@foxitsoftware/foxit-pdf-sdk-for-web-library 8.3.0 → 8.3.0--

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.
@@ -279,5 +279,5 @@ e.defineLocale("zh-hk",{months:"一月_二月_三月_四月_五月_六月_七月
279
279
  //! moment.js locale configuration
280
280
  e.defineLocale("zh-mo",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"D/M/YYYY",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var r=100*e+t;return r<600?"凌晨":r<900?"早上":r<1130?"上午":r<1230?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n(0))},function(e,t,n){!function(e){"use strict";
281
281
  //! moment.js locale configuration
282
- e.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var r=100*e+t;return r<600?"凌晨":r<900?"早上":r<1130?"上午":r<1230?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n(0))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=p(n(642)),a=p(n(643)),s=p(n(127)),u=p(n(37)),c=n(22),d=p(n(176)),l=(n(3),p(n(644))),f=p(n(645)),h=p(n(646));function p(e){return e&&e.__esModule?e:{default:e}}function m(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var g=void 0,y=(Promise.resolve(),{1:{font:null,fontSize:16,charSpace:0,wordSpace:0,fontIsItalic:!1,fontIsBold:!1,fillColor:4278190080,strokeColor:4278190080,opacity:1},2:{strokeColor:4278190080,fillColor:4278190080,opacity:1}}),_=new h.default,v=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),g=t,this.doc=n,this.editPages={},this.oldEditPages={},this.scales={},this.lastUpdate=0,this.lastRButtonUpArgs=null,this.popMenuAction=null,this.clipBoardManager=new f.default(this,t),this.undoManager=new l.default(this,t),this.modifiedPage={},this.editingFontName="Helvetica"}return e.prototype.init=function(e){var t=this.scales.dpr||1;return e.SetSystemDPI(96*t,96*t),this.PE=new g.PageEditor(e),this},e.prototype.updateMatrix=function(e){Object.assign(this.scales,e)},e.prototype.handle=function(e,t){var n,r=this,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],d=(0,c.getJRArgs)(g,this,u,g.EditorPage),l={};switch(this.lastEditorPage&&(this.modifiedPage[this.lastEditorPage.GetPage().GetIndex()]=1),"OnKeyDown"==e&&(17==u[0]&&(this.controlDown=!0),16==u[0]&&(this.shiftDown=!0)),"OnKeyUp"==e&&(17==u[0]&&(this.controlDown=!1),16==u[0]&&(this.shiftDown=!1)),e){case"Undo":this.undoManager.undo(u[0],u[1]);break;case"Render":var f=d[0];if(f&&(this.lastEditorPage=f),!this.lastEditorPage)return{};var h=this.scales.uiRect,p=this.scales.dpr||1,v={width:h.width*p,height:h.height*p};return s.default.render((function(e){return r.PE.Render(e)}),this.lastEditorPage.GetPage(),v);case"OnChar":for(var b=0;b<u[0].length;b++){var S=u[0].charCodeAt(b);this.PE.OnChar(S,u[1]||0)}break;case"OnHitObjectTest":this.PE[e].apply(this.PE,d),d.push(0),this.PE.OnMouseMove.apply(this.PE,d);break;case"GetGraphicsObjectUtils":var w=this.PE.GetGraphicsObjectUtils();return(0,i.default)(g,w,this.PE);case"GetSelection":for(var M=this.PE.GetSelection(),D=[],P=0;P<M.GetSize();P++){M.GetAt(P);D.push({})}return D;case"GetGraphicsObjectEditor":var T=this.PE.GetGraphicsObjectEditor();return(0,a.default)(g,T);case"OnRButtonUp":this.lastRButtonUpArgs=d,this.PE.OnRButtonUp.apply(this.PE,d);break;case"Paste":2===u.length&&this.clipBoardManager.setPastePos(u[0],u[1]),this.PE.Paste(),l=this.lastEditorPage.GetPage().GetIndex();break;case"CreateImage":(l=(n=this.PE).CreateImage.apply(n,m(d)))&&(l=this.lastEditorPage.GetPage().GetIndex());break;case"getDefaultProperty":1===u[0]?((l=o({},y[u[0]])).fontName=_.getDefaultFontName(),delete l.font):l=y[u[0]]||{};break;case"StartEdit":d=[];default:l=this.PE[e].apply(this.PE,d);break;case"ChangeLanguage":this.strings=d[0]}return l},e.prototype.changePEProperty=function(e,t,n){var r=this.PE.GetGraphicsObjectUtils(),o=void 0;switch(n=Array.isArray(n)?n:[n],n=(0,c.getJRArgs)(g,this,n,g.EditorPage),this.lastEditorPage&&(this.modifiedPage[this.lastEditorPage.GetPage().GetIndex()]=1),e){case 0:o=r[t].apply(r,n);break;case 1:var i=new g.TextObjectUtils(r);switch(t){case"SetFont":var a=new g.WString(n[0]),s=n[1],u=n[2];this.undoManager.aggregateUndo(2),i.SetFont(a,s,u,g.FontOperationType.e_FontOperationTypeBold),o=i.SetFont(a,s,u,g.FontOperationType.e_FontOperationTypeItatic);break;default:o=i[t].apply(i,n)}break;case 2:var d=new g.PathObjectUtils(r);o=d[t].apply(d,n);break;case 3:o=r[t].apply(r,n);break;case 4:var l=new g.ShadingObjectUtils(r);if(n=(0,c.getJRArgs)(g,this,n,g.EditorPage),"RenderGridient"==t){l.SetGradientCurrentInfo(l.GetGradientColor());var f=n[0]+"-"+n[1],h=bitmaps[f]||(bitmaps[f]=new g.Bitmap(n[0],n[1],g.DIBFormat.e_DIBArgb,0,0));h.FillRect(4294967295,null);var p=new g.Renderer(h,!0);l.RenderGridient(p);var m=getBitmapBuffer(g,0,h,p);return m.left=0,m.top=0,m}o=l[t].apply(l,n)}var y=this.lastEditorPage.GetPage();return y.GenerateContent(),this.updateView(!0),[y.GetIndex(),o]},e.prototype.changeEditingProperty=function(e,t){var n=this.PE.GetGraphicsObjectEditor();if(this.lastEditorPage&&(this.modifiedPage[this.lastEditorPage.GetPage().GetIndex()]=1),"IsEmpty"===e)return n.IsEmpty();switch(n.GetType().value){case 2:n=new g.TextEditor(n),"OnWritingDirectionChanged"==e?t[0]=g.WritingDirection.values[t[0]]:"OnFontNameChanged"===e&&(this.editingFontName=t[0],t[0]=new g.WString(t[0]));break;case 3:break;case 4:n=new g.PathEditor(n);break;case 5:n=new g.ShadingEditor(n)}return n[e].apply(n,t)},e.prototype.triggerPopMenuAction=function(e){var t=this;this.popMenuAction=e,this.PE.OnRButtonUp.apply(this.PE,this.lastRButtonUpArgs),setTimeout((function(){t.updateView(!0)}))},e.prototype.updateView=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.scales&&!this.lastEditorPage.isDeleted()){var n=this.lastEditorPage.GetPage(),r=(n.GetIndex(),this.scales.uiRect),o=this.scales.dpr||1,i={width:r.width*o,height:r.height*o},a=s.default.render((function(t){return e.PE.Render(t)}),n,i);postMessage({workflow:"out",type:"updateView",msg:{bitmapInfo:a,redraw:t}})}},e.prototype.destroy=function(){var e=this;for(var t in this.editPages){this.editPages[t].delete()}for(var n in this.oldEditPages){this.oldEditPages[n].delete()}this.clipBoardManager.destroy(),this.undoManager.destroy(),_.destroy(),["doc","editPages","scales","updateType","lastUpdate","lastRButtonUpArgs","popMenuAction","clipBoardManager","editRedos","editUndos","undos","redos"].forEach((function(t){return e[t]=[]}))},e.prototype.generateContent=function(){for(var e in this.editPages){this.editPages[e].GetPage().GenerateContent()}},e.prototype.TrackPopupMenu=function(e,t,n,o){if(null!==this.popMenuAction){var s=this.popMenuAction;return this.popMenuAction=null,s}var u=this.PE.GetGraphicsObjectUtils(),c=this.PE.GetGraphicsObjectEditor(),d={},l=o.GetPage().GetIndex(),f=r(this.scales[l],4);f[0],f[1],f[2],f[3];d.activeObject=(0,i.default)(g,u,this.PE)||null,d.editingObject=(0,a.default)(g,c)||{};var h=this.scales.dpr||1;return d.position={x:t/h,y:n/h},d.menu=e,d.pageIndex=l,postMessage({workflow:"out",type:"showPopupMenu",msg:d}),-1>>>0},e.prototype.GetPageViewScale=function(e){var t=e.GetPage().GetIndex();return this.scales[t][0]},e.prototype.OnInvalid=function(e,t){this.updateView()},e.prototype.GetRenderMatrix=function(e){var t=new g.Matrix,n=e.GetPage();if(n.IsEmpty())return t;var o=this.scales[n.GetIndex()];if(!o)return t;var i=r(o,4),a=(i[0],i[1],i[2]);i[3];t.Set(a.a,a.b,a.c,a.d,0|a.e,0|a.f);var s=this.scales.dpr||1;return t.Scale(s,s,!1),t},e.prototype.GetPageVisibleRect=function(e){var t=e.GetPage(),n=this.scales[t.GetIndex()],o=new g.CFX_FloatRect;if(!n)return o;var i=r(n,4),a=(i[0],i[1],i[2],i[3]);return o.left=a.left,o.top=a.top,o.right=a.right,o.bottom=a.bottom,o},e.prototype.GetRect=function(e){var t=e.GetPage(),n=r(this.scales[t.GetIndex()],4),o=(n[0],n[1],n[2],n[3]),i=new g.CFX_FloatRect;return i.left=o.left,i.top=o.top,i.right=o.right,i.bottom=o.bottom,i},e.prototype.GetDefaultEditorPage=function(){if(!this.lastEditorPage){var e=this.scales.visibleIndexes[0];this.editPages[e]?this.lastEditorPage=this.editPages[e]:this.lastEditorPage=g.EditorPage.Create(this.doc.pageIndexMap[e].page,100)}return this.lastEditorPage},e.prototype.GetClientRect=function(){var e=this.scales.uiRect,t=this.scales.dpr||1,n=new g.CFX_FloatRect;return n.left=0,n.top=0,n.right=e.width*t,n.bottom=e.height*t,n},e.prototype.OnSetPropsAsDefault=function(e,t){var n=this.PE.GetGraphicsObjectUtils(),r=(0,i.default)(g,n,this.PE);if(1===e.value){var o=void 0;try{o=t.GetAt(0).GetGraphicsObject().GetTextObject().GetTextState(this.lastEditorPage.GetPage()).font}catch(e){o=new g.Font(g.StandardID.e_StdIDHelvetica)}_.setDefaultFont(o,this.doc.doc)}y[e.value]=r},e.prototype.OnExitEdit=function(e,t){var n=this;return setTimeout((function(){n.generateContent()})),postMessage({workflow:"out",type:"exitEdit",msg:t.value}),!1},e.prototype.GetTemplate=function(e,t){if(t){var n=g.getPEGraphic(t),r=n.GetType();if(r==g.GraphicsObjectType.e_TypeText){var o=n.GetTextObject(),i=y[1],a=new g.TextState;a.font=_.getDefaultFont(g),a.font_size=i.fontSize,a.charspace=i.charSpace,a.wordspace=i.wordSpace,a.textmode=g.Mode.e_ModeFill,a.origin_position.x=0,a.origin_position.y=0,a.SetMatrixA(1),a.SetMatrixB(0),a.SetMatrixC(0),a.SetMatrixD(1);var s=e.GetPage(),u=this.scales[s.GetIndex()][1]/90;switch(4-(s.GetRotation().value+u)%4){case 1:a.SetMatrixA(0),a.SetMatrixB(-1),a.SetMatrixC(1),a.SetMatrixD(0);break;case 2:a.SetMatrixA(-1),a.SetMatrixB(0),a.SetMatrixC(0),a.SetMatrixD(-1);break;case 3:a.SetMatrixA(0),a.SetMatrixB(1),a.SetMatrixC(-1),a.SetMatrixD(0)}o.SetTextState(e.GetPage(),a,i.fontIsItalic,i.fontIsBold?550:400),o.SetFillColor(i.fillColor),o.SetStrokeColor(i.strokeColor),o.SetFillOpacity(i.opacity),o.SetStrokeOpacity(i.opacity)}else if(r==g.GraphicsObjectType.e_TypePath){var c=n.GetPathObject(),d=y[2];d&&(c.SetStrokeState(0!==d.strokeColor),c.SetStrokeColor(d.strokeColor),c.SetFillColor(d.fillColor),c.SetFillOpacity(0==d.fillColor?0:1),c.SetStrokeOpacity(d.opacity))}}},e.prototype.GetLatestPDFPage=function(e,t){return this.doc.doc.GetPage(t)},e.prototype.GetToolbarFontName=function(){return new g.WString(this.editingFontName)},e.prototype.GetString=function(e){return new g.WString(this.strings[e.value]||"")},e.prototype.IsShiftKeyDown=function(){return this.shiftDown},e.prototype.IsControlKeyDown=function(){return this.controlDown},e}();t.default=function(e,t){if(e.pageEditor)return e.pageEditor;s.default.setGSDK(e.engine);var n=e.pageEditor=new v(e.engine,e),r=n.clipBoardManager,o=n.undoManager;g=e.engine;var i={};return["CopyGraphicObject","PasteGraphicObject","CanPasteGraphicObject"].forEach((function(e){return i[e]=r[e].bind(r)})),["OnAddUndo","OnUndoRedoBeginEdit","OnUndoRedoEndEdit"].forEach((function(e){return i[e]=o[e].bind(o)})),["GetDefaultEditorPage","GetRenderMatrix","GetClientRect","GetPageVisibleRect","GetPageViewScale","OnInvalid","TrackPopupMenu","OnSetPropsAsDefault","GetTemplate","GetLatestPDFPage","GetToolbarFontName","GetString","OnExitEdit","IsShiftKeyDown","IsControlKeyDown"].forEach((function(e){return i[e]=n[e].bind(n)})),i.GetPageRect=n.GetPageVisibleRect.bind(n),i.OnInvalid=(0,d.default)(n.OnInvalid.bind(n)),n.init(e.JR.getEditorContext(i,t.map((function(t){var n=e.JR.requestData("GET",!1,t);return u.default.createImage(e.engine,n).GetFrameBitmap(0)})))),e.beforeSave((function(t){e.pageEditor.PE.EndEdit(),e.pageEditor.generateContent()})),e.addDestroyHook((function(t){return e.pageEditor.destroy()})),n}},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";var r=n(26);function o(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(r.isURLSearchParams(t))i=t.toString();else{var a=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),a.push(o(t)+"="+o(e))})))})),i=a.join("&")}if(i){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,n){"use strict";var r=n(26),o=n(655),i=n(656),a=n(366),s=n(657),u=n(660),c=n(661),d=n(369);e.exports=function(e){return new Promise((function(t,n){var l=e.data,f=e.headers,h=e.responseType;r.isFormData(l)&&delete f["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var m=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";f.Authorization="Basic "+btoa(m+":"+g)}var y=s(e.baseURL,e.url);function _(){if(p){var r="getAllResponseHeaders"in p?u(p.getAllResponseHeaders()):null,i={data:h&&"text"!==h&&"json"!==h?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:r,config:e,request:p};o(t,n,i),p=null}}if(p.open(e.method.toUpperCase(),a(y,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,"onloadend"in p?p.onloadend=_:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(_)},p.onabort=function(){p&&(n(d("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){n(d("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(d(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",p)),p=null},r.isStandardBrowserEnv()){var v=(e.withCredentials||c(y))&&e.xsrfCookieName?i.read(e.xsrfCookieName):void 0;v&&(f[e.xsrfHeaderName]=v)}"setRequestHeader"in p&&r.forEach(f,(function(e,t){void 0===l&&"content-type"===t.toLowerCase()?delete f[t]:p.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),h&&"json"!==h&&(p.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),n(e),p=null)})),l||(l=null),p.send(l)}))}},function(e,t,n){"use strict";var r=n(367);e.exports=function(e,t,n,o,i){var a=new Error(e);return r(a,t,n,o,i)}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";var r=n(26);e.exports=function(e,t){t=t||{};var n={},o=["url","method","data"],i=["headers","auth","proxy","params"],a=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],s=["validateStatus"];function u(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function c(o){r.isUndefined(t[o])?r.isUndefined(e[o])||(n[o]=u(void 0,e[o])):n[o]=u(e[o],t[o])}r.forEach(o,(function(e){r.isUndefined(t[e])||(n[e]=u(void 0,t[e]))})),r.forEach(i,c),r.forEach(a,(function(o){r.isUndefined(t[o])?r.isUndefined(e[o])||(n[o]=u(void 0,e[o])):n[o]=u(void 0,t[o])})),r.forEach(s,(function(r){r in t?n[r]=u(e[r],t[r]):r in e&&(n[r]=u(void 0,e[r]))}));var d=o.concat(i).concat(a).concat(s),l=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===d.indexOf(e)}));return r.forEach(l,c),n}},function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setCustomWatermarkFontMap=t.setCustomFontMap=t.getCharRange=t.prefetchCache=t.getCharsetFromName=t.getGlyphMatch=t.getWatermarkFontFilesPos=t.getWatermarkFontFileBuffer=t.getThirdPartyFontBuffer=void 0;var r=a(n(165)),o=a(n(671)),i=a(n(107));function a(e){return e&&e.__esModule?e:{default:e}}var s=new i.default("fontLib","FoxitPDFSDKForWeb_fontLib"),u=[];u=u.concat(u,[{nameMatches:[/verdana/,/franklingothic/,/segoeui/,/sylfaen/,/tahoma/,/couriernew/,/lucidasansunicode/,/calibri/,/cambria/,/candara/,/comicsansms/,/consolas/,/constantia/,/corbel/,/gabriola/,/georgia/,/impact/,/lucidaconsole/,/microsoftsansserif/,/msrefrencesansserif/,/palatinolinotype/,/segoeprint/,/segoescript/,/trebuchetms/,/notosansbold/],charsets:[0,204,238],charRange:/[\u0000-\u00ff]/,glyphs:[{bold:-1,flags:64,url:"NotoSans-BoldItalic.ttf"},{bold:496,flags:-1,url:"NotoSans-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSans-Regular.ttf"}]},{nameMatches:[/(stsonglight)/,/(notosanstclight)/],charsets:[134],charRange:/[\u0000-\u007f\uB0A1-\uF7FE\u8140-\uA0FE\uAA40-\uFEA0\uA996\uA1A1-\uA9FE\uA840-\uA9A0\uAAA1-\uAFFE\uF8A1-\uFEFE\uA140-\uA7A0\u2E80-\u303F\u31C0-\u4DBF\u4E00-\u9FBF\uFF00-\uFFEF]/,glyphs:[{bold:7,flags:-1,url:"NotoSansTCLight.ttf"}]},{nameMatches:[/(youyuan)|(simhei)|(simsun)|(song)|(仿宋)|(黑体)|(宋体)/,/(notosansmonocjksc)/],charsets:[134],charRange:/[\u0000-\u007f\u8140-\uA0FE\uA996\uA1A1-\uA9FE\uA840-\uA9A0\uF8A1-\uFEFE\uA140-\uA7A0\u200F-\u2027\u2E80-\u303F\u31C0-\u4DBF\u4E00-\u9FBF\uFF00-\uFFEF]/,glyphs:[{bold:-1,flags:-1,url:"NotoSansMonoCJKsc-Regular.otf"}]},{nameMatches:[/(simhei)|(simsun)|(simsunextb)|(kaiti)|(方正)|(仿宋)|(黑体)|(华文)|(楷体)|(隶书)|(宋体)|(微软雅黑)|(新宋体)|(幼圆)/,/(notosanssc)|(notosanscjksc)/],charsets:[134],charRange:/[\u0000-\u007f\u8140-\uA0FE\uA996\uA1A1-\uA9FE\uA840-\uA9A0\uF8A1-\uFEFE\uA140-\uA7A0\u200F-\u2027\u2E80-\u303F\u31C0-\u4DBF\u4E00-\u9FBF\uFF00-\uFFEF]/,glyphs:[{bold:-1,flags:1,url:"NotoSansMonoCJKsc-Regular.otf"},{bold:1,flags:-1,url:"NotoSansSC-Thin.otf"},{bold:2,flags:-1,url:"NotoSansSC-Light.otf"},{bold:4,flags:-1,url:"NotoSansSC-DemiLight.otf"},{bold:48,flags:-1,url:"NotoSansSC-Medium.otf"},{bold:129,flags:-1,url:"NotoSansSC-Bold.otf"},{bold:256,flags:-1,url:"NotoSansSC-Black.otf"},{bold:-1,flags:-1,url:"NotoSansSC-Regular.otf"}]},{nameMatches:[/(meiryo)|(meiryoui)|(msgothic)|(msmincho)|(mspgothic)|(mspmincho)|(uigothic)/,/(notosanscjkjp)|(notosansmonocjkjp)/],charsets:[128],charRange:/[\u0000-\u007f\u2E80-\u4DBF\u4E00-\u9FBF\uF900-\uFAFF\uFE30-\uFE4F]/,glyphs:[{bold:-1,flags:1,url:"NotoSansMonoCJKjp-Regular.otf"},{bold:1,flags:-1,url:"NotoSansCJKjp-Thin.otf"},{bold:2,flags:-1,url:"NotoSansCJKjp-Light.otf"},{bold:4,flags:-1,url:"NotoSansCJKjp-DemiLight.otf"},{bold:496,flags:-1,url:"NotoSansCJKjp-Medium.otf"},{bold:-1,flags:-1,url:"NotoSansCJKjp-Regular.otf"}]},{nameMatches:[/(korean)/,/(notosanscjkkr)|(notosansmonocjkkr)/],charsets:[129],charRange:/[\u0000-\u007f\u1100-\u11FF\u3130-\u318F\uAC00-\uD7AF\uFF00-\uFFEF\u2E80-\u303F\u31C0-\u4DBF\u4E00-\u9FBF\uF900-\uFAFF\uFE30-\uFE4F]/,glyphs:[{bold:-1,flags:1,url:"NotoSansMonoCJKkr-Regular.otf"},{bold:1,flags:-1,url:"NotoSansCJKkr-Thin.otf"},{bold:2,flags:-1,url:"NotoSansCJKkr-Light.otf"},{bold:4,flags:-1,url:"NotoSansCJKkr-DemiLight.otf"},{bold:496,flags:-1,url:"NotoSansCJKkr-Medium.otf"},{bold:-1,flags:-1,url:"NotoSansCJKkr-Regular.otf"}]},{nameMatches:[/(dfkaisb)|(microsoftjhenghei)|(mingliu)|(mingliuhkscs)|(mingliuhkscsextb)|(mingliuextb)|(pmingliu)|(pmingliuextb)/,/(notosanscjktcdemilight)|(notosanscjktclight)|(notosanscjktcmedium)|(notosanscjktcthin)|(notosansmonocjktcregular)/],charsets:[136],charRange:/[\u4E00-\uA0FE\uA140-\uA3BF\uA259-\uA261\uA3C0-\uA3FE\u2E80-\u303F\u31C0-\u4DBF\uFF00-\uFFEF]/,glyphs:[{bold:-1,flags:1,url:"NotoSansMonoCJKtc-Regular.otf"},{bold:1,flags:-1,url:"NotoSansCJKtc-Thin.otf"},{bold:2,flags:-1,url:"NotoSansCJKtc-Light.otf"},{bold:4,flags:-1,url:"NotoSansCJKtc-DemiLight.otf"},{bold:496,flags:-1,url:"NotoSansCJKtc-Medium.otf"},{bold:-1,flags:-1,url:"NotoSansMonoCJKtc-Regular.otf"}]},{nameMatches:[/(arabic)|(andalus)|(arabictypesetting)|(sakkalmajalla)|(simplifiedarabic)|(simplifiedarabicfixed)|(traditionalarabic)/,/(notonaskharabicbold)|(notonaskharabic)/],charsets:[178],charRange:/[\u0000-\u007f\u0600-\u06FF\u0750-\u077F\uFB50-\uFDFF\uFE70-\uFEFF]/,glyphs:[{bold:496,flags:-1,url:"NotoNaskhArabic-Bold.ttf"},{bold:-1,flags:-1,url:"NotoNaskhArabic-Regular.ttf"}]},{nameMatches:[/(angsananew)|(angsanaupc)|(browallianew)|(browalliaupc)|(cordianew)|(cordiaupc)|(eucrosiaupc)|(freesiaupc)|(irisupc)|(jasmineupc)|(kodchiangupc)|(leelawadee)|(lilyupc)|(thonburi)/,/(notosansthaibold)|(notosansthai)|(notoserifthaibold)|(notoserifthai)/],charsets:[222],charRange:/[\u0E00-\u0E7F]/,glyphs:[{bold:496,flags:2,url:"NotoSerifThai-Bold.ttf"},{bold:-1,flags:2,url:"NotoSerifThai-Regular.ttf"},{bold:496,flags:-1,url:"NotoSansThai-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansThai-Regular.ttf"}]},{nameMatches:[/(aharoni)|(david)|(frankruehl)|(gisha)|(levenimmt)|(miriam)|(narkism)|(rod)/,/(notosanshebrewbold)|(notosanshebrew)/],charsets:[177],charRange:/[\u0590-\u05FF]/,glyphs:[{bold:496,flags:-1,url:"NotoSansHebrew-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansHebrew-Regular.ttf"}]},{nameMatches:[/(daunpenh)|(khmer)|(moolboran)/,/(notosanskhmerbold)|(notosanskhmer)|(notoserifkhmerbold)|(notoserifkhmer)/],charsets:[1],charRange:/[\u1780-\u17FF\u19E0-\u19FF]/,glyphs:[{bold:496,flags:2,url:"NotoSerifKhmer-Bold.ttf"},{bold:-1,flags:2,url:"NotoSerifKhmer-Regular.ttf"},{bold:496,flags:-1,url:"NotoSansKhmer-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansKhmer-Regular.ttf"}]},{nameMatches:[/(dokchampa)|(lao)/,/(notosanslaobold)|(notosanslao)|(notoseriflaobold)|(notoseriflao)/],charsets:[1],charRange:/[\u0E80-\u0EFF]/,glyphs:[{bold:496,flags:2,url:"NotoSerifLao-Bold.ttf"},{bold:-1,flags:2,url:"NotoSerifLao-Regular.ttf"},{bold:496,flags:-1,url:"NotoSansLao-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansLao-Regular.ttf"}]},{nameMatches:[/(vani)|(gautami)/,/(notosanstelugubold)|(notosanstelugu)/],charsets:[1],charRange:/[\u0C00-\u0C7F]/,glyphs:[{bold:496,flags:-1,url:"NotoSansTelugu-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansTelugu-Regular.ttf"}]},{nameMatches:[/(latha)|(vijaya)/,/(notosanstamilbold)|(notosanstamil)/],charsets:[1],charRange:/[\u0C00-\u0C7F]/,glyphs:[{bold:496,flags:-1,url:"NotoSansTamil-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansTamil-Regular.ttf"}]},{nameMatches:[/(moboli)|(mvboli)/,/(notosansthaanabold)|(notosansthaana)/],charsets:[1],charRange:/[\u0780-\u07BF]/,glyphs:[{bold:496,flags:-1,url:"NotoSansThaana-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansThaana-Regular.ttf"}]},{nameMatches:[/(taile)|(microsofttaile)/,/(notosanstaile)/],charsets:[1],charRange:/[\u1950-\u197F]/,glyphs:[{bold:-1,flags:-1,url:"NotoSansTaiLe-Regular.ttf"}]},{nameMatches:[/(estrangeloedessa)/,/(notosanssyriaceastern)/],charsets:[1],charRange:/[\u0700-\u074F]/,glyphs:[{bold:-1,flags:-1,url:"NotoSansSyriacEastern-Regular.ttf"}]},{nameMatches:[/(iskoolapota)/,/(notosanssinhalabold)|(notosanssinhala)/],charsets:[1],charRange:/[\u0D80-\u0DFF]/,glyphs:[{bold:496,flags:-1,url:"NotoSansSinhala-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansSinhala-Regular.ttf"}]},{nameMatches:[/(himalaya)|(microsofthimalaya)/,/(notosanstibetanbold)|(notosanstibetan)/],charsets:[1],charRange:/[\u0F00-\u0FFF]/,glyphs:[{bold:496,flags:-1,url:"NotoSansTibetan-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansTibetan-Regular.ttf"}]},{nameMatches:[/(phagspa)|(microsoftphagspa)/,/(notosansphagspa)/],charsets:[1],charRange:/[\uA840-\uA87F]/,glyphs:[{bold:-1,flags:-1,url:"NotoSansPhagsPa-Regular.ttf"}]},{nameMatches:[/(euphemia)|(gadugi)/,/(notosanscanadianaboriginal)/],charsets:[1],charRange:/[\u1400-\u167F\u18B0-\u18FF]/,glyphs:[{bold:-1,flags:-1,url:"NotoSansCanadianAboriginal-Regular.ttf"}]},{nameMatches:[/(plantagenetcherokee)|(notosanscherokee)/],charsets:[1],charRange:/[\u13A0-\u13FF]/,glyphs:[{bold:-1,flags:-1,url:"NotoSansCherokee-Regular.ttf"}]},{nameMatches:[/(nyala)|(ebrima)|(notosansethiopicbold)|(notosansethiopic)/],charsets:[1],charRange:/[\u1200-\u139F\u2D80-\u2DDF\uAB00-\uAB5F]/,glyphs:[{bold:496,flags:-1,url:"NotoSansEthiopic-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansEthiopic-Regular.ttf"}]},{nameMatches:[/(shruti)|(notosansgujaratibold)|(notosansgujarati)/],charsets:[1],charRange:/[\u0A80-\u0AFF]/,glyphs:[{bold:496,flags:-1,url:"NotoSansGujarati-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansGujarati-Regular.ttf"}]},{nameMatches:[/(mongolian)|(mongolianbaiti)|(notosansmongolian)/],charsets:[1],charRange:/[\u1800-\u18AF]/,glyphs:[{bold:-1,flags:-1,url:"NotoSansMongolian-Regular.ttf"}]},{nameMatches:[/(nirmalaui)|(notosansgujarati)/],charsets:[1],charRange:/[\u0A80-\u0E7F]/,glyphs:[{bold:-1,flags:-1,url:"NotoNirmalaui-Regular.ttf"}]},{nameMatches:[/(microsoftyibati)|(yi\b)|(notosansyi)/],charsets:[1],charRange:/[]/,glyphs:[{bold:-1,flags:-1,url:"NotoSansYi-Regular.ttf"}]},{nameMatches:[/notosans/],charsets:[0,204,238],charRange:/[\u0000-\u00ff]/,glyphs:[{bold:-1,flags:-1,url:"NotoSans-Regular.ttf"}]}]);var c=[],d=[],l={extralight:100,light:200,normal:300,regular:400,medium:500,bold:700,heavy:900,black:900,thin:100},f={},h={},p={},m={},g={};function y(e,t,n,r,o){if(e){var i=function(e,t,n,r,o){return[e,t,n,r,o].join("-")}(e,t,n,r,o),a=f[i];if(a)return[a,h[i],p[i]];(n=function(e,t,n){return t||64&n||/(italic)|(oblique)/.test(e.toLowerCase())}(e,n,o))&&(o|=64);for(var s=function(e){return 1<<e%100-1}(function(e,t){for(var n in e=e.toLowerCase(),l)if(e.indexOf(n))return l[n];return l[t]||(t%100?t:t>400?700:400)}(e,r)),c=e,m=0,g=d.length;m<g;m++){var y=d[m];if(v(c,y))for(var b=y.glyphs||[],S=0,w=b.length;S<w;S++){var M=b[S],D=M.bold||-1,P=M.flags||-1;if(s&D&&(-1===P||(o&P)===P))return f[i]=M,h[i]=y,p[i]=1,[M,y,1]}}c=_(e=e.toLowerCase());for(var T=0,k=u.length;T<k;T++){var A=u[T];if(v(c,A))for(var L=A.glyphs||[],F=0,I=L.length;F<I;F++){var x=L[F],C=x.bold||-1,R=x.flags||-1;if(s&C&&(-1===R||(o&R)===R))return f[i]=x,h[i]=A,[x,A]}}if(t>1){for(var O=0,G=d.length;O<G;O++){var E=d[O];if(E.charsets&&-1!==E.charsets.indexOf(t))for(var Y=E.glyphs||[],j=0,N=Y.length;j<N;j++){var B=Y[j],H=B.bold||-1,W=B.flags||-1;if(s&H&&(-1===W||(o&W)===W))return f[i]=B,h[i]=E,p[i]=1,[B,E,1]}}for(var U=0,z=u.length;U<z;U++){var J=u[U];if(-1!==J.charsets.indexOf(t))for(var V=J.glyphs||[],K=0,q=V.length;K<q;K++){var Z=V[K],X=Z.bold||-1,Q=Z.flags||-1;if(s&X&&(-1===Q||(o&Q)===Q))return f[i]=Z,h[i]=J,[Z,J]}}}}}function _(e){return e.replace(/,/g,"").replace(/-/g,"").replace(/\s/g,"").toLowerCase()}function v(e,t){for(var n=t.nameMatches||[],r=0,o=n.length;r<o;r++)if(new RegExp(n[r]).test(e))return!0;return!1}function b(e,t){var n;if(n=m[e])return n;var o=new XMLHttpRequest;o.open("get",e,!1),o.responseType="arraybuffer",o.send();var i=o.status,a=o.response;return i>=200&&i<300||304===i&&a instanceof ArrayBuffer?(t&&(a=(0,r.default)(new Uint8Array(a))),s.set(e,a).then((function(){s.get("fontName").then((function(t){(t=t||{})[e]=1,s.set("fontName",t).catch((function(){}))}))}),(function(){})),m[e]=a):null}t.getThirdPartyFontBuffer=function(e,t,n,i,a,u){var c=y(t,n,i,a,u);if(!c)return null;var d=c[0],l=d.url;return c[2]?b(l,d.isBrotli):function(e,t){var n=void 0;if(n=m[t])return n;var i=e+"/"+t+".brotli?h="+o.default[t];if(n=g[i])return n;var a=new XMLHttpRequest;a.open("get",i,!1),a.responseType="arraybuffer",a.send();var u=a.status,c=a.response;return u>=200&&u<300||304===u&&c instanceof ArrayBuffer?(c=(0,r.default)(new Uint8Array(c)),s.set(i,c).then((function(){s.get("fontName").then((function(e){(e=e||{})[i]=1,s.set("fontName",e).catch((function(){}))}),(function(){}))}),(function(){})),m[t]=c):null}(e,l)},t.getWatermarkFontFileBuffer=function(e){var t=c[e-1];return t?b(t.url,t.isBrotli):null},t.getWatermarkFontFilesPos=function(e){return 0===c.length?0:(e+1)%(c.length+1)},t.getGlyphMatch=y,t.getCharsetFromName=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t&&(e=_(e));for(var n=[],r=0,o=(n=n.concat(d).concat(u)).length;r<o;r++){var i=n[r];if(v(e,i)){var a=i.charsets||[0];return a[0]}}return-1},t.prefetchCache=function(){s.get("fontName").then((function(e){if(e)for(var t=Object.keys(e),n=t.length;n--;)!function(e){s.get(e).then((function(t){t&&(g[e]=t)}),(function(){}))}(t[n])}),(function(){}))},t.getCharRange=function(e,t,n,r,o){var i=y(e,t,n,r,o);if(i)return i[1].charRange},t.setCustomFontMap=function(e){e&&(d=e)},t.setCustomWatermarkFontMap=function(e){e&&(c=e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAA=void 0;var r,o=n(3),i=n(38),a=(r=i)&&r.__esModule?r:{default:r};t.getAA=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:7,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:17,s=e.engine,u={},c=n.GetElement((0,o.CString)(s,"AA"));if(c&&c.GetDict()){for(var d=c.GetDict(),l=new s.AdditionalAction(t,d),f=s.TriggerEvent,h=r;h<i;h++){var p=l.GetAction(f.values[h]);p.IsEmpty()||(u[h]=e.actionManager.get(p,t,e).toJson())}(0,a.default)(l)}return u}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.getArrayBufferFrom=function(e,t,n){var r=e.HEAPU8.buffer;return r.slice?r.slice(t,t+n):new Uint8Array(r,t,n).buffer}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(87);function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function a(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var s=function(e){function t(n,r,o,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(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}(this,e.call(this,n,r,o,i));if(a.matrix=n.GetMatrix(),!a.isParentPage()){var s=a.parent.getMatrix();a.matrix.Concat(s,!1)}return a.graphicsObject=n.GetFormXObject(),a}return a(t,e),t.prototype.getMatrix=function(){return this.matrix},t.prototype.getGraphicsObjectsInRect=function(e,t,n){for(var r=this.graphicsObject.GetGraphicsObjects(),o=this.engine.GraphicsObjectType.e_TypeAll,a=[],s=r.GetFirstGraphicsObjectPosition(o);s;){var u=r.GetGraphicsObject(s),c=u.GetRect();if(this.matrix.TransformRect(c),e.Contains(c)){var d=n.get(u,this.c_page,this),l=d.getType();if(t!=l&&0!=t&&5!=l);else{if(0==t&&targetType<4)a.push(element);else if(0==t&&targetType>3)continue;l===t?a.push(d):5===l&&a.push.apply(a,i(d.getGraphicsObjectsInRect(e,t,n)))}}s=r.GetNextGraphicsObjectPosition(s,o)}return a},t.prototype.getGraphicsObjectAtPoint=function(e,t,n,r){for(var o=this.graphicsObject.GetGraphicsObjects(),i=this.engine.GraphicsObjectType.e_TypeAll,a=o.GetFirstGraphicsObjectPosition(i);a;){var s=o.GetGraphicsObject(a),u=s.GetRect();if(this.matrix.TransformRect(u),u.Contains(e,t)){var c=r.get(s,this.c_page,this),d=s.GetType().value;if(d===n)return c;if(5===d)return c.getGraphicsObjectAtPoint(e,t,n,r)}a=o.GetNextGraphicsObjectPosition(a,i)}return null},t.prototype.getGraphicsObjectsAtPoint=function(e,t,n,r,o){for(var i=[],a=this.graphicsObject.GetGraphicsObjects(),s=this.engine.GraphicsObjectType.e_TypeAll,u=a.GetFirstGraphicsObjectPosition(s);u;){var c=a.GetGraphicsObject(u),d=c.GetRect();if(this.matrix.TransformRect(d),d.Contains(e,t)){var l=o.get(c,this.c_page,this),f=c.GetType().value;5===f?i=i.concat(l.getGraphicsObjectsAtPoint(e,t,n,r,o)):f!==n&&0!=n||i.push(l)}u=a.GetNextGraphicsObjectPosition(u,s)}return i},t.prototype.toJson=function(){return null},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=s},function(e,t,n){"use strict";e.exports={wasmHash:"3b082388733851af09586f37d4760285",jsHash:"f727ab0236a725d959b047a622f20b77",asmMemHash:"4e0e29b0927516e7f4fd38eb4bae6ee6",asmJSHash:"2ad01594f11946b067008cd931dcc870"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=function(){return i};var o=navigator.userAgent.toLowerCase(),i=!1,a=o.indexOf("safari")>-1&&-1==o.indexOf("chrome");i=!(!(i=!(a&&parseFloat(o.match(/ applewebkit\/(\d+)/)[1])<607))||"object"!=("undefined"==typeof WebAssembly?"undefined":r(WebAssembly)))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=i(n(721)),o=(i(n(380)),i(n(168)),n(167));function i(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 s(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 u(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var c=function(e){function t(n,r,i,u,c,d){if(a(this,t),0==arguments.length){var l=s(this,e.call(this,o.Action_Type.javaScript));return s(l)}return(l=s(this,e.call(this,n,r,i,u,c,d))).info.script&&(l.info.javascript=l.info.script),s(l)}return u(t,e),t.prototype.getScript=function(){return this.info.javascript},t.prototype.checkOutData=function(e){return e&&e.javascript},t.prototype.setScript=function(e){var t=this;return this.doc?this.doc.api.setActionScript(this.doc.getId(),this.info.objNumber,e).then((function(e){return t.updateAction(e),e})):(this.info.javascript=e,Promise.resolve())},t.prototype.exportToJson=function(){var t=e.prototype.exportToJson.call(this);return Object.assign(t,{script:this.getScript()})},t}(r.default);t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(20),o=n(106),i=(d(n(722)),d(n(168))),a=n(223),s=d(n(723)),u=d(n(724)),c=d(n(381));d(n(725));function d(e){return e&&e.__esModule?e:{default:e}}var l=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._isEmpty=!t,this.info=t||{},this.page=n,this.api=n.api;var r=this.engine=n.engine;this.eventEmitter=r.eventEmitter,this.id=t.id,this.objectNumber=t.objectNumber,this.isDestroyed=!1}return e.prototype.destroy=function(){this.isDestroyed=!0,this.info=null,this.page=null,this.api=null,this.eventEmitter=null},e.prototype.checkModidyPerm=function(){if("widget"!=this.info.type){if(!this.page.doc.checkPermission(u.default.annotForm))throw new Error("Permission error")}else if(!this.page.doc.checkPermission(u.default.fillForm|u.default.annotForm))throw new Error("Permission error")},e.prototype.hasModifyPermission=function(){return"widget"==this.info.type?this.page.doc.checkPermission(u.default.fillForm|u.default.annotForm):this.page.doc.checkPermission(u.default.annotForm)},e.prototype.isEmpty=function(){return this._isEmpty},e.prototype.getInfo=function(){return this.info},e.prototype.getId=function(){return this.info.objectNumber},e.prototype.getObjectNumber=function(){return this.info.objectNumber},e.prototype.getUniqueID=function(){return this.info.name},e.prototype.setUniqueID=function(e){var t=this,n=this.getPDFPage(),r=n.getPDFDoc(),o=this.getUniqueID();return this.page.doc.api.setUniqueId(r.getId(),n.getId(),this.getId(),e).then((function(r){return r?(t.info.name=e,t.update(c.default.uniqueIDUpdated).then((function(){return t.eventEmitter.emit(i.default.annotationIDUpdated,e,o,t,n),r}))):r}))},e.prototype.getName=function(){return this.info.name},e.prototype.getPDFPage=function(){return this.page},e.prototype.getPage=function(){return this.getPDFPage()},e.prototype.getType=function(){return this.info.type},e.prototype.getTitle=function(){return this.info.title},e.prototype.isMarkup=function(){return this.info.isMarkup},e.prototype.isDeleted=function(){return this.info.isDeleted},e.prototype.getRect=function(){var e=this.info.rect;return new s.default(e.left,e.bottom,e.right,e.top)},e.prototype._setRect=function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.info.rect=e;var r=this.getPDFPage(),o=r.getPDFDoc();return this.page.doc.api.setAnnotRect(o.getId(),r.getId(),this.getId(),e).then((function(e){return e?t.update(c.default.rectUpdated,n).then((function(){return t.eventEmitter.emit(i.default.annotationAppearanceUpdated,[t],t.getPDFPage()),e})):e}))},e.prototype.setRect=function(e){var t=this;this.info.rect=e;var n=this.getPDFPage(),r=n.getPDFDoc();return this.page.doc.api.setAnnotRect(r.getId(),n.getId(),this.getId(),e).then((function(e){return e?t.update(c.default.rectUpdated).then((function(e){return t.eventEmitter.emit(i.default.annotationAppearanceUpdated,[t],t.getPDFPage()),!0})):e}))},e.prototype.setRectAndInnerRect=function(e,t){var n=this;this.info.rect=e,this.info.innerRect=t;var r=this.getPDFPage(),o=r.getPDFDoc();return this.page.doc.api.setAnnotRectAndInnerRect(o.getId(),r.getId(),this.getId(),e,t).then((function(e){return e?n.update(c.default.rectUpdated).then((function(e){return n.eventEmitter.emit(i.default.annotationAppearanceUpdated,[n],n.getPDFPage()),!0})):e}))},e.prototype.moveTo=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.left,r=t.top,o=t.action,a=t.triggerAction,s=void 0===a||a,u=Object.assign({},this.info.rect),d=u.right,l=u.bottom,f=n-u.left,h=r-u.top;this.info.rect={left:n,top:r,right:d+f,bottom:l+h};var p=this.getPDFPage(),m=p.getPDFDoc(),g=m.getId(),y=p.getId(),_=this.getId();return this.page.doc.api.moveAnnotTo(g,y,_,{left:n,top:r}).then((function(e){return p.getAnnotsByObjectNumArray(e)})).then((function(t){return Promise.all(t.map((function(e){return e._update()}))).then((function(n){s&&e.eventEmitter.emit(i.default.annotationUpdated,t,p,c.default.rectUpdated),"move"==o&&e.eventEmitter.emit(i.default.annotationMovedPosition,t,p,e)}))}))},e.prototype.getDeviceRect=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.page.getDeviceRect(this.getRect(),e,t);if(16&this.info.flag){var r=this.page.getDevicePoint([this.info.rect.left,this.info.rect.top],e,t);return{left:r[0],top:r[1],right:r[0]+n.right-n.left,bottom:r[1]+n.bottom-n.top}}return n},e.prototype.getDeviceInnerRect=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.page.getDeviceRect(this.getInnerRect(),e,t)},e.prototype.getContent=function(){return this.info.content},e.prototype.setContent=function(e){var t=this;return this.checkModidyPerm(),this._setContent(e).then((function(n){return t.info.content=e,t.eventEmitter.emit(i.default.annotationUpdated,[t],t.getPDFPage(),c.default.contentUpdated),t}))},e.prototype._setContent=function(e){var t=this.getPDFPage(),n=t.getPDFDoc();return this.page.doc.api.setAnnotContent(n.getId(),t.getId(),this.getId(),e)},e.prototype.getBorderColor=function(){return this.info.borderColor},e.prototype.setBorderColor=function(e){var t=this;this.checkModidyPerm(),isNaN(e)&&(e=(0,a.colorConvertor)(e,"int",1));var n=this.getPDFPage(),r=n.getPDFDoc();return this.page.doc.api.setAnnotBorderColor(r.getId(),n.getId(),this.getId(),e).then((function(r){return r?(0===e&&(t.info.hasBorderColor=!1),t.update(c.default.borderColorUpdated).then((function(){t.isGrouped&&t.isGrouped()&&t.getGroupElements().map((function(e){e!=t&&t.eventEmitter.emit(i.default.annotationAppearanceUpdated,[e],n)}));return t.eventEmitter.emit(i.default.annotationAppearanceUpdated,[t],n),r}))):r}))},e.prototype.getBorderStyle=function(){return this.info.borderInfo.style},e.prototype.getBorderStyleWithParam=function(){var e=this.info.borderInfo,t=e.style,n=e.cloudIntensity,o=e.dashes,i=void 0;switch(t){case r.BORDER_STYLE.SOLID:i=[];break;case r.BORDER_STYLE.CLOUDY:i=n;break;case r.BORDER_STYLE.DASHED:i=o}return{style:t,param:i}},e.prototype.getBorderInfo=function(){return Object.assign({},this.info.borderInfo)},e.prototype.setBorderInfo=function(e){var t=this;this.checkModidyPerm();var n=this.getType();if(this.getQuadPoints||"caret"===n||"text"===n)return Promise.resolve();var r=JSON.parse(JSON.stringify(this.info.borderInfo||{}));e=this.info.borderInfo=Object.assign(r,e);var o=this.getPDFPage(),a=o.getPDFDoc();return 1===e.style&&0===e.dashes.length&&(e.dashes=[2,2]),5===e.style&&e.cloudIntensity>2&&(e.cloudIntensity=2),this.page.doc.api.setAnnotBorderInfo(a.getId(),o.getId(),this.getId(),e).then((function(e){if(5===t.info.borderInfo.style)return t._update()})).then((function(e){return t.eventEmitter.emit(i.default.annotationUpdated,[t],o,c.default.borderInfoUpdated),t.eventEmitter.emit(i.default.annotationAppearanceUpdated,[t],o),!0}))},e.prototype.setBorderStyle=function(e,t){var n=this,r=this.info.borderInfo;switch(r.style=e,e){case 1:r.dashes=t;break;case 5:r.cloudIntensity=t}var o=this.getPDFPage(),a=o.getPDFDoc();return this.page.doc.api.setAnnotBorderStyle(a.getId(),o.getId(),this.getId(),e,t).then((function(e){return o.getAnnotsByObjectNumArray(e)})).then((function(e){for(var t=[],n=e.length;n--;)t.push(e[n]._update());return Promise.all(t)})).then((function(e){return n.eventEmitter.emit(i.default.annotationUpdated,e,o,c.default.borderStyleUpdated),n.eventEmitter.emit(i.default.annotationAppearanceUpdated,e,o),!0}))},e.prototype.getBorderDashes=function(){return Object.assign([],this.info.borderInfo.dashes)},e.prototype.getBorderWidth=function(){var e=this.info.borderInfo.width;return void 0===e?1:+e},e.prototype.setBorderWidth=function(e){var t=this,n=this.getPDFPage(),r=n.getPDFDoc();return this.page.doc.api.setAnnotBorderWidth(r.getId(),n.getId(),this.getId(),e).then((function(e){return t._update().then((function(t){return e}))})).then((function(e){return e&&(t.eventEmitter.emit(i.default.annotationUpdated,[t],n,c.default.borderWidthUpdated),t.eventEmitter.emit(i.default.annotationAppearanceUpdated,[t],n)),e}))},e.prototype.getCloudIntensity=function(){return this.info.borderInfo.cloudIntensity||0},e.prototype.reviseSummary=function(e){return Promise.resolve(this)},e.prototype.rectIsEmpty=function(){return this.info.rectIsEmpty},e.prototype.update=function(e){var t=this;return this._update().then((function(){return e&&t.eventEmitter.emit(i.default.annotationUpdated,[t],t.getPDFPage(),e),t}))},e.prototype._update=function(){var e=this,t=this.getPDFPage(),n=t.getPDFDoc();return this.page.doc.api.getAnnot(n.getId(),t.getId(),this.getId()).then((function(t){return t.rotation&&t.rotation<0&&(t.rotation+=360),e.updateInfo(t),e}))},e.prototype._updateMore=function(){},e.prototype.getFlags=function(){return this.info.flag},e.prototype.getIndex=function(){return this.info.index},e.prototype.setFlags=function(e,t){var n=this;this.checkModidyPerm(),this.info.flag=e;var r=this.getPDFPage(),o=r.getPDFDoc();return this.page.doc.api.setAnnotFlag(o.getId(),r.getId(),this.getId(),e).then((function(o){return o&&("widget"==n.getType()&&n.updateUI({type:"display",value:e}),t||(n.eventEmitter.emit(i.default.annotationUpdated,[n],r,c.default.flagsUpdated),n.eventEmitter.emit(i.default.annotationAppearanceUpdated,[n],r))),o}))},e.prototype.setFlagValue=function(e,t){return this.setFlags(e,t)},e.prototype.getModifiedDateTime=function(){var e=this.info.modifiedTimestamp;return e<0?null:new Date(e)},e.prototype.setModifiedDateTime=function(e){var t=this;this.checkModidyPerm();var n=this.getPDFPage(),r=n.getPDFDoc();return this.page.doc.api.setModifiedDateTime(r.getId(),n.getId(),this.getId(),e).then((function(e){return t.update(c.default.modifiedDateTimeUpdated)}))},e.prototype.exportToJSON=function(){var e=(0,a.colorConvertor)(16777215&this.info.borderColor,"#"),t=this.info.flag,n=[];for(var i in r.AnnotFlagsName)t&1<<parseInt(i)&&n.push(r.AnnotFlagsName[i]);n=n.join(",");var s=(0,o.formatPDFDate)(new Date(this.info.modifiedTimestamp)),u=this.info.name,c=this.page.getIndex(),d=this.info.rect,l=d.left+","+d.bottom+","+d.right+","+d.top,f=this.info.content,h=this.info.borderInfo,p=this.info.type,m=this.info.customEntries,g={type:p,color:e,flags:n,date:s,name:u,page:c,rect:l,contents:f,width:h.width,customEntries:m,objectNumber:this.info.objectNumber};switch(h.style){case r.BORDER_STYLE.SOLID:g.style="solid";break;case r.BORDER_STYLE.DASHED:g.style="dashed",g.dashPhase=h.dashPhase,g.dashes=h.dashes.join(",");break;case r.BORDER_STYLE.UNDERLINE:g.style="underline";break;case r.BORDER_STYLE.BEVELED:g.style="beveled";break;case r.BORDER_STYLE.INSET:g.style="inset";break;case r.BORDER_STYLE.CLOUDY:g.style="cloudy",g.intensity=h.cloudIntensity}return g},e.prototype.updateInfo=function(e){this._isEmpty=!e,this.info=e,this._updateMore(),this.action&&e.action&&(this.action.info=e.action)},e.prototype.getIntent=function(){return""},e.prototype.setCustomEntries=function(e,t){this.info.customEntries=this.info.customEntries||{},this.info.customEntries[e]=t},e.prototype.setDictionaryEntry=function(e,t){var n=this;return this._setDictionaryEntry(e,t).then((function(e){return e&&n.eventEmitter.emit(i.default.annotationUpdated,[n],n.getPDFPage(),c.default.addDictionary),e}))},e.prototype._setDictionaryEntry=function(e,t){var n=this,r=this.getPDFPage(),o=r.getPDFDoc();return this.page.doc.api.setDictionaryEntry(o.getId(),r.getId(),this.getId(),e,t).then((function(r){return r&&n.setCustomEntries(e,t),r}))},e.prototype.getDictionaryEntry=function(e){return this._getDictionaryEntry(e)},e.prototype._getDictionaryEntry=function(e){var t=this.getPDFPage(),n=t.getPDFDoc();return this.page.doc.api.getDictionaryEntry(n.getId(),t.getId(),this.getId(),e)},e.prototype.resetAppearanceStream=function(){var e=this.getPDFPage(),t=e.getPDFDoc();return this.page.doc.api.resetAppearanceStream(t.getId(),e.getId(),this.getId())},e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={contentUpdated:"content-updated",borderInfoUpdated:"borderInfo-updated",borderStyleUpdated:"borderStyle-updated",borderWidthUpdated:"borderWidth-updated",borderColorUpdated:"borderColor-updated",modifiedDateTimeUpdated:"modifiedDateTime-updated",uniqueIDUpdated:"uniqueID-updated",flagsUpdated:"flags-updated",rectUpdated:"rect-updated",innerRectUpdated:"innerRect-updated",iconNameUpdated:"iconName-updated",rotationUpdated:"rotation-updated",defaultAppearanceUpdated:"defaultAppearance-updated",calloutLineEndingStyleUpdated:"calloutLineEndingStyle-updated",calloutLinePointsUpdated:"calloutLinePoints-updated",fillColorUpdated:"fillColor-updated",textColorUpdated:"textColor-updated",alignmentUpdated:"alignment-updated",inkListUpdated:"inkList-updated",endPointUpdated:"endPoint-updated",startPointUpdated:"startPoint-updated",endingStyleUpdated:"endingStyle-updated",enableCaptionUpdated:"enableCaption-updated",leaderCaptionOffsetUpdated:"leaderCaptionOffset-updated",styleFillColorUpdated:"styleFillColor-updated",leaderLineLengthUpdated:"leaderLineLength-updated",leaderLineExtendUpdated:"leaderLineExtend-updated",leaderLineOffsetUpdated:"leaderLineOffset-updated",measureRatioUpdated:"measureRatio-updated",measureUnitUpdated:"measureUnit-updated",measureConversionFactorUpdated:"measureConversionFactor-updated",removeAction:"remove-action",actionDataUpdated:"actionData-updated",addAction:"add-action",highlightingModeUpdated:"highlightingMode-updated",subjectUpdated:"subject-updated",titleUpdated:"title-updated",createDateTimeUpdated:"createDateTime-updated",opacityUpdated:"opacity-updated",intentUpdated:"intent-updated",vertexesUpdated:"vertexes-updated",applyFillColorUpdated:"applyFillColor-updated",overlayTextUpdated:"overlayText-updated",overlayTexAlignmentUpdated:"overlayTextAlignment-updated",repeatUpdated:"repeat-updated",autoFontSizeUpdated:"autoFontSize-updated",redactDefaultAppearanceUpdated:"redactDefaultAppearance-update",redactOpacityUpdated:"redactOpacity-updated",quadPointsUpdated:"quadPoints-updated",reviewStateUpdated:"review-state-updated",markedStateUpdated:"marked-state-updated",statesCleared:"state-cleared",replyAdded:"add-replies",addDictionary:"add-dictionary",formFieldValueUpdated:"form-field-value",formFieldsMaxLengthUpdated:"maxLength",formFieldItemsUpdated:"setItems",formFieldIconUpdated:"icon",formFieldInsertedItem:"insertItemAt",formFieldExportValueUpdated:"form-field-export-value",formFieldMKPropertyUpdated:"form-field-mk-property",formFieldAlternateName:"form-field-alternate-name",formFieldActionUpdated:"form-field-action"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=0,o=t.ModulePageEditor=1,i=t.ModuleTouchup=2,a=t.ModuleExporter=4;t.initGSDKModule=function(e,t){if(!(r&t)){switch(t){case o:e.initPageEditor();break;case i:e.initTouchup();break;case a:e.initExporter()}r|=t}}},,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};n(407);var o=M(n(609)),i=M(n(73)),a=M(n(68)),s=n(377),u=M(n(719)),c=M(n(726)),d=M(n(727)),l=M(n(728)),f=M(n(166)),h=M(n(378)),p=M(n(165)),m=M(n(107)),g=n(3),y=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(731)),_=(M(n(103)),n(382)),v=M(n(37)),b=M(n(732)),S=n(733),w=M(n(74));function M(e){return e&&e.__esModule?e:{default:e}}function D(e){return function(){var t=e.apply(this,arguments);return new Promise((function(e,n){return function r(o,i){try{var a=t[o](i),s=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(s).then((function(e){r("next",e)}),(function(e){r("throw",e)}));e(s)}("next")}))}}var P=new m.default("cache","FoxitPDFSDKForWeb_cache"),T=navigator.userAgent.toLowerCase();function k(){var e=void 0;return!(!("ActiveXObject"in self)||!(e=T.match(/msie ([\d\.]+)/)))&&10===parseInt(e[1])}var A=/iP(hone|od|ad)/i.test(T),L={};trace=self.trace=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(self.gsdk){for(var r="",o=t[1];o<t[1]+180&&0!=gsdk.HEAP8[o];o++){var i=String.fromCharCode(gsdk.HEAP8[o]);r+=i}t[1]=r}console.trace(t[1]+":"+t[0]+":gsdk exception")},self.saveBitmapToFile=function(e){var t=new gsdk.Image;t.AddFrame(e);var n=[],r=gsdk.StreamCallback.implement({Release:function(){},Flush:function(){return!0},GetSize:function(){return 0},WriteBlock:function(e,t,r){var o=gsdk.HEAPU8.buffer,i=void 0;return i=o.slice?o.slice(e,e+r):new Uint8Array(o,e,r).buffer,n=n.concat(i),!0}});t.SaveAs(r,new gsdk.WString(".bmp"));var o=new Blob(n,{type:"image/bmp"}),i=URL.createObjectURL(o);postMessage({type:-11,url:i})},self.renderAnnot=function(e){var t=e.GetRect(),n=t.right-t.left,r=t.top-t.bottom,o=new gsdk.Bitmap(n,r,gsdk.DIBFormat.e_DIBArgb,0,0),i=new gsdk.Renderer(o,!0),a=e.GetPage(),s=a.GetDisplayMatrix(0,0,a.GetWidth(),a.GetHeight(),{value:0});s.e-=t.left,s.f-=a.GetHeight()-t.top;i.RenderAnnot(e,s);saveBitmapToFile(o)},self.getWASMString=function(e,t){for(var n="",r=e;r<e+2*t;r++){n+=String.fromCharCode(gsdk.HEAP8[r])}console.trace("wasm string:",n)};var F=(0,i.default)(),I=F.promise,x=!1,C=!1,R=!1,O={},G={};(0,u.default)(G,ne,oe,I,Q,X),(0,d.default)(G,ne,oe,I,Q,X);var E,Y,j=(0,c.default)(G,ne,oe,I,Q,X),N=(0,l.default)(G,ne,oe,I,Q,X),B={},H=(E={},{push:function(e){for(var t=E[e]=E[e]||[],n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];t.push.apply(t,r)},get:function(e){return E[e]||[]}}),W={},U={},z={},J=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.reason=t,this.transfers=n};function V(e){return W[e]}function K(e,t){for(var n=e.params||[],r=e.more.paramsInfo||[],o=[],i=n.length;i--;){var a=n[i],s=r[i]||{};s.isObject?!(o[i]=V(a))&&s.enumName&&(o[i]=q(a,s.enumName,t)):o[i]=n[i]}return o}function q(e,t,n){for(var r=t.split("."),o=n,i=0,a=r.length;i<a;i++)o=o[r[i]];return o.values[e]}function Z(e,t){try{self.postMessage(e,t)}catch(t){self.postMessage(e)}}function X(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{error:-1},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;k()&&(n=n[0]),t&&r&&(t.e=r.constructor?r.constructor.name:r),Z({id:e,type:1,params:t},n)}function Q(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];k()&&(n=n[0]),Z({id:e,type:0,params:t},n)}function $(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];k()&&(n=n[0]);var r=(0,a.default)("worker_back"),o=(0,i.default)();return B[r]=function(e){o.resolve(e)},Z({callId:e,params:t,backId:r},n),o.promise}function ee(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];k()&&(n=n[0]),Z({uiListener:e,params:t},n)}function te(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!1),r.responseType="arraybuffer",r.send(),r.status>=200&&r.status<300||304===r.status||n.reject(new Error("request error: "+r.status));var o=new Uint8Array(r.response),i=(0,p.default)(o);P.set("asmJs",i).then((function(){ee("asmJs",e)}),(function(){}));var a=new Blob([i],{type:"application/javascript"}),s=void 0,u=void 0;try{s=URL.createObjectURL(a),u=Promise.resolve(s)}catch(e){u=$(t,a)}return u.then((function(e){importScripts(e)})).then((function(){n.resolve()}),(function(e){n.reject(e)}))}function ne(e){return I.then((function(t){return t.getPDFDocById(e)})).then((function(t){if(!t)throw new Error('The document corresponding to the ID("'+e+'") cannot be found or has been deleted!');return t}))}function re(e,t){return ne(e).then((function(e){return e.getPageByIndex(t)})).then((function(e){if(!e)throw new Error("Cannot access the page with the specified index: "+t);return e}))}function oe(e,t){return ne(e).then((function(e){return e.getPageById(t)}))}function ie(e,t,n){var r=t.docId,o=t.pageId,i=t.x,a=t.y,s=t.width,u=t.height,c=t.scale,d=t.rotate;return oe(r,o).then((function(e){return e.getImageDataByTile(i,a,s,u,c,d,n)})).then((function(t){var n=[];t.buffer&&(n=[t.buffer]),Q(e,t,n)}))}self.onmessage=function(e){var t=e.data,n=t.params,r=t.backId;if(r)return B[r](n);var o=t.name,i=t.id;try{var s=G[o];if(s){var u=s(i,n);u instanceof Promise&&u.catch((function(e){var t=void 0,r=void 0;e instanceof J?(r=e.reason,t=e.transfers):(t=[],r=e),"number"==typeof r?I.then((function(e){var a=e.engine.getErrorCode(r);"number"!=typeof a&&(a=r),X(i,{error:r,message:"Unknown engine error! error: "+r+", code: "+a+", Worker function name: "+o+", parameters: "+JSON.stringify(n)},t,null)})):r instanceof Error&&X(i,{error:"number"==typeof r.error?r.error:-1,message:r.message,stack:r.stack},t,r)}))}else!function(e){var t=e.id,n=e.name.split(".");I.then((function(e){return e.engine})).then((function(t){for(var r=t,o=0,i=n.length;o<i;o++){var s=void 0;if(s=r[n[o]]){var u=n[o+1];if("prototype"===u){var c=void 0;try{r=V(c=e.more.self)}catch(e){r=new s}if(o++,"destroy"===n[o+1])return c}else"create"===u?(r=new s.apply(s,K(e)),o++):r="function"==typeof s?s.apply(r,K(e)):s}}return function(e){if(!e)return"";var t=(0,a.default)("obj");return W[t]=e,t}(r)})).then((function(e){Q(t,e)}),(function(e){X(t,{code:e.code,stack:e.stack,message:e.message})}))}(t)}catch(e){X(i,{error:-1,message:"web-pdf-jr-worker-error\r\n"+o+"\r\n"+e.toString(),stack:e.stack})}},G.initJREngine=function(e,t){var n=t.enginePath,r=t.licenseSN,a=t.licenseKey,u=t.fontPath,c=t.cache,d=t.compatibilityURL,l=t.l,f=t.d,p=t.readBlock,m=void 0===p?8192:p,g=t.fontMap,y=void 0===g?[]:g,_=t.brotli,v=void 0===_?{}:_;if(R)return Q(e,{version:self.gsdkVersion});if(I.then((function(t){if(Y)return Q(e,{other:Y,version:self.gsdkVersion});Q(e,{version:self.gsdkVersion})})),!C&&!x){var b=(0,i.default)();x=b.promise.then((function(){return C=!0,new o.default(null,{enginePath:n,fontPath:u,cache:c,postMessageToUi:ee,readBlock:m,fontMap:y,brotli:v})})).then((function(t){t.jrEnginePromise.catch((function(t){X(e,{error:3},null,t)})),(l?t.checkLicense2(l):t.checkLicense(r,a)).then((function(n){var r=n.flag,o=n.other;if(self.gsdkVersion=t.engine.Library.GetVersion().toString(),r){var i=t.engine.Library.GetLicenseKeyInfo,a=void 0;try{a=i().toString()}catch(e){}if(a){var s=a.match(/<Domains>((.|\r?\n)*)<\/Domains>/);if(s){s=s[1];for(var u=/<Domain>([^<]+)<\/Domain>/g,c=void 0,d=!1,l=!1;c=u.exec(s);){var h=c[1],p=void 0;if(h)for(var m=h.split(/,|,|\r?\n/),g=m.length;g--;){var y=m[g];if(y){d=!0;var _=void 0;try{_=new RegExp(y.replace(/\./g,"\\.").replace(/\*\*/g,"福昕").replace(/\*/g,".?").replace(new RegExp("福昕","g"),".*")).test(f)}catch(e){}if(_){l=!0,p=!0;break}}}if(p)break}if(d&&!l)return void X(e,{error:2})}}if(o&&(o=JSON.parse(o))){var v=!0;if(o.h){v=!1;var b=o.h;0;for(var S=b.length;S--;){var w=b[S];if(new RegExp(w).test(f)){v=!0;break}}}if(!v)return void X(e,{error:2});var M=Date.now(),D=o.b;if(D&&!(v=M>D))return void X(e,{error:2});var P=o.e;if(P&&!(v=M<P))return void X(e,{error:2});if(!v)return void X(e,{error:2})}Y=o,R=!0,F.resolve(t)}else X(e,{error:2})}))}),(function(){X(e)}));try{if((0,h.default)())importScripts(n+"/gsdk.js?h="+s.jsHash),b.resolve();else{var S=void 0;!1===v.core?(S=n+"/gsdk.asm.js?h="+s.asmJSHash,importScripts(S),b.resolve()):(S=n+"/gsdk.asm.js.brotli?h="+s.asmJSHash)===c.asmJs?P.get("asmJs").then((function(e){if(e)try{var t=new Blob([e],{type:"application/javascript"}),n=void 0,r=void 0;try{r=URL.createObjectURL(t),n=Promise.resolve(r)}catch(e){n=$(d,t)}n.then((function(e){importScripts(e),b.resolve()}),(function(e){b.reject(e)}))}catch(e){b.reject(e)}else te(S,d,b)}),(function(){te(S,d,b)})):te(S,d,b)}C=!0}catch(t){return console.log(t),X(e,{error:1})}}},G.getPDFDocByFile=function(e,t){var n=t.file;return I.then((function(e){if(n instanceof ArrayBuffer)return e.getPDFDoc({buffer:n});var t=de(n);return t.size<2097152?e.getPDFDoc({buffer:t.read(0,t.size)}):e.getPDFDoc({size:t.size,getBuffer:function(e,n){return t.read(e,n)},destroyCallback:function(){t.destroy()}})})).then((function(e){return e.setOriginalStream(n),e.id})).then((function(t){Q(e,t)}))},G.getPDFDocFromImageFile=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return I.then((function(r){var o=r.engine,i=de(t),a=i.read(0,i.size),s=v.default.createImage(o,a),u=s.GetWidth(),c=s.GetHeight(),d=t.name,l={width:u,height:c};return r.createNewDoc(d,n,l).then((function(e){return r.getPDFDoc({buffer:e})})).then((function(t){Q(e,{docId:t.id,width:u,height:c,buffer:a})}))}))},G.createNewDoc=function(e,t){var n=t.title,r=t.author,o=t.pageSize;return I.then((function(e){return e.createNewDoc(n,r,o)})).then((function(t){Q(e,t,[t])}))},G.createNewPortfolioDoc=function(e,t){var n=t.fileCoversheet,r=t.files,o=t.title;return I.then((function(e){return e.createNewPortfolioDoc(n,r,o)})).then((function(t){Q(e,t,[t])}))},G.createSummarizeComments=function(e,t){var n=t.docId,r=t.writeStream,o=t.param,i=void 0;return ne(n).then((function(e){return i=e,e.createSummarizeComments({writeStream:function(e,t,n){$(r,{arrayBuffer:e,offset:t,size:n},[e])}},o)})).then((function(t){H.push(i.id,r),Q(e,t)}),(function(t){X(e,{err:-1},[],t)}))},G.setIcons=function(e,t){var n=t.icons;I.then((function(e){var t=(0,f.default)();t.initIconProvider(e,e.engine),t.setIcons(n)})),Q(e)},G.addIcon=function(e,t){var n=t.icon;(0,f.default)().addIcon(n),Q(e)},G.removeIcon=function(e,t){var n=t.type,r=t.catalog,o=t.name;(0,f.default)().removeIcon(n,r,o),Q(e)},G.checkCertificatePassword=function(e,t){var n=t.pfxFile,r=t.password;return I.then((function(e){return e.checkCertificatePassword(n,r)})).then((function(t){Q(e,t)}))},G.getCertificateInfo=function(e,t){var n=t.file,r=t.password;return I.then((function(e){return e.getCertificateInfo(n,r)})).then((function(t){Q(e,t)}))},G.createCertificateFile=function(e,t){var n=t.docId,r=t.info;return ne(n).then((function(e){return e.createCertificateFile(r)})).then((function(t){Q(e,t)}))},G.getCertificateSerials=function(e,t){return ne(t.docId).then((function(e){return e.getCertificateSerials()})).then((function(t){Q(e,t)}))},G.parseByCertificate=function(e,t){var n=t.docId,r=t.info;return ne(n).then((function(t){t.parseByCertificate(r).then((function(n){0===n.code&&(n.info=t.toJson()),Q(e,n)}))})).catch((function(t){X(e,null,[],t)}))},G.parsePDFDocByPassword=function(e,t){var n=t.id,r=t.password,o=t.initData,i=void 0===o?{}:o,a=I.then((function(e){if(e.engine.Library.SetDefaultFileSize(i.readBlock||e.defaultReadBlockSize),i.fdf&&i.fdf.file){var t=i.fdf.file,n=ue(t),r=ce(t);return e.getFDFDoc({size:n,getBuffer:function(e,t){return r(e,t)}}).then((function(e){i.fdf.file=e}))}})),s=void 0;return a.then((function(){return ne(n)})).then((function(e){return s=e,e.parseByPassword(r,i)})).then((function(t){if(I.then((function(e){e.unRegisterSecurityCallback("FoxitDRM"),e.registeredDRMSecurityCallback=!1})),0===t.code){t.info=s.toJson();var n=s.doc.CheckPassword(new s.engine.String(r||""));t.info.hasOwnerPassword=3===n.value||s.doc.HasOwnerPassword()}Q(e,t)})).catch((function(t){X(e,null,[],t)})).finally((function(e){return s=null}))},G.getPageCount=function(e,t){return ne(t).then((function(e){return e.getPageCount()})).then((function(t){Q(e,t)}),(function(t){X(e,null,[],t)}))},G.getFileVersion=function(e,t){return ne(t).then((function(e){return e.getFileVersion()})).then((function(t){Q(e,t)}),(function(t){X(e,null,[],t)}))},G.getPDFDocInfoById=function(e,t){return ne(t).then((function(t){Q(e,t.toJson())}))},G.getMetadata=function(e,t){return ne(t).then((function(t){Q(e,t.getMetadata())}))},G.setMetadataValue=function(e,t){var n=t.id,r=t.key,o=t.value;return ne(n).then((function(t){Q(e,t.setMetadataValue(r,o))}))},G.getPageInfoByIndex=function(e,t){return re(t.id,t.index).then((function(t){Q(e,t.toJson())})).catch((function(e){0}))},G.getDocPermission=function(e,t){return ne(t).then((function(e){return e.getPermission()})).then((function(t){Q(e,t)}))},G.getPageWidth=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.getWidth()})).then((function(t){Q(e,t)}))},G.getPageHeight=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.getHeight()})).then((function(t){Q(e,t)}))},G.getPageImageData=function(e,t){var n=t.docId,r=t.pageId,o=t.scale;return oe(n,r).then((function(e){return e.getImageData(o)})).then((function(t){var n=[];t.buffer&&(n=[t.buffer]),Q(e,t,n)}))},G.destroyDoc=function(e,t){var n=t.id;H.get(n).forEach((function(e){var t;t=e,self.postMessage({destroyId:t})})),z[n]&&delete U[z[n]],ne(n).then((function(t){return I.then((function(e){e.destroyDoc(n)})).then((function(){j.clearObjectFromCache(n),N.clearObjectCache(),t.destroy();var r=O[n];r&&(r(),delete O[n]),Q(e)}))})).catch((function(t){X(e,null,[],t)}))},G.getImageDataByTile=ie,G.getImageDataWithoutAnnotByTile=function(e,t){var n=t.docId,r=t.pageId,o=t.x,i=t.y,a=t.width,s=t.height,u=t.scale,c=t.rotate;return I.then((function(t){ie(e,{docId:n,pageId:r,x:o,y:i,width:a,height:s,scale:u,rotate:c},[t.engine.ContentFlag.e_RenderPage.value])}))},G.getAnnot=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e?e.getAnnotById(o):null})).then((function(e){return e?e.toJson():{}})).then((function(t){Q(e,t)}))},G.getPageAnnotIDList=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.getAnnotIDList()})).then((function(t){Q(e,t)}))},G.getAnnots=function(e,t){var n=t.docId,r=t.pageId,o=t.idList,i=t.reload;return oe(n,r).then((function(e){return e?e.getAnnots(o,void 0,i):[]})).then((function(e){var t={};return e.map((function(e,n){var r=e.annot;if(0===r.GetType().value)return!1;var o=r.GetDict(),i=o.GetObjNum(),a=t[i]=t[i]||{},s=i;a.index=n,a.id=s,a.objectNumber=s;var u=e.engine,c=(0,g.CString)(u,"IRT");if(o.HasKey(c)){var d=o.GetElement(c).GetDict().GetObjNum(),l=(0,g.CString)(u,"RT"),f=(0,g.CString)(u,"State"),h=(0,g.CString)(u,"StateModel"),p=t[d]=t[d]||{};if(o.HasKey(f)&&o.HasKey(h)){var m=o.GetElement(h).GetString().toString(),y=r.GetModifiedDateTime(),_=0;switch(y.IsValid()&&(y=y.ToUTCTime(),_=Date.UTC(y.year,y.month-1,y.day,y.hour,y.minute,y.second,y.milliseconds)),m){case"Marked":(p.markedStates=p.markedStates||[]).push({index:n,id:s,time:_,objectNumber:s});break;case"Review":(p.reviewStates=p.reviewStates||[]).push({index:n,id:s,time:_,objectNumber:s})}}else if(o.HasKey(l)){switch(o.GetElement(l).GetString().toString()){case"Group":p.isGroupHeader=!0,p.isGroup=!0,(p.groupElements=p.groupElements||[]).push({index:n,id:s,objectNumber:s}),a.isGroup=!0,a.groupHeader=p;break;case"R":default:p.hasReplies=!0,(p.replies=p.replies||[]).push({index:n,id:s,content:r.GetContent().toString(),objectNumber:s})}}else{p.hasReplies=!0,(p.replies=p.replies||[]).push({index:n,id:s,content:r.GetContent().toString(),objectNumber:s})}}})),e.map((function(e){if(0!==e.annot.GetType().value)return e&&e.toJson(t)})).filter(Boolean)})).then((function(t){Q(e,t)}))},G.setRenderFlag=function(e,t){var n=t.docId,r=t.flags;return ne(n).then((function(e){e.setRenderFlag(r)}))};var ae={};function se(e,t){var n=t.progressiveId,r=ae[n];r?(r.bitmap.delete(),r.renderer.delete(),r.progressive.delete(),delete ae[n],e&&Q(e)):Q(e)}function ue(e){return e instanceof Blob?e.size:e.byteLength}function ce(e){if(e instanceof Blob){if(A){var t=new FileReaderSync;e=new Blob([t.readAsArrayBuffer(e)])}return function(t,n){return(new FileReaderSync).readAsArrayBuffer(e.slice(t,t+n))}}return e.slice?function(t,n){return e.slice(t,t+n)}:function(t,n){return new Uint8Array(e,t,n).buffer}}function de(e){var t=void 0,n=void 0,r=[];if(e instanceof Blob){if(A){var o=new FileReaderSync;e=new Blob([o.readAsArrayBuffer(e)])}t=e.size;var i=!0,a=0,s=Math.ceil(t/65536);n=function(n,o){for(var u=n+o,c=Math.floor(n/65536),d=Math.floor(u/65536),l=n%65536,f=Math.min(65536,u),h=new Uint8Array(o),p=[],m=c,g=d+1,y=0;m<g;m++){var _,v=(f=m===d?u%65536:65536)-l;(_=r[m])?h.set(new Uint8Array(_,l,f-l),y):v&&p.push([m,l,f,y]),y+=v,l=0}if(p.length){i&&(i=!1,setTimeout((function(){i=!0,a=1}),0));for(var b=[],S=p[0][0],w=S,M=0,D=p.length;M<D;M++)w=p[M][0],p[M+1]&&p[M+1][0]===w+1||(b.push([S,w]),S=b[++M]&&b[M][0]);for(var P=0,T=b.length;P<T;P++){for(var k=b[P],A=k[0],L=k[1],F=0,I=a;F<I;F++){var x=L+1,C=A-1;if(F%2)C>-1&&!r[C]?A--:x<s&&!r[x]&&L++;else if(x<s&&!r[x])L++;else{if(!(C>-1)||r[C])break;A--}}b[P]=[A,L]}for(var R=new FileReaderSync,O=0,G=b.length;O<G;O++){var E=b[O],Y=E[0],j=E[1],N=65536*Y,B=Math.min(65536*(j+1),t),H=R.readAsArrayBuffer(e.slice(N,B));if(H.slice)for(var W=Y,U=j+1,z=0;W<U;W++,z++)r[W]=H.slice(65536*z,65536*(z+1));else for(var J=Y,V=j+1,K=0;J<V;J++,K++){var q=65536;65536*(J+1)>t&&(q=t%65536),r[J]=new Uint8Array(H,65536*K,q).buffer}}a++}for(var Z=0,X=p.length;Z<X;Z++){var Q=p[Z];h.set(new Uint8Array(r[Q[0]],Q[1],Q[2]-Q[1]),Q[3])}return h}}else t=e.byteLength,n=e.slice?function(t,n){return e.slice(t,t+n)}:function(t,n){return new Uint8Array(e,t,n).buffer};return{size:t,read:n,destroy:function(){e=null,t=0,n=null;for(var o=r.length;o--;)delete r[o];r=null}}}function le(e){for(var t=[],n=e.GetMatchRects(),r=0,o=n.GetSize();r<o;r++){var i=n.GetAt(r);t[r]={left:i.left,right:i.right,top:i.top,bottom:i.bottom}}return{pageIndex:e.GetMatchPageIndex(),startCharIndex:e.GetMatchStartCharIndex(),endCharIndex:e.GetMatchEndCharIndex(),sentenceStartIndex:e.GetMatchSentenceStartIndex(),sentence:e.GetMatchSentence().toString(),rectArray:t}}G.getPageBitmap=function(e,t){var n=t.docId,r=t.pageId,o=t.scale,i=t.rotate,a=t.rect,s=t.flags,u=t.usage,c=t.id;return oe(n,r).then((function(e){return e?e.getBitmap(o,i,a,s,u,""==c):null})).then((function(t){if(t){var n=t.image;if(t.isVirtual)Q(e,n,[n.buffer]);else{var r=[];n.buffer&&(r=[n.buffer]),n.progressiveId=c,Q(e,n,r),delete t.image,100==n.rate?(t.bitmap.delete(),t.renderer.delete(),t.progressive.delete()):ae[c]=t}}else Q(e,null)}))},G.progressContinue=function(e,t){var n=t.progressiveId,r=ae[n];if(r){var o=r.progressive,i=o.GetRateOfProgress();100==i&&Q(e,{rate:100});for(var a=o.Continue(),s=Date.now();1==a.value&&(a=o.Continue(),!(Date.now()-s>200)););var u=r.page,c=r.renderer,d=r.usage,l=r.matrix,f=r.renderFlags;100==(i=2==a.value?100:o.GetRateOfProgress())&&u.renderAnnots(c,d,l,f);var h=r.getBitmapBuffer(r.engine,r.bitmap,r.renderer,!1);h.rate=i,h.progressiveId=n,h.x=r.x,h.y=r.y;var p=[];h.buffer&&(p=[h.buffer]),Q(e,h,p),100==h.rate&&se(null,{progressiveId:n})}else Q(e,{isEmpty:1,progressiveId:n})},G.cancleProgress=se,G.getPageAndHighlightBitmap=function(e,t){var n=t.docId,r=t.pageId,o=t.scale,i=t.rotate,a=t.rect,s=t.exclude;return oe(n,r).then((function(e){return e.getPageAndHighlightBitmap(o,i,a,s)})).then((function(t){var n=[];t.buffer&&(n=[t.buffer]),Q(e,t,n)}))},G.getAnnotBitmap=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.scale,a=t.rotate,s=t.rect,u=t.renderAppearanceType;return oe(n,r).then((function(e){return e.getAnnotBitmap(o,i,a,s,u)})).then((function(t){var n=[];t.buffer&&(n=[t.buffer]),Q(e,t,n)}))},G.getAnnotBitmapByRange=function(e,t){var n=t.docId,r=t.pageId,o=t.range,i=t.scale,a=t.rotate,s=t.rect;return oe(n,r).then((function(e){return e.getAnnotBitmapByRange(o,i,a,s)})).then((function(t){var n=[];t.buffer&&(n=[t.buffer]),Q(e,t,n)}))},G.getAnnotIdAtPoint=function(e,t){var n=t.docId,r=t.pageId,o=t.points,i=t.tolerance;return oe(n,r).then((function(e){return e.getAnnotIdAtPoint(o.x,o.y,i)})).then((function(t){Q(e,t)}))},G.getAnnotIdAtDevicePoint=function(e,t){var n=t.docId,r=t.pageId,o=t.points,i=t.tolerance,a=t.matrix;return oe(n,r).then((function(e){return e.getAnnotIdAtDevicePoint(o.x,o.y,i,a)})).then((function(t){Q(e,t)}))},G.getAnnotObjectNumAtPoint=function(e,t){var n=t.docId,r=t.pageId,o=t.points,i=t.tolerance;return oe(n,r).then((function(e){return e.getAnnotObjectNumAtPoint(o.x,o.y,i)})).then((function(t){Q(e,t)}))},G.getAnnotObjectNumAtDevicePoint=function(e,t){var n=t.docId,r=t.pageId,o=t.points,i=t.tolerance,a=t.matrix;return oe(n,r).then((function(e){return e.getAnnotObjectNumAtDevicePoint(o.x,o.y,i,a)})).then((function(t){Q(e,t)}))},G.getAnnotObjNumByNM=function(e,t){var n=t.docId,r=t.pageId,o=t.nm;return oe(n,r).then((function(e){return e.getAnnotObjNumByNM(o)})).then((function(t){Q(e,t)}))},G.getCharInfoAtPoint=function(e,t){var n=t.docId,r=t.pageId,o=t.points,i=t.tolerance;return oe(n,r).then((function(e){return e.getCharInfoAtPoint(o.x,o.y,i)})).then((function(t){Q(e,t)}))},G.getThumb=function(e,t){var n=t.docId,r=t.pageId,o=t.rotate,i=t.ratio;return oe(n,r).then((function(t){return t?t.getThumb(o,i).then((function(t){var n=[];t.buffer&&(n=[t.buffer]),Q(e,t,n)})):X(e,new Error("Page not exists: "+r))}))},G.getMediaBoxBitmap=function(e,t){var n=t.docId,r=t.pageId,o=t.width,i=t.height;return oe(n,r).then((function(t){return t?t.getMediaBoxBitmap(o,i).then((function(t){var n=[];t.buffer&&(n=[t.buffer]),Q(e,t,n)})):X(e,new Error("Page not exists: "+r))}))},G.updateAnnotQuadPointsByCharIndex=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.startCharIndex,a=t.endCharIndex;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.updateQuadPointsByCharIndex(i,a);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setAnnotContent=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.content;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setContent(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setAnnotBorderColor=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.color;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setBorderColor(i);return e.updateModifyTime(),t})).then((function(){Q(e,!0)}))},G.setAnnotOpacity=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.opacity;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setOpacity(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setAnnotRotation=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.rotation;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRotation(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.removeAnnot=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){if(e.hasAnnot(o))return e.getAnnotById(o)})).then((function(e){return e?e.remove():[o]})).then((function(t){Q(e,t||[])}))},G.annotAddReply=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.content;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.addReply(i);return e.updateModifyTime(),t})).then((function(e){return e.pdfPage.update().then((function(){return e}))})).then((function(t){Q(e,t.toJson())}))},G.setAnnotRect=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.rect;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRect(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setAnnotRectAndInnerRect=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.rect,a=t.innerRect;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setAnnotRectAndInnerRect(i,a);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.getAnnotInnerRect=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){t.getInnerRect?Q(e,t.getInnerRect()):Q(e,!1)}))},G.moveAnnotTo=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.position;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.moveTo(i.left,i.top);return e.updateModifyTime(),t})).then((function(t){return Q(e,t)}))},G.setAnnotInnerRect=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.rect;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setInnerRect(i);return e.updateModifyTime(),t})).then((function(t){return Q(e,t)}))},G.setAnnotAPBitmap=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.url,a=t.size;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setAnnotAPBitmap(i,a);return e.updateModifyTime(),t})).then((function(t){return Q(e,t)}))},G.getPDFDocStream=function(e,t){var n=t.docId,r=t.writeStream,o=t.flag,i=void 0;return ne(n).then((function(e){return i=e,e.getStream({writeStream:function(e,t,n){$(r,{arrayBuffer:e,offset:t,size:n},[e])}},o)})).then((function(t){H.push(i.id,r),Q(e,t)}))},G.setAnnotBorderStyle=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.style,a=t.styleParam;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setBorderStyle(i,a);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setAnnotBorderWidth=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.width;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setBorderWidth(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setAnnotFillColor=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.color;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setFillColor(i);return e.updateModifyTime(),!!t.length})).then((function(t){Q(e,t)}))},G.setRedactAnnotFillColor=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.color,a=t.onlyForFill;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setRedactFillColor(i,a),e.updateModifyTime(),!0})).then((function(t){Q(e,t)}))},G.setAnnotBorderInfo=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.borderInfo;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setBorderInfo(i),e.updateModifyTime(),!0})).then((function(t){Q(e,t)}))},G.setRedactOverlayText=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.overlayText;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRedactOverlayText(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setRedactApplyFillColor=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.color;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRedactApplyFillColor(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.removeRedactOverlayText=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.removeRedactOverlayText();return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setRedactOverlayTextAlignment=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.alignment;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRedactOverlayTextAlignment(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setRedactRepeat=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.isRepeat;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRedactRepeat(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setRedactAutoFontSize=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.isAutoFontSize;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRedactAutoFontSize(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.getRedactDefaultAppearance=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){Q(e,t.getRedactDefaultAppearance())}))},G.setRedactDefaultAppearance=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.appearance;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRedactDefaultAppearance(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setRedactOpacity=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.opacity,a=t.only4Fill;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRedactOpacity(i,a);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setAnnotIconName=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.iconName;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setIconName(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.getFileattachmentStream=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.writeStream;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.getStream({writeStream:function(e,t,n){$(i,{arrayBuffer:e,offset:t,size:n},[e])}})})).then((function(t){H.push(o,i),Q(e,t)}))},G.setAnnotEndingStyle=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.isBeginning,a=t.style;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){a=parseInt(a),i?e.setLineStartStyle(a):e.setLineEndStyle(a),e.updateModifyTime()})).then((function(){Q(e)}))},G.enableLineCaption=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.enable;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.enableCaption(i),e.updateModifyTime()})).then((function(){Q(e)}))},G.setLineStartPoint=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.x,a=t.y;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setStartPoint(i,a),e.updateModifyTime()})).then((function(){Q(e)}))},G.setLineEndPoint=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.x,a=t.y;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setEndPoint(i,a),e.updateModifyTime()})).then((function(){Q(e)}))},G.setAnnotLeaderLineLength=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.length;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setLeaderLineLength(i),e.updateModifyTime()})).then((function(){Q(e)}))},G.setAnnotLeaderLineExtend=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.length;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setLeaderLineExtensionLength(i),e.updateModifyTime()})).then((function(){Q(e)}))},G.setAnnotLeaderLineOffset=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.offset;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setLeaderLineOffset(i),e.updateModifyTime()})).then((function(){Q(e)}))},G.setAnnotCaptionOffset=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.x,a=t.y;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setCaptionOffset(i,a),e.updateModifyTime()})).then((function(){Q(e)}))},G.updateAnnotVertexes=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.pointIndex,a=t.x,s=t.y;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.updateVertexes(i,a,s),e.updateModifyTime()})).then((function(){Q(e)}))},G.setAnnotVertexes=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.vertexes;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setVertexes(i),e.updateModifyTime()})).then((function(){Q(e)}))},G.setHighlightingMode=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.highlightingMode;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setHighlightingMode(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.importFromFDF=function(e,t){var n=t.docId,o=t.fdf,i=t.dataType;return I.then((function(e){var t=ue(o),r=ce(o);return Promise.all([e.getFDFDoc({size:t,getBuffer:function(e,t){return r(e,t)}}),ne(n)])})).then((function(e){var t=r(e,2),n=t[0],o=t[1];return[o.importFromFDF(n,i),o]})).then((function(e){var t=r(e,2),n=(t[0],t[1]);return Promise.all(n.getAllLoadedPages().map((function(e){return e.update()})))})).then((function(){Q(e)}))},G.importFromFDFFile=function(e,t){var n=t.docId,o=t.file,i=t.size,a=t.type;return I.then((function(e){var t=void 0;return o instanceof Uint8Array?t=e.getFDFDoc({size:o.byteLength,getBuffer:function(e,t){return o.slice?o.slice(e,e+t):new Uint8Array(o,e,t).buffer}}):"string"==typeof o&&(t=e.getFDFFromURL(o,i)),t})).then((function(e){return Promise.all([e,ne(n)])})).then((function(e){var t=r(e,2),n=t[0],o=t[1],i=o.importFromFDF(n,a);return Promise.all(o.getAllLoadedPages().map((function(e){return e.update()}))).then((function(){return i}))})).then((function(t){Q(e,t)}))},G.setCalloutLineEndingStyle=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.endingStyle;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setCalloutLineEndingStyle(i),e.updateModifyTime()})).then((function(){Q(e)}))},G.setDefaultAppearance=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.da;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){t.setDefaultAppearance(i);t.updateModifyTime(),Q(e)}))},G.setAction=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.type,a=t.trigger,s=t.append;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setAction(a,i,s);return e.updateModifyTime(),t})).then((function(t){Q(e,t.toJson())}))},G.removeAnnotAction=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.removeAction();return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.getAction=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.getAction()})).then((function(t){var n=void 0;n=t?t.toJson():null,Q(e,n)}))},G.getArticleList=function(e,t){return ne(t.docId).then((function(e){return e.getArticle().toJson()})).then((function(t){Q(e,t)}))},G.getStructureRoles=function(e,t){return ne(t.docId).then((function(e){return e.getStructureRoles(e)})).then((function(t){Q(e,t)}))},G.addBookmarksFromStructureRoles=function(e,t){var n=t.docId,r=t.structureRoles,o=t.rootTitle;return ne(n).then((function(e){return e.addBookmarksFromStructureRoles(r,o)})).then((function(t){Q(e,t)}))},G.addAnnotReviewState=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.stateName;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.addReviewState(i);return e.updateModifyTime(),t})).then((function(e){return e.pdfPage.update().then((function(){return e}))})).then((function(t){Q(e,t.toJson())}))},G.addAnnotMarkedState=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.stateName;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.addMarkedState(i);return e.updateModifyTime(),t})).then((function(e){return e.pdfPage.update().then((function(){return e}))})).then((function(t){Q(e,t.toJson())}))},G.removeAllStateAnnots=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.removeAllStateAnnots();return!!t&&(e.updateModifyTime(),e.pdfPage.update().then((function(e){return t})))})).then((function(t){return Q(e,t)}))},G.setStateName=function(e,t){var n=t.docId,r=t.pageId,o=t.stateAnnotId,i=t.stateName;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){t.setStateName(i),t.updateModifyTime(),Q(e,!0)}))},G.setNoteOpenStatus=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.isOpen;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){var n=t.setOpenStatus(i);n&&t.updateModifyTime(),Q(e,n)}))},G.setActionDataByIndex=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.data,a=t.actionIndex;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.action.setActionDataByIndex(i,a);return e.updateModifyTime(),t})).then((function(t){Q(e,t.toJson())}))},G.setCalloutLinePoints=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.calloutLinePoints;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setCalloutLinePoints(i);return e.updateModifyTime(),t})).then((function(){Q(e)}))},G.setSubject=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.subject;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setSubject(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setTitle=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.title;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setTitle(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setCreateDateTime=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.date;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setCreateDateTime(i)})).then((function(t){Q(e,t)}))},G.setModifiedDateTime=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.date;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setModifiedDateTime(i)})).then((function(t){Q(e,t)}))},G.setUniqueId=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.newId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setUniqueId(i,!0)})).then((function(t){Q(e,t)}))},G.setDefaultAp=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.defaultAppearance;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setDefaultAp(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setAlignment=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.value;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setAlignment(i),e.updateModifyTime(),!0})).then((function(t){Q(e,t)}))},G.exportToStardardXml=function(e,t){var n=t.docId,r=t.fileName,o=t.callbackId;return ne(n).then((function(e){return(0,_.initGSDKModule)(e.engine,_.ModuleExporter),e.exportToStardardXml(r,(function(e){$(o,e)}))})).then((function(t){Q(e,t)}))},G.exportToFDF=function(e,t){var n=t.docId,r=t.fileType,o=t.dataType,i=t.pageAnnots;return ne(n).then((function(e){return e.exportToFDF(r,o,i)})).then((function(t){Q(e,t)}))},G.exportToImage=function(e,t){var n=t.docId,r=t.imageSetting,o=t.fileName,i=t.pageRange,a=t.callbackId;return ne(n).then((function(e){return(0,_.initGSDKModule)(e.engine,_.ModuleExporter),e.exportToImage(r,o,i,(function(e){$(a,e)}))})).then((function(t){Q(e,t)}))},G.exportToTxt=function(e,t){var n=t.docId,r=t.taskName,o=t.pageRange,i=t.callbackId;return ne(n).then((function(e){return(0,_.initGSDKModule)(e.engine,_.ModuleExporter),e.exportToTxt(r,o,(function(e){$(i,e)}))})).then((function(t){Q(e,t)}))},G.exportImageObjectToImage=function(e,t){var n=t.docId,r=t.graphicsObject,o=t.imageSetting,i=t.fileName,a=t.callbackId;return ne(n).then((function(e){return(0,_.initGSDKModule)(e.engine,_.ModuleExporter),e.exportImageObjectToImage(r,o,i,(function(e){$(a,e)}))})).then((function(t){Q(e,t)}))},G.cancelExport=function(e,t){return ne(t.docId).then((function(e){return e.cancelExport()})).then((function(t){Q(e,t)}))},G.setAnnotFlag=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.flag;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setFlags(i);return e.updateModifyTime(),t})).then((function(t){Q(e,!0)}))},G.addAnnot=function(e,t){var n=t.docId,r=t.pageId,o=t.annot;return oe(n,r).then((function(e){return e.addAnnot(o)})).then((function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];o?t[n]=o.toJson():t[n]=null}return t})).then((function(t){Q(e,t)}))},G.setImage=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.buffer;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setImage(i);return e.updateModifyTime(),t})).then((function(t){Q(e,!0)}))},G.getAllModuleLicenseRight=function(e){return I.then((function(e){var t=e.engine,n=t.ModuleName,r=Object.keys(n).filter((function(e){return 0===e.indexOf("e_ModuleName")})),o={};return r.length>0&&r.forEach((function(e){var r=e.substr("e_ModuleName".length).toLowerCase(),i=t.Library.HasModuleLicenseRight(n[e]);o[r]=i})),o})).then((function(t){Q(e,t)}))},G.setDictionaryEntry=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.key,a=t.value;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setDictionaryEntry(i,a);return t&&e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.getDictionaryEntry=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.key;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.getDictionaryEntry(i)})).then((function(t){Q(e,t)}))},G.resetAppearanceStream=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){t.resetAppearanceStream(),Q(e)}))},G.isLinearized=function(e,t){return ne(t.docId).then((function(e){return e.isLinearized()})).then((function(t){Q(e,t)}))},G.getLayerNodes=function(e,t){return ne(t.docId).then((function(e){return e.getLayerNodes()})).then((function(t){Q(e,t)}))},G.setLayerNodeVisiable=function(e,t){var n=t.docId,r=t.layerId,o=t.visiable;return ne(n).then((function(e){return!!e.pdfLayer&&e.pdfLayer.setLayerNodeVisiable(r,o)})).then((function(t){Q(e,t)}))},G.addAnnotGroup=function(e,t){var n=t.docId,r=t.pageId,o=t.annots,i=t.headerIndex;return oe(n,r).then((function(e){return e.addAnnotGroup(o,i)})).then((function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];o?t[n]=o.toJson():t[n]=null}return t})).then((function(t){Q(e,t)}))},G.getBlankPageIndexes=function(e,t){return ne(t.docId).then((function(e){return e.getBlankPageIndexes()})).then((function(t){Q(e,t)}))},G.getBookmarks=function(e,t){return ne(t.docId).then((function(e){return e.getBookmarks()})).then((function(t){Q(e,t)}))},G.getCurFileSymbolId=function(e,t){return ne(t.docId).then((function(e){return e.getCurFileSymbolId()})).then((function(t){Q(e,t)}))},G.getFadeOutBackground=function(e,t){var n=t.docId,r=t.imgBuffer;return ne(n).then((function(e){return e.getFadeOutBackground(r)})).then((function(t){Q(e,t)}))},G.getConvertToMono=function(e,t){var n=t.docId,r=t.imgBuffer;return ne(n).then((function(e){return e.getConvertToMono(r)})).then((function(t){Q(e,t)}))},G.createRootBookmark=function(e,t){return ne(t.docId).then((function(e){return e.createRootBookmark()})).then((function(t){Q(e,t)}))},G.insertBookmark=function(e,t){var n=t.docId,r=t.pbkId,o=t.title,i=t.pageIndex,a=t.top,s=t.left,u=t.relationship;return ne(n).then((function(e){return e.insertBookmark(r,o,i,a,s,u)})).then((function(t){Q(e,t)}))},G.setBookmarkProperty=function(e,t){var n=t.docId,r=t.bkId,o=t.properties;return ne(n).then((function(e){return e.setBookmarkProperty(r,o)})).then((function(t){Q(e,t)}))},G.removeBookmark=function(e,t){var n=t.docId,r=t.bkId;return ne(n).then((function(e){return e.removeBookmark(r)})).then((function(t){Q(e,t)}))},G.getBookmarkDestination=function(e,t){var n=t.docId,r=t.bkId;return ne(n).then((function(e){var t=e.rootBookmark.getBookmarkById(r);if(t)return t.getDestination()})).then((function(t){Q(e,t)}))},G.setBookmarkDestination=function(e,t){var n=t.docId,r=t.bkId,o=t.gotoAction;return ne(n).then((function(e){var t=e.rootBookmark.getBookmarkById(r);if(t)return t.setDestination(o)})).then((function(t){Q(e,t)}))},G.getBookmarkAction=function(e,t){var n=t.docId,r=t.bkId;return ne(n).then((function(e){var t=e.rootBookmark.getBookmarkById(r);if(t)return t.getAction()})).then((function(t){Q(e,t)}))},G.setBookmarkAction=function(e,t){var n=t.docId,r=t.bkId,o=t.action;return ne(n).then((function(e){var t=e.rootBookmark.getBookmarkById(r);if(t)return t.setAction(o)})).then((function(t){Q(e,t)}))},G.moveBookmarkAction=function(e,t){var n=t.docId,r=t.bkId,o=t.action,i=t.direction;return ne(n).then((function(e){var t=e.rootBookmark.getBookmarkById(r);if(t)return t.moveAction(o,i)})).then((function(t){Q(e,t)}))},G.removeBookmarkAction=function(e,t){var n=t.docId,r=t.bkId,o=t.action;return ne(n).then((function(e){var t=e.rootBookmark.getBookmarkById(r);if(t)return t.removeAction(o)})).then((function(t){Q(e,t)}))},G.getTextRectsAtRect=function(e,t){var n=t.docId,r=t.pageId,o=t.rect;return oe(n,r).then((function(e){return e.getTextRectsAtRect(o)})).then((function(t){Q(e,t)}))},G.getTextContinuousRectsAtRect=function(e,t){var n=t.docId,r=t.pageId,o=t.rect;return oe(n,r).then((function(e){return e.getTextContinuousRectsAtRect(o)})).then((function(t){Q(e,t)}))},G.getTextContinuousRectsAtPoints=function(e,t){var n=t.docId,r=t.pageId,o=t.point1,i=t.point2,a=t.tolerance,s=t.start,u=t.end;return oe(n,r).then((function(e){return e.getTextContinuousCharInfoAtPoints(o,i,a,s,u)})).then((function(t){Q(e,t)}))},G.getTextContinuousCharsAtRect=function(e,t){var n=t.docId,r=t.pageId,o=t.rect,i=t.allInRect;return oe(n,r).then((function(e){return e.getTextContinuousCharsAtRect(o,i)})).then((function(t){Q(e,t)}))},G.getDoubleClickTextRectAtPoint=function(e,t){var n=t.docId,r=t.pageId,o=t.doubleClickPoint,i=t.tolerance;return oe(n,r).then((function(e){return e.getDoubleClickTextCharInfoAtPoint(o,i)})).then((function(t){Q(e,t)}))},G.getTextSearch=function(e,t){var n=t.docId,r=t.pageId,o=t.pattern,i=t.flags;return oe(n,r).then((function(e){return e.getTextSearch(o,i)})).then((function(t){var n=t.textSearch,r=t.textPage,o=t.strPattern,i=(0,a.default)("page_text_search");L[i]={textSearch:n,textPage:r,strPattern:o},Q(e,i)}))},G.getAnnotTextSearch=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.pattern,s=t.flags;return oe(n,r).then((function(e){return e.getAnnotTextSearch(o,i,s)})).then((function(t){var n=t.textSearch,r=t.strPattern,o=(0,a.default)("annot_text_search");L[o]={textSearch:n,strPattern:r},Q(e,o)}))},G.textSearchFindNext=function(e,t){var n=t.id,r=L[n];return r?(r=r.textSearch).FindNext()?void Q(e,le(r)):Q(e,null):X(e,null,[],"No text search found!!")},G.textSearchFindPrev=function(e,t){var n=t.id,r=L[n];return r?(r=r.textSearch).FindPrev()?void Q(e,le(r)):Q(e,null):X(e,null,[],"No text search found!!")},G.textSearchDestroy=function(e,t){var n=t.id;try{var r=L[n];r.strPattern.delete(),r.textSearch.delete(),r.textPage.delete(),delete L[n]}catch(e){}finally{Q(e)}},G.registerSecurityCallback=function(e,t){var n=t.type,r=t.options;return I.then((function(e){return e.registerSecurityCallback(n,r)})).then((function(t){Q(e,t)}))},G.setDocOpenAction=function(e,t){var n=t.docId,r=t.type,o=t.params;return ne(n).then((function(e){return e.setOpenAction(r,o)})).then((function(t){Q(e,t)}))},G.setDocActionData=function(e,t){var n=t.docId,r=t.data,o=t.index;return ne(n).then((function(e){return e.action.setActionDataByIndex(r,o)})).then((function(t){Q(e,t.toJson())}))},G.moveCaretRectByCharIndex=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.charIndex;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.moveRectByCharIndex(i)})).then((function(t){Q(e,!0)}))},G.setAnnotIntent=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.intent;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setIntent(i)})).then((function(t){Q(e,t)}))},G.setInkList=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.inkList;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setInkList(i)})).then((function(t){Q(e,t)}))},G.setUserName=function(e,t){var n=t.name;return I.then((function(e){return e.setUserName(n)})).then((function(){Q(e)}))},G.getUserName=function(e){return I.then((function(e){return e.getUserName()})).then((function(t){return Q(e,t)}))},G.flatten=function(e,t){var n=t.docId,r=t.pageId,o=t.option;return oe(n,r).then((function(e){return e.flatten(o)})).then((function(t){t?Q(e,t):X(e)}))},G.setDynamicInfoFormula=function(e,t){var n=t.seperator,r=t.timeFormat;(0,f.default)().setDynamicInfoFormula(n,r),Q(e)},G.updatePageInfo=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.toJson()})).then((function(t){Q(e,t)}))},G.setPageRotation=function(e,t){var n=t.docId,r=t.pageId,o=t.rotation;return oe(n,r).then((function(e){return e.setRotation(o)})).then((function(t){Q(e,t)}))},G.getSecurityType=function(e,t){return ne(t.docId).then((function(e){return e.getSecurityType()})).then((function(t){Q(e,t)}))},G.setCertificateAndPermission=function(e,t){var n=t.docId,r=t.infos,o=t.cipher,i=t.isEncryptMetadata;return ne(n).then((function(e){return e.setCertificateAndPermission(r,o,i)})).then((function(t){Q(e,t)}))},G.setPasswordAndPermission=function(e,t){var n=t.docId,r=t.userPassword,o=t.ownerPassword,i=t.permission,a=t.cipher,s=t.isEncryptMetadata;return ne(n).then((function(e){return e.setPasswordAndPermission(r,o,i,a,s)})).then((function(t){Q(e,t)}))},G.removeSecurity=function(e,t){return ne(t.docId).then((function(e){return e.removeSecurity()})).then((function(t){Q(e,t)}))},G.checkPassword=function(e,t){var n=t.docId,r=t.password;return ne(n).then((function(e){return e.checkPassword(r)})).then((function(t){Q(e,t)}))},G.getPermission=function(e,t){return ne(t.docId).then((function(e){return e.getPermission()})).then((function(t){Q(e,t)}))},G.getStdCipherOptions=function(e,t){return ne(t.docId).then((function(e){return e.getStdCipherOptions()})).then((function(t){Q(e,t)}))},G.addWatermark=function(e,t){var n=t.docId,r=t.pageId,o=t.data;return oe(n,r).then((function(e){return e.addWatermark(o)})).then((function(t){Q(e,t)}))},G.getUserPassword=function(e,t){var n=t.docId,r=t.password;return ne(n).then((function(e){return e.getUserPassword(r)})).then((function(t){Q(e,t)}))},G.getPasswordType=function(e,t){return ne(t.docId).then((function(e){return e.getPasswordType()})).then((function(t){Q(e,t)}))},G.setPasswordType=function(e,t){var n=t.docId,r=t.type;return ne(n).then((function(e){return e.setPasswordType(r)})).then((function(t){Q(e,t)}))},G.movePageTo=function(e,t){var n=t.docId,r=t.pageId,o=t.destIndex;return ne(n).then((function(e){return e.movePageTo(r,o)})).then((function(t){Q(e,t)}))},G.insertPage=function(e,t){var n=t.docId,r=t.pageIndex,o=t.width,i=t.height;return ne(n).then((function(e){return e.insertPage(r,o,i)})).then((function(t){Q(e,t)}))},G.removePage=function(e,t){var n=t.docId,r=t.pageIndex,o=void 0;return ne(n).then((function(e){try{o=e.pageIndexMap[r].id}catch(e){}return e.removePage(r)})).then((function(t){t&&j.clearObjectFromCache(n,o),Q(e,t)}))},G.markRedactAnnot=function(e,t){var n=t.docId,r=t.pageId,o=t.rects,i=t.annot;return oe(n,r).then((function(e){return e.markRedactAnnot(o,i)})).then((function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];o?t[n]=o.toJson():t[n]=null}return t})).then((function(t){Q(e,t)}))},G.applyRedaction=function(e,t){return ne(t.docId).then((function(e){return e.applyRedaction()})).then((function(t){Q(e,t)}))},G.redactApply=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.apply()})).then((function(t){Q(e,t)}))},G.setActionDestination=function(e,t){var n=t.docId,r=t.objNum,o=t.destination;return ne(n).then((function(t){return"number"==typeof o.pageIndex?re(n,o.pageIndex).then((function(t){if(!t.isVirtual)return i();Q(e,null)})):i();function i(){return t.getIndirectObject(r).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.setDestination(o),r}))})).then((function(t){Q(e,t.toJson())}))}}))},G.setActionFieldNames=function(e,t){var n=t.docId,r=t.objNum,o=t.fieldNames;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.setFieldNames(o),r}))})).then((function(t){Q(e,t.toJson())}))},G.setActionHideState=function(e,t){var n=t.docId,r=t.objNum,o=t.isHide;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.setHideState(o),r}))})).then((function(t){Q(e,t.toJson())}))},G.setActionScript=function(e,t){var n=t.docId,r=t.objNum,o=t.script;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.setScript(o),r}))})).then((function(t){Q(e,t.toJson())}))},G.setActionOCGState=function(e,t){t.docId,t.objNum,t.layerIds},G.setActionURI=function(e,t){var n=t.docId,r=t.objNum,o=t.uri;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.setURI(o),r}))})).then((function(t){Q(e,t.toJson())}))},G.setActionFlags=function(e,t){var n=t.docId,r=t.objNum,o=t.flags;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.setFlags(o),r}))})).then((function(t){Q(e,t.toJson())}))},G.insertSubAction=function(e,t){var n=t.docId,r=t.objNum,o=t.index,i=t.type;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.insertSubAction(o,i),r}))})).then((function(t){Q(e,t.toJson())}))},G.setSubAction=function(e,t){var n=t.docId,r=t.objNum,o=t.index,i=t.type;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.setSubAction(o,i),r}))})).then((function(t){Q(e,t.toJson())}))},G.removeAllSubActions=function(e,t){var n=t.docId,r=t.objNum;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.removeAllSubActions(),r}))})).then((function(t){Q(e,t.toJson())}))},G.removeSubAction=function(e,t){var n=t.docId,r=t.objNum,o=t.index;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.removeSubAction(o),r}))})).then((function(t){Q(e,t.toJson())}))},G.setActionData=function(e,t){var n=t.docId,r=t.objNum,o=t.data;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.setActionData(o),r}))})).then((function(t){Q(e,t.toJson())}))},G.moveAction=function(e,t){var n=t.docId,r=t.pageId,o=t.objNum,i=t.trigger,a=t.actionData,s=t.direction;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.moveAction(i,a,s);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.getActionFileStream=function(e,t){var n=t.docId,r=t.objNum,o=t.writeStream;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc;return t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t).getFileSpec().getStream((function(e,t,n){$(o,{arrayBuffer:e,offset:t,size:n},[e])}))}))})).then((function(t){Q(e,t)}))};var fe=function(e){var t=new Error("request error: "+e.statusText);return t.error=e.status,t};function he(e,t,n,r){var o=new XMLHttpRequest;if(o.open(e.type||"GET",e.url||e.url,!1,e.user,e.password),o.responseType="arraybuffer",e.headers){var i=e.headers;for(var a in i)o.setRequestHeader(a,i[a])}if(o.setRequestHeader("Range","bytes="+t+"-"+Math.min(t+n-1,r-1)),o.send(e.data),!(o.status>=200&&o.status<300||304===o.status))throw new Error("request error: "+o.status);return o.response}function pe(e,t,n){setTimeout((function(){try{var r=e.next();if(r.done)return void n(r.value);ee(t,r.value),pe(e,t,n)}catch(e){ee(t,-1),n(e.status)}}))}function me(e,t){ne(t.docId).then((function(e){return e.getPDFDictInfo()})).then((function(t){return Q(e,t)}))}function ge(e,t){var n=t.docId,r=t.pageId,o=t.objects;oe(n,r).then((function(e){return e.addAnnotObjects(o)})).then((function(t){return Q(e,t.map((function(e){return e.toJson()})))}))}G.getPDFDocIdByHttpRangeRequest=function(e,t){var n=t.size,o=t.range,a=void 0===o?{}:o,s=void 0,u=void 0,c=void 0;if(n)u=Promise.resolve(n),s=Promise.resolve({});else{var d=(0,i.default)();u=d.promise;var l=(0,i.default)();s=l.promise;!function e(){var t=new XMLHttpRequest;if(t.open(a.type||"GET",a.url||a.url,!0,a.user,a.password),t.responseType="arraybuffer",a.headers){var n=a.headers;for(var r in n)t.setRequestHeader(r,n[r])}void 0===a.firstRequestStatus&&t.setRequestHeader("Range","bytes=0-1"),t.onreadystatechange=function(){if(4===t.readyState)if(t.status>=200&&t.status<300||304===t.status){try{var n=void 0;a.extendOptions&&(n=t.getResponseHeader(a.extendOptions))?l.resolve(JSON.parse(atob(n))):l.resolve({})}catch(e){l.resolve({})}var r=t.getAllResponseHeaders();if(r){var o=r.trim().split(/[\r\n]+/),i={};o.forEach((function(e){var t=e.split(": "),n=t.shift(),r=t.join(": ");i[n]=r}));var s=i["content-range"]||i["Content-Range"],u=void 0;s&&-1!==(u=s.lastIndexOf("/"))?d.resolve(+s.slice(u+1)):t.response instanceof ArrayBuffer?(c=t.response,d.resolve(c.byteLength)):(w.default.getLogger("[JR-Worker]").error("The response header which names 'Content-Range' cannot be obtained. Please confirm whether the HTTP server response is correct. If it is a cross-domain request, please check whether the value of 'Access-Control-Expose-Headers' contains 'Content-Range'"),d.reject(fe(t)))}else d.reject(fe(t))}else 0===t.status&&void 0===a.firstRequestStatus?(a.firstRequestStatus=t.status,e()):d.reject(fe(t))},t.send(a.data)}()}return Promise.all([u,I,s]).then((function(e){var t=r(e,3),n=t[0],o=t[1],i=t[2],s=n;if(c){var u=de(c);return o.getPDFDoc({size:s,getBuffer:function(e,t){return u.read(e,t)},initOpenOptions:i,destroyCallback:function(){u.destroy()},docId:a.docId})}return o.getPDFDoc({size:n,getBuffer:function(e,t){return function(e,t,n,r){for(var o=e.url,i=e.id||o,a=U[i]=U[i]||{buffers:[]},s=+(e.chunkSize||131072),u=Math.floor(t/s),c=Math.floor((t+n)/s),d=a.buffers,l=u,f=c;l<=f;l++)d[l]||(d[l]=he(e,l*s,s,r));if(u===c){var h=d[u],p=t-u*s;return h.slice?h.slice(p,p+n):new Uint8Array(h,p,n).buffer}var m=new Uint8Array(n),g=d[u],y=t-u*s;m.set(new Uint8Array(g,y));for(var _=s-y,v=u+1,b=c-1;v<=b;v++)g=d[v],m.set(new Uint8Array(g),_),_+=s;return g=d[c],m.set(new Uint8Array(g,0,(t+n)%s),_),m.buffer}(a,e,t,s)},initOpenOptions:i,docId:a.docId})})).then((function(e){return c?e.setOriginalStream(c):e.setOriginalStream(a),z[e.id]=a.id||a.url,e.id})).then((function(t){Q(e,t)}))},G.setPopupOpenStatus=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.status;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setOpenStatus(i)})).then((function(t){Q(e,t)}))},G.removePageAllAnnot=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.removeAllAnnot()})).then((function(){Q(e)}))},G.getAnnotWoff=function(e,t){var n=t.docId,r=t.pageId,o=t.id;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.getWoff()})).then((function(t){Q(e,t)}))},G.drmEncrypt=function(e,t){var n=t.docId,r=t.options;return ne(n).then((function(e){return e.drmEncrypt(r)})).then((function(t){return t?Q(e):X(e,{error:-1})}))},G.getTemplates=function(e,t){return ne(t.docId).then((function(e){return e.getTemplates()})).then((function(t){return Q(e,t)}))},G.hideTemplate=function(e,t){var n=t.docId,r=t.templateObj,o=t.isHidden;return ne(n).then((function(e){return e.hideTemplate(r,o)})).then((function(t){return Q(e,t)}))},G.spawnPage=function(e,t){var n=t.docId,r=t.templateObj,o=t.nPage,i=t.bRename,a=t.bOverlay;return ne(n).then((function(e){return e.spawnPage(n,r,o,i,a)})).then((function(t){return Q(e,t)}))},G.removeTemplate=function(e,t){var n=t.docId,r=t.name;return ne(n).then((function(e){return e.removeTemplate(r)})).then((function(t){return Q(e,t)}))},G.getFontBufferByName=function(e,t){var n=t.docId,r=t.fontName;return ne(n).then((function(e){return e.getFontBufferByName(r)})).then((function(t){return Q(e,t)}))},G.getPageSizes=function(e,t){var n=t.docId,r=t.index,o=t.count;return ne(n).then((function(e){return e.getPageSizes(r,o)})).then((function(t){return Q(e,t)}))},G.setMeasureRatio=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.ratioInfo;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setMeasureRatio(i)})).then((function(){Q(e)}))},G.setMeasureUnit=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.unit;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setMeasureUnit(i)})).then((function(){Q(e)}))},G.setMeasureConversionFactor=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.factor;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setMeasureConversionFactor(i)})).then((function(){Q(e)}))},G.startImportPages=function(e,t){var n=t.docId,r=t.destIndex,o=t.file,i=t.password,a=t.flags,s=t.layerName,u=t.startIndex,c=t.endIndex;return ne(n).then((function(e){var t=ue(o),n=ce(o);return e.startImportPages(r,{size:t,getBuffer:function(e,t){return n(e,t)}},i,a,s,u,c)})).then((function(t){return Q(e,t)}))},G.importPagesFromPDFDocs=function(e,t){var n=t.docId,r=t.destIndex,o=t.srcDocs,i=t.layerName;return ne(n).then((function(e){return Promise.all(o.map((function(e){var t=e.srcDocId,n=e.srcPages;return ne(t).then((function(e){return{srcDoc:e,srcPages:n}}))}))).then((function(t){return e.importPagesFromPDFDocs(r,t,i)}))})).then((function(t){return Q(e,t)}))},G.exportPagesToPDFDocs=function(e,t){var n=t.docId,r=t.srcPages,o=t.destDocs,i=t.layerName,a=t.bookmarkTitle;return ne(n).then((function(e){return Promise.all(o.map((function(e){var t=e.destDocId,n=e.destIndex;return ne(t).then((function(e){return{destDoc:e,destIndex:n}}))}))).then((function(t){return e.exportPagesToPDFDocs(r,t,i,a)}))})).then((function(t){return Q(e,t.map((function(e){var t=e.doc,n=e.name;return{docId:t?t.id:null,name:n}})))}))},G.extractPages=function(e,t){var n=t.docId,r=t.pageRange,o=t.writeStream,i=t.file,a=t.password;return ne(n).then((function(e){var t=void 0;if(i){var n=ue(i),s=ce(i);t={size:n,getBuffer:function(e,t){return s(e,t)}}}return e.extractPages(r,{writeStream:function(e,t,n){$(o,{arrayBuffer:e,offset:t,size:n},[e])}},t,a)})).then((function(t){return H.push(n,o),Q(e,t)}))},G.copyPages=function(e,t){var n=t.docId,r=t.pageRange,o=t.destIndex;return ne(n).then((function(e){return e.copyPages(r,o)})).then((function(t){return Q(e,t)}))},G.saveCopyPagesData=function(e,t){var n=t.docId,r=t.pageRange;return ne(n).then((function(e){return e.saveCopyPagesData(r)})).then((function(t){Q(e,t)}))},G.pastePages=function(e,t){var n=t.docId,r=t.destIndex;return ne(n).then((function(e){return e.pastePages(r)})).then((function(t){Q(e,t)})).catch((function(t){return X(e,t)}))},G.embedAllPageThumbnail=function(e,t){return ne(t.docId).then((function(t){pe(t.embedAllPageThumbnail(),"embeddingProgress",Q.bind(null,e))}))},G.removeEmbeddedPageThumbnail=function(e,t){return ne(t.docId).then((function(t){pe(t.removeEmbeddedPageThumbnail(),"removingProgress",Q.bind(null,e))}))},G.cancelEmbedAllPageThumbnail=function(e,t){return ne(t.docId).then((function(e){return e.cancelEmbedAllPageThumbnail()})).then((function(t){Q(e,t)}))},G.cancelRemoveEmbeddedPageThumbnail=function(e,t){return ne(t.docId).then((function(e){return e.cancelRemoveEmbeddedPageThumbnail()})).then((function(t){Q(e,t)}))},G.getAllBoxes=function(e,t){var n=t.docId,r=t.index;return ne(n).then((function(e){return e.getAllBoxes(r)})).then((function(t){return Q(e,t)}))},G.setAllBoxesByIndexes=function(e,t){var n=t.docId,r=t.indexes,o=t.width,i=t.height,a=t.xOffset,s=t.yOffset,u=t.boxes,c=t.isMoveWhite;return ne(n).then((function(e){return e.setAllBoxesByIndexes(r,o,i,a,s,u,c)})).then((function(t){return Q(e,t)}))},G.getPageFormat=function(e,t){var n,r=this,o=t.docId,i=t.type,a=t.previewWidth,s=t.previewHeight,u=t.fileName,c=void 0===u?"":u,d=t.newDocId,l=void 0===d?"":d,f=t.localFormat,h=void 0===f?void 0:f;return ne(o).then((n=D(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=void 0,!(l.length>1)){e.next=6;break}return e.next=4,ne(l);case 4:n=(n=e.sent).doc;case 6:return e.abrupt("return",t.getPageFormat(i,a,s,c,n,h));case 7:case"end":return e.stop()}}),e,r)}))),function(e){return n.apply(this,arguments)})).then((function(t){return Q(e,t)}))},G.addPageFormat=function(e,t){var n,r=this,o=t.docId,i=t.type,a=t.data,s=t.isUpdate;return ne(o).then((n=D(regeneratorRuntime.mark((function e(t){var n,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a&&a.sourceDoc&&a.sourceDoc.docId&&"currentDoc"!==a.sourceDoc.docId)){e.next=5;break}return e.next=3,ne(a.sourceDoc.docId);case 3:n=e.sent,a.sourceDoc.newDoc=n.doc;case 5:if(!a||2!==a.sourceType){e.next=19;break}if(!a.file){e.next=13;break}o=ue(a.file),u=ce(a.file),a.file={size:o,getBuffer:function(e,t){return u(e,t)}},a.doc=null,e.next=19;break;case 13:if(!a.docId){e.next=19;break}return e.next=16,ne(a.docId);case 16:c=e.sent,a.doc=c,a.file=null;case 19:return e.abrupt("return",t.addPageFormat(i,a,s));case 20:case"end":return e.stop()}}),e,r)}))),function(e){return n.apply(this,arguments)})).then((function(t){return Q(e,t)}))},G.getPageFormatThumb=function(e,t){var n,r=this,o=t.docId,i=t.type,a=t.pageIndex,s=t.data,u=t.isUpdate,c=t.bitmapWidth,d=t.bitmapHeight,l=t.rotate;return ne(o).then((n=D(regeneratorRuntime.mark((function e(t){var n,o,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!s||2!==s.sourceType){e.next=14;break}if(!s.file){e.next=8;break}n=ue(s.file),o=ce(s.file),s.file={size:n,getBuffer:function(e,t){return o(e,t)}},s.doc=null,e.next=14;break;case 8:if(!s.docId){e.next=14;break}return e.next=11,ne(s.docId);case 11:f=e.sent,s.doc=f,s.file=null;case 14:return e.abrupt("return",t.getPageFormatThumb(i,a,s,u,c,d,l));case 15:case"end":return e.stop()}}),e,r)}))),function(e){return n.apply(this,arguments)})).then((function(t){return Q(e,t)}))},G.removeAllPageFormat=function(e,t){var n=t.docId,r=t.type;return ne(n).then((function(e){return e.removeAllPageFormat(r)})).then((function(t){return Q(e,t)}))},G.extractPrintPages=function(e,t){var n,r=this,o=t.docId,i=t.data;return ne(o).then((n=D(regeneratorRuntime.mark((function e(t){var n,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("selectedPDF"!==i.rangeType&&"allPDF"!==i.rangeType){e.next=20;break}if(n=[],"allPDF"!==i.rangeType){e.next=8;break}return e.next=5,t.pdfPortfolio.getFolioNodePDFDoc();case 5:n=e.sent,e.next=9;break;case 8:"selectedPDF"===i.rangeType&&(n=i.selectedIds);case 9:o=[],a=0;case 11:if(!(a<n.length)){e.next=19;break}return e.next=14,ne(n[a]);case 14:s=e.sent,o.push(s);case 16:a++,e.next=11;break;case 19:i.docs=o;case 20:return e.abrupt("return",t.extractPrintPages(i));case 21:case"end":return e.stop()}}),e,r)}))),function(e){return n.apply(this,arguments)})).then((function(t){return Q(e,t)}))},G.encryptLicense=function(e,t){return I.then((function(n){return t=n.encryptLicense(t),Q(e,t)}))},G.getHeaderFooter=function(e,t){return ne(t).then((function(e){return e.getHeaderFooter()})).then((function(t){return Q(e,t)}))},G.addHeaderFooter=function(e,t){var n=t.docId,r=t.headerFooter;return ne(n).then((function(e){return e.addHeaderFooter(r)})).then((function(t){return Q(e,t)}),(function(t){return X(e,t,[],t)}))},G.updateHeaderFooter=function(e,t){var n=t.docId,r=t.headerFooter;return ne(n).then((function(e){return e.updateHeaderFooter(r)})).then((function(t){return Q(e,t)}),(function(t){return X(e,t,[],t)}))},G.removeHeaderFooter=function(e,t){return ne(t).then((function(e){return e.removeHeaderFooter()})).then((function(t){return Q(e,t)}))},G.setFontMap=function(e,t){return I.then((function(n){return n.setFontMap(t),Q(e)}),(function(){return X(e)}))},G.addFontMap=function(e,t){return I.then((function(n){return n.addFontMap(t),Q(e)}),(function(){return X(e)}))},G.setWatermarkFontMap=function(e,t){return I.then((function(n){return n.setWatermarkFontMap(t),Q(e)}))},G.paste=function(e,t){var n=t.docId,o=t.pageId,i=t.srcPageId,a=t.type,s=t.objectId,u=t.position;switch(a){case"annot":return Promise.all([oe(n,o),oe(n,i)]).then((function(e){var t=r(e,2),n=t[0],o=t[1],i=o._getAnnotIndexById(s),a=o.page.GetAnnot(i);return n.pasteAnnot(a,u)})).then((function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];o?t[n]=o.toJson():t[n]=null}return t})).then((function(t){return Q(e,t)}));case"graphicObject":return Promise.all([oe(n,o),oe(n,i)]).then((function(t){var o=r(t,2),i=o[0],a=o[1];return G.pasteGraphicObject(e,n,i,a,s,u)})).then((function(e){}))}},G.getAnnotsRawData=function(e,t){var n=t.docId,r=t.rawAnnots;return ne(n).then((function(e){return e.getAnnotsRawData(r)})).then((function(t){return Q(e,t)}))},G.attachFile=function(e,t){var n=t.docId,r=t.blob;return ne(n).then((function(e){return e.attachFile(r)})).then((function(t){return Q(e,t)}))},G.signDoc=function(e,t){var n=t.docId,r=t.signInfo;ne(n).then((function(e){return e.sign(r)})).then((function(t){return Q(e,t,[t.buffer])}))},G.getFontsInfo=function(e,t){ne(t.docId).then((function(e){return e.getFontsInfo()})).then((function(t){return Q(e,t)}))},G.getDocAdditionalActions=function(e,t){ne(t.docId).then((function(e){return e.getAdditionalActions()})).then((function(t){return Q(e,t)}))},G.calcPageContentBBox=function(e,t){var n=t.docId,r=t.pageIndex,o=t.mode;re(n,r).then((function(e){return e.calcContentBBox(o)})).then((function(t){Q(e,t)}))},G.getPageBox=function(e,t){var n=t.docId,r=t.pageIndex,o=t.boxType;re(n,r).then((function(t){return Q(e,t.getBox(o))}))},G.setPageBox=function(e,t){var n=t.docId,r=t.pageIndex,o=t.boxType,i=t.rect;re(n,r).then((function(t){return Q(e,t.setBox(o,i))}))},G.setPageSize=function(e,t){var n=t.docId,r=t.pageIndex,o=t.width,i=t.height;re(n,r).then((function(t){return Q(e,t.setSize(o,i))}))},G.getPageAction=function(e,t){var n=t.docId,r=t.pageId,o=t.trigger;return oe(n,r).then((function(e){return e.getAction(o)})).then((function(t){Q(e,t)}))},G.removePageAction=function(e,t){var n=t.docId,r=t.pageId,o=t.trigger,i=t.action;return oe(n,r).then((function(e){return e.removeAction(o,i)})).then((function(t){Q(e,t)}))},G.movePageAction=function(e,t){var n=t.docId,r=t.pageId,o=t.trigger,i=t.action,a=t.direction;return oe(n,r).then((function(e){return e.moveAction(o,i,a)})).then((function(t){Q(e,t)}))},G.setPageAction=function(e,t){var n=t.docId,r=t.pageId,o=t.trigger,i=t.action;oe(n,r).then((function(e){return e.setAction(o,i)})).then((function(){Q(e,i)}))},G.syncDataCache=function(e,t){var n=t.docId,r=t.pageIdMap;ne(n).then((function(e){return e.syncDataCache(r)})).then((function(){return Q(e)}))},G.moveAnnotsToPage=function(e,t){var n=t.docId,r=t.srcPageId,o=t.dstPageId,i=t.annotInfos;return ne(n).then((function(e){return e.moveAnnotsToPage(r,o,i)})).then((function(e){return e.map((function(e){return e&&e.toJson()}))})).then((function(t){Q(e,t)}))},G.getOriginalStream=function(e,t){ne(t.docId).then((function(e){return e.getOriginalStream()})).then((function(t){return Q(e,t,[t])}))},G.setDocColors=function(e,t){var n=t.docId,r=t.colors;ne(n).then((function(t){return t.setColors(r),Q(e)}))},G.setPageDisplayPreferences=function(e,t){var n=t.docId,r=t.pageDisplayPreferences;ne(n).then((function(t){return t.setPageDisplayPreferences(r),Q(e)}))},G.getWidgetMkOption=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){var n=t.getWidgetMkOption();Q(e,n)}))},G.setWidgetIconCaptionRelation=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.relation;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){t.setWidgetIconCaptionRelation(i),Q(e)}))},G.setWidgetHighlighting=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.mode;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){t.setWidgetHighlighting(i),Q(e)}))},G.setWidgetMkCaption=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.position,a=t.caption;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){var n=t.setWidgetMkCaption(i,a);Q(e,n)}))},G.setWidgetMkIcon=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.position,a=t.buffer;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){var n=t.setWidgetMkIcon(i,a);Q(e,n)}))},G.getWidgetIconFitOption=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){var n=t.getWidgetIconFitOption();Q(e,n)}))},G.setWidgetIconFitOption=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.option;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){var n=t.setWidgetIconFitOption(i);Q(e,n)}))},G.setTabOrder=function(e,t){var n=t.docId,r=t.pageIndex,o=t.type;ne(n).then((function(e){return e.setTabOrder(r,o)})).then((function(t){return Q(e,t)}))},G.getTabOrder=function(e,t){var n=t.docId,r=t.pageIndex;ne(n).then((function(e){return e.getTabOrder(r)})).then((function(t){return Q(e,t)}))},G.setStructureOrder=function(e,t){var n=t.docId,r=t.pageIndex,o=t.idList;ne(n).then((function(e){return e.setStructureOrder(r,o)})).then((function(){return Q(e)}))},G.getAnnotIdArrayByOrder=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.getAnnotIdArrayByOrder()})).then((function(t){return Q(e,t)}))},G.renderTemplatesByObjNum=function(e,t){var n=t.docId,r=t.objNum;return ne(n).then((function(t){Q(e,t.renderTemplatesByObjNum(r))}))},G.getNameTree=function(e,t){var n=t.docId,r=t.type;return ne(n).then((function(t){Q(e,t.getNameTree(r))}))},G.addNameTreeObj=function(e,t){var n=t.docId,r=t.type,o=t.name,i=t.objNum;return ne(n).then((function(t){Q(e,t.addNameTreeObj(r,o,i))}))},G.removeNameTreeObj=function(e,t){var n=t.docId,r=t.type,o=t.name;return ne(n).then((function(t){Q(e,t.removeNameTreeObj(r,o))}))},G.replaceNameTreeObj=function(e,t){var n=t.docId,r=t.type,o=t.name,i=t.objNum;return ne(n).then((function(t){Q(e,t.replaceNameTreeObj(r,o,i))}))},G.renameNameTreeObj=function(e,t){var n=t.docId,r=t.type,o=t.oldName,i=t.newName;return ne(n).then((function(t){Q(e,t.renameNameTreeObj(r,o,i))}))},G.getPageIndexByObjNum=function(e,t){var n=t.docId,r=t.objNum;return ne(n).then((function(t){Q(e,t.getPageIndexByObjNum(r))}))},G.nameTreeTemplatesToPages=function(e,t){var n=t.docId,r=t.name;return ne(n).then((function(t){Q(e,t.nameTreeTemplatesToPages(r))}))},G.nameTreePagesToTemplates=function(e,t){var n=t.docId,r=t.name;return ne(n).then((function(t){Q(e,t.nameTreePagesToTemplates(r))}))},G.showNameTreePageAtTheEnd=function(e,t){return ne(t.docId).then((function(e){return e.showNameTreePageAtTheEnd()})).then((function(t){Q(e,t)}))},G.hideNameTreePage=function(e,t){var n=t.docId,r=t.pageIndex;return ne(n).then((function(t){Q(e,t.hideNameTreePage(r))}))},G.addFileSpec=function(e,t){var n=t.docId,r=t.fileName,o=t.fileBuffer,i=t.modifiedDateTime;return ne(n).then((function(t){Q(e,t.addFileSpec(r,o,i))}))},G.setFileSpecDesc=function(e,t){var n=t.docId,r=t.desc,o=t.objNum;return ne(n).then((function(t){Q(e,t.setFileSpecDesc(r,o))}))},G.getFileSpecStream=function(e,t){var n=t.docId,r=t.fileSpecObjNum,o=t.writeStreamCall;return ne(n).then((function(e){return e.getFileSpecStream(r,(function(e,t,n){$(o,{arrayBuffer:e,offset:t,size:n},[e])}))})).then((function(t){Q(e,t)}))},G.addEmbeddedFileByAttachments=function(e,t){var n=t.docId,r=t.name,o=t.objNum;return ne(n).then((function(t){Q(e,t.attachments.addEmbeddedFile(r,o))}))},G.setEmbeddedFileByAttachments=function(e,t){var n=t.docId,r=t.name,o=t.objNum;return ne(n).then((function(t){Q(e,t.attachments.setEmbeddedFile(r,o))}))},G.removeEmbeddedFileByAttachments=function(e,t){var n=t.docId,r=t.name;return ne(n).then((function(t){Q(e,t.attachments.removeEmbeddedFile(r))}))},G.getPageDictionary=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.getPageDictionary()})).then((function(t){return Q(e,t)}))},G.getSuggestedFormDesignerRect=function(e,t){var n=t.docId,r=t.pageId,o=t.point;return oe(n,r).then((function(e){return e.getSuggestedFormDesignerRect(o)})).then((function(t){return Q(e,t)}))},G.clearDesignerAssitCache=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e&&e.clearDesignerAssitCache()})).then((function(t){return Q(e)}))},G.getPDFDictInfo=me,G.startFormDesignerAssit=function(e,t){ne(t.docId).then((function(e){return e.startFormDesignerAssit()})).then((function(t){return Q(e)}))},G.stopFormDesignerAssit=function(e,t){ne(t.docId).then((function(e){return e.stopFormDesignerAssit()})).then((function(t){return Q(e)}))},G.getPDFDictInfo=me,G.getPageLabels=function(e,t){var n=t.docId,r=t.indexes;ne(n).then((function(e){return e.getPageLabels(r)})).then((function(t){return Q(e,t)}))},G.hasKey=function(e,t){var n=t.docId,r=t.id,o=t.key;ne(n).then((function(e){return e.hasKey(r,o)})).then((function(t){return Q(e,t)}))},G.setAt=function(e,t){var n=t.docId,r=t.id,o=t.key,i=t.value;ne(n).then((function(e){return e.setAt(r,o,i)})).then((function(t){return Q(e,t)}))},G.getAt=function(e,t){var n=t.docId,r=t.id,o=t.key;ne(n).then((function(e){return e.getAt(r,o)})).then((function(t){return Q(e,t)}))},G.setJPXDownSample=function(e,t){return I.then((function(n){return n.setJPXDownSample(t),Q(e)}),(function(){return X(e)}))},G.autoRecognitionForm=function(e,t){ne(t.docId).then((function(e){return e.autoRecognitionForm()})).then((function(t){return Q(e,t)}))},G.isStaticXFA=function(e,t){return ne(t.docId).then((function(e){return e.isStaticXFA()})).then((function(t){return Q(e,t)}))},G.isXFA=function(e,t){return ne(t.docId).then((function(e){return e.isXFA()})).then((function(t){Q(e,t)}))},G.removeXFA=function(e,t){return ne(t.docId).then((function(e){return e.removeXFA()})).then((function(t){return Q(e,t)}))},G.createWebLinks=function(e,t){var n=t.docId,r=t.pageId,o=t.paramPages;return oe(n,r).then((function(e){return e.createWebLinks(o)})).then((function(t){return Q(e,t)}))},G.removeWebLinks=function(e,t){var n=t.docId,r=t.pageId,o=t.paramPages;return oe(n,r).then((function(e){return e.removeWebLinks(o)})).then((function(t){Q(e,t)}))},G.linkHasPA=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){Q(e,t.hasPA())}))},G.linkResetAByPA=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){Q(e,t.resetAByPA())}))},G.getDestinationsArray=function(e,t){return ne(t.docId).then((function(e){return e.getDestinationsArray()})).then((function(t){Q(e,t)}))},G.deleteDestination=function(e,t){var n=t.docId,r=t.pageId,o=t.name;return oe(n,r).then((function(e){return e.deleteDestination(o)})).then((function(t){Q(e,t)}))},G.renameDestination=function(e,t){var n=t.docId,r=t.pageId,o=t.oldName,i=t.newName;return oe(n,r).then((function(t){var n=t.renameDestination(o,i);Q(e,n)}))},G.createDestination=function(e,t){var n=t.docId,r=t.pageId,o=t.title,i=t.pageNum;return oe(n,r).then((function(t){var n=t.createDestination(o,i);Q(e,n)}))},G.resetDestination=function(e,t){var n=t.docId,r=t.pageId,o=t.title,i=t.pageNum;return oe(n,r).then((function(e){return e.resetDestination(o,i)})).then((function(t){Q(e,t)}))},G.moveBookmark=function(e,t){var n=t.docId,r=t.targetBookmarkId,o=t.destBookmarkId,i=t.position;return ne(n).then((function(e){return e.moveBookmark(r,o,i)})).then((function(t){return Q(e,t)}))},G.combineFormsToCSV=function(e,t){var n=t.filesArray,r=t.writeStreamCall;return I.then((function(e){var t=e.engine,o=0,a=(0,i.default)(),s=new t.FormFileInfoArray;n.forEach((function(e){var n=e.file,r=e.name,o=de(n),i=t.ReaderCallback.implement({Release:function(){},GetSize:function(){return o.size},ReadBlock:function(e,n,r){var i=new Uint8Array(function(e,t){return o.read(e,t)}(n,r));return t.HEAPU8.set(i,e),!0}}),a=new t.FormFileInfo(i,(0,g.CWString)(t,""),(0,g.CWString)(t,r));s.Add(a)}));var u=t.StreamCallback.implement({Release:function(){u.delete()},Flush:function(){return a.resolve(o),!0},IsEOF:function(){return!1},GetPosition:function(){return o},GetSize:function(){return o},WriteBlock:function(e,n,i){o+=i;var a=t.HEAPU8.buffer;return function(e,t,n){$(r,{arrayBuffer:e,offset:t,size:n},[e])}(a.slice?a.slice(e,e+i):new Uint8Array(a,e,i).buffer,n,i),!0},ReadBlock:function(e,t,n){return!0}});return t.FormCombination.CombineFormsToCSV(s,u,!1),s.delete(),a.promise})).then((function(t){Q(e,t)}))},G.reversePages=function(e,t){var n=t.docId,r=t.pageRanges;return ne(n).then((function(e){return e.reversePages(r)})).then((function(t){return Q(e,t)}))},G.movePagesTo=function(e,t){var n=t.docId,r=t.pageRange,o=t.destIndex;return ne(n).then((function(e){return e.movePagesTo(r,o)})).then((function(t){Q(e,t)}))},G.removePages=function(e,t){var n=t.docId,r=t.pageRange,o=void 0;return ne(n).then((function(e){try{var t=(0,b.default)(r).sort((function(e,t){return t-e}));o=t.map((function(t){return e.pageIndexMap[t]&&e.pageIndexMap[t].id}))}catch(e){}return e.removePages(r)})).then((function(t){try{o&&t&&o.forEach((function(e){j.clearObjectFromCache(n,e)}))}catch(e){}Q(e,t)}))},G.insertBlankPages=function(e,t){var n=t.docId,r=t.pageRange,o=t.width,i=t.height;return ne(n).then((function(e){return e.insertBlankPages(r,o,i)})).then((function(t){Q(e,t)}))},G.insertBlankPages2=function(e,t){var n=t.docId,r=t.pageRange,o=t.width,i=t.height;return ne(n).then((function(e){return e.insertBlankPages2(r,o,i)})).then((function(t){Q(e,t)}))},G.rotatePages=function(e,t){var n=t.docId,r=t.pageRange,o=t.rotation;return ne(n).then((function(e){return e.rotatePages(r,o)})).then((function(t){Q(e,t)}))},G.getPageIndexByLabelText=function(e,t){var n=t.docId,r=t.text;return ne(n).then((function(e){return y.getPageIndexByLabelText(e,r)})).then((function(t){Q(e,t)}))},G.getCurrentPageLabelInfo=function(e,t){var n=t.docId,r=t.pageIndex;return ne(n).then((function(e){return y.getCurrentPageLabelInfo(e,r)})).then((function(t){Q(e,t)}))},G.checkDocIsUseLogicPage=function(e,t){return ne(t.docId).then((function(e){return y.checkDocIsUseLogicPage(e)})).then((function(t){Q(e,t)}))},G.formatPageNumbers=function(e,t){var n=t.docId,r=t.isExtendNumbering,o=t.pageRange,i=t.numberingInfo;return ne(n).then((function(e){return y.formatPageNumbers(e,r,o,i)})).then((function(t){Q(e,t)}))},G.updatePageLabelsByAction=function(e,t){var n=t.docId,r=t.action,o=t.args;return ne(n).then((function(e){var t;return(t=y.UpdatePageLabels)[r].apply(t,[e].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(o)))})).then((function(t){Q(e,t)}))},G.getPortfolioTreeNode=function(e,t){return ne(t.docId).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.getTreeNode()})).then((function(t){return Q(e,t)}))},G.getPortfolioInitialNodePath=function(e,t){return ne(t.docId).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.getInitialNodePath()})).then((function(t){return Q(e,t)}))},G.sendSortFolioParam=function(e,t){var n=t.docId,r=t.target,o=t.order;return ne(n).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.sendSortFolioParam(r,o)})).then((function(t){return Q(e,t)}))},G.recordPDFFileByPortFolioNode=function(e,t){var n=t.docId,r=t.handle;return ne(n).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.recordPDFFileByPortFolioNode(r)})).then((function(t){return Q(e,t)}))},G.getFolioNodePDFDoc=function(e,t){return ne(t.docId).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.getFolioNodePDFDoc()})).then((function(t){return Q(e,t)}))},G.getPortfolioFileStream=function(e,t){var n=t.docId,r=t.nodeHandle,o=t.writeStream;return ne(n).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.getFileStream(r,{writeStream:function(e,t,n){$(o,{arrayBuffer:e,offset:t,size:n},[e])}})})).then((function(t){Q(e,t)}))},G.getPortfolioStream=function(e,t){var n=t.docId,r=t.nodeHandles;return ne(n).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.getStream(r)})).then((function(t){Q(e,t)}))},G.getPortfolioSubNodes=function(e,t){var n=t.docId,r=t.nodeHandle;return ne(n).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.getPortfolioSubNodes(r)})).then((function(t){Q(e,t)}))},G.changePortfolioSubNodesOrder=function(e,t){var n=t.docId,r=t.nodeHandle,o=t.sourceIndexes,i=t.targetIndex;return ne(n).then((function(e){e.pdfPortfolio&&e.pdfPortfolio.changeSubNodesOrder(r,o,i)})).then((function(){Q(e)}))},G.portfolioMoveSubNodeToSubFolderNode=function(e,t){var n=t.docId,r=t.nodeHandle,o=t.sourceHandles,i=t.targetHandle;return ne(n).then((function(e){e.pdfPortfolio&&e.pdfPortfolio.moveSubNodeToSubFolderNode(r,o,i)})).then((function(){Q(e)}))},G.portfolioHasSameNameSubNode=function(e,t){var n=t.docId,r=t.name,o=t.type,i=t.targetHandle;return ne(n).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.hasSameNameSubNode(r,o,i)})).then((function(t){Q(e,t)}))},G.getPortfolioInfo=function(e,t){return ne(t.docId).then((function(t){var n=t.pdfPortfolio?t.pdfPortfolio.getInfo():{};Q(e,n)}))},G.setPortfolioInfo=function(e,t){var n=t.docId,r=t.info;return ne(n).then((function(t){t.pdfPortfolio&&t.pdfPortfolio.setInfo(r),Q(e)}))},G.portfolioAddFiles=function(e,t){var n=t.docId,r=t.files,o=t.targetIndex,i=t.folderNodeHandle;return ne(n).then((function(t){t.pdfPortfolio&&t.pdfPortfolio.addFiles(r,o,i),Q(e)}))},G.portfolioCreateFolder=function(e,t){var n=t.docId,r=t.name,o=t.folderNodeHandle;return ne(n).then((function(t){var n=t.pdfPortfolio?t.pdfPortfolio.createFolder(r,o):{};Q(e,n)}))},G.portfolioRemoveSubNodes=function(e,t){var n=t.docId,r=t.folderNodeHandle,o=t.subNodeHandles;return ne(n).then((function(t){t.pdfPortfolio&&t.pdfPortfolio.removeSubNodes(r,o),Q(e)}))},G.portfolioRegenerateTOC=function(e,t){var n=t.docId,r=t.title;return ne(n).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.regenerateTOC(r)})).then((function(t){Q(e,t)}))},G.getSnappedPoint=function(e,t){var n=t.docId,r=t.pageId,o=t.point,i=t.mode;return oe(n,r).then((function(e){return e.getSnappedPoint(o,i)})).then((function(t){Q(e,t)}))},G.getPageTextRectCount=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.getTextRectCount()})).then((function(t){return Q(e,t),t}))},G.getPageTextByRectIndex=function(e,t){var n=t.docId,r=t.pageId,o=t.rectIndex;return oe(n,r).then((function(e){return e.getTextByRectIndex(o)})).then((function(t){return Q(e,t),t}))},G.isCPDF=function(e,t){return ne(t.docId).then((function(t){return Q(e,t.isCPDF())}))},G.getDocURI=function(e,t){return ne(t.docId).then((function(t){return Q(e,t.getDocURI())}))},G.convertToCPDF=function(e,t){var n=t.docId,r=t.cPDFFileName,o=t.cPDFEndPoint,i=t.cPDFUserToken,a=t.cPDFUserIDFromToken;return ne(n).then((function(t){return t.convertToCPDF(r,o,i,a).then((function(){return Q(e)}))}))},G.removeCDocId=function(e,t){var n=t.docId,r=t.cPDFFileName,o=t.cPDFEndPoint,i=t.cPDFUserToken,a=t.cPDFUserIDFromToken;return console.log(e),ne(n).then((function(t){return t.removeCDocId(r,o,i,a).then((function(){return Q(e)}))}))},G.removeLayerNode=function(e,t){var n=t.docId,r=t.layerId;return ne(n).then((function(e){return!!e.pdfLayer&&e.pdfLayer.removeLayerNode(r,e)})).then((function(t){return Q(e,t)}))},G.getLayersByPage=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.pdfDoc.pdfLayer.getLayersByPage(e)})).then((function(t){return Q(e,t)}))},G.updateLayerInfo=function(e,t){var n=t.docId,r=t.layerInfo;return ne(n).then((function(t){var n=r.id;if(!n&&0!==n)return Q(e,!1);for(var o in r){var i=r[o];switch(o){case"name":t.pdfLayer.setLayerName(n,i);break;case"intent":t.pdfLayer.setLayerIntent(n,i,r.isSingle);break;case"state":t.pdfLayer.setLayerDefaultState(n,i);break;case"isLocked":t.pdfLayer.setLayerLocked(n,i);break;case"viewUsage":t.pdfLayer.setLayerViewUsage(n,i);break;case"printUsage":t.pdfLayer.setLayerPrintUsage(n,i);break;case"exportUsage":t.pdfLayer.setLayerExportUsage(n,i)}}return Q(e,!0)}))},G.flattenLayers=function(e,t){return ne(t.docId).then((function(e){return!!e.pdfLayer&&e.pdfLayer.flattenLayers(e)})).then((function(t){return Q(e,t)}))},G.mergeLayers=function(e,t){var n=t.docId,r=t.layerIds,o=t.mergeTo;return ne(n).then((function(e){return!!e.pdfLayer&&e.pdfLayer.mergeLayers(e,r,o)})).then((function(t){return Q(e,t)}))},G.getLayerRelatedAnnots=function(e,t){var n=t.docId,r=t.layerId;return ne(n).then((function(e){return!!e.pdfLayer&&e.pdfLayer.getLayerNodeById(r).getRelatedAnnots().map((function(e){return e.GetDict().GetObjNum()}))})).then((function(t){return Q(e,t)}))},G.layerMoveTo=function(e,t){var n=t.docId,r=t.layerId,o=t.parentLayerId,i=t.index;return ne(n).then((function(e){return!!e.pdfLayer&&e.pdfLayer.moveTo(r,o,i)})).then((function(t){return Q(e,t)}))},G.getInfos=function(e,t){return ne(t.docId).then((function(t){Q(e,t.getInfos())}))},G.hasDocIsWrapped=function(e,t){return ne(t.docId).then((function(t){Q(e,t.doc.IsWrapper())}))},G.removeMetadata=function(e,t){var n=t.id,r=t.key;return ne(n).then((function(t){return Q(e,t.removeMetadata(r))}))},G.addAnnotObjects=ge,G.normalizePage=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.normalize()})).then((function(t){return Q(e,t),t}))},G.addAnnotObjects=ge,G.getViewerPreference=function(e,t){return ne(t.docId).then((function(t){return Q(e,t.getViewerPreference())}))},G.setViewPreference=function(e,t){var n=t.docId,r=t.key,o=t.value;return ne(n).then((function(t){return Q(e,t.setViewPreference(r,o))}))},G.getEmbeddedFontData=function(e,t){return ne(t.docId).then((function(t){return Q(e,t.getEmbeddedFontData())}))},G.computeAuditSpace=function(e,t){return ne(t.docId).then((function(e){return e.computeAuditSpace()})).then((function(t){return Q(e,t)}))},G.optimizer=function(e,t){var n=t.docId,r=t.option,o=t.portfolioNodeHandle;return ne(n).then((function(e){return e.optimizer(r,o)})).then((function(t){return Q(e,t)}))},G.optimizeScannedPDF=function(e,t){var n=t.docId,r=t.option,o=t.callback;return ne(n).then((function(e){return e.optimizeScannedPDF(r,(function(e){$(o,e)}))})).then((function(t){return Q(e,t)}))},G.startReplacePages=function(e,t){var n=t.docId,r=t.startIndex,o=t.count,i=t.srcPdfDocId,a=t.srcPageindexRange;return ne(n).then((function(t){return ne(i).then((function(n){return Q(e,t.startReplacePages(r,o,n,a))}))}))},G.importAsLayer=function(e,t){var n=t.docId,r=t.args;return ne(n).then((function(t){return ne(r.sourcePdfDocId).then((function(e){return r.sourcePdfDoc=e.doc,t.importAsLayer(r)})).then((function(t){return Q(e,t)}))}))},G.previewImportLayer=function(e,t){var n=t.docId,r=t.args;return ne(n).then((function(t){return r.sourcePdfDocId?ne(r.sourcePdfDocId).then((function(n){return r.sourcePdfDoc=n.doc,Q(e,t.previewImportLayer(r))})):Q(e,t.previewImportLayer(r))}))},G.compareDoc=function(e,t){var n=t.baseDocId,r=t.compareDocId,o=t.basePageCount,i=t.comparedPageCount,a=t.newTemplateId,s=t.oldTemplateId,u=t.basePageIndex,c=t.comparePageIndex,d=(t.comparePageNum,t.inputOptions),l=t.compareResultStrings;return I.then((function(e){var t=e.engine,f=t.ComparisonProgresssCallback.implement({Release:function(){},UpdateCurrentStateData:function(e,t){ee("compareProgress",e)},ShouldCancel:function(){}}),h=e.getPDFDocById(n),p=e.getPDFDocById(r),m=e.getPDFDocById(a),g=e.getPDFDocById(s),y=new t.Comparison(h.doc,p.doc),_=new t.ComparisonOptions;Object.keys(d).forEach((function(e){_[e]=d[e]}));var v=new t.WString(h.oriFile.name),b=new t.WString(p.oriFile.name),S=new t.ComparisonStringResource;Object.keys(l).forEach((function(e){S[e]=new t.WString(l[e])}));var w=y.GenerateComparedDoc(u,c,o,i,_,v,b,m.doc,g.doc,S,f);return e.getPDFDoc({engineDoc:w}).id})).then((function(t){Q(e,t)}))},G.reloadLayer=function(e,t){return ne(t.docId).then((function(t){Q(e,t.reloadLayer())}))},G.getMeasureScaleRatio=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.getMeasureScaleRatio()})).then((function(t){return Q(e,t),t}))},G.exportMeasureData=function(e,t){var n=t.docId,r=t.columnNames;return ne(n).then((function(e){return e.exportMeasureData(r)})).then((function(t){return Q(e,t)}))},G.setMeasureScaleRatio=function(e,t){var n=t.docId,r=t.pageId,o=t.storeInPage,i=t.measureInfo;return oe(n,r).then((function(e){return e.setMeasureRatio(o,i)})).then((function(t){return Q(e,t),t}))},G.searchDoc=function(e,t){var n=t.docId,r=t.type,o=t.words,i=t.flag,a=t.isForRedact;return ne(n).then((function(e){return e.search(r,o,i,a)})).then((function(t){return Q(e,t)}))},G.generateDocHash=function(e,t){var n=t.docId,r=t.buffer;return ne(n).then((function(e){return e.generateDocHash(r)})).then((function(t){return Q(e,t)}))},G.convertToTextMarkup=function(e,t){var n=t.docId,r=t.findResults;return ne(n).then((function(e){return e.convertToTextMarkup(r)})).then((function(t){return Q(e,t)}))},G.redactSearch=function(e,t){var n=t.docId,r=t.findResults,o=t.start,i=t.count,a=t.overlayTexts,s=t.opts;return ne(n).then((function(e){return e.redactSearch(r,o,i,a,s)})).then((function(t){return Q(e,t)}))},G.updateBeadRect=function(e,t){var n=t.docId,r=t.threadObjNum,o=t.beadObjNum,i=t.rect;return ne(n).then((function(e){return e.article.getThreadInfo(r).getBeadInfo(o).update({rect:i})})).then((function(t){return Q(e,t)}))},G.insertThread=function(e,t){var n=t.docId,r=t.threadInfo;return ne(n).then((function(e){return e.article.insertThread(r)})).then((function(t){return Q(e,t)}))},G.updateThread=function(e,t){var n=t.docId,r=t.threadInfo;return ne(n).then((function(e){return e.article.getThreadInfo(r.objNum).update(r)})).then((function(t){return Q(e,t)}))},G.removeThread=function(e,t){var n=t.docId,r=t.objNum;return ne(n).then((function(e){var t=e.article.removeThread(r);return t&&e.getArticle(!0),t})).then((function(t){return Q(e,t)}))},G.insertBead=function(e,t){var n=t.docId,r=t.pageIndex,o=t.threadObjNum,i=t.pdfBeadRect,a=t.beadIndex;return ne(n).then((function(e){return e.article.getThreadInfo(o).insertBead(r,i,a)})).then((function(t){return Q(e,t)}))},G.removeBead=function(e,t){var n=t.docId,r=t.threadObjNum,o=t.beadObjNum;return ne(n).then((function(e){return e.article.getThreadInfo(r).removeBead(o)})).then((function(t){return Q(e,t)}))},G.mergeThread=function(e,t){var n=t.docId,r=t.threadObjNum,o=t.mergeToThreadObjNum;return ne(n).then((function(e){var t=e.article,n=t.getThreadInfo(r),i=t.getThreadInfo(o);return n.children.reverse().forEach((function(e){var t=e.toJson(),n=t.pageIndex,r=t.rect;i.insertBead(n,r,0)})),i.toJson()})).then((function(t){return Q(e,t)}))},G.setRenderConfigLineWeight=function(e,t){var n=t.docId,r=t.lineWeight;return ne(n).then((function(t){return t.setRenderConfigLineWeight(r),Q(e)}))},G.isScannedDoc=function(e,t){return ne(t.docId).then((function(e){return e.isScannedDoc()})).then((function(t){return Q(e,t)}))},G.getCompareFileFilterNums=function(e,t){return ne(t.docId).then((function(t){var n=t.getCompareFileFilterNums();return Q(e,n)}))},G.removePDFAID=function(e,t){return ne(t.docId).then((function(t){return t.removePDFAID(),Q(e)}))},G.setPageTransition=function(e,t){var n=t.docId,r=t.transName,o=t.direction,i=t.speed,a=t.range;return ne(n).then((function(t){return Q(e,t.setPageTransition(r,o,i,a))}))},G.getPageTransitionByIndex=function(e,t){var n=t.docId,r=t.pageIndex;return ne(n).then((function(t){return Q(e,t.getPageTransitionByIndex(r))}))},G.getPageTransition=function(e,t){var n=t.docId,r=t.pageId;return oe(n,r).then((function(t){return Q(e,t.getPageTransition(r))}))},G.isScannedPage=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.isScannedPage()})).then((function(t){return Q(e,t)}))},G.getPureTexts=function(e,t){return oe(t.docId,t.pageId).then((function(t){t.getPureTexts().then((function(t){Q(e,t)}))}))},G.hiddenDataSanitizeDocument=function(e,t){return ne(t.docId).then((function(t){return(0,S.sanitizeDocument)(t).then((function(t){return Q(e,t)}))}))},G.hiddenDataRemoveHiddenInfo=function(e,t){var n=t.docId,r=t.options;return ne(n).then((function(t){return(0,S.removeHiddenInfo)(t,r).then((function(t){return Q(e,t)}))}))},G.handleGroupMarkup=function(e,t){var n=t.docId,r=t.pageId,o=t.annotIds,i=t.isGroup;return oe(n,r).then((function(e){return e.handleGroupMarkup(o,i)})).then((function(t){return Q(e,t)}))},G.setRedactAppearance=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.option;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRedactAppearance(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.getText=function(e,t){var n=t.docId,r=t.pageRange,o=t.taskId,i=t.taskProgress;return ne(n).then((function(e){return e.getText(r,o,{taskProgress:function(e){$(i,e,[])}})})).then((function(t){Q(e,t)}))},G.cancelTaskProgress=function(e,t){var n=t.docId,r=t.taskId;return ne(n).then((function(e){return e.cancelTaskProgress(r)})).then((function(t){Q(e,t)}))},G.getPageTexts=function(e,t){var n=t.docId,r=t.pageId,o=t.settings,i=t.minWidth;return oe(n,r).then((function(t){var n=t.getTexts(o,i);return Q(e,n)}))},G.cacheFontConfig=function(e,t){I.then((function(e){return e.cacheFontConfig(t)})).then((function(){Q(e)}))},G.getFxcoreFontList=function(e,t){I.then((function(e){return e.getFxcoreFontList(t)})).then((function(t){Q(e,t)}))}},function(e,t,n){"use strict";(function(e){if(n(408),n(605),n(606),e._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");e._babelPolyfill=!0;function t(e,t,n){e[t]||Object.defineProperty(e,t,{writable:!0,configurable:!0,value:n})}t(String.prototype,"padLeft","".padStart),t(String.prototype,"padRight","".padEnd),"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach((function(e){[][e]&&t(Array,e,Function.call.bind([][e]))}))}).call(this,n(14))},function(e,t,n){n(409),n(412),n(413),n(414),n(415),n(416),n(417),n(418),n(419),n(420),n(421),n(422),n(423),n(424),n(425),n(426),n(427),n(428),n(429),n(430),n(431),n(432),n(433),n(434),n(435),n(436),n(437),n(438),n(439),n(440),n(441),n(442),n(443),n(444),n(445),n(446),n(447),n(448),n(449),n(450),n(451),n(452),n(453),n(454),n(455),n(456),n(457),n(458),n(459),n(460),n(461),n(462),n(463),n(464),n(465),n(466),n(467),n(468),n(469),n(470),n(471),n(472),n(473),n(474),n(475),n(476),n(477),n(478),n(479),n(480),n(481),n(482),n(483),n(484),n(485),n(486),n(487),n(489),n(490),n(492),n(493),n(494),n(495),n(496),n(497),n(498),n(500),n(501),n(502),n(503),n(504),n(505),n(506),n(507),n(508),n(509),n(510),n(511),n(512),n(148),n(513),n(198),n(514),n(199),n(515),n(516),n(517),n(518),n(519),n(202),n(204),n(205),n(520),n(521),n(522),n(523),n(524),n(525),n(526),n(527),n(528),n(529),n(530),n(531),n(532),n(533),n(534),n(535),n(536),n(537),n(538),n(539),n(540),n(541),n(542),n(543),n(544),n(545),n(546),n(547),n(548),n(549),n(550),n(551),n(552),n(553),n(554),n(555),n(556),n(557),n(558),n(559),n(560),n(561),n(562),n(563),n(564),n(565),n(566),n(567),n(568),n(569),n(570),n(571),n(572),n(573),n(574),n(575),n(576),n(577),n(578),n(579),n(580),n(581),n(582),n(583),n(584),n(585),n(586),n(587),n(588),n(589),n(590),n(591),n(592),n(593),n(594),n(595),n(596),n(597),n(598),n(599),n(600),n(601),n(602),n(603),n(604),e.exports=n(32)},function(e,t,n){"use strict";var r=n(5),o=n(27),i=n(11),a=n(1),s=n(24),u=n(50).KEY,c=n(6),d=n(80),l=n(69),f=n(56),h=n(9),p=n(180),m=n(129),g=n(411),y=n(91),_=n(4),v=n(7),b=n(15),S=n(28),w=n(40),M=n(55),D=n(59),P=n(183),T=n(29),k=n(90),A=n(12),L=n(57),F=T.f,I=A.f,x=P.f,C=r.Symbol,R=r.JSON,O=R&&R.stringify,G=h("_hidden"),E=h("toPrimitive"),Y={}.propertyIsEnumerable,j=d("symbol-registry"),N=d("symbols"),B=d("op-symbols"),H=Object.prototype,W="function"==typeof C&&!!k.f,U=r.QObject,z=!U||!U.prototype||!U.prototype.findChild,J=i&&c((function(){return 7!=D(I({},"a",{get:function(){return I(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=F(H,t);r&&delete H[t],I(e,t,n),r&&e!==H&&I(H,t,r)}:I,V=function(e){var t=N[e]=D(C.prototype);return t._k=e,t},K=W&&"symbol"==typeof C.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof C},q=function(e,t,n){return e===H&&q(B,t,n),_(e),t=w(t,!0),_(n),o(N,t)?(n.enumerable?(o(e,G)&&e[G][t]&&(e[G][t]=!1),n=D(n,{enumerable:M(0,!1)})):(o(e,G)||I(e,G,M(1,{})),e[G][t]=!0),J(e,t,n)):I(e,t,n)},Z=function(e,t){_(e);for(var n,r=g(t=S(t)),o=0,i=r.length;i>o;)q(e,n=r[o++],t[n]);return e},X=function(e){var t=Y.call(this,e=w(e,!0));return!(this===H&&o(N,e)&&!o(B,e))&&(!(t||!o(this,e)||!o(N,e)||o(this,G)&&this[G][e])||t)},Q=function(e,t){if(e=S(e),t=w(t,!0),e!==H||!o(N,t)||o(B,t)){var n=F(e,t);return!n||!o(N,t)||o(e,G)&&e[G][t]||(n.enumerable=!0),n}},$=function(e){for(var t,n=x(S(e)),r=[],i=0;n.length>i;)o(N,t=n[i++])||t==G||t==u||r.push(t);return r},ee=function(e){for(var t,n=e===H,r=x(n?B:S(e)),i=[],a=0;r.length>a;)!o(N,t=r[a++])||n&&!o(H,t)||i.push(N[t]);return i};W||(s((C=function(){if(this instanceof C)throw TypeError("Symbol is not a constructor!");var e=f(arguments.length>0?arguments[0]:void 0),t=function(n){this===H&&t.call(B,n),o(this,G)&&o(this[G],e)&&(this[G][e]=!1),J(this,e,M(1,n))};return i&&z&&J(H,e,{configurable:!0,set:t}),V(e)}).prototype,"toString",(function(){return this._k})),T.f=Q,A.f=q,n(60).f=P.f=$,n(82).f=X,k.f=ee,i&&!n(49)&&s(H,"propertyIsEnumerable",X,!0),p.f=function(e){return V(h(e))}),a(a.G+a.W+a.F*!W,{Symbol:C});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ne=0;te.length>ne;)h(te[ne++]);for(var re=L(h.store),oe=0;re.length>oe;)m(re[oe++]);a(a.S+a.F*!W,"Symbol",{for:function(e){return o(j,e+="")?j[e]:j[e]=C(e)},keyFor:function(e){if(!K(e))throw TypeError(e+" is not a symbol!");for(var t in j)if(j[t]===e)return t},useSetter:function(){z=!0},useSimple:function(){z=!1}}),a(a.S+a.F*!W,"Object",{create:function(e,t){return void 0===t?D(e):Z(D(e),t)},defineProperty:q,defineProperties:Z,getOwnPropertyDescriptor:Q,getOwnPropertyNames:$,getOwnPropertySymbols:ee});var ie=c((function(){k.f(1)}));a(a.S+a.F*ie,"Object",{getOwnPropertySymbols:function(e){return k.f(b(e))}}),R&&a(a.S+a.F*(!W||c((function(){var e=C();return"[null]"!=O([e])||"{}"!=O({a:e})||"{}"!=O(Object(e))}))),"JSON",{stringify:function(e){for(var t,n,r=[e],o=1;arguments.length>o;)r.push(arguments[o++]);if(n=t=r[1],(v(t)||void 0!==e)&&!K(e))return y(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!K(t))return t}),r[1]=t,O.apply(R,r)}}),C.prototype[E]||n(23)(C.prototype,E,C.prototype.valueOf),l(C,"Symbol"),l(Math,"Math",!0),l(r.JSON,"JSON",!0)},function(e,t,n){e.exports=n(80)("native-function-to-string",Function.toString)},function(e,t,n){var r=n(57),o=n(90),i=n(82);e.exports=function(e){var t=r(e),n=o.f;if(n)for(var a,s=n(e),u=i.f,c=0;s.length>c;)u.call(e,a=s[c++])&&t.push(a);return t}},function(e,t,n){var r=n(1);r(r.S,"Object",{create:n(59)})},function(e,t,n){var r=n(1);r(r.S+r.F*!n(11),"Object",{defineProperty:n(12).f})},function(e,t,n){var r=n(1);r(r.S+r.F*!n(11),"Object",{defineProperties:n(182)})},function(e,t,n){var r=n(28),o=n(29).f;n(42)("getOwnPropertyDescriptor",(function(){return function(e,t){return o(r(e),t)}}))},function(e,t,n){var r=n(15),o=n(30);n(42)("getPrototypeOf",(function(){return function(e){return o(r(e))}}))},function(e,t,n){var r=n(15),o=n(57);n(42)("keys",(function(){return function(e){return o(r(e))}}))},function(e,t,n){n(42)("getOwnPropertyNames",(function(){return n(183).f}))},function(e,t,n){var r=n(7),o=n(50).onFreeze;n(42)("freeze",(function(e){return function(t){return e&&r(t)?e(o(t)):t}}))},function(e,t,n){var r=n(7),o=n(50).onFreeze;n(42)("seal",(function(e){return function(t){return e&&r(t)?e(o(t)):t}}))},function(e,t,n){var r=n(7),o=n(50).onFreeze;n(42)("preventExtensions",(function(e){return function(t){return e&&r(t)?e(o(t)):t}}))},function(e,t,n){var r=n(7);n(42)("isFrozen",(function(e){return function(t){return!r(t)||!!e&&e(t)}}))},function(e,t,n){var r=n(7);n(42)("isSealed",(function(e){return function(t){return!r(t)||!!e&&e(t)}}))},function(e,t,n){var r=n(7);n(42)("isExtensible",(function(e){return function(t){return!!r(t)&&(!e||e(t))}}))},function(e,t,n){var r=n(1);r(r.S+r.F,"Object",{assign:n(184)})},function(e,t,n){var r=n(1);r(r.S,"Object",{is:n(185)})},function(e,t,n){var r=n(1);r(r.S,"Object",{setPrototypeOf:n(133).set})},function(e,t,n){"use strict";var r=n(70),o={};o[n(9)("toStringTag")]="z",o+""!="[object z]"&&n(24)(Object.prototype,"toString",(function(){return"[object "+r(this)+"]"}),!0)},function(e,t,n){var r=n(1);r(r.P,"Function",{bind:n(186)})},function(e,t,n){var r=n(12).f,o=Function.prototype,i=/^\s*function ([^ (]*)/;"name"in o||n(11)&&r(o,"name",{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var r=n(7),o=n(30),i=n(9)("hasInstance"),a=Function.prototype;i in a||n(12).f(a,i,{value:function(e){if("function"!=typeof this||!r(e))return!1;if(!r(this.prototype))return e instanceof this;for(;e=o(e);)if(this.prototype===e)return!0;return!1}})},function(e,t,n){var r=n(1),o=n(188);r(r.G+r.F*(parseInt!=o),{parseInt:o})},function(e,t,n){var r=n(1),o=n(189);r(r.G+r.F*(parseFloat!=o),{parseFloat:o})},function(e,t,n){"use strict";var r=n(5),o=n(27),i=n(34),a=n(135),s=n(40),u=n(6),c=n(60).f,d=n(29).f,l=n(12).f,f=n(71).trim,h=r.Number,p=h,m=h.prototype,g="Number"==i(n(59)(m)),y="trim"in String.prototype,_=function(e){var t=s(e,!1);if("string"==typeof t&&t.length>2){var n,r,o,i=(t=y?t.trim():f(t,3)).charCodeAt(0);if(43===i||45===i){if(88===(n=t.charCodeAt(2))||120===n)return NaN}else if(48===i){switch(t.charCodeAt(1)){case 66:case 98:r=2,o=49;break;case 79:case 111:r=8,o=55;break;default:return+t}for(var a,u=t.slice(2),c=0,d=u.length;c<d;c++)if((a=u.charCodeAt(c))<48||a>o)return NaN;return parseInt(u,r)}}return+t};if(!h(" 0o1")||!h("0b1")||h("+0x1")){h=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof h&&(g?u((function(){m.valueOf.call(n)})):"Number"!=i(n))?a(new p(_(t)),n,h):_(t)};for(var v,b=n(11)?c(p):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),S=0;b.length>S;S++)o(p,v=b[S])&&!o(h,v)&&l(h,v,d(p,v));h.prototype=m,m.constructor=h,n(24)(r,"Number",h)}},function(e,t,n){"use strict";var r=n(1),o=n(35),i=n(190),a=n(136),s=1..toFixed,u=Math.floor,c=[0,0,0,0,0,0],d="Number.toFixed: incorrect invocation!",l=function(e,t){for(var n=-1,r=t;++n<6;)r+=e*c[n],c[n]=r%1e7,r=u(r/1e7)},f=function(e){for(var t=6,n=0;--t>=0;)n+=c[t],c[t]=u(n/e),n=n%e*1e7},h=function(){for(var e=6,t="";--e>=0;)if(""!==t||0===e||0!==c[e]){var n=String(c[e]);t=""===t?n:t+a.call("0",7-n.length)+n}return t},p=function(e,t,n){return 0===t?n:t%2==1?p(e,t-1,n*e):p(e*e,t/2,n)};r(r.P+r.F*(!!s&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!n(6)((function(){s.call({})}))),"Number",{toFixed:function(e){var t,n,r,s,u=i(this,d),c=o(e),m="",g="0";if(c<0||c>20)throw RangeError(d);if(u!=u)return"NaN";if(u<=-1e21||u>=1e21)return String(u);if(u<0&&(m="-",u=-u),u>1e-21)if(n=(t=function(e){for(var t=0,n=e;n>=4096;)t+=12,n/=4096;for(;n>=2;)t+=1,n/=2;return t}(u*p(2,69,1))-69)<0?u*p(2,-t,1):u/p(2,t,1),n*=4503599627370496,(t=52-t)>0){for(l(0,n),r=c;r>=7;)l(1e7,0),r-=7;for(l(p(10,r,1),0),r=t-1;r>=23;)f(1<<23),r-=23;f(1<<r),l(1,1),f(2),g=h()}else l(0,n),l(1<<-t,0),g=h()+a.call("0",c);return g=c>0?m+((s=g.length)<=c?"0."+a.call("0",c-s)+g:g.slice(0,s-c)+"."+g.slice(s-c)):m+g}})},function(e,t,n){"use strict";var r=n(1),o=n(6),i=n(190),a=1..toPrecision;r(r.P+r.F*(o((function(){return"1"!==a.call(1,void 0)}))||!o((function(){a.call({})}))),"Number",{toPrecision:function(e){var t=i(this,"Number#toPrecision: incorrect invocation!");return void 0===e?a.call(t):a.call(t,e)}})},function(e,t,n){var r=n(1);r(r.S,"Number",{EPSILON:Math.pow(2,-52)})},function(e,t,n){var r=n(1),o=n(5).isFinite;r(r.S,"Number",{isFinite:function(e){return"number"==typeof e&&o(e)}})},function(e,t,n){var r=n(1);r(r.S,"Number",{isInteger:n(191)})},function(e,t,n){var r=n(1);r(r.S,"Number",{isNaN:function(e){return e!=e}})},function(e,t,n){var r=n(1),o=n(191),i=Math.abs;r(r.S,"Number",{isSafeInteger:function(e){return o(e)&&i(e)<=9007199254740991}})},function(e,t,n){var r=n(1);r(r.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},function(e,t,n){var r=n(1);r(r.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},function(e,t,n){var r=n(1),o=n(189);r(r.S+r.F*(Number.parseFloat!=o),"Number",{parseFloat:o})},function(e,t,n){var r=n(1),o=n(188);r(r.S+r.F*(Number.parseInt!=o),"Number",{parseInt:o})},function(e,t,n){var r=n(1),o=n(192),i=Math.sqrt,a=Math.acosh;r(r.S+r.F*!(a&&710==Math.floor(a(Number.MAX_VALUE))&&a(1/0)==1/0),"Math",{acosh:function(e){return(e=+e)<1?NaN:e>94906265.62425156?Math.log(e)+Math.LN2:o(e-1+i(e-1)*i(e+1))}})},function(e,t,n){var r=n(1),o=Math.asinh;r(r.S+r.F*!(o&&1/o(0)>0),"Math",{asinh:function e(t){return isFinite(t=+t)&&0!=t?t<0?-e(-t):Math.log(t+Math.sqrt(t*t+1)):t}})},function(e,t,n){var r=n(1),o=Math.atanh;r(r.S+r.F*!(o&&1/o(-0)<0),"Math",{atanh:function(e){return 0==(e=+e)?e:Math.log((1+e)/(1-e))/2}})},function(e,t,n){var r=n(1),o=n(137);r(r.S,"Math",{cbrt:function(e){return o(e=+e)*Math.pow(Math.abs(e),1/3)}})},function(e,t,n){var r=n(1);r(r.S,"Math",{clz32:function(e){return(e>>>=0)?31-Math.floor(Math.log(e+.5)*Math.LOG2E):32}})},function(e,t,n){var r=n(1),o=Math.exp;r(r.S,"Math",{cosh:function(e){return(o(e=+e)+o(-e))/2}})},function(e,t,n){var r=n(1),o=n(138);r(r.S+r.F*(o!=Math.expm1),"Math",{expm1:o})},function(e,t,n){var r=n(1);r(r.S,"Math",{fround:n(193)})},function(e,t,n){var r=n(1),o=Math.abs;r(r.S,"Math",{hypot:function(e,t){for(var n,r,i=0,a=0,s=arguments.length,u=0;a<s;)u<(n=o(arguments[a++]))?(i=i*(r=u/n)*r+1,u=n):i+=n>0?(r=n/u)*r:n;return u===1/0?1/0:u*Math.sqrt(i)}})},function(e,t,n){var r=n(1),o=Math.imul;r(r.S+r.F*n(6)((function(){return-5!=o(4294967295,5)||2!=o.length})),"Math",{imul:function(e,t){var n=+e,r=+t,o=65535&n,i=65535&r;return 0|o*i+((65535&n>>>16)*i+o*(65535&r>>>16)<<16>>>0)}})},function(e,t,n){var r=n(1);r(r.S,"Math",{log10:function(e){return Math.log(e)*Math.LOG10E}})},function(e,t,n){var r=n(1);r(r.S,"Math",{log1p:n(192)})},function(e,t,n){var r=n(1);r(r.S,"Math",{log2:function(e){return Math.log(e)/Math.LN2}})},function(e,t,n){var r=n(1);r(r.S,"Math",{sign:n(137)})},function(e,t,n){var r=n(1),o=n(138),i=Math.exp;r(r.S+r.F*n(6)((function(){return-2e-17!=!Math.sinh(-2e-17)})),"Math",{sinh:function(e){return Math.abs(e=+e)<1?(o(e)-o(-e))/2:(i(e-1)-i(-e-1))*(Math.E/2)}})},function(e,t,n){var r=n(1),o=n(138),i=Math.exp;r(r.S,"Math",{tanh:function(e){var t=o(e=+e),n=o(-e);return t==1/0?1:n==1/0?-1:(t-n)/(i(e)+i(-e))}})},function(e,t,n){var r=n(1);r(r.S,"Math",{trunc:function(e){return(e>0?Math.floor:Math.ceil)(e)}})},function(e,t,n){var r=n(1),o=n(58),i=String.fromCharCode,a=String.fromCodePoint;r(r.S+r.F*(!!a&&1!=a.length),"String",{fromCodePoint:function(e){for(var t,n=[],r=arguments.length,a=0;r>a;){if(t=+arguments[a++],o(t,1114111)!==t)throw RangeError(t+" is not a valid code point");n.push(t<65536?i(t):i(55296+((t-=65536)>>10),t%1024+56320))}return n.join("")}})},function(e,t,n){var r=n(1),o=n(28),i=n(10);r(r.S,"String",{raw:function(e){for(var t=o(e.raw),n=i(t.length),r=arguments.length,a=[],s=0;n>s;)a.push(String(t[s++])),s<r&&a.push(String(arguments[s]));return a.join("")}})},function(e,t,n){"use strict";n(71)("trim",(function(e){return function(){return e(this,3)}}))},function(e,t,n){"use strict";var r=n(92)(!0);n(139)(String,"String",(function(e){this._t=String(e),this._i=0}),(function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})}))},function(e,t,n){"use strict";var r=n(1),o=n(92)(!1);r(r.P,"String",{codePointAt:function(e){return o(this,e)}})},function(e,t,n){"use strict";var r=n(1),o=n(10),i=n(141),a="".endsWith;r(r.P+r.F*n(142)("endsWith"),"String",{endsWith:function(e){var t=i(this,e,"endsWith"),n=arguments.length>1?arguments[1]:void 0,r=o(t.length),s=void 0===n?r:Math.min(o(n),r),u=String(e);return a?a.call(t,u,s):t.slice(s-u.length,s)===u}})},function(e,t,n){"use strict";var r=n(1),o=n(141);r(r.P+r.F*n(142)("includes"),"String",{includes:function(e){return!!~o(this,e,"includes").indexOf(e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(1);r(r.P,"String",{repeat:n(136)})},function(e,t,n){"use strict";var r=n(1),o=n(10),i=n(141),a="".startsWith;r(r.P+r.F*n(142)("startsWith"),"String",{startsWith:function(e){var t=i(this,e,"startsWith"),n=o(Math.min(arguments.length>1?arguments[1]:void 0,t.length)),r=String(e);return a?a.call(t,r,n):t.slice(n,n+r.length)===r}})},function(e,t,n){"use strict";n(25)("anchor",(function(e){return function(t){return e(this,"a","name",t)}}))},function(e,t,n){"use strict";n(25)("big",(function(e){return function(){return e(this,"big","","")}}))},function(e,t,n){"use strict";n(25)("blink",(function(e){return function(){return e(this,"blink","","")}}))},function(e,t,n){"use strict";n(25)("bold",(function(e){return function(){return e(this,"b","","")}}))},function(e,t,n){"use strict";n(25)("fixed",(function(e){return function(){return e(this,"tt","","")}}))},function(e,t,n){"use strict";n(25)("fontcolor",(function(e){return function(t){return e(this,"font","color",t)}}))},function(e,t,n){"use strict";n(25)("fontsize",(function(e){return function(t){return e(this,"font","size",t)}}))},function(e,t,n){"use strict";n(25)("italics",(function(e){return function(){return e(this,"i","","")}}))},function(e,t,n){"use strict";n(25)("link",(function(e){return function(t){return e(this,"a","href",t)}}))},function(e,t,n){"use strict";n(25)("small",(function(e){return function(){return e(this,"small","","")}}))},function(e,t,n){"use strict";n(25)("strike",(function(e){return function(){return e(this,"strike","","")}}))},function(e,t,n){"use strict";n(25)("sub",(function(e){return function(){return e(this,"sub","","")}}))},function(e,t,n){"use strict";n(25)("sup",(function(e){return function(){return e(this,"sup","","")}}))},function(e,t,n){var r=n(1);r(r.S,"Date",{now:function(){return(new Date).getTime()}})},function(e,t,n){"use strict";var r=n(1),o=n(15),i=n(40);r(r.P+r.F*n(6)((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})})),"Date",{toJSON:function(e){var t=o(this),n=i(t);return"number"!=typeof n||isFinite(n)?t.toISOString():null}})},function(e,t,n){var r=n(1),o=n(488);r(r.P+r.F*(Date.prototype.toISOString!==o),"Date",{toISOString:o})},function(e,t,n){"use strict";var r=n(6),o=Date.prototype.getTime,i=Date.prototype.toISOString,a=function(e){return e>9?e:"0"+e};e.exports=r((function(){return"0385-07-25T07:06:39.999Z"!=i.call(new Date(-50000000000001))}))||!r((function(){i.call(new Date(NaN))}))?function(){if(!isFinite(o.call(this)))throw RangeError("Invalid time value");var e=this,t=e.getUTCFullYear(),n=e.getUTCMilliseconds(),r=t<0?"-":t>9999?"+":"";return r+("00000"+Math.abs(t)).slice(r?-6:-4)+"-"+a(e.getUTCMonth()+1)+"-"+a(e.getUTCDate())+"T"+a(e.getUTCHours())+":"+a(e.getUTCMinutes())+":"+a(e.getUTCSeconds())+"."+(n>99?n:"0"+a(n))+"Z"}:i},function(e,t,n){var r=Date.prototype,o=r.toString,i=r.getTime;new Date(NaN)+""!="Invalid Date"&&n(24)(r,"toString",(function(){var e=i.call(this);return e==e?o.call(this):"Invalid Date"}))},function(e,t,n){var r=n(9)("toPrimitive"),o=Date.prototype;r in o||n(23)(o,r,n(491))},function(e,t,n){"use strict";var r=n(4),o=n(40);e.exports=function(e){if("string"!==e&&"number"!==e&&"default"!==e)throw TypeError("Incorrect hint");return o(r(this),"number"!=e)}},function(e,t,n){var r=n(1);r(r.S,"Array",{isArray:n(91)})},function(e,t,n){"use strict";var r=n(33),o=n(1),i=n(15),a=n(194),s=n(143),u=n(10),c=n(144),d=n(145);o(o.S+o.F*!n(94)((function(e){Array.from(e)})),"Array",{from:function(e){var t,n,o,l,f=i(e),h="function"==typeof this?this:Array,p=arguments.length,m=p>1?arguments[1]:void 0,g=void 0!==m,y=0,_=d(f);if(g&&(m=r(m,p>2?arguments[2]:void 0,2)),null==_||h==Array&&s(_))for(n=new h(t=u(f.length));t>y;y++)c(n,y,g?m(f[y],y):f[y]);else for(l=_.call(f),n=new h;!(o=l.next()).done;y++)c(n,y,g?a(l,m,[o.value,y],!0):o.value);return n.length=y,n}})},function(e,t,n){"use strict";var r=n(1),o=n(144);r(r.S+r.F*n(6)((function(){function e(){}return!(Array.of.call(e)instanceof e)})),"Array",{of:function(){for(var e=0,t=arguments.length,n=new("function"==typeof this?this:Array)(t);t>e;)o(n,e,arguments[e++]);return n.length=t,n}})},function(e,t,n){"use strict";var r=n(1),o=n(28),i=[].join;r(r.P+r.F*(n(81)!=Object||!n(36)(i)),"Array",{join:function(e){return i.call(o(this),void 0===e?",":e)}})},function(e,t,n){"use strict";var r=n(1),o=n(132),i=n(34),a=n(58),s=n(10),u=[].slice;r(r.P+r.F*n(6)((function(){o&&u.call(o)})),"Array",{slice:function(e,t){var n=s(this.length),r=i(this);if(t=void 0===t?n:t,"Array"==r)return u.call(this,e,t);for(var o=a(e,n),c=a(t,n),d=s(c-o),l=new Array(d),f=0;f<d;f++)l[f]="String"==r?this.charAt(o+f):this[o+f];return l}})},function(e,t,n){"use strict";var r=n(1),o=n(16),i=n(15),a=n(6),s=[].sort,u=[1,2,3];r(r.P+r.F*(a((function(){u.sort(void 0)}))||!a((function(){u.sort(null)}))||!n(36)(s)),"Array",{sort:function(e){return void 0===e?s.call(i(this)):s.call(i(this),o(e))}})},function(e,t,n){"use strict";var r=n(1),o=n(43)(0),i=n(36)([].forEach,!0);r(r.P+r.F*!i,"Array",{forEach:function(e){return o(this,e,arguments[1])}})},function(e,t,n){var r=n(7),o=n(91),i=n(9)("species");e.exports=function(e){var t;return o(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!o(t.prototype)||(t=void 0),r(t)&&null===(t=t[i])&&(t=void 0)),void 0===t?Array:t}},function(e,t,n){"use strict";var r=n(1),o=n(43)(1);r(r.P+r.F*!n(36)([].map,!0),"Array",{map:function(e){return o(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(1),o=n(43)(2);r(r.P+r.F*!n(36)([].filter,!0),"Array",{filter:function(e){return o(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(1),o=n(43)(3);r(r.P+r.F*!n(36)([].some,!0),"Array",{some:function(e){return o(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(1),o=n(43)(4);r(r.P+r.F*!n(36)([].every,!0),"Array",{every:function(e){return o(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(1),o=n(195);r(r.P+r.F*!n(36)([].reduce,!0),"Array",{reduce:function(e){return o(this,e,arguments.length,arguments[1],!1)}})},function(e,t,n){"use strict";var r=n(1),o=n(195);r(r.P+r.F*!n(36)([].reduceRight,!0),"Array",{reduceRight:function(e){return o(this,e,arguments.length,arguments[1],!0)}})},function(e,t,n){"use strict";var r=n(1),o=n(89)(!1),i=[].indexOf,a=!!i&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(a||!n(36)(i)),"Array",{indexOf:function(e){return a?i.apply(this,arguments)||0:o(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(1),o=n(28),i=n(35),a=n(10),s=[].lastIndexOf,u=!!s&&1/[1].lastIndexOf(1,-0)<0;r(r.P+r.F*(u||!n(36)(s)),"Array",{lastIndexOf:function(e){if(u)return s.apply(this,arguments)||0;var t=o(this),n=a(t.length),r=n-1;for(arguments.length>1&&(r=Math.min(r,i(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}})},function(e,t,n){var r=n(1);r(r.P,"Array",{copyWithin:n(196)}),n(51)("copyWithin")},function(e,t,n){var r=n(1);r(r.P,"Array",{fill:n(147)}),n(51)("fill")},function(e,t,n){"use strict";var r=n(1),o=n(43)(5),i=!0;"find"in[]&&Array(1).find((function(){i=!1})),r(r.P+r.F*i,"Array",{find:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),n(51)("find")},function(e,t,n){"use strict";var r=n(1),o=n(43)(6),i="findIndex",a=!0;i in[]&&Array(1)[i]((function(){a=!1})),r(r.P+r.F*a,"Array",{findIndex:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),n(51)(i)},function(e,t,n){n(61)("Array")},function(e,t,n){var r=n(5),o=n(135),i=n(12).f,a=n(60).f,s=n(93),u=n(83),c=r.RegExp,d=c,l=c.prototype,f=/a/g,h=/a/g,p=new c(f)!==f;if(n(11)&&(!p||n(6)((function(){return h[n(9)("match")]=!1,c(f)!=f||c(h)==h||"/a/i"!=c(f,"i")})))){c=function(e,t){var n=this instanceof c,r=s(e),i=void 0===t;return!n&&r&&e.constructor===c&&i?e:o(p?new d(r&&!i?e.source:e,t):d((r=e instanceof c)?e.source:e,r&&i?u.call(e):t),n?this:l,c)};for(var m=function(e){e in c||i(c,e,{configurable:!0,get:function(){return d[e]},set:function(t){d[e]=t}})},g=a(d),y=0;g.length>y;)m(g[y++]);l.constructor=c,c.prototype=l,n(24)(r,"RegExp",c)}n(61)("RegExp")},function(e,t,n){"use strict";n(199);var r=n(4),o=n(83),i=n(11),a=/./.toString,s=function(e){n(24)(RegExp.prototype,"toString",e,!0)};n(6)((function(){return"/a/b"!=a.call({source:"a",flags:"b"})}))?s((function(){var e=r(this);return"/".concat(e.source,"/","flags"in e?e.flags:!i&&e instanceof RegExp?o.call(e):void 0)})):"toString"!=a.name&&s((function(){return a.call(this)}))},function(e,t,n){"use strict";var r=n(4),o=n(10),i=n(150),a=n(95);n(96)("match",1,(function(e,t,n,s){return[function(n){var r=e(this),o=null==n?void 0:n[t];return void 0!==o?o.call(n,r):new RegExp(n)[t](String(r))},function(e){var t=s(n,e,this);if(t.done)return t.value;var u=r(e),c=String(this);if(!u.global)return a(u,c);var d=u.unicode;u.lastIndex=0;for(var l,f=[],h=0;null!==(l=a(u,c));){var p=String(l[0]);f[h]=p,""===p&&(u.lastIndex=i(c,o(u.lastIndex),d)),h++}return 0===h?null:f}]}))},function(e,t,n){"use strict";var r=n(4),o=n(15),i=n(10),a=n(35),s=n(150),u=n(95),c=Math.max,d=Math.min,l=Math.floor,f=/\$([$&`']|\d\d?|<[^>]*>)/g,h=/\$([$&`']|\d\d?)/g;n(96)("replace",2,(function(e,t,n,p){return[function(r,o){var i=e(this),a=null==r?void 0:r[t];return void 0!==a?a.call(r,i,o):n.call(String(i),r,o)},function(e,t){var o=p(n,e,this,t);if(o.done)return o.value;var l=r(e),f=String(this),h="function"==typeof t;h||(t=String(t));var g=l.global;if(g){var y=l.unicode;l.lastIndex=0}for(var _=[];;){var v=u(l,f);if(null===v)break;if(_.push(v),!g)break;""===String(v[0])&&(l.lastIndex=s(f,i(l.lastIndex),y))}for(var b,S="",w=0,M=0;M<_.length;M++){v=_[M];for(var D=String(v[0]),P=c(d(a(v.index),f.length),0),T=[],k=1;k<v.length;k++)T.push(void 0===(b=v[k])?b:String(b));var A=v.groups;if(h){var L=[D].concat(T,P,f);void 0!==A&&L.push(A);var F=String(t.apply(void 0,L))}else F=m(D,f,P,T,A,t);P>=w&&(S+=f.slice(w,P)+F,w=P+D.length)}return S+f.slice(w)}];function m(e,t,r,i,a,s){var u=r+e.length,c=i.length,d=h;return void 0!==a&&(a=o(a),d=f),n.call(s,d,(function(n,o){var s;switch(o.charAt(0)){case"$":return"$";case"&":return e;case"`":return t.slice(0,r);case"'":return t.slice(u);case"<":s=a[o.slice(1,-1)];break;default:var d=+o;if(0===d)return n;if(d>c){var f=l(d/10);return 0===f?n:f<=c?void 0===i[f-1]?o.charAt(1):i[f-1]+o.charAt(1):n}s=i[d-1]}return void 0===s?"":s}))}}))},function(e,t,n){"use strict";var r=n(4),o=n(185),i=n(95);n(96)("search",1,(function(e,t,n,a){return[function(n){var r=e(this),o=null==n?void 0:n[t];return void 0!==o?o.call(n,r):new RegExp(n)[t](String(r))},function(e){var t=a(n,e,this);if(t.done)return t.value;var s=r(e),u=String(this),c=s.lastIndex;o(c,0)||(s.lastIndex=0);var d=i(s,u);return o(s.lastIndex,c)||(s.lastIndex=c),null===d?-1:d.index}]}))},function(e,t,n){"use strict";var r=n(93),o=n(4),i=n(84),a=n(150),s=n(10),u=n(95),c=n(149),d=n(6),l=Math.min,f=[].push,h="length",p=!d((function(){RegExp(4294967295,"y")}));n(96)("split",2,(function(e,t,n,d){var m;return m="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1)[h]||2!="ab".split(/(?:ab)*/)[h]||4!=".".split(/(.?)(.?)/)[h]||".".split(/()()/)[h]>1||"".split(/.?/)[h]?function(e,t){var o=String(this);if(void 0===e&&0===t)return[];if(!r(e))return n.call(o,e,t);for(var i,a,s,u=[],d=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,p=void 0===t?4294967295:t>>>0,m=new RegExp(e.source,d+"g");(i=c.call(m,o))&&!((a=m.lastIndex)>l&&(u.push(o.slice(l,i.index)),i[h]>1&&i.index<o[h]&&f.apply(u,i.slice(1)),s=i[0][h],l=a,u[h]>=p));)m.lastIndex===i.index&&m.lastIndex++;return l===o[h]?!s&&m.test("")||u.push(""):u.push(o.slice(l)),u[h]>p?u.slice(0,p):u}:"0".split(void 0,0)[h]?function(e,t){return void 0===e&&0===t?[]:n.call(this,e,t)}:n,[function(n,r){var o=e(this),i=null==n?void 0:n[t];return void 0!==i?i.call(n,o,r):m.call(String(o),n,r)},function(e,t){var r=d(m,e,this,t,m!==n);if(r.done)return r.value;var c=o(e),f=String(this),h=i(c,RegExp),g=c.unicode,y=(c.ignoreCase?"i":"")+(c.multiline?"m":"")+(c.unicode?"u":"")+(p?"y":"g"),_=new h(p?c:"^(?:"+c.source+")",y),v=void 0===t?4294967295:t>>>0;if(0===v)return[];if(0===f.length)return null===u(_,f)?[f]:[];for(var b=0,S=0,w=[];S<f.length;){_.lastIndex=p?S:0;var M,D=u(_,p?f:f.slice(S));if(null===D||(M=l(s(_.lastIndex+(p?0:S)),f.length))===b)S=a(f,S,g);else{if(w.push(f.slice(b,S)),w.length===v)return w;for(var P=1;P<=D.length-1;P++)if(w.push(D[P]),w.length===v)return w;S=b=M}}return w.push(f.slice(b)),w}]}))},function(e,t,n){"use strict";var r,o,i,a,s=n(49),u=n(5),c=n(33),d=n(70),l=n(1),f=n(7),h=n(16),p=n(62),m=n(63),g=n(84),y=n(151).set,_=n(152)(),v=n(153),b=n(200),S=n(97),w=n(201),M=u.TypeError,D=u.process,P=D&&D.versions,T=P&&P.v8||"",k=u.Promise,A="process"==d(D),L=function(){},F=o=v.f,I=!!function(){try{var e=k.resolve(1),t=(e.constructor={})[n(9)("species")]=function(e){e(L,L)};return(A||"function"==typeof PromiseRejectionEvent)&&e.then(L)instanceof t&&0!==T.indexOf("6.6")&&-1===S.indexOf("Chrome/66")}catch(e){}}(),x=function(e){var t;return!(!f(e)||"function"!=typeof(t=e.then))&&t},C=function(e,t){if(!e._n){e._n=!0;var n=e._c;_((function(){for(var r=e._v,o=1==e._s,i=0,a=function(t){var n,i,a,s=o?t.ok:t.fail,u=t.resolve,c=t.reject,d=t.domain;try{s?(o||(2==e._h&&G(e),e._h=1),!0===s?n=r:(d&&d.enter(),n=s(r),d&&(d.exit(),a=!0)),n===t.promise?c(M("Promise-chain cycle")):(i=x(n))?i.call(n,u,c):u(n)):c(r)}catch(e){d&&!a&&d.exit(),c(e)}};n.length>i;)a(n[i++]);e._c=[],e._n=!1,t&&!e._h&&R(e)}))}},R=function(e){y.call(u,(function(){var t,n,r,o=e._v,i=O(e);if(i&&(t=b((function(){A?D.emit("unhandledRejection",o,e):(n=u.onunhandledrejection)?n({promise:e,reason:o}):(r=u.console)&&r.error&&r.error("Unhandled promise rejection",o)})),e._h=A||O(e)?2:1),e._a=void 0,i&&t.e)throw t.v}))},O=function(e){return 1!==e._h&&0===(e._a||e._c).length},G=function(e){y.call(u,(function(){var t;A?D.emit("rejectionHandled",e):(t=u.onrejectionhandled)&&t({promise:e,reason:e._v})}))},E=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),C(t,!0))},Y=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw M("Promise can't be resolved itself");(t=x(e))?_((function(){var r={_w:n,_d:!1};try{t.call(e,c(Y,r,1),c(E,r,1))}catch(e){E.call(r,e)}})):(n._v=e,n._s=1,C(n,!1))}catch(e){E.call({_w:n,_d:!1},e)}}};I||(k=function(e){p(this,k,"Promise","_h"),h(e),r.call(this);try{e(c(Y,this,1),c(E,this,1))}catch(e){E.call(this,e)}},(r=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(64)(k.prototype,{then:function(e,t){var n=F(g(this,k));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=A?D.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&C(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),i=function(){var e=new r;this.promise=e,this.resolve=c(Y,e,1),this.reject=c(E,e,1)},v.f=F=function(e){return e===k||e===a?new i(e):o(e)}),l(l.G+l.W+l.F*!I,{Promise:k}),n(69)(k,"Promise"),n(61)("Promise"),a=n(32).Promise,l(l.S+l.F*!I,"Promise",{reject:function(e){var t=F(this);return(0,t.reject)(e),t.promise}}),l(l.S+l.F*(s||!I),"Promise",{resolve:function(e){return w(s&&this===a?k:this,e)}}),l(l.S+l.F*!(I&&n(94)((function(e){k.all(e).catch(L)}))),"Promise",{all:function(e){var t=this,n=F(t),r=n.resolve,o=n.reject,i=b((function(){var n=[],i=0,a=1;m(e,!1,(function(e){var s=i++,u=!1;n.push(void 0),a++,t.resolve(e).then((function(e){u||(u=!0,n[s]=e,--a||r(n))}),o)})),--a||r(n)}));return i.e&&o(i.v),n.promise},race:function(e){var t=this,n=F(t),r=n.reject,o=b((function(){m(e,!1,(function(e){t.resolve(e).then(n.resolve,r)}))}));return o.e&&r(o.v),n.promise}})},function(e,t,n){"use strict";var r=n(206),o=n(65);n(98)("WeakSet",(function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}}),{add:function(e){return r.def(o(this,"WeakSet"),e,!0)}},r,!1,!0)},function(e,t,n){"use strict";var r=n(1),o=n(99),i=n(154),a=n(4),s=n(58),u=n(10),c=n(7),d=n(5).ArrayBuffer,l=n(84),f=i.ArrayBuffer,h=i.DataView,p=o.ABV&&d.isView,m=f.prototype.slice,g=o.VIEW;r(r.G+r.W+r.F*(d!==f),{ArrayBuffer:f}),r(r.S+r.F*!o.CONSTR,"ArrayBuffer",{isView:function(e){return p&&p(e)||c(e)&&g in e}}),r(r.P+r.U+r.F*n(6)((function(){return!new f(2).slice(1,void 0).byteLength})),"ArrayBuffer",{slice:function(e,t){if(void 0!==m&&void 0===t)return m.call(a(this),e);for(var n=a(this).byteLength,r=s(e,n),o=s(void 0===t?n:t,n),i=new(l(this,f))(u(o-r)),c=new h(this),d=new h(i),p=0;r<o;)d.setUint8(p++,c.getUint8(r++));return i}}),n(61)("ArrayBuffer")},function(e,t,n){var r=n(1);r(r.G+r.W+r.F*!n(99).ABV,{DataView:n(154).DataView})},function(e,t,n){n(46)("Int8",1,(function(e){return function(t,n,r){return e(this,t,n,r)}}))},function(e,t,n){n(46)("Uint8",1,(function(e){return function(t,n,r){return e(this,t,n,r)}}))},function(e,t,n){n(46)("Uint8",1,(function(e){return function(t,n,r){return e(this,t,n,r)}}),!0)},function(e,t,n){n(46)("Int16",2,(function(e){return function(t,n,r){return e(this,t,n,r)}}))},function(e,t,n){n(46)("Uint16",2,(function(e){return function(t,n,r){return e(this,t,n,r)}}))},function(e,t,n){n(46)("Int32",4,(function(e){return function(t,n,r){return e(this,t,n,r)}}))},function(e,t,n){n(46)("Uint32",4,(function(e){return function(t,n,r){return e(this,t,n,r)}}))},function(e,t,n){n(46)("Float32",4,(function(e){return function(t,n,r){return e(this,t,n,r)}}))},function(e,t,n){n(46)("Float64",8,(function(e){return function(t,n,r){return e(this,t,n,r)}}))},function(e,t,n){var r=n(1),o=n(16),i=n(4),a=(n(5).Reflect||{}).apply,s=Function.apply;r(r.S+r.F*!n(6)((function(){a((function(){}))})),"Reflect",{apply:function(e,t,n){var r=o(e),u=i(n);return a?a(r,t,u):s.call(r,t,u)}})},function(e,t,n){var r=n(1),o=n(59),i=n(16),a=n(4),s=n(7),u=n(6),c=n(186),d=(n(5).Reflect||{}).construct,l=u((function(){function e(){}return!(d((function(){}),[],e)instanceof e)})),f=!u((function(){d((function(){}))}));r(r.S+r.F*(l||f),"Reflect",{construct:function(e,t){i(e),a(t);var n=arguments.length<3?e:i(arguments[2]);if(f&&!l)return d(e,t,n);if(e==n){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var r=[null];return r.push.apply(r,t),new(c.apply(e,r))}var u=n.prototype,h=o(s(u)?u:Object.prototype),p=Function.apply.call(e,h,t);return s(p)?p:h}})},function(e,t,n){var r=n(12),o=n(1),i=n(4),a=n(40);o(o.S+o.F*n(6)((function(){Reflect.defineProperty(r.f({},1,{value:1}),1,{value:2})})),"Reflect",{defineProperty:function(e,t,n){i(e),t=a(t,!0),i(n);try{return r.f(e,t,n),!0}catch(e){return!1}}})},function(e,t,n){var r=n(1),o=n(29).f,i=n(4);r(r.S,"Reflect",{deleteProperty:function(e,t){var n=o(i(e),t);return!(n&&!n.configurable)&&delete e[t]}})},function(e,t,n){"use strict";var r=n(1),o=n(4),i=function(e){this._t=o(e),this._i=0;var t,n=this._k=[];for(t in e)n.push(t)};n(140)(i,"Object",(function(){var e,t=this._k;do{if(this._i>=t.length)return{value:void 0,done:!0}}while(!((e=t[this._i++])in this._t));return{value:e,done:!1}})),r(r.S,"Reflect",{enumerate:function(e){return new i(e)}})},function(e,t,n){var r=n(29),o=n(30),i=n(27),a=n(1),s=n(7),u=n(4);a(a.S,"Reflect",{get:function e(t,n){var a,c,d=arguments.length<3?t:arguments[2];return u(t)===d?t[n]:(a=r.f(t,n))?i(a,"value")?a.value:void 0!==a.get?a.get.call(d):void 0:s(c=o(t))?e(c,n,d):void 0}})},function(e,t,n){var r=n(29),o=n(1),i=n(4);o(o.S,"Reflect",{getOwnPropertyDescriptor:function(e,t){return r.f(i(e),t)}})},function(e,t,n){var r=n(1),o=n(30),i=n(4);r(r.S,"Reflect",{getPrototypeOf:function(e){return o(i(e))}})},function(e,t,n){var r=n(1);r(r.S,"Reflect",{has:function(e,t){return t in e}})},function(e,t,n){var r=n(1),o=n(4),i=Object.isExtensible;r(r.S,"Reflect",{isExtensible:function(e){return o(e),!i||i(e)}})},function(e,t,n){var r=n(1);r(r.S,"Reflect",{ownKeys:n(208)})},function(e,t,n){var r=n(1),o=n(4),i=Object.preventExtensions;r(r.S,"Reflect",{preventExtensions:function(e){o(e);try{return i&&i(e),!0}catch(e){return!1}}})},function(e,t,n){var r=n(12),o=n(29),i=n(30),a=n(27),s=n(1),u=n(55),c=n(4),d=n(7);s(s.S,"Reflect",{set:function e(t,n,s){var l,f,h=arguments.length<4?t:arguments[3],p=o.f(c(t),n);if(!p){if(d(f=i(t)))return e(f,n,s,h);p=u(0)}if(a(p,"value")){if(!1===p.writable||!d(h))return!1;if(l=o.f(h,n)){if(l.get||l.set||!1===l.writable)return!1;l.value=s,r.f(h,n,l)}else r.f(h,n,u(0,s));return!0}return void 0!==p.set&&(p.set.call(h,s),!0)}})},function(e,t,n){var r=n(1),o=n(133);o&&r(r.S,"Reflect",{setPrototypeOf:function(e,t){o.check(e,t);try{return o.set(e,t),!0}catch(e){return!1}}})},function(e,t,n){"use strict";var r=n(1),o=n(89)(!0);r(r.P,"Array",{includes:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),n(51)("includes")},function(e,t,n){"use strict";var r=n(1),o=n(209),i=n(15),a=n(10),s=n(16),u=n(146);r(r.P,"Array",{flatMap:function(e){var t,n,r=i(this);return s(e),t=a(r.length),n=u(r,0),o(n,r,r,t,0,1,e,arguments[1]),n}}),n(51)("flatMap")},function(e,t,n){"use strict";var r=n(1),o=n(209),i=n(15),a=n(10),s=n(35),u=n(146);r(r.P,"Array",{flatten:function(){var e=arguments[0],t=i(this),n=a(t.length),r=u(t,0);return o(r,t,t,n,0,void 0===e?1:s(e)),r}}),n(51)("flatten")},function(e,t,n){"use strict";var r=n(1),o=n(92)(!0),i=n(6)((function(){return"𠮷"!=="𠮷".at(0)}));r(r.P+r.F*i,"String",{at:function(e){return o(this,e)}})},function(e,t,n){"use strict";var r=n(1),o=n(210),i=n(97),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(i);r(r.P+r.F*a,"String",{padStart:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0,!0)}})},function(e,t,n){"use strict";var r=n(1),o=n(210),i=n(97),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(i);r(r.P+r.F*a,"String",{padEnd:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0,!1)}})},function(e,t,n){"use strict";n(71)("trimLeft",(function(e){return function(){return e(this,1)}}),"trimStart")},function(e,t,n){"use strict";n(71)("trimRight",(function(e){return function(){return e(this,2)}}),"trimEnd")},function(e,t,n){"use strict";var r=n(1),o=n(41),i=n(10),a=n(93),s=n(83),u=RegExp.prototype,c=function(e,t){this._r=e,this._s=t};n(140)(c,"RegExp String",(function(){var e=this._r.exec(this._s);return{value:e,done:null===e}})),r(r.P,"String",{matchAll:function(e){if(o(this),!a(e))throw TypeError(e+" is not a regexp!");var t=String(this),n="flags"in u?String(e.flags):s.call(e),r=new RegExp(e.source,~n.indexOf("g")?n:"g"+n);return r.lastIndex=i(e.lastIndex),new c(r,t)}})},function(e,t,n){n(129)("asyncIterator")},function(e,t,n){n(129)("observable")},function(e,t,n){var r=n(1),o=n(208),i=n(28),a=n(29),s=n(144);r(r.S,"Object",{getOwnPropertyDescriptors:function(e){for(var t,n,r=i(e),u=a.f,c=o(r),d={},l=0;c.length>l;)void 0!==(n=u(r,t=c[l++]))&&s(d,t,n);return d}})},function(e,t,n){var r=n(1),o=n(211)(!1);r(r.S,"Object",{values:function(e){return o(e)}})},function(e,t,n){var r=n(1),o=n(211)(!0);r(r.S,"Object",{entries:function(e){return o(e)}})},function(e,t,n){"use strict";var r=n(1),o=n(15),i=n(16),a=n(12);n(11)&&r(r.P+n(100),"Object",{__defineGetter__:function(e,t){a.f(o(this),e,{get:i(t),enumerable:!0,configurable:!0})}})},function(e,t,n){"use strict";var r=n(1),o=n(15),i=n(16),a=n(12);n(11)&&r(r.P+n(100),"Object",{__defineSetter__:function(e,t){a.f(o(this),e,{set:i(t),enumerable:!0,configurable:!0})}})},function(e,t,n){"use strict";var r=n(1),o=n(15),i=n(40),a=n(30),s=n(29).f;n(11)&&r(r.P+n(100),"Object",{__lookupGetter__:function(e){var t,n=o(this),r=i(e,!0);do{if(t=s(n,r))return t.get}while(n=a(n))}})},function(e,t,n){"use strict";var r=n(1),o=n(15),i=n(40),a=n(30),s=n(29).f;n(11)&&r(r.P+n(100),"Object",{__lookupSetter__:function(e){var t,n=o(this),r=i(e,!0);do{if(t=s(n,r))return t.set}while(n=a(n))}})},function(e,t,n){var r=n(1);r(r.P+r.R,"Map",{toJSON:n(212)("Map")})},function(e,t,n){var r=n(1);r(r.P+r.R,"Set",{toJSON:n(212)("Set")})},function(e,t,n){n(101)("Map")},function(e,t,n){n(101)("Set")},function(e,t,n){n(101)("WeakMap")},function(e,t,n){n(101)("WeakSet")},function(e,t,n){n(102)("Map")},function(e,t,n){n(102)("Set")},function(e,t,n){n(102)("WeakMap")},function(e,t,n){n(102)("WeakSet")},function(e,t,n){var r=n(1);r(r.G,{global:n(5)})},function(e,t,n){var r=n(1);r(r.S,"System",{global:n(5)})},function(e,t,n){var r=n(1),o=n(34);r(r.S,"Error",{isError:function(e){return"Error"===o(e)}})},function(e,t,n){var r=n(1);r(r.S,"Math",{clamp:function(e,t,n){return Math.min(n,Math.max(t,e))}})},function(e,t,n){var r=n(1);r(r.S,"Math",{DEG_PER_RAD:Math.PI/180})},function(e,t,n){var r=n(1),o=180/Math.PI;r(r.S,"Math",{degrees:function(e){return e*o}})},function(e,t,n){var r=n(1),o=n(214),i=n(193);r(r.S,"Math",{fscale:function(e,t,n,r,a){return i(o(e,t,n,r,a))}})},function(e,t,n){var r=n(1);r(r.S,"Math",{iaddh:function(e,t,n,r){var o=e>>>0,i=n>>>0;return(t>>>0)+(r>>>0)+((o&i|(o|i)&~(o+i>>>0))>>>31)|0}})},function(e,t,n){var r=n(1);r(r.S,"Math",{isubh:function(e,t,n,r){var o=e>>>0,i=n>>>0;return(t>>>0)-(r>>>0)-((~o&i|~(o^i)&o-i>>>0)>>>31)|0}})},function(e,t,n){var r=n(1);r(r.S,"Math",{imulh:function(e,t){var n=+e,r=+t,o=65535&n,i=65535&r,a=n>>16,s=r>>16,u=(a*i>>>0)+(o*i>>>16);return a*s+(u>>16)+((o*s>>>0)+(65535&u)>>16)}})},function(e,t,n){var r=n(1);r(r.S,"Math",{RAD_PER_DEG:180/Math.PI})},function(e,t,n){var r=n(1),o=Math.PI/180;r(r.S,"Math",{radians:function(e){return e*o}})},function(e,t,n){var r=n(1);r(r.S,"Math",{scale:n(214)})},function(e,t,n){var r=n(1);r(r.S,"Math",{umulh:function(e,t){var n=+e,r=+t,o=65535&n,i=65535&r,a=n>>>16,s=r>>>16,u=(a*i>>>0)+(o*i>>>16);return a*s+(u>>>16)+((o*s>>>0)+(65535&u)>>>16)}})},function(e,t,n){var r=n(1);r(r.S,"Math",{signbit:function(e){return(e=+e)!=e?e:0==e?1/e==1/0:e>0}})},function(e,t,n){"use strict";var r=n(1),o=n(32),i=n(5),a=n(84),s=n(201);r(r.P+r.R,"Promise",{finally:function(e){var t=a(this,o.Promise||i.Promise),n="function"==typeof e;return this.then(n?function(n){return s(t,e()).then((function(){return n}))}:e,n?function(n){return s(t,e()).then((function(){throw n}))}:e)}})},function(e,t,n){"use strict";var r=n(1),o=n(153),i=n(200);r(r.S,"Promise",{try:function(e){var t=o.f(this),n=i(e);return(n.e?t.reject:t.resolve)(n.v),t.promise}})},function(e,t,n){var r=n(47),o=n(4),i=r.key,a=r.set;r.exp({defineMetadata:function(e,t,n,r){a(e,t,o(n),i(r))}})},function(e,t,n){var r=n(47),o=n(4),i=r.key,a=r.map,s=r.store;r.exp({deleteMetadata:function(e,t){var n=arguments.length<3?void 0:i(arguments[2]),r=a(o(t),n,!1);if(void 0===r||!r.delete(e))return!1;if(r.size)return!0;var u=s.get(t);return u.delete(n),!!u.size||s.delete(t)}})},function(e,t,n){var r=n(47),o=n(4),i=n(30),a=r.has,s=r.get,u=r.key,c=function(e,t,n){if(a(e,t,n))return s(e,t,n);var r=i(t);return null!==r?c(e,r,n):void 0};r.exp({getMetadata:function(e,t){return c(e,o(t),arguments.length<3?void 0:u(arguments[2]))}})},function(e,t,n){var r=n(204),o=n(213),i=n(47),a=n(4),s=n(30),u=i.keys,c=i.key,d=function(e,t){var n=u(e,t),i=s(e);if(null===i)return n;var a=d(i,t);return a.length?n.length?o(new r(n.concat(a))):a:n};i.exp({getMetadataKeys:function(e){return d(a(e),arguments.length<2?void 0:c(arguments[1]))}})},function(e,t,n){var r=n(47),o=n(4),i=r.get,a=r.key;r.exp({getOwnMetadata:function(e,t){return i(e,o(t),arguments.length<3?void 0:a(arguments[2]))}})},function(e,t,n){var r=n(47),o=n(4),i=r.keys,a=r.key;r.exp({getOwnMetadataKeys:function(e){return i(o(e),arguments.length<2?void 0:a(arguments[1]))}})},function(e,t,n){var r=n(47),o=n(4),i=n(30),a=r.has,s=r.key,u=function(e,t,n){if(a(e,t,n))return!0;var r=i(t);return null!==r&&u(e,r,n)};r.exp({hasMetadata:function(e,t){return u(e,o(t),arguments.length<3?void 0:s(arguments[2]))}})},function(e,t,n){var r=n(47),o=n(4),i=r.has,a=r.key;r.exp({hasOwnMetadata:function(e,t){return i(e,o(t),arguments.length<3?void 0:a(arguments[2]))}})},function(e,t,n){var r=n(47),o=n(4),i=n(16),a=r.key,s=r.set;r.exp({metadata:function(e,t){return function(n,r){s(e,t,(void 0!==r?o:i)(n),a(r))}}})},function(e,t,n){var r=n(1),o=n(152)(),i=n(5).process,a="process"==n(34)(i);r(r.G,{asap:function(e){var t=a&&i.domain;o(t?t.bind(e):e)}})},function(e,t,n){"use strict";var r=n(1),o=n(5),i=n(32),a=n(152)(),s=n(9)("observable"),u=n(16),c=n(4),d=n(62),l=n(64),f=n(23),h=n(63),p=h.RETURN,m=function(e){return null==e?void 0:u(e)},g=function(e){var t=e._c;t&&(e._c=void 0,t())},y=function(e){return void 0===e._o},_=function(e){y(e)||(e._o=void 0,g(e))},v=function(e,t){c(e),this._c=void 0,this._o=e,e=new b(this);try{var n=t(e),r=n;null!=n&&("function"==typeof n.unsubscribe?n=function(){r.unsubscribe()}:u(n),this._c=n)}catch(t){return void e.error(t)}y(this)&&g(this)};v.prototype=l({},{unsubscribe:function(){_(this)}});var b=function(e){this._s=e};b.prototype=l({},{next:function(e){var t=this._s;if(!y(t)){var n=t._o;try{var r=m(n.next);if(r)return r.call(n,e)}catch(e){try{_(t)}finally{throw e}}}},error:function(e){var t=this._s;if(y(t))throw e;var n=t._o;t._o=void 0;try{var r=m(n.error);if(!r)throw e;e=r.call(n,e)}catch(e){try{g(t)}finally{throw e}}return g(t),e},complete:function(e){var t=this._s;if(!y(t)){var n=t._o;t._o=void 0;try{var r=m(n.complete);e=r?r.call(n,e):void 0}catch(e){try{g(t)}finally{throw e}}return g(t),e}}});var S=function(e){d(this,S,"Observable","_f")._f=u(e)};l(S.prototype,{subscribe:function(e){return new v(e,this._f)},forEach:function(e){var t=this;return new(i.Promise||o.Promise)((function(n,r){u(e);var o=t.subscribe({next:function(t){try{return e(t)}catch(e){r(e),o.unsubscribe()}},error:r,complete:n})}))}}),l(S,{from:function(e){var t="function"==typeof this?this:S,n=m(c(e)[s]);if(n){var r=c(n.call(e));return r.constructor===t?r:new t((function(e){return r.subscribe(e)}))}return new t((function(t){var n=!1;return a((function(){if(!n){try{if(h(e,!1,(function(e){if(t.next(e),n)return p}))===p)return}catch(e){if(n)throw e;return void t.error(e)}t.complete()}})),function(){n=!0}}))},of:function(){for(var e=0,t=arguments.length,n=new Array(t);e<t;)n[e]=arguments[e++];return new("function"==typeof this?this:S)((function(e){var t=!1;return a((function(){if(!t){for(var r=0;r<n.length;++r)if(e.next(n[r]),t)return;e.complete()}})),function(){t=!0}}))}}),f(S.prototype,s,(function(){return this})),r(r.G,{Observable:S}),n(61)("Observable")},function(e,t,n){var r=n(5),o=n(1),i=n(97),a=[].slice,s=/MSIE .\./.test(i),u=function(e){return function(t,n){var r=arguments.length>2,o=!!r&&a.call(arguments,2);return e(r?function(){("function"==typeof t?t:Function(t)).apply(this,o)}:t,n)}};o(o.G+o.B+o.F*s,{setTimeout:u(r.setTimeout),setInterval:u(r.setInterval)})},function(e,t,n){var r=n(1),o=n(151);r(r.G+r.B,{setImmediate:o.set,clearImmediate:o.clear})},function(e,t,n){for(var r=n(148),o=n(57),i=n(24),a=n(5),s=n(23),u=n(72),c=n(9),d=c("iterator"),l=c("toStringTag"),f=u.Array,h={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},p=o(h),m=0;m<p.length;m++){var g,y=p[m],_=h[y],v=a[y],b=v&&v.prototype;if(b&&(b[d]||s(b,d,f),b[l]||s(b,l,y),u[y]=f,_))for(g in r)b[g]||i(b,g,r[g],!0)}},function(e,t,n){(function(t){!function(t){"use strict";var n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag",u="object"==typeof e,c=t.regeneratorRuntime;if(c)u&&(e.exports=c);else{(c=t.regeneratorRuntime=u?e.exports:{}).wrap=m;var d={},l={};l[i]=function(){return this};var f=Object.getPrototypeOf,h=f&&f(f(T([])));h&&h!==n&&r.call(h,i)&&(l=h);var p=v.prototype=y.prototype=Object.create(l);_.prototype=p.constructor=v,v.constructor=_,v[s]=_.displayName="GeneratorFunction",c.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===_||"GeneratorFunction"===(t.displayName||t.name))},c.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s in e||(e[s]="GeneratorFunction")),e.prototype=Object.create(p),e},c.awrap=function(e){return{__await:e}},b(S.prototype),S.prototype[a]=function(){return this},c.AsyncIterator=S,c.async=function(e,t,n,r){var o=new S(m(e,t,n,r));return c.isGeneratorFunction(t)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(p),p[s]="Generator",p[i]=function(){return this},p.toString=function(){return"[object Generator]"},c.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},c.values=T,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(D),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),D(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;D(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:T(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}}}function m(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,i=Object.create(o.prototype),a=new P(r||[]);return i._invoke=function(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return k()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=w(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=g(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(e,n,a),i}function g(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function y(){}function _(){}function v(){}function b(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function S(e){function n(t,o,i,a){var s=g(e[t],e,o);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"==typeof c&&r.call(c,"__await")?Promise.resolve(c.__await).then((function(e){n("next",e,i,a)}),(function(e){n("throw",e,i,a)})):Promise.resolve(c).then((function(e){u.value=e,i(u)}),a)}a(s.arg)}var o;"object"==typeof t.process&&t.process.domain&&(n=t.process.domain.bind(n)),this._invoke=function(e,t){function r(){return new Promise((function(r,o){n(e,t,r,o)}))}return o=o?o.then(r,r):r()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var r=g(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,d;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function M(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function D(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(M,this),this.reset(!0)}function T(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:k}}function k(){return{value:void 0,done:!0}}}("object"==typeof t?t:"object"==typeof window?window:"object"==typeof self?self:this)}).call(this,n(14))},function(e,t,n){n(607),e.exports=n(32).RegExp.escape},function(e,t,n){var r=n(1),o=n(608)(/[\\^$*+?.()|[\]{}]/g,"\\$&");r(r.S,"RegExp",{escape:function(e){return o(e)}})},function(e,t){e.exports=function(e,t){var n=t===Object(t)?function(e){return t[e]}:t;return function(t){return String(t).replace(e,n)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};n(610);var o=v(n(73)),i=v(n(611)),a=n(373),s=v(n(672)),u=v(n(697)),c=v(n(713)),d=n(377),l=(v(n(166)),v(n(165))),f=v(n(107)),h=n(3),p=n(20),m=(n(228),v(n(378))),g=v(n(717)),y=v(n(31)),_=v(n(718));function v(e){return e&&e.__esModule?e:{default:e}}function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var S=new f.default("cache","FoxitPDFSDKForWeb_cache"),w=[{bsStandardName:"Helvetica",bsSubstName:"Arial",wWeight:400,bItalic:0},{bsStandardName:"Helvetica-Bold",bsSubstName:"Arial",wWeight:700,bItalic:0},{bsStandardName:"Helvetica-BoldOblique",bsSubstName:"Arial",wWeight:700,bItalic:1},{bsStandardName:"Helvetica-Oblique",bsSubstName:"Arial",wWeight:400,bItalic:1},{bsStandardName:"Times-Roman",bsSubstName:"Times New Roman",wWeight:400,bItalic:0},{bsStandardName:"Times-Bold",bsSubstName:"Times New Roman",wWeight:700,bItalic:0},{bsStandardName:"Times-BoldItalic",bsSubstName:"Times New Roman",wWeight:700,bItalic:1},{bsStandardName:"Times-Italic",bsSubstName:"Times New Roman",wWeight:400,bItalic:1}],M=function(){function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.postMessageToUi,l=r.cache,f=void 0===l?{}:l,h=r.enginePath,p=void 0===h?".":h,g=r.fontPath,y=void 0===g?"http://webpdf.foxitsoftware.com/webfonts":g,v=r.readBlock,M=void 0===v?8192:v,T=(r.fontMap,r.brotli);b(this,e);var k=(0,o.default)(),A=k.promise;this.jrEnginePromise=A,this.fontPath=y,this.serverFontCache={};var L=T.core;this.customFontMaps=[];var F={onRuntimeInitialized:function(){},printErr:function(e){console.warn("[JR ENGINE]",e)},locateFile:function(e){return"gsdk.wasm"===e?!1===L||-1!==navigator.userAgent.indexOf("Edge")?[p,e].join("/")+"?h="+d.wasmHash:"data:application/octet-stream;base64,"+[p,e+".brotli"].join("/")+"?h="+d.wasmHash:"gsdk.asm.js.mem"===e?[p,e].join("/")+"?h="+d.asmMemHash:[p,e].join("/")+"?h="+d.wasmHash},readBinary:function(e){var t="data:application/octet-stream;base64,";return 0===e.indexOf(t)&&(e=e.replace(t,"")),new Promise((function(t,n){!1===L?P(e,t,n):D(e,t,n,"wasmBinary",i,f.wasmBinary)}))},readAsync:function(e,t,n){if(!1===L)P(e,t,n);else{if(f.asmMem===e)return void S.get(f.asmMem).then((function(r){r?t(r):D(e,t,n,"asmMem",i,f.asmMem)}),(function(){D(e,t,n,"asmMem",i)}));D(e,t,n,"asmMem",i)}}},I=void 0;if(f.wasmBinary===[p,"gsdk.wasm.brotli"].join("/")+"?h="+d.wasmHash){var x=(0,o.default)();I=x.promise,S.get("wasmBinary").then((function(e){e&&(F.wasmBinary=e)})).finally((function(){x.resolve()}))}else I=Promise.resolve();I.then((function(e){var t=void 0;return F.wasmBinary||(t=(0,m.default)()?F.readBinary(F.locateFile("gsdk.wasm")).then((function(e){return e&&(F.wasmBinary=e)})):Promise.resolve()),t})).then((function(){return GSDK(F).then((function(e){n.engine=e,e.wasmBinary=null,GSDK=null,n.annotManager=new s.default(e),n.actionManager=new u.default(e),n.graphicsObjectManager=new c.default(e,n),k.resolve()}))})),this.pdfDocCache={},this.fontInfoMap={},A.then((function(){var e=n.engine,t=0,r=0;e.setThirdPartyFontHandler(e.ThirdPartyFontHandler.implement({GetThirdPartyFont:function(t,r,o,i,s){for(var u=0;u<w.length;u++)if(t===w[u].bsStandardName){var c=8388608|s;u%4==1||u%4==2?c=16777216:c&=-16777217,u%4>=2?c|=33554432:c&=-33554433,t=w[u].bsSubstName,o=w[u].bItalic,i=w[u].wWeight,s=c;break}try{var d=[t,r,o,i,s].join("-");if(n.fontInfoMap[d])return n.fontInfoMap[d];var l=(0,a.getThirdPartyFontBuffer)(y,t,r,o,i,s);if(!l)return null;var f=e.ThirdPartyFontInfo.implement({GetFaceIndex:function(){return 0},GetFontFileData:function(){var t=e._malloc(l.byteLength);return e.HEAPU8.set(new Uint8Array(l),t),t},GetFontFileSize:function(){return l.byteLength}});return n.fontInfoMap[d]=f}catch(e){return isNaN(e)||(e=n.engine.getErrorCode(e)),console.warn(e),null}},GetWebFontFileStream:function(t){var n=(0,a.getWatermarkFontFileBuffer)(t);if(!n)return null;var r=null;try{r=e.StreamCallback.implement({Release:function(){},Flush:function(){return!0},GetSize:function(){return n.byteLength},WriteBlock:function(e,t,n){return console.warn("readonly mode, write function shouldn't be called"),!0},ReadBlock:function(t,r,o){var i=n.slice(r,r+o);return e.HEAPU8.set(i,t),!0}})}catch(e){isNaN(e)||(e=this.engine.getErrorCode(e)),console.warn(e)}return r},GetFontFilesPos:function(e){return(0,a.getWatermarkFontFilesPos)(e)},GetPlatformIDFromThirdParty:function(){return _.default},CountCachedFontFromThirdParty:function(){return n.getCustomUploadFontsCount()},MGetCachedFontDataFromThirdParty:function(e){r=e;var o=n.getCustomUploadFontByIndex(e);if(!o)return 0;var i=new Uint8Array(o.value);t=i.byteLength;var a=n.engine._malloc(t);return n.engine.HEAPU8.set(i,a),a},GetCachedName:function(){var e=n.getCustomUploadFontByIndex(r);if(!e)return 0;var t="custom__"+e.name;return new n.engine.WString(t)},MGetFontFileDataByNameFromThirdParty:function(e){e=e.toString();var r=void 0,o=/^custom__/;if(o.test(e)){e=e.replace(o,"");var i=n.getCustomUploadFontByName(e);r=i?i.value:null}else r=n.getFontFromServer(e);if(!r)return t=0,0;var a=new Uint8Array(r);t=a.byteLength;var s=n.engine._malloc(t);return n.engine.HEAPU8.set(a,s),s},MGetNotExistFontFamilyFromThirdParty:function(){var e=n.getNotExistFontsString();if(!e)return 0;var r=new n.engine.String(e),o=n.engine.HEAPU8.slice(r.GetBuffer(),r.GetBuffer()+e.length);t=e.length;var i=n.engine._malloc(e.length);return n.engine.HEAPU8.set(o,i),i},GetSize:function(){return t}}))})).then((function(){setTimeout((function(){(0,a.prefetchCache)()}),0)})),this.userName="Foxit Web",this.defaultReadBlockSize=M}return e.prototype.getFontBuffer=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:400,i=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return(0,a.getThirdPartyFontBuffer)(this.fontPath,e,r,n,o,t,i)},e.prototype.updatePdfDocCache=function(e){var t=e.id;this.pdfDocCache[t]=e},e.prototype.getPDFDocById=function(e){return this.pdfDocCache[e]||null},e.prototype.destroyDoc=function(e){delete this.pdfDocCache[e]},e.prototype.checkLicense=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p.EMPTY_STR,r=(0,o.default)();return this.jrEnginePromise.then((function(){return e.engine.initialize(t,n).toString().split(" ")})).then((function(t){var n=0==+t[0];return n&&(e.engine.Library.SetDefaultFileSize(e.defaultReadBlockSize),e.engine.setCacheSize(572)),r.resolve({flag:n})})),r.promise},e.prototype.checkLicense2=function(e){var t=this,n=(0,o.default)();return this.jrEnginePromise.then((function(){return t.engine.initialize(e,"").toString().split(" ")})).then((function(e){return 0===+e[0]?(t.engine.Library.SetDefaultFileSize(8192),t.engine.setCacheSize(572),n.resolve({flag:!0,other:e.slice(1).join(" ")})):n.resolve({flag:!1})})),n.promise},e.prototype.createNewPortfolioDoc=function(e,t,n){var r=this.engine,o=new FileReaderSync,a=new i.default(this,{isCreatePortfolio:!0}),s=a.pdfPortfolio.portfolio;if(s.SetInitialViewMode(r.InitialViewMode.e_InitialViewTileMode),e instanceof Blob){var u=o.readAsArrayBuffer(e),c=u.byteLength,d=r._malloc(c);r.HEAPU8.set(new Uint8Array(u),d);var l=r.createPDFDocWithBuffer(d,c);l.Load(new r.String("")),a.doc.RemovePage(0),a.doc.InsertDocument(0,l,0,new r.WString),d&&r._free(d),d=null}if(Array.isArray(t)&&t.length){var f=new r.PortfolioFolderNode(s.GetRootNode());t.forEach((function(e,t){var n=r.ReaderCallback.implement({Release:function(){},GetSize:function(){return e.size},GetPosition:function(){return e.size},ReadBlock:function(t,n,i){var a=new Uint8Array(o.readAsArrayBuffer(e.slice(n,n+i)));return r.HEAPU8.set(a,t),!0}}),i=f.AddFile(n,new r.WString(e.name));0===t&&s.SetInitialFileSpecKeyName(i.GetKeyName()),i.GetFileSpec().SetModifiedDateTime(y.default.ToDateTime(r,e.lastModified||e.lastModifiedDate))}));for(var h=s.GetSchemaFields(),p=0;p<h.GetSize();p++){if(h.GetAt(p).GetKeyName().toString()==s.GetSortingFieldKeyName().toString()){h.RemoveAt(p);break}}s.SetSchemaFields(h),s.SetSortingFieldKeyName(new r.String("FileName"))}this.setMetaData(a,n,"");var m=[];return a.getStream({writeStream:function(e,t,n){m.push(e)}},0).then((function(e){for(var t=new Uint8Array(e),n=0,r=0,o=m.length;r<o;r++){var i=m[r];t.set(new Uint8Array(i),n),n+=i.byteLength}return a.destroy(),t.buffer}))},e.prototype.createNewDoc=function(e,t,n){var r=new i.default(this,{isCreate:!0});this.setMetaData(r,e,t);var o=void 0,a=void 0;return n&&(n.width&&(o=n.width),n.height&&(a=n.height)),r.insertPage(0,o,a).then((function(e){var t=[];return r.getStream({writeStream:function(e,n,r){t.push(e)}},0).then((function(e){for(var n=new Uint8Array(e),o=0,i=0,a=t.length;i<a;i++){var s=t[i];n.set(new Uint8Array(s),o),o+=s.byteLength}return r.destroy(),n.buffer}))}))},e.prototype.setMetaData=function(e,t,n){var r=this.engine,o=(0,h.CWString)(r,"Title"),i=(0,h.CWString)(r,"Author"),a=(0,h.CWString)(r,"Producer"),s=void 0;s=t?(0,h.CWString)(r,t):(0,h.CWString)(r,"Untitled.pdf");var u=void 0;u=n?(0,h.CWString)(r,n):(0,h.CWString)(r,"Unknown");var c=(0,h.CWString)(r,"Foxit PDFWebSDK");e.setMetadataValue(o,s),e.setMetadataValue(i,u),e.setMetadataValue(a,c);var d=(new Date).toString();e.setMetadataValue("CreationDate",d),e.setMetadataValue("ModDate",d)},e.prototype.getPDFDoc=function(e){var t=new i.default(this,e);return this.updatePdfDocCache(t),t},e.prototype.getPDFDocByEngineDoc=function(e){var t=new i.default(this,{engineDoc:e});return this.updatePdfDocCache(t),t},e.prototype.getFDFDoc=function(e){var t=this,n=e.size,r=e.getBuffer,o=(e.release,this.engine.ReaderCallback.implement({Release:function(){},GetSize:function(){return n},ReadBlock:function(e,n,o){var i=new Uint8Array(r(n,o));return t.engine.HEAPU8.set(i,e),!0}}));return Promise.resolve(new this.engine.FDFDoc(o))},e.prototype.getFDFFromURL=function(e){var t=this,n=+this.requestData("GET",!1,e,1,1,!0).getResponseHeader("Content-Range").match("bytes[^]+?/([^]+)")[1],r=this.engine.ReaderCallback.implement({Release:function(){},GetSize:function(){return n},ReadBlock:function(n,r,o){var i=new Uint8Array(t.requestData("GET",!1,e,r,o));return t.engine.HEAPU8.set(i,n),!0}});return Promise.resolve(new this.engine.FDFDoc(r))},e.prototype.getPDFDocAsync=function(e){var t=e.size,n=e.getBuffer,r=e.release,o=new i.default(this,{getBuffer:n,size:t,release:r,async:!0});return this.updatePdfDocCache(o),o},e.prototype.getPDFDocByReaderCalback=function(e){var t=new i.default(this.engine,{readerCallbackParams:e});return this.updatePdfDocCache(t),t},e.prototype.getPDFDocByAsyncReaderCallback=function(e){var t=new i.default(this.engine,{readerCallbackParams:e,async:!0});return this.updatePdfDocCache(t),t},e.prototype.requestData=function(e,t,n,r,o,i){var a=new XMLHttpRequest;if(a.open(e,n,t),void 0!==r){var s="bytes="+r+"-"+(r+o-1);a.setRequestHeader("Range",s)}a.responseType="arraybuffer",a.send(null);var u=a.status;if(u>=200&&u<300||304===u)return i?a:a.response},e.prototype.createReaderCallback=function(e){var t=this.engine;return this.engine.ReaderCallback.implement({jr:this,engine:t,url:e,load:function(){var e=this.jr.requestData("GET",!1,this.url),t=this.docBuffer=new Uint8Array(e);this.size=t.length},Release:function(){this.docBuffer=null},GetSize:function(){return this.size||this.load(),this.size},ReadBlock:function(e,t,n){this.size||this.load();var r=this.docBuffer.slice(t,t+n);return this.engine.HEAPU8.set(r,e),!0}})},e.prototype.registerSecurityCallback=function(e,t){switch(this.unRegisterSecurityCallback(e),e){case"FoxitDRM":return this.registerDRMSecurityCallback(t);default:return!1}},e.prototype.registerDRMSecurityCallback=function(){var e=this;if(this.registeredDRMSecurityCallback)return!0;try{var t=this.engine,n=t.DRMSecurityCallback.implement({Release:function(){},GetSecurityType:function(){return t.EncryptType.e_EncryptFoxitDRM},IsOwner:function(t,n){var r=e.getPDFDocFromCDoc(t);return!!r&&e.getDrmProperty(r,"isOwner")},GetUserPermissions:function(t,n){var r=e.getPDFDocFromCDoc(t);return r?e.getDrmProperty(r,"userPermissions"):0},GetCipherType:function(n,r){var o=e.getPDFDocFromCDoc(n);return o?t.CipherType.values[e.getDrmProperty(o,"cipher")]:t.CipherType.e_CipherNone},GetKeyLength:function(t,n){var r=e.getPDFDocFromCDoc(t);return r?e.getDrmProperty(r,"keyLength"):16},GetFileID:function(n,r){var o=e.getPDFDocFromCDoc(n);return o?new t.String(e.getDrmProperty(o,"fileId","")):new t.String("")},GetInitialKey:function(n,r){var o=e.getPDFDocFromCDoc(n);return o?new t.String(e.getDrmProperty(o,"initialKey","")):new t.String("")}}),r=t.Library.RegisterSecurityCallback((0,h.CString)(t,"FoxitDRM"),n);return r&&(this.registeredDRMSecurityCallback=!0),r}catch(e){return!1}},e.prototype.registerOpenFileSecurityCallback=function(e){var t=this.engine;this.registeredOpenFileSecurityCallback&&this.unRegisterSecurityCallback("FOPN_foweb");try{var n=t.CustomSecurityCallback.implement({JSUseStandardCryptoMethod:function(){return!0},JSCreateContext:function(t,n,r){return e.$$ptr},JSReleaseContext:function(e){return!0},JSGetUserPermissions:function(e,t){var n=0;return 4&t&&(n|=4),8&t&&(n|=8),16&t&&(n|=16),32&t&&(n|=32),n},JSIsOwner:function(e){return!1},JSGetCipher:function(n){return e.cipher&&2===e.cipher?t.CipherType.e_CipherAES:t.CipherType.e_CipherRC4},JSGetEncryptKey:function(n){var r=new t.String(""),o=t._malloc(e.encryptKey.length),i=new Uint8Array(e.encryptKey);return t.HEAPU8.set(i,o),r.Load(o,e.encryptKey.length),r},JSGetDecryptedSize:function(e,t){},JSStartDecryptor:function(e,t,n){},JSDecryptData:function(e,t,n){},JSFinishDecryptor:function(e){},JSGetEncryptedSize:function(e,t,n,r,o){},JSEncryptData:function(e,t,n,r,o,i,a){}}),r=t.Library.RegisterCustomSecurityCallback((0,h.CString)(t,"FOPN_foweb"),n);return r&&(this.registeredOpenFileSecurityCallback=!0),r}catch(e){return!1}},e.prototype.unRegisterSecurityCallback=function(e){var t=this.engine,n=(0,h.CString)(t,e);try{this.engine.Library.UnregisterSecurityCallback(n)}catch(e){try{this.engine.Library.UnregisterSecurityCallback(n)}catch(e){}}},e.prototype.setUserName=function(e){this.userName=e},e.prototype.getUserName=function(){return this.userName},e.prototype.getRotatedAnnotRect=function(e){var t=e.GetRect(),n={left:t.left,top:t.top,right:t.right,bottom:t.bottom,rotate:0};return t.delete(),n},e.prototype.getHexString=function(e){for(var t="",n=e.GetLength(),r=e.GetBuffer(),o=0;o<n;o++){var i=this.engine.HEAP8[r+o]>>>0&255;t+=String.fromCharCode(i)}return t},e.prototype.getPDFDocFromCDoc=function(e){var t=this.pdfDocCache;for(var n in t){var r=t[n];if(e.Equals(r.doc))return r}},e.prototype.getDrmProperty=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=e.otherData;if(!r)return n;var o=r.drm;return o?o[t]:n},e.prototype.getPDFString=function(e){var t=void 0;try{t=e.toString()}catch(s){for(var n="",r=e.GetBuffer(),o=0,i=e.GetLength();o<i;o++){var a=this.engine.HEAP8[r+o]>>>0&255;n+=String.fromCharCode(a)}t=this.pdfNameDecoding(n)}return t},e.prototype.pdfNameDecoding=function(e){if(254==e.charCodeAt(0)&&255==e.charCodeAt(1)){for(var t="",n=2;n<e.length;n+=2)t+=String.fromCharCode((e.charCodeAt(n)<<8)+e.charCodeAt(n+1));return t}return e},e.prototype.setFontMap=function(e){(0,a.setCustomFontMap)(e)},e.prototype.setWatermarkFontMap=function(e){(0,a.setCustomWatermarkFontMap)(e)},e.prototype.addFontMap=function(e){e&&(this.customFontMaps=this.customFontMaps.concat(e))},e.prototype.getCharsetByFontName=function(e){if(e){for(var t=0,n=this.customFontMaps.length;t<n;t++){var r=this.customFontMaps[t];if(r.name.replace(" ","").replace("-","")===e)return this.engine.Charset.values[r.charset||0]}return this.engine.Charset.e_CharsetANSI}},e.prototype.getFontInfoByFontName=function(e){if(e){for(var t=0,n=this.customFontMaps.length;t<n;t++){var r=this.customFontMaps[t];if(r.name.replace(" ","").replace("-","")===e)return{charset:this.engine.Charset.values[r.charset||0],style:r.style}}return{charset:this.engine.Charset.e_CharsetANSI,style:0}}},e.prototype.setActionToDict=function(e,t,n){var r,o=this.engine,i=this.actionManager;if(r=i.create(e,actionJson.type),-1==trigger)try{this.engineWidget.SetAction(jsaction)}catch(e){isNaN(e)||(e=o.getErrorCode(e)),console.warn(e)}else{var a=void 0,s=(0,h.CString)(o,"AA"),u=engineWidget.GetDict(),c=u.GetElement(s);if(c){var d=c.GetDict();a=new o.AdditionalAction(this.pdfPage.doc,d)}else{var l=o.PDFDictionary.Create();u.SetAt(s,l),a=new o.AdditionalAction(this.pdfPage.doc,l)}a.SetAction(o.TriggerEvent.values[trigger],r)}var f=i.get(r,this.doc,this.JR);return f.create(actionJson),f},e.prototype.asyncOperation=function(e,t){var n=this;t||(t=(0,o.default)());try{t.resolve(e())}catch(r){if(17!==this.engine.getErrorCode(r).value)throw r;return setTimeout((function(){n.asyncOperation(e,t)}),30),t.promise}return t.promise},e.prototype.setJPXDownSample=function(e){this._JPXDownSample=e},e.prototype.getJPXDownSample=function(){var e=this._JPXDownSample;return void 0===e||!!e},e.prototype.SetJSObjectRef=function(e){return this.objectMap=this.objectMap||{},this.objectMap[e.$$.ptr]=e,e.$$.ptr},e.prototype.GetJSObjectFromPtr=function(e){if(this.objectMap)return this.objectMap[e]},e.prototype.getEditorContext=function(e,t){var n=this.pageEditorContext;return n?n.setCallbacks(e):(n=this.pageEditorContext=new g.default(this.engine,e,t)).context},e.prototype.storeNotExistFonts=function(e){this._notExistFonts=e},e.prototype.getNotExistFontsString=function(){return(this._notExistFonts||[]).join("\n")},e.prototype.checkFontNotExist=function(e){return(this._notExistFonts||[]).find((function(t){return t===e}))},e.prototype.checkCertificatePassword=function(e,t){var n=this.engine,r=(new FileReaderSync).readAsArrayBuffer(e),o=n.StreamCallback.implement({GetSize:function(){return r.byteLength},GetPosition:function(){return 0},ReadBlock:function(e,t,o){var i=new Uint8Array(r,t,o);return n.HEAPU8.set(i,e),!0}});return n.CheckCertPassword(o,new n.String(t))},e.prototype.getCertificateInfo=function(e,t){var n=this.engine,o={},i=(new FileReaderSync).readAsArrayBuffer(e),a=n.StreamCallback.implement({GetSize:function(){return i.byteLength},GetPosition:function(){return 0},ReadBlock:function(e,t,r){var o=new Uint8Array(i,t,r);return n.HEAPU8.set(o,e),!0}}),s=void 0;if(t?(s=n.GetCerFromPfx(a,new n.String(t)),o.pfxFile=e):s=n.ReadFileContent(a),!s.GetLength())return o;var u=n.HEAPU8.subarray(s.GetBuffer(),s.GetBuffer()+s.GetLength());o.cerFile=new Blob([u],{type:"application/pkix-cert"}),o.serial=n.GetCertificateInfo(s,new n.String("SerialNumber")).toString(),o.validPeriodFrom=n.GetCertificateInfo(s,new n.String("ValidPeriodFrom")).toString(),o.validPeriodTo=n.GetCertificateInfo(s,new n.String("ValidPeriodTo")).toString(),n.GetCertificateInfo(s,new n.String("Issuer")).toString().split(",").forEach((function(e){var t=e.split("="),n=r(t,2),i=n[0],a=n[1];switch(i.replace(/^\s+|\s+$/g,"")){case"CN":o.subjectName=a,o.issuerName=a;break;case"E":o.email=a;break;case"O":o.orgName=a;break;case"OU":o.orgUnit=a;break;case"C":o.country=a}}));var c=n.GetCertificateInfo(s,new n.String("KeyUsage")).toString();return c.indexOf("Digital Signature")>=0&&c.indexOf("Data Encipherment")>=0?o.keyUsage=2:c.indexOf("Digital Signature")>=0?o.keyUsage=0:c.indexOf("Data Encipherment")>=0?o.keyUsage=1:o.keyUsage=-1,o},e.prototype.storeCustomUploadFonts=function(e){this._customUploadFonts=e},e.prototype.getCustomUploadFontsCount=function(){return this._customUploadFonts?this._customUploadFonts.length:0},e.prototype.getCustomUploadFontByIndex=function(e){var t=this._customUploadFonts;return t?t[e]:null},e.prototype.getCustomUploadFontByName=function(e){var t=this._customUploadFonts;return t?t.find((function(t){return t.name===e})):null},e.prototype.storeFontServerRoot=function(e){this._fontServerRoot=e},e.prototype.getFontServerRoot=function(){return this._fontServerRoot||""},e.prototype.getFontFromServer=function(e){var t=Date.now(),n=this.getFontServerRoot()+e,r=this.serverFontCache[n];if(r)return r;var o=new XMLHttpRequest;return o.open("GET",n,!1),o.responseType="arraybuffer",o.send(),o.status>=200&&o.status<300||304===o.status?(postMessage({workflow:"fontProfile",name:e,time:Date.now()-t}),this.serverFontCache[n]=o.response):void 0},e.prototype.cacheFontConfig=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.storeNotExistFonts(e.notExistFonts),this.storeCustomUploadFonts(e.customUploadFonts),this.storeFontServerRoot(e.fontServerRoot)},e.prototype.getFxcoreFontList=function(){var e=this.engine,t=[];if(!e.getFontCommonList)return t;for(var n=e.getFontCommonList(),r=n.GetSize();r--;)t[r]=n.GetAt(r).toString();return t},e}();function D(e,t,n,r,o){P(e,(function(n){var i=(0,l.default)(new Uint8Array(n)).buffer;t(i),S.set(r,i).then((function(){o(r,e)}),(function(){}))}),n)}function P(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(){200==r.status||0==r.status&&r.response?t(r.response):n()},r.onerror=n,r.send(null)}t.default=M},function(e,t,n){"use strict";Uint8Array.prototype.slice||Object.defineProperty(Uint8Array.prototype,"slice",{value:Array.prototype.slice})},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_slicedToArray=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},_createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),_getUniqueId=__webpack_require__(68),_getUniqueId2=_interopRequireDefault(_getUniqueId),_createDeferred=__webpack_require__(73),_createDeferred2=_interopRequireDefault(_createDeferred),_consts=__webpack_require__(20),_PDFPage=__webpack_require__(215),_PDFPage2=_interopRequireDefault(_PDFPage),_PDFDictionary=__webpack_require__(221),_PDFDictionary2=_interopRequireDefault(_PDFDictionary),_BufferBlock=__webpack_require__(628),_BufferBlock2=_interopRequireDefault(_BufferBlock),_PDFBookmark=__webpack_require__(629),_PDFBookmark2=_interopRequireDefault(_PDFBookmark),_PDFLayer=__webpack_require__(226),_PDFLayer2=_interopRequireDefault(_PDFLayer),_Form=__webpack_require__(630),_Form2=_interopRequireDefault(_Form),_LoggerFactory=__webpack_require__(74),_LoggerFactory2=_interopRequireDefault(_LoggerFactory),_cipherType=__webpack_require__(634),_cipherType2=_interopRequireDefault(_cipherType),_keyUsageType=__webpack_require__(635),_keyUsageType2=_interopRequireDefault(_keyUsageType),_PDFObject=__webpack_require__(636),_PDFObject2=_interopRequireDefault(_PDFObject),_PDFFontMgr=__webpack_require__(159),_PDFFontMgr2=_interopRequireDefault(_PDFFontMgr),_errorCode=__webpack_require__(227),_constantsString=__webpack_require__(3),_headerFooter=__webpack_require__(637),_headerFooter2=_interopRequireDefault(_headerFooter),_callback=__webpack_require__(228),_objectsDelete=__webpack_require__(38),_objectsDelete2=_interopRequireDefault(_objectsDelete),_RendererHelper=__webpack_require__(222),_FileSpec=__webpack_require__(44),_FileSpec2=_interopRequireDefault(_FileSpec),_assertion=__webpack_require__(640),_Annot=__webpack_require__(31),_Annot2=_interopRequireDefault(_Annot),_Attachments=__webpack_require__(641),_Attachments2=_interopRequireDefault(_Attachments),_pageEditor=__webpack_require__(364),_pageEditor2=_interopRequireDefault(_pageEditor),_Image=__webpack_require__(37),_Image2=_interopRequireDefault(_Image),_IndexDBCache=__webpack_require__(107),_IndexDBCache2=_interopRequireDefault(_IndexDBCache),_browser=__webpack_require__(155),_InvalidJRObjectError=__webpack_require__(224),_InvalidJRObjectError2=_interopRequireDefault(_InvalidJRObjectError),_VirtualJRPDFPage=__webpack_require__(647),_VirtualJRPDFPage2=_interopRequireDefault(_VirtualJRPDFPage),_axios=__webpack_require__(648),_axios2=_interopRequireDefault(_axios),_convertions=__webpack_require__(158),_progressiveCountine=__webpack_require__(216),_progressiveCountine2=_interopRequireDefault(_progressiveCountine),_annotType=__webpack_require__(217),_createSummarizeCommentsUtil=__webpack_require__(667),_PDFArticle=__webpack_require__(668),_PDFArticle2=_interopRequireDefault(_PDFArticle),_PDFPortfolio=__webpack_require__(669),_PDFPortfolio2=_interopRequireDefault(_PDFPortfolio),_formatDate=__webpack_require__(106);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function _asyncToGenerator(e){return function(){var t=e.apply(this,arguments);return new Promise((function(e,n){return function r(o,i){try{var a=t[o](i),s=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(s).then((function(e){r("next",e)}),(function(e){r("throw",e)}));e(s)}("next")}))}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var noop=function(){},logger=_LoggerFactory2.default.getLogger("pdf-jr.PDFDoc"),continueExport=null;function rshift(e,t){return Math.floor(e/Math.pow(2,t))}function and(e,t){var n=2147483648;return(~~(e/n)&~~(t/n))*n+(2147483647&e&(2147483647&t))}function getPrintRange(e,t){var n=[];if(!e)return n;var r=e.GetElement(t);if(!r)return n;r=r.GetDirectObject().GetArray();for(var o=0;o<r.GetElementCount();o++){var i=r.GetElement(o);n.push(i.GetInteger())}return n}var PDFDoc=function(){function PDFDoc(e,t){var n=this,r=t.getBuffer,o=t.size,i=t.release,a=void 0===i?noop:i,s=t.async,u=void 0!==s&&s,c=t.isCreate,d=void 0!==c&&c,l=t.isCreatePortfolio,f=void 0!==l&&l,h=t.initOpenOptions,p=void 0===h?{}:h,m=t.destroyCallback,g=void 0===m?noop:m,y=t.buffer,_=t.docId,v=t.doc,b=t.engineDoc;_classCallCheck(this,PDFDoc),this.isLoaded=!1,this.docDeferred=(0,_createDeferred2.default)(),this.docPromise=this.docDeferred.promise;var S=o;this.id=_||(0,_getUniqueId2.default)("pdf_doc"),this.JR=e;var w=this.engine=e.engine;this.async=u;var M=void 0;if(this.readerBlockLoading=0,this.initOpenOptions=p,this.destroyCallback=g,this.colors={background:null,foreground:null},v)this.doc=v,this.docDeferred.resolve(v);else if(d)this.doc=new w.PDFDoc,this.docDeferred.resolve(this.doc);else if(f){var D=w.Portfolio.CreatePortfolio();this.doc=D.GetPortfolioPDFDoc(),this.docDeferred.resolve(this.doc)}else if(y){S=y.byteLength;var P=this.buffer=w._malloc(S);w.HEAPU8.set(new Uint8Array(y),P),this.doc=w.createPDFDocWithBuffer(P,S),this.docDeferred.resolve(this.doc)}else if(b)this.doc=b,this.docDeferred.resolve(this.doc);else if(this.getBuffer=r,u){var T=this.asyncBlock=new _BufferBlock2.default(o);M=w.AsyncReaderCallback.implement({Release:function(){a()},GetSize:function(){return S},ReadBlock:function(e,t,o){if(!T.avail(t,o))return T.checkLoadBuffer(t,o)||(T.loadingBuffer(t,o),n.readerBlockLoading++,r(t,o).then((function(e){T.addBuffer(t,o,e),n.readerBlockLoading--}))),!1;var i=T.getBuffer(t,o);if(!i)return T.checkLoadBuffer(t,o)||(T.loadingBuffer(t,o),n.readerBlockLoading++,r(t,o).then((function(e){T.addBuffer(t,o,e),n.readerBlockLoading--}))),!1;var a=new Uint8Array(i);return w.HEAPU8.set(a,e),!0},IsDataAvail:function(e,t){return T.avail(e,t)},AddDownloadHint:function(e,t){var o=e+t+2097152;return o=o>=S?S-e:t+2097152,T.checkLoadBuffer(e,t)||T.avail(e,t)||(T.loadingBuffer(e,o),n.readerBlockLoading++,r(e,o).then((function(t){T.addBuffer(e,o,t),n.readerBlockLoading--}))),!0}}),this.doc=w.createPDFDocWithReaderCallback(M,!0)}else{M=w.AsyncReaderCallback.implement({Release:function(){a()},GetSize:function(){return S>2147483647?(w.SetHighBits(rshift(S,31)),w.SetLowBits(and(S,2147483647)),-1):S},ReadBlock:function(e,t,n){var o=new Uint8Array(r(t,n));return w.HEAPU8.set(o,e),!0},IsDataAvail:function(e,t){return!0},AddDownloadHint:function(e,t){return!0}}),(this.doc=w.createPDFDocWithReaderCallback(M,!0)).IsLinearized()||(this.doc.delete(),M.delete(),M=w.ReaderCallback.implement({Release:function(){a()},GetSize:function(){return S>2147483647?(w.SetHighBits(rshift(S,31)),w.SetLowBits(and(S,2147483647)),-1):S},ReadBlock:function(e,t,n){var o=new Uint8Array(r(t,n));return w.HEAPU8.set(o,e),!0}}),this.doc=w.createPDFDocWithReaderCallback(M,!1))}this.pageCache={},this.pageIndexMap={},this.pageIndexPromise={},this.dictionaryCache={},this.dictionaryMap={},this.blockRanges=[],this.renderFlags=0,this.readerCallback=M,this.destroyHooks=[],this.beforeSaveHooks=[],this.curFileId="",this.taskProgressMap={}}var _ref2,_ref3,_ref4,_ref5,_ref6,_ref13,_ref18,_ref19,_ref20,_ref30,_ref32,_ref34;return PDFDoc.prototype.beforeSave=function(e){this.beforeSaveHooks.push(e)},PDFDoc.prototype.addDestroyHook=function(e){this.destroyHooks.push(e)},PDFDoc.prototype.isLinearized=function(){return this.doc.IsLinearized()},PDFDoc.prototype.createCertificateFile=function(e){var t=this.engine,n=new t.SG_DATASTRUCT;n.cwName=new t.WString(e.cwName||""),n.cwOU=new t.WString(e.cwOU||""),n.cwON=new t.WString(e.cwON||""),n.cwMail=new t.WString(e.cwMail||""),n.csCR=new t.String(e.csCR||""),n.nKA="number"==typeof e.nKA?e.nKA:0,n.nUDF="number"==typeof e.nUDF?e.nUDF:_keyUsageType2.default.SignatureAndEncryption,n.cwSavePass=new t.WString(e.cwSavePass||"");var r=function(e){var n=0;return t.WriterCallback.implement({Release:function(){},Flush:function(){return!0},GetSize:function(){return n},WriteBlock:function(r,o,i){n+=i;var a=t.HEAPU8.buffer,s=void 0;return s=a.slice?a.slice(r,r+i):new Uint8Array(a,r,i).buffer,e.push(s),!0}})},o=[],i=r(o),a=r([]);t.CreateOpenSSLCert(n,i,a);var s=new Blob(o,{type:"application/x-pkcs12"});return this.JR.getCertificateInfo(s,e.cwSavePass)},PDFDoc.prototype.getCertificateSerials=function(){var e=this.engine,t=(0,_createDeferred2.default)(),n=new Set,r=e.CertificateSecurityCallback.implement({Release:function(){t.resolve(Array.from(n))},GetDecryptionKey:function(t,r){for(var o=e.GetSerials(t,r),i=0;i<o.GetSize();i++)n.add(o.GetAt(i).toString());return new e.String("")}}),o=new e.String("Adobe.PubSec");return e.Library.RegisterSecurityCallback(o,r),this.doc.Load(new e.String("")),e.Library.UnregisterSecurityCallback(o),t.promise},PDFDoc.prototype.parseByCertificate=function(e){var t=this.engine,n=(0,_createDeferred2.default)(),r=e.pfxFile,o=e.password,i=(new FileReaderSync).readAsArrayBuffer(r),a=t.StreamCallback.implement({GetSize:function(){return i.byteLength},GetPosition:function(){return 0},ReadBlock:function(e,n,r){var o=new Uint8Array(i,n,r);return t.HEAPU8.set(o,e),!0}}),s=t.CertificateSecurityCallback.implement({Release:function(){},GetDecryptionKey:function(e,n){return new t.Envelope.CreateWithDataBuffer(e,n).GetDecryptionKey(a,new t.String(o))}}),u=new t.String("Adobe.PubSec");t.Library.RegisterSecurityCallback(u,s);var c=this.doc.Load(new t.String(""));return t.Library.UnregisterSecurityCallback(u),n.resolve({code:c.value}),n.promise},PDFDoc.prototype.parseByPassword=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.isLoaded)return Promise.resolve({code:0});void 0===e&&(e=this.initOpenOptions.password||""),n=Object.assign({},this.initOpenOptions,n);var r=this.engine,o=(0,_createDeferred2.default)(),i=function(){setTimeout((function(){t.parseByPassword(e,n).then((function(e){o.resolve(e)}))}),200)};if(this.readerBlockLoading)return i(),o.promise;var a=void 0;if(this.otherData=n,e){var s=new r.String(e);a=this.doc.Load(s),s.delete()}else if(n.encryptPassword){var u=new r.String(n.encryptPassword);a=this.doc.LoadByAsymmetricEncryption(u),u.delete()}else{var c=new r.String(e);a=this.doc.Load(c),c.delete()}if(a===r.ErrorCode.e_ErrSuccess){if(this.password=e,this.curFileId=this.doc.GetFileID().toString(),n.fdf&&n.fdf.file){var d=n.fdf.file,l=n.fdf.type;this.importFromFDF(d,l)}this.isLoaded=!0,this.docDeferred.resolve(this.doc),o.resolve({code:a.value}),0==a.value&&this.getPageByIndex(0).then((function(e){if(!e.isVirtual)return e.parsedPage()})).catch((function(e){return o.reject(e)}))}else if(a===r.ErrorCode.e_ErrDataNotReady)i();else if(a===r.ErrorCode.e_ErrSecurityHandler){var f=this.doc.GetEncryptDict(),h=formateDictToJson(f);"FoxitDRM"===h.Filter&&n.drm?(this.JR.registerDRMSecurityCallback(),i()):"FOPN_foweb"===h.Filter&&n.fileOpen?(n.fileOpen.$$ptr=this.doc.$$.ptr,this.JR.registerOpenFileSecurityCallback(n.fileOpen),i()):o.resolve({code:a.value,encryptDict:h})}else this.JR.unRegisterSecurityCallback("FOPN_foweb"),o.resolve({code:a.value});return o.promise},PDFDoc.prototype.getCurFileSymbolId=function(){return this.curFileId},PDFDoc.prototype.getFadeOutBackground=function(e){var t=this.engine,n=_Image2.default.createImage(t,e),r=new t.Image,o=n.GetFrameBitmap(0).FadeOutBackground();r.AddFrame(o);var i=[],a=t.StreamCallback.implement({Release:function(){},Flush:function(){return!0},GetSize:function(){return 0},WriteBlock:function(e,n,r){var o=t.HEAPU8.buffer,a=void 0;return a=o.slice?o.slice(e,e+r):new Uint8Array(o,e,r).buffer,i=i.concat(a),!0}});return r.SaveAs(a,(0,_constantsString.CWString)(t,".png")),i},PDFDoc.prototype.getConvertToMono=function(e){var t=this.engine,n=_Image2.default.createImage(t,e),r=new t.Image,o=n.GetFrameBitmap(0).ConvertToMono();r.AddFrame(o);var i=[],a=t.StreamCallback.implement({Release:function(){},Flush:function(){return!0},GetSize:function(){return 0},WriteBlock:function(e,n,r){var o=t.HEAPU8.buffer,a=void 0;return a=o.slice?o.slice(e,e+r):new Uint8Array(o,e,r).buffer,i=i.concat(a),!0}});return r.SaveAs(a,(0,_constantsString.CWString)(t,".png")),i},PDFDoc.prototype.updatePageCache=function(e){var t=e.id;this.pageCache[t]=e},PDFDoc.prototype.updatePageIndexMap=function(e,t){this.pageIndexMap[e]=t},PDFDoc.prototype.getPageById=function(e){return this.pageCache[e]||null},PDFDoc.prototype.getAllLoadedPages=function(){var e=[];for(var t in this.pageCache)e.push(this.pageCache[t]);return e},PDFDoc.prototype.extractPrintPages=function(e){var t=this.engine,n=e.reverse,r=e.type,o=e.bleed,i=e.rangeType,a=e.docs,s=e.range,u=void 0;switch(parseInt(r)){case 1:u=t.PrintWhatType.e_PrintWhatDocumentAndMarkups;break;case 2:u=t.PrintWhatType.e_PrintWhatDocumentAndStamps;break;case 3:u=t.PrintWhatType.e_PrintWhatFormFieldsOnly;break;default:u=t.PrintWhatType.e_PrintWhatDocument}var c="",d=0,l=t.WriterCallback.implement({Release:noop,Flush:function(){return!0},GetSize:function(){return d},WriteBlock:function(e,n,r){d+=r;var o=t.HEAPU8.buffer,i=void 0;i=o.slice?o.slice(e,e+r):new Uint8Array(o,e,r).buffer;for(var a=new Uint8Array(i),s=a.byteLength,u=0;u<s;u++)c+=String.fromCharCode(a[u]);return!0}}),f=void 0,h=void 0;if("selectedPDF"===i||"allPDF"===i){if(a.length<1)return!1;a.forEach((function(e){if(f){var n=e.oriFile?e.oriFile.name:"temp.pdf",r=new t.WString(n);f.InsertDocument(h,e.doc,t.InsertDocOptions.e_InsertDocOptionAttachments.value|t.InsertDocOptions.e_InsertDocOptionBookmark.value,r)}else f=e.doc;h=f.GetPageCount()})),s=[[0,h-1]]}else f=this.doc,h=f.GetPageCount();var p=this._generateRange(s,t,h),m=p.ranges,g=(p.addCount,new t.ProcessPrintSetting(u,!!o,!!n,m)),y=f.StartExtractPrintPages(l,g,null);g.delete();for(var _=-1;100!==_;){if(-1===(_=y.GetRateOfProgress()))return!1;y.Continue()}return c},PDFDoc.prototype.getPageFormat=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:324,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:392,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=this,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:void 0,s=this.engine;return this.JR.isInitPageFormat||(s.initPageFormat(),this.JR.isInitPageFormat=!0),this.docPromise.then((function(u){var c=void 0;if(o.pageFormat){if(o.pageFormat.utils&&(o.pageFormat.utils.delete(),o.pageFormat.utils=null),o.pageFormat.oldUtils){try{o.pageFormat.oldUtils.delete()}catch(e){}o.pageFormat.oldUtils=null}o.pageFormat.delete(),o.pageFormat=null}var d=o._getPageformatProvider(t,n,r,a);if(i&&(u=i),c=new s.PageFormat(d,u),d.delete(),c.IsEmpty())return c.delete(),{res:-1,old:null};o.pageFormat=c,o.pageFormat.isCurrentDoc=!i,o.pageFormat.localFormat=a;var l=void 0;switch(e){case"background":l=s.PageFormatType.e_Background;break;case"watermark":l=s.PageFormatType.e_Watermark;break;case"headerfooter":l=s.PageFormatType.e_HeaderFooter;break;case"batesNumbering":l=s.PageFormatType.e_BatesNumber}if(c.StartCheckExistPageFormat(null,l)===s.PageFormatFindRetCode.e_Found){var f=void 0,h=o._getPageformatUtil(c,e,!0);switch(e){case"background":f=o._getBackground(h);break;case"watermark":f=o._getWatermark(h);break;case"headerfooter":f=o._getHeaderfooter(h);break;case"batesNumbering":f=o._getBatesNumbering(h)}return{res:1,old:f}}return{res:0,old:null}}))},PDFDoc.prototype.getPageFormatThumb=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=this;return this.docPromise.then((function(t){if(!o.pageFormat)return null;o.engine;var i=o.pageFormat,a=o._getPageformatUtil(i,e,r);return a?(o.setPageFormat(e,a,n),null):null}))},PDFDoc.prototype.setPageFormat=function(e,t,n){switch(e){case"background":this._setBackground(t,n);break;case"watermark":this._setWatermark(t,n);break;case"headerfooter":this._setHeaderfooter(t,n);break;case"batesNumbering":this._setBatesNumbering(t,n)}},PDFDoc.prototype.removeAllPageFormat=(_ref2=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var n,r,o,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.pageFormat){e.next=2;break}return e.abrupt("return",-1);case 2:n=this.engine,r=this.pageFormat,o=void 0,e.t0=t,e.next="background"===e.t0?8:"watermark"===e.t0?10:"headerfooter"===e.t0?12:"batesNumbering"===e.t0?14:16;break;case 8:return o=n.PageFormatType.e_Background,e.abrupt("break",16);case 10:return o=n.PageFormatType.e_Watermark,e.abrupt("break",16);case 12:return o=n.PageFormatType.e_HeaderFooter,e.abrupt("break",16);case 14:return o=n.PageFormatType.e_BatesNumber,e.abrupt("break",16);case 16:i=r.StartRemoveAll(null,o),e.t1=i,e.next=e.t1===n.PageFormatOperationRetCode.e_Success?20:e.t1===n.PageFormatOperationRetCode.e_Failed?27:e.t1===n.PageFormatOperationRetCode.e_NoChange?29:31;break;case 20:if(!(a=this._getPageformatUtil(r,t,!0))){e.next=25;break}return a.SetPageRange(0,this.doc.GetPageCount()-1),e.next=25,this._pageFormatRemoveFinished(0,this.doc.GetPageCount()-1);case 25:return i=1,e.abrupt("break",31);case 27:return i=-2,e.abrupt("break",31);case 29:return i=0,e.abrupt("break",31);case 31:return e.abrupt("return",i);case 32:case"end":return e.stop()}}),e,this)}))),function(e){return _ref2.apply(this,arguments)}),PDFDoc.prototype.addPageFormat=(_ref3=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n){var r,o,i,a,s,u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.pageFormat){e.next=2;break}return e.abrupt("return",-1);case 2:if("batesNumbering"!==t){e.next=6;break}return e.next=5,this._addBatesNumber(n);case 5:return e.abrupt("return",e.sent);case 6:if(r=this.engine,o=this.pageFormat,i=this._getPageformatUtil(o,t,u)){e.next=11;break}return e.abrupt("return",-2);case 11:a=void 0,s=void 0,e.t0=t,e.next="background"===e.t0?16:"watermark"===e.t0?18:"headerfooter"===e.t0?20:22;break;case 16:return s=r.PageFormatType.e_Background,e.abrupt("break",22);case 18:return s=r.PageFormatType.e_Watermark,e.abrupt("break",22);case 20:return s=r.PageFormatType.e_HeaderFooter,e.abrupt("break",22);case 22:if((a=u?o.StartUpdate(null,s):o.StartInsert(null,s))!==r.PageFormatOperationRetCode.e_Success){e.next=29;break}return e.next=26,this._pageFormatFinished(i,o.isCurrentDoc);case 26:return e.abrupt("return",1);case 29:if(a!==r.PageFormatOperationRetCode.e_Failed){e.next=33;break}return e.abrupt("return",-3);case 33:return e.abrupt("return",0);case 34:case"end":return e.stop()}}),e,this)}))),function(e,t){return _ref3.apply(this,arguments)}),PDFDoc.prototype._addBatesNumber=(_ref4=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var n,r,o,i,a,s,u,c,d,l,f,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.engine,r=this.pageFormat,o=r.isCurrentDoc,i=r.utils,!(a=r.oldUtils)){e.next=26;break}if(s=t.sourceDoc,u=s.fileName,c=s.newDoc,d=this._getPageformatProvider(1,1,u,this.pageFormat.localFormat),l=null,!c){e.next=14;break}l=c,o=!1,e.next=18;break;case 14:return e.next=16,this.docPromise;case 16:l=e.sent,o=!0;case 18:if(r=new n.PageFormat(d,l),d.delete(),!r.IsEmpty()){e.next=23;break}return r.delete(),e.abrupt("return",-1);case 23:(i=r.CreateBatesNumberUtils()).JoinBatesNumberUtils(a),this._setBatesNumbering(i,t);case 26:if((f=r.StartInsert(null,n.PageFormatType.e_BatesNumber))!==n.PageFormatOperationRetCode.e_Success){e.next=35;break}return e.next=30,this._pageFormatFinished(i,o);case 30:return h=i.GetRangeString(new n.WString("-")).toString(),this.pageFormat.oldUtils=i,e.abrupt("return",h);case 35:if(f!==n.PageFormatOperationRetCode.e_Failed){e.next=39;break}return e.abrupt("return",-3);case 39:return e.abrupt("return",0);case 40:case"end":return e.stop()}}),e,this)}))),function(e){return _ref4.apply(this,arguments)}),PDFDoc.prototype._getPageformatUtil=function(e,t,n){var r=void 0;if(e.utils&&(n||e.isUtilsCreated))return e.utils;switch(t){case"background":n?r=e.GetBackgroundUtils():(r=e.CreateBackgroundUtils(),e.isUtilsCreated=!0);break;case"watermark":n?r=e.GetWatermarkUtils():(r=e.CreateWatermarkUtils(),e.isUtilsCreated=!0);break;case"headerfooter":n?r=e.GetHeaderFooterUtils():(r=e.CreateHeaderFooterUtils(),e.isUtilsCreated=!0);break;case"batesNumbering":n?r=e.GetBatesNumberUtils():(r=e.CreateBatesNumberUtils(),e.isUtilsCreated=!0)}return r.IsEmpty()?null:(e.utils=r,r)},PDFDoc.prototype._pageFormatRemoveFinished=(_ref5=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n){var r,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t;case 1:if(!(r<=n)){e.next=12;break}return e.next=4,this.getPageByIndex(r);case 4:if(!(o=e.sent)){e.next=9;break}return e.next=8,o.reParsePage();case 8:o.reloadAnnots();case 9:r++,e.next=1;break;case 12:this.reloadLayer();case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return _ref5.apply(this,arguments)}),PDFDoc.prototype._pageFormatFinished=(_ref6=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var n,r,o,i,a,s,u=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u){e.next=2;break}return e.abrupt("return");case 2:if(n=t.GetPageRangeStart(),r=t.GetPageRangeEnd(),o=t.IsUseEvenPages(),i=t.IsUseOddPages(),!1!==o||!1!==i){e.next=8;break}return e.abrupt("return");case 8:-1===n&&(n=0,r=this.doc.GetPageCount()-1,t.SetPageRange(n,r),t.SetEvenOddFlag(!0,!0)),a=n;case 10:if(!(a<=r)){e.next=26;break}if(i===o){e.next=16;break}if(!o||(a+1)%2==0){e.next=14;break}return e.abrupt("continue",23);case 14:if(!i||(a+1)%2!=0){e.next=16;break}return e.abrupt("continue",23);case 16:return e.next=18,this.getPageByIndex(a);case 18:if(!(s=e.sent)){e.next=23;break}return e.next=22,s.reParsePage();case 22:s.reloadAnnots();case 23:a++,e.next=10;break;case 26:this.reloadLayer();case 27:case"end":return e.stop()}}),e,this)}))),function(e){return _ref6.apply(this,arguments)}),PDFDoc.prototype._setWatermark=function(e,t){if(t){var n=this.engine,r=1===t.sourceType?n.PageFormatSourceType.e_Text:n.PageFormatSourceType.e_ImageFile,i=new n.WString(t.text.replaceAll("\n","\r")),a=t.pageStart,s=t.pageEnd,u=t.pageEven,c=t.pageOdd,d=0;switch(t.unit){case 1:d=n.PageFormatUnitType.e_Inches;break;case 2:d=n.PageFormatUnitType.e_Percent,o;break;case 3:d=n.PageFormatUnitType.e_Centimeters;break;case 4:d=n.PageFormatUnitType.e_Millimeters;break;case 5:d=n.PageFormatUnitType.e_Picas;break;case 6:d=n.PageFormatUnitType.e_Points}var l=0;switch(t.vFrom){case 1:l=n.PageFormatAlignType.e_Top;break;case 2:l=n.PageFormatAlignType.e_VCenter;break;case 3:l=n.PageFormatAlignType.e_Bottom}var f=0;switch(t.hFrom){case 1:f=n.PageFormatAlignType.e_Left;break;case 2:f=n.PageFormatAlignType.e_HCenter;break;case 3:f=n.PageFormatAlignType.e_Right}if(e.SetSourceType(r),e.SetPageRange(a,s),e.SetEvenOddFlag(u,c),2===t.sourceType){if(t.file){var h=n.ReaderCallback.implement({Release:function(){noop()},GetSize:function(){return t.file.size},ReadBlock:function(e,r,o){var i=new Uint8Array(t.file.getBuffer(r,o));return n.HEAPU8.set(i,e),!0}});e.SetImage(h)}else if(t.doc)e.SetPDFDoc(t.doc.doc);else if(t.bitmap){var p=_Image2.default.createImage(n,t.bitmap,!0);e.SetImage(p)}e.SetSourcePageNumber(t.pageNumber),t.scaleCkd?e.SetScale(-t.scale/100):e.SetScale(t.absScale/100)}else{var m="number"==typeof t.fontColor?t.fontColor:parseInt(t.fontColor.replace("#","0x"),16),g=new n.WString(t.fontName);e.SetText(i),e.UnderlineText(t.underLine),e.SetTextColor(m),e.SetFontName(g),t.scaleCkd?e.SetScale(-t.scale/100):(e.SetScale(1),e.SetFontSize(parseFloat(t.fontSize)))}e.SetPositionUnit(d),e.SetVerticalAlign(l),e.SetHorizontalAlign(f),e.SetVerticalValue(parseFloat(t.vDistance)),e.SetHorizontalValue(parseFloat(t.hDistance)),e.SetOpacity(t.opacity/100),e.SetRotation(parseFloat(t.rotate)),e.SetShowOnTopFlag(2===t.appear),e.SetFixedPrintFlag(t.isKeep),e.SetVisibleForPrintFlag(t.isPrint),e.SetDisplayOnScreenFlag(t.isScreen)}},PDFDoc.prototype._setBackground=function(e,t){if(t){var n=this.engine,r=1===t.sourceType?n.PageFormatSourceType.e_Color:n.PageFormatSourceType.e_ImageFile,o=t.pageStart,i=t.pageEnd,a=t.pageEven,s=t.pageOdd,u=0;switch(t.unit){case 1:u=n.PageFormatUnitType.e_Inches;break;case 2:u=n.PageFormatUnitType.e_Percent;break;case 3:u=n.PageFormatUnitType.e_Centimeters;break;case 4:u=n.PageFormatUnitType.e_Millimeters;break;case 5:u=n.PageFormatUnitType.e_Picas;break;case 6:u=n.PageFormatUnitType.e_Points}var c=0;switch(t.vFrom){case 1:c=n.PageFormatAlignType.e_Top;break;case 2:c=n.PageFormatAlignType.e_VCenter;break;case 3:c=n.PageFormatAlignType.e_Bottom}var d=0;switch(t.hFrom){case 1:d=n.PageFormatAlignType.e_Left;break;case 2:d=n.PageFormatAlignType.e_HCenter;break;case 3:d=n.PageFormatAlignType.e_Right}if(e.SetSourceType(r),e.SetPageRange(o,i),e.SetEvenOddFlag(a,s),2===t.sourceType){if(t.file){var l=n.ReaderCallback.implement({Release:function(){noop()},GetSize:function(){return t.file.size},ReadBlock:function(e,r,o){var i=new Uint8Array(t.file.getBuffer(r,o));return n.HEAPU8.set(i,e),!0}});e.SetImage(l)}else t.doc&&e.SetPDFDoc(t.doc.doc);e.SetSourcePageNumber(t.pageNumber),t.scaleCkd?e.SetScale(-t.scale/100):e.SetScale(t.absScale/100)}else{var f=t.backgroundColor;f&&7===f.length&&(f="0x"+f.substr(5,2)+f.substr(3,2)+f.substr(1,2),f=parseInt(f,16),e.SetBackgroundColor(f)),e.SetScale(-t.scale/100)}e.SetPositionUnit(u),e.SetVerticalAlign(c),e.SetHorizontalAlign(d),e.SetVerticalValue(parseFloat(t.vDistance)),e.SetHorizontalValue(parseFloat(t.hDistance)),e.SetOpacity(t.opacity/100),e.SetRotation(parseFloat(t.rotate)),e.SetVisibleForPrintFlag(t.isPrint),e.SetDisplayOnScreenFlag(t.isScreen)}},PDFDoc.prototype._setHeaderfooter=function(e,t){if(t){var n=this.engine,r="number"==typeof t.fontColor?t.fontColor:parseInt(t.fontColor.replace("#","0x"),16),o=new n.WString(t.fontName),i=new n.WString(t.leftHeaderText.replaceAll("\n","\r")),a=new n.WString(t.rightHeaderText.replaceAll("\n","\r")),s=new n.WString(t.centerHeaderText.replaceAll("\n","\r")),u=new n.WString(t.leftFooterText.replaceAll("\n","\r")),c=new n.WString(t.centerFooterText.replaceAll("\n","\r")),d=new n.WString(t.rightFooterText.replaceAll("\n","\r")),l="1";switch(t.pageFormat){case"1":l=n.HeaderFooterPageNumberFormat.e_Number;break;case"1 of n":l=n.HeaderFooterPageNumberFormat.e_NumberOfTotal;break;case"1/n":l=n.HeaderFooterPageNumberFormat.e_NumberSlashTotal;break;case"Page 1":l=n.HeaderFooterPageNumberFormat.e_PageNumber;break;case"Page 1 of n":l=n.HeaderFooterPageNumberFormat.e_PageNumberOfTotal;break;case"Page 1 of n":l=n.HeaderFooterPageNumberFormat.e_BatesNumber}var f="m/d";switch(t.dateFormat){case"m/d":f=n.HeaderFooterDateFormat.e_MSlashD;break;case"m/d/yy":f=n.HeaderFooterDateFormat.e_MSlashDSlashYY;break;case"m/d/yyyy":f=n.HeaderFooterDateFormat.e_MSlashDSlashYYYY;break;case"mm/dd/yy":f=n.HeaderFooterDateFormat.e_MMSlashDDSlashYY;break;case"mm/dd/yyyy":f=n.HeaderFooterDateFormat.e_MMSlashDDSlashYYYY;break;case"d/m/yy":f=n.HeaderFooterDateFormat.e_DSlashMSlashYY;break;case"d/m/yyyy":f=n.HeaderFooterDateFormat.e_DSlashMSlashYYYY;break;case"dd/mm/yy":f=n.HeaderFooterDateFormat.e_DDSlashMMSlashYY;break;case"dd/mm/yyyy":f=n.HeaderFooterDateFormat.e_DDSlashMMSlashYYYY;break;case"mm/yy":f=n.HeaderFooterDateFormat.e_MMSlashYY;break;case"mm/yyyy":f=n.HeaderFooterDateFormat.e_MMSlashYYYY;break;case"m.d.yy":f=n.HeaderFooterDateFormat.e_MDotDDotYY;break;case"m.d.yyyy":f=n.HeaderFooterDateFormat.e_MDotDDotYYYY;break;case"mm.dd.yy":f=n.HeaderFooterDateFormat.e_MMDotDDDotYY;break;case"mm.dd.yyyy":f=n.HeaderFooterDateFormat.e_MMDotDDDotYYYY;break;case"mm.yy":f=n.HeaderFooterDateFormat.e_MMDotYY;break;case"d.m.yyyy":l=n.HeaderFooterDateFormat.e_DDotMDotYYYY;break;case"dd.mm.yy":f=n.HeaderFooterDateFormat.e_DDDotMMDotYY;break;case"dd.mm.yyyy":f=n.HeaderFooterDateFormat.e_DDDotMMDotYYYY;break;case"yy-mm-dd":f=n.HeaderFooterDateFormat.e_YYHyphenMMHyphenDD;break;case"yyyy-mm-dd":f=n.HeaderFooterDateFormat.e_YYYYHyphenMMHyphenDD}var h=t.pageStart,p=t.pageEnd,m=t.pageEven,g=t.pageOdd;e.SetEmbedFontFlag(t.fontEmbed),e.UnderlineText(t.underLine),e.SetTextColor(r),e.SetFontName(o),e.SetFontSize(parseFloat(t.fontSize)),e.SetMargin(n.HeaderFooterMargin.e_Left,t.marginLeft),e.SetMargin(n.HeaderFooterMargin.e_Right,t.marginRight),e.SetMargin(n.HeaderFooterMargin.e_Top,t.marginTop),e.SetMargin(n.HeaderFooterMargin.e_Bottom,t.marginBottom),e.SetText(n.HeaderFooterLocation.e_HeaderLeft,i),e.SetText(n.HeaderFooterLocation.e_HeaderMiddle,s),e.SetText(n.HeaderFooterLocation.e_HeaderRight,a),e.SetText(n.HeaderFooterLocation.e_FooterLeft,u),e.SetText(n.HeaderFooterLocation.e_FooterMiddle,c),e.SetText(n.HeaderFooterLocation.e_FooterRight,d),e.SetDateFormat(f),e.SetPageNumberFormat(l),e.SetPageNumberOffset(t.startPage),e.SetPageRange(h,p),e.SetEvenOddFlag(m,g),e.SetFixedPrintFlag(t.isKeep),e.SetShrinkFlag(t.isShrink)}},PDFDoc.prototype._setBatesNumbering=function(e,t){if(t){var n=this.engine,r=parseInt(t.fontColor.replace("#","0x"),16),o=new n.WString(t.fontName),i=new n.WString(t.leftHeaderText.replaceAll("\n","\r")),a=new n.WString(t.rightHeaderText.replaceAll("\n","\r")),s=new n.WString(t.centerHeaderText.replaceAll("\n","\r")),u=new n.WString(t.leftFooterText.replaceAll("\n","\r")),c=new n.WString(t.centerFooterText.replaceAll("\n","\r")),d=new n.WString(t.rightFooterText.replaceAll("\n","\r")),l="1";switch(t.pageFormat){case"1":l=n.HeaderFooterPageNumberFormat.e_Number;break;case"1 of n":l=n.HeaderFooterPageNumberFormat.e_NumberOfTotal;break;case"1/n":l=n.HeaderFooterPageNumberFormat.e_NumberSlashTotal;break;case"Page 1":l=n.HeaderFooterPageNumberFormat.e_PageNumber;break;case"Page 1 of n":l=n.HeaderFooterPageNumberFormat.e_PageNumberOfTotal;break;case"Bates Number":l=n.HeaderFooterPageNumberFormat.e_BatesNumber}var f="m/d";switch(t.dateFormat){case"m/d":f=n.HeaderFooterDateFormat.e_MSlashD;break;case"m/d/yy":f=n.HeaderFooterDateFormat.e_MSlashDSlashYY;break;case"m/d/yyyy":f=n.HeaderFooterDateFormat.e_MSlashDSlashYYYY;break;case"mm/dd/yy":f=n.HeaderFooterDateFormat.e_MMSlashDDSlashYY;break;case"mm/dd/yyyy":f=n.HeaderFooterDateFormat.e_MMSlashDDSlashYYYY;break;case"d/m/yy":f=n.HeaderFooterDateFormat.e_DSlashMSlashYY;break;case"d/m/yyyy":f=n.HeaderFooterDateFormat.e_DSlashMSlashYYYY;break;case"dd/mm/yy":f=n.HeaderFooterDateFormat.e_DDSlashMMSlashYY;break;case"dd/mm/yyyy":f=n.HeaderFooterDateFormat.e_DDSlashMMSlashYYYY;break;case"mm/yy":f=n.HeaderFooterDateFormat.e_MMSlashYY;break;case"mm/yyyy":f=n.HeaderFooterDateFormat.e_MMSlashYYYY;break;case"m.d.yy":f=n.HeaderFooterDateFormat.e_MDotDDotYY;break;case"m.d.yyyy":f=n.HeaderFooterDateFormat.e_MDotDDotYYYY;break;case"mm.dd.yy":f=n.HeaderFooterDateFormat.e_MMDotDDDotYY;break;case"mm.dd.yyyy":f=n.HeaderFooterDateFormat.e_MMDotDDDotYYYY;break;case"mm.yy":f=n.HeaderFooterDateFormat.e_MMDotYY;break;case"d.m.yyyy":l=n.HeaderFooterDateFormat.e_DDotMDotYYYY;break;case"dd.mm.yy":f=n.HeaderFooterDateFormat.e_DDDotMMDotYY;break;case"dd.mm.yyyy":f=n.HeaderFooterDateFormat.e_DDDotMMDotYYYY;break;case"yy-mm-dd":f=n.HeaderFooterDateFormat.e_YYHyphenMMHyphenDD;break;case"yyyy-mm-dd":f=n.HeaderFooterDateFormat.e_YYYYHyphenMMHyphenDD}var h=t.pageStart,p=t.pageEnd,m=t.pageEven,g=t.pageOdd;e.SetEmbedFontFlag(t.fontEmbed),e.UnderlineText(t.underLine),e.SetTextColor(r),e.SetFontName(o),e.SetFontSize(parseFloat(t.fontSize)),e.SetMargin(n.HeaderFooterMargin.e_Left,t.marginLeft),e.SetMargin(n.HeaderFooterMargin.e_Right,t.marginRight),e.SetMargin(n.HeaderFooterMargin.e_Top,t.marginTop),e.SetMargin(n.HeaderFooterMargin.e_Bottom,t.marginBottom),e.SetText(n.HeaderFooterLocation.e_HeaderLeft,i),e.SetText(n.HeaderFooterLocation.e_HeaderMiddle,s),e.SetText(n.HeaderFooterLocation.e_HeaderRight,a),e.SetText(n.HeaderFooterLocation.e_FooterLeft,u),e.SetText(n.HeaderFooterLocation.e_FooterMiddle,c),e.SetText(n.HeaderFooterLocation.e_FooterRight,d),e.SetDateFormat(f),e.SetPageNumberFormat(l),e.SetPageNumberOffset(t.startPage),e.SetPageRange(h,p),e.SetEvenOddFlag(m,g),e.SetFixedPrintFlag(t.isKeep),e.SetShrinkFlag(t.isShrink)}},PDFDoc.prototype._getWatermark=function(e){var t={},n=this.engine,r=parseInt(e.GetTextColor()).toString(16);if(r.length<6)for(var o=6-r.length,i=0;i<o;i++)r="0"+r;r="#"+r;var a=e.GetSourceType().value===n.PageFormatSourceType.e_Text.value?1:2,s=0;switch(e.GetPositionUnit().value){case n.PageFormatUnitType.e_Inches.value:s=1;break;case n.PageFormatUnitType.e_Percent.value:s=2;break;case n.PageFormatUnitType.e_Centimeters.value:s=3;break;case n.PageFormatUnitType.e_Millimeters.value:s=4;break;case n.PageFormatUnitType.e_Picas.value:s=5;break;case n.PageFormatUnitType.e_Points.value:s=6}var u=0;switch(e.GetVerticalAlign().value){case n.PageFormatAlignType.e_Top.value:u=1;break;case n.PageFormatAlignType.e_VCenter.value:u=2;break;case n.PageFormatAlignType.e_Bottom.value:u=3}var c=0;switch(e.GetHorizontalAlign().value){case n.PageFormatAlignType.e_Left.value:c=1;break;case n.PageFormatAlignType.e_HCenter.value:c=2;break;case n.PageFormatAlignType.e_Right.value:c=3}return t.sourceType=a,t.pageNumber=e.GetSourcePageNumber(),t.text=e.GetText().toString().replaceAll("\r","\n"),t.fontSize=parseInt(e.GetFontSize()),t.underLine=e.IsUnderline(),t.fontColor=r,t.fontName=e.GetFontName().toString(),t.opacity=parseInt(100*e.GetOpacity()),t.rotate=e.GetRotation(),t.scale=Math.round(100*e.GetScale()),t.appear=!0===e.IsShowOnTop()?2:1,t.isKeep=e.IsFixedPrint(),t.isPrint=e.IsVisibleForPrint(),t.isScreen=e.IsDisplayOnScreen(),t.unit=s,t.vFrom=u,t.hFrom=c,t.hDistance=parseFloat(e.GetHorizontalValue()),t.vDistance=parseFloat(e.GetVerticalValue()),t.pageStart=e.GetPageRangeStart(),t.pageEnd=e.GetPageRangeEnd(),t.pageEven=e.IsUseEvenPages(),t.pageOdd=e.IsUseOddPages(),t},PDFDoc.prototype._getBackground=function(e){var t={},n=this.engine,r=parseInt(e.GetBackgroundColor()).toString(16);if(r.length<6)for(var o=6-r.length,i=0;i<o;i++)r="0"+r;r="#"+r;var a=e.GetSourceType().value===n.PageFormatSourceType.e_Color.value?1:2,s=0;switch(e.GetPositionUnit().value){case n.PageFormatUnitType.e_Inches.value:s=1;break;case n.PageFormatUnitType.e_Percent.value:s=2;break;case n.PageFormatUnitType.e_Centimeters.value:s=3;break;case n.PageFormatUnitType.e_Millimeters.value:s=4;break;case n.PageFormatUnitType.e_Picas.value:s=5;break;case n.PageFormatUnitType.e_Points.value:s=6}var u=0;switch(e.GetVerticalAlign().value){case n.PageFormatAlignType.e_Top.value:u=1;break;case n.PageFormatAlignType.e_VCenter.value:u=2;break;case n.PageFormatAlignType.e_Bottom.value:u=3}var c=0;switch(e.GetHorizontalAlign().value){case n.PageFormatAlignType.e_Left.value:c=1;break;case n.PageFormatAlignType.e_HCenter.value:c=2;break;case n.PageFormatAlignType.e_Right.value:c=3}return t.sourceType=a,t.pageNumber=e.GetSourcePageNumber(),t.backgroundColor=r,t.opacity=parseInt(100*e.GetOpacity()),t.rotate=e.GetRotation(),t.scale=Math.round(100*e.GetScale()),t.isPrint=e.IsVisibleForPrint(),t.isScreen=e.IsDisplayOnScreen(),t.unit=s,t.vFrom=u,t.hFrom=c,t.hDistance=parseFloat(e.GetHorizontalValue()),t.vDistance=parseFloat(e.GetVerticalValue()),t.pageStart=e.GetPageRangeStart(),t.pageEnd=e.GetPageRangeEnd(),t.pageEven=e.IsUseEvenPages(),t.pageOdd=e.IsUseOddPages(),t},PDFDoc.prototype._getHeaderfooter=function(e){var t={},n=this.engine,r=parseInt(e.GetTextColor()).toString(16);if(r.length<6)for(var o=6-r.length,i=0;i<o;i++)r="0"+r;r="#"+r;var a=e.GetPageNumberFormat().value;switch(a){case n.HeaderFooterPageNumberFormat.e_Number.value:a="1";break;case n.HeaderFooterPageNumberFormat.e_NumberOfTotal.value:a="1 of n";break;case n.HeaderFooterPageNumberFormat.e_NumberSlashTotal.value:a="1/n";break;case n.HeaderFooterPageNumberFormat.e_PageNumber.value:a="Page 1";break;case n.HeaderFooterPageNumberFormat.e_PageNumberOfTotal.value:case n.HeaderFooterPageNumberFormat.e_BatesNumber.value:a="Page 1 of n"}var s=e.GetDateFormat().value;switch(s){case n.HeaderFooterDateFormat.e_MSlashD.value:s="m/d";break;case n.HeaderFooterDateFormat.e_MSlashDSlashYY.value:s="m/d/yy";break;case n.HeaderFooterDateFormat.e_MSlashDSlashYYYY.value:s="m/d/yyyy";break;case n.HeaderFooterDateFormat.e_MMSlashDDSlashYY.value:s="mm/dd/yy";break;case n.HeaderFooterDateFormat.e_MMSlashDDSlashYYYY.value:s="mm/dd/yyyy";break;case n.HeaderFooterDateFormat.e_DSlashMSlashYY.value:s="d/m/yy";break;case n.HeaderFooterDateFormat.e_DSlashMSlashYYYY.value:s="d/m/yyyy";break;case n.HeaderFooterDateFormat.e_DDSlashMMSlashYY.value:s="dd/mm/yy";break;case n.HeaderFooterDateFormat.e_DDSlashMMSlashYYYY.value:s="dd/mm/yyyy";break;case n.HeaderFooterDateFormat.e_MMSlashYY.value:s="mm/yy";break;case n.HeaderFooterDateFormat.e_MMSlashYYYY:s="mm/yyyy";break;case n.HeaderFooterDateFormat.e_MDotDDotYY.value:s="m.d.yy";break;case n.HeaderFooterDateFormat.e_MDotDDotYYYY.value:s="m.d.yyyy";break;case n.HeaderFooterDateFormat.e_MMDotDDDotYY.value:s="mm.dd.yy";break;case n.HeaderFooterDateFormat.e_MMDotDDDotYYYY.value:s="mm.dd.yyyy";break;case n.HeaderFooterDateFormat.e_MMDotYY.value:s="mm.yy";break;case n.HeaderFooterDateFormat.e_DDotMDotYYYY.value:s="d.m.yyyy";break;case n.HeaderFooterDateFormat.e_DDDotMMDotYY.value:s="dd.mm.yy";break;case n.HeaderFooterDateFormat.e_DDDotMMDotYYYY.value:s="dd.mm.yyyy";break;case n.HeaderFooterDateFormat.e_YYHyphenMMHyphenDD.value:s="yy-mm-dd";break;case n.HeaderFooterDateFormat.e_YYYYHyphenMMHyphenDD.value:s="yyyy-mm-dd"}return t.fontSize=parseInt(e.GetFontSize()),t.underLine=e.IsUnderline(),t.fontEmbed=e.IsEmbeddedFont(),t.fontColor=r,t.fontName=e.GetFontName().toString(),t.leftHeaderText=e.GetText(n.HeaderFooterLocation.e_HeaderLeft).toString().replaceAll("\r","\n"),t.centerHeaderText=e.GetText(n.HeaderFooterLocation.e_HeaderMiddle).toString().replaceAll("\r","\n"),t.rightHeaderText=e.GetText(n.HeaderFooterLocation.e_HeaderRight).toString().replaceAll("\r","\n"),t.leftFooterText=e.GetText(n.HeaderFooterLocation.e_FooterLeft).toString().replaceAll("\r","\n"),t.centerFooterText=e.GetText(n.HeaderFooterLocation.e_FooterMiddle).toString().replaceAll("\r","\n"),t.rightFooterText=e.GetText(n.HeaderFooterLocation.e_FooterRight).toString().replaceAll("\r","\n"),t.marginLeft=e.GetMargin(n.HeaderFooterMargin.e_Left),t.marginRight=e.GetMargin(n.HeaderFooterMargin.e_Right),t.marginTop=e.GetMargin(n.HeaderFooterMargin.e_Top),t.marginBottom=e.GetMargin(n.HeaderFooterMargin.e_Bottom),t.pageStart=e.GetPageRangeStart(),t.pageEnd=e.GetPageRangeEnd(),t.pageEven=e.IsUseEvenPages(),t.pageOdd=e.IsUseOddPages(),t.isKeep=e.IsFixedPrint(),t.isShrink=e.IsShrink(),t.dateFormat=s,t.pageFormat=a,t.startPage=e.GetPageNumberOffset(),t},PDFDoc.prototype._getBatesNumbering=function(e){var t={},n=this.engine,r=parseInt(e.GetTextColor()).toString(16);if(r.length<6)for(var o=6-r.length,i=0;i<o;i++)r="0"+r;r="#"+r;var a=e.GetPageNumberFormat().value;switch(a){case n.HeaderFooterPageNumberFormat.e_Number.value:a="1";break;case n.HeaderFooterPageNumberFormat.e_NumberOfTotal.value:a="1 of n";break;case n.HeaderFooterPageNumberFormat.e_NumberSlashTotal.value:a="1/n";break;case n.HeaderFooterPageNumberFormat.e_PageNumber.value:a="Page 1";break;case n.HeaderFooterPageNumberFormat.e_PageNumberOfTotal.value:case n.HeaderFooterPageNumberFormat.e_BatesNumber.value:a="Page 1 of n"}var s=e.GetDateFormat().value;switch(s){case n.HeaderFooterDateFormat.e_MSlashD.value:s="m/d";break;case n.HeaderFooterDateFormat.e_MSlashDSlashYY.value:s="m/d/yy";break;case n.HeaderFooterDateFormat.e_MSlashDSlashYYYY.value:s="m/d/yyyy";break;case n.HeaderFooterDateFormat.e_MMSlashDDSlashYY.value:s="mm/dd/yy";break;case n.HeaderFooterDateFormat.e_MMSlashDDSlashYYYY.value:s="mm/dd/yyyy";break;case n.HeaderFooterDateFormat.e_DSlashMSlashYY.value:s="d/m/yy";break;case n.HeaderFooterDateFormat.e_DSlashMSlashYYYY.value:s="d/m/yyyy";break;case n.HeaderFooterDateFormat.e_DDSlashMMSlashYY.value:s="dd/mm/yy";break;case n.HeaderFooterDateFormat.e_DDSlashMMSlashYYYY.value:s="dd/mm/yyyy";break;case n.HeaderFooterDateFormat.e_MMSlashYY.value:s="mm/yy";break;case n.HeaderFooterDateFormat.e_MMSlashYYYY:s="mm/yyyy";break;case n.HeaderFooterDateFormat.e_MDotDDotYY.value:s="m.d.yy";break;case n.HeaderFooterDateFormat.e_MDotDDotYYYY.value:s="m.d.yyyy";break;case n.HeaderFooterDateFormat.e_MMDotDDDotYY.value:s="mm.dd.yy";break;case n.HeaderFooterDateFormat.e_MMDotDDDotYYYY.value:s="mm.dd.yyyy";break;case n.HeaderFooterDateFormat.e_MMDotYY.value:s="mm.yy";break;case n.HeaderFooterDateFormat.e_DDotMDotYYYY.value:s="d.m.yyyy";break;case n.HeaderFooterDateFormat.e_DDDotMMDotYY.value:s="dd.mm.yy";break;case n.HeaderFooterDateFormat.e_DDDotMMDotYYYY.value:s="dd.mm.yyyy";break;case n.HeaderFooterDateFormat.e_YYHyphenMMHyphenDD.value:s="yy-mm-dd";break;case n.HeaderFooterDateFormat.e_YYYYHyphenMMHyphenDD.value:s="yyyy-mm-dd"}return t.fontSize=parseInt(e.GetFontSize()),t.underLine=e.IsUnderline(),t.fontEmbed=e.IsEmbeddedFont(),t.fontColor=r,t.fontName=e.GetFontName().toString(),t.leftHeaderText=e.GetText(n.HeaderFooterLocation.e_HeaderLeft).toString().replaceAll("\r","\n"),t.centerHeaderText=e.GetText(n.HeaderFooterLocation.e_HeaderMiddle).toString().replaceAll("\r","\n"),t.rightHeaderText=e.GetText(n.HeaderFooterLocation.e_HeaderRight).toString().replaceAll("\r","\n"),t.leftFooterText=e.GetText(n.HeaderFooterLocation.e_FooterLeft).toString().replaceAll("\r","\n"),t.centerFooterText=e.GetText(n.HeaderFooterLocation.e_FooterMiddle).toString().replaceAll("\r","\n"),t.rightFooterText=e.GetText(n.HeaderFooterLocation.e_FooterRight).toString().replaceAll("\r","\n"),t.marginLeft=e.GetMargin(n.HeaderFooterMargin.e_Left),t.marginRight=e.GetMargin(n.HeaderFooterMargin.e_Right),t.marginTop=e.GetMargin(n.HeaderFooterMargin.e_Top),t.marginBottom=e.GetMargin(n.HeaderFooterMargin.e_Bottom),t.pageStart=e.GetPageRangeStart(),t.pageEnd=e.GetPageRangeEnd(),t.pageEven=e.IsUseEvenPages(),t.pageOdd=e.IsUseOddPages(),t.isKeep=e.IsFixedPrint(),t.isShrink=e.IsShrink(),t.dateFormat=s,t.pageFormat=a,t.startPage=e.GetPageNumberOffset(),t},PDFDoc.prototype._getPageformatProvider=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,o=this.engine,i=o.PageformatUndoCallback.implement({CanUndoRedo:function(){return!1},OnAddUndo:function(e){},OnUndoRedoBegin:function(){},OnUndoRedoEnd:function(){}}),a=o.PageformatProgressBarCallback.implement({Create:function(){return 0},SetRange:function(e,t,n){},SetText:function(e,t){},SetCurrentValue:function(e,t){},PeekAndPump:function(e){},Destroy:function(e){},GetString:function(e){r||(r={fileName:"File Name",date:"1\\n1 of n\\n1/n\\nPage 1\\nPage 1 of n\\nBates Number",dateLocal:"%d\\n%d of %d\\n%d/%d\\nPage %d\\nPage %d of %d\\nBates Number"});var t=void 0;switch(e){case o.PageFormatProgressBarStringResourceID.e_FileName:t=r.fileName;break;case o.PageFormatProgressBarStringResourceID.e_DateFormat:t="m/d\\nm/d/yy\\nm/d/yyyy\\nmm/dd/yy\\nmm/dd/yyyy\\nd/m/yy\\nd/m/yyyy\\ndd/mm/yy\\ndd/mm/yyyy\\nmm/yy\\nmm/yyyy\\nm.d.yy\\nm.d.yyyy\\nmm.dd.yy\\nmm.dd.yyyy\\nmm.yy\\nd.m.yyyy\\ndd.mm.yy\\ndd.mm.yyyy\\nyy-mm-dd\\nyyyy-mm-dd";break;case o.PageFormatProgressBarStringResourceID.e_PageNumberFormat:t=r.date;break;case o.PageFormatProgressBarStringResourceID.e_PageNumberFormatLocal:t=r.dateLocal;break;default:t=""}return new o.WString(t)}}),s=o.PageformatSysFontCallback.implement({IsStandardFont:function(e){return!1},GetScriptName:function(e,t){return new o.WString("")},GetFaceName:function(e){return new o.WString(e.toString())},GetFontTypeName:function(e){return new o.String("")},GetFontFaceNameBold:function(e,t){return!1},GetFontFaceNameItalic:function(e,t){return!1}}),u=o.PageFormatProviderCallback.implement({Release:function(){},GetPreviewRect:function(n){return new o.FX_RECT(0,0,e,t)},GetPage:function(e,t){return e.GetPage(t)},OnPageChanged:function(e){},GetDocName:function(e){return new o.WString(n)}}),c=new o.PageFormatProvider(u);return c.SetProgressBarCallback(a),c.SetUndoCallback(i),c.SetSysFontCallback(s),c},PDFDoc.prototype.setAllBoxesByIndexes=function(e,t,n,r,o,i,a){var s=this,u=[],c=this.engine;return this.docPromise.then((function(d){var l;return e.forEach((l=_asyncToGenerator(regeneratorRuntime.mark((function e(l){var f,h,p,m,g,y,_,v,b,S,w,M;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(f=JSON.parse(JSON.stringify(i)),h=s.pageIndexMap[l],p=void 0,h?p=h.page||d.GetPage(l):(p=d.GetPage(l),(h=new _PDFPage2.default(l,s)).page=p),m=h.getBox(0),g=m.right-m.left,y=m.top-m.bottom,_=["cropBox","artBox","trimBox","bleedBox"],!a){e.next=13;break}return e.next=11,h.calcContentBBox(0);case 11:v=e.sent,_.forEach((function(e){f[e]=v}));case 13:S="number"==typeof n?n:y,(b="number"==typeof t?t:g)>g&&S>y?(m={left:0,right:b,bottom:0,top:S},_.forEach((function(e){var t=f[e];t&&(t.right=b-g+t.right,t.top=S-y+t.top)}))):r=o=0,(w=f.cropBox)&&w.right-w.left>=10&&w.top-w.bottom>=10&&(_.forEach((function(e){if("cropBox"!==e){var t=f[e];if(!t)return;var n=w.right-w.left,r=t.right-t.left,o=w.top-w.bottom,i=t.top-t.top;r>n&&(t.left=w.left,t.right=w.right),i>o&&(t.bottom=w.bottom,t.top=w.top),t.left=Math.max(w.left,t.left),t.bottom=Math.max(w.bottom,t.bottom),t.right=Math.min(w.right,t.right),t.top=Math.min(w.top,t.top)}})),f.cropBox&&h.setBox(1,f.cropBox),f.trimBox&&h.setBox(2,f.trimBox),f.artBox&&h.setBox(3,f.artBox),f.bleedBox&&h.setBox(4,f.bleedBox)),h.setBox(0,m),p.Reload(!1),(r>0||o>0)&&(M=new c.Matrix(1,0,0,1,Math.floor(r),Math.floor(o)),p.Transform(M,!0),p.StartParse(0,null,!0),M.delete()),u.push(h.toJson());case 22:case"end":return e.stop()}}),e,s)}))),function(e){return l.apply(this,arguments)})),u}))},PDFDoc.prototype.getAllBoxes=function(e){var t=this,n={};return this.docPromise.then((function(e){return[e.GetPageCount(),e]})).then((function(r){for(var o=_slicedToArray(r,2),i=o[0],a=o[1],s=0,u=0,c=i;c--;){var d=a.GetPage(c),l=new _PDFPage2.default(c,t);l.page=d;var f=l.getBox(0),h=f.right-f.left,p=f.top-f.bottom;c===e&&(n={mediaBox:f,cropBox:l.getBox(1),trimBox:d.GetBox(t.engine.BoxType.e_TrimBox).IsEmpty()?{}:l.getBox(2),artBox:d.GetBox(t.engine.BoxType.e_ArtBox).IsEmpty()?{}:l.getBox(3),bleedBox:d.GetBox(t.engine.BoxType.e_BleedBox).IsEmpty()?{}:l.getBox(4),width:h,height:p,pdfPage:l}),s=0===s||s>h?h:s,u=0===u||u>p?p:u}return n.minWidth=s,n.minHeight=u,n.pdfPage.calcContentBBox(0)})).then((function(e){return n.calcBox=e,delete n.pdfPage,n}))},PDFDoc.prototype.getPDFDocInfo=function(){return this.docPromise.then((function(e){var t=(0,_createDeferred2.default)(),n=e.GetInfo();return t.resolve(n),t.promise}))},PDFDoc.prototype.getPageCount=function(){return this.docPromise.then((function(e){return e.GetPageCount()}))},PDFDoc.prototype.getIndirectObject=function(e){return this.docPromise.then((function(t){var n=t.GetIndirectObject(e);return new _PDFObject2.default(t,n)}))},PDFDoc.prototype.getPagesWidthHeight=function(){return this.docPromise.then((function(e){return[e.GetPageCount(),e]})).then((function(e){for(var t=_slicedToArray(e,2),n=t[0],r=t[1],o=[],i=Date.now(),a=n;a--;){var s=r.GetPage(a);o[a]={width:s.GetWidth(),height:s.GetHeight()}}Date.now();return o}))},PDFDoc.prototype.getPageByIndex=function(e,t){var n=this,r=this.pageIndexMap[e];if(r)return t&&(r.id=t,this.updatePageCache(r)),Promise.resolve(r);if(this.pageIndexPromise[e])return this.pageIndexPromise[e];var o=(0,_createDeferred2.default)();return r=new _PDFPage2.default(e,this),this.pageIndexPromise[e]=r.c_pagePromise.then((function(){t&&(r.id=t),n.updatePageIndexMap(e,r),n.updatePageCache(r),delete n.pageIndexPromise[e],o.resolve(r)})).catch((function(t){_InvalidJRObjectError2.default.is(t)?(r=new _VirtualJRPDFPage2.default(e,n),n.updatePageIndexMap(e,r),n.updatePageCache(r),delete n.pageIndexPromise[e],o.resolve(r)):o.reject(t)})),o.promise},PDFDoc.prototype.getPage=function(e){},PDFDoc.prototype.getPDFPageByPageIndex=function(e){},PDFDoc.prototype.getPermission=function(){return this.stdCipherOptions?this.stdCipherOptions.permission:this.doc.GetUserPermissions()},PDFDoc.prototype.getMetadata=function(){for(var e=this.engine,t=new e.Metadata(this.doc),n={Title:getMetadataValues(t,(0,_constantsString.CWString)(e,"Title")),Author:getMetadataValues(t,(0,_constantsString.CWString)(e,"Author")),Subject:getMetadataValues(t,(0,_constantsString.CWString)(e,"Subject")),Keywords:getMetadataValues(t,(0,_constantsString.CWString)(e,"Keywords")),Creator:getMetadataValues(t,(0,_constantsString.CWString)(e,"Creator")),Producer:getMetadataValues(t,(0,_constantsString.CWString)(e,"Producer")),Trapped:getMetadataValues(t,(0,_constantsString.CWString)(e,"Trapped")),CreationDate:formatMetadataDate(getMetadataValues(t,(0,_constantsString.CWString)(e,"CreationDate"))),ModDate:formatMetadataDate(getMetadataValues(t,(0,_constantsString.CWString)(e,"ModDate"))),pdfaid:getMetadataValues(t,(0,_constantsString.CWString)(e,"pdfaid")),isTagged:this.doc.IsTaggedPDF(),isLinearized:this.doc.IsLinearized(),version:this.doc.GetFileVersion(),count:this.doc.GetPageCount()},r={},o=t.GetCustomerKeys(),i=0;i<o.GetSize();i++){var a=o.GetAt(i),s=t.GetValues(a),u=s.GetSize()>0?s.GetAt(0).toString():"";r[a.toString()]=u}for(var c={},d=t.GetAllRdfXMLKeys(),l=0;l<d.GetSize();l++){var f=d.GetAt(l).toString().split(":");if(!["CreateDate","Keywords","ModifyDate","Producer"].includes(f[1])){var h=t.GetRdfXMLString((0,_constantsString.CWString)(e,f[0]),(0,_constantsString.CWString)(e,f[1]));c[f[1]]=h.toString()}}return t.delete(),t=null,n.allXMLKey=c,n.custom=r,n},PDFDoc.prototype.setMetadataValue=function(e,t){var n=this.engine,r=new n.WString(e.toString()),o=void 0;o="CreationDate"===e||"ModDate"===e?this.ToDateTime(t):new n.WString(t.toString());var i=new n.Metadata(this.doc);if("CreationDate"===e)i.SetCreationDateTime(o);else if("ModDate"===e)i.SetModifiedDateTime(o);else{var a=i.GetValues(r);a.RemoveAll(),a.Add(o),i.SetValues(r,a)}i.delete(),i=null},PDFDoc.prototype.ToDateTime=function(e){var t=new Date(e),n=t.getFullYear(),r=t.getMonth()+1,o=t.getDate(),i=t.getHours(),a=t.getMinutes(),s=t.getSeconds(),u=t.getMilliseconds(),c=-t.getTimezoneOffset()/60;return new this.engine.DateTime(n,r,o,i,a,s,u,c,0)},PDFDoc.prototype.movePageTo=function(e,t){var n=this;return this.docPromise.then((function(r){var o=n.getPageById(e);return o.parsedPage().then((function(e){var i=o.index,a=r.MovePageTo(e,t);if(a){var s=void 0,u=void 0,c=void 0;i<t?(s=i,u=t,c=!1):(s=t,u=i,c=!0),n.updatePageIndex(s,u,c,!0)}return a}))}))},PDFDoc.prototype.insertPage=function(e,t,n){var r=this;return this.docPromise.then((function(o){var i=o.InsertPage(e,t,n);if(!i)return!1;var a=i.GetIndex(),s=void 0,u=s=new _PDFPage2.default(a,r);s.page=i;var c=o.GetPageCount()-1;return r.updatePageIndex(a+1,c,!0,!1),r.updatePageIndexMap(a,u),r.updatePageCache(s),s.toJson()}))},PDFDoc.prototype.removePage=function(e){var t=this,n=this,r=this.touchup;return this.JR.asyncOperation((function(){return t.doc.RemovePage(e)})).then((function(t){if(t){if(r&&delete r.editPages[e],n.pageIndexMap[e]){var o=n.pageIndexMap[e];delete n.pageIndexMap[e],delete n.pageIndexPromise[e],delete n.pageCache[o.id]}var i=n.doc.GetPageCount()-1;n.updatePageIndex(e,i)}return t}))},PDFDoc.prototype.showNameTreePageAtTheEnd=function(){var e=this;return this.docPromise.then((function(t){var n=t.GetPageCount()-1,r=t.GetPage(n),o=new _PDFPage2.default(n,e);return o.page=r,e.updatePageIndexMap(n,o),e.updatePageCache(o),o.toJson()}))},PDFDoc.prototype.hideNameTreePage=function(e){if(this.pageIndexMap[e]){var t=this.pageIndexMap[e];delete this.pageIndexMap[e],delete this.pageIndexPromise[e],delete this.pageCache[t.id]}var n=this.doc.GetPageCount()-1;return this.updatePageIndex(e,n),!0},PDFDoc.prototype.updatePageIndex=function(e,t,n,r){if(r)if(n){var o=this.pageIndexMap[t];delete this.pageIndexMap[t],this.updatePageIndex(e+1,t,n,!1),o&&(this.pageIndexMap[e]=o,this.pageIndexMap[e].index=e)}else{var i=this.pageIndexMap[e];delete this.pageIndexMap[e],this.updatePageIndex(e,t-1,n,!1),i&&(this.pageIndexMap[t]=i,this.pageIndexMap[t].index=t)}else if(n)for(var a=t;a>=e;a--)this.pageIndexMap[a-1]&&(this.pageIndexMap[a]=this.pageIndexMap[a-1],delete this.pageIndexMap[a-1],delete this.pageIndexPromise[a-1],this.pageIndexMap[a].index=a);else for(var s=e;s<=t;s++)this.pageIndexMap[s+1]&&(this.pageIndexMap[s]=this.pageIndexMap[s+1],delete this.pageIndexMap[s+1],delete this.pageIndexPromise[s+1],this.pageIndexMap[s].index=s)},PDFDoc.prototype.destroy=function(){var e=this;this.beforeSaveHooks=[];var t=this.pageCache,n=[];for(var r in t)n.push(t[r].destroy()),delete t[r];this.destroyHooks.forEach((function(e){return e()})),this.form&&this.form.destroy(),this.form=null,this.attachments=null,this.asyncBlock&&this.asyncBlock.destroy(),this.password=null,this.stdCipherOptions=null,this.passwordType=null;var o=this.doc;try{o.ClearRenderCache()}catch(e){}this.JR.unRegisterSecurityCallback("FOPN_foweb"),this.destroyCallback(),this.docPromise=null,this.docDeferred.promise=null,this.readerCallback&&this.readerCallback.delete(),this.readerCallback=null,this.otherData=null;var i=this.rootBookmark;i&&i.destroy(),this.rootBookmark=null,this.buffer&&this.engine._free(this.buffer),this.buffer=null,this.getBuffer=null;var a=Promise.all(n).then((function(t){e.doc=null;var n=e.doc;n&&n.delete()}));return this.destroyHooks=[],(0,_constantsString.cleanString)(),a},PDFDoc.prototype.destroyPage=function(e){var t=this.getPageById(e);t&&(t.destroy(),delete this.pageCache[e])},PDFDoc.prototype.getInfos=function(){return{fileSize:this.doc.GetFileSize()}},PDFDoc.prototype.toJson=function(){var e=this.doc,t=this.engine;e.GetPage(0);var n=e.GetPageCount(),r=e.GetFileSize(),o=void 0,i=this.doc.GetOpenAction();i.IsEmpty()||(o=(i=this.JR.actionManager.get(i,this.doc,this.JR)).toJson());var a=[],s=e.GetTrailer();if(s){var u=(0,_constantsString.CString)(t,"ID"),c=s.GetElement(u);if(c)for(var d=c.GetArray(),l=0;l<2;l++){for(var f=d.GetElement(l).GetString().GetBuffer(),h="",p=0;p<16;p++){var m=this.engine.HEAP8[f+p]>>>0&255;(m=m.toString(16)).length<2&&(m="0"+m),h+=m}a.push(h)}}var g=e.GetUserPermissions(),y=!0,_=t.PasswordType.e_PwdNoPassword;try{var v=e.GetSecurityHandler();if(v.IsEmpty())y=!0;else{var b=t.EncryptType;switch(v.GetSecurityType()){case b.e_EncryptNone:y=!0;break;case b.e_EncryptPassword:y=(_=e.GetPasswordType())==t.PasswordType.e_PwdOwner;break;case b.e_EncryptFoxitDRM:case b.e_EncryptCDRM:y=e.GetDRMEncryptData().is_owner;break;case b.e_EncryptCertificate:y=!!(2&g);break;case b.e_EncryptCustom:case b.e_EncryptRMS:case b.e_EncryptUnknown:default:y=!0}}}catch(e){y=!1}var S=e.IsXFA()?1:0,w={};1==S&&!e.IsStaticXFA()?S=2:w=this.getNameTree(2);var M=[],D=e.GetCatalog(),P=(0,_constantsString.CString)(t,"Names"),T=(0,_constantsString.CString)(t,"AP"),k=D.GetElement(P),A=(k=D.GetElement(P)&&D.GetElement(P).GetDict())&&k.GetElement(T);if(A&&A.GetDirectObject()){var L=A.GetDirectObject().GetDict().GetElement(P);if(L)for(var F=L.GetArray(),I=F.GetElementCount(),x=0;x<I;x+=2){var C=void 0,R=F.GetElement(x).GetString();try{C=R.toString()}catch(e){for(var O="",G=R.GetBuffer(),E=0,Y=R.GetLength();E<Y;E++){var j=this.engine.HEAP8[G+E]>>>0&255;O+=String.fromCharCode(j)}C=this.JR.pdfNameDecoding(O)}var N=F.GetElement(x+1).GetDirectObject();N&&M.push({name:C,objNum:N.GetObjNum()})}}var B=!1,H=e.GetCatalog(),W=(0,_constantsString.CString)(t,"AcroForm");if(H.HasKey(W)){var U=H.GetElement(W).GetDirectObject();if(U.GetType()==t.PDFObjectType.e_Dictionary){var z=U.GetDict(),J=(0,_constantsString.CString)(t,"SigFlags");if(z.HasKey(J)){var V=z.GetElement(J).GetInteger();(1&V||2&V)&&(B=!0)}}}var K=[];if(B)for(var q=e.GetSignatureCount(),Z=0;Z<q;Z++){var X=e.GetSignature(Z);if(X.IsSigned()){y=!1;var Q=4294963392;switch(X.GetDocPermission().value){case 0:Q=4294967292;break;case 1:Q=4294965972;break;case 2:Q=4294966740;break;case 3:Q=4294966772}K.push(Q)}}8&g&&(g=(1024|g)>>>0),this.isOwner=y;var $=this.isCompareDoc(),ee=getMetadataValues(new t.Metadata(this.doc),(0,_constantsString.CWString)(t,"pdfaid"));return{curFileSymbolId:this.curFileId,id:this.id,fileSize:r,sigPerms:K,fileID:a,pageCount:n,userPermissions:g,oriPerm:e.GetUserPermissions(),action:o,jsNameTree:w,isOwner:y,passwordType:_.value,icons:M,isTagged:e.IsTaggedPDF(),isPortfolio:e.IsPortfolio(),isCompareDoc:$,pdfaid:ee,fileType:S}},PDFDoc.prototype.getStream=function(e,t){var n=e.writeStream;this.beforeSaveHooks.forEach((function(e){return e()}));var r=this.engine;return this.docPromise.then((function(e){var o=0,i=(0,_createDeferred2.default)(),a=r.WriterCallback.implement({Release:function(){a.delete()},Flush:function(){return i.resolve(o),!0},GetSize:function(){return o},WriteBlock:function(e,t,i){o=Math.max(t+i,o);var a=r.HEAPU8.buffer,s=void 0;return s=a.slice?a.slice(e,e+i):new Uint8Array(a,e,i).buffer,n(s,t,i),!0}});return r.saveDoc(e,a,t),i.promise}))},PDFDoc.prototype.importFromFDF=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;r||(r=(0,_createDeferred2.default)());var o=new this.engine.Range(0,this.doc.GetPageCount()-1,this.engine.RangeFilter.e_All);try{var i=this.doc.ImportFromFDF(e,n,o);r.resolve(i)}catch(o){if(17==(o=this.engine.getErrorCode(o)).value)return void setTimeout((function(){t.importFromFDF(e,n,r)}),200);console.warn(o)}finally{o.delete(),o=null,logger.info("ImportFromFDF","finally")}return r.promise},PDFDoc.prototype.getBookmarks=function(){var e=this;return this.docPromise.then((function(t){var n=(0,_createDeferred2.default)();if(e.rootBookmark)return n.resolve(e.rootBookmark.toJson()),n.promise;var r=t.GetRootBookmark(),o=void 0;if(r.IsEmpty())o=null;else{var i=new _PDFBookmark2.default(e,r.GetDict().GetObjNum(),r,t);o=i.toJson(),e.rootBookmark=i}return n.resolve(o),n.promise}))},PDFDoc.prototype.getBlankPageIndexes=function(){return this.docPromise.then((function(e){for(var t=e.GetBlankPageIndexes(),n=[],r=t.GetSize();r--;)n[r]=t.GetAt(r);return n}))},PDFDoc.prototype.createRootBookmark=function(){var e=this;return this.docPromise.then((function(t){if(!e.rootBookmark){var n=t.CreateRootBookmark(),r=new _PDFBookmark2.default(e,n.GetDict().GetObjNum(),n,t);e.rootBookmark=r}return e.rootBookmark.toJson()}))},PDFDoc.prototype.addBookmarksFromStructureRoles=function(e,t){var n=this;return this.docPromise.then((function(r){var o=r.GetRootBookmark();!0===o.IsEmpty()&&(o=r.CreateRootBookmark());var i=(0,_constantsString.CWString)(n.engine,t),a=o.Insert(i,n.engine.BookmarkPosition.e_PosLastChild),s=new n.engine.WStringArray,u=!0,c=!1,d=void 0;try{for(var l,f=e[Symbol.iterator]();!(u=(l=f.next()).done);u=!0){var h=l.value;s.Add((0,_constantsString.CWString)(n.engine,h))}}catch(e){c=!0,d=e}finally{try{!u&&f.return&&f.return()}finally{if(c)throw d}}return a.AddBookmarksFromStructureRoles(s,null),a.GetDict().GetObjNum()}))},PDFDoc.prototype.insertBookmark=function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=arguments[5],a=this,s=a.rootBookmark.getBookmarkById(e),u=s.insert(t,n,{top:r,left:o},i),c=u.toJson();return c},PDFDoc.prototype.setBookmarkProperty=function(e,t){var n=this.rootBookmark.getBookmarkById(e);return n.setProperty(t),n.toJson()},PDFDoc.prototype.removeBookmark=function(e){var t=void 0;return this.rootBookmark.id==e?(t=this.rootBookmark,this.rootBookmark=null):t=this.rootBookmark.removeChild(e),t.remove()},PDFDoc.prototype.getLayerNodes=function(){var e=this.engine,t=this;return this.docPromise.then((function(n){var r=(0,_createDeferred2.default)(),o=new _PDFLayer2.default(n,e);t.pdfLayer=o;var i=o.toJson();return r.resolve(i),r.promise}))},PDFDoc.prototype.createLayerNodes=function(e){return new _PDFLayer2.default(this.doc,this.engine,e)},PDFDoc.prototype.getRedaction=function(){var e=this.engine,t=this;return this.docPromise.then((function(n){if(!e.Library.HasModuleLicenseRight({value:3}))return Promise.reject(_errorCode.error.noRedactionLicense);if(!t.c_redaction)try{t.c_redaction=new e.Redaction(n)}catch(t){isNaN(t)||(t=e.getErrorCode(t)),console.warn(t)}return t.c_redaction}))},PDFDoc.prototype.applyRedaction=function(){for(var e=this,t={},n={},r=[],o=0;o<this.doc.GetPageCount();o++)r.push(this.getPageByIndex(o).then((function(e){return n[e.index]=e,e.getAnnots()})));return Promise.all(r).then((function(n){var r=function(r){var o=e.pageCache[r];t[o.index]||(t[o.index]={}),n[o.index].forEach((function(e){var n=e.annot.GetDict().GetObjNum();n&&(t[o.index][n]=e)}))};for(var o in e.pageCache)r(o);return e.getRedaction().then((function(t){var n=[];if(!t.Apply())return!1;for(var r in e.pageCache){var o=e.pageCache[r];n.push(o.update())}return Promise.all(n)})).then((function(e){for(var n=[],r=0;r<e.length;r++){var o=e[r],i=o.index,a=t[i],s=[];for(var u in a){var c=a[u];(-1===o.annotIds.indexOf(u)||c.annot.IsEmpty())&&s.push(u)}n.push({pageIndex:i,removedAnnotIds:s})}return n})).catch((function(t){return-6===t.error||isNaN(t)||(t=e.engine.getErrorCode(t)),Promise.reject(t)}))}))},PDFDoc.prototype.exportToFDF=function(e,t,n){var r=this,o=this.engine,i=new o.FDFDoc(e);if(0==Object.keys(n).length){var a=new o.Range(0,this.doc.GetPageCount(),o.RangeFilter.e_All);this.doc.ExportToFDF(i,t,a),a.delete(),a=null}else{var s=function(e){var t=r.getPageById(e);if(!t)throw new Error("page not loaded: "+e);n[e].forEach((function(e){var n=t._getAnnotIndexById(e),o=t.page.GetAnnot(n);r.doc.ExportAnnotToFDF(o,i)}))};for(var u in n)s(u)}var c=0,d=[],l=o.WriterCallback.implement({Release:function(){i.delete()},Flush:function(){return!0},GetSize:function(){return c},WriteBlock:function(e,t,n){c+=n;var r=o.HEAPU8.buffer,i=void 0;return i=r.slice?r.slice(e,e+n):new Uint8Array(r,e,n).buffer,d.push(i),!0}});return i.SaveAs(l),new Blob(d,{type:["application/vnd.adobe.fdf","application/vnd.xfdf"][e]})},PDFDoc.prototype.exportToStardardXml=function(e,t){var n=this,r=this.engine,o=this.doc,i=null,a=void 0,s=r.ExportToImageCallback.implement({Release:noop,GetPDFProducer:function(){return new r.WString("")},GetPDFDocAuthor:function(){return new r.WString("")},GetStreamCallbackForImage:function(e){var n=e.toString();return-1!=n.indexOf("\\")&&(n=n.replace("\\","/")),0==n.indexOf("/")&&(n=n.substr(1,n.length-1)),i&&i.byteLength>0&&t({fileName:n,imgBuffer:i,percent:a?a.GetRateOfProgress():0}),i=new ArrayBuffer,r.StreamCallback.implement({Release:function(){},Flush:function(){return!0},GetSize:function(){return i.byteLength},ReadBlock:function(e,t,n){if(i&&i.byteLength>0){var o=new Uint8Array(i,t,n);return r.HEAPU8.set(o,e),!0}return!1},WriteBlock:function(e,t,n){if(i.byteLength<t+n){var o=i;if(i=new ArrayBuffer(t+n),0!==o.byteLength){var a=new Uint8Array(o);new Uint8Array(i).set(a)}}var s=new Uint8Array(i,t,n),u=r.HEAPU8.subarray(e,e+n);return s.set(u),!0}})}}),u=0,c=[],d=r.WriterCallback.implement({Release:noop,Flush:function(){return!0},GetSize:function(){return u},WriteBlock:function(e,t,n){u+=n;var o=r.HEAPU8.buffer,i=void 0;return i=o.slice?o.slice(e,e+n):new Uint8Array(o,e,n).buffer,c.push(i),!0}}),l=new r.WString(e),f=new r.WString(e),h=r.PauseCallback.implement({NeedToPauseNow:function(){return!0}});a=o.StartExportToXML(d,f,l,s,h),t({percent:a.GetRateOfProgress()}),continueExport={exportImageCallback:s,pauseCallback:h};var p=r.ProgressiveState.e_ToBeContinued;setTimeout((function o(){continueExport&&p===r.ProgressiveState.e_ToBeContinued?(p=a.Continue(),setTimeout(o,0)):(t({imgBuffer:i,xmlBuffer:c,fileName:e,percent:100}),n.cancelExport())}),0)},PDFDoc.prototype.exportToTxt=function(e,t,n){var r=this,o=this.engine,i=new o.Range;if(t&&t.string){var a=t.string,s=t.filter;a.split(",").filter((function(e){return!!e})).forEach((function(e){if(e.indexOf("-")>=0){var t=e.split("-"),n=_slicedToArray(t,2),r=n[0],a=n[1];i.AddSegment(Number(r)-1,Number(a)-1,{all:o.RangeFilter.e_All,even:o.RangeFilter.e_Odd,odd:o.RangeFilter.e_Even}[s])}else i.AddSingle(Number(e)-1)}))}var u=new o.ExportProvider,c=void 0,d=0,l=[],f=o.StreamCallback.implement({Release:function(){f.delete()},Flush:function(){return!0},GetSize:function(){return d},ReadBlock:function(){return!0},WriteBlock:function(e,t,n){d+=n;var r=o.HEAPU8.buffer,i=void 0;return i=r.slice?r.slice(e,e+n):new Uint8Array(r,e,n).buffer,l.push(i),!0}});"convert-pdf-to-accessible-txt"===e?(c=o.ExportAccessibilityTextCallback.implement({Release:function(){},GetEntryKey:function(){return new o.WString("")},GetTxtFileStream:function(){return f}}),u.SetExportAccessibilityTextCallback(c)):(c=o.ExportTextCallback.implement({Release:function(){},GetTxtFileStream:function(){return f}}),u.SetExportTextCallback(c));var h=o.PauseCallback.implement({NeedToPauseNow:function(){return!0}}),p=new o.ExportMgr(u,this.doc),m=p.StartExportPDFToText(i,h);continueExport={range:i,exportTextCallback:c,pauseCallback:h,exportProvider:u,exportMgr:p};var g=o.ProgressiveState.e_ToBeContinued;setTimeout((function e(){continueExport&&g===o.ProgressiveState.e_ToBeContinued?(g=m.Continue(),n({percent:m.GetRateOfProgress()}),setTimeout(e,0)):(n({buffer:l,percent:100}),r.cancelExport())}),0)},PDFDoc.prototype.generateImageExportSetting=function(e,t,n){var r=null,o=function(e){if(!(["png","jpeg","jpeg2000","tiff","bmp"].indexOf(t.format)<0)){e.SetImageColorSpace({value:t.imageColorSpace});var n=[0,72,96,150,300,600,1200,2400].indexOf(t.imageResolution);n>=0?e.SetImageResolution({value:n}):(e.SetImageResolution({value:-1}),e.SetCustomResolution(t.imageResolution)),"tiff"===t.format&&e.SetImageConvertType({value:t.imageConvertType})}};switch(t.format){case"png":(r=new e.PNGExportSetting).SetInterlace({value:t.pngInterlace}),o(r);break;case"jpeg":case"jpeg2000":(r=new e.JPEGExportSetting("jpeg2000"===t.format)).SetImageGrayscaleQuality({value:t.imageGrayscaleQuality}),r.SetImageColorQuality({value:t.imageColorQuality}),"jpeg2000"===t.format&&r.SetImageTile(t.imageTile),o(r);break;case"tiff":(r=new e.TIFFExportSetting).SetMonochromeCompressType({value:t.monochromeCompressType}),r.SetGrayscaleCompressType({value:t.grayscaleCompressType}),r.SetColorCompressType({value:t.colorCompressType}),o(r);break;case"bmp":o(r=new e.BMPExportSetting)}if(r){if(n)return r.SetImageSettingType(e.ImageSettingType.e_PageToImage),r;switch(t.type){case"pageToImage":r.SetImageSettingType(e.ImageSettingType.e_PageToImage);break;case"imageObjsOfPage":r.SetImageSettingType(e.ImageSettingType.e_ImageObjsOfPage),r.SetImageMinInch({value:t.imageMinInch})}return r}},PDFDoc.prototype.exportToImage=function(e,t,n,r){var o=this,i=this.engine,a=this.generateImageExportSetting(i,e),s=new i.Range;if(n&&n.string){var u=n.string,c=n.filter;u.split(",").filter((function(e){return!!e})).forEach((function(e){if(e.indexOf("-")>=0){var t=e.split("-"),n=_slicedToArray(t,2),r=n[0],o=n[1];s.AddSegment(Number(r)-1,Number(o)-1,{all:i.RangeFilter.e_All,even:i.RangeFilter.e_Odd,odd:i.RangeFilter.e_Even}[c])}else s.AddSingle(Number(e)-1)}))}var d=null,l=null,f=i.ExportImageCallback.implement({Release:function(){},GetDeviceCapsX:function(){return e.dpi&&e.dpi.x||96},GetDeviceCapsY:function(){return e.dpi&&e.dpi.y||96},CallBackError:function(){return!0},GetImageFileStream:function(e,n){d&&d.byteLength>0&&r({fileName:l,buffer:d,percent:g?g.GetRateOfProgress():0}),d=new ArrayBuffer;var o=t.lastIndexOf("."),a=t.substr(0,o),s=t.substr(o);return l=n<=0?a+"_Page"+e.toString()+s:a+"_Page"+e.toString()+"_Image"+n.toString()+s,i.StreamCallback.implement({Release:function(){},Flush:function(){return!0},GetSize:function(){return d.byteLength},ReadBlock:function(e,t,n){if(d&&d.byteLength>0){var r=new Uint8Array(d,t,n);return i.HEAPU8.set(r,e),!0}return!1},WriteBlock:function(e,t,n){if(d.byteLength<t+n){var r=d;if(d=new ArrayBuffer(t+n),0!==r.byteLength){var o=new Uint8Array(r);new Uint8Array(d).set(o)}}var a=new Uint8Array(d,t,n),s=i.HEAPU8.subarray(e,e+n);return a.set(s),!0}})}}),h=i.PauseCallback.implement({NeedToPauseNow:function(){return!0}}),p=new i.ExportProvider;p.SetExportImageCallback(f);var m=new i.ExportMgr(p,this.doc),g=m.StartExportPDFToImage(a,s,h);r({percent:g.GetRateOfProgress()}),continueExport={imageExportSetting:a,engineRange:s,exportImageCallback:f,pauseCallback:h,exportProvider:p,exportMgr:m};var y=i.ProgressiveState.e_ToBeContinued;setTimeout((function e(){continueExport&&y===i.ProgressiveState.e_ToBeContinued?(y=g.Continue(),setTimeout(e,0)):(r({buffer:d,fileName:l,percent:100}),o.cancelExport())}),0)},PDFDoc.prototype.exportImageObjectToImage=(_ref13=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n,r,o){var i,a,s,u,c,d,l,f,h,p,m,g,y,_,v=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this.engine,a=this.generateImageExportSetting(i,n,t),s=this.doc.GetPage(t.index),u=new _PDFPage2.default(t.index,this),e.next=6,u.getGraphicsObjectAtPoint(t.selectPosition,0,3);case 6:c=e.sent,d=c.graphicsObject,l=null,f=i.ExportImageCallback.implement({Release:function(){},GetDeviceCapsX:function(){return n.dpi&&n.dpi.x||96},GetDeviceCapsY:function(){return n.dpi&&n.dpi.y||96},CallBackError:function(){return!0},GetImageFileStream:function(){l&&l.byteLength>0&&o({fileName:r,buffer:l,percent:g?g.GetRateOfProgress():0}),l=new ArrayBuffer;var e=i.StreamCallback.implement({Release:function(){e.delete()},Flush:function(){return!0},GetSize:function(){return l.byteLength},ReadBlock:function(e,t,n){if(l&&l.byteLength>0){var r=new Uint8Array(l,t,n);return i.HEAPU8.set(r,e),!0}return!1},WriteBlock:function(e,t,n){if(l.byteLength<t+n){var r=l;if(l=new ArrayBuffer(t+n),0!==r.byteLength){var o=new Uint8Array(r);new Uint8Array(l).set(o)}}var a=new Uint8Array(l,t,n),s=i.HEAPU8.subarray(e,e+n);return a.set(s),!0}});return e}}),h=i.PauseCallback.implement({NeedToPauseNow:function(){return!0}}),(p=new i.ExportProvider).SetExportImageCallback(f),m=new i.ExportMgr(p,this.doc),g=m.StartExportImageObjToImage(d,s,a,h),o({percent:g.GetRateOfProgress()}),continueExport={imageExportSetting:a,exportImageCallback:f,pauseCallback:h,exportProvider:p,exportMgr:m},y=i.ProgressiveState.e_ToBeContinued,_=function e(){continueExport&&y===i.ProgressiveState.e_ToBeContinued?(y=g.Continue(),setTimeout(e,0)):(o({buffer:l,fileName:r,percent:100}),v.cancelExport())},setTimeout(_,0);case 20:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return _ref13.apply(this,arguments)}),PDFDoc.prototype.cancelExport=function(){if(continueExport){for(var e in continueExport)continueExport[e]=null;continueExport=null}},PDFDoc.prototype.loadForm=function(){if(this.form)return this.form;var e=this.engine,t=new e.Form(this.doc);return this.form=new _Form2.default(this,t,e,this.JR),this.form},PDFDoc.prototype.setOpenAction=function(e,t){var n=this.JR.actionManager.create(this.doc,e);return this.doc.SetOpenAction(n),(n=this.JR.actionManager.get(n,this.doc,this.JR)).create(t),n.toJson()},PDFDoc.prototype.getSecurityType=function(){return this.doc.GetSecurityHandler().GetSecurityType().value},PDFDoc.prototype.setCertificateAndPermission=function(e,t,n){var r=this.engine,o=new FileReaderSync,i=new r.EnvelopeArray;e.forEach((function(e){var t=e.cerFile,n=e.permission,a=o.readAsArrayBuffer(t),s=r.StreamCallback.implement({GetSize:function(){return a.byteLength},GetPosition:function(){return 0},ReadBlock:function(e,t,n){var o=new Uint8Array(a,t,n);return r.HEAPU8.set(o,e),!0}}),u=null;if(n){var c=n.print,d=n.change,l=n.accessibility,f=n.copy;(u=new r.CertPermission).bEnableCopy=f,u.bEnableTextAccess=l,u.printPer={value:c},u.changePer={value:d}}var h=new r.Envelope(s,u);i.Add(h)}));var a=r.CipherType.e_CipherNone;t===_cipherType2.default.AES128||t===_cipherType2.default.AES256?a=r.CipherType.e_CipherAES:t===_cipherType2.default.RC4&&(a=r.CipherType.e_CipherRC4);var s=new r.CertificateSecurityHandler;return s.Initialize(i,a,n),this.doc.SetSecurityHandler(s),!0},PDFDoc.prototype.setPasswordAndPermission=function(e,t,n,r,o){var i=this,a=this.engine;return this.docPromise.then((function(s){var u=void 0,c=void 0;if(r==_cipherType2.default.None)u=a.CipherType.e_CipherNone,c=0;else if(r==_cipherType2.default.RC4)u=a.CipherType.e_CipherRC4,c=16;else if(r==_cipherType2.default.AES128)u=a.CipherType.e_CipherAES,c=16;else{if(r!=_cipherType2.default.AES256)throw new Error("cipher error");u=a.CipherType.e_CipherAES,c=32}var d=s.GetEncryptionType(),l=s.GetSecurityHandler(),f=l.GetSecurityType(),h=void 0,p=void 0;try{d!==a.EncryptType.e_EncryptNone&&1===f.value?((p=s.GetStdEncryptData()).cipher=u,p.is_encrypt_metadata=o,p.key_length=c,p.user_permissions=n,h=new a.StdSecurityHandler(l)):(p=new a.StdEncryptData(o,n,u,c),h=new a.StdSecurityHandler)}catch(e){p=new a.StdEncryptData(o,n,u,c),h=new a.StdSecurityHandler}if(r==_cipherType2.default.AES256){var m=void 0,g=void 0;h.SetAES256ModifyFlags(7),-1===e?(m=new a.WString(""),g=new a.WString(t),h.InitializeW(p,m,g)):(m=new a.WString(e),g=new a.WString(t),h.InitializeW(p,m,g)),m.delete(),g.delete()}else{var y=void 0,_=void 0;y=new a.String(-1===e?"":e),_=new a.String(t),h.Initialize(p,y,_),y.delete(),_.delete()}var v=s.SetSecurityHandler(h);return v&&(i.stdCipherOptions={isEncryptMetadata:o,permission:n,cipherType:r}),p.delete(),h.delete(),v}))},PDFDoc.prototype.removeSecurity=function(){var e=this;return this.docPromise.then((function(t){return e.registerDRMSecurityCallback=!1,t.RemoveSecurity()}))},PDFDoc.prototype.checkPassword=function(e){var t=this,n=this.engine;return this.docPromise.then((function(r){var o=new n.String(e),i=r.CheckPassword(o);return o.delete(),t.isOwner=3==i.value,i.value}))},PDFDoc.prototype.getStdCipherOptions=function(){var e=this;return this.docPromise.then((function(t){if(e.stdCipherOptions)return e.stdCipherOptions;var n={},r=t.GetSecurityHandler();if(!r||r.IsEmpty())return n;if(1==r.GetSecurityType().value){var o=t.GetStdEncryptData();n.isEncryptMetadata=o.is_encrypt_metadata,n.permission=o.user_permissions,0===o.cipher.value?n.cipherType=_cipherType2.default.None:1===o.cipher.value?n.cipherType=_cipherType2.default.RC4:2===o.cipher.value&&(16===o.key_length?n.cipherType=_cipherType2.default.AES128:n.cipherType=_cipherType2.default.AES256)}return n}))},PDFDoc.prototype.getUserPassword=function(e){var t=this,n=this.engine,r=void 0;return this.docPromise.then((function(e){return r=e,t.getStdCipherOptions()})).then((function(o){if(o.cipherType===_cipherType2.default.AES256)return t.password||"";var i=new n.String(e),a=void 0;try{a=r.GetUserPassword(i).toString()}catch(e){a=t.password||""}return i.delete(),a}))},PDFDoc.prototype.getFileVersion=function(){return this.docPromise.then((function(e){return e.GetFileVersion()}))},PDFDoc.prototype.setRenderFlag=function(e){this.renderFlags=e},PDFDoc.prototype.getRenderFlags=function(){return this.renderFlags},PDFDoc.prototype.drmEncrypt=function(e){var t=this.engine;return this.docPromise.then((function(e){var n=e.GetSecurityHandler();if(n&&!n.IsEmpty()){var r=n.GetSecurityType();if(r!==t.EncryptType.e_EncryptUnknown&&r!==t.EncryptType.e_EncryptNone){var o=new Error("This document has been encrypted and cannot be encrypted again!");return o.error=-1,Promise.reject(o)}}return e})).then((function(n){var r=new t.String(e.subFilter),o=new t.DRMEncryptData(e.isEncryptMetadata,r,t.CipherType.values[e.cipher],e.keyLength,e.isOwner,e.userPermissions);r.delete();var i=new t.DRMSecurityHandler;if(e.values){var a=e.values;for(var s in a){var u=new t.String(s),c=new t.WString(a[s]);i.SetDRMValue(u,c)}}if(i.Initialize(o,new t.String(e.fileId),new t.String(e.initialKey)))return o.delete(),[n,i];o.delete();var d=new Error("Document encryption failed!");return d.error=2,Promise.reject(d)})).then((function(e){var t=_slicedToArray(e,2),n=t[0],r=t[1];return n.SetSecurityHandler(r)}))},PDFDoc.prototype.getTemplates=function(){var e=this.doc.GetCatalog();if(!e)return null;var t=this.engine,n=(0,_constantsString.CString)(t,"Names"),r=e.GetElement(n);if(!r)return null;var o=r.GetDict();if(!o)return null;var i=new Array,a=o.GetElement((0,_constantsString.CString)(t,"Templates"));if(a){var s=a.GetDict();if(s){var u=s.GetElement(n);if(u){var c=u.GetArray();if(c)for(var d=c.GetElementCount(),l=0;l<d;l+=2){var f=c.GetElement(l).GetString(),h=this.JR.getPDFString(f);if(h&&""!==h&&l+1<d){var p=c.GetElement(l+1);p.GetType()===this.engine.PDFObjectType.e_Reference&&(p=p.GetDirectObject());var m={name:h,objNum:p.GetObjNum()};i.push(m)}}}}}var g=[],y=o.GetElement((0,_constantsString.CString)(t,"Pages"));if(y){var _=y.GetDict();if(_){var v=_.GetElement(n);if(v){var b=v.GetArray();if(b)for(var S=b.GetElementCount(),w=0;w<S;w+=2){var M=b.GetElement(w).GetString(),D=this.JR.getPDFString(M);if(D&&""!==D&&w+1<S){var P=b.GetElement(w+1);P.GetType()===this.engine.PDFObjectType.e_Reference&&(P=P.GetDirectObject());var T={name:D,objNum:P.GetObjNum()};g.push(T)}}}}}return{visibleArr:g,invisibleArr:i}},PDFDoc.prototype.removeTemplate=function(e){var t=this.doc.GetCatalog();if(!t)return!0;var n=this.engine,r=(0,_constantsString.CString)(n,"Names"),o=t.GetElement(r);if(!o)return!0;var i=o.GetDict();if(!i)return!0;var a=i.GetElement((0,_constantsString.CString)(n,"Templates")),s=a?a.GetDict():null;if(s){var u=s.GetElement(r);if(u){var c=u.GetArray();if(c)for(var d=c.GetElementCount(),l=0;l<d;l+=2){var f=c.GetElement(l).GetString().toString();if(f&&""!==f&&f===e&&l+1<d){c.RemoveAt(l),c.RemoveAt(l);break}}}}var h=i.GetElement((0,_constantsString.CString)(n,"Pages")),p=h?h.GetDict():null;if(p){var m=p.GetElement(r);if(m){var g=m.GetArray();if(g)for(var y=g.GetElementCount(),_=0;_<y;_+=2){var v=g.GetElement(_).GetString().toString();if(v&&""!==v&&v===e&&_+1<y){g.RemoveAt(_),g.RemoveAt(_);break}}}}return!0},PDFDoc.prototype.hideTemplate=function(e,t){var n=this.doc.GetCatalog();if(!n)return!1;var r=this.engine,o=(0,_constantsString.CString)("Names"),i=n.GetElement((0,_constantsString.CString)(r,"Names"));if(!i)return!1;var a=i.GetDict();if(!a)return!1;var s=(0,_constantsString.CString)(r,"Templates"),u=a.GetElement(s),c=u?u.GetDict():null;c||(c=this.engine.PDFDictionary.Create(),a.SetAtReference(s,c,this.doc));var d=c.GetElement(o);d||(d=this.engine.PDFArray.Create(),c.SetAt(o,d));var l=d.GetArray(),f=(0,_constantsString.CString)(r,"Pages"),h=a.GetElement(f),p=h?h.GetDict():null;p||(p=this.engine.PDFDictionary.Create(),a.SetAtReference(f,p,this.doc));var m=p.GetElement(o);m||(m=this.engine.PDFArray.Create(),p.SetAt(o,m));var g=m.GetArray(),y=g,_=l,v="Page";t&&(y=l,_=g,v="Template");var b=new this.engine.WString(e.name);y.AddString(b),b.delete();var S=this.engine.PDFObject.CreateReference(this.doc,e.objNum);y.AddElement(S);for(var w=(0,_constantsString.CString)(r,"Type"),M=(0,_constantsString.CString)(r,v),D=_.GetElementCount(),P=0;P<D;P+=2){var T=_.GetElement(P).GetString().toString();if(T&&""!==T&&T===e.name&&P+1<D){var k=_.GetElement(P+1);if(k.GetType()===this.engine.PDFObjectType.e_Reference&&(k=k.GetDirectObject()),k.GetObjNum()===e.objNum){(k=k.GetDict()).SetAtName(w,M),_.RemoveAt(P),_.RemoveAt(P);break}}}},PDFDoc.prototype.spawnPage=function(e,t,n,r,o){var i=t.name,a=this.doc.GetPageCount();(-1===n||n>a)&&(n=a);var s=new this.engine.WString(i);if(this.doc.SpawnPage(s,n,r,o)){var u=void 0,c=u=new _PDFPage2.default(n,this);u.page=this.doc.GetPage(n);var d=this.doc.GetPageCount()-1;return this.updatePageIndex(n+1,d,!0,!1),this.updatePageIndexMap(n,c),this.updatePageCache(u),u.toJson()}},PDFDoc.prototype.hasForm=function(){try{var e=this.engine,t=(0,_constantsString.CString)(e,"AcroForm"),n=(0,_constantsString.CString)(e,"Fields");return this.doc.GetCatalog().GetElement(t).GetDict().GetElement(n).GetDirectObject().GetArray().GetElementCount()>0}catch(e){return!1}},PDFDoc.prototype.reloadPageAnnots=function(e){var t=this;e.forEach((function(e){t.pageIndexMap[e]&&t.pageIndexMap[e].reloadAnnots()}))},PDFDoc.prototype.getFontBufferByName=function(e){for(var t=this.doc.GetFontCount(),n=0;n<t;n++){var r=this.doc.GetFont(n);if(r.GetName().toString()==e)return _PDFFontMgr2.default.getWoffDataBuffer(r.GetWoffData(this.doc),this.engine)}},PDFDoc.prototype.getStructureRoles=(_ref18=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,n,r,o,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((t=this.doc).IsTaggedPDF()){e.next=4;break}return e.abrupt("return");case 4:for(n=[],r=t.GetStructureRoles(),o=r.GetSize(),i=0;i<o;i++)a=r["operator[]"](i).toString(),n.push(a);return e.abrupt("return",n);case 9:case"end":return e.stop()}}),e,this)}))),function(){return _ref18.apply(this,arguments)}),PDFDoc.prototype.getPageSizes=function(e,t){var n={},r=this.engine,o=this.doc,i=r.ErrorCode.e_ErrDataNotReady;function a(e,t){var n=(0,_createDeferred2.default)(),s=void 0;try{s=o.GetPage(t).IsEmpty()?{width:_VirtualJRPDFPage.VIRTUAL_PAGE_WIDTH,height:_VirtualJRPDFPage.VIRTUAL_PAGE_HEIGHT,rotation:{value:0}}:o.GetPageBasicInfo(t)}catch(o){var u=r.getErrorCode(o);if(u!==r.ErrorCode.e_ErrUnknown)return u!==i?(n.reject(u.value),n.promise):(setTimeout((function(){a(e,t).then(n.resolve,n.reject)}),30),n.promise);s={width:_VirtualJRPDFPage.VIRTUAL_PAGE_WIDTH,height:_VirtualJRPDFPage.VIRTUAL_PAGE_HEIGHT,rotation:{value:0}}}return e[t]={width:s.width,height:s.height,rotation:s.rotation.value},n.resolve(),n.promise}for(var s=[],u=e;u<e+t;u++)s.push(a(n,u));return Promise.all(s).then((function(){return n}))},PDFDoc.prototype._generateRange=function(e,t,n){var r=void 0,o=0;return e.forEach((function(e){if(1===e.length){var i=e[0];(0,_assertion.isInteger)(i)||(i=0),i<0?i=0:i>n-1&&(i=n-1),o++,r?r.AddSingle(i):r=new t.Range(i)}else if(2===e.length){var a=e[0];(0,_assertion.isInteger)(a)||(a=0),a<0?a=0:a>n-1&&(a=n-1);var s=e[1];(0,_assertion.isInteger)(s)||(s=0),s<0?s=0:s>n-1&&(s=n-1),a>s&&(a=+s,a-=s=a-s),r?a===s?(o++,r.AddSingle(a)):(o+=s-a+1,r.AddSegment(a,s,0)):a===s?(o++,r=new t.Range(a)):(o+=s-a+1,r=new t.Range(a,s,0))}})),{ranges:r,addCount:o}},PDFDoc.prototype.copyPages=function(e,t){var n=this,r=this.engine,o=this.doc,i=o.GetPageCount();(0,_assertion.isInteger)(t)||(t=0);var a=this._generateRange(e,r,i),s=a.ranges,u=a.addCount,c=[],d=new r.String(""),l=o.StartImportPages(t,o,0,d,s);d.delete();for(var f=[],h=0;h<u;h++)f.push(t+h);return 100===l.GetRateOfProgress()&&f.map((function(e){var t=o.GetPage(e),r=t.GetIndex(),i=void 0,a=i=new _PDFPage2.default(r,n);i.page=t,n.updatePageIndex(r+1,o.GetPageCount()-1,!0,!1),n.updatePageIndexMap(r,a),n.updatePageCache(i),c.push(i.toJson())})),s&&s.delete(),c},PDFDoc.prototype.saveCopyPagesData=function(e){for(var t=this.engine,n=this.doc,r=n.GetPageCount(),o=0,i=[],a=t.WriterCallback.implement({Release:noop,Flush:function(){return!0},GetSize:function(){return o},WriteBlock:function(e,n,r){o+=r;var a=t.HEAPU8.buffer,s=void 0;return s=a.slice?a.slice(e,e+r):new Uint8Array(a,e,r).buffer,i.push(s),!0}}),s=this._generateRange(e,t,r),u=s.ranges,c=(s.addCount,t.ExtractPagesOptions.e_ExtractPagesOptionAnnotation.value|t.ExtractPagesOptions.e_ExtractPagesOptionOCProperties.value),d=n.StartExtractPages(a,c,u,null),l=-1;100!==l;){if(-1===(l=d.GetRateOfProgress()))return;d.Continue()}for(var f=new Uint8Array(o),h=0,p=0,m=i.length;p<m;p++){var g=i[p];f.set(new Uint8Array(g),h),h+=g.byteLength}f=f.slice(0),getDB().set("COPY_PAGES_BUFFERS",f)},PDFDoc.prototype.pastePages=(_ref19=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var n,r,o,i,a,s,u,c,d,l,f=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.engine,e.next=3,getDB().get("COPY_PAGES_BUFFERS");case 3:if((r=e.sent).byteLength,o=new PDFDoc(this.JR,{buffer:r}),i=new n.String(""),o.doc.Load(i)===n.ErrorCode.e_ErrSuccess){e.next=9;break}throw"pastePages fail: source doc load error";case 9:for(a=new n.String(""),s=new n.Range,u=o.doc.GetPageCount(),c=0;c<u;c++)s.AddSingle(c);if(this.doc.StartImportPages(t,o.doc,0,a,s).GetErrorCode()!==n.ErrorCode.e_ErrFormat){e.next=16;break}throw"format error";case 16:return d=this.doc.GetPageCount()-1,l=Array.from(Array(u).keys(),(function(e){var n=e+t,r=new _PDFPage2.default(n,f);return r.page=f.doc.GetPage(n),f.updatePageIndex(n+1,d,!0,!1),f.updatePageIndexMap(n,r),f.updatePageCache(r),r.toJson()})),e.abrupt("return",l);case 19:case"end":return e.stop()}}),e,this)}))),function(e){return _ref19.apply(this,arguments)}),PDFDoc.prototype._renderThumbnailToBitmap=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=this.engine;e.IsParsed()||e.StartParse(0,null,!1);var r=(0,_browser.getDPI)(),o=r.x,i=r.y,a=76.5*o/72+.5>>0,s=99*i/72+.5>>0,u=new n.Bitmap(a,s,n.DIBFormat.e_DIBArgb,0,0),c=new n.Renderer(u,!1);c.SetRenderContentFlags(t);var d=e.GetDisplayMatrix(0,0,a,s,{value:0}),l=c.StartRender(e,d,null);return l.Continue(),c.delete(),u},PDFDoc.prototype._calcStep=function(e){var t=10;return e>1e3?t=e/100:e>100&&(t=e/10),t},PDFDoc.prototype.embedAllPageThumbnail=regeneratorRuntime.mark((function e(){var t,n,r,o,i,a,s,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._embedCancel=!1,t=this.doc,n=t.GetPageCount(),r=t.GetPage(0).LoadThumbnail(),o=r.IsEmpty(),i=this._calcStep(n),a=0,s=0;case 8:if(!(s<n)){e.next=22;break}if(!this._embedCancel){e.next=11;break}throw{msg:"cancel",status:o};case 11:if(u=t.GetPage(s),c=this._renderThumbnailToBitmap(u),u.SetThumbnail(c),c.delete(),!(a<=s+1||n===s+1)){e.next=19;break}return a+=i,e.next=19,(s+1)/n;case 19:s++,e.next=8;break;case 22:return e.abrupt("return",o);case 23:case"end":return e.stop()}}),e,this)})),PDFDoc.prototype.removeEmbeddedPageThumbnail=regeneratorRuntime.mark((function e(){var t,n,r,o,i,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._removeEmbeddedCancel=!1,t=this.doc,n=t.GetPageCount(),r=t.GetPage(0).LoadThumbnail(),o=r.IsEmpty(),i=this._calcStep(n),a=0,s=0;case 8:if(!(s<n)){e.next=20;break}if(!this._removeEmbeddedCancel){e.next=11;break}throw{msg:"cancel",status:!o};case 11:if(t.GetPage(s).RemoveThumbnail(),!(a<=s+1||n===s+1)){e.next=17;break}return a+=i,e.next=17,(s+1)/n;case 17:s++,e.next=8;break;case 20:return e.abrupt("return",!o);case 21:case"end":return e.stop()}}),e,this)})),PDFDoc.prototype.cancelEmbedAllPageThumbnail=function(){this._embedCancel=!0},PDFDoc.prototype.cancelRemoveEmbeddedPageThumbnail=function(){this._removeEmbeddedCancel=!0},PDFDoc.prototype._isFullPage=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,n=t.doc.GetPageCount();return e.length===n&&[].concat(_toConsumableArray(Array(n).keys())).every((function(t){return t===e[t]}))},PDFDoc.prototype.importPagesFromPDFDocs=(_ref20=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var n,r,o,i,a,s,u,c=this,d=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.engine,r=new n.String(l),o=d.reverse().reduce((function(e,o){var i=e.successfulCount,a=e.errs,s=o.srcDoc,u=o.srcPages,d=(s.oriFile?s.oriFile.name:void 0)||"temp.pdf",f=new n.Range,h=s.doc.GetPageCount();u.sort((function(e,t){return e>t?1:-1})),new Set(u).size!==h&&u.forEach((function(e){return f.AddSingle(e)}));var p=new n.LayerTree(s.doc),m=p.GetRootNode(),g=m.GetChildrenCount()>0;m.delete(),p.delete();for(var y=g&&l?n.ImportPageFlags.e_ImportFlagWithLayers.value:0,_=c.doc.StartImportPages(t,s.doc,y,r,f),v=-1;v<100;){if(-1===(v=_.GetRateOfProgress()))return{successfulCount:i,errs:[].concat(_toConsumableArray(a),[{name:d,err:"rate of progress is -1"}])};_.Continue()}return{successfulCount:i+u.length,errs:a}}),{successfulCount:0,errs:[]}),i=o.successfulCount,a=o.errs,r.delete(),s=Array.from(Array(i).keys()).map((function(e){return e+t})).map((function(e){var t=c.doc.GetPage(e),n=t.GetIndex(),r=new _PDFPage2.default(n,c);return r.page=t,c.updatePageIndex(n+1,c.doc.GetPageCount()-1,!0,!1),c.updatePageIndexMap(n,r),c.updatePageCache(r),r.toJson()})),e.next=7,this.getBookmarks();case 7:return u=e.sent,e.abrupt("return",{bookmarks:u,pagesJson:s,errs:a});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return _ref20.apply(this,arguments)}),PDFDoc.prototype.exportPagesToPDFDocs=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=this.engine,a=new i.String(r),s=new i.WString(o),u=this._isFullPage(e),c=null;u||(c=new i.Range,e.forEach((function(e){return c.AddSingle(e)})));var d=t.reverse().map((function(e){var t=e.destDoc,r=e.destIndex,o=t.oriFile?t.oriFile.name:"temp.pdf";if(u)try{return t.doc.InsertDocument(r,n.doc,i.InsertDocOptions.e_InsertDocOptionAttachments.value|i.InsertDocOptions.e_InsertDocOptionBookmark.value,s),{name:o,doc:t}}catch(e){return{name:o,err:e}}for(var d=t.doc.StartImportPages(r,n.doc,0,a,c),l=-1;l<100;){if(-1===(l=d.GetRateOfProgress()))return{name:o,err:"rate of progress is -1"};d.Continue()}return{name:o,doc:t}}));return a.delete(),s.delete(),d},PDFDoc.prototype.startImportPages=function(e,t){var n=t.size,r=t.getBuffer,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_consts.EMPTY_STR,i=arguments[3],a=arguments[4],s=this,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments[6],d=this.engine,l=d.ReaderCallback.implement({Release:function(){release()},GetSize:function(){return n},ReadBlock:function(e,t,n){var o=new Uint8Array(r(t,n));return d.HEAPU8.set(o,e),!0}}),f=d.createPDFDocWithReaderCallback(l,!1),h=new d.String(o);f.Load(h);var p=f.GetPageCount(),m=p-1,g=this.doc.GetPageCount();(u=Math.min(m,u))<0&&(u=(u+p)%p),(c=Math.min(m,c))<0&&(c=(c+p)%p);var y=Math.min(u,c),_=Math.max(u,c),v=new d.String(a),b=new d.Range(y,_,0);e<0&&(e=e%g+g),e=Math.max(0,Math.min(g,e));for(var S=this.doc.StartImportPages(e,f,i,v,b),w=[],M=0;M<=_-y;M++)w.push(e+M);var D=[];return 100===S.GetRateOfProgress()&&w.map((function(e){var t=s.doc.GetPage(e),n=t.GetIndex(),r=void 0,o=r=new _PDFPage2.default(n,s);r.page=t,s.updatePageIndex(n+1,s.doc.GetPageCount()-1,!0,!1),s.updatePageIndexMap(n,o),s.updatePageCache(r),D.push(r.toJson())})),D},PDFDoc.prototype.extractPages=function(e,t,n){var r=t.writeStream,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:_consts.EMPTY_STR,i=this.engine,a=new i.PDFDoc,s=new i.String("");a.Load(s);var u=this.doc,c=void 0;n&&(c=i.ReaderCallback.implement({Release:function(){release()},GetSize:function(){return n.size},ReadBlock:function(e,t,r){var o=new Uint8Array(n.getBuffer(t,r));return i.HEAPU8.set(o,e),!0}}),u=i.createPDFDocWithReaderCallback(c,!1),s=new i.String(o||""),u.Load(s));var d=u.GetPageCount(),l=new i.String("");e.reverse().forEach((function(e){if(1===e.length){if(e[0]>=d||isNaN(e[0]))return;e[0]<0&&(e[0]=e[0]%d+d);var t=new i.Range((e[0]+d)%d);a.StartImportPages(0,u,0,l,t)}else if(2===e.length){if(isNaN(e[0])||isNaN(e[1]))return;var n=Math.min(e[0],e[1]),r=Math.max(e[0],e[1]);if(n<0&&(n=n%d+d),r<0&&(r=r%d+d),n>=d)return;r=Math.min(r,d-1);var o=new i.Range((n+d)%d,(r+d)%d,0);a.StartImportPages(0,u,0,l,o)}}));var f=0,h=(0,_createDeferred2.default)();return a.GetPageCount()>0?i.saveDoc(a,i.WriterCallback.implement({Release:function(){},Flush:function(){return h.resolve(f),!0},GetSize:function(){return f},WriteBlock:function(e,t,n){f+=n;var o=i.HEAPU8.buffer,a=void 0;return a=o.slice?o.slice(e,e+n):new Uint8Array(o,e,n).buffer,r(a,t,n),!0}}),i.SaveFlags.e_SaveFlagNormal.value):h.reject(new Error("Cannot extract pages on none page document")),h.promise},PDFDoc.prototype.getHeaderFooter=function(e){var t=this;e||(e=(0,_createDeferred2.default)());try{if(!this.doc.HasHeaderFooter())return e.resolve(null);var n=this.doc.GetEditableHeaderFooter(),r=n.page_range,o={start:r.start_number,end:r.end_number,filter:r.filter.value},i=n.content,a={TopLeft:i.header_left_content.toString(),TopCenter:i.header_center_content.toString(),TopRight:i.header_right_content.toString(),BottomLeft:i.footer_left_content.toString(),BottomCenter:i.footer_center_content.toString(),BottomRight:i.footer_right_content.toString()},s=n.page_margin;e.resolve({font:this.JR.getPDFString(n.font.GetBaseFontName(this.doc)),textSize:n.text_size,textColor:n.text_color,hasTextShrinked:n.has_text_shrinked,hasFixedSized:n.has_fixedsize_for_print,ranges:o,margin:{left:s.left,right:s.right,top:s.top,bottom:s.bottom},startPageNumber:n.start_page_number,contents:a,contentFormats:{},underline:n.is_underline})}catch(n){isNaN(n)||(n=this.engine.getErrorCode(n)),n.value&&17==n.value?setTimeout((function(){t.getHeaderFooter(e)}),200):e.reject(n)}return e.promise},PDFDoc.prototype.addHeaderFooter=function(e,t){var n=this,r=this.doc;t||(t=(0,_createDeferred2.default)());try{var o=(0,_headerFooter2.default)(this.engine,r,e);r.AddHeaderFooter(o),o.delete(),this.getHeaderFooter(t)}catch(r){isNaN(r)||17!=this.engine.getErrorCode(r).value?t.reject(r):setTimeout((function(){n.addHeaderFooter(e,t)}),200)}return t.promise},PDFDoc.prototype.updateHeaderFooter=function(e,t){var n=this,r=this.doc;t||(t=(0,_createDeferred2.default)());try{var o=(0,_headerFooter2.default)(this.engine,r,e);r.UpdateHeaderFooter(o),this.getHeaderFooter(t)}catch(r){if("number"==typeof r){var i=this.engine.getErrorCode(r).value;if("number"==typeof i&&17==i)return void setTimeout((function(){n.updateHeaderFooter(e,t)}),200)}t.reject(r)}return t.promise},PDFDoc.prototype.removeHeaderFooter=function(e){var t=this;e||(e=(0,_createDeferred2.default)());try{this.doc.RemoveAllHeaderFooters(),e.resolve()}catch(n){if(17!=this.engine.getErrorCode(n).value)throw n;setTimeout((function(){t.removeHeaderFooter(e)}),200)}return e.promise},PDFDoc.prototype.getAnnotsRawData=function(e){var t=this;try{var n=this.engine,r=[];for(var o in e){var i=e[o];r.push(this.getPageByIndex(i.page))}return Promise.all(r).then((function(n){var r=[];for(var o in e){var i=e[o],a=i.page=t.pageIndexMap[i.page];i.iterator=r.length,r.push(a.getAnnotById(i.index))}return Promise.all(r)})).then((function(t){var r=[];for(var o in e){var i=t[e[o].iterator].annot,a=i.GetDict(),s={};switch(i.GetType().value){case 13:var u=a.GetElement((0,_constantsString.CString)(n,"AP"));u&&(s.N=retriveDict(n,s,"",u.GetDirectObject().GetDict().GetElement((0,_constantsString.CString)(n,"N")).GetDirectObject()));break;case 17:var c=a.GetElement((0,_constantsString.CString)(n,"FS"));c&&(s.FS=retriveDict(n,s,"",c.GetDirectObject()));break;case 18:var d=a.GetElement((0,_constantsString.CString)(n,"Sound"));d&&(s.Sound=retriveDict(n,s,"",d.GetDirectObject()))}r.push({index:o,raw:s})}return r}))}catch(e){throw console.error(engine.getErrorCode(e)),new Error(e)}},PDFDoc.prototype.sign=function(e){var t=this,n=this.engine,r=n.KeyName,o=void 0,i=!1,a=Promise.resolve();if(e.fieldName){var s=(o=this.loadForm().getField(e.fieldName).engineField).GetControl(0).GetWidget().GetPage().GetIndex();a=this.getPageByIndex(s)}return a.then((function(a){var s=e.flag||256;if(!o){var u=t.doc.GetPage(e.pageIndex),c=new n.WString(e.fieldName),d=e.rect;o=u.AddSignature(new n.CFX_FloatRect(d.left,d.bottom,d.right,d.top),c,{value:0},!0),i=!0}e.signer&&o.SetKeyValue(r.e_KeyNameSigner,new n.WString(e.signer)),e.reason&&o.SetKeyValue(r.e_KeyNameReason,new n.WString(e.reason)),e.distinguishName&&o.SetKeyValue(r.e_KeyNameDN,new n.WString(e.distinguishName)),e.location&&o.SetKeyValue(r.e_KeyNameLocation,new n.WString(e.location));var l=e.text||e.signer;l&&256&s&&o.SetKeyValue(r.e_KeyNameText,new n.WString(l));var f=new Date,h=new n.DateTime(f.getFullYear(),f.getMonth()+1,f.getDate(),f.getHours(),f.getMinutes(),f.getSeconds(),f.getMilliseconds(),-f.getTimezoneOffset()/60,0);o.SetSignTime(h);var p;if((p=e.inkSign)&&128&s){var m=t.JR.createReaderCallback(p),g=new n.Image(m).GetFrameBitmap(0);o.SetBitmap(g)}o.SetAppearanceFlags(s),o.SetFilter(new n.String(e.filter)),o.SetSubFilter(new n.String(e.subfilter)),e.docPermission&&o.SetDocPermission({value:e.docPermission}),e.defaultContentsLength&&o.SetDefaultContentsLength(e.defaultContentsLength);var y=(0,_callback.startSign)(t.engine,o,e.hashAlgorithm,e.filter,e.subfilter);if(i)return t.getPageByIndex(e.pageIndex).then((function(e){return e.reloadAnnots()})).then((function(e){return(0,_callback.getSignedFile)(y)}));var _=(0,_callback.getSignedFile)(y);return Promise.resolve(_)}))},PDFDoc.prototype.attachFile=function(e){},PDFDoc.prototype.getFontsInfo=function(){for(var e=this.doc,t=[],n=0,r=e.GetFontCount();n<r;n++){var o=e.GetFont(n),i=o.GetFontType(e).value;t.push({isEmbedded:o.IsEmbedded(e),isBold:o.IsBold(),isItalic:o.IsItalic(),baseFontName:this.JR.getPDFString(o.GetBaseFontName(e)),fontType:1===i?"Type1":2===i?"TrueType":3===i?"Type3":4===i?"TrueType(CID)":"",name:this.JR.getPDFString(o.GetName()),familyName:this.JR.getPDFString(o.GetFamilyName()),index:n,docId:this.id,encodingType:o.getEncodingType(e).toString(),actualFontName:o.getActualFontName(e).toString(),actualFontStyle:o.getActualFontStyle(e).toString()})}return t},PDFDoc.prototype.getAdditionalActions=function(){var e=this.engine,t=this.doc.GetCatalog().GetElement((0,_constantsString.CString)(e,"AA")),n={};if(!t)return n;for(var r=new e.AdditionalAction(this.doc,t.GetDict()),o=e.TriggerEvent,i=2;i<7;i++){var a=r.GetAction(o.values[i]);a.IsEmpty()||(n[i]=this.JR.actionManager.get(a,this,this.JR).toJson())}return(0,_objectsDelete2.default)(r),n},PDFDoc.prototype.syncDataCache=function(e){var t=[];for(var n in e)t.push(this.getPageByIndex(e[n],n));return Promise.all(t)},PDFDoc.prototype.setColors=function(e){Object.assign(this.colors,e)},PDFDoc.prototype.setPageDisplayPreferences=function(e){this.pageDisplayPreferences=e},PDFDoc.prototype.setOriginalStream=function(e){this.oriFile=e},PDFDoc.prototype.getOriginalStream=function(){var e=(0,_createDeferred2.default)();if("string"==typeof this.oriFile.url){var t=this.oriFile,n=new XMLHttpRequest;if(n.open(t.type||"GET",t.url,!0,t.user,t.password),n.responseType="arraybuffer",t.headers){var r=t.headers;for(var o in r)n.setRequestHeader(o,r[o])}n.onreadystatechange=function(){4===n.readyState&&(n.status>=200&&n.status<300||304===n.status?e.resolve(n.response):e.reject(n))},n.send(t.data)}else if(this.oriFile instanceof Blob){var i=new FileReaderSync;e.resolve(new Uint8Array(i.readAsArrayBuffer(this.oriFile)))}else e.resolve(new Uint8Array(this.oriFile).slice(0).buffer);return e.promise},PDFDoc.prototype.moveAnnotsToPage=function(e,t,n){var r=this;return Promise.all([this.getPageById(e),this.getPageById(t)]).then((function(e){var t=_slicedToArray(e,2),o=t[0],i=t[1];return i.isVirtual?[]:Promise.all([o.parsedPage(),i.parsedPage()]).then((function(e){var t=_slicedToArray(e,2),a=t[0],s=t[1],u=r.engine,c=a.GetRotation().value,d=s.GetRotation().value-c,l=getAnnotsArray(u,a),f=getAnnotsArray(u,s),h={},p=function(e){var t=o._getAnnotIndexById(Number(e)),i=a.GetAnnot(t),s=n[e].rect,c=i.GetDict(),l=c.GetObjNum();Object.keys(s).length&&function(){var e=new u.CFX_FloatRect(s.left,s.bottom,s.right,s.top),t=i.GetRect(),n=t.Width()/2,r=t.Height()/2,o=new u.Matrix;o.Translate(-t.left-n,-t.bottom-r,!1),o.Rotate(-d*Math.PI/2,!1),o.Translate(t.left+n,t.bottom+r,!1),o.SetReverse(o);var a=i.GetRect();o.TransformRect(a),e.right=e.left+a.Width(),e.top=e.bottom+a.Height();var l=i.GetType().value,f=s.left-a.left,h=s.bottom-a.bottom;switch(l){case 3:var p,m=(360+90*d)%360,g=(0,_constantsString.CString)(u,"Rotate"),y=c.GetElement(g);p=y?y.GetInteger():0,c.SetAt(g,u.PDFObject.CreateFromInteger((p+m)%360));var _=new u.FreeText(i);if("FreeTextCallout"==_.GetIntent().toString()){for(var v=_.GetCalloutLinePoints(),b=0,S=v.GetSize();b<S;b++){var w=v.GetAt(b);(w=o.TransformPoint(w.x,w.y)).x+=f,w.y+=h,v.SetAt(b,w)}_.SetCalloutLinePoints(v);var M=_.GetInnerRect();o.TransformRect(M),M.left+=f,M.right+=f,M.top+=h,M.bottom+=h;var D=new u.CFX_FloatRect(M.left-e.left,M.bottom-e.bottom,e.right-M.right,e.top-M.top);c.SetAtRect((0,_constantsString.CString)(u,"RD"),D),c.SetAtRect((0,_constantsString.CString)(u,"Rect"),e),i.ResetAppearanceStream()}break;case 4:var P=new u.Line(i),T=P.GetStartPoint();(T=o.TransformPoint(T.x,T.y)).x+=f,T.y+=h,P.SetStartPoint(T);var k=P.GetEndPoint();(k=o.TransformPoint(k.x,k.y)).x+=f,k.y+=h,P.SetEndPoint(k);break;case 7:case 8:[u.PolyLine,u.Polygon].find((function(e,t){if(7==l&&0==t)return!1;for(var n=new e(i),r=n.GetVertexes(),a=0,s=r.GetSize();a<s;a++){var u=r.GetAt(a);(u=o.TransformPoint(u.x,u.y)).x+=f,u.y+=h,r.SetAt(a,u)}return n.SetVertexes(r),!0}));break;case 10:case 11:case 12:for(var A=new u.TextMarkup(i),L=A.GetQuadPoints(),F=new u.QuadPointsArray,I=function(e,t){var n=L.GetAt(e),r=new u.QuadPoints;[n.first,n.second,n.third,n.fourth].forEach((function(e,t){var n=o.TransformPoint(e.x,e.y);switch(n.x+=f,n.y+=h,t){case 0:r.first=n;break;case 1:r.second=n;break;case 2:r.third=n;break;case 3:r.fourth=n}})),F.Add(r)},x=0,C=L.GetSize();x<C;x++)I(x);A.SetQuadPoints(F);break;case 15:for(var R=new u.Ink(i),O=R.GetInkList(),G=O.GetPointCount(),E=0;E<G;E++){var Y=O.GetPoint(E),j=o.TransformPoint(Y.x,Y.y);j.x+=f,j.y+=h;var N=O.GetPointType(E);O.SetPoint(E,j,N)}R.SetInkList(O);break;case 13:var B,H=(360+90*d)%360,W=(0,_constantsString.CString)(u,"Rotate"),U=c.GetElement(W);B=U?U.GetInteger():0,new u.Stamp(i).SetRotation(((-B-H)%360+360)%360);break;case 17:var z=i.GetFlags();i.SetFlags(24|z);break;case 20:var J=(4+d)%4,V=new u.Widget(i),K=V.GetMKRotation().value;4===K&&(K=0);var q=4-((-K-J)%4+4)%4,Z=u.Rotation.e_Rotation0;switch(q){case 1:Z=u.Rotation.e_Rotation90;break;case 2:Z=u.Rotation.e_Rotation180;break;case 3:Z=u.Rotation.e_Rotation270}V.SetMKRotation(Z)}26!==l&&c.SetAtRect((0,_constantsString.CString)(u,"Rect"),e),i.ResetAppearanceStream()}(),c.RemoveAt((0,_constantsString.CString)(u,"P")),f.AddElement(u.PDFObject.CreateReference(r.doc,l)),h[l]=e};for(var m in n)p(m);for(var g in h)for(var y=l.GetElementCount(),_=0;_<y;_++){var v=l.GetElement(_).GetDirectObject().GetDict(),b=v.GetObjNum();if(h[b]){l.RemoveAt(_);break}var S=v.GetElement((0,_constantsString.CString)(u,"NM")),w=S&&S.GetString().toString();if(h[b]==w&&S){l.RemoveAt(_);break}}return o.page.UpdateAnnotList(),i.page.UpdateAnnotList(),o.reloadAnnots(),i.reloadAnnots(),i.getAnnots(null,h)}))}))},PDFDoc.prototype.setTabOrder=function(e,t){var n=this,r=Object.freeze({none:"e_None",row:"e_Row",column:"e_Column",structure:"e_Structure"});return this.getPageByIndex(e).then((function(e){if(e.isVirtual)return[];var o=n.engine.OrderType[r[t]||r.none],i=new n.engine.TabOrderMgr(e.page);i.SetOrderType(o),i.Reload();e.page.GetAnnotCount();for(var a=i.GetFirstAnnot(),s=[];!a.IsEmpty();)s.push(a.GetDict().GetObjNum()),a=i.GetNextAnnot(a);return s}))},PDFDoc.prototype.getTabOrder=function(e){var t=this,n=this.engine;return this.getPageByIndex(e).then((function(e){if(e.isVirtual)return"e_None";var r=new t.engine.TabOrderMgr(e.page).GetOrderType();switch(r){case n.OrderType.e_Row:r="e_Row";break;case n.OrderType.e_Column:r="e_Column";break;case n.OrderType.e_Structure:r="e_Structure";break;default:r="e_None"}return r}))},PDFDoc.prototype.setStructureOrder=function(e,t){var n=this,r=this.engine;return this.getPageByIndex(e).then((function(e){return e.isVirtual?[]:e.getAnnots(t).then((function(t){var o=new n.engine.TabOrderMgr(e.page),i=new r.AnnotArray;return t.forEach((function(e){i.Add(e.annot)})),o.AdjustStructureOrder(i),e.reloadAnnots()}))}))},PDFDoc.prototype.renderTemplatesByObjNum=function(e){var t=this.engine,n=this.doc.GetTemplateSize(e),r=new t.Bitmap(n.x,n.y,t.DIBFormat.e_DIBRgb32,0,0);r.FillRect(4294967295,null);var o=(0,_RendererHelper.createBitmapRender)(t,r);return o.RenderTemplates(this.doc,e,r),(0,_RendererHelper.getBitmapBuffer)(t,r,o)},PDFDoc.prototype.getPageIndexByObjNum=function(e){return this.doc.GetPageIndex(e)},PDFDoc.prototype.getNameTree=function(e){for(var t={value:e},n=this.doc,r=this.engine,o={},i=new r.PDFNameTree(n,t),a=0,s=i.GetCount();a<s;a++){var u=i.GetName(a),c=i.GetObj(u);if(c){var d=u.toString();if(t.value===r.PDFNameTreeType.e_JavaScript.value){var l=new r.Action(n,c.GetDict());if(l.IsEmpty())continue;var f=new r.JavaScriptAction(l),h=f.GetScript();o[d]=h.toString(),l=null,f=null,h=null}else if(4===t.value||5===t.value){var p=c.GetDict().GetObjNum();o[d]=p,p=null}else if(t.value===r.PDFNameTreeType.e_EmbeddedFiles.value){var m=new r.FileSpec(n,c),g=new _FileSpec2.default(m,this);o[d]=g.toJson(),g=null}u.delete(),u=null}}return o},PDFDoc.prototype.addNameTreeObj=function(e,t,n){var r=this.engine,o=this.doc,i=new r.PDFNameTree(o,{value:e}),a=new r.WString(t),s=o.GetIndirectObject(n).GetDirectObject(),u=i.Add(a,s);return a.delete(),a=null,u},PDFDoc.prototype.removeNameTreeObj=function(e,t){var n=this.engine,r=this.doc,o=new n.PDFNameTree(r,{value:e}),i=new n.WString(t),a=o.RemoveObj(i);return i.delete(),i=null,a},PDFDoc.prototype.replaceNameTreeObj=function(e,t,n){var r=this.engine,o=this.doc,i=new r.PDFNameTree(o,{value:e}),a=new r.WString(t),s=o.GetIndirectObject(n).GetDirectObject(),u=i.SetObj(a,s);return a.delete(),a=null,u},PDFDoc.prototype.renameNameTreeObj=function(e,t,n){var r=this.engine,o=this.doc,i=new r.PDFNameTree(o,{value:e}),a=new r.WString(t),s=new r.WString(n),u=i.Rename(a,s);return a.delete(),a=null,s.delete(),s=null,u},PDFDoc.prototype.nameTreeTemplatesToPages=function(e){var t=this.engine,n=this.doc,r=new t.WString(e),o=n.InsertPageFromTemplate(r);return r.delete(),r=null,o},PDFDoc.prototype.nameTreePagesToTemplates=function(e){var t=this.engine,n=this.doc,r=new t.WString(e);return n.RemovePageFromTemplate(r),r.delete(),r=null,!0},PDFDoc.prototype.addFileSpec=function(e,t,n){var r=this.engine,o=this.doc,i=_FileSpec2.default.createFile(r,o,t),a=new r.WString(e);return i.SetFileName(a),a.delete(),a=null,i.SetModifiedDateTime(_Annot2.default.ToDateTime(r,n)),i.GetDict().GetObjNum()},PDFDoc.prototype.setFileSpecDesc=function(e,t){var n=this.engine,r=this.doc,o=new n.FileSpec(r,r.GetIndirectObject(t));if(!o.IsEmpty()){var i=new n.String(e);o.SetDescription(i),i.delete(),i=null}return!0},PDFDoc.prototype.getArticle=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return!e&&this.article||(this.article=new _PDFArticle2.default(this)),this.article},PDFDoc.prototype.getFileSpecStream=function(e,t){var n=this.engine,r=this.doc,o=new n.FileSpec(r,r.GetIndirectObject(e));if(o.IsEmpty())return Promise.reject();var i=new _FileSpec2.default(o,this),a=i.getStream(t);return i=null,a},PDFDoc.prototype.getFormControlPage=function(e){for(var t=this,n=[],r=0;r<this.doc.GetPageCount();r++)n.push(this.getPageByIndex(r));return Promise.all(n).then((function(n){for(var r=0;r<n.length;r++){var o=t.pageIndexMap[r].page.GetDict().GetElement((0,_constantsString.CString)(t.engine,"Annots"));if(o&&(o=o.GetDirectObject()))for(var i=o.GetArray(),a=0;a<i.GetElementCount();a++){var s=i.GetElement(a);if(s&&((s=s.GetDirectObject())&&s.GetDict().GetObjNum()==e))return r}}}))},PDFDoc.prototype.getPDFDictInfo=function(){var e=this.dictionaryMap[this.id];if(e)return e.toJson();var t=this;return this.docPromise.then((function(e){var n=e.GetInfo(),r=new _PDFDictionary2.default(t);return t.updateDictCache(n,r),t.updateDictMap(t.id,r),r.toJson()}))},PDFDoc.prototype.getPageLabels=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=this,r=this.engine,o=this.docPromise.then((function(e){return e.GetPageCount()})).then((function(n){return Promise.all(t.map((function(r){if(r>0&&r<n)return e.getPageByIndex(r).then((function(e){if(e.isVirtual){var n=t.indexOf(r);t.split(n,1)}}))})))}));return o.then((function(){return e.docPromise})).then((function(e){n.pageLabels=n.pageLabels||new r.PageLabels(e);var o=[],i=e.GetPageCount();if(!t||!t.length){for(var a=0;a<i;a++){var s=n.pageLabels.GetPageLabelTitle(a);o.push(s.toString())}return o}return t.forEach((function(e){if(e<0||e>=i)o.push("");else{var t=n.pageLabels.GetPageLabelTitle(e);o.push(t.toString())}})),o}))},PDFDoc.prototype.startFormDesignerAssit=function(){for(var e in this.isDesignerMode=!0,this.pageCache){this.pageCache[e].resetBitmapCache()}},PDFDoc.prototype.stopFormDesignerAssit=function(){for(var e in this.isDesignerMode=!1,this.pageCache){this.pageCache[e].resetBitmapCache()}},PDFDoc.prototype.updateDictCache=function(e,t){var n=t.id;this.dictionaryCache[n]=e},PDFDoc.prototype.updateDictMap=function(e,t){this.dictionaryMap[e]=t},PDFDoc.prototype.hasKey=function(e,t){var n=this.dictionaryCache[e];if(!n)return!1;var r=(0,_constantsString.CString)(this.engine,t);return n.HasKey(r)},PDFDoc.prototype.setAt=function(e,t,n){var r=this.dictionaryCache[e],o=this.engine,i=(0,_constantsString.CString)(o,t);switch(void 0===n?"undefined":_typeof(n)){case"string":return r.SetAtString(i,(0,_constantsString.CString)(o,n)),!0;case"number":return n%1==0?(r.SetAtInteger(i,n),!0):!isNaN(n)&&(r.SetAtFloat(i,n),!0);case"boolean":return r.SetAtBoolean(i,n),!0}return!1},PDFDoc.prototype.getAt=function(e,t){var n=this.dictionaryCache[e],r=this.engine;try{var o=(0,_constantsString.CString)(r,t),i=n.GetElement(o);switch(i.GetType().value){case 1:return i.GetBoolean();case 2:return i.GetFloat();case 3:return i.GetString().toString()}}catch(e){throw new Error("The specified key does not exist in the dictionary or the value type is unaccepted")}},PDFDoc.prototype.autoRecognitionForm=function(){var e=this.doc.AutoRecognitionForm(!1),t=[];return this.getAllLoadedPages().forEach((function(e){t.push(e.index)})),this.reloadPageAnnots(t),e},PDFDoc.prototype.isStaticXFA=function(){return this.doc.IsStaticXFA()},PDFDoc.prototype.isXFA=function(){return this.doc.IsXFA()},PDFDoc.prototype.removeXFA=function(){return this.doc.RemoveXFA()},PDFDoc.prototype.reversePages=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=this.engine;return this.docPromise.then((function(r){if(!Array.isArray(t))return[];if(t.length<2)return[];if(!t.every((function(e){return"number"==typeof e})))return[];for(var o=function(e,t,n,r){var o=new t.Range;return o.AddSingle(n),e.MovePagesTo(o,r)},i=0,a=t.length-1;i<a;i++,a--){var s=o(r,n,i,a);if(s&&(s=o(r,n,a-1,i)),s){var u=e.pageIndexMap[i],c=function(t,n){var r=void 0;return t instanceof _PDFPage2.default&&(t.index=n,r=t.id),e.pageIndexMap[n]=t,r};c(e.pageIndexMap[a],i),c(u,a)}}return t}))},PDFDoc.prototype.movePagesTo=function(e,t){var n=this,r=this.engine,o=new r.Range;return e.forEach((function(e){"object"!==(void 0===e?"undefined":_typeof(e))?o.AddSingle(e):1===e.length?o.AddSingle(e[0]):2===e.length&&o.AddSegment(e[0],e[1],r.RangeFilter.e_All)})),this.docPromise.then((function(r){var i=r.GetPageCount(),a=t;e[0]<t&&(a=t-1),a<0&&(a=0),a>=i&&(a=i-1);var s=r.MovePagesTo(o,a);if(!s)return s;Math.max.apply(Math,_toConsumableArray(e).concat([t]));for(var u=Object.values(n.pageIndexMap),c=0;c<i;c++)u[c]||(u[c]={});var d=void 0;return e.map((function(e){return u[e]})).forEach((function(e,n){var r=u.indexOf(e);if(u.splice(r,1),0===n)r<t?u.splice(t-1,0,e):u.splice(t,0,e);else{var o=u.indexOf(d);u.splice(o+1,0,e)}d=e})),s=[],u.forEach((function(e,t){var r=void 0;e instanceof _PDFPage2.default?(e.index=t,r=e.id):e=null,s.push(r),n.pageIndexMap[t]=e})),s}))},PDFDoc.prototype.startReplacePages=function(e,t,n,r){var o=this,i=this.engine,a=new i.Range,s=this.doc;s.GetPageCount();r.forEach((function(e){"object"!==(void 0===e?"undefined":_typeof(e))?a.AddSingle(e):1===e.length?a.AddSingle(e[0]):2===e.length&&a.AddSegment(e[0],e[1],i.RangeFilter.e_All)}));var u=[],c=(0,_createDeferred2.default)(),d=0,l="",f=i.StreamCallback.implement({Release:function(){},Flush:function(){return c.resolve(d),!0},GetSize:function(){return d},WriteBlock:function(e,t,n){d+=n;var r=i.HEAPU8.buffer,o=void 0;return o=r.slice?r.slice(e,e+n):new Uint8Array(r,e,n).buffer,u.push(o),!0},ReadBlock:function(e,t,n){var r=(new FileReaderSync).readAsArrayBuffer(new Blob(u).slice(t,t+n));return r=new Uint8Array(r),i.HEAPU8.set(r,e),!0}}),h=i.PauseCallback.implement({NeedToPauseNow:function(){return!1}});try{s.StartReplacePages(e,t,n.doc,a,f,h)}catch(e){l=e}if(l)return{error:l};for(var p=r.length,m=0;m<t;m++){var g=m+e;if(this.pageIndexMap[g]){var y=this.pageIndexMap[g];delete this.pageIndexMap[g],delete this.pageIndexPromise[g],delete this.pageCache[y.id]}}t!==p&&Object.keys(this.pageIndexMap).reverse().map((function(n,r){+n>=e+t-1&&(o.pageIndexMap[+n+p-t]=o.pageIndexMap[+n],o.pageIndexMap[+n+p-t].index=+n+p-t,delete o.pageIndexMap[+n])}));var _=new Array(p).fill(0).map((function(t,n){return e+n})).map((function(e){var t=s.GetPage(e),n=t.GetIndex(),r=new _PDFPage2.default(n,o);return r.page=t,o.updatePageIndexMap(n,r),o.updatePageCache(r),r.toJson()}));return a&&a.delete(),_},PDFDoc.prototype.setPageTransition=function(e,t,n,r){var o=this.JR.engine,i=new o.PDFDictionary.Create,a=new o.String("S"),s=new o.String(e);if(i.SetAtName(a,s),"Split"===e){var u=new o.String("Dm"),c=new o.String("M"),d=new o.String("H"),l=new o.String("V"),f=new o.String("I"),h=new o.String("O");"Horizontal Inward"===t?(i.SetAtName(u,d),i.SetAtName(c,f)):"Horizontal Outward"==t?(i.SetAtName(u,d),i.SetAtName(c,h)):"Vertical Inward"==t?(i.SetAtName(u,l),i.SetAtName(c,f)):(i.SetAtName(u,l),i.SetAtName(c,h)),u.delete(),c.delete(),d.delete(),l.delete(),f.delete(),h.delete()}else if("Blinds"===e){var p=new o.String("Dm"),m=new o.String("H"),g=new o.String("V");"Horizontal"===t?i.SetAtName(p,m):i.SetAtName(p,g),p.delete(),m.delete(),g.delete()}else if("Box"==e){var y=new o.String("M"),_=new o.String("I"),v=new o.String("O");"Inward"===t?i.SetAtName(y,_):i.SetAtName(y,v),y.delete(),_.delete(),v.delete()}else if("Wipe"===e||"Glitter"===e||"Cover"===e||"Uncover"===e){var b=new o.String("Di"),S=0;S="Right"===t?0:"Right Up"===t?1:"Up"===t?2:"Left Up"===t?3:"Left"===t?4:"Left Down"===t?5:"Down"===t?6:7,i.SetAtInteger(b,45*S),b.delete()}else if("Push"==e){var w=new o.String("Di"),M=0;M="Right"===t?0:"Up"===t?1:"Left"===t?2:3,i.SetAtInteger(w,45*M),w.delete()}else if("Fly"===e){var D=new o.String("Di"),P=0;P="Right"===t?0:"Up"===t?1:"Left"===t?2:3,i.SetAtInteger(D,90*P),D.delete()}var T=new o.String("D");"Fast"===n?i.SetAtFloat(T,.333328):"Medium"===n&&i.SetAtFloat(T,.666656);var k=this.doc,A=new o.String("Trans");if(k.AddIndirectObject(i),"NoTransition"!==e)for(var L=0;L<r.length;L++){k.GetPage(r[L]).GetDict().SetAtReference(A,i,k)}else for(var F=0;F<r.length;F++){k.GetPage(F).GetDict().RemoveAt(A)}return a.delete(),s.delete(),T.delete(),A.delete(),!0},PDFDoc.prototype.getPageTransitionByIndex=function(e){var t=this.JR.engine,n=this.doc.GetPage(e).GetDict(),r="NoTransition",o=void 0,i=new t.String("Trans"),a=n.GetElement(i);if(null===a)return{transName:"NoTransition",direction:"",speed:""};a.GetType()===t.PDFObjectType.e_Reference&&(a=a.GetDirectObject()),a.GetType()==t.PDFObjectType.e_Dictionary&&(o=a.GetDict());var s=new t.String("S"),u=o.GetElement(s);u&&"R"===(r=u.GetString().toString())&&(r="NoTransition");var c="",d=new t.String("Dm"),l=o.GetElement(d);if("Split"===r){var f=new t.String("M"),h=o.GetElement(f);c=l&&"V"===l.GetString().toString().toLocaleUpperCase()?h&&"O"===h.GetString().toString().toLocaleUpperCase()?"Vertical Outward":"Vertical Inward":h&&"O"===h.GetString().toString().toLocaleUpperCase()?"Horizontal Outward":"Horizontal Inward",f.delete()}else if("Blinds"===r)c=l&&"V"===l.GetString().toString().toLocaleUpperCase()?"Vertical":"Horizontal";else if("Box"===r){var p=new t.String("M"),m=o.GetElement(p);c=m&&"O"===m.GetString().toString().toLocaleUpperCase()?"Outward":"Inward",p.delete()}else if("Wipe"==r||"Glitter"==r||"Cover"==r||"Uncover"==r){var g=new t.String("Di"),y=o.GetElement(g);if(null===y)c="Right";else switch(y.GetInteger()/45%8){case 0:c="Right";break;case 1:c="Right Up";break;case 2:c="Up";break;case 3:c="Left Up";break;case 4:c="Left";break;case 5:c="Left Down";break;case 6:c="Down";break;case 7:c="Right Down"}g.delete()}else if("Push"===r){var _=new t.String("Di"),v=o.GetElement(_);if(null===v)c="Right";else switch(v.GetInteger()/45%8){case 0:c="Right";break;case 1:c="Up";break;case 2:c="Left";break;case 3:c="Down";break;default:c="Up"}_.delete()}else if("Fly"==r){var b=new t.String("Di"),S=o.GetElement(b);if(null===S)c="Right";else switch(S.GetInteger()){case 0:c="Right";break;case 90:c="Up";break;case 180:c="Left";break;case 270:c="Down";break;default:c="Up"}b.delete()}var w="";if("NoTransition"!==r){var M=new t.String("D");if(null===o.GetElement(M))w="Slow";else{var D=o.GetElement(M).GetFloat();w=D-.333328<.001&&D-.333328>-.001?"Fast":D-.666656<.001&&D-.666656>-.001?"Medium":"Slow"}M.delete()}return i.delete(),s.delete(),d.delete(),{transName:r,direction:c,speed:w}},PDFDoc.prototype.removePages=function(e){var t=this,n=pageRangeTwoDimensionToOne(e).sort((function(e,t){return t-e}));try{var r=[];return n.forEach((function(e){r.push(t.removePage(e))})),syncPromisesTask(r).then((function(e){return!0}))}catch(e){return console.warn(e),!1}},PDFDoc.prototype.insertBlankPages=function(e,t,n){var r=this,o=pageRangeTwoDimensionToOne(e).sort((function(e,t){return e-t})),i=[];return o.forEach((function(e,o){i.push(r.insertPage(e+o,t,n))})),syncPromisesTask(i)},PDFDoc.prototype.insertBlankPages2=(_ref30=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n,r){var o,i,a,s,u,c,d,l,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=pageRangeTwoDimensionToOne(t).sort((function(e,t){return e-t})),i=[],a=!0,s=!1,u=void 0,e.prev=5,c=o[Symbol.iterator]();case 7:if(a=(d=c.next()).done){e.next=16;break}return l=d.value,e.next=11,this.insertPage(l,n,r);case 11:f=e.sent,i.push(f);case 13:a=!0,e.next=7;break;case 16:e.next=22;break;case 18:e.prev=18,e.t0=e.catch(5),s=!0,u=e.t0;case 22:e.prev=22,e.prev=23,!a&&c.return&&c.return();case 25:if(e.prev=25,!s){e.next=28;break}throw u;case 28:return e.finish(25);case 29:return e.finish(22);case 30:return e.abrupt("return",i);case 31:case"end":return e.stop()}}),e,this,[[5,18,22,30],[23,,25,29]])}))),function(e,t,n){return _ref30.apply(this,arguments)}),PDFDoc.prototype.rotatePages=function(e,t){var n=pageRangeTwoDimensionToOne(e),r=[];return pageIndexesToPages(this,n).then((function(e){return e.forEach((function(e){r.push(e.setRotation(t))})),Promise.all(r)}))},PDFDoc.prototype.moveBookmark=function(e,t,n){var r=this.rootBookmark.getBookmarkById(e),o=this.rootBookmark.getBookmarkById(t);return this.rootBookmark=null,r.moveTo(o,n)},PDFDoc.prototype.getFolioTreeRoot=function(){if(this.doc.IsPortfolio()){var e=this.engine.Portfolio.CreatePortfolio(this.doc),t=e.GetRootNode();if(!t.IsEmpty()){var n=void 0,r=t.GetNodeType();return r==this.engine.PortfolioNodeType.e_TypeFolder&&(t=new this.engine.PortfolioFolderNode(t),n=this.portfolioFolderNodeToJSON(t)),r==this.engine.PortfolioNodeType.e_TypeFile&&(t=new this.engine.PortfolioFileNode(t),n=this.portfolioFileNodeToJSON(t)),e.delete(),n}e.delete()}},PDFDoc.prototype.getFolioFileInfo=function(){if(!this.doc.IsPortfolio())return{};var e=this.engine.Portfolio.CreatePortfolio(this.doc);try{return{initialFileSpecKeyName:e.GetInitialFileSpecKeyName().toString(),initialViewMode:e.GetInitialViewMode().value}}finally{e.delete()}},PDFDoc.prototype.getPortfolioFileStream=function(e,t){var n=t.writeStream,r=this.JR.GetJSObjectFromPtr(e);return new _FileSpec2.default(r.GetFileSpec(),this).getStream(n)},PDFDoc.prototype.getPortfolioSubNodes=function(e){var t=[],n=this.JR.GetJSObjectFromPtr(e);if(!n)throw new Error("Nonexistent portfolio folder node!");var r=n.GetNodeType();if(r!==this.engine.PortfolioNodeType.e_TypeFolder)return t;for(var o=n.GetSortedSubNodes(),i=o.GetSize(),a=0;a<i;a++){var s=o.GetAt(a);(r=s.GetNodeType())==this.engine.PortfolioNodeType.e_TypeFolder&&(s=new this.engine.PortfolioFolderNode(s),t.push(this.portfolioFolderNodeToJSON(s))),r==this.engine.PortfolioNodeType.e_TypeFile&&(s=new this.engine.PortfolioFileNode(s),t.push(this.portfolioFileNodeToJSON(s)))}return t},PDFDoc.prototype.removeSubNode=function(e,t){var n=this.JR.GetJSObjectFromPtr(e);if(!n)throw new Error("Nonexistent portfolio folder node!");if(n.GetNodeType()!==this.engine.PortfolioNodeType.e_TypeFolder)return!1;var r=this.JR.GetJSObjectFromPtr(t);if(!r)throw new Error("Nonexistent portfolio node!");n.RemoveSubNode(r)},PDFDoc.prototype.portfolioFolderNodeToJSON=function(e){var t=gsdkDateToLocal(e.GetCreationDateTime()),n=gsdkDateToLocal(e.GetModifiedDateTime());return{type:1,fileName:e.GetName().toString(),description:e.GetDescription().toString(),creationDateTime:t?t.getTime():-1,modifiedDateTime:n?n.getTime():t,handle:this.JR.SetJSObjectRef(e)}},PDFDoc.prototype.portfolioFileNodeToJSON=function(e){var t=e.GetFileSpec(),n=gsdkDateToLocal(t.GetCreationDateTime()),r=gsdkDateToLocal(t.GetModifiedDateTime()),o=e.GetKeyName().toString();return{type:0,fileName:t.GetFileName().toString(),fileSize:t.GetFileSize(),description:t.GetDescription().toString(),creationDateTime:n?n.getTime():-1,modifiedDateTime:r?r.getTime():n,subtype:t.GetSubtype().toString(),keyName:o,handle:this.JR.SetJSObjectRef(e)}},PDFDoc.prototype.removeSubNode=function(e,t){var n=this.JR.GetJSObjectFromPtr(e);if(!n)throw new Error("Nonexistent portfolio folder node!");if(n.GetNodeType()!==this.engine.PortfolioNodeType.e_TypeFolder)return!1;var r=this.JR.GetJSObjectFromPtr(t);if(!r)throw new Error("Nonexistent portfolio node!");n.RemoveSubNode(r)},PDFDoc.prototype.isCPDF=function(){return this.doc.IsCPDF()},PDFDoc.prototype.getDocURI=function(){return this.isCPDF()?this.doc.GetDocURI().toString():null},PDFDoc.prototype.convertToCPDF=(_ref32=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n,r,o){var i,a,s,u,c,d,l,f,h,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(![t,n,r,o].some((function(e){return"string"!=typeof e||0===e.length}))){e.next=2;break}throw"[ERROR] All arguments must be string.";case 2:if(i=this.engine,a={endPoint:new i.String(n)},s=void 0,u=function(e){return e.split("\r\n").reduce((function(e,t){var n=t.split(": ");return 2===n.length&&(e[n[0]]=n[1]),e}),{})},c=function(){var e=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n,r){var o,a,s,c,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=function(e){var t=e.GetURL().toString(),n=u(e.GetHTTPHeader().toString());switch(e.GetUsageType()){case i.RequestUsageType.e_RequestUsagePOST:return{url:t,headers:n,method:"post",data:e.GetRequestData().toString()};case i.RequestUsageType.e_RequestUsagePUT:return{url:t,headers:n,method:"put",data:e.GetRequestData().toString()};case i.RequestUsageType.e_RequestUsageGET:return{url:t,headers:n,method:"get",params:e.GetRequestData().toString()};case i.RequestUsageType.e_RequestUsageNone:default:throw"[ERROR] Not valid request."}}(n),e.next=4,_axios2.default.request(o);case 4:if(a=e.sent,s=new i.ResponseParser,c=function(e){return e!==i.ErrorCode.e_ErrSuccess},d=void 0,d=s.Parse(new i.String(JSON.stringify(a.data)),r),!c(d)){e.next=11;break}throw"[ERROR] Fail to parse response for "+t;case 11:if(d=s.GetResultStatus(),!c(d)){e.next=14;break}throw"[ERROR] Response result status: "+d.value.toString();case 14:return e.abrupt("return",s);case 15:case"end":return e.stop()}}),e,p)})));return function(t,n,r){return e.apply(this,arguments)}}(),!this.isCPDF()){e.next=9;break}throw"[ERROR] Already a ConnectedPDF file, so no need to do conversion.";case 9:return d=void 0,d=i.ConnectedPDF.GenerateRequestToCheckEndpoint(a.endPoint),e.next=13,c("CheckEndPoint",d,i.ResponsePurposeType.e_ResponsePurposeCheckServer);case 13:if((s=e.sent).IsValidCPDFServer()){e.next=16;break}throw"[FAILED] "+a.endPoint+" is not a valid CPDF server.";case 16:return(l=new i.ConnectedPDFClientInfo).device_id=new i.String("Device ID"),l.device_name=new i.String("Device Name"),l.device_model=new i.String("Device Model"),l.mac_address=new i.String("MAC Address"),l.os=new i.String("OS"),l.product_name=new i.String("Product Name"),l.product_vendor=new i.String("Product Vendor"),l.product_version=new i.String("1.0.0.0"),l.product_language=new i.String("en-us"),d=i.ConnectedPDF.GenerateRequestToGetClientID(l),e.next=29,c("GetClientID",d,i.ResponsePurposeType.e_ResponsePurposeClientID);case 29:return s=e.sent,f=s.GetClientID(),h=new i.ConnectedPDF(f,new i.String(r),new i.String(""),i.CPDFEncryptType.e_CPDFEncryptTypeAES,this.doc),d=h.GenerateRequestToConvertToCPDF(a.endPoint,new i.String(o),new i.WString(t)),e.next=35,c("ConvertToCPDF",d,i.ResponsePurposeType.e_ResponsePurposeCommon);case 35:if(s=e.sent,h.UpdateInfoToPDFDoc(d)){e.next=38;break}throw"[FAILED] Fail to convert to Connected PDF file.";case 38:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return _ref32.apply(this,arguments)}),PDFDoc.prototype.removeCDocId=(_ref34=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n,r,o){var i,a,s,u,c,d,l,f,h,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(![t,n,r,o].some((function(e){return"string"!=typeof e||0===e.length}))){e.next=2;break}throw"[ERROR] All arguments must be string.";case 2:return i=void 0,a=this.engine,s={endPoint:new a.String(n)},u=function(e){return e.split("\r\n").reduce((function(e,t){var n=t.split(": ");return 2===n.length&&(e[n[0]]=n[1]),e}),{})},c=function(){var e=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n,r){var o,i,s,c,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=function(e){var t=e.GetURL().toString(),n=u(e.GetHTTPHeader().toString());switch(e.GetUsageType()){case a.RequestUsageType.e_RequestUsagePOST:return{url:t,headers:n,method:"post",data:e.GetRequestData().toString()};case a.RequestUsageType.e_RequestUsagePUT:return{url:t,headers:n,method:"put",data:e.GetRequestData().toString()};case a.RequestUsageType.e_RequestUsageGET:return{url:t,headers:n,method:"get",params:e.GetRequestData().toString()};case a.RequestUsageType.e_RequestUsageNone:default:throw"[ERROR] Not valid request."}}(n),e.next=4,_axios2.default.request(o);case 4:if(i=e.sent,s=new a.ResponseParser,c=function(e){return e!==a.ErrorCode.e_ErrSuccess},d=void 0,d=s.Parse(new a.String(JSON.stringify(i.data)),r),!c(d)){e.next=11;break}throw"[ERROR] Fail to parse response for "+t;case 11:if(d=s.GetResultStatus(),!c(d)){e.next=14;break}throw"[ERROR] Response result status: "+d.value.toString();case 14:return e.abrupt("return",s);case 15:case"end":return e.stop()}}),e,p)})));return function(t,n,r){return e.apply(this,arguments)}}(),d=void 0,d=a.ConnectedPDF.GenerateRequestToCheckEndpoint(s.endPoint),e.next=11,c("CheckEndPoint",d,a.ResponsePurposeType.e_ResponsePurposeCheckServer);case 11:if((i=e.sent).IsValidCPDFServer()){e.next=14;break}throw"[FAILED] "+s.endPoint+" is not a valid CPDF server.";case 14:return(l=new a.ConnectedPDFClientInfo).device_id=new a.String("Device ID"),l.device_name=new a.String("Device Name"),l.device_model=new a.String("Device Model"),l.mac_address=new a.String("MAC Address"),l.os=new a.String("OS"),l.product_name=new a.String("Product Name"),l.product_vendor=new a.String("Product Vendor"),l.product_version=new a.String("1.0.0.0"),l.product_language=new a.String("en-us"),d=a.ConnectedPDF.GenerateRequestToGetClientID(l),e.next=27,c("GetClientID",d,a.ResponsePurposeType.e_ResponsePurposeClientID);case 27:i=e.sent,f=i.GetClientID(),(h=new a.ConnectedPDF(f,new a.String(r),new a.String(""),a.CPDFEncryptType.e_CPDFEncryptTypeAES,this.doc)).RemoveDocumentID(),h.RemoveVersionID();case 32:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return _ref34.apply(this,arguments)}),PDFDoc.prototype.saveAsReload=function(){var e=this,t=[];return this.getStream({writeStream:function(e){t.push(e)}},0).then((function(n){for(var r=new Uint8Array(n),o=0,i=0,a=t.length;i<a;i++){var s=t[i];r.set(new Uint8Array(s),o),o+=s.byteLength}r=r.slice(0);var u=new PDFDoc(e.JR,{buffer:r,docId:e.id});return u.parseByPassword(""),u}))},PDFDoc.prototype.getAllPages=function(){var e=this;return this.getPageCount().then((function(t){for(var n=[],r=0;r<t;r++)n.push(e.getPageByIndex(r).then((function(e){return e.page.IsParsed()||e.parsedPage(),e})));return Promise.all(n)}))},PDFDoc.prototype.getDestinationsArray=function(){var e=this;return this.docPromise.then((function(t){var n=new e.engine.CNP_Destinations(t),r=new e.engine.WStringArray,o=new e.engine.Int32Array,i=new e.engine.Int32Array;n.GetAllDestinations(r,o,i);for(var a=[],s=0;s<r.GetSize();s++){var u=r.GetAt(s),c=o.GetAt(s),d={title:u.toString(),page:c};a.push(d)}return a}))},PDFDoc.prototype.removeMetadata=function(e){var t=this.engine,n=new t.WString(e.toString()),r=new t.Metadata(this.doc),o=r.RemoveCustomerKey(n);return n=null,r=null,o},PDFDoc.prototype.setViewPreference=function(e,t){var n=this.engine,r=this.doc.GetCatalog(),o=this.getVPDict(),i=(0,_constantsString.CString)(n,e),a=(0,_constantsString.CString)(n,t+"");switch(e){case"PageMode":"FullScreen"===(f=getDictName(this.JR,n,r,"PageMode","UseNone"))?o.SetAtName((0,_constantsString.CString)(n,"NonFullScreenPageMode"),a):r.SetAtString(i,a);break;case"PageLayout":"Default"==t?r.RemoveAt(i):r.SetAtString(i,a);break;case"Lang":"none"==t?r.RemoveAt(i):r.SetAtString(i,a);break;case"HideToolbar":case"HideMenubar":case"HideWindowUI":case"CenterWindow":case"DisplayDocTitle":case"PickTrayByPDFSize":o.SetAtBoolean(i,t);break;case"PrintScaling":case"Duplex":case"Direction":o.SetAtName(i,a);break;case"NumCopies":if("Default"==t)o.RemoveAt(i);else{var s=+t;o.SetAtInteger(i,s)}break;case"PrintPageRange":var u=n.PDFArray.Create(),c=new Set;(t=t.replace(/ /g,"")).split(",").forEach((function(e){if(e.indexOf("-")>0)for(var t=e.split("-"),n=Math.min.apply(Math,_toConsumableArray(t))-1,r=Math.max.apply(Math,_toConsumableArray(t))-1,o=n;o<=r;o++)c.add(o);else""!==e&&(e=+e-1,c.add(e))})),c.forEach((function(e){e>=0&&u.AddInteger(e)})),o.SetAt(i,u);break;case"FullScreen":var d=(0,_constantsString.CString)(n,"PageMode"),l=(0,_constantsString.CString)(n,"NonFullScreenPageMode");if(t){var f=getDictName(this.JR,n,r,"PageMode","UseNone");r.SetAtString(d,(0,_constantsString.CString)(n,"FullScreen")),o.SetAtName(l,(0,_constantsString.CString)(n,f))}else{var h=getDictName(this.JR,n,o,"NonFullScreenPageMode");r.SetAtString(d,(0,_constantsString.CString)(n,h)),o.RemoveAt(l)}}},PDFDoc.prototype.getVPDict=function(){var e=this.engine,t=this.doc.GetCatalog(),n=t.GetElement((0,_constantsString.CString)(e,"ViewerPreferences"));return n?n=n.GetDict():(n=e.PDFDictionary.Create(),t.SetAt((0,_constantsString.CString)(e,"ViewerPreferences"),n)),n},PDFDoc.prototype.getViewerPreference=function(){var e=this,t=this.engine,n=this.doc.GetCatalog(),r=getDictName(this.JR,t,n,"PageLayout"),o=getDictName(this.JR,t,n,"PageMode","UseNone"),i=getDictName(this.JR,t,n,"Lang","en-us"),a={},s=n.GetElement((0,_constantsString.CString)(t,"ViewerPreferences"));return s&&(s=s.GetDict()),[["HideToolbar",!1],["HideMenubar",!1],["HideWindowUI",!1],["FitWindow",!1],["CenterWindow",!1],["DisplayDocTitle",!1],["NonFullScreenPageMode"],["PickTrayByPDFSize",!1],["PrintScaling","AppDefault"],["Duplex","Simplex"],["NumCopies"],["Direction","L2R"]].forEach((function(n){var r=_slicedToArray(n,2),o=r[0],i=r[1];a[o]=getDictName(e.JR,t,s,o,i)})),a.PrintPageRange=getPrintRange(s,(0,_constantsString.CString)(t,"PrintPageRange")),{pageLayout:r,uiLayout:o,language:i,viewerPreference:a}},PDFDoc.prototype.getEmbeddedFontData=function(){for(var e=this.doc.GetEmbeddedFontData(),t=e.nonstandard_font_name_array,n=e.standard_font_name_array,r=[],o=[],i=0;i<t.GetSize();i++){var a=t.GetAt(i);o.push(a.toString())}for(var s=0;s<n.GetSize();s++){var u=n.GetAt(s);r.push(u.toString())}return{standard:r,nostandard:o}},PDFDoc.prototype.computeAuditSpace=function(){this.doc;var e=this.engine,t=new e.FX_AuditSpaceSize,n=(e.Optimizer.ComputeAuditSpace(this.doc,t),{});for(var r in t){var o=t[r];"function"!=typeof o&&(n[r]=o)}return n},PDFDoc.prototype.getStreamBySpecifiedDoc=function(e,t){var n=this.engine,r=Promise.resolve(e);return e||(r=this.docPromise),r.then((function(e){var r=(0,_createDeferred2.default)(),o=new ArrayBuffer,i=0,a=!1,s=0,u=0,c=n.WriterCallback.implement({Release:function(){c.delete()},Flush:function(){return r.resolve(o),!0},GetSize:function(){return a?u:o.byteLength},WriteBlock:function(e,t,r){if(a&&(t+=s),o.byteLength<t+r){var i=o;if(o=new ArrayBuffer(t+r),0!==i.byteLength){var u=new Uint8Array(i);new Uint8Array(o).set(u)}}var c=new Uint8Array(o,t,r),d=n.HEAPU8.subarray(e,e+r);return c.set(d),!0},GetPosition:function(){return a?i-s:i},SetPosition:function(e){a&&(e+=s),i=e},IsEOF:function(){var e=a?u:o.byteLength;return i===e},ReadBlock:function(e,t,r){if(a&&(t+=s)+r>u)return!1;var i=new Uint8Array(o,t,r);return n.HEAPU8.set(i,e),!0},SetRange:function(e,t){s=e,u=t,a=!0},ClearRange:function(){a=!1}});return n.saveDoc(e,c,t),r.promise}))},PDFDoc.prototype.optimizer=function optimizer(option,portfolioNodeHandle){var doc=this.doc;portfolioNodeHandle&&this.pdfPortfolio&&(doc=this.pdfPortfolio.getPDFDocByNodeHandle(portfolioNodeHandle));var engine=this.engine,opSetting=new engine.OptimizerSettings;if(option.DC_Algorithm){var imgSetting=new engine.ImageSettings;imgSetting.SetStretchMode(engine.ImageStretchMode[option.DC_Algorithm]),imgSetting.SetCompressionMode(engine.ImageCompressMode[option.CC_Algorithm]),imgSetting.SetQuality(engine.ImageCompressQuality[option.CC_Level]),imgSetting.SetImageDPI(+option.DC_DPISet),imgSetting.SetImageDPILimit(+option.DC_DPIAbove),"e_ImageCompressjpeg2000"===option.CC_Algorithm&&imgSetting.SetTitleSize(+option.compressiontileSize),opSetting.SetColorGrayImageSettings(imgSetting)}if(option.DM_Algorithm){var monoSetting=new engine.MonoImageSettings;monoSetting.SetCompressionMode(engine.MonoImageCompressMode[option.CM_Algorithm]),monoSetting.SetStretchMode(engine.MonoStretchMode[option.DM_Algorithm]),monoSetting.SetImageDPI(+option.DM_DPISet),monoSetting.SetImageDPILimit(+option.DM_DPIAbove),-1===["e_ImageCompressjbig2","e_ImageCompressHigh"].indexOf(option.CM_Algorithm)&&(option.CM_Level=""),"e_ImageCompressQualityLossless"===option.CM_Level||"e_ImageCompressQualityLossy"===option.CM_Level?monoSetting.SetQuality(engine.MonoImageCompressQuality[option.CM_Level]):option.CM_Level&&monoSetting.SetQuality(engine.ImageCompressQuality[option.CM_Level]),opSetting.SetMonoImageSettings(monoSetting)}if(option.unembededFonts&&option.unembededFonts.length>0){var unembeddedFontSettings=new engine.UnembeddedFontSettings,wsArray=new this.engine.WStringArray;option.unembededFonts.forEach((function(e){wsArray.Add((0,_constantsString.CWString)(engine,e))})),unembeddedFontSettings.SetUnembeddedFontNameArray(wsArray),opSetting.SetUnembeddedFontSettings(unembeddedFontSettings)}if(option.D_IntList){var D_IntList_Arr=option.D_IntList.split(",")||[];D_IntList_Arr=D_IntList_Arr.map((function(e){return engine.DiscardObjectsOptions[e].value})),D_IntList_Arr=D_IntList_Arr.join("|"),D_IntList_Arr=eval(D_IntList_Arr),opSetting.SetDiscardObjectsOptions(D_IntList_Arr)}if(option.D_IntList_User){var D_IntList_User_Arr=option.D_IntList_User.split(",")||[];D_IntList_User_Arr=D_IntList_User_Arr.map((function(e){return engine.DiscardUserDataOptions[e].value})),D_IntList_User_Arr=D_IntList_User_Arr.join("|"),D_IntList_User_Arr=eval(D_IntList_User_Arr),opSetting.SetDiscardUserDataOptions(D_IntList_User_Arr)}var isSaveFlagLinearized=doc.IsLinearized();if(option.CL_IntList){var CL_IntList_Arr=option.CL_IntList.split(",")||[];isSaveFlagLinearized=CL_IntList_Arr.indexOf("e_SaveFlagLinearized")>-1,CL_IntList_Arr.splice(CL_IntList_Arr.indexOf("e_SaveFlagLinearized"),1),CL_IntList_Arr=CL_IntList_Arr.map((function(e){return engine.CleanUpOptions[e].value})),CL_IntList_Arr=CL_IntList_Arr.join("|"),CL_IntList_Arr=eval(CL_IntList_Arr),CL_IntList_Arr&&opSetting.SetCleanUpOptions(CL_IntList_Arr)}for(var streamCallback=engine.ImageCompressionCallback.implement({Release:function(){},GetTempFileStream:function(){var e=0,t=engine.StreamCallback.implement({Release:function(){t.delete()},Flush:function(){return!0},GetSize:function(){return e},ReadBlock:function(e,t,n){return!1},WriteBlock:function(t,n,r){return e+=r,!0}});return t}}),pauseCallback=engine.PauseCallback.implement({NeedToPauseNow:function(){return!0}}),progressive=engine.Optimizer.Optimize(doc,opSetting,streamCallback,pauseCallback),optimize_state=engine.ProgressiveState.e_ToBeContinued;optimize_state===engine.ProgressiveState.e_ToBeContinued;)optimize_state=progressive.Continue();return this.getStreamBySpecifiedDoc(doc,isSaveFlagLinearized?engine.SaveFlags.e_SaveFlagLinearized.value:0).then((function(e){return[e]}))},PDFDoc.prototype.optimizeScannedPDF=function(e,t){var n=e.pageRange,r=e.scannedImageCompressMode,o=void 0===r?"e_ImageCompressHigh":r,i=e.quality,a=void 0===i?80:i,s=e.scannedMonoImageCompressMode,u=void 0===s?"e_MonoImageCompressjbig2LossLess":s,c=this.doc,d=this.engine,l=new d.OptimizeScannedPDFSettings;if(n.length>0){var f=new d.Range;n.forEach((function(e){return f.AddSingle(e)})),l.SetOptimizedPages(f)}l.SetColorGrayImageCompressionMode(d.ScannedImageCompressMode[o]),["e_ImageCompressjpeg","e_ImageCompressHigh"].indexOf(o)>-1&&l.SetColorGrayImageCompressionQuality(a),l.SetMonoImageCompressionMode(d.ScannedMonoImageCompressMode[u]);var h=d.ImageCompressionCallback.implement({Release:function(){},GetTempFileStream:function(){var e=new ArrayBuffer,t=d.StreamCallback.implement({Release:function(){t.delete()},Flush:function(){return!0},GetSize:function(){return e.byteLength},ReadBlock:function(t,n,r){var o=new Uint8Array(e,n,r);return d.HEAPU8.set(o,t),!0},WriteBlock:function(t,n,r){if(e.byteLength<n+r){var o=e;if(e=new ArrayBuffer(n+r),0!==o.byteLength){var i=new Uint8Array(o);new Uint8Array(e).set(i)}}var a=new Uint8Array(e,n,r),s=d.HEAPU8.subarray(t,t+r);return a.set(s),!0}});return t}}),p=d.PauseCallback.implement({NeedToPauseNow:function(){return!0}});try{for(var m=d.Optimizer.OptimizeScannedPDF(c,l,h,p),g=-1,y=0;g<100;){if(g=m.GetRateOfProgress(),t&&t(g),3===y)return!1;if(-1===g)throw new Error("optimizeScannedPDF error");0===g?y+=1:m.Continue()}return this.getStreamBySpecifiedDoc(c,0).then((function(e){return[e]}))}catch(e){return!1}},PDFDoc.prototype.importAsLayer=function(e){var t=e.sourcePdfDoc,n=e.sourceFileName,r=e.sourcePageIndex,o=void 0===r?0:r,i=e.importType,a=void 0===i?"e_ImportToCreateNewLayer":i,s=e.newLayerName,u=e.targetLayerName,c=e.targetPageIndex,d=void 0===c?0:c,l=e.targetFileName,f=e.rotateAngle,h=void 0===f?0:f,p=e.isAbsoluteScale,m=void 0!==p&&p,g=e.scale,y=void 0===g?1:g,_=e.verticalOffsetFrom,v=void 0===_?"e_OffsetFromCenter":_,b=e.horizontalOffsetFrom,S=void 0===b?"e_OffsetFromCenter":b,w=e.verticalOffset,M=void 0===w?0:w,D=e.horizontalOffset,P=void 0===D?0:D,T=e.opacity,k=void 0===T?100:T,A=e.appearBehindTarget,L=void 0!==A&&A,F=this.engine;this.doc.GetInfo();v=F.OffsetFrom[v],S=F.OffsetFrom[S],a=F.ImportAsLayerOperationType[a];var I=new F.ImportAsLayerSetting(a,new F.WString(s),new F.WString(u),h,m,y,v,M,S,P,k,L);try{this.doc.ImportAsLayer(d,new F.WString(l),t,new F.WString(n),o,I),this.getPageByIndex(d).then((function(e){e.reParsePage()}));var x=this.pdfLayer.layer_context,C=this.pdfLayer.layer_tree.IsEmpty(),R=new _PDFLayer2.default(this.doc,F);return C||R.layer_context.CopyStates(x),this.pdfLayer=R,this.pdfLayer.toJson()}catch(e){throw new Error("ImportAsLayer error: "+e)}},PDFDoc.prototype.previewImportLayer=function(e){var t=e.sourcePdfDoc,n=e.sourcePageIndex,r=void 0===n?0:n,o=e.importType,i=void 0===o?"e_ImportToCreateNewLayer":o,a=e.targetPageIndex,s=void 0===a?0:a,u=e.rotateAngle,c=void 0===u?0:u,d=e.isAbsoluteScale,l=void 0!==d&&d,f=e.scale,h=void 0===f?1:f,p=e.verticalOffsetFrom,m=void 0===p?"e_OffsetFromCenter":p,g=e.horizontalOffsetFrom,y=void 0===g?"e_OffsetFromCenter":g,_=e.verticalOffset,v=void 0===_?0:_,b=e.horizontalOffset,S=void 0===b?0:b,w=e.opacity,M=void 0===w?100:w,D=e.appearBehindTarget,P=void 0!==D&&D,T=this.engine,k=this.doc.GetPage(s);k.StartParse(T.ParseFlags.e_ParsePageNormal.value,null,!0);var A=k.GetWidth(),L=k.GetHeight(),F=T.DIBFormat.e_DIBArgb,I=new T.Bitmap(A,L,F,0,0);I.FillRect(0,null);var x=T.Rotation.e_Rotation0,C=k.GetDisplayMatrix(0,0,A,L,x),R=new T.Renderer(I,!0),O=T.ContentFlag.e_RenderPage.value|T.ContentFlag.e_RenderAnnot.value;if(!t){var G=this.pdfLayer;return R.SetLayerContext(G.layer_context),R.SetRenderContentFlags(O),R.StartRender(k,C,null),(0,_RendererHelper.getBitmapBuffer)(T,I,R)}m=T.OffsetFrom[m],y=T.OffsetFrom[y],i=T.ImportAsLayerOperationType[i];var E=new T.ImportAsLayerSetting(i,new T.WString(""),new T.WString,c,l,h,m,v,y,S,M,P),Y=t.GetPage(r);Y.StartParse(T.ParseFlags.e_ParsePageNormal.value,null,!1);var j=k.GetBox(T.BoxType.e_MediaBox),N=Y.GetBox(T.BoxType.e_MediaBox),B=new T.Matrix(1,0,0,1,0,0),H=3.14*E.rotate_angle/180,W=new T.Matrix(1,0,0,1,0,0);W.Rotate(H,!1),W.TransformRect(N),B.Concat(W.a,W.b,W.c,W.d,W.e,W.f,!1);var U=new T.Matrix(1,0,0,1,0,0);if(0==E.is_absolute_scale){var z=j.Width()/N.Width(),J=j.Height()/N.Height(),V=parseFloat(z)<parseFloat(J)?z:J;U.Scale(V,V,!1)}U.Scale(E.scale,E.scale,!1),U.TransformRect(N),B.Concat(U.a,U.b,U.c,U.d,U.e,U.f,!1);var K=new T.PointF,q=new T.PointF,Z=E.horizontal_offset;switch(E.horizontal_offset_from){case T.OffsetFrom.e_OffsetFromLeft:K.x=N.left,q.x=j.left;break;case T.OffsetFrom.e_OffsetFromCenter:K.x=N.left+N.Width()/2,q.x=j.left+j.Width()/2;break;case T.OffsetFrom.e_OffsetFromRight:K.x=N.right,q.x=j.right,Z=0-E.horizontal_offset}var X=E.vertical_offset;switch(E.vertical_offset_from){case T.OffsetFrom.e_OffsetFromTop:K.y=N.top,q.y=j.top,X=0-E.vertical_offset;break;case T.OffsetFrom.e_OffsetFromCenter:K.y=N.top-N.Height()/2,q.y=j.top-j.Height()/2;break;case T.OffsetFrom.e_OffsetFromBottom:K.y=N.bottom,q.y=j.bottom}B.Translate(q.x-K.x+Z,q.y-K.y+X,!1);var Q=B;return Q.Concat(C.a,C.b,C.c,C.d,C.e,C.f,!1),R.SetRenderContentFlags(T.ContentFlag.e_RenderPage.value),R.SetRenderLayer(!1),R.StartRender(Y,Q,null),(0,_RendererHelper.getBitmapBuffer)(T,I,R)},PDFDoc.prototype.isCompareDoc=function(){var e=this.doc.GetCatalog();if(!e)return!1;if(!e.HasKey(new this.engine.String("PieceInfo")))return!1;var t=e.GetElement(new this.engine.String("PieceInfo"));return!!t&&(t.GetDict()&&t.GetDict().HasKey(new this.engine.String("ComparePDF")))},PDFDoc.prototype.reloadLayer=function(){return this.pdfLayer&&this.pdfLayer.delete(),this.pdfLayer=new _PDFLayer2.default(this.doc,this.engine),!0},PDFDoc.prototype.exportMeasureData=function(e){var t=e.label,n=void 0===t?"label":t,r=e.type,o=void 0===r?"type":r,i=e.value,a=void 0===i?"value":i,s=e.unit,u=void 0===s?"unit":s,c=e.distance,d=void 0===c?"distance":c,l=e.perimeter,f=void 0===l?"perimeter":l,h=e.area,p=void 0===h?"area":h,m=this.doc,g=this.engine,y=new g.ExportMeasureSetting;y.label_colunm_name=new g.WString(n),y.type_colunm_name=new g.WString(o),y.value_colunm_name=new g.WString(a),y.unit_colunm_name=new g.WString(u),y.type_distance_name=new g.WString(d),y.type_perimeter_name=new g.WString(f),y.type_area_name=new g.WString(p);for(var _=(0,_createDeferred2.default)(),v=0,b=[],S=g.WriterCallback.implement({Release:function(){S.delete(),_.resolve(b)},Flush:function(){return _.resolve(b),!0},GetSize:function(){return v},WriteBlock:function(e,t,n){v+=n;var r=g.HEAPU8.buffer,o=void 0;return o=r.slice?r.slice(e,e+n):new Uint8Array(r,e,n).buffer,b.push(o),!0}}),w=g.PauseCallback.implement({NeedToPauseNow:function(){return!0}}),M=m.StartExportMeasureDataToCSV(y,S,w),D=(M.GetRateOfProgress(),g.ProgressiveState.e_ToBeContinued);g.ProgressiveState.e_ToBeContinued==D;)D=M.Continue(),M.GetRateOfProgress().toString();return _.promise},PDFDoc.prototype.setRenderConfigLineWeight=function(e){this.renderConfigLineWeight=e},PDFDoc.prototype.searchBookmark=function(e,t){var n=this;return this.getBookmarks().then((function(r){if(!n.rootBookmark)return[];var o=[];return n.rootBookmark.search(e,t,o),o}))},PDFDoc.prototype.search=function(e,t,n,r){var o=this;if("number"==typeof e)return-1==e?this.searchBookmark(t,n):this.getPageByIndex(e).then((function(e){return e.search(t,n,r)}));var i=[];return e.forEach((function(e){if(-1==e)return i.push(o.searchBookmark(t,n));i.push(o.getPageByIndex(e).then((function(e){return e.search(t,n,r)})))})),Promise.all(i).then((function(t){return t.reduce((function(t,n,r){return t[e[r]]=n,t}),{})}))},PDFDoc.prototype.convertToTextMarkup=function(e){var t=this,n=[],r={};return e.forEach((function(e){var o=t.pageIndexMap[e.pageIndex];r[e.pageIndex]=1,n.push(o.addAnnot({flags:4,type:"highlight",rect:{left:0,right:0,top:0,bottom:0},coords:e.rects}))})),Promise.all(n).then((function(e){return Object.keys(r)}))},PDFDoc.prototype.generateDocHash=function(e){var t=function(e,t){var n=new Uint8Array(t),r=new e.String,o=e._malloc(n.length);return e.HEAPU8.set(n,o),r.Load(o,n.length),r}(this.engine,e);return this.engine.Library.GenerateHashData(this.engine.CryptType.e_Crypt_SHA256,t,t.GetLength()).toString()},PDFDoc.prototype.redactSearch=function(e,t,n,r,o){var i=this,a=[],s=[];return e.forEach((function(e){if(!e.isMetaData){t<0&&(t+=e.word.length);var u=e.charIndex+t,c=-1==n?e.word.length:n,d="";r.find((function(t){if(t.word.toLowerCase()==e.word.toLowerCase())return d=t.overlay,!0})),s.push(e.pageIndex);var l=i.pageIndexMap[e.pageIndex];"form"===e.type?a.push(l.markRedactByAnnotId(e.id,u,c,d,o)):a.push(l.markRedact(u,c,d,o))}})),Promise.all(a).then((function(e){return s}))},PDFDoc.prototype.removePDFAID=function(){return new this.engine.Metadata(this.doc).RemovePDFAID()},PDFDoc.prototype.isScannedDoc=function(){return this.getAllPages().then((function(e){for(var t=0;t<e.length;t++)for(var n=e[t].page,r=n.GetGraphicsObjectCount(),o=0;o<r;o++){var i=n.GetGraphicsObjectBI(o).GetType().value;if(2!==i&&3!==i)return!1}return!0}))},PDFDoc.prototype.getCompareFileFilterNums=function(){for(var e={Text:0,Images:0,Annotation:0,Formatting:0},t=this.doc.GetPageCount(),n=2;n<t;n++){var r=this.doc.GetPage(n).GetDict().GetElement((0,_constantsString.CString)(this.engine,"Annots"));if(r)for(var o=r.GetArray(),i=o.GetElementCount(),a=0;a<i;a++){var s=o.GetElement(a).GetDict().GetElement((0,_constantsString.CString)(this.engine,"OC"));if(s){var u=s.GetDict().GetElement((0,_constantsString.CString)(this.engine,"VE")).GetArray(),c=u.GetElementCount();if(!(c<=1)){var d=u.GetElement(c-1);if(d)if(!d.GetArray())e[d.GetDict().GetElement((0,_constantsString.CString)(this.engine,"Name")).GetString().toString()]++}}}}return e},PDFDoc.prototype.createSummarizeComments=function(e){var t=this,n=e.writeStream,r=void 0===n?function(){}:n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(0,_createDeferred2.default)(),a=o.layoutType,s=o.commentType,u=o.paperSizeType,c=o.fontSizeType,d=o.sortCommentsByType,l=o.pagesContainingNoComments,f=o.pageIndexes,h=o.color,p=o.opacity,m=o.fileName,g=o.annotTypesInfo,y=o.summarizeCommentsShowInfo,_=void 0===y?{}:y,v=this.engine,b=(0,_createSummarizeCommentsUtil.getEngineSummaryLayout)(v,a),S=(0,_annotType.getEngineAnnotType)(v,s),w=(0,_createSummarizeCommentsUtil.getEngineFontSizeType)(v,c),M=(0,_createSummarizeCommentsUtil.getEngineSortType)(v,d),D=(0,_constantsString.CWString)(v,m),P=_slicedToArray(f,2),T=P[0],k=P[1],A=void 0===k?T:k;try{var L=new v.AnnotationSummary(this.doc),F=new v.AnnotationSummarySettings;F.SetSummaryLayout(b);var I="All"===s;F.SetAnnotType(S,I);var x=(0,_createSummarizeCommentsUtil.getPaperSizeWidthAndHeight)(u),C=new v.CFX_FloatRect(0,0,x[0],x[1]);F.SetPageRect(C),C.delete(),F.SetFontSize(w),F.SetSortType(M),F.SetStartPage(T),F.SetEndPage(A),F.EnableOutputNoAnnotationPage(l),"SeparatePagesWithLine"!==a&&"SinglePageWithLine"!==a||(F.SetConnectorLineColor(h),F.SetConnectorLineOpacity(p)),F.SetFileTitle(D),g.forEach((function(e){var n=e.type,r=e.annotThumbnail,o=(0,_annotType.getEngineAnnotType)(v,n),i=(0,_createSummarizeCommentsUtil.getAnnotThumbnailBitmap)(v,r,t.JR);F.SetAnnotThumbnail(o,i)}));var R=v.AnnotationSummaryCallback.implement({Release:function(){R.delete()},GetCurrentLocaleID:function(){return v.LocaleID.e_LocaleIDUnspecified.value},GetLocalFontName:function(){return new _constantsString.CWString(v,"Helvetica")},LoadString:function(e){return(0,_createSummarizeCommentsUtil.getSummarizeCommentsShowInfoById)(v,e,_)}});L.SetCallback(R);var O=0,G=v.WriterCallback.implement({Release:function(){G.delete()},Flush:function(){return i.resolve(O),!0},GetSize:function(){return O},WriteBlock:function(e,t,n){O=Math.max(t+n,O);var o=v.HEAPU8.buffer,i=void 0;return i=o.slice?o.slice(e,e+n):new Uint8Array(o,e,n).buffer,r(i,t,n),!0}}),E=v.PauseCallback.implement({NeedToPauseNow:function(){return!1}});L.StartSummarize(G,F,E),L.delete(),F.delete()}catch(e){var Y=this.engine.getErrorCode(e);console.error(Y)}return i.promise},PDFDoc.prototype.addAA=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=this.doc,i=this.engine,a=void 0,s=(0,_constantsString.CString)(i,"AA"),u=e.GetElement(s);if(u){var c=u.GetDict();a=new i.AdditionalAction(o,c)}else{var d=i.PDFDictionary.Create();e.SetAt(s,d),a=new i.AdditionalAction(o,d)}var l=i.TriggerEvent.values[n.trigger],f=a.GetAction(l);if(r&&!f.IsEmpty()){var h=f.GetSubActionCount();f.InsertSubAction(h,t)}else a.SetAction(l,t)},PDFDoc.prototype.hasOwnerPassword=function(){return this.doc.HasOwnerPassword()},PDFDoc.prototype.getText=function(e,t,n){var r=this,o=n.taskProgress,i=this.engine,a=new i.PDFDoc,s=new i.String("");a.Load(s);var u=this.doc,c=u.GetPageCount(),d=new i.String("");e.forEach((function(e,t){var n=new i.Range((e+c)%c);a.StartImportPages(t,u,0,d,n)})),this.taskProgressMap[t]=!1;var l="",f=0;!function n(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(r.taskProgressMap[t])return delete r.taskProgressMap[t],o({percent:f,content:l});var u=a.GetPage(s),c=i.FlattenOptions.e_FlattenAll.value;u.Flatten(!0,c);var d=i.ParseFlags.e_ParsePageNormal.value;u.StartParse(d,null,!1);var h=i.TextParseFlags.e_ParseTextNormal.value,p=new i.TextPage(u,h),m=i.TextOrderFlag.e_TextDisplayOrder;u.HasVertWritingFont()&&(m=i.TextOrderFlag.e_TextStreamOrder);var g=p.GetText(m).toString();e[s];if(l+=g,p.delete(),f=Math.round((s+1)/e.length*1e4)/100,s>=e.length-1)return delete r.taskProgressMap[t],o({percent:100,content:l});o({percent:f,content:l}),n(++s)}()},PDFDoc.prototype.cancelTaskProgress=function(e){this.taskProgressMap.hasOwnProperty(e)&&(this.taskProgressMap[e]=!0)},_createClass(PDFDoc,[{key:"attachments",get:function(){return this._attachments||(this._attachments=new _Attachments2.default(this.engine,this.doc)),this._attachments},set:function(e){this._attachments=e}},{key:"pdfPortfolio",get:function(){if(this.doc.IsPortfolio())return this._pdfPortfolio||(this._pdfPortfolio=new _PDFPortfolio2.default(this,this.engine)),this._pdfPortfolio},set:function(e){this._pdfPortfolio=e}}]),PDFDoc}();function getDictName(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"Default";if(!n)return o;var i=n.GetElement((0,_constantsString.CString)(t,r));if(!i)return o;switch(i.GetType().value){case 1:return i.GetBoolean();default:return e.getPDFString(i.GetString())}}function getAnnotsArray(e,t){var n=t.GetDict(),r=(0,_constantsString.CString)(e,"Annots"),o=n.GetElement(r);return o||(o=e.PDFArray.Create(),n.SetAt(r,o)),o.GetDirectObject().GetArray()}function getTemplateObject(e,t,n){var r=(0,_constantsString.CString)(t.engine,"Names"),o=e.GetElement(r),i=null;if(o)for(var a=o.GetArray(),s=a.GetElementCount(),u=0;u<s;u+=2){var c=a.GetElement(u).GetString();if(n===t.JR.getPDFString(c)&&u+1<s){i=a.GetElement(u+1);break}}return i}function getMetadataValues(e,t){for(var n=e.GetValues(t),r="",o=0,i=n.GetSize();o<i;o++)r=n.GetAt(o).toString();return r}function formateDictToJson(e){var t={};if(e)for(var n=0;n=e.MoveNext(n);){var r=e.GetKey(n).toString(),o=formatDictObjToJson(e.GetValue(n));t[r]=o}return t}function formatDictObjToJson(e){var t=void 0;switch(e.GetType().value){case 1:t=e.GetBoolean();break;case 2:t=e.GetFloat();break;case 3:t=e.GetString().toString();break;case 4:t=e.GetName().toString();break;case 5:for(var n=e.GetArray(),r=[],o=n.GetElementCount();o--;)r[o]=formatDictObjToJson(n.GetElement(o));t=r;break;case 6:t=formateDictToJson(e.GetDict());break;case 8:t=null;break;default:t=e.toString()}return t}function retriveDict(e,t,n,r){var o="",i=void 0,a=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];switch(r.GetType().value){case 1:return r.GetString().toString();case 2:var s=r.GetString().toString();return Math.abs(parseInt(s)-parseFloat(s))<.001?parseInt(s):parseFloat(s);case 3:var u=r.GetString(),c=u.GetBuffer();o="<";for(var d=0;d<u.GetLength();d++){var l=e.HEAPU8[c+d];o+=a[(240&l)>>4],o+=a[15&l]}return o+=">";case 4:return"/"+r.GetName().toString();case 5:o=[];for(var f=r.GetArray(),h=f.GetElementCount(),p=0;p<h;p++)o.push(retriveDict(e,t,n,f.GetElement(p)));return o;case 7:o={};var m=r.GetStream();i=m.GetDictionary();var g=m.GetDataSize(!0);if(g){var y=e._malloc(g);r.GetStream().GetData(!0,g,y);for(var _="",v=y;v<y+g;v++){var b=e.HEAP8[v];_+=a[(240&b)>>4],_+=a[15&b]}e._free(y),o.stream=_}case 6:o=o||{},i||(i=r.GetDict()),i||(i=r);var S=i.GetElement((0,_constantsString.CString)(e,"Type"));if(S&&"OCG"==S.GetString().toString())return{};for(var w=i.MoveNext(0);w;){var M=i.GetKey(w),D=i.GetElement(M);o[M.toString()]=retriveDict(e,t,M.toString(),D),w=i.MoveNext(w),M.delete()}return o;case 8:return null;case 9:var P=r.GetDirectObject().GetObjNum();return o=P+"R",t[P]=retriveDict(e,t,n,r.GetDirectObject()),o}return o}function getPDFNameTree(e,t,n){for(var r={},o=new t.PDFNameTree(n,e),i=0,a=o.GetCount();i<a;i++){var s=o.GetName(i),u=o.GetObj(s);if(u){var c=s.toString();if(e.value===t.PDFNameTreeType.e_JavaScript.value){var d=new t.Action(n,u.GetDict());if(d.IsEmpty())continue;var l=new t.JavaScriptAction(d),f=l.GetScript();r[c]=f.toString(),d=null,l=null,f=null}else if(4===e.value||5===e.value){var h=u.GetDict().GetObjNum();r[c]=h,h=null}s.delete(),s=null}}return r}function pageRangeTwoDimensionToOne(e){return e.reduce((function(e,t){if(2===t.length){for(var n=[],r=t[0];r<t[1];r++)n.push(r);t=n}return e.concat(t)}),[])}function pageIndexesToPages(e,t){var n=[];return t.forEach((function(t){n.push(e.getPageByIndex(t))})),Promise.all(n)}function syncPromisesTask(e){var t=[];return e.reduce((function(n,r,o){return n.then((function(n){return r.then((function(n){return t[o]=n,o==e.length-1?t:r}))}))}),Promise.resolve())}function getDB(){if(getDB._db)return getDB._db;var e=new _IndexDBCache2.default("CopyPages_cache","FoxitPDFSDKForWeb_CopyPages_cache");return e.clear(),getDB._db=e,e}function formatMetadataDate(e,t){return-1!=e.indexOf("D:")?e:(0,_formatDate.formatPDFDate)(e)}exports.default=PDFDoc},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={MARKED:"marked",UNMARKED:"unmarked",ACCEPTED:"accepted",REJECTED:"rejected",CANCELLED:"cancelled",COMPLETED:"completed",DEFERRED:"deferred",FUTURE:"future",NONE:"none"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getEngineRectF=function(e,t){return new(0,e.CFX_FloatRect)(t.left,t.bottom,t.right,t.top)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSecureRandom=function(){if((0,o.isRunningInBrowser)()){if(window.crypto)return e=new Uint32Array(1),window.crypto.getRandomValues(e),e[0]/4294967296;if(window.msCrypto)return function(){var e=new Uint32Array(1);return window.msCrypto.getRandomValues(e),e[0]/4294967296}()}var e;return(0,r.prop)("random",Math)()};var r=n(218),o=n(155)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(75);var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.prototype.format=function(e,t,n){return[{type:"string",value:"["+this.levelText(t)+"]"},{type:"string",value:"{"+e+"}"}].concat(n.map((function(e){return null==e?{type:void 0===e?"undefined":r(e),value:e+""}:{type:void 0===e?"undefined":r(e),value:e}})))},e.prototype.levelText=function(e){switch(e){case o.LEVEL_DEBUG:return"DEBUG";case o.LEVEL_INFO:return"INFO";case o.LEVEL_WARN:return"WARN";case o.LEVEL_ERROR:return"ERROR"}return"UNKNOWN LEVEL"},e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NoLogger=void 0;var r=n(75),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(219));function i(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 a(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var u=function(){function e(t,n,r,o){s(this,e),this.appender=t,this.layout=n,this.module=r,this.minLevel=o,this.logOff=!1}return e.prototype.toggle=function(e){this.logOff="boolean"==typeof e?e:!o.logOff},e.prototype.setLevel=function(e){this.minLevel=e},e.prototype.doLog=function(e,t){if(!this.isLoggable(e)){var n=this.layout.format(this.module,e,t);this.appender.print(n,e)}},e.prototype.log=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.doLog(e,n)},e.prototype.debug=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];this.doLog(r.LEVEL_DEBUG,t)},e.prototype.info=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];this.doLog(r.LEVEL_INFO,t)},e.prototype.warn=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];this.doLog(r.LEVEL_WARN,t)},e.prototype.error=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];this.doLog(r.LEVEL_ERROR,t)},e.prototype.isLoggable=function(e){return this.logOff||o.logOff||e<this.minLevel||e<o.logLevel},e}();t.default=u;t.NoLogger=function(e){function t(){return s(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.doLog=function(){},t}(u)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){throw new Error("Method not implemented"+(e?":"+e:""))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(75);var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.prototype.format=function(e,t,n){var o=this,i=(new Error).stack,a=void 0;i&&(a="\n "+i.split("\n")[4].trim());return[{type:"string",style:"color: "+this.levelColor(t)+";",value:"["+this.levelText(t)+"]"},{type:"string",style:"color: magenta",value:"{"+e+"}"}].concat(n.map((function(e){return null==e?{type:void 0===e?"undefined":r(e),style:"color: megenta;font-weight: bold",value:e+""}:"string"==typeof e?{type:void 0===e?"undefined":r(e),style:"color: "+o.levelColor(t),value:e}:{type:void 0===e?"undefined":r(e),value:e}}))).concat({type:"string",style:"color: grey;",value:a})},e.prototype.levelColor=function(e){switch(e){case o.LEVEL_DEBUG:return"blue";case o.LEVEL_INFO:return"green";case o.LEVEL_WARN:return"#5C3C00";case o.LEVEL_ERROR:return"red"}return"#000"},e.prototype.levelText=function(e){switch(e){case o.LEVEL_DEBUG:return"DEBUG";case o.LEVEL_INFO:return"INFO";case o.LEVEL_WARN:return"WARN";case o.LEVEL_ERROR:return"ERROR"}return"UNKNOWN LEVEL"},e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});r(n(220));function r(e){return e&&e.__esModule?e:{default:e}}function o(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var i=function(e){function t(n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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}(this,e.call(this));return r.appenders=n||[],r}return o(t,e),t.prototype.print=function(e,t){this.appenders.forEach((function(n){return n.print(e,t)}))},t}(r(n(156)).default);t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(37),i=(r=o)&&r.__esModule?r:{default:r};var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.createTextWatermark=function(e,t,n,r,o){var i=new e.WString(n),a=new e.Watermark(t,i,r,o);return i.delete(),a},e.createBitmapWatermark=function(e,t,n,r){var o=i.default.createImage(e,n).GetFrameBitmap(0);return new e.Watermark(t,o,r)},e}();t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.createWatermarkSettings=function(e,t,n,r,o,i,a,s,u){var c=e.Position,d=e.WatermarkSettingsFlags,l={TopLeft:c.e_PosTopLeft,TopCenter:c.e_PosTopCenter,TopRight:c.e_PosTopRight,CenterLeft:c.e_PosCenterLeft,Center:c.e_PosCenter,CenterRight:c.e_PosCenterRight,BottomLeft:c.e_PosBottomLeft,BottomCenter:c.e_PosBottomCenter,BottomRight:c.e_PosBottomRight},f={0:d.e_FlagASPageContents,1:d.e_FlagASAnnot,2:d.e_FlagOnTop,4:d.e_FlagNoPrint,8:d.e_FlagInvisible};return new e.WatermarkSettings(l[t],n,r,f[o].value,i,a,s,u)},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.createWatermarkTextProperties=function(e,t,n,r,o,i,a){var s=e.StandardID,u=[s.e_StdIDCourier,s.e_StdIDCourierB,s.e_StdIDCourierBI,s.e_StdIDCourierI,s.e_StdIDHelvetica,s.e_StdIDHelveticaB,s.e_StdIDHelveticaBI,s.e_StdIDHelveticaI,s.e_StdIDTimes,s.e_StdIDTimesB,s.e_StdIDTimesBI,s.e_StdIDTimesI,s.e_StdIDSymbol,s.e_StdIDZapfDingbats],c={normal:e.FontStyle.e_FontStyleNormal,underline:e.FontStyle.e_FontStyleUnderline},d={left:e.Alignment.e_AlignmentLeft,center:e.Alignment.e_AlignmentCenter,right:e.Alignment.e_AlignmentRight},l=new e.Font(u[t]),f=new e.WatermarkTextProperties(l,n,r,c[o.toLocaleLowerCase()],i,d[a.toLocaleLowerCase()]);return l.delete(),f},e}();t.default=r},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=t.RectDiffer=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n;r(this,e),this.top=t,this.left=n,this.bottom=o,this.right=i},i=(t.Rect=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;r(this,e),this.top=t,this.left=n,this.bottom=o,this.right=i},t.Boundary=function e(t,n,o,i){r(this,e),this.top=t,this.left=n,this.bottom=bottom,this.right=right},function(){function e(t){r(this,e),this.offsetLeft=0,this.offsetTop=0,this.offsetRight=0,this.offsetBottom=0,this.target=t}return e.isOverlap=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=Math.max(e.left,t.left),o=Math[n?"min":"max"](e.top,t.top),i=Math[n?"max":"min"](e.bottom,t.bottom),a=Math.min(e.right,t.right);if(r<=a)if(n){if(o>=i)return(a-r)*(o-i)}else if(o<=i)return(a-r)*(i-o);return 0},e.isInRect=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e>=n.left&&e<=n.right)if(r){if(t>=n.bottom&&t<=n.top)return!0}else if(t<=n.bottom&&t>=n.top)return!0;return!1},e.rectInRect=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.left>=t.left&&e.right<=t.right;return!!r&&(n?e.top<=t.top&&e.bottom>=t.bottom:e.top>=t.top&&e.bottom<=t.bottom)},e.on=function(t){return new e(t)},e.subtract=function(e,t){return new o(e.top-t.top,e.left-t.left,e.bottom-t.bottom,e.right-t.right)},e.expandOffset=function(e,t){return new o(e.top-t.top,e.left-t.left,t.bottom-e.bottom,t.right-e.right)},e.copyTo=function(e,t){t.left=e.left,t.top=e.top,t.right=e.right,t.bottom=e.bottom},e.prototype.moveLeft=function(e){return this.offsetLeft+=e,this.offsetRight+=e,this},e.prototype.moveTop=function(e){return this.offsetTop+=e,this.offsetBottom+=e,this},e.prototype.move=function(e,t){return this.moveLeft(e).moveTop(t)},e.prototype.moveTo=function(e,t){return this.offsetLeft=this.offsetRight=this.target.left-e,this.offsetTop=this.offsetBottom=this.target.top-t,this},e.prototype.shrink=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t;return this.add(new o(e,t,-n,-r))},e.prototype.expand=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t;return this.add(new o(-e,-t,n,r))},e.prototype.zoom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"center",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"center",r=this.target.right+this.offsetRight-(this.target.left+this.offsetLeft),i=this.target.bottom+this.offsetBottom-(this.target.top+this.offsetTop),a=r*e,s=i*e,u=a-r,c=s-i,d=0,l=0,f=0,h=0;switch(t){case"right":d=-u;break;case"center":d=-u/2,l=u/2;break;case"left":default:l=u}switch(n){case"bottom":f=-c;break;case"center":f=-c/2,h=c/2;break;case"top":default:h=c}return this.add(new o(f,d,h,l))},e.prototype.add=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.top,n=void 0===t?0:t,r=e.left,o=void 0===r?n:r,i=e.bottom,a=void 0===i?n:i,s=e.right,u=void 0===s?o:s;return this.offsetLeft+=o,this.offsetRight+=u,this.offsetBottom+=a,this.offsetTop+=n,this},e.prototype.extract=function(){var e=this.target.left+this.offsetLeft,t=this.target.right+this.offsetRight;return{left:e,top:this.target.top+this.offsetTop,right:t,bottom:this.target.bottom+this.offsetBottom}},e.prototype.boundary=function(){var e=this.target.left+this.offsetLeft,t=this.target.right+this.offsetRight,n=this.target.top+this.offsetTop;return{left:e,top:n,width:t-e,height:this.target.bottom+this.offsetBottom-n}},e.prototype.intersect=function(t){t instanceof e||(t=e.on(t));var n=this.toPlainObject(),r=t.toPlainObject(),o={left:Math.max(n.left,r.left),right:Math.min(n.right,r.right),top:Math.max(n.top,r.top),bottom:Math.min(n.bottom,r.bottom)};return e.on(o)},e.prototype.toPlainObject=function(){return{left:this.target.left+this.offsetLeft,right:this.target.right+this.offsetRight,top:this.target.top+this.offsetTop,bottom:this.target.bottom+this.offsetBottom}},e}());t.default=i},function(e,t,n){"use strict";n.r(t);var r=function(){function e(e){this.page=e,this.modified=!0,this.currentRotate=0}return e.prototype.reset=function(){this.currentBitmapPromise&&(this.currentBitmapPromise.then((function(e){e.bitmap.delete()})),this.currentBitmapPromise=void 0),this.modified=!0},e.prototype.setCurrentRotate=function(e){this.currentRotate=e},e.prototype.getCurrentImageData=function(){return!this.modified&&this.currentBitmapPromise||(this.currentBitmapPromise=this.page.getBitmap(1,this.currentRotate,void 0,["page","annot"],"print","").then((function(e){return e.renderer.delete(),e.progressive.delete(),delete e.renderer,delete e.progressive,e})),this.modified=!1),this.currentBitmapPromise},e}();t.default=r},function(e,t,n){"use strict";var r;n.r(t),n.d(t,"SNAP_MODE",(function(){return r})),function(e){e.EndPoint="end-point",e.MidPoint="mid-point",e.IntersectionPoint="intersection-point",e.NearestPoint="nearest-point"}(r||(r={}))},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,o="~";function i(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,n,r,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new a(n,r||e,i),u=o?o+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function u(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(o=!1)),c.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(o?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},c.prototype.listeners=function(e){var t=o?o+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,i=n.length,a=new Array(i);r<i;r++)a[r]=n[r].fn;return a},c.prototype.listenerCount=function(e){var t=o?o+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,r,i,a){var s=o?o+e:e;if(!this._events[s])return!1;var u,c,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,r),!0;case 5:return d.fn.call(d.context,t,n,r,i),!0;case 6:return d.fn.call(d.context,t,n,r,i,a),!0}for(c=1,u=new Array(l-1);c<l;c++)u[c-1]=arguments[c];d.fn.apply(d.context,u)}else{var f,h=d.length;for(c=0;c<h;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),l){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,n);break;case 4:d[c].fn.call(d[c].context,t,n,r);break;default:if(!u)for(f=1,u=new Array(l-1);f<l;f++)u[f-1]=arguments[f];d[c].fn.apply(d[c].context,u)}}return!0},c.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,r){var i=o?o+e:e;if(!this._events[i])return this;if(!t)return u(this,i),this;var a=this._events[i];if(a.fn)a.fn!==t||r&&!a.once||n&&a.context!==n||u(this,i);else{for(var s=0,c=[],d=a.length;s<d;s++)(a[s].fn!==t||r&&!a[s].once||n&&a[s].context!==n)&&c.push(a[s]);c.length?this._events[i]=1===c.length?c[0]:c:u(this,i)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=o?o+e:e,this._events[t]&&u(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=o,c.EventEmitter=c,e.exports=c},function(e,t,n){"use strict";function r(e,t){var n=t.renderConfigLineWeight;void 0!==n&&e.SetRenderPathThinLine(!n);var r=t.pageDisplayPreferences;r&&!r.enhanceThinLinesChecked||e.SetRenderEnhanceThinLines(!0)}n.r(t),n.d(t,"setRendererThinLineByDocOps",(function(){return r}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var o="undefined"===("undefined"==typeof URL?"undefined":r(URL))?"undefined"===("undefined"==typeof webkitURL?"undefined":r(webkitURL))?null:webkitURL:URL,i=void 0,a=void 0;"undefined"!==("undefined"==typeof FileReaderSync?"undefined":r(FileReaderSync))?(i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size,r=new FileReaderSync;return r.readAsArrayBuffer(e.slice(t,t+n))},a=function(e){return new Blob([e])}):o?(i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size,r=o.createObjectURL(e),i=new XMLHttpRequest;i.open("GET",r,!1),i.responseType="arraybuffer",i.send(null);var a=i.status;return a>=200&&a<300||304===a?(o.revokeObjectURL(r),(e=i.response).slice?e.slice(t,t+n):new Uint8Array(e,t,n).buffer):null},a=function(e){return new Blob([e])}):(i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.byteLength;return e.slice?e.slice(t,n):new Uint8Array(e,t,n).buffer},a=function(e){return e});var s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.size=t,this.blockSize=8388608,this.blocks=[],this.loadingBlocks=[],this.blobCache=[],this.loadingCache={}}return e.prototype.push=function(e,t){for(var n=this.blocks,r=Math.max(0,e),o=Math.min(e+t,this.size),i=[],a=n.length;a--;){var s=n[a],u=s[0],c=s[1];u<=o&&c>=r&&(r=Math.min(r,u),o=Math.max(o,c),i.push(a))}for(var d=0,l=i.length;d<l;d++)n.splice(i[d],1);n.push([r,o])},e.prototype.avail=function(e,t){for(var n=e,r=e+t,o=this.blocks,i=o.length;i--;){var a=o[i],s=a[0],u=a[1];if(s<=n&&u>=r)return!0}return!1},e.prototype.full=function(){1===this.blocks.length&&0===this.blocks[0][0]&&(this.blocks[0][1],this.size)},e.prototype.checkLoadBuffer=function(e,t){for(var n=e,r=e+t,o=this.loadingBlocks,i=o.length;i--;){var a=o[i],s=a[0],u=a[1];if(s<=n&&u>=r)return!0}return!1},e.prototype.loadingBuffer=function(e,t){for(var n=this.loadingBlocks,r=Math.max(0,e),o=Math.min(e+t,this.size),i=[],a=n.length;a--;){var s=n[a],u=s[0],c=s[1];u<=o&&c>=r&&(r=Math.min(r,u),o=Math.max(o,c),i.push(a))}for(var d=0,l=i.length;d<l;d++)n.splice(i[d],1);n.push([r,o])},e.prototype.addBuffer=function(e,t,n){for(var r=new Uint8Array(n),o=this.blockSize,s=this.blobCache,u=e%o,c=0,d=o-u,l=Math.floor(e/o),f=Math.floor((e+t)/o);l<=f;l++){var h=s[l],p=void 0;h&&(p=i(h)),p||(p=new ArrayBuffer(o));var m=new Uint8Array(p);m.set(r.slice(c,d),u),s[l]=a(m),u=0,c+=o,d+=o}this.push(e,t)},e.prototype.getBuffer=function(e,t){e+t>this.size&&(t=this.size-e);for(var n=new ArrayBuffer(t),r=this.blockSize,o=this.blobCache,a=Math.floor(e/r),s=Math.floor((e+t)/r),u=e%r,c=Math.min(t,r-u),d=0,l=c,f=a,h=s;f<=h;f++){var p=o[f],m=void 0;if(p&&(m=i(p,u,c)),!m)return null;new Uint8Array(n,d,l-d).set(new Uint8Array(m)),u=0,t-=c,d+=c,l+=c=Math.min(t,r-u)}return n},e.prototype._getBufferCacheKey=function(e,t){return[e,t].join("-")},e.prototype.destroy=function(){for(var e=this.blobCache.length;e--;)delete this.blobCache[e]},e}();t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=s(n(38)),o=s(n(85)),i=s(n(105)),a=n(225);function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var c=function(){function e(t,n,r,o){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;u(this,e),this.doc=t,this.engine=t.engine,this.id=n,this.c_bookmark=r,this.c_doc=o,this.title=r.GetTitle().toString();var a=this.c_bookmark.GetColor().toString(16);this.color="#"+a.substr(2);var s=this.c_bookmark.GetStyle();this.isItalic=1&s,this.isBold=2&s,this.dst=r.GetDestination(),this.deep=i;var c=this.dst.IsEmpty();this.children=[],c?(this.pageIndex=null,this.pageTop=0,this.pageLeft=0):(this.pageIndex=this.dst.GetPageIndex(this.c_doc),this.pageTop=this.dst.GetTop(),this.pageLeft=this.dst.GetLeft())}return e.prototype.destroy=function(){this.dst.delete(),this.c_bookmark.delete(),this.children.forEach((function(e){return e.destroy()})),this.children=null,this.c_destination=null,this.c_doc=null,this.engine=null,this.c_bookmark=null},e.prototype.removeChild=function(e){var t=this.children;for(var n in t){var r=t[n];if(r.id==e)return t.splice(n,1),r;var o=r.removeChild(e);if(o)return o}},e.prototype.insert=function(t,n,o,i){var a=new this.engine.WString(t),s=this.c_bookmark.Insert(a,this.engine.BookmarkPosition.values[i]);(0,r.default)(a);var u={destination:{pageIndex:n,left:o.left,top:o.top,zoomMode:"ZoomFitHorz"},type:"TypeGoto"},c=this.doc.JR.actionManager,d=c.create(this.c_doc,u.type);s.SetAction(d),c.get(d,this.c_doc,this.doc.JR).create(u);var l=new e(this.doc,s.GetDict().GetObjNum(),s,this.c_doc,this.deep+1);return this.children.push(l),l},e.prototype.getBookmarkById=function(e){if(e==this.id)return this;var t=this.children;for(var n in t){var r=t[n].getBookmarkById(e);if(r)return r}},e.prototype.remove=function(){var e=this.c_doc.RemoveBookmark(this.c_bookmark);return this.destroy(),e},e.prototype.setProperty=function(e){for(var t in e)if("title"==t){var n=new this.engine.WString(e[t]);this.c_bookmark.SetTitle(n),n.delete(),this.title=this.c_bookmark.GetTitle().toString()}else if("style"==t){this.c_bookmark.SetStyle(e[t]);var r=this.c_bookmark.GetStyle();this.isItalic=1&r,this.isBold=2&r}else if("color"==t){this.c_bookmark.SetColor(e[t]);var o=this.c_bookmark.GetColor().toString(16);this.color="#"+o.substr(2)}else if("destination"==t){var i=e[t],a=new this.engine.Destination.CreateXYZ(this.c_doc,i.pageIndex,i.left,i.top,1);this.c_bookmark.SetDestination(a)}},e.prototype.toJson=function(){if(this.c_bookmark.IsEmpty())return[];var t=[];if(this.children=[],this.c_bookmark.HasChild())for(var n=this.c_bookmark.GetFirstChild();!n.IsEmpty();){var r=new e(this.doc,n.GetDict().GetObjNum(),n,this.c_doc,this.deep+1);n=n.GetNextSibling(),t.push(r.toJson()),this.children.push(r)}return{id:this.id,deep:this.deep,title:this.title,color:this.color,isBold:this.isBold,isItalic:this.isItalic,children:t,page:this.pageIndex,top:this.pageTop,left:this.pageLeft}},e.prototype.moveTo=function(e,t){var n=e.c_bookmark;return this.c_bookmark.MoveTo(n,this.engine.BookmarkPosition.values[t])},e.prototype.getDestination=function(){var e=new this.engine.String("A");if(!this.c_bookmark.GetDict().HasKey(e)){var t=this.c_bookmark.GetDestination();return t.IsEmpty()?void 0:{destination:new i.default(t,this.doc,this.engine).toJson(),objNumber:null,subAction:[],subActionCount:0,type:"TypeGoto"}}(0,r.default)(e)},e.prototype.setDestination=function(e){var t=this.c_bookmark.GetDict(),n=new this.engine.String("A");t.HasKey(n)&&t.RemoveAt(n),(0,r.default)(n);var o=i.default.create(this.engine,this.c_doc,e.destination);return this.c_bookmark.SetDestination(o),{destination:new i.default(o,this.doc,this.engine).toJson(),objNumber:null,subAction:[],subActionCount:0,type:"TypeGoto"}},e.prototype.getAction=function(){var e=new this.engine.String("Dest");if(!this.c_bookmark.GetDict().HasKey(e)){var t=this.c_bookmark.GetAction();return t.IsEmpty()?void 0:this.doc.JR.actionManager.get(t,this.doc,this.doc.JR).toJson()}(0,r.default)(e)},e.prototype.setAction=function(e){var t=this.doc.JR.actionManager,n=t.create(this.c_doc,e.type),o=this.c_bookmark.GetAction();if(o.IsEmpty())this.c_bookmark.SetAction(n);else{var i=o.GetSubActionCount();o.InsertSubAction(i,n),this.c_bookmark.SetAction(o)}var a=this.c_bookmark.GetDict(),s=new this.engine.String("Dest");a.HasKey(s)&&a.RemoveAt(s),(0,r.default)(s),t.get(n,this.c_doc,this.doc.JR).create(e)},e.prototype.moveAction=function(e,t){var n=new this.engine.Action(this.c_doc,this.c_doc.GetIndirectObject(e.objNumber).GetDict());this.c_bookmark.MoveAction(n,t)},e.prototype.removeAction=function(e){if(e){var t=this.c_bookmark.GetAction();return t=(0,o.default)(this.engine,this.c_doc,t,e.objNumber),e.objNumber&&t?(this.c_bookmark.SetAction(t),!0):this.c_bookmark.RemoveAction()}return this.c_bookmark.RemoveAction()},e.prototype.getCanonicalString=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(e){var r=new this.engine.WString(e),o=this.engine.TextSearchUtils.CanonicalFindText(r,t,n),i=o.canonical_text?o.canonical_text.toString():"";return r.delete(),i}},e.prototype.search=function(e,t,n){var r=this,o=!t.wholeWordsOnly&&!t.caseSensitive&&t.stemming,i=this.c_bookmark.GetTitle().toString(),s=i,u=null;if(t.isIgnoreDiacritics||t.isIgnoreAsia){var c=new this.engine.WString(s),d=this.engine.TextSearchUtils.CanonicalFindText(c,t.isIgnoreAsia,t.isIgnoreDiacritics);s=d.canonical_text?d.canonical_text.toString():"";var l=d.text_index_of_len_array,f=[];u=[];for(var h=0;h<=l.GetSize();h++)f[h]=0===h?0:f[h-1]+l.GetAt(h-1),u[f[h]]=h;for(var p=0;p<u.length;p++)void 0===u[p]&&(u[p]=u[p-1]);c.delete()}t.caseSensitive||(s=s.toLowerCase()),e.forEach((function(e){var c=e;t.caseSensitive||(c=c.toLowerCase()),(t.isIgnoreDiacritics||t.isIgnoreAsia)&&(c=r.getCanonicalString(c,t.isIgnoreAsia,t.isIgnoreDiacritics));var d=s.indexOf(c,0),l=void 0;if(o){var f=(l=(0,a.searchStemming)(r.engine,c,i)).next();f.done?d=-1:(d=f.value.index,c=f.value.oriWord)}for(;-1!==d;){var h=r.getCanonicalString(s[d-1]),p=r.getCanonicalString(s[d+c.length]),m=o?c.length:e.length;if(!t.wholeWordsOnly||!(/[0-9a-zA-Z]/.test(h)&&void 0!==h||/[0-9a-zA-Z]/.test(p)&&void 0!==p)){var g=null,y=null,_=d;u?(g=(0,a.getStartText)(i,u[d]),y=(0,a.getEndText)(i,u[d]+m),_=u[d]):(g=(0,a.getStartText)(i,d),y=(0,a.getEndText)(i,d+m)),n.push({startText:g,endText:y,word:i.substr(_,m),type:"bookmark",index:n.length,id:r.id});break}if(o){var v=l.next();v.done?d=-1:(d=v.value.index,c=v.value.oriWord)}else d=s.indexOf(c,d+1)}})),this.children.forEach((function(r){return r.search(e,t,n)}))},e}();t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(631),i=(r=o)&&r.__esModule?r:{default:r},a=n(3),s=n(104);var u=function(){function e(t,n,r,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.jrDoc=t,this.engineForm=n,this.engine=r,this.JR=o,this.fields={},this.changedWidget={}}return e.prototype.destroy=function(){this.engine=null,this.JR=null;var e=this.fields;for(var t in e){var n=e[t];0!==Object.keys(n).length&&n.destroy(),e[t]=null}this.fields=null,this.engineForm.delete(),this.engineForm=null},e.prototype.getField=function(e){return this.fields[e]},e.prototype.addJRField=function(e,t,n){var r=new i.default(this.jrDoc,this.engineForm,e,this.engine,this.JR);return this.fields[t||n]=r,r},e.prototype.setFieldsValue=function(e,t){for(var n in e)this.fields[n].setValue(e[n],t)},e.prototype.getFieldsValue=function(){var e={};for(var t in this.fields)e[t]=this.fields[t].getValue();return e},e.prototype.toJson=function(){for(var e=this.engineForm,t=e.NeedConstructAppearances(),n=(0,a.CWString)(this.engine,""),r=e.GetFieldCount(n),o=[],s=0;s<r;s++)try{var u=e.GetField(s,n);if(u.IsEmpty()){o.push({}),this.fields[s]={};continue}7==u.GetType().value&&(u=new this.engine.Signature(u));var c=new i.default(this.jrDoc,e,u,this.engine,this.JR),d=c.toJson(s);this.fields[u.GetName().toString()||s]=c,o.push(d)}catch(e){o.push({}),this.fields[s]={}}return Promise.all(o).then((function(n){for(var r=e.GetFieldsInCalculationOrder(),o=[],i=0;i<r.GetSize();i++){var a=r.GetAt(i);o.push(a.GetName().toString())}r.delete();var s=e.GetDefaultAppearance(),u=e.GetAlignment().value,c="",d="";try{s.font.IsEmpty()||(c=s.font.GetName().toString(),d=(d=s.font.GetFamilyName().toString()).replace(" ","").replace("-",""),s.font.IsBold()&&(d+="Bold"),s.font.IsItalic()&&(d+="Italic"))}catch(e){console.error("font name error")}return{needConstructAppearances:t,fields:n,DefaultAppearance:{flags:s.flags,fontName:c,textColor:s.text_color,textSize:s.text_Size,fullName:d},calculationOrder:o,alignment:u}}))},e.prototype.updateFormControl=function(e,t,n,r){var o=this.engineForm.GetDocument(),i=o.GetIndirectObject(t).GetDict(),u=(0,a.CString)(this.engine,"F"),d=0;i.GetElement(u)&&(d=i.GetElement(u).GetInteger());var l=this.engine;switch(this.changedWidget[t]=1,n){case"exportValue":var f=this.getControlByObjNum(e,t);f.SetExportValue((0,a.CWString)(l,r));for(var h=f.GetField(),p=h.GetControlCount(),m=[],g=0;g<p;g++){var y=h.GetControl(g);m.push(y.GetExportValue().toString())}return m;case"display":switch(r){case 0:d&=-2,d&=-3,d&=-33,d|=4;break;case 1:d&=-2,d&=-33,d|=6;break;case 2:d&=-2,d&=-5,d&=-3,d&=-33;break;case 3:d|=32,d|=4,d&=-3}i.SetAtInteger(u,d);break;case"hidden":r?d|=2:d&=-3,i.SetAtInteger(u,d);break;case"fillColor":case"borderColor":c(l,i,n,r);break;case"action":if(!r.data)break;var _=this.JR.actionManager.create(o,r.data.type);-1==r.trigger?i.SetAtReference((0,a.CString)(l,"A"),_.GetDict(),o):this.addAAToDict(i,_,r),this.JR.actionManager.get(_,o,this.JR).create(r.data);break;case"DA":var v=this.getControlByObjNum(e,t);if(!v)return;var b=JSON.parse(r),S=void 0!==b.fontName?l.DefAPFlags.e_FlagFont.value:0,w=void 0!==b.textColor?l.DefAPFlags.e_FlagTextColor.value:0,M=void 0!==b.textSize?l.DefAPFlags.e_FlagFontSize.value:0,D=void 0;if(b.fontName){var P=(0,s.mapFontName2StdID)(b.fontName);if(P){var T=[l.StandardID.e_StdIDCourier,l.StandardID.e_StdIDCourierB,l.StandardID.e_StdIDCourierBI,l.StandardID.e_StdIDCourierI,l.StandardID.e_StdIDHelvetica,l.StandardID.e_StdIDHelveticaB,l.StandardID.e_StdIDHelveticaBI,l.StandardID.e_StdIDHelveticaI,l.StandardID.e_StdIDTimes,l.StandardID.e_StdIDTimesB,l.StandardID.e_StdIDTimesBI,l.StandardID.e_StdIDTimesI,l.StandardID.e_StdIDSymbol,l.StandardID.e_StdIDZapfDingbats];D=new this.engine.Font(T[P])}else{var k=this.JR.getFontInfoByFontName(b.fontName),A=k.charset,L=k.style;D=new this.engine.Font((0,a.CWString)(l,b.fontName),L,A,0)}}else D=new this.engine.Font(0);var F=new this.engine.DefaultAppearance(S|w|M,D,b.textSize?b.textSize:0,b.textColor?b.textColor:0);try{v.SetDefaultAppearance(F)}catch(e){return isNaN(e)||(e=l.getErrorCode(e)),void console.warn(e)}}},e.prototype.getControlByObjNum=function(e,t){for(var n=this.fields[e].engineField,r=n.GetControlCount(),o=void 0,i=0;i<r;i++){var a=n.GetControl(i);if(t==a.GetDictionaryObjectNumber()){o=a;break}}return o},e.prototype.addAAToDict=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=this.engine,i=this.engineForm;i.GetDocument();if(this.jrDoc.addAA(e,t,n,r),10===n.trigger){for(var s=i.GetFieldsInCalculationOrder(),u=(0,a.CWString)(o,n.field),c=i.GetField(0,u),d=0;d<s.GetSize();d++){var l=s.GetAt(d);if(l.GetName().toString()==c.GetName().toString())return}s.Add(c),i.SetFieldsInCalculationOrder(s)}},e.prototype.hasWidgetChanged=function(e){var t=this.changedWidget[e];return delete this.changedWidget[e],t},e.prototype.copyControls=function(e,t,n){var r=this,o=this.engine,i=this.engineForm,s=(i.GetDocument(),o.TriggerEvent,[]);return n.forEach((function(e){var n=r.getField(e.fieldName),u=n.engineField,c=e.rect,d=c.left,l=c.right,f=c.top,h=c.bottom,p=new o.CFX_FloatRect(d,h,l,f),m=r.getWidget(u,e.srcObjectNumber);if(m){var g=i.AddControl(t.page,(0,a.CWString)(o,e.fieldName),u.GetType(),p);s.push(n);var y=g.GetWidget();r.copyWidget(m,y)}})),t.update(),Promise.all(s.map((function(e){return e.getControlsJson()}))).then((function(e){return s.map((function(t,n){return{fieldName:t.engineField.GetName().toString(),controlJsons:e[n]}}))}))},e.prototype.getWidget=function(e,t){for(var n=0,r=e.GetControlCount();n<r;n++){if(e.GetControl(n).GetDictionaryObjectNumber()==t)return e.GetControl(n).GetWidget()}},e.prototype.copyWidget=function(e,t){var n=this.engine,r=e.GetMKRotation();4!=r.value&&t.SetMKRotation(r);var o=e.GetMKBorderColor();o&&t.SetMKBorderColor(o),(o=e.GetMKBackgroundColor())&&t.SetMKBackgroundColor(o);var i=e.GetMKNormalCaption();i.toString().length&&t.SetMKNormalCaption(i),(i=e.GetMKRolloverCaption()).toString().length&&t.SetMKRolloverCaption(i),(i=e.GetMKDownCaption()).toString().length&&t.SetMKDownCaption(i);var a=e.GetMKNormalIconBitmap();if(a.IsEmpty()||t.SetMKNormalIconBitmap(a),(a=e.GetMKRolloverIconBitmap()).IsEmpty()||t.SetMKRolloverIconBitmap(a),(a=e.GetMKDownIconBitmap()).IsEmpty()||t.SetMKDownIconBitmap(a),1===e.GetField().GetType().value){var s=e.GetMKIconFit();void 0===s.scale_way_type&&(s.scale_way_type=n.ScaleWayType.e_ScaleWayAlways),t.SetMKIconFit(s)}t.SetMKIconCaptionRelation(e.GetMKIconCaptionRelation());var u=e.GetAppearanceState();u.toString().length&&t.SetAppearanceState(u),t.SetBorderInfo(e.GetBorderInfo());var c=e.GetControl();t.GetControl().SetDefaultAppearance(c.GetDefaultAppearance()),t.SetFlags(e.GetFlags());var d=e.GetAction();d.IsEmpty()||t.SetAction(d);for(var l=new n.AdditionalAction.CreateFromAnnot(e),f=new n.AdditionalAction.CreateFromAnnot(t),h=11;h<17;h++){var p=n.TriggerEvent.values[h],m=l.GetAction(p);m.IsEmpty()||f.SetAction(p,m)}t.ResetAppearanceStream()},e.prototype.duplicateWidget=function(e,t,n){var r=this,o=this.getField(t),i=o.engineField,s=this.getWidget(i,n);return e.forEach((function(e){i.GetControlCount(e.page);var n=r.engineForm.AddControl(e.page,(0,a.CWString)(r.engine,t),i.GetType(),s.GetRect()).GetWidget();r.copyWidget(s,n),e.update()})),o.getControlsJson()},e.prototype.duplicateField=function(e,t,n,r,o,i){var s=this,u=this.engine,c=this.engineForm,d=this.jrDoc,l=this.getField(e),f=this.getWidget(l.engineField,n),h=(0,a.CWString)(u,e);return i.map((function(e){var n=e.left,r=e.right,o=e.top,i=e.bottom,a=new u.CFX_FloatRect(n,i,r,o);return c.AddControl(t.page,h,l.engineField.GetType(),a)})).map((function(e){var t=e.GetWidget();return s.copyWidget(f,t),e})).splice(0,0,l.engineField.GetControl(0)),delete d.form,this.destroy(),t.update(),d},e.prototype.setCO=function(e){var t=this.engine,n=this.engineForm,r=new t.FieldArray;e.forEach((function(e){var o=(0,a.CWString)(t,e);r.Add(n.GetField(0,o))})),n.SetFieldsInCalculationOrder(r)},e}(),c=function(e,t,n,r){try{n="fillColor"==n?"BG":"BC";var o=t.GetElement((0,a.CString)(e,"MK"));if(!o)return void console.error("no MK Dictionary");o=o.GetDict();var i=(0,a.CString)(e,n);if(0===r)return void o.RemoveAt(i);var s=o.GetElement(i);if(s)for(var u=(s=s.GetArray()).GetElementCount(),c=[e.PDFObject.CreateFromFloat(((16711680&r)>>16)/256),e.PDFObject.CreateFromFloat(((65280&r)>>8)/256),e.PDFObject.CreateFromFloat((255&r)/256)],d=0;d<=u-1;d++)c[d]&&s.SetAt(d,c[d]);else(s=e.PDFArray.Create()).AddFloat(((16711680&r)>>16)/256),s.AddFloat(((65280&r)>>8)/256),s.AddFloat((255&r)/256);o.SetAt(i,s)}catch(e){console.error(e)}};t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=s(n(632)),o=n(3),i=s(n(38)),a=n(633);function s(e){return e&&e.__esModule?e:{default:e}}var u={e_KeyNameSigner:"signer",e_KeyNameLocation:"location",e_KeyNameReason:"reason",e_KeyNameContactInfo:"contact",e_KeyNameDN:"DN",e_KeyNameText:"text"},c=function(){function e(t,n,r,o,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.jrDoc=t,this.engineForm=n,this.engineField=r,this.engine=o,this.JR=i,this.label=""}return e.prototype.destroy=function(){this.engineField.delete(),this.engineForm=null,this.engineField=null,this.engine=null,this.JR=null},e.prototype.update=function(e,t){var n=this,r=this.engineField,s=this.engine,u=void 0,c=void 0,d=r.GetValue(),l=!1;switch(e){case"align":r.SetAlignment({value:t});break;case"flag":var f=r.GetDict(),h=(0,o.CString)(s,"Ff"),p=f.GetElement(h);l=16789512&((p?p.GetInteger():0)^t),r.SetFlags(t);break;case"maxLength":if(void 0===t){var m=new s.String("MaxLen");r.GetDict().RemoveAt(m),(0,i.default)(m)}else r.SetMaxLength(t);break;case"defaultValue":if(void 0===t){var g=new s.String("DV");r.GetDict().RemoveAt(g),(0,i.default)(g)}else c=new s.WString(t),r.SetDefaultValue(c),(0,i.default)(c);break;case"clearItems":var y=new s.ChoiceOptionArray;r.SetOptions(y),(0,i.default)(y);break;case"deleteItems":u=r.GetOptions();for(var _=new s.ChoiceOptionArray,v=0,b=u.GetSize();v<b;v++){var S=u.GetAt(v);if(v!=t)_.Add(S);else{r.GetValue().toString();S.option_value.toString()}}r.SetOptions(_),(0,i.default)(_);break;case"insertItemAt":var w=new s.ChoiceOption;w.option_value=new s.WString(""+t.value),w.option_label=new s.WString(t.label),w.selected=t.selected,w.default_selected=t.defaultSelected,u=r.GetOptions(),t.index<0||t.index>=u.GetSize()?u.Add(w):u.InsertAt(t.index,w),r.SetOptions(u),(0,i.default)(w,w.option_value,w.option_label);break;case"alternateName":if(""==t){var M=new s.String("TU");r.GetDict().RemoveAt(M),(0,i.default)(M);break}c=new s.WString(t),r.SetAlternateName(c),(0,i.default)(c);break;case"textColor":var D=r.GetDefaultAppearance();D.text_color=+t,r.SetDefaultAppearance(D);break;case"setItems":u=new s.ChoiceOptionArray;var P=!1;t.map((function(e){if(0!==e.value.length&&0!==e.label.length){var t=new s.ChoiceOption;t.option_value=new s.WString(""+e.value),t.option_label=new s.WString(""+e.label),(t.selected=e.selected)&&(P=!0,n.label=t.option_label),t.default_selected=e.defaultSelected,u.Add(t),(0,i.default)(t,t.option_value,t.option_label)}})),r.SetOptions(u),4==r.GetType().value&&P&&r.SetValue(this.label);break;case"displayValue":r.SetValue((0,o.CWString)(s,t)),this.label=t;break;case"AA":var T,k=t.trigger,A=t.data,L=this.JR.actionManager,F=this.jrDoc.doc;T=L.create(F,A.type),this.jrDoc.form.addAAToDict(r.GetDict(),T,{trigger:k,field:t.field});var I=L.get(T,this.jrDoc,this.JR);return I.create(A),I.toJson()}for(var x=r.GetControlCount(),C=0;C<x;C++){var R=r.GetControl(C).GetWidget();R.IsEmpty()||(l||"flag"!=e||t&a.FieldFlag.ButtonRadiosInUnison)&&R.ResetAppearanceStream()}this.label.length>0&&r.GetDict().SetAtWString((0,o.CString)(s,"V"),d);4==r.GetType().value&&(this.label="")},e.prototype.setValue=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Array.isArray(e)&&(e=e.map((function(e){return"("+e+")"})).join(""));var n=new this.engine.WString(e+"");if(this.engineField.SetValue(n),n.delete(),this.label="",t){var r=this.engineField,o=r.GetType(),i=r.GetValue();if(4==o.value)for(var a=r.GetOptions(),s=(i.toString(),0),u=a.GetSize();s<u;s++){var c=a.GetAt(s);if(c.selected){r.SetValue(c.option_label);break}}for(var d=0;d<this.engineField.GetControlCount();d++){var l=this.engineField.GetControl(d).GetWidget();!l.IsEmpty()&&l.ResetAppearanceStream()}4==o.value&&r.SetValue(i)}},e.prototype.getValue=function(){var e=this.engineField.GetFlags(),t=this.engineField.GetType().value;if(256==(256&e)&&5===t){for(var n=this.engineField.GetOptions(),r=[],o=0,i=n.GetSize();o<i;o++){var a=n.GetAt(o);a.selected&&r.push(a.option_value.toString())}return r}return this.engineField.GetValue().toString()},e.prototype.getControlsJson=function(){for(var e=[],t=this.engineField.GetControlCount(),n=0;n<t;n++){var o=this.engineField.GetControl(n),i=new r.default(this.jrDoc,o,this.engine);e.push(i.toJson()),i.destroy()}return Promise.all(e)},e.prototype.toJson=function(e){var t=this;try{for(var n=this.engineField,i=n.GetAlignment().value,a=n.GetAlternateName().toString(),s=[],u=n.GetControlCount(),c=0;c<u;c++){var d=n.GetControl(c);d=new r.default(this.jrDoc,d,this.engine),s.push(d.toJson()),d.destroy()}return Promise.all(s).then((function(e){var r=n.GetDefaultAppearance(),s=n.GetDefaultValue().toString(),u=0,c=n.GetDict();if(c){var d=(0,o.CString)(t.engine,"Ff"),l=c.GetElement(d);l&&(u=l.GetInteger())}var f=n.GetMappingName().toString(),h=n.GetMaxLength(),p=n.GetName().toString(),m=n.GetValue().toString(),g=n.GetType().value,y=n.GetOptions(),_=[];if(4===g||5===g){for(var v=[],b=0,S=y.GetSize();b<S;b++){var w=y.GetAt(b);_.push({label:w.option_label.toString(),value:w.option_value.toString(),selected:w.selected,defaultSelected:w.default_selected}),w.selected&&v.push(w.option_value.toString())}5===g&&(m=v.length>0?v.length>1?v:v[0]:"")}var M=n.GetTopVisibleIndex(),D=n.IsEmpty(),P="",T=!1;try{if(!r.font.IsEmpty()){var k=t.engineForm.GetDocument();P=t.JR.getPDFString(r.font.GetName()),T=r.font.IsEmbedded(k)}}catch(e){isNaN(e)||(e=engine.getErrorCode(e)),console.warn(e)}var A={alignment:i,alternateName:a,controls:e,DA:{flags:r.flags,fontName:P,textColor:r.text_color,textSize:r.text_size,isEmbedded:T},defaultValue:s,flag:u,mappingName:f,maxLength:h,name:p,options:_,topVisibleIndex:M,type:g,value:m,isEmpty:D,AA:t.getAAJson()};return 7===g&&t.getSignatureInfo(A),A}))}catch(e){return isNaN(e)||(e=engine.getErrorCode(e)),console.warn(e),{}}},e.prototype.getAAJson=function(){var e={},t=this.engineField.GetDict(),n=this.engine,r=t.GetElement((0,o.CString)(n,"AA"));if(r&&r.GetDict()){9==r.GetType().value&&(r=r.GetDirectObject());for(var i=r.GetDict(),a=new n.AdditionalAction(this.engineForm.GetDocument(),i),s=n.TriggerEvent,u=7;u<17;u++){var c=a.GetAction(s.values[u]);c.IsEmpty()||(e[u]=this.JR.actionManager.get(c,this.jrDoc,this.JR).toJson())}}return e},e.prototype.getSignatureInfo=function(e){var t=this.engine,n=this.engineField,r=e.isSigned=n.IsSigned(),i=n.GetFieldMDPAction().value,a=(e.lockAction={type:i},e.lockAction.fields=[]);if(i>1)for(var s=n.GetFieldMDPActionFields(),c=0;c<s.GetSize();c++)a.push(s.GetAt(c).toString());if(r){e.filter=n.GetFilter().toString(),e.subfilter=n.GetSubFilter().toString(),Object.keys(u).forEach((function(r){e[u[r]]=n.GetKeyValue(t.KeyName[r]).toString()}));var d=n.GetSignTime();d.IsValid()&&(d=d.ToUTCTime(),e.signTime=Date.UTC(d.year,d.month-1,d.day,d.hour,d.minute,d.second,d.milliseconds)),e.apFlag=n.GetAppearanceFlags(),e.isTimeStamp=n.IsTimeStamp();var l=n.GetDict(),f=n.GetBitmap();e.image=f.IsEmpty()?"":this.bitmapParseBlob(f),f.delete();var h=l.GetElement((0,o.CString)(t,"V")).GetDict().GetElement((0,o.CString)(t,"ByteRange")).GetArray(),p=e.byteRange=[];if(h)for(var m=h.GetElementCount(),g=0;g<m;g++)p.push(h.GetElement(g).GetInteger())}},e.prototype.setLockAction=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=this.engine,r=new n.WStringArray;0!=e?(t.forEach((function(e){r.Add((0,o.CWString)(n,e))})),this.engineField.SetFieldMDPActionFields({value:e},r)):this.engineField.GetDict().RemoveAt((0,o.CString)(n,"Lock"))},e.prototype.bitmapParseBlob=function(e){var t=this.engine,n="";if(!e.IsEmpty()){e.ConvertFormat(t.DIBFormat.e_DIBArgb);var r=e.GetWidth(),o=e.GetHeight(),i=e.GetBuffer(),a=o*e.GetPitch(),s=i+a,u=void 0;u=t.HEAPU8.buffer.slice?t.HEAPU8.buffer.slice(i,s):new Uint8Array(t.HEAPU8.buffer,i,a).buffer;var c=new Uint8Array(u),d=0,l=0,f=e.GetPitch();for(d=0;d<o;d++)for(l=0;l<r;l++){var h=d*f,p=[c[4*l+2+h],c[4*l+h]];c[4*l+h]=p[0],c[4*l+2+h]=p[1]}n={start:i,size:a,width:r,height:o,buffer:u}}return n},e}();t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.jrDoc=t,this.engineControl=n,this.engine=r}return e.prototype.destroy=function(){this.engineControl.delete(),this.engineControl=null,this.engine=null},e.prototype.toJson=function(){var e=this.engineControl,t=e.GetIndex(),n=e.IsChecked(),r=e.IsDefaultChecked(),o=e.IsEmpty();if(o)return{};var i=e.GetExportValue().toString(),a=e.GetDictionaryObjectNumber(),s=void 0,u=void 0,c="",d="";s=e.GetDefaultAppearance();try{s.font.IsEmpty()||(u=s.font.IsEmbedded(this.jrDoc.doc),c=s.font.GetName().toString(),d=(d=s.font.GetFamilyName().toString()).replace(" ","").replace("-",""),s.font.IsBold()&&(d+="Bold"),s.font.IsItalic()&&(d+="Italic"))}catch(e){isNaN(e)||(e=engine.getErrorCode(e)),console.warn(e)}return Promise.resolve().then((function(e){return Object.assign({},{index:t,isChecked:n,isDefaultChecked:r,isEmpty:o,objectNumber:a,exportValue:i},s?{DA:{flags:s.flags,textColor:s.text_color,textSize:s.text_size,isEmbedded:u,fontName:c,fullName:d}}:{})}))},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={ReadOnly:1,Required:2,NoExport:4,Hidden:8,ButtonNoToggleToOff:16384,ButtonRadiosInUnison:33554432,TextMultiline:4096,TextPassword:8192,TextDoNotSpellCheck:4194304,TextDoNotScroll:8388608,TextComb:16777216,ComboEdit:262144,ChoiceMultiSelect:2097152,CommitOnSelChange:67108864,inUnison:function(e){return e&r.ButtonRadiosInUnison},isHidden:function(e){return e&r.Hidden},isReadOnly:function(e){return e&r.ReadOnly},isRequired:function(e){return e&r.Required},isNoExport:function(e){return e&r.NoExport},isMultiline:function(e){return e&r.TextMultiline},isPassword:function(e){return e&r.TextPassword},isComb:function(e){return e&r.TextComb},isNoSpellCheck:function(e){return e&r.TextDoNotSpellCheck},isNoScroll:function(e){return e&r.TextDoNotScroll},isComboEdit:function(e){return e&r.ComboEdit},isChoiceMultiSelect:function(e){return e&r.ChoiceMultiSelect}},o={FlagExclude:1,FlagIncludeNoValueFields:2,FlagExportFormat:4,FlagGetMethod:8,FlagWithCoordinates:16,FlagAsXFDF:32,FlagIncludeAppendSaves:64,FlagIncludeAnnotations:128,FlagSubmitAsPDF:256,FlagCanonicalFormat:512,FlagExclNonUserAnnots:1024,FlagExclFKey:2048,FlagEmbedForm:8192,isExclude:function(e){return e&o.FlagExclude},isIncludeNoValueFields:function(e){return e&o.FlagIncludeNoValueFields},isHTML:function(e){return e&o.FlagExportFormat},isGetMethod:function(e){return e&o.FlagGetMethod},isXFDF:function(e){return e&o.FlagAsXFDF},isPDF:function(e){return e&o.FlagSubmitAsPDF},getType:function(e){var t=o.isHTML(e);if(t)return"HTML";var n=o.isXFDF(e);if(n)return"XFDF";var r=o.isPDF(e);return r?"PDF":t||n||r?void 0:"FDF"}},i={Unknown:0,PushButton:1,CheckBox:2,RadioButton:3,Text:6,ListBox:5,ComboBox:4,Sign:7,Barcode:8},a=r;t.FieldType=i,t.FieldFlag=a,t.FormActionFlags=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={None:"none",RC4:"rc4",AES128:"aes128",AES256:"aes256"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Unknown:-1,Signature:0,Encryption:1,SignatureAndEncryption:2}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pdfDoc=t,this.pdfObject=n}return e.prototype.getDict=function(){return this.pdfObject.GetDict()},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3);t.default=function(e,t,n,o){var i=new e.HeaderFooterContentGenerator,a=n.contentFormats,s=n.contents,u=[a.TopLeft||(s?[{type:"string",value:s.TopLeft}]:[]),a.TopCenter||(s?[{type:"string",value:s.TopCenter}]:[]),a.TopRight||(s?[{type:"string",value:s.TopRight}]:[]),a.BottomLeft||(s?[{type:"string",value:s.BottomLeft}]:[]),a.BottomCenter||(s?[{type:"string",value:s.BottomCenter}]:[]),a.BottomRight||(s?[{type:"string",value:s.BottomRight}]:[])];u=u.map((function(t){t.forEach((function(t){switch(t.type){case"string":return i.AddString((0,r.CWString)(e,t.value));case"pageNumber":return i.AddPageNumber({value:t.value});case"date":return i.AddDate({value:t.value})}}));var n=i.GenerateContent();i.Clear();var o=n.toString().replace(/([^ ])<</g,"$1 <<");return(0,r.CWString)(e,o)})),i.delete();var c=new e.HeaderFooterContent;c.Set.apply(c,function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(u));var d=void 0;d=o&&t.HasHeaderFooter()?t.GetEditableHeaderFooter():new e.HeaderFooter;var l="number"==typeof n.font?n.font:n.fontId,f=new e.Font({value:l||0}),h=new e.PageNumberRange;n.range?h.Set(n.range.start,n.range.end,{value:n.range.filter||0}):h.Set(1,t.GetPageCount(),{value:0});var p=new e.CFX_FloatRect;if(n.margin){var m=n.margin;p.left=m.left,p.bottom=m.bottom,p.top=m.top,p.right=m.right}return d.Set(f,n.textSize,n.textColor,h,p,n.hasTextShrinked,n.hasFixedSized,n.startPageNumber,c,!1,n.underline),c.delete(),h.delete(),p.delete(),d}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){var r={"./af":229,"./af.js":229,"./ar":230,"./ar-dz":231,"./ar-dz.js":231,"./ar-kw":232,"./ar-kw.js":232,"./ar-ly":233,"./ar-ly.js":233,"./ar-ma":234,"./ar-ma.js":234,"./ar-sa":235,"./ar-sa.js":235,"./ar-tn":236,"./ar-tn.js":236,"./ar.js":230,"./az":237,"./az.js":237,"./be":238,"./be.js":238,"./bg":239,"./bg.js":239,"./bm":240,"./bm.js":240,"./bn":241,"./bn-bd":242,"./bn-bd.js":242,"./bn.js":241,"./bo":243,"./bo.js":243,"./br":244,"./br.js":244,"./bs":245,"./bs.js":245,"./ca":246,"./ca.js":246,"./cs":247,"./cs.js":247,"./cv":248,"./cv.js":248,"./cy":249,"./cy.js":249,"./da":250,"./da.js":250,"./de":251,"./de-at":252,"./de-at.js":252,"./de-ch":253,"./de-ch.js":253,"./de.js":251,"./dv":254,"./dv.js":254,"./el":255,"./el.js":255,"./en-au":256,"./en-au.js":256,"./en-ca":257,"./en-ca.js":257,"./en-gb":258,"./en-gb.js":258,"./en-ie":259,"./en-ie.js":259,"./en-il":260,"./en-il.js":260,"./en-in":261,"./en-in.js":261,"./en-nz":262,"./en-nz.js":262,"./en-sg":263,"./en-sg.js":263,"./eo":264,"./eo.js":264,"./es":265,"./es-do":266,"./es-do.js":266,"./es-mx":267,"./es-mx.js":267,"./es-us":268,"./es-us.js":268,"./es.js":265,"./et":269,"./et.js":269,"./eu":270,"./eu.js":270,"./fa":271,"./fa.js":271,"./fi":272,"./fi.js":272,"./fil":273,"./fil.js":273,"./fo":274,"./fo.js":274,"./fr":275,"./fr-ca":276,"./fr-ca.js":276,"./fr-ch":277,"./fr-ch.js":277,"./fr.js":275,"./fy":278,"./fy.js":278,"./ga":279,"./ga.js":279,"./gd":280,"./gd.js":280,"./gl":281,"./gl.js":281,"./gom-deva":282,"./gom-deva.js":282,"./gom-latn":283,"./gom-latn.js":283,"./gu":284,"./gu.js":284,"./he":285,"./he.js":285,"./hi":286,"./hi.js":286,"./hr":287,"./hr.js":287,"./hu":288,"./hu.js":288,"./hy-am":289,"./hy-am.js":289,"./id":290,"./id.js":290,"./is":291,"./is.js":291,"./it":292,"./it-ch":293,"./it-ch.js":293,"./it.js":292,"./ja":294,"./ja.js":294,"./jv":295,"./jv.js":295,"./ka":296,"./ka.js":296,"./kk":297,"./kk.js":297,"./km":298,"./km.js":298,"./kn":299,"./kn.js":299,"./ko":300,"./ko.js":300,"./ku":301,"./ku.js":301,"./ky":302,"./ky.js":302,"./lb":303,"./lb.js":303,"./lo":304,"./lo.js":304,"./lt":305,"./lt.js":305,"./lv":306,"./lv.js":306,"./me":307,"./me.js":307,"./mi":308,"./mi.js":308,"./mk":309,"./mk.js":309,"./ml":310,"./ml.js":310,"./mn":311,"./mn.js":311,"./mr":312,"./mr.js":312,"./ms":313,"./ms-my":314,"./ms-my.js":314,"./ms.js":313,"./mt":315,"./mt.js":315,"./my":316,"./my.js":316,"./nb":317,"./nb.js":317,"./ne":318,"./ne.js":318,"./nl":319,"./nl-be":320,"./nl-be.js":320,"./nl.js":319,"./nn":321,"./nn.js":321,"./oc-lnc":322,"./oc-lnc.js":322,"./pa-in":323,"./pa-in.js":323,"./pl":324,"./pl.js":324,"./pt":325,"./pt-br":326,"./pt-br.js":326,"./pt.js":325,"./ro":327,"./ro.js":327,"./ru":328,"./ru.js":328,"./sd":329,"./sd.js":329,"./se":330,"./se.js":330,"./si":331,"./si.js":331,"./sk":332,"./sk.js":332,"./sl":333,"./sl.js":333,"./sq":334,"./sq.js":334,"./sr":335,"./sr-cyrl":336,"./sr-cyrl.js":336,"./sr.js":335,"./ss":337,"./ss.js":337,"./sv":338,"./sv.js":338,"./sw":339,"./sw.js":339,"./ta":340,"./ta.js":340,"./te":341,"./te.js":341,"./tet":342,"./tet.js":342,"./tg":343,"./tg.js":343,"./th":344,"./th.js":344,"./tk":345,"./tk.js":345,"./tl-ph":346,"./tl-ph.js":346,"./tlh":347,"./tlh.js":347,"./tr":348,"./tr.js":348,"./tzl":349,"./tzl.js":349,"./tzm":350,"./tzm-latn":351,"./tzm-latn.js":351,"./tzm.js":350,"./ug-cn":352,"./ug-cn.js":352,"./uk":353,"./uk.js":353,"./ur":354,"./ur.js":354,"./uz":355,"./uz-latn":356,"./uz-latn.js":356,"./uz.js":355,"./vi":357,"./vi.js":357,"./x-pseudo":358,"./x-pseudo.js":358,"./yo":359,"./yo.js":359,"./zh-cn":360,"./zh-cn.js":360,"./zh-hk":361,"./zh-hk.js":361,"./zh-mo":362,"./zh-mo.js":362,"./zh-tw":363,"./zh-tw.js":363};function o(e){var t=i(e);return n(t)}function i(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}o.keys=function(){return Object.keys(r)},o.resolve=i,e.exports=o,o.id=639},function(e,t,n){"use strict";function r(e,t){if(!e)throw new Error(t)}function o(e){return"number"==typeof e}function i(e){return o(e)&&Math.floor(e)===e}function a(e){return Math.pow(Math.floor(e),2)!==e}function s(e){return(e%360+360)%360%90==0}function u(e,t,n,r,o){return void 0===r&&(r=!1),void 0===o&&(o=!1),(r?e>=t:e>t)&&(o?e<=n:e<n)}function c(e,t,n){return void 0===n&&(n=.01),Math.abs(e-t)<n}function d(e,t,n){return void 0===n&&(n=.01),c(e.x,t.x)&&c(e.y,t.y)}function l(e){return null!=e}function f(e){return"function"==typeof e}function h(e){return"string"==typeof e}n.r(t),n.d(t,"assertThat",(function(){return r})),n.d(t,"isNumber",(function(){return o})),n.d(t,"isInteger",(function(){return i})),n.d(t,"isSquaredNumber",(function(){return a})),n.d(t,"isValidRotationAngle",(function(){return s})),n.d(t,"isNumberInRange",(function(){return u})),n.d(t,"isSamePoint",(function(){return d})),n.d(t,"isDefined",(function(){return l})),n.d(t,"isFunction",(function(){return f})),n.d(t,"isString",(function(){return h}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.engine=t,this.doc=n,this.attachments=new t.Attachments(n,new t.PDFNameTree(n,{value:3}))}return e.prototype.addEmbeddedFile=function(e,t){var n=this.engine,r=this.doc,o=new n.FileSpec(r,r.GetIndirectObject(t));if(o.IsEmpty())return!1;var i=new n.WString(e),a=this.attachments.AddEmbeddedFile(i,o);return i.delete(),i=null,a},e.prototype.setEmbeddedFile=function(e,t){var n=this.engine,r=this.doc;return!new n.FileSpec(r,r.GetIndirectObject(t)).IsEmpty()&&(!!this.removeEmbeddedFile(e)&&this.addEmbeddedFile(e,t))},e.prototype.removeEmbeddedFile=function(e){var t=new this.engine.WString(e),n=this.attachments.RemoveEmbeddedFile(t);return t.delete(),t=null,n},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(22),o=function(e,t,n){var r=t.GetType().value,o=t.GetWidth(),i=t.GetHeight(),a=t.GetOpacity(),s=t.GetXPosition(),u=t.GetYPosition(),c=t.CanChangeRenderingOrder(e.RenderingOrder.e_RenderingOrderFront),d=t.CanChangeRenderingOrder(e.RenderingOrder.e_RenderingOrderBack),l=n.GetSelectionCount();return{type:r,width:o,height:i,opacity:a,count:l,xPosition:s,yPosition:u,canChangeFront:c,canChangeBack:d,clipPathCount:1===l?n.GetSelection().GetAt(0).GetGraphicsObject().GetClipPathCount():0}},i=function(e){if(e.IsEmpty())return 0;for(var t=4278190080,n=(e=e.ConvertToRGB({value:0})).GetValue(),r=0;r<n.GetSize();r++){t|=(255*n.GetAt(r)|0)<<16-8*r}return t>>>0};function a(e){return e.IsEmpty()?0:e.GetColorSpace().GetColorSpaceType().value}t.default=function(e,t,n){if(t.IsEmpty())return{};if(function(e){var t=e.GetWidth(),n=e.GetHeight(),r=e.GetOpacity(),o=e.GetXPosition(),i=e.GetYPosition();return 0===t&&0===n&&0===r&&0===o&&0===i}(t))return{};switch(t.GetType().value){case 0:break;case 1:return function(e,t,n){var r=o(e,t,n),a=new e.TextObjectUtils(t);r.fontName=a.GetFont(!0).toString(),r.baseFontName=a.GetFont(!1).toString(),r.fontSize=a.GetFontSize(),r.fillColor=i(a.GetFillColor()),r.fillColorSpace=a.GetFillColor().GetColorSpace().GetColorSpaceType().value,r.strokeColor=i(a.GetStrokeColor()),r.strokeColorSpace=a.GetStrokeColor().GetColorSpace().GetColorSpaceType().value,r.horizontalScale=a.GetHorizontalScale(),r.charSpace=a.GetCharSpace(),r.wordSpace=a.GetWordSpace(),r.canRemoveTextKerning=a.CanRemoveTextKerning(),r.canMergeText=a.CanMergeText(),r.canSplitText=a.CanSplitText(),r.canText2Path=a.CanText2Path(),r.isWordSpaceValid=a.IsWordSpaceValid().value,r.fontIsBold=a.GetFontIsBold(),r.fontIsItalic=a.GetFontIsItalic(),r.textMode=a.GetTextMode().value;try{1===r.count?r.text=n.GetSelection().GetAt(0).GetGraphicsObject().GetTextObject().GetText().toString():r.text=""}catch(e){r.text=""}return r}(e,t,n);case 2:return function(e,t,n){var r=o(e,t,n),s=new e.PathObjectUtils(t);r.lineWidth=s.GetLineWidth(),r.miterLimit=s.GetMiterLimit(),r.lineCap=s.GetLineCap().value,r.lineJoin=s.GetLineJoin().value;for(var u=s.GetLineStyle(),c=r.lineStyle=[],d=0;d<u.GetSize();d++){var l=u.GetAt(d);c.push(l)}var f=s.GetFillColor();return r.fillColor=i(f),r.fillColorSpace=a(f),f=s.GetStrokeColor(),r.strokeColor=i(f),r.strokeColorSpace=a(f),r}(e,t,n);case 3:return function(e,t,n){return o(e,t,n)}(e,t,n);case 4:return function(e,t,n){var i=o(e,t,n),a=new e.ShadingObjectUtils(t);i.cursorColor=a.GetGridientCursorColor(),i.cursorLocation=a.GetGridientCursorLocation();var s=i.iCursorIndex=a.GetGridientCursorIndex();i.color=a.GetGridientColorAt(s);for(var u=a.GetGradientColor(),c=i.gradientArray=[],d=0;d<u.GetSize();d++){var l=u.GetAt(d);c.push({from:l.from,to:l.to,fromColor:(0,r.intColorToHex)(l.from_color),toColor:(0,r.intColorToHex)(l.to_color)})}return i}(e,t,n);case 5:return o(e,t,n)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){return{type:t.GetType().value,isEmpty:t.IsEmpty()}};t.default=function(e,t){if(t.IsEmpty())return{};switch(t.GetType().value){case 0:case 1:break;case 2:return function(e,t){var n=r(0,t),o=new e.TextEditor(t),i={isSelect:o.IsSelect(),canPaste:o.CanPaste(),isAdd:o.IsAdd()};return Object.assign(i,n)}(e,t);case 3:break;case 4:return function(e,t){var n=r(0,t),o={isClipPathMode:new e.PathEditor(t).IsClipPathMode()};return Object.assign(o,n)}(e,t);case 5:return function(e,t){var n=r(0,t),o={isReferenceLineWorking:new e.ShadingEditor(t).IsReferenceLineWorking()};return Object.assign(o,n)}(e,t)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.gsdkIns=n,this.pageEditor=t,this.undos=[],this.redos=[],this.editUndos=[],this.editRedos=[],this.aggregateCount=1,this.aggregatedItems=[]}return e.prototype.undo=function(e,t){var n=this.gsdkIns,r=void 0,o=void 0,i=t?"PEUndo":"PERedo";e?t?(r=this.editUndos,o=this.editRedos):(r=this.editRedos,o=this.editUndos):t?(r=this.undos,o=this.redos):(r=this.redos,o=this.undos);var a=r.pop();a&&(Array.isArray(a)?a.forEach((function(e){return n[i](e)})):n[i](a),o.push(a))},e.prototype.aggregateUndo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.aggregateCount=e},e.prototype.OnAddUndo=function(e,t){this.aggregatedItems.unshift(e),this.aggregateCount-=1,this.aggregateCount<=0&&(t?(this.editUndos.push(this.aggregatedItems),this.editRedos=[]):(this.undos.push(this.aggregatedItems),this.redos=[]),this.aggregateCount=1,this.aggregatedItems=[])},e.prototype.OnUndoRedoBeginEdit=function(e){this.editUndos=[],this.editRedos=[]},e.prototype.OnUndoRedoEndEdit=function(e){this.editUndos=[],this.editRedos=[]},e.prototype.destroy=function(){var e=this.gsdkIns;this.aggregateCount=1,this.aggregatedItems.forEach((function(t){e.PEUndoItemRelease(t)})),[this.editRedos,this.editUndos,this.undos,this.redos].forEach((function(t){return t.forEach((function(t){Array.isArray(t)?t.forEach((function(t){return e.PEUndoItemRelease(t)})):e.PEUndoItemRelease(t)}))}))},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.gsdkIns=n,this.pageEditor=t,this.pasteMargin=5,this.graphicArray=null,this.autoCalPastePos=!0,this.lastPageIndex=0,this.selectionX=0,this.selectionY=0,this.selectionHeight=0,this.pasteX=0,this.pasteY=0,this.offsetX=0,this.offsetY=0}return e.prototype.destroy=function(){this.pageEditor=null},e.prototype.CanPasteGraphicObject=function(){return!!this.graphicArray},e.prototype.CopyGraphicObject=function(){var e=this.gsdkIns;this._deleteGraphicArray();for(var t=this.pageEditor.PE.GetSelection(),n=new e.GraphicsObjectArray,r=t.GetSize(),o=-1/0,i=1/0,a=1/0,s=0;s<r;s++){var u=t.GetAt(s).GetGraphicsObject().Clone();n.Add(u);var c=u.GetRect(),d=c.top,l=c.left,f=c.bottom;o=Math.max(d,o),i=Math.min(l,i),a=Math.min(f,a)}this.selectionX=i,this.selectionY=o,this.selectionHeight=o-a,this.pasteX=i,this.pasteY=o,this.offsetY=this.selectionHeight+this.pasteMargin,this.lastPageIndex=this.pageEditor.lastEditorPage.GetPage().GetIndex(),this.graphicArray=n},e.prototype.PasteGraphicObject=function(){var e=this.pageEditor.lastEditorPage.GetPage(),t=e.GetIndex();this.autoCalPastePos&&(this.pasteX+=this.offsetX,this.pasteY-=this.offsetY,t!==this.lastPageIndex?(this.pasteX=0,this.pasteY=e.GetHeight(),this.lastPageIndex=t):this.pasteY<this.selectionHeight/2&&(this.pasteY=this.pageEditor.lastEditorPage.GetPage().GetHeight()));var n=this._pasteGraphicArrayAtPoint(this.pasteX,this.pasteY);return this.autoCalPastePos=!0,n},e.prototype.setPastePos=function(e,t){this.autoCalPastePos=!1,this.pasteX=e,this.pasteY=t},e.prototype._pasteGraphicArrayAtPoint=function(e,t){for(var n=this.gsdkIns,r=e-this.selectionX,o=t-this.selectionY,i=this.graphicArray.GetSize(),a=new n.GraphicsObjectArray,s=0;s<i;s++){var u=this.graphicArray.GetAt(s),c=u.GetRect(),d=u.Clone();this._moveGraphicObject(d,c.left+r,c.top+o),a.Add(d)}return a},e.prototype._moveGraphicObject=function(e,t,n){var r=this.gsdkIns,o=e.GetRect(),i=o.top-o.bottom,a=o.right-o.left,s=new r.CFX_FloatRect;s.top=n,s.bottom=n-i,s.left=t,s.right=t+a;var u=new r.Matrix;u.MatchRect(s,o),e.Transform(u,!0),s.delete()},e.prototype._deleteGraphicArray=function(){if(this.graphicArray){for(var e=this.graphicArray.GetSize(),t=0;t<e;t++)this.graphicArray.GetAt(t).delete();this.graphicArray.delete(),this.graphicArray=null}},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(104);var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.isStandard=!1,this.fontName="",this.fontIns=""}return e.prototype.setDefaultFont=function(e,t){this.isStandard=e.IsStandardFont(t),this.isStandard&&(this.fontName=e.GetBaseFontName(t).toString()),this.fontIns=e},e.prototype.getDefaultFont=function(e){return this.isStandard?new e.Font(this._getStandardID(this.fontName,e)):this.fontIns?this.fontIns:new e.Font(e.StandardID.e_StdIDHelvetica)},e.prototype.getDefaultFontName=function(e){if(this.isStandard)return this.fontName;if(!this.fontIns)return"Helvetica";try{return this.fontIns.GetBaseFontName(e).toString()}catch(e){var t=this.fontIns.GetName().toString();return r.FoxitFontMap[t]||t}},e.prototype._getStandardID=function(e,t){var n=t.StandardID;return{Courier:n.e_StdIDCourier,"Courier-Bold":n.e_StdIDCourierB,"Courier-BoldOblique":n.e_StdIDCourierBI,"Courier-Oblique":n.e_StdIDCourierI,Helvetica:n.e_StdIDHelvetica,"Helvetica-Bold":n.e_StdIDHelveticaB,"Helvetica-BoldOblique":n.e_StdIDHelveticaBI,"Helvetica-Oblique":n.e_StdIDHelveticaI,"Times-Roman":n.e_StdIDTimes,"Times-Bold":n.e_StdIDTimesB,"Times-BoldItalic":n.e_StdIDTimesBI,"Times-Italic":n.e_StdIDTimesI,Symbol:n.e_StdIDSymbol,ZapfDingbats:n.e_StdIDZapfDingbats}[e]||n.e_StdIDHelvetica},e.prototype.destroy=function(){this.fontIns=null},e}();t.default=o},function(e,t,n){"use strict";n.r(t),n.d(t,"VIRTUAL_PAGE_WIDTH",(function(){return s})),n.d(t,"VIRTUAL_PAGE_HEIGHT",(function(){return u}));var r=n(68),o=n.n(r);function i(e,t){var n=Array.prototype.slice.call(t).join(",");throw new Error("Illegal operations on virtual page: "+e+"("+n+")")}function a(e,t,n){var r=new e.Bitmap(t,n,e.DIBFormat.e_DIBRgb32,0,0),o=new e.FX_RECT;o.left=0,o.bottom=0,o.right=t,o.top=n,r.FillRect(4294638330,o);var i=r.GetBuffer(),a=r.GetHeight()*r.GetPitch(),s=i+a;return{buffer:e.HEAPU8.buffer.slice?e.HEAPU8.buffer.slice(i,s):new Uint8Array(e.HEAPU8.buffer,i,a).buffer,bitmap:r}}var s=800,u=300,c=function(){function e(e,t){this.index=e,this.pdfDoc=t,this.isVirtual=!0,this.width=s,this.height=u,this.id=o()("virtual_pdf_page"),this.engine=t.engine}return Object.defineProperty(e.prototype,"page",{get:function(){return i(".page",arguments)},enumerable:!1,configurable:!0}),e.prototype.addJRAnnot=function(){i("addJRAnnot",arguments)},e.prototype.clearEnginePage=function(){i("clearEnginePage",arguments)},e.prototype.reloadAnnots=function(){},e.prototype.hasAnnot=function(){return!1},e.prototype.parsedPage=function(){i("parsedPage",arguments)},e.prototype.reParsePage=function(){i("reParsePage",arguments)},e.prototype.getIndex=function(){return this.index},e.prototype.getObjNumber=function(){},e.prototype.getWidth=function(){return Promise.resolve(this.width)},e.prototype.getHeight=function(){return Promise.resolve(this.height)},e.prototype.getAnnots=function(){return Promise.resolve([])},e.prototype.getAnnotIDList=function(){return[]},e.prototype.getAnnotById=function(){return Promise.resolve(void 0)},e.prototype.getThumb=function(){var e;e=this.height/this.width>1.29?258/this.height:200/this.width;var t=this.width*e,n=this.height*e,r=a(this.engine,t,n),o=r.buffer;return r.bitmap.delete(),Promise.resolve(o)},e.prototype.getNativeAnnotById=function(){i("getNativeAnnotById",arguments)},e.prototype.getImageDataByTile=function(e,t,n,r,o,i){void 0===o&&(o=1),void 0===i&&(i=0);var s=a(this.engine,n,r),u=s.buffer;return s.bitmap.delete(),u},e.prototype.getImageData=function(e){void 0===e&&(e=1);var t=Math.max(1,this.width*e),n=Math.max(1,this.height*e),r=a(this.engine,t,n),o=r.buffer;return r.bitmap.delete(),o},e.prototype.getRotation=function(){return 0},e.prototype.setRotation=function(){},e.prototype.destroy=function(){},e.prototype.resetBitmapCache=function(){},e.prototype.toJson=function(){return{id:this.id,index:this.index,width:this.width,height:this.height,rotation:0,annotCount:0,matrix:[1,0,0,1,0,0],objectNumber:-1,AA:{},mediaWidth:this.width,mediaHeight:this.height,isCropped:!1,isVirtual:!0,cropBox:{left:0,right:this.width,top:this.height,bottom:0}}},e.prototype.getBitmap=function(e,t,n,r,o,i){if(n.width<1||n.height<1)return Promise.resolve({image:{buffer:void 0},isVirtual:!0});var s=a(this.engine,n.width,n.height),u=s.buffer;return s.bitmap.delete(),Promise.resolve({image:{buffer:u,x:n.x||0,y:n.y||0,width:n.width,height:n.height},isVirtual:!0})},e.prototype.renderAnnots=function(){},e.prototype.getPageAndHighlightBitmap=function(e,t,n,r){return this.getBitmap(e,t,n,0,[],!0)},e.prototype.getAnnotBitmap=function(){i("getAnnotBitmap",arguments)},e.prototype.getAnnotBitmapByRange=function(){i("getAnnotBitmapByRange",arguments)},e.prototype.getAnnotIdAtPoint=function(){i("getAnnotIdAtPoint",arguments)},e.prototype.getAnnotIdAtDevicePoint=function(){i("getAnnotIdAtDevicePoint",arguments)},e.prototype.getCharInfoAtPoint=function(){i("getCharInfoAtPoint",arguments)},e.prototype.getNormalTextPage=function(){i("getNormalTextPage",arguments)},e.prototype.getNormalTextPageSync=function(){i("getNormalTextPageSync",arguments)},e.prototype.removeAnnotById=function(){i("removeAnnotById",arguments)},e.prototype.removeAllAnnot=function(){},e.prototype.addImage=function(){i("addImage",arguments)},e.prototype.addAnnot=function(){i("addAnnot",arguments)},e.prototype.markRedactAnnot=function(){i("markRedactAnnot",arguments)},e.prototype.addAnnotGroup=function(){i("addAnnotGroup",arguments)},e.prototype.getTextRectsAtRect=function(){i("getTextRectsAtRect",arguments)},e.prototype.getTextContinuousRectsAtRect=function(){i("getTextContinuousRectsAtRect",arguments)},e.prototype.getTextContinuousCharInfoAtPoints=function(){i("getTextContinuousCharInfoAtPoints",arguments)},e.prototype.getTextContinuousCharsAtRect=function(){return Promise.resolve("")},e.prototype.getDoubleClickTextCharInfoAtPoint=function(){i("getDoubleClickTextCharInfoAtPoint",arguments)},e.prototype.getTextSearch=function(){i("getTextSearch",arguments)},e.prototype.update=function(){return Promise.resolve({index:this.index,annotIds:[]})},e.prototype.flattern=function(){i("flattern",arguments)},e.prototype.getGraphicsObjectAtPoint_s=function(){return Promise.resolve([])},e.prototype.getGraphicsObjectsCount=function(){return Promise.resolve(0)},e.prototype.getGraphicsObjectByIndex=function(){i("getGraphicsObjectByIndex",arguments)},e.prototype.getGraphicsObjectsInRect=function(){i("getGraphicsObjectsInRect",arguments)},e.prototype.getGraphicsObjectAtPoint=function(){i("getGraphicsObjectAtPoint",arguments)},e.prototype.checkPathObjects=function(){},e.prototype.addWatermark=function(){i("addWatermark",arguments)},e.prototype.pasteAnnot=function(){i("pasteAnnot",arguments)},e.prototype.calcContentBBox=function(){return{}},e.prototype.getBox=function(){return{}},e.prototype.getAnnotIdArrayByOrder=function(){return Promise.resolve([])},e.prototype.getPageDictionary=function(){return Promise.resolve({})},e.prototype.clearDesignerAssitCache=function(){},e.prototype.getSuggestedFormDesignerRect=function(){return Promise.resolve({left:0,right:0,top:0,bottom:0})},e.prototype.getSnappedPoint=function(e){return e},e.prototype.getTextRectCount=function(){return Promise.resolve(0)},e.prototype.getTextByRectIndex=function(){i("getTextByRectIndex",arguments)},e.prototype.normalize=function(){},e}();t.default=c},function(e,t,n){e.exports=n(649)},function(e,t,n){"use strict";var r=n(26),o=n(365),i=n(650),a=n(371);function s(e){var t=new i(e),n=o(i.prototype.request,t);return r.extend(n,i.prototype,t),r.extend(n,t),n}var u=s(n(160));u.Axios=i,u.create=function(e){return s(a(u.defaults,e))},u.Cancel=n(372),u.CancelToken=n(664),u.isCancel=n(370),u.all=function(e){return Promise.all(e)},u.spread=n(665),u.isAxiosError=n(666),e.exports=u,e.exports.default=u},function(e,t,n){"use strict";var r=n(26),o=n(366),i=n(651),a=n(652),s=n(371),u=n(662),c=u.validators;function d(e){this.defaults=e,this.interceptors={request:new i,response:new i}}d.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=s(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&u.assertOptions(t,{silentJSONParsing:c.transitional(c.boolean,"1.0.0"),forcedJSONParsing:c.transitional(c.boolean,"1.0.0"),clarifyTimeoutError:c.transitional(c.boolean,"1.0.0")},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var o,i=[];if(this.interceptors.response.forEach((function(e){i.push(e.fulfilled,e.rejected)})),!r){var d=[a,void 0];for(Array.prototype.unshift.apply(d,n),d=d.concat(i),o=Promise.resolve(e);d.length;)o=o.then(d.shift(),d.shift());return o}for(var l=e;n.length;){var f=n.shift(),h=n.shift();try{l=f(l)}catch(e){h(e);break}}try{o=a(l)}catch(e){return Promise.reject(e)}for(;i.length;)o=o.then(i.shift(),i.shift());return o},d.prototype.getUri=function(e){return e=s(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){d.prototype[e]=function(t,n){return this.request(s(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){d.prototype[e]=function(t,n,r){return this.request(s(r||{},{method:e,url:t,data:n}))}})),e.exports=d},function(e,t,n){"use strict";var r=n(26);function o(){this.handlers=[]}o.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},function(e,t,n){"use strict";var r=n(26),o=n(653),i=n(370),a=n(160);function s(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return s(e),e.headers=e.headers||{},e.data=o.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||a.adapter)(e).then((function(t){return s(e),t.data=o.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(s(e),t&&t.response&&(t.response.data=o.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,n){"use strict";var r=n(26),o=n(160);e.exports=function(e,t,n){var i=this||o;return r.forEach(n,(function(n){e=n.call(i,e,t)})),e}},function(e,t,n){"use strict";var r=n(26);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},function(e,t,n){"use strict";var r=n(369);e.exports=function(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(26);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,o,i,a){var s=[];s.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),r.isString(o)&&s.push("path="+o),r.isString(i)&&s.push("domain="+i),!0===a&&s.push("secure"),document.cookie=s.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)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";var r=n(658),o=n(659);e.exports=function(e,t){return e&&!r(t)?o(e,t):t}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(26),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,a={};return e?(r.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=r.trim(e.substr(0,i)).toLowerCase(),n=r.trim(e.substr(i+1)),t){if(a[t]&&o.indexOf(t)>=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([n]):a[t]?a[t]+", "+n:n}})),a):a}},function(e,t,n){"use strict";var r=n(26);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function o(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=o(window.location.href),function(t){var n=r.isString(t)?o(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var r=n(663),o={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){o[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var i={},a=r.version.split(".");function s(e,t){for(var n=t?t.split("."):a,r=e.split("."),o=0;o<3;o++){if(n[o]>r[o])return!0;if(n[o]<r[o])return!1}return!1}o.transitional=function(e,t,n){var o=t&&s(t);function a(e,t){return"[Axios v"+r.version+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,s){if(!1===e)throw new Error(a(r," has been removed in "+t));return o&&!i[r]&&(i[r]=!0,console.warn(a(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,s)}},e.exports={isOlderVersion:s,assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),o=r.length;o-- >0;){var i=r[o],a=t[i];if(a){var s=e[i],u=void 0===s||a(s,i,e);if(!0!==u)throw new TypeError("option "+i+" must be "+u)}else if(!0!==n)throw Error("Unknown option "+i)}},validators:o}},function(e){e.exports=JSON.parse('{"_args":[["axios@0.21.4","C:\\\\GitLab-Runner\\\\builds\\\\d5sVgm4y\\\\0\\\\foxit\\\\phantom\\\\cloud\\\\phantompdf_online\\\\foxitwebsdk"]],"_from":"axios@0.21.4","_id":"axios@0.21.4","_inBundle":false,"_integrity":"sha1-xnuQ3AVo5cHPKwuFjEO6KOLtpXU=","_location":"/axios","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"axios@0.21.4","name":"axios","escapedName":"axios","rawSpec":"0.21.4","saveSpec":null,"fetchSpec":"0.21.4"},"_requiredBy":["/"],"_resolved":"https://registry.npmmirror.com/axios/download/axios-0.21.4.tgz","_spec":"0.21.4","_where":"C:\\\\GitLab-Runner\\\\builds\\\\d5sVgm4y\\\\0\\\\foxit\\\\phantom\\\\cloud\\\\phantompdf_online\\\\foxitwebsdk","author":{"name":"Matt Zabriskie"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"bugs":{"url":"https://github.com/axios/axios/issues"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}],"dependencies":{"follow-redirects":"^1.14.0"},"description":"Promise based HTTP client for the browser and node.js","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"homepage":"https://axios-http.com","jsdelivr":"dist/axios.min.js","keywords":["xhr","http","ajax","promise","node"],"license":"MIT","main":"index.js","name":"axios","repository":{"type":"git","url":"git+https://github.com/axios/axios.git"},"scripts":{"build":"NODE_ENV=production grunt build","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","examples":"node ./examples/server.js","fix":"eslint --fix lib/**/*.js","postversion":"git push && git push --tags","preversion":"npm test","start":"node ./sandbox/server.js","test":"grunt test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"},"typings":"./index.d.ts","unpkg":"dist/axios.min.js","version":"0.21.4"}')},function(e,t,n){"use strict";var r=n(372);function o(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 r(e),t(n.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSummarizeCommentsShowInfoById=t.getAnnotThumbnailBitmap=t.getPaperSizeWidthAndHeight=t.getEngineFontSizeType=t.getEngineSortType=t.getEngineSummaryLayout=void 0;var r,o=n(37),i=(r=o)&&r.__esModule?r:{default:r},a=n(3);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var u={A0:[2384,3370],A1:[1684,2384],A2:[1191,1684],A3:[842,1191],A4:[595,842],A5:[420,595],A6:[298,420],"9_11":[648,792],"10_11":[720,792],"10_14":[720,1008],"11_17":[792,1224],"12_11":[864,792],"15_11":[1080,792],Letter:[612,792],Legal:[612,1008],Screen:[468,373],Tabloid:[792,1224],Ledger:[1224,792],Statement:[396,612],Executive:[522,756],Folio:[612,936],Quarto:[609,780],ANSI_C:[1224,1584],ANSI_D:[1584,2448],ANSI_E:[2448,3168],ANSI_F:[2016,2880],ARCH_A:[648,864],ARCH_B:[864,1296],ARCH_C:[1296,1728],ARCH_D:[1728,2592],ARCH_E:[2592,3456],ARCH_E1:[2160,3024],ARCH_E2:[1872,2736],ARCH_E3:[1944,2808],"B5_(ISO)":[499,709],"B4_(ISO)":[709,1001],"B2_(ISO)":[1417,2004],"B1_(ISO)":[2004,2835],"B5_(JIS)":[516,729],"B4_(JIS)":[729,1032],"B3_(JIS)":[1032,1460],"B2_(JIS)":[1460,2064],"B1_(JIS)":[2064,2920],"B0_(JIS)":[2920,4127]};var c=function(e){var t,n=e.AnnotationSummaryStringID;return s(t={},n.e_AnnotationSummaryStringIDAuthor.value,"author"),s(t,n.e_AnnotationSummaryStringIDDate.value,"date"),s(t,n.e_AnnotationSummaryStringIDPage.value,"page"),s(t,n.e_AnnotationSummaryStringIDType.value,"type"),s(t,n.e_AnnotationSummaryStringIDDocumentTitle.value,"documentTitle"),s(t,n.e_AnnotationSummaryStringIDPageTitle.value,"pageTitle"),s(t,n.e_AnnotationSummaryStringIDNoAnnotations.value,"noAnnotations"),s(t,n.e_AnnotationSummaryStringIDNumber.value,"number"),s(t,n.e_AnnotationSummaryStringIDSubject.value,"subject"),t};t.getEngineSummaryLayout=function(e,t){return e.SummaryLayout["e_SummaryLayout"+t]},t.getEngineSortType=function(e,t){return e.SortType["e_TypeSortBy"+t]},t.getEngineFontSizeType=function(e,t){return e.FontSizeType["e_FontSize"+t]},t.getPaperSizeWidthAndHeight=function(e){return u[e]},t.getAnnotThumbnailBitmap=function(e,t,n){var r=t.url,o=n.requestData("GET",!1,r);return i.default.createImage(e,o).GetFrameBitmap(0)},t.getSummarizeCommentsShowInfoById=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=c(e)[t.value]||"",o=n[r]||"";return new a.CWString(e,o)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3);function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(t){o(this,e),this.pdfDoc=t,this.doc=t.doc,this.engine=t.engine,this.c_articles=new t.engine.Articles(this.doc),this.articles=this.getArticles()}return e.prototype.getArticles=function(){this.engine;for(var e=this.c_articles.GetArticles(),t=e.GetSize(),n=[],r=0;r<t;r++){var o=e.GetAt(r),i=new a(this.pdfDoc,o,r);n.push(i)}return n},e.prototype.toJson=function(){for(var e=this.articles,t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.toJson())}return t},e.prototype.getThreadInfo=function(e){var t=void 0,n=0;for(this.engine;n<this.articles.length;n++){var r=this.articles[n];if(r.c_thread.GetDict().GetObjNum()===e){(t=r).index=n;break}}return t},e.prototype.insertThread=function(e){var t=e.author,n=e.keywords,r=e.subject,o=e.title,i=new this.engine.Thread(this.doc),s=this.articles.length,u=this.c_articles.InsertArticle(s,i);if(u){var c=new a(this.pdfDoc,i,s);u=c.update({author:t,keywords:n,subject:r,title:o}),this.articles.push(c)}return u},e.prototype.removeThread=function(e){var t=this.getThreadInfo(e);if(!t)return!1;var n=t.index,r=(t.thread,this.c_articles.RemoveArticle(n));return r&&this.articles.splice(n,1),r},e}(),a=function(){function e(t,n,r){o(this,e),this.pdfDoc=t,this.doc=t.doc,this.engine=t.engine,this.c_thread=n,this.children=this.getChildren(),this.index=r}return e.prototype.getChildren=function(){for(var e=this.c_thread.GetBeads(),t=e.GetSize(),n=[],r=0;r<t;r++){var o=e.GetAt(r),i=new s(this,o,r);n.push(i)}return n},e.prototype.getThreadInfoJson=function(){var e=this.c_thread,t=e.GetDict().GetObjNum(),n=e.GetThreadInfo();return{objNum:t,author:n.author.toString(),keywords:n.keywords.toString(),subject:n.subject.toString(),title:n.title.toString()}},e.prototype.toJson=function(){var e=this.getThreadInfoJson();return e.no=this.index+1,e.children=this.children.map((function(e){return e.toJson()})),e},e.prototype.update=function(e){var t=e.author,n=e.keywords,o=e.subject,i=e.title,a=this.engine,s=this.c_thread,u=s.GetThreadInfo();void 0!==t&&(u.author=(0,r.CWString)(a,t)),void 0!==n&&(u.keywords=(0,r.CWString)(a,n)),void 0!==o&&(u.subject=(0,r.CWString)(a,o)),void 0!==i&&(u.title=(0,r.CWString)(a,i));var c=s.SetThreadInfo(u);return c?this.getThreadInfoJson():c},e.prototype.getBeadInfo=function(e){var t=void 0,n=0;for(this.engine;n<this.children.length;n++){var r=this.children[n];if(r.c_bead.GetDict().GetObjNum()===e){(t=r).index=n;break}}return t},e.prototype.insertBead=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments[1],n=t.left,r=t.bottom,o=t.right,i=t.top,a=arguments[2],u=this.engine,c=this.c_thread,d=new u.Bead(this.doc);void 0===a&&(a=this.children.length);var l=new s(this,d,a),f=l.update({pageIndex:e,rect:{left:n,bottom:r,right:o,top:i}}),h=c.InsertBead(a,d);return h&&(this.children.splice(a,0,l),this.children.forEach((function(e,t){e.index=t}))),h?f:h},e.prototype.removeBead=function(e){var t=this.getBeadInfo(e);if(!t)return!1;var n=t.index,r=this.c_thread.RemoveBead(n);return r&&(this.children.splice(n,1),this.children.forEach((function(e,t){e.index=t}))),r},e}(),s=function(){function e(t,n,r){o(this,e);var i=t.pdfDoc;this.parentThread=t,this.pdfDoc=i,this.doc=i.doc,this.engine=i.engine,this.c_bead=n,this.index=r}return e.prototype.toJson=function(){var e=this.c_bead,t=e.GetBeadInfo(),n=[this.parentThread.index+1,this.index+1].join("-"),r=e.GetDict().GetObjNum(),o=t.page_index,i=t.rect;return{objNum:r,no:n,pageIndex:o,rect:{left:i.left,right:i.right,bottom:i.bottom,top:i.top}}},e.prototype.update=function(e){var t=e.pageIndex,n=e.rect,r=this.engine,o=this.c_bead,i=o.GetBeadInfo();if(void 0!==t&&(i.page_index=t),void 0!==n){var a=n.left,s=n.bottom,u=n.right,c=n.top,d=r.CFX_FloatRect;i.rect=new d(a,s,u,c)}var l=o.SetBeadInfo(i);return l?this.toJson():l},e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(670),o=u(n(44)),i=u(n(31)),a=u(n(161)),s=u(n(215));function u(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var d=function(){function e(){c(this,e),this.map={}}return e.prototype.getNode=function(e){return this.map[e]},e.prototype.setNode=function(e){var t=e.GetDict().GetObjNum();return this.map[t]=e,t},e.prototype.remove=function(e){var t=e.GetDict().GetObjNum();delete this.map[t]},e.prototype.clear=function(){this.map={}},e}(),l=function(){function e(t,n){c(this,e),this.doc=t,this.engine=n,this.engineDoc=t.doc,this.portfolio=n.Portfolio.CreatePortfolio(this.engineDoc),this.nodeCache=new d}var t,n;return e.prototype.getInfo=function(){for(var e=this.portfolio,t=[],n=this.getSchemaFieldsHandler(),r=0;r<n.GetSize();r++){var o=n.GetAt(r);t.push({isDefaultField:o.IsDefaultField(),isVisible:o.IsVisible(),keyName:o.GetKeyName().toString(),subtypeName:o.GetSubtypeName().toString(),displayName:o.GetDisplayName().toString(),schemaField:o})}return{initialFileSpecKeyName:e.GetInitialFileSpecKeyName().toString(),initialViewMode:e.GetInitialViewMode().value,isSortedInAscending:e.IsSortedInAscending(),sortingFieldKeyName:e.GetSortingFieldKeyName().toString(),fields:t}},e.prototype.setInfo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.engine,n=this.portfolio;if(void 0!==e.fields){var r=n.GetSchemaFields(),o=new t.SchemaFieldArray;(e.fields||[]).forEach((function(e){if(e.isDefaultField){for(var n=void 0,i=0;i<r.GetSize();i++){var a=r.GetAt(i);if(e.keyName===a.GetKeyName().toString()){a.SetVisibility(e.isVisible),n=a;break}}o.Add(n)}else{var s=new t.SchemaField;s.SetKeyName(new t.String(e.keyName)),s.SetSubtypeName(new t.String(e.subtypeName)),s.SetDisplayName(new t.WString(e.displayName)),s.SetVisibility(e.isVisible),o.Add(s)}})),n.SetSchemaFields(o)}void 0!==e.initialFileSpecKeyName&&n.SetInitialFileSpecKeyName(new t.WString(e.initialFileSpecKeyName)),e.initialViewMode&&n.SetInitialViewMode({value:e.initialViewMode}),void 0!==e.isSortedInAscending&&n.SetSortingOrder(e.isSortedInAscending),void 0!==e.sortingFieldKeyName&&n.SetSortingFieldKeyName(new t.String(e.sortingFieldKeyName))},e.prototype.getTreeNode=function(){if(this.engineDoc.IsPortfolio()){var e=this.engine,t=this.portfolio,n=this.getInfo().fields,r=t.GetRootNode();if(!r.IsEmpty()){var o=void 0,i=r.GetNodeType();return i===e.PortfolioNodeType.e_TypeFolder&&(r=new e.PortfolioFolderNode(r),o=this.folderNodeToJSON(r,n)),i===e.PortfolioNodeType.e_TypeFile&&(r=new e.PortfolioFileNode(r),o=this.fileNodeToJSON(r,n)),o}t.delete()}},e.prototype.getInitialNodePath=function(){var e=this.engine,t=this.portfolio,n=this.getInfo(),r=n.initialFileSpecKeyName,o=n.fields,i=t.GetRootNode();i=new e.PortfolioFolderNode(i);var a=[this.folderNodeToJSON(i,o)];if(!r)return a;var s=void 0;if(function t(n){for(var o=0;o<n.GetSize();o++){var i=n.GetAt(o);if(i.GetNodeType()===e.PortfolioNodeType.e_TypeFile){if(i=new e.PortfolioFileNode(i),r===i.GetKeyName().toString()){s=i;break}}else i.GetNodeType()===e.PortfolioNodeType.e_TypeFolder&&t((i=new e.PortfolioFolderNode(i)).GetSortedSubNodes())}}(i.GetSortedSubNodes()),!s||s.GetParentNode().IsEmpty())return a;var u=[];u.unshift(this.fileNodeToJSON(s,o));for(var c=s.GetParentNode();!c.IsEmpty()&&!c.IsRoot();)c=(s=s.GetParentNode()).GetParentNode(),u.unshift(this.folderNodeToJSON(s,o));return u.unshift(this.folderNodeToJSON(i,o)),u},e.prototype.addFiles=function(e,t,n){var r=this,o=this.engine,a=this.nodeCache.getNode(n);if(a&&a.GetNodeType()===o.PortfolioNodeType.e_TypeFolder){for(var s=a.GetSortedSubNodes().GetSize(),u=new FileReaderSync,c=function(t){var n=e[t];if(a.HasSameNameSubNode(new o.WString(n.name),o.PortfolioNodeType.e_TypeFile)){var s=void 0;for(var c in r.nodeCache.map){var d=r.nodeCache.map[c];if(d.GetNodeType()===o.PortfolioNodeType.e_TypeFile&&d.GetFileSpec().GetFileName().toString()===n.name){s=d;break}}s&&r.nodeCache.remove(s)}var l=o.ReaderCallback.implement({Release:function(){},GetSize:function(){return n.size},GetPosition:function(){return n.size},ReadBlock:function(e,t,r){var i=new Uint8Array(u.readAsArrayBuffer(n.slice(t,t+r)));return o.HEAPU8.set(i,e),!0}});a.AddFile(l,new o.WString(n.name)).GetFileSpec().SetModifiedDateTime(i.default.ToDateTime(o,n.lastModified||n.lastModifiedDate))},d=0;d<e.length;d++)c(d);if(void 0!==t){var l=a.GetSortedSubNodes().GetSize(),f=[];for(d=0;d<l-s;d++)f.unshift(l-1-d);this.changeSubNodesOrder(n,f,t)}}},e.prototype.createFolder=function(e,t){var n=this.engine,r=this.nodeCache.getNode(t);if(r&&r.GetNodeType()===n.PortfolioNodeType.e_TypeFolder){var o=r.AddSubFolder(new n.WString(e)),i=this.getInfo().fields;return this.folderNodeToJSON(o,i)}},e.prototype.removeSubNodes=function(e,t){var n=this,r=this.engine,o=this.nodeCache.getNode(e);o&&o.GetNodeType()===r.PortfolioNodeType.e_TypeFolder&&t.forEach((function(e){var t=n.nodeCache.getNode(e);if(t.GetNodeType()===r.PortfolioNodeType.e_TypeFile)n.nodeCache.remove(t);else{!function e(t){for(var o=t.GetSortedSubNodes(),i=0;i<o.GetSize();i++){var a=o.GetAt(i);a.GetNodeType()===r.PortfolioNodeType.e_TypeFile?n.nodeCache.remove(a):e(new r.PortfolioFolderNode(a))}n.nodeCache.remove(t)}(t)}o.RemoveSubNode(t)}))},e.prototype.regenerateTOC=function(e){var t=this,n=this.portfolio.GetTocPageIndexes();this.portfolio.StartGenerateTableOfContents(new this.engine.WString(e),!!n.GetSize(),null);for(var r=this.portfolio.GetTocPageIndexes(),o=[],i=0;i<n.GetSize();i++)o.push(n.GetAt(i));for(var a=[],u=0;u<r.GetSize();u++)a.push(r.GetAt(u));return o.forEach((function(e){if(t.doc.pageIndexMap[e]){var n=t.doc.pageIndexMap[e];delete t.doc.pageIndexMap[e],delete t.doc.pageCache[n.id],delete t.doc.pageIndexPromise[e]}})),{oldIndexes:o,newPages:a.map((function(e){var n=t.engineDoc.GetPage(e),r=new s.default(e,t.doc);return r.page=n,t.doc.updatePageIndexMap(e,r),t.doc.updatePageCache(r),r.toJson()}))}},e.prototype.nodeToJSONByCustomProperty=function(e,t,n,o){if(!e.IsDefaultField())if(n.HasCustomProperty(e)){var i=e.GetSubtypeName().toString();if("N"===i)o[t]=n.GetCustomPropertyIntegerValue(e);else if("S"===i)o[t]=n.GetCustomPropertyStringValue(e).toString();else if("D"===i){var a=(0,r.gsdkDateToLocal)(n.GetCustomPropertyDateTimeValue(e));o[t]=a?a.getTime():-1}else o[t]=""}else o[t]=""},e.prototype.folderNodeToJSON=function(e,t){var n=this,o={};t.forEach((function(t){n.nodeToJSONByCustomProperty(t.schemaField,t.displayName,e,o)}));try{o.Description=e.GetDescription().toString()}catch(e){o.Description=""}var i=(0,r.gsdkDateToLocal)(e.GetCreationDateTime());o.CreationDate=i?i.getTime():-1;var a=(0,r.gsdkDateToLocal)(e.GetModifiedDateTime());return o.ModDate=a?a.getTime():i,o.FileName=e.GetName().toString(),o.subNodeSize=e.GetSortedSubNodes().GetSize(),o.handle=this.nodeCache.setNode(e),o.type=1,o},e.prototype.fileNodeToJSON=function(e,t){var n=this,o={};t.forEach((function(t){n.nodeToJSONByCustomProperty(t.schemaField,t.displayName,e,o)}));var i=e.GetFileSpec();try{o.Description=i.GetDescription().toString()}catch(e){o.Description=""}var a=(0,r.gsdkDateToLocal)(i.GetCreationDateTime());o.CreationDate=a?a.getTime():-1;var s=(0,r.gsdkDateToLocal)(i.GetModifiedDateTime());return o.ModDate=s?s.getTime():a,o.CompressedSize=i.GetCompressedEmbeddedFileSize(),o.Size=i.GetFileSize(),o.FileName=i.GetFileName().toString(),o.subtype=i.GetSubtype().toString(),o.keyName=e.GetKeyName().toString(),o.handle=this.nodeCache.setNode(e),o.type=2,o},e.prototype.getFileStream=function(e,t){var n=t.writeStream,r=this.nodeCache.getNode(e),i=new o.default(r.GetFileSpec(),this);return 0===i.getFileSize()?Promise.resolve(0):i.getStream(n)},e.prototype.getStream=function(e){var t=this,n=this.engine,r=function(r){var i=[],s=new a.default,u=e.map((function(e){return t.nodeCache.getNode(e)})).filter((function(e){return!!e}));return function e(r,a){for(var s=0;s<a.length;s++){var u=a[s];if(u.GetNodeType()===n.PortfolioNodeType.e_TypeFile)!function(){u instanceof n.PortfolioFileNode||(u=new n.PortfolioFileNode(u));var e=new o.default(u.GetFileSpec(),t.doc),a=[],s=e.getStream((function(e,t,n){return a.push(e)})).then((function(){r.file(e.getFileName(),a,{binary:!0})}));i.push(s)}();else{u instanceof n.PortfolioFolderNode||(u=new n.PortfolioFolderNode(u));for(var c=u.GetSortedSubNodes(),d=[],l=0;l<c.GetSize();l++)d.push(c.GetAt(l));e(r.folder(u.GetName().toString()),d)}}}(s,u),Promise.all(i).then((function(){return s.generateAsync({type:"blob"}).then((function(e){return{blob:e,fileName:r}}))}))};if(1===e.length){var i=this.nodeCache.getNode(e[0]);if(i.GetNodeType()===n.PortfolioNodeType.e_TypeFile){var s=new o.default(i.GetFileSpec(),this.doc),u=[];return s.getStream((function(e,t,n){return u.push(e)})).then((function(){return{blob:new Blob(u,{type:"application/octet-stream"}),fileName:s.getFileName()}}))}return r(i.GetName().toString()+".zip")}return r("download.zip")},e.prototype.sendSortFolioParam=(t=regeneratorRuntime.mark((function e(t,n){var r,o,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.engine,this.engineDoc.IsPortfolio()){e.next=3;break}return e.abrupt("return");case 3:return o=this.portfolio,i=new r.String(t),e.next=7,o.SetSortingFieldKeyName(i);case 7:return e.next=9,o.SetSortingOrder(n);case 9:return e.abrupt("return",!0);case 10:case"end":return e.stop()}}),e,this)})),n=function(){var e=t.apply(this,arguments);return new Promise((function(t,n){return function r(o,i){try{var a=e[o](i),s=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(s).then((function(e){r("next",e)}),(function(e){r("throw",e)}));t(s)}("next")}))},function(e,t){return n.apply(this,arguments)}),e.prototype.getPortfolioSubNodes=function(e){var t=this.engine,n=[],r=this.nodeCache.getNode(e);if(!r)throw new Error("Nonexistent portfolio folder node!");var o=r.GetNodeType();if(o!==t.PortfolioNodeType.e_TypeFolder)return n;for(var i=this.getInfo().fields,a=r.GetSortedSubNodes(),s=a.GetSize(),u=0;u<s;u++){var c=a.GetAt(u);(o=c.GetNodeType())===t.PortfolioNodeType.e_TypeFolder&&(c=new t.PortfolioFolderNode(c),n.push(this.folderNodeToJSON(c,i))),o===t.PortfolioNodeType.e_TypeFile&&(c=new t.PortfolioFileNode(c),n.push(this.fileNodeToJSON(c,i)))}return n},e.prototype.getPDFDocByNodeHandle=function(e){var t=this.engine,n=this.nodeCache.getNode(e);if(n&&n.GetNodeType()!==t.PortfolioNodeType.e_TypeFolder){var r=n.GetFileSpec();if(".pdf"===r.GetFileName().toString().substr(-4)){var o=new t.PDFDoc(r.GetFileData(),!1);return o.Load(new t.String("")),o}}},e.prototype.changeSubNodesOrder=function(e,t,n){var r,o=this.engine,i=this.nodeCache.getNode(e);if(i&&i.GetNodeType()!==o.PortfolioNodeType.e_TypeFile){var a=i.GetSortedSubNodes(),s=new Array(a.GetSize()).fill(null);s.forEach((function(e,n,r){t.includes(n)||(r[n]=a.GetAt(n))}));var u=t.map((function(e){return a.GetAt(e)}));(r=s).splice.apply(r,[n,0].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(u))),s=s.filter((function(e){return!!e}));var c=new o.PortfolioNodeArray;s.forEach((function(e){return c.Add(e)})),i.ReorderSubNodes(c)}},e.prototype.moveSubNodeToSubFolderNode=function(e,t,n){var r=this.engine,o=this.nodeCache.getNode(e);if(o&&o.GetNodeType()!==r.PortfolioNodeType.e_TypeFile){var i=this.nodeCache.getNode(n);if(i&&i.GetNodeType()!==r.PortfolioNodeType.e_TypeFile)for(var a=0;a<t.length;a++){var s=this.nodeCache.getNode(t[a]);if(s){var u=void 0,c=void 0;s.GetNodeType()===r.PortfolioNodeType.e_TypeFile?(u=s.GetFileSpec().GetFileName(),c=r.PortfolioNodeType.e_TypeFile):(u=s.GetName(),c=r.PortfolioNodeType.e_TypeFolder);var d=i.HasSameNameSubNode(u,c);o.MoveSubNodeToSubFolderNode(s,i,d)}}}},e.prototype.hasSameNameSubNode=function(e,t,n){var r=this.engine,o=this.nodeCache.getNode(n);if(o&&o.GetNodeType()!==r.PortfolioNodeType.e_TypeFile)return o.HasSameNameSubNode(new r.WString(e),{value:t})},e.prototype.recordPDFFileByPortFolioNode=function(e){var t=this.engine,n=[];for(var r in e){var o=e[r],i=this.nodeCache.getNode(o),a=i.GetNodeType();if(a===t.PortfolioNodeType.e_TypeFile){var s=i.GetFileSpec();if(".pdf"===s.GetFileName().toString().substr(-4)){var u=s.GetFileData(),c=new t.PDFDoc(u,!1);if(c.Load(new t.String(""))===t.ErrorCode.e_ErrPassword){n.push("password");continue}var d=this.doc.JR.getPDFDocByEngineDoc(c);n.push(d.id)}}else a===t.PortfolioNodeType.e_TypeFolder&&this.recursionFolioNodePDFDoc(n,i)}return n},e.prototype.getFolioNodePDFDoc=function(){if(this.engineDoc.IsPortfolio()){var e=this.engine,t=this.portfolio.GetRootNode(),n=new e.PortfolioFolderNode(t);if(!n)throw new Error("Nonexistent portfolio folder node!");return this.recursionFolioNodePDFDoc([],n)}},e.prototype.recursionFolioNodePDFDoc=function(e,t){for(var n=this.engine,r=t.GetSortedSubNodes(),o=r.GetSize(),i=0;i<o;i++){var a=r.GetAt(i),s=a.GetNodeType();if(s===n.PortfolioNodeType.e_TypeFile){var u=(a=new n.PortfolioFileNode(a)).GetFileSpec();if(".pdf"===u.GetFileName().toString().substr(-4)){var c=u.GetFileData(),d=new n.PDFDoc(c,!1);if(d.Load(new n.String(""))===n.ErrorCode.e_ErrPassword)continue;var l=this.doc.JR.getPDFDocByEngineDoc(d);e.push(l.id)}}else if(s===n.PortfolioNodeType.e_TypeFolder){var f=new n.PortfolioFolderNode(a);this.recursionFolioNodePDFDoc(e,f)}}return e},e.prototype.getSchemaFieldsHandler=function(){for(var e=this.engine,t=this.portfolio,n=t.GetSchemaFields(),r=!1,o=!1,i=!1,a=!1,s=!1,u=!1,c=new e.SchemaFieldArray,d=0;d<n.GetSize();d++){var l=n.GetAt(d),f=l.GetSubtypeName().toString();switch(c.Add(l),f){case"F":r=!0;break;case"Desc":o=!0;break;case"ModDate":i=!0;break;case"Size":a=!0;break;case"CompressedSize":s=!0;break;case"CreationDate":u=!0}}var h=function(t,n,r){var o=new e.SchemaField;o.SetSubtypeName(new e.String(t)),o.SetKeyName(new e.String(n)),o.SetDisplayName(new e.WString(r)),o.SetVisibility(!0),c.Add(o)};return r||h("F","FileName","Name"),o||h("Desc","Description","Description"),i||h("ModDate","ModDate","Modified"),a||h("Size","Size","Size"),s||h("CompressedSize","CompressedSize","Compressed size"),u||h("CreationDate","CreationDate","Created"),t.SetSchemaFields(c),t.GetSchemaFields()},e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gsdkDateToLocal=function(e){return new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.milliseconds)}},function(e,t,n){"use strict";n.r(t),t.default={"arialbd_M.ttf":"69d839378ea59b548ce8c1d6e898d4dc","arialbi_M.ttf":"c0dd0b6d0eac90efac9326519a4165a4","ariali_M.ttf":"b70f39d993be031363a37edfd3858a93","arial_M.ttf":"fac7aaa5c76c9ce38db25b46e1a5da24","NotoNaskhArabic-Bold.ttf":"febcd5fae479715518a682af57a1422e","NotoNaskhArabic-Regular.ttf":"f11da773d5e424caa06cbe86b19c8c3b","NotoNirmalaui-Regular.ttf":"8300e4a9865b6231e32e46b1707b8f7b","NotoSans-Bold.ttf":"f0fbfd466cf418784f70671d60b1e3ae","NotoSans-BoldItalic.ttf":"50c48f215078a295208b49554aea3987","NotoSans-Regular.ttf":"7d9f89ded30222fd1266979e91adaf88","NotoSansCanadianAboriginal-Regular.ttf":"462d533ae85cece0541123b8b3572374","NotoSansCherokee-Regular.ttf":"a88159ea01ed8715b9cdd68c4013fccb","NotoSansCJKjp-DemiLight.otf":"30c649feb1b2f3e329d91796c3064110","NotoSansCJKjp-Light.otf":"b81b161eff7c869389aaa6015c04730a","NotoSansCJKjp-Medium.otf":"dd4cedc2ef66c81cab848ad9601e8144","NotoSansCJKjp-Regular.otf":"0501218c178d3763f2f9ae15744eae69","NotoSansCJKjp-Thin.otf":"27428f85a1f9fc06d37b1e4f772b332e","NotoSansCJKkr-DemiLight.otf":"f08d579f072fc995a0d0cf04930601c1","NotoSansCJKkr-Light.otf":"aa338e61e68bf72f6adfd2733847c90d","NotoSansCJKkr-Medium.otf":"3ebac294262ed84a17b4a4787837e23a","NotoSansCJKkr-Regular.otf":"4cf03dc23b8bb8d4a19bdca44c799133","NotoSansCJKkr-Thin.otf":"eae1fc05cf33c41e0031cdd11db599f7","NotoSansCJKtc-DemiLight.otf":"bec6ef360c6e7ac3734b6fe28a4126e2","NotoSansCJKtc-Light.otf":"468d6c5da548fecbda4fd5a23b912166","NotoSansCJKtc-Medium.otf":"f20459bfb276c641f12426b82f4be596","NotoSansCJKtc-Thin.otf":"8ecb59643a91f8e2c041f8fef92b47c2","NotoSansEthiopic-Bold.ttf":"22142e5eb5edaf965ce01e3fc1894c01","NotoSansEthiopic-Regular.ttf":"7e19f7808de91fd1c4c9789a5f0450de","NotoSansGujarati-Bold.ttf":"500303eb9e05a1de5e6c01fd25edf0b7","NotoSansGujarati-Regular.ttf":"a5f559c25908b12d7fcfdaa1600fd9f1","NotoSansHebrew-Bold.ttf":"b2c1b6906d9d77c5672fcc4f4a3c7b61","NotoSansHebrew-Regular.ttf":"681afbd524342551a9b3bf974c0ad433","NotoSansKhmer-Bold.ttf":"4a799c2835ed2e32e92d071add8e4228","NotoSansKhmer-Regular.ttf":"11217ceabbe48efc06cb950ec37189ef","NotoSansLao-Bold.ttf":"12da97798a3838ed577ca954d9d0c34b","NotoSansLao-Regular.ttf":"e5dadb678254367dcc3f91a1863fa74a","NotoSansMongolian-Regular.ttf":"e3426a66b65f03ca853cdc7bea355b8f","NotoSansMonoCJKjp-Regular.otf":"0beee38f74ab3756ada63bd7ce40cbad","NotoSansMonoCJKkr-Regular.otf":"2b7b9ff7c17b0de1c3b5e6059971e8b9","NotoSansMonoCJKsc-Regular.otf":"c24d3cd332ddf3aca147541507e5deec","NotoSansMonoCJKtc-Regular.otf":"fd7b80221cdfbed04eb69a371c0681b8","NotoSansPhagsPa-Regular.ttf":"857df25a1ff86fd325dc35efa2cb749d","NotoSansSC-Black.otf":"1a4015a208e09022a62256eac48eebe7","NotoSansSC-Bold.otf":"6038abbaa72926e043eac1ffc1726fd3","NotoSansSC-DemiLight.otf":"db2514b43a247c427c3732de541c09de","NotoSansSC-Light.otf":"65e7865c68f0062b0673296a266f888a","NotoSansSC-Medium.otf":"0c714136a7e02b5e4820a6c7c8e59be6","NotoSansSC-Regular.otf":"0a1fe01e7d921603e8ba185cdf1be994","NotoSansSC-Thin.otf":"fcc448ce50589e3a5309895b7e2716da","NotoSansSinhala-Bold.ttf":"d90775d13538cfa519812193a5c24986","NotoSansSinhala-Regular.ttf":"408ad25235ba342df73ed40683c5122a","NotoSansSyriacEastern-Regular.ttf":"555d860b3efcbedfd0928856bd0d1678","NotoSansTaiLe-Regular.ttf":"1611c941bde482ee7c5b50a9c4dc5f9f","NotoSansTamil-Bold.ttf":"1bd32f3eab7154c43e689394a8c62033","NotoSansTamil-Regular.ttf":"7a9bd984400243ea3bf443be7a261a6c","NotoSansTCLight.otf":"f5b0408d4cbf63865eba3dc8d9109bfd","NotoSansTelugu-Bold.ttf":"e47d4bd6e1d8a55d48b97b33b6b8b09d","NotoSansTelugu-Regular.ttf":"9c3e0075f045d1943a07b0c06cfde600","NotoSansThaana-Bold.ttf":"9c615895d006c4a4d74c12d5fa3c1eff","NotoSansThaana-Regular.ttf":"59d78c806149e8cc9f12211aabcf71fb","NotoSansThai-Bold.ttf":"269e5db28965fa7d9f7895a23d088c87","NotoSansThai-Regular.ttf":"057fa6d673e2dda7afbf19d4a5d30901","NotoSansTibetan-Bold.ttf":"7c712907f958ccf0ebfbc28bf275154a","NotoSansTibetan-Regular.ttf":"06a4dbcbf8ef798d42383f6f2869d7be","NotoSansYi-Regular.ttf":"9f73151e0398e0bc70c4e9549ff3b046","NotoSerifKhmer-Bold.ttf":"9ed9ad995a6ba799e64a1949ea2e88ad","NotoSerifKhmer-Regular.ttf":"6c7bde29fb840cdeb077cdb66da2d0ad","NotoSerifLao-Bold.ttf":"4d2fb002f26a6e146781a207e315f0c3","NotoSerifLao-Regular.ttf":"730051aa181cefd7357c1eefd1c228b2","NotoSerifThai-Bold.ttf":"d4d31e29ea92a2b72b01edabb8b8483b","NotoSerifThai-Regular.ttf":"657709f54d9b04cf4967fe32e03873ea"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=P(n(31)),o=P(n(673)),i=P(n(674)),a=P(n(675)),s=P(n(676)),u=P(n(679)),c=P(n(680)),d=P(n(681)),l=P(n(682)),f=P(n(683)),h=P(n(684)),p=P(n(685)),m=P(n(686)),g=P(n(687)),y=P(n(688)),_=P(n(689)),v=P(n(690)),b=P(n(691)),S=P(n(692)),w=P(n(693)),M=P(n(694)),D=P(n(695));P(n(696));function P(e){return e&&e.__esModule?e:{default:e}}var T=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.engine=t}return e.prototype.get=function(e,t){var n=this.engine.AnnotType;switch(e.GetType()){case n.e_Highlight:return new o.default(e,t);case n.e_Squiggly:return new d.default(e,t);case n.e_StrikeOut:return new i.default(e,t);case n.e_Underline:return new a.default(e,t);case n.e_Line:return new s.default(e,t);case n.e_PolyLine:return new u.default(e,t);case n.e_FileAttachment:return new h.default(e,t);case n.e_Note:return new l.default(e,t);case n.e_Circle:return new f.default(e,t);case n.e_Caret:return new p.default(e,t);case n.e_Polygon:return new c.default(e,t);case n.e_FreeText:return new g.default(e,t);case n.e_Square:return new m.default(e,t);case n.e_Sound:return new D.default(e,t);case n.e_Ink:return new v.default(e,t);case n.e_Stamp:return new y.default(e,t);case n.e_Link:return new _.default(e,t);case n.e_Screen:return new S.default(e,t);case n.e_Widget:return new b.default(e,t);case n.e_Popup:return new w.default(e,t);case n.e_Redact:return new M.default(e,t);default:return new r.default(e,t)}},e}();t.default=T},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(109),i=(r=o)&&r.__esModule?r:{default:r},a=n(3);function s(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 c(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var d=function(e){function t(){return s(this,t),u(this,e.apply(this,arguments))}return c(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Highlight(e)},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.annot,o=this.engine;return r.GetDict().HasKey((0,a.CString)(o,"AreaHi"))&&(n.isArea=!0),n},t.prototype.setRect=function(t){var n=this.engine,r=new n.QuadPointsArray,o=n.QuadPoints,i=n.PointF;return r.Add(new o(new i(t.left,t.top),new i(t.right,t.top),new i(t.left,t.bottom),new i(t.right,t.bottom))),this.annot.SetQuadPoints(r),this.annot.ResetAppearanceStream(),e.prototype.setRect.call(this,t)},t.prototype.move=function(e,t){var n=this.annot.GetRect(),r=n.left+e,o=n.right+e,i=n.top+t,a=n.bottom+t,s=this.engine,u=new s.QuadPointsArray,c=s.QuadPoints,d=s.PointF;u.Add(new c(new d(r,i),new d(o,i),new d(r,a),new d(o,a))),this.annot.SetQuadPoints(u),u.delete(),this.annot.ResetAppearanceStream();var l=new this.engine.CFX_FloatRect(r,a,o,i),f=this.annot.Move(l);return l.delete(),f},t.prototype.create=function(t){var n=e.prototype.create.call(this,t),r=t.color;return r=r||0==r?r:16776960,this.setBorderColor(r),n},t}(i.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(109);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.StrikeOut(e)},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t);return n.IRT&&"Group"==n.RT&&""==n.intent&&(n.intent="StrikeOutTextEdit"),this.isReplace()&&(n.typeAlias="Replace"),n},t.prototype.updateQuadPointsByCharIndex=function(t,n){return e.prototype.updateQuadPointsByCharIndex.call(this,t,n)},t.prototype.isReplace=function(){var e=this.annot,t=void 0,n=void 0;if(e.IsGrouped()&&(t=e.GetGroupElements())&&2===(n=t.GetSize())){for(var r=["AnnotType_e_StrikeOut","AnnotType_e_Caret"],o=n;o--;){var i=t.GetAt(o);if(-1===r.indexOf(i.GetType().constructor.name))return!1}return!0}return!1},t.prototype.create=function(t){var n=e.prototype.create.call(this,t),r=t.color;return t.subject&&"replace"===t.subject.toLocaleLowerCase()?(r=r||0==r?r:255,this.setBorderColor(r)):(r=r||0==r?r:16711680,this.setBorderColor(r)),n},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(109);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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var a=function(e){function t(n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(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}(this,e.call(this,n,r)),i=o.annot;return o.annot=new o.engine.Underline(i),o._freeSuperAnnot(o.annot,i),o}return i(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Underline(e)},t.prototype.create=function(t){var n=e.prototype.create.call(this,t),r=t.color;return r=r||0==r?r:6736947,this.setBorderColor(r),n},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=n(18),a=(r=i)&&r.__esModule?r:{default:r},s=n(20),u=n(77);n(3);function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(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 l(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var f=function(e){function t(){return c(this,t),d(this,e.apply(this,arguments))}return l(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Line(e)},t.prototype.calculateLength=function(){var e=this.annot.GetMeasureRatio().toString(),t=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD).toString();if(0==t.length&&(t=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString()),0!=e.length){"p"==t&&(t="pica");var n=this.annot.GetEndPoint(),r=this.annot.GetStartPoint(),i=n.x-r.x,a=n.y-r.y,s=Math.sqrt(i*i+a*a),c=e.match(/([\d.]+) (\w+) = ([\d.]+) (\w+)/);if(c){var d=o(c,5),l=d[1],f=d[2],h=d[3],p=d[4];"in"==f&&(f="inch"),f=(0,u.getUnitByName)(f),l=parseFloat(l),h=parseFloat(h),p=(0,u.getUnitByName)(p),s=s*h/f.convertTo(l,u.POINT),s=Math.round(100*s)/100;var m=this.annot.GetContent().toString(),g=m.indexOf("\n"),y=m.lastIndexOf(" "),_=(y>=0&&m.substr(y+1),m.substr(0,-1===g?g:g+1)),v=new this.engine.WString(_+s+" "+t);this.annot.SetContent(v),v.delete()}}},t.prototype.enableCaption=function(e){return this.annot.EnableCaption(e),this.annot.ResetAppearanceStream(),!0},t.prototype.setFillColor=function(e){if("number"!=typeof e)throw new Error("Incorrect color value: "+e);return 0===e?(this.annot.RemoveProperty({value:3}),this.annot.ResetAppearanceStream()):(this.annot.SetStyleFillColor(e),this.annot.ResetAppearanceStream()),[this]},t.prototype.setCaptionOffset=function(e,t){var n=new this.engine.PointF(e,t);this.annot.SetCaptionOffset(n),this.annot.ResetAppearanceStream()},t.prototype.setCaptionPositionType=function(e){},t.prototype.setEndPoint=function(e,t){var n=new this.engine.PointF(e,t);this.annot.SetEndPoint(n),this.calculateLength(),this.annot.ResetAppearanceStream()},t.prototype.setLeaderLineExtensionLength=function(e){this.annot.SetLeaderLineExtensionLength(e),this.annot.ResetAppearanceStream()},t.prototype.setLeaderLineLength=function(e){this.annot.SetLeaderLineLength(e),this.annot.ResetAppearanceStream()},t.prototype.setLeaderLineOffset=function(e){this.annot.SetLeaderLineOffset(e),this.annot.ResetAppearanceStream()},t.prototype.setLineEndStyle=function(e){var t=this.engine.EndingStyle.values[e];this.annot.SetLineEndStyle(t),this.annot.ResetAppearanceStream()},t.prototype.setLineStartStyle=function(e){var t=this.engine.EndingStyle.values[e];this.annot.SetLineStartStyle(t),this.annot.ResetAppearanceStream()},t.prototype.setMeasureConversionFactor=function(e,t){},t.prototype.setMeasureRatio=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.userSpaceValue,n=void 0===t?1:t,r=e.userSpaceUnit,o=void 0===r?"inch":r,i=e.realValue,a=void 0===i?1:i,s=e.realUnit,u=void 0===s?"inch":s,c=new this.engine.String(n+" "+o+" = "+a+" "+u);this.annot.SetMeasureRatio(c),this.calculateLength(),this.annot.ResetAppearanceStream(),c.delete()},t.prototype.setMeasureUnit=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=new this.engine.String(e);this.annot.SetMeasureUnit(this.engine.MeasureType.values[t],n),this.calculateLength(),this.annot.ResetAppearanceStream(),n.delete()},t.prototype.setStartPoint=function(e,t){var n=new this.engine.PointF(e,t);this.annot.SetStartPoint(n),n.delete(),this.calculateLength(),this.annot.ResetAppearanceStream()},t.prototype.create=function(t){var n=e.prototype.create.call(this,t),r=this.annot,o=t.startStyle,i=t.endStyle,a=t.rect,u=t.enableCaption,c=t.startPoint,d=t.endPoint;if(o=o||0,i=i||0,void 0!==s.LineEndingName[o]&&this.setLineStartStyle(o),t.length&&this.setLeaderLineLength(t.length),t.intent==s.Intents.LINE_DIMENSION&&(t.leaderLineLength&&this.setLeaderLineLength(t.leaderLineLength),t.leaderLineExtend&&this.setLeaderLineExtensionLength(t.leaderLineExtend)),t.borderWidth&&this.setBorderWidth(t.borderWidth),t.borderStyle&&this.setBorderStyle(t.borderStyle,t.borderStyleParam),t.styleFillColor&&this.setFillColor(t.styleFillColor),t.fillColor&&this.setFillColor(t.fillColor),s.LineEndingName[i]&&this.setLineEndStyle(i),"boolean"==typeof u&&r.EnableCaption(u),void 0!==c?this.setStartPoint(c.x,c.y):this.setStartPoint(a.left,a.top),void 0!==d?this.setEndPoint(d.x,d.y):this.setEndPoint(a.right,a.bottom),t.measure){this.annot.SetMeasureConversionFactor(0,2);var l=new this.engine.String(t.measure.unit);this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX,l),this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD,l),this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeA,l),this.setMeasureRatio(t.measure.ratio),l.delete()}return this.calculateLength(t.label),n},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t);if(0==n.borderInfo.width){n.borderInfo.width=1;var r=this.annot.GetBorderInfo();r.width=1,this.annot.SetBorderInfo(r)}var o=this.annot.GetCaptionOffset(),i=this.annot.GetCaptionPositionType(),a=this.annot.GetEndPoint(),s=this.annot.GetLeaderLineExtensionLength(),u=this.annot.GetLeaderLineLength(),c=this.annot.GetLeaderLineOffset(),d=this.annot.GetLineEndStyle(),l=this.annot.GetLineStartStyle(),f=this.annot.GetMeasureConversionFactor(0),h=void 0,p=void 0;try{h=this.annot.GetMeasureRatio().toString(),0==(p=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD).toString()).length&&(p=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString())}catch(e){h=this.JR.getHexString(this.annot.GetMeasureRatio()),0==(p=this.JR.getHexString(this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD))).length&&(p=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString())}var m=this.annot.GetStartPoint();n.styleFillColor=this.getFillColor();var g=this.annot.HasCaption(),y={captionOffset:{x:o.x,y:o.y},capPos:i.value,endPoint:{x:a.x,y:a.y},leaderLineExtensionLength:s,leaderLineLength:u,leaderLineOffset:c,endingStyle:d.value,startStyle:l.value,measureConversionFactor:f,measureRatio:h,measureUnit:p,startPoint:{x:m.x,y:m.y},hasCaption:g};return Object.assign(y,n)},t}(a.default);t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PixelUnit=t.Unit=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(157),i=n(155);function a(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var u=t.Unit=function(){function e(t,n){s(this,e),this.fromInchRate=t,this.name=n}return e.prototype.convertTo=function(e,t){return e/this.fromInchRate*t.fromInchRate},e.prototype.convertAreaTo=function(e,t){return e/Math.pow(this.fromInchRate,2)*Math.pow(t.fromInchRate,2)},r(e,[{key:"isPixel",get:function(){return!1}}]),e}();t.PixelUnit=function(e){function t(n){s(this,t);var r=function(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}(this,e.call(this,0,"px"));return r.orientation=n,Object.defineProperty(r,"fromInchRate",{get:function(){var e=(0,i.getDPI)();switch(n){case o.ORIENTATION_HORIZONTAL:return e.x;case o.ORIENTATION_VERTICAL:return e.y;default:return e.x}}}),r}return a(t,e),r(t,[{key:"isPixel",get:function(){return!0}}]),t}(u)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);t.default=e}(n(77));t.default={inch:"inch",custom:"custom",mi:"mi",pt:"pt",ft:"ft",yd:"yd",km:"km",m:"m",cm:"cm",mm:"mm",pica:"pica"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=n(18),a=(r=i)&&r.__esModule?r:{default:r},s=(n(3),n(20),n(77));function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 d(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var l=function(e){function t(){return u(this,t),c(this,e.apply(this,arguments))}return d(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.PolyLine(e)},t.prototype.setLineEndStyle=function(e){var t=this.engine.EndingStyle.values[e];this.annot.SetLineEndStyle(t),this.annot.ResetAppearanceStream()},t.prototype.setLineStartStyle=function(e){var t=this.engine.EndingStyle.values[e];this.annot.SetLineStartStyle(t),this.annot.ResetAppearanceStream()},t.prototype.setFillColor=function(e){if("number"!=typeof e)throw new Error("Incorrect color value: "+e);return 0===e?(this.annot.RemoveProperty({value:3}),this.annot.ResetAppearanceStream()):(this.annot.SetStyleFillColor(e),this.annot.ResetAppearanceStream()),[this]},t.prototype.calculatePerimeter=function(){var e=this.annot.GetMeasureRatio().toString(),t=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD).toString();if(0==t.length&&(t=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString()),0!=e.length){var n=this.annot.GetVertexes();if(!(n.length<2)){var r=e.match(/([\d.]+) (\w+) = ([\d.]+) (\w+)/);if(r){var i=o(r,5),a=i[1],u=i[2],c=i[3],d=i[4];u=(0,s.getUnitByName)(u),a=parseFloat(a),c=parseFloat(c),d=(0,s.getUnitByName)(d);for(var l=0,f=n.GetAt(0),h=1;h<n.GetSize();h++){var p=n.GetAt(h),m=p.x-f.x,g=p.y-f.y,y=Math.sqrt(m*m+g*g);l+=y=y*c/u.convertTo(a,s.POINT),f=p}var _=this.annot.GetContent().toString(),v=_.indexOf("\n"),b=_.lastIndexOf(" "),S=b>=0&&_.substr(b+1),w=_.substr(0,-1===v?v:v+1),M=new this.engine.WString(w+Math.round(100*l)/100+" "+S||t);this.annot.SetContent(M),M.delete()}}}},t.prototype.updateVertexes=function(e,t,n){var r=this.annot.GetVertexes(),o=new this.engine.PointF(t,n);r.SetAt(parseInt(e),o),o.delete(),this.annot.SetVertexes(r),this.calculatePerimeter(),this.annot.ResetAppearanceStream()},t.prototype.setVertexes=function(e){var t=this,n=e.reduce((function(e,n){var r=n.x,o=n.y,i=new t.engine.PointF(r,o);return e.Add(i),i.delete(),e}),new this.engine.PointFArray);this.annot.SetVertexes(n),this.annot.ResetAppearanceStream()},t.prototype.setMeasureRatio=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.userSpaceValue,n=void 0===t?1:t,r=e.userSpaceUnit,o=void 0===r?"inch":r,i=e.realValue,a=void 0===i?1:i,s=e.realUnit,u=void 0===s?"inch":s,c=new this.engine.String(n+" "+o+" = "+a+" "+u);this.annot.SetMeasureRatio(c),this.calculatePerimeter(),this.annot.ResetAppearanceStream(),c.delete()},t.prototype.create=function(t){var n=this,r=e.prototype.create.call(this,t);if(t.vertexes){var o=t.vertexes.reduce((function(e,t){var r=t.x,o=t.y,i=new n.engine.PointF(r,o);return e.Add(i),i.delete(),e}),new this.engine.PointFArray);this.annot.SetVertexes(o)}if(t.fillColor&&this.setFillColor(t.fillColor),t.borderWidth&&this.setBorderWidth(t.borderWidth),t.borderStyle&&this.setBorderStyle(t.borderStyle,t.borderStyleParam),t.startStyle&&this.setLineStartStyle(t.startStyle),t.endStyle&&this.setLineEndStyle(t.endStyle),t.measure){this.annot.SetMeasureConversionFactor(0,2);var i=new this.engine.String(t.measure.unit);this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX,i),this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD,i),this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeA,i),this.setMeasureRatio(t.measure.ratio),i.delete()}return r},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.annot.GetLineEndStyle(),o=this.annot.GetLineStartStyle(),i=this.annot.GetVertexes();n.fillColor=this.getFillColor();var a=this.annot.GetMeasureConversionFactor(0),s=void 0,u=void 0;try{s=this.annot.GetMeasureRatio().toString(),0==(u=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD).toString()).length&&(u=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString())}catch(e){s=this.JR.getHexString(this.annot.GetMeasureRatio()),0==(u=this.JR.getHexString(this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD))).length&&(u=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString())}for(var c=[],d=0;d<i.GetSize();d++){var l=i.GetAt(d);c.push({x:l.x,y:l.y})}var f={endingStyle:r.value,startStyle:o.value,vertexes:c,measureConversionFactor:a,measureRatio:s,measureUnit:u};return Object.assign(f,n)},t}(a.default);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=n(18),a=(r=i)&&r.__esModule?r:{default:r},s=(n(3),n(20),n(77));function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 d(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var l=function(e){function t(){return u(this,t),c(this,e.apply(this,arguments))}return d(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Polygon(e)},t.caculateTriangleArea=function(e,t,n,r){r[FIELD_USER_SPACE_SCALE],r[FIELD_USER_SPACE_UNIT],r[FIELD_REAL_SCALE]},t.caculatePolygonArea=function(e,t){for(var n={x:0,y:0},r=0,o=1;o<=e.length;++o)o<e.length?r+=MathAlgorithm.caculateTriangleArea(n,e[o-1],e[o],t):r+=MathAlgorithm.caculateTriangleArea(n,e[o-1],e[0],t);return Math.abs(r)},t.prototype.calculateArea=function(){var e=this.annot.GetMeasureRatio().toString(),t=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD).toString();if(0==t.length&&(t=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString()),0!=e.length){var n=this.annot.GetVertexes();if(!(n.length<2)){var r=e.match(/([\d.]+) (\w+) = ([\d.]+) (\w+)/);if(r){var i=o(r,5),a=i[1],u=i[2],c=i[3],d=i[4];u=(0,s.getUnitByName)(u),a=parseFloat(a),c=parseFloat(c),d=(0,s.getUnitByName)(d);var l=function(e,t,n){var r=e.x*t.y+t.x*n.y+n.x*e.y-(e.x*n.y+t.x*e.y+n.x*t.y);return r/=2,s.POINT.convertAreaTo(r,u)*Math.pow(c/a,2)},f=function(e){for(var t={x:0,y:0},n=0,r=1;r<=e.GetSize();++r)r<e.GetSize()?n+=l(t,e.GetAt(r-1),e.GetAt(r)):n+=l(t,e.GetAt(r-1),e.GetAt(0));return Math.abs(n)}(n),h=this.annot.GetContent().toString(),p=h.indexOf("\n"),m=h.lastIndexOf(" "),g=m>=0&&h.substr(m+1),y=h.substr(0,-1===p?p:p+1),_=new this.engine.WString(y+Math.round(100*f)/100+" sq "+g||t);this.annot.SetContent(_),_.delete()}}}},t.prototype.updateVertexes=function(e,t,n){var r=this.annot.GetVertexes(),o=new this.engine.PointF(t,n);r.SetAt(parseInt(e),o),o.delete(),this.annot.SetVertexes(r),this.calculateArea(),this.annot.ResetAppearanceStream()},t.prototype.setVertexes=function(e){var t=this,n=e.reduce((function(e,n){var r=n.x,o=n.y,i=new t.engine.PointF(r,o);return e.Add(i),i.delete(),e}),new this.engine.PointFArray);this.annot.SetVertexes(n),this.annot.ResetAppearanceStream()},t.prototype.setMeasureRatio=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.userSpaceValue,n=void 0===t?1:t,r=e.userSpaceUnit,o=void 0===r?"inch":r,i=e.realValue,a=void 0===i?1:i,s=e.realUnit,u=void 0===s?"inch":s,c=new this.engine.String(n+" "+o+" = "+a+" "+u);this.annot.SetMeasureRatio(c),this.calculateArea(),this.annot.ResetAppearanceStream(),c.delete()},t.prototype.create=function(t){var n=e.prototype.create.call(this,t);if(t.vertexes&&this.setVertexes(t.vertexes),t.borderWidth&&this.setBorderWidth(t.borderWidth),t.borderStyle&&this.setBorderStyle(t.borderStyle,t.borderStyleParam),t.fillColor&&this.setFillColor(t.fillColor),t.measure){this.annot.SetMeasureConversionFactor(0,2);var r=new this.engine.String(t.measure.unit);this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX,r),this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD,r),this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeA,r),this.setMeasureRatio(t.measure.ratio),r.delete()}return n},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t);n.fillColor=this.getFillColor();for(var r=this.annot.GetVertexes(),o=[],i=0;i<r.GetSize();i++){var a=r.GetAt(i);o.push({x:a.x,y:a.y})}var s=this.annot.GetMeasureConversionFactor(0),u=void 0,c=void 0;try{u=this.annot.GetMeasureRatio().toString(),0==(c=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD).toString()).length&&(c=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString())}catch(e){u=this.JR.getHexString(this.annot.GetMeasureRatio()),0==(c=this.JR.getHexString(this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD))).length&&(c=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString())}var d={vertexes:o,measureRatio:u,measureUnit:c,measureConversionFactor:s};return Object.assign(d,n)},t.prototype.setFillColor=function(t){return e.prototype._setFillColor.call(this,t)},t}(a.default);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(109);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Squiggly(e)},t.prototype.create=function(t){var n=e.prototype.create.call(this,t),r=t.color;return r=r||0==r?r:16737843,this.setBorderColor(r),n},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(18),i=(r=o)&&r.__esModule?r:{default:r},a=n(20),s=n(3);function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 d(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var l=function(e){function t(){return u(this,t),c(this,e.apply(this,arguments))}return d(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Note(e)},t.prototype.setIconName=function(e){var t=this.annot;return t.SetIconName((0,s.CString)(this.engine,e)),t.ResetAppearanceStream(),!0},t.prototype.setOpenStatus=function(e){return this.annot.SetOpenStatus(e),annot.ResetAppearanceStream(),!0},t.prototype.setStateName=function(e){var t=this.engine.StateModel,n=this.annot;if(!n.IsStateAnnot())return!1;var r=void 0,o=this.engine.MarkupState;switch(n.GetStateModel()){case t.e_StateModelMarked:switch(e){case a.MARKUP_ANNOTATION_STATE.UNMARKED:r=o.e_StateUnmarked;break;case a.MARKUP_ANNOTATION_STATE.MARKED:r=o.e_StateMarked;break;default:throw new Error("Illegal argument: incorrect state name in marked state model: "+e)}break;case t.e_StateModelReview:switch(e){case a.MARKUP_ANNOTATION_STATE.ACCEPTED:r=o.e_StateAccepted;break;case a.MARKUP_ANNOTATION_STATE.CANCELLED:r=o.e_StateCancelled;break;case a.MARKUP_ANNOTATION_STATE.COMPLETED:r=o.e_StateCompleted;break;case a.MARKUP_ANNOTATION_STATE.NONE:r=o.e_StateNone;break;case a.MARKUP_ANNOTATION_STATE.REJECTED:r=o.e_StateRejected;break;case a.MARKUP_ANNOTATION_STATE.DEFERRED:r=o.e_StateDeferred;break;case a.MARKUP_ANNOTATION_STATE.FUTURE:r=o.e_StateFuture;break;default:throw new Error("Illegal argument: incorrect state name in review state model: "+e)}}return n.SetState(r),!0},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t);if(n.flag|=24,n.iconName=this.annot.GetIconName().toString(),this.annot.IsStateAnnot()){var r=this.engine.MarkupState;switch(n.isStateAnnot=!0,this.annot.GetState()){case r.e_StateAccepted:n.state=a.MARKUP_ANNOTATION_STATE.ACCEPTED;break;case r.e_StateCancelled:n.state=a.MARKUP_ANNOTATION_STATE.CANCELLED;break;case r.e_StateCompleted:n.state=a.MARKUP_ANNOTATION_STATE.COMPLETED;break;case r.e_StateNone:n.state=a.MARKUP_ANNOTATION_STATE.NONE;break;case r.e_StateRejected:n.state=a.MARKUP_ANNOTATION_STATE.REJECTED;break;case r.e_StateDeferred:n.state=a.MARKUP_ANNOTATION_STATE.DEFERRED;break;case r.e_StateFuture:n.state=a.MARKUP_ANNOTATION_STATE.FUTURE;break;case r.e_StateUnmarked:n.state=a.MARKUP_ANNOTATION_STATE.UNMARKED;break;case r.e_StateMarked:n.state=a.MARKUP_ANNOTATION_STATE.MARKED;break;default:n.isStateAnnot=!1}var o=this.annot.GetStateModel();o&&(n.stateMode=o.value)}else n.isStateAnnot=!1;return n.isOpen=this.annot.GetOpenStatus(),n},t.prototype.create=function(t){var n=e.prototype.create.call(this,t);return t.icon&&this.setIconName(t.icon),this.annot.ResetAppearanceStream(),n},t}(i.default);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=s(n(18)),i=s(n(76)),a=(n(3),n(77));function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 d(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var l=function(e){function t(){return u(this,t),c(this,e.apply(this,arguments))}return d(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Circle(e)},t.prototype._calculateRectDiffer=function(){var e=this.annot.GetRect(),t=this.annot.GetInnerRect();return i.default.subtract(e,t)},t.prototype.move=function(e,t){var n=this.annot,r=i.default.on(n.GetRect()).move(e,t).extract();return this.annot.Move(r)},t.prototype.setRect=function(e){var t=new this.engine.CFX_FloatRect(e.left,e.bottom,e.right,e.top),n=this.annot.Move(t);return this.annot.ResetAppearanceStream(),t.delete(),this.calculateArea(),n},t.prototype.setInnerRect=function(e){var t=new this.engine.CFX_FloatRect(e.left,e.bottom,e.right,e.top);return this.annot.SetInnerRect(t),this.annot.ResetAppearanceStream(),t.delete(),!0},t.prototype.getInnerRect=function(){return i.default.on(this.annot.GetInnerRect()).toPlainObject()},t.prototype.setAnnotRectAndInnerRect=function(e,t){var n=new this.engine.CFX_FloatRect(e.left,e.bottom,e.right,e.top),r=this.annot.Move(n),o=new this.engine.CFX_FloatRect(t.left,t.bottom,t.right,t.top);return this.annot.SetInnerRect(o),this.annot.ResetAppearanceStream(),o.delete(),n.delete(),this.calculateArea(),r},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.getFillColor(),o=i.default.on(this.annot.GetInnerRect()).toPlainObject(),a=this.annot.GetMeasureConversionFactor(0),s=void 0,u=void 0;try{s=this.annot.GetMeasureRatio().toString(),0==(u=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD).toString()).length&&(u=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString())}catch(e){s=this.JR.getHexString(this.annot.GetMeasureRatio()),0==(u=this.JR.getHexString(this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD))).length&&(u=this.JR.getHexString(this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX)))}var c={fillColor:r,innerRect:o,measureConversionFactor:a,measureRatio:s,measureUnit:u};return Object.assign(n,c)},t.prototype.setFillColor=function(t){return e.prototype._setFillColor.call(this,t)},t.prototype.create=function(t){var n=e.prototype.create.call(this,t);if(t.borderWidth&&this.setBorderWidth(t.borderWidth),t.fillColor&&this.setFillColor(t.fillColor),t.borderStyle&&this.setBorderStyle(t.borderStyle,t.borderStyleParam),t.measure){this.annot.SetMeasureConversionFactor(0,2);var r=new this.engine.String(t.measure.unit);this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX,r),this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD,r),this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeA,r),this.setMeasureRatio(t.measure.ratio),r.delete()}return n},t.prototype.calculateArea=function(){var e=this,t=this.annot.GetMeasureRatio().toString(),n=this.annot.GetMeasureUnit(0).toString();if(0!=t.length){var o=t.match(/(\d+) (\w+) = (\d+) (\w+)/);if(o){var i=r(o,5),s=i[1],u=i[2],c=i[3],d=i[4];u=(0,a.getUnitByName)(u),s=parseFloat(s),c=parseFloat(c),d=(0,a.getUnitByName)(d);var l=function(){var t=e.annot.GetRect(),n=(t.right-t.left)*(t.top-t.bottom)*Math.PI;return a.POINT.convertAreaTo(n/4,u)*Math.pow(c/s,2)}(),f=this.annot.GetContent().toString(),h=f.indexOf("\n"),p=f.lastIndexOf(" "),m=p>=0&&f.substr(p+1),g=f.substr(0,-1===h?h:h+1),y=new this.engine.WString(g+Math.round(100*l)/100+" sq "+m||n);this.annot.SetContent(y),y.delete()}}},t.prototype.setMeasureConversionFactor=function(e){this.annot.SetMeasureConversionFactor(0,e),this.calculateArea(),this.annot.ResetAppearanceStream()},t.prototype.setMeasureRatio=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.userSpaceValue,n=void 0===t?1:t,r=e.userSpaceUnit,o=void 0===r?"inch":r,i=e.realValue,a=void 0===i?1:i,s=e.realUnit,u=void 0===s?"inch":s,c=new this.engine.String(n+" "+o+" = "+a+" "+u);this.annot.SetMeasureRatio(c),this.calculateArea(),this.annot.ResetAppearanceStream(),c.delete()},t.prototype.setMeasureUnit=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=new this.engine.String(e);this.annot.SetMeasureUnit(this.engine.MeasureType.values[t],n),this.calculateArea(),this.annot.ResetAppearanceStream(),n.delete()},t}(o.default);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=s(n(18)),o=s(n(44)),i=n(3),a=s(n(31));function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 d(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var l=function(e){function t(){return u(this,t),c(this,e.apply(this,arguments))}return d(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.FileAttachment(e)},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.engine,a=this.annot,s=a.GetDict(),u=new o.default(this.getFileSpec(),this);n.fileSpec=u.toJson();var c=s.GetElement((0,i.CString)(r,"Contents"));if(c&&n.fileSpec){var d=c.GetWideString().toString();d!==n.fileSpec.fileName&&(n.fileSpec.description=d)}n.iconName=a.GetIconName().toString();var l=s.GetElement((0,i.CString)(r,"FS"));return l&&(l=l.GetDirectObject(),n.fObjNum=l.GetObjNum()),n},t.prototype.setIconName=function(e){var t=this.annot;return t.SetIconName(new this.engine.String(e)),t.ResetAppearanceStream(),!0},t.prototype.getFileSpec=function(){return this.annot.GetFileSpec()},t.prototype.create=function(t){var n=e.prototype.create.call(this,t),r=this.engine;try{t.iconName&&this.annot.SetIconName((0,i.CString)(r,t.iconName))}catch(e){console.log(e),isNaN(e)||(e=r.getErrorCode(e)),console.warn(e)}return this.setFile(t),this.annot.ResetAppearanceStream(),n},t.prototype.setFile=function(e){try{if(e.fObjNum){var t=this.doc,n=this.annot.GetDict(),r=new this.engine.String("FS");n.SetAtReference(r,t.GetIndirectObject(+e.fObjNum),t)}else if(e.buffer){var i=o.default.createFile(this.engine,this.annot.GetPage().GetDocument(),e.buffer),s=new o.default(i,this);e.fileName&&s.setFileName(e.fileName),e.file&&e.file.lastModifiedDate&&s.setModifiedDateTime(a.default.ToDateTime(this.engine,e.file.lastModifiedDate)),this.annot.SetFileSpec(i)}}catch(e){var u=this.engine,c=e instanceof u.ErrorCode?e:u.getErrorCode(e);console.warn(c)}return!0},t.prototype.getStream=function(e){var t=e.writeStream;return new o.default(this.getFileSpec(),this).getStream(t)},t}(r.default);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(18),i=(r=o)&&r.__esModule?r:{default:r},a=n(3);function s(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 c(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var d=function(e){function t(){return s(this,t),u(this,e.apply(this,arguments))}return c(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Caret(e)},t.prototype.moveRectByCharIndex=function(e){var t=this.annot,n=this.pdfPage.getNormalTextPageSync(),r=(n.GetTextRectCount(e,1),n.GetTextRect(0));n.delete();var o=t.GetRect(),i=new this.engine.CFX_FloatRect,a=o.right-o.left,s=o.top-o.bottom;i.left=r.right-a/2,i.right=r.right+a/2,i.top=r.bottom+s/5,i.bottom=r.bottom-4*s/5,t.Move(i),t.ResetAppearanceStream(),i.delete()},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.annot.GetInnerRect();return n.innerRect={top:r.top,right:r.right,bottom:r.bottom,left:r.left},this.isReplace()&&""==n.intent&&(n.intent="Replace"),n},t.prototype.create=function(t){var n=e.prototype.create.call(this,t),r=t.color;if(r||(r=t.subject&&"replace"===t.subject.toLocaleLowerCase()?r||0==r?r:255:r||0==r?r:10040217,this.setBorderColor(r)),t.rotation){var o=this.engine,i=new o.Matrix;i.Rotate(-t.rotation,!1),this.annot.GetDict().GetElement((0,a.CString)(o,"AP")).GetDict().GetElement((0,a.CString)(o,"N")).GetDict().SetAtMatrix((0,a.CString)(o,"Matrix"),i),i.delete()}return n},t.prototype.isReplace=function(){var e=this.annot,t=void 0,n=void 0;if(e.IsGrouped()&&(t=e.GetGroupElements())&&2===(n=t.GetSize())){for(var r=["AnnotType_e_StrikeOut","AnnotType_e_Caret"],o=n;o--;){var i=t.GetAt(o);if(-1===r.indexOf(i.GetType().constructor.name))return!1}return!0}return!1},t}(i.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=u(n(18)),i=u(n(76)),a=(n(3),n(20)),s=n(77);function u(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(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 l(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var f=function(e){function t(){return c(this,t),d(this,e.apply(this,arguments))}return l(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Square(e)},t.prototype._calculateRectDiffer=function(){var e=this.annot.GetRect(),t=this.annot.GetInnerRect();return i.default.subtract(e,t)},t.prototype.move=function(e,t){var n=this.annot,r=i.default.on(n.GetRect()).move(e,t).extract();return this.annot.Move(r)},t.prototype.setRect=function(e){var t=new this.engine.CFX_FloatRect(e.left,e.bottom,e.right,e.top),n=this.annot.Move(t);return this.annot.ResetAppearanceStream(),t.delete(),this.calculateArea(),n},t.prototype.setInnerRect=function(e){var t=new this.engine.CFX_FloatRect(e.left,e.bottom,e.right,e.top);return this.annot.SetInnerRect(t),this.annot.ResetAppearanceStream(),t.delete(),!0},t.prototype.setAnnotRectAndInnerRect=function(e,t){var n=new this.engine.CFX_FloatRect(e.left,e.bottom,e.right,e.top),r=this.annot.Move(n),o=new this.engine.CFX_FloatRect(t.left,t.bottom,t.right,t.top);return this.annot.SetInnerRect(o),n.delete(),o.delete(),this.annot.ResetAppearanceStream(),this.calculateArea(),r},t.prototype.getInnerRect=function(){return i.default.on(this.annot.GetInnerRect()).toPlainObject()},t.prototype.setBorderStyle=function(t,n){var r=this.annot.GetBorderInfo(),o=this.engine.BorderInfoStyle,i=e.prototype.setBorderStyle.call(this,t,n);if(t!==a.BORDER_STYLE.CLOUDY&&r.style===o.e_Cloudy){var s=this.annot.GetInnerRect(),u=this.annot.GetRect();this.annot.SetInnerRect(u),this.annot.Move(s),this.annot.ResetAppearanceStream()}return i},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.getFillColor(),o=i.default.on(this.annot.GetInnerRect()).toPlainObject(),a=this.annot.GetMeasureConversionFactor(0),s=void 0,u=void 0;try{s=this.annot.GetMeasureRatio().toString(),u=this.annot.GetMeasureUnit(0).toString()}catch(e){s=this.JR.getHexString(this.annot.GetMeasureRatio()),u=this.JR.getHexString(this.annot.GetMeasureUnit(0))}var c={fillColor:r,innerRect:o,measureConversionFactor:a,measureRatio:s,measureUnit:u};return Object.assign(n,c)},t.prototype.setFillColor=function(t){return e.prototype._setFillColor.call(this,t)},t.prototype.create=function(t){var n=e.prototype.create.call(this,t);if(t.fillColor&&this.setFillColor(t.fillColor),t.borderWidth&&this.setBorderWidth(t.borderWidth),t.borderStyle&&this.setBorderStyle(t.borderStyle,t.borderStyleParam),t.measure){this.annot.SetMeasureConversionFactor(0,2);var r=new this.engine.String(t.measure.unit);this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX,r),this.setMeasureRatio(t.measure.ratio),r.delete()}return n},t.prototype.calculateArea=function(){var e=this,t=this.annot.GetMeasureRatio().toString(),n=this.annot.GetMeasureUnit(0).toString();if(0!=t.length){var o=t.match(/(\d+) (\w+) = (\d+) (\w+)/);if(o){var i=r(o,5),a=i[1],u=i[2],c=i[3],d=i[4];u=(0,s.getUnitByName)(u),a=parseInt(a),c=parseInt(c),d=(0,s.getUnitByName)(d);var l=function(){var t=e.annot.GetRect(),n=(t.right-t.left)*(t.top-t.bottom);return s.POINT.convertAreaTo(n,u)*Math.pow(c/a,2)}(),f=new this.engine.WString(Math.round(100*l)/100+" sq "+n);this.annot.SetContent(f),f.delete()}}},t.prototype.setMeasureConversionFactor=function(e){this.annot.SetMeasureConversionFactor(0,e),this.calculateArea(),this.annot.ResetAppearanceStream()},t.prototype.setMeasureRatio=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.userSpaceValue,n=void 0===t?1:t,r=e.userSpaceUnit,o=void 0===r?"inch":r,i=e.realValue,a=void 0===i?1:i,s=e.realUnit,u=void 0===s?"inch":s,c=new this.engine.String(n+" "+o+" = "+a+" "+u);this.annot.SetMeasureRatio(c),this.calculateArea(),this.annot.ResetAppearanceStream(),c.delete()},t.prototype.setMeasureUnit=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new this.engine.String(e);this.annot.SetMeasureUnit(this.engine.MeasureType.values[t],n),this.calculateArea(),this.annot.ResetAppearanceStream(),n.delete()},t}(o.default);t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(18)),o=n(20),i=u(n(159)),a=n(3),s=n(158);function u(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(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 l(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var f=function(e){function t(){return c(this,t),d(this,e.apply(this,arguments))}return l(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.FreeText(e)},t.prototype.setAlignment=function(e){this.annot.SetAlignment({value:e}),this.annot.ResetAppearanceStream()},t.prototype.getRotation=function(){return 90*this.annot.GetRotation().value},t.prototype.setRotation=function(e){var t=e/90;return this.annot.SetRotation({value:t}),this.annot.ResetAppearanceStream(),[this.getId()]},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.annot;if(n.intent===o.Intents.FREETEXT_CALLOUT){for(var i=r.GetCalloutLineEndingStyle().value,s=r.GetCalloutLinePoints(),u=[],c=s.GetSize();c--;){var d=s.GetAt(c);u[c]={x:d.x,y:d.y}}n.calloutLineEndingStyle=i,n.calloutLinePoints=u}var l=r.GetAlignment().value;n.intent===o.Intents.FREETEXT_TYPEWRITER&&0!==l&&(l=0,r.SetAlignment(this.engine.Alignment.e_AlignmentLeft)),n.justification=l;var f=this.getRotation();n.rotation=f;var h=r.GetDefaultAppearance();n.defaultAppearance={flags:h.flags,textColor:h.text_color,textSize:h.text_size},h.font.IsEmpty()||(n.fontName=h.font.GetName().toString());var p=this.annot.GetDict(),m=(0,a.CString)(this.engine,"RC"),g=p.GetElement(m),y="";g&&(y=this.JR.getPDFString(g.GetString())),n.fillColor=this.getFillColor();var _=r.GetInnerRect();return n.innerRect={top:_.top,right:_.right,bottom:_.bottom,left:_.left},n.RC=y,m=(0,a.CString)(this.engine,"FoxitTag"),p.GetElement(m)&&(n.modifiable=!1),n},t.prototype.setCalloutLineEndingStyle=function(e){this.annot.SetCalloutLineEndingStyle({value:e}),this.annot.ResetAppearanceStream()},t.prototype.setInnerRect=function(e){var t=new this.engine.CFX_FloatRect(e.left,e.bottom,e.right,e.top);return this.annot.SetInnerRect(t),"FreeTextCallout"!=this.annot.GetIntent()&&this.annot.ResetAppearanceStream(),t.delete(),!0},t.prototype.setAnnotRectAndInnerRect=function(e,t){var n=void 0;e.left>e.right&&(n=e.right,e.right=e.left,e.left=n),e.bottom>e.top&&(n=e.top,e.top=e.bottom,e.bottom=n);var r=e.top-e.bottom,o=e.right-e.left,i=this.annot.GetRect(),a=!0;Math.abs(r-i.right+i.left)<.01&&Math.abs(o-i.top+i.bottom)<.01&&(a=!1);var s=new this.engine.CFX_FloatRect(e.left,e.bottom,e.right,e.top),u=this.annot.Move(s),c=new this.engine.CFX_FloatRect(t.left,t.bottom,t.right,t.top);return this.annot.SetInnerRect(c),s.delete(),c.delete(),u&&(this.updateModifyTime(),a&&this.annot.ResetAppearanceStream(),this.pdfPage.resetBitmapCache()),u},t.prototype.setCalloutLinePoints=function(e){for(var t=new this.engine.PointFArray,n=this.engine.PointF,r=e.length,o=0;o<r;o++){var i=new n(e[o].x,e[o].y);t.Add(i),i.delete()}return this.annot.SetCalloutLinePoints(t),this.annot.ResetAppearanceStream(),t.delete(),!0},t.prototype.setDefaultAp=function(e){var t=e.textColor,n=e.textSize,r=e.font;0===t&&(t|=4278190080,t>>>=0);var o=new this.engine.Font(1),i=1;if(r){var s=r.name,u=r.styles,c=r.charset;i=this.engine.DefAPFlags.e_FlagFont.value,o=new this.engine.Font((0,a.CWString)(this.engine,s),u||0,this.engine.Charset.values[c]||this.engine.Charset.e_CharsetANSI,0)}if(t&&(i|=2),n&&(i|=4),i){var d=new this.engine.DefaultAppearance(i,o,n,t);return this.annot.SetDefaultAppearance(d),this.annot.ResetAppearanceStream(),o.delete(),d.delete(),!0}},t.prototype.setFillColor=function(t){return e.prototype._setFillColor.call(this,t)},t.prototype.create=function(t){if(e.prototype.create.call(this,t),t.rotation){var n=(0,s.convertToGSDKRotate)(this.engine,t.rotation);this.annot.SetRotation(n)}var r;(r=t["interior-color"]||t.interiorColor)&&this.setFillColor(r),t.fillColor&&this.setFillColor(t.fillColor),t.alignment&&this.setAlignment(t.alignment);var o;if((o=t.contents)&&this.setContent(o),t.borderWidth&&this.setBorderWidth(t.borderWidth),t.borderStyle&&this.setBorderStyle(t.borderStyle,t.borderStyleParam),t.DA){var i=this.engine;this.annot.GetDict().SetAtString((0,a.CString)(i,"DA"),(0,a.CString)(i,t.DA));var u={textColor:t.fontColor,textSize:Number(t.DA.split(" ")[1])};this.setDefaultAp(u)}if(t.defaultAppearance&&"{}"!==JSON.stringify(t.defaultAppearance)){this.engine,this.annot.GetDict();var c={textColor:t.defaultAppearance.textColor?Number(t.defaultAppearance.textColor):4278190080,textSize:t.defaultAppearance.textSize?Number(t.defaultAppearance.textSize):0};this.setDefaultAp(c)}if(this.setRect(t.rect),t.innerRect&&this.setInnerRect(t.innerRect),t.calloutLinePoints&&this.setCalloutLinePoints(t.calloutLinePoints),"FreeTextCallout"==t.intent){var d=t.calloutLineEndingStyle||t.startStyle;null==d?this.setCalloutLineEndingStyle(4):this.setCalloutLineEndingStyle(d)}return[this]},t.prototype.getWoffBlob=function(){var e=this.annot;if(!e.GetDefaultAppearance().font.IsEmpty()){var t="",n=(e.GetDict().GetElement(new this.engine.String("DA")).GetString().toString()+" ").match(/\/([^\s]*) /);if(n&&n.length>1){t=n[1].replace(/#20/g," ");var r=this.JR.getFontBuffer(t.toString(),524322);if(r)return new Blob([r],{type:"application/woff"})}return null}},t.prototype.getWoff=function(){var e=this.engine,t=this.annot.GetDefaultAppearance(),n=this.pdfPage.doc,r=t.font;if(r.IsEmpty())return null;if(r.IsEmbedded(n))return i.default.getWoffDataBuffer(r.GetWoffData(n),this.engine);var o=e.Charset.e_CharsetDefault.value;r.GetFontType(n)==e.FontTypes.e_FontTypeCIDFont&&(o=r.GetFontType(n).value);var a=this.JR.getFontBuffer(r.GetBaseFontName(n).toString(),r.GetStyles(n),0,o,r.IsBold()?700:400,!0);return a?{buffer:a}:null},t.prototype.setContent=function(t){var n=this.annot,r=n.GetDict(),o=n.GetDefaultAppearance(),i=(0,a.CString)(this.engine,"RC");return r.GetElement(i)&&r.RemoveAt(i),n.SetDefaultAppearance(o),e.prototype.setContent.call(this,t,!0)},t}(r.default);t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(18)),o=a(n(166)),i=n(3);function a(e){return e&&e.__esModule?e:{default:e}}function s(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 c(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var d=function(e){function t(){return s(this,t),u(this,e.apply(this,arguments))}return c(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Stamp(e)},t.prototype.setIconName=function(e){},t.prototype.getIconName=function(){return this.JR.getPDFString(this.annot.GetIconName())},t.prototype.create=function(t){var n=e.prototype.create.call(this,t),r=this.engine,a=this.annot;try{if(t.rotation&&this.setRotation(t.rotation),t.apObjeNum){t.rect&&this.setRect(t.rect);var s=this.doc,u=a.GetDict(),c=(0,i.CString)(r,"AP"),d=u.GetElement(c);d||(d=r.PDFDictionary.Create().GetDict(),u.SetAt(c,d)),d.GetDirectObject().GetDict().SetAtReference((0,i.CString)(r,"N"),s.GetIndirectObject(+t.apObjeNum),s)}else{var l=(0,o.default)();if(l.jr||l.initIconProvider(this.JR,this.engine),t.iconInfo&&(l.addIcon(t.iconInfo),t.iconCategory=t.iconInfo.category,t.icon=t.iconInfo.name),t.iconCategory&&(l.activeIcon(t.iconCategory,t.icon),l.enable(!0)),t.icon){var f=new r.WString(t.icon);a.SetIconName(f.UTF8Encode()),a.ResetAppearanceStream(),l.enable(!1),f.delete()}}}catch(e){isNaN(e)||(e=this.engine.getErrorCode(e)),console.warn(e)}return n},t.prototype.setAnnotAPBitmap=function(e,t){var n=this,r=this.engine.ReaderCallback.implement({Release:function(){},GetSize:function(){return t},ReadBlock:function(t,r,o){var i=new Uint8Array(n.JR.requestData("GET",!1,e,r,o));return n.engine.HEAPU8.set(i,t),!0}}),o=new this.engine.Image(r);this.annot.SetImage(o,0,0),this.annot.ResetAppearanceStream()},t.prototype.setRotation=function(e){var t=this.annot.GetRotation(),n=this.annot;return n.Rotate((360-t)%360),n.Rotate(e%360),n.ResetAppearanceStream(),[this.getId()]},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t);n.rotation=this.annot.GetRotation(),n.iconName=this.getIconName();var r=this.engine,o=this.annot.GetDict().GetElement((0,i.CString)(r,"AP")),a=o&&o.GetDirectObject().GetDict(),s=a&&a.GetElement((0,i.CString)(r,"N")),u=s&&s.GetDirectObject();return u&&(n.apObjeNum=u.GetObjNum()),n},t}(r.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(31)),o=n(3),i=a(n(85));function a(e){return e&&e.__esModule?e:{default:e}}function s(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 u(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var c=function(e){function t(n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=s(this,e.call(this,n,r)),a=(n=i.annot).GetAction();a.IsEmpty()||(i.action=i.JR.actionManager.get(a,i.doc,i.JR));var u=i.engine,c=(0,o.CString)(u,"AP"),d=i.annot.GetDict().GetElement(c);return c=(0,o.CString)(u,"N"),64&n.GetFlags()?s(i):(d&&d.GetDict().HasKey(c)||n.ResetAppearanceStream(),i)}return u(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Link(e)},t.prototype.destroy=function(){this.action&&this.action.destroy(),e.prototype.destroy.call(this)},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.annot.GetHighlightingMode()||{value:0};n.highlightingMode=r.value,n.action=this.action&&this.action.toJson();var i=this.annot.GetDict().GetElement((0,o.CString)(this.engine,"A")),a=i&&i.GetDirectObject();return a&&(n.aObjNum=a.GetObjNum()),n},t.prototype.setHighlightingMode=function(e){return this.annot.SetHighlightingMode(this.engine.HighlightingMode.values[e]),this.annot.ResetAppearanceStream(),[this.getId()]},t.prototype.setAction=function(e,t,n){var r=this.engine,o=t.type,i=this.annot.GetPage().GetDocument(),a=void 0;if(a=o?this.JR.actionManager.create(i,t.type):this.JR.actionManager.create(i,t),n){var s=this.annot.GetAction();if(n&&!s.IsEmpty()){var u=s.GetSubActionCount();return s.InsertSubAction(u,a),o&&this.JR.actionManager.get(a,this.doc,this.JR).create(t),this.JR.actionManager.get(s,this.doc,this.JR)}}if(this.action&&this.action.action.GetType()===r.ActionType.e_TypeURI&&r.ActionType["e_"+(o?t.type:t)]===r.ActionType.e_TypeGoto){var c=this.annot.GetDict(),d=c.GetElement(new r.String("A")).GetDirectObject();c.SetAtReference(new r.String("PA"),d,this.doc)}this.annot.SetAction(a);var l=this.JR.actionManager.get(this.annot.GetAction(),this.doc,this.JR);return o&&l.create(t),l},t.prototype.create=function(t){var n=e.prototype.create.call(this,t);if(t.borderWidth&&this.setBorderWidth(t.borderWidth),t.borderStyle&&this.setBorderStyle(t.borderStyle,t.borderStyleParam),void 0!==t.highlightingMode&&this.setHighlightingMode(t.highlightingMode),t.aObjNum){var r=this.annot.GetDict(),o=new this.engine.String("A");r.GetElement(o)||r.SetAtReference(o,this.doc.GetIndirectObject(+t.aObjNum),this.doc);var i=this.annot.GetAction();i.IsEmpty()||(this.action=this.JR.actionManager.get(i,this.doc,this.JR))}return n},t.prototype.setBorderStyle=function(t,n){return e.prototype.setBorderStyle.call(this,t,n),[this.getId()]},t.prototype.hasPA=function(){var e=this.engine;return this.annot.GetDict().HasKey(new e.String("PA"))},t.prototype.resetAByPA=function(){if(!this.hasPA())return!1;var e=this.engine,t=this.annot.GetDict(),n=new e.String("PA"),r=t.GetElement(n).GetDirectObject();return t.SetAtReference(new e.String("A"),r,this.doc),t.RemoveAt(n),!0},t.prototype.removeAction=function(e,t){var n=this.engine,r=this.pdfPage.pdfDoc.doc,o=this.annot,a=o.GetAction();return a=(0,i.default)(n,r,a,t),t&&a?(o.SetAction(a),[this.JR.actionManager.get(a,this,this.JR).toJson()]):(o.RemoveAction(),[])},t}(r.default);t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(18);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Ink(e)},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.annot.GetInkList(),o=[];if(!r.IsEmpty())for(var i=r.GetPointCount(),a=0;a<i;a++){var s=r.GetPoint(a),u=r.GetPointType(a);o.push({x:s.x,y:s.y,type:u.value})}return n.inkList=o,n},t.prototype.setInkList=function(e){var t=this,n=new this.engine.Path;return e.forEach((function(e){var r=new t.engine.PointF(e.x,e.y);1===e.type?n.MoveTo(r):n.LineTo(r),r.delete()})),this.annot.SetInkList(n),n.delete(),this.annot.ResetAppearanceStream(),!0},t.prototype.create=function(t){t.borderWidth&&this.setBorderWidth(t.borderWidth);var n=e.prototype.create.call(this,t),r=t.inkList;return r&&this.setInkList(r),n},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=d(n(31)),i=d(n(37)),a=n(3),s=d(n(38)),u=d(n(85)),c=n(374);function d(e){return e&&e.__esModule?e:{default:e}}function l(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var f=function(e){function t(n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(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}(this,e.call(this,n,r));o.engineWidget=o.annot,o.page=r;var i=r.pdfDoc.form;return i&&i.hasWidgetChanged(n.GetDict().GetObjNum())&&n.ResetAppearanceStream(),o}return l(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Widget(e)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.engineWidget=null},t.prototype.updateMKProperty=function(e,t){var n=this.engineWidget,o=n.GetDict(),s=this.pdfPage.doc,u=this.engine,c=!0,d=void 0,l=void 0;switch(e){case"alignment":var f=(0,a.CString)(u,"Q");void 0===t?o.RemoveAt(f):o.SetAtInteger(f,t);break;case"directionRTL":var h=(0,a.CString)(u,"MEOptions");void 0===t?o.RemoveAt(h):o.SetAtInteger(h,t);break;case"lineSpace":var p=(0,a.CString)(u,"LS");if(void 0===t)o.RemoveAt(p);else{var m=this.engine.PDFArray.Create();m.AddInteger(t[0]),m.AddFloat(t[1]),o.SetAt(p,m)}break;case"borderColor":0===t?n.RemoveMKEntry(u.MKEntry.e_MKEntryBorderColor):n.SetMKBorderColor(t);break;case"fillColor":0==t?n.RemoveMKEntry(u.MKEntry.e_MKEntryBackgroundColor):n.SetMKBackgroundColor(t);break;case"normalCaption":l=new u.WString(t),n.SetMKNormalCaption(l),l.delete();break;case"downCaption":l=new u.WString(t),n.SetMKDownCaption(l),l.delete();break;case"rotation":var g=u.Rotation.e_Rotation0;switch(t){case 1:g=u.Rotation.e_Rotation90;break;case 2:g=u.Rotation.e_Rotation180;break;case 3:g=u.Rotation.e_Rotation270}n.SetMKRotation(g);break;case"rolloverCaption":l=new u.WString(t),n.SetMKRolloverCaption(l),l.delete();break;case"normalIcon":d="I";case"downIcon":d||(d="IX");case"rolloverIcon":d||(d="RI");var y=(0,a.CString)(u,"MK"),_=o.GetElement(y);if(_&&_.GetDict()?_=_.GetDict():(_=u.PDFDictionary.Create(),o.SetAtReference(y,_,s)),d=(0,a.CString)(u,d),"number"==typeof t)_.SetAtReference(d,s.GetIndirectObject(t),s);else if("object"==(void 0===t?"undefined":r(t)))if(t)if(t.height>0&&t.width>0){var v=new u.String(t.stream),b=this.doc.CreateIcon(v,t.width,t.height);_.SetAtReference(d,b,s)}else if(t instanceof Uint8Array){var S=i.default.createImage(u,t);S?n.SetMKNormalIconImage(S,0):c=!1}else _.RemoveAt(d);else _.RemoveAt(d);for(var w=n.GetField(),M=w.GetControlCount(),D=_.GetElement(d),P=D?D.GetDirectObject().GetObjNum():0,T=0;P&&T<M;T++){var k=w.GetControl(T).GetWidget();if(!k.IsEmpty()){var A=k.GetDict();if(A.GetObjNum()!=o.GetObjNum()){var L=A.GetElement(y);L&&L.GetDict()?L=L.GetDict():(L=u.PDFDictionary.Create(),A.SetAtReference(y,L,s)),L.SetAtReference(d,s.GetIndirectObject(P),s),k.ResetAppearanceStream()}}}}var F=this.pdfPage.pdfDoc.form,I=n.GetField().GetName().toString(),x=F.getField(I),C=x.engineField,R=C.GetDict(),O=C.GetValue();return x.label.length>0&&C.SetValue((0,a.CWString)(u,x.label)),n.ResetAppearanceStream(),x.label.length>0&&R.SetAtWString((0,a.CString)(u,"V"),O),c},t.prototype.setAS=function(e){if(e){var t=this.engineWidget.GetDict(),n=this.engine,r=(0,a.CString)(n,"AS"),o=new n.String(e);t.SetAt(r,n.PDFObject.CreateFromName(o)),(0,s.default)(o)}},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.engineWidget,o=r.GetField(),i=r.GetControl(),s=r.GetAction(),u="";s.IsEmpty()||(u=this.JR.actionManager.get(s,this.doc,this.JR).toJson());var d=this.engine,l=["Off"],f=void 0,h={},p=void 0,m=void 0,g=void 0,y=void 0,_=0,v=0,b=[];if(!r.IsEmpty()){var S=r.GetDict();_=(_=S.GetElement((0,a.CString)(d,"Q")))?_.GetInteger():0,h=(0,c.getAA)(this.JR,this.page.doc,S);var w=(0,a.CString)(d,"AS");if(S.HasKey(w)){var M=this.engineWidget.GetAppearanceOnStateName();try{l.push(M.toString())}catch(e){l.push(this.JR.getHexString(M))}f=this.engineWidget.GetAppearanceState().toString()}w=(0,a.CString)(d,"AP"),y=S.HasKey(w);var D=S.GetElement((0,a.CString)(d,"MK"));D&&D.GetDict()&&((p=D.GetDict().GetElement((0,a.CString)(d,"I")))&&(p=p.GetDirectObject().GetObjNum()),(m=D.GetDict().GetElement((0,a.CString)(d,"RI")))&&(m=m.GetDirectObject().GetObjNum()),(g=D.GetDict().GetElement((0,a.CString)(d,"IX")))&&(g=g.GetDirectObject().GetObjNum()));var P=S.GetElement((0,a.CString)(d,"MEOptions"));P&&(v=P.GetInteger());var T=S.GetElement((0,a.CString)(d,"LS"));if(T){var k=T.GetArray();2===k.GetElementCount()&&(b.push(k.GetElement(0).GetInteger()),b.push(Number(k.GetElement(1).GetFloat().toFixed(1))))}}var A=r.GetHighlightingMode();A&&(A=A.value);var L=0;L=r.HasMKEntry(d.MKEntry.e_MKEntryBackgroundColor)?4278190080|r.GetMKBackgroundColor():0;var F=void 0;F=r.HasMKEntry(d.MKEntry.e_MKEntryBorderColor)?4278190080|r.GetMKBorderColor():0;var I=r.GetMKDownCaption().toString(),x=r.GetMKIconCaptionRelation().value,C=r.GetMKIconFit(),R=r.GetMKNormalCaption().toString(),O=r.GetMKRolloverCaption().toString(),G=r.GetMKRotation().value,E="",Y=0,j=void 0;o.IsEmpty()||(E=o.GetName().toString(),Y=o.GetType().value,j=i.GetIndex(),this.engineWidget.GetDict().HasKey((0,a.CString)(this.engine,"PMD"))&&(Y=8));var N=!1,B=void 0,H=void 0,W=void 0;if(!o.IsEmpty()){H=i.GetDefaultAppearance();try{H.font.IsEmpty()||(N=H.font.IsEmbedded(this.pdfPage.doc),B=H.font.GetName().toString(),W=(W=H.font.GetFamilyName().toString()).replace(" ","").replace("-",""),H.font.IsBold()&&(W+="Bold"),H.font.IsItalic()&&(W+="Italic"))}catch(e){isNaN(e)||(e=d.getErrorCode(e)),console.warn(e)}}return Object.assign(n,{highlightingMode:A,fillColor:L,iconFit:{fitBounds:C.fit_bounds,horizontalFraction:C.horizontal_fraction,isProportionalScaling:C.is_proportional_scaling,scaleWayType:C.scale_way_type?C.scale_way_type.value:C.scale_way_type,verticalFraction:C.vertical_fraction},MKBorderColor:F,downCaption:I,normalCaption:R,rolloverCaption:O,captionRelation:x,rotation:G,field:E,control:j,fieldType:Y,action:u,AA:h,ApStates:l,ApState:f,normalIcon:p,rolloverIcon:m,downIcon:g,hasAP:y,alignment:_,directionRTL:v,lineSpace:b},H?{DA:{flags:H.flags,textColor:H.text_color,textSize:H.text_size,isEmbedded:N,fontName:B,fullName:W}}:{})},t.prototype.setAction=function(e,t,n){var r,o=this.engine,i=this.JR.actionManager,a=this.engineWidget,s=this.annot.GetPage().GetDocument();if(r=i.create(s,t.type),-1==e)try{a.SetAction(r)}catch(e){isNaN(e)||(e=o.getErrorCode(e)),console.warn(e)}else{var u=a.GetField(),c=this.pdfPage.pdfDoc.form,d=e>10&&e<17?a.GetDict():u.GetDict();c.addAAToDict(d,r,{trigger:e,field:u.GetName().toString()},n)}var l=i.get(r,this.doc,this.JR);return l.create(t),l},t.prototype.setDefaultAppearance=function(e){var t=this.engine,n=JSON.parse(e),r=this.engineWidget,o=r.GetControl(),i=void 0!==n.fontName?t.DefAPFlags.e_FlagFont.value:0,s=void 0!==n.textColor?t.DefAPFlags.e_FlagTextColor.value:0,u=void 0!==n.textSize?t.DefAPFlags.e_FlagFontSize.value:0,c=void 0;if(n.fontName){var d=mapFontName2StdID(n.fontName);if(d){var l=[t.StandardID.e_StdIDCourier,t.StandardID.e_StdIDCourierB,t.StandardID.e_StdIDCourierBI,t.StandardID.e_StdIDCourierI,t.StandardID.e_StdIDHelvetica,t.StandardID.e_StdIDHelveticaB,t.StandardID.e_StdIDHelveticaBI,t.StandardID.e_StdIDHelveticaI,t.StandardID.e_StdIDTimes,t.StandardID.e_StdIDTimesB,t.StandardID.e_StdIDTimesBI,t.StandardID.e_StdIDTimesI,t.StandardID.e_StdIDSymbol,t.StandardID.e_StdIDZapfDingbats];c=new this.engine.Font(l[d])}else c=new this.engine.Font((0,a.CWString)(t,n.fontName),0,t.Charset.e_CharsetANSI,0)}else c=new this.engine.Font(0);var f=new this.engine.DefaultAppearance(i|s|u,c,n.textSize?n.textSize:0,n.textColor?n.textColor:0);try{o.SetDefaultAppearance(f)}catch(e){return isNaN(e)||(e=t.getErrorCode(e)),void console.warn(e)}r.ResetAppearanceStream()},t.prototype.getWidgetMkOption=function(){var e=this.engine,t=this.engineWidget.GetMKIconCaptionRelation();switch(t){case e.MKIconCaptionRelation.e_MKRelationNoIcon:t="e_MKRelationNoIcon";break;case e.MKIconCaptionRelation.e_MKRelationNoCaption:t="e_MKRelationNoCaption";break;case e.MKIconCaptionRelation.e_MKRelationCaptionBelowIcon:t="e_MKRelationCaptionBelowIcon";break;case e.MKIconCaptionRelation.e_MKRelationCaptionAboveIcon:t="e_MKRelationCaptionAboveIcon";break;case e.MKIconCaptionRelation.e_MKRelationCaptionRight:t="e_MKRelationCaptionRight";break;case e.MKIconCaptionRelation.e_MKRelationCaptionLeft:t="e_MKRelationCaptionLeft";break;case e.MKIconCaptionRelation.e_MKRelationCaptionOvrlayOnIcon:t="e_MKRelationCaptionOvrlayOnIcon";break;default:t=""}var n=this.engineWidget.GetHighlightingMode();switch(n){case e.HighlightingMode.e_HighlightingNone:n="e_HighlightingNone";break;case e.HighlightingMode.e_HighlightingInvert:n="e_HighlightingInvert";break;case e.HighlightingMode.e_HighlightingOutline:n="e_HighlightingOutline";break;case e.HighlightingMode.e_HighlightingPush:n="e_HighlightingPush";break;case e.HighlightingMode.e_HighlightingToggle:n="e_HighlightingToggle";break;default:n=""}var r=this.engineWidget.GetMKNormalCaption().toString(),o=this.engineWidget.GetMKDownCaption().toString(),i=this.engineWidget.GetMKRolloverCaption().toString();return{labelIcon:{up:{label:r,icon:this.bitmapParseBlob(this.engineWidget.GetMKNormalIconBitmap())},down:{label:o,icon:this.bitmapParseBlob(this.engineWidget.GetMKDownIconBitmap())},rollover:{label:i,icon:this.bitmapParseBlob(this.engineWidget.GetMKRolloverIconBitmap())}},layout:t,behavior:n}},t.prototype.setWidgetIconCaptionRelation=function(e){e=e||"e_MKRelationNoIcon";var t=this.engine.MKIconCaptionRelation[e];this.engineWidget.SetMKIconCaptionRelation(t),this.engineWidget.ResetAppearanceStream()},t.prototype.setWidgetHighlighting=function(e){e=e||"e_HighlightingPush";var t=this.engine.HighlightingMode[e];this.engineWidget.SetHighlightingMode(t),this.engineWidget.ResetAppearanceStream()},t.prototype.setWidgetMkCaption=function(e,t){switch(e=e||"up",t=(0,a.CWString)(this.engine,t||""),e){case"up":this.engineWidget.SetMKNormalCaption(t);break;case"down":this.engineWidget.SetMKDownCaption(t);break;case"rollover":this.engineWidget.SetMKRolloverCaption(t)}this.engineWidget.ResetAppearanceStream()},t.prototype.setWidgetMkIcon=function(e,t){e=e||"up";var n=void 0;switch(t&&(n=i.default.createImage(this.engine,t).GetFrameBitmap(0)),e){case"up":t?this.engineWidget.SetMKNormalIconBitmap(n):this.engineWidget.RemoveMKEntry(this.engine.MKEntry.e_MKEntryNormalIcon);break;case"down":t?this.engineWidget.SetMKDownIconBitmap(n):this.engineWidget.RemoveMKEntry(this.engine.MKEntry.e_MKEntryDownIcon);break;case"rollover":t?this.engineWidget.SetMKRolloverIconBitmap(n):this.engineWidget.RemoveMKEntry(this.engine.MKEntry.e_MKEntryRolloverIcon)}this.engineWidget.ResetAppearanceStream()},t.prototype.getWidgetIconFitOption=function(){var e=this.engine,t=this.engineWidget.GetMKIconFit(),n=t.scale_way_type,r=t.is_proportional_scaling,o=t.fit_bounds,i=t.horizontal_fraction,a=t.vertical_fraction;switch(n){case e.ScaleWayType.e_ScaleWayAlways:n="e_ScaleWayAlways";break;case e.ScaleWayType.e_ScaleWayBigger:n="e_ScaleWayBigger";break;case e.ScaleWayType.e_ScaleWaySmaller:n="e_ScaleWaySmaller";break;case e.ScaleWayType.e_ScaleWayNever:n="e_ScaleWayNever";break;default:n="e_ScaleWayAlways"}return{scale_way_type:n,is_proportional_scaling:r+"",fit_bounds:o,horizontal_fraction:i=(100*i).toFixed(0),vertical_fraction:a=(100*a).toFixed(0)}},t.prototype.setWidgetIconFitOption=function(e){var t=new this.engine.IconFit,n=this.engine.ScaleWayType[e.scale_way_type],r=e.is_proportional_scaling,o=e.horizontal_fraction,i=e.vertical_fraction,a=e.fit_bounds;o=parseFloat(o/100),i=parseFloat(i/100),t.Set(n,"true"===r,o,i,a),this.engineWidget.SetMKIconFit(t),this.engineWidget.ResetAppearanceStream()},t.prototype.bitmapParseBlob=function(e){var t=this.engine,n="";if(!e.IsEmpty()){e.ConvertFormat(t.DIBFormat.e_DIBArgb);var r=e.GetWidth(),o=e.GetHeight(),i=e.GetBuffer(),a=o*e.GetPitch(),s=i+a,u=void 0;u=t.HEAPU8.buffer.slice?t.HEAPU8.buffer.slice(i,s):new Uint8Array(t.HEAPU8.buffer,i,a).buffer;var c=new Uint8Array(u),d=0,l=0,f=e.GetPitch();for(d=0;d<o;d++)for(l=0;l<r;l++){var h=d*f,p=[c[4*l+2+h],c[4*l+h]];c[4*l+h]=p[0],c[4*l+2+h]=p[1]}n={start:i,size:a,width:r,height:o,buffer:u}}return n},t.prototype.removeAction=function(e,t){var n=this,r=this.engine,o=this.pdfPage.pdfDoc.form.engineForm.GetDocument(),i=this.engineWidget;if("-1"==e){var s=i.GetAction();return s=(0,u.default)(r,o,s,t),t&&s?(i.SetAction(s),[this.JR.actionManager.get(s,this,this.JR).toJson()]):(i.RemoveAction(),[])}e=r.TriggerEvent.values[e];var c=i.GetField(),d=i.GetDict(),l=c.GetDict(),f=[d,l];return d.GetObjNum()==l.GetObjNum()&&(f=[d,null]),f.map((function(i){if(i){var s=void 0,c=(0,a.CString)(r,"AA"),d=i.GetElement(c);if(d){var l=d.GetDict();if(s=new r.AdditionalAction(o,l),t){var f=s.GetAction(e);if(f.IsEmpty())return;if(f=(0,u.default)(r,o,f,t))return s.SetAction(e,f),n.JR.actionManager.get(f,n,n.JR).toJson();s.RemoveAction(e)}else s.RemoveAction(e)}}}))},t.prototype.moveAction=function(e,t,n){if(t){var r=this.pdfPage.doc,o=new this.engine.Action(r,r.GetIndirectObject(t.objNumber).GetDict()),i=this.engineWidget;i.GetAction();return i.MoveAction(o,n)}},t}(o.default);t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=l(n(31)),o=l(n(37)),i=l(n(44)),a=n(3),s=l(n(38)),u=l(n(74)),c=n(374),d=l(n(85));function l(e){return e&&e.__esModule?e:{default:e}}function f(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var h=[0,90,180,270],p=function(e){function t(n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(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}(this,e.call(this,n,r));o.isAudioVideo=!1;var i=o.annot.GetAction();return i.IsEmpty()||(o.action=o.JR.actionManager.get(i,o.doc,o.JR),"ActionType_e_TypeRendition"==o.action.getType()&&(o.isAudioVideo=!0)),o}return f(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Screen(e)},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t);this.isAudioVideo||(n.action=this.action&&this.action.toJson()),n.opacity=this.getOpacity(),n.rotation=h[this.getRotation()],n.title=this.getTitle(),n.isAudioVideo=this.isAudioVideo;var r=this.annot.GetDict(),o=this.engine,i=r.GetElement((0,a.CString)(o,"MK")),s=i&&i.GetDirectObject().GetDict(),u=r.GetElement((0,a.CString)(o,"A")),d=u&&u.GetDirectObject();if(d&&(n.aObjNum=d.GetObjNum()),s){var l=s.GetElement((0,a.CString)(o,"I")),f=l&&l.GetDirectObject();f&&(n.iObjNum=f.GetObjNum())}n.AA=(0,c.getAA)(this.JR,this.pdfPage.doc,this.annot.GetDict(),17,21);var p=r.GetElement((0,a.CString)(o,"AP"));if(p){var m=p.GetDirectObject().GetDict().GetElement((0,a.CString)(o,"N"));m&&m.GetDirectObject()&&(n.apObjNum=m.GetDirectObject().GetObjNum())}return n},t.prototype.setBorderColor=function(e){var t=this.annot;if(0==e)t.RemoveProperty({value:2});else{if(-1==e)return;t.SetBorderColor(e)}t.ResetAppearanceStream()},t.prototype.getAction=function(){return this.action?this.action:null},t.prototype.setAction=function(e,t,n){var r,o=this.engine,i=this.JR.actionManager,a=this.annot,s=this.annot.GetPage().GetDocument();if(r=i.create(s,t.type),-1==e)try{a.SetAction(r)}catch(e){isNaN(e)||(e=o.getErrorCode(e)),console.warn(e)}else{var u=a.GetDict();this.pdfPage.pdfDoc.addAA(u,r,{trigger:e},n)}var c=i.get(r,s,this.JR);return c.create(t),c},t.prototype.getOpacity=function(){return this.annot.GetOpacity()},t.prototype.getRotation=function(){return this.annot.GetRotation().value},t.prototype.getTitle=function(){return this.annot.GetTitle().toString()},t.prototype.create=function(t){if(t.rotation){var n={0:0,90:1,180:2,270:3}[t.rotation]||0;this.annot.SetRotation(this.engine.Rotation.values[n]||0)}t.borderWidth?this.setBorderWidth(t.borderWidth):this.setBorderWidth(0);var r=e.prototype.create.call(this,t);if(void 0!==t.opacity){var o=+t.opacity;this.setOpacity(o)}if(t.apObjNum){var i=this.doc,u=this.annot.GetDict(),c=this.engine,d=(0,a.CString)(c,"AP"),l=(0,a.CString)(c,"MK"),f=u.GetElement(d),h=u.GetElement(l);if(f||(f=c.PDFDictionary.Create().GetDict(),u.SetAt(d,f)),h||(h=c.PDFDictionary.Create().GetDict(),u.SetAt(l,h)),f.GetDirectObject().GetDict().SetAtReference((0,a.CString)(c,"N"),i.GetIndirectObject(+t.apObjNum),i),t.aObjNum){var p=(0,a.CString)(c,"A");u.GetElement(p)||u.SetAtReference(p,i.GetIndirectObject(+t.aObjNum),i);var m=this.annot.GetAction();m.IsEmpty()||(this.action=this.JR.actionManager.get(m,this.doc,this.JR),"ActionType_e_TypeRendition"==this.action.getType()&&(this.isAudioVideo=!0))}if(t.iObjNum){var g=h.GetDirectObject().GetDict();g.SetAtReference((0,a.CString)(c,"I"),i.GetIndirectObject(+t.iObjNum),i);var y=(0,a.CString)(c,"IF"),_=g.GetElement(y);_||(_=c.PDFDictionary.Create().GetDict(),g.SetAt(y,_));var v=_.GetDirectObject().GetDict(),b=(0,a.CString)(c,"FB"),S=(0,a.CString)(c,"P"),w=(0,a.CString)(c,"S"),M=c.PDFObject.CreateFromBoolean(!0),D=c.PDFObject.CreateFromName(S);v.SetAt(b,M),v.SetAt(w,D),(0,s.default)(M,D)}}else if(t.multiBuffer&&(this.setMultiMedia(t.multiBuffer,t.fileName,t.contentType),this.isAudioVideo=!0),t.buffer&&!this.setImage(t.buffer))return null;return r},t.prototype.setMultiMedia=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"video.mp4",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"video/mp4",r=this.annot.GetPage().GetDocument(),o=this.engine.Action.Create(r,this.engine.ActionType.e_TypeRendition),a=new this.engine.RenditionAction(o);a.SetOperationType(this.engine.OperationType.e_OpTypeAssociate),a.SetScreenAnnot(this.annot);var u=new this.engine.Rendition(r,null),c=new this.engine.WString(t);u.SetRenditionName(c),u.SetMediaClipName(c);var d=i.default.createFile(this.engine,r,e);d.SetFileName(c),u.SetMediaClipFile(d);var l=new this.engine.String(n);u.SetMediaClipContentType(l),a.InsertRendition(u,-1),this.annot.SetAction(a),this.annot.ResetAppearanceStream(),(0,s.default)(c,l,u,a),this.action=this.JR.actionManager.get(o,this.doc,this.JR)},t.prototype.setImage=function(e){try{var t=o.default.createImage(this.engine,e);this.annot.SetImage(t,0,0),this.annot.ResetAppearanceStream()}catch(e){var n=this.engine,r=e instanceof n.ErrorCode?n.getErrorCode(e):e;return u.default.getLogger("setImage").warn(r),!1}return!0},t.prototype.setOpacity=function(e){var t=this.annot;return e=+e,t.SetOpacity(e),t.ResetAppearanceStream(),[this.getId()]},t.prototype.setRotation=function(e){var t=this.annot,n=this.engine.Rotation,r={0:n.e_Rotation0,90:n.e_Rotation90,180:n.e_Rotation180,270:n.e_Rotation270};return t.SetRotation(r[e]),t.ResetAppearanceStream(),[this.getId()]},t.prototype.setBorderStyle=function(t,n){return e.prototype.setBorderStyle.call(this,t,n),[this.getId()]},t.prototype.setTitle=function(e){var t=this.annot,n=new this.engine.WString(e);return t.SetTitle(n),r.default.updateModifyTime(this.engine,t),n.delete(),[this.getId()]},t.prototype.removeAction=function(e,t){var n=this,r=this.engine,o=this.pdfPage.pdfDoc.doc,i=this.annot;if("-1"==e){var s=i.GetAction();return s=(0,d.default)(r,o,s,t),t&&s?(i.SetAction(s),[this.JR.actionManager.get(s,this,this.JR).toJson()]):(i.RemoveAction(),[])}return e=r.TriggerEvent.values[e],[i.GetDict()].map((function(i){if(i){var s=void 0,u=(0,a.CString)(r,"AA"),c=i.GetElement(u);if(c){var l=c.GetDict();if(s=new r.AdditionalAction(o,l),t){var f=s.GetAction(e);if(f.IsEmpty())return;if(f=(0,d.default)(r,o,f,t))return s.SetAction(e,f),n.JR.actionManager.get(f,n,n.JR).toJson();s.RemoveAction(e)}else s.RemoveAction(e)}}}))},t.prototype.moveAction=function(e,t,n){if(t){var r=this.pdfPage.doc,o=new this.engine.Action(r,r.GetIndirectObject(t.objNumber).GetDict()),i=this.engineWidget;i.GetAction();return i.MoveAction(o,n)}},t}(r.default);t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(31),i=(r=o)&&r.__esModule?r:{default:r},a=n(3);function s(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 c(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var d=function(e){function t(){return s(this,t),u(this,e.apply(this,arguments))}return c(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Popup(e)},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.annot;return n.openStatus=r.GetOpenStatus(),n},t.prototype.create=function(t){e.prototype.create.call(this,t);var n=(t.open||"no").toString();"yes"===n||"true"===n?this.setOpenStatus(!0):this.setOpenStatus(!1);var r=t.popId;return r&&this.annot.SetUniqueID((0,a.CWString)(this.engine,r)),[this]},t.prototype.setOpenStatus=function(e){return this.annot.SetOpenStatus(e),e},t}(i.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(18)),o=n(3),i=n(227),a=n(104),s=u(n(31));function u(e){return e&&e.__esModule?e:{default:e}}function c(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var d=function(e){function t(n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(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}(this,e.call(this,n,r));return o.gsdkIDs=[o.engine.StandardID.e_StdIDCourier,o.engine.StandardID.e_StdIDCourierB,o.engine.StandardID.e_StdIDCourierBI,o.engine.StandardID.e_StdIDCourierI,o.engine.StandardID.e_StdIDHelvetica,o.engine.StandardID.e_StdIDHelveticaB,o.engine.StandardID.e_StdIDHelveticaBI,o.engine.StandardID.e_StdIDHelveticaI,o.engine.StandardID.e_StdIDTimes,o.engine.StandardID.e_StdIDTimesB,o.engine.StandardID.e_StdIDTimesBI,o.engine.StandardID.e_StdIDTimesI,o.engine.StandardID.e_StdIDSymbol,o.engine.StandardID.e_StdIDZapfDingbats],o}return c(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Redact(e)},t.prototype.apply=function(){var e=this;if(!this.engine.Library.HasModuleLicenseRight({value:3}))return Promise.reject(i.error.noRedactionLicense);var t={},n=[];return this.pdfPage.getAnnots().then((function(n){return n.forEach((function(e){var n=e.getId();n&&(t[n]=e)})),e.annot.Apply()?e.pdfPage.update():new Error})).then((function(e){for(var r in t){t[r];-1===e.annotIds.indexOf(r)&&n.push(r)}return n}))},t.prototype.setRedactOverlayText=function(e){return this.engine.Library.HasModuleLicenseRight({value:3})?(void 0!==e&&(this.annot.SetOverlayText((0,o.CWString)(this.engine,e)),this.annot.ResetAppearanceStream()),!0):Promise.reject(i.error.noRedactionLicense)},t.prototype.removeRedactOverlayText=function(){return this.engine.Library.HasModuleLicenseRight({value:3})?(this.annot.RemoveOverlayText(),this.annot.ResetAppearanceStream(),!0):Promise.reject(i.error.noRedactionLicense)},t.prototype.setRedactOverlayTextAlignment=function(e){if(!this.engine.Library.HasModuleLicenseRight({value:3}))return Promise.reject(i.error.noRedactionLicense);var t=[this.engine.Alignment.e_AlignmentLeft,this.engine.Alignment.e_AlignmentCenter,this.engine.Alignment.e_AlignmentRight];return t[e]&&(this.annot.SetOverlayTextAlignment(t[e]),this.annot.ResetAppearanceStream()),!0},t.prototype.setRedactRepeat=function(e){return this.engine.Library.HasModuleLicenseRight({value:3})?(void 0!==e&&(this.annot.SetRepeat(e),this.annot.ResetAppearanceStream()),!0):Promise.reject(i.error.noRedactionLicense)},t.prototype.setRedactAutoFontSize=function(e){return this.engine.Library.HasModuleLicenseRight({value:3})?(void 0!==e&&(this.annot.SetAutoFontSize(e),this.annot.ResetAppearanceStream()),!0):Promise.reject(i.error.noRedactionLicense)},t.prototype.getRedactDefaultAppearance=function(){if(!this.engine.Library.HasModuleLicenseRight({value:3}))return Promise.reject(i.error.noRedactionLicense);var e=this.annot.GetDefaultAppearance(),t=e.font,n={textColor:e.text_color,textSize:e.text_size};return t.IsEmpty()||(n.fontName=t.GetName().toString()),n},t.prototype.setRedactDefaultAppearance=function(e){if(!this.engine.Library.HasModuleLicenseRight({value:3}))return Promise.reject(i.error.noRedactionLicense);var t=this.annot.GetDefaultAppearance(),n=e.textColor,r=e.textSize,s=e.fontName;void 0===n&&(n=t.text_color),void 0===r&&(r=t.text_size);var u=void 0;if(s){var c=(0,a.mapFontName2StdID)(s);u=null!=c?new this.engine.Font(this.gsdkIDs[c]):new this.engine.Font((0,o.CWString)(this.engine,s),0,this.engine.Charset.e_CharsetANSI,0)}else t.font.IsEmpty()&&(u=new this.engine.Font(this.engine.StandardID.e_StdIDHelvetica));var d=((u=u||t.font)?this.engine.DefAPFlags.e_FlagFont.value:0)|this.engine.DefAPFlags.e_FlagTextColor.value|(r>0?this.engine.DefAPFlags.e_FlagFontSize.value:0),l=new this.engine.DefaultAppearance(d,u,r,n||16711680),f=this.annot.SetDefaultAppearance(l);return this.annot.ResetAppearanceStream(),f},t.prototype.setRedactOpacity=function(e,t){return this.engine.Library.HasModuleLicenseRight({value:3})?(this.annot.SetOpacity(e,t),this.annot.ResetAppearanceStream(),!0):Promise.reject(i.error.noRedactionLicense)},t.prototype.setRedactApplyFillColor=function(e){return this.engine.Library.HasModuleLicenseRight({value:3})?(this.annot.SetApplyFillColor(e),this.annot.ResetAppearanceStream(),!0):Promise.reject(i.error.noRedactionLicense)},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t);n.quadPoints=this.getQuadPointsArray(),0===n.quadPoints.length?n.isArea=!0:n.isArea=!1,n.applyFillColor=this.annot.GetApplyFillColor(),n.fillColor=this.annot.GetFillColor(),n.overlayText=this.annot.GetOverlayText().toString(),n.justification=this.annot.GetOverlayTextAlignment().value;var r=this.annot.GetDefaultAppearance();if(n.defaultAppearance={flags:r.flags,textColor:r.text_color,textSize:r.text_size},!r.font.IsEmpty()){var o=r.font.GetName().toString();n.fontName=a.FoxitFontMap[o]}n.isRepeat=this.annot.GetRepeat(),n.isOverlayCode=this.annot.HasOverlayCode(),n.overlayCode=[];for(var i=this.annot.GetOverlayCode(),s=0;s<i.GetSize();s++)n.overlayCode.push(i.GetAt(s));return n},t.prototype.getQuadPointsArray=function(){var e=[],t=this.annot.GetDict(),n=(0,o.CString)(this.engine,"QuadPoints");if(t.HasKey(n))for(var r=t.GetElement(n).GetArray(),i=r.GetElementCount()/8,a=0;a<i;a++){var s=[];s.push({x:r.GetElement(8*a).GetFloat(),y:r.GetElement(8*a+1).GetFloat()},{x:r.GetElement(8*a+2).GetFloat(),y:r.GetElement(8*a+3).GetFloat()},{x:r.GetElement(8*a+4).GetFloat(),y:r.GetElement(8*a+5).GetFloat()},{x:r.GetElement(8*a+6).GetFloat(),y:r.GetElement(8*a+7).GetFloat()}),e.push(s)}return e},t.prototype.updateQuadPointsByCharIndex=function(e,t){try{if(-1===e||-1===t)return!1;if(e>t){var n=e;e=t,t=n}var r=this.pdfPage.getNormalTextPageSync(),i=r.GetTextRectCount(e,t-e+1);if(i<1)return r.delete(),!1;for(var a=this.engine,s=(new a.QuadPointsArray,a.QuadPoints,a.PointF),u=a.PDFArray.Create(),c=0,d=i;c<d;c++){var l=r.GetTextRect(c),f=r.GetBaselineRotation(c),h=l.top,p=l.right,m=l.bottom,g=l.left,y=new s(g,h),_=new s(p,h),v=new s(g,m),b=new s(p,m),S=void 0,w=void 0,M=void 0,D=void 0;switch(f.value%4){case 0:S=y,w=_,M=v,D=b;break;case 1:S=y,w=v,M=_,D=b;break;case 2:S=b,w=v,M=_,D=y;break;case 3:S=b,w=_,M=v,D=y}u.AddFloat(S.x),u.AddFloat(S.y),u.AddFloat(w.x),u.AddFloat(w.y),u.AddFloat(M.x),u.AddFloat(M.y),u.AddFloat(D.x),u.AddFloat(D.y)}var P=this.annot;return P.GetDict().SetAt((0,o.CString)(a,"QuadPoints"),u),P.ResetAppearanceStream(),r.delete(),!0}catch(e){isNaN(e)||(e=this.engine.getErrorCode(e))}},t.prototype.create=function(t){return e.prototype.create.call(this,t)},t.prototype.setRedactAppearance=function(e){var t=e.applyFillColor,n=e.isAutoFontSize,r=e.textColor,i=e.textSize,s=e.fontName,u=e.justification,c=e.isRepeat,d=e.overlayText,l=e.redactionCode,f=this.engine,h=this.annot.GetDefaultAppearance();void 0!==t&&this.annot.SetApplyFillColor(t),void 0!==n&&this.annot.SetAutoFontSize(n),r=void 0===r?h.text_color:r,i=void 0===i?h.text_size:parseFloat(i);var p=void 0;if(s){var m=(0,a.mapFontName2StdID)(s);p=m?new f.Font(this.gsdkIDs[m]):new f.Font((0,o.CWString)(f,s),0,f.Charset.e_CharsetANSI,0)}else h.font.IsEmpty()&&(p=new f.Font(f.StandardID.e_StdIDHelvetica));var g=((p=p||h.font)?f.DefAPFlags.e_FlagFont.value:0)|f.DefAPFlags.e_FlagTextColor.value|(i>0?f.DefAPFlags.e_FlagFontSize.value:0),y=new f.DefaultAppearance(g,p,i,r||16711680);if(this.annot.SetDefaultAppearance(y),"0"===u&&this.annot.SetOverlayTextAlignment(f.Alignment.e_AlignmentLeft),"1"===u&&this.annot.SetOverlayTextAlignment(f.Alignment.e_AlignmentCenter),"2"===u&&this.annot.SetOverlayTextAlignment(f.Alignment.e_AlignmentRight),void 0!==c&&this.annot.SetRepeat(c),void 0!==d&&this.annot.SetOverlayText((0,o.CWString)(f,d)),l){var _=new f.Int32Array;l.forEach((function(e){return _.Add(e)})),this.annot.SetOverlayCode(_)}else this.annot.RemoveOverlayCode();return this.annot.ResetAppearanceStream(),!0},t.prototype.removeOverlayText=function(){this.engine;return this.annot.RemoveOverlayText(),this.annot.ResetAppearanceStream(),!0},t.prototype.setRedactFillColor=function(e,t){if("number"!=typeof e)throw new Error("Incorrect color value: "+e);void 0===t&&(t=!1),e<0&&(e=0);var n=this.annot,r=this.engine;0===e?n.RemoveProperty({value:3}):(n.SetOpacity(n.GetOpacity(),t),n.SetFillColor&&n.SetFillColor(e)),n.ResetAppearanceStream(),s.default.updateModifyTime(r,n)},t}(r.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(18)),o=(c(n(76)),n(3)),i=c(n(38)),a=c(n(44)),s=c(n(37)),u=n(375);function c(e){return e&&e.__esModule?e:{default:e}}function d(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var l=function(e){function t(n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(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}(this,e.call(this,n,r));return o.isAudioVideo=!0,o}return d(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Sound(e)},t.prototype.getSoundStream=function(){return this.annot.GetSoundStream()},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.engine;this.isAudioVideo||(n.action=this.action&&this.action.toJson()),n.opacity=this.getOpacity(),n.isAudioVideo=this.isAudioVideo;try{n.title=this.annot.GetTitle().toString();var i=this.getSoundStream(),a=this.annot.GetSamplingRate(),s=this.annot.GetBits(),c=this.annot.GetChannelCount();if(i){var d=i.GetDataSize(!1);if(d>0){var l=r._malloc(d);i.GetData(!1,d,l);var f=(0,u.getArrayBufferFrom)(r,l,d);n.soundObj={data:f,sampleRate:a,sampleBits:s,channel:c,size:d},r._free(l)}}}catch(e){console.error(e)}var h=this.annot.GetDict(),p=h.GetElement((0,o.CString)(r,"AP"));if(p){var m=p.GetDirectObject().GetDict().GetElement((0,o.CString)(r,"N")),g=h.GetElement((0,o.CString)(r,"A")),y=g&&g.GetDirectObject();y&&(n.aObjNum=y.GetObjNum()),m&&m.GetDirectObject()&&(n.apObjNum=m.GetDirectObject().GetObjNum())}var _=h.GetElement((0,o.CString)(r,"MK")),v=_&&_.GetDirectObject().GetDict();if(v){var b=v.GetElement((0,o.CString)(r,"I")),S=b&&b.GetDirectObject();S&&(n.iObjNum=S.GetObjNum())}var w=h.GetElement((0,o.CString)(r,"Name"));return w&&(n.iconName=(w.GetName()||"").toString()),n},t.prototype.setBorderColor=function(e){var t=this.annot;if(0==e)t.RemoveProperty({value:2});else{if(-1==e)return;t.SetBorderColor(e)}t.ResetAppearanceStream()},t.prototype.getOpacity=function(){return this.annot.GetOpacity()},t.prototype.getTitle=function(){return this.annot.GetTitle()},t.prototype.create=function(t){t.rotate&&this.annot.SetRotation(this.engine.Rotation.values[t.rotate]),t.borderWidth&&this.setBorderWidth(t.borderWidth);var n=e.prototype.create.call(this,t);if(this.setBorderWidth(0),void 0!==t.opacity){var r=+t.opacity;this.setOpacity(r)}if(t.apObjNum){var a=this.doc,s=this.annot.GetDict(),u=this.engine,c=(0,o.CString)(u,"AP"),d=(0,o.CString)(u,"MK"),l=s.GetElement(c),f=s.GetElement(d);if(l||(l=u.PDFDictionary.Create().GetDict(),s.SetAt(c,l)),f||(f=u.PDFDictionary.Create().GetDict(),s.SetAt(d,f)),l.GetDirectObject().GetDict().SetAtReference((0,o.CString)(u,"N"),a.GetIndirectObject(+t.apObjNum),a),t.aObjNum){var h=(0,o.CString)(u,"A");s.GetElement(h)||s.SetAtReference(h,a.GetIndirectObject(+t.aObjNum),a);var p=this.annot.GetAction();p.IsEmpty()||(this.action=this.JR.actionManager.get(p,this.doc,this.JR),"ActionType_e_TypeRendition"==this.action.getType()&&(this.isAudioVideo=!0))}if(t.iObjNum){var m=f.GetDirectObject().GetDict();m.SetAtReference((0,o.CString)(u,"I"),a.GetIndirectObject(+t.iObjNum),a);var g=(0,o.CString)(u,"IF"),y=m.GetElement(g);y||(y=u.PDFDictionary.Create().GetDict(),m.SetAt(g,y));var _=y.GetDirectObject().GetDict(),v=(0,o.CString)(u,"FB"),b=(0,o.CString)(u,"P"),S=(0,o.CString)(u,"S"),w=u.PDFObject.CreateFromBoolean(!0),M=u.PDFObject.CreateFromName(b);_.SetAt(v,w),_.SetAt(S,M),(0,i.default)(w,M)}}else t.multiBuffer&&(this.setMultiMedia(t.multiBuffer,t.fileName,t.contentType),this.isAudioVideo=!0),t.buffer?this.setImage(t.buffer):this.annot.ResetAppearanceStream();return n},t.prototype.setMultiMedia=function(e,t,n){var r=this.annot.GetPage().GetDocument(),o=this.engine.Action.Create(r,this.engine.ActionType.e_TypeRendition),s=new this.engine.RenditionAction(o);s.SetOperationType(this.engine.OperationType.e_OpTypeAssociate),s.SetScreenAnnot(this.annot);var u=new this.engine.Rendition(r,null),c=new this.engine.WString(t);u.SetRenditionName(c),u.SetMediaClipName(c);var d=a.default.createFile(this.engine,r,e);d.SetFileName(c),u.SetMediaClipFile(d);var l=new this.engine.String(n);u.SetMediaClipContentType(l),s.InsertRendition(u,-1),this.annot.SetAction(s),this.annot.ResetAppearanceStream(),(0,i.default)(c,l,u,s),this.action=this.JR.actionManager.get(o,this.doc,this.JR)},t.prototype.setImage=function(e){try{var t=s.default.createImage(this.engine,e);this.annot.SetImage(t,0,0),this.annot.ResetAppearanceStream()}catch(e){var n=this.engine,r=e instanceof n.ErrorCode?e:n.getErrorCode(e);console.warn(r)}return!0},t.prototype.setOpacity=function(e){var t=this.annot;return e=+e,t.SetOpacity(e),t.ResetAppearanceStream(),[this.getId()]},t.prototype.setRotation=function(e){var t=this.annot,n=this.engine.Rotation,r={0:n.e_Rotation0,90:n.e_Rotation90,180:n.e_Rotation180,270:n.e_Rotation270};return t.SetRotation(r[e]),t.ResetAppearanceStream(),[this.getId()]},t.prototype.setBorderStyle=function(t,n){return e.prototype.setBorderStyle.call(this,t,n),[this.getId()]},t.prototype.removeAction=function(){return this.annot.RemoveAction(),!0},t}(r.default);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=o(n(18));o(n(76));function o(e){return e&&e.__esModule?e:{default:e}}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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var a=function(e){function t(n,r){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(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}(this,e.call(this,n,r))}return i(t,e),t}(r.default);t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=_(n(19)),o=_(n(698)),i=_(n(699)),a=_(n(700)),s=_(n(701)),u=_(n(702)),c=_(n(703)),d=_(n(704)),l=_(n(705)),f=_(n(706)),h=_(n(707)),p=_(n(708)),m=_(n(709)),g=_(n(711)),y=_(n(712));function _(e){return e&&e.__esModule?e:{default:e}}var v=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.engine=t}return e.prototype.get=function(e,t,n){var _=this.engine,v=_.ActionType;switch(e&&!e.IsEmpty()&&e.GetType()||null){case v.e_TypeThread:return new y.default(e,t,_,n);case v.e_TypeSetOCGState:return new g.default(e,t,_,n);case v.e_TypeURI:return new o.default(e,t,_,n);case v.e_TypeLaunch:return new a.default(e,t,_,n);case v.e_TypeNamed:return new s.default(e,t,_,n);case v.e_TypeJavaScript:return new u.default(e,t,_,n);case v.e_TypeResetForm:return new d.default(e,t,_,n);case v.e_TypeSubmitForm:return new c.default(e,t,_,n);case v.e_TypeImportData:return new l.default(e,t,_,n);case v.e_TypeGoto:return new i.default(e,t,_,n);case v.e_TypeRendition:return new f.default(e,t,_,n);case v.e_TypeHide:return new h.default(e,t,_,n);case v.e_TypeGoToR:return new p.default(e,t,_,n);case v.e_TypeGoToE:return new m.default(e,t,_,n);case v.e_TypeUnknown:case v.e_TypeSound:case v.e_TypeMovie:case v.e_TypeTrans:case v.e_TypeGoTo3DView:default:return new r.default(e,t,_,n)}},e.prototype.create=function(e,t){var n=this.engine.ActionType;return r.default.create(this.engine,e,n["e_"+t])},e.prototype.getActionByDict=function(e,t){return new this.engine.Action(e,t)},e}();t.default=v},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(19);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.createAction=function(e){return new this.engine.URIAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);return t.uri=this.getURI(),t},t.prototype.setActionData=function(e){return this.setURI(e.uri),!0},t.prototype.create=function(e){return e.uri&&this.setURI(e.uri),!0},t.prototype.getURI=function(){var e=this.action.GetURI(),t=void 0;try{t=e.toString()}catch(s){isNaN(s)||(s=this.engine.getErrorCode(s)),console.warn(s);for(var n="",r=e.GetLength(),o=e.GetBuffer(),i=0;i<r;i++){var a=this.engine.HEAP8[o+i]>>>0&255;n+=String.fromCharCode(a)}t=n}return t},t.prototype.setURI=function(e){var t=new this.engine.String(e);this.action.SetURI(t),t.delete()},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=i(n(19)),o=i(n(105));function i(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 s(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 u(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var c=function(e){function t(){return a(this,t),s(this,e.apply(this,arguments))}return u(t,e),t.prototype.createAction=function(e){return new this.engine.GotoAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this),n=this.getDestination();return t.destination=n.toJson(),t},t.prototype.getDestination=function(){return new o.default(this.action.GetDestination(),this.doc,this.engine)},t.prototype.setActionData=function(e){return this.setDestination(e.destination||e)},t.prototype.create=function(e){if(e.destination)return this.setDestination(e.destination)},t.prototype.setDestination=function(e){var t=this.doc;t.doc&&(t=t.doc);var n=o.default.create(this.engine,t,e);return this.action.SetDestination(n),!0},t}(r.default);t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(19)),o=a(n(44)),i=n(3);function a(e){return e&&e.__esModule?e:{default:e}}function s(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 c(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var d=function(e){function t(){return s(this,t),u(this,e.apply(this,arguments))}return c(t,e),t.prototype.createAction=function(e){return new this.engine.LaunchAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this),n=this.getFileSpec();return t.fileSpec=n.toJson(),t},t.prototype.getFileSpec=function(){return this.fileSpec=new o.default(this.action.GetFileSpec(),this)},t.prototype.setActionData=function(e){try{if(e.fileSpec)return this.create(e);e.buffer&&this.setFileSpec(e)}catch(e){return!1}return!0},t.prototype.create=function(e){if(e.fileSpec){var t=new this.engine.FileSpec(this.doc);return t.SetFileName((0,i.CWString)(this.engine,e.fileSpec.fileName)),this.action.SetFileSpec(t),!0}try{data.buffer&&this.setFileSpec(e)}catch(e){return!1}return!0},t.prototype.setFileSpec=function(e){var t=o.default.createFile(this.engine,this.doc,e.buffer);new o.default(t,this).setFileName(e.fileName),this.action.SetFileSpec(t)},t}(r.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(19);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.createAction=function(e){return new this.engine.NamedAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);return t.name=this.getName(),t},t.prototype.setActionData=function(e){try{this.setName(e.name)}catch(e){return!1}return!0},t.prototype.create=function(e){try{this.setName(e.name)}catch(e){return!1}return!0},t.prototype.getName=function(){return this.action.GetName().toString()},t.prototype.setName=function(e){var t=new this.engine.String(e);this.action.SetName(t),t.delete()},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(3),i=n(19);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(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 u(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var c=function(e){function t(){return a(this,t),s(this,e.apply(this,arguments))}return u(t,e),t.prototype.createAction=function(e){return new this.engine.JavaScriptAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);return t.javascript=this.getScript(),t},t.prototype.setActionData=function(e){try{this.setScript(e.script||e.javascript)}catch(e){return!1}return!0},t.prototype.create=function(e){var t=e.script;t||(t=e.javascript);try{t&&this.setScript(t)}catch(e){return!1}return!0},t.prototype.getScript=function(){return this.action.GetScript().toString()},t.prototype.setScript=function(e){var t=this.engine,n=(0,o.CWString)(t,e);this.action.GetDict().SetAtWString((0,o.CString)(t,"JS"),n),n.delete()},t}(((r=i)&&r.__esModule?r:{default:r}).default);t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(19);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.createAction=function(e){return new this.engine.SubmitFormAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);return t.flags=this.getFlags(),t.url=this.getURL(),t.fieldNames=this.getFieldNames(),t},t.prototype.setActionData=function(e){try{this.setFlags(e.flags||0),e.url&&this.setURL(e.url),e.fieldNames&&this.setFieldNames(e.fieldNames)}catch(e){return!1}return!0},t.prototype.create=function(e){try{e.flags&&this.setFlags(e.flags),e.url&&this.setURL(e.url),e.fieldNames&&this.setFieldNames(e.fieldNames)}catch(e){return!1}return!0},t.prototype.getFieldNames=function(){for(var e=this.action.GetFieldNames(),t=[],n=e.GetSize(),r=0;r<n;r++)t.push(e.GetAt(r).toString());return t},t.prototype.getFlags=function(){return this.action.GetFlags()},t.prototype.getURL=function(){var e=this.action.GetURL();return 0===e.GetLength()?null:this.JR.getPDFString(e)},t.prototype.setFieldNames=function(e){var t=this,n=new this.engine.WStringArray;e.forEach((function(e){var r=new t.engine.WString(e);n.Add(r),r.delete()}));var r=this.action.SetFieldNames(n);return n.delete(),r},t.prototype.setFlags=function(e){return this.action.SetFlags(Number(e))},t.prototype.setURL=function(e){return this.action.SetURL(new this.engine.String(e))},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(19);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.createAction=function(e){return new this.engine.ResetFormAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);return t.flags=this.getFlags(),t.fieldNames=this.getFieldNames(),t},t.prototype.setActionData=function(e){try{e.flags&&this.setFlags(e.flags),e.fieldNames&&this.setFieldNames(e.fieldNames)}catch(e){return!1}return!0},t.prototype.create=function(e){try{e.flags&&this.setFlags(e.flags),e.fieldNames&&this.setFieldNames(e.fieldNames)}catch(e){return!1}return!0},t.prototype.getFieldNames=function(){for(var e=this.action.GetFieldNames(),t=[],n=e.GetSize(),r=0;r<n;r++)t.push(e.GetAt(r).toString());return t},t.prototype.getFlags=function(){return this.action.GetFlags()},t.prototype.setFieldNames=function(e){var t=this,n=new this.engine.WStringArray;e.forEach((function(e){var r=new t.engine.WString(e);n.Add(r),r.delete()}));var r=this.action.SetFieldNames(n);return n.delete(),r},t.prototype.setFlags=function(e){return this.action.SetFlags(Number(e))},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(19)),o=a(n(44)),i=n(3);function a(e){return e&&e.__esModule?e:{default:e}}function s(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 c(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var d=function(e){function t(){return s(this,t),u(this,e.apply(this,arguments))}return c(t,e),t.prototype.createAction=function(e){return new this.engine.ImportDataAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this),n=this.getFDFFileSpec();return t.fileSpec=n.toJson(),t},t.prototype.setActionData=function(e){try{if(e.fileSpec)return this.create(e);e.buffer&&this.setFDFFileSpec(e)}catch(e){return!1}return!0},t.prototype.create=function(e){if(e.fileSpec){var t=new this.engine.FileSpec(this.doc);return t.SetFileName((0,i.CWString)(this.engine,e.fileSpec.fileName)),this.action.SetFDFFileSpec(t),!0}try{e.buffer&&this.setFDFFileSpec(e)}catch(e){return!1}return!0},t.prototype.getFDFFileSpec=function(){return this.fileSpec=new o.default(this.action.GetFDFFileSpec(),this)},t.prototype.setFDFFileSpec=function(e){var t=o.default.createFile(this.engine,this.doc,e.buffer);new o.default(t,this).setFileName(e.fileName),this.action.SetFDFFileSpec(t)},t}(r.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=i(n(19)),o=i(n(44));function i(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 s(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 u(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var c=function(e){function t(){return a(this,t),s(this,e.apply(this,arguments))}return u(t,e),t.prototype.createAction=function(e){return new this.engine.RenditionAction(e)},t.prototype.toJson=function(){for(var t=this,n=e.prototype.toJson.call(this),r=this.action.GetRenditionCount(),i=[],a=function(e){var n=t.action.GetRendition(e),r=n.GetMediaClipContentType(),a=void 0;try{a=r.toString()}catch(e){for(var s="",u=r.GetLength(),c=r.GetBuffer(),d=0;d<u;d++){var l=t.engine.HEAP8[c+d]>>>0&255;s+=String.fromCharCode(l)}a=s}var f=n.GetMediaClipFile(),h=f.GetFileName().toString(),p=new o.default(f,t),m=p.getFileSize(),g=new Uint8Array(m);p.getStream((function(e,t,n){var r=new Uint8Array(e);g.set(r,t)})),i.push({fileSize:m,fileName:h,contentType:a,buffer:g})},s=0;s<r;s++)a(s);return n.renditions=i,n},t}(r.default);t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(19);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.createAction=function(e){return new this.engine.HideAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);return t.fieldNames=this.getFieldNames(),t.hideState=this.getHideState(),t},t.prototype.getFieldNames=function(){for(var e=this.action.GetFieldNames(),t=[],n=0;n<e.GetSize();n++)t.push(e.GetAt(n).toString());return t},t.prototype.getHideState=function(){return this.action.GetHideState()},t.prototype.setActionData=function(e){try{this.setFieldNames(e.fieldNames),this.setHideState(e.hideState)}catch(e){return!1}return!0},t.prototype.create=function(e){try{e.fieldNames&&this.setFieldNames(e.fieldNames),this.setHideState(e.hideState)}catch(e){return!1}return!0},t.prototype.setFieldNames=function(e){var t=this,n=new this.engine.WStringArray;e.forEach((function(e){var r=new t.engine.WString(e);n.Add(r),r.delete()}));var r=this.action.SetFieldNames(n);return n.delete(),r},t.prototype.setHideState=function(e){return this.action.SetHideState(e)},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(19)),o=a(n(105)),i=a(n(44));function a(e){return e&&e.__esModule?e:{default:e}}function s(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 c(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var d=function(e){function t(){return s(this,t),u(this,e.apply(this,arguments))}return c(t,e),t.prototype.createAction=function(e){return new this.engine.RemoteGotoAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);t.destinationName=this.getDestinationName();var n=this.getDestination();t.destination=n.toJson();var r=this.getFileSpec();return t.fileSpec=r.toJson(),t.newWindowFlag=this.getNewWindowFlag(),t},t.prototype.getDestinationName=function(){return this.action.GetDestinationName().toString()},t.prototype.getDestination=function(){return new o.default(this.action.GetDestination(),this.doc,this.engine)},t.prototype.getFileSpec=function(){return this.fileSpec=new i.default(this.action.GetFileSpec(),this)},t.prototype.getNewWindowFlag=function(){return this.action.GetNewWindowFlag().value},t.prototype.setActionData=function(e){this.setDestination(e),e.destinationName&&this.setDestinationName(e.destinationName),this.setFileSpec(e.buffer,e.fileName),e.newWindowFlag&&this.setNewWindowFlag(e.newWindowFlag)},t.prototype.create=function(e){this.setDestination(e.destination),e.destinationName&&this.setDestinationName(e.destinationName),this.setFileSpec(e.buffer,e.fileName),e.newWindowFlag&&this.setNewWindowFlag(e.newWindowFlag)},t.prototype.setDestination=function(e){var t=this.doc,n=null;switch(e.type){case"ZoomXYZ":n=o.default.createXYZ;break;case"ZoomFitPage":n=o.default.createFitPage;break;case"ZoomFitHorz":n=o.default.createFitHorz;break;case"ZoomFitVert":n=o.default.createFitVert;break;case"ZoomFitRect":n=o.default.createFitRect;break;case"ZoomFitBBox":n=o.default.createFitBBox;break;case"ZoomFitBHorz":n=o.default.createFitBHorz;break;default:n=o.default.createFitBVert}var r=n(this.engine,t,e);return this.action.SetDestination(r),!0},t.prototype.setDestinationName=function(e){return this.action.SetDestinationName(e),!0},t.prototype.setFileSpec=function(e,t){var n=i.default.createFile(this.engine,this.doc,e);new i.default(n,this).setFileName(t),this.action.SetFileSpec(n)},t.prototype.setNewWindowFlag=function(e){var t=[this.engine.NewWindowFlag.e_NewWindowFlagFalse,this.engine.NewWindowFlag.e_NewWindowFlagTrue,this.engine.NewWindowFlag.e_NewWindowFlagNone];this.action.SetNewWindowFlag(t[e])},t}(r.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=s(n(19)),o=s(n(105)),i=s(n(44)),a=s(n(710));function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 d(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var l=function(e){function t(){return u(this,t),c(this,e.apply(this,arguments))}return d(t,e),t.prototype.createAction=function(e){return new this.engine.EmbeddedGotoAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);t.destinationName=this.getDestinationName();var n=this.getDestination();t.destination=n.toJson();var r=this.getRootFile();return t.rootFile=r.toJson(),t.newWindowFlag=this.getNewWindowFlag(),this.action.GetTarget().IsEmpty()||(t.target=this.getTarget().toJson()),t},t.prototype.getDestinationName=function(){return this.action.GetDestinationName().toString()},t.prototype.getDestination=function(){return new o.default(this.action.GetDestination(),this.doc,this.engine)},t.prototype.getRootFile=function(){return this.fileSpec=new i.default(this.action.GetRootFile(),this)},t.prototype.getNewWindowFlag=function(){return this.action.GetNewWindowFlag().value},t.prototype.getTarget=function(){return new a.default(this.action.GetTarget(),this.engine,this.doc)},t.prototype.setActionData=function(e){this.setDestination(e),e.destinationName&&this.setDestinationName(e.destinationName),e.buffer&&this.setRootFile(e.buffer,e.fileName),e.newWindowFlag&&this.setNewWindowFlag(e.newWindowFlag),this.setTarget(e.target)},t.prototype.create=function(e){this.setDestination(e.destination),e.destinationName&&this.setDestinationName(e.destinationName),e.buffer&&this.setRootFile(e.buffer,e.fileName),e.newWindowFlag&&this.setNewWindowFlag(e.newWindowFlag),e.target&&this.setTarget(e.target)},t.prototype.setDestination=function(e){var t=this.doc,n=null;switch(e.type){case"ZoomXYZ":n=o.default.createXYZ;break;case"ZoomFitPage":n=o.default.createFitPage;break;case"ZoomFitHorz":n=o.default.createFitHorz;break;case"ZoomFitVert":n=o.default.createFitVert;break;case"ZoomFitRect":n=o.default.createFitRect;break;case"ZoomFitBBox":n=o.default.createFitBBox;break;case"ZoomFitBHorz":n=o.default.createFitBHorz;break;default:n=o.default.createFitBVert}var r=n(this.engine,t,e);return this.action.SetDestination(r),!0},t.prototype.setDestinationName=function(e){return this.action.SetDestinationName(e),!0},t.prototype.setRootFile=function(e,t){var n=i.default.createFile(this.engine,this.doc,e);new i.default(n,this).setFileName(t);try{this.action.SetRootFile(n)}catch(e){isNaN(e)||(e=this.engine.getErrorCode(e)),console.warn(e)}},t.prototype.setNewWindowFlag=function(e){var t=[this.engine.NewWindowFlag.e_NewWindowFlagFalse,this.engine.NewWindowFlag.e_NewWindowFlagTrue,this.engine.NewWindowFlag.e_NewWindowFlagNone];this.action.SetNewWindowFlag(t[e])},t.prototype.setTarget=function(e){var t=e.attachedFileName,n=e.fileAttachmentAnnotIndex,r=e.pageIndex,o=e.relationship,i=e.target,s=a.default.create(this.engine,this.doc),u=new a.default(s,this.engine,this.doc);t&&u.setAttachedFileName(t),n>=0&&u.setFileAttachmentAnnotIndex(n),r>=0&&u.setPageIndex(r),o&&u.setRelationship(o),i&&u.setTarget(i),this.action.SetTarget(s)},t}(r.default);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.engine=n,this.doc=r,this.embeddedGotoTarget=t}return e.create=function(e,t){return new e.EmbeddedGotoTarget(t)},e.prototype.toJson=function(){var e=this.getAttachedFileName(),t=this.getFileAttachmentAnnotIndex(),n=this.getPageIndex(),r=this.getRelationship(),o=void 0;return this.embeddedGotoTarget.GetTarget().IsEmpty()||(o=this.getTarget().toJson()),{attachedFileName:e,fileAttachmentAnnotIndex:t,pageIndex:n,relationship:r,target:o}},e.prototype.getAttachedFileName=function(){return this.embeddedGotoTarget.GetAttachedFileName().toString()},e.prototype.getFileAttachmentAnnotIndex=function(){return this.embeddedGotoTarget.GetFileAttachmentAnnotIndex()},e.prototype.getPageIndex=function(){return this.embeddedGotoTarget.GetPageIndex()},e.prototype.getRelationship=function(){return this.embeddedGotoTarget.GetRelationship().toString()},e.prototype.getTarget=function(){return new this.constructor(this.embeddedGotoTarget.GetTarget())},e.prototype.setAttachedFileName=function(e){this.embeddedGotoTarget.SetAttachedFileName(new this.engine.WString(e))},e.prototype.setFileAttachmentAnnotIndex=function(e){this.embeddedGotoTarget.SetFileAttachmentAnnotIndex(e)},e.prototype.setPageIndex=function(e){this.embeddedGotoTarget.SetPageIndex(e)},e.prototype.setRelationship=function(e){this.embeddedGotoTarget.SetRelationship(new this.engine.String(e))},e.prototype.setTarget=function(e){var t=e.attachedFileName,n=e.fileAttachmentAnnotIndex,r=e.pageIndex,o=e.relationship,i=e.target,a=this.constructor.create(this.engine,this.doc),s=new this.constructor(a,this.engine,this.doc);t&&s.setAttachedFileName(t),n>=0&&s.setFileAttachmentAnnotIndex(n),r>=0&&s.setPageIndex(r),o&&s.setRelationship(o),i&&s.setTarget(i),this.embeddedGotoTarget.SetTarget(a)},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=i(n(19)),o=i(n(226));function i(e){return e&&e.__esModule?e:{default:e}}function a(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var s=function(e){function t(n,r,i,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var s=function(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}(this,e.call(this,n,r,i,a));s.action=new s.engine.SetOCGStateAction(n);var u=r.doc||r;return s.pdflayer=new o.default(u,i),s}return a(t,e),t.prototype.toJson=function(){for(var t=e.prototype.toJson.call(this),n=[],r=[],o=this.action.GetOCGStateCount(),i=0;i<o;i++)for(var a=this.action.GetOCGStateArray(i),s=a.GetSize(),u=0;u<s;u++){var c=a.GetAt(u).GetObjNum();0===i?n.push(c):r.push(c)}return t.visibleLayerIds=n,t.hideLayerIds=r,t},t.prototype.setOCGState=function(e,t){var n=this.engine.OCGState,r=n.e_OCGStateOff,o=n.e_OCGStateOn;return e.length>0&&this._setState(e,r),t.length>0&&this._setState(t,o),this.toJson()},t.prototype._setState=function(e,t){for(var n=new this.engine.PDFDictionaryArray,r=0;r<e.length;r++){var o=this.pdflayer.getLayerNodeById(e[r]).layer_node;n.Add(o.GetDict())}this.action.InsertOCGStates(this.doc,0,t,n)},t.prototype.setActionData=function(e){this.create(e)},t.prototype.create=function(e){var t=e.hideLayerIds,n=e.visibleLayerIds;try{return this.setOCGState(t,n)}catch(e){return console.error(e),!1}},t}(r.default);t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(19);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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var a=function(e){function t(n,r,o,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(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}(this,e.call(this,n,r,o,i));return a.doc=r,a.engine=o,a.action=new a.engine.ThreadAction(n),a}return i(t,e),t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);return this.action.IsDestThreadInCurrentDoc()?(t.dest_thread=this.action.GetDestinationThread(),t.dest_thread_index=this.action.GetDestinationThreadIndex(),t.dest_thread_title=this.action.GetDestinationThreadTitle().toString()):t.file_spec=this.action.GetFileSpec(),t},t.prototype.setActionData=function(e){try{this.setThreadIndex(e.dest_thread_index)}catch(e){return!1}return!0},t.prototype.create=function(e){try{this.setThreadIndex(e.dest_thread_index)}catch(e){console.error(e)}return!0},t.prototype.setThreadIndex=function(e){var t=new this.engine.FileSpec(this.doc);this.action.SetDestinationThreadIndex(t,e)},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(87)),o=u(n(714)),i=u(n(715)),a=u(n(716)),s=u(n(376));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.engine=t,this.jr=n}return e.prototype.get=function(e,t,n){var u=this.engine,c=u.GraphicsObjectType;switch(e.GetType()){case c.e_TypeText:return new o.default(e,t,n,u,this.jr);case c.e_TypePath:return new i.default(e,t,n,u,this.jr);case c.e_TypeImage:return new a.default(e,t,n,u,this.jr);case c.e_TypeFormXObject:return new s.default(e,t,n,u,this.jr);default:return new r.default(e,t,n,u,this.jr)}},e.prototype.create=function(e,t,n){var r=this.engine,s=r.GraphicsObjectType;switch(e.type){case s.e_TypeText.value:return o.default.create(e,t,n,r,this);case s.e_TypePath.value:return i.default.create(e,t,n,r,this);case s.e_TypeImage.value:return a.default.create(e,t,n,r,this);default:return}},e}();t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(87)),o=u(n(159)),i=n(373),a=n(3),s=u(n(38));function u(e){return e&&e.__esModule?e:{default:e}}function c(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function d(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var l=function(e){function t(n,r,o,i,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var s=function(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}(this,e.call(this,n,r,o,i));return s.graphicsObject=n.GetTextObject(),s.jr=a,s}return d(t,e),t.create=function(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=r.TextObject.Create(),c=e.originPosition;if(!c)throw new Error("originPosition is required");var d=c.x,l=c.y,f=e.charspace||0,h=e.wordspace||0,p=e.fontSize||12,m=e.textmatrix||[1,0,0,1],g=r.Mode.values[e.textmode||0],y=void 0;if(e.font){var _=e.font;if(void 0!==_.standardId)y=new r.Font(r.StandardID.values[_.standardId]);else{var v=new r.WString(_.name);y=new r.Font(v,_.styles,r.Charset.values[1==_.charset?0:_.charset],_.weight||0),(0,s.default)(v)}}else y=new r.Font((0,a.CWString)(r,"FoxitSansOTF"),458863,r.Charset.e_CharsetANSI,400);var b=u.GetTextState(t);b.font=y,b.font_size=p,b.charspace=f,b.wordspace=h,b.textmode=g;var S=new r.PointF(d,l);//!!info.italic, info.weight || 400);
283
- if(b.origin_position=S,b.textmatrix=m,u.SetTextState(t,b,!1,400),e.matrix){var w=e.matrix;u.SetMatrix(new r.Matrix(w[0],w[1],w[2],w[3],w[4],w[5]))}var M=new r.WString(e.text||"");u.SetText(M),e.fillColor&&u.SetFillColor((4278190080|e.fillColor)>>>0),i=i||t.GetLastGraphicsObjectPosition(r.GraphicsObjectType.e_TypeAll),t.InsertGraphicsObject(i,u),e.text&&t.GenerateContent();var D=o.get(u,t,n);return e.text&&e.text.length>0&&D.setText(e.text),(0,s.default)(y,S,M),D},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this),n={},r=this.engine,o=this.c_page,a=o.GetDocument(),s=this.graphicsObject.GetTextState(o),u=s.font,c={};if(!u.IsEmpty()){c.name=u.GetName().toString();var d=u.GetFamilyName().toString();c.familyName=d;var l=c.name;try{l=u.GetBaseFontName(a).toString()||l}catch(e){}c.baseName=l,c.ascent=u.GetAscent(),c.descent=u.GetDescent(),c.isItalic=u.IsItalic();var f=(c.isBold=u.IsBold())?700:400,h=void 0,p=c.styles=u.GetStyles(a),m=r.Charset.e_CharsetDefault.value;u.GetFontType(a)==r.FontTypes.e_FontTypeCIDFont&&(void 0!==(m=u.GetCIDCharset(a))&&m!==r.Charset.e_CharsetDefault||(m=r.Charset.values[(0,i.getCharsetFromName)(l)])||(m=r.Charset.e_CharsetANSI),m===r.CIDCharset.e_CIDCharsetJAPAN1?m=r.Charset.e_CharsetShift_JIS:m===r.CIDCharset.e_CIDCharsetKOREA1&&(m=r.Charset.e_CharsetHangeul),m=m.value),c.charset=m,u.IsEmbedded(a)?(c.isEmbedded=!0,c.nameKey="fv_"+this.id):u.IsStandardFont(a)?(c.isStandard=!0,c.standardId=u.GetStandard14Font(a).value,(h=(0,i.getGlyphMatch)(l,m,0,f,p))&&(h="fv_"+h[0].url.replace(/\./g,"_"),c.nameKey=h)):(h=(0,i.getGlyphMatch)(l,m,0,f,p))&&(h="fv_"+h[0].url.replace(/\./g,"_"),c.nameKey=h)}return n.textState={text:this.graphicsObject.GetText().toString(),charSpace:s.charspace,font:c,size:s.font_size,position:{x:s.origin_position.x,y:s.origin_position.y},matrix:[s.GetMatrixA(),s.GetMatrixB(),s.GetMatrixC(),s.GetMatrixD()],mode:s.textmode.value,wordSpace:s.wordspace},Object.assign({},t,n)},t.prototype.setText=function(e){for(var t=this.engine,n=this.c_page,r=n.GetDocument(),o=this.graphicsObject,s=o.GetTextState(n),u=o.GetMatrix(),c=parseInt(180*Math.atan2(u.b,u.a)/Math.PI),d=s.font,l=p(o,n,t.GraphicsObjectType.e_TypeText)||n.GetLastGraphicsObjectPosition(t.GraphicsObjectType.e_TypeAll),y=e.split(/\n/),_=[o],v=y.length-1;v>0;v--){var b=o.Clone().GetTextObject();_[v]=b,b.SetText((0,a.CWString)(t,"")),n.InsertGraphicsObject(l,b)}var S=[];if(d.IsEmpty())return Promise.resolve();if(d.IsStandardFont(r))for(var w=0,M=y.length;w<M;w++)if(e=y[w],o=_[w],!e||/^[\u0000-\u00FF]+$/.test(e))o.SetText(new this.engine.WString(e)),S[w]=[o];else{S[w]=m(e,/[\u0000-\u00FF]+/g,o,n,d,t,this,w)}else if(d.IsEmbedded(r))for(var D=o.GetText().toString(),P=new RegExp("^["+D+"]+$"),T=0,k=y.length;T<k;T++)e=y[T],o=_[T],!e||P.test(e)?(o.SetText(new this.engine.WString(e)),S[T]=[o]):S[T]=m(e,new RegExp("["+D+"]+","g"),o,n,d,t,this);else for(var A=0,L=y.length;A<L;A++)if(e=y[A],o=_[A],d.GetFontType(r)==t.FontTypes.e_FontTypeCIDFont){var F=f(t,d,r);if(F&&F!==t.Charset.e_CharsetDefault){var I=h(F=F.value);if(I)!e||new RegExp("^"+I.source+"$").test(e)?(o.SetText(new t.WString(e)),S[A]=[o]):S[A]=m(e,I,o,n,d,t,this,A);else{var x=g(e,o,n,d,t,0);S[A]=x,x.length>1&&(A||this.graphicsObject!==o||(this.graphicsObject=x[0]),n.RemoveGraphicsObject(o))}}else{var C=g(e,o,n,d,t,0);S[A]=C,C.length>1&&(A||this.graphicsObject!==o||(this.graphicsObject=C[0]),n.RemoveGraphicsObject(o))}}else{var R=d.GetName().toString();try{R=d.GetBaseFontName(r).toString()||R}catch(e){}var O=h((0,i.getCharsetFromName)(R,!1)||t.Charset.e_CharsetANSI.value);if(O)!e||new RegExp("^"+O.source+"$").test(e)?(o.SetText(new t.WString(e)),S[A]=[o]):S[A]=m(e,O,o,n,d,t,this,A);else{var G=g(e,o,n,d,t,0);S[A]=G,G.length>1&&(A||this.graphicsObject!==o||(this.graphicsObject=G[0]),n.RemoveGraphicsObject(o))}}for(var E=0,Y=0,j=0,N=S.length;j<N;j++)for(var B=S[j],H=0,W=B.length;H<W;H++){var U=B[H].GetRect(),z=U.top-U.bottom;E=Math.max(E,z);var J=U.right-U.left;Y=Math.max(Y,J)}E+=3,Y+=3;for(var V=0,K=0,q=1,Z=S.length;q<Z;q++){switch(c){case 0:V-=E;break;case 90:K+=Y;break;case 180:case-180:V+=E;break;case 270:case-90:K-=Y}for(var X=S[q],Q=0,$=X.length;Q<$;Q++){var ee=X[Q],te=ee.GetTextState(n);if(te.origin_position=new t.PointF(te.origin_position.x+K,te.origin_position.y+V),ee.SetTextState(n,te,!1,400),!ee.GetText().toString()){var ne=new t.WString("");ee.SetText(ne)}}}this.isParentPage()||this.parent.graphicsObject.GetGraphicsObjects().GenerateContent();return n.GenerateContent(),this.reParsePage()},t.prototype.setItalic=function(e){var t=this.c_page,n=t.GetDocument(),r=this.graphicsObject,o=this.engine,a=r.GetTextState(t),u=a.font,c=void 0;if(u.IsEmpty())return Promise.resolve();if(u.IsStandardFont(n)){var d=o.StandardID,l=u.GetStandard14Font(n),h=void 0;if(e)switch(l){case d.e_StdIDCourier:h=d.e_StdIDCourierI;break;case d.e_StdIDCourierB:h=d.e_StdIDCourierBI;break;case d.e_StdIDHelvetica:h=d.e_StdIDHelveticaI;break;case d.e_StdIDHelveticaB:h=d.e_StdIDHelveticaBI;break;case d.e_StdIDTimes:h=d.e_StdIDTimesI;break;case d.e_StdIDTimesB:h=d.e_StdIDTimesBI}else switch(l){case d.e_StdIDCourierI:h=d.e_StdIDCourier;break;case d.e_StdIDCourierBI:h=d.e_StdIDCourierB;break;case d.e_StdIDHelveticaI:h=d.e_StdIDHelvetica;break;case d.e_StdIDHelveticaBI:h=d.e_StdIDHelveticaB;break;case d.e_StdIDTimesI:h=d.e_StdIDTimes;break;case d.e_StdIDTimesBI:h=d.e_StdIDTimesB}h&&(c=new o.Font(h))}else{var p=u.GetStyles(n),m=o.Styles.e_StyleItalic.value;e?p|=m:p&=~m;var g=f(o,u,n),y=u.GetName().toString();try{y=u.GetBaseFontName(n).toString()||y}catch(e){}if(!g||g===o.Charset.e_CharsetDefault){var _=(0,i.getCharsetFromName)(y);if(-1===_)return Promise.resolve();g=o.Charset.values[_]}g&&g!==o.Charset.e_CharsetDefault||(g=o.Charset.e_CharsetANSI);var v=new o.WString(y);c=new o.Font(v,p,g,u.IsBold()?700:400),(0,s.default)(v)}if(c){if(a.font=c,r.SetTextState(t,a,!1,400),r.GetText().toString()||r.SetText(new this.engine.WString("")),!this.isParentPage())this.parent.graphicsObject.GetGraphicsObjects().GenerateContent();return t.GenerateContent(),(0,s.default)(c),this.reParsePage()}return Promise.resolve()},t.prototype.setBold=function(e){var t=this.c_page,n=t.GetDocument(),r=this.graphicsObject,o=this.engine,a=r.GetTextState(t),u=a.font,c=void 0;if(u.IsEmpty())return Promise.resolve();if(u.IsStandardFont(n)){var d=o.StandardID,l=u.GetStandard14Font(n),h=void 0;if(e)switch(l){case d.e_StdIDCourier:h=d.e_StdIDCourierB;break;case d.e_StdIDCourierI:h=d.e_StdIDCourierBI;break;case d.e_StdIDHelvetica:h=d.e_StdIDHelveticaB;break;case d.e_StdIDHelveticaI:h=d.e_StdIDHelveticaBI;break;case d.e_StdIDTimes:h=d.e_StdIDTimesB;break;case d.e_StdIDTimesI:h=d.e_StdIDTimesBI}else switch(l){case d.e_StdIDCourierB:h=d.e_StdIDCourier;break;case d.e_StdIDCourierBI:h=d.e_StdIDCourierI;break;case d.e_StdIDHelveticaB:h=d.e_StdIDHelvetica;break;case d.e_StdIDHelveticaBI:h=d.e_StdIDHelveticaI;break;case d.e_StdIDTimesB:h=d.e_StdIDTimes;break;case d.e_StdIDTimesBI:h=d.e_StdIDTimesI}h&&(c=new o.Font(h))}else{var p=u.GetStyles(n),m=o.Styles.e_StylesBold.value;e?p|=m:p&=~m;var g=f(o,u,n),y=u.GetName().toString();try{y=u.GetBaseFontName(n).toString()||y}catch(e){}if(!g||g===o.Charset.e_CharsetDefault){var _=(0,i.getCharsetFromName)(y);if(-1===_)return Promise.resolve();g=o.Charset.values[_]}g&&g!==o.Charset.e_CharsetDefault||(g=o.Charset.e_CharsetANSI);var v=new o.WString(y);c=new o.Font(v,p,g,e?700:400),(0,s.default)(v)}if(c){if(a.font=c,r.SetTextState(t,a,!1,400),r.GetText().toString()||r.SetText(new this.engine.WString("")),!this.isParentPage())this.parent.graphicsObject.GetGraphicsObjects().GenerateContent();return t.GenerateContent(),(0,s.default)(c),this.reParsePage()}return Promise.resolve()},t.prototype.setFontSize=function(e){var t=this.c_page,n=this.graphicsObject,r=n.GetTextState(t);r.font;if(r.font_size=e,n.SetTextState(t,r,!1,400),n.GetText().toString()||n.SetText((0,a.CWString)(this.engine,"")),!this.isParentPage()){var o=this.parent.graphicsObject.GetGraphicsObjects();o.GenerateContent()}return t.GenerateContent(),this.reParsePage()},t.prototype.setStandardFont=function(e){var t=this.graphicsObject,n=t.GetText().toString(),r=this.engine,o=this.c_page;e=r.StandardID.values[e];var i=t.GetTextState(o),a=i.font;return a=new r.Font(e),i.font=a,t.SetTextState(o,i,!1,400),this.setText(n)},t.prototype.setFontByName=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:458863,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.c_page,o=this.graphicsObject,i=o.GetText().toString(),a=o.GetTextState(r),u=a.font,c=this.engine,d=new c.WString(e);return u=new c.Font(d,t,c.Charset.values[n]||c.Charset.e_CharsetANSI,400),(0,s.default)(d),a.font=u,o.SetTextState(r,a,!1,400),this.setText(i)},t.prototype.setFillColor=function(e){(this.graphicsObject.SetFillColor((4278190080|e)>>>0),this.isParentPage())||this.parent.graphicsObject.GetGraphicsObjects().GenerateContent();return this.c_page.GenerateContent(),this.toJson()},t.prototype.reParsePage=function(){return Promise.resolve()},t.prototype.getWoff=function(){var e=this.engine,t=this.c_page,n=t.GetDocument(),r=this.graphicsObject.GetTextState(t).font;if(r.IsEmpty())return null;if(r.IsEmbedded(n))return o.default.getWoffDataBuffer(r.GetWoffData(n),this.engine);var i=f(e,r,n)||0;i&&(i=i.value);var a=r.GetName().toString();try{a=r.GetBaseFontName(n).toString()||a}catch(e){}var s=this.jr.getFontBuffer(a,r.GetStyles(n),0,i,r.IsBold()?700:400,!0);return s?{buffer:s}:null},t}(r.default);function f(e,t,n){var r=e.Charset,o=e.CIDCharset,i=void 0;if(t.GetFontType(n)==e.FontTypes.e_FontTypeCIDFont)switch(t.GetCIDCharset(n)){case o.e_CIDCharsetGB1:case o.CIDCharsetCNS1:case o.CIDCharsetJAPAN1:case o.CIDCharsetKOREA1:i=r.e_CharsetGB2312;break;case o.CIDCharsetUNICODE:i=r.e_CharsetANSI}return i}function h(e){switch(e){case 0:case 2:case 238:case 204:return/[\u0000-\u00FF]+/g;case 134:return/[\u0000-\u007f\u8140-\uA0FE\uA996\uA1A1-\uA9FE\uA840-\uA9A0\uF8A1-\uFEFE\uA140-\uA7A0\u200F-\u2027\u2E80-\u303F\u31C0-\u4DBF\u4E00-\u9FBF\uFF00-\uFFEF]+/g;case 136:return/[\u4E00-\uA0FE\uA140-\uA3BF\uA259-\uA261\uA3C0-\uA3FE\u2E80-\u303F\u31C0-\u4DBF\uFF00-\uFFEF]+/g;case 128:return/[\u0000-\u007f\u2E80-\u4DBF\u4E00-\u9FBF\uF900-\uFAFF\uFE30-\uFE4F]+/g;case 129:return/[\u0000-\u007f\u1100-\u11FF\u3130-\u318F\uAC00-\uD7AF\uFF00-\uFFEF\u2E80-\u303F\u31C0-\u4DBF\u4E00-\u9FBF\uF900-\uFAFF\uFE30-\uFE4F]+/g;case 222:return/[\u0E00-\u0E7F]+/g;case 161:case 162:case 186:return/[\u0370-\u03FF\u1F00-\u1FFF]+/g;case 177:return/[\u0590-\u05FF]+/g;case 178:return/[\u0600-\u06FF\u0750-\u077F\uFB50-\uFDFF\uFE70-\uFEFF]+/g;case 1:default:return!1}}function p(e,t,n){for(var r=t.GetFirstGraphicsObjectPosition(n);r;){if(t.GetGraphicsObject(r).GetTextObject().$$.ptr===e.$$.ptr)return r;r=t.GetNextGraphicsObjectPosition(r,n)}return r}function m(e,t,n,r,o,i,a,s){var u=[],d=0,l=t.exec(e),f=e.length;if(l){var h=l.index,m=l[0];h!==d&&u.push([0,e.slice(d,h)]),u.push([1,m]),d=h+m.length}else u=[[0,e]],d=f;for(;l=t.exec(e);){var y=l.index,_=l[0];u.push([0,e.slice(d,y)]),u.push([1,_]),d=y+_.length}d<f&&u.push([0,e.slice(d)]);for(var v=0,b=[],S=u.length,w=p(n,r,i.GraphicsObjectType.e_TypeText)||r.GetLastGraphicsObjectPosition(i.GraphicsObjectType.e_TypeAll),M=S;M--;){var D=n.Clone().GetTextObject();r.InsertGraphicsObject(w,D),b[M]=D}S&&(a.graphicsObject=b[0]);for(var P=void 0,T=[],k=0,A=S;k<A;k++){var L=b[k],F=u[k],I=F[0],x=F[1],C=L.GetTextState(r);if(C.origin_position=new i.PointF(C.origin_position.x+v,C.origin_position.y),L.SetTextState(r,C,!1,400),I)L.SetText(new i.WString(x)),T.push(L);else{var R=g(x,L,r,o,i,v);T.push.apply(T,c(R)),R.length>1&&(s||a.graphicsObject!==L||(a.graphicsObject=R[0]),r.RemoveGraphicsObject(L))}v+=(P=L.GetRect()).right-P.left+1}return S&&r.RemoveGraphicsObject(n),T}function g(e,t,n,r,o,i){var a=r.IsBold()?700:400,u=[o.Charset.e_CharsetANSI,o.Charset.e_CharsetSymbol,o.Charset.e_CharsetShift_JIS,o.Charset.e_CharsetHangeul,o.Charset.e_CharsetGB2312,o.Charset.e_CharsetChineseBig5],d=n.GetDocument(),l=function e(t){for(var n=[[/[\u0000-\u00FF]+/g,{name:"Arial",styles:32,charset:1}],[/[\u0000-\u007f\u8140-\uA0FE\uA996\uA1A1-\uA9FE\uA840-\uA9A0\uF8A1-\uFEFE\uA140-\uA7A0\u200F-\u2027\u2E80-\u303F\u31C0-\u4DBF\u4E00-\u9FBF\uFF00-\uFFEF]+/g,{name:"SimSun",styles:34,charset:134}],[/[\u4E00-\uA0FE\uA140-\uA3BF\uA259-\uA261\uA3C0-\uA3FE\u2E80-\u303F\u31C0-\u4DBF\uFF00-\uFFEF]+/g,{name:"SimSun",styles:34,charset:136}],[/[\u0000-\u007f\u2E80-\u4DBF\u4E00-\u9FBF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF]+/g,{name:"Meiryo",styles:34,charset:128}],[/[\u0000-\u007f\u1100-\u11FF\u3130-\u318F\uAC00-\uD7AF\uFF00-\uFFEF\u2E80-\u303F\u31C0-\u4DBF\u4E00-\u9FBF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF]+/g,{name:"Korean",styles:32,charset:129}],[/[\u0E00-\u0E7F]+/g,{name:"Angsana New",styles:32,charset:222}],[/[\u0370-\u03FF\u1F00-\u1FFF]+/g,{name:"Arial",styles:32,charset:161}],[/[\u0590-\u05FF]+/g,{name:"Aharoni",styles:32,charset:177}],[/[\u0600-\u06FF\u0750-\u077F\uFB50-\uFDFF\uFE70-\uFEFF]+/g,{name:"Arabic",styles:32,charset:178}]],r=0,o=n.length;r<o;r++)if(new RegExp("^"+n[r][0].source+"$").test(t))return[{text:t,info:n[r][1]}];for(var i=[],a=0,s=void 0,u=0,d=n.length;u<d;u++){for(n[u][0].lastIndex=a;s=n[u][0].exec(t);){var l=s.index;if(l>a){var f=t.slice(a,l);i.push.apply(i,c(e(f)))}var h=s[0];i.push({text:h,info:n[u][1]}),a=l+h.length}if(a>=t.length)break}return i.length?i:[{text:t,info:null}]}(e);if(1===l.length){var f=t,h=l[0].info;if(h){var m=t.GetTextState(n),g=o.Charset.values[h.charset]||o.Charset.e_CharsetANSI;m.font=new o.Font(new o.WString(h.name),h.styles,g,a);var y=m.font.IsEmbedded(d);if(m.font.IsSupportEmbedded(d)&&!y&&-1===u.indexOf(g)){var _=m.font.Embed(d);_.IsEmpty()||(m.font=_)}f.SetTextState(n,m,!1,400)}return f.SetText(new o.WString(l[0].text)),[f]}for(var v=p(t,n,o.GraphicsObjectType.e_TypeText)||n.GetLastGraphicsObjectPosition(o.GraphicsObjectType.e_TypeAll),b=[],S=l.length;S--;){var w=t.Clone().GetTextObject();n.InsertGraphicsObject(v,w),b[S]=w}for(var M=0,D=l.length;M<D;M++){var P=b[M],T=P.GetTextState(n),k=l[M],A=k.text,L=k.info,F=void 0;if(T.origin_position=new o.PointF(T.origin_position.x+i,T.origin_position.y),L){F=new o.WString(L.name);var I=o.Charset.values[L.charset]||o.Charset.e_CharsetANSI;T.font=new o.Font(F,L.styles,I,a);var x=T.font.IsEmbedded(d);if(T.font.IsSupportEmbedded(d)&&!x&&-1===u.indexOf(I)){var C=T.font.Embed(d);C.IsEmpty()||(T.font=C)}(0,s.default)(F)}P.SetTextState(n,T,!1,400),F=new o.WString(A),P.SetText(F);var R=P.GetRect();i+=R.right-R.left+1,(0,s.default)(F,T.origin_position)}return b}t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(87)),o=a(n(376)),i=a(n(38));function a(e){return e&&e.__esModule?e:{default:e}}function s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(n,r,o,i,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var s=function(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}(this,e.call(this,n,r,o,i,a));return s.graphicsObject=n.GetPathObject(),s}return s(t,e),t.prototype.toJson=function(){for(var t=this.graphicsObject,n=e.prototype.toJson.call(this),r=this.graphicsObject.GetPathData(),o=r.GetPointCount(),i=[],a=0;a<o;a++){var s=r.GetPoint(a);i.push({x:s.x,y:s.y,type:r.GetPointType(a).value})}var u={fillMode:t.GetFillMode().value,strokeState:t.GetStrokeState(),path:i,needStroke:t.GetStrokeState()};return Object.assign(u,n)},t.prototype.setBorderColor=function(t){return this.graphicsObject.SetStrokeState(0!==t),e.prototype.setBorderColor.call(this,t)},t.prototype.setFillColor=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(0===e)this.graphicsObject.SetFillColor(4278190080),this.graphicsObject.SetFillMode(this.engine.FillMode.e_FillModeNone);else{var n=255*this.graphicsObject.GetFillOpacity()|0;this.graphicsObject.SetFillColor((16777215&e|n<<24)>>>0),this.graphicsObject.SetFillMode(this.engine.FillMode.e_FillModeWinding)}return t&&this.c_page.GenerateContent(),this.toJson()},t.prototype.isPointInLine=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,r=this.graphicsObject.GetPathData(),i=r.GetPointCount(),a=void 0,s=void 0,u=void 0,l=void 0,f=void 0,h=void 0,p=this.graphicsObject.GetMatrix();if(this.page instanceof o.default){var m=this.page.graphicsObject.GetMatrix();m.Concat(p.a,p.b,p.c,p.d,p.e,p.f,!1),p.delete(),p=m}for(var g=[],y=0;y<i;y++){var _=r.GetPoint(y);switch(_=p.TransformPoint(_.x,_.y),r.GetPointType(y).value){case 1:s=a=[_.x,_.y];break;case 2:l=(u=[_.x,_.y])[0]-s[0],f=u[1]-s[1],h=Math.max(Math.abs(l),Math.abs(f));for(var v=0;v<h;v++){var b=[s[0]+l*v/h,s[1]+f*v/h];if(c([e,t],b)<n)return!0}s=u;break;case 3:l=s[0]-a[0],f=s[1]-a[1],h=Math.max(Math.abs(l),Math.abs(f));for(var S=0;S<h;S++){var w=[a[0]+l*S/h,a[1]+f*S/h];if(c([e,t],w)<n)return!0}a=s=[];case 4:case 5:var M=[_.x,_.y];if(g.push(M),h=Math.ceil(Math.max(Math.abs(_.x-s[0]),Math.abs(_.y-s[1]))),3==g.length){for(var D=0;D<h;D++){var P=d(D/h,s,g[0],g[1],g[2]);if(c([e,t],P)<n)return!0}g=[],s=M}}}return!1},t.create=function(e,t,n,r,o){var a=r.PathObject.Create();try{var s=new r.Path,u=[],c=void 0,d=!0,l=!1,f=void 0;try{for(var h,p=e.points[Symbol.iterator]();!(d=(h=p.next()).done);d=!0){var m=h.value;switch(m[0]){case"m":c=new r.PointF(m[1],m[2]),s.MoveTo(c),c.delete();break;case"l":c=new r.PointF(m[1],m[2]),s.LineTo(c),c.delete();break;case"c":u.push(new r.PointF(m[1],m[2])),3==u.length&&(s.CubicBezierTo(u[0],u[1],u[2]),u.length=0);break;case"h":s.CloseFigure()}}}catch(e){l=!0,f=e}finally{try{!d&&p.return&&p.return()}finally{if(l)throw f}}(0,i.default)(u),a.SetPathData(s),s.delete(),a.SetStrokeColor(4278190080);var g=a.GetGraphState();g.line_width=e.borderWidth||1,a.SetGraphState(g);var y=t.GetLastGraphicsObjectPosition(r.GraphicsObjectType.e_TypeAll);t.InsertGraphicsObject(y,a),t.GenerateContent(),t.StartParse(0,null,!0),y=t.GetLastGraphicsObjectPosition(r.GraphicsObjectType.e_TypeAll),a=t.GetGraphicsObject(y)}catch(e){isNaN(e)||(e=this.engine.getErrorCode(e)),console.warn(e)}return o.get(a,t,n)},t}(r.default);function c(e,t){var n=t[1]-e[1],r=t[0]-e[0];return Math.sqrt(r*r+n*n)}function d(e,t,n,r,o){var i=[1,1],a=1-e;return i[0]=t[0]*a*a*a+3*n[0]*e*a*a+3*r[0]*e*e*a+o[0]*e*e*e,i[1]=t[1]*a*a*a+3*n[1]*e*a*a+3*r[1]*e*e*a+o[1]*e*e*e,i}t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(87)),o=a(n(37)),i=n(375);function a(e){return e&&e.__esModule?e:{default:e}}function s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(n,r,o,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(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}(this,e.call(this,n,r,o,i));return a.imageObject=n.GetImageObject(),a}return s(t,e),t.prototype.setRotation=function(e){var t=e*Math.PI/180,n=this.graphicsObject.GetRect(),r={x:(n.right+n.left)/2,y:(n.top+n.bottom)/2},o=new this.engine.Matrix;return o.RotateAt(-t,-r.x,-r.y,0),this.graphicsObject.Transform(o,!0),this.c_page.GenerateContent(),o.delete(),this.toJson()},t.create=function(e,t,n,r,i){var a=r.ImageObject.Create(n.doc);try{var s=o.default.createImage(r,e.buffer);a.SetImage(s,0);var u=a.GetMatrix(),c=e.rect,d=c.left,l=c.right,f=c.top,h=c.bottom;u.a=l-d,u.d=f-h,u.Translate(d,h,0),a.SetMatrix(u);var p=t.GetLastGraphicsObjectPosition(r.GraphicsObjectType.e_TypeAll);t.InsertGraphicsObject(p,a),t.GenerateContent(),t.StartParse(0,null,!0),p=t.GetLastGraphicsObjectPosition(r.GraphicsObjectType.e_TypeAll),a=t.GetGraphicsObject(p)}catch(e){isNaN(e)||(e=this.engine.getErrorCode(e)),console.warn(e)}return i.get(a,t,n)},t.prototype.getStream=function(){var e=this.engine,t=this.imageObject.GetStream();if(t){var n=t.GetDataSize(!1);if(!(n<=0)){var r=e._malloc(n);t.GetData(!1,n,r);var o=(0,i.getArrayBufferFrom)(e,r,n);return e._free(r),o}}},t}(r.default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(22);var o=void 0,i={Release:function(){},TextChanged:function(){},IsShiftKeyDown:function(){},IsControlKeyDown:function(){},GetPageWindow:function(){return 33}},a={Release:function(){},OnSelectionChange:function(){postMessage({workflow:"out",type:"selectionChange"})},KillTimer:function(e){postMessage({workflow:"out",type:"toggleCaret",msg:!1}),clearInterval(e)},OnCaretChange:function(e,t,n){postMessage({workflow:"out",type:"caretChange",msg:{charProp:{lineLeading:e.fLineLeading,lineIndent:e.fLineIndent,alignment:e.nAlignment,enableSoftReturn:e.bEnableSoftReturn,rtl:e.bRTL,secSpace:e.fSecSpace},wordProp:{fontSize:t.fFontSize,wordColor:(0,r.intColorToHex)(t.dwWordColor),strokeColor:(0,r.intColorToHex)(t.dwStrokeColor),scriptType:t.nScriptType,wordStyle:t.nWordStyle,charSpace:t.fCharSpace,horzScale:t.nHorzScale,wordSpace:t.fWordSpace,xOffset:t.fXOffset,yOffset:t.fYOffset,renderingMode:t.nRenderingMode,lineWidth:t.fLineWidth,charCode:t.dwCharCode,alphal:t.nAlphal/255,isCross:Boolean(4&t.nWordStyle),isUnderline:Boolean(2&t.nWordStyle),isBold:Boolean(262144&t.nWordStyle||11===t.nRenderingMode),isItalic:Boolean(64&t.nWordStyle)},fontName:n}})},OnCursorChange:function(e,t){postMessage({workflow:"out",type:"cursorChange",msg:t.value})},OnEnterEdit:function(e,t){return postMessage({workflow:"out",type:"enterEdit",msg:t.value}),!1},OnProcessEdit:function(e,t){return postMessage({workflow:"out",type:"processEdit",msg:t.value}),!1}},s={Release:function(){},Show:function(e,t){postMessage({workflow:"out",type:"showTipMsg",msg:e})},MoveTo:function(e){postMessage({workflow:"out",type:"moveTip",msg:{x:e.x,y:e.y}})},SetTip:function(e,t){postMessage({workflow:"out",type:"setTipMsg",msg:e.toString()})}},u={},c={},d={Release:function(){},CreatePopupMenu:function(){var e=(Date.now()+1e3*Math.random()|0)%2147483647;return u[e]=[],e},CreatePopupSubMenu:function(){var e=(Date.now()+1e3*Math.random()|0)%2147483647;return u[e]=[],e},AppendMenuItem:function(e,t){var n={name:t,enable:!0,isCheck:!0,id:t};c[t]=n,u[e].push(n)},AppendSubMenu:function(e,t,n){u[e].push({name:t,subItems:u[n]})},RemoveMenuItem:function(e,t,n){},AppendSeparator:function(e){u[e].push({name:"-"})},EnableMenuItem:function(e,t,n,r){var o=c[t];o&&(o.enable=n)},CheckMenuItem:function(e,t,n){c[t].isCheck=n},InsertMenuItem:function(e,t,n,r){},InsertSeparator:function(e,t){},DestroyMenu:function(e){u={}},IsMenuEnabled:function(e){return!0}},l="",f={Release:function(){},CanPasteGraphicObject:function(){},GetClipboardText:function(){return new o.WString(l)},SetClipboardText:function(e,t){var n=t.toString();l=n,postMessage({workflow:"out",type:"setClipboardText",msg:n})},IsFormatAvailable:function(){return!0},PasteBitmap:function(){return!0},CopyBitmap:function(){},CopyGraphicObject:function(){},PasteGraphicObject:function(){}},h=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),o=t,this.setCallbacks(n),i.IsShiftKeyDown=n.IsShiftKeyDown,i.IsControlKeyDown=n.IsControlKeyDown;var u=t.EditPageContextCallback.implement(i),c=t.EditPageContext.Create(u);a.OnInvalid=n.OnInvalid,a.OnExitEdit=n.OnExitEdit,a.SetTimerCallback=this.SetTimerCallback.bind(this);var l=t.OperationNotifierCallback.implement(a),h=t.TipsCallback.implement(s),p=t.ClipboardCallback.implement(f);c.SetOperationNotifierCallback(l),c.SetTipsCallback(h),c.SetClipboardCallback(p);var m=t.PopupMenuCallback.implement(d);c.SetPopupMenuCallback(m),c.SetRotateCtrlIcon(r[0]),c.SetBitmap(t.ImageResourceID.e_ImageResourceIDRedPoint,r[1]),c.SetBitmap(t.ImageResourceID.e_ImageResourceIDBluePoint,r[2]),c.SetBitmap(t.ImageResourceID.e_ImageResourceIDGreenPoint,r[3]),c.SetSystemDPI(96,96),this.context=c}return e.prototype.SetTimerCallback=function(e,t){var n=setInterval((function(){o.OnTimeout(t,n)}),e);return postMessage({workflow:"out",type:"toggleCaret",msg:!0}),n},e.prototype.setCallbacks=function(e){return this.callbacks=e,["GetRenderMatrix","GetClientRect","GetPageVisibleRect","GetPageRect","GetPageViewScale","GetDefaultEditorPage","GetLatestPDFPage","GetTemplate","GetToolbarFontName","GetString"].forEach((function(t){return i[t]=e[t]})),["OnInvalid","OnSetPropsAsDefault","OnAddUndo","OnUndoRedoBeginEdit","OnUndoRedoEndEdit"].forEach((function(t){return a[t]=e[t]})),d.TrackPopupMenu=function(t,n,r,o){return e.TrackPopupMenu(u[t],n,r,o)},["CopyGraphicObject","PasteGraphicObject","CanPasteGraphicObject"].forEach((function(t){return f[t]=e[t]})),this.context},e}();t.default=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=navigator.platform,o=0;/^win/i.test(r)?o=0:/^mac/i.test(r)?o=1:(/^linux/i.test(r)||/^x11/i.test(r))&&(o=2),t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=(n(3),i(n(110)));n(167),i(n(379));function i(e){return e&&e.__esModule?e:{default:e}}function a(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var s={},u={},c=new(function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(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}(this,e.call(this));return n.workerObj=s,n.apis=u,n}return a(t,e),t}(o.default)),d=void 0,l=function(e,t){if(!t)throw console.warn(e),new Error("Unable to updateField: document not found by id: "+e)};function f(e,t,n){return s.getDocByID(n).then((function(e){return e.hasForm()?e.loadForm().toJson():null})).then((function(t){var n=[];t&&(n=t.fields.map((function(e){return e.image?e.image.buffer:null})).filter(Boolean)),s.resolve(e,t,n)})).catch((function(r){if(isNaN(r)||(r=t.getErrorCode(r)),r!==t.ErrorCode.e_ErrDataNotReady)throw r;setTimeout((function(){f(e,t,n)}),200)}))}u.loadForm=function(e,t){var n=t.docId;if(d)return f(e,d,n);s.jrPromise.then((function(t){return d=t.engine,f(e,d,n)}))},u.hasForm=function(e,t){var n=t.docId;return s.getDocByID(n).then((function(t){s.resolve(e,t.hasForm())}))},u.updateField=function(e,t){var n=t.docId,r=t.title,o=t.key,i=t.value;return s.getDocByID(n).then((function(e){var t=e.loadForm().getField(r);return t.update(o,i)||t.toJson()})).then((function(t){s.resolve(e,t)}))},u.setFieldValue=function(e,t){var n=t.docId,r=t.title,o=t.value;return s.getDocByID(n).then((function(t){l(n,t),t.loadForm().getField(r).setValue(o),s.resolve(e)}))},u.updateMKProperty=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.key,a=t.value;return s.getDocByID(n).then((function(e){return e.getPageById(r).getAnnotById(o)})).then((function(t){s.resolve(e,t.updateMKProperty(i,a))}))},u.setWidgetAS=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.AS;return s.getDocByID(n).then((function(e){return e.getPageById(r).getAnnotById(o)})).then((function(t){return t.setAS(i),s.resolve(e)}))},u.getFieldsValue=function(e,t){var n=t.docId;return s.getDocByID(n).then((function(t){var n=t.loadForm();s.resolve(e,n.getFieldsValue())}))},u.addControl=function(e,t){var n=t.docId,r=t.pageIndex,o=t.fieldName,i=t.fieldType,a=t.rect,u=t.options;return s.getDocByID(n).then((function(e){l(n,e);var t=e.loadForm(),s=t.engineForm,c=e.engine,d=e.JR,f=new c.WString(""),h=s.GetFieldCount(f);f.delete();var p=new c.CFX_FloatRect(a.left,a.bottom,a.right,a.top);return e.getPageByIndex(r).then((function(n){var r=new c.WString(o);if(o){var a=s.ValidateFieldName(c.FieldType.values[i],r);if(!a)for(var l=o.replace(/[^0-9]/gi,""),f=o.substr(0,o.indexOf(l)),m=parseInt(l);m++,r=new c.WString(f+m),!(a=s.ValidateFieldName(c.FieldType.values[i],r)););}var g=void 0,y=void 0;if(7==i){if((y=n.page.AddSignature(p,r,c.SignatureType.e_SignatureTypeOrdinary,!1)).IsEmpty())return{failed:!0}}else try{var _=(g=s.AddControl(n.page,r,c.FieldType.values[i],p)).GetWidget();if(u&&void 0!==u.mkRotate&&_.SetMKRotation({value:u.mkRotate}),1==i){var v=_.GetMKIconFit();v.horizontal_fraction=parseFloat(.5),v.vertical_fraction=parseFloat(.5),v.scale_way_type||(v.scale_way_type=c.ScaleWayType.e_ScaleWayAlways),_.SetMKIconFit(v)}if(u&&u.stateName,u&&"CreateImageStateHandler"===u.stateName){_.SetMKIconCaptionRelation(c.MKIconCaptionRelation.e_MKRelationNoCaption),_.SetHighlightingMode(c.HighlightingMode.e_HighlightingInvert);var b=_.GetMKIconFit();b.is_proportional_scaling=!0,_.SetMKIconFit(b);var S=d.createReaderCallback(u.imagePath),w=new c.Image(S);_.SetMKNormalIconImage(w,0);var M=c.Action.Create(e.doc,c.ActionType.e_TypeJavaScript),D=new c.JavaScriptAction(M);D.SetScript(new c.WString("event.target.buttonImportIcon()")),_.SetAction(D)}_.ResetAppearanceStream(),y=g.GetField()}catch(e){console.log(e)}if(!y)throw new Error("Field not exist");if(y.IsEmpty())throw new Error("Permission error");p.delete();var P=new c.WString(""),T=s.GetFieldCount(P);return P.delete(),r.delete(),n.update().then((function(){var e=y.GetFlags(),n=y.GetDict();if(n){var r=new c.String("Ff"),a=n.GetElement(r);a&&(e=a.GetInteger()),r.delete()}if(o=y.GetName().toString(),0==h)return t.toJson().then((function(t){return{form:t,fieldName:o,fieldFlags:e}}));if(T==h)return t.getField(o).getControlsJson().then((function(t){return{controls:t,fieldName:o,fieldFlags:e}}));var s=t.addJRField(y,o,T-1);return 7==i?s.toJson():s.getControlsJson().then((function(t){return{controls:t,fieldName:o,fieldFlags:e}}))}))}))})).then((function(t){s.resolve(e,t)}))},u.validateFieldName=function(e,t){var n=t.docId,r=t.fieldName,o=t.fieldType;return s.getDocByID(n).then((function(e){l(n,e),8==o&&(o=6);var t=e.engine;return e.loadForm().engineForm.ValidateFieldName(t.FieldType.values[o],new t.WString(r))})).then((function(t){s.resolve(e,t)}))},u.renameField=function(e,t){var n=t.docId,r=t.fieldName,o=t.newName;return s.getDocByID(n).then((function(e){l(n,e);var t=e.engine,i=e.loadForm(),a=i.engineForm;delete e.form;var s=new t.WString(r),u=a.GetField(0,s);s.delete(),s=new t.WString(o);for(var c=a.RenameField(u,s),d=(u=a.GetField(0,s)).GetControlCount(),f=0;f<d;f++){u.GetControl(f).GetWidget().ResetAppearanceStream()}return s.delete(),i.destroy(),!!c&&e.loadForm().toJson()})).then((function(t){s.resolve(e,t)}))},u.removeField=function(e,t){var n=t.docId,r=t.fieldName;return s.getDocByID(n).then((function(e){if(!e)throw console.warn(n),new Error(n);var t=e.engine,o=e.loadForm().engineForm,i=new t.WString(r),a=o.GetField(0,i);i.delete();for(var s={},u=a.GetControlCount(),c=0;c<u;c++){s[a.GetControl(c).GetWidget().GetPage().GetIndex()]=1}7==a.GetType().value?e.doc.RemoveSignature(new t.Signature(a)):o.RemoveField(a),e.reloadPageAnnots(Object.keys(s))})).then((function(t){s.resolve(e,!0)}))},u.removeControl=function(e,t){var n=t.docId,r=t.pageIndex,o=t.fieldName,i=t.controlObjectNumber;return s.getDocByID(n).then((function(t){l(n,t);var a=t.loadForm(),u=a.engineForm,c=a.getField(o).engineField;if(7==c.GetType().value)r=c.GetControl(0).GetWidget().GetPage().GetIndex(),t.doc.RemoveSignature(c);else{for(var d=c.GetControlCount(),f=void 0,h=0;h<d;h++){var p=c.GetControl(h);p.GetWidget().GetDict().GetObjNum()==i&&(r=(f=p).GetWidget().GetPage().GetIndex())}f&&!f.IsEmpty()&&u.RemoveControl(f)}t.getPageByIndex(r).then((function(e){e.update()})),s.resolve(e,!0)}))},u.fixPageFields=function(e,t){var n=t.docId,r=t.pageIndex;return s.getDocByID(n).then((function(t){l(n,t),t.loadForm().engineForm.FixPageFields(r),s.resolve(e,!0)}))},u.getControlCount=function(e,t){var n=t.docId,o=t.pageIndex;return s.getDocByID(n).then((function(e){return l(n,e),Promise.all([e,e.getPageByIndex(o)])})).then((function(e){var t=r(e,2),n=t[0],o=t[1];return n.loadForm().engineForm.GetControlCount(o.page)})).then((function(t){s.resolve(e,t)}))},u.setFieldsValue=function(e,t){var n=t.docId,r=t.fieldsValue,o=t.resetAP;return s.getDocByID(n).then((function(t){l(n,t),t.loadForm().setFieldsValue(r,o),s.resolve(e,!0)}))},u.updateFormControl=function(e,t){var n=t.docId,r=t.fieldName,o=t.objectNumber,i=t.key,a=t.value;return s.getDocByID(n).then((function(t){l(n,t);var u=t.loadForm().updateFormControl(r,o,i,a);s.resolve(e,u||!0)}))},u.setLockAction=function(e,t){var n=t.docId,r=t.title,o=t.type,i=t.fieldNames;return s.getDocByID(n).then((function(e){l(n,e),e.loadForm().getField(r).setLockAction(o,i)})).then((function(){s.resolve(e)}),(function(t){s.reject(e,{err:-1},[],t)}))},u.getControlPageIndex=function(e,t){var n=t.docId,r=t.fieldName,o=t.objectNumber;return s.getDocByID(n).then((function(e){l(n,e);for(var t=e.loadForm().getField(r).engineField,i=t.GetControlCount(),a=0;a<i;a++){var s=t.GetControl(a);if(o==s.GetDictionaryObjectNumber()){var u=s.GetWidget();return u.IsEmpty()?-1:u.GetPage().GetIndex()}}return-1})).then((function(t){s.resolve(e,t)}),(function(t){s.reject(e,{err:-1},[],t)}))},u.copyControls=function(e,t){var n=t.docId,o=(t.pageIndex,t.dstPageIndex),i=t.controls;return s.getDocByID(n).then((function(e){return l(n,e),Promise.all([0,e.getPageByIndex(o)]).then((function(t){var n=r(t,2),o=n[0],a=n[1];return e.loadForm().copyControls(o,a,i)}))})).then((function(t){s.resolve(e,t)}),(function(t){s.reject(e,{err:-1},[],t)}))},u.duplicateWidget=function(e,t){var n=t.docId,r=t.pages,o=t.fieldName,i=t.objectNumber;return s.getDocByID(n).then((function(e){l(n,e);var t=r.map((function(t){return e.getPageByIndex(t)})),a=e.loadForm();return Promise.all(t).then((function(e){return a.duplicateWidget(e,o,i)}))})).then((function(t){s.resolve(e,t)}),(function(t){s.reject(e,{err:-1},[],t)}))},u.removeAction=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.trigger,a=(t.parentObject,t.objectNumber);return s.getDocByID(n).then((function(e){return e.getPageById(r).getAnnotById(o)})).then((function(t){s.resolve(e,t.removeAction(i,a))}))},u.duplicateField=function(e,t){var n=t.docId,o=t.fieldName,i=t.pageIndex,a=t.annotObjNum,u=t.columns,c=t.rows,d=t.positions;return s.getDocByID(n).then((function(e){return l(n,e),Promise.all([e,e.getPageByIndex(i)])})).then((function(e){var t=r(e,2),n=t[0],i=t[1];return n.loadForm().duplicateField(o,i,a,u,c,d)})).then((function(e){return e.loadForm().toJson()})).then((function(t){s.resolve(e,t)}),(function(t){s.reject(e,{err:-1},[],t)}))},u.setCO=function(e,t){var n=t.docId,r=t.CO;return s.getDocByID(n).then((function(t){l(n,t);t.engine;t.loadForm().setCO(r),s.resolve(e,!0)}))},u.moveControl=function(e,t){var n=t.docId,r=t.fieldId,o=t.fieldName,i=t.newName;return s.getDocByID(n).then((function(e){l(n,e);for(var t=e.engine,a=e.loadForm(),s=a.engineForm,u=a.getField(o).engineField,c=u.GetControlCount(),d=new t.WString(i),f="",h=0;h<c;h++){var p=u.GetControl(h);if(p.GetWidget().GetDict().GetObjNum()===r){f=s.MoveControl(p,d);break}}return delete e.form,d.delete(),a.destroy(),!!f&&e.loadForm().toJson()})).then((function(t){s.resolve(e,t)}))},u.getAAJson=function(e,t){var n=t.docId,r=t.fieldName;return s.getDocByID(n).then((function(e){return e.loadForm().getField(r).getAAJson()})).then((function(t){s.resolve(e,t)}))},t.default=c.extendsWorkerAPI.bind(c)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={success:0,file:1,format:2,password:3,handle:4,certificate:5,unknown:6,invalidLicense:7,param:8,unsupported:9,outOfMemory:10,securityHandler:11,notParsed:12,notFound:13,invalidType:14,conflict:15,unknownState:16,dataNotReady:17,invalidData:18,xFALoadError:19,notLoaded:20,invalidState:21,notCDRM:22,canNotConnectToServer:23,invalidUserToken:24,noRights:25,rightsExpired:26,deviceLimitation:27,canNotRemoveSecurityFromServer:28,canNotGetACL:29,canNotSetACL:30,isAlreadyCPDF:31,isAlreadyCDRM:32,canNotUploadDocInfo:33,canNotUploadCDRMInfo:34,invalidWrapper:35,canNotGetClientID:36,canNotGetUserToken:37,invalidACL:38,invalidClientID:39,OCREngineNotInit:40,diskFull:41,OCRTrialIsEnd:42,filePathNotExist:43,complianceEngineNotInit:44,complianceEngineInvalidUnlockCode:45,complianceEngineInitFailed:46,timeStampServerMgrNotInit:47,LTVVerifyModeNotSet:48,LTVRevocationCallbackNotSet:49,LTVCannotSwitchVersion:50,LTVCannotCheckDTS:51,LTVCannotLoadDSS:52,LTVCannotLoadDTS:53,needSigned:54,complianceResourceFile:55,timeStampServerMgrNoDefaltServer:56,defaultTimeStampServer:57,noConnectedPDFModuleRight:58,noXFAModuleRight:59,noRedactionModuleRight:60,noRMSModuleRight:61,noOCRModuleRight:62,noComparisonModuleRight:63,noComplianceModuleRight:64,noOptimizerModuleRight:65,noConversionModuleRight:66,collaborationSession:1400}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(380)),o=a(n(168)),i=a(n(381));function a(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var u=function(){function e(){s(this,e),this.init.apply(this,arguments)}return e.prototype.init=function(){if(1==arguments.length)this.info={type:arguments[0]};else{var e=Array.prototype.slice.call(arguments),t=e[0],n=e[1],r=e[2],o=(e[3],e[4]),i=e[5];this.info=t,this.factory=n,this.doc=r,this.host=i,this.eventEmitter=o}this.initSubAction()},e.prototype.checkInserted=function(){if(!this.doc.api)throw new Error("Please insert this action to a host first.")},e.prototype.initSubAction=function(){var e=this;this.subAction=[],this.info.subAction&&this.info.subAction.forEach((function(t){e.subAction.push(e.factory.createAction(t,e.doc,e.doc.api,e.eventEmitter,e.host))}))},e.prototype.appendSubAction=function(e){this.subAction.push(e),this.info.subAction=this.info.subAction||[],this.info.subAction.push(e.info)},e.prototype.getType=function(){return this.info.type},e.prototype.getSubActionCount=function(){return this.info.subAction.length||0},e.prototype.getSubAction=function(e){return this.subAction[e]},e.prototype.insertSubAction=function(t,n){var r=this;if(this.checkInserted(),"number"!=typeof t)throw new Error("param error. Only number is available.");return t=Math.max(0,Math.min(t,this.getSubActionCount())),n instanceof e&&(n=n.getType()),this.doc.api.insertSubAction(this.doc.getId(),this.info.objNumber,t,n).then((function(e){return r.updateAction(e),e}))},e.prototype.setSubAction=function(t,n){var r=this;if(this.checkInserted(),"number"!=typeof t)throw new Error("param error. Only number is available.");var o=this.getSubActionCount();if(0===o)throw new Error("Cannot be set without sub action.");return t=Math.max(0,Math.min(t,o-1)),n instanceof e&&(n=n.getType()),this.doc.api.setSubAction(this.doc.getId(),this.info.objNumber,t,n).then((function(e){return r.updateAction(e),e}))},e.prototype.removeAllSubActions=function(){var e=this;if(this.doc.api)return this.doc.api.removeAllSubActions(this.doc.getId(),this.info.objNumber).then((function(t){e.updateAction(t)}))},e.prototype.removeSubAction=function(e){var t=this;if(this.doc.api){if("number"!=typeof e)throw new Error("param error. Only number is available.");var n=this.getSubActionCount();if(0===n)throw new Error("Cannot be remove without sub action.");return e=Math.max(0,Math.min(e,n-1)),this.doc.api.removeSubAction(this.doc.getId(),this.info.objNumber,e).then((function(e){t.updateAction(e)}))}},e.prototype.setActionData=function(e){var t=this;return this.doc.api.setActionData(this.doc.getId(),this.info.objNumber,e).then((function(e){t.updateAction(e)}))},e.prototype.updateAction=function(e){Object.assign(this.info,e),this.initSubAction(),this.host&&(this.eventEmitter.emit(o.default.actionUpdated,this.host),this.host instanceof r.default&&this.eventEmitter.emit(o.default.annotationUpdated,[this.host],this.host.getPDFPage(),"widget"===this.host.getType()?i.default.formFieldActionUpdated:i.default.actionDataUpdated))},e.prototype.checkOutData=function(e){return!0},e.prototype.exportToJson=function(){return{type:this.getType()}},e}();t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNameEncode=t.xfdfJsonToAddJson=t.default=void 0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(20),i=n(167);function a(e){return{unknowntype:"UnKnownType",text:"Text",link:"Link",freetext:"FreeText",line:"Line",square:"Square",circle:"Circle",polygon:"Polygon",polyline:"PolyLine",highlight:"Highlight",underline:"Underline",squiggly:"Squiggly",strikeout:"StrikeOut",stamp:"Stamp",caret:"Caret",ink:"Ink",psink:"PsInk",fileattachment:"FileAttachment",sound:"Sound",movie:"Movie",widget:"Widget",screen:"Screen",printermark:"PrinterMark",trapnet:"TrapNet",watermark:"Watermark","3d":"3D",popup:"Popup",redact:"Redact"}[e.toString().toLowerCase()]}var s="WRRRRRRRRWWRWWRRRRRRRRRRRRRRRRRRWRRRRDRRDDRNRNNDNNNNNNNNNNRRDRDRRRRRRRRRRRRRRRRRRRRRRRRRRRRDRDRRRRRRRRRRRRRRRRRRRRRRRRRRRRRDRDRRWRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRW";function u(e){var t=e.length,n=0,r=void 0;for(r=0;r<t;r++){var o=e.charCodeAt(r);o>=128||"W"==s[o]||"#"==e[r]||"D"==s[o]?n+=3:n++}if(n==t)return e;var i="";for(r=0;r<t;r++){var a=e.charCodeAt(r);if(a>=128||"W"==s[a]||"#"==e[r]||"D"==s[a]){if("W"==s[a]&&0==a)continue;i+="#",i+="0123456789ABCDEF"[parseInt(a/16)],i+="0123456789ABCDEF"[a%16]}else i+=e[r]}return i}function c(e){var t=void 0;for(t=0;t<e.length&&!(e.charCodeAt(t)>255);t++);if(t===e.length)return"("+e.replace(/([\(|\)])/g,"\\$1")+")";var n="<FEFF";for(t=0;t<e.length;t++){for(var r=e.charCodeAt(t).toString(16);r.length<4;)r="0"+r;n+=r}return n+">"}function d(e){for(var t=[],n=0;n<e.length;n++)t.push(e.charCodeAt(n));return new Uint8Array(t)}var l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.JSONToFDF=function(t){for(var n={next:2,annotRef:[],file:"%FDF-1.2\n1 0 obj<</FDF<</Annots[{annotsRefArray}]>>/Type/Catalog>>endobj\n"},r=[],o=0,i=t.length;o<i;o++){var a=t[o];a.type&&(a.deleted?r.push({name:a.name,page:a.page}):e.singleAnnotJSONToFDF(n,a,!1))}return new Blob([d(n.file.replace(/\{annotsRefArray\}/,n.annotRef.join(" "))+"trailer\n<</Root 1 0 R>>\n%%EOF")],{type:"application/fdf"})},e.singleAnnotJSONToFDF=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=void 0,s=t.next;if(r?i="Popup":r="popup"==(i=a(n&&n.type&&n.type.toLowerCase()||"")).toLowerCase(),!i||"link"==i.toLowerCase()||"screen"==i.toLowerCase()||"sound"==i.toLowerCase())return 0;var d=n.style||"S";d=d.toUpperCase()[0];var l=n.width,h=n.color||"",m="C"==d?"C":"S",g=n.intensity,y=0===n.opacity?0:n.opacity||1,_=c(n.contents||""),v=n.flags||"print",b=v.split(",");for(var S in v=0,o.AnnotFlagsName)-1!=b.indexOf(o.AnnotFlagsName[S])&&(v|=1<<parseInt(S));var w=n.creationdate,M=n.date,D=n.name||"",P=n.page,T=(n.rect||"").replace(/,/g," "),k=c(n.subject||"subject"),A=c(n.title||"title"),L=n["interior-color"]||n.interiorColor,F=s+" 0 obj\n<</Rect ["+T+"]/Subtype /"+i+"/NM ("+D+")";for(var I in n.customEntries)F+="/"+I+" "+c(n.customEntries[I])+"\n";if(t.annotRef.push(s+" 0 R "),t.next++,!r){if(F+="/M ("+M+")/CA "+y+"/Contents "+_+"/CreationDate ("+w+")/F "+v+"/Page "+P+"/Subj "+k+"/T "+A+"/Type /Annot",n.replyType){var x=void 0;F+="/RT /"+((x="string"==typeof n.replyType&&n.replyType||"Group")[0].toUpperCase()+x.substr(1))}n.inreplyto&&(F+="/IRT ("+n.inreplyto+")"),n.measureRatio&&(F+="/Measure<</R("+n.measureRatio+")/X[<</C "+n.measureConversionFactor+"/U("+n.measureUnit+")>>]/Type/Measure/Subtype/RL>>")}if(d||l){d=d||"S",l=l||"0",g=g||"0",m=m||"S";var C=(n.dashes||"").replace(/,/g," ");F+="/BS <</S /"+d+" /W "+l+" /D ["+C+"]>>/BE <</S /"+m+" /I "+g+">>"}"FreeText"!=i?(h&&(F+="/C "+p(h)),L&&(F+="/IC "+p(L))):(L&&(F+="/C "+p(L)),h&&(F+="/IC "+p(h),F+="/DS (color:"+n.fontColor+")")),void 0!==n.rotation&&(F+="/Rotate "+n.rotation);var R="";switch(i){case"Text":case"Note":F=F.replace(/\/Subtype\s?\/Note/,"/Subtype /Text"),n.icon&&(F+="/Name/"+u(n.icon));var O=void 0;(O=n.state)&&(F+="/State("+O+")/StateModel("+n.statemodel+")");break;case"Link":return"";case"FreeText":F=F.replace(/\/C\s?\[[\s\S]*?\]/,""),L&&(F+="/C "+p(L));var G=n.defaultappearance,E=n.justification,Y="/DA ("+G+")/Q "+E,j=n.intent||n.IT;if(j&&(Y+="/IT /"+j),n.callout){var N=n.callout.replace(/,/g," ");Y+="/CL ["+N+"]",Y+="/LE/"+n.head}if(n.fringe){var B=n.fringe.replace(/,/g," ");Y+="/RD ["+B+"]"}R=Y;break;case"Line":var H="yes"===n.caption,W=n.head,U=n.tail,z="[/"+W+"/"+U+"]",J=n.leaderLength,V=n.start.replace(/,/g," "),K=n.end.replace(/,/g," "),q=V+" "+K,Z=n.leaderExtend,X=n.leaderOffset,Q=n.captionOffset?n.captionOffset.x+" "+n.captionOffset.y:"",$=n.intent,ee="/Cap "+H+"/LE "+z+"/LL "+J+"/L ["+q+"]/LLE "+Z+"/LLO "+X;Q&&(ee+="/CO ["+Q+"]"),$&&(ee+="/IT /"+$),R=ee;break;case"Square":case"Circle":var te=n.intent,ne=n.fringe.replace(/,/g," "),re="/RD ["+ne+"]";te&&(re+="/IT /"+te),n.measureRatio&&n.measureUnit&&void 0!==n.measureConversionFactor&&(re+="/Measure<</R("+n.measureRatio+")/X[<</C "+n.measureConversionFactor+"/U("+n.measureUnit+")>>]/Type/Measure/Subtype/RL>>"),R=re;break;case"Polygon":case"PolyLine":var oe=n.vertices.replace(/[,|;]/g," "),ie=n.intent,ae="/Vertices ["+oe+"]";if(ie&&(ae+="/IT /"+ie),"PolygonDimension"===ie&&n.measureRatio&&n.measureUnit&&void 0!==n.measureConversionFactor&&(ae+="/Measure<</R("+n.measureRatio+")/X[<</C "+n.measureConversionFactor+"/U("+n.measureUnit+")>>]/Type/Measure/Subtype/RL>>"),"PolyLine"==i){var se=n.head,ue=n.tail,ce="[/"+se+"/"+ue+"]";ae+="/LE "+ce}R=ae;break;case"Redact":if(R+="/OC "+p(h),R+="/Repeat "+("yes"==n.repeat?"true":"false"),"Redact"==i){R+="/OverlayText"+c(n["overlay-text"]||n.overlaText||"");var de=n.defaultappearance;R+="/DA ("+de+")",R+="/Q "+(n.justification||0)}case"StrikeOut":case"Highlight":case"Squiggly":case"Underline":if(n.coords){var le=n.coords.replace(/,/g," ");R+="/QuadPoints ["+le+"]"}break;case"Caret":var fe=n.fringe.replace(/,/g," "),he="/RD ["+fe+"]";R=he;break;case"Stamp":if(n.icon&&(R="/Name/"+u(n.icon)),n.raw&&n.raw.N){var pe=f(t,n.raw,n.raw.N);R+="/AP<</N "+pe+" 0 R>>\n"}break;case"Ink":if("["===n.inklist[0]){var me=n.inklist.substr(1,n.inklist.length-2).split("],["),ge="";me.map((function(e){ge+="["+e.replace(/[,|;]/g," ")+"]"}));var ye="/InkList ["+ge+"]";R=ye}else R="/InkList [["+n.inklist.replace(/[,|;]/g," ")+"]]";break;case"Popup":R="/Open "+("yes"==n.open?"true":"false");break;case"Sound":var _e=f(t,n,{Filter:"/ASCIIHexDecode",R:n.rate,Type:"/Sound",stream:n.soundStream});R+="/Sound "+_e+" 0 R";case"FileAttachment":if(n.icon&&(R+="/Name/"+u(n.icon)),n.raw){var ve=f(t,n.raw,n.raw.FS);R+="/FS "+ve+" 0 R "}}if(n.popup){var be=e.singleAnnotJSONToFDF(t,n.popup,!0);R+="/Popup "+be+" 0 R"}return t.file+=F+R+">>\nendobj\n",s},e}(),f=function(e,t,n){var r=e.next;e.next++;var o="";if(o+=r+" 0 obj\n","string"==typeof n)o+=n;else if(n instanceof Array)o+="["+n.map((function(n){return h(e,t,n)})).join(" ")+"]";else{o+="<<\n";for(var i in n)"stream"!=i&&(o+="/"+i+" "+h(e,t,n[i]));if(o+=">>",n.stream){for(var a="",s=0;s<n.stream.length;s+=2){var u=parseInt(n.stream[s],16),c=parseInt(n.stream[s+1],16);a+=String.fromCharCode((u<<4)+c)}o+="stream\n"+a+"\nendstream"}}return o+="\nendobj\n",e.file+=o,r},h=function e(t,n,o){if(null===o)return"null";var i=void 0===o?"undefined":r(o);if("number"==i)return o;if("string"==i){if("/"==o[0])return"/"+u(o.replace("/",""));if("<"==o[0])return o;var a;return(a=o.match(/^(\d*)R$/))?f(t,n,n[a[1]])+" 0 R":"("+o+")"}if("boolean"==i)return o?"true":"false";if(o instanceof Array)return"["+o.map((function(r){return e(t,n,r)})).join(" ")+"]";var s="<<";for(var c in o)s+="/"+c+" "+e(t,n,o[c]);return s+">>"},p=function(e){var t=e.match(/\#?(\w{2})(\w{2})(\w{2})/),n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,o=parseInt(t[3],16)/255;return"["+n.toFixed(2)+" "+r.toFixed(2)+" "+o.toFixed(2)+"]"},m=function(e){for(var t in o.LineEndingName)if(o.LineEndingName[t]==e)return+t;return 0};t.default=l,t.xfdfJsonToAddJson=function(e){var t={type:e.type,opacity:e.opacity,name:e.name,contents:e.contents,subject:e.subject,title:e.title,icon:e.icon,intent:e.intent||e.IT,DA:e.defaultappearance,alignment:e.justification,enableCaption:"yes"==e.caption},n=e.fontColor;n&&(t.fontColor=parseInt(n.replace("#",""),16));var r=void 0;(r=e.color)&&(t.color=parseInt(r.replace("#",""),16));var a=e["interior-color"]||e.interiorColor;a&&(t.styleFillColor=t.fillColor=parseInt(a.replace("#",""),16));var s=e.flags||"print",u=s.split(",");for(var c in s=0,o.AnnotFlagsName)-1!=u.indexOf(o.AnnotFlagsName[c])&&(s|=1<<parseInt(c));t.flag=s;var d=(e.rect||"").split(",");d.length&&(t.rect={left:+d[0],top:+d[3],right:+d[2],bottom:+d[1]});var l=(e.fringe||"").split(",");4===l.length&&(t.innerRect={left:t.rect.left+ +l[0],top:t.rect.top-+l[3],right:t.rect.right-+l[2],bottom:t.rect.bottom+ +l[1]});var f=e.coords;if(f){f=f.split(","),t.coords=[];for(var h=0,p=f.length;h<p;h+=8){var g=Math.min(+f[0],+f[2],+f[4],+f[6]),y=Math.max(+f[0],+f[2],+f[4],+f[6]),_=Math.max(+f[1],+f[3],+f[5],+f[7]),v=Math.min(+f[1],+f[3],+f[5],+f[7]);t.coords.push({left:g,right:y,top:_,bottom:v})}}var b=e.callout;if(b){b=b.split(","),t.calloutLinePoints=[];for(var S=0,w=b.length;S<w;S+=2)t.calloutLinePoints.push({x:+b[S],y:+b[S+1]})}var M=e.head;M&&(t.startStyle=m(M));var D=e.tail;D&&(t.endStyle=m(D));var P=e.vertices;if(P){t.vertexes=[],P=P.split(";");for(var T=0;T<P.length;T++){var k=P[T].split(",");t.vertexes.push({x:+k[0],y:+k[1]})}}var A=e.inklist;if(A){t.inkList=[],A=JSON.parse("["+A.replace(/;/g,",")+"]");for(var L=0;L<A.length;L++)for(var F=A[L],I=0;I<F.length;I+=2){var x=F[I],C=0==I?1:2;t.inkList.push({x:x,y:F[I+1],type:C})}}var R=i.Border_Style[e.style||"solid"];t.borderInfo={style:R,width:e.width||1};var O=e.dashes;O&&(t.borderInfo.dashes=JSON.parse("["+O+"]"));var G=e.intensity;G&&(t.borderInfo.cloudIntensity=G);var E=e.start;E&&(E=E.split(","),t.startPoint={x:+E[0],y:+E[1]});var Y=e.end;return Y&&(Y=Y.split(","),t.endPoint={x:+Y[0],y:+Y[1]}),t},t.PDFNameEncode=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function e(t,n,r,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.left=t,this.bottom=n,this.right=r,this.top=o}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={print:4,modify:8,extract:16,annotForm:32,fillForm:256,extractAccess:512,assemble:1024,printHigh:2048}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={invisible:1,hidden:2,print:4,noZoom:8,noRotate:16,noView:32,readOnly:64,locked:128,toggleNoView:256,lockedContents:512}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=n(110),a=(r=i)&&r.__esModule?r:{default:r};function s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u={},c={},d=new(function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(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}(this,e.call(this));return n.workerObj=u,n.apis=c,n}return s(t,e),t.prototype.extendsWorkerAPI=function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.prototype.extendsWorkerAPI.apply(this,n),this},t.prototype.clearObjectFromCache=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];g.apply(null,t)},t}(a.default)),l={};function f(e,t,n){var r=l[t]=l[t]||{};(r[n]=r[n]||{})[e.id]=e}var h={};function p(e,t,n,r){var o=h[t]=h[t]||{};(o[n]=o[n]||{})[r]=e}function m(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=void 0;try{o=l[e][t][n]}catch(e){}if(!o&&!r)throw new Error("Couldn't obtain the graphic object from cache and the operation cannot be performed!");return o}function g(e,t,n){try{n?delete l[e][t][n]:t?delete l[e][t]:e&&delete l[e]}catch(e){}}c.getGraphicsObjectAtPoint=function(e,t){var n=t.docId,r=t.pageId,o=t.point,i=t.tolerance,a=t.type,s=t.rect;return u.getPageByID(n,r).then((function(e){return s?e.getGraphicsObjectsInRect(s,i,a):e.getGraphicsObjectAtPoint(o,i,a)})).then((function(t){if(t instanceof Array){var o=[];return t.forEach((function(e){f(e,n,r),o.push(e.toJson())})),void u.resolve(e,o)}t?(f(t,n,r),u.resolve(e,t.toJson())):u.resolve(e,{})}))},c.setGraphicsObjectMatrix=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.matrix,a=m(n,r,o);a.setMatrix(i),u.resolve(e,a.toJson())},c.setGraphicsObjectRect=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.rect,a=m(n,r,o);a.setRect(i,!0),u.resolve(e,a.toJson())},c.getGraphicsObjectBitmap=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.scale,a=t.rotation,s=m(n,r,o).render(i,a,null);u.resolve(e,s,[s.buffer])},c.setGraphicsObjectBorderStyle=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.style,a=t.dashes,s=m(n,r,o);s.setBorderStyle(i,a,!0),u.resolve(e,s.toJson())},c.setGraphicsObjectBorderWidth=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.width,a=m(n,r,o);a.setBorderWidth(i,!0),u.resolve(e,a.toJson())},c.setGraphicsObjectBorderColor=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.color,a=void 0,s=m(n,r,o);s&&(a=s.setBorderColor(i,!0)),u.resolve(e,a)},c.setGraphicsObjectFillColor=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.color,a=m(n,r,o);a.setFillColor(i,!0),u.resolve(e,a.toJson())},c.setGraphicsObjectOpacity=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.opacity,a=void 0,s=m(n,r,o);s&&(a=s.setOpacity(parseFloat(i),!0)),u.resolve(e,a)},c.addGraphicsObject=function(e,t){var n=t.docId,r=t.pageId,i=t.info;return Promise.all([u.jrPromise,u.getPageByID(n,r)]).then((function(e){var t=o(e,2),n=t[0],r=t[1];return Promise.all([n,r,r.c_pagePromise])})).then((function(e){var t=o(e,3),n=t[0],r=t[1],a=t[2];return n.graphicsObjectManager.create(i,a,r)})).then((function(t){f(t,n,r),u.resolve(e,t.toJson())}))},c.setImageObjectOpacity=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.opacity,a=void 0,s=m(n,r,o);s&&(a=s.setOpacity(i,!0)),u.resolve(e,a)},c.removeGraphicsObject=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=void 0,a=m(n,r,o,!0);a&&(i=a.remove(),a=null,g(n,r,o)),u.resolve(e,i)},c.moveGraphicsObjectByPosition=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.type,a=t.graphicObjectId,s=void 0,c=m(n,r,o,!0);c&&(s=c.moveToPosition(i,a)),u.resolve(e,s)},c.setImageObjectRotation=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.rotation,a=m(n,r,o);a.setRotation(i,!0),u.resolve(e,a.toJson())},c.getImageObjectStream=function(e,t){var n=m(t.docId,t.pageId,t.id);u.resolve(e,n.getStream())},c.setTextObjectChar=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.char,a=m(n,r,o);return a.setText(i).then((function(){u.resolve(e,a.toJson())}))},c.setTextObjectItalic=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.italic,a=m(n,r,o);return a.setItalic(i).then((function(){u.resolve(e,a.toJson())}))},c.setTextObjectBold=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.bold,a=m(n,r,o);return a.setBold(i).then((function(){u.resolve(e,a.toJson())}))},c.setTextObjectFontSize=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.size,a=m(n,r,o);return a.setFontSize(i).then((function(){u.resolve(e,a.toJson())}))},c.setTextObjectStandardFont=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.standardId,a=m(n,r,o);return a.setStandardFont(i).then((function(){u.resolve(e,a.toJson())}))},c.setTextObjectFontByName=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.name,a=t.styles,s=t.charset,c=m(n,r,o);return c.setFontByName(i,a,s).then((function(){u.resolve(e,c.toJson())}))},c.getTextObjectWoff=function(e,t){var n=m(t.docId,t.pageId,t.id).getWoff();return u.resolve(e,n,[])},c.pasteGraphicObject=function(e,t,n,r,o,i){var a=h[t][r.id][o],s=n.page,c=s.GetLastGraphicsObjectPosition(n.engine.GraphicsObjectType.e_TypeAll);s.InsertGraphicsObject(c,a.graphicsObject),a.setRect(i),s.GenerateContent(),f(a,t,n.id),function(e,t,n){try{n?delete h[e][t][n]:t?delete h[e][t]:e&&delete h[e]}catch(e){}}(t,r.id,o);var d=a.graphicsObject.Clone();p(n.JR.graphicsObjectManager.get(d,s,n),t,r.id,o),u.resolve(e,a.toJson())},c.getGraphicsObjectByIndex=function(e,t){var n=t.docId,r=t.pageId,o=t.index;return u.getPageByID(n,r).then((function(e){return e.getGraphicsObjectByIndex(o)})).then((function(t){t?(f(t,n,r),u.resolve(e,t.toJson())):u.resolve(e,{})}))},c.getGraphicsObjectsCount=function(e,t){var n=t.docId,r=t.pageId;return u.getPageByID(n,r).then((function(e){return e.getGraphicsObjectsCount()})).then((function(t){u.resolve(e,t)}))},c.addPageImage=function(e,t){var n=t.docId,r=t.pageId,o=t.imageBuffer,i=t.point,a=t.width,s=t.height,c=t.rotation;return u.getPageByID(n,r).then((function(e){return e.addImage(o,i,a,s,c)})).then((function(t){f(t,n,r),u.resolve(e,t.toJson())}))},c.cloneGraphicObject=function(e,t){var n=t.docId,r=t.pageId,o=t.srcPageId,i=t.ids;h={};var a=i.map((function(e){return m(n,o,e)}));return u.getPageByID(n,r).then((function(t){var r=a.map((function(e){return e.graphicsObject.Clone()})),o=t.page,s=[],c=[];r.forEach((function(e){s.push(t.JR.graphicsObjectManager.get(e,o,t))})),s.forEach((function(e,r){p(e,n,t.id,i[r]),c.push(e.toJson())})),u.resolve(e,c)}))},t.default=d.extendsWorkerAPI.bind(d)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(382),o=(n(3),s(n(110))),i=(s(n(379)),s(n(828))),a=s(n(364));function s(e){return e&&e.__esModule?e:{default:e}}function u(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var c={},d={},l=new(function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(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}(this,e.call(this));return n.workerObj=c,n.apis=d,n}return u(t,e),t}(o.default));d.handlePageEditorEvent=function(e,t){var n=t.docId,o=t.fn,i=t.delay,s=t.args;return c.getDocByID(n).then((function(t){(0,r.initGSDKModule)(t.engine,r.ModulePageEditor);var n=(0,a.default)(t,s);try{c.resolve(e,n.handle(o,i,s))}catch(e){console.error(e)}}))},d.updateWinlessMatrix=function(e,t){var n=t.docId,o=t.type,s=t.matrixes;return c.getDocByID(n).then((function(t){switch(o){case 1:(0,r.initGSDKModule)(t.engine,r.ModuleTouchup),(0,i.default)(t.engine,t).updateMatrix(s);break;default:(0,a.default)(t).updateMatrix(s)}c.resolve(e)}))},d.changePEProperty=function(e,t){var n=t.docId,r=t.type,o=t.fn,i=t.param;return c.getDocByID(n).then((function(t){var n=(0,a.default)(t);c.resolve(e,n.changePEProperty(r,o,i))}))},d.changeEditingProperty=function(e,t){var n=t.docId,r=t.fn,o=t.args;return c.getDocByID(n).then((function(t){var n=(0,a.default)(t);c.resolve(e,n.changeEditingProperty(r,o))}))},d.triggerPopMenuAction=function(e,t){var n=t.docId,r=t.action;return c.getDocByID(n).then((function(t){var n=(0,a.default)(t);c.resolve(e,n.triggerPopMenuAction(r))}))},d.handleTouchUpEvent=function(e,t){var n=t.docId,o=t.fn,a=t.args;return c.getDocByID(n).then((function(t){(0,r.initGSDKModule)(t.engine,r.ModuleTouchup);var n=(0,i.default)(t.engine,t);c.resolve(e,n.handleTouchUpEvent(o,a))}))},d.handleFindReplaceEvent=function(e,t){var n=t.docId,o=t.fn,a=t.args;return c.getDocByID(n).then((function(e){return(0,r.initGSDKModule)(e.engine,r.ModuleTouchup),(0,i.default)(e.engine,e).handleFindReplaceEvent(o,a)})).then((function(t){return c.resolve(e,t)}))},d.triggerTUPopMenuAction=function(e,t){var n=t.docId,r=t.action;return c.getDocByID(n).then((function(t){var n=(0,i.default)(t.engine,t);c.resolve(e,n.triggerPopMenuAction(r))}))},d.reInitPageEditor=function(e,t){var n=t.docId;return c.getDocByID(n).then((function(t){var n=t.pageEditor;n&&(n.oldEditPages=n.editPages,n.editPages={}),c.resolve(e)}))},t.default=l.extendsWorkerAPI.bind(l)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=a(n(729)),i=a(n(110));function a(e){return e&&e.__esModule?e:{default:e}}function s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u={},c={},d=new(function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(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}(this,e.call(this));return n.workerObj=u,n.apis=c,n.cache={},n}return s(t,e),t.prototype.extendsWorkerAPI=function(){for(var t=this,n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.prototype.extendsWorkerAPI.apply(this,r),u.jrPromise.then((function(e){return t.jr=e})),this},t.prototype.clearObjectCache=function(e){if(e){var t=r(this.cache[e],2);t[0],t[1];delete this.cache[e]}else for(var n in this.cache){var o=r(this.cache[n],2);o[0],o[1];delete this.cache[n]}},t.prototype.getCachedObject=function(e){return this.cache[e]},t.prototype.cacheObject=function(e,t,n){return n=n||e.$$.ptr,t?this.cache[n]=[e,t]:this.cache[n][0]=e,n},t}(i.default)),l=function(e){var t=e.docId,n=e.pageId,r=e.type,o=e.rect,i=e.rotation;return u.getPageByID(t,n).then((function(e){var t=e.engine,n=new t.FillSign(e.page),a=o.right-o.left,s=o.top-o.bottom,u=n.AddObject({value:r},new t.PointF(o.left,o.bottom),a,s,{value:i});return[d.cacheObject(u,n),u,t]}))},f=function(e,t){var n=d.jr.createReaderCallback(t),r=new engine.Image(n).GetFrameBitmap(0);e.SetBitmap(r),e.GenerateContent()},h=function(e){var t=e.docId,n=e.pageId,r=e.rect,i=e.textState,a=e.text,s=e.isComb,c=e.rotation;return u.getPageByID(t,n).then((function(e){var t=e.engine,n=new t.TextState;n.version=1,n.font=new t.Font(t.StandardID.e_StdIDHelvetica),n.font_size=i.fontSize,n.charspace=i.charspace,n.textmode={value:i.textMode},n.wordspace=i.wordspace;var u=c;u%=4;var l=new t.Matrix;l.Rotate(u/2*Math.PI,!1),n.SetMatrixA(l.a),n.SetMatrixB(l.b),n.SetMatrixC(l.c),n.SetMatrixD(l.d);for(var f=new t.TextFillSignObjectDataArray,h=0;h<a.length;h++){var p=new t.TextFillSignObjectData(n,new t.WString(a.charAt(h)));f.Add(p)}var m=new t.FillSign(e.page),g=t.Rotation.values[u],y=m.AddTextObject(f,new t.PointF(r.left,r.bottom),1,1,g,s);(y=new t.TextFillSignObject(y)).GenerateContent();d.cacheObject(y,m);var _=(0,o.default)(t,d,m,y);return _.textState.matrix=[l.a,l.b,l.c,l.d],_}))};c.addPathFillSignObject=function(e,t){l(t).then((function(n){var o=r(n,2),i=o[0],a=o[1];a.GenerateContent();var s=a.GetRect();u.resolve(e,{id:i,type:t.type,rect:{left:s.left,right:s.right,top:s.top,bottom:s.bottom}})}))},c.moveFillSignObject=function(e,t){var n=t.id,i=t.rect,a=t.rotation,s=d.jr.engine,c=d.getCachedObject(n),l=r(c,2),f=l[0],h=l[1],p=i.right-i.left,m=i.top-i.bottom;f.Move(new s.PointF(i.left,i.bottom),p,m,{value:a||0}),f.GenerateContent(),u.resolve(e,(0,o.default)(s,d,h,f))},c.addTextFillSignObject=function(e,t){h(t).then((function(t){u.resolve(e,t)}))},c.addSignatureFillSignObject=function(e,t){t.type=6,l(t).then((function(n){var o=r(n,3),i=o[0],a=o[1];a=new o[2].SignatureFillSignObject(a),f(a,t.url),i=d.cacheObject(a),u.resolve(e,{id:i,rect:{left:rect.left,right:rect.right,top:rect.top,bottom:rect.bottom},type:6})}))},c.updateTextFillSign=function(e,t){var n=t.docId,i=t.pageId,a=t.id,s=t.property;return u.getPageByID(n,i).then((function(t){var c=t.engine,l=d.getCachedObject(a),f=r(l,2),p=f[0],m=f[1],g=p.GetTextDataArray(),y=void 0,_=!1,v=void 0;if(0==g.GetSize())y=new c.TextState,v=new c.WString(""),_=!0;else{var b=g.GetAt(0);y=b.text_state,v=b.text}Array.isArray(s)||(s=[s]);var S=!1,w=void 0,M=void 0,D=void 0;if(s.forEach((function(e){var t=e.key,n=e.value;if(void 0!==n)switch(t){case"rect":S=!0,w=n;break;case"font":break;case"fontSize":y.font_size=n,M=n;break;case"charspace":y.charspace=n;break;case"textMode":y.textmode=n;break;case"wordspace":y.wordspace=n;break;case"text":v=new c.WString(n),D=n}})),S){var P=(0,o.default)(c,d,m,p);m.RemoveObject(p),d.clearObjectCache(a),P=Object.assign(P,{docId:n,pageId:i}),M&&(P.textState.fontSize=M),D&&(P.text=D);var T=P.matrix;return P.rotation=0,0==T[0]&&1==T[1]&&-1==T[2]&&0==T[3]&&(w&&(w.right=w.left+1,w.top=w.bottom+1),P.rotation=1),-1==T[0]&&0==T[1]&&0==T[2]&&-1==T[3]&&(w&&(w.left=w.right-1,w.top=w.bottom+1),P.rotation=2),0==T[0]&&-1==T[1]&&1==T[2]&&0==T[3]&&(w&&(w.left=w.right-1,w.bottom=w.top-1),P.rotation=3),w&&(P.rect=w),void h(P).then((function(t){var n=t.id,r=d.getCachedObject(n);d.clearObjectCache(n),d.cacheObject(r[0],r[1],a),t.textState.fontSize=y.font_size,t.id=a,_&&(y.delete(),v.delete()),u.resolve(e,t)}))}var k=new c.TextFillSignObjectData(y,v),A=new c.TextFillSignObjectDataArray;A.Add(k),p.SetTextDataArray(A,!1),p.GenerateContent(),_&&(y.delete(),v.delete()),k.delete(),A.delete();var L=(0,o.default)(c,d,m,p);u.resolve(e,L)}))},c.updateFillSign=function(e,t){t.docId,t.pageId;var n=t.id,o=t.property,i=d.getCachedObject(n),a=r(i,2),s=a[0];a[1];f(s,o.url),u.resolve(e)},c.getFillSignObject=function(e,t){var n=t.docId,r=t.pageId,i=t.point;return u.getPageByID(n,r).then((function(t){var n=t.engine,r=new n.FillSign(t.page),a=r.GetObjectAtPoint(new n.PointF(i.x,i.y));if(a.IsEmpty())return u.resolve(e,{empty:!0});var s=(0,o.default)(n,d,r,a);u.resolve(e,s)}))},c.removeFillSignObject=function(e,t){var n=t.docId,o=t.pageId,i=t.id;return u.getPageByID(n,o).then((function(t){var n=d.getCachedObject(i),o=r(n,2),a=o[0];o[1].RemoveObject(a),t.page.GenerateContent(),d.clearObjectCache(i),u.resolve(e)}))},t.default=d.extendsWorkerAPI.bind(d)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n,r){var o=r.GetRect(),a=r.GetType().value;0==a?r=new e.TextFillSignObject(r):6!=a&&7!=a||(r=new e.SignatureFillSignObject(r));var s={id:t.cacheObject(r,n),rect:{left:o.left,right:o.right,top:o.top,bottom:o.bottom},type:a};0==a&&Object.assign(s,(0,i.default)(r));return s};var r,o=n(730),i=(r=o)&&r.__esModule?r:{default:r}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.GetRect(),n=e.GetTextDataArray(),r=e.GetFormXObject().GetMatrix(),o={};if(n.GetSize()>0){var i=n.GetAt(0).text_state;o={fontId:i.font.GetName().toString(),fontSize:i.font_size,charspace:i.charspace,textMode:i.textmode.value,wordspace:i.wordspace,matrix:[i.GetMatrixA(),i.GetMatrixB(),i.GetMatrixC(),i.GetMatrixD()]}}else o={fontSize:12,charspace:0,wordspace:0,matrix:[1,0,0,1]};for(var a="",s=0,u=n.GetSize();s<u;s++){var c=n.GetAt(s);a+=c.text.toString()}return{rect:{left:t.left,right:t.right,top:t.top,bottom:t.bottom},text:a,isComb:e.IsCombFieldMode(),textState:o,matrix:[r.a,r.b,r.c,r.d,r.e,r.f]}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};function o(e,t){var n=e.engine.PageLabelsStyle;switch(t){case n.e_None:return"none";case n.e_DecimalNums:return"decimalNums";case n.e_UpperRomanNums:return"upperRomanNums";case n.e_LowerRomanNums:return"lowerRomanNums";case n.e_UpperLetters:return"upperLetters";case n.e_LowerLetters:return"lowerLetters"}return"decimalNums"}function i(e,t,n){var o=n.styleType,i=void 0===o?"decimalNums":o,a=n.prefix,s=void 0===a?"":a,u=n.start,c=void 0===u?1:u,d=e.engine,l=new d.PageLabels(e.doc),f=e.doc.GetPageCount(),h=r(t,2),p=h[0],m=h[1],g=m+1;if(g<f){var y=l.HasPageLabel(m);if(0==l.HasPageLabel(g)){var _=d.PageLabelsStyle.e_DecimalNums,v="",b=-1;if(0==y){for(var S=m-1;S>=0;S--)if(l.HasPageLabel(S)){_=l.GetPageLabelStyle(S),v=l.GetPageLabelPrefix(S);var w=l.GetPageLabelStart(S);b=p<=S?w:p-S+w;break}-1===b&&(b=p+1)}else _=l.GetPageLabelStyle(m),v=l.GetPageLabelPrefix(m),b=l.GetPageLabelStart(m);v=v instanceof d.WString?v:new d.WString(v),l.SetPageLabel(g,_,b,v)}}var M=new d.WString(s),D=function(e,t){var n={none:"e_None",decimalNums:"e_DecimalNums",upperRomanNums:"e_UpperRomanNums",lowerRomanNums:"e_LowerRomanNums",upperLetters:"e_UpperLetters",lowerLetters:"e_LowerLetters"}[t];return e.engine.PageLabelsStyle[n]}(e,i);l.SetPageLabel(p,D,c,M);for(var P=p+1;P<=m;P++)l.HasPageLabel(P)&&l.RemovePageLabel(P)}function a(e,t){var n=e.engine,o=new n.PageLabels(e.doc),i=e.doc.GetPageCount(),a=r(t,2),s=a[0],u=a[1],c=u+1,d=!0;if(c<i){var l=o.HasPageLabel(u);if(0==o.HasPageLabel(c)){var f=n.PageLabelsStyle.e_None,h="",p=-1;if(0==l){for(var m=u-1;m>=0;m--)if(o.HasPageLabel(m)){f=o.GetPageLabelStyle(m),h=o.GetPageLabelPrefix(m),s<=m?p=o.GetPageLabelStart(m):d=!1;break}-1===p&&(p=s+1)}else f=o.GetPageLabelStyle(u),h=o.GetPageLabelPrefix(u),p=o.GetPageLabelStart(u);h=h instanceof n.WString?h:new n.WString(h),o.SetPageLabel(c,f,p,h)}}if(0!=d)for(var g=u;g>=s;g--)0!=g&&o.HasPageLabel(g)&&o.RemovePageLabel(g)}t.getPageIndexByLabelText=function(e,t){for(var n=e.doc,r=new e.engine.PageLabels(n),o=n.GetPageCount(),i=0;i<o;i++){if(r.GetPageLabelTitle(i).toString()===t)return i}return-1},t.getCurrentPageLabelInfo=function(e,t){var n=new e.engine.PageLabels(e.doc),r=n.GetPageLabelPrefix(t),i=n.GetPageLabelTitle(t);for(;!n.HasPageLabel(t)&&t>0;)t--;var a=n.GetPageLabelStyle(t),s=n.GetPageLabelStart(t);return{hasLabel:n.HasPageLabel(t),style:o(e,a),firstNumber:s,prefix:r.toString(),title:i.toString()}},t.checkDocIsUseLogicPage=function(e){var t=e.engine,n=e.doc,r=new t.PageLabels(n);if(!r.HasPageLabel(0))return!1;for(var o=n.GetPageCount(),i=0;i<o;i++){if(r.HasPageLabel(i)&&(r.GetPageLabelStyle(i)!==t.PageLabelsStyle.e_DecimalNums||""!==r.GetPageLabelPrefix(i).toString()))return!0}return!1},t.formatPageNumbers=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};!0===t?a(e,n):i(e,n,r)};t.UpdatePageLabels=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.insertPagesByRange=function(e,t){var n=!0,r=!1,o=void 0;try{for(var i,a=t[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var s=i.value;this.insertPages(e,s,1)}}catch(e){r=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw o}}},e.insertPages=function(e,t,n){var r=e.engine,o=new r.PageOperationInfo;o.type=r.PageOperationType.e_PageOperationInsert,o.page_index_1=t,o.page_count=n,e.doc.UpdatePageLabels(o)},e.deletePages=function(e,t){var n=e.engine,o=new n.PageOperationInfo;o.type=n.PageOperationType.e_PageOperationDelete;var i=!0,a=!1,s=void 0;try{for(var u,c=t[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var d=u.value,l=r(d,2),f=l[0],h=l[1];h=void 0===h?f:h,o.page_index_range.AddSegment(f,h,n.RangeFilter.e_All)}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}e.doc.UpdatePageLabels(o)},e.reversePages=function(e,t){var n=e.engine,r=new n.PageOperationInfo;r.type=n.PageOperationType.e_PageOperationReverse;var o=!0,i=!1,a=void 0;try{for(var s,u=t[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value;r.page_index_range.AddSegment(c,c,n.RangeFilter.e_All)}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}e.doc.UpdatePageLabels(r)},e.replacePages=function(e,t,n,r,o){var i=e.engine,a=new i.PageOperationInfo;a.type=i.PageOperationType.e_PageOperationReplace,a.page_index_1=t,a.page_count=n-t+1,a.page_index_range.AddSegment(r,o,i.RangeFilter.e_All),e.doc.UpdatePageLabels(a)},e.swapPages=function(e,t,n){var r=e.engine,o=new r.PageOperationInfo;o.type=r.PageOperationType.e_PageOperationSwap,o.page_index_1=t,o.page_index_2=n,e.doc.UpdatePageLabels(o)},e.movePages=function(e,t,n){var r=e.doc.GetPageCount(),o=n;t[0]<n&&(o=n-1),o<0&&(o=0),o>=r&&(o=r-1);var i=e.engine,a=new i.PageOperationInfo;a.type=i.PageOperationType.e_PageOperationMove;var s=!0,u=!1,c=void 0;try{for(var d,l=t[Symbol.iterator]();!(s=(d=l.next()).done);s=!0){var f=d.value;a.page_index_range.AddSegment(f,f,i.RangeFilter.e_All)}}catch(e){u=!0,c=e}finally{try{!s&&l.return&&l.return()}finally{if(u)throw c}}a.page_index_1=o,e.doc.UpdatePageLabels(a)},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return JSON.parse(JSON.stringify(e)).reduce((function(e,t){if(2===t.length){for(var n=[],r=t[0];r<t[1];r++)n.push(r);t=n}return e.concat(t)}),[])}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o;t.sanitizeDocument=(r=i(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.doc,e.next=3,n.Sanitize();case 3:return r=e.sent,e.abrupt("return",r);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)}),t.removeHiddenInfo=(o=i(regeneratorRuntime.mark((function e(t,n){var r,o,i,s,u,c,d,l,f,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=t.doc,o=t.engine,i=new o.RemoveInfo,s=!0,u=!1,c=void 0,e.prev=6,d=a[Symbol.iterator]();!(s=(l=d.next()).done);s=!0)f=l.value,i[f]=!!n[f];e.next=14;break;case 10:e.prev=10,e.t0=e.catch(6),u=!0,c=e.t0;case 14:e.prev=14,e.prev=15,!s&&d.return&&d.return();case 17:if(e.prev=17,!u){e.next=20;break}throw c;case 20:return e.finish(17);case 21:return e.finish(14);case 22:return e.next=24,r.RemoveHiddenInfo(i);case 24:return h=e.sent,e.abrupt("return",h);case 26:case"end":return e.stop()}}),e,this,[[6,10,14,22],[15,,17,21]])}))),function(e,t){return o.apply(this,arguments)});function i(e){return function(){var t=e.apply(this,arguments);return new Promise((function(e,n){return function r(o,i){try{var a=t[o](i),s=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(s).then((function(e){r("next",e)}),(function(e){r("throw",e)}));e(s)}("next")}))}}var a=["bRemoveBookmark","bRemoveComment","bRemoveContent","bRemoveFileattachment","bRemoveForm","bRemoveHideLayer","bRemoveHideText","bRemoveLink","bRemoveMetadata","bRemoveOverlaping","bRemoveSearchIndex"]},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return A})),n.d(t,"WORK_FLOW",(function(){return S}));var r,o,i=n(176),a=n.n(i),s=n(127),u=n(22),c=n(3),d=function(){this.Release=function(){},this.FindFontInFormatBar=function(e){},this.EnableFormatToolBar=function(e){},this.SetOwnerFontName=function(e){for(var t=[],n=0,r=e.GetSize();n<r;n++)t.push(e.GetAt(n).toString());postMessage({workflow:S,type:"fontNameChange",msg:t})},this.ClearOwnerFontName=function(e){},this.UpdateTextFormat=function(e,t,n){postMessage({workflow:S,type:"updateTextFormat",msg:{secProps:{lineLeading:e.fLineLeading,lineIndent:e.fLineIndent,alignment:e.nAlignment,enableSoftReturn:e.bEnableSoftReturn,rtl:e.bRTL,secSpace:e.fSecSpace},wordProp:{fontSize:t.fFontSize,wordColor:Object(u.intColorToHex)(t.dwWordColor),strokeColor:Object(u.intColorToHex)(t.dwStrokeColor),scriptType:t.nScriptType,wordStyle:t.nWordStyle,charSpace:t.fCharSpace,horzScale:t.nHorzScale,wordSpace:t.fWordSpace,xOffset:t.fXOffset,yOffset:t.fYOffset,renderingMode:t.nRenderingMode,lineWidth:t.fLineWidth,charCode:t.dwCharCode,alphal:t.nAlphal/255,isCross:Boolean(4&t.nWordStyle),isUnderline:Boolean(2&t.nWordStyle),isBold:Boolean(262144&t.nWordStyle||11===t.nRenderingMode),isItalic:Boolean(64&t.nWordStyle)},fontName:n?n.toString():"Helvetica"}})}},l={},f={},h={trackPopupMenu:function(e,t,n,r){},TrackPopupMenu:function(e,t,n,r){return h.trackPopupMenu(l[e],t,n,r)},Release:function(){},CreatePopupMenu:function(){var e=(Date.now()+1e3*Math.random()|0)%2147483647;return l[e]=[],e},CreatePopupSubMenu:function(){var e=(Date.now()+1e3*Math.random()|0)%2147483647;return l[e]=[],e},AppendMenuItem:function(e,t){var n={name:t,enable:!0,isCheck:!0,id:t};f[t]=n,l[e].push(n)},AppendSubMenu:function(e,t,n){l[e].push({name:t,subItems:l[n]})},RemoveMenuItem:function(e,t,n){},AppendSeparator:function(e){l[e].push({name:"-"})},EnableMenuItem:function(e,t,n,r){var o=f[t];o&&(o.enable=n)},CheckMenuItem:function(e,t,n){f[t].isCheck=n},InsertMenuItem:function(e,t,n,r){},InsertSeparator:function(e,t){},DestroyMenu:function(e){l={}},IsMenuEnabled:function(e){return!0}},p=h,m=function(){function e(){this.isEdit=!1,this.isGroup=!1}return e.prototype.Release=function(){},e.prototype.BeginEdit=function(e){this.isEdit=!0},e.prototype.EndEdit=function(){this.isEdit=!1,this.endEditCallback()},e.prototype.IsUndoRedoing=function(){},e.prototype.BeginUndoGroup=function(){this.isGroup=!0},e.prototype.EndUndoGroup=function(e){this.isGroup=!1,this.endCallback()},e.prototype.SetOwnUndoMode=function(e){},e.prototype.Restore=function(e){},e.prototype.registerEndGroup=function(e){this.endCallback=e},e.prototype.registerEndEdit=function(e){this.endEditCallback=e},e}(),g=!0,y=!1;var _,v,b,S="touchup",w=(v=[],function(e){_&&clearTimeout(_),v=v.concat(e),_=setTimeout((function(){postMessage({workflow:S,type:"revertBackground",msg:v}),v=[]}),20)}),M=function(){function e(e){var t=this;this.lastUndo=[],this.undos=[],this.redos=[],this.Undo=function(e){try{var n=t.undos,o=t.redos;e||(n=t.redos,o=t.undos);var i=n.pop();if(!i)return;if(Array.isArray(i))for(var a=i.length-1;a>=0;a--)r.TouchupUndo(i[a],e);else r.TouchupUndo(i,e);o.push(i)}catch(e){console.log("undo err",e)}},this.undoCallback=e,e.registerEndGroup((function(){t.undos.push(t.lastUndo),t.lastUndo=[]})),e.registerEndEdit((function(){t.undos=[],t.redos=[]}))}return e.prototype.Release=function(){},e.prototype.OnEnterEditing=function(e){return postMessage({workflow:S,type:"enterEdit"}),!1},e.prototype.OnExitEditing=function(){return postMessage({workflow:S,type:"exitEdit"}),!1},e.prototype.OnInvalid=function(e,t,n){},e.prototype.SetTimerCallback=function(e,t){var n=setInterval((function(){r.OnTimeout(t,n)}),e);return g&&postMessage({workflow:S,type:"toggleCaret",msg:!0}),n},e.prototype.KillTimer=function(e){g&&postMessage({workflow:S,type:"toggleCaret",msg:!1}),clearInterval(e)},e.prototype.OnAddUndo=function(e){postMessage({workflow:S,type:"docModified"}),this.undoCallback.isGroup?this.lastUndo.push(e):(this.undos.push(e),this.redos=[])},e.prototype.OnChangeDoc=function(e){},e.prototype.OnLROnPageWithoutText=function(e){var t=e.GetPage().GetIndex();postMessage({workflow:S,type:"pageWithoutText",msg:t})},e.prototype.OnTextInputReachesLimit=function(e){},e}(),D={Create:function(e,t){return postMessage({workflow:S,type:"progressCreate",msg:[e,t]}),101},IsCancelled:function(e){return!1}};b=self.Proxy?new Proxy(D,{get:function(e,t){return e[t]?e[t]:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];postMessage({workflow:S,type:"progress"+t.toString(),msg:e.map((function(e){return e instanceof r.WString?e.toString():e}))})}}}):function(){};var P=function(){function e(){var e=this;this.visibleIndexes=[],this.Release=function(){},this.GetRenderMatrix=function(t){var n=new r.Matrix,o=t.GetPage(),i=e.matrixes[o.GetIndex()];if(!i)return n;var a=i[2];n.Set(a.a,a.b,a.c,a.d,a.e,a.f);var s=e.matrixes.dpr||1;return n.Scale(s,s,!1),n},this.GetClientRect=function(t){var n=e.matrixes.uiRect,o=n.width,i=n.height,a=e.matrixes.dpr||1,s=new r.CFX_FloatRect;return s.left=0,s.top=0,s.right=o*a,s.bottom=i*a,s},this.GetPageVisibleRect=function(t){var n=t.GetPage(),o=e.matrixes[n.GetIndex()],i=new r.CFX_FloatRect;if(!o)return i;var a=o[3],s=e.matrixes.dpr||1;i.left=a.left*s,i.top=a.top*s,i.right=a.right*s,i.bottom=a.bottom*s;var u=e.GetRenderMatrix(t),c=new r.Matrix;return c.SetReverse(u),c.TransformRect(i),u.delete(),c.delete(),i},this.GetPageRect=function(t){var n=t.GetPage(),o=e.matrixes[n.GetIndex()],i=new r.CFX_FloatRect;if(!o)return i;var a=o[4],s=e.matrixes.dpr||1;return i.left=a.left*s,i.top=a.top*s,i.right=a.right*s,i.bottom=a.bottom*s,i},this.GetPageViewScale=function(t){var n=t.GetPage().GetIndex(),r=e.matrixes[n];return r?r[0]:4/3},this.GotoPageView=function(e,t,n){var r=e.GetPage().GetIndex();return postMessage({workflow:S,type:"gotoPageView",msg:{index:r,left:t,top:n}}),!0},this.ScrollToCenterPoint=function(e,t){var n=e.GetPage().GetIndex();postMessage({workflow:S,type:"gotoPageView",msg:{index:n,left:t.x,top:t.y}})},this.Scroll=function(e,t){console.log("Scroll")},this.GetString=function(e){return Object(c.CWString)(r,"string"+e)},this.ShowMessageBox=function(e,t,n){return postMessage({workflow:S,type:"showMessageBox",msg:{id:e.value,flag:t,data:n}}),!0},this.ChangeCursor=function(e){postMessage({workflow:S,type:"cursorChange",msg:e&&e.value})},this.GetPageWindow=function(e){return 1e3},this.SetClipboardText=function(t,n){e.text=n.toString()},this.GetClipboardText=function(){return Object(c.CWString)(r,e.text||"")}}return e.prototype.DrawRect=function(e,t){for(var n=[],r=0,o=t.GetSize();r<o;r++){var i=t.GetAt(r);n.push({left:0|i.left,top:0|i.top,right:0|i.right,bottom:0|i.bottom})}return w(n),!0},e}(),T=function(){function e(){this.rects=[]}return e.prototype.Release=function(){},e.prototype.OnEnterReplaceAll=function(e){},e.prototype.OnExitReplaceAll=function(e){},e.prototype.GetLastedDocTempPath=function(e){return Object(c.CWString)(r,"c:/fakepath.pdf")},e.prototype.ReParseTextPage=function(e,t,n){},e.prototype.AddSelectTextRects=function(e,t){if(g){for(var n=[],r=e.GetPage().GetIndex(),o=0;o<t.GetSize();o++){var i=t.GetAt(o),a={left:i.left,right:i.right,top:i.top,bottom:i.bottom};n.push(a),this.rects.push(a)}postMessage({workflow:S,type:"addTextRects",msg:{rects:n,index:r,caller:"AddSelectTextRects"}})}},e.prototype.GetSelectPDFRect=function(e){var t=new r.RectFArray;return this.rects.forEach((function(e){var n=new r.CFX_FloatRect(e.left,e.bottom,e.right,e.top);t.Add(n)})),t},e.prototype.AddSelect=function(e,t){if(g){var n=e.GetPage().GetIndex();this.rects=[];for(var r=0;r<t.GetSize();r++){var o=t.GetAt(r);this.rects.push({left:o.left,right:o.right,top:o.top,bottom:o.bottom})}postMessage({workflow:S,type:"addTextRects",msg:{rects:this.rects,index:n,caller:"AddSelect"}})}},e.prototype.DeselectAll=function(){this.rects=[]},e}(),k=function(){function e(){var e=this;this.targets={},this.controlDown=!1,this.shiftDown=!1,this.popMenuAction=-1,this.modifiedObjects=[],this.OnContentChange=function(t,n,r){if(1!=t.value&&r)for(var o=0;o<r.GetSize();o++){var i=r.GetAt(o);e.modifiedObjects.push(i)}},this.setJRMgr=function(t){e.jrMgr=t},this.OnInvalid=function(t,n,r){if(void 0===r&&(r=!1),e.target.Render&&!Array.isArray(e.lastEditorPage)){var o=e.lastEditorPage.GetPage(),i=e.providerCallback.matrixes.uiRect,a=e.providerCallback.matrixes.dpr,u={width:i.width*a,height:i.height*a},c=s.default.render((function(t){var n=e.GetVisiblePage(e.doc.doc);return e.target.Render(n,t)}),o,u);postMessage({workflow:S,type:"updateView",msg:{bitmapInfo:c,redraw:r}})}},this.GetVisiblePage=function(t){var n=new r.TouchupEditorPageArray;return e.providerCallback.visibleIndexes.forEach((function(e){var o=t.GetPage(e),i=r.TUEditorPage.Create(o,101);n.Add(i)})),n},this.GetDefaultEditorPage=function(){var t=e.providerCallback.visibleIndexes[0],n=e.doc.doc.GetPage(t);return r.TUEditorPage.Create(n,101)},this.TrackPopupMenu=function(t,n,r,o){if(-1!==e.popMenuAction){var i=e.popMenuAction;return e.popMenuAction=-1,i}var a={},s=o.GetPage().GetIndex(),u=e.providerCallback.matrixes.dpr||1;return a.position={x:n/u,y:r/u},a.menu=t,a.pageIndex=s,postMessage({workflow:S,type:"showPopupMenu",msg:a}),-1>>>0},this.GetPage=function(t,n){return r.TUEditorPage.Create(e.doc.pageIndexMap[n].page,100)},this.GetCurrentEditorPage=function(){var t=e.providerCallback.visibleIndexes[0];return r.TUEditorPage.Create(e.doc.pageIndexMap[t].page,100)},this.IsShiftKeyDown=function(){return e.shiftDown},this.IsControlKeyDown=function(){return e.controlDown}}return e.prototype.setCObject=function(e,t,n){this.providerCallback=n,this.operationNotifier=t,this.editPages={},this.doc=e},e.prototype.updateMatrix=function(e){var t=this;this.providerCallback.matrixes=e,this.providerCallback.visibleIndexes=e.visibleIndexes,this.lastEditorPage=r.TUEditorPage.Create(this.doc.doc.GetPage(e.visibleIndexes[0]),101),this.target&&(clearTimeout(this.updateTask),this.updateTask=setTimeout((function(){t.OnInvalid(null,[]),t.updateTask=null}),100))},e.prototype.handleFindReplaceEvent=function(e,t){var n=this;void 0===t&&(t=[]);var o=this.findReplace;if(o||(o=this.findReplace=this.jrMgr.GetFindReplace()),"AbortReplaceAll"!=e){if("ReplaceAll"==e)return g=!1,y=!1,this.doc.getPageCount().then((function(e){var i=0,a=[t[0],0,{type:"FindOption",value:4|3&t[1].value}],s=[t[2]],c=t[3]||0,d=0,l=Object(u.getJRArgs)(r,n,a,r.TUEditorPage),f=Object(u.getJRArgs)(r,n,s,r.TUEditorPage),h=function(t){if(l[1]=t,postMessage({workflow:S,type:"replaceAllProgress",msg:{pageIndex:d,total:e}}),y&&postMessage({workflow:S,type:"replaceAllProgress",msg:{pageIndex:-1}}),d>=e||y)return g=!0,i;i+=function(e,t,n){for(var r=0;;){if(!e.Find.apply(e,t))break;e.Replace.apply(e,n),r++}return r}(o,l,f),d++;var n=t+1;return n>=e&&(n=0),Object(u.nextTick)().then((function(){return h(n)}))};return h(c)}));var i=Object(u.getJRArgs)(r,this,t,r.TUEditorPage);return"Find"==e?this.doc.getPageByIndex(t[1]).then((function(e){return e.parsedPage()})).then((function(t){return o[e].apply(o,i)})):o[e].apply(o,i)}y=!0},e.prototype.triggerPopMenuAction=function(e){var t=this;this.popMenuAction=e,this.target.OnRButtonUp&&this.target.OnRButtonUp.apply(this.target,this.lastRButtonUpArgs),setTimeout((function(){t.OnInvalid(null,[],!0)}))},e.prototype.handleTouchUpEvent=function(e,t){var n=this;void 0===t&&(t=[]);var i=this.target;switch("OnKeyDown"==e&&(17==t[0]&&(this.controlDown=!0),16==t[0]&&(this.shiftDown=!0)),"OnKeyUp"==e&&(17==t[0]&&(this.controlDown=!1),16==t[0]&&(this.shiftDown=!1)),e){case"OnLButtonDown":var a=Object(u.getJRArgs)(r,this,t,r.TUEditorPage),s=i&&i.OnLButtonDown;return s&&s.apply(i,a);case"Undo":return void this.operationNotifier.Undo(t[0]);case"OnActivate":var c=t[0];if(i=this.targets[c])this.target=i;else{switch(c){case"touchup":i=this.target=this.targets[c]=this.jrMgr.GetTouchup();break;case"spellcheck":i=this.target=this.targets[c]=this.jrMgr.GetTouchupSpellCheck();break;case"joinSplit":i=this.target=this.targets[c]=this.jrMgr.GetJoinSplit()}setTimeout((function(){n.OnInvalid(null,[],!0)}))}t=[];break;case"OnChar":for(var d in t[0])this.target.OnChar(t[0].charCodeAt(d));return;case"OnRButtonUp":var l=Object(u.getJRArgs)(r,this,t,r.TUEditorPage);return this.lastRButtonUpArgs=l,void(this.target.OnRButtonUp&&this.target.OnRButtonUp.apply(this.target,l));case"GetEditInfo":return void(o=this.target.GetEditInfo());case"EditContent":return void this.target.EditContent(o);case"JoinSplitToEditText":var f=this.targets.joinSplit.GetEditInfo(),h=this.target=this.targets[c]=this.jrMgr.GetTouchup();return h.OnActivate(),void setTimeout((function(){n.OnInvalid(null,[],!0),f.editor_page.IsEmpty()||h.EditContent(f)}))}var p=Object(u.getJRArgs)(r,this,t,r.TUEditorPage),m=i&&i[e];return m&&m.apply(i,p)},e.prototype.destroy=function(){var e=this;for(var t in["tu","providerCallback","operationNotifier","lastInvalid","lastEditorPage","editPages","doc","jrMgr","popMenuAction"].forEach((function(t){return e[t]=[]})),this.targets){this.targets[t].delete()}},e.prototype.generateContent=function(){for(var e in this.editPages){this.editPages[e].GetPage().GenerateContent()}this.modifiedObjects.forEach((function(e){return e.GenerateContent()})),this.modifiedObjects=[]},e}(),A=function(e,t){if(t.touchup)return t.touchup;r=e,s.default.setGSDK(e);var n=t.touchup=new k,o=new P;o.IsShiftKeyDown=n.IsShiftKeyDown,o.IsControlKeyDown=n.IsControlKeyDown;var i=new e.TouchupProvider(e.TouchupProviderCallback.implement(o)),u=new m,c=new M(u);return u.Restore=c.Undo,c.OnContentChange=n.OnContentChange,c.OnInvalid=a()(n.OnInvalid,50),o.GetVisiblePage=n.GetVisiblePage,o.GetDefaultEditorPage=n.GetDefaultEditorPage,o.GetPage=n.GetPage,i.SetOperationNotifierCallback(e.TouchupOperationNotifierCallback.implement(c)),i.SetProgressBarCallback(e.ProgressBarCallback.implement(b)),p.trackPopupMenu=n.TrackPopupMenu,i.SetPopupMenuCallback(e.TouchupPopupMenuCallback.implement(p)),i.SetTextFormatCallback(e.TextFormatCallback.implement(new d)),i.SetFindReplaceCallback(e.FindReplaceCallback.implement(new T)),i.SetUndoCallback(e.UndoCallback.implement(u)),o.GetLatestPDFPage=function(e,n){return t.pageIndexMap[n].page},o.GetCurrentEditorPage=n.GetCurrentEditorPage,i.SetIsSpellCheckAvailable(!1),n.setJRMgr(t.touchupMgr=new e.TouchupMgr(i,t.doc)),t.addDestroyHook((function(e){t.touchupMgr.delete(),t.touchup.destroy(),t.touchupMgr=null,t.touchup=null,r=null})),t.beforeSave((function(e){return t.touchup.generateContent()})),n.setCObject(t,c,o),n}}])}));
282
+ e.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var r=100*e+t;return r<600?"凌晨":r<900?"早上":r<1130?"上午":r<1230?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n(0))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=p(n(642)),a=p(n(643)),s=p(n(127)),u=p(n(37)),c=n(22),d=p(n(176)),l=(n(3),p(n(644))),f=p(n(645)),h=p(n(646));function p(e){return e&&e.__esModule?e:{default:e}}function m(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var g=void 0,y=(Promise.resolve(),{1:{font:null,fontSize:16,charSpace:0,wordSpace:0,fontIsItalic:!1,fontIsBold:!1,fillColor:4278190080,strokeColor:4278190080,opacity:1},2:{strokeColor:4278190080,fillColor:4278190080,opacity:1}}),_=new h.default,v=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),g=t,this.doc=n,this.editPages={},this.oldEditPages={},this.scales={},this.lastUpdate=0,this.lastRButtonUpArgs=null,this.popMenuAction=null,this.clipBoardManager=new f.default(this,t),this.undoManager=new l.default(this,t),this.modifiedPage={},this.editingFontName="Helvetica"}return e.prototype.init=function(e){var t=this.scales.dpr||1;return e.SetSystemDPI(96*t,96*t),this.PE=new g.PageEditor(e),this},e.prototype.updateMatrix=function(e){Object.assign(this.scales,e)},e.prototype.handle=function(e,t){var n,r=this,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],d=(0,c.getJRArgs)(g,this,u,g.EditorPage),l={};switch(this.lastEditorPage&&(this.modifiedPage[this.lastEditorPage.GetPage().GetIndex()]=1),"OnKeyDown"==e&&(17==u[0]&&(this.controlDown=!0),16==u[0]&&(this.shiftDown=!0)),"OnKeyUp"==e&&(17==u[0]&&(this.controlDown=!1),16==u[0]&&(this.shiftDown=!1)),e){case"Undo":this.undoManager.undo(u[0],u[1]);break;case"Render":var f=d[0];if(f&&(this.lastEditorPage=f),!this.lastEditorPage)return{};var h=this.scales.uiRect,p=this.scales.dpr||1,v={width:h.width*p,height:h.height*p};return s.default.render((function(e){return r.PE.Render(e)}),this.lastEditorPage.GetPage(),v);case"OnChar":for(var b=0;b<u[0].length;b++){var S=u[0].charCodeAt(b);this.PE.OnChar(S,u[1]||0)}break;case"OnHitObjectTest":this.PE[e].apply(this.PE,d),d.push(0),this.PE.OnMouseMove.apply(this.PE,d);break;case"GetGraphicsObjectUtils":var w=this.PE.GetGraphicsObjectUtils();return(0,i.default)(g,w,this.PE);case"GetSelection":for(var M=this.PE.GetSelection(),D=[],P=0;P<M.GetSize();P++){M.GetAt(P);D.push({})}return D;case"GetGraphicsObjectEditor":var T=this.PE.GetGraphicsObjectEditor();return(0,a.default)(g,T);case"OnRButtonUp":this.lastRButtonUpArgs=d,this.PE.OnRButtonUp.apply(this.PE,d);break;case"Paste":2===u.length&&this.clipBoardManager.setPastePos(u[0],u[1]),this.PE.Paste(),l=this.lastEditorPage.GetPage().GetIndex();break;case"CreateImage":(l=(n=this.PE).CreateImage.apply(n,m(d)))&&(l=this.lastEditorPage.GetPage().GetIndex());break;case"getDefaultProperty":1===u[0]?((l=o({},y[u[0]])).fontName=_.getDefaultFontName(),delete l.font):l=y[u[0]]||{};break;case"StartEdit":d=[];default:l=this.PE[e].apply(this.PE,d);break;case"ChangeLanguage":this.strings=d[0]}return l},e.prototype.changePEProperty=function(e,t,n){var r=this.PE.GetGraphicsObjectUtils(),o=void 0;switch(n=Array.isArray(n)?n:[n],n=(0,c.getJRArgs)(g,this,n,g.EditorPage),this.lastEditorPage&&(this.modifiedPage[this.lastEditorPage.GetPage().GetIndex()]=1),e){case 0:o=r[t].apply(r,n);break;case 1:var i=new g.TextObjectUtils(r);switch(t){case"SetFont":var a=new g.WString(n[0]),s=n[1],u=n[2];this.undoManager.aggregateUndo(2),i.SetFont(a,s,u,g.FontOperationType.e_FontOperationTypeBold),o=i.SetFont(a,s,u,g.FontOperationType.e_FontOperationTypeItatic);break;default:o=i[t].apply(i,n)}break;case 2:var d=new g.PathObjectUtils(r);o=d[t].apply(d,n);break;case 3:o=r[t].apply(r,n);break;case 4:var l=new g.ShadingObjectUtils(r);if(n=(0,c.getJRArgs)(g,this,n,g.EditorPage),"RenderGridient"==t){l.SetGradientCurrentInfo(l.GetGradientColor());var f=n[0]+"-"+n[1],h=bitmaps[f]||(bitmaps[f]=new g.Bitmap(n[0],n[1],g.DIBFormat.e_DIBArgb,0,0));h.FillRect(4294967295,null);var p=new g.Renderer(h,!0);l.RenderGridient(p);var m=getBitmapBuffer(g,0,h,p);return m.left=0,m.top=0,m}o=l[t].apply(l,n)}var y=this.lastEditorPage.GetPage();return y.GenerateContent(),this.updateView(!0),[y.GetIndex(),o]},e.prototype.changeEditingProperty=function(e,t){var n=this.PE.GetGraphicsObjectEditor();if(this.lastEditorPage&&(this.modifiedPage[this.lastEditorPage.GetPage().GetIndex()]=1),"IsEmpty"===e)return n.IsEmpty();switch(n.GetType().value){case 2:n=new g.TextEditor(n),"OnWritingDirectionChanged"==e?t[0]=g.WritingDirection.values[t[0]]:"OnFontNameChanged"===e&&(this.editingFontName=t[0],t[0]=new g.WString(t[0]));break;case 3:break;case 4:n=new g.PathEditor(n);break;case 5:n=new g.ShadingEditor(n)}return n[e].apply(n,t)},e.prototype.triggerPopMenuAction=function(e){var t=this;this.popMenuAction=e,this.PE.OnRButtonUp.apply(this.PE,this.lastRButtonUpArgs),setTimeout((function(){t.updateView(!0)}))},e.prototype.updateView=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.scales&&!this.lastEditorPage.isDeleted()){var n=this.lastEditorPage.GetPage(),r=(n.GetIndex(),this.scales.uiRect),o=this.scales.dpr||1,i={width:r.width*o,height:r.height*o},a=s.default.render((function(t){return e.PE.Render(t)}),n,i);postMessage({workflow:"out",type:"updateView",msg:{bitmapInfo:a,redraw:t}})}},e.prototype.destroy=function(){var e=this;for(var t in this.editPages){this.editPages[t].delete()}for(var n in this.oldEditPages){this.oldEditPages[n].delete()}this.clipBoardManager.destroy(),this.undoManager.destroy(),_.destroy(),["doc","editPages","scales","updateType","lastUpdate","lastRButtonUpArgs","popMenuAction","clipBoardManager","editRedos","editUndos","undos","redos"].forEach((function(t){return e[t]=[]}))},e.prototype.generateContent=function(){for(var e in this.editPages){this.editPages[e].GetPage().GenerateContent()}},e.prototype.TrackPopupMenu=function(e,t,n,o){if(null!==this.popMenuAction){var s=this.popMenuAction;return this.popMenuAction=null,s}var u=this.PE.GetGraphicsObjectUtils(),c=this.PE.GetGraphicsObjectEditor(),d={},l=o.GetPage().GetIndex(),f=r(this.scales[l],4);f[0],f[1],f[2],f[3];d.activeObject=(0,i.default)(g,u,this.PE)||null,d.editingObject=(0,a.default)(g,c)||{};var h=this.scales.dpr||1;return d.position={x:t/h,y:n/h},d.menu=e,d.pageIndex=l,postMessage({workflow:"out",type:"showPopupMenu",msg:d}),-1>>>0},e.prototype.GetPageViewScale=function(e){var t=e.GetPage().GetIndex();return this.scales[t][0]},e.prototype.OnInvalid=function(e,t){this.updateView()},e.prototype.GetRenderMatrix=function(e){var t=new g.Matrix,n=e.GetPage();if(n.IsEmpty())return t;var o=this.scales[n.GetIndex()];if(!o)return t;var i=r(o,4),a=(i[0],i[1],i[2]);i[3];t.Set(a.a,a.b,a.c,a.d,0|a.e,0|a.f);var s=this.scales.dpr||1;return t.Scale(s,s,!1),t},e.prototype.GetPageVisibleRect=function(e){var t=e.GetPage(),n=this.scales[t.GetIndex()],o=new g.CFX_FloatRect;if(!n)return o;var i=r(n,4),a=(i[0],i[1],i[2],i[3]);return o.left=a.left,o.top=a.top,o.right=a.right,o.bottom=a.bottom,o},e.prototype.GetRect=function(e){var t=e.GetPage(),n=r(this.scales[t.GetIndex()],4),o=(n[0],n[1],n[2],n[3]),i=new g.CFX_FloatRect;return i.left=o.left,i.top=o.top,i.right=o.right,i.bottom=o.bottom,i},e.prototype.GetDefaultEditorPage=function(){if(!this.lastEditorPage){var e=this.scales.visibleIndexes[0];this.editPages[e]?this.lastEditorPage=this.editPages[e]:this.lastEditorPage=g.EditorPage.Create(this.doc.pageIndexMap[e].page,100)}return this.lastEditorPage},e.prototype.GetClientRect=function(){var e=this.scales.uiRect,t=this.scales.dpr||1,n=new g.CFX_FloatRect;return n.left=0,n.top=0,n.right=e.width*t,n.bottom=e.height*t,n},e.prototype.OnSetPropsAsDefault=function(e,t){var n=this.PE.GetGraphicsObjectUtils(),r=(0,i.default)(g,n,this.PE);if(1===e.value){var o=void 0;try{o=t.GetAt(0).GetGraphicsObject().GetTextObject().GetTextState(this.lastEditorPage.GetPage()).font}catch(e){o=new g.Font(g.StandardID.e_StdIDHelvetica)}_.setDefaultFont(o,this.doc.doc)}y[e.value]=r},e.prototype.OnExitEdit=function(e,t){var n=this;return setTimeout((function(){n.generateContent()})),postMessage({workflow:"out",type:"exitEdit",msg:t.value}),!1},e.prototype.GetTemplate=function(e,t){if(t){var n=g.getPEGraphic(t),r=n.GetType();if(r==g.GraphicsObjectType.e_TypeText){var o=n.GetTextObject(),i=y[1],a=new g.TextState;a.font=_.getDefaultFont(g),a.font_size=i.fontSize,a.charspace=i.charSpace,a.wordspace=i.wordSpace,a.textmode=g.Mode.e_ModeFill,a.origin_position.x=0,a.origin_position.y=0,a.SetMatrixA(1),a.SetMatrixB(0),a.SetMatrixC(0),a.SetMatrixD(1);var s=e.GetPage(),u=this.scales[s.GetIndex()][1]/90;switch(4-(s.GetRotation().value+u)%4){case 1:a.SetMatrixA(0),a.SetMatrixB(-1),a.SetMatrixC(1),a.SetMatrixD(0);break;case 2:a.SetMatrixA(-1),a.SetMatrixB(0),a.SetMatrixC(0),a.SetMatrixD(-1);break;case 3:a.SetMatrixA(0),a.SetMatrixB(1),a.SetMatrixC(-1),a.SetMatrixD(0)}o.SetTextState(e.GetPage(),a,i.fontIsItalic,i.fontIsBold?550:400),o.SetFillColor(i.fillColor),o.SetStrokeColor(i.strokeColor),o.SetFillOpacity(i.opacity),o.SetStrokeOpacity(i.opacity)}else if(r==g.GraphicsObjectType.e_TypePath){var c=n.GetPathObject(),d=y[2];d&&(c.SetStrokeState(0!==d.strokeColor),c.SetStrokeColor(d.strokeColor),c.SetFillColor(d.fillColor),c.SetFillOpacity(0==d.fillColor?0:1),c.SetStrokeOpacity(d.opacity))}}},e.prototype.GetLatestPDFPage=function(e,t){return this.doc.doc.GetPage(t)},e.prototype.GetToolbarFontName=function(){return new g.WString(this.editingFontName)},e.prototype.GetString=function(e){return new g.WString(this.strings[e.value]||"")},e.prototype.IsShiftKeyDown=function(){return this.shiftDown},e.prototype.IsControlKeyDown=function(){return this.controlDown},e}();t.default=function(e,t){if(e.pageEditor)return e.pageEditor;s.default.setGSDK(e.engine);var n=e.pageEditor=new v(e.engine,e),r=n.clipBoardManager,o=n.undoManager;g=e.engine;var i={};return["CopyGraphicObject","PasteGraphicObject","CanPasteGraphicObject"].forEach((function(e){return i[e]=r[e].bind(r)})),["OnAddUndo","OnUndoRedoBeginEdit","OnUndoRedoEndEdit"].forEach((function(e){return i[e]=o[e].bind(o)})),["GetDefaultEditorPage","GetRenderMatrix","GetClientRect","GetPageVisibleRect","GetPageViewScale","OnInvalid","TrackPopupMenu","OnSetPropsAsDefault","GetTemplate","GetLatestPDFPage","GetToolbarFontName","GetString","OnExitEdit","IsShiftKeyDown","IsControlKeyDown"].forEach((function(e){return i[e]=n[e].bind(n)})),i.GetPageRect=n.GetPageVisibleRect.bind(n),i.OnInvalid=(0,d.default)(n.OnInvalid.bind(n)),n.init(e.JR.getEditorContext(i,t.map((function(t){var n=e.JR.requestData("GET",!1,t);return u.default.createImage(e.engine,n).GetFrameBitmap(0)})))),e.beforeSave((function(t){e.pageEditor.PE.EndEdit(),e.pageEditor.generateContent()})),e.addDestroyHook((function(t){return e.pageEditor.destroy()})),n}},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";var r=n(26);function o(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(r.isURLSearchParams(t))i=t.toString();else{var a=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),a.push(o(t)+"="+o(e))})))})),i=a.join("&")}if(i){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,n){"use strict";var r=n(26),o=n(655),i=n(656),a=n(366),s=n(657),u=n(660),c=n(661),d=n(369);e.exports=function(e){return new Promise((function(t,n){var l=e.data,f=e.headers,h=e.responseType;r.isFormData(l)&&delete f["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var m=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";f.Authorization="Basic "+btoa(m+":"+g)}var y=s(e.baseURL,e.url);function _(){if(p){var r="getAllResponseHeaders"in p?u(p.getAllResponseHeaders()):null,i={data:h&&"text"!==h&&"json"!==h?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:r,config:e,request:p};o(t,n,i),p=null}}if(p.open(e.method.toUpperCase(),a(y,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,"onloadend"in p?p.onloadend=_:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(_)},p.onabort=function(){p&&(n(d("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){n(d("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(d(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",p)),p=null},r.isStandardBrowserEnv()){var v=(e.withCredentials||c(y))&&e.xsrfCookieName?i.read(e.xsrfCookieName):void 0;v&&(f[e.xsrfHeaderName]=v)}"setRequestHeader"in p&&r.forEach(f,(function(e,t){void 0===l&&"content-type"===t.toLowerCase()?delete f[t]:p.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),h&&"json"!==h&&(p.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),n(e),p=null)})),l||(l=null),p.send(l)}))}},function(e,t,n){"use strict";var r=n(367);e.exports=function(e,t,n,o,i){var a=new Error(e);return r(a,t,n,o,i)}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";var r=n(26);e.exports=function(e,t){t=t||{};var n={},o=["url","method","data"],i=["headers","auth","proxy","params"],a=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],s=["validateStatus"];function u(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function c(o){r.isUndefined(t[o])?r.isUndefined(e[o])||(n[o]=u(void 0,e[o])):n[o]=u(e[o],t[o])}r.forEach(o,(function(e){r.isUndefined(t[e])||(n[e]=u(void 0,t[e]))})),r.forEach(i,c),r.forEach(a,(function(o){r.isUndefined(t[o])?r.isUndefined(e[o])||(n[o]=u(void 0,e[o])):n[o]=u(void 0,t[o])})),r.forEach(s,(function(r){r in t?n[r]=u(e[r],t[r]):r in e&&(n[r]=u(void 0,e[r]))}));var d=o.concat(i).concat(a).concat(s),l=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===d.indexOf(e)}));return r.forEach(l,c),n}},function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setCustomWatermarkFontMap=t.setCustomFontMap=t.getCharRange=t.prefetchCache=t.getCharsetFromName=t.getGlyphMatch=t.getWatermarkFontFilesPos=t.getWatermarkFontFileBuffer=t.getThirdPartyFontBuffer=void 0;var r=a(n(165)),o=a(n(671)),i=a(n(107));function a(e){return e&&e.__esModule?e:{default:e}}var s=new i.default("fontLib","FoxitPDFSDKForWeb_fontLib"),u=[];u=u.concat(u,[{nameMatches:[/verdana/,/franklingothic/,/segoeui/,/sylfaen/,/tahoma/,/couriernew/,/lucidasansunicode/,/calibri/,/cambria/,/candara/,/comicsansms/,/consolas/,/constantia/,/corbel/,/gabriola/,/georgia/,/impact/,/lucidaconsole/,/microsoftsansserif/,/msrefrencesansserif/,/palatinolinotype/,/segoeprint/,/segoescript/,/trebuchetms/,/notosansbold/],charsets:[0,204,238],charRange:/[\u0000-\u00ff]/,glyphs:[{bold:-1,flags:64,url:"NotoSans-BoldItalic.ttf"},{bold:496,flags:-1,url:"NotoSans-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSans-Regular.ttf"}]},{nameMatches:[/(stsonglight)/,/(notosanstclight)/],charsets:[134],charRange:/[\u0000-\u007f\uB0A1-\uF7FE\u8140-\uA0FE\uAA40-\uFEA0\uA996\uA1A1-\uA9FE\uA840-\uA9A0\uAAA1-\uAFFE\uF8A1-\uFEFE\uA140-\uA7A0\u2E80-\u303F\u31C0-\u4DBF\u4E00-\u9FBF\uFF00-\uFFEF]/,glyphs:[{bold:7,flags:-1,url:"NotoSansTCLight.ttf"}]},{nameMatches:[/(youyuan)|(simhei)|(simsun)|(song)|(仿宋)|(黑体)|(宋体)/,/(notosansmonocjksc)/],charsets:[134],charRange:/[\u0000-\u007f\u8140-\uA0FE\uA996\uA1A1-\uA9FE\uA840-\uA9A0\uF8A1-\uFEFE\uA140-\uA7A0\u200F-\u2027\u2E80-\u303F\u31C0-\u4DBF\u4E00-\u9FBF\uFF00-\uFFEF]/,glyphs:[{bold:-1,flags:-1,url:"NotoSansMonoCJKsc-Regular.otf"}]},{nameMatches:[/(simhei)|(simsun)|(simsunextb)|(kaiti)|(方正)|(仿宋)|(黑体)|(华文)|(楷体)|(隶书)|(宋体)|(微软雅黑)|(新宋体)|(幼圆)/,/(notosanssc)|(notosanscjksc)/],charsets:[134],charRange:/[\u0000-\u007f\u8140-\uA0FE\uA996\uA1A1-\uA9FE\uA840-\uA9A0\uF8A1-\uFEFE\uA140-\uA7A0\u200F-\u2027\u2E80-\u303F\u31C0-\u4DBF\u4E00-\u9FBF\uFF00-\uFFEF]/,glyphs:[{bold:-1,flags:1,url:"NotoSansMonoCJKsc-Regular.otf"},{bold:1,flags:-1,url:"NotoSansSC-Thin.otf"},{bold:2,flags:-1,url:"NotoSansSC-Light.otf"},{bold:4,flags:-1,url:"NotoSansSC-DemiLight.otf"},{bold:48,flags:-1,url:"NotoSansSC-Medium.otf"},{bold:129,flags:-1,url:"NotoSansSC-Bold.otf"},{bold:256,flags:-1,url:"NotoSansSC-Black.otf"},{bold:-1,flags:-1,url:"NotoSansSC-Regular.otf"}]},{nameMatches:[/(meiryo)|(meiryoui)|(msgothic)|(msmincho)|(mspgothic)|(mspmincho)|(uigothic)/,/(notosanscjkjp)|(notosansmonocjkjp)/],charsets:[128],charRange:/[\u0000-\u007f\u2E80-\u4DBF\u4E00-\u9FBF\uF900-\uFAFF\uFE30-\uFE4F]/,glyphs:[{bold:-1,flags:1,url:"NotoSansMonoCJKjp-Regular.otf"},{bold:1,flags:-1,url:"NotoSansCJKjp-Thin.otf"},{bold:2,flags:-1,url:"NotoSansCJKjp-Light.otf"},{bold:4,flags:-1,url:"NotoSansCJKjp-DemiLight.otf"},{bold:496,flags:-1,url:"NotoSansCJKjp-Medium.otf"},{bold:-1,flags:-1,url:"NotoSansCJKjp-Regular.otf"}]},{nameMatches:[/(korean)/,/(notosanscjkkr)|(notosansmonocjkkr)/],charsets:[129],charRange:/[\u0000-\u007f\u1100-\u11FF\u3130-\u318F\uAC00-\uD7AF\uFF00-\uFFEF\u2E80-\u303F\u31C0-\u4DBF\u4E00-\u9FBF\uF900-\uFAFF\uFE30-\uFE4F]/,glyphs:[{bold:-1,flags:1,url:"NotoSansMonoCJKkr-Regular.otf"},{bold:1,flags:-1,url:"NotoSansCJKkr-Thin.otf"},{bold:2,flags:-1,url:"NotoSansCJKkr-Light.otf"},{bold:4,flags:-1,url:"NotoSansCJKkr-DemiLight.otf"},{bold:496,flags:-1,url:"NotoSansCJKkr-Medium.otf"},{bold:-1,flags:-1,url:"NotoSansCJKkr-Regular.otf"}]},{nameMatches:[/(dfkaisb)|(microsoftjhenghei)|(mingliu)|(mingliuhkscs)|(mingliuhkscsextb)|(mingliuextb)|(pmingliu)|(pmingliuextb)/,/(notosanscjktcdemilight)|(notosanscjktclight)|(notosanscjktcmedium)|(notosanscjktcthin)|(notosansmonocjktcregular)/],charsets:[136],charRange:/[\u4E00-\uA0FE\uA140-\uA3BF\uA259-\uA261\uA3C0-\uA3FE\u2E80-\u303F\u31C0-\u4DBF\uFF00-\uFFEF]/,glyphs:[{bold:-1,flags:1,url:"NotoSansMonoCJKtc-Regular.otf"},{bold:1,flags:-1,url:"NotoSansCJKtc-Thin.otf"},{bold:2,flags:-1,url:"NotoSansCJKtc-Light.otf"},{bold:4,flags:-1,url:"NotoSansCJKtc-DemiLight.otf"},{bold:496,flags:-1,url:"NotoSansCJKtc-Medium.otf"},{bold:-1,flags:-1,url:"NotoSansMonoCJKtc-Regular.otf"}]},{nameMatches:[/(arabic)|(andalus)|(arabictypesetting)|(sakkalmajalla)|(simplifiedarabic)|(simplifiedarabicfixed)|(traditionalarabic)/,/(notonaskharabicbold)|(notonaskharabic)/],charsets:[178],charRange:/[\u0000-\u007f\u0600-\u06FF\u0750-\u077F\uFB50-\uFDFF\uFE70-\uFEFF]/,glyphs:[{bold:496,flags:-1,url:"NotoNaskhArabic-Bold.ttf"},{bold:-1,flags:-1,url:"NotoNaskhArabic-Regular.ttf"}]},{nameMatches:[/(angsananew)|(angsanaupc)|(browallianew)|(browalliaupc)|(cordianew)|(cordiaupc)|(eucrosiaupc)|(freesiaupc)|(irisupc)|(jasmineupc)|(kodchiangupc)|(leelawadee)|(lilyupc)|(thonburi)/,/(notosansthaibold)|(notosansthai)|(notoserifthaibold)|(notoserifthai)/],charsets:[222],charRange:/[\u0E00-\u0E7F]/,glyphs:[{bold:496,flags:2,url:"NotoSerifThai-Bold.ttf"},{bold:-1,flags:2,url:"NotoSerifThai-Regular.ttf"},{bold:496,flags:-1,url:"NotoSansThai-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansThai-Regular.ttf"}]},{nameMatches:[/(aharoni)|(david)|(frankruehl)|(gisha)|(levenimmt)|(miriam)|(narkism)|(rod)/,/(notosanshebrewbold)|(notosanshebrew)/],charsets:[177],charRange:/[\u0590-\u05FF]/,glyphs:[{bold:496,flags:-1,url:"NotoSansHebrew-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansHebrew-Regular.ttf"}]},{nameMatches:[/(daunpenh)|(khmer)|(moolboran)/,/(notosanskhmerbold)|(notosanskhmer)|(notoserifkhmerbold)|(notoserifkhmer)/],charsets:[1],charRange:/[\u1780-\u17FF\u19E0-\u19FF]/,glyphs:[{bold:496,flags:2,url:"NotoSerifKhmer-Bold.ttf"},{bold:-1,flags:2,url:"NotoSerifKhmer-Regular.ttf"},{bold:496,flags:-1,url:"NotoSansKhmer-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansKhmer-Regular.ttf"}]},{nameMatches:[/(dokchampa)|(lao)/,/(notosanslaobold)|(notosanslao)|(notoseriflaobold)|(notoseriflao)/],charsets:[1],charRange:/[\u0E80-\u0EFF]/,glyphs:[{bold:496,flags:2,url:"NotoSerifLao-Bold.ttf"},{bold:-1,flags:2,url:"NotoSerifLao-Regular.ttf"},{bold:496,flags:-1,url:"NotoSansLao-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansLao-Regular.ttf"}]},{nameMatches:[/(vani)|(gautami)/,/(notosanstelugubold)|(notosanstelugu)/],charsets:[1],charRange:/[\u0C00-\u0C7F]/,glyphs:[{bold:496,flags:-1,url:"NotoSansTelugu-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansTelugu-Regular.ttf"}]},{nameMatches:[/(latha)|(vijaya)/,/(notosanstamilbold)|(notosanstamil)/],charsets:[1],charRange:/[\u0C00-\u0C7F]/,glyphs:[{bold:496,flags:-1,url:"NotoSansTamil-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansTamil-Regular.ttf"}]},{nameMatches:[/(moboli)|(mvboli)/,/(notosansthaanabold)|(notosansthaana)/],charsets:[1],charRange:/[\u0780-\u07BF]/,glyphs:[{bold:496,flags:-1,url:"NotoSansThaana-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansThaana-Regular.ttf"}]},{nameMatches:[/(taile)|(microsofttaile)/,/(notosanstaile)/],charsets:[1],charRange:/[\u1950-\u197F]/,glyphs:[{bold:-1,flags:-1,url:"NotoSansTaiLe-Regular.ttf"}]},{nameMatches:[/(estrangeloedessa)/,/(notosanssyriaceastern)/],charsets:[1],charRange:/[\u0700-\u074F]/,glyphs:[{bold:-1,flags:-1,url:"NotoSansSyriacEastern-Regular.ttf"}]},{nameMatches:[/(iskoolapota)/,/(notosanssinhalabold)|(notosanssinhala)/],charsets:[1],charRange:/[\u0D80-\u0DFF]/,glyphs:[{bold:496,flags:-1,url:"NotoSansSinhala-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansSinhala-Regular.ttf"}]},{nameMatches:[/(himalaya)|(microsofthimalaya)/,/(notosanstibetanbold)|(notosanstibetan)/],charsets:[1],charRange:/[\u0F00-\u0FFF]/,glyphs:[{bold:496,flags:-1,url:"NotoSansTibetan-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansTibetan-Regular.ttf"}]},{nameMatches:[/(phagspa)|(microsoftphagspa)/,/(notosansphagspa)/],charsets:[1],charRange:/[\uA840-\uA87F]/,glyphs:[{bold:-1,flags:-1,url:"NotoSansPhagsPa-Regular.ttf"}]},{nameMatches:[/(euphemia)|(gadugi)/,/(notosanscanadianaboriginal)/],charsets:[1],charRange:/[\u1400-\u167F\u18B0-\u18FF]/,glyphs:[{bold:-1,flags:-1,url:"NotoSansCanadianAboriginal-Regular.ttf"}]},{nameMatches:[/(plantagenetcherokee)|(notosanscherokee)/],charsets:[1],charRange:/[\u13A0-\u13FF]/,glyphs:[{bold:-1,flags:-1,url:"NotoSansCherokee-Regular.ttf"}]},{nameMatches:[/(nyala)|(ebrima)|(notosansethiopicbold)|(notosansethiopic)/],charsets:[1],charRange:/[\u1200-\u139F\u2D80-\u2DDF\uAB00-\uAB5F]/,glyphs:[{bold:496,flags:-1,url:"NotoSansEthiopic-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansEthiopic-Regular.ttf"}]},{nameMatches:[/(shruti)|(notosansgujaratibold)|(notosansgujarati)/],charsets:[1],charRange:/[\u0A80-\u0AFF]/,glyphs:[{bold:496,flags:-1,url:"NotoSansGujarati-Bold.ttf"},{bold:-1,flags:-1,url:"NotoSansGujarati-Regular.ttf"}]},{nameMatches:[/(mongolian)|(mongolianbaiti)|(notosansmongolian)/],charsets:[1],charRange:/[\u1800-\u18AF]/,glyphs:[{bold:-1,flags:-1,url:"NotoSansMongolian-Regular.ttf"}]},{nameMatches:[/(nirmalaui)|(notosansgujarati)/],charsets:[1],charRange:/[\u0A80-\u0E7F]/,glyphs:[{bold:-1,flags:-1,url:"NotoNirmalaui-Regular.ttf"}]},{nameMatches:[/(microsoftyibati)|(yi\b)|(notosansyi)/],charsets:[1],charRange:/[]/,glyphs:[{bold:-1,flags:-1,url:"NotoSansYi-Regular.ttf"}]},{nameMatches:[/notosans/],charsets:[0,204,238],charRange:/[\u0000-\u00ff]/,glyphs:[{bold:-1,flags:-1,url:"NotoSans-Regular.ttf"}]}]);var c=[],d=[],l={extralight:100,light:200,normal:300,regular:400,medium:500,bold:700,heavy:900,black:900,thin:100},f={},h={},p={},m={},g={};function y(e,t,n,r,o){if(e){var i=function(e,t,n,r,o){return[e,t,n,r,o].join("-")}(e,t,n,r,o),a=f[i];if(a)return[a,h[i],p[i]];(n=function(e,t,n){return t||64&n||/(italic)|(oblique)/.test(e.toLowerCase())}(e,n,o))&&(o|=64);for(var s=function(e){return 1<<e%100-1}(function(e,t){for(var n in e=e.toLowerCase(),l)if(e.indexOf(n))return l[n];return l[t]||(t%100?t:t>400?700:400)}(e,r)),c=e,m=0,g=d.length;m<g;m++){var y=d[m];if(v(c,y))for(var b=y.glyphs||[],S=0,w=b.length;S<w;S++){var M=b[S],D=M.bold||-1,P=M.flags||-1;if(s&D&&(-1===P||(o&P)===P))return f[i]=M,h[i]=y,p[i]=1,[M,y,1]}}c=_(e=e.toLowerCase());for(var T=0,k=u.length;T<k;T++){var A=u[T];if(v(c,A))for(var L=A.glyphs||[],F=0,I=L.length;F<I;F++){var x=L[F],C=x.bold||-1,R=x.flags||-1;if(s&C&&(-1===R||(o&R)===R))return f[i]=x,h[i]=A,[x,A]}}if(t>1){for(var O=0,G=d.length;O<G;O++){var E=d[O];if(E.charsets&&-1!==E.charsets.indexOf(t))for(var Y=E.glyphs||[],j=0,N=Y.length;j<N;j++){var B=Y[j],H=B.bold||-1,W=B.flags||-1;if(s&H&&(-1===W||(o&W)===W))return f[i]=B,h[i]=E,p[i]=1,[B,E,1]}}for(var U=0,z=u.length;U<z;U++){var J=u[U];if(-1!==J.charsets.indexOf(t))for(var V=J.glyphs||[],K=0,q=V.length;K<q;K++){var Z=V[K],X=Z.bold||-1,Q=Z.flags||-1;if(s&X&&(-1===Q||(o&Q)===Q))return f[i]=Z,h[i]=J,[Z,J]}}}}}function _(e){return e.replace(/,/g,"").replace(/-/g,"").replace(/\s/g,"").toLowerCase()}function v(e,t){for(var n=t.nameMatches||[],r=0,o=n.length;r<o;r++)if(new RegExp(n[r]).test(e))return!0;return!1}function b(e,t){var n;if(n=m[e])return n;var o=new XMLHttpRequest;o.open("get",e,!1),o.responseType="arraybuffer",o.send();var i=o.status,a=o.response;return i>=200&&i<300||304===i&&a instanceof ArrayBuffer?(t&&(a=(0,r.default)(new Uint8Array(a))),s.set(e,a).then((function(){s.get("fontName").then((function(t){(t=t||{})[e]=1,s.set("fontName",t).catch((function(){}))}))}),(function(){})),m[e]=a):null}t.getThirdPartyFontBuffer=function(e,t,n,i,a,u){var c=y(t,n,i,a,u);if(!c)return null;var d=c[0],l=d.url;return c[2]?b(l,d.isBrotli):function(e,t){var n=void 0;if(n=m[t])return n;var i=e+"/"+t+".brotli?h="+o.default[t];if(n=g[i])return n;var a=new XMLHttpRequest;a.open("get",i,!1),a.responseType="arraybuffer",a.send();var u=a.status,c=a.response;return u>=200&&u<300||304===u&&c instanceof ArrayBuffer?(c=(0,r.default)(new Uint8Array(c)),s.set(i,c).then((function(){s.get("fontName").then((function(e){(e=e||{})[i]=1,s.set("fontName",e).catch((function(){}))}),(function(){}))}),(function(){})),m[t]=c):null}(e,l)},t.getWatermarkFontFileBuffer=function(e){var t=c[e-1];return t?b(t.url,t.isBrotli):null},t.getWatermarkFontFilesPos=function(e){return 0===c.length?0:(e+1)%(c.length+1)},t.getGlyphMatch=y,t.getCharsetFromName=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t&&(e=_(e));for(var n=[],r=0,o=(n=n.concat(d).concat(u)).length;r<o;r++){var i=n[r];if(v(e,i)){var a=i.charsets||[0];return a[0]}}return-1},t.prefetchCache=function(){s.get("fontName").then((function(e){if(e)for(var t=Object.keys(e),n=t.length;n--;)!function(e){s.get(e).then((function(t){t&&(g[e]=t)}),(function(){}))}(t[n])}),(function(){}))},t.getCharRange=function(e,t,n,r,o){var i=y(e,t,n,r,o);if(i)return i[1].charRange},t.setCustomFontMap=function(e){e&&(d=e)},t.setCustomWatermarkFontMap=function(e){e&&(c=e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAA=void 0;var r,o=n(3),i=n(38),a=(r=i)&&r.__esModule?r:{default:r};t.getAA=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:7,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:17,s=e.engine,u={},c=n.GetElement((0,o.CString)(s,"AA"));if(c&&c.GetDict()){for(var d=c.GetDict(),l=new s.AdditionalAction(t,d),f=s.TriggerEvent,h=r;h<i;h++){var p=l.GetAction(f.values[h]);p.IsEmpty()||(u[h]=e.actionManager.get(p,t,e).toJson())}(0,a.default)(l)}return u}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.getArrayBufferFrom=function(e,t,n){var r=e.HEAPU8.buffer;return r.slice?r.slice(t,t+n):new Uint8Array(r,t,n).buffer}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(87);function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function a(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var s=function(e){function t(n,r,o,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(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}(this,e.call(this,n,r,o,i));if(a.matrix=n.GetMatrix(),!a.isParentPage()){var s=a.parent.getMatrix();a.matrix.Concat(s,!1)}return a.graphicsObject=n.GetFormXObject(),a}return a(t,e),t.prototype.getMatrix=function(){return this.matrix},t.prototype.getGraphicsObjectsInRect=function(e,t,n){for(var r=this.graphicsObject.GetGraphicsObjects(),o=this.engine.GraphicsObjectType.e_TypeAll,a=[],s=r.GetFirstGraphicsObjectPosition(o);s;){var u=r.GetGraphicsObject(s),c=u.GetRect();if(this.matrix.TransformRect(c),e.Contains(c)){var d=n.get(u,this.c_page,this),l=d.getType();if(t!=l&&0!=t&&5!=l);else{if(0==t&&targetType<4)a.push(element);else if(0==t&&targetType>3)continue;l===t?a.push(d):5===l&&a.push.apply(a,i(d.getGraphicsObjectsInRect(e,t,n)))}}s=r.GetNextGraphicsObjectPosition(s,o)}return a},t.prototype.getGraphicsObjectAtPoint=function(e,t,n,r){for(var o=this.graphicsObject.GetGraphicsObjects(),i=this.engine.GraphicsObjectType.e_TypeAll,a=o.GetFirstGraphicsObjectPosition(i);a;){var s=o.GetGraphicsObject(a),u=s.GetRect();if(this.matrix.TransformRect(u),u.Contains(e,t)){var c=r.get(s,this.c_page,this),d=s.GetType().value;if(d===n)return c;if(5===d)return c.getGraphicsObjectAtPoint(e,t,n,r)}a=o.GetNextGraphicsObjectPosition(a,i)}return null},t.prototype.getGraphicsObjectsAtPoint=function(e,t,n,r,o){for(var i=[],a=this.graphicsObject.GetGraphicsObjects(),s=this.engine.GraphicsObjectType.e_TypeAll,u=a.GetFirstGraphicsObjectPosition(s);u;){var c=a.GetGraphicsObject(u),d=c.GetRect();if(this.matrix.TransformRect(d),d.Contains(e,t)){var l=o.get(c,this.c_page,this),f=c.GetType().value;5===f?i=i.concat(l.getGraphicsObjectsAtPoint(e,t,n,r,o)):f!==n&&0!=n||i.push(l)}u=a.GetNextGraphicsObjectPosition(u,s)}return i},t.prototype.toJson=function(){return null},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=s},function(e,t,n){"use strict";e.exports={wasmHash:"3b082388733851af09586f37d4760285",jsHash:"f727ab0236a725d959b047a622f20b77",asmMemHash:"4e0e29b0927516e7f4fd38eb4bae6ee6",asmJSHash:"2ad01594f11946b067008cd931dcc870"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=function(){return i};var o=navigator.userAgent.toLowerCase(),i=!1,a=o.indexOf("safari")>-1&&-1==o.indexOf("chrome");i=!(!(i=!(a&&parseFloat(o.match(/ applewebkit\/(\d+)/)[1])<607))||"object"!=("undefined"==typeof WebAssembly?"undefined":r(WebAssembly)))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=i(n(721)),o=(i(n(380)),i(n(168)),n(167));function i(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 s(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 u(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var c=function(e){function t(n,r,i,u,c,d){if(a(this,t),0==arguments.length){var l=s(this,e.call(this,o.Action_Type.javaScript));return s(l)}return(l=s(this,e.call(this,n,r,i,u,c,d))).info.script&&(l.info.javascript=l.info.script),s(l)}return u(t,e),t.prototype.getScript=function(){return this.info.javascript},t.prototype.checkOutData=function(e){return e&&e.javascript},t.prototype.setScript=function(e){var t=this;return this.doc?this.doc.api.setActionScript(this.doc.getId(),this.info.objNumber,e).then((function(e){return t.updateAction(e),e})):(this.info.javascript=e,Promise.resolve())},t.prototype.exportToJson=function(){var t=e.prototype.exportToJson.call(this);return Object.assign(t,{script:this.getScript()})},t}(r.default);t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(20),o=n(106),i=(d(n(722)),d(n(168))),a=n(223),s=d(n(723)),u=d(n(724)),c=d(n(381));d(n(725));function d(e){return e&&e.__esModule?e:{default:e}}var l=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._isEmpty=!t,this.info=t||{},this.page=n,this.api=n.api;var r=this.engine=n.engine;this.eventEmitter=r.eventEmitter,this.id=t.id,this.objectNumber=t.objectNumber,this.isDestroyed=!1}return e.prototype.destroy=function(){this.isDestroyed=!0,this.info=null,this.page=null,this.api=null,this.eventEmitter=null},e.prototype.checkModidyPerm=function(){if("widget"!=this.info.type){if(!this.page.doc.checkPermission(u.default.annotForm))throw new Error("Permission error")}else if(!this.page.doc.checkPermission(u.default.fillForm|u.default.annotForm))throw new Error("Permission error")},e.prototype.hasModifyPermission=function(){return"widget"==this.info.type?this.page.doc.checkPermission(u.default.fillForm|u.default.annotForm):this.page.doc.checkPermission(u.default.annotForm)},e.prototype.isEmpty=function(){return this._isEmpty},e.prototype.getInfo=function(){return this.info},e.prototype.getId=function(){return this.info.objectNumber},e.prototype.getObjectNumber=function(){return this.info.objectNumber},e.prototype.getUniqueID=function(){return this.info.name},e.prototype.setUniqueID=function(e){var t=this,n=this.getPDFPage(),r=n.getPDFDoc(),o=this.getUniqueID();return this.page.doc.api.setUniqueId(r.getId(),n.getId(),this.getId(),e).then((function(r){return r?(t.info.name=e,t.update(c.default.uniqueIDUpdated).then((function(){return t.eventEmitter.emit(i.default.annotationIDUpdated,e,o,t,n),r}))):r}))},e.prototype.getName=function(){return this.info.name},e.prototype.getPDFPage=function(){return this.page},e.prototype.getPage=function(){return this.getPDFPage()},e.prototype.getType=function(){return this.info.type},e.prototype.getTitle=function(){return this.info.title},e.prototype.isMarkup=function(){return this.info.isMarkup},e.prototype.isDeleted=function(){return this.info.isDeleted},e.prototype.getRect=function(){var e=this.info.rect;return new s.default(e.left,e.bottom,e.right,e.top)},e.prototype._setRect=function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.info.rect=e;var r=this.getPDFPage(),o=r.getPDFDoc();return this.page.doc.api.setAnnotRect(o.getId(),r.getId(),this.getId(),e).then((function(e){return e?t.update(c.default.rectUpdated,n).then((function(){return t.eventEmitter.emit(i.default.annotationAppearanceUpdated,[t],t.getPDFPage()),e})):e}))},e.prototype.setRect=function(e){var t=this;this.info.rect=e;var n=this.getPDFPage(),r=n.getPDFDoc();return this.page.doc.api.setAnnotRect(r.getId(),n.getId(),this.getId(),e).then((function(e){return e?t.update(c.default.rectUpdated).then((function(e){return t.eventEmitter.emit(i.default.annotationAppearanceUpdated,[t],t.getPDFPage()),!0})):e}))},e.prototype.setRectAndInnerRect=function(e,t){var n=this;this.info.rect=e,this.info.innerRect=t;var r=this.getPDFPage(),o=r.getPDFDoc();return this.page.doc.api.setAnnotRectAndInnerRect(o.getId(),r.getId(),this.getId(),e,t).then((function(e){return e?n.update(c.default.rectUpdated).then((function(e){return n.eventEmitter.emit(i.default.annotationAppearanceUpdated,[n],n.getPDFPage()),!0})):e}))},e.prototype.moveTo=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.left,r=t.top,o=t.action,a=t.triggerAction,s=void 0===a||a,u=Object.assign({},this.info.rect),d=u.right,l=u.bottom,f=n-u.left,h=r-u.top;this.info.rect={left:n,top:r,right:d+f,bottom:l+h};var p=this.getPDFPage(),m=p.getPDFDoc(),g=m.getId(),y=p.getId(),_=this.getId();return this.page.doc.api.moveAnnotTo(g,y,_,{left:n,top:r}).then((function(e){return p.getAnnotsByObjectNumArray(e)})).then((function(t){return Promise.all(t.map((function(e){return e._update()}))).then((function(n){s&&e.eventEmitter.emit(i.default.annotationUpdated,t,p,c.default.rectUpdated),"move"==o&&e.eventEmitter.emit(i.default.annotationMovedPosition,t,p,e)}))}))},e.prototype.getDeviceRect=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.page.getDeviceRect(this.getRect(),e,t);if(16&this.info.flag){var r=this.page.getDevicePoint([this.info.rect.left,this.info.rect.top],e,t);return{left:r[0],top:r[1],right:r[0]+n.right-n.left,bottom:r[1]+n.bottom-n.top}}return n},e.prototype.getDeviceInnerRect=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.page.getDeviceRect(this.getInnerRect(),e,t)},e.prototype.getContent=function(){return this.info.content},e.prototype.setContent=function(e){var t=this;return this.checkModidyPerm(),this._setContent(e).then((function(n){return t.info.content=e,t.eventEmitter.emit(i.default.annotationUpdated,[t],t.getPDFPage(),c.default.contentUpdated),t}))},e.prototype._setContent=function(e){var t=this.getPDFPage(),n=t.getPDFDoc();return this.page.doc.api.setAnnotContent(n.getId(),t.getId(),this.getId(),e)},e.prototype.getBorderColor=function(){return this.info.borderColor},e.prototype.setBorderColor=function(e){var t=this;this.checkModidyPerm(),isNaN(e)&&(e=(0,a.colorConvertor)(e,"int",1));var n=this.getPDFPage(),r=n.getPDFDoc();return this.page.doc.api.setAnnotBorderColor(r.getId(),n.getId(),this.getId(),e).then((function(r){return r?(0===e&&(t.info.hasBorderColor=!1),t.update(c.default.borderColorUpdated).then((function(){t.isGrouped&&t.isGrouped()&&t.getGroupElements().map((function(e){e!=t&&t.eventEmitter.emit(i.default.annotationAppearanceUpdated,[e],n)}));return t.eventEmitter.emit(i.default.annotationAppearanceUpdated,[t],n),r}))):r}))},e.prototype.getBorderStyle=function(){return this.info.borderInfo.style},e.prototype.getBorderStyleWithParam=function(){var e=this.info.borderInfo,t=e.style,n=e.cloudIntensity,o=e.dashes,i=void 0;switch(t){case r.BORDER_STYLE.SOLID:i=[];break;case r.BORDER_STYLE.CLOUDY:i=n;break;case r.BORDER_STYLE.DASHED:i=o}return{style:t,param:i}},e.prototype.getBorderInfo=function(){return Object.assign({},this.info.borderInfo)},e.prototype.setBorderInfo=function(e){var t=this;this.checkModidyPerm();var n=this.getType();if(this.getQuadPoints||"caret"===n||"text"===n)return Promise.resolve();var r=JSON.parse(JSON.stringify(this.info.borderInfo||{}));e=this.info.borderInfo=Object.assign(r,e);var o=this.getPDFPage(),a=o.getPDFDoc();return 1===e.style&&0===e.dashes.length&&(e.dashes=[2,2]),5===e.style&&e.cloudIntensity>2&&(e.cloudIntensity=2),this.page.doc.api.setAnnotBorderInfo(a.getId(),o.getId(),this.getId(),e).then((function(e){if(5===t.info.borderInfo.style)return t._update()})).then((function(e){return t.eventEmitter.emit(i.default.annotationUpdated,[t],o,c.default.borderInfoUpdated),t.eventEmitter.emit(i.default.annotationAppearanceUpdated,[t],o),!0}))},e.prototype.setBorderStyle=function(e,t){var n=this,r=this.info.borderInfo;switch(r.style=e,e){case 1:r.dashes=t;break;case 5:r.cloudIntensity=t}var o=this.getPDFPage(),a=o.getPDFDoc();return this.page.doc.api.setAnnotBorderStyle(a.getId(),o.getId(),this.getId(),e,t).then((function(e){return o.getAnnotsByObjectNumArray(e)})).then((function(e){for(var t=[],n=e.length;n--;)t.push(e[n]._update());return Promise.all(t)})).then((function(e){return n.eventEmitter.emit(i.default.annotationUpdated,e,o,c.default.borderStyleUpdated),n.eventEmitter.emit(i.default.annotationAppearanceUpdated,e,o),!0}))},e.prototype.getBorderDashes=function(){return Object.assign([],this.info.borderInfo.dashes)},e.prototype.getBorderWidth=function(){var e=this.info.borderInfo.width;return void 0===e?1:+e},e.prototype.setBorderWidth=function(e){var t=this,n=this.getPDFPage(),r=n.getPDFDoc();return this.page.doc.api.setAnnotBorderWidth(r.getId(),n.getId(),this.getId(),e).then((function(e){return t._update().then((function(t){return e}))})).then((function(e){return e&&(t.eventEmitter.emit(i.default.annotationUpdated,[t],n,c.default.borderWidthUpdated),t.eventEmitter.emit(i.default.annotationAppearanceUpdated,[t],n)),e}))},e.prototype.getCloudIntensity=function(){return this.info.borderInfo.cloudIntensity||0},e.prototype.reviseSummary=function(e){return Promise.resolve(this)},e.prototype.rectIsEmpty=function(){return this.info.rectIsEmpty},e.prototype.update=function(e){var t=this;return this._update().then((function(){return e&&t.eventEmitter.emit(i.default.annotationUpdated,[t],t.getPDFPage(),e),t}))},e.prototype._update=function(){var e=this,t=this.getPDFPage(),n=t.getPDFDoc();return this.page.doc.api.getAnnot(n.getId(),t.getId(),this.getId()).then((function(t){return t.rotation&&t.rotation<0&&(t.rotation+=360),e.updateInfo(t),e}))},e.prototype._updateMore=function(){},e.prototype.getFlags=function(){return this.info.flag},e.prototype.getIndex=function(){return this.info.index},e.prototype.setFlags=function(e,t){var n=this;this.checkModidyPerm(),this.info.flag=e;var r=this.getPDFPage(),o=r.getPDFDoc();return this.page.doc.api.setAnnotFlag(o.getId(),r.getId(),this.getId(),e).then((function(o){return o&&("widget"==n.getType()&&n.updateUI({type:"display",value:e}),t||(n.eventEmitter.emit(i.default.annotationUpdated,[n],r,c.default.flagsUpdated),n.eventEmitter.emit(i.default.annotationAppearanceUpdated,[n],r))),o}))},e.prototype.setFlagValue=function(e,t){return this.setFlags(e,t)},e.prototype.getModifiedDateTime=function(){var e=this.info.modifiedTimestamp;return e<0?null:new Date(e)},e.prototype.setModifiedDateTime=function(e){var t=this;this.checkModidyPerm();var n=this.getPDFPage(),r=n.getPDFDoc();return this.page.doc.api.setModifiedDateTime(r.getId(),n.getId(),this.getId(),e).then((function(e){return t.update(c.default.modifiedDateTimeUpdated)}))},e.prototype.exportToJSON=function(){var e=(0,a.colorConvertor)(16777215&this.info.borderColor,"#"),t=this.info.flag,n=[];for(var i in r.AnnotFlagsName)t&1<<parseInt(i)&&n.push(r.AnnotFlagsName[i]);n=n.join(",");var s=(0,o.formatPDFDate)(new Date(this.info.modifiedTimestamp)),u=this.info.name,c=this.page.getIndex(),d=this.info.rect,l=d.left+","+d.bottom+","+d.right+","+d.top,f=this.info.content,h=this.info.borderInfo,p=this.info.type,m=this.info.customEntries,g={type:p,color:e,flags:n,date:s,name:u,page:c,rect:l,contents:f,width:h.width,customEntries:m,objectNumber:this.info.objectNumber};switch(h.style){case r.BORDER_STYLE.SOLID:g.style="solid";break;case r.BORDER_STYLE.DASHED:g.style="dashed",g.dashPhase=h.dashPhase,g.dashes=h.dashes.join(",");break;case r.BORDER_STYLE.UNDERLINE:g.style="underline";break;case r.BORDER_STYLE.BEVELED:g.style="beveled";break;case r.BORDER_STYLE.INSET:g.style="inset";break;case r.BORDER_STYLE.CLOUDY:g.style="cloudy",g.intensity=h.cloudIntensity}return g},e.prototype.updateInfo=function(e){this._isEmpty=!e,this.info=e,this._updateMore(),this.action&&e.action&&(this.action.info=e.action)},e.prototype.getIntent=function(){return""},e.prototype.setCustomEntries=function(e,t){this.info.customEntries=this.info.customEntries||{},this.info.customEntries[e]=t},e.prototype.setDictionaryEntry=function(e,t){var n=this;return this._setDictionaryEntry(e,t).then((function(e){return e&&n.eventEmitter.emit(i.default.annotationUpdated,[n],n.getPDFPage(),c.default.addDictionary),e}))},e.prototype._setDictionaryEntry=function(e,t){var n=this,r=this.getPDFPage(),o=r.getPDFDoc();return this.page.doc.api.setDictionaryEntry(o.getId(),r.getId(),this.getId(),e,t).then((function(r){return r&&n.setCustomEntries(e,t),r}))},e.prototype.getDictionaryEntry=function(e){return this._getDictionaryEntry(e)},e.prototype._getDictionaryEntry=function(e){var t=this.getPDFPage(),n=t.getPDFDoc();return this.page.doc.api.getDictionaryEntry(n.getId(),t.getId(),this.getId(),e)},e.prototype.resetAppearanceStream=function(){var e=this.getPDFPage(),t=e.getPDFDoc();return this.page.doc.api.resetAppearanceStream(t.getId(),e.getId(),this.getId())},e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={contentUpdated:"content-updated",borderInfoUpdated:"borderInfo-updated",borderStyleUpdated:"borderStyle-updated",borderWidthUpdated:"borderWidth-updated",borderColorUpdated:"borderColor-updated",modifiedDateTimeUpdated:"modifiedDateTime-updated",uniqueIDUpdated:"uniqueID-updated",flagsUpdated:"flags-updated",rectUpdated:"rect-updated",innerRectUpdated:"innerRect-updated",iconNameUpdated:"iconName-updated",rotationUpdated:"rotation-updated",defaultAppearanceUpdated:"defaultAppearance-updated",calloutLineEndingStyleUpdated:"calloutLineEndingStyle-updated",calloutLinePointsUpdated:"calloutLinePoints-updated",fillColorUpdated:"fillColor-updated",textColorUpdated:"textColor-updated",alignmentUpdated:"alignment-updated",inkListUpdated:"inkList-updated",endPointUpdated:"endPoint-updated",startPointUpdated:"startPoint-updated",endingStyleUpdated:"endingStyle-updated",enableCaptionUpdated:"enableCaption-updated",leaderCaptionOffsetUpdated:"leaderCaptionOffset-updated",styleFillColorUpdated:"styleFillColor-updated",leaderLineLengthUpdated:"leaderLineLength-updated",leaderLineExtendUpdated:"leaderLineExtend-updated",leaderLineOffsetUpdated:"leaderLineOffset-updated",measureRatioUpdated:"measureRatio-updated",measureUnitUpdated:"measureUnit-updated",measureConversionFactorUpdated:"measureConversionFactor-updated",removeAction:"remove-action",actionDataUpdated:"actionData-updated",addAction:"add-action",highlightingModeUpdated:"highlightingMode-updated",subjectUpdated:"subject-updated",titleUpdated:"title-updated",createDateTimeUpdated:"createDateTime-updated",opacityUpdated:"opacity-updated",intentUpdated:"intent-updated",vertexesUpdated:"vertexes-updated",applyFillColorUpdated:"applyFillColor-updated",overlayTextUpdated:"overlayText-updated",overlayTexAlignmentUpdated:"overlayTextAlignment-updated",repeatUpdated:"repeat-updated",autoFontSizeUpdated:"autoFontSize-updated",redactDefaultAppearanceUpdated:"redactDefaultAppearance-update",redactOpacityUpdated:"redactOpacity-updated",quadPointsUpdated:"quadPoints-updated",reviewStateUpdated:"review-state-updated",markedStateUpdated:"marked-state-updated",statesCleared:"state-cleared",replyAdded:"add-replies",addDictionary:"add-dictionary",formFieldValueUpdated:"form-field-value",formFieldsMaxLengthUpdated:"maxLength",formFieldItemsUpdated:"setItems",formFieldIconUpdated:"icon",formFieldInsertedItem:"insertItemAt",formFieldExportValueUpdated:"form-field-export-value",formFieldMKPropertyUpdated:"form-field-mk-property",formFieldAlternateName:"form-field-alternate-name",formFieldActionUpdated:"form-field-action"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=0,o=t.ModulePageEditor=1,i=t.ModuleTouchup=2,a=t.ModuleExporter=4;t.initGSDKModule=function(e,t){if(!(r&t)){switch(t){case o:e.initPageEditor();break;case i:e.initTouchup();break;case a:e.initExporter()}r|=t}}},,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};n(407);var o=M(n(609)),i=M(n(73)),a=M(n(68)),s=n(377),u=M(n(719)),c=M(n(726)),d=M(n(727)),l=M(n(728)),f=M(n(166)),h=M(n(378)),p=M(n(165)),m=M(n(107)),g=n(3),y=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(731)),_=(M(n(103)),n(382)),v=M(n(37)),b=M(n(732)),S=n(733),w=M(n(74));function M(e){return e&&e.__esModule?e:{default:e}}function D(e){return function(){var t=e.apply(this,arguments);return new Promise((function(e,n){return function r(o,i){try{var a=t[o](i),s=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(s).then((function(e){r("next",e)}),(function(e){r("throw",e)}));e(s)}("next")}))}}var P=new m.default("cache","FoxitPDFSDKForWeb_cache"),T=navigator.userAgent.toLowerCase();function k(){var e=void 0;return!(!("ActiveXObject"in self)||!(e=T.match(/msie ([\d\.]+)/)))&&10===parseInt(e[1])}var A=/iP(hone|od|ad)/i.test(T),L={};trace=self.trace=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(self.gsdk){for(var r="",o=t[1];o<t[1]+180&&0!=gsdk.HEAP8[o];o++){var i=String.fromCharCode(gsdk.HEAP8[o]);r+=i}t[1]=r}console.trace(t[1]+":"+t[0]+":gsdk exception")},self.saveBitmapToFile=function(e){var t=new gsdk.Image;t.AddFrame(e);var n=[],r=gsdk.StreamCallback.implement({Release:function(){},Flush:function(){return!0},GetSize:function(){return 0},WriteBlock:function(e,t,r){var o=gsdk.HEAPU8.buffer,i=void 0;return i=o.slice?o.slice(e,e+r):new Uint8Array(o,e,r).buffer,n=n.concat(i),!0}});t.SaveAs(r,new gsdk.WString(".bmp"));var o=new Blob(n,{type:"image/bmp"}),i=URL.createObjectURL(o);postMessage({type:-11,url:i})},self.renderAnnot=function(e){var t=e.GetRect(),n=t.right-t.left,r=t.top-t.bottom,o=new gsdk.Bitmap(n,r,gsdk.DIBFormat.e_DIBArgb,0,0),i=new gsdk.Renderer(o,!0),a=e.GetPage(),s=a.GetDisplayMatrix(0,0,a.GetWidth(),a.GetHeight(),{value:0});s.e-=t.left,s.f-=a.GetHeight()-t.top;i.RenderAnnot(e,s);saveBitmapToFile(o)},self.getWASMString=function(e,t){for(var n="",r=e;r<e+2*t;r++){n+=String.fromCharCode(gsdk.HEAP8[r])}console.trace("wasm string:",n)};var F=(0,i.default)(),I=F.promise,x=!1,C=!1,R=!1,O={},G={};(0,u.default)(G,ne,oe,I,Q,X),(0,d.default)(G,ne,oe,I,Q,X);var E,Y,j=(0,c.default)(G,ne,oe,I,Q,X),N=(0,l.default)(G,ne,oe,I,Q,X),B={},H=(E={},{push:function(e){for(var t=E[e]=E[e]||[],n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];t.push.apply(t,r)},get:function(e){return E[e]||[]}}),W={},U={},z={},J=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.reason=t,this.transfers=n};function V(e){return W[e]}function K(e,t){for(var n=e.params||[],r=e.more.paramsInfo||[],o=[],i=n.length;i--;){var a=n[i],s=r[i]||{};s.isObject?!(o[i]=V(a))&&s.enumName&&(o[i]=q(a,s.enumName,t)):o[i]=n[i]}return o}function q(e,t,n){for(var r=t.split("."),o=n,i=0,a=r.length;i<a;i++)o=o[r[i]];return o.values[e]}function Z(e,t){try{self.postMessage(e,t)}catch(t){self.postMessage(e)}}function X(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{error:-1},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;k()&&(n=n[0]),t&&r&&(t.e=r.constructor?r.constructor.name:r),Z({id:e,type:1,params:t},n)}function Q(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];k()&&(n=n[0]),Z({id:e,type:0,params:t},n)}function $(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];k()&&(n=n[0]);var r=(0,a.default)("worker_back"),o=(0,i.default)();return B[r]=function(e){o.resolve(e)},Z({callId:e,params:t,backId:r},n),o.promise}function ee(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];k()&&(n=n[0]),Z({uiListener:e,params:t},n)}function te(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!1),r.responseType="arraybuffer",r.send(),r.status>=200&&r.status<300||304===r.status||n.reject(new Error("request error: "+r.status));var o=new Uint8Array(r.response),i=(0,p.default)(o);P.set("asmJs",i).then((function(){ee("asmJs",e)}),(function(){}));var a=new Blob([i],{type:"application/javascript"}),s=void 0,u=void 0;try{s=URL.createObjectURL(a),u=Promise.resolve(s)}catch(e){u=$(t,a)}return u.then((function(e){importScripts(e)})).then((function(){n.resolve()}),(function(e){n.reject(e)}))}function ne(e){return I.then((function(t){return t.getPDFDocById(e)})).then((function(t){if(!t)throw new Error('The document corresponding to the ID("'+e+'") cannot be found or has been deleted!');return t}))}function re(e,t){return ne(e).then((function(e){return e.getPageByIndex(t)})).then((function(e){if(!e)throw new Error("Cannot access the page with the specified index: "+t);return e}))}function oe(e,t){return ne(e).then((function(e){return e.getPageById(t)}))}function ie(e,t,n){var r=t.docId,o=t.pageId,i=t.x,a=t.y,s=t.width,u=t.height,c=t.scale,d=t.rotate;return oe(r,o).then((function(e){return e.getImageDataByTile(i,a,s,u,c,d,n)})).then((function(t){var n=[];t.buffer&&(n=[t.buffer]),Q(e,t,n)}))}self.onmessage=function(e){var t=e.data,n=t.params,r=t.backId;if(r)return B[r](n);var o=t.name,i=t.id;try{var s=G[o];if(s){var u=s(i,n);u instanceof Promise&&u.catch((function(e){var t=void 0,r=void 0;e instanceof J?(r=e.reason,t=e.transfers):(t=[],r=e),"number"==typeof r?I.then((function(e){var a=e.engine.getErrorCode(r);"number"!=typeof a&&(a=r),X(i,{error:r,message:"Unknown engine error! error: "+r+", code: "+a+", Worker function name: "+o+", parameters: "+JSON.stringify(n)},t,null)})):r instanceof Error&&X(i,{error:"number"==typeof r.error?r.error:-1,message:r.message,stack:r.stack},t,r)}))}else!function(e){var t=e.id,n=e.name.split(".");I.then((function(e){return e.engine})).then((function(t){for(var r=t,o=0,i=n.length;o<i;o++){var s=void 0;if(s=r[n[o]]){var u=n[o+1];if("prototype"===u){var c=void 0;try{r=V(c=e.more.self)}catch(e){r=new s}if(o++,"destroy"===n[o+1])return c}else"create"===u?(r=new s.apply(s,K(e)),o++):r="function"==typeof s?s.apply(r,K(e)):s}}return function(e){if(!e)return"";var t=(0,a.default)("obj");return W[t]=e,t}(r)})).then((function(e){Q(t,e)}),(function(e){X(t,{code:e.code,stack:e.stack,message:e.message})}))}(t)}catch(e){X(i,{error:-1,message:"web-pdf-jr-worker-error\r\n"+o+"\r\n"+e.toString(),stack:e.stack})}},G.initJREngine=function(e,t){var n=t.enginePath,r=t.licenseSN,a=t.licenseKey,u=t.fontPath,c=t.cache,d=t.compatibilityURL,l=t.l,f=t.d,p=t.readBlock,m=void 0===p?8192:p,g=t.fontMap,y=void 0===g?[]:g,_=t.brotli,v=void 0===_?{}:_;if(R)return Q(e,{version:self.gsdkVersion});if(I.then((function(t){if(Y)return Q(e,{other:Y,version:self.gsdkVersion});Q(e,{version:self.gsdkVersion})})),!C&&!x){var b=(0,i.default)();x=b.promise.then((function(){return C=!0,new o.default(null,{enginePath:n,fontPath:u,cache:c,postMessageToUi:ee,readBlock:m,fontMap:y,brotli:v})})).then((function(t){t.jrEnginePromise.catch((function(t){X(e,{error:3},null,t)})),(l?t.checkLicense2(l):t.checkLicense(r,a)).then((function(n){var r=n.flag,o=n.other;if(self.gsdkVersion=t.engine.Library.GetVersion().toString(),r){var i=t.engine.Library.GetLicenseKeyInfo,a=void 0;try{a=i().toString()}catch(e){}if(a){var s=a.match(/<Domains>((.|\r?\n)*)<\/Domains>/);if(s){s=s[1];for(var u=/<Domain>([^<]+)<\/Domain>/g,c=void 0,d=!1,l=!1;c=u.exec(s);){var h=c[1],p=void 0;if(h)for(var m=h.split(/,|,|\r?\n/),g=m.length;g--;){var y=m[g];if(y){d=!0;var _=void 0;try{_=new RegExp(y.replace(/\./g,"\\.").replace(/\*\*/g,"福昕").replace(/\*/g,".?").replace(new RegExp("福昕","g"),".*")).test(f)}catch(e){}if(_){l=!0,p=!0;break}}}if(p)break}if(d&&!l)return void X(e,{error:2})}}if(o&&(o=JSON.parse(o))){var v=!0;if(o.h){v=!1;var b=o.h;0;for(var S=b.length;S--;){var w=b[S];if(new RegExp(w).test(f)){v=!0;break}}}if(!v)return void X(e,{error:2});var M=Date.now(),D=o.b;if(D&&!(v=M>D))return void X(e,{error:2});var P=o.e;if(P&&!(v=M<P))return void X(e,{error:2});if(!v)return void X(e,{error:2})}Y=o,R=!0,F.resolve(t)}else X(e,{error:2})}))}),(function(){X(e)}));try{if((0,h.default)())importScripts(n+"/gsdk.js?h="+s.jsHash),b.resolve();else{var S=void 0;!1===v.core?(S=n+"/gsdk.asm.js?h="+s.asmJSHash,importScripts(S),b.resolve()):(S=n+"/gsdk.asm.js.brotli?h="+s.asmJSHash)===c.asmJs?P.get("asmJs").then((function(e){if(e)try{var t=new Blob([e],{type:"application/javascript"}),n=void 0,r=void 0;try{r=URL.createObjectURL(t),n=Promise.resolve(r)}catch(e){n=$(d,t)}n.then((function(e){importScripts(e),b.resolve()}),(function(e){b.reject(e)}))}catch(e){b.reject(e)}else te(S,d,b)}),(function(){te(S,d,b)})):te(S,d,b)}C=!0}catch(t){return console.log(t),X(e,{error:1})}}},G.getPDFDocByFile=function(e,t){var n=t.file;return I.then((function(e){if(n instanceof ArrayBuffer)return e.getPDFDoc({buffer:n});var t=de(n);return t.size<2097152?e.getPDFDoc({buffer:t.read(0,t.size)}):e.getPDFDoc({size:t.size,getBuffer:function(e,n){return t.read(e,n)},destroyCallback:function(){t.destroy()}})})).then((function(e){return e.setOriginalStream(n),e.id})).then((function(t){Q(e,t)}))},G.getPDFDocFromImageFile=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return I.then((function(r){var o=r.engine,i=de(t),a=i.read(0,i.size),s=v.default.createImage(o,a),u=s.GetWidth(),c=s.GetHeight(),d=t.name,l={width:u,height:c};return r.createNewDoc(d,n,l).then((function(e){return r.getPDFDoc({buffer:e})})).then((function(t){Q(e,{docId:t.id,width:u,height:c,buffer:a})}))}))},G.createNewDoc=function(e,t){var n=t.title,r=t.author,o=t.pageSize;return I.then((function(e){return e.createNewDoc(n,r,o)})).then((function(t){Q(e,t,[t])}))},G.createNewPortfolioDoc=function(e,t){var n=t.fileCoversheet,r=t.files,o=t.title;return I.then((function(e){return e.createNewPortfolioDoc(n,r,o)})).then((function(t){Q(e,t,[t])}))},G.createSummarizeComments=function(e,t){var n=t.docId,r=t.writeStream,o=t.param,i=void 0;return ne(n).then((function(e){return i=e,e.createSummarizeComments({writeStream:function(e,t,n){$(r,{arrayBuffer:e,offset:t,size:n},[e])}},o)})).then((function(t){H.push(i.id,r),Q(e,t)}),(function(t){X(e,{err:-1},[],t)}))},G.setIcons=function(e,t){var n=t.icons;I.then((function(e){var t=(0,f.default)();t.initIconProvider(e,e.engine),t.setIcons(n)})),Q(e)},G.addIcon=function(e,t){var n=t.icon;(0,f.default)().addIcon(n),Q(e)},G.removeIcon=function(e,t){var n=t.type,r=t.catalog,o=t.name;(0,f.default)().removeIcon(n,r,o),Q(e)},G.checkCertificatePassword=function(e,t){var n=t.pfxFile,r=t.password;return I.then((function(e){return e.checkCertificatePassword(n,r)})).then((function(t){Q(e,t)}))},G.getCertificateInfo=function(e,t){var n=t.file,r=t.password;return I.then((function(e){return e.getCertificateInfo(n,r)})).then((function(t){Q(e,t)}))},G.createCertificateFile=function(e,t){var n=t.docId,r=t.info;return ne(n).then((function(e){return e.createCertificateFile(r)})).then((function(t){Q(e,t)}))},G.getCertificateSerials=function(e,t){return ne(t.docId).then((function(e){return e.getCertificateSerials()})).then((function(t){Q(e,t)}))},G.parseByCertificate=function(e,t){var n=t.docId,r=t.info;return ne(n).then((function(t){t.parseByCertificate(r).then((function(n){0===n.code&&(n.info=t.toJson()),Q(e,n)}))})).catch((function(t){X(e,null,[],t)}))},G.parsePDFDocByPassword=function(e,t){var n=t.id,r=t.password,o=t.initData,i=void 0===o?{}:o,a=I.then((function(e){if(e.engine.Library.SetDefaultFileSize(i.readBlock||e.defaultReadBlockSize),i.fdf&&i.fdf.file){var t=i.fdf.file,n=ue(t),r=ce(t);return e.getFDFDoc({size:n,getBuffer:function(e,t){return r(e,t)}}).then((function(e){i.fdf.file=e}))}})),s=void 0;return a.then((function(){return ne(n)})).then((function(e){return s=e,e.parseByPassword(r,i)})).then((function(t){if(I.then((function(e){e.unRegisterSecurityCallback("FoxitDRM"),e.registeredDRMSecurityCallback=!1})),0===t.code){t.info=s.toJson();var n=s.doc.CheckPassword(new s.engine.String(r||""));t.info.hasOwnerPassword=3===n.value||s.doc.HasOwnerPassword()}Q(e,t)})).catch((function(t){X(e,null,[],t)})).finally((function(e){return s=null}))},G.getPageCount=function(e,t){return ne(t).then((function(e){return e.getPageCount()})).then((function(t){Q(e,t)}),(function(t){X(e,null,[],t)}))},G.getFileVersion=function(e,t){return ne(t).then((function(e){return e.getFileVersion()})).then((function(t){Q(e,t)}),(function(t){X(e,null,[],t)}))},G.getPDFDocInfoById=function(e,t){return ne(t).then((function(t){Q(e,t.toJson())}))},G.getMetadata=function(e,t){return ne(t).then((function(t){Q(e,t.getMetadata())}))},G.setMetadataValue=function(e,t){var n=t.id,r=t.key,o=t.value;return ne(n).then((function(t){Q(e,t.setMetadataValue(r,o))}))},G.getPageInfoByIndex=function(e,t){return re(t.id,t.index).then((function(t){Q(e,t.toJson())})).catch((function(e){0}))},G.getDocPermission=function(e,t){return ne(t).then((function(e){return e.getPermission()})).then((function(t){Q(e,t)}))},G.getPageWidth=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.getWidth()})).then((function(t){Q(e,t)}))},G.getPageHeight=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.getHeight()})).then((function(t){Q(e,t)}))},G.getPageImageData=function(e,t){var n=t.docId,r=t.pageId,o=t.scale;return oe(n,r).then((function(e){return e.getImageData(o)})).then((function(t){var n=[];t.buffer&&(n=[t.buffer]),Q(e,t,n)}))},G.destroyDoc=function(e,t){var n=t.id;H.get(n).forEach((function(e){var t;t=e,self.postMessage({destroyId:t})})),z[n]&&delete U[z[n]],ne(n).then((function(t){return I.then((function(e){e.destroyDoc(n)})).then((function(){j.clearObjectFromCache(n),N.clearObjectCache(),t.destroy();var r=O[n];r&&(r(),delete O[n]),Q(e)}))})).catch((function(t){X(e,null,[],t)}))},G.getImageDataByTile=ie,G.getImageDataWithoutAnnotByTile=function(e,t){var n=t.docId,r=t.pageId,o=t.x,i=t.y,a=t.width,s=t.height,u=t.scale,c=t.rotate;return I.then((function(t){ie(e,{docId:n,pageId:r,x:o,y:i,width:a,height:s,scale:u,rotate:c},[t.engine.ContentFlag.e_RenderPage.value])}))},G.getAnnot=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e?e.getAnnotById(o):null})).then((function(e){return e?e.toJson():{}})).then((function(t){Q(e,t)}))},G.getPageAnnotIDList=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.getAnnotIDList()})).then((function(t){Q(e,t)}))},G.getAnnots=function(e,t){var n=t.docId,r=t.pageId,o=t.idList,i=t.reload;return oe(n,r).then((function(e){return e?e.getAnnots(o,void 0,i):[]})).then((function(e){var t={};return e.map((function(e,n){var r=e.annot;if(0===r.GetType().value)return!1;var o=r.GetDict(),i=o.GetObjNum(),a=t[i]=t[i]||{},s=i;a.index=n,a.id=s,a.objectNumber=s;var u=e.engine,c=(0,g.CString)(u,"IRT");if(o.HasKey(c)){var d=o.GetElement(c).GetDict().GetObjNum(),l=(0,g.CString)(u,"RT"),f=(0,g.CString)(u,"State"),h=(0,g.CString)(u,"StateModel"),p=t[d]=t[d]||{};if(o.HasKey(f)&&o.HasKey(h)){var m=o.GetElement(h).GetString().toString(),y=r.GetModifiedDateTime(),_=0;switch(y.IsValid()&&(y=y.ToUTCTime(),_=Date.UTC(y.year,y.month-1,y.day,y.hour,y.minute,y.second,y.milliseconds)),m){case"Marked":(p.markedStates=p.markedStates||[]).push({index:n,id:s,time:_,objectNumber:s});break;case"Review":(p.reviewStates=p.reviewStates||[]).push({index:n,id:s,time:_,objectNumber:s})}}else if(o.HasKey(l)){switch(o.GetElement(l).GetString().toString()){case"Group":p.isGroupHeader=!0,p.isGroup=!0,(p.groupElements=p.groupElements||[]).push({index:n,id:s,objectNumber:s}),a.isGroup=!0,a.groupHeader=p;break;case"R":default:p.hasReplies=!0,(p.replies=p.replies||[]).push({index:n,id:s,content:r.GetContent().toString(),objectNumber:s})}}else{p.hasReplies=!0,(p.replies=p.replies||[]).push({index:n,id:s,content:r.GetContent().toString(),objectNumber:s})}}})),e.map((function(e){if(0!==e.annot.GetType().value)return e&&e.toJson(t)})).filter(Boolean)})).then((function(t){Q(e,t)}))},G.setRenderFlag=function(e,t){var n=t.docId,r=t.flags;return ne(n).then((function(e){e.setRenderFlag(r)}))};var ae={};function se(e,t){var n=t.progressiveId,r=ae[n];r?(r.bitmap.delete(),r.renderer.delete(),r.progressive.delete(),delete ae[n],e&&Q(e)):Q(e)}function ue(e){return e instanceof Blob?e.size:e.byteLength}function ce(e){if(e instanceof Blob){if(A){var t=new FileReaderSync;e=new Blob([t.readAsArrayBuffer(e)])}return function(t,n){return(new FileReaderSync).readAsArrayBuffer(e.slice(t,t+n))}}return e.slice?function(t,n){return e.slice(t,t+n)}:function(t,n){return new Uint8Array(e,t,n).buffer}}function de(e){var t=void 0,n=void 0,r=[];if(e instanceof Blob){if(A){var o=new FileReaderSync;e=new Blob([o.readAsArrayBuffer(e)])}t=e.size;var i=!0,a=0,s=Math.ceil(t/65536);n=function(n,o){for(var u=n+o,c=Math.floor(n/65536),d=Math.floor(u/65536),l=n%65536,f=Math.min(65536,u),h=new Uint8Array(o),p=[],m=c,g=d+1,y=0;m<g;m++){var _,v=(f=m===d?u%65536:65536)-l;(_=r[m])?h.set(new Uint8Array(_,l,f-l),y):v&&p.push([m,l,f,y]),y+=v,l=0}if(p.length){i&&(i=!1,setTimeout((function(){i=!0,a=1}),0));for(var b=[],S=p[0][0],w=S,M=0,D=p.length;M<D;M++)w=p[M][0],p[M+1]&&p[M+1][0]===w+1||(b.push([S,w]),S=b[++M]&&b[M][0]);for(var P=0,T=b.length;P<T;P++){for(var k=b[P],A=k[0],L=k[1],F=0,I=a;F<I;F++){var x=L+1,C=A-1;if(F%2)C>-1&&!r[C]?A--:x<s&&!r[x]&&L++;else if(x<s&&!r[x])L++;else{if(!(C>-1)||r[C])break;A--}}b[P]=[A,L]}for(var R=new FileReaderSync,O=0,G=b.length;O<G;O++){var E=b[O],Y=E[0],j=E[1],N=65536*Y,B=Math.min(65536*(j+1),t),H=R.readAsArrayBuffer(e.slice(N,B));if(H.slice)for(var W=Y,U=j+1,z=0;W<U;W++,z++)r[W]=H.slice(65536*z,65536*(z+1));else for(var J=Y,V=j+1,K=0;J<V;J++,K++){var q=65536;65536*(J+1)>t&&(q=t%65536),r[J]=new Uint8Array(H,65536*K,q).buffer}}a++}for(var Z=0,X=p.length;Z<X;Z++){var Q=p[Z];h.set(new Uint8Array(r[Q[0]],Q[1],Q[2]-Q[1]),Q[3])}return h}}else t=e.byteLength,n=e.slice?function(t,n){return e.slice(t,t+n)}:function(t,n){return new Uint8Array(e,t,n).buffer};return{size:t,read:n,destroy:function(){e=null,t=0,n=null;for(var o=r.length;o--;)delete r[o];r=null}}}function le(e){for(var t=[],n=e.GetMatchRects(),r=0,o=n.GetSize();r<o;r++){var i=n.GetAt(r);t[r]={left:i.left,right:i.right,top:i.top,bottom:i.bottom}}return{pageIndex:e.GetMatchPageIndex(),startCharIndex:e.GetMatchStartCharIndex(),endCharIndex:e.GetMatchEndCharIndex(),sentenceStartIndex:e.GetMatchSentenceStartIndex(),sentence:e.GetMatchSentence().toString(),rectArray:t}}G.getPageBitmap=function(e,t){var n=t.docId,r=t.pageId,o=t.scale,i=t.rotate,a=t.rect,s=t.flags,u=t.usage,c=t.id;return oe(n,r).then((function(e){return e?e.getBitmap(o,i,a,s,u,""==c):null})).then((function(t){if(t){var n=t.image;if(t.isVirtual)Q(e,n,[n.buffer]);else{var r=[];n.buffer&&(r=[n.buffer]),n.progressiveId=c,Q(e,n,r),delete t.image,100==n.rate?(t.bitmap.delete(),t.renderer.delete(),t.progressive.delete()):ae[c]=t}}else Q(e,null)}))},G.progressContinue=function(e,t){var n=t.progressiveId,r=ae[n];if(r){var o=r.progressive,i=o.GetRateOfProgress();100==i&&Q(e,{rate:100});for(var a=o.Continue(),s=Date.now();1==a.value&&(a=o.Continue(),!(Date.now()-s>200)););var u=r.page,c=r.renderer,d=r.usage,l=r.matrix,f=r.renderFlags;100==(i=2==a.value?100:o.GetRateOfProgress())&&u.renderAnnots(c,d,l,f);var h=r.getBitmapBuffer(r.engine,r.bitmap,r.renderer,!1);h.rate=i,h.progressiveId=n,h.x=r.x,h.y=r.y;var p=[];h.buffer&&(p=[h.buffer]),Q(e,h,p),100==h.rate&&se(null,{progressiveId:n})}else Q(e,{isEmpty:1,progressiveId:n})},G.cancleProgress=se,G.getPageAndHighlightBitmap=function(e,t){var n=t.docId,r=t.pageId,o=t.scale,i=t.rotate,a=t.rect,s=t.exclude;return oe(n,r).then((function(e){return e.getPageAndHighlightBitmap(o,i,a,s)})).then((function(t){var n=[];t.buffer&&(n=[t.buffer]),Q(e,t,n)}))},G.getAnnotBitmap=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.scale,a=t.rotate,s=t.rect,u=t.renderAppearanceType;return oe(n,r).then((function(e){return e.getAnnotBitmap(o,i,a,s,u)})).then((function(t){var n=[];t.buffer&&(n=[t.buffer]),Q(e,t,n)}))},G.getAnnotBitmapByRange=function(e,t){var n=t.docId,r=t.pageId,o=t.range,i=t.scale,a=t.rotate,s=t.rect;return oe(n,r).then((function(e){return e.getAnnotBitmapByRange(o,i,a,s)})).then((function(t){var n=[];t.buffer&&(n=[t.buffer]),Q(e,t,n)}))},G.getAnnotIdAtPoint=function(e,t){var n=t.docId,r=t.pageId,o=t.points,i=t.tolerance;return oe(n,r).then((function(e){return e.getAnnotIdAtPoint(o.x,o.y,i)})).then((function(t){Q(e,t)}))},G.getAnnotIdAtDevicePoint=function(e,t){var n=t.docId,r=t.pageId,o=t.points,i=t.tolerance,a=t.matrix;return oe(n,r).then((function(e){return e.getAnnotIdAtDevicePoint(o.x,o.y,i,a)})).then((function(t){Q(e,t)}))},G.getAnnotObjectNumAtPoint=function(e,t){var n=t.docId,r=t.pageId,o=t.points,i=t.tolerance;return oe(n,r).then((function(e){return e.getAnnotObjectNumAtPoint(o.x,o.y,i)})).then((function(t){Q(e,t)}))},G.getAnnotObjectNumAtDevicePoint=function(e,t){var n=t.docId,r=t.pageId,o=t.points,i=t.tolerance,a=t.matrix;return oe(n,r).then((function(e){return e.getAnnotObjectNumAtDevicePoint(o.x,o.y,i,a)})).then((function(t){Q(e,t)}))},G.getAnnotObjNumByNM=function(e,t){var n=t.docId,r=t.pageId,o=t.nm;return oe(n,r).then((function(e){return e.getAnnotObjNumByNM(o)})).then((function(t){Q(e,t)}))},G.getCharInfoAtPoint=function(e,t){var n=t.docId,r=t.pageId,o=t.points,i=t.tolerance;return oe(n,r).then((function(e){return e.getCharInfoAtPoint(o.x,o.y,i)})).then((function(t){Q(e,t)}))},G.getThumb=function(e,t){var n=t.docId,r=t.pageId,o=t.rotate,i=t.ratio;return oe(n,r).then((function(t){return t?t.getThumb(o,i).then((function(t){var n=[];t.buffer&&(n=[t.buffer]),Q(e,t,n)})):X(e,new Error("Page not exists: "+r))}))},G.getMediaBoxBitmap=function(e,t){var n=t.docId,r=t.pageId,o=t.width,i=t.height;return oe(n,r).then((function(t){return t?t.getMediaBoxBitmap(o,i).then((function(t){var n=[];t.buffer&&(n=[t.buffer]),Q(e,t,n)})):X(e,new Error("Page not exists: "+r))}))},G.updateAnnotQuadPointsByCharIndex=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.startCharIndex,a=t.endCharIndex;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.updateQuadPointsByCharIndex(i,a);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setAnnotContent=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.content;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setContent(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setAnnotBorderColor=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.color;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setBorderColor(i);return e.updateModifyTime(),t})).then((function(){Q(e,!0)}))},G.setAnnotOpacity=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.opacity;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setOpacity(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setAnnotRotation=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.rotation;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRotation(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.removeAnnot=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){if(e.hasAnnot(o))return e.getAnnotById(o)})).then((function(e){return e?e.remove():[o]})).then((function(t){Q(e,t||[])}))},G.annotAddReply=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.content;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.addReply(i);return e.updateModifyTime(),t})).then((function(e){return e.pdfPage.update().then((function(){return e}))})).then((function(t){Q(e,t.toJson())}))},G.setAnnotRect=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.rect;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRect(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setAnnotRectAndInnerRect=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.rect,a=t.innerRect;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setAnnotRectAndInnerRect(i,a);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.getAnnotInnerRect=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){t.getInnerRect?Q(e,t.getInnerRect()):Q(e,!1)}))},G.moveAnnotTo=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.position;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.moveTo(i.left,i.top);return e.updateModifyTime(),t})).then((function(t){return Q(e,t)}))},G.setAnnotInnerRect=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.rect;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setInnerRect(i);return e.updateModifyTime(),t})).then((function(t){return Q(e,t)}))},G.setAnnotAPBitmap=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.url,a=t.size;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setAnnotAPBitmap(i,a);return e.updateModifyTime(),t})).then((function(t){return Q(e,t)}))},G.getPDFDocStream=function(e,t){var n=t.docId,r=t.writeStream,o=t.flag,i=void 0;return ne(n).then((function(e){return i=e,e.getStream({writeStream:function(e,t,n){$(r,{arrayBuffer:e,offset:t,size:n},[e])}},o)})).then((function(t){H.push(i.id,r),Q(e,t)}))},G.setAnnotBorderStyle=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.style,a=t.styleParam;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setBorderStyle(i,a);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setAnnotBorderWidth=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.width;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setBorderWidth(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setAnnotFillColor=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.color;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setFillColor(i);return e.updateModifyTime(),!!t.length})).then((function(t){Q(e,t)}))},G.setRedactAnnotFillColor=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.color,a=t.onlyForFill;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setRedactFillColor(i,a),e.updateModifyTime(),!0})).then((function(t){Q(e,t)}))},G.setAnnotBorderInfo=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.borderInfo;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setBorderInfo(i),e.updateModifyTime(),!0})).then((function(t){Q(e,t)}))},G.setRedactOverlayText=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.overlayText;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRedactOverlayText(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setRedactApplyFillColor=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.color;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRedactApplyFillColor(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.removeRedactOverlayText=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.removeRedactOverlayText();return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setRedactOverlayTextAlignment=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.alignment;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRedactOverlayTextAlignment(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setRedactRepeat=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.isRepeat;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRedactRepeat(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setRedactAutoFontSize=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.isAutoFontSize;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRedactAutoFontSize(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.getRedactDefaultAppearance=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){Q(e,t.getRedactDefaultAppearance())}))},G.setRedactDefaultAppearance=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.appearance;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRedactDefaultAppearance(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setRedactOpacity=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.opacity,a=t.only4Fill;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRedactOpacity(i,a);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setAnnotIconName=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.iconName;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setIconName(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.getFileattachmentStream=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.writeStream;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.getStream({writeStream:function(e,t,n){$(i,{arrayBuffer:e,offset:t,size:n},[e])}})})).then((function(t){H.push(o,i),Q(e,t)}))},G.setAnnotEndingStyle=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.isBeginning,a=t.style;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){a=parseInt(a),i?e.setLineStartStyle(a):e.setLineEndStyle(a),e.updateModifyTime()})).then((function(){Q(e)}))},G.enableLineCaption=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.enable;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.enableCaption(i),e.updateModifyTime()})).then((function(){Q(e)}))},G.setLineStartPoint=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.x,a=t.y;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setStartPoint(i,a),e.updateModifyTime()})).then((function(){Q(e)}))},G.setLineEndPoint=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.x,a=t.y;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setEndPoint(i,a),e.updateModifyTime()})).then((function(){Q(e)}))},G.setAnnotLeaderLineLength=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.length;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setLeaderLineLength(i),e.updateModifyTime()})).then((function(){Q(e)}))},G.setAnnotLeaderLineExtend=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.length;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setLeaderLineExtensionLength(i),e.updateModifyTime()})).then((function(){Q(e)}))},G.setAnnotLeaderLineOffset=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.offset;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setLeaderLineOffset(i),e.updateModifyTime()})).then((function(){Q(e)}))},G.setAnnotCaptionOffset=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.x,a=t.y;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setCaptionOffset(i,a),e.updateModifyTime()})).then((function(){Q(e)}))},G.updateAnnotVertexes=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.pointIndex,a=t.x,s=t.y;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.updateVertexes(i,a,s),e.updateModifyTime()})).then((function(){Q(e)}))},G.setAnnotVertexes=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.vertexes;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setVertexes(i),e.updateModifyTime()})).then((function(){Q(e)}))},G.setHighlightingMode=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.highlightingMode;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setHighlightingMode(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.importFromFDF=function(e,t){var n=t.docId,o=t.fdf,i=t.dataType;return I.then((function(e){var t=ue(o),r=ce(o);return Promise.all([e.getFDFDoc({size:t,getBuffer:function(e,t){return r(e,t)}}),ne(n)])})).then((function(e){var t=r(e,2),n=t[0],o=t[1];return[o.importFromFDF(n,i),o]})).then((function(e){var t=r(e,2),n=(t[0],t[1]);return Promise.all(n.getAllLoadedPages().map((function(e){return e.update()})))})).then((function(){Q(e)}))},G.importFromFDFFile=function(e,t){var n=t.docId,o=t.file,i=t.size,a=t.type;return I.then((function(e){var t=void 0;return o instanceof Uint8Array?t=e.getFDFDoc({size:o.byteLength,getBuffer:function(e,t){return o.slice?o.slice(e,e+t):new Uint8Array(o,e,t).buffer}}):"string"==typeof o&&(t=e.getFDFFromURL(o,i)),t})).then((function(e){return Promise.all([e,ne(n)])})).then((function(e){var t=r(e,2),n=t[0],o=t[1],i=o.importFromFDF(n,a);return Promise.all(o.getAllLoadedPages().map((function(e){return e.update()}))).then((function(){return i}))})).then((function(t){Q(e,t)}))},G.setCalloutLineEndingStyle=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.endingStyle;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setCalloutLineEndingStyle(i),e.updateModifyTime()})).then((function(){Q(e)}))},G.setDefaultAppearance=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.da;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){t.setDefaultAppearance(i);t.updateModifyTime(),Q(e)}))},G.setAction=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.type,a=t.trigger,s=t.append;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setAction(a,i,s);return e.updateModifyTime(),t})).then((function(t){Q(e,t.toJson())}))},G.removeAnnotAction=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.removeAction();return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.getAction=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.getAction()})).then((function(t){var n=void 0;n=t?t.toJson():null,Q(e,n)}))},G.getArticleList=function(e,t){return ne(t.docId).then((function(e){return e.getArticle().toJson()})).then((function(t){Q(e,t)}))},G.getStructureRoles=function(e,t){return ne(t.docId).then((function(e){return e.getStructureRoles(e)})).then((function(t){Q(e,t)}))},G.addBookmarksFromStructureRoles=function(e,t){var n=t.docId,r=t.structureRoles,o=t.rootTitle;return ne(n).then((function(e){return e.addBookmarksFromStructureRoles(r,o)})).then((function(t){Q(e,t)}))},G.addAnnotReviewState=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.stateName;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.addReviewState(i);return e.updateModifyTime(),t})).then((function(e){return e.pdfPage.update().then((function(){return e}))})).then((function(t){Q(e,t.toJson())}))},G.addAnnotMarkedState=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.stateName;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.addMarkedState(i);return e.updateModifyTime(),t})).then((function(e){return e.pdfPage.update().then((function(){return e}))})).then((function(t){Q(e,t.toJson())}))},G.removeAllStateAnnots=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.removeAllStateAnnots();return!!t&&(e.updateModifyTime(),e.pdfPage.update().then((function(e){return t})))})).then((function(t){return Q(e,t)}))},G.setStateName=function(e,t){var n=t.docId,r=t.pageId,o=t.stateAnnotId,i=t.stateName;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){t.setStateName(i),t.updateModifyTime(),Q(e,!0)}))},G.setNoteOpenStatus=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.isOpen;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){var n=t.setOpenStatus(i);n&&t.updateModifyTime(),Q(e,n)}))},G.setActionDataByIndex=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.data,a=t.actionIndex;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.action.setActionDataByIndex(i,a);return e.updateModifyTime(),t})).then((function(t){Q(e,t.toJson())}))},G.setCalloutLinePoints=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.calloutLinePoints;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setCalloutLinePoints(i);return e.updateModifyTime(),t})).then((function(){Q(e)}))},G.setSubject=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.subject;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setSubject(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setTitle=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.title;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setTitle(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setCreateDateTime=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.date;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setCreateDateTime(i)})).then((function(t){Q(e,t)}))},G.setModifiedDateTime=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.date;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setModifiedDateTime(i)})).then((function(t){Q(e,t)}))},G.setUniqueId=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.newId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setUniqueId(i,!0)})).then((function(t){Q(e,t)}))},G.setDefaultAp=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.defaultAppearance;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setDefaultAp(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.setAlignment=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.value;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setAlignment(i),e.updateModifyTime(),!0})).then((function(t){Q(e,t)}))},G.exportToStardardXml=function(e,t){var n=t.docId,r=t.fileName,o=t.callbackId;return ne(n).then((function(e){return(0,_.initGSDKModule)(e.engine,_.ModuleExporter),e.exportToStardardXml(r,(function(e){$(o,e)}))})).then((function(t){Q(e,t)}))},G.exportToFDF=function(e,t){var n=t.docId,r=t.fileType,o=t.dataType,i=t.pageAnnots;return ne(n).then((function(e){return e.exportToFDF(r,o,i)})).then((function(t){Q(e,t)}))},G.exportToImage=function(e,t){var n=t.docId,r=t.imageSetting,o=t.fileName,i=t.pageRange,a=t.callbackId;return ne(n).then((function(e){return(0,_.initGSDKModule)(e.engine,_.ModuleExporter),e.exportToImage(r,o,i,(function(e){$(a,e)}))})).then((function(t){Q(e,t)}))},G.exportToTxt=function(e,t){var n=t.docId,r=t.taskName,o=t.pageRange,i=t.callbackId;return ne(n).then((function(e){return(0,_.initGSDKModule)(e.engine,_.ModuleExporter),e.exportToTxt(r,o,(function(e){$(i,e)}))})).then((function(t){Q(e,t)}))},G.exportImageObjectToImage=function(e,t){var n=t.docId,r=t.graphicsObject,o=t.imageSetting,i=t.fileName,a=t.callbackId;return ne(n).then((function(e){return(0,_.initGSDKModule)(e.engine,_.ModuleExporter),e.exportImageObjectToImage(r,o,i,(function(e){$(a,e)}))})).then((function(t){Q(e,t)}))},G.cancelExport=function(e,t){return ne(t.docId).then((function(e){return e.cancelExport()})).then((function(t){Q(e,t)}))},G.setAnnotFlag=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.flag;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setFlags(i);return e.updateModifyTime(),t})).then((function(t){Q(e,!0)}))},G.addAnnot=function(e,t){var n=t.docId,r=t.pageId,o=t.annot;return oe(n,r).then((function(e){return e.addAnnot(o)})).then((function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];o?t[n]=o.toJson():t[n]=null}return t})).then((function(t){Q(e,t)}))},G.setImage=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.buffer;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setImage(i);return e.updateModifyTime(),t})).then((function(t){Q(e,!0)}))},G.getAllModuleLicenseRight=function(e){return I.then((function(e){var t=e.engine,n=t.ModuleName,r=Object.keys(n).filter((function(e){return 0===e.indexOf("e_ModuleName")})),o={};return r.length>0&&r.forEach((function(e){var r=e.substr("e_ModuleName".length).toLowerCase(),i=t.Library.HasModuleLicenseRight(n[e]);o[r]=i})),o})).then((function(t){Q(e,t)}))},G.setDictionaryEntry=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.key,a=t.value;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setDictionaryEntry(i,a);return t&&e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.getDictionaryEntry=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.key;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.getDictionaryEntry(i)})).then((function(t){Q(e,t)}))},G.resetAppearanceStream=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){t.resetAppearanceStream(),Q(e)}))},G.isLinearized=function(e,t){return ne(t.docId).then((function(e){return e.isLinearized()})).then((function(t){Q(e,t)}))},G.getLayerNodes=function(e,t){return ne(t.docId).then((function(e){return e.getLayerNodes()})).then((function(t){Q(e,t)}))},G.setLayerNodeVisiable=function(e,t){var n=t.docId,r=t.layerId,o=t.visiable;return ne(n).then((function(e){return!!e.pdfLayer&&e.pdfLayer.setLayerNodeVisiable(r,o)})).then((function(t){Q(e,t)}))},G.addAnnotGroup=function(e,t){var n=t.docId,r=t.pageId,o=t.annots,i=t.headerIndex;return oe(n,r).then((function(e){return e.addAnnotGroup(o,i)})).then((function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];o?t[n]=o.toJson():t[n]=null}return t})).then((function(t){Q(e,t)}))},G.getBlankPageIndexes=function(e,t){return ne(t.docId).then((function(e){return e.getBlankPageIndexes()})).then((function(t){Q(e,t)}))},G.getBookmarks=function(e,t){return ne(t.docId).then((function(e){return e.getBookmarks()})).then((function(t){Q(e,t)}))},G.getCurFileSymbolId=function(e,t){return ne(t.docId).then((function(e){return e.getCurFileSymbolId()})).then((function(t){Q(e,t)}))},G.getFadeOutBackground=function(e,t){var n=t.docId,r=t.imgBuffer;return ne(n).then((function(e){return e.getFadeOutBackground(r)})).then((function(t){Q(e,t)}))},G.getConvertToMono=function(e,t){var n=t.docId,r=t.imgBuffer;return ne(n).then((function(e){return e.getConvertToMono(r)})).then((function(t){Q(e,t)}))},G.createRootBookmark=function(e,t){return ne(t.docId).then((function(e){return e.createRootBookmark()})).then((function(t){Q(e,t)}))},G.insertBookmark=function(e,t){var n=t.docId,r=t.pbkId,o=t.title,i=t.pageIndex,a=t.top,s=t.left,u=t.relationship;return ne(n).then((function(e){return e.insertBookmark(r,o,i,a,s,u)})).then((function(t){Q(e,t)}))},G.setBookmarkProperty=function(e,t){var n=t.docId,r=t.bkId,o=t.properties;return ne(n).then((function(e){return e.setBookmarkProperty(r,o)})).then((function(t){Q(e,t)}))},G.removeBookmark=function(e,t){var n=t.docId,r=t.bkId;return ne(n).then((function(e){return e.removeBookmark(r)})).then((function(t){Q(e,t)}))},G.getBookmarkDestination=function(e,t){var n=t.docId,r=t.bkId;return ne(n).then((function(e){var t=e.rootBookmark.getBookmarkById(r);if(t)return t.getDestination()})).then((function(t){Q(e,t)}))},G.setBookmarkDestination=function(e,t){var n=t.docId,r=t.bkId,o=t.gotoAction;return ne(n).then((function(e){var t=e.rootBookmark.getBookmarkById(r);if(t)return t.setDestination(o)})).then((function(t){Q(e,t)}))},G.getBookmarkAction=function(e,t){var n=t.docId,r=t.bkId;return ne(n).then((function(e){var t=e.rootBookmark.getBookmarkById(r);if(t)return t.getAction()})).then((function(t){Q(e,t)}))},G.setBookmarkAction=function(e,t){var n=t.docId,r=t.bkId,o=t.action;return ne(n).then((function(e){var t=e.rootBookmark.getBookmarkById(r);if(t)return t.setAction(o)})).then((function(t){Q(e,t)}))},G.moveBookmarkAction=function(e,t){var n=t.docId,r=t.bkId,o=t.action,i=t.direction;return ne(n).then((function(e){var t=e.rootBookmark.getBookmarkById(r);if(t)return t.moveAction(o,i)})).then((function(t){Q(e,t)}))},G.removeBookmarkAction=function(e,t){var n=t.docId,r=t.bkId,o=t.action;return ne(n).then((function(e){var t=e.rootBookmark.getBookmarkById(r);if(t)return t.removeAction(o)})).then((function(t){Q(e,t)}))},G.getTextRectsAtRect=function(e,t){var n=t.docId,r=t.pageId,o=t.rect;return oe(n,r).then((function(e){return e.getTextRectsAtRect(o)})).then((function(t){Q(e,t)}))},G.getTextContinuousRectsAtRect=function(e,t){var n=t.docId,r=t.pageId,o=t.rect;return oe(n,r).then((function(e){return e.getTextContinuousRectsAtRect(o)})).then((function(t){Q(e,t)}))},G.getTextContinuousRectsAtPoints=function(e,t){var n=t.docId,r=t.pageId,o=t.point1,i=t.point2,a=t.tolerance,s=t.start,u=t.end;return oe(n,r).then((function(e){return e.getTextContinuousCharInfoAtPoints(o,i,a,s,u)})).then((function(t){Q(e,t)}))},G.getTextContinuousCharsAtRect=function(e,t){var n=t.docId,r=t.pageId,o=t.rect,i=t.allInRect;return oe(n,r).then((function(e){return e.getTextContinuousCharsAtRect(o,i)})).then((function(t){Q(e,t)}))},G.getDoubleClickTextRectAtPoint=function(e,t){var n=t.docId,r=t.pageId,o=t.doubleClickPoint,i=t.tolerance;return oe(n,r).then((function(e){return e.getDoubleClickTextCharInfoAtPoint(o,i)})).then((function(t){Q(e,t)}))},G.getTextSearch=function(e,t){var n=t.docId,r=t.pageId,o=t.pattern,i=t.flags;return oe(n,r).then((function(e){return e.getTextSearch(o,i)})).then((function(t){var n=t.textSearch,r=t.textPage,o=t.strPattern,i=(0,a.default)("page_text_search");L[i]={textSearch:n,textPage:r,strPattern:o},Q(e,i)}))},G.getAnnotTextSearch=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.pattern,s=t.flags;return oe(n,r).then((function(e){return e.getAnnotTextSearch(o,i,s)})).then((function(t){var n=t.textSearch,r=t.strPattern,o=(0,a.default)("annot_text_search");L[o]={textSearch:n,strPattern:r},Q(e,o)}))},G.textSearchFindNext=function(e,t){var n=t.id,r=L[n];return r?(r=r.textSearch).FindNext()?void Q(e,le(r)):Q(e,null):X(e,null,[],"No text search found!!")},G.textSearchFindPrev=function(e,t){var n=t.id,r=L[n];return r?(r=r.textSearch).FindPrev()?void Q(e,le(r)):Q(e,null):X(e,null,[],"No text search found!!")},G.textSearchDestroy=function(e,t){var n=t.id;try{var r=L[n];r.strPattern.delete(),r.textSearch.delete(),r.textPage.delete(),delete L[n]}catch(e){}finally{Q(e)}},G.registerSecurityCallback=function(e,t){var n=t.type,r=t.options;return I.then((function(e){return e.registerSecurityCallback(n,r)})).then((function(t){Q(e,t)}))},G.setDocOpenAction=function(e,t){var n=t.docId,r=t.type,o=t.params;return ne(n).then((function(e){return e.setOpenAction(r,o)})).then((function(t){Q(e,t)}))},G.setDocActionData=function(e,t){var n=t.docId,r=t.data,o=t.index;return ne(n).then((function(e){return e.action.setActionDataByIndex(r,o)})).then((function(t){Q(e,t.toJson())}))},G.moveCaretRectByCharIndex=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.charIndex;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.moveRectByCharIndex(i)})).then((function(t){Q(e,!0)}))},G.setAnnotIntent=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.intent;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setIntent(i)})).then((function(t){Q(e,t)}))},G.setInkList=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.inkList;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setInkList(i)})).then((function(t){Q(e,t)}))},G.setUserName=function(e,t){var n=t.name;return I.then((function(e){return e.setUserName(n)})).then((function(){Q(e)}))},G.getUserName=function(e){return I.then((function(e){return e.getUserName()})).then((function(t){return Q(e,t)}))},G.flatten=function(e,t){var n=t.docId,r=t.pageId,o=t.option;return oe(n,r).then((function(e){return e.flatten(o)})).then((function(t){t?Q(e,t):X(e)}))},G.setDynamicInfoFormula=function(e,t){var n=t.seperator,r=t.timeFormat;(0,f.default)().setDynamicInfoFormula(n,r),Q(e)},G.updatePageInfo=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.toJson()})).then((function(t){Q(e,t)}))},G.setPageRotation=function(e,t){var n=t.docId,r=t.pageId,o=t.rotation;return oe(n,r).then((function(e){return e.setRotation(o)})).then((function(t){Q(e,t)}))},G.getSecurityType=function(e,t){return ne(t.docId).then((function(e){return e.getSecurityType()})).then((function(t){Q(e,t)}))},G.setCertificateAndPermission=function(e,t){var n=t.docId,r=t.infos,o=t.cipher,i=t.isEncryptMetadata;return ne(n).then((function(e){return e.setCertificateAndPermission(r,o,i)})).then((function(t){Q(e,t)}))},G.setPasswordAndPermission=function(e,t){var n=t.docId,r=t.userPassword,o=t.ownerPassword,i=t.permission,a=t.cipher,s=t.isEncryptMetadata;return ne(n).then((function(e){return e.setPasswordAndPermission(r,o,i,a,s)})).then((function(t){Q(e,t)}))},G.removeSecurity=function(e,t){return ne(t.docId).then((function(e){return e.removeSecurity()})).then((function(t){Q(e,t)}))},G.checkPassword=function(e,t){var n=t.docId,r=t.password;return ne(n).then((function(e){return e.checkPassword(r)})).then((function(t){Q(e,t)}))},G.getPermission=function(e,t){return ne(t.docId).then((function(e){return e.getPermission()})).then((function(t){Q(e,t)}))},G.getStdCipherOptions=function(e,t){return ne(t.docId).then((function(e){return e.getStdCipherOptions()})).then((function(t){Q(e,t)}))},G.addWatermark=function(e,t){var n=t.docId,r=t.pageId,o=t.data;return oe(n,r).then((function(e){return e.addWatermark(o)})).then((function(t){Q(e,t)}))},G.getUserPassword=function(e,t){var n=t.docId,r=t.password;return ne(n).then((function(e){return e.getUserPassword(r)})).then((function(t){Q(e,t)}))},G.getPasswordType=function(e,t){return ne(t.docId).then((function(e){return e.getPasswordType()})).then((function(t){Q(e,t)}))},G.setPasswordType=function(e,t){var n=t.docId,r=t.type;return ne(n).then((function(e){return e.setPasswordType(r)})).then((function(t){Q(e,t)}))},G.movePageTo=function(e,t){var n=t.docId,r=t.pageId,o=t.destIndex;return ne(n).then((function(e){return e.movePageTo(r,o)})).then((function(t){Q(e,t)}))},G.insertPage=function(e,t){var n=t.docId,r=t.pageIndex,o=t.width,i=t.height;return ne(n).then((function(e){return e.insertPage(r,o,i)})).then((function(t){Q(e,t)}))},G.removePage=function(e,t){var n=t.docId,r=t.pageIndex,o=void 0;return ne(n).then((function(e){try{o=e.pageIndexMap[r].id}catch(e){}return e.removePage(r)})).then((function(t){t&&j.clearObjectFromCache(n,o),Q(e,t)}))},G.markRedactAnnot=function(e,t){var n=t.docId,r=t.pageId,o=t.rects,i=t.annot;return oe(n,r).then((function(e){return e.markRedactAnnot(o,i)})).then((function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];o?t[n]=o.toJson():t[n]=null}return t})).then((function(t){Q(e,t)}))},G.applyRedaction=function(e,t){return ne(t.docId).then((function(e){return e.applyRedaction()})).then((function(t){Q(e,t)}))},G.redactApply=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.apply()})).then((function(t){Q(e,t)}))},G.setActionDestination=function(e,t){var n=t.docId,r=t.objNum,o=t.destination;return ne(n).then((function(t){return"number"==typeof o.pageIndex?re(n,o.pageIndex).then((function(t){if(!t.isVirtual)return i();Q(e,null)})):i();function i(){return t.getIndirectObject(r).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.setDestination(o),r}))})).then((function(t){Q(e,t.toJson())}))}}))},G.setActionFieldNames=function(e,t){var n=t.docId,r=t.objNum,o=t.fieldNames;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.setFieldNames(o),r}))})).then((function(t){Q(e,t.toJson())}))},G.setActionHideState=function(e,t){var n=t.docId,r=t.objNum,o=t.isHide;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.setHideState(o),r}))})).then((function(t){Q(e,t.toJson())}))},G.setActionScript=function(e,t){var n=t.docId,r=t.objNum,o=t.script;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.setScript(o),r}))})).then((function(t){Q(e,t.toJson())}))},G.setActionOCGState=function(e,t){t.docId,t.objNum,t.layerIds},G.setActionURI=function(e,t){var n=t.docId,r=t.objNum,o=t.uri;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.setURI(o),r}))})).then((function(t){Q(e,t.toJson())}))},G.setActionFlags=function(e,t){var n=t.docId,r=t.objNum,o=t.flags;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.setFlags(o),r}))})).then((function(t){Q(e,t.toJson())}))},G.insertSubAction=function(e,t){var n=t.docId,r=t.objNum,o=t.index,i=t.type;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.insertSubAction(o,i),r}))})).then((function(t){Q(e,t.toJson())}))},G.setSubAction=function(e,t){var n=t.docId,r=t.objNum,o=t.index,i=t.type;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.setSubAction(o,i),r}))})).then((function(t){Q(e,t.toJson())}))},G.removeAllSubActions=function(e,t){var n=t.docId,r=t.objNum;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.removeAllSubActions(),r}))})).then((function(t){Q(e,t.toJson())}))},G.removeSubAction=function(e,t){var n=t.docId,r=t.objNum,o=t.index;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.removeSubAction(o),r}))})).then((function(t){Q(e,t.toJson())}))},G.setActionData=function(e,t){var n=t.docId,r=t.objNum,o=t.data;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc,r=t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t);return r.setActionData(o),r}))})).then((function(t){Q(e,t.toJson())}))},G.moveAction=function(e,t){var n=t.docId,r=t.pageId,o=t.objNum,i=t.trigger,a=t.actionData,s=t.direction;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.moveAction(i,a,s);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.getActionFileStream=function(e,t){var n=t.docId,r=t.objNum,o=t.writeStream;return ne(n).then((function(e){return e.getIndirectObject(r)})).then((function(e){return I.then((function(t){var n=e.pdfDoc;return t.actionManager.get(t.actionManager.getActionByDict(n,e.getDict()),n,t).getFileSpec().getStream((function(e,t,n){$(o,{arrayBuffer:e,offset:t,size:n},[e])}))}))})).then((function(t){Q(e,t)}))};var fe=function(e){var t=new Error("request error: "+e.statusText);return t.error=e.status,t};function he(e,t,n,r){var o=new XMLHttpRequest;if(o.open(e.type||"GET",e.url||e.url,!1,e.user,e.password),o.responseType="arraybuffer",e.headers){var i=e.headers;for(var a in i)o.setRequestHeader(a,i[a])}if(o.setRequestHeader("Range","bytes="+t+"-"+Math.min(t+n-1,r-1)),o.send(e.data),!(o.status>=200&&o.status<300||304===o.status))throw new Error("request error: "+o.status);return o.response}function pe(e,t,n){setTimeout((function(){try{var r=e.next();if(r.done)return void n(r.value);ee(t,r.value),pe(e,t,n)}catch(e){ee(t,-1),n(e.status)}}))}function me(e,t){ne(t.docId).then((function(e){return e.getPDFDictInfo()})).then((function(t){return Q(e,t)}))}function ge(e,t){var n=t.docId,r=t.pageId,o=t.objects;oe(n,r).then((function(e){return e.addAnnotObjects(o)})).then((function(t){return Q(e,t.map((function(e){return e.toJson()})))}))}G.getPDFDocIdByHttpRangeRequest=function(e,t){var n=t.size,o=t.range,a=void 0===o?{}:o,s=void 0,u=void 0,c=void 0;if(n)u=Promise.resolve(n),s=Promise.resolve({});else{var d=(0,i.default)();u=d.promise;var l=(0,i.default)();s=l.promise;!function e(){var t=new XMLHttpRequest;if(t.open(a.type||"GET",a.url||a.url,!0,a.user,a.password),t.responseType="arraybuffer",a.headers){var n=a.headers;for(var r in n)t.setRequestHeader(r,n[r])}void 0===a.firstRequestStatus&&t.setRequestHeader("Range","bytes=0-1"),t.onreadystatechange=function(){if(4===t.readyState)if(t.status>=200&&t.status<300||304===t.status){try{var n=void 0;a.extendOptions&&(n=t.getResponseHeader(a.extendOptions))?l.resolve(JSON.parse(atob(n))):l.resolve({})}catch(e){l.resolve({})}var r=t.getAllResponseHeaders();if(r){var o=r.trim().split(/[\r\n]+/),i={};o.forEach((function(e){var t=e.split(": "),n=t.shift(),r=t.join(": ");i[n]=r}));var s=i["content-range"]||i["Content-Range"],u=void 0;s&&-1!==(u=s.lastIndexOf("/"))?d.resolve(+s.slice(u+1)):t.response instanceof ArrayBuffer?(c=t.response,d.resolve(c.byteLength)):(w.default.getLogger("[JR-Worker]").error("The response header which names 'Content-Range' cannot be obtained. Please confirm whether the HTTP server response is correct. If it is a cross-domain request, please check whether the value of 'Access-Control-Expose-Headers' contains 'Content-Range'"),d.reject(fe(t)))}else d.reject(fe(t))}else 0===t.status&&void 0===a.firstRequestStatus?(a.firstRequestStatus=t.status,e()):d.reject(fe(t))},t.send(a.data)}()}return Promise.all([u,I,s]).then((function(e){var t=r(e,3),n=t[0],o=t[1],i=t[2],s=n;if(c){var u=de(c);return o.getPDFDoc({size:s,getBuffer:function(e,t){return u.read(e,t)},initOpenOptions:i,destroyCallback:function(){u.destroy()},docId:a.docId})}return o.getPDFDoc({size:n,getBuffer:function(e,t){return function(e,t,n,r){for(var o=e.url,i=e.id||o,a=U[i]=U[i]||{buffers:[]},s=+(e.chunkSize||131072),u=Math.floor(t/s),c=Math.floor((t+n)/s),d=a.buffers,l=u,f=c;l<=f;l++)d[l]||(d[l]=he(e,l*s,s,r));if(u===c){var h=d[u],p=t-u*s;return h.slice?h.slice(p,p+n):new Uint8Array(h,p,n).buffer}var m=new Uint8Array(n),g=d[u],y=t-u*s;m.set(new Uint8Array(g,y));for(var _=s-y,v=u+1,b=c-1;v<=b;v++)g=d[v],m.set(new Uint8Array(g),_),_+=s;return g=d[c],m.set(new Uint8Array(g,0,(t+n)%s),_),m.buffer}(a,e,t,s)},initOpenOptions:i,docId:a.docId})})).then((function(e){return c?e.setOriginalStream(c):e.setOriginalStream(a),z[e.id]=a.id||a.url,e.id})).then((function(t){Q(e,t)}))},G.setPopupOpenStatus=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.status;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.setOpenStatus(i)})).then((function(t){Q(e,t)}))},G.removePageAllAnnot=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.removeAllAnnot()})).then((function(){Q(e)}))},G.getAnnotWoff=function(e,t){var n=t.docId,r=t.pageId,o=t.id;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){return e.getWoff()})).then((function(t){Q(e,t)}))},G.drmEncrypt=function(e,t){var n=t.docId,r=t.options;return ne(n).then((function(e){return e.drmEncrypt(r)})).then((function(t){return t?Q(e):X(e,{error:-1})}))},G.getTemplates=function(e,t){return ne(t.docId).then((function(e){return e.getTemplates()})).then((function(t){return Q(e,t)}))},G.hideTemplate=function(e,t){var n=t.docId,r=t.templateObj,o=t.isHidden;return ne(n).then((function(e){return e.hideTemplate(r,o)})).then((function(t){return Q(e,t)}))},G.spawnPage=function(e,t){var n=t.docId,r=t.templateObj,o=t.nPage,i=t.bRename,a=t.bOverlay;return ne(n).then((function(e){return e.spawnPage(n,r,o,i,a)})).then((function(t){return Q(e,t)}))},G.removeTemplate=function(e,t){var n=t.docId,r=t.name;return ne(n).then((function(e){return e.removeTemplate(r)})).then((function(t){return Q(e,t)}))},G.getFontBufferByName=function(e,t){var n=t.docId,r=t.fontName;return ne(n).then((function(e){return e.getFontBufferByName(r)})).then((function(t){return Q(e,t)}))},G.getPageSizes=function(e,t){var n=t.docId,r=t.index,o=t.count;return ne(n).then((function(e){return e.getPageSizes(r,o)})).then((function(t){return Q(e,t)}))},G.setMeasureRatio=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.ratioInfo;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setMeasureRatio(i)})).then((function(){Q(e)}))},G.setMeasureUnit=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.unit;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setMeasureUnit(i)})).then((function(){Q(e)}))},G.setMeasureConversionFactor=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.factor;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){e.setMeasureConversionFactor(i)})).then((function(){Q(e)}))},G.startImportPages=function(e,t){var n=t.docId,r=t.destIndex,o=t.file,i=t.password,a=t.flags,s=t.layerName,u=t.startIndex,c=t.endIndex;return ne(n).then((function(e){var t=ue(o),n=ce(o);return e.startImportPages(r,{size:t,getBuffer:function(e,t){return n(e,t)}},i,a,s,u,c)})).then((function(t){return Q(e,t)}))},G.importPagesFromPDFDocs=function(e,t){var n=t.docId,r=t.destIndex,o=t.srcDocs,i=t.layerName;return ne(n).then((function(e){return Promise.all(o.map((function(e){var t=e.srcDocId,n=e.srcPages;return ne(t).then((function(e){return{srcDoc:e,srcPages:n}}))}))).then((function(t){return e.importPagesFromPDFDocs(r,t,i)}))})).then((function(t){return Q(e,t)}))},G.exportPagesToPDFDocs=function(e,t){var n=t.docId,r=t.srcPages,o=t.destDocs,i=t.layerName,a=t.bookmarkTitle;return ne(n).then((function(e){return Promise.all(o.map((function(e){var t=e.destDocId,n=e.destIndex;return ne(t).then((function(e){return{destDoc:e,destIndex:n}}))}))).then((function(t){return e.exportPagesToPDFDocs(r,t,i,a)}))})).then((function(t){return Q(e,t.map((function(e){var t=e.doc,n=e.name;return{docId:t?t.id:null,name:n}})))}))},G.extractPages=function(e,t){var n=t.docId,r=t.pageRange,o=t.writeStream,i=t.file,a=t.password;return ne(n).then((function(e){var t=void 0;if(i){var n=ue(i),s=ce(i);t={size:n,getBuffer:function(e,t){return s(e,t)}}}return e.extractPages(r,{writeStream:function(e,t,n){$(o,{arrayBuffer:e,offset:t,size:n},[e])}},t,a)})).then((function(t){return H.push(n,o),Q(e,t)}))},G.copyPages=function(e,t){var n=t.docId,r=t.pageRange,o=t.destIndex;return ne(n).then((function(e){return e.copyPages(r,o)})).then((function(t){return Q(e,t)}))},G.saveCopyPagesData=function(e,t){var n=t.docId,r=t.pageRange;return ne(n).then((function(e){return e.saveCopyPagesData(r)})).then((function(t){Q(e,t)}))},G.pastePages=function(e,t){var n=t.docId,r=t.destIndex;return ne(n).then((function(e){return e.pastePages(r)})).then((function(t){Q(e,t)})).catch((function(t){return X(e,t)}))},G.embedAllPageThumbnail=function(e,t){return ne(t.docId).then((function(t){pe(t.embedAllPageThumbnail(),"embeddingProgress",Q.bind(null,e))}))},G.removeEmbeddedPageThumbnail=function(e,t){return ne(t.docId).then((function(t){pe(t.removeEmbeddedPageThumbnail(),"removingProgress",Q.bind(null,e))}))},G.cancelEmbedAllPageThumbnail=function(e,t){return ne(t.docId).then((function(e){return e.cancelEmbedAllPageThumbnail()})).then((function(t){Q(e,t)}))},G.cancelRemoveEmbeddedPageThumbnail=function(e,t){return ne(t.docId).then((function(e){return e.cancelRemoveEmbeddedPageThumbnail()})).then((function(t){Q(e,t)}))},G.getAllBoxes=function(e,t){var n=t.docId,r=t.index;return ne(n).then((function(e){return e.getAllBoxes(r)})).then((function(t){return Q(e,t)}))},G.setAllBoxesByIndexes=function(e,t){var n=t.docId,r=t.indexes,o=t.width,i=t.height,a=t.xOffset,s=t.yOffset,u=t.boxes,c=t.isMoveWhite;return ne(n).then((function(e){return e.setAllBoxesByIndexes(r,o,i,a,s,u,c)})).then((function(t){return Q(e,t)}))},G.getPageFormat=function(e,t){var n,r=this,o=t.docId,i=t.type,a=t.previewWidth,s=t.previewHeight,u=t.fileName,c=void 0===u?"":u,d=t.newDocId,l=void 0===d?"":d,f=t.localFormat,h=void 0===f?void 0:f;return ne(o).then((n=D(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=void 0,!(l.length>1)){e.next=6;break}return e.next=4,ne(l);case 4:n=(n=e.sent).doc;case 6:return e.abrupt("return",t.getPageFormat(i,a,s,c,n,h));case 7:case"end":return e.stop()}}),e,r)}))),function(e){return n.apply(this,arguments)})).then((function(t){return Q(e,t)}))},G.addPageFormat=function(e,t){var n,r=this,o=t.docId,i=t.type,a=t.data,s=t.isUpdate;return ne(o).then((n=D(regeneratorRuntime.mark((function e(t){var n,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a&&a.sourceDoc&&a.sourceDoc.docId&&"currentDoc"!==a.sourceDoc.docId)){e.next=5;break}return e.next=3,ne(a.sourceDoc.docId);case 3:n=e.sent,a.sourceDoc.newDoc=n.doc;case 5:if(!a||2!==a.sourceType){e.next=19;break}if(!a.file){e.next=13;break}o=ue(a.file),u=ce(a.file),a.file={size:o,getBuffer:function(e,t){return u(e,t)}},a.doc=null,e.next=19;break;case 13:if(!a.docId){e.next=19;break}return e.next=16,ne(a.docId);case 16:c=e.sent,a.doc=c,a.file=null;case 19:return e.abrupt("return",t.addPageFormat(i,a,s));case 20:case"end":return e.stop()}}),e,r)}))),function(e){return n.apply(this,arguments)})).then((function(t){return Q(e,t)}))},G.getPageFormatThumb=function(e,t){var n,r=this,o=t.docId,i=t.type,a=t.pageIndex,s=t.data,u=t.isUpdate,c=t.bitmapWidth,d=t.bitmapHeight,l=t.rotate;return ne(o).then((n=D(regeneratorRuntime.mark((function e(t){var n,o,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!s||2!==s.sourceType){e.next=14;break}if(!s.file){e.next=8;break}n=ue(s.file),o=ce(s.file),s.file={size:n,getBuffer:function(e,t){return o(e,t)}},s.doc=null,e.next=14;break;case 8:if(!s.docId){e.next=14;break}return e.next=11,ne(s.docId);case 11:f=e.sent,s.doc=f,s.file=null;case 14:return e.abrupt("return",t.getPageFormatThumb(i,a,s,u,c,d,l));case 15:case"end":return e.stop()}}),e,r)}))),function(e){return n.apply(this,arguments)})).then((function(t){return Q(e,t)}))},G.removeAllPageFormat=function(e,t){var n=t.docId,r=t.type;return ne(n).then((function(e){return e.removeAllPageFormat(r)})).then((function(t){return Q(e,t)}))},G.extractPrintPages=function(e,t){var n,r=this,o=t.docId,i=t.data;return ne(o).then((n=D(regeneratorRuntime.mark((function e(t){var n,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("selectedPDF"!==i.rangeType&&"allPDF"!==i.rangeType){e.next=20;break}if(n=[],"allPDF"!==i.rangeType){e.next=8;break}return e.next=5,t.pdfPortfolio.getFolioNodePDFDoc();case 5:n=e.sent,e.next=9;break;case 8:"selectedPDF"===i.rangeType&&(n=i.selectedIds);case 9:o=[],a=0;case 11:if(!(a<n.length)){e.next=19;break}return e.next=14,ne(n[a]);case 14:s=e.sent,o.push(s);case 16:a++,e.next=11;break;case 19:i.docs=o;case 20:return e.abrupt("return",t.extractPrintPages(i));case 21:case"end":return e.stop()}}),e,r)}))),function(e){return n.apply(this,arguments)})).then((function(t){return Q(e,t)}))},G.encryptLicense=function(e,t){return I.then((function(n){return t=n.encryptLicense(t),Q(e,t)}))},G.getHeaderFooter=function(e,t){return ne(t).then((function(e){return e.getHeaderFooter()})).then((function(t){return Q(e,t)}))},G.addHeaderFooter=function(e,t){var n=t.docId,r=t.headerFooter;return ne(n).then((function(e){return e.addHeaderFooter(r)})).then((function(t){return Q(e,t)}),(function(t){return X(e,t,[],t)}))},G.updateHeaderFooter=function(e,t){var n=t.docId,r=t.headerFooter;return ne(n).then((function(e){return e.updateHeaderFooter(r)})).then((function(t){return Q(e,t)}),(function(t){return X(e,t,[],t)}))},G.removeHeaderFooter=function(e,t){return ne(t).then((function(e){return e.removeHeaderFooter()})).then((function(t){return Q(e,t)}))},G.setFontMap=function(e,t){return I.then((function(n){return n.setFontMap(t),Q(e)}),(function(){return X(e)}))},G.addFontMap=function(e,t){return I.then((function(n){return n.addFontMap(t),Q(e)}),(function(){return X(e)}))},G.setWatermarkFontMap=function(e,t){return I.then((function(n){return n.setWatermarkFontMap(t),Q(e)}))},G.paste=function(e,t){var n=t.docId,o=t.pageId,i=t.srcPageId,a=t.type,s=t.objectId,u=t.position;switch(a){case"annot":return Promise.all([oe(n,o),oe(n,i)]).then((function(e){var t=r(e,2),n=t[0],o=t[1],i=o._getAnnotIndexById(s),a=o.page.GetAnnot(i);return n.pasteAnnot(a,u)})).then((function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];o?t[n]=o.toJson():t[n]=null}return t})).then((function(t){return Q(e,t)}));case"graphicObject":return Promise.all([oe(n,o),oe(n,i)]).then((function(t){var o=r(t,2),i=o[0],a=o[1];return G.pasteGraphicObject(e,n,i,a,s,u)})).then((function(e){}))}},G.getAnnotsRawData=function(e,t){var n=t.docId,r=t.rawAnnots;return ne(n).then((function(e){return e.getAnnotsRawData(r)})).then((function(t){return Q(e,t)}))},G.attachFile=function(e,t){var n=t.docId,r=t.blob;return ne(n).then((function(e){return e.attachFile(r)})).then((function(t){return Q(e,t)}))},G.signDoc=function(e,t){var n=t.docId,r=t.signInfo;ne(n).then((function(e){return e.sign(r)})).then((function(t){return Q(e,t,[t.buffer])}))},G.getFontsInfo=function(e,t){ne(t.docId).then((function(e){return e.getFontsInfo()})).then((function(t){return Q(e,t)}))},G.getDocAdditionalActions=function(e,t){ne(t.docId).then((function(e){return e.getAdditionalActions()})).then((function(t){return Q(e,t)}))},G.calcPageContentBBox=function(e,t){var n=t.docId,r=t.pageIndex,o=t.mode;re(n,r).then((function(e){return e.calcContentBBox(o)})).then((function(t){Q(e,t)}))},G.getPageBox=function(e,t){var n=t.docId,r=t.pageIndex,o=t.boxType;re(n,r).then((function(t){return Q(e,t.getBox(o))}))},G.setPageBox=function(e,t){var n=t.docId,r=t.pageIndex,o=t.boxType,i=t.rect;re(n,r).then((function(t){return Q(e,t.setBox(o,i))}))},G.setPageSize=function(e,t){var n=t.docId,r=t.pageIndex,o=t.width,i=t.height;re(n,r).then((function(t){return Q(e,t.setSize(o,i))}))},G.getPageAction=function(e,t){var n=t.docId,r=t.pageId,o=t.trigger;return oe(n,r).then((function(e){return e.getAction(o)})).then((function(t){Q(e,t)}))},G.removePageAction=function(e,t){var n=t.docId,r=t.pageId,o=t.trigger,i=t.action;return oe(n,r).then((function(e){return e.removeAction(o,i)})).then((function(t){Q(e,t)}))},G.movePageAction=function(e,t){var n=t.docId,r=t.pageId,o=t.trigger,i=t.action,a=t.direction;return oe(n,r).then((function(e){return e.moveAction(o,i,a)})).then((function(t){Q(e,t)}))},G.setPageAction=function(e,t){var n=t.docId,r=t.pageId,o=t.trigger,i=t.action;oe(n,r).then((function(e){return e.setAction(o,i)})).then((function(){Q(e,i)}))},G.syncDataCache=function(e,t){var n=t.docId,r=t.pageIdMap;ne(n).then((function(e){return e.syncDataCache(r)})).then((function(){return Q(e)}))},G.moveAnnotsToPage=function(e,t){var n=t.docId,r=t.srcPageId,o=t.dstPageId,i=t.annotInfos;return ne(n).then((function(e){return e.moveAnnotsToPage(r,o,i)})).then((function(e){return e.map((function(e){return e&&e.toJson()}))})).then((function(t){Q(e,t)}))},G.getOriginalStream=function(e,t){ne(t.docId).then((function(e){return e.getOriginalStream()})).then((function(t){return Q(e,t,[t])}))},G.setDocColors=function(e,t){var n=t.docId,r=t.colors;ne(n).then((function(t){return t.setColors(r),Q(e)}))},G.setPageDisplayPreferences=function(e,t){var n=t.docId,r=t.pageDisplayPreferences;ne(n).then((function(t){return t.setPageDisplayPreferences(r),Q(e)}))},G.getWidgetMkOption=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){var n=t.getWidgetMkOption();Q(e,n)}))},G.setWidgetIconCaptionRelation=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.relation;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){t.setWidgetIconCaptionRelation(i),Q(e)}))},G.setWidgetHighlighting=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.mode;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){t.setWidgetHighlighting(i),Q(e)}))},G.setWidgetMkCaption=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.position,a=t.caption;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){var n=t.setWidgetMkCaption(i,a);Q(e,n)}))},G.setWidgetMkIcon=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.position,a=t.buffer;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){var n=t.setWidgetMkIcon(i,a);Q(e,n)}))},G.getWidgetIconFitOption=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){var n=t.getWidgetIconFitOption();Q(e,n)}))},G.setWidgetIconFitOption=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.option;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){var n=t.setWidgetIconFitOption(i);Q(e,n)}))},G.setTabOrder=function(e,t){var n=t.docId,r=t.pageIndex,o=t.type;ne(n).then((function(e){return e.setTabOrder(r,o)})).then((function(t){return Q(e,t)}))},G.getTabOrder=function(e,t){var n=t.docId,r=t.pageIndex;ne(n).then((function(e){return e.getTabOrder(r)})).then((function(t){return Q(e,t)}))},G.setStructureOrder=function(e,t){var n=t.docId,r=t.pageIndex,o=t.idList;ne(n).then((function(e){return e.setStructureOrder(r,o)})).then((function(){return Q(e)}))},G.getAnnotIdArrayByOrder=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.getAnnotIdArrayByOrder()})).then((function(t){return Q(e,t)}))},G.renderTemplatesByObjNum=function(e,t){var n=t.docId,r=t.objNum;return ne(n).then((function(t){Q(e,t.renderTemplatesByObjNum(r))}))},G.getNameTree=function(e,t){var n=t.docId,r=t.type;return ne(n).then((function(t){Q(e,t.getNameTree(r))}))},G.addNameTreeObj=function(e,t){var n=t.docId,r=t.type,o=t.name,i=t.objNum;return ne(n).then((function(t){Q(e,t.addNameTreeObj(r,o,i))}))},G.removeNameTreeObj=function(e,t){var n=t.docId,r=t.type,o=t.name;return ne(n).then((function(t){Q(e,t.removeNameTreeObj(r,o))}))},G.replaceNameTreeObj=function(e,t){var n=t.docId,r=t.type,o=t.name,i=t.objNum;return ne(n).then((function(t){Q(e,t.replaceNameTreeObj(r,o,i))}))},G.renameNameTreeObj=function(e,t){var n=t.docId,r=t.type,o=t.oldName,i=t.newName;return ne(n).then((function(t){Q(e,t.renameNameTreeObj(r,o,i))}))},G.getPageIndexByObjNum=function(e,t){var n=t.docId,r=t.objNum;return ne(n).then((function(t){Q(e,t.getPageIndexByObjNum(r))}))},G.nameTreeTemplatesToPages=function(e,t){var n=t.docId,r=t.name;return ne(n).then((function(t){Q(e,t.nameTreeTemplatesToPages(r))}))},G.nameTreePagesToTemplates=function(e,t){var n=t.docId,r=t.name;return ne(n).then((function(t){Q(e,t.nameTreePagesToTemplates(r))}))},G.showNameTreePageAtTheEnd=function(e,t){return ne(t.docId).then((function(e){return e.showNameTreePageAtTheEnd()})).then((function(t){Q(e,t)}))},G.hideNameTreePage=function(e,t){var n=t.docId,r=t.pageIndex;return ne(n).then((function(t){Q(e,t.hideNameTreePage(r))}))},G.addFileSpec=function(e,t){var n=t.docId,r=t.fileName,o=t.fileBuffer,i=t.modifiedDateTime;return ne(n).then((function(t){Q(e,t.addFileSpec(r,o,i))}))},G.setFileSpecDesc=function(e,t){var n=t.docId,r=t.desc,o=t.objNum;return ne(n).then((function(t){Q(e,t.setFileSpecDesc(r,o))}))},G.getFileSpecStream=function(e,t){var n=t.docId,r=t.fileSpecObjNum,o=t.writeStreamCall;return ne(n).then((function(e){return e.getFileSpecStream(r,(function(e,t,n){$(o,{arrayBuffer:e,offset:t,size:n},[e])}))})).then((function(t){Q(e,t)}))},G.addEmbeddedFileByAttachments=function(e,t){var n=t.docId,r=t.name,o=t.objNum;return ne(n).then((function(t){Q(e,t.attachments.addEmbeddedFile(r,o))}))},G.setEmbeddedFileByAttachments=function(e,t){var n=t.docId,r=t.name,o=t.objNum;return ne(n).then((function(t){Q(e,t.attachments.setEmbeddedFile(r,o))}))},G.removeEmbeddedFileByAttachments=function(e,t){var n=t.docId,r=t.name;return ne(n).then((function(t){Q(e,t.attachments.removeEmbeddedFile(r))}))},G.getPageDictionary=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.getPageDictionary()})).then((function(t){return Q(e,t)}))},G.getSuggestedFormDesignerRect=function(e,t){var n=t.docId,r=t.pageId,o=t.point;return oe(n,r).then((function(e){return e.getSuggestedFormDesignerRect(o)})).then((function(t){return Q(e,t)}))},G.clearDesignerAssitCache=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e&&e.clearDesignerAssitCache()})).then((function(t){return Q(e)}))},G.getPDFDictInfo=me,G.startFormDesignerAssit=function(e,t){ne(t.docId).then((function(e){return e.startFormDesignerAssit()})).then((function(t){return Q(e)}))},G.stopFormDesignerAssit=function(e,t){ne(t.docId).then((function(e){return e.stopFormDesignerAssit()})).then((function(t){return Q(e)}))},G.getPDFDictInfo=me,G.getPageLabels=function(e,t){var n=t.docId,r=t.indexes;ne(n).then((function(e){return e.getPageLabels(r)})).then((function(t){return Q(e,t)}))},G.hasKey=function(e,t){var n=t.docId,r=t.id,o=t.key;ne(n).then((function(e){return e.hasKey(r,o)})).then((function(t){return Q(e,t)}))},G.setAt=function(e,t){var n=t.docId,r=t.id,o=t.key,i=t.value;ne(n).then((function(e){return e.setAt(r,o,i)})).then((function(t){return Q(e,t)}))},G.getAt=function(e,t){var n=t.docId,r=t.id,o=t.key;ne(n).then((function(e){return e.getAt(r,o)})).then((function(t){return Q(e,t)}))},G.setJPXDownSample=function(e,t){return I.then((function(n){return n.setJPXDownSample(t),Q(e)}),(function(){return X(e)}))},G.autoRecognitionForm=function(e,t){ne(t.docId).then((function(e){return e.autoRecognitionForm()})).then((function(t){return Q(e,t)}))},G.isStaticXFA=function(e,t){return ne(t.docId).then((function(e){return e.isStaticXFA()})).then((function(t){return Q(e,t)}))},G.isXFA=function(e,t){return ne(t.docId).then((function(e){return e.isXFA()})).then((function(t){Q(e,t)}))},G.removeXFA=function(e,t){return ne(t.docId).then((function(e){return e.removeXFA()})).then((function(t){return Q(e,t)}))},G.createWebLinks=function(e,t){var n=t.docId,r=t.pageId,o=t.paramPages;return oe(n,r).then((function(e){return e.createWebLinks(o)})).then((function(t){return Q(e,t)}))},G.removeWebLinks=function(e,t){var n=t.docId,r=t.pageId,o=t.paramPages;return oe(n,r).then((function(e){return e.removeWebLinks(o)})).then((function(t){Q(e,t)}))},G.linkHasPA=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){Q(e,t.hasPA())}))},G.linkResetAByPA=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(t){Q(e,t.resetAByPA())}))},G.getDestinationsArray=function(e,t){return ne(t.docId).then((function(e){return e.getDestinationsArray()})).then((function(t){Q(e,t)}))},G.deleteDestination=function(e,t){var n=t.docId,r=t.pageId,o=t.name;return oe(n,r).then((function(e){return e.deleteDestination(o)})).then((function(t){Q(e,t)}))},G.renameDestination=function(e,t){var n=t.docId,r=t.pageId,o=t.oldName,i=t.newName;return oe(n,r).then((function(t){var n=t.renameDestination(o,i);Q(e,n)}))},G.createDestination=function(e,t){var n=t.docId,r=t.pageId,o=t.title,i=t.pageNum;return oe(n,r).then((function(t){var n=t.createDestination(o,i);Q(e,n)}))},G.resetDestination=function(e,t){var n=t.docId,r=t.pageId,o=t.title,i=t.pageNum;return oe(n,r).then((function(e){return e.resetDestination(o,i)})).then((function(t){Q(e,t)}))},G.moveBookmark=function(e,t){var n=t.docId,r=t.targetBookmarkId,o=t.destBookmarkId,i=t.position;return ne(n).then((function(e){return e.moveBookmark(r,o,i)})).then((function(t){return Q(e,t)}))},G.combineFormsToCSV=function(e,t){var n=t.filesArray,r=t.writeStreamCall;return I.then((function(e){var t=e.engine,o=0,a=(0,i.default)(),s=new t.FormFileInfoArray;n.forEach((function(e){var n=e.file,r=e.name,o=de(n),i=t.ReaderCallback.implement({Release:function(){},GetSize:function(){return o.size},ReadBlock:function(e,n,r){var i=new Uint8Array(function(e,t){return o.read(e,t)}(n,r));return t.HEAPU8.set(i,e),!0}}),a=new t.FormFileInfo(i,(0,g.CWString)(t,""),(0,g.CWString)(t,r));s.Add(a)}));var u=t.StreamCallback.implement({Release:function(){u.delete()},Flush:function(){return a.resolve(o),!0},IsEOF:function(){return!1},GetPosition:function(){return o},GetSize:function(){return o},WriteBlock:function(e,n,i){o+=i;var a=t.HEAPU8.buffer;return function(e,t,n){$(r,{arrayBuffer:e,offset:t,size:n},[e])}(a.slice?a.slice(e,e+i):new Uint8Array(a,e,i).buffer,n,i),!0},ReadBlock:function(e,t,n){return!0}});return t.FormCombination.CombineFormsToCSV(s,u,!1),s.delete(),a.promise})).then((function(t){Q(e,t)}))},G.reversePages=function(e,t){var n=t.docId,r=t.pageRanges;return ne(n).then((function(e){return e.reversePages(r)})).then((function(t){return Q(e,t)}))},G.movePagesTo=function(e,t){var n=t.docId,r=t.pageRange,o=t.destIndex;return ne(n).then((function(e){return e.movePagesTo(r,o)})).then((function(t){Q(e,t)}))},G.removePages=function(e,t){var n=t.docId,r=t.pageRange,o=void 0;return ne(n).then((function(e){try{var t=(0,b.default)(r).sort((function(e,t){return t-e}));o=t.map((function(t){return e.pageIndexMap[t]&&e.pageIndexMap[t].id}))}catch(e){}return e.removePages(r)})).then((function(t){try{o&&t&&o.forEach((function(e){j.clearObjectFromCache(n,e)}))}catch(e){}Q(e,t)}))},G.insertBlankPages=function(e,t){var n=t.docId,r=t.pageRange,o=t.width,i=t.height;return ne(n).then((function(e){return e.insertBlankPages(r,o,i)})).then((function(t){Q(e,t)}))},G.insertBlankPages2=function(e,t){var n=t.docId,r=t.pageRange,o=t.width,i=t.height;return ne(n).then((function(e){return e.insertBlankPages2(r,o,i)})).then((function(t){Q(e,t)}))},G.rotatePages=function(e,t){var n=t.docId,r=t.pageRange,o=t.rotation;return ne(n).then((function(e){return e.rotatePages(r,o)})).then((function(t){Q(e,t)}))},G.getPageIndexByLabelText=function(e,t){var n=t.docId,r=t.text;return ne(n).then((function(e){return y.getPageIndexByLabelText(e,r)})).then((function(t){Q(e,t)}))},G.getCurrentPageLabelInfo=function(e,t){var n=t.docId,r=t.pageIndex;return ne(n).then((function(e){return y.getCurrentPageLabelInfo(e,r)})).then((function(t){Q(e,t)}))},G.checkDocIsUseLogicPage=function(e,t){return ne(t.docId).then((function(e){return y.checkDocIsUseLogicPage(e)})).then((function(t){Q(e,t)}))},G.formatPageNumbers=function(e,t){var n=t.docId,r=t.isExtendNumbering,o=t.pageRange,i=t.numberingInfo;return ne(n).then((function(e){return y.formatPageNumbers(e,r,o,i)})).then((function(t){Q(e,t)}))},G.updatePageLabelsByAction=function(e,t){var n=t.docId,r=t.action,o=t.args;return ne(n).then((function(e){var t;return(t=y.UpdatePageLabels)[r].apply(t,[e].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(o)))})).then((function(t){Q(e,t)}))},G.getPortfolioTreeNode=function(e,t){return ne(t.docId).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.getTreeNode()})).then((function(t){return Q(e,t)}))},G.getPortfolioInitialNodePath=function(e,t){return ne(t.docId).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.getInitialNodePath()})).then((function(t){return Q(e,t)}))},G.sendSortFolioParam=function(e,t){var n=t.docId,r=t.target,o=t.order;return ne(n).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.sendSortFolioParam(r,o)})).then((function(t){return Q(e,t)}))},G.recordPDFFileByPortFolioNode=function(e,t){var n=t.docId,r=t.handle;return ne(n).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.recordPDFFileByPortFolioNode(r)})).then((function(t){return Q(e,t)}))},G.getFolioNodePDFDoc=function(e,t){return ne(t.docId).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.getFolioNodePDFDoc()})).then((function(t){return Q(e,t)}))},G.getPortfolioFileStream=function(e,t){var n=t.docId,r=t.nodeHandle,o=t.writeStream;return ne(n).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.getFileStream(r,{writeStream:function(e,t,n){$(o,{arrayBuffer:e,offset:t,size:n},[e])}})})).then((function(t){Q(e,t)}))},G.getPortfolioStream=function(e,t){var n=t.docId,r=t.nodeHandles;return ne(n).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.getStream(r)})).then((function(t){Q(e,t)}))},G.getPortfolioSubNodes=function(e,t){var n=t.docId,r=t.nodeHandle;return ne(n).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.getPortfolioSubNodes(r)})).then((function(t){Q(e,t)}))},G.changePortfolioSubNodesOrder=function(e,t){var n=t.docId,r=t.nodeHandle,o=t.sourceIndexes,i=t.targetIndex;return ne(n).then((function(e){e.pdfPortfolio&&e.pdfPortfolio.changeSubNodesOrder(r,o,i)})).then((function(){Q(e)}))},G.portfolioMoveSubNodeToSubFolderNode=function(e,t){var n=t.docId,r=t.nodeHandle,o=t.sourceHandles,i=t.targetHandle;return ne(n).then((function(e){e.pdfPortfolio&&e.pdfPortfolio.moveSubNodeToSubFolderNode(r,o,i)})).then((function(){Q(e)}))},G.portfolioHasSameNameSubNode=function(e,t){var n=t.docId,r=t.name,o=t.type,i=t.targetHandle;return ne(n).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.hasSameNameSubNode(r,o,i)})).then((function(t){Q(e,t)}))},G.getPortfolioInfo=function(e,t){return ne(t.docId).then((function(t){var n=t.pdfPortfolio?t.pdfPortfolio.getInfo():{};Q(e,n)}))},G.setPortfolioInfo=function(e,t){var n=t.docId,r=t.info;return ne(n).then((function(t){t.pdfPortfolio&&t.pdfPortfolio.setInfo(r),Q(e)}))},G.portfolioAddFiles=function(e,t){var n=t.docId,r=t.files,o=t.targetIndex,i=t.folderNodeHandle;return ne(n).then((function(t){t.pdfPortfolio&&t.pdfPortfolio.addFiles(r,o,i),Q(e)}))},G.portfolioCreateFolder=function(e,t){var n=t.docId,r=t.name,o=t.folderNodeHandle;return ne(n).then((function(t){var n=t.pdfPortfolio?t.pdfPortfolio.createFolder(r,o):{};Q(e,n)}))},G.portfolioRemoveSubNodes=function(e,t){var n=t.docId,r=t.folderNodeHandle,o=t.subNodeHandles;return ne(n).then((function(t){t.pdfPortfolio&&t.pdfPortfolio.removeSubNodes(r,o),Q(e)}))},G.portfolioRegenerateTOC=function(e,t){var n=t.docId,r=t.title;return ne(n).then((function(e){return e.pdfPortfolio&&e.pdfPortfolio.regenerateTOC(r)})).then((function(t){Q(e,t)}))},G.getSnappedPoint=function(e,t){var n=t.docId,r=t.pageId,o=t.point,i=t.mode;return oe(n,r).then((function(e){return e.getSnappedPoint(o,i)})).then((function(t){Q(e,t)}))},G.getPageTextRectCount=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.getTextRectCount()})).then((function(t){return Q(e,t),t}))},G.getPageTextByRectIndex=function(e,t){var n=t.docId,r=t.pageId,o=t.rectIndex;return oe(n,r).then((function(e){return e.getTextByRectIndex(o)})).then((function(t){return Q(e,t),t}))},G.isCPDF=function(e,t){return ne(t.docId).then((function(t){return Q(e,t.isCPDF())}))},G.getDocURI=function(e,t){return ne(t.docId).then((function(t){return Q(e,t.getDocURI())}))},G.convertToCPDF=function(e,t){var n=t.docId,r=t.cPDFFileName,o=t.cPDFEndPoint,i=t.cPDFUserToken,a=t.cPDFUserIDFromToken;return ne(n).then((function(t){return t.convertToCPDF(r,o,i,a).then((function(){return Q(e)}))}))},G.removeCDocId=function(e,t){var n=t.docId,r=t.cPDFFileName,o=t.cPDFEndPoint,i=t.cPDFUserToken,a=t.cPDFUserIDFromToken;return console.log(e),ne(n).then((function(t){return t.removeCDocId(r,o,i,a).then((function(){return Q(e)}))}))},G.removeLayerNode=function(e,t){var n=t.docId,r=t.layerId;return ne(n).then((function(e){return!!e.pdfLayer&&e.pdfLayer.removeLayerNode(r,e)})).then((function(t){return Q(e,t)}))},G.getLayersByPage=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.pdfDoc.pdfLayer.getLayersByPage(e)})).then((function(t){return Q(e,t)}))},G.updateLayerInfo=function(e,t){var n=t.docId,r=t.layerInfo;return ne(n).then((function(t){var n=r.id;if(!n&&0!==n)return Q(e,!1);for(var o in r){var i=r[o];switch(o){case"name":t.pdfLayer.setLayerName(n,i);break;case"intent":t.pdfLayer.setLayerIntent(n,i,r.isSingle);break;case"state":t.pdfLayer.setLayerDefaultState(n,i);break;case"isLocked":t.pdfLayer.setLayerLocked(n,i);break;case"viewUsage":t.pdfLayer.setLayerViewUsage(n,i);break;case"printUsage":t.pdfLayer.setLayerPrintUsage(n,i);break;case"exportUsage":t.pdfLayer.setLayerExportUsage(n,i)}}return Q(e,!0)}))},G.flattenLayers=function(e,t){return ne(t.docId).then((function(e){return!!e.pdfLayer&&e.pdfLayer.flattenLayers(e)})).then((function(t){return Q(e,t)}))},G.mergeLayers=function(e,t){var n=t.docId,r=t.layerIds,o=t.mergeTo;return ne(n).then((function(e){return!!e.pdfLayer&&e.pdfLayer.mergeLayers(e,r,o)})).then((function(t){return Q(e,t)}))},G.getLayerRelatedAnnots=function(e,t){var n=t.docId,r=t.layerId;return ne(n).then((function(e){return!!e.pdfLayer&&e.pdfLayer.getLayerNodeById(r).getRelatedAnnots().map((function(e){return e.GetDict().GetObjNum()}))})).then((function(t){return Q(e,t)}))},G.layerMoveTo=function(e,t){var n=t.docId,r=t.layerId,o=t.parentLayerId,i=t.index;return ne(n).then((function(e){return!!e.pdfLayer&&e.pdfLayer.moveTo(r,o,i)})).then((function(t){return Q(e,t)}))},G.getInfos=function(e,t){return ne(t.docId).then((function(t){Q(e,t.getInfos())}))},G.hasDocIsWrapped=function(e,t){return ne(t.docId).then((function(t){Q(e,t.doc.IsWrapper())}))},G.removeMetadata=function(e,t){var n=t.id,r=t.key;return ne(n).then((function(t){return Q(e,t.removeMetadata(r))}))},G.addAnnotObjects=ge,G.normalizePage=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.normalize()})).then((function(t){return Q(e,t),t}))},G.addAnnotObjects=ge,G.getViewerPreference=function(e,t){return ne(t.docId).then((function(t){return Q(e,t.getViewerPreference())}))},G.setViewPreference=function(e,t){var n=t.docId,r=t.key,o=t.value;return ne(n).then((function(t){return Q(e,t.setViewPreference(r,o))}))},G.getEmbeddedFontData=function(e,t){return ne(t.docId).then((function(t){return Q(e,t.getEmbeddedFontData())}))},G.computeAuditSpace=function(e,t){return ne(t.docId).then((function(e){return e.computeAuditSpace()})).then((function(t){return Q(e,t)}))},G.optimizer=function(e,t){var n=t.docId,r=t.option,o=t.portfolioNodeHandle;return ne(n).then((function(e){return e.optimizer(r,o)})).then((function(t){return Q(e,t)}))},G.optimizeScannedPDF=function(e,t){var n=t.docId,r=t.option,o=t.callback;return ne(n).then((function(e){return e.optimizeScannedPDF(r,(function(e){$(o,e)}))})).then((function(t){return Q(e,t)}))},G.startReplacePages=function(e,t){var n=t.docId,r=t.startIndex,o=t.count,i=t.srcPdfDocId,a=t.srcPageindexRange;return ne(n).then((function(t){return ne(i).then((function(n){return Q(e,t.startReplacePages(r,o,n,a))}))}))},G.importAsLayer=function(e,t){var n=t.docId,r=t.args;return ne(n).then((function(t){return ne(r.sourcePdfDocId).then((function(e){return r.sourcePdfDoc=e.doc,t.importAsLayer(r)})).then((function(t){return Q(e,t)}))}))},G.previewImportLayer=function(e,t){var n=t.docId,r=t.args;return ne(n).then((function(t){return r.sourcePdfDocId?ne(r.sourcePdfDocId).then((function(n){return r.sourcePdfDoc=n.doc,Q(e,t.previewImportLayer(r))})):Q(e,t.previewImportLayer(r))}))},G.compareDoc=function(e,t){var n=t.baseDocId,r=t.compareDocId,o=t.basePageCount,i=t.comparedPageCount,a=t.newTemplateId,s=t.oldTemplateId,u=t.basePageIndex,c=t.comparePageIndex,d=(t.comparePageNum,t.inputOptions),l=t.compareResultStrings;return I.then((function(e){var t=e.engine,f=t.ComparisonProgresssCallback.implement({Release:function(){},UpdateCurrentStateData:function(e,t){ee("compareProgress",e)},ShouldCancel:function(){}}),h=e.getPDFDocById(n),p=e.getPDFDocById(r),m=e.getPDFDocById(a),g=e.getPDFDocById(s),y=new t.Comparison(h.doc,p.doc),_=new t.ComparisonOptions;Object.keys(d).forEach((function(e){_[e]=d[e]}));var v=new t.WString(h.oriFile.name),b=new t.WString(p.oriFile.name),S=new t.ComparisonStringResource;Object.keys(l).forEach((function(e){S[e]=new t.WString(l[e])}));var w=y.GenerateComparedDoc(u,c,o,i,_,v,b,m.doc,g.doc,S,f);return e.getPDFDoc({engineDoc:w}).id})).then((function(t){Q(e,t)}))},G.reloadLayer=function(e,t){return ne(t.docId).then((function(t){Q(e,t.reloadLayer())}))},G.getMeasureScaleRatio=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.getMeasureScaleRatio()})).then((function(t){return Q(e,t),t}))},G.exportMeasureData=function(e,t){var n=t.docId,r=t.columnNames;return ne(n).then((function(e){return e.exportMeasureData(r)})).then((function(t){return Q(e,t)}))},G.setMeasureScaleRatio=function(e,t){var n=t.docId,r=t.pageId,o=t.storeInPage,i=t.measureInfo;return oe(n,r).then((function(e){return e.setMeasureRatio(o,i)})).then((function(t){return Q(e,t),t}))},G.searchDoc=function(e,t){var n=t.docId,r=t.type,o=t.words,i=t.flag,a=t.isForRedact;return ne(n).then((function(e){return e.search(r,o,i,a)})).then((function(t){return Q(e,t)}))},G.generateDocHash=function(e,t){var n=t.docId,r=t.buffer;return ne(n).then((function(e){return e.generateDocHash(r)})).then((function(t){return Q(e,t)}))},G.convertToTextMarkup=function(e,t){var n=t.docId,r=t.findResults;return ne(n).then((function(e){return e.convertToTextMarkup(r)})).then((function(t){return Q(e,t)}))},G.redactSearch=function(e,t){var n=t.docId,r=t.findResults,o=t.start,i=t.count,a=t.overlayTexts,s=t.opts;return ne(n).then((function(e){return e.redactSearch(r,o,i,a,s)})).then((function(t){return Q(e,t)}))},G.updateBeadRect=function(e,t){var n=t.docId,r=t.threadObjNum,o=t.beadObjNum,i=t.rect;return ne(n).then((function(e){return e.article.getThreadInfo(r).getBeadInfo(o).update({rect:i})})).then((function(t){return Q(e,t)}))},G.insertThread=function(e,t){var n=t.docId,r=t.threadInfo;return ne(n).then((function(e){return e.article.insertThread(r)})).then((function(t){return Q(e,t)}))},G.updateThread=function(e,t){var n=t.docId,r=t.threadInfo;return ne(n).then((function(e){return e.article.getThreadInfo(r.objNum).update(r)})).then((function(t){return Q(e,t)}))},G.removeThread=function(e,t){var n=t.docId,r=t.objNum;return ne(n).then((function(e){var t=e.article.removeThread(r);return t&&e.getArticle(!0),t})).then((function(t){return Q(e,t)}))},G.insertBead=function(e,t){var n=t.docId,r=t.pageIndex,o=t.threadObjNum,i=t.pdfBeadRect,a=t.beadIndex;return ne(n).then((function(e){return e.article.getThreadInfo(o).insertBead(r,i,a)})).then((function(t){return Q(e,t)}))},G.removeBead=function(e,t){var n=t.docId,r=t.threadObjNum,o=t.beadObjNum;return ne(n).then((function(e){return e.article.getThreadInfo(r).removeBead(o)})).then((function(t){return Q(e,t)}))},G.mergeThread=function(e,t){var n=t.docId,r=t.threadObjNum,o=t.mergeToThreadObjNum;return ne(n).then((function(e){var t=e.article,n=t.getThreadInfo(r),i=t.getThreadInfo(o);return n.children.reverse().forEach((function(e){var t=e.toJson(),n=t.pageIndex,r=t.rect;i.insertBead(n,r,0)})),i.toJson()})).then((function(t){return Q(e,t)}))},G.setRenderConfigLineWeight=function(e,t){var n=t.docId,r=t.lineWeight;return ne(n).then((function(t){return t.setRenderConfigLineWeight(r),Q(e)}))},G.isScannedDoc=function(e,t){return ne(t.docId).then((function(e){return e.isScannedDoc()})).then((function(t){return Q(e,t)}))},G.getCompareFileFilterNums=function(e,t){return ne(t.docId).then((function(t){var n=t.getCompareFileFilterNums();return Q(e,n)}))},G.removePDFAID=function(e,t){return ne(t.docId).then((function(t){return t.removePDFAID(),Q(e)}))},G.setPageTransition=function(e,t){var n=t.docId,r=t.transName,o=t.direction,i=t.speed,a=t.range;return ne(n).then((function(t){return Q(e,t.setPageTransition(r,o,i,a))}))},G.getPageTransitionByIndex=function(e,t){var n=t.docId,r=t.pageIndex;return ne(n).then((function(t){return Q(e,t.getPageTransitionByIndex(r))}))},G.getPageTransition=function(e,t){var n=t.docId,r=t.pageId;return oe(n,r).then((function(t){return Q(e,t.getPageTransition(r))}))},G.isScannedPage=function(e,t){return oe(t.docId,t.pageId).then((function(e){return e.isScannedPage()})).then((function(t){return Q(e,t)}))},G.getPureTexts=function(e,t){return oe(t.docId,t.pageId).then((function(t){t.getPureTexts().then((function(t){Q(e,t)}))}))},G.hiddenDataSanitizeDocument=function(e,t){return ne(t.docId).then((function(t){return(0,S.sanitizeDocument)(t).then((function(t){return Q(e,t)}))}))},G.hiddenDataRemoveHiddenInfo=function(e,t){var n=t.docId,r=t.options;return ne(n).then((function(t){return(0,S.removeHiddenInfo)(t,r).then((function(t){return Q(e,t)}))}))},G.handleGroupMarkup=function(e,t){var n=t.docId,r=t.pageId,o=t.annotIds,i=t.isGroup;return oe(n,r).then((function(e){return e.handleGroupMarkup(o,i)})).then((function(t){return Q(e,t)}))},G.setRedactAppearance=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.option;return oe(n,r).then((function(e){return e.getAnnotById(o)})).then((function(e){var t=e.setRedactAppearance(i);return e.updateModifyTime(),t})).then((function(t){Q(e,t)}))},G.getText=function(e,t){var n=t.docId,r=t.pageRange,o=t.taskId,i=t.taskProgress;return ne(n).then((function(e){return e.getText(r,o,{taskProgress:function(e){$(i,e,[])}})})).then((function(t){Q(e,t)}))},G.cancelTaskProgress=function(e,t){var n=t.docId,r=t.taskId;return ne(n).then((function(e){return e.cancelTaskProgress(r)})).then((function(t){Q(e,t)}))},G.getPageTexts=function(e,t){var n=t.docId,r=t.pageId,o=t.settings,i=t.minWidth;return oe(n,r).then((function(t){var n=t.getTexts(o,i);return Q(e,n)}))},G.cacheFontConfig=function(e,t){I.then((function(e){return e.cacheFontConfig(t)})).then((function(){Q(e)}))},G.getFxcoreFontList=function(e,t){I.then((function(e){return e.getFxcoreFontList(t)})).then((function(t){Q(e,t)}))}},function(e,t,n){"use strict";(function(e){if(n(408),n(605),n(606),e._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");e._babelPolyfill=!0;function t(e,t,n){e[t]||Object.defineProperty(e,t,{writable:!0,configurable:!0,value:n})}t(String.prototype,"padLeft","".padStart),t(String.prototype,"padRight","".padEnd),"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach((function(e){[][e]&&t(Array,e,Function.call.bind([][e]))}))}).call(this,n(14))},function(e,t,n){n(409),n(412),n(413),n(414),n(415),n(416),n(417),n(418),n(419),n(420),n(421),n(422),n(423),n(424),n(425),n(426),n(427),n(428),n(429),n(430),n(431),n(432),n(433),n(434),n(435),n(436),n(437),n(438),n(439),n(440),n(441),n(442),n(443),n(444),n(445),n(446),n(447),n(448),n(449),n(450),n(451),n(452),n(453),n(454),n(455),n(456),n(457),n(458),n(459),n(460),n(461),n(462),n(463),n(464),n(465),n(466),n(467),n(468),n(469),n(470),n(471),n(472),n(473),n(474),n(475),n(476),n(477),n(478),n(479),n(480),n(481),n(482),n(483),n(484),n(485),n(486),n(487),n(489),n(490),n(492),n(493),n(494),n(495),n(496),n(497),n(498),n(500),n(501),n(502),n(503),n(504),n(505),n(506),n(507),n(508),n(509),n(510),n(511),n(512),n(148),n(513),n(198),n(514),n(199),n(515),n(516),n(517),n(518),n(519),n(202),n(204),n(205),n(520),n(521),n(522),n(523),n(524),n(525),n(526),n(527),n(528),n(529),n(530),n(531),n(532),n(533),n(534),n(535),n(536),n(537),n(538),n(539),n(540),n(541),n(542),n(543),n(544),n(545),n(546),n(547),n(548),n(549),n(550),n(551),n(552),n(553),n(554),n(555),n(556),n(557),n(558),n(559),n(560),n(561),n(562),n(563),n(564),n(565),n(566),n(567),n(568),n(569),n(570),n(571),n(572),n(573),n(574),n(575),n(576),n(577),n(578),n(579),n(580),n(581),n(582),n(583),n(584),n(585),n(586),n(587),n(588),n(589),n(590),n(591),n(592),n(593),n(594),n(595),n(596),n(597),n(598),n(599),n(600),n(601),n(602),n(603),n(604),e.exports=n(32)},function(e,t,n){"use strict";var r=n(5),o=n(27),i=n(11),a=n(1),s=n(24),u=n(50).KEY,c=n(6),d=n(80),l=n(69),f=n(56),h=n(9),p=n(180),m=n(129),g=n(411),y=n(91),_=n(4),v=n(7),b=n(15),S=n(28),w=n(40),M=n(55),D=n(59),P=n(183),T=n(29),k=n(90),A=n(12),L=n(57),F=T.f,I=A.f,x=P.f,C=r.Symbol,R=r.JSON,O=R&&R.stringify,G=h("_hidden"),E=h("toPrimitive"),Y={}.propertyIsEnumerable,j=d("symbol-registry"),N=d("symbols"),B=d("op-symbols"),H=Object.prototype,W="function"==typeof C&&!!k.f,U=r.QObject,z=!U||!U.prototype||!U.prototype.findChild,J=i&&c((function(){return 7!=D(I({},"a",{get:function(){return I(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=F(H,t);r&&delete H[t],I(e,t,n),r&&e!==H&&I(H,t,r)}:I,V=function(e){var t=N[e]=D(C.prototype);return t._k=e,t},K=W&&"symbol"==typeof C.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof C},q=function(e,t,n){return e===H&&q(B,t,n),_(e),t=w(t,!0),_(n),o(N,t)?(n.enumerable?(o(e,G)&&e[G][t]&&(e[G][t]=!1),n=D(n,{enumerable:M(0,!1)})):(o(e,G)||I(e,G,M(1,{})),e[G][t]=!0),J(e,t,n)):I(e,t,n)},Z=function(e,t){_(e);for(var n,r=g(t=S(t)),o=0,i=r.length;i>o;)q(e,n=r[o++],t[n]);return e},X=function(e){var t=Y.call(this,e=w(e,!0));return!(this===H&&o(N,e)&&!o(B,e))&&(!(t||!o(this,e)||!o(N,e)||o(this,G)&&this[G][e])||t)},Q=function(e,t){if(e=S(e),t=w(t,!0),e!==H||!o(N,t)||o(B,t)){var n=F(e,t);return!n||!o(N,t)||o(e,G)&&e[G][t]||(n.enumerable=!0),n}},$=function(e){for(var t,n=x(S(e)),r=[],i=0;n.length>i;)o(N,t=n[i++])||t==G||t==u||r.push(t);return r},ee=function(e){for(var t,n=e===H,r=x(n?B:S(e)),i=[],a=0;r.length>a;)!o(N,t=r[a++])||n&&!o(H,t)||i.push(N[t]);return i};W||(s((C=function(){if(this instanceof C)throw TypeError("Symbol is not a constructor!");var e=f(arguments.length>0?arguments[0]:void 0),t=function(n){this===H&&t.call(B,n),o(this,G)&&o(this[G],e)&&(this[G][e]=!1),J(this,e,M(1,n))};return i&&z&&J(H,e,{configurable:!0,set:t}),V(e)}).prototype,"toString",(function(){return this._k})),T.f=Q,A.f=q,n(60).f=P.f=$,n(82).f=X,k.f=ee,i&&!n(49)&&s(H,"propertyIsEnumerable",X,!0),p.f=function(e){return V(h(e))}),a(a.G+a.W+a.F*!W,{Symbol:C});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ne=0;te.length>ne;)h(te[ne++]);for(var re=L(h.store),oe=0;re.length>oe;)m(re[oe++]);a(a.S+a.F*!W,"Symbol",{for:function(e){return o(j,e+="")?j[e]:j[e]=C(e)},keyFor:function(e){if(!K(e))throw TypeError(e+" is not a symbol!");for(var t in j)if(j[t]===e)return t},useSetter:function(){z=!0},useSimple:function(){z=!1}}),a(a.S+a.F*!W,"Object",{create:function(e,t){return void 0===t?D(e):Z(D(e),t)},defineProperty:q,defineProperties:Z,getOwnPropertyDescriptor:Q,getOwnPropertyNames:$,getOwnPropertySymbols:ee});var ie=c((function(){k.f(1)}));a(a.S+a.F*ie,"Object",{getOwnPropertySymbols:function(e){return k.f(b(e))}}),R&&a(a.S+a.F*(!W||c((function(){var e=C();return"[null]"!=O([e])||"{}"!=O({a:e})||"{}"!=O(Object(e))}))),"JSON",{stringify:function(e){for(var t,n,r=[e],o=1;arguments.length>o;)r.push(arguments[o++]);if(n=t=r[1],(v(t)||void 0!==e)&&!K(e))return y(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!K(t))return t}),r[1]=t,O.apply(R,r)}}),C.prototype[E]||n(23)(C.prototype,E,C.prototype.valueOf),l(C,"Symbol"),l(Math,"Math",!0),l(r.JSON,"JSON",!0)},function(e,t,n){e.exports=n(80)("native-function-to-string",Function.toString)},function(e,t,n){var r=n(57),o=n(90),i=n(82);e.exports=function(e){var t=r(e),n=o.f;if(n)for(var a,s=n(e),u=i.f,c=0;s.length>c;)u.call(e,a=s[c++])&&t.push(a);return t}},function(e,t,n){var r=n(1);r(r.S,"Object",{create:n(59)})},function(e,t,n){var r=n(1);r(r.S+r.F*!n(11),"Object",{defineProperty:n(12).f})},function(e,t,n){var r=n(1);r(r.S+r.F*!n(11),"Object",{defineProperties:n(182)})},function(e,t,n){var r=n(28),o=n(29).f;n(42)("getOwnPropertyDescriptor",(function(){return function(e,t){return o(r(e),t)}}))},function(e,t,n){var r=n(15),o=n(30);n(42)("getPrototypeOf",(function(){return function(e){return o(r(e))}}))},function(e,t,n){var r=n(15),o=n(57);n(42)("keys",(function(){return function(e){return o(r(e))}}))},function(e,t,n){n(42)("getOwnPropertyNames",(function(){return n(183).f}))},function(e,t,n){var r=n(7),o=n(50).onFreeze;n(42)("freeze",(function(e){return function(t){return e&&r(t)?e(o(t)):t}}))},function(e,t,n){var r=n(7),o=n(50).onFreeze;n(42)("seal",(function(e){return function(t){return e&&r(t)?e(o(t)):t}}))},function(e,t,n){var r=n(7),o=n(50).onFreeze;n(42)("preventExtensions",(function(e){return function(t){return e&&r(t)?e(o(t)):t}}))},function(e,t,n){var r=n(7);n(42)("isFrozen",(function(e){return function(t){return!r(t)||!!e&&e(t)}}))},function(e,t,n){var r=n(7);n(42)("isSealed",(function(e){return function(t){return!r(t)||!!e&&e(t)}}))},function(e,t,n){var r=n(7);n(42)("isExtensible",(function(e){return function(t){return!!r(t)&&(!e||e(t))}}))},function(e,t,n){var r=n(1);r(r.S+r.F,"Object",{assign:n(184)})},function(e,t,n){var r=n(1);r(r.S,"Object",{is:n(185)})},function(e,t,n){var r=n(1);r(r.S,"Object",{setPrototypeOf:n(133).set})},function(e,t,n){"use strict";var r=n(70),o={};o[n(9)("toStringTag")]="z",o+""!="[object z]"&&n(24)(Object.prototype,"toString",(function(){return"[object "+r(this)+"]"}),!0)},function(e,t,n){var r=n(1);r(r.P,"Function",{bind:n(186)})},function(e,t,n){var r=n(12).f,o=Function.prototype,i=/^\s*function ([^ (]*)/;"name"in o||n(11)&&r(o,"name",{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var r=n(7),o=n(30),i=n(9)("hasInstance"),a=Function.prototype;i in a||n(12).f(a,i,{value:function(e){if("function"!=typeof this||!r(e))return!1;if(!r(this.prototype))return e instanceof this;for(;e=o(e);)if(this.prototype===e)return!0;return!1}})},function(e,t,n){var r=n(1),o=n(188);r(r.G+r.F*(parseInt!=o),{parseInt:o})},function(e,t,n){var r=n(1),o=n(189);r(r.G+r.F*(parseFloat!=o),{parseFloat:o})},function(e,t,n){"use strict";var r=n(5),o=n(27),i=n(34),a=n(135),s=n(40),u=n(6),c=n(60).f,d=n(29).f,l=n(12).f,f=n(71).trim,h=r.Number,p=h,m=h.prototype,g="Number"==i(n(59)(m)),y="trim"in String.prototype,_=function(e){var t=s(e,!1);if("string"==typeof t&&t.length>2){var n,r,o,i=(t=y?t.trim():f(t,3)).charCodeAt(0);if(43===i||45===i){if(88===(n=t.charCodeAt(2))||120===n)return NaN}else if(48===i){switch(t.charCodeAt(1)){case 66:case 98:r=2,o=49;break;case 79:case 111:r=8,o=55;break;default:return+t}for(var a,u=t.slice(2),c=0,d=u.length;c<d;c++)if((a=u.charCodeAt(c))<48||a>o)return NaN;return parseInt(u,r)}}return+t};if(!h(" 0o1")||!h("0b1")||h("+0x1")){h=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof h&&(g?u((function(){m.valueOf.call(n)})):"Number"!=i(n))?a(new p(_(t)),n,h):_(t)};for(var v,b=n(11)?c(p):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),S=0;b.length>S;S++)o(p,v=b[S])&&!o(h,v)&&l(h,v,d(p,v));h.prototype=m,m.constructor=h,n(24)(r,"Number",h)}},function(e,t,n){"use strict";var r=n(1),o=n(35),i=n(190),a=n(136),s=1..toFixed,u=Math.floor,c=[0,0,0,0,0,0],d="Number.toFixed: incorrect invocation!",l=function(e,t){for(var n=-1,r=t;++n<6;)r+=e*c[n],c[n]=r%1e7,r=u(r/1e7)},f=function(e){for(var t=6,n=0;--t>=0;)n+=c[t],c[t]=u(n/e),n=n%e*1e7},h=function(){for(var e=6,t="";--e>=0;)if(""!==t||0===e||0!==c[e]){var n=String(c[e]);t=""===t?n:t+a.call("0",7-n.length)+n}return t},p=function(e,t,n){return 0===t?n:t%2==1?p(e,t-1,n*e):p(e*e,t/2,n)};r(r.P+r.F*(!!s&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!n(6)((function(){s.call({})}))),"Number",{toFixed:function(e){var t,n,r,s,u=i(this,d),c=o(e),m="",g="0";if(c<0||c>20)throw RangeError(d);if(u!=u)return"NaN";if(u<=-1e21||u>=1e21)return String(u);if(u<0&&(m="-",u=-u),u>1e-21)if(n=(t=function(e){for(var t=0,n=e;n>=4096;)t+=12,n/=4096;for(;n>=2;)t+=1,n/=2;return t}(u*p(2,69,1))-69)<0?u*p(2,-t,1):u/p(2,t,1),n*=4503599627370496,(t=52-t)>0){for(l(0,n),r=c;r>=7;)l(1e7,0),r-=7;for(l(p(10,r,1),0),r=t-1;r>=23;)f(1<<23),r-=23;f(1<<r),l(1,1),f(2),g=h()}else l(0,n),l(1<<-t,0),g=h()+a.call("0",c);return g=c>0?m+((s=g.length)<=c?"0."+a.call("0",c-s)+g:g.slice(0,s-c)+"."+g.slice(s-c)):m+g}})},function(e,t,n){"use strict";var r=n(1),o=n(6),i=n(190),a=1..toPrecision;r(r.P+r.F*(o((function(){return"1"!==a.call(1,void 0)}))||!o((function(){a.call({})}))),"Number",{toPrecision:function(e){var t=i(this,"Number#toPrecision: incorrect invocation!");return void 0===e?a.call(t):a.call(t,e)}})},function(e,t,n){var r=n(1);r(r.S,"Number",{EPSILON:Math.pow(2,-52)})},function(e,t,n){var r=n(1),o=n(5).isFinite;r(r.S,"Number",{isFinite:function(e){return"number"==typeof e&&o(e)}})},function(e,t,n){var r=n(1);r(r.S,"Number",{isInteger:n(191)})},function(e,t,n){var r=n(1);r(r.S,"Number",{isNaN:function(e){return e!=e}})},function(e,t,n){var r=n(1),o=n(191),i=Math.abs;r(r.S,"Number",{isSafeInteger:function(e){return o(e)&&i(e)<=9007199254740991}})},function(e,t,n){var r=n(1);r(r.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},function(e,t,n){var r=n(1);r(r.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},function(e,t,n){var r=n(1),o=n(189);r(r.S+r.F*(Number.parseFloat!=o),"Number",{parseFloat:o})},function(e,t,n){var r=n(1),o=n(188);r(r.S+r.F*(Number.parseInt!=o),"Number",{parseInt:o})},function(e,t,n){var r=n(1),o=n(192),i=Math.sqrt,a=Math.acosh;r(r.S+r.F*!(a&&710==Math.floor(a(Number.MAX_VALUE))&&a(1/0)==1/0),"Math",{acosh:function(e){return(e=+e)<1?NaN:e>94906265.62425156?Math.log(e)+Math.LN2:o(e-1+i(e-1)*i(e+1))}})},function(e,t,n){var r=n(1),o=Math.asinh;r(r.S+r.F*!(o&&1/o(0)>0),"Math",{asinh:function e(t){return isFinite(t=+t)&&0!=t?t<0?-e(-t):Math.log(t+Math.sqrt(t*t+1)):t}})},function(e,t,n){var r=n(1),o=Math.atanh;r(r.S+r.F*!(o&&1/o(-0)<0),"Math",{atanh:function(e){return 0==(e=+e)?e:Math.log((1+e)/(1-e))/2}})},function(e,t,n){var r=n(1),o=n(137);r(r.S,"Math",{cbrt:function(e){return o(e=+e)*Math.pow(Math.abs(e),1/3)}})},function(e,t,n){var r=n(1);r(r.S,"Math",{clz32:function(e){return(e>>>=0)?31-Math.floor(Math.log(e+.5)*Math.LOG2E):32}})},function(e,t,n){var r=n(1),o=Math.exp;r(r.S,"Math",{cosh:function(e){return(o(e=+e)+o(-e))/2}})},function(e,t,n){var r=n(1),o=n(138);r(r.S+r.F*(o!=Math.expm1),"Math",{expm1:o})},function(e,t,n){var r=n(1);r(r.S,"Math",{fround:n(193)})},function(e,t,n){var r=n(1),o=Math.abs;r(r.S,"Math",{hypot:function(e,t){for(var n,r,i=0,a=0,s=arguments.length,u=0;a<s;)u<(n=o(arguments[a++]))?(i=i*(r=u/n)*r+1,u=n):i+=n>0?(r=n/u)*r:n;return u===1/0?1/0:u*Math.sqrt(i)}})},function(e,t,n){var r=n(1),o=Math.imul;r(r.S+r.F*n(6)((function(){return-5!=o(4294967295,5)||2!=o.length})),"Math",{imul:function(e,t){var n=+e,r=+t,o=65535&n,i=65535&r;return 0|o*i+((65535&n>>>16)*i+o*(65535&r>>>16)<<16>>>0)}})},function(e,t,n){var r=n(1);r(r.S,"Math",{log10:function(e){return Math.log(e)*Math.LOG10E}})},function(e,t,n){var r=n(1);r(r.S,"Math",{log1p:n(192)})},function(e,t,n){var r=n(1);r(r.S,"Math",{log2:function(e){return Math.log(e)/Math.LN2}})},function(e,t,n){var r=n(1);r(r.S,"Math",{sign:n(137)})},function(e,t,n){var r=n(1),o=n(138),i=Math.exp;r(r.S+r.F*n(6)((function(){return-2e-17!=!Math.sinh(-2e-17)})),"Math",{sinh:function(e){return Math.abs(e=+e)<1?(o(e)-o(-e))/2:(i(e-1)-i(-e-1))*(Math.E/2)}})},function(e,t,n){var r=n(1),o=n(138),i=Math.exp;r(r.S,"Math",{tanh:function(e){var t=o(e=+e),n=o(-e);return t==1/0?1:n==1/0?-1:(t-n)/(i(e)+i(-e))}})},function(e,t,n){var r=n(1);r(r.S,"Math",{trunc:function(e){return(e>0?Math.floor:Math.ceil)(e)}})},function(e,t,n){var r=n(1),o=n(58),i=String.fromCharCode,a=String.fromCodePoint;r(r.S+r.F*(!!a&&1!=a.length),"String",{fromCodePoint:function(e){for(var t,n=[],r=arguments.length,a=0;r>a;){if(t=+arguments[a++],o(t,1114111)!==t)throw RangeError(t+" is not a valid code point");n.push(t<65536?i(t):i(55296+((t-=65536)>>10),t%1024+56320))}return n.join("")}})},function(e,t,n){var r=n(1),o=n(28),i=n(10);r(r.S,"String",{raw:function(e){for(var t=o(e.raw),n=i(t.length),r=arguments.length,a=[],s=0;n>s;)a.push(String(t[s++])),s<r&&a.push(String(arguments[s]));return a.join("")}})},function(e,t,n){"use strict";n(71)("trim",(function(e){return function(){return e(this,3)}}))},function(e,t,n){"use strict";var r=n(92)(!0);n(139)(String,"String",(function(e){this._t=String(e),this._i=0}),(function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})}))},function(e,t,n){"use strict";var r=n(1),o=n(92)(!1);r(r.P,"String",{codePointAt:function(e){return o(this,e)}})},function(e,t,n){"use strict";var r=n(1),o=n(10),i=n(141),a="".endsWith;r(r.P+r.F*n(142)("endsWith"),"String",{endsWith:function(e){var t=i(this,e,"endsWith"),n=arguments.length>1?arguments[1]:void 0,r=o(t.length),s=void 0===n?r:Math.min(o(n),r),u=String(e);return a?a.call(t,u,s):t.slice(s-u.length,s)===u}})},function(e,t,n){"use strict";var r=n(1),o=n(141);r(r.P+r.F*n(142)("includes"),"String",{includes:function(e){return!!~o(this,e,"includes").indexOf(e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(1);r(r.P,"String",{repeat:n(136)})},function(e,t,n){"use strict";var r=n(1),o=n(10),i=n(141),a="".startsWith;r(r.P+r.F*n(142)("startsWith"),"String",{startsWith:function(e){var t=i(this,e,"startsWith"),n=o(Math.min(arguments.length>1?arguments[1]:void 0,t.length)),r=String(e);return a?a.call(t,r,n):t.slice(n,n+r.length)===r}})},function(e,t,n){"use strict";n(25)("anchor",(function(e){return function(t){return e(this,"a","name",t)}}))},function(e,t,n){"use strict";n(25)("big",(function(e){return function(){return e(this,"big","","")}}))},function(e,t,n){"use strict";n(25)("blink",(function(e){return function(){return e(this,"blink","","")}}))},function(e,t,n){"use strict";n(25)("bold",(function(e){return function(){return e(this,"b","","")}}))},function(e,t,n){"use strict";n(25)("fixed",(function(e){return function(){return e(this,"tt","","")}}))},function(e,t,n){"use strict";n(25)("fontcolor",(function(e){return function(t){return e(this,"font","color",t)}}))},function(e,t,n){"use strict";n(25)("fontsize",(function(e){return function(t){return e(this,"font","size",t)}}))},function(e,t,n){"use strict";n(25)("italics",(function(e){return function(){return e(this,"i","","")}}))},function(e,t,n){"use strict";n(25)("link",(function(e){return function(t){return e(this,"a","href",t)}}))},function(e,t,n){"use strict";n(25)("small",(function(e){return function(){return e(this,"small","","")}}))},function(e,t,n){"use strict";n(25)("strike",(function(e){return function(){return e(this,"strike","","")}}))},function(e,t,n){"use strict";n(25)("sub",(function(e){return function(){return e(this,"sub","","")}}))},function(e,t,n){"use strict";n(25)("sup",(function(e){return function(){return e(this,"sup","","")}}))},function(e,t,n){var r=n(1);r(r.S,"Date",{now:function(){return(new Date).getTime()}})},function(e,t,n){"use strict";var r=n(1),o=n(15),i=n(40);r(r.P+r.F*n(6)((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})})),"Date",{toJSON:function(e){var t=o(this),n=i(t);return"number"!=typeof n||isFinite(n)?t.toISOString():null}})},function(e,t,n){var r=n(1),o=n(488);r(r.P+r.F*(Date.prototype.toISOString!==o),"Date",{toISOString:o})},function(e,t,n){"use strict";var r=n(6),o=Date.prototype.getTime,i=Date.prototype.toISOString,a=function(e){return e>9?e:"0"+e};e.exports=r((function(){return"0385-07-25T07:06:39.999Z"!=i.call(new Date(-50000000000001))}))||!r((function(){i.call(new Date(NaN))}))?function(){if(!isFinite(o.call(this)))throw RangeError("Invalid time value");var e=this,t=e.getUTCFullYear(),n=e.getUTCMilliseconds(),r=t<0?"-":t>9999?"+":"";return r+("00000"+Math.abs(t)).slice(r?-6:-4)+"-"+a(e.getUTCMonth()+1)+"-"+a(e.getUTCDate())+"T"+a(e.getUTCHours())+":"+a(e.getUTCMinutes())+":"+a(e.getUTCSeconds())+"."+(n>99?n:"0"+a(n))+"Z"}:i},function(e,t,n){var r=Date.prototype,o=r.toString,i=r.getTime;new Date(NaN)+""!="Invalid Date"&&n(24)(r,"toString",(function(){var e=i.call(this);return e==e?o.call(this):"Invalid Date"}))},function(e,t,n){var r=n(9)("toPrimitive"),o=Date.prototype;r in o||n(23)(o,r,n(491))},function(e,t,n){"use strict";var r=n(4),o=n(40);e.exports=function(e){if("string"!==e&&"number"!==e&&"default"!==e)throw TypeError("Incorrect hint");return o(r(this),"number"!=e)}},function(e,t,n){var r=n(1);r(r.S,"Array",{isArray:n(91)})},function(e,t,n){"use strict";var r=n(33),o=n(1),i=n(15),a=n(194),s=n(143),u=n(10),c=n(144),d=n(145);o(o.S+o.F*!n(94)((function(e){Array.from(e)})),"Array",{from:function(e){var t,n,o,l,f=i(e),h="function"==typeof this?this:Array,p=arguments.length,m=p>1?arguments[1]:void 0,g=void 0!==m,y=0,_=d(f);if(g&&(m=r(m,p>2?arguments[2]:void 0,2)),null==_||h==Array&&s(_))for(n=new h(t=u(f.length));t>y;y++)c(n,y,g?m(f[y],y):f[y]);else for(l=_.call(f),n=new h;!(o=l.next()).done;y++)c(n,y,g?a(l,m,[o.value,y],!0):o.value);return n.length=y,n}})},function(e,t,n){"use strict";var r=n(1),o=n(144);r(r.S+r.F*n(6)((function(){function e(){}return!(Array.of.call(e)instanceof e)})),"Array",{of:function(){for(var e=0,t=arguments.length,n=new("function"==typeof this?this:Array)(t);t>e;)o(n,e,arguments[e++]);return n.length=t,n}})},function(e,t,n){"use strict";var r=n(1),o=n(28),i=[].join;r(r.P+r.F*(n(81)!=Object||!n(36)(i)),"Array",{join:function(e){return i.call(o(this),void 0===e?",":e)}})},function(e,t,n){"use strict";var r=n(1),o=n(132),i=n(34),a=n(58),s=n(10),u=[].slice;r(r.P+r.F*n(6)((function(){o&&u.call(o)})),"Array",{slice:function(e,t){var n=s(this.length),r=i(this);if(t=void 0===t?n:t,"Array"==r)return u.call(this,e,t);for(var o=a(e,n),c=a(t,n),d=s(c-o),l=new Array(d),f=0;f<d;f++)l[f]="String"==r?this.charAt(o+f):this[o+f];return l}})},function(e,t,n){"use strict";var r=n(1),o=n(16),i=n(15),a=n(6),s=[].sort,u=[1,2,3];r(r.P+r.F*(a((function(){u.sort(void 0)}))||!a((function(){u.sort(null)}))||!n(36)(s)),"Array",{sort:function(e){return void 0===e?s.call(i(this)):s.call(i(this),o(e))}})},function(e,t,n){"use strict";var r=n(1),o=n(43)(0),i=n(36)([].forEach,!0);r(r.P+r.F*!i,"Array",{forEach:function(e){return o(this,e,arguments[1])}})},function(e,t,n){var r=n(7),o=n(91),i=n(9)("species");e.exports=function(e){var t;return o(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!o(t.prototype)||(t=void 0),r(t)&&null===(t=t[i])&&(t=void 0)),void 0===t?Array:t}},function(e,t,n){"use strict";var r=n(1),o=n(43)(1);r(r.P+r.F*!n(36)([].map,!0),"Array",{map:function(e){return o(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(1),o=n(43)(2);r(r.P+r.F*!n(36)([].filter,!0),"Array",{filter:function(e){return o(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(1),o=n(43)(3);r(r.P+r.F*!n(36)([].some,!0),"Array",{some:function(e){return o(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(1),o=n(43)(4);r(r.P+r.F*!n(36)([].every,!0),"Array",{every:function(e){return o(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(1),o=n(195);r(r.P+r.F*!n(36)([].reduce,!0),"Array",{reduce:function(e){return o(this,e,arguments.length,arguments[1],!1)}})},function(e,t,n){"use strict";var r=n(1),o=n(195);r(r.P+r.F*!n(36)([].reduceRight,!0),"Array",{reduceRight:function(e){return o(this,e,arguments.length,arguments[1],!0)}})},function(e,t,n){"use strict";var r=n(1),o=n(89)(!1),i=[].indexOf,a=!!i&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(a||!n(36)(i)),"Array",{indexOf:function(e){return a?i.apply(this,arguments)||0:o(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(1),o=n(28),i=n(35),a=n(10),s=[].lastIndexOf,u=!!s&&1/[1].lastIndexOf(1,-0)<0;r(r.P+r.F*(u||!n(36)(s)),"Array",{lastIndexOf:function(e){if(u)return s.apply(this,arguments)||0;var t=o(this),n=a(t.length),r=n-1;for(arguments.length>1&&(r=Math.min(r,i(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}})},function(e,t,n){var r=n(1);r(r.P,"Array",{copyWithin:n(196)}),n(51)("copyWithin")},function(e,t,n){var r=n(1);r(r.P,"Array",{fill:n(147)}),n(51)("fill")},function(e,t,n){"use strict";var r=n(1),o=n(43)(5),i=!0;"find"in[]&&Array(1).find((function(){i=!1})),r(r.P+r.F*i,"Array",{find:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),n(51)("find")},function(e,t,n){"use strict";var r=n(1),o=n(43)(6),i="findIndex",a=!0;i in[]&&Array(1)[i]((function(){a=!1})),r(r.P+r.F*a,"Array",{findIndex:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),n(51)(i)},function(e,t,n){n(61)("Array")},function(e,t,n){var r=n(5),o=n(135),i=n(12).f,a=n(60).f,s=n(93),u=n(83),c=r.RegExp,d=c,l=c.prototype,f=/a/g,h=/a/g,p=new c(f)!==f;if(n(11)&&(!p||n(6)((function(){return h[n(9)("match")]=!1,c(f)!=f||c(h)==h||"/a/i"!=c(f,"i")})))){c=function(e,t){var n=this instanceof c,r=s(e),i=void 0===t;return!n&&r&&e.constructor===c&&i?e:o(p?new d(r&&!i?e.source:e,t):d((r=e instanceof c)?e.source:e,r&&i?u.call(e):t),n?this:l,c)};for(var m=function(e){e in c||i(c,e,{configurable:!0,get:function(){return d[e]},set:function(t){d[e]=t}})},g=a(d),y=0;g.length>y;)m(g[y++]);l.constructor=c,c.prototype=l,n(24)(r,"RegExp",c)}n(61)("RegExp")},function(e,t,n){"use strict";n(199);var r=n(4),o=n(83),i=n(11),a=/./.toString,s=function(e){n(24)(RegExp.prototype,"toString",e,!0)};n(6)((function(){return"/a/b"!=a.call({source:"a",flags:"b"})}))?s((function(){var e=r(this);return"/".concat(e.source,"/","flags"in e?e.flags:!i&&e instanceof RegExp?o.call(e):void 0)})):"toString"!=a.name&&s((function(){return a.call(this)}))},function(e,t,n){"use strict";var r=n(4),o=n(10),i=n(150),a=n(95);n(96)("match",1,(function(e,t,n,s){return[function(n){var r=e(this),o=null==n?void 0:n[t];return void 0!==o?o.call(n,r):new RegExp(n)[t](String(r))},function(e){var t=s(n,e,this);if(t.done)return t.value;var u=r(e),c=String(this);if(!u.global)return a(u,c);var d=u.unicode;u.lastIndex=0;for(var l,f=[],h=0;null!==(l=a(u,c));){var p=String(l[0]);f[h]=p,""===p&&(u.lastIndex=i(c,o(u.lastIndex),d)),h++}return 0===h?null:f}]}))},function(e,t,n){"use strict";var r=n(4),o=n(15),i=n(10),a=n(35),s=n(150),u=n(95),c=Math.max,d=Math.min,l=Math.floor,f=/\$([$&`']|\d\d?|<[^>]*>)/g,h=/\$([$&`']|\d\d?)/g;n(96)("replace",2,(function(e,t,n,p){return[function(r,o){var i=e(this),a=null==r?void 0:r[t];return void 0!==a?a.call(r,i,o):n.call(String(i),r,o)},function(e,t){var o=p(n,e,this,t);if(o.done)return o.value;var l=r(e),f=String(this),h="function"==typeof t;h||(t=String(t));var g=l.global;if(g){var y=l.unicode;l.lastIndex=0}for(var _=[];;){var v=u(l,f);if(null===v)break;if(_.push(v),!g)break;""===String(v[0])&&(l.lastIndex=s(f,i(l.lastIndex),y))}for(var b,S="",w=0,M=0;M<_.length;M++){v=_[M];for(var D=String(v[0]),P=c(d(a(v.index),f.length),0),T=[],k=1;k<v.length;k++)T.push(void 0===(b=v[k])?b:String(b));var A=v.groups;if(h){var L=[D].concat(T,P,f);void 0!==A&&L.push(A);var F=String(t.apply(void 0,L))}else F=m(D,f,P,T,A,t);P>=w&&(S+=f.slice(w,P)+F,w=P+D.length)}return S+f.slice(w)}];function m(e,t,r,i,a,s){var u=r+e.length,c=i.length,d=h;return void 0!==a&&(a=o(a),d=f),n.call(s,d,(function(n,o){var s;switch(o.charAt(0)){case"$":return"$";case"&":return e;case"`":return t.slice(0,r);case"'":return t.slice(u);case"<":s=a[o.slice(1,-1)];break;default:var d=+o;if(0===d)return n;if(d>c){var f=l(d/10);return 0===f?n:f<=c?void 0===i[f-1]?o.charAt(1):i[f-1]+o.charAt(1):n}s=i[d-1]}return void 0===s?"":s}))}}))},function(e,t,n){"use strict";var r=n(4),o=n(185),i=n(95);n(96)("search",1,(function(e,t,n,a){return[function(n){var r=e(this),o=null==n?void 0:n[t];return void 0!==o?o.call(n,r):new RegExp(n)[t](String(r))},function(e){var t=a(n,e,this);if(t.done)return t.value;var s=r(e),u=String(this),c=s.lastIndex;o(c,0)||(s.lastIndex=0);var d=i(s,u);return o(s.lastIndex,c)||(s.lastIndex=c),null===d?-1:d.index}]}))},function(e,t,n){"use strict";var r=n(93),o=n(4),i=n(84),a=n(150),s=n(10),u=n(95),c=n(149),d=n(6),l=Math.min,f=[].push,h="length",p=!d((function(){RegExp(4294967295,"y")}));n(96)("split",2,(function(e,t,n,d){var m;return m="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1)[h]||2!="ab".split(/(?:ab)*/)[h]||4!=".".split(/(.?)(.?)/)[h]||".".split(/()()/)[h]>1||"".split(/.?/)[h]?function(e,t){var o=String(this);if(void 0===e&&0===t)return[];if(!r(e))return n.call(o,e,t);for(var i,a,s,u=[],d=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,p=void 0===t?4294967295:t>>>0,m=new RegExp(e.source,d+"g");(i=c.call(m,o))&&!((a=m.lastIndex)>l&&(u.push(o.slice(l,i.index)),i[h]>1&&i.index<o[h]&&f.apply(u,i.slice(1)),s=i[0][h],l=a,u[h]>=p));)m.lastIndex===i.index&&m.lastIndex++;return l===o[h]?!s&&m.test("")||u.push(""):u.push(o.slice(l)),u[h]>p?u.slice(0,p):u}:"0".split(void 0,0)[h]?function(e,t){return void 0===e&&0===t?[]:n.call(this,e,t)}:n,[function(n,r){var o=e(this),i=null==n?void 0:n[t];return void 0!==i?i.call(n,o,r):m.call(String(o),n,r)},function(e,t){var r=d(m,e,this,t,m!==n);if(r.done)return r.value;var c=o(e),f=String(this),h=i(c,RegExp),g=c.unicode,y=(c.ignoreCase?"i":"")+(c.multiline?"m":"")+(c.unicode?"u":"")+(p?"y":"g"),_=new h(p?c:"^(?:"+c.source+")",y),v=void 0===t?4294967295:t>>>0;if(0===v)return[];if(0===f.length)return null===u(_,f)?[f]:[];for(var b=0,S=0,w=[];S<f.length;){_.lastIndex=p?S:0;var M,D=u(_,p?f:f.slice(S));if(null===D||(M=l(s(_.lastIndex+(p?0:S)),f.length))===b)S=a(f,S,g);else{if(w.push(f.slice(b,S)),w.length===v)return w;for(var P=1;P<=D.length-1;P++)if(w.push(D[P]),w.length===v)return w;S=b=M}}return w.push(f.slice(b)),w}]}))},function(e,t,n){"use strict";var r,o,i,a,s=n(49),u=n(5),c=n(33),d=n(70),l=n(1),f=n(7),h=n(16),p=n(62),m=n(63),g=n(84),y=n(151).set,_=n(152)(),v=n(153),b=n(200),S=n(97),w=n(201),M=u.TypeError,D=u.process,P=D&&D.versions,T=P&&P.v8||"",k=u.Promise,A="process"==d(D),L=function(){},F=o=v.f,I=!!function(){try{var e=k.resolve(1),t=(e.constructor={})[n(9)("species")]=function(e){e(L,L)};return(A||"function"==typeof PromiseRejectionEvent)&&e.then(L)instanceof t&&0!==T.indexOf("6.6")&&-1===S.indexOf("Chrome/66")}catch(e){}}(),x=function(e){var t;return!(!f(e)||"function"!=typeof(t=e.then))&&t},C=function(e,t){if(!e._n){e._n=!0;var n=e._c;_((function(){for(var r=e._v,o=1==e._s,i=0,a=function(t){var n,i,a,s=o?t.ok:t.fail,u=t.resolve,c=t.reject,d=t.domain;try{s?(o||(2==e._h&&G(e),e._h=1),!0===s?n=r:(d&&d.enter(),n=s(r),d&&(d.exit(),a=!0)),n===t.promise?c(M("Promise-chain cycle")):(i=x(n))?i.call(n,u,c):u(n)):c(r)}catch(e){d&&!a&&d.exit(),c(e)}};n.length>i;)a(n[i++]);e._c=[],e._n=!1,t&&!e._h&&R(e)}))}},R=function(e){y.call(u,(function(){var t,n,r,o=e._v,i=O(e);if(i&&(t=b((function(){A?D.emit("unhandledRejection",o,e):(n=u.onunhandledrejection)?n({promise:e,reason:o}):(r=u.console)&&r.error&&r.error("Unhandled promise rejection",o)})),e._h=A||O(e)?2:1),e._a=void 0,i&&t.e)throw t.v}))},O=function(e){return 1!==e._h&&0===(e._a||e._c).length},G=function(e){y.call(u,(function(){var t;A?D.emit("rejectionHandled",e):(t=u.onrejectionhandled)&&t({promise:e,reason:e._v})}))},E=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),C(t,!0))},Y=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw M("Promise can't be resolved itself");(t=x(e))?_((function(){var r={_w:n,_d:!1};try{t.call(e,c(Y,r,1),c(E,r,1))}catch(e){E.call(r,e)}})):(n._v=e,n._s=1,C(n,!1))}catch(e){E.call({_w:n,_d:!1},e)}}};I||(k=function(e){p(this,k,"Promise","_h"),h(e),r.call(this);try{e(c(Y,this,1),c(E,this,1))}catch(e){E.call(this,e)}},(r=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(64)(k.prototype,{then:function(e,t){var n=F(g(this,k));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=A?D.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&C(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),i=function(){var e=new r;this.promise=e,this.resolve=c(Y,e,1),this.reject=c(E,e,1)},v.f=F=function(e){return e===k||e===a?new i(e):o(e)}),l(l.G+l.W+l.F*!I,{Promise:k}),n(69)(k,"Promise"),n(61)("Promise"),a=n(32).Promise,l(l.S+l.F*!I,"Promise",{reject:function(e){var t=F(this);return(0,t.reject)(e),t.promise}}),l(l.S+l.F*(s||!I),"Promise",{resolve:function(e){return w(s&&this===a?k:this,e)}}),l(l.S+l.F*!(I&&n(94)((function(e){k.all(e).catch(L)}))),"Promise",{all:function(e){var t=this,n=F(t),r=n.resolve,o=n.reject,i=b((function(){var n=[],i=0,a=1;m(e,!1,(function(e){var s=i++,u=!1;n.push(void 0),a++,t.resolve(e).then((function(e){u||(u=!0,n[s]=e,--a||r(n))}),o)})),--a||r(n)}));return i.e&&o(i.v),n.promise},race:function(e){var t=this,n=F(t),r=n.reject,o=b((function(){m(e,!1,(function(e){t.resolve(e).then(n.resolve,r)}))}));return o.e&&r(o.v),n.promise}})},function(e,t,n){"use strict";var r=n(206),o=n(65);n(98)("WeakSet",(function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}}),{add:function(e){return r.def(o(this,"WeakSet"),e,!0)}},r,!1,!0)},function(e,t,n){"use strict";var r=n(1),o=n(99),i=n(154),a=n(4),s=n(58),u=n(10),c=n(7),d=n(5).ArrayBuffer,l=n(84),f=i.ArrayBuffer,h=i.DataView,p=o.ABV&&d.isView,m=f.prototype.slice,g=o.VIEW;r(r.G+r.W+r.F*(d!==f),{ArrayBuffer:f}),r(r.S+r.F*!o.CONSTR,"ArrayBuffer",{isView:function(e){return p&&p(e)||c(e)&&g in e}}),r(r.P+r.U+r.F*n(6)((function(){return!new f(2).slice(1,void 0).byteLength})),"ArrayBuffer",{slice:function(e,t){if(void 0!==m&&void 0===t)return m.call(a(this),e);for(var n=a(this).byteLength,r=s(e,n),o=s(void 0===t?n:t,n),i=new(l(this,f))(u(o-r)),c=new h(this),d=new h(i),p=0;r<o;)d.setUint8(p++,c.getUint8(r++));return i}}),n(61)("ArrayBuffer")},function(e,t,n){var r=n(1);r(r.G+r.W+r.F*!n(99).ABV,{DataView:n(154).DataView})},function(e,t,n){n(46)("Int8",1,(function(e){return function(t,n,r){return e(this,t,n,r)}}))},function(e,t,n){n(46)("Uint8",1,(function(e){return function(t,n,r){return e(this,t,n,r)}}))},function(e,t,n){n(46)("Uint8",1,(function(e){return function(t,n,r){return e(this,t,n,r)}}),!0)},function(e,t,n){n(46)("Int16",2,(function(e){return function(t,n,r){return e(this,t,n,r)}}))},function(e,t,n){n(46)("Uint16",2,(function(e){return function(t,n,r){return e(this,t,n,r)}}))},function(e,t,n){n(46)("Int32",4,(function(e){return function(t,n,r){return e(this,t,n,r)}}))},function(e,t,n){n(46)("Uint32",4,(function(e){return function(t,n,r){return e(this,t,n,r)}}))},function(e,t,n){n(46)("Float32",4,(function(e){return function(t,n,r){return e(this,t,n,r)}}))},function(e,t,n){n(46)("Float64",8,(function(e){return function(t,n,r){return e(this,t,n,r)}}))},function(e,t,n){var r=n(1),o=n(16),i=n(4),a=(n(5).Reflect||{}).apply,s=Function.apply;r(r.S+r.F*!n(6)((function(){a((function(){}))})),"Reflect",{apply:function(e,t,n){var r=o(e),u=i(n);return a?a(r,t,u):s.call(r,t,u)}})},function(e,t,n){var r=n(1),o=n(59),i=n(16),a=n(4),s=n(7),u=n(6),c=n(186),d=(n(5).Reflect||{}).construct,l=u((function(){function e(){}return!(d((function(){}),[],e)instanceof e)})),f=!u((function(){d((function(){}))}));r(r.S+r.F*(l||f),"Reflect",{construct:function(e,t){i(e),a(t);var n=arguments.length<3?e:i(arguments[2]);if(f&&!l)return d(e,t,n);if(e==n){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var r=[null];return r.push.apply(r,t),new(c.apply(e,r))}var u=n.prototype,h=o(s(u)?u:Object.prototype),p=Function.apply.call(e,h,t);return s(p)?p:h}})},function(e,t,n){var r=n(12),o=n(1),i=n(4),a=n(40);o(o.S+o.F*n(6)((function(){Reflect.defineProperty(r.f({},1,{value:1}),1,{value:2})})),"Reflect",{defineProperty:function(e,t,n){i(e),t=a(t,!0),i(n);try{return r.f(e,t,n),!0}catch(e){return!1}}})},function(e,t,n){var r=n(1),o=n(29).f,i=n(4);r(r.S,"Reflect",{deleteProperty:function(e,t){var n=o(i(e),t);return!(n&&!n.configurable)&&delete e[t]}})},function(e,t,n){"use strict";var r=n(1),o=n(4),i=function(e){this._t=o(e),this._i=0;var t,n=this._k=[];for(t in e)n.push(t)};n(140)(i,"Object",(function(){var e,t=this._k;do{if(this._i>=t.length)return{value:void 0,done:!0}}while(!((e=t[this._i++])in this._t));return{value:e,done:!1}})),r(r.S,"Reflect",{enumerate:function(e){return new i(e)}})},function(e,t,n){var r=n(29),o=n(30),i=n(27),a=n(1),s=n(7),u=n(4);a(a.S,"Reflect",{get:function e(t,n){var a,c,d=arguments.length<3?t:arguments[2];return u(t)===d?t[n]:(a=r.f(t,n))?i(a,"value")?a.value:void 0!==a.get?a.get.call(d):void 0:s(c=o(t))?e(c,n,d):void 0}})},function(e,t,n){var r=n(29),o=n(1),i=n(4);o(o.S,"Reflect",{getOwnPropertyDescriptor:function(e,t){return r.f(i(e),t)}})},function(e,t,n){var r=n(1),o=n(30),i=n(4);r(r.S,"Reflect",{getPrototypeOf:function(e){return o(i(e))}})},function(e,t,n){var r=n(1);r(r.S,"Reflect",{has:function(e,t){return t in e}})},function(e,t,n){var r=n(1),o=n(4),i=Object.isExtensible;r(r.S,"Reflect",{isExtensible:function(e){return o(e),!i||i(e)}})},function(e,t,n){var r=n(1);r(r.S,"Reflect",{ownKeys:n(208)})},function(e,t,n){var r=n(1),o=n(4),i=Object.preventExtensions;r(r.S,"Reflect",{preventExtensions:function(e){o(e);try{return i&&i(e),!0}catch(e){return!1}}})},function(e,t,n){var r=n(12),o=n(29),i=n(30),a=n(27),s=n(1),u=n(55),c=n(4),d=n(7);s(s.S,"Reflect",{set:function e(t,n,s){var l,f,h=arguments.length<4?t:arguments[3],p=o.f(c(t),n);if(!p){if(d(f=i(t)))return e(f,n,s,h);p=u(0)}if(a(p,"value")){if(!1===p.writable||!d(h))return!1;if(l=o.f(h,n)){if(l.get||l.set||!1===l.writable)return!1;l.value=s,r.f(h,n,l)}else r.f(h,n,u(0,s));return!0}return void 0!==p.set&&(p.set.call(h,s),!0)}})},function(e,t,n){var r=n(1),o=n(133);o&&r(r.S,"Reflect",{setPrototypeOf:function(e,t){o.check(e,t);try{return o.set(e,t),!0}catch(e){return!1}}})},function(e,t,n){"use strict";var r=n(1),o=n(89)(!0);r(r.P,"Array",{includes:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),n(51)("includes")},function(e,t,n){"use strict";var r=n(1),o=n(209),i=n(15),a=n(10),s=n(16),u=n(146);r(r.P,"Array",{flatMap:function(e){var t,n,r=i(this);return s(e),t=a(r.length),n=u(r,0),o(n,r,r,t,0,1,e,arguments[1]),n}}),n(51)("flatMap")},function(e,t,n){"use strict";var r=n(1),o=n(209),i=n(15),a=n(10),s=n(35),u=n(146);r(r.P,"Array",{flatten:function(){var e=arguments[0],t=i(this),n=a(t.length),r=u(t,0);return o(r,t,t,n,0,void 0===e?1:s(e)),r}}),n(51)("flatten")},function(e,t,n){"use strict";var r=n(1),o=n(92)(!0),i=n(6)((function(){return"𠮷"!=="𠮷".at(0)}));r(r.P+r.F*i,"String",{at:function(e){return o(this,e)}})},function(e,t,n){"use strict";var r=n(1),o=n(210),i=n(97),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(i);r(r.P+r.F*a,"String",{padStart:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0,!0)}})},function(e,t,n){"use strict";var r=n(1),o=n(210),i=n(97),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(i);r(r.P+r.F*a,"String",{padEnd:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0,!1)}})},function(e,t,n){"use strict";n(71)("trimLeft",(function(e){return function(){return e(this,1)}}),"trimStart")},function(e,t,n){"use strict";n(71)("trimRight",(function(e){return function(){return e(this,2)}}),"trimEnd")},function(e,t,n){"use strict";var r=n(1),o=n(41),i=n(10),a=n(93),s=n(83),u=RegExp.prototype,c=function(e,t){this._r=e,this._s=t};n(140)(c,"RegExp String",(function(){var e=this._r.exec(this._s);return{value:e,done:null===e}})),r(r.P,"String",{matchAll:function(e){if(o(this),!a(e))throw TypeError(e+" is not a regexp!");var t=String(this),n="flags"in u?String(e.flags):s.call(e),r=new RegExp(e.source,~n.indexOf("g")?n:"g"+n);return r.lastIndex=i(e.lastIndex),new c(r,t)}})},function(e,t,n){n(129)("asyncIterator")},function(e,t,n){n(129)("observable")},function(e,t,n){var r=n(1),o=n(208),i=n(28),a=n(29),s=n(144);r(r.S,"Object",{getOwnPropertyDescriptors:function(e){for(var t,n,r=i(e),u=a.f,c=o(r),d={},l=0;c.length>l;)void 0!==(n=u(r,t=c[l++]))&&s(d,t,n);return d}})},function(e,t,n){var r=n(1),o=n(211)(!1);r(r.S,"Object",{values:function(e){return o(e)}})},function(e,t,n){var r=n(1),o=n(211)(!0);r(r.S,"Object",{entries:function(e){return o(e)}})},function(e,t,n){"use strict";var r=n(1),o=n(15),i=n(16),a=n(12);n(11)&&r(r.P+n(100),"Object",{__defineGetter__:function(e,t){a.f(o(this),e,{get:i(t),enumerable:!0,configurable:!0})}})},function(e,t,n){"use strict";var r=n(1),o=n(15),i=n(16),a=n(12);n(11)&&r(r.P+n(100),"Object",{__defineSetter__:function(e,t){a.f(o(this),e,{set:i(t),enumerable:!0,configurable:!0})}})},function(e,t,n){"use strict";var r=n(1),o=n(15),i=n(40),a=n(30),s=n(29).f;n(11)&&r(r.P+n(100),"Object",{__lookupGetter__:function(e){var t,n=o(this),r=i(e,!0);do{if(t=s(n,r))return t.get}while(n=a(n))}})},function(e,t,n){"use strict";var r=n(1),o=n(15),i=n(40),a=n(30),s=n(29).f;n(11)&&r(r.P+n(100),"Object",{__lookupSetter__:function(e){var t,n=o(this),r=i(e,!0);do{if(t=s(n,r))return t.set}while(n=a(n))}})},function(e,t,n){var r=n(1);r(r.P+r.R,"Map",{toJSON:n(212)("Map")})},function(e,t,n){var r=n(1);r(r.P+r.R,"Set",{toJSON:n(212)("Set")})},function(e,t,n){n(101)("Map")},function(e,t,n){n(101)("Set")},function(e,t,n){n(101)("WeakMap")},function(e,t,n){n(101)("WeakSet")},function(e,t,n){n(102)("Map")},function(e,t,n){n(102)("Set")},function(e,t,n){n(102)("WeakMap")},function(e,t,n){n(102)("WeakSet")},function(e,t,n){var r=n(1);r(r.G,{global:n(5)})},function(e,t,n){var r=n(1);r(r.S,"System",{global:n(5)})},function(e,t,n){var r=n(1),o=n(34);r(r.S,"Error",{isError:function(e){return"Error"===o(e)}})},function(e,t,n){var r=n(1);r(r.S,"Math",{clamp:function(e,t,n){return Math.min(n,Math.max(t,e))}})},function(e,t,n){var r=n(1);r(r.S,"Math",{DEG_PER_RAD:Math.PI/180})},function(e,t,n){var r=n(1),o=180/Math.PI;r(r.S,"Math",{degrees:function(e){return e*o}})},function(e,t,n){var r=n(1),o=n(214),i=n(193);r(r.S,"Math",{fscale:function(e,t,n,r,a){return i(o(e,t,n,r,a))}})},function(e,t,n){var r=n(1);r(r.S,"Math",{iaddh:function(e,t,n,r){var o=e>>>0,i=n>>>0;return(t>>>0)+(r>>>0)+((o&i|(o|i)&~(o+i>>>0))>>>31)|0}})},function(e,t,n){var r=n(1);r(r.S,"Math",{isubh:function(e,t,n,r){var o=e>>>0,i=n>>>0;return(t>>>0)-(r>>>0)-((~o&i|~(o^i)&o-i>>>0)>>>31)|0}})},function(e,t,n){var r=n(1);r(r.S,"Math",{imulh:function(e,t){var n=+e,r=+t,o=65535&n,i=65535&r,a=n>>16,s=r>>16,u=(a*i>>>0)+(o*i>>>16);return a*s+(u>>16)+((o*s>>>0)+(65535&u)>>16)}})},function(e,t,n){var r=n(1);r(r.S,"Math",{RAD_PER_DEG:180/Math.PI})},function(e,t,n){var r=n(1),o=Math.PI/180;r(r.S,"Math",{radians:function(e){return e*o}})},function(e,t,n){var r=n(1);r(r.S,"Math",{scale:n(214)})},function(e,t,n){var r=n(1);r(r.S,"Math",{umulh:function(e,t){var n=+e,r=+t,o=65535&n,i=65535&r,a=n>>>16,s=r>>>16,u=(a*i>>>0)+(o*i>>>16);return a*s+(u>>>16)+((o*s>>>0)+(65535&u)>>>16)}})},function(e,t,n){var r=n(1);r(r.S,"Math",{signbit:function(e){return(e=+e)!=e?e:0==e?1/e==1/0:e>0}})},function(e,t,n){"use strict";var r=n(1),o=n(32),i=n(5),a=n(84),s=n(201);r(r.P+r.R,"Promise",{finally:function(e){var t=a(this,o.Promise||i.Promise),n="function"==typeof e;return this.then(n?function(n){return s(t,e()).then((function(){return n}))}:e,n?function(n){return s(t,e()).then((function(){throw n}))}:e)}})},function(e,t,n){"use strict";var r=n(1),o=n(153),i=n(200);r(r.S,"Promise",{try:function(e){var t=o.f(this),n=i(e);return(n.e?t.reject:t.resolve)(n.v),t.promise}})},function(e,t,n){var r=n(47),o=n(4),i=r.key,a=r.set;r.exp({defineMetadata:function(e,t,n,r){a(e,t,o(n),i(r))}})},function(e,t,n){var r=n(47),o=n(4),i=r.key,a=r.map,s=r.store;r.exp({deleteMetadata:function(e,t){var n=arguments.length<3?void 0:i(arguments[2]),r=a(o(t),n,!1);if(void 0===r||!r.delete(e))return!1;if(r.size)return!0;var u=s.get(t);return u.delete(n),!!u.size||s.delete(t)}})},function(e,t,n){var r=n(47),o=n(4),i=n(30),a=r.has,s=r.get,u=r.key,c=function(e,t,n){if(a(e,t,n))return s(e,t,n);var r=i(t);return null!==r?c(e,r,n):void 0};r.exp({getMetadata:function(e,t){return c(e,o(t),arguments.length<3?void 0:u(arguments[2]))}})},function(e,t,n){var r=n(204),o=n(213),i=n(47),a=n(4),s=n(30),u=i.keys,c=i.key,d=function(e,t){var n=u(e,t),i=s(e);if(null===i)return n;var a=d(i,t);return a.length?n.length?o(new r(n.concat(a))):a:n};i.exp({getMetadataKeys:function(e){return d(a(e),arguments.length<2?void 0:c(arguments[1]))}})},function(e,t,n){var r=n(47),o=n(4),i=r.get,a=r.key;r.exp({getOwnMetadata:function(e,t){return i(e,o(t),arguments.length<3?void 0:a(arguments[2]))}})},function(e,t,n){var r=n(47),o=n(4),i=r.keys,a=r.key;r.exp({getOwnMetadataKeys:function(e){return i(o(e),arguments.length<2?void 0:a(arguments[1]))}})},function(e,t,n){var r=n(47),o=n(4),i=n(30),a=r.has,s=r.key,u=function(e,t,n){if(a(e,t,n))return!0;var r=i(t);return null!==r&&u(e,r,n)};r.exp({hasMetadata:function(e,t){return u(e,o(t),arguments.length<3?void 0:s(arguments[2]))}})},function(e,t,n){var r=n(47),o=n(4),i=r.has,a=r.key;r.exp({hasOwnMetadata:function(e,t){return i(e,o(t),arguments.length<3?void 0:a(arguments[2]))}})},function(e,t,n){var r=n(47),o=n(4),i=n(16),a=r.key,s=r.set;r.exp({metadata:function(e,t){return function(n,r){s(e,t,(void 0!==r?o:i)(n),a(r))}}})},function(e,t,n){var r=n(1),o=n(152)(),i=n(5).process,a="process"==n(34)(i);r(r.G,{asap:function(e){var t=a&&i.domain;o(t?t.bind(e):e)}})},function(e,t,n){"use strict";var r=n(1),o=n(5),i=n(32),a=n(152)(),s=n(9)("observable"),u=n(16),c=n(4),d=n(62),l=n(64),f=n(23),h=n(63),p=h.RETURN,m=function(e){return null==e?void 0:u(e)},g=function(e){var t=e._c;t&&(e._c=void 0,t())},y=function(e){return void 0===e._o},_=function(e){y(e)||(e._o=void 0,g(e))},v=function(e,t){c(e),this._c=void 0,this._o=e,e=new b(this);try{var n=t(e),r=n;null!=n&&("function"==typeof n.unsubscribe?n=function(){r.unsubscribe()}:u(n),this._c=n)}catch(t){return void e.error(t)}y(this)&&g(this)};v.prototype=l({},{unsubscribe:function(){_(this)}});var b=function(e){this._s=e};b.prototype=l({},{next:function(e){var t=this._s;if(!y(t)){var n=t._o;try{var r=m(n.next);if(r)return r.call(n,e)}catch(e){try{_(t)}finally{throw e}}}},error:function(e){var t=this._s;if(y(t))throw e;var n=t._o;t._o=void 0;try{var r=m(n.error);if(!r)throw e;e=r.call(n,e)}catch(e){try{g(t)}finally{throw e}}return g(t),e},complete:function(e){var t=this._s;if(!y(t)){var n=t._o;t._o=void 0;try{var r=m(n.complete);e=r?r.call(n,e):void 0}catch(e){try{g(t)}finally{throw e}}return g(t),e}}});var S=function(e){d(this,S,"Observable","_f")._f=u(e)};l(S.prototype,{subscribe:function(e){return new v(e,this._f)},forEach:function(e){var t=this;return new(i.Promise||o.Promise)((function(n,r){u(e);var o=t.subscribe({next:function(t){try{return e(t)}catch(e){r(e),o.unsubscribe()}},error:r,complete:n})}))}}),l(S,{from:function(e){var t="function"==typeof this?this:S,n=m(c(e)[s]);if(n){var r=c(n.call(e));return r.constructor===t?r:new t((function(e){return r.subscribe(e)}))}return new t((function(t){var n=!1;return a((function(){if(!n){try{if(h(e,!1,(function(e){if(t.next(e),n)return p}))===p)return}catch(e){if(n)throw e;return void t.error(e)}t.complete()}})),function(){n=!0}}))},of:function(){for(var e=0,t=arguments.length,n=new Array(t);e<t;)n[e]=arguments[e++];return new("function"==typeof this?this:S)((function(e){var t=!1;return a((function(){if(!t){for(var r=0;r<n.length;++r)if(e.next(n[r]),t)return;e.complete()}})),function(){t=!0}}))}}),f(S.prototype,s,(function(){return this})),r(r.G,{Observable:S}),n(61)("Observable")},function(e,t,n){var r=n(5),o=n(1),i=n(97),a=[].slice,s=/MSIE .\./.test(i),u=function(e){return function(t,n){var r=arguments.length>2,o=!!r&&a.call(arguments,2);return e(r?function(){("function"==typeof t?t:Function(t)).apply(this,o)}:t,n)}};o(o.G+o.B+o.F*s,{setTimeout:u(r.setTimeout),setInterval:u(r.setInterval)})},function(e,t,n){var r=n(1),o=n(151);r(r.G+r.B,{setImmediate:o.set,clearImmediate:o.clear})},function(e,t,n){for(var r=n(148),o=n(57),i=n(24),a=n(5),s=n(23),u=n(72),c=n(9),d=c("iterator"),l=c("toStringTag"),f=u.Array,h={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},p=o(h),m=0;m<p.length;m++){var g,y=p[m],_=h[y],v=a[y],b=v&&v.prototype;if(b&&(b[d]||s(b,d,f),b[l]||s(b,l,y),u[y]=f,_))for(g in r)b[g]||i(b,g,r[g],!0)}},function(e,t,n){(function(t){!function(t){"use strict";var n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag",u="object"==typeof e,c=t.regeneratorRuntime;if(c)u&&(e.exports=c);else{(c=t.regeneratorRuntime=u?e.exports:{}).wrap=m;var d={},l={};l[i]=function(){return this};var f=Object.getPrototypeOf,h=f&&f(f(T([])));h&&h!==n&&r.call(h,i)&&(l=h);var p=v.prototype=y.prototype=Object.create(l);_.prototype=p.constructor=v,v.constructor=_,v[s]=_.displayName="GeneratorFunction",c.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===_||"GeneratorFunction"===(t.displayName||t.name))},c.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s in e||(e[s]="GeneratorFunction")),e.prototype=Object.create(p),e},c.awrap=function(e){return{__await:e}},b(S.prototype),S.prototype[a]=function(){return this},c.AsyncIterator=S,c.async=function(e,t,n,r){var o=new S(m(e,t,n,r));return c.isGeneratorFunction(t)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(p),p[s]="Generator",p[i]=function(){return this},p.toString=function(){return"[object Generator]"},c.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},c.values=T,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(D),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),D(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;D(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:T(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}}}function m(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,i=Object.create(o.prototype),a=new P(r||[]);return i._invoke=function(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return k()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=w(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=g(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(e,n,a),i}function g(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function y(){}function _(){}function v(){}function b(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function S(e){function n(t,o,i,a){var s=g(e[t],e,o);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"==typeof c&&r.call(c,"__await")?Promise.resolve(c.__await).then((function(e){n("next",e,i,a)}),(function(e){n("throw",e,i,a)})):Promise.resolve(c).then((function(e){u.value=e,i(u)}),a)}a(s.arg)}var o;"object"==typeof t.process&&t.process.domain&&(n=t.process.domain.bind(n)),this._invoke=function(e,t){function r(){return new Promise((function(r,o){n(e,t,r,o)}))}return o=o?o.then(r,r):r()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var r=g(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,d;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function M(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function D(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(M,this),this.reset(!0)}function T(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:k}}function k(){return{value:void 0,done:!0}}}("object"==typeof t?t:"object"==typeof window?window:"object"==typeof self?self:this)}).call(this,n(14))},function(e,t,n){n(607),e.exports=n(32).RegExp.escape},function(e,t,n){var r=n(1),o=n(608)(/[\\^$*+?.()|[\]{}]/g,"\\$&");r(r.S,"RegExp",{escape:function(e){return o(e)}})},function(e,t){e.exports=function(e,t){var n=t===Object(t)?function(e){return t[e]}:t;return function(t){return String(t).replace(e,n)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};n(610);var o=v(n(73)),i=v(n(611)),a=n(373),s=v(n(672)),u=v(n(697)),c=v(n(713)),d=n(377),l=(v(n(166)),v(n(165))),f=v(n(107)),h=n(3),p=n(20),m=(n(228),v(n(378))),g=v(n(717)),y=v(n(31)),_=v(n(718));function v(e){return e&&e.__esModule?e:{default:e}}function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var S=new f.default("cache","FoxitPDFSDKForWeb_cache"),w=[{bsStandardName:"Helvetica",bsSubstName:"Arial",wWeight:400,bItalic:0},{bsStandardName:"Helvetica-Bold",bsSubstName:"Arial",wWeight:700,bItalic:0},{bsStandardName:"Helvetica-BoldOblique",bsSubstName:"Arial",wWeight:700,bItalic:1},{bsStandardName:"Helvetica-Oblique",bsSubstName:"Arial",wWeight:400,bItalic:1},{bsStandardName:"Times-Roman",bsSubstName:"Times New Roman",wWeight:400,bItalic:0},{bsStandardName:"Times-Bold",bsSubstName:"Times New Roman",wWeight:700,bItalic:0},{bsStandardName:"Times-BoldItalic",bsSubstName:"Times New Roman",wWeight:700,bItalic:1},{bsStandardName:"Times-Italic",bsSubstName:"Times New Roman",wWeight:400,bItalic:1}],M=function(){function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.postMessageToUi,l=r.cache,f=void 0===l?{}:l,h=r.enginePath,p=void 0===h?".":h,g=r.fontPath,y=void 0===g?"http://webpdf.foxitsoftware.com/webfonts":g,v=r.readBlock,M=void 0===v?8192:v,T=(r.fontMap,r.brotli);b(this,e);var k=(0,o.default)(),A=k.promise;this.jrEnginePromise=A,this.fontPath=y,this.serverFontCache={};var L=T.core;this.customFontMaps=[];var F={onRuntimeInitialized:function(){},printErr:function(e){console.warn("[JR ENGINE]",e)},locateFile:function(e){return"gsdk.wasm"===e?!1===L||-1!==navigator.userAgent.indexOf("Edge")?[p,e].join("/")+"?h="+d.wasmHash:"data:application/octet-stream;base64,"+[p,e+".brotli"].join("/")+"?h="+d.wasmHash:"gsdk.asm.js.mem"===e?[p,e].join("/")+"?h="+d.asmMemHash:[p,e].join("/")+"?h="+d.wasmHash},readBinary:function(e){var t="data:application/octet-stream;base64,";return 0===e.indexOf(t)&&(e=e.replace(t,"")),new Promise((function(t,n){!1===L?P(e,t,n):D(e,t,n,"wasmBinary",i,f.wasmBinary)}))},readAsync:function(e,t,n){if(!1===L)P(e,t,n);else{if(f.asmMem===e)return void S.get(f.asmMem).then((function(r){r?t(r):D(e,t,n,"asmMem",i,f.asmMem)}),(function(){D(e,t,n,"asmMem",i)}));D(e,t,n,"asmMem",i)}}},I=void 0;if(f.wasmBinary===[p,"gsdk.wasm.brotli"].join("/")+"?h="+d.wasmHash){var x=(0,o.default)();I=x.promise,S.get("wasmBinary").then((function(e){e&&(F.wasmBinary=e)})).finally((function(){x.resolve()}))}else I=Promise.resolve();I.then((function(e){var t=void 0;return F.wasmBinary||(t=(0,m.default)()?F.readBinary(F.locateFile("gsdk.wasm")).then((function(e){return e&&(F.wasmBinary=e)})):Promise.resolve()),t})).then((function(){return GSDK(F).then((function(e){n.engine=e,e.wasmBinary=null,GSDK=null,n.annotManager=new s.default(e),n.actionManager=new u.default(e),n.graphicsObjectManager=new c.default(e,n),k.resolve()}))})),this.pdfDocCache={},this.fontInfoMap={},A.then((function(){var e=n.engine,t=0,r=0;e.setThirdPartyFontHandler(e.ThirdPartyFontHandler.implement({GetThirdPartyFont:function(t,r,o,i,s){for(var u=0;u<w.length;u++)if(t===w[u].bsStandardName){var c=8388608|s;u%4==1||u%4==2?c=16777216:c&=-16777217,u%4>=2?c|=33554432:c&=-33554433,t=w[u].bsSubstName,o=w[u].bItalic,i=w[u].wWeight,s=c;break}try{var d=[t,r,o,i,s].join("-");if(n.fontInfoMap[d])return n.fontInfoMap[d];var l=(0,a.getThirdPartyFontBuffer)(y,t,r,o,i,s);if(!l)return null;var f=e.ThirdPartyFontInfo.implement({GetFaceIndex:function(){return 0},GetFontFileData:function(){var t=e._malloc(l.byteLength);return e.HEAPU8.set(new Uint8Array(l),t),t},GetFontFileSize:function(){return l.byteLength}});return n.fontInfoMap[d]=f}catch(e){return isNaN(e)||(e=n.engine.getErrorCode(e)),console.warn(e),null}},GetWebFontFileStream:function(t){var n=(0,a.getWatermarkFontFileBuffer)(t);if(!n)return null;var r=null;try{r=e.StreamCallback.implement({Release:function(){},Flush:function(){return!0},GetSize:function(){return n.byteLength},WriteBlock:function(e,t,n){return console.warn("readonly mode, write function shouldn't be called"),!0},ReadBlock:function(t,r,o){var i=n.slice(r,r+o);return e.HEAPU8.set(i,t),!0}})}catch(e){isNaN(e)||(e=this.engine.getErrorCode(e)),console.warn(e)}return r},GetFontFilesPos:function(e){return(0,a.getWatermarkFontFilesPos)(e)},GetPlatformIDFromThirdParty:function(){return _.default},CountCachedFontFromThirdParty:function(){return n.getCustomUploadFontsCount()},MGetCachedFontDataFromThirdParty:function(e){r=e;var o=n.getCustomUploadFontByIndex(e);if(!o)return 0;var i=new Uint8Array(o.value);t=i.byteLength;var a=n.engine._malloc(t);return n.engine.HEAPU8.set(i,a),a},GetCachedName:function(){var e=n.getCustomUploadFontByIndex(r);if(!e)return 0;var t="custom__"+e.name;return new n.engine.WString(t)},MGetFontFileDataByNameFromThirdParty:function(e){e=e.toString();var r=void 0,o=/^custom__/;if(o.test(e)){e=e.replace(o,"");var i=n.getCustomUploadFontByName(e);r=i?i.value:null}else r=n.getFontFromServer(e);if(!r)return t=0,0;var a=new Uint8Array(r);t=a.byteLength;var s=n.engine._malloc(t);return n.engine.HEAPU8.set(a,s),s},MGetNotExistFontFamilyFromThirdParty:function(){var e=n.getNotExistFontsString();if(!e)return 0;var r=new n.engine.String(e),o=n.engine.HEAPU8.slice(r.GetBuffer(),r.GetBuffer()+e.length);t=e.length;var i=n.engine._malloc(e.length);return n.engine.HEAPU8.set(o,i),i},GetSize:function(){return t}}))})).then((function(){setTimeout((function(){(0,a.prefetchCache)()}),0)})),this.userName="Foxit Web",this.defaultReadBlockSize=M}return e.prototype.getFontBuffer=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:400,i=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return(0,a.getThirdPartyFontBuffer)(this.fontPath,e,r,n,o,t,i)},e.prototype.updatePdfDocCache=function(e){var t=e.id;this.pdfDocCache[t]=e},e.prototype.getPDFDocById=function(e){return this.pdfDocCache[e]||null},e.prototype.destroyDoc=function(e){delete this.pdfDocCache[e]},e.prototype.checkLicense=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p.EMPTY_STR,r=(0,o.default)();return this.jrEnginePromise.then((function(){return e.engine.initialize(t,n).toString().split(" ")})).then((function(t){var n=0==+t[0];return n&&(e.engine.Library.SetDefaultFileSize(e.defaultReadBlockSize),e.engine.setCacheSize(572)),r.resolve({flag:n})})),r.promise},e.prototype.checkLicense2=function(e){var t=this,n=(0,o.default)();return this.jrEnginePromise.then((function(){return t.engine.initialize(e,"").toString().split(" ")})).then((function(e){return 0===+e[0]?(t.engine.Library.SetDefaultFileSize(8192),t.engine.setCacheSize(572),n.resolve({flag:!0,other:e.slice(1).join(" ")})):n.resolve({flag:!1})})),n.promise},e.prototype.createNewPortfolioDoc=function(e,t,n){var r=this.engine,o=new FileReaderSync,a=new i.default(this,{isCreatePortfolio:!0}),s=a.pdfPortfolio.portfolio;if(s.SetInitialViewMode(r.InitialViewMode.e_InitialViewTileMode),e instanceof Blob){var u=o.readAsArrayBuffer(e),c=u.byteLength,d=r._malloc(c);r.HEAPU8.set(new Uint8Array(u),d);var l=r.createPDFDocWithBuffer(d,c);l.Load(new r.String("")),a.doc.RemovePage(0),a.doc.InsertDocument(0,l,0,new r.WString),d&&r._free(d),d=null}if(Array.isArray(t)&&t.length){var f=new r.PortfolioFolderNode(s.GetRootNode());t.forEach((function(e,t){var n=r.ReaderCallback.implement({Release:function(){},GetSize:function(){return e.size},GetPosition:function(){return e.size},ReadBlock:function(t,n,i){var a=new Uint8Array(o.readAsArrayBuffer(e.slice(n,n+i)));return r.HEAPU8.set(a,t),!0}}),i=f.AddFile(n,new r.WString(e.name));0===t&&s.SetInitialFileSpecKeyName(i.GetKeyName()),i.GetFileSpec().SetModifiedDateTime(y.default.ToDateTime(r,e.lastModified||e.lastModifiedDate))}));for(var h=s.GetSchemaFields(),p=0;p<h.GetSize();p++){if(h.GetAt(p).GetKeyName().toString()==s.GetSortingFieldKeyName().toString()){h.RemoveAt(p);break}}s.SetSchemaFields(h),s.SetSortingFieldKeyName(new r.String("FileName"))}this.setMetaData(a,n,"");var m=[];return a.getStream({writeStream:function(e,t,n){m.push(e)}},0).then((function(e){for(var t=new Uint8Array(e),n=0,r=0,o=m.length;r<o;r++){var i=m[r];t.set(new Uint8Array(i),n),n+=i.byteLength}return a.destroy(),t.buffer}))},e.prototype.createNewDoc=function(e,t,n){var r=new i.default(this,{isCreate:!0});this.setMetaData(r,e,t);var o=void 0,a=void 0;return n&&(n.width&&(o=n.width),n.height&&(a=n.height)),r.insertPage(0,o,a).then((function(e){var t=[];return r.getStream({writeStream:function(e,n,r){t.push(e)}},0).then((function(e){for(var n=new Uint8Array(e),o=0,i=0,a=t.length;i<a;i++){var s=t[i];n.set(new Uint8Array(s),o),o+=s.byteLength}return r.destroy(),n.buffer}))}))},e.prototype.setMetaData=function(e,t,n){var r=this.engine,o=(0,h.CWString)(r,"Title"),i=(0,h.CWString)(r,"Author"),a=(0,h.CWString)(r,"Producer"),s=void 0;s=t?(0,h.CWString)(r,t):(0,h.CWString)(r,"Untitled.pdf");var u=void 0;u=n?(0,h.CWString)(r,n):(0,h.CWString)(r,"Unknown");var c=(0,h.CWString)(r,"Foxit PDFWebSDK");e.setMetadataValue(o,s),e.setMetadataValue(i,u),e.setMetadataValue(a,c);var d=(new Date).toString();e.setMetadataValue("CreationDate",d),e.setMetadataValue("ModDate",d)},e.prototype.getPDFDoc=function(e){var t=new i.default(this,e);return this.updatePdfDocCache(t),t},e.prototype.getPDFDocByEngineDoc=function(e){var t=new i.default(this,{engineDoc:e});return this.updatePdfDocCache(t),t},e.prototype.getFDFDoc=function(e){var t=this,n=e.size,r=e.getBuffer,o=(e.release,this.engine.ReaderCallback.implement({Release:function(){},GetSize:function(){return n},ReadBlock:function(e,n,o){var i=new Uint8Array(r(n,o));return t.engine.HEAPU8.set(i,e),!0}}));return Promise.resolve(new this.engine.FDFDoc(o))},e.prototype.getFDFFromURL=function(e){var t=this,n=+this.requestData("GET",!1,e,1,1,!0).getResponseHeader("Content-Range").match("bytes[^]+?/([^]+)")[1],r=this.engine.ReaderCallback.implement({Release:function(){},GetSize:function(){return n},ReadBlock:function(n,r,o){var i=new Uint8Array(t.requestData("GET",!1,e,r,o));return t.engine.HEAPU8.set(i,n),!0}});return Promise.resolve(new this.engine.FDFDoc(r))},e.prototype.getPDFDocAsync=function(e){var t=e.size,n=e.getBuffer,r=e.release,o=new i.default(this,{getBuffer:n,size:t,release:r,async:!0});return this.updatePdfDocCache(o),o},e.prototype.getPDFDocByReaderCalback=function(e){var t=new i.default(this.engine,{readerCallbackParams:e});return this.updatePdfDocCache(t),t},e.prototype.getPDFDocByAsyncReaderCallback=function(e){var t=new i.default(this.engine,{readerCallbackParams:e,async:!0});return this.updatePdfDocCache(t),t},e.prototype.requestData=function(e,t,n,r,o,i){var a=new XMLHttpRequest;if(a.open(e,n,t),void 0!==r){var s="bytes="+r+"-"+(r+o-1);a.setRequestHeader("Range",s)}a.responseType="arraybuffer",a.send(null);var u=a.status;if(u>=200&&u<300||304===u)return i?a:a.response},e.prototype.createReaderCallback=function(e){var t=this.engine;return this.engine.ReaderCallback.implement({jr:this,engine:t,url:e,load:function(){var e=this.jr.requestData("GET",!1,this.url),t=this.docBuffer=new Uint8Array(e);this.size=t.length},Release:function(){this.docBuffer=null},GetSize:function(){return this.size||this.load(),this.size},ReadBlock:function(e,t,n){this.size||this.load();var r=this.docBuffer.slice(t,t+n);return this.engine.HEAPU8.set(r,e),!0}})},e.prototype.registerSecurityCallback=function(e,t){switch(this.unRegisterSecurityCallback(e),e){case"FoxitDRM":return this.registerDRMSecurityCallback(t);default:return!1}},e.prototype.registerDRMSecurityCallback=function(){var e=this;if(this.registeredDRMSecurityCallback)return!0;try{var t=this.engine,n=t.DRMSecurityCallback.implement({Release:function(){},GetSecurityType:function(){return t.EncryptType.e_EncryptFoxitDRM},IsOwner:function(t,n){var r=e.getPDFDocFromCDoc(t);return!!r&&e.getDrmProperty(r,"isOwner")},GetUserPermissions:function(t,n){var r=e.getPDFDocFromCDoc(t);return r?e.getDrmProperty(r,"userPermissions"):0},GetCipherType:function(n,r){var o=e.getPDFDocFromCDoc(n);return o?t.CipherType.values[e.getDrmProperty(o,"cipher")]:t.CipherType.e_CipherNone},GetKeyLength:function(t,n){var r=e.getPDFDocFromCDoc(t);return r?e.getDrmProperty(r,"keyLength"):16},GetFileID:function(n,r){var o=e.getPDFDocFromCDoc(n);return o?new t.String(e.getDrmProperty(o,"fileId","")):new t.String("")},GetInitialKey:function(n,r){var o=e.getPDFDocFromCDoc(n);return o?new t.String(e.getDrmProperty(o,"initialKey","")):new t.String("")}}),r=t.Library.RegisterSecurityCallback((0,h.CString)(t,"FoxitDRM"),n);return r&&(this.registeredDRMSecurityCallback=!0),r}catch(e){return!1}},e.prototype.registerOpenFileSecurityCallback=function(e){var t=this.engine;this.registeredOpenFileSecurityCallback&&this.unRegisterSecurityCallback("FOPN_foweb");try{var n=t.CustomSecurityCallback.implement({JSUseStandardCryptoMethod:function(){return!0},JSCreateContext:function(t,n,r){return e.$$ptr},JSReleaseContext:function(e){return!0},JSGetUserPermissions:function(e,t){var n=0;return 4&t&&(n|=4),8&t&&(n|=8),16&t&&(n|=16),32&t&&(n|=32),n},JSIsOwner:function(e){return!1},JSGetCipher:function(n){return e.cipher&&2===e.cipher?t.CipherType.e_CipherAES:t.CipherType.e_CipherRC4},JSGetEncryptKey:function(n){var r=new t.String(""),o=t._malloc(e.encryptKey.length),i=new Uint8Array(e.encryptKey);return t.HEAPU8.set(i,o),r.Load(o,e.encryptKey.length),r},JSGetDecryptedSize:function(e,t){},JSStartDecryptor:function(e,t,n){},JSDecryptData:function(e,t,n){},JSFinishDecryptor:function(e){},JSGetEncryptedSize:function(e,t,n,r,o){},JSEncryptData:function(e,t,n,r,o,i,a){}}),r=t.Library.RegisterCustomSecurityCallback((0,h.CString)(t,"FOPN_foweb"),n);return r&&(this.registeredOpenFileSecurityCallback=!0),r}catch(e){return!1}},e.prototype.unRegisterSecurityCallback=function(e){var t=this.engine,n=(0,h.CString)(t,e);try{this.engine.Library.UnregisterSecurityCallback(n)}catch(e){try{this.engine.Library.UnregisterSecurityCallback(n)}catch(e){}}},e.prototype.setUserName=function(e){this.userName=e},e.prototype.getUserName=function(){return this.userName},e.prototype.getRotatedAnnotRect=function(e){var t=e.GetRect(),n={left:t.left,top:t.top,right:t.right,bottom:t.bottom,rotate:0};return t.delete(),n},e.prototype.getHexString=function(e){for(var t="",n=e.GetLength(),r=e.GetBuffer(),o=0;o<n;o++){var i=this.engine.HEAP8[r+o]>>>0&255;t+=String.fromCharCode(i)}return t},e.prototype.getPDFDocFromCDoc=function(e){var t=this.pdfDocCache;for(var n in t){var r=t[n];if(e.Equals(r.doc))return r}},e.prototype.getDrmProperty=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=e.otherData;if(!r)return n;var o=r.drm;return o?o[t]:n},e.prototype.getPDFString=function(e){var t=void 0;try{t=e.toString()}catch(s){for(var n="",r=e.GetBuffer(),o=0,i=e.GetLength();o<i;o++){var a=this.engine.HEAP8[r+o]>>>0&255;n+=String.fromCharCode(a)}t=this.pdfNameDecoding(n)}return t},e.prototype.pdfNameDecoding=function(e){if(254==e.charCodeAt(0)&&255==e.charCodeAt(1)){for(var t="",n=2;n<e.length;n+=2)t+=String.fromCharCode((e.charCodeAt(n)<<8)+e.charCodeAt(n+1));return t}return e},e.prototype.setFontMap=function(e){(0,a.setCustomFontMap)(e)},e.prototype.setWatermarkFontMap=function(e){(0,a.setCustomWatermarkFontMap)(e)},e.prototype.addFontMap=function(e){e&&(this.customFontMaps=this.customFontMaps.concat(e))},e.prototype.getCharsetByFontName=function(e){if(e){for(var t=0,n=this.customFontMaps.length;t<n;t++){var r=this.customFontMaps[t];if(r.name.replace(" ","").replace("-","")===e)return this.engine.Charset.values[r.charset||0]}return this.engine.Charset.e_CharsetANSI}},e.prototype.getFontInfoByFontName=function(e){if(e){for(var t=0,n=this.customFontMaps.length;t<n;t++){var r=this.customFontMaps[t];if(r.name.replace(" ","").replace("-","")===e)return{charset:this.engine.Charset.values[r.charset||0],style:r.style}}return{charset:this.engine.Charset.e_CharsetANSI,style:0}}},e.prototype.setActionToDict=function(e,t,n){var r,o=this.engine,i=this.actionManager;if(r=i.create(e,actionJson.type),-1==trigger)try{this.engineWidget.SetAction(jsaction)}catch(e){isNaN(e)||(e=o.getErrorCode(e)),console.warn(e)}else{var a=void 0,s=(0,h.CString)(o,"AA"),u=engineWidget.GetDict(),c=u.GetElement(s);if(c){var d=c.GetDict();a=new o.AdditionalAction(this.pdfPage.doc,d)}else{var l=o.PDFDictionary.Create();u.SetAt(s,l),a=new o.AdditionalAction(this.pdfPage.doc,l)}a.SetAction(o.TriggerEvent.values[trigger],r)}var f=i.get(r,this.doc,this.JR);return f.create(actionJson),f},e.prototype.asyncOperation=function(e,t){var n=this;t||(t=(0,o.default)());try{t.resolve(e())}catch(r){if(17!==this.engine.getErrorCode(r).value)throw r;return setTimeout((function(){n.asyncOperation(e,t)}),30),t.promise}return t.promise},e.prototype.setJPXDownSample=function(e){this._JPXDownSample=e},e.prototype.getJPXDownSample=function(){var e=this._JPXDownSample;return void 0===e||!!e},e.prototype.SetJSObjectRef=function(e){return this.objectMap=this.objectMap||{},this.objectMap[e.$$.ptr]=e,e.$$.ptr},e.prototype.GetJSObjectFromPtr=function(e){if(this.objectMap)return this.objectMap[e]},e.prototype.getEditorContext=function(e,t){var n=this.pageEditorContext;return n?n.setCallbacks(e):(n=this.pageEditorContext=new g.default(this.engine,e,t)).context},e.prototype.storeNotExistFonts=function(e){this._notExistFonts=e},e.prototype.getNotExistFontsString=function(){return(this._notExistFonts||[]).join("\n")},e.prototype.checkFontNotExist=function(e){return(this._notExistFonts||[]).find((function(t){return t===e}))},e.prototype.checkCertificatePassword=function(e,t){var n=this.engine,r=(new FileReaderSync).readAsArrayBuffer(e),o=n.StreamCallback.implement({GetSize:function(){return r.byteLength},GetPosition:function(){return 0},ReadBlock:function(e,t,o){var i=new Uint8Array(r,t,o);return n.HEAPU8.set(i,e),!0}});return n.CheckCertPassword(o,new n.String(t))},e.prototype.getCertificateInfo=function(e,t){var n=this.engine,o={},i=(new FileReaderSync).readAsArrayBuffer(e),a=n.StreamCallback.implement({GetSize:function(){return i.byteLength},GetPosition:function(){return 0},ReadBlock:function(e,t,r){var o=new Uint8Array(i,t,r);return n.HEAPU8.set(o,e),!0}}),s=void 0;if(t?(s=n.GetCerFromPfx(a,new n.String(t)),o.pfxFile=e):s=n.ReadFileContent(a),!s.GetLength())return o;var u=n.HEAPU8.subarray(s.GetBuffer(),s.GetBuffer()+s.GetLength());o.cerFile=new Blob([u],{type:"application/pkix-cert"}),o.serial=n.GetCertificateInfo(s,new n.String("SerialNumber")).toString(),o.validPeriodFrom=n.GetCertificateInfo(s,new n.String("ValidPeriodFrom")).toString(),o.validPeriodTo=n.GetCertificateInfo(s,new n.String("ValidPeriodTo")).toString(),n.GetCertificateInfo(s,new n.String("Issuer")).toString().split(",").forEach((function(e){var t=e.split("="),n=r(t,2),i=n[0],a=n[1];switch(i.replace(/^\s+|\s+$/g,"")){case"CN":o.subjectName=a,o.issuerName=a;break;case"E":o.email=a;break;case"O":o.orgName=a;break;case"OU":o.orgUnit=a;break;case"C":o.country=a}}));var c=n.GetCertificateInfo(s,new n.String("KeyUsage")).toString();return c.indexOf("Digital Signature")>=0&&c.indexOf("Data Encipherment")>=0?o.keyUsage=2:c.indexOf("Digital Signature")>=0?o.keyUsage=0:c.indexOf("Data Encipherment")>=0?o.keyUsage=1:o.keyUsage=-1,o},e.prototype.storeCustomUploadFonts=function(e){this._customUploadFonts=e},e.prototype.getCustomUploadFontsCount=function(){return this._customUploadFonts?this._customUploadFonts.length:0},e.prototype.getCustomUploadFontByIndex=function(e){var t=this._customUploadFonts;return t?t[e]:null},e.prototype.getCustomUploadFontByName=function(e){var t=this._customUploadFonts;return t?t.find((function(t){return t.name===e})):null},e.prototype.storeFontServerRoot=function(e){this._fontServerRoot=e},e.prototype.getFontServerRoot=function(){return this._fontServerRoot||""},e.prototype.getFontFromServer=function(e){var t=Date.now(),n=this.getFontServerRoot()+e,r=this.serverFontCache[n];if(r)return r;var o=new XMLHttpRequest;return o.open("GET",n,!1),o.responseType="arraybuffer",o.send(),o.status>=200&&o.status<300||304===o.status?(postMessage({workflow:"fontProfile",name:e,time:Date.now()-t}),this.serverFontCache[n]=o.response):void 0},e.prototype.cacheFontConfig=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.storeNotExistFonts(e.notExistFonts),this.storeCustomUploadFonts(e.customUploadFonts),this.storeFontServerRoot(e.fontServerRoot)},e.prototype.getFxcoreFontList=function(){var e=this.engine,t=[];if(!e.getFontCommonList)return t;for(var n=e.getFontCommonList(),r=n.GetSize();r--;)t[r]=n.GetAt(r).toString();return t},e}();function D(e,t,n,r,o){P(e,(function(n){var i=(0,l.default)(new Uint8Array(n)).buffer;t(i),S.set(r,i).then((function(){o(r,e)}),(function(){}))}),n)}function P(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(){200==r.status||0==r.status&&r.response?t(r.response):n()},r.onerror=n,r.send(null)}t.default=M},function(e,t,n){"use strict";Uint8Array.prototype.slice||Object.defineProperty(Uint8Array.prototype,"slice",{value:Array.prototype.slice})},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_slicedToArray=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},_createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),_getUniqueId=__webpack_require__(68),_getUniqueId2=_interopRequireDefault(_getUniqueId),_createDeferred=__webpack_require__(73),_createDeferred2=_interopRequireDefault(_createDeferred),_consts=__webpack_require__(20),_PDFPage=__webpack_require__(215),_PDFPage2=_interopRequireDefault(_PDFPage),_PDFDictionary=__webpack_require__(221),_PDFDictionary2=_interopRequireDefault(_PDFDictionary),_BufferBlock=__webpack_require__(628),_BufferBlock2=_interopRequireDefault(_BufferBlock),_PDFBookmark=__webpack_require__(629),_PDFBookmark2=_interopRequireDefault(_PDFBookmark),_PDFLayer=__webpack_require__(226),_PDFLayer2=_interopRequireDefault(_PDFLayer),_Form=__webpack_require__(630),_Form2=_interopRequireDefault(_Form),_LoggerFactory=__webpack_require__(74),_LoggerFactory2=_interopRequireDefault(_LoggerFactory),_cipherType=__webpack_require__(634),_cipherType2=_interopRequireDefault(_cipherType),_keyUsageType=__webpack_require__(635),_keyUsageType2=_interopRequireDefault(_keyUsageType),_PDFObject=__webpack_require__(636),_PDFObject2=_interopRequireDefault(_PDFObject),_PDFFontMgr=__webpack_require__(159),_PDFFontMgr2=_interopRequireDefault(_PDFFontMgr),_errorCode=__webpack_require__(227),_constantsString=__webpack_require__(3),_headerFooter=__webpack_require__(637),_headerFooter2=_interopRequireDefault(_headerFooter),_callback=__webpack_require__(228),_objectsDelete=__webpack_require__(38),_objectsDelete2=_interopRequireDefault(_objectsDelete),_RendererHelper=__webpack_require__(222),_FileSpec=__webpack_require__(44),_FileSpec2=_interopRequireDefault(_FileSpec),_assertion=__webpack_require__(640),_Annot=__webpack_require__(31),_Annot2=_interopRequireDefault(_Annot),_Attachments=__webpack_require__(641),_Attachments2=_interopRequireDefault(_Attachments),_pageEditor=__webpack_require__(364),_pageEditor2=_interopRequireDefault(_pageEditor),_Image=__webpack_require__(37),_Image2=_interopRequireDefault(_Image),_IndexDBCache=__webpack_require__(107),_IndexDBCache2=_interopRequireDefault(_IndexDBCache),_browser=__webpack_require__(155),_InvalidJRObjectError=__webpack_require__(224),_InvalidJRObjectError2=_interopRequireDefault(_InvalidJRObjectError),_VirtualJRPDFPage=__webpack_require__(647),_VirtualJRPDFPage2=_interopRequireDefault(_VirtualJRPDFPage),_axios=__webpack_require__(648),_axios2=_interopRequireDefault(_axios),_convertions=__webpack_require__(158),_progressiveCountine=__webpack_require__(216),_progressiveCountine2=_interopRequireDefault(_progressiveCountine),_annotType=__webpack_require__(217),_createSummarizeCommentsUtil=__webpack_require__(667),_PDFArticle=__webpack_require__(668),_PDFArticle2=_interopRequireDefault(_PDFArticle),_PDFPortfolio=__webpack_require__(669),_PDFPortfolio2=_interopRequireDefault(_PDFPortfolio),_formatDate=__webpack_require__(106);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function _asyncToGenerator(e){return function(){var t=e.apply(this,arguments);return new Promise((function(e,n){return function r(o,i){try{var a=t[o](i),s=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(s).then((function(e){r("next",e)}),(function(e){r("throw",e)}));e(s)}("next")}))}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var noop=function(){},logger=_LoggerFactory2.default.getLogger("pdf-jr.PDFDoc"),continueExport=null;function rshift(e,t){return Math.floor(e/Math.pow(2,t))}function and(e,t){var n=2147483648;return(~~(e/n)&~~(t/n))*n+(2147483647&e&(2147483647&t))}function getPrintRange(e,t){var n=[];if(!e)return n;var r=e.GetElement(t);if(!r)return n;r=r.GetDirectObject().GetArray();for(var o=0;o<r.GetElementCount();o++){var i=r.GetElement(o);n.push(i.GetInteger())}return n}var PDFDoc=function(){function PDFDoc(e,t){var n=this,r=t.getBuffer,o=t.size,i=t.release,a=void 0===i?noop:i,s=t.async,u=void 0!==s&&s,c=t.isCreate,d=void 0!==c&&c,l=t.isCreatePortfolio,f=void 0!==l&&l,h=t.initOpenOptions,p=void 0===h?{}:h,m=t.destroyCallback,g=void 0===m?noop:m,y=t.buffer,_=t.docId,v=t.doc,b=t.engineDoc;_classCallCheck(this,PDFDoc),this.isLoaded=!1,this.docDeferred=(0,_createDeferred2.default)(),this.docPromise=this.docDeferred.promise;var S=o;this.id=_||(0,_getUniqueId2.default)("pdf_doc"),this.JR=e;var w=this.engine=e.engine;this.async=u;var M=void 0;if(this.readerBlockLoading=0,this.initOpenOptions=p,this.destroyCallback=g,this.colors={background:null,foreground:null},v)this.doc=v,this.docDeferred.resolve(v);else if(d)this.doc=new w.PDFDoc,this.docDeferred.resolve(this.doc);else if(f){var D=w.Portfolio.CreatePortfolio();this.doc=D.GetPortfolioPDFDoc(),this.docDeferred.resolve(this.doc)}else if(y){S=y.byteLength;var P=this.buffer=w._malloc(S);w.HEAPU8.set(new Uint8Array(y),P),this.doc=w.createPDFDocWithBuffer(P,S),this.docDeferred.resolve(this.doc)}else if(b)this.doc=b,this.docDeferred.resolve(this.doc);else if(this.getBuffer=r,u){var T=this.asyncBlock=new _BufferBlock2.default(o);M=w.AsyncReaderCallback.implement({Release:function(){a()},GetSize:function(){return S},ReadBlock:function(e,t,o){if(!T.avail(t,o))return T.checkLoadBuffer(t,o)||(T.loadingBuffer(t,o),n.readerBlockLoading++,r(t,o).then((function(e){T.addBuffer(t,o,e),n.readerBlockLoading--}))),!1;var i=T.getBuffer(t,o);if(!i)return T.checkLoadBuffer(t,o)||(T.loadingBuffer(t,o),n.readerBlockLoading++,r(t,o).then((function(e){T.addBuffer(t,o,e),n.readerBlockLoading--}))),!1;var a=new Uint8Array(i);return w.HEAPU8.set(a,e),!0},IsDataAvail:function(e,t){return T.avail(e,t)},AddDownloadHint:function(e,t){var o=e+t+2097152;return o=o>=S?S-e:t+2097152,T.checkLoadBuffer(e,t)||T.avail(e,t)||(T.loadingBuffer(e,o),n.readerBlockLoading++,r(e,o).then((function(t){T.addBuffer(e,o,t),n.readerBlockLoading--}))),!0}}),this.doc=w.createPDFDocWithReaderCallback(M,!0)}else{M=w.AsyncReaderCallback.implement({Release:function(){a()},GetSize:function(){return S>2147483647?(w.SetHighBits(rshift(S,31)),w.SetLowBits(and(S,2147483647)),-1):S},ReadBlock:function(e,t,n){var o=new Uint8Array(r(t,n));return w.HEAPU8.set(o,e),!0},IsDataAvail:function(e,t){return!0},AddDownloadHint:function(e,t){return!0}}),(this.doc=w.createPDFDocWithReaderCallback(M,!0)).IsLinearized()||(this.doc.delete(),M.delete(),M=w.ReaderCallback.implement({Release:function(){a()},GetSize:function(){return S>2147483647?(w.SetHighBits(rshift(S,31)),w.SetLowBits(and(S,2147483647)),-1):S},ReadBlock:function(e,t,n){var o=new Uint8Array(r(t,n));return w.HEAPU8.set(o,e),!0}}),this.doc=w.createPDFDocWithReaderCallback(M,!1))}this.pageCache={},this.pageIndexMap={},this.pageIndexPromise={},this.dictionaryCache={},this.dictionaryMap={},this.blockRanges=[],this.renderFlags=0,this.readerCallback=M,this.destroyHooks=[],this.beforeSaveHooks=[],this.curFileId="",this.taskProgressMap={}}var _ref2,_ref3,_ref4,_ref5,_ref6,_ref13,_ref18,_ref19,_ref20,_ref30,_ref32,_ref34;return PDFDoc.prototype.beforeSave=function(e){this.beforeSaveHooks.push(e)},PDFDoc.prototype.addDestroyHook=function(e){this.destroyHooks.push(e)},PDFDoc.prototype.isLinearized=function(){return this.doc.IsLinearized()},PDFDoc.prototype.createCertificateFile=function(e){var t=this.engine,n=new t.SG_DATASTRUCT;n.cwName=new t.WString(e.cwName||""),n.cwOU=new t.WString(e.cwOU||""),n.cwON=new t.WString(e.cwON||""),n.cwMail=new t.WString(e.cwMail||""),n.csCR=new t.String(e.csCR||""),n.nKA="number"==typeof e.nKA?e.nKA:0,n.nUDF="number"==typeof e.nUDF?e.nUDF:_keyUsageType2.default.SignatureAndEncryption,n.cwSavePass=new t.WString(e.cwSavePass||"");var r=function(e){var n=0;return t.WriterCallback.implement({Release:function(){},Flush:function(){return!0},GetSize:function(){return n},WriteBlock:function(r,o,i){n+=i;var a=t.HEAPU8.buffer,s=void 0;return s=a.slice?a.slice(r,r+i):new Uint8Array(a,r,i).buffer,e.push(s),!0}})},o=[],i=r(o),a=r([]);t.CreateOpenSSLCert(n,i,a);var s=new Blob(o,{type:"application/x-pkcs12"});return this.JR.getCertificateInfo(s,e.cwSavePass)},PDFDoc.prototype.getCertificateSerials=function(){var e=this.engine,t=(0,_createDeferred2.default)(),n=new Set,r=e.CertificateSecurityCallback.implement({Release:function(){t.resolve(Array.from(n))},GetDecryptionKey:function(t,r){for(var o=e.GetSerials(t,r),i=0;i<o.GetSize();i++)n.add(o.GetAt(i).toString());return new e.String("")}}),o=new e.String("Adobe.PubSec");return e.Library.RegisterSecurityCallback(o,r),this.doc.Load(new e.String("")),e.Library.UnregisterSecurityCallback(o),t.promise},PDFDoc.prototype.parseByCertificate=function(e){var t=this.engine,n=(0,_createDeferred2.default)(),r=e.pfxFile,o=e.password,i=(new FileReaderSync).readAsArrayBuffer(r),a=t.StreamCallback.implement({GetSize:function(){return i.byteLength},GetPosition:function(){return 0},ReadBlock:function(e,n,r){var o=new Uint8Array(i,n,r);return t.HEAPU8.set(o,e),!0}}),s=t.CertificateSecurityCallback.implement({Release:function(){},GetDecryptionKey:function(e,n){return new t.Envelope.CreateWithDataBuffer(e,n).GetDecryptionKey(a,new t.String(o))}}),u=new t.String("Adobe.PubSec");t.Library.RegisterSecurityCallback(u,s);var c=this.doc.Load(new t.String(""));return t.Library.UnregisterSecurityCallback(u),n.resolve({code:c.value}),n.promise},PDFDoc.prototype.parseByPassword=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.isLoaded)return Promise.resolve({code:0});void 0===e&&(e=this.initOpenOptions.password||""),n=Object.assign({},this.initOpenOptions,n);var r=this.engine,o=(0,_createDeferred2.default)(),i=function(){setTimeout((function(){t.parseByPassword(e,n).then((function(e){o.resolve(e)}))}),200)};if(this.readerBlockLoading)return i(),o.promise;var a=void 0;if(this.otherData=n,e){var s=new r.String(e);a=this.doc.Load(s),s.delete()}else if(n.encryptPassword){var u=new r.String(n.encryptPassword);a=this.doc.LoadByAsymmetricEncryption(u),u.delete()}else{var c=new r.String(e);a=this.doc.Load(c),c.delete()}if(a===r.ErrorCode.e_ErrSuccess){if(this.password=e,this.curFileId=this.doc.GetFileID().toString(),n.fdf&&n.fdf.file){var d=n.fdf.file,l=n.fdf.type;this.importFromFDF(d,l)}this.isLoaded=!0,this.docDeferred.resolve(this.doc),o.resolve({code:a.value}),0==a.value&&this.getPageByIndex(0).then((function(e){if(!e.isVirtual)return e.parsedPage()})).catch((function(e){return o.reject(e)}))}else if(a===r.ErrorCode.e_ErrDataNotReady)i();else if(a===r.ErrorCode.e_ErrSecurityHandler){var f=this.doc.GetEncryptDict(),h=formateDictToJson(f);"FoxitDRM"===h.Filter&&n.drm?(this.JR.registerDRMSecurityCallback(),i()):"FOPN_foweb"===h.Filter&&n.fileOpen?(n.fileOpen.$$ptr=this.doc.$$.ptr,this.JR.registerOpenFileSecurityCallback(n.fileOpen),i()):o.resolve({code:a.value,encryptDict:h})}else this.JR.unRegisterSecurityCallback("FOPN_foweb"),o.resolve({code:a.value});return o.promise},PDFDoc.prototype.getCurFileSymbolId=function(){return this.curFileId},PDFDoc.prototype.getFadeOutBackground=function(e){var t=this.engine,n=_Image2.default.createImage(t,e),r=new t.Image,o=n.GetFrameBitmap(0).FadeOutBackground();r.AddFrame(o);var i=[],a=t.StreamCallback.implement({Release:function(){},Flush:function(){return!0},GetSize:function(){return 0},WriteBlock:function(e,n,r){var o=t.HEAPU8.buffer,a=void 0;return a=o.slice?o.slice(e,e+r):new Uint8Array(o,e,r).buffer,i=i.concat(a),!0}});return r.SaveAs(a,(0,_constantsString.CWString)(t,".png")),i},PDFDoc.prototype.getConvertToMono=function(e){var t=this.engine,n=_Image2.default.createImage(t,e),r=new t.Image,o=n.GetFrameBitmap(0).ConvertToMono();r.AddFrame(o);var i=[],a=t.StreamCallback.implement({Release:function(){},Flush:function(){return!0},GetSize:function(){return 0},WriteBlock:function(e,n,r){var o=t.HEAPU8.buffer,a=void 0;return a=o.slice?o.slice(e,e+r):new Uint8Array(o,e,r).buffer,i=i.concat(a),!0}});return r.SaveAs(a,(0,_constantsString.CWString)(t,".png")),i},PDFDoc.prototype.updatePageCache=function(e){var t=e.id;this.pageCache[t]=e},PDFDoc.prototype.updatePageIndexMap=function(e,t){this.pageIndexMap[e]=t},PDFDoc.prototype.getPageById=function(e){return this.pageCache[e]||null},PDFDoc.prototype.getAllLoadedPages=function(){var e=[];for(var t in this.pageCache)e.push(this.pageCache[t]);return e},PDFDoc.prototype.extractPrintPages=function(e){var t=this.engine,n=e.reverse,r=e.type,o=e.bleed,i=e.rangeType,a=e.docs,s=e.range,u=void 0;switch(parseInt(r)){case 1:u=t.PrintWhatType.e_PrintWhatDocumentAndMarkups;break;case 2:u=t.PrintWhatType.e_PrintWhatDocumentAndStamps;break;case 3:u=t.PrintWhatType.e_PrintWhatFormFieldsOnly;break;default:u=t.PrintWhatType.e_PrintWhatDocument}var c="",d=0,l=t.WriterCallback.implement({Release:noop,Flush:function(){return!0},GetSize:function(){return d},WriteBlock:function(e,n,r){d+=r;var o=t.HEAPU8.buffer,i=void 0;i=o.slice?o.slice(e,e+r):new Uint8Array(o,e,r).buffer;for(var a=new Uint8Array(i),s=a.byteLength,u=0;u<s;u++)c+=String.fromCharCode(a[u]);return!0}}),f=void 0,h=void 0;if("selectedPDF"===i||"allPDF"===i){if(a.length<1)return!1;a.forEach((function(e){if(f){var n=e.oriFile?e.oriFile.name:"temp.pdf",r=new t.WString(n);f.InsertDocument(h,e.doc,t.InsertDocOptions.e_InsertDocOptionAttachments.value|t.InsertDocOptions.e_InsertDocOptionBookmark.value,r)}else f=e.doc;h=f.GetPageCount()})),s=[[0,h-1]]}else f=this.doc,h=f.GetPageCount();var p=this._generateRange(s,t,h),m=p.ranges,g=(p.addCount,new t.ProcessPrintSetting(u,!!o,!!n,m)),y=f.StartExtractPrintPages(l,g,null);g.delete();for(var _=-1;100!==_;){if(-1===(_=y.GetRateOfProgress()))return!1;y.Continue()}return c},PDFDoc.prototype.getPageFormat=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:324,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:392,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=this,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:void 0,s=this.engine;return this.JR.isInitPageFormat||(s.initPageFormat(),this.JR.isInitPageFormat=!0),this.docPromise.then((function(u){var c=void 0;if(o.pageFormat){if(o.pageFormat.utils&&(o.pageFormat.utils.delete(),o.pageFormat.utils=null),o.pageFormat.oldUtils){try{o.pageFormat.oldUtils.delete()}catch(e){}o.pageFormat.oldUtils=null}o.pageFormat.delete(),o.pageFormat=null}var d=o._getPageformatProvider(t,n,r,a);if(i&&(u=i),c=new s.PageFormat(d,u),d.delete(),c.IsEmpty())return c.delete(),{res:-1,old:null};o.pageFormat=c,o.pageFormat.isCurrentDoc=!i,o.pageFormat.localFormat=a;var l=void 0;switch(e){case"background":l=s.PageFormatType.e_Background;break;case"watermark":l=s.PageFormatType.e_Watermark;break;case"headerfooter":l=s.PageFormatType.e_HeaderFooter;break;case"batesNumbering":l=s.PageFormatType.e_BatesNumber}if(c.StartCheckExistPageFormat(null,l)===s.PageFormatFindRetCode.e_Found){var f=void 0,h=o._getPageformatUtil(c,e,!0);switch(e){case"background":f=o._getBackground(h);break;case"watermark":f=o._getWatermark(h);break;case"headerfooter":f=o._getHeaderfooter(h);break;case"batesNumbering":f=o._getBatesNumbering(h)}return{res:1,old:f}}return{res:0,old:null}}))},PDFDoc.prototype.getPageFormatThumb=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=this;return this.docPromise.then((function(t){if(!o.pageFormat)return null;o.engine;var i=o.pageFormat,a=o._getPageformatUtil(i,e,r);return a?(o.setPageFormat(e,a,n),null):null}))},PDFDoc.prototype.setPageFormat=function(e,t,n){switch(e){case"background":this._setBackground(t,n);break;case"watermark":this._setWatermark(t,n);break;case"headerfooter":this._setHeaderfooter(t,n);break;case"batesNumbering":this._setBatesNumbering(t,n)}},PDFDoc.prototype.removeAllPageFormat=(_ref2=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var n,r,o,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.pageFormat){e.next=2;break}return e.abrupt("return",-1);case 2:n=this.engine,r=this.pageFormat,o=void 0,e.t0=t,e.next="background"===e.t0?8:"watermark"===e.t0?10:"headerfooter"===e.t0?12:"batesNumbering"===e.t0?14:16;break;case 8:return o=n.PageFormatType.e_Background,e.abrupt("break",16);case 10:return o=n.PageFormatType.e_Watermark,e.abrupt("break",16);case 12:return o=n.PageFormatType.e_HeaderFooter,e.abrupt("break",16);case 14:return o=n.PageFormatType.e_BatesNumber,e.abrupt("break",16);case 16:i=r.StartRemoveAll(null,o),e.t1=i,e.next=e.t1===n.PageFormatOperationRetCode.e_Success?20:e.t1===n.PageFormatOperationRetCode.e_Failed?27:e.t1===n.PageFormatOperationRetCode.e_NoChange?29:31;break;case 20:if(!(a=this._getPageformatUtil(r,t,!0))){e.next=25;break}return a.SetPageRange(0,this.doc.GetPageCount()-1),e.next=25,this._pageFormatRemoveFinished(0,this.doc.GetPageCount()-1);case 25:return i=1,e.abrupt("break",31);case 27:return i=-2,e.abrupt("break",31);case 29:return i=0,e.abrupt("break",31);case 31:return e.abrupt("return",i);case 32:case"end":return e.stop()}}),e,this)}))),function(e){return _ref2.apply(this,arguments)}),PDFDoc.prototype.addPageFormat=(_ref3=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n){var r,o,i,a,s,u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.pageFormat){e.next=2;break}return e.abrupt("return",-1);case 2:if("batesNumbering"!==t){e.next=6;break}return e.next=5,this._addBatesNumber(n);case 5:return e.abrupt("return",e.sent);case 6:if(r=this.engine,o=this.pageFormat,i=this._getPageformatUtil(o,t,u)){e.next=11;break}return e.abrupt("return",-2);case 11:a=void 0,s=void 0,e.t0=t,e.next="background"===e.t0?16:"watermark"===e.t0?18:"headerfooter"===e.t0?20:22;break;case 16:return s=r.PageFormatType.e_Background,e.abrupt("break",22);case 18:return s=r.PageFormatType.e_Watermark,e.abrupt("break",22);case 20:return s=r.PageFormatType.e_HeaderFooter,e.abrupt("break",22);case 22:if((a=u?o.StartUpdate(null,s):o.StartInsert(null,s))!==r.PageFormatOperationRetCode.e_Success){e.next=29;break}return e.next=26,this._pageFormatFinished(i,o.isCurrentDoc);case 26:return e.abrupt("return",1);case 29:if(a!==r.PageFormatOperationRetCode.e_Failed){e.next=33;break}return e.abrupt("return",-3);case 33:return e.abrupt("return",0);case 34:case"end":return e.stop()}}),e,this)}))),function(e,t){return _ref3.apply(this,arguments)}),PDFDoc.prototype._addBatesNumber=(_ref4=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var n,r,o,i,a,s,u,c,d,l,f,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.engine,r=this.pageFormat,o=r.isCurrentDoc,i=r.utils,!(a=r.oldUtils)){e.next=26;break}if(s=t.sourceDoc,u=s.fileName,c=s.newDoc,d=this._getPageformatProvider(1,1,u,this.pageFormat.localFormat),l=null,!c){e.next=14;break}l=c,o=!1,e.next=18;break;case 14:return e.next=16,this.docPromise;case 16:l=e.sent,o=!0;case 18:if(r=new n.PageFormat(d,l),d.delete(),!r.IsEmpty()){e.next=23;break}return r.delete(),e.abrupt("return",-1);case 23:(i=r.CreateBatesNumberUtils()).JoinBatesNumberUtils(a),this._setBatesNumbering(i,t);case 26:if((f=r.StartInsert(null,n.PageFormatType.e_BatesNumber))!==n.PageFormatOperationRetCode.e_Success){e.next=35;break}return e.next=30,this._pageFormatFinished(i,o);case 30:return h=i.GetRangeString(new n.WString("-")).toString(),this.pageFormat.oldUtils=i,e.abrupt("return",h);case 35:if(f!==n.PageFormatOperationRetCode.e_Failed){e.next=39;break}return e.abrupt("return",-3);case 39:return e.abrupt("return",0);case 40:case"end":return e.stop()}}),e,this)}))),function(e){return _ref4.apply(this,arguments)}),PDFDoc.prototype._getPageformatUtil=function(e,t,n){var r=void 0;if(e.utils&&(n||e.isUtilsCreated))return e.utils;switch(t){case"background":n?r=e.GetBackgroundUtils():(r=e.CreateBackgroundUtils(),e.isUtilsCreated=!0);break;case"watermark":n?r=e.GetWatermarkUtils():(r=e.CreateWatermarkUtils(),e.isUtilsCreated=!0);break;case"headerfooter":n?r=e.GetHeaderFooterUtils():(r=e.CreateHeaderFooterUtils(),e.isUtilsCreated=!0);break;case"batesNumbering":n?r=e.GetBatesNumberUtils():(r=e.CreateBatesNumberUtils(),e.isUtilsCreated=!0)}return r.IsEmpty()?null:(e.utils=r,r)},PDFDoc.prototype._pageFormatRemoveFinished=(_ref5=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n){var r,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t;case 1:if(!(r<=n)){e.next=12;break}return e.next=4,this.getPageByIndex(r);case 4:if(!(o=e.sent)){e.next=9;break}return e.next=8,o.reParsePage();case 8:o.reloadAnnots();case 9:r++,e.next=1;break;case 12:this.reloadLayer();case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return _ref5.apply(this,arguments)}),PDFDoc.prototype._pageFormatFinished=(_ref6=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var n,r,o,i,a,s,u=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u){e.next=2;break}return e.abrupt("return");case 2:if(n=t.GetPageRangeStart(),r=t.GetPageRangeEnd(),o=t.IsUseEvenPages(),i=t.IsUseOddPages(),!1!==o||!1!==i){e.next=8;break}return e.abrupt("return");case 8:-1===n&&(n=0,r=this.doc.GetPageCount()-1,t.SetPageRange(n,r),t.SetEvenOddFlag(!0,!0)),a=n;case 10:if(!(a<=r)){e.next=26;break}if(i===o){e.next=16;break}if(!o||(a+1)%2==0){e.next=14;break}return e.abrupt("continue",23);case 14:if(!i||(a+1)%2!=0){e.next=16;break}return e.abrupt("continue",23);case 16:return e.next=18,this.getPageByIndex(a);case 18:if(!(s=e.sent)){e.next=23;break}return e.next=22,s.reParsePage();case 22:s.reloadAnnots();case 23:a++,e.next=10;break;case 26:this.reloadLayer();case 27:case"end":return e.stop()}}),e,this)}))),function(e){return _ref6.apply(this,arguments)}),PDFDoc.prototype._setWatermark=function(e,t){if(t){var n=this.engine,r=1===t.sourceType?n.PageFormatSourceType.e_Text:n.PageFormatSourceType.e_ImageFile,i=new n.WString(t.text.replaceAll("\n","\r")),a=t.pageStart,s=t.pageEnd,u=t.pageEven,c=t.pageOdd,d=0;switch(t.unit){case 1:d=n.PageFormatUnitType.e_Inches;break;case 2:d=n.PageFormatUnitType.e_Percent,o;break;case 3:d=n.PageFormatUnitType.e_Centimeters;break;case 4:d=n.PageFormatUnitType.e_Millimeters;break;case 5:d=n.PageFormatUnitType.e_Picas;break;case 6:d=n.PageFormatUnitType.e_Points}var l=0;switch(t.vFrom){case 1:l=n.PageFormatAlignType.e_Top;break;case 2:l=n.PageFormatAlignType.e_VCenter;break;case 3:l=n.PageFormatAlignType.e_Bottom}var f=0;switch(t.hFrom){case 1:f=n.PageFormatAlignType.e_Left;break;case 2:f=n.PageFormatAlignType.e_HCenter;break;case 3:f=n.PageFormatAlignType.e_Right}if(e.SetSourceType(r),e.SetPageRange(a,s),e.SetEvenOddFlag(u,c),2===t.sourceType){if(t.file){var h=n.ReaderCallback.implement({Release:function(){noop()},GetSize:function(){return t.file.size},ReadBlock:function(e,r,o){var i=new Uint8Array(t.file.getBuffer(r,o));return n.HEAPU8.set(i,e),!0}});e.SetImage(h)}else if(t.doc)e.SetPDFDoc(t.doc.doc);else if(t.bitmap){var p=_Image2.default.createImage(n,t.bitmap,!0);e.SetImage(p)}e.SetSourcePageNumber(t.pageNumber),t.scaleCkd?e.SetScale(-t.scale/100):e.SetScale(t.absScale/100)}else{var m="number"==typeof t.fontColor?t.fontColor:parseInt(t.fontColor.replace("#","0x"),16),g=new n.WString(t.fontName);e.SetText(i),e.UnderlineText(t.underLine),e.SetTextColor(m),e.SetFontName(g),t.scaleCkd?e.SetScale(-t.scale/100):(e.SetScale(1),e.SetFontSize(parseFloat(t.fontSize)))}e.SetPositionUnit(d),e.SetVerticalAlign(l),e.SetHorizontalAlign(f),e.SetVerticalValue(parseFloat(t.vDistance)),e.SetHorizontalValue(parseFloat(t.hDistance)),e.SetOpacity(t.opacity/100),e.SetRotation(parseFloat(t.rotate)),e.SetShowOnTopFlag(2===t.appear),e.SetFixedPrintFlag(t.isKeep),e.SetVisibleForPrintFlag(t.isPrint),e.SetDisplayOnScreenFlag(t.isScreen)}},PDFDoc.prototype._setBackground=function(e,t){if(t){var n=this.engine,r=1===t.sourceType?n.PageFormatSourceType.e_Color:n.PageFormatSourceType.e_ImageFile,o=t.pageStart,i=t.pageEnd,a=t.pageEven,s=t.pageOdd,u=0;switch(t.unit){case 1:u=n.PageFormatUnitType.e_Inches;break;case 2:u=n.PageFormatUnitType.e_Percent;break;case 3:u=n.PageFormatUnitType.e_Centimeters;break;case 4:u=n.PageFormatUnitType.e_Millimeters;break;case 5:u=n.PageFormatUnitType.e_Picas;break;case 6:u=n.PageFormatUnitType.e_Points}var c=0;switch(t.vFrom){case 1:c=n.PageFormatAlignType.e_Top;break;case 2:c=n.PageFormatAlignType.e_VCenter;break;case 3:c=n.PageFormatAlignType.e_Bottom}var d=0;switch(t.hFrom){case 1:d=n.PageFormatAlignType.e_Left;break;case 2:d=n.PageFormatAlignType.e_HCenter;break;case 3:d=n.PageFormatAlignType.e_Right}if(e.SetSourceType(r),e.SetPageRange(o,i),e.SetEvenOddFlag(a,s),2===t.sourceType){if(t.file){var l=n.ReaderCallback.implement({Release:function(){noop()},GetSize:function(){return t.file.size},ReadBlock:function(e,r,o){var i=new Uint8Array(t.file.getBuffer(r,o));return n.HEAPU8.set(i,e),!0}});e.SetImage(l)}else t.doc&&e.SetPDFDoc(t.doc.doc);e.SetSourcePageNumber(t.pageNumber),t.scaleCkd?e.SetScale(-t.scale/100):e.SetScale(t.absScale/100)}else{var f=t.backgroundColor;f&&7===f.length&&(f="0x"+f.substr(5,2)+f.substr(3,2)+f.substr(1,2),f=parseInt(f,16),e.SetBackgroundColor(f)),e.SetScale(-t.scale/100)}e.SetPositionUnit(u),e.SetVerticalAlign(c),e.SetHorizontalAlign(d),e.SetVerticalValue(parseFloat(t.vDistance)),e.SetHorizontalValue(parseFloat(t.hDistance)),e.SetOpacity(t.opacity/100),e.SetRotation(parseFloat(t.rotate)),e.SetVisibleForPrintFlag(t.isPrint),e.SetDisplayOnScreenFlag(t.isScreen)}},PDFDoc.prototype._setHeaderfooter=function(e,t){if(t){var n=this.engine,r="number"==typeof t.fontColor?t.fontColor:parseInt(t.fontColor.replace("#","0x"),16),o=new n.WString(t.fontName),i=new n.WString(t.leftHeaderText.replaceAll("\n","\r")),a=new n.WString(t.rightHeaderText.replaceAll("\n","\r")),s=new n.WString(t.centerHeaderText.replaceAll("\n","\r")),u=new n.WString(t.leftFooterText.replaceAll("\n","\r")),c=new n.WString(t.centerFooterText.replaceAll("\n","\r")),d=new n.WString(t.rightFooterText.replaceAll("\n","\r")),l="1";switch(t.pageFormat){case"1":l=n.HeaderFooterPageNumberFormat.e_Number;break;case"1 of n":l=n.HeaderFooterPageNumberFormat.e_NumberOfTotal;break;case"1/n":l=n.HeaderFooterPageNumberFormat.e_NumberSlashTotal;break;case"Page 1":l=n.HeaderFooterPageNumberFormat.e_PageNumber;break;case"Page 1 of n":l=n.HeaderFooterPageNumberFormat.e_PageNumberOfTotal;break;case"Page 1 of n":l=n.HeaderFooterPageNumberFormat.e_BatesNumber}var f="m/d";switch(t.dateFormat){case"m/d":f=n.HeaderFooterDateFormat.e_MSlashD;break;case"m/d/yy":f=n.HeaderFooterDateFormat.e_MSlashDSlashYY;break;case"m/d/yyyy":f=n.HeaderFooterDateFormat.e_MSlashDSlashYYYY;break;case"mm/dd/yy":f=n.HeaderFooterDateFormat.e_MMSlashDDSlashYY;break;case"mm/dd/yyyy":f=n.HeaderFooterDateFormat.e_MMSlashDDSlashYYYY;break;case"d/m/yy":f=n.HeaderFooterDateFormat.e_DSlashMSlashYY;break;case"d/m/yyyy":f=n.HeaderFooterDateFormat.e_DSlashMSlashYYYY;break;case"dd/mm/yy":f=n.HeaderFooterDateFormat.e_DDSlashMMSlashYY;break;case"dd/mm/yyyy":f=n.HeaderFooterDateFormat.e_DDSlashMMSlashYYYY;break;case"mm/yy":f=n.HeaderFooterDateFormat.e_MMSlashYY;break;case"mm/yyyy":f=n.HeaderFooterDateFormat.e_MMSlashYYYY;break;case"m.d.yy":f=n.HeaderFooterDateFormat.e_MDotDDotYY;break;case"m.d.yyyy":f=n.HeaderFooterDateFormat.e_MDotDDotYYYY;break;case"mm.dd.yy":f=n.HeaderFooterDateFormat.e_MMDotDDDotYY;break;case"mm.dd.yyyy":f=n.HeaderFooterDateFormat.e_MMDotDDDotYYYY;break;case"mm.yy":f=n.HeaderFooterDateFormat.e_MMDotYY;break;case"d.m.yyyy":l=n.HeaderFooterDateFormat.e_DDotMDotYYYY;break;case"dd.mm.yy":f=n.HeaderFooterDateFormat.e_DDDotMMDotYY;break;case"dd.mm.yyyy":f=n.HeaderFooterDateFormat.e_DDDotMMDotYYYY;break;case"yy-mm-dd":f=n.HeaderFooterDateFormat.e_YYHyphenMMHyphenDD;break;case"yyyy-mm-dd":f=n.HeaderFooterDateFormat.e_YYYYHyphenMMHyphenDD}var h=t.pageStart,p=t.pageEnd,m=t.pageEven,g=t.pageOdd;e.SetEmbedFontFlag(t.fontEmbed),e.UnderlineText(t.underLine),e.SetTextColor(r),e.SetFontName(o),e.SetFontSize(parseFloat(t.fontSize)),e.SetMargin(n.HeaderFooterMargin.e_Left,t.marginLeft),e.SetMargin(n.HeaderFooterMargin.e_Right,t.marginRight),e.SetMargin(n.HeaderFooterMargin.e_Top,t.marginTop),e.SetMargin(n.HeaderFooterMargin.e_Bottom,t.marginBottom),e.SetText(n.HeaderFooterLocation.e_HeaderLeft,i),e.SetText(n.HeaderFooterLocation.e_HeaderMiddle,s),e.SetText(n.HeaderFooterLocation.e_HeaderRight,a),e.SetText(n.HeaderFooterLocation.e_FooterLeft,u),e.SetText(n.HeaderFooterLocation.e_FooterMiddle,c),e.SetText(n.HeaderFooterLocation.e_FooterRight,d),e.SetDateFormat(f),e.SetPageNumberFormat(l),e.SetPageNumberOffset(t.startPage),e.SetPageRange(h,p),e.SetEvenOddFlag(m,g),e.SetFixedPrintFlag(t.isKeep),e.SetShrinkFlag(t.isShrink)}},PDFDoc.prototype._setBatesNumbering=function(e,t){if(t){var n=this.engine,r=parseInt(t.fontColor.replace("#","0x"),16),o=new n.WString(t.fontName),i=new n.WString(t.leftHeaderText.replaceAll("\n","\r")),a=new n.WString(t.rightHeaderText.replaceAll("\n","\r")),s=new n.WString(t.centerHeaderText.replaceAll("\n","\r")),u=new n.WString(t.leftFooterText.replaceAll("\n","\r")),c=new n.WString(t.centerFooterText.replaceAll("\n","\r")),d=new n.WString(t.rightFooterText.replaceAll("\n","\r")),l="1";switch(t.pageFormat){case"1":l=n.HeaderFooterPageNumberFormat.e_Number;break;case"1 of n":l=n.HeaderFooterPageNumberFormat.e_NumberOfTotal;break;case"1/n":l=n.HeaderFooterPageNumberFormat.e_NumberSlashTotal;break;case"Page 1":l=n.HeaderFooterPageNumberFormat.e_PageNumber;break;case"Page 1 of n":l=n.HeaderFooterPageNumberFormat.e_PageNumberOfTotal;break;case"Bates Number":l=n.HeaderFooterPageNumberFormat.e_BatesNumber}var f="m/d";switch(t.dateFormat){case"m/d":f=n.HeaderFooterDateFormat.e_MSlashD;break;case"m/d/yy":f=n.HeaderFooterDateFormat.e_MSlashDSlashYY;break;case"m/d/yyyy":f=n.HeaderFooterDateFormat.e_MSlashDSlashYYYY;break;case"mm/dd/yy":f=n.HeaderFooterDateFormat.e_MMSlashDDSlashYY;break;case"mm/dd/yyyy":f=n.HeaderFooterDateFormat.e_MMSlashDDSlashYYYY;break;case"d/m/yy":f=n.HeaderFooterDateFormat.e_DSlashMSlashYY;break;case"d/m/yyyy":f=n.HeaderFooterDateFormat.e_DSlashMSlashYYYY;break;case"dd/mm/yy":f=n.HeaderFooterDateFormat.e_DDSlashMMSlashYY;break;case"dd/mm/yyyy":f=n.HeaderFooterDateFormat.e_DDSlashMMSlashYYYY;break;case"mm/yy":f=n.HeaderFooterDateFormat.e_MMSlashYY;break;case"mm/yyyy":f=n.HeaderFooterDateFormat.e_MMSlashYYYY;break;case"m.d.yy":f=n.HeaderFooterDateFormat.e_MDotDDotYY;break;case"m.d.yyyy":f=n.HeaderFooterDateFormat.e_MDotDDotYYYY;break;case"mm.dd.yy":f=n.HeaderFooterDateFormat.e_MMDotDDDotYY;break;case"mm.dd.yyyy":f=n.HeaderFooterDateFormat.e_MMDotDDDotYYYY;break;case"mm.yy":f=n.HeaderFooterDateFormat.e_MMDotYY;break;case"d.m.yyyy":l=n.HeaderFooterDateFormat.e_DDotMDotYYYY;break;case"dd.mm.yy":f=n.HeaderFooterDateFormat.e_DDDotMMDotYY;break;case"dd.mm.yyyy":f=n.HeaderFooterDateFormat.e_DDDotMMDotYYYY;break;case"yy-mm-dd":f=n.HeaderFooterDateFormat.e_YYHyphenMMHyphenDD;break;case"yyyy-mm-dd":f=n.HeaderFooterDateFormat.e_YYYYHyphenMMHyphenDD}var h=t.pageStart,p=t.pageEnd,m=t.pageEven,g=t.pageOdd;e.SetEmbedFontFlag(t.fontEmbed),e.UnderlineText(t.underLine),e.SetTextColor(r),e.SetFontName(o),e.SetFontSize(parseFloat(t.fontSize)),e.SetMargin(n.HeaderFooterMargin.e_Left,t.marginLeft),e.SetMargin(n.HeaderFooterMargin.e_Right,t.marginRight),e.SetMargin(n.HeaderFooterMargin.e_Top,t.marginTop),e.SetMargin(n.HeaderFooterMargin.e_Bottom,t.marginBottom),e.SetText(n.HeaderFooterLocation.e_HeaderLeft,i),e.SetText(n.HeaderFooterLocation.e_HeaderMiddle,s),e.SetText(n.HeaderFooterLocation.e_HeaderRight,a),e.SetText(n.HeaderFooterLocation.e_FooterLeft,u),e.SetText(n.HeaderFooterLocation.e_FooterMiddle,c),e.SetText(n.HeaderFooterLocation.e_FooterRight,d),e.SetDateFormat(f),e.SetPageNumberFormat(l),e.SetPageNumberOffset(t.startPage),e.SetPageRange(h,p),e.SetEvenOddFlag(m,g),e.SetFixedPrintFlag(t.isKeep),e.SetShrinkFlag(t.isShrink)}},PDFDoc.prototype._getWatermark=function(e){var t={},n=this.engine,r=parseInt(e.GetTextColor()).toString(16);if(r.length<6)for(var o=6-r.length,i=0;i<o;i++)r="0"+r;r="#"+r;var a=e.GetSourceType().value===n.PageFormatSourceType.e_Text.value?1:2,s=0;switch(e.GetPositionUnit().value){case n.PageFormatUnitType.e_Inches.value:s=1;break;case n.PageFormatUnitType.e_Percent.value:s=2;break;case n.PageFormatUnitType.e_Centimeters.value:s=3;break;case n.PageFormatUnitType.e_Millimeters.value:s=4;break;case n.PageFormatUnitType.e_Picas.value:s=5;break;case n.PageFormatUnitType.e_Points.value:s=6}var u=0;switch(e.GetVerticalAlign().value){case n.PageFormatAlignType.e_Top.value:u=1;break;case n.PageFormatAlignType.e_VCenter.value:u=2;break;case n.PageFormatAlignType.e_Bottom.value:u=3}var c=0;switch(e.GetHorizontalAlign().value){case n.PageFormatAlignType.e_Left.value:c=1;break;case n.PageFormatAlignType.e_HCenter.value:c=2;break;case n.PageFormatAlignType.e_Right.value:c=3}return t.sourceType=a,t.pageNumber=e.GetSourcePageNumber(),t.text=e.GetText().toString().replaceAll("\r","\n"),t.fontSize=parseInt(e.GetFontSize()),t.underLine=e.IsUnderline(),t.fontColor=r,t.fontName=e.GetFontName().toString(),t.opacity=parseInt(100*e.GetOpacity()),t.rotate=e.GetRotation(),t.scale=Math.round(100*e.GetScale()),t.appear=!0===e.IsShowOnTop()?2:1,t.isKeep=e.IsFixedPrint(),t.isPrint=e.IsVisibleForPrint(),t.isScreen=e.IsDisplayOnScreen(),t.unit=s,t.vFrom=u,t.hFrom=c,t.hDistance=parseFloat(e.GetHorizontalValue()),t.vDistance=parseFloat(e.GetVerticalValue()),t.pageStart=e.GetPageRangeStart(),t.pageEnd=e.GetPageRangeEnd(),t.pageEven=e.IsUseEvenPages(),t.pageOdd=e.IsUseOddPages(),t},PDFDoc.prototype._getBackground=function(e){var t={},n=this.engine,r=parseInt(e.GetBackgroundColor()).toString(16);if(r.length<6)for(var o=6-r.length,i=0;i<o;i++)r="0"+r;r="#"+r;var a=e.GetSourceType().value===n.PageFormatSourceType.e_Color.value?1:2,s=0;switch(e.GetPositionUnit().value){case n.PageFormatUnitType.e_Inches.value:s=1;break;case n.PageFormatUnitType.e_Percent.value:s=2;break;case n.PageFormatUnitType.e_Centimeters.value:s=3;break;case n.PageFormatUnitType.e_Millimeters.value:s=4;break;case n.PageFormatUnitType.e_Picas.value:s=5;break;case n.PageFormatUnitType.e_Points.value:s=6}var u=0;switch(e.GetVerticalAlign().value){case n.PageFormatAlignType.e_Top.value:u=1;break;case n.PageFormatAlignType.e_VCenter.value:u=2;break;case n.PageFormatAlignType.e_Bottom.value:u=3}var c=0;switch(e.GetHorizontalAlign().value){case n.PageFormatAlignType.e_Left.value:c=1;break;case n.PageFormatAlignType.e_HCenter.value:c=2;break;case n.PageFormatAlignType.e_Right.value:c=3}return t.sourceType=a,t.pageNumber=e.GetSourcePageNumber(),t.backgroundColor=r,t.opacity=parseInt(100*e.GetOpacity()),t.rotate=e.GetRotation(),t.scale=Math.round(100*e.GetScale()),t.isPrint=e.IsVisibleForPrint(),t.isScreen=e.IsDisplayOnScreen(),t.unit=s,t.vFrom=u,t.hFrom=c,t.hDistance=parseFloat(e.GetHorizontalValue()),t.vDistance=parseFloat(e.GetVerticalValue()),t.pageStart=e.GetPageRangeStart(),t.pageEnd=e.GetPageRangeEnd(),t.pageEven=e.IsUseEvenPages(),t.pageOdd=e.IsUseOddPages(),t},PDFDoc.prototype._getHeaderfooter=function(e){var t={},n=this.engine,r=parseInt(e.GetTextColor()).toString(16);if(r.length<6)for(var o=6-r.length,i=0;i<o;i++)r="0"+r;r="#"+r;var a=e.GetPageNumberFormat().value;switch(a){case n.HeaderFooterPageNumberFormat.e_Number.value:a="1";break;case n.HeaderFooterPageNumberFormat.e_NumberOfTotal.value:a="1 of n";break;case n.HeaderFooterPageNumberFormat.e_NumberSlashTotal.value:a="1/n";break;case n.HeaderFooterPageNumberFormat.e_PageNumber.value:a="Page 1";break;case n.HeaderFooterPageNumberFormat.e_PageNumberOfTotal.value:case n.HeaderFooterPageNumberFormat.e_BatesNumber.value:a="Page 1 of n"}var s=e.GetDateFormat().value;switch(s){case n.HeaderFooterDateFormat.e_MSlashD.value:s="m/d";break;case n.HeaderFooterDateFormat.e_MSlashDSlashYY.value:s="m/d/yy";break;case n.HeaderFooterDateFormat.e_MSlashDSlashYYYY.value:s="m/d/yyyy";break;case n.HeaderFooterDateFormat.e_MMSlashDDSlashYY.value:s="mm/dd/yy";break;case n.HeaderFooterDateFormat.e_MMSlashDDSlashYYYY.value:s="mm/dd/yyyy";break;case n.HeaderFooterDateFormat.e_DSlashMSlashYY.value:s="d/m/yy";break;case n.HeaderFooterDateFormat.e_DSlashMSlashYYYY.value:s="d/m/yyyy";break;case n.HeaderFooterDateFormat.e_DDSlashMMSlashYY.value:s="dd/mm/yy";break;case n.HeaderFooterDateFormat.e_DDSlashMMSlashYYYY.value:s="dd/mm/yyyy";break;case n.HeaderFooterDateFormat.e_MMSlashYY.value:s="mm/yy";break;case n.HeaderFooterDateFormat.e_MMSlashYYYY:s="mm/yyyy";break;case n.HeaderFooterDateFormat.e_MDotDDotYY.value:s="m.d.yy";break;case n.HeaderFooterDateFormat.e_MDotDDotYYYY.value:s="m.d.yyyy";break;case n.HeaderFooterDateFormat.e_MMDotDDDotYY.value:s="mm.dd.yy";break;case n.HeaderFooterDateFormat.e_MMDotDDDotYYYY.value:s="mm.dd.yyyy";break;case n.HeaderFooterDateFormat.e_MMDotYY.value:s="mm.yy";break;case n.HeaderFooterDateFormat.e_DDotMDotYYYY.value:s="d.m.yyyy";break;case n.HeaderFooterDateFormat.e_DDDotMMDotYY.value:s="dd.mm.yy";break;case n.HeaderFooterDateFormat.e_DDDotMMDotYYYY.value:s="dd.mm.yyyy";break;case n.HeaderFooterDateFormat.e_YYHyphenMMHyphenDD.value:s="yy-mm-dd";break;case n.HeaderFooterDateFormat.e_YYYYHyphenMMHyphenDD.value:s="yyyy-mm-dd"}return t.fontSize=parseInt(e.GetFontSize()),t.underLine=e.IsUnderline(),t.fontEmbed=e.IsEmbeddedFont(),t.fontColor=r,t.fontName=e.GetFontName().toString(),t.leftHeaderText=e.GetText(n.HeaderFooterLocation.e_HeaderLeft).toString().replaceAll("\r","\n"),t.centerHeaderText=e.GetText(n.HeaderFooterLocation.e_HeaderMiddle).toString().replaceAll("\r","\n"),t.rightHeaderText=e.GetText(n.HeaderFooterLocation.e_HeaderRight).toString().replaceAll("\r","\n"),t.leftFooterText=e.GetText(n.HeaderFooterLocation.e_FooterLeft).toString().replaceAll("\r","\n"),t.centerFooterText=e.GetText(n.HeaderFooterLocation.e_FooterMiddle).toString().replaceAll("\r","\n"),t.rightFooterText=e.GetText(n.HeaderFooterLocation.e_FooterRight).toString().replaceAll("\r","\n"),t.marginLeft=e.GetMargin(n.HeaderFooterMargin.e_Left),t.marginRight=e.GetMargin(n.HeaderFooterMargin.e_Right),t.marginTop=e.GetMargin(n.HeaderFooterMargin.e_Top),t.marginBottom=e.GetMargin(n.HeaderFooterMargin.e_Bottom),t.pageStart=e.GetPageRangeStart(),t.pageEnd=e.GetPageRangeEnd(),t.pageEven=e.IsUseEvenPages(),t.pageOdd=e.IsUseOddPages(),t.isKeep=e.IsFixedPrint(),t.isShrink=e.IsShrink(),t.dateFormat=s,t.pageFormat=a,t.startPage=e.GetPageNumberOffset(),t},PDFDoc.prototype._getBatesNumbering=function(e){var t={},n=this.engine,r=parseInt(e.GetTextColor()).toString(16);if(r.length<6)for(var o=6-r.length,i=0;i<o;i++)r="0"+r;r="#"+r;var a=e.GetPageNumberFormat().value;switch(a){case n.HeaderFooterPageNumberFormat.e_Number.value:a="1";break;case n.HeaderFooterPageNumberFormat.e_NumberOfTotal.value:a="1 of n";break;case n.HeaderFooterPageNumberFormat.e_NumberSlashTotal.value:a="1/n";break;case n.HeaderFooterPageNumberFormat.e_PageNumber.value:a="Page 1";break;case n.HeaderFooterPageNumberFormat.e_PageNumberOfTotal.value:case n.HeaderFooterPageNumberFormat.e_BatesNumber.value:a="Page 1 of n"}var s=e.GetDateFormat().value;switch(s){case n.HeaderFooterDateFormat.e_MSlashD.value:s="m/d";break;case n.HeaderFooterDateFormat.e_MSlashDSlashYY.value:s="m/d/yy";break;case n.HeaderFooterDateFormat.e_MSlashDSlashYYYY.value:s="m/d/yyyy";break;case n.HeaderFooterDateFormat.e_MMSlashDDSlashYY.value:s="mm/dd/yy";break;case n.HeaderFooterDateFormat.e_MMSlashDDSlashYYYY.value:s="mm/dd/yyyy";break;case n.HeaderFooterDateFormat.e_DSlashMSlashYY.value:s="d/m/yy";break;case n.HeaderFooterDateFormat.e_DSlashMSlashYYYY.value:s="d/m/yyyy";break;case n.HeaderFooterDateFormat.e_DDSlashMMSlashYY.value:s="dd/mm/yy";break;case n.HeaderFooterDateFormat.e_DDSlashMMSlashYYYY.value:s="dd/mm/yyyy";break;case n.HeaderFooterDateFormat.e_MMSlashYY.value:s="mm/yy";break;case n.HeaderFooterDateFormat.e_MMSlashYYYY:s="mm/yyyy";break;case n.HeaderFooterDateFormat.e_MDotDDotYY.value:s="m.d.yy";break;case n.HeaderFooterDateFormat.e_MDotDDotYYYY.value:s="m.d.yyyy";break;case n.HeaderFooterDateFormat.e_MMDotDDDotYY.value:s="mm.dd.yy";break;case n.HeaderFooterDateFormat.e_MMDotDDDotYYYY.value:s="mm.dd.yyyy";break;case n.HeaderFooterDateFormat.e_MMDotYY.value:s="mm.yy";break;case n.HeaderFooterDateFormat.e_DDotMDotYYYY.value:s="d.m.yyyy";break;case n.HeaderFooterDateFormat.e_DDDotMMDotYY.value:s="dd.mm.yy";break;case n.HeaderFooterDateFormat.e_DDDotMMDotYYYY.value:s="dd.mm.yyyy";break;case n.HeaderFooterDateFormat.e_YYHyphenMMHyphenDD.value:s="yy-mm-dd";break;case n.HeaderFooterDateFormat.e_YYYYHyphenMMHyphenDD.value:s="yyyy-mm-dd"}return t.fontSize=parseInt(e.GetFontSize()),t.underLine=e.IsUnderline(),t.fontEmbed=e.IsEmbeddedFont(),t.fontColor=r,t.fontName=e.GetFontName().toString(),t.leftHeaderText=e.GetText(n.HeaderFooterLocation.e_HeaderLeft).toString().replaceAll("\r","\n"),t.centerHeaderText=e.GetText(n.HeaderFooterLocation.e_HeaderMiddle).toString().replaceAll("\r","\n"),t.rightHeaderText=e.GetText(n.HeaderFooterLocation.e_HeaderRight).toString().replaceAll("\r","\n"),t.leftFooterText=e.GetText(n.HeaderFooterLocation.e_FooterLeft).toString().replaceAll("\r","\n"),t.centerFooterText=e.GetText(n.HeaderFooterLocation.e_FooterMiddle).toString().replaceAll("\r","\n"),t.rightFooterText=e.GetText(n.HeaderFooterLocation.e_FooterRight).toString().replaceAll("\r","\n"),t.marginLeft=e.GetMargin(n.HeaderFooterMargin.e_Left),t.marginRight=e.GetMargin(n.HeaderFooterMargin.e_Right),t.marginTop=e.GetMargin(n.HeaderFooterMargin.e_Top),t.marginBottom=e.GetMargin(n.HeaderFooterMargin.e_Bottom),t.pageStart=e.GetPageRangeStart(),t.pageEnd=e.GetPageRangeEnd(),t.pageEven=e.IsUseEvenPages(),t.pageOdd=e.IsUseOddPages(),t.isKeep=e.IsFixedPrint(),t.isShrink=e.IsShrink(),t.dateFormat=s,t.pageFormat=a,t.startPage=e.GetPageNumberOffset(),t},PDFDoc.prototype._getPageformatProvider=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,o=this.engine,i=o.PageformatUndoCallback.implement({CanUndoRedo:function(){return!1},OnAddUndo:function(e){},OnUndoRedoBegin:function(){},OnUndoRedoEnd:function(){}}),a=o.PageformatProgressBarCallback.implement({Create:function(){return 0},SetRange:function(e,t,n){},SetText:function(e,t){},SetCurrentValue:function(e,t){},PeekAndPump:function(e){},Destroy:function(e){},GetString:function(e){r||(r={fileName:"File Name",date:"1\\n1 of n\\n1/n\\nPage 1\\nPage 1 of n\\nBates Number",dateLocal:"%d\\n%d of %d\\n%d/%d\\nPage %d\\nPage %d of %d\\nBates Number"});var t=void 0;switch(e){case o.PageFormatProgressBarStringResourceID.e_FileName:t=r.fileName;break;case o.PageFormatProgressBarStringResourceID.e_DateFormat:t="m/d\\nm/d/yy\\nm/d/yyyy\\nmm/dd/yy\\nmm/dd/yyyy\\nd/m/yy\\nd/m/yyyy\\ndd/mm/yy\\ndd/mm/yyyy\\nmm/yy\\nmm/yyyy\\nm.d.yy\\nm.d.yyyy\\nmm.dd.yy\\nmm.dd.yyyy\\nmm.yy\\nd.m.yyyy\\ndd.mm.yy\\ndd.mm.yyyy\\nyy-mm-dd\\nyyyy-mm-dd";break;case o.PageFormatProgressBarStringResourceID.e_PageNumberFormat:t=r.date;break;case o.PageFormatProgressBarStringResourceID.e_PageNumberFormatLocal:t=r.dateLocal;break;default:t=""}return new o.WString(t)}}),s=o.PageformatSysFontCallback.implement({IsStandardFont:function(e){return!1},GetScriptName:function(e,t){return new o.WString("")},GetFaceName:function(e){return new o.WString(e.toString())},GetFontTypeName:function(e){return new o.String("")},GetFontFaceNameBold:function(e,t){return!1},GetFontFaceNameItalic:function(e,t){return!1}}),u=o.PageFormatProviderCallback.implement({Release:function(){},GetPreviewRect:function(n){return new o.FX_RECT(0,0,e,t)},GetPage:function(e,t){return e.GetPage(t)},OnPageChanged:function(e){},GetDocName:function(e){return new o.WString(n)}}),c=new o.PageFormatProvider(u);return c.SetProgressBarCallback(a),c.SetUndoCallback(i),c.SetSysFontCallback(s),c},PDFDoc.prototype.setAllBoxesByIndexes=function(e,t,n,r,o,i,a){var s=this,u=[],c=this.engine;return this.docPromise.then((function(d){var l;return e.forEach((l=_asyncToGenerator(regeneratorRuntime.mark((function e(l){var f,h,p,m,g,y,_,v,b,S,w,M;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(f=JSON.parse(JSON.stringify(i)),h=s.pageIndexMap[l],p=void 0,h?p=h.page||d.GetPage(l):(p=d.GetPage(l),(h=new _PDFPage2.default(l,s)).page=p),m=h.getBox(0),g=m.right-m.left,y=m.top-m.bottom,_=["cropBox","artBox","trimBox","bleedBox"],!a){e.next=13;break}return e.next=11,h.calcContentBBox(0);case 11:v=e.sent,_.forEach((function(e){f[e]=v}));case 13:S="number"==typeof n?n:y,(b="number"==typeof t?t:g)>g&&S>y?(m={left:0,right:b,bottom:0,top:S},_.forEach((function(e){var t=f[e];t&&(t.right=b-g+t.right,t.top=S-y+t.top)}))):r=o=0,(w=f.cropBox)&&w.right-w.left>=10&&w.top-w.bottom>=10&&(_.forEach((function(e){if("cropBox"!==e){var t=f[e];if(!t)return;var n=w.right-w.left,r=t.right-t.left,o=w.top-w.bottom,i=t.top-t.top;r>n&&(t.left=w.left,t.right=w.right),i>o&&(t.bottom=w.bottom,t.top=w.top),t.left=Math.max(w.left,t.left),t.bottom=Math.max(w.bottom,t.bottom),t.right=Math.min(w.right,t.right),t.top=Math.min(w.top,t.top)}})),f.cropBox&&h.setBox(1,f.cropBox),f.trimBox&&h.setBox(2,f.trimBox),f.artBox&&h.setBox(3,f.artBox),f.bleedBox&&h.setBox(4,f.bleedBox)),h.setBox(0,m),p.Reload(!1),(r>0||o>0)&&(M=new c.Matrix(1,0,0,1,Math.floor(r),Math.floor(o)),p.Transform(M,!0),p.StartParse(0,null,!0),M.delete()),u.push(h.toJson());case 22:case"end":return e.stop()}}),e,s)}))),function(e){return l.apply(this,arguments)})),u}))},PDFDoc.prototype.getAllBoxes=function(e){var t=this,n={};return this.docPromise.then((function(e){return[e.GetPageCount(),e]})).then((function(r){for(var o=_slicedToArray(r,2),i=o[0],a=o[1],s=0,u=0,c=i;c--;){var d=a.GetPage(c),l=new _PDFPage2.default(c,t);l.page=d;var f=l.getBox(0),h=f.right-f.left,p=f.top-f.bottom;c===e&&(n={mediaBox:f,cropBox:l.getBox(1),trimBox:d.GetBox(t.engine.BoxType.e_TrimBox).IsEmpty()?{}:l.getBox(2),artBox:d.GetBox(t.engine.BoxType.e_ArtBox).IsEmpty()?{}:l.getBox(3),bleedBox:d.GetBox(t.engine.BoxType.e_BleedBox).IsEmpty()?{}:l.getBox(4),width:h,height:p,pdfPage:l}),s=0===s||s>h?h:s,u=0===u||u>p?p:u}return n.minWidth=s,n.minHeight=u,n.pdfPage.calcContentBBox(0)})).then((function(e){return n.calcBox=e,delete n.pdfPage,n}))},PDFDoc.prototype.getPDFDocInfo=function(){return this.docPromise.then((function(e){var t=(0,_createDeferred2.default)(),n=e.GetInfo();return t.resolve(n),t.promise}))},PDFDoc.prototype.getPageCount=function(){return this.docPromise.then((function(e){return e.GetPageCount()}))},PDFDoc.prototype.getIndirectObject=function(e){return this.docPromise.then((function(t){var n=t.GetIndirectObject(e);return new _PDFObject2.default(t,n)}))},PDFDoc.prototype.getPagesWidthHeight=function(){return this.docPromise.then((function(e){return[e.GetPageCount(),e]})).then((function(e){for(var t=_slicedToArray(e,2),n=t[0],r=t[1],o=[],i=Date.now(),a=n;a--;){var s=r.GetPage(a);o[a]={width:s.GetWidth(),height:s.GetHeight()}}Date.now();return o}))},PDFDoc.prototype.getPageByIndex=function(e,t){var n=this,r=this.pageIndexMap[e];if(r)return t&&(r.id=t,this.updatePageCache(r)),Promise.resolve(r);if(this.pageIndexPromise[e])return this.pageIndexPromise[e];var o=(0,_createDeferred2.default)();return r=new _PDFPage2.default(e,this),this.pageIndexPromise[e]=r.c_pagePromise.then((function(){t&&(r.id=t),n.updatePageIndexMap(e,r),n.updatePageCache(r),delete n.pageIndexPromise[e],o.resolve(r)})).catch((function(t){_InvalidJRObjectError2.default.is(t)?(r=new _VirtualJRPDFPage2.default(e,n),n.updatePageIndexMap(e,r),n.updatePageCache(r),delete n.pageIndexPromise[e],o.resolve(r)):o.reject(t)})),o.promise},PDFDoc.prototype.getPage=function(e){},PDFDoc.prototype.getPDFPageByPageIndex=function(e){},PDFDoc.prototype.getPermission=function(){return this.stdCipherOptions?this.stdCipherOptions.permission:this.doc.GetUserPermissions()},PDFDoc.prototype.getMetadata=function(){for(var e=this.engine,t=new e.Metadata(this.doc),n={Title:getMetadataValues(t,(0,_constantsString.CWString)(e,"Title")),Author:getMetadataValues(t,(0,_constantsString.CWString)(e,"Author")),Subject:getMetadataValues(t,(0,_constantsString.CWString)(e,"Subject")),Keywords:getMetadataValues(t,(0,_constantsString.CWString)(e,"Keywords")),Creator:getMetadataValues(t,(0,_constantsString.CWString)(e,"Creator")),Producer:getMetadataValues(t,(0,_constantsString.CWString)(e,"Producer")),Trapped:getMetadataValues(t,(0,_constantsString.CWString)(e,"Trapped")),CreationDate:formatMetadataDate(getMetadataValues(t,(0,_constantsString.CWString)(e,"CreationDate"))),ModDate:formatMetadataDate(getMetadataValues(t,(0,_constantsString.CWString)(e,"ModDate"))),pdfaid:getMetadataValues(t,(0,_constantsString.CWString)(e,"pdfaid")),isTagged:this.doc.IsTaggedPDF(),isLinearized:this.doc.IsLinearized(),version:this.doc.GetFileVersion(),count:this.doc.GetPageCount()},r={},o=t.GetCustomerKeys(),i=0;i<o.GetSize();i++){var a=o.GetAt(i),s=t.GetValues(a),u=s.GetSize()>0?s.GetAt(0).toString():"";r[a.toString()]=u}for(var c={},d=t.GetAllRdfXMLKeys(),l=0;l<d.GetSize();l++){var f=d.GetAt(l).toString().split(":");if(!["CreateDate","Keywords","ModifyDate","Producer"].includes(f[1])){var h=t.GetRdfXMLString((0,_constantsString.CWString)(e,f[0]),(0,_constantsString.CWString)(e,f[1]));c[f[1]]=h.toString()}}return t.delete(),t=null,n.allXMLKey=c,n.custom=r,n},PDFDoc.prototype.setMetadataValue=function(e,t){var n=this.engine,r=new n.WString(e.toString()),o=void 0;o="CreationDate"===e||"ModDate"===e?this.ToDateTime(t):new n.WString(t.toString());var i=new n.Metadata(this.doc);if("CreationDate"===e)i.SetCreationDateTime(o);else if("ModDate"===e)i.SetModifiedDateTime(o);else{var a=i.GetValues(r);a.RemoveAll(),a.Add(o),i.SetValues(r,a)}i.delete(),i=null},PDFDoc.prototype.ToDateTime=function(e){var t=new Date(e),n=t.getFullYear(),r=t.getMonth()+1,o=t.getDate(),i=t.getHours(),a=t.getMinutes(),s=t.getSeconds(),u=t.getMilliseconds(),c=-t.getTimezoneOffset()/60;return new this.engine.DateTime(n,r,o,i,a,s,u,c,0)},PDFDoc.prototype.movePageTo=function(e,t){var n=this;return this.docPromise.then((function(r){var o=n.getPageById(e);return o.parsedPage().then((function(e){var i=o.index,a=r.MovePageTo(e,t);if(a){var s=void 0,u=void 0,c=void 0;i<t?(s=i,u=t,c=!1):(s=t,u=i,c=!0),n.updatePageIndex(s,u,c,!0)}return a}))}))},PDFDoc.prototype.insertPage=function(e,t,n){var r=this;return this.docPromise.then((function(o){var i=o.InsertPage(e,t,n);if(!i)return!1;var a=i.GetIndex(),s=void 0,u=s=new _PDFPage2.default(a,r);s.page=i;var c=o.GetPageCount()-1;return r.updatePageIndex(a+1,c,!0,!1),r.updatePageIndexMap(a,u),r.updatePageCache(s),s.toJson()}))},PDFDoc.prototype.removePage=function(e){var t=this,n=this,r=this.touchup;return this.JR.asyncOperation((function(){return t.doc.RemovePage(e)})).then((function(t){if(t){if(r&&delete r.editPages[e],n.pageIndexMap[e]){var o=n.pageIndexMap[e];delete n.pageIndexMap[e],delete n.pageIndexPromise[e],delete n.pageCache[o.id]}var i=n.doc.GetPageCount()-1;n.updatePageIndex(e,i)}return t}))},PDFDoc.prototype.showNameTreePageAtTheEnd=function(){var e=this;return this.docPromise.then((function(t){var n=t.GetPageCount()-1,r=t.GetPage(n),o=new _PDFPage2.default(n,e);return o.page=r,e.updatePageIndexMap(n,o),e.updatePageCache(o),o.toJson()}))},PDFDoc.prototype.hideNameTreePage=function(e){if(this.pageIndexMap[e]){var t=this.pageIndexMap[e];delete this.pageIndexMap[e],delete this.pageIndexPromise[e],delete this.pageCache[t.id]}var n=this.doc.GetPageCount()-1;return this.updatePageIndex(e,n),!0},PDFDoc.prototype.updatePageIndex=function(e,t,n,r){if(r)if(n){var o=this.pageIndexMap[t];delete this.pageIndexMap[t],this.updatePageIndex(e+1,t,n,!1),o&&(this.pageIndexMap[e]=o,this.pageIndexMap[e].index=e)}else{var i=this.pageIndexMap[e];delete this.pageIndexMap[e],this.updatePageIndex(e,t-1,n,!1),i&&(this.pageIndexMap[t]=i,this.pageIndexMap[t].index=t)}else if(n)for(var a=t;a>=e;a--)this.pageIndexMap[a-1]&&(this.pageIndexMap[a]=this.pageIndexMap[a-1],delete this.pageIndexMap[a-1],delete this.pageIndexPromise[a-1],this.pageIndexMap[a].index=a);else for(var s=e;s<=t;s++)this.pageIndexMap[s+1]&&(this.pageIndexMap[s]=this.pageIndexMap[s+1],delete this.pageIndexMap[s+1],delete this.pageIndexPromise[s+1],this.pageIndexMap[s].index=s)},PDFDoc.prototype.destroy=function(){var e=this;this.beforeSaveHooks=[];var t=this.pageCache,n=[];for(var r in t)n.push(t[r].destroy()),delete t[r];this.destroyHooks.forEach((function(e){return e()})),this.form&&this.form.destroy(),this.form=null,this.attachments=null,this.asyncBlock&&this.asyncBlock.destroy(),this.password=null,this.stdCipherOptions=null,this.passwordType=null;var o=this.doc;try{o.ClearRenderCache()}catch(e){}this.JR.unRegisterSecurityCallback("FOPN_foweb"),this.destroyCallback(),this.docPromise=null,this.docDeferred.promise=null,this.readerCallback&&this.readerCallback.delete(),this.readerCallback=null,this.otherData=null;var i=this.rootBookmark;i&&i.destroy(),this.rootBookmark=null,this.buffer&&this.engine._free(this.buffer),this.buffer=null,this.getBuffer=null;var a=Promise.all(n).then((function(t){e.doc=null;var n=e.doc;n&&n.delete()}));return this.destroyHooks=[],(0,_constantsString.cleanString)(),a},PDFDoc.prototype.destroyPage=function(e){var t=this.getPageById(e);t&&(t.destroy(),delete this.pageCache[e])},PDFDoc.prototype.getInfos=function(){return{fileSize:this.doc.GetFileSize()}},PDFDoc.prototype.toJson=function(){var e=this.doc,t=this.engine;e.GetPage(0);var n=e.GetPageCount(),r=e.GetFileSize(),o=void 0,i=this.doc.GetOpenAction();i.IsEmpty()||(o=(i=this.JR.actionManager.get(i,this.doc,this.JR)).toJson());var a=[],s=e.GetTrailer();if(s){var u=(0,_constantsString.CString)(t,"ID"),c=s.GetElement(u);if(c)for(var d=c.GetArray(),l=0;l<2;l++){for(var f=d.GetElement(l).GetString().GetBuffer(),h="",p=0;p<16;p++){var m=this.engine.HEAP8[f+p]>>>0&255;(m=m.toString(16)).length<2&&(m="0"+m),h+=m}a.push(h)}}var g=e.GetUserPermissions(),y=!0,_=t.PasswordType.e_PwdNoPassword;try{var v=e.GetSecurityHandler();if(v.IsEmpty())y=!0;else{var b=t.EncryptType;switch(v.GetSecurityType()){case b.e_EncryptNone:y=!0;break;case b.e_EncryptPassword:y=(_=e.GetPasswordType())==t.PasswordType.e_PwdOwner;break;case b.e_EncryptFoxitDRM:case b.e_EncryptCDRM:y=e.GetDRMEncryptData().is_owner;break;case b.e_EncryptCertificate:y=!!(2&g);break;case b.e_EncryptCustom:case b.e_EncryptRMS:case b.e_EncryptUnknown:default:y=!0}}}catch(e){y=!1}var S=e.IsXFA()?1:0,w={};1==S&&!e.IsStaticXFA()?S=2:w=this.getNameTree(2);var M=[],D=e.GetCatalog(),P=(0,_constantsString.CString)(t,"Names"),T=(0,_constantsString.CString)(t,"AP"),k=D.GetElement(P),A=(k=D.GetElement(P)&&D.GetElement(P).GetDict())&&k.GetElement(T);if(A&&A.GetDirectObject()){var L=A.GetDirectObject().GetDict().GetElement(P);if(L)for(var F=L.GetArray(),I=F.GetElementCount(),x=0;x<I;x+=2){var C=void 0,R=F.GetElement(x).GetString();try{C=R.toString()}catch(e){for(var O="",G=R.GetBuffer(),E=0,Y=R.GetLength();E<Y;E++){var j=this.engine.HEAP8[G+E]>>>0&255;O+=String.fromCharCode(j)}C=this.JR.pdfNameDecoding(O)}var N=F.GetElement(x+1).GetDirectObject();N&&M.push({name:C,objNum:N.GetObjNum()})}}var B=!1,H=e.GetCatalog(),W=(0,_constantsString.CString)(t,"AcroForm");if(H.HasKey(W)){var U=H.GetElement(W).GetDirectObject();if(U.GetType()==t.PDFObjectType.e_Dictionary){var z=U.GetDict(),J=(0,_constantsString.CString)(t,"SigFlags");if(z.HasKey(J)){var V=z.GetElement(J).GetInteger();(1&V||2&V)&&(B=!0)}}}var K=[];if(B)for(var q=e.GetSignatureCount(),Z=0;Z<q;Z++){var X=e.GetSignature(Z);if(X.IsSigned()){y=!1;var Q=4294963392;switch(X.GetDocPermission().value){case 0:Q=4294967292;break;case 1:Q=4294965972;break;case 2:Q=4294966740;break;case 3:Q=4294966772}K.push(Q)}}8&g&&(g=(1024|g)>>>0),this.isOwner=y;var $=this.isCompareDoc(),ee=getMetadataValues(new t.Metadata(this.doc),(0,_constantsString.CWString)(t,"pdfaid"));return{curFileSymbolId:this.curFileId,id:this.id,fileSize:r,sigPerms:K,fileID:a,pageCount:n,userPermissions:g,oriPerm:e.GetUserPermissions(),action:o,jsNameTree:w,isOwner:y,passwordType:_.value,icons:M,isTagged:e.IsTaggedPDF(),isPortfolio:e.IsPortfolio(),isCompareDoc:$,pdfaid:ee,fileType:S}},PDFDoc.prototype.getStream=function(e,t){var n=e.writeStream;this.beforeSaveHooks.forEach((function(e){return e()}));var r=this.engine;return this.docPromise.then((function(e){var o=0,i=(0,_createDeferred2.default)(),a=r.WriterCallback.implement({Release:function(){a.delete()},Flush:function(){return i.resolve(o),!0},GetSize:function(){return o},WriteBlock:function(e,t,i){o=Math.max(t+i,o);var a=r.HEAPU8.buffer,s=void 0;return s=a.slice?a.slice(e,e+i):new Uint8Array(a,e,i).buffer,n(s,t,i),!0}});return r.saveDoc(e,a,t),i.promise}))},PDFDoc.prototype.importFromFDF=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;r||(r=(0,_createDeferred2.default)());var o=new this.engine.Range(0,this.doc.GetPageCount()-1,this.engine.RangeFilter.e_All);try{var i=this.doc.ImportFromFDF(e,n,o);r.resolve(i)}catch(o){if(17==(o=this.engine.getErrorCode(o)).value)return void setTimeout((function(){t.importFromFDF(e,n,r)}),200);console.warn(o)}finally{o.delete(),o=null,logger.info("ImportFromFDF","finally")}return r.promise},PDFDoc.prototype.getBookmarks=function(){var e=this;return this.docPromise.then((function(t){var n=(0,_createDeferred2.default)();if(e.rootBookmark)return n.resolve(e.rootBookmark.toJson()),n.promise;var r=t.GetRootBookmark(),o=void 0;if(r.IsEmpty())o=null;else{var i=new _PDFBookmark2.default(e,r.GetDict().GetObjNum(),r,t);o=i.toJson(),e.rootBookmark=i}return n.resolve(o),n.promise}))},PDFDoc.prototype.getBlankPageIndexes=function(){return this.docPromise.then((function(e){for(var t=e.GetBlankPageIndexes(),n=[],r=t.GetSize();r--;)n[r]=t.GetAt(r);return n}))},PDFDoc.prototype.createRootBookmark=function(){var e=this;return this.docPromise.then((function(t){if(!e.rootBookmark){var n=t.CreateRootBookmark(),r=new _PDFBookmark2.default(e,n.GetDict().GetObjNum(),n,t);e.rootBookmark=r}return e.rootBookmark.toJson()}))},PDFDoc.prototype.addBookmarksFromStructureRoles=function(e,t){var n=this;return this.docPromise.then((function(r){var o=r.GetRootBookmark();!0===o.IsEmpty()&&(o=r.CreateRootBookmark());var i=(0,_constantsString.CWString)(n.engine,t),a=o.Insert(i,n.engine.BookmarkPosition.e_PosLastChild),s=new n.engine.WStringArray,u=!0,c=!1,d=void 0;try{for(var l,f=e[Symbol.iterator]();!(u=(l=f.next()).done);u=!0){var h=l.value;s.Add((0,_constantsString.CWString)(n.engine,h))}}catch(e){c=!0,d=e}finally{try{!u&&f.return&&f.return()}finally{if(c)throw d}}return a.AddBookmarksFromStructureRoles(s,null),a.GetDict().GetObjNum()}))},PDFDoc.prototype.insertBookmark=function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=arguments[5],a=this,s=a.rootBookmark.getBookmarkById(e),u=s.insert(t,n,{top:r,left:o},i),c=u.toJson();return c},PDFDoc.prototype.setBookmarkProperty=function(e,t){var n=this.rootBookmark.getBookmarkById(e);return n.setProperty(t),n.toJson()},PDFDoc.prototype.removeBookmark=function(e){var t=void 0;return this.rootBookmark.id==e?(t=this.rootBookmark,this.rootBookmark=null):t=this.rootBookmark.removeChild(e),t.remove()},PDFDoc.prototype.getLayerNodes=function(){var e=this.engine,t=this;return this.docPromise.then((function(n){var r=(0,_createDeferred2.default)(),o=new _PDFLayer2.default(n,e);t.pdfLayer=o;var i=o.toJson();return r.resolve(i),r.promise}))},PDFDoc.prototype.createLayerNodes=function(e){return new _PDFLayer2.default(this.doc,this.engine,e)},PDFDoc.prototype.getRedaction=function(){var e=this.engine,t=this;return this.docPromise.then((function(n){if(!e.Library.HasModuleLicenseRight({value:3}))return Promise.reject(_errorCode.error.noRedactionLicense);if(!t.c_redaction)try{t.c_redaction=new e.Redaction(n)}catch(t){isNaN(t)||(t=e.getErrorCode(t)),console.warn(t)}return t.c_redaction}))},PDFDoc.prototype.applyRedaction=function(){for(var e=this,t={},n={},r=[],o=0;o<this.doc.GetPageCount();o++)r.push(this.getPageByIndex(o).then((function(e){return n[e.index]=e,e.getAnnots()})));return Promise.all(r).then((function(n){var r=function(r){var o=e.pageCache[r];t[o.index]||(t[o.index]={}),n[o.index].forEach((function(e){var n=e.annot.GetDict().GetObjNum();n&&(t[o.index][n]=e)}))};for(var o in e.pageCache)r(o);return e.getRedaction().then((function(t){var n=[];if(!t.Apply())return!1;for(var r in e.pageCache){var o=e.pageCache[r];n.push(o.update())}return Promise.all(n)})).then((function(e){for(var n=[],r=0;r<e.length;r++){var o=e[r],i=o.index,a=t[i],s=[];for(var u in a){var c=a[u];(-1===o.annotIds.indexOf(u)||c.annot.IsEmpty())&&s.push(u)}n.push({pageIndex:i,removedAnnotIds:s})}return n})).catch((function(t){return-6===t.error||isNaN(t)||(t=e.engine.getErrorCode(t)),Promise.reject(t)}))}))},PDFDoc.prototype.exportToFDF=function(e,t,n){var r=this,o=this.engine,i=new o.FDFDoc(e);if(0==Object.keys(n).length){var a=new o.Range(0,this.doc.GetPageCount(),o.RangeFilter.e_All);this.doc.ExportToFDF(i,t,a),a.delete(),a=null}else{var s=function(e){var t=r.getPageById(e);if(!t)throw new Error("page not loaded: "+e);n[e].forEach((function(e){var n=t._getAnnotIndexById(e),o=t.page.GetAnnot(n);r.doc.ExportAnnotToFDF(o,i)}))};for(var u in n)s(u)}var c=0,d=[],l=o.WriterCallback.implement({Release:function(){i.delete()},Flush:function(){return!0},GetSize:function(){return c},WriteBlock:function(e,t,n){c+=n;var r=o.HEAPU8.buffer,i=void 0;return i=r.slice?r.slice(e,e+n):new Uint8Array(r,e,n).buffer,d.push(i),!0}});return i.SaveAs(l),new Blob(d,{type:["application/vnd.adobe.fdf","application/vnd.xfdf"][e]})},PDFDoc.prototype.exportToStardardXml=function(e,t){var n=this,r=this.engine,o=this.doc,i=null,a=void 0,s=r.ExportToImageCallback.implement({Release:noop,GetPDFProducer:function(){return new r.WString("")},GetPDFDocAuthor:function(){return new r.WString("")},GetStreamCallbackForImage:function(e){var n=e.toString();return-1!=n.indexOf("\\")&&(n=n.replace("\\","/")),0==n.indexOf("/")&&(n=n.substr(1,n.length-1)),i&&i.byteLength>0&&t({fileName:n,imgBuffer:i,percent:a?a.GetRateOfProgress():0}),i=new ArrayBuffer,r.StreamCallback.implement({Release:function(){},Flush:function(){return!0},GetSize:function(){return i.byteLength},ReadBlock:function(e,t,n){if(i&&i.byteLength>0){var o=new Uint8Array(i,t,n);return r.HEAPU8.set(o,e),!0}return!1},WriteBlock:function(e,t,n){if(i.byteLength<t+n){var o=i;if(i=new ArrayBuffer(t+n),0!==o.byteLength){var a=new Uint8Array(o);new Uint8Array(i).set(a)}}var s=new Uint8Array(i,t,n),u=r.HEAPU8.subarray(e,e+n);return s.set(u),!0}})}}),u=0,c=[],d=r.WriterCallback.implement({Release:noop,Flush:function(){return!0},GetSize:function(){return u},WriteBlock:function(e,t,n){u+=n;var o=r.HEAPU8.buffer,i=void 0;return i=o.slice?o.slice(e,e+n):new Uint8Array(o,e,n).buffer,c.push(i),!0}}),l=new r.WString(e),f=new r.WString(e),h=r.PauseCallback.implement({NeedToPauseNow:function(){return!0}});a=o.StartExportToXML(d,f,l,s,h),t({percent:a.GetRateOfProgress()}),continueExport={exportImageCallback:s,pauseCallback:h};var p=r.ProgressiveState.e_ToBeContinued;setTimeout((function o(){continueExport&&p===r.ProgressiveState.e_ToBeContinued?(p=a.Continue(),setTimeout(o,0)):(t({imgBuffer:i,xmlBuffer:c,fileName:e,percent:100}),n.cancelExport())}),0)},PDFDoc.prototype.exportToTxt=function(e,t,n){var r=this,o=this.engine,i=new o.Range;if(t&&t.string){var a=t.string,s=t.filter;a.split(",").filter((function(e){return!!e})).forEach((function(e){if(e.indexOf("-")>=0){var t=e.split("-"),n=_slicedToArray(t,2),r=n[0],a=n[1];i.AddSegment(Number(r)-1,Number(a)-1,{all:o.RangeFilter.e_All,even:o.RangeFilter.e_Odd,odd:o.RangeFilter.e_Even}[s])}else i.AddSingle(Number(e)-1)}))}var u=new o.ExportProvider,c=void 0,d=0,l=[],f=o.StreamCallback.implement({Release:function(){f.delete()},Flush:function(){return!0},GetSize:function(){return d},ReadBlock:function(){return!0},WriteBlock:function(e,t,n){d+=n;var r=o.HEAPU8.buffer,i=void 0;return i=r.slice?r.slice(e,e+n):new Uint8Array(r,e,n).buffer,l.push(i),!0}});"convert-pdf-to-accessible-txt"===e?(c=o.ExportAccessibilityTextCallback.implement({Release:function(){},GetEntryKey:function(){return new o.WString("")},GetTxtFileStream:function(){return f}}),u.SetExportAccessibilityTextCallback(c)):(c=o.ExportTextCallback.implement({Release:function(){},GetTxtFileStream:function(){return f}}),u.SetExportTextCallback(c));var h=o.PauseCallback.implement({NeedToPauseNow:function(){return!0}}),p=new o.ExportMgr(u,this.doc),m=p.StartExportPDFToText(i,h);continueExport={range:i,exportTextCallback:c,pauseCallback:h,exportProvider:u,exportMgr:p};var g=o.ProgressiveState.e_ToBeContinued;setTimeout((function e(){continueExport&&g===o.ProgressiveState.e_ToBeContinued?(g=m.Continue(),n({percent:m.GetRateOfProgress()}),setTimeout(e,0)):(n({buffer:l,percent:100}),r.cancelExport())}),0)},PDFDoc.prototype.generateImageExportSetting=function(e,t,n){var r=null,o=function(e){if(!(["png","jpeg","jpeg2000","tiff","bmp"].indexOf(t.format)<0)){e.SetImageColorSpace({value:t.imageColorSpace});var n=[0,72,96,150,300,600,1200,2400].indexOf(t.imageResolution);n>=0?e.SetImageResolution({value:n}):(e.SetImageResolution({value:-1}),e.SetCustomResolution(t.imageResolution)),"tiff"===t.format&&e.SetImageConvertType({value:t.imageConvertType})}};switch(t.format){case"png":(r=new e.PNGExportSetting).SetInterlace({value:t.pngInterlace}),o(r);break;case"jpeg":case"jpeg2000":(r=new e.JPEGExportSetting("jpeg2000"===t.format)).SetImageGrayscaleQuality({value:t.imageGrayscaleQuality}),r.SetImageColorQuality({value:t.imageColorQuality}),"jpeg2000"===t.format&&r.SetImageTile(t.imageTile),o(r);break;case"tiff":(r=new e.TIFFExportSetting).SetMonochromeCompressType({value:t.monochromeCompressType}),r.SetGrayscaleCompressType({value:t.grayscaleCompressType}),r.SetColorCompressType({value:t.colorCompressType}),o(r);break;case"bmp":o(r=new e.BMPExportSetting)}if(r){if(n)return r.SetImageSettingType(e.ImageSettingType.e_PageToImage),r;switch(t.type){case"pageToImage":r.SetImageSettingType(e.ImageSettingType.e_PageToImage);break;case"imageObjsOfPage":r.SetImageSettingType(e.ImageSettingType.e_ImageObjsOfPage),r.SetImageMinInch({value:t.imageMinInch})}return r}},PDFDoc.prototype.exportToImage=function(e,t,n,r){var o=this,i=this.engine,a=this.generateImageExportSetting(i,e),s=new i.Range;if(n&&n.string){var u=n.string,c=n.filter;u.split(",").filter((function(e){return!!e})).forEach((function(e){if(e.indexOf("-")>=0){var t=e.split("-"),n=_slicedToArray(t,2),r=n[0],o=n[1];s.AddSegment(Number(r)-1,Number(o)-1,{all:i.RangeFilter.e_All,even:i.RangeFilter.e_Odd,odd:i.RangeFilter.e_Even}[c])}else s.AddSingle(Number(e)-1)}))}var d=null,l=null,f=i.ExportImageCallback.implement({Release:function(){},GetDeviceCapsX:function(){return e.dpi&&e.dpi.x||96},GetDeviceCapsY:function(){return e.dpi&&e.dpi.y||96},CallBackError:function(){return!0},GetImageFileStream:function(e,n){d&&d.byteLength>0&&r({fileName:l,buffer:d,percent:g?g.GetRateOfProgress():0}),d=new ArrayBuffer;var o=t.lastIndexOf("."),a=t.substr(0,o),s=t.substr(o);return l=n<=0?a+"_Page"+e.toString()+s:a+"_Page"+e.toString()+"_Image"+n.toString()+s,i.StreamCallback.implement({Release:function(){},Flush:function(){return!0},GetSize:function(){return d.byteLength},ReadBlock:function(e,t,n){if(d&&d.byteLength>0){var r=new Uint8Array(d,t,n);return i.HEAPU8.set(r,e),!0}return!1},WriteBlock:function(e,t,n){if(d.byteLength<t+n){var r=d;if(d=new ArrayBuffer(t+n),0!==r.byteLength){var o=new Uint8Array(r);new Uint8Array(d).set(o)}}var a=new Uint8Array(d,t,n),s=i.HEAPU8.subarray(e,e+n);return a.set(s),!0}})}}),h=i.PauseCallback.implement({NeedToPauseNow:function(){return!0}}),p=new i.ExportProvider;p.SetExportImageCallback(f);var m=new i.ExportMgr(p,this.doc),g=m.StartExportPDFToImage(a,s,h);r({percent:g.GetRateOfProgress()}),continueExport={imageExportSetting:a,engineRange:s,exportImageCallback:f,pauseCallback:h,exportProvider:p,exportMgr:m};var y=i.ProgressiveState.e_ToBeContinued;setTimeout((function e(){continueExport&&y===i.ProgressiveState.e_ToBeContinued?(y=g.Continue(),setTimeout(e,0)):(r({buffer:d,fileName:l,percent:100}),o.cancelExport())}),0)},PDFDoc.prototype.exportImageObjectToImage=(_ref13=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n,r,o){var i,a,s,u,c,d,l,f,h,p,m,g,y,_,v=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this.engine,a=this.generateImageExportSetting(i,n,t),s=this.doc.GetPage(t.index),u=new _PDFPage2.default(t.index,this),e.next=6,u.getGraphicsObjectAtPoint(t.selectPosition,0,3);case 6:c=e.sent,d=c.graphicsObject,l=null,f=i.ExportImageCallback.implement({Release:function(){},GetDeviceCapsX:function(){return n.dpi&&n.dpi.x||96},GetDeviceCapsY:function(){return n.dpi&&n.dpi.y||96},CallBackError:function(){return!0},GetImageFileStream:function(){l&&l.byteLength>0&&o({fileName:r,buffer:l,percent:g?g.GetRateOfProgress():0}),l=new ArrayBuffer;var e=i.StreamCallback.implement({Release:function(){e.delete()},Flush:function(){return!0},GetSize:function(){return l.byteLength},ReadBlock:function(e,t,n){if(l&&l.byteLength>0){var r=new Uint8Array(l,t,n);return i.HEAPU8.set(r,e),!0}return!1},WriteBlock:function(e,t,n){if(l.byteLength<t+n){var r=l;if(l=new ArrayBuffer(t+n),0!==r.byteLength){var o=new Uint8Array(r);new Uint8Array(l).set(o)}}var a=new Uint8Array(l,t,n),s=i.HEAPU8.subarray(e,e+n);return a.set(s),!0}});return e}}),h=i.PauseCallback.implement({NeedToPauseNow:function(){return!0}}),(p=new i.ExportProvider).SetExportImageCallback(f),m=new i.ExportMgr(p,this.doc),g=m.StartExportImageObjToImage(d,s,a,h),o({percent:g.GetRateOfProgress()}),continueExport={imageExportSetting:a,exportImageCallback:f,pauseCallback:h,exportProvider:p,exportMgr:m},y=i.ProgressiveState.e_ToBeContinued,_=function e(){continueExport&&y===i.ProgressiveState.e_ToBeContinued?(y=g.Continue(),setTimeout(e,0)):(o({buffer:l,fileName:r,percent:100}),v.cancelExport())},setTimeout(_,0);case 20:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return _ref13.apply(this,arguments)}),PDFDoc.prototype.cancelExport=function(){if(continueExport){for(var e in continueExport)continueExport[e]=null;continueExport=null}},PDFDoc.prototype.loadForm=function(){if(this.form)return this.form;var e=this.engine,t=new e.Form(this.doc);return this.form=new _Form2.default(this,t,e,this.JR),this.form},PDFDoc.prototype.setOpenAction=function(e,t){var n=this.JR.actionManager.create(this.doc,e);return this.doc.SetOpenAction(n),(n=this.JR.actionManager.get(n,this.doc,this.JR)).create(t),n.toJson()},PDFDoc.prototype.getSecurityType=function(){return this.doc.GetSecurityHandler().GetSecurityType().value},PDFDoc.prototype.setCertificateAndPermission=function(e,t,n){var r=this.engine,o=new FileReaderSync,i=new r.EnvelopeArray;e.forEach((function(e){var t=e.cerFile,n=e.permission,a=o.readAsArrayBuffer(t),s=r.StreamCallback.implement({GetSize:function(){return a.byteLength},GetPosition:function(){return 0},ReadBlock:function(e,t,n){var o=new Uint8Array(a,t,n);return r.HEAPU8.set(o,e),!0}}),u=null;if(n){var c=n.print,d=n.change,l=n.accessibility,f=n.copy;(u=new r.CertPermission).bEnableCopy=f,u.bEnableTextAccess=l,u.printPer={value:c},u.changePer={value:d}}var h=new r.Envelope(s,u);i.Add(h)}));var a=r.CipherType.e_CipherNone;t===_cipherType2.default.AES128||t===_cipherType2.default.AES256?a=r.CipherType.e_CipherAES:t===_cipherType2.default.RC4&&(a=r.CipherType.e_CipherRC4);var s=new r.CertificateSecurityHandler;return s.Initialize(i,a,n),this.doc.SetSecurityHandler(s),!0},PDFDoc.prototype.setPasswordAndPermission=function(e,t,n,r,o){var i=this,a=this.engine;return this.docPromise.then((function(s){var u=void 0,c=void 0;if(r==_cipherType2.default.None)u=a.CipherType.e_CipherNone,c=0;else if(r==_cipherType2.default.RC4)u=a.CipherType.e_CipherRC4,c=16;else if(r==_cipherType2.default.AES128)u=a.CipherType.e_CipherAES,c=16;else{if(r!=_cipherType2.default.AES256)throw new Error("cipher error");u=a.CipherType.e_CipherAES,c=32}var d=s.GetEncryptionType(),l=s.GetSecurityHandler(),f=l.GetSecurityType(),h=void 0,p=void 0;try{d!==a.EncryptType.e_EncryptNone&&1===f.value?((p=s.GetStdEncryptData()).cipher=u,p.is_encrypt_metadata=o,p.key_length=c,p.user_permissions=n,h=new a.StdSecurityHandler(l)):(p=new a.StdEncryptData(o,n,u,c),h=new a.StdSecurityHandler)}catch(e){p=new a.StdEncryptData(o,n,u,c),h=new a.StdSecurityHandler}if(r==_cipherType2.default.AES256){var m=void 0,g=void 0;h.SetAES256ModifyFlags(7),-1===e?(m=new a.WString(""),g=new a.WString(t),h.InitializeW(p,m,g)):(m=new a.WString(e),g=new a.WString(t),h.InitializeW(p,m,g)),m.delete(),g.delete()}else{var y=void 0,_=void 0;y=new a.String(-1===e?"":e),_=new a.String(t),h.Initialize(p,y,_),y.delete(),_.delete()}var v=s.SetSecurityHandler(h);return v&&(i.stdCipherOptions={isEncryptMetadata:o,permission:n,cipherType:r}),p.delete(),h.delete(),v}))},PDFDoc.prototype.removeSecurity=function(){var e=this;return this.docPromise.then((function(t){return e.registerDRMSecurityCallback=!1,t.RemoveSecurity()}))},PDFDoc.prototype.checkPassword=function(e){var t=this,n=this.engine;return this.docPromise.then((function(r){var o=new n.String(e),i=r.CheckPassword(o);return o.delete(),t.isOwner=3==i.value,i.value}))},PDFDoc.prototype.getStdCipherOptions=function(){var e=this;return this.docPromise.then((function(t){if(e.stdCipherOptions)return e.stdCipherOptions;var n={},r=t.GetSecurityHandler();if(!r||r.IsEmpty())return n;if(1==r.GetSecurityType().value){var o=t.GetStdEncryptData();n.isEncryptMetadata=o.is_encrypt_metadata,n.permission=o.user_permissions,0===o.cipher.value?n.cipherType=_cipherType2.default.None:1===o.cipher.value?n.cipherType=_cipherType2.default.RC4:2===o.cipher.value&&(16===o.key_length?n.cipherType=_cipherType2.default.AES128:n.cipherType=_cipherType2.default.AES256)}return n}))},PDFDoc.prototype.getUserPassword=function(e){var t=this,n=this.engine,r=void 0;return this.docPromise.then((function(e){return r=e,t.getStdCipherOptions()})).then((function(o){if(o.cipherType===_cipherType2.default.AES256)return t.password||"";var i=new n.String(e),a=void 0;try{a=r.GetUserPassword(i).toString()}catch(e){a=t.password||""}return i.delete(),a}))},PDFDoc.prototype.getFileVersion=function(){return this.docPromise.then((function(e){return e.GetFileVersion()}))},PDFDoc.prototype.setRenderFlag=function(e){this.renderFlags=e},PDFDoc.prototype.getRenderFlags=function(){return this.renderFlags},PDFDoc.prototype.drmEncrypt=function(e){var t=this.engine;return this.docPromise.then((function(e){var n=e.GetSecurityHandler();if(n&&!n.IsEmpty()){var r=n.GetSecurityType();if(r!==t.EncryptType.e_EncryptUnknown&&r!==t.EncryptType.e_EncryptNone){var o=new Error("This document has been encrypted and cannot be encrypted again!");return o.error=-1,Promise.reject(o)}}return e})).then((function(n){var r=new t.String(e.subFilter),o=new t.DRMEncryptData(e.isEncryptMetadata,r,t.CipherType.values[e.cipher],e.keyLength,e.isOwner,e.userPermissions);r.delete();var i=new t.DRMSecurityHandler;if(e.values){var a=e.values;for(var s in a){var u=new t.String(s),c=new t.WString(a[s]);i.SetDRMValue(u,c)}}if(i.Initialize(o,new t.String(e.fileId),new t.String(e.initialKey)))return o.delete(),[n,i];o.delete();var d=new Error("Document encryption failed!");return d.error=2,Promise.reject(d)})).then((function(e){var t=_slicedToArray(e,2),n=t[0],r=t[1];return n.SetSecurityHandler(r)}))},PDFDoc.prototype.getTemplates=function(){var e=this.doc.GetCatalog();if(!e)return null;var t=this.engine,n=(0,_constantsString.CString)(t,"Names"),r=e.GetElement(n);if(!r)return null;var o=r.GetDict();if(!o)return null;var i=new Array,a=o.GetElement((0,_constantsString.CString)(t,"Templates"));if(a){var s=a.GetDict();if(s){var u=s.GetElement(n);if(u){var c=u.GetArray();if(c)for(var d=c.GetElementCount(),l=0;l<d;l+=2){var f=c.GetElement(l).GetString(),h=this.JR.getPDFString(f);if(h&&""!==h&&l+1<d){var p=c.GetElement(l+1);p.GetType()===this.engine.PDFObjectType.e_Reference&&(p=p.GetDirectObject());var m={name:h,objNum:p.GetObjNum()};i.push(m)}}}}}var g=[],y=o.GetElement((0,_constantsString.CString)(t,"Pages"));if(y){var _=y.GetDict();if(_){var v=_.GetElement(n);if(v){var b=v.GetArray();if(b)for(var S=b.GetElementCount(),w=0;w<S;w+=2){var M=b.GetElement(w).GetString(),D=this.JR.getPDFString(M);if(D&&""!==D&&w+1<S){var P=b.GetElement(w+1);P.GetType()===this.engine.PDFObjectType.e_Reference&&(P=P.GetDirectObject());var T={name:D,objNum:P.GetObjNum()};g.push(T)}}}}}return{visibleArr:g,invisibleArr:i}},PDFDoc.prototype.removeTemplate=function(e){var t=this.doc.GetCatalog();if(!t)return!0;var n=this.engine,r=(0,_constantsString.CString)(n,"Names"),o=t.GetElement(r);if(!o)return!0;var i=o.GetDict();if(!i)return!0;var a=i.GetElement((0,_constantsString.CString)(n,"Templates")),s=a?a.GetDict():null;if(s){var u=s.GetElement(r);if(u){var c=u.GetArray();if(c)for(var d=c.GetElementCount(),l=0;l<d;l+=2){var f=c.GetElement(l).GetString().toString();if(f&&""!==f&&f===e&&l+1<d){c.RemoveAt(l),c.RemoveAt(l);break}}}}var h=i.GetElement((0,_constantsString.CString)(n,"Pages")),p=h?h.GetDict():null;if(p){var m=p.GetElement(r);if(m){var g=m.GetArray();if(g)for(var y=g.GetElementCount(),_=0;_<y;_+=2){var v=g.GetElement(_).GetString().toString();if(v&&""!==v&&v===e&&_+1<y){g.RemoveAt(_),g.RemoveAt(_);break}}}}return!0},PDFDoc.prototype.hideTemplate=function(e,t){var n=this.doc.GetCatalog();if(!n)return!1;var r=this.engine,o=(0,_constantsString.CString)("Names"),i=n.GetElement((0,_constantsString.CString)(r,"Names"));if(!i)return!1;var a=i.GetDict();if(!a)return!1;var s=(0,_constantsString.CString)(r,"Templates"),u=a.GetElement(s),c=u?u.GetDict():null;c||(c=this.engine.PDFDictionary.Create(),a.SetAtReference(s,c,this.doc));var d=c.GetElement(o);d||(d=this.engine.PDFArray.Create(),c.SetAt(o,d));var l=d.GetArray(),f=(0,_constantsString.CString)(r,"Pages"),h=a.GetElement(f),p=h?h.GetDict():null;p||(p=this.engine.PDFDictionary.Create(),a.SetAtReference(f,p,this.doc));var m=p.GetElement(o);m||(m=this.engine.PDFArray.Create(),p.SetAt(o,m));var g=m.GetArray(),y=g,_=l,v="Page";t&&(y=l,_=g,v="Template");var b=new this.engine.WString(e.name);y.AddString(b),b.delete();var S=this.engine.PDFObject.CreateReference(this.doc,e.objNum);y.AddElement(S);for(var w=(0,_constantsString.CString)(r,"Type"),M=(0,_constantsString.CString)(r,v),D=_.GetElementCount(),P=0;P<D;P+=2){var T=_.GetElement(P).GetString().toString();if(T&&""!==T&&T===e.name&&P+1<D){var k=_.GetElement(P+1);if(k.GetType()===this.engine.PDFObjectType.e_Reference&&(k=k.GetDirectObject()),k.GetObjNum()===e.objNum){(k=k.GetDict()).SetAtName(w,M),_.RemoveAt(P),_.RemoveAt(P);break}}}},PDFDoc.prototype.spawnPage=function(e,t,n,r,o){var i=t.name,a=this.doc.GetPageCount();(-1===n||n>a)&&(n=a);var s=new this.engine.WString(i);if(this.doc.SpawnPage(s,n,r,o)){var u=void 0,c=u=new _PDFPage2.default(n,this);u.page=this.doc.GetPage(n);var d=this.doc.GetPageCount()-1;return this.updatePageIndex(n+1,d,!0,!1),this.updatePageIndexMap(n,c),this.updatePageCache(u),u.toJson()}},PDFDoc.prototype.hasForm=function(){try{var e=this.engine,t=(0,_constantsString.CString)(e,"AcroForm"),n=(0,_constantsString.CString)(e,"Fields");return this.doc.GetCatalog().GetElement(t).GetDict().GetElement(n).GetDirectObject().GetArray().GetElementCount()>0}catch(e){return!1}},PDFDoc.prototype.reloadPageAnnots=function(e){var t=this;e.forEach((function(e){t.pageIndexMap[e]&&t.pageIndexMap[e].reloadAnnots()}))},PDFDoc.prototype.getFontBufferByName=function(e){for(var t=this.doc.GetFontCount(),n=0;n<t;n++){var r=this.doc.GetFont(n);if(r.GetName().toString()==e)return _PDFFontMgr2.default.getWoffDataBuffer(r.GetWoffData(this.doc),this.engine)}},PDFDoc.prototype.getStructureRoles=(_ref18=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,n,r,o,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((t=this.doc).IsTaggedPDF()){e.next=4;break}return e.abrupt("return");case 4:for(n=[],r=t.GetStructureRoles(),o=r.GetSize(),i=0;i<o;i++)a=r["operator[]"](i).toString(),n.push(a);return e.abrupt("return",n);case 9:case"end":return e.stop()}}),e,this)}))),function(){return _ref18.apply(this,arguments)}),PDFDoc.prototype.getPageSizes=function(e,t){var n={},r=this.engine,o=this.doc,i=r.ErrorCode.e_ErrDataNotReady;function a(e,t){var n=(0,_createDeferred2.default)(),s=void 0;try{s=o.GetPage(t).IsEmpty()?{width:_VirtualJRPDFPage.VIRTUAL_PAGE_WIDTH,height:_VirtualJRPDFPage.VIRTUAL_PAGE_HEIGHT,rotation:{value:0}}:o.GetPageBasicInfo(t)}catch(o){var u=r.getErrorCode(o);if(u!==r.ErrorCode.e_ErrUnknown)return u!==i?(n.reject(u.value),n.promise):(setTimeout((function(){a(e,t).then(n.resolve,n.reject)}),30),n.promise);s={width:_VirtualJRPDFPage.VIRTUAL_PAGE_WIDTH,height:_VirtualJRPDFPage.VIRTUAL_PAGE_HEIGHT,rotation:{value:0}}}return e[t]={width:s.width,height:s.height,rotation:s.rotation.value},n.resolve(),n.promise}for(var s=[],u=e;u<e+t;u++)s.push(a(n,u));return Promise.all(s).then((function(){return n}))},PDFDoc.prototype._generateRange=function(e,t,n){var r=void 0,o=0;return e.forEach((function(e){if(1===e.length){var i=e[0];(0,_assertion.isInteger)(i)||(i=0),i<0?i=0:i>n-1&&(i=n-1),o++,r?r.AddSingle(i):r=new t.Range(i)}else if(2===e.length){var a=e[0];(0,_assertion.isInteger)(a)||(a=0),a<0?a=0:a>n-1&&(a=n-1);var s=e[1];(0,_assertion.isInteger)(s)||(s=0),s<0?s=0:s>n-1&&(s=n-1),a>s&&(a=+s,a-=s=a-s),r?a===s?(o++,r.AddSingle(a)):(o+=s-a+1,r.AddSegment(a,s,0)):a===s?(o++,r=new t.Range(a)):(o+=s-a+1,r=new t.Range(a,s,0))}})),{ranges:r,addCount:o}},PDFDoc.prototype.copyPages=function(e,t){var n=this,r=this.engine,o=this.doc,i=o.GetPageCount();(0,_assertion.isInteger)(t)||(t=0);var a=this._generateRange(e,r,i),s=a.ranges,u=a.addCount,c=[],d=new r.String(""),l=o.StartImportPages(t,o,0,d,s);d.delete();for(var f=[],h=0;h<u;h++)f.push(t+h);return 100===l.GetRateOfProgress()&&f.map((function(e){var t=o.GetPage(e),r=t.GetIndex(),i=void 0,a=i=new _PDFPage2.default(r,n);i.page=t,n.updatePageIndex(r+1,o.GetPageCount()-1,!0,!1),n.updatePageIndexMap(r,a),n.updatePageCache(i),c.push(i.toJson())})),s&&s.delete(),c},PDFDoc.prototype.saveCopyPagesData=function(e){for(var t=this.engine,n=this.doc,r=n.GetPageCount(),o=0,i=[],a=t.WriterCallback.implement({Release:noop,Flush:function(){return!0},GetSize:function(){return o},WriteBlock:function(e,n,r){o+=r;var a=t.HEAPU8.buffer,s=void 0;return s=a.slice?a.slice(e,e+r):new Uint8Array(a,e,r).buffer,i.push(s),!0}}),s=this._generateRange(e,t,r),u=s.ranges,c=(s.addCount,t.ExtractPagesOptions.e_ExtractPagesOptionAnnotation.value|t.ExtractPagesOptions.e_ExtractPagesOptionOCProperties.value),d=n.StartExtractPages(a,c,u,null),l=-1;100!==l;){if(-1===(l=d.GetRateOfProgress()))return;d.Continue()}for(var f=new Uint8Array(o),h=0,p=0,m=i.length;p<m;p++){var g=i[p];f.set(new Uint8Array(g),h),h+=g.byteLength}f=f.slice(0),getDB().set("COPY_PAGES_BUFFERS",f)},PDFDoc.prototype.pastePages=(_ref19=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var n,r,o,i,a,s,u,c,d,l,f=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.engine,e.next=3,getDB().get("COPY_PAGES_BUFFERS");case 3:if((r=e.sent).byteLength,o=new PDFDoc(this.JR,{buffer:r}),i=new n.String(""),o.doc.Load(i)===n.ErrorCode.e_ErrSuccess){e.next=9;break}throw"pastePages fail: source doc load error";case 9:for(a=new n.String(""),s=new n.Range,u=o.doc.GetPageCount(),c=0;c<u;c++)s.AddSingle(c);if(this.doc.StartImportPages(t,o.doc,0,a,s).GetErrorCode()!==n.ErrorCode.e_ErrFormat){e.next=16;break}throw"format error";case 16:return d=this.doc.GetPageCount()-1,l=Array.from(Array(u).keys(),(function(e){var n=e+t,r=new _PDFPage2.default(n,f);return r.page=f.doc.GetPage(n),f.updatePageIndex(n+1,d,!0,!1),f.updatePageIndexMap(n,r),f.updatePageCache(r),r.toJson()})),e.abrupt("return",l);case 19:case"end":return e.stop()}}),e,this)}))),function(e){return _ref19.apply(this,arguments)}),PDFDoc.prototype._renderThumbnailToBitmap=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=this.engine;e.IsParsed()||e.StartParse(0,null,!1);var r=(0,_browser.getDPI)(),o=r.x,i=r.y,a=76.5*o/72+.5>>0,s=99*i/72+.5>>0,u=new n.Bitmap(a,s,n.DIBFormat.e_DIBArgb,0,0),c=new n.Renderer(u,!1);c.SetRenderContentFlags(t);var d=e.GetDisplayMatrix(0,0,a,s,{value:0}),l=c.StartRender(e,d,null);return l.Continue(),c.delete(),u},PDFDoc.prototype._calcStep=function(e){var t=10;return e>1e3?t=e/100:e>100&&(t=e/10),t},PDFDoc.prototype.embedAllPageThumbnail=regeneratorRuntime.mark((function e(){var t,n,r,o,i,a,s,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._embedCancel=!1,t=this.doc,n=t.GetPageCount(),r=t.GetPage(0).LoadThumbnail(),o=r.IsEmpty(),i=this._calcStep(n),a=0,s=0;case 8:if(!(s<n)){e.next=22;break}if(!this._embedCancel){e.next=11;break}throw{msg:"cancel",status:o};case 11:if(u=t.GetPage(s),c=this._renderThumbnailToBitmap(u),u.SetThumbnail(c),c.delete(),!(a<=s+1||n===s+1)){e.next=19;break}return a+=i,e.next=19,(s+1)/n;case 19:s++,e.next=8;break;case 22:return e.abrupt("return",o);case 23:case"end":return e.stop()}}),e,this)})),PDFDoc.prototype.removeEmbeddedPageThumbnail=regeneratorRuntime.mark((function e(){var t,n,r,o,i,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._removeEmbeddedCancel=!1,t=this.doc,n=t.GetPageCount(),r=t.GetPage(0).LoadThumbnail(),o=r.IsEmpty(),i=this._calcStep(n),a=0,s=0;case 8:if(!(s<n)){e.next=20;break}if(!this._removeEmbeddedCancel){e.next=11;break}throw{msg:"cancel",status:!o};case 11:if(t.GetPage(s).RemoveThumbnail(),!(a<=s+1||n===s+1)){e.next=17;break}return a+=i,e.next=17,(s+1)/n;case 17:s++,e.next=8;break;case 20:return e.abrupt("return",!o);case 21:case"end":return e.stop()}}),e,this)})),PDFDoc.prototype.cancelEmbedAllPageThumbnail=function(){this._embedCancel=!0},PDFDoc.prototype.cancelRemoveEmbeddedPageThumbnail=function(){this._removeEmbeddedCancel=!0},PDFDoc.prototype._isFullPage=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,n=t.doc.GetPageCount();return e.length===n&&[].concat(_toConsumableArray(Array(n).keys())).every((function(t){return t===e[t]}))},PDFDoc.prototype.importPagesFromPDFDocs=(_ref20=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var n,r,o,i,a,s,u,c=this,d=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.engine,r=new n.String(l),o=d.reverse().reduce((function(e,o){var i=e.successfulCount,a=e.errs,s=o.srcDoc,u=o.srcPages,d=(s.oriFile?s.oriFile.name:void 0)||"temp.pdf",f=new n.Range,h=s.doc.GetPageCount();u.sort((function(e,t){return e>t?1:-1})),new Set(u).size!==h&&u.forEach((function(e){return f.AddSingle(e)}));var p=new n.LayerTree(s.doc),m=p.GetRootNode(),g=m.GetChildrenCount()>0;m.delete(),p.delete();for(var y=g&&l?n.ImportPageFlags.e_ImportFlagWithLayers.value:0,_=c.doc.StartImportPages(t,s.doc,y,r,f),v=-1;v<100;){if(-1===(v=_.GetRateOfProgress()))return{successfulCount:i,errs:[].concat(_toConsumableArray(a),[{name:d,err:"rate of progress is -1"}])};_.Continue()}return{successfulCount:i+u.length,errs:a}}),{successfulCount:0,errs:[]}),i=o.successfulCount,a=o.errs,r.delete(),s=Array.from(Array(i).keys()).map((function(e){return e+t})).map((function(e){var t=c.doc.GetPage(e),n=t.GetIndex(),r=new _PDFPage2.default(n,c);return r.page=t,c.updatePageIndex(n+1,c.doc.GetPageCount()-1,!0,!1),c.updatePageIndexMap(n,r),c.updatePageCache(r),r.toJson()})),e.next=7,this.getBookmarks();case 7:return u=e.sent,e.abrupt("return",{bookmarks:u,pagesJson:s,errs:a});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return _ref20.apply(this,arguments)}),PDFDoc.prototype.exportPagesToPDFDocs=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=this.engine,a=new i.String(r),s=new i.WString(o),u=this._isFullPage(e),c=null;u||(c=new i.Range,e.forEach((function(e){return c.AddSingle(e)})));var d=t.reverse().map((function(e){var t=e.destDoc,r=e.destIndex,o=t.oriFile?t.oriFile.name:"temp.pdf";if(u)try{return t.doc.InsertDocument(r,n.doc,i.InsertDocOptions.e_InsertDocOptionAttachments.value|i.InsertDocOptions.e_InsertDocOptionBookmark.value,s),{name:o,doc:t}}catch(e){return{name:o,err:e}}for(var d=t.doc.StartImportPages(r,n.doc,0,a,c),l=-1;l<100;){if(-1===(l=d.GetRateOfProgress()))return{name:o,err:"rate of progress is -1"};d.Continue()}return{name:o,doc:t}}));return a.delete(),s.delete(),d},PDFDoc.prototype.startImportPages=function(e,t){var n=t.size,r=t.getBuffer,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_consts.EMPTY_STR,i=arguments[3],a=arguments[4],s=this,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments[6],d=this.engine,l=d.ReaderCallback.implement({Release:function(){release()},GetSize:function(){return n},ReadBlock:function(e,t,n){var o=new Uint8Array(r(t,n));return d.HEAPU8.set(o,e),!0}}),f=d.createPDFDocWithReaderCallback(l,!1),h=new d.String(o);f.Load(h);var p=f.GetPageCount(),m=p-1,g=this.doc.GetPageCount();(u=Math.min(m,u))<0&&(u=(u+p)%p),(c=Math.min(m,c))<0&&(c=(c+p)%p);var y=Math.min(u,c),_=Math.max(u,c),v=new d.String(a),b=new d.Range(y,_,0);e<0&&(e=e%g+g),e=Math.max(0,Math.min(g,e));for(var S=this.doc.StartImportPages(e,f,i,v,b),w=[],M=0;M<=_-y;M++)w.push(e+M);var D=[];return 100===S.GetRateOfProgress()&&w.map((function(e){var t=s.doc.GetPage(e),n=t.GetIndex(),r=void 0,o=r=new _PDFPage2.default(n,s);r.page=t,s.updatePageIndex(n+1,s.doc.GetPageCount()-1,!0,!1),s.updatePageIndexMap(n,o),s.updatePageCache(r),D.push(r.toJson())})),D},PDFDoc.prototype.extractPages=function(e,t,n){var r=t.writeStream,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:_consts.EMPTY_STR,i=this.engine,a=new i.PDFDoc,s=new i.String("");a.Load(s);var u=this.doc,c=void 0;n&&(c=i.ReaderCallback.implement({Release:function(){release()},GetSize:function(){return n.size},ReadBlock:function(e,t,r){var o=new Uint8Array(n.getBuffer(t,r));return i.HEAPU8.set(o,e),!0}}),u=i.createPDFDocWithReaderCallback(c,!1),s=new i.String(o||""),u.Load(s));var d=u.GetPageCount(),l=new i.String("");e.reverse().forEach((function(e){if(1===e.length){if(e[0]>=d||isNaN(e[0]))return;e[0]<0&&(e[0]=e[0]%d+d);var t=new i.Range((e[0]+d)%d);a.StartImportPages(0,u,0,l,t)}else if(2===e.length){if(isNaN(e[0])||isNaN(e[1]))return;var n=Math.min(e[0],e[1]),r=Math.max(e[0],e[1]);if(n<0&&(n=n%d+d),r<0&&(r=r%d+d),n>=d)return;r=Math.min(r,d-1);var o=new i.Range((n+d)%d,(r+d)%d,0);a.StartImportPages(0,u,0,l,o)}}));var f=0,h=(0,_createDeferred2.default)();return a.GetPageCount()>0?i.saveDoc(a,i.WriterCallback.implement({Release:function(){},Flush:function(){return h.resolve(f),!0},GetSize:function(){return f},WriteBlock:function(e,t,n){f+=n;var o=i.HEAPU8.buffer,a=void 0;return a=o.slice?o.slice(e,e+n):new Uint8Array(o,e,n).buffer,r(a,t,n),!0}}),i.SaveFlags.e_SaveFlagNormal.value):h.reject(new Error("Cannot extract pages on none page document")),h.promise},PDFDoc.prototype.getHeaderFooter=function(e){var t=this;e||(e=(0,_createDeferred2.default)());try{if(!this.doc.HasHeaderFooter())return e.resolve(null);var n=this.doc.GetEditableHeaderFooter(),r=n.page_range,o={start:r.start_number,end:r.end_number,filter:r.filter.value},i=n.content,a={TopLeft:i.header_left_content.toString(),TopCenter:i.header_center_content.toString(),TopRight:i.header_right_content.toString(),BottomLeft:i.footer_left_content.toString(),BottomCenter:i.footer_center_content.toString(),BottomRight:i.footer_right_content.toString()},s=n.page_margin;e.resolve({font:this.JR.getPDFString(n.font.GetBaseFontName(this.doc)),textSize:n.text_size,textColor:n.text_color,hasTextShrinked:n.has_text_shrinked,hasFixedSized:n.has_fixedsize_for_print,ranges:o,margin:{left:s.left,right:s.right,top:s.top,bottom:s.bottom},startPageNumber:n.start_page_number,contents:a,contentFormats:{},underline:n.is_underline})}catch(n){isNaN(n)||(n=this.engine.getErrorCode(n)),n.value&&17==n.value?setTimeout((function(){t.getHeaderFooter(e)}),200):e.reject(n)}return e.promise},PDFDoc.prototype.addHeaderFooter=function(e,t){var n=this,r=this.doc;t||(t=(0,_createDeferred2.default)());try{var o=(0,_headerFooter2.default)(this.engine,r,e);r.AddHeaderFooter(o),o.delete(),this.getHeaderFooter(t)}catch(r){isNaN(r)||17!=this.engine.getErrorCode(r).value?t.reject(r):setTimeout((function(){n.addHeaderFooter(e,t)}),200)}return t.promise},PDFDoc.prototype.updateHeaderFooter=function(e,t){var n=this,r=this.doc;t||(t=(0,_createDeferred2.default)());try{var o=(0,_headerFooter2.default)(this.engine,r,e);r.UpdateHeaderFooter(o),this.getHeaderFooter(t)}catch(r){if("number"==typeof r){var i=this.engine.getErrorCode(r).value;if("number"==typeof i&&17==i)return void setTimeout((function(){n.updateHeaderFooter(e,t)}),200)}t.reject(r)}return t.promise},PDFDoc.prototype.removeHeaderFooter=function(e){var t=this;e||(e=(0,_createDeferred2.default)());try{this.doc.RemoveAllHeaderFooters(),e.resolve()}catch(n){if(17!=this.engine.getErrorCode(n).value)throw n;setTimeout((function(){t.removeHeaderFooter(e)}),200)}return e.promise},PDFDoc.prototype.getAnnotsRawData=function(e){var t=this;try{var n=this.engine,r=[];for(var o in e){var i=e[o];r.push(this.getPageByIndex(i.page))}return Promise.all(r).then((function(n){var r=[];for(var o in e){var i=e[o],a=i.page=t.pageIndexMap[i.page];i.iterator=r.length,r.push(a.getAnnotById(i.index))}return Promise.all(r)})).then((function(t){var r=[];for(var o in e){var i=t[e[o].iterator].annot,a=i.GetDict(),s={};switch(i.GetType().value){case 13:var u=a.GetElement((0,_constantsString.CString)(n,"AP"));u&&(s.N=retriveDict(n,s,"",u.GetDirectObject().GetDict().GetElement((0,_constantsString.CString)(n,"N")).GetDirectObject()));break;case 17:var c=a.GetElement((0,_constantsString.CString)(n,"FS"));c&&(s.FS=retriveDict(n,s,"",c.GetDirectObject()));break;case 18:var d=a.GetElement((0,_constantsString.CString)(n,"Sound"));d&&(s.Sound=retriveDict(n,s,"",d.GetDirectObject()))}r.push({index:o,raw:s})}return r}))}catch(e){throw console.error(engine.getErrorCode(e)),new Error(e)}},PDFDoc.prototype.sign=function(e){var t=this,n=this.engine,r=n.KeyName,o=void 0,i=!1,a=Promise.resolve();if(e.fieldName){var s=(o=this.loadForm().getField(e.fieldName).engineField).GetControl(0).GetWidget().GetPage().GetIndex();a=this.getPageByIndex(s)}return a.then((function(a){var s=e.flag||256;if(!o){var u=t.doc.GetPage(e.pageIndex),c=new n.WString(e.fieldName),d=e.rect;o=u.AddSignature(new n.CFX_FloatRect(d.left,d.bottom,d.right,d.top),c,{value:0},!0),i=!0}e.signer&&o.SetKeyValue(r.e_KeyNameSigner,new n.WString(e.signer)),e.reason&&o.SetKeyValue(r.e_KeyNameReason,new n.WString(e.reason)),e.distinguishName&&o.SetKeyValue(r.e_KeyNameDN,new n.WString(e.distinguishName)),e.location&&o.SetKeyValue(r.e_KeyNameLocation,new n.WString(e.location));var l=e.text||e.signer;l&&256&s&&o.SetKeyValue(r.e_KeyNameText,new n.WString(l));var f=new Date,h=new n.DateTime(f.getFullYear(),f.getMonth()+1,f.getDate(),f.getHours(),f.getMinutes(),f.getSeconds(),f.getMilliseconds(),-f.getTimezoneOffset()/60,0);o.SetSignTime(h);var p;if((p=e.inkSign)&&128&s){var m=t.JR.createReaderCallback(p),g=new n.Image(m).GetFrameBitmap(0);o.SetBitmap(g)}o.SetAppearanceFlags(s),o.SetFilter(new n.String(e.filter)),o.SetSubFilter(new n.String(e.subfilter)),e.docPermission&&o.SetDocPermission({value:e.docPermission}),e.defaultContentsLength&&o.SetDefaultContentsLength(e.defaultContentsLength);var y=(0,_callback.startSign)(t.engine,o,e.hashAlgorithm,e.filter,e.subfilter);if(i)return t.getPageByIndex(e.pageIndex).then((function(e){return e.reloadAnnots()})).then((function(e){return(0,_callback.getSignedFile)(y)}));var _=(0,_callback.getSignedFile)(y);return Promise.resolve(_)}))},PDFDoc.prototype.attachFile=function(e){},PDFDoc.prototype.getFontsInfo=function(){for(var e=this.doc,t=[],n=0,r=e.GetFontCount();n<r;n++){var o=e.GetFont(n),i=o.GetFontType(e).value;t.push({isEmbedded:o.IsEmbedded(e),isBold:o.IsBold(),isItalic:o.IsItalic(),baseFontName:this.JR.getPDFString(o.GetBaseFontName(e)),fontType:1===i?"Type1":2===i?"TrueType":3===i?"Type3":4===i?"TrueType(CID)":"",name:this.JR.getPDFString(o.GetName()),familyName:this.JR.getPDFString(o.GetFamilyName()),index:n,docId:this.id,encodingType:o.getEncodingType(e).toString(),actualFontName:o.getActualFontName(e).toString(),actualFontStyle:o.getActualFontStyle(e).toString()})}return t},PDFDoc.prototype.getAdditionalActions=function(){var e=this.engine,t=this.doc.GetCatalog().GetElement((0,_constantsString.CString)(e,"AA")),n={};if(!t)return n;for(var r=new e.AdditionalAction(this.doc,t.GetDict()),o=e.TriggerEvent,i=2;i<7;i++){var a=r.GetAction(o.values[i]);a.IsEmpty()||(n[i]=this.JR.actionManager.get(a,this,this.JR).toJson())}return(0,_objectsDelete2.default)(r),n},PDFDoc.prototype.syncDataCache=function(e){var t=[];for(var n in e)t.push(this.getPageByIndex(e[n],n));return Promise.all(t)},PDFDoc.prototype.setColors=function(e){Object.assign(this.colors,e)},PDFDoc.prototype.setPageDisplayPreferences=function(e){this.pageDisplayPreferences=e},PDFDoc.prototype.setOriginalStream=function(e){this.oriFile=e},PDFDoc.prototype.getOriginalStream=function(){var e=(0,_createDeferred2.default)();if("string"==typeof this.oriFile.url){var t=this.oriFile,n=new XMLHttpRequest;if(n.open(t.type||"GET",t.url,!0,t.user,t.password),n.responseType="arraybuffer",t.headers){var r=t.headers;for(var o in r)n.setRequestHeader(o,r[o])}n.onreadystatechange=function(){4===n.readyState&&(n.status>=200&&n.status<300||304===n.status?e.resolve(n.response):e.reject(n))},n.send(t.data)}else if(this.oriFile instanceof Blob){var i=new FileReaderSync;e.resolve(new Uint8Array(i.readAsArrayBuffer(this.oriFile)))}else e.resolve(new Uint8Array(this.oriFile).slice(0).buffer);return e.promise},PDFDoc.prototype.moveAnnotsToPage=function(e,t,n){var r=this;return Promise.all([this.getPageById(e),this.getPageById(t)]).then((function(e){var t=_slicedToArray(e,2),o=t[0],i=t[1];return i.isVirtual?[]:Promise.all([o.parsedPage(),i.parsedPage()]).then((function(e){var t=_slicedToArray(e,2),a=t[0],s=t[1],u=r.engine,c=a.GetRotation().value,d=s.GetRotation().value-c,l=getAnnotsArray(u,a),f=getAnnotsArray(u,s),h={},p=function(e){var t=o._getAnnotIndexById(Number(e)),i=a.GetAnnot(t),s=n[e].rect,c=i.GetDict(),l=c.GetObjNum();Object.keys(s).length&&function(){var e=new u.CFX_FloatRect(s.left,s.bottom,s.right,s.top),t=i.GetRect(),n=t.Width()/2,r=t.Height()/2,o=new u.Matrix;o.Translate(-t.left-n,-t.bottom-r,!1),o.Rotate(-d*Math.PI/2,!1),o.Translate(t.left+n,t.bottom+r,!1),o.SetReverse(o);var a=i.GetRect();o.TransformRect(a),e.right=e.left+a.Width(),e.top=e.bottom+a.Height();var l=i.GetType().value,f=s.left-a.left,h=s.bottom-a.bottom;switch(l){case 3:var p,m=(360+90*d)%360,g=(0,_constantsString.CString)(u,"Rotate"),y=c.GetElement(g);p=y?y.GetInteger():0,c.SetAt(g,u.PDFObject.CreateFromInteger((p+m)%360));var _=new u.FreeText(i);if("FreeTextCallout"==_.GetIntent().toString()){for(var v=_.GetCalloutLinePoints(),b=0,S=v.GetSize();b<S;b++){var w=v.GetAt(b);(w=o.TransformPoint(w.x,w.y)).x+=f,w.y+=h,v.SetAt(b,w)}_.SetCalloutLinePoints(v);var M=_.GetInnerRect();o.TransformRect(M),M.left+=f,M.right+=f,M.top+=h,M.bottom+=h;var D=new u.CFX_FloatRect(M.left-e.left,M.bottom-e.bottom,e.right-M.right,e.top-M.top);c.SetAtRect((0,_constantsString.CString)(u,"RD"),D),c.SetAtRect((0,_constantsString.CString)(u,"Rect"),e),i.ResetAppearanceStream()}break;case 4:var P=new u.Line(i),T=P.GetStartPoint();(T=o.TransformPoint(T.x,T.y)).x+=f,T.y+=h,P.SetStartPoint(T);var k=P.GetEndPoint();(k=o.TransformPoint(k.x,k.y)).x+=f,k.y+=h,P.SetEndPoint(k);break;case 7:case 8:[u.PolyLine,u.Polygon].find((function(e,t){if(7==l&&0==t)return!1;for(var n=new e(i),r=n.GetVertexes(),a=0,s=r.GetSize();a<s;a++){var u=r.GetAt(a);(u=o.TransformPoint(u.x,u.y)).x+=f,u.y+=h,r.SetAt(a,u)}return n.SetVertexes(r),!0}));break;case 10:case 11:case 12:for(var A=new u.TextMarkup(i),L=A.GetQuadPoints(),F=new u.QuadPointsArray,I=function(e,t){var n=L.GetAt(e),r=new u.QuadPoints;[n.first,n.second,n.third,n.fourth].forEach((function(e,t){var n=o.TransformPoint(e.x,e.y);switch(n.x+=f,n.y+=h,t){case 0:r.first=n;break;case 1:r.second=n;break;case 2:r.third=n;break;case 3:r.fourth=n}})),F.Add(r)},x=0,C=L.GetSize();x<C;x++)I(x);A.SetQuadPoints(F);break;case 15:for(var R=new u.Ink(i),O=R.GetInkList(),G=O.GetPointCount(),E=0;E<G;E++){var Y=O.GetPoint(E),j=o.TransformPoint(Y.x,Y.y);j.x+=f,j.y+=h;var N=O.GetPointType(E);O.SetPoint(E,j,N)}R.SetInkList(O);break;case 13:var B,H=(360+90*d)%360,W=(0,_constantsString.CString)(u,"Rotate"),U=c.GetElement(W);B=U?U.GetInteger():0,new u.Stamp(i).SetRotation(((-B-H)%360+360)%360);break;case 17:var z=i.GetFlags();i.SetFlags(24|z);break;case 20:var J=(4+d)%4,V=new u.Widget(i),K=V.GetMKRotation().value;4===K&&(K=0);var q=4-((-K-J)%4+4)%4,Z=u.Rotation.e_Rotation0;switch(q){case 1:Z=u.Rotation.e_Rotation90;break;case 2:Z=u.Rotation.e_Rotation180;break;case 3:Z=u.Rotation.e_Rotation270}V.SetMKRotation(Z)}26!==l&&c.SetAtRect((0,_constantsString.CString)(u,"Rect"),e),i.ResetAppearanceStream()}(),c.RemoveAt((0,_constantsString.CString)(u,"P")),f.AddElement(u.PDFObject.CreateReference(r.doc,l)),h[l]=e};for(var m in n)p(m);for(var g in h)for(var y=l.GetElementCount(),_=0;_<y;_++){var v=l.GetElement(_).GetDirectObject().GetDict(),b=v.GetObjNum();if(h[b]){l.RemoveAt(_);break}var S=v.GetElement((0,_constantsString.CString)(u,"NM")),w=S&&S.GetString().toString();if(h[b]==w&&S){l.RemoveAt(_);break}}return o.page.UpdateAnnotList(),i.page.UpdateAnnotList(),o.reloadAnnots(),i.reloadAnnots(),i.getAnnots(null,h)}))}))},PDFDoc.prototype.setTabOrder=function(e,t){var n=this,r=Object.freeze({none:"e_None",row:"e_Row",column:"e_Column",structure:"e_Structure"});return this.getPageByIndex(e).then((function(e){if(e.isVirtual)return[];var o=n.engine.OrderType[r[t]||r.none],i=new n.engine.TabOrderMgr(e.page);i.SetOrderType(o),i.Reload();e.page.GetAnnotCount();for(var a=i.GetFirstAnnot(),s=[];!a.IsEmpty();)s.push(a.GetDict().GetObjNum()),a=i.GetNextAnnot(a);return s}))},PDFDoc.prototype.getTabOrder=function(e){var t=this,n=this.engine;return this.getPageByIndex(e).then((function(e){if(e.isVirtual)return"e_None";var r=new t.engine.TabOrderMgr(e.page).GetOrderType();switch(r){case n.OrderType.e_Row:r="e_Row";break;case n.OrderType.e_Column:r="e_Column";break;case n.OrderType.e_Structure:r="e_Structure";break;default:r="e_None"}return r}))},PDFDoc.prototype.setStructureOrder=function(e,t){var n=this,r=this.engine;return this.getPageByIndex(e).then((function(e){return e.isVirtual?[]:e.getAnnots(t).then((function(t){var o=new n.engine.TabOrderMgr(e.page),i=new r.AnnotArray;return t.forEach((function(e){i.Add(e.annot)})),o.AdjustStructureOrder(i),e.reloadAnnots()}))}))},PDFDoc.prototype.renderTemplatesByObjNum=function(e){var t=this.engine,n=this.doc.GetTemplateSize(e),r=new t.Bitmap(n.x,n.y,t.DIBFormat.e_DIBRgb32,0,0);r.FillRect(4294967295,null);var o=(0,_RendererHelper.createBitmapRender)(t,r);return o.RenderTemplates(this.doc,e,r),(0,_RendererHelper.getBitmapBuffer)(t,r,o)},PDFDoc.prototype.getPageIndexByObjNum=function(e){return this.doc.GetPageIndex(e)},PDFDoc.prototype.getNameTree=function(e){for(var t={value:e},n=this.doc,r=this.engine,o={},i=new r.PDFNameTree(n,t),a=0,s=i.GetCount();a<s;a++){var u=i.GetName(a),c=i.GetObj(u);if(c){var d=u.toString();if(t.value===r.PDFNameTreeType.e_JavaScript.value){var l=new r.Action(n,c.GetDict());if(l.IsEmpty())continue;var f=new r.JavaScriptAction(l),h=f.GetScript();o[d]=h.toString(),l=null,f=null,h=null}else if(4===t.value||5===t.value){var p=c.GetDict().GetObjNum();o[d]=p,p=null}else if(t.value===r.PDFNameTreeType.e_EmbeddedFiles.value){var m=new r.FileSpec(n,c),g=new _FileSpec2.default(m,this);o[d]=g.toJson(),g=null}u.delete(),u=null}}return o},PDFDoc.prototype.addNameTreeObj=function(e,t,n){var r=this.engine,o=this.doc,i=new r.PDFNameTree(o,{value:e}),a=new r.WString(t),s=o.GetIndirectObject(n).GetDirectObject(),u=i.Add(a,s);return a.delete(),a=null,u},PDFDoc.prototype.removeNameTreeObj=function(e,t){var n=this.engine,r=this.doc,o=new n.PDFNameTree(r,{value:e}),i=new n.WString(t),a=o.RemoveObj(i);return i.delete(),i=null,a},PDFDoc.prototype.replaceNameTreeObj=function(e,t,n){var r=this.engine,o=this.doc,i=new r.PDFNameTree(o,{value:e}),a=new r.WString(t),s=o.GetIndirectObject(n).GetDirectObject(),u=i.SetObj(a,s);return a.delete(),a=null,u},PDFDoc.prototype.renameNameTreeObj=function(e,t,n){var r=this.engine,o=this.doc,i=new r.PDFNameTree(o,{value:e}),a=new r.WString(t),s=new r.WString(n),u=i.Rename(a,s);return a.delete(),a=null,s.delete(),s=null,u},PDFDoc.prototype.nameTreeTemplatesToPages=function(e){var t=this.engine,n=this.doc,r=new t.WString(e),o=n.InsertPageFromTemplate(r);return r.delete(),r=null,o},PDFDoc.prototype.nameTreePagesToTemplates=function(e){var t=this.engine,n=this.doc,r=new t.WString(e);return n.RemovePageFromTemplate(r),r.delete(),r=null,!0},PDFDoc.prototype.addFileSpec=function(e,t,n){var r=this.engine,o=this.doc,i=_FileSpec2.default.createFile(r,o,t),a=new r.WString(e);return i.SetFileName(a),a.delete(),a=null,i.SetModifiedDateTime(_Annot2.default.ToDateTime(r,n)),i.GetDict().GetObjNum()},PDFDoc.prototype.setFileSpecDesc=function(e,t){var n=this.engine,r=this.doc,o=new n.FileSpec(r,r.GetIndirectObject(t));if(!o.IsEmpty()){var i=new n.String(e);o.SetDescription(i),i.delete(),i=null}return!0},PDFDoc.prototype.getArticle=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return!e&&this.article||(this.article=new _PDFArticle2.default(this)),this.article},PDFDoc.prototype.getFileSpecStream=function(e,t){var n=this.engine,r=this.doc,o=new n.FileSpec(r,r.GetIndirectObject(e));if(o.IsEmpty())return Promise.reject();var i=new _FileSpec2.default(o,this),a=i.getStream(t);return i=null,a},PDFDoc.prototype.getFormControlPage=function(e){for(var t=this,n=[],r=0;r<this.doc.GetPageCount();r++)n.push(this.getPageByIndex(r));return Promise.all(n).then((function(n){for(var r=0;r<n.length;r++){var o=t.pageIndexMap[r].page.GetDict().GetElement((0,_constantsString.CString)(t.engine,"Annots"));if(o&&(o=o.GetDirectObject()))for(var i=o.GetArray(),a=0;a<i.GetElementCount();a++){var s=i.GetElement(a);if(s&&((s=s.GetDirectObject())&&s.GetDict().GetObjNum()==e))return r}}}))},PDFDoc.prototype.getPDFDictInfo=function(){var e=this.dictionaryMap[this.id];if(e)return e.toJson();var t=this;return this.docPromise.then((function(e){var n=e.GetInfo(),r=new _PDFDictionary2.default(t);return t.updateDictCache(n,r),t.updateDictMap(t.id,r),r.toJson()}))},PDFDoc.prototype.getPageLabels=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=this,r=this.engine,o=this.docPromise.then((function(e){return e.GetPageCount()})).then((function(n){return Promise.all(t.map((function(r){if(r>0&&r<n)return e.getPageByIndex(r).then((function(e){if(e.isVirtual){var n=t.indexOf(r);t.split(n,1)}}))})))}));return o.then((function(){return e.docPromise})).then((function(e){n.pageLabels=n.pageLabels||new r.PageLabels(e);var o=[],i=e.GetPageCount();if(!t||!t.length){for(var a=0;a<i;a++){var s=n.pageLabels.GetPageLabelTitle(a);o.push(s.toString())}return o}return t.forEach((function(e){if(e<0||e>=i)o.push("");else{var t=n.pageLabels.GetPageLabelTitle(e);o.push(t.toString())}})),o}))},PDFDoc.prototype.startFormDesignerAssit=function(){for(var e in this.isDesignerMode=!0,this.pageCache){this.pageCache[e].resetBitmapCache()}},PDFDoc.prototype.stopFormDesignerAssit=function(){for(var e in this.isDesignerMode=!1,this.pageCache){this.pageCache[e].resetBitmapCache()}},PDFDoc.prototype.updateDictCache=function(e,t){var n=t.id;this.dictionaryCache[n]=e},PDFDoc.prototype.updateDictMap=function(e,t){this.dictionaryMap[e]=t},PDFDoc.prototype.hasKey=function(e,t){var n=this.dictionaryCache[e];if(!n)return!1;var r=(0,_constantsString.CString)(this.engine,t);return n.HasKey(r)},PDFDoc.prototype.setAt=function(e,t,n){var r=this.dictionaryCache[e],o=this.engine,i=(0,_constantsString.CString)(o,t);switch(void 0===n?"undefined":_typeof(n)){case"string":return r.SetAtString(i,(0,_constantsString.CString)(o,n)),!0;case"number":return n%1==0?(r.SetAtInteger(i,n),!0):!isNaN(n)&&(r.SetAtFloat(i,n),!0);case"boolean":return r.SetAtBoolean(i,n),!0}return!1},PDFDoc.prototype.getAt=function(e,t){var n=this.dictionaryCache[e],r=this.engine;try{var o=(0,_constantsString.CString)(r,t),i=n.GetElement(o);switch(i.GetType().value){case 1:return i.GetBoolean();case 2:return i.GetFloat();case 3:return i.GetString().toString()}}catch(e){throw new Error("The specified key does not exist in the dictionary or the value type is unaccepted")}},PDFDoc.prototype.autoRecognitionForm=function(){var e=this.doc.AutoRecognitionForm(!1),t=[];return this.getAllLoadedPages().forEach((function(e){t.push(e.index)})),this.reloadPageAnnots(t),e},PDFDoc.prototype.isStaticXFA=function(){return this.doc.IsStaticXFA()},PDFDoc.prototype.isXFA=function(){return this.doc.IsXFA()},PDFDoc.prototype.removeXFA=function(){return this.doc.RemoveXFA()},PDFDoc.prototype.reversePages=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=this.engine;return this.docPromise.then((function(r){if(!Array.isArray(t))return[];if(t.length<2)return[];if(!t.every((function(e){return"number"==typeof e})))return[];for(var o=function(e,t,n,r){var o=new t.Range;return o.AddSingle(n),e.MovePagesTo(o,r)},i=0,a=t.length-1;i<a;i++,a--){var s=o(r,n,i,a);if(s&&(s=o(r,n,a-1,i)),s){var u=e.pageIndexMap[i],c=function(t,n){var r=void 0;return t instanceof _PDFPage2.default&&(t.index=n,r=t.id),e.pageIndexMap[n]=t,r};c(e.pageIndexMap[a],i),c(u,a)}}return t}))},PDFDoc.prototype.movePagesTo=function(e,t){var n=this,r=this.engine,o=new r.Range;return e.forEach((function(e){"object"!==(void 0===e?"undefined":_typeof(e))?o.AddSingle(e):1===e.length?o.AddSingle(e[0]):2===e.length&&o.AddSegment(e[0],e[1],r.RangeFilter.e_All)})),this.docPromise.then((function(r){var i=r.GetPageCount(),a=t;e[0]<t&&(a=t-1),a<0&&(a=0),a>=i&&(a=i-1);var s=r.MovePagesTo(o,a);if(!s)return s;Math.max.apply(Math,_toConsumableArray(e).concat([t]));for(var u=Object.values(n.pageIndexMap),c=0;c<i;c++)u[c]||(u[c]={});var d=void 0;return e.map((function(e){return u[e]})).forEach((function(e,n){var r=u.indexOf(e);if(u.splice(r,1),0===n)r<t?u.splice(t-1,0,e):u.splice(t,0,e);else{var o=u.indexOf(d);u.splice(o+1,0,e)}d=e})),s=[],u.forEach((function(e,t){var r=void 0;e instanceof _PDFPage2.default?(e.index=t,r=e.id):e=null,s.push(r),n.pageIndexMap[t]=e})),s}))},PDFDoc.prototype.startReplacePages=function(e,t,n,r){var o=this,i=this.engine,a=new i.Range,s=this.doc;s.GetPageCount();r.forEach((function(e){"object"!==(void 0===e?"undefined":_typeof(e))?a.AddSingle(e):1===e.length?a.AddSingle(e[0]):2===e.length&&a.AddSegment(e[0],e[1],i.RangeFilter.e_All)}));var u=[],c=(0,_createDeferred2.default)(),d=0,l="",f=i.StreamCallback.implement({Release:function(){},Flush:function(){return c.resolve(d),!0},GetSize:function(){return d},WriteBlock:function(e,t,n){d+=n;var r=i.HEAPU8.buffer,o=void 0;return o=r.slice?r.slice(e,e+n):new Uint8Array(r,e,n).buffer,u.push(o),!0},ReadBlock:function(e,t,n){var r=(new FileReaderSync).readAsArrayBuffer(new Blob(u).slice(t,t+n));return r=new Uint8Array(r),i.HEAPU8.set(r,e),!0}}),h=i.PauseCallback.implement({NeedToPauseNow:function(){return!1}});try{s.StartReplacePages(e,t,n.doc,a,f,h)}catch(e){l=e}if(l)return{error:l};for(var p=r.length,m=0;m<t;m++){var g=m+e;if(this.pageIndexMap[g]){var y=this.pageIndexMap[g];delete this.pageIndexMap[g],delete this.pageIndexPromise[g],delete this.pageCache[y.id]}}t!==p&&Object.keys(this.pageIndexMap).reverse().map((function(n,r){+n>=e+t-1&&(o.pageIndexMap[+n+p-t]=o.pageIndexMap[+n],o.pageIndexMap[+n+p-t].index=+n+p-t,delete o.pageIndexMap[+n])}));var _=new Array(p).fill(0).map((function(t,n){return e+n})).map((function(e){var t=s.GetPage(e),n=t.GetIndex(),r=new _PDFPage2.default(n,o);return r.page=t,o.updatePageIndexMap(n,r),o.updatePageCache(r),r.toJson()}));return a&&a.delete(),_},PDFDoc.prototype.setPageTransition=function(e,t,n,r){var o=this.JR.engine,i=new o.PDFDictionary.Create,a=new o.String("S"),s=new o.String(e);if(i.SetAtName(a,s),"Split"===e){var u=new o.String("Dm"),c=new o.String("M"),d=new o.String("H"),l=new o.String("V"),f=new o.String("I"),h=new o.String("O");"Horizontal Inward"===t?(i.SetAtName(u,d),i.SetAtName(c,f)):"Horizontal Outward"==t?(i.SetAtName(u,d),i.SetAtName(c,h)):"Vertical Inward"==t?(i.SetAtName(u,l),i.SetAtName(c,f)):(i.SetAtName(u,l),i.SetAtName(c,h)),u.delete(),c.delete(),d.delete(),l.delete(),f.delete(),h.delete()}else if("Blinds"===e){var p=new o.String("Dm"),m=new o.String("H"),g=new o.String("V");"Horizontal"===t?i.SetAtName(p,m):i.SetAtName(p,g),p.delete(),m.delete(),g.delete()}else if("Box"==e){var y=new o.String("M"),_=new o.String("I"),v=new o.String("O");"Inward"===t?i.SetAtName(y,_):i.SetAtName(y,v),y.delete(),_.delete(),v.delete()}else if("Wipe"===e||"Glitter"===e||"Cover"===e||"Uncover"===e){var b=new o.String("Di"),S=0;S="Right"===t?0:"Right Up"===t?1:"Up"===t?2:"Left Up"===t?3:"Left"===t?4:"Left Down"===t?5:"Down"===t?6:7,i.SetAtInteger(b,45*S),b.delete()}else if("Push"==e){var w=new o.String("Di"),M=0;M="Right"===t?0:"Up"===t?1:"Left"===t?2:3,i.SetAtInteger(w,45*M),w.delete()}else if("Fly"===e){var D=new o.String("Di"),P=0;P="Right"===t?0:"Up"===t?1:"Left"===t?2:3,i.SetAtInteger(D,90*P),D.delete()}var T=new o.String("D");"Fast"===n?i.SetAtFloat(T,.333328):"Medium"===n&&i.SetAtFloat(T,.666656);var k=this.doc,A=new o.String("Trans");if(k.AddIndirectObject(i),"NoTransition"!==e)for(var L=0;L<r.length;L++){k.GetPage(r[L]).GetDict().SetAtReference(A,i,k)}else for(var F=0;F<r.length;F++){k.GetPage(F).GetDict().RemoveAt(A)}return a.delete(),s.delete(),T.delete(),A.delete(),!0},PDFDoc.prototype.getPageTransitionByIndex=function(e){var t=this.JR.engine,n=this.doc.GetPage(e).GetDict(),r="NoTransition",o=void 0,i=new t.String("Trans"),a=n.GetElement(i);if(null===a)return{transName:"NoTransition",direction:"",speed:""};a.GetType()===t.PDFObjectType.e_Reference&&(a=a.GetDirectObject()),a.GetType()==t.PDFObjectType.e_Dictionary&&(o=a.GetDict());var s=new t.String("S"),u=o.GetElement(s);u&&"R"===(r=u.GetString().toString())&&(r="NoTransition");var c="",d=new t.String("Dm"),l=o.GetElement(d);if("Split"===r){var f=new t.String("M"),h=o.GetElement(f);c=l&&"V"===l.GetString().toString().toLocaleUpperCase()?h&&"O"===h.GetString().toString().toLocaleUpperCase()?"Vertical Outward":"Vertical Inward":h&&"O"===h.GetString().toString().toLocaleUpperCase()?"Horizontal Outward":"Horizontal Inward",f.delete()}else if("Blinds"===r)c=l&&"V"===l.GetString().toString().toLocaleUpperCase()?"Vertical":"Horizontal";else if("Box"===r){var p=new t.String("M"),m=o.GetElement(p);c=m&&"O"===m.GetString().toString().toLocaleUpperCase()?"Outward":"Inward",p.delete()}else if("Wipe"==r||"Glitter"==r||"Cover"==r||"Uncover"==r){var g=new t.String("Di"),y=o.GetElement(g);if(null===y)c="Right";else switch(y.GetInteger()/45%8){case 0:c="Right";break;case 1:c="Right Up";break;case 2:c="Up";break;case 3:c="Left Up";break;case 4:c="Left";break;case 5:c="Left Down";break;case 6:c="Down";break;case 7:c="Right Down"}g.delete()}else if("Push"===r){var _=new t.String("Di"),v=o.GetElement(_);if(null===v)c="Right";else switch(v.GetInteger()/45%8){case 0:c="Right";break;case 1:c="Up";break;case 2:c="Left";break;case 3:c="Down";break;default:c="Up"}_.delete()}else if("Fly"==r){var b=new t.String("Di"),S=o.GetElement(b);if(null===S)c="Right";else switch(S.GetInteger()){case 0:c="Right";break;case 90:c="Up";break;case 180:c="Left";break;case 270:c="Down";break;default:c="Up"}b.delete()}var w="";if("NoTransition"!==r){var M=new t.String("D");if(null===o.GetElement(M))w="Slow";else{var D=o.GetElement(M).GetFloat();w=D-.333328<.001&&D-.333328>-.001?"Fast":D-.666656<.001&&D-.666656>-.001?"Medium":"Slow"}M.delete()}return i.delete(),s.delete(),d.delete(),{transName:r,direction:c,speed:w}},PDFDoc.prototype.removePages=function(e){var t=this,n=pageRangeTwoDimensionToOne(e).sort((function(e,t){return t-e}));try{var r=[];return n.forEach((function(e){r.push(t.removePage(e))})),syncPromisesTask(r).then((function(e){return!0}))}catch(e){return console.warn(e),!1}},PDFDoc.prototype.insertBlankPages=function(e,t,n){var r=this,o=pageRangeTwoDimensionToOne(e).sort((function(e,t){return e-t})),i=[];return o.forEach((function(e,o){i.push(r.insertPage(e+o,t,n))})),syncPromisesTask(i)},PDFDoc.prototype.insertBlankPages2=(_ref30=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n,r){var o,i,a,s,u,c,d,l,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=pageRangeTwoDimensionToOne(t).sort((function(e,t){return e-t})),i=[],a=!0,s=!1,u=void 0,e.prev=5,c=o[Symbol.iterator]();case 7:if(a=(d=c.next()).done){e.next=16;break}return l=d.value,e.next=11,this.insertPage(l,n,r);case 11:f=e.sent,i.push(f);case 13:a=!0,e.next=7;break;case 16:e.next=22;break;case 18:e.prev=18,e.t0=e.catch(5),s=!0,u=e.t0;case 22:e.prev=22,e.prev=23,!a&&c.return&&c.return();case 25:if(e.prev=25,!s){e.next=28;break}throw u;case 28:return e.finish(25);case 29:return e.finish(22);case 30:return e.abrupt("return",i);case 31:case"end":return e.stop()}}),e,this,[[5,18,22,30],[23,,25,29]])}))),function(e,t,n){return _ref30.apply(this,arguments)}),PDFDoc.prototype.rotatePages=function(e,t){var n=pageRangeTwoDimensionToOne(e),r=[];return pageIndexesToPages(this,n).then((function(e){return e.forEach((function(e){r.push(e.setRotation(t))})),Promise.all(r)}))},PDFDoc.prototype.moveBookmark=function(e,t,n){var r=this.rootBookmark.getBookmarkById(e),o=this.rootBookmark.getBookmarkById(t);return this.rootBookmark=null,r.moveTo(o,n)},PDFDoc.prototype.getFolioTreeRoot=function(){if(this.doc.IsPortfolio()){var e=this.engine.Portfolio.CreatePortfolio(this.doc),t=e.GetRootNode();if(!t.IsEmpty()){var n=void 0,r=t.GetNodeType();return r==this.engine.PortfolioNodeType.e_TypeFolder&&(t=new this.engine.PortfolioFolderNode(t),n=this.portfolioFolderNodeToJSON(t)),r==this.engine.PortfolioNodeType.e_TypeFile&&(t=new this.engine.PortfolioFileNode(t),n=this.portfolioFileNodeToJSON(t)),e.delete(),n}e.delete()}},PDFDoc.prototype.getFolioFileInfo=function(){if(!this.doc.IsPortfolio())return{};var e=this.engine.Portfolio.CreatePortfolio(this.doc);try{return{initialFileSpecKeyName:e.GetInitialFileSpecKeyName().toString(),initialViewMode:e.GetInitialViewMode().value}}finally{e.delete()}},PDFDoc.prototype.getPortfolioFileStream=function(e,t){var n=t.writeStream,r=this.JR.GetJSObjectFromPtr(e);return new _FileSpec2.default(r.GetFileSpec(),this).getStream(n)},PDFDoc.prototype.getPortfolioSubNodes=function(e){var t=[],n=this.JR.GetJSObjectFromPtr(e);if(!n)throw new Error("Nonexistent portfolio folder node!");var r=n.GetNodeType();if(r!==this.engine.PortfolioNodeType.e_TypeFolder)return t;for(var o=n.GetSortedSubNodes(),i=o.GetSize(),a=0;a<i;a++){var s=o.GetAt(a);(r=s.GetNodeType())==this.engine.PortfolioNodeType.e_TypeFolder&&(s=new this.engine.PortfolioFolderNode(s),t.push(this.portfolioFolderNodeToJSON(s))),r==this.engine.PortfolioNodeType.e_TypeFile&&(s=new this.engine.PortfolioFileNode(s),t.push(this.portfolioFileNodeToJSON(s)))}return t},PDFDoc.prototype.removeSubNode=function(e,t){var n=this.JR.GetJSObjectFromPtr(e);if(!n)throw new Error("Nonexistent portfolio folder node!");if(n.GetNodeType()!==this.engine.PortfolioNodeType.e_TypeFolder)return!1;var r=this.JR.GetJSObjectFromPtr(t);if(!r)throw new Error("Nonexistent portfolio node!");n.RemoveSubNode(r)},PDFDoc.prototype.portfolioFolderNodeToJSON=function(e){var t=gsdkDateToLocal(e.GetCreationDateTime()),n=gsdkDateToLocal(e.GetModifiedDateTime());return{type:1,fileName:e.GetName().toString(),description:e.GetDescription().toString(),creationDateTime:t?t.getTime():-1,modifiedDateTime:n?n.getTime():t,handle:this.JR.SetJSObjectRef(e)}},PDFDoc.prototype.portfolioFileNodeToJSON=function(e){var t=e.GetFileSpec(),n=gsdkDateToLocal(t.GetCreationDateTime()),r=gsdkDateToLocal(t.GetModifiedDateTime()),o=e.GetKeyName().toString();return{type:0,fileName:t.GetFileName().toString(),fileSize:t.GetFileSize(),description:t.GetDescription().toString(),creationDateTime:n?n.getTime():-1,modifiedDateTime:r?r.getTime():n,subtype:t.GetSubtype().toString(),keyName:o,handle:this.JR.SetJSObjectRef(e)}},PDFDoc.prototype.removeSubNode=function(e,t){var n=this.JR.GetJSObjectFromPtr(e);if(!n)throw new Error("Nonexistent portfolio folder node!");if(n.GetNodeType()!==this.engine.PortfolioNodeType.e_TypeFolder)return!1;var r=this.JR.GetJSObjectFromPtr(t);if(!r)throw new Error("Nonexistent portfolio node!");n.RemoveSubNode(r)},PDFDoc.prototype.isCPDF=function(){return this.doc.IsCPDF()},PDFDoc.prototype.getDocURI=function(){return this.isCPDF()?this.doc.GetDocURI().toString():null},PDFDoc.prototype.convertToCPDF=(_ref32=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n,r,o){var i,a,s,u,c,d,l,f,h,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(![t,n,r,o].some((function(e){return"string"!=typeof e||0===e.length}))){e.next=2;break}throw"[ERROR] All arguments must be string.";case 2:if(i=this.engine,a={endPoint:new i.String(n)},s=void 0,u=function(e){return e.split("\r\n").reduce((function(e,t){var n=t.split(": ");return 2===n.length&&(e[n[0]]=n[1]),e}),{})},c=function(){var e=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n,r){var o,a,s,c,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=function(e){var t=e.GetURL().toString(),n=u(e.GetHTTPHeader().toString());switch(e.GetUsageType()){case i.RequestUsageType.e_RequestUsagePOST:return{url:t,headers:n,method:"post",data:e.GetRequestData().toString()};case i.RequestUsageType.e_RequestUsagePUT:return{url:t,headers:n,method:"put",data:e.GetRequestData().toString()};case i.RequestUsageType.e_RequestUsageGET:return{url:t,headers:n,method:"get",params:e.GetRequestData().toString()};case i.RequestUsageType.e_RequestUsageNone:default:throw"[ERROR] Not valid request."}}(n),e.next=4,_axios2.default.request(o);case 4:if(a=e.sent,s=new i.ResponseParser,c=function(e){return e!==i.ErrorCode.e_ErrSuccess},d=void 0,d=s.Parse(new i.String(JSON.stringify(a.data)),r),!c(d)){e.next=11;break}throw"[ERROR] Fail to parse response for "+t;case 11:if(d=s.GetResultStatus(),!c(d)){e.next=14;break}throw"[ERROR] Response result status: "+d.value.toString();case 14:return e.abrupt("return",s);case 15:case"end":return e.stop()}}),e,p)})));return function(t,n,r){return e.apply(this,arguments)}}(),!this.isCPDF()){e.next=9;break}throw"[ERROR] Already a ConnectedPDF file, so no need to do conversion.";case 9:return d=void 0,d=i.ConnectedPDF.GenerateRequestToCheckEndpoint(a.endPoint),e.next=13,c("CheckEndPoint",d,i.ResponsePurposeType.e_ResponsePurposeCheckServer);case 13:if((s=e.sent).IsValidCPDFServer()){e.next=16;break}throw"[FAILED] "+a.endPoint+" is not a valid CPDF server.";case 16:return(l=new i.ConnectedPDFClientInfo).device_id=new i.String("Device ID"),l.device_name=new i.String("Device Name"),l.device_model=new i.String("Device Model"),l.mac_address=new i.String("MAC Address"),l.os=new i.String("OS"),l.product_name=new i.String("Product Name"),l.product_vendor=new i.String("Product Vendor"),l.product_version=new i.String("1.0.0.0"),l.product_language=new i.String("en-us"),d=i.ConnectedPDF.GenerateRequestToGetClientID(l),e.next=29,c("GetClientID",d,i.ResponsePurposeType.e_ResponsePurposeClientID);case 29:return s=e.sent,f=s.GetClientID(),h=new i.ConnectedPDF(f,new i.String(r),new i.String(""),i.CPDFEncryptType.e_CPDFEncryptTypeAES,this.doc),d=h.GenerateRequestToConvertToCPDF(a.endPoint,new i.String(o),new i.WString(t)),e.next=35,c("ConvertToCPDF",d,i.ResponsePurposeType.e_ResponsePurposeCommon);case 35:if(s=e.sent,h.UpdateInfoToPDFDoc(d)){e.next=38;break}throw"[FAILED] Fail to convert to Connected PDF file.";case 38:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return _ref32.apply(this,arguments)}),PDFDoc.prototype.removeCDocId=(_ref34=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n,r,o){var i,a,s,u,c,d,l,f,h,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(![t,n,r,o].some((function(e){return"string"!=typeof e||0===e.length}))){e.next=2;break}throw"[ERROR] All arguments must be string.";case 2:return i=void 0,a=this.engine,s={endPoint:new a.String(n)},u=function(e){return e.split("\r\n").reduce((function(e,t){var n=t.split(": ");return 2===n.length&&(e[n[0]]=n[1]),e}),{})},c=function(){var e=_asyncToGenerator(regeneratorRuntime.mark((function e(t,n,r){var o,i,s,c,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=function(e){var t=e.GetURL().toString(),n=u(e.GetHTTPHeader().toString());switch(e.GetUsageType()){case a.RequestUsageType.e_RequestUsagePOST:return{url:t,headers:n,method:"post",data:e.GetRequestData().toString()};case a.RequestUsageType.e_RequestUsagePUT:return{url:t,headers:n,method:"put",data:e.GetRequestData().toString()};case a.RequestUsageType.e_RequestUsageGET:return{url:t,headers:n,method:"get",params:e.GetRequestData().toString()};case a.RequestUsageType.e_RequestUsageNone:default:throw"[ERROR] Not valid request."}}(n),e.next=4,_axios2.default.request(o);case 4:if(i=e.sent,s=new a.ResponseParser,c=function(e){return e!==a.ErrorCode.e_ErrSuccess},d=void 0,d=s.Parse(new a.String(JSON.stringify(i.data)),r),!c(d)){e.next=11;break}throw"[ERROR] Fail to parse response for "+t;case 11:if(d=s.GetResultStatus(),!c(d)){e.next=14;break}throw"[ERROR] Response result status: "+d.value.toString();case 14:return e.abrupt("return",s);case 15:case"end":return e.stop()}}),e,p)})));return function(t,n,r){return e.apply(this,arguments)}}(),d=void 0,d=a.ConnectedPDF.GenerateRequestToCheckEndpoint(s.endPoint),e.next=11,c("CheckEndPoint",d,a.ResponsePurposeType.e_ResponsePurposeCheckServer);case 11:if((i=e.sent).IsValidCPDFServer()){e.next=14;break}throw"[FAILED] "+s.endPoint+" is not a valid CPDF server.";case 14:return(l=new a.ConnectedPDFClientInfo).device_id=new a.String("Device ID"),l.device_name=new a.String("Device Name"),l.device_model=new a.String("Device Model"),l.mac_address=new a.String("MAC Address"),l.os=new a.String("OS"),l.product_name=new a.String("Product Name"),l.product_vendor=new a.String("Product Vendor"),l.product_version=new a.String("1.0.0.0"),l.product_language=new a.String("en-us"),d=a.ConnectedPDF.GenerateRequestToGetClientID(l),e.next=27,c("GetClientID",d,a.ResponsePurposeType.e_ResponsePurposeClientID);case 27:i=e.sent,f=i.GetClientID(),(h=new a.ConnectedPDF(f,new a.String(r),new a.String(""),a.CPDFEncryptType.e_CPDFEncryptTypeAES,this.doc)).RemoveDocumentID(),h.RemoveVersionID();case 32:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return _ref34.apply(this,arguments)}),PDFDoc.prototype.saveAsReload=function(){var e=this,t=[];return this.getStream({writeStream:function(e){t.push(e)}},0).then((function(n){for(var r=new Uint8Array(n),o=0,i=0,a=t.length;i<a;i++){var s=t[i];r.set(new Uint8Array(s),o),o+=s.byteLength}r=r.slice(0);var u=new PDFDoc(e.JR,{buffer:r,docId:e.id});return u.parseByPassword(""),u}))},PDFDoc.prototype.getAllPages=function(){var e=this;return this.getPageCount().then((function(t){for(var n=[],r=0;r<t;r++)n.push(e.getPageByIndex(r).then((function(e){return e.page.IsParsed()||e.parsedPage(),e})));return Promise.all(n)}))},PDFDoc.prototype.getDestinationsArray=function(){var e=this;return this.docPromise.then((function(t){var n=new e.engine.CNP_Destinations(t),r=new e.engine.WStringArray,o=new e.engine.Int32Array,i=new e.engine.Int32Array;n.GetAllDestinations(r,o,i);for(var a=[],s=0;s<r.GetSize();s++){var u=r.GetAt(s),c=o.GetAt(s),d={title:u.toString(),page:c};a.push(d)}return a}))},PDFDoc.prototype.removeMetadata=function(e){var t=this.engine,n=new t.WString(e.toString()),r=new t.Metadata(this.doc),o=r.RemoveCustomerKey(n);return n=null,r=null,o},PDFDoc.prototype.setViewPreference=function(e,t){var n=this.engine,r=this.doc.GetCatalog(),o=this.getVPDict(),i=(0,_constantsString.CString)(n,e),a=(0,_constantsString.CString)(n,t+"");switch(e){case"PageMode":"FullScreen"===(f=getDictName(this.JR,n,r,"PageMode","UseNone"))?o.SetAtName((0,_constantsString.CString)(n,"NonFullScreenPageMode"),a):r.SetAtString(i,a);break;case"PageLayout":"Default"==t?r.RemoveAt(i):r.SetAtString(i,a);break;case"Lang":"none"==t?r.RemoveAt(i):r.SetAtString(i,a);break;case"HideToolbar":case"HideMenubar":case"HideWindowUI":case"CenterWindow":case"DisplayDocTitle":case"PickTrayByPDFSize":o.SetAtBoolean(i,t);break;case"PrintScaling":case"Duplex":case"Direction":o.SetAtName(i,a);break;case"NumCopies":if("Default"==t)o.RemoveAt(i);else{var s=+t;o.SetAtInteger(i,s)}break;case"PrintPageRange":var u=n.PDFArray.Create(),c=new Set;(t=t.replace(/ /g,"")).split(",").forEach((function(e){if(e.indexOf("-")>0)for(var t=e.split("-"),n=Math.min.apply(Math,_toConsumableArray(t))-1,r=Math.max.apply(Math,_toConsumableArray(t))-1,o=n;o<=r;o++)c.add(o);else""!==e&&(e=+e-1,c.add(e))})),c.forEach((function(e){e>=0&&u.AddInteger(e)})),o.SetAt(i,u);break;case"FullScreen":var d=(0,_constantsString.CString)(n,"PageMode"),l=(0,_constantsString.CString)(n,"NonFullScreenPageMode");if(t){var f=getDictName(this.JR,n,r,"PageMode","UseNone");r.SetAtString(d,(0,_constantsString.CString)(n,"FullScreen")),o.SetAtName(l,(0,_constantsString.CString)(n,f))}else{var h=getDictName(this.JR,n,o,"NonFullScreenPageMode");r.SetAtString(d,(0,_constantsString.CString)(n,h)),o.RemoveAt(l)}}},PDFDoc.prototype.getVPDict=function(){var e=this.engine,t=this.doc.GetCatalog(),n=t.GetElement((0,_constantsString.CString)(e,"ViewerPreferences"));return n?n=n.GetDict():(n=e.PDFDictionary.Create(),t.SetAt((0,_constantsString.CString)(e,"ViewerPreferences"),n)),n},PDFDoc.prototype.getViewerPreference=function(){var e=this,t=this.engine,n=this.doc.GetCatalog(),r=getDictName(this.JR,t,n,"PageLayout"),o=getDictName(this.JR,t,n,"PageMode","UseNone"),i=getDictName(this.JR,t,n,"Lang","en-us"),a={},s=n.GetElement((0,_constantsString.CString)(t,"ViewerPreferences"));return s&&(s=s.GetDict()),[["HideToolbar",!1],["HideMenubar",!1],["HideWindowUI",!1],["FitWindow",!1],["CenterWindow",!1],["DisplayDocTitle",!1],["NonFullScreenPageMode"],["PickTrayByPDFSize",!1],["PrintScaling","AppDefault"],["Duplex","Simplex"],["NumCopies"],["Direction","L2R"]].forEach((function(n){var r=_slicedToArray(n,2),o=r[0],i=r[1];a[o]=getDictName(e.JR,t,s,o,i)})),a.PrintPageRange=getPrintRange(s,(0,_constantsString.CString)(t,"PrintPageRange")),{pageLayout:r,uiLayout:o,language:i,viewerPreference:a}},PDFDoc.prototype.getEmbeddedFontData=function(){for(var e=this.doc.GetEmbeddedFontData(),t=e.nonstandard_font_name_array,n=e.standard_font_name_array,r=[],o=[],i=0;i<t.GetSize();i++){var a=t.GetAt(i);o.push(a.toString())}for(var s=0;s<n.GetSize();s++){var u=n.GetAt(s);r.push(u.toString())}return{standard:r,nostandard:o}},PDFDoc.prototype.computeAuditSpace=function(){this.doc;var e=this.engine,t=new e.FX_AuditSpaceSize,n=(e.Optimizer.ComputeAuditSpace(this.doc,t),{});for(var r in t){var o=t[r];"function"!=typeof o&&(n[r]=o)}return n},PDFDoc.prototype.getStreamBySpecifiedDoc=function(e,t){var n=this.engine,r=Promise.resolve(e);return e||(r=this.docPromise),r.then((function(e){var r=(0,_createDeferred2.default)(),o=new ArrayBuffer,i=0,a=!1,s=0,u=0,c=n.WriterCallback.implement({Release:function(){c.delete()},Flush:function(){return r.resolve(o),!0},GetSize:function(){return a?u:o.byteLength},WriteBlock:function(e,t,r){if(a&&(t+=s),o.byteLength<t+r){var i=o;if(o=new ArrayBuffer(t+r),0!==i.byteLength){var u=new Uint8Array(i);new Uint8Array(o).set(u)}}var c=new Uint8Array(o,t,r),d=n.HEAPU8.subarray(e,e+r);return c.set(d),!0},GetPosition:function(){return a?i-s:i},SetPosition:function(e){a&&(e+=s),i=e},IsEOF:function(){var e=a?u:o.byteLength;return i===e},ReadBlock:function(e,t,r){if(a&&(t+=s)+r>u)return!1;var i=new Uint8Array(o,t,r);return n.HEAPU8.set(i,e),!0},SetRange:function(e,t){s=e,u=t,a=!0},ClearRange:function(){a=!1}});return n.saveDoc(e,c,t),r.promise}))},PDFDoc.prototype.optimizer=function optimizer(option,portfolioNodeHandle){var doc=this.doc;portfolioNodeHandle&&this.pdfPortfolio&&(doc=this.pdfPortfolio.getPDFDocByNodeHandle(portfolioNodeHandle));var engine=this.engine,opSetting=new engine.OptimizerSettings;if(option.DC_Algorithm){var imgSetting=new engine.ImageSettings;imgSetting.SetStretchMode(engine.ImageStretchMode[option.DC_Algorithm]),imgSetting.SetCompressionMode(engine.ImageCompressMode[option.CC_Algorithm]),imgSetting.SetQuality(engine.ImageCompressQuality[option.CC_Level]),imgSetting.SetImageDPI(+option.DC_DPISet),imgSetting.SetImageDPILimit(+option.DC_DPIAbove),"e_ImageCompressjpeg2000"===option.CC_Algorithm&&imgSetting.SetTitleSize(+option.compressiontileSize),opSetting.SetColorGrayImageSettings(imgSetting)}if(option.DM_Algorithm){var monoSetting=new engine.MonoImageSettings;monoSetting.SetCompressionMode(engine.MonoImageCompressMode[option.CM_Algorithm]),monoSetting.SetStretchMode(engine.MonoStretchMode[option.DM_Algorithm]),monoSetting.SetImageDPI(+option.DM_DPISet),monoSetting.SetImageDPILimit(+option.DM_DPIAbove),-1===["e_ImageCompressjbig2","e_ImageCompressHigh"].indexOf(option.CM_Algorithm)&&(option.CM_Level=""),"e_ImageCompressQualityLossless"===option.CM_Level||"e_ImageCompressQualityLossy"===option.CM_Level?monoSetting.SetQuality(engine.MonoImageCompressQuality[option.CM_Level]):option.CM_Level&&monoSetting.SetQuality(engine.ImageCompressQuality[option.CM_Level]),opSetting.SetMonoImageSettings(monoSetting)}if(option.unembededFonts&&option.unembededFonts.length>0){var unembeddedFontSettings=new engine.UnembeddedFontSettings,wsArray=new this.engine.WStringArray;option.unembededFonts.forEach((function(e){wsArray.Add((0,_constantsString.CWString)(engine,e))})),unembeddedFontSettings.SetUnembeddedFontNameArray(wsArray),opSetting.SetUnembeddedFontSettings(unembeddedFontSettings)}if(option.D_IntList){var D_IntList_Arr=option.D_IntList.split(",")||[];D_IntList_Arr=D_IntList_Arr.map((function(e){return engine.DiscardObjectsOptions[e].value})),D_IntList_Arr=D_IntList_Arr.join("|"),D_IntList_Arr=eval(D_IntList_Arr),opSetting.SetDiscardObjectsOptions(D_IntList_Arr)}if(option.D_IntList_User){var D_IntList_User_Arr=option.D_IntList_User.split(",")||[];D_IntList_User_Arr=D_IntList_User_Arr.map((function(e){return engine.DiscardUserDataOptions[e].value})),D_IntList_User_Arr=D_IntList_User_Arr.join("|"),D_IntList_User_Arr=eval(D_IntList_User_Arr),opSetting.SetDiscardUserDataOptions(D_IntList_User_Arr)}var isSaveFlagLinearized=doc.IsLinearized();if(option.CL_IntList){var CL_IntList_Arr=option.CL_IntList.split(",")||[];isSaveFlagLinearized=CL_IntList_Arr.indexOf("e_SaveFlagLinearized")>-1,CL_IntList_Arr.splice(CL_IntList_Arr.indexOf("e_SaveFlagLinearized"),1),CL_IntList_Arr=CL_IntList_Arr.map((function(e){return engine.CleanUpOptions[e].value})),CL_IntList_Arr=CL_IntList_Arr.join("|"),CL_IntList_Arr=eval(CL_IntList_Arr),CL_IntList_Arr&&opSetting.SetCleanUpOptions(CL_IntList_Arr)}for(var streamCallback=engine.ImageCompressionCallback.implement({Release:function(){},GetTempFileStream:function(){var e=0,t=engine.StreamCallback.implement({Release:function(){t.delete()},Flush:function(){return!0},GetSize:function(){return e},ReadBlock:function(e,t,n){return!1},WriteBlock:function(t,n,r){return e+=r,!0}});return t}}),pauseCallback=engine.PauseCallback.implement({NeedToPauseNow:function(){return!0}}),progressive=engine.Optimizer.Optimize(doc,opSetting,streamCallback,pauseCallback),optimize_state=engine.ProgressiveState.e_ToBeContinued;optimize_state===engine.ProgressiveState.e_ToBeContinued;)optimize_state=progressive.Continue();return this.getStreamBySpecifiedDoc(doc,isSaveFlagLinearized?engine.SaveFlags.e_SaveFlagLinearized.value:0).then((function(e){return[e]}))},PDFDoc.prototype.optimizeScannedPDF=function(e,t){var n=e.pageRange,r=e.scannedImageCompressMode,o=void 0===r?"e_ImageCompressHigh":r,i=e.quality,a=void 0===i?80:i,s=e.scannedMonoImageCompressMode,u=void 0===s?"e_MonoImageCompressjbig2LossLess":s,c=this.doc,d=this.engine,l=new d.OptimizeScannedPDFSettings;if(n.length>0){var f=new d.Range;n.forEach((function(e){return f.AddSingle(e)})),l.SetOptimizedPages(f)}l.SetColorGrayImageCompressionMode(d.ScannedImageCompressMode[o]),["e_ImageCompressjpeg","e_ImageCompressHigh"].indexOf(o)>-1&&l.SetColorGrayImageCompressionQuality(a),l.SetMonoImageCompressionMode(d.ScannedMonoImageCompressMode[u]);var h=d.ImageCompressionCallback.implement({Release:function(){},GetTempFileStream:function(){var e=new ArrayBuffer,t=d.StreamCallback.implement({Release:function(){t.delete()},Flush:function(){return!0},GetSize:function(){return e.byteLength},ReadBlock:function(t,n,r){var o=new Uint8Array(e,n,r);return d.HEAPU8.set(o,t),!0},WriteBlock:function(t,n,r){if(e.byteLength<n+r){var o=e;if(e=new ArrayBuffer(n+r),0!==o.byteLength){var i=new Uint8Array(o);new Uint8Array(e).set(i)}}var a=new Uint8Array(e,n,r),s=d.HEAPU8.subarray(t,t+r);return a.set(s),!0}});return t}}),p=d.PauseCallback.implement({NeedToPauseNow:function(){return!0}});try{for(var m=d.Optimizer.OptimizeScannedPDF(c,l,h,p),g=-1,y=0;g<100;){if(g=m.GetRateOfProgress(),t&&t(g),3===y)return!1;if(-1===g)throw new Error("optimizeScannedPDF error");0===g?y+=1:m.Continue()}return this.getStreamBySpecifiedDoc(c,0).then((function(e){return[e]}))}catch(e){return!1}},PDFDoc.prototype.importAsLayer=function(e){var t=e.sourcePdfDoc,n=e.sourceFileName,r=e.sourcePageIndex,o=void 0===r?0:r,i=e.importType,a=void 0===i?"e_ImportToCreateNewLayer":i,s=e.newLayerName,u=e.targetLayerName,c=e.targetPageIndex,d=void 0===c?0:c,l=e.targetFileName,f=e.rotateAngle,h=void 0===f?0:f,p=e.isAbsoluteScale,m=void 0!==p&&p,g=e.scale,y=void 0===g?1:g,_=e.verticalOffsetFrom,v=void 0===_?"e_OffsetFromCenter":_,b=e.horizontalOffsetFrom,S=void 0===b?"e_OffsetFromCenter":b,w=e.verticalOffset,M=void 0===w?0:w,D=e.horizontalOffset,P=void 0===D?0:D,T=e.opacity,k=void 0===T?100:T,A=e.appearBehindTarget,L=void 0!==A&&A,F=this.engine;this.doc.GetInfo();v=F.OffsetFrom[v],S=F.OffsetFrom[S],a=F.ImportAsLayerOperationType[a];var I=new F.ImportAsLayerSetting(a,new F.WString(s),new F.WString(u),h,m,y,v,M,S,P,k,L);try{this.doc.ImportAsLayer(d,new F.WString(l),t,new F.WString(n),o,I),this.getPageByIndex(d).then((function(e){e.reParsePage()}));var x=this.pdfLayer.layer_context,C=this.pdfLayer.layer_tree.IsEmpty(),R=new _PDFLayer2.default(this.doc,F);return C||R.layer_context.CopyStates(x),this.pdfLayer=R,this.pdfLayer.toJson()}catch(e){throw new Error("ImportAsLayer error: "+e)}},PDFDoc.prototype.previewImportLayer=function(e){var t=e.sourcePdfDoc,n=e.sourcePageIndex,r=void 0===n?0:n,o=e.importType,i=void 0===o?"e_ImportToCreateNewLayer":o,a=e.targetPageIndex,s=void 0===a?0:a,u=e.rotateAngle,c=void 0===u?0:u,d=e.isAbsoluteScale,l=void 0!==d&&d,f=e.scale,h=void 0===f?1:f,p=e.verticalOffsetFrom,m=void 0===p?"e_OffsetFromCenter":p,g=e.horizontalOffsetFrom,y=void 0===g?"e_OffsetFromCenter":g,_=e.verticalOffset,v=void 0===_?0:_,b=e.horizontalOffset,S=void 0===b?0:b,w=e.opacity,M=void 0===w?100:w,D=e.appearBehindTarget,P=void 0!==D&&D,T=this.engine,k=this.doc.GetPage(s);k.StartParse(T.ParseFlags.e_ParsePageNormal.value,null,!0);var A=k.GetWidth(),L=k.GetHeight(),F=T.DIBFormat.e_DIBArgb,I=new T.Bitmap(A,L,F,0,0);I.FillRect(0,null);var x=T.Rotation.e_Rotation0,C=k.GetDisplayMatrix(0,0,A,L,x),R=new T.Renderer(I,!0),O=T.ContentFlag.e_RenderPage.value|T.ContentFlag.e_RenderAnnot.value;if(!t){var G=this.pdfLayer;return R.SetLayerContext(G.layer_context),R.SetRenderContentFlags(O),R.StartRender(k,C,null),(0,_RendererHelper.getBitmapBuffer)(T,I,R)}m=T.OffsetFrom[m],y=T.OffsetFrom[y],i=T.ImportAsLayerOperationType[i];var E=new T.ImportAsLayerSetting(i,new T.WString(""),new T.WString,c,l,h,m,v,y,S,M,P),Y=t.GetPage(r);Y.StartParse(T.ParseFlags.e_ParsePageNormal.value,null,!1);var j=k.GetBox(T.BoxType.e_MediaBox),N=Y.GetBox(T.BoxType.e_MediaBox),B=new T.Matrix(1,0,0,1,0,0),H=3.14*E.rotate_angle/180,W=new T.Matrix(1,0,0,1,0,0);W.Rotate(H,!1),W.TransformRect(N),B.Concat(W.a,W.b,W.c,W.d,W.e,W.f,!1);var U=new T.Matrix(1,0,0,1,0,0);if(0==E.is_absolute_scale){var z=j.Width()/N.Width(),J=j.Height()/N.Height(),V=parseFloat(z)<parseFloat(J)?z:J;U.Scale(V,V,!1)}U.Scale(E.scale,E.scale,!1),U.TransformRect(N),B.Concat(U.a,U.b,U.c,U.d,U.e,U.f,!1);var K=new T.PointF,q=new T.PointF,Z=E.horizontal_offset;switch(E.horizontal_offset_from){case T.OffsetFrom.e_OffsetFromLeft:K.x=N.left,q.x=j.left;break;case T.OffsetFrom.e_OffsetFromCenter:K.x=N.left+N.Width()/2,q.x=j.left+j.Width()/2;break;case T.OffsetFrom.e_OffsetFromRight:K.x=N.right,q.x=j.right,Z=0-E.horizontal_offset}var X=E.vertical_offset;switch(E.vertical_offset_from){case T.OffsetFrom.e_OffsetFromTop:K.y=N.top,q.y=j.top,X=0-E.vertical_offset;break;case T.OffsetFrom.e_OffsetFromCenter:K.y=N.top-N.Height()/2,q.y=j.top-j.Height()/2;break;case T.OffsetFrom.e_OffsetFromBottom:K.y=N.bottom,q.y=j.bottom}B.Translate(q.x-K.x+Z,q.y-K.y+X,!1);var Q=B;return Q.Concat(C.a,C.b,C.c,C.d,C.e,C.f,!1),R.SetRenderContentFlags(T.ContentFlag.e_RenderPage.value),R.SetRenderLayer(!1),R.StartRender(Y,Q,null),(0,_RendererHelper.getBitmapBuffer)(T,I,R)},PDFDoc.prototype.isCompareDoc=function(){var e=this.doc.GetCatalog();if(!e)return!1;if(!e.HasKey(new this.engine.String("PieceInfo")))return!1;var t=e.GetElement(new this.engine.String("PieceInfo"));return!!t&&(t.GetDict()&&t.GetDict().HasKey(new this.engine.String("ComparePDF")))},PDFDoc.prototype.reloadLayer=function(){return this.pdfLayer&&this.pdfLayer.delete(),this.pdfLayer=new _PDFLayer2.default(this.doc,this.engine),!0},PDFDoc.prototype.exportMeasureData=function(e){var t=e.label,n=void 0===t?"label":t,r=e.type,o=void 0===r?"type":r,i=e.value,a=void 0===i?"value":i,s=e.unit,u=void 0===s?"unit":s,c=e.distance,d=void 0===c?"distance":c,l=e.perimeter,f=void 0===l?"perimeter":l,h=e.area,p=void 0===h?"area":h,m=this.doc,g=this.engine,y=new g.ExportMeasureSetting;y.label_colunm_name=new g.WString(n),y.type_colunm_name=new g.WString(o),y.value_colunm_name=new g.WString(a),y.unit_colunm_name=new g.WString(u),y.type_distance_name=new g.WString(d),y.type_perimeter_name=new g.WString(f),y.type_area_name=new g.WString(p);for(var _=(0,_createDeferred2.default)(),v=0,b=[],S=g.WriterCallback.implement({Release:function(){S.delete(),_.resolve(b)},Flush:function(){return _.resolve(b),!0},GetSize:function(){return v},WriteBlock:function(e,t,n){v+=n;var r=g.HEAPU8.buffer,o=void 0;return o=r.slice?r.slice(e,e+n):new Uint8Array(r,e,n).buffer,b.push(o),!0}}),w=g.PauseCallback.implement({NeedToPauseNow:function(){return!0}}),M=m.StartExportMeasureDataToCSV(y,S,w),D=(M.GetRateOfProgress(),g.ProgressiveState.e_ToBeContinued);g.ProgressiveState.e_ToBeContinued==D;)D=M.Continue(),M.GetRateOfProgress().toString();return _.promise},PDFDoc.prototype.setRenderConfigLineWeight=function(e){this.renderConfigLineWeight=e},PDFDoc.prototype.searchBookmark=function(e,t){var n=this;return this.getBookmarks().then((function(r){if(!n.rootBookmark)return[];var o=[];return n.rootBookmark.search(e,t,o),o}))},PDFDoc.prototype.search=function(e,t,n,r){var o=this;if("number"==typeof e)return-1==e?this.searchBookmark(t,n):this.getPageByIndex(e).then((function(e){return e.search(t,n,r)}));var i=[];return e.forEach((function(e){if(-1==e)return i.push(o.searchBookmark(t,n));i.push(o.getPageByIndex(e).then((function(e){return e.search(t,n,r)})))})),Promise.all(i).then((function(t){return t.reduce((function(t,n,r){return t[e[r]]=n,t}),{})}))},PDFDoc.prototype.convertToTextMarkup=function(e){var t=this,n=[],r={};return e.forEach((function(e){var o=t.pageIndexMap[e.pageIndex];r[e.pageIndex]=1,n.push(o.addAnnot({flags:4,type:"highlight",rect:{left:0,right:0,top:0,bottom:0},coords:e.rects}))})),Promise.all(n).then((function(e){return Object.keys(r)}))},PDFDoc.prototype.generateDocHash=function(e){var t=function(e,t){var n=new Uint8Array(t),r=new e.String,o=e._malloc(n.length);return e.HEAPU8.set(n,o),r.Load(o,n.length),r}(this.engine,e);return this.engine.Library.GenerateHashData(this.engine.CryptType.e_Crypt_SHA256,t,t.GetLength()).toString()},PDFDoc.prototype.redactSearch=function(e,t,n,r,o){var i=this,a=[],s=[];return e.forEach((function(e){if(!e.isMetaData){t<0&&(t+=e.word.length);var u=e.charIndex+t,c=-1==n?e.word.length:n,d="";r.find((function(t){if(t.word.toLowerCase()==e.word.toLowerCase())return d=t.overlay,!0})),s.push(e.pageIndex);var l=i.pageIndexMap[e.pageIndex];"form"===e.type?a.push(l.markRedactByAnnotId(e.id,u,c,d,o)):a.push(l.markRedact(u,c,d,o))}})),Promise.all(a).then((function(e){return s}))},PDFDoc.prototype.removePDFAID=function(){return new this.engine.Metadata(this.doc).RemovePDFAID()},PDFDoc.prototype.isScannedDoc=function(){return this.getAllPages().then((function(e){for(var t=0;t<e.length;t++)for(var n=e[t].page,r=n.GetGraphicsObjectCount(),o=0;o<r;o++){var i=n.GetGraphicsObjectBI(o).GetType().value;if(2!==i&&3!==i)return!1}return!0}))},PDFDoc.prototype.getCompareFileFilterNums=function(){for(var e={Text:0,Images:0,Annotation:0,Formatting:0},t=this.doc.GetPageCount(),n=2;n<t;n++){var r=this.doc.GetPage(n).GetDict().GetElement((0,_constantsString.CString)(this.engine,"Annots"));if(r)for(var o=r.GetArray(),i=o.GetElementCount(),a=0;a<i;a++){var s=o.GetElement(a).GetDict().GetElement((0,_constantsString.CString)(this.engine,"OC"));if(s){var u=s.GetDict().GetElement((0,_constantsString.CString)(this.engine,"VE")).GetArray(),c=u.GetElementCount();if(!(c<=1)){var d=u.GetElement(c-1);if(d)if(!d.GetArray())e[d.GetDict().GetElement((0,_constantsString.CString)(this.engine,"Name")).GetString().toString()]++}}}}return e},PDFDoc.prototype.createSummarizeComments=function(e){var t=this,n=e.writeStream,r=void 0===n?function(){}:n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(0,_createDeferred2.default)(),a=o.layoutType,s=o.commentType,u=o.paperSizeType,c=o.fontSizeType,d=o.sortCommentsByType,l=o.pagesContainingNoComments,f=o.pageIndexes,h=o.color,p=o.opacity,m=o.fileName,g=o.annotTypesInfo,y=o.summarizeCommentsShowInfo,_=void 0===y?{}:y,v=this.engine,b=(0,_createSummarizeCommentsUtil.getEngineSummaryLayout)(v,a),S=(0,_annotType.getEngineAnnotType)(v,s),w=(0,_createSummarizeCommentsUtil.getEngineFontSizeType)(v,c),M=(0,_createSummarizeCommentsUtil.getEngineSortType)(v,d),D=(0,_constantsString.CWString)(v,m),P=_slicedToArray(f,2),T=P[0],k=P[1],A=void 0===k?T:k;try{var L=new v.AnnotationSummary(this.doc),F=new v.AnnotationSummarySettings;F.SetSummaryLayout(b);var I="All"===s;F.SetAnnotType(S,I);var x=(0,_createSummarizeCommentsUtil.getPaperSizeWidthAndHeight)(u),C=new v.CFX_FloatRect(0,0,x[0],x[1]);F.SetPageRect(C),C.delete(),F.SetFontSize(w),F.SetSortType(M),F.SetStartPage(T),F.SetEndPage(A),F.EnableOutputNoAnnotationPage(l),"SeparatePagesWithLine"!==a&&"SinglePageWithLine"!==a||(F.SetConnectorLineColor(h),F.SetConnectorLineOpacity(p)),F.SetFileTitle(D),g.forEach((function(e){var n=e.type,r=e.annotThumbnail,o=(0,_annotType.getEngineAnnotType)(v,n),i=(0,_createSummarizeCommentsUtil.getAnnotThumbnailBitmap)(v,r,t.JR);F.SetAnnotThumbnail(o,i)}));var R=v.AnnotationSummaryCallback.implement({Release:function(){R.delete()},GetCurrentLocaleID:function(){return v.LocaleID.e_LocaleIDUnspecified.value},GetLocalFontName:function(){return new _constantsString.CWString(v,"Helvetica")},LoadString:function(e){return(0,_createSummarizeCommentsUtil.getSummarizeCommentsShowInfoById)(v,e,_)}});L.SetCallback(R);var O=0,G=v.WriterCallback.implement({Release:function(){G.delete()},Flush:function(){return i.resolve(O),!0},GetSize:function(){return O},WriteBlock:function(e,t,n){O=Math.max(t+n,O);var o=v.HEAPU8.buffer,i=void 0;return i=o.slice?o.slice(e,e+n):new Uint8Array(o,e,n).buffer,r(i,t,n),!0}}),E=v.PauseCallback.implement({NeedToPauseNow:function(){return!1}});L.StartSummarize(G,F,E),L.delete(),F.delete()}catch(e){var Y=this.engine.getErrorCode(e);console.error(Y)}return i.promise},PDFDoc.prototype.addAA=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=this.doc,i=this.engine,a=void 0,s=(0,_constantsString.CString)(i,"AA"),u=e.GetElement(s);if(u){var c=u.GetDict();a=new i.AdditionalAction(o,c)}else{var d=i.PDFDictionary.Create();e.SetAt(s,d),a=new i.AdditionalAction(o,d)}var l=i.TriggerEvent.values[n.trigger],f=a.GetAction(l);if(r&&!f.IsEmpty()){var h=f.GetSubActionCount();f.InsertSubAction(h,t)}else a.SetAction(l,t)},PDFDoc.prototype.hasOwnerPassword=function(){return this.doc.HasOwnerPassword()},PDFDoc.prototype.getText=function(e,t,n){var r=this,o=n.taskProgress,i=this.engine,a=new i.PDFDoc,s=new i.String("");a.Load(s);var u=this.doc,c=u.GetPageCount(),d=new i.String("");e.forEach((function(e,t){var n=new i.Range((e+c)%c);a.StartImportPages(t,u,0,d,n)})),this.taskProgressMap[t]=!1;var l="",f=0;!function n(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(r.taskProgressMap[t])return delete r.taskProgressMap[t],o({percent:f,content:l});var u=a.GetPage(s),c=i.FlattenOptions.e_FlattenAll.value;u.Flatten(!0,c);var d=i.ParseFlags.e_ParsePageNormal.value;u.StartParse(d,null,!1);var h=i.TextParseFlags.e_ParseTextNormal.value,p=new i.TextPage(u,h),m=i.TextOrderFlag.e_TextDisplayOrder;u.HasVertWritingFont()&&(m=i.TextOrderFlag.e_TextStreamOrder);var g=p.GetText(m).toString();e[s];if(l+=g,p.delete(),f=Math.round((s+1)/e.length*1e4)/100,s>=e.length-1)return delete r.taskProgressMap[t],o({percent:100,content:l});o({percent:f,content:l}),n(++s)}()},PDFDoc.prototype.cancelTaskProgress=function(e){this.taskProgressMap.hasOwnProperty(e)&&(this.taskProgressMap[e]=!0)},_createClass(PDFDoc,[{key:"attachments",get:function(){return this._attachments||(this._attachments=new _Attachments2.default(this.engine,this.doc)),this._attachments},set:function(e){this._attachments=e}},{key:"pdfPortfolio",get:function(){if(this.doc.IsPortfolio())return this._pdfPortfolio||(this._pdfPortfolio=new _PDFPortfolio2.default(this,this.engine)),this._pdfPortfolio},set:function(e){this._pdfPortfolio=e}}]),PDFDoc}();function getDictName(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"Default";if(!n)return o;var i=n.GetElement((0,_constantsString.CString)(t,r));if(!i)return o;switch(i.GetType().value){case 1:return i.GetBoolean();default:return e.getPDFString(i.GetString())}}function getAnnotsArray(e,t){var n=t.GetDict(),r=(0,_constantsString.CString)(e,"Annots"),o=n.GetElement(r);return o||(o=e.PDFArray.Create(),n.SetAt(r,o)),o.GetDirectObject().GetArray()}function getTemplateObject(e,t,n){var r=(0,_constantsString.CString)(t.engine,"Names"),o=e.GetElement(r),i=null;if(o)for(var a=o.GetArray(),s=a.GetElementCount(),u=0;u<s;u+=2){var c=a.GetElement(u).GetString();if(n===t.JR.getPDFString(c)&&u+1<s){i=a.GetElement(u+1);break}}return i}function getMetadataValues(e,t){for(var n=e.GetValues(t),r="",o=0,i=n.GetSize();o<i;o++)r=n.GetAt(o).toString();return r}function formateDictToJson(e){var t={};if(e)for(var n=0;n=e.MoveNext(n);){var r=e.GetKey(n).toString(),o=formatDictObjToJson(e.GetValue(n));t[r]=o}return t}function formatDictObjToJson(e){var t=void 0;switch(e.GetType().value){case 1:t=e.GetBoolean();break;case 2:t=e.GetFloat();break;case 3:t=e.GetString().toString();break;case 4:t=e.GetName().toString();break;case 5:for(var n=e.GetArray(),r=[],o=n.GetElementCount();o--;)r[o]=formatDictObjToJson(n.GetElement(o));t=r;break;case 6:t=formateDictToJson(e.GetDict());break;case 8:t=null;break;default:t=e.toString()}return t}function retriveDict(e,t,n,r){var o="",i=void 0,a=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];switch(r.GetType().value){case 1:return r.GetString().toString();case 2:var s=r.GetString().toString();return Math.abs(parseInt(s)-parseFloat(s))<.001?parseInt(s):parseFloat(s);case 3:var u=r.GetString(),c=u.GetBuffer();o="<";for(var d=0;d<u.GetLength();d++){var l=e.HEAPU8[c+d];o+=a[(240&l)>>4],o+=a[15&l]}return o+=">";case 4:return"/"+r.GetName().toString();case 5:o=[];for(var f=r.GetArray(),h=f.GetElementCount(),p=0;p<h;p++)o.push(retriveDict(e,t,n,f.GetElement(p)));return o;case 7:o={};var m=r.GetStream();i=m.GetDictionary();var g=m.GetDataSize(!0);if(g){var y=e._malloc(g);r.GetStream().GetData(!0,g,y);for(var _="",v=y;v<y+g;v++){var b=e.HEAP8[v];_+=a[(240&b)>>4],_+=a[15&b]}e._free(y),o.stream=_}case 6:o=o||{},i||(i=r.GetDict()),i||(i=r);var S=i.GetElement((0,_constantsString.CString)(e,"Type"));if(S&&"OCG"==S.GetString().toString())return{};for(var w=i.MoveNext(0);w;){var M=i.GetKey(w),D=i.GetElement(M);o[M.toString()]=retriveDict(e,t,M.toString(),D),w=i.MoveNext(w),M.delete()}return o;case 8:return null;case 9:var P=r.GetDirectObject().GetObjNum();return o=P+"R",t[P]=retriveDict(e,t,n,r.GetDirectObject()),o}return o}function getPDFNameTree(e,t,n){for(var r={},o=new t.PDFNameTree(n,e),i=0,a=o.GetCount();i<a;i++){var s=o.GetName(i),u=o.GetObj(s);if(u){var c=s.toString();if(e.value===t.PDFNameTreeType.e_JavaScript.value){var d=new t.Action(n,u.GetDict());if(d.IsEmpty())continue;var l=new t.JavaScriptAction(d),f=l.GetScript();r[c]=f.toString(),d=null,l=null,f=null}else if(4===e.value||5===e.value){var h=u.GetDict().GetObjNum();r[c]=h,h=null}s.delete(),s=null}}return r}function pageRangeTwoDimensionToOne(e){return e.reduce((function(e,t){if(2===t.length){for(var n=[],r=t[0];r<t[1];r++)n.push(r);t=n}return e.concat(t)}),[])}function pageIndexesToPages(e,t){var n=[];return t.forEach((function(t){n.push(e.getPageByIndex(t))})),Promise.all(n)}function syncPromisesTask(e){var t=[];return e.reduce((function(n,r,o){return n.then((function(n){return r.then((function(n){return t[o]=n,o==e.length-1?t:r}))}))}),Promise.resolve())}function getDB(){if(getDB._db)return getDB._db;var e=new _IndexDBCache2.default("CopyPages_cache","FoxitPDFSDKForWeb_CopyPages_cache");return e.clear(),getDB._db=e,e}function formatMetadataDate(e,t){return-1!=e.indexOf("D:")?e:(0,_formatDate.formatPDFDate)(e)}exports.default=PDFDoc},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={MARKED:"marked",UNMARKED:"unmarked",ACCEPTED:"accepted",REJECTED:"rejected",CANCELLED:"cancelled",COMPLETED:"completed",DEFERRED:"deferred",FUTURE:"future",NONE:"none"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getEngineRectF=function(e,t){return new(0,e.CFX_FloatRect)(t.left,t.bottom,t.right,t.top)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSecureRandom=function(){if((0,o.isRunningInBrowser)()){if(window.crypto)return e=new Uint32Array(1),window.crypto.getRandomValues(e),e[0]/4294967296;if(window.msCrypto)return function(){var e=new Uint32Array(1);return window.msCrypto.getRandomValues(e),e[0]/4294967296}()}var e;return(0,r.prop)("random",Math)()};var r=n(218),o=n(155)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(75);var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.prototype.format=function(e,t,n){return[{type:"string",value:"["+this.levelText(t)+"]"},{type:"string",value:"{"+e+"}"}].concat(n.map((function(e){return null==e?{type:void 0===e?"undefined":r(e),value:e+""}:{type:void 0===e?"undefined":r(e),value:e}})))},e.prototype.levelText=function(e){switch(e){case o.LEVEL_DEBUG:return"DEBUG";case o.LEVEL_INFO:return"INFO";case o.LEVEL_WARN:return"WARN";case o.LEVEL_ERROR:return"ERROR"}return"UNKNOWN LEVEL"},e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NoLogger=void 0;var r=n(75),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(219));function i(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 a(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var u=function(){function e(t,n,r,o){s(this,e),this.appender=t,this.layout=n,this.module=r,this.minLevel=o,this.logOff=!1}return e.prototype.toggle=function(e){this.logOff="boolean"==typeof e?e:!o.logOff},e.prototype.setLevel=function(e){this.minLevel=e},e.prototype.doLog=function(e,t){if(!this.isLoggable(e)){var n=this.layout.format(this.module,e,t);this.appender.print(n,e)}},e.prototype.log=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.doLog(e,n)},e.prototype.debug=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];this.doLog(r.LEVEL_DEBUG,t)},e.prototype.info=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];this.doLog(r.LEVEL_INFO,t)},e.prototype.warn=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];this.doLog(r.LEVEL_WARN,t)},e.prototype.error=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];this.doLog(r.LEVEL_ERROR,t)},e.prototype.isLoggable=function(e){return this.logOff||o.logOff||e<this.minLevel||e<o.logLevel},e}();t.default=u;t.NoLogger=function(e){function t(){return s(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.doLog=function(){},t}(u)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){throw new Error("Method not implemented"+(e?":"+e:""))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(75);var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.prototype.format=function(e,t,n){var o=this,i=(new Error).stack,a=void 0;i&&(a="\n "+i.split("\n")[4].trim());return[{type:"string",style:"color: "+this.levelColor(t)+";",value:"["+this.levelText(t)+"]"},{type:"string",style:"color: magenta",value:"{"+e+"}"}].concat(n.map((function(e){return null==e?{type:void 0===e?"undefined":r(e),style:"color: megenta;font-weight: bold",value:e+""}:"string"==typeof e?{type:void 0===e?"undefined":r(e),style:"color: "+o.levelColor(t),value:e}:{type:void 0===e?"undefined":r(e),value:e}}))).concat({type:"string",style:"color: grey;",value:a})},e.prototype.levelColor=function(e){switch(e){case o.LEVEL_DEBUG:return"blue";case o.LEVEL_INFO:return"green";case o.LEVEL_WARN:return"#5C3C00";case o.LEVEL_ERROR:return"red"}return"#000"},e.prototype.levelText=function(e){switch(e){case o.LEVEL_DEBUG:return"DEBUG";case o.LEVEL_INFO:return"INFO";case o.LEVEL_WARN:return"WARN";case o.LEVEL_ERROR:return"ERROR"}return"UNKNOWN LEVEL"},e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});r(n(220));function r(e){return e&&e.__esModule?e:{default:e}}function o(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var i=function(e){function t(n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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}(this,e.call(this));return r.appenders=n||[],r}return o(t,e),t.prototype.print=function(e,t){this.appenders.forEach((function(n){return n.print(e,t)}))},t}(r(n(156)).default);t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(37),i=(r=o)&&r.__esModule?r:{default:r};var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.createTextWatermark=function(e,t,n,r,o){var i=new e.WString(n),a=new e.Watermark(t,i,r,o);return i.delete(),a},e.createBitmapWatermark=function(e,t,n,r){var o=i.default.createImage(e,n).GetFrameBitmap(0);return new e.Watermark(t,o,r)},e}();t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.createWatermarkSettings=function(e,t,n,r,o,i,a,s,u){var c=e.Position,d=e.WatermarkSettingsFlags,l={TopLeft:c.e_PosTopLeft,TopCenter:c.e_PosTopCenter,TopRight:c.e_PosTopRight,CenterLeft:c.e_PosCenterLeft,Center:c.e_PosCenter,CenterRight:c.e_PosCenterRight,BottomLeft:c.e_PosBottomLeft,BottomCenter:c.e_PosBottomCenter,BottomRight:c.e_PosBottomRight},f={0:d.e_FlagASPageContents,1:d.e_FlagASAnnot,2:d.e_FlagOnTop,4:d.e_FlagNoPrint,8:d.e_FlagInvisible};return new e.WatermarkSettings(l[t],n,r,f[o].value,i,a,s,u)},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.createWatermarkTextProperties=function(e,t,n,r,o,i,a){var s=e.StandardID,u=[s.e_StdIDCourier,s.e_StdIDCourierB,s.e_StdIDCourierBI,s.e_StdIDCourierI,s.e_StdIDHelvetica,s.e_StdIDHelveticaB,s.e_StdIDHelveticaBI,s.e_StdIDHelveticaI,s.e_StdIDTimes,s.e_StdIDTimesB,s.e_StdIDTimesBI,s.e_StdIDTimesI,s.e_StdIDSymbol,s.e_StdIDZapfDingbats],c={normal:e.FontStyle.e_FontStyleNormal,underline:e.FontStyle.e_FontStyleUnderline},d={left:e.Alignment.e_AlignmentLeft,center:e.Alignment.e_AlignmentCenter,right:e.Alignment.e_AlignmentRight},l=new e.Font(u[t]),f=new e.WatermarkTextProperties(l,n,r,c[o.toLocaleLowerCase()],i,d[a.toLocaleLowerCase()]);return l.delete(),f},e}();t.default=r},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=t.RectDiffer=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n;r(this,e),this.top=t,this.left=n,this.bottom=o,this.right=i},i=(t.Rect=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;r(this,e),this.top=t,this.left=n,this.bottom=o,this.right=i},t.Boundary=function e(t,n,o,i){r(this,e),this.top=t,this.left=n,this.bottom=bottom,this.right=right},function(){function e(t){r(this,e),this.offsetLeft=0,this.offsetTop=0,this.offsetRight=0,this.offsetBottom=0,this.target=t}return e.isOverlap=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=Math.max(e.left,t.left),o=Math[n?"min":"max"](e.top,t.top),i=Math[n?"max":"min"](e.bottom,t.bottom),a=Math.min(e.right,t.right);if(r<=a)if(n){if(o>=i)return(a-r)*(o-i)}else if(o<=i)return(a-r)*(i-o);return 0},e.isInRect=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e>=n.left&&e<=n.right)if(r){if(t>=n.bottom&&t<=n.top)return!0}else if(t<=n.bottom&&t>=n.top)return!0;return!1},e.rectInRect=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.left>=t.left&&e.right<=t.right;return!!r&&(n?e.top<=t.top&&e.bottom>=t.bottom:e.top>=t.top&&e.bottom<=t.bottom)},e.on=function(t){return new e(t)},e.subtract=function(e,t){return new o(e.top-t.top,e.left-t.left,e.bottom-t.bottom,e.right-t.right)},e.expandOffset=function(e,t){return new o(e.top-t.top,e.left-t.left,t.bottom-e.bottom,t.right-e.right)},e.copyTo=function(e,t){t.left=e.left,t.top=e.top,t.right=e.right,t.bottom=e.bottom},e.prototype.moveLeft=function(e){return this.offsetLeft+=e,this.offsetRight+=e,this},e.prototype.moveTop=function(e){return this.offsetTop+=e,this.offsetBottom+=e,this},e.prototype.move=function(e,t){return this.moveLeft(e).moveTop(t)},e.prototype.moveTo=function(e,t){return this.offsetLeft=this.offsetRight=this.target.left-e,this.offsetTop=this.offsetBottom=this.target.top-t,this},e.prototype.shrink=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t;return this.add(new o(e,t,-n,-r))},e.prototype.expand=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t;return this.add(new o(-e,-t,n,r))},e.prototype.zoom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"center",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"center",r=this.target.right+this.offsetRight-(this.target.left+this.offsetLeft),i=this.target.bottom+this.offsetBottom-(this.target.top+this.offsetTop),a=r*e,s=i*e,u=a-r,c=s-i,d=0,l=0,f=0,h=0;switch(t){case"right":d=-u;break;case"center":d=-u/2,l=u/2;break;case"left":default:l=u}switch(n){case"bottom":f=-c;break;case"center":f=-c/2,h=c/2;break;case"top":default:h=c}return this.add(new o(f,d,h,l))},e.prototype.add=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.top,n=void 0===t?0:t,r=e.left,o=void 0===r?n:r,i=e.bottom,a=void 0===i?n:i,s=e.right,u=void 0===s?o:s;return this.offsetLeft+=o,this.offsetRight+=u,this.offsetBottom+=a,this.offsetTop+=n,this},e.prototype.extract=function(){var e=this.target.left+this.offsetLeft,t=this.target.right+this.offsetRight;return{left:e,top:this.target.top+this.offsetTop,right:t,bottom:this.target.bottom+this.offsetBottom}},e.prototype.boundary=function(){var e=this.target.left+this.offsetLeft,t=this.target.right+this.offsetRight,n=this.target.top+this.offsetTop;return{left:e,top:n,width:t-e,height:this.target.bottom+this.offsetBottom-n}},e.prototype.intersect=function(t){t instanceof e||(t=e.on(t));var n=this.toPlainObject(),r=t.toPlainObject(),o={left:Math.max(n.left,r.left),right:Math.min(n.right,r.right),top:Math.max(n.top,r.top),bottom:Math.min(n.bottom,r.bottom)};return e.on(o)},e.prototype.toPlainObject=function(){return{left:this.target.left+this.offsetLeft,right:this.target.right+this.offsetRight,top:this.target.top+this.offsetTop,bottom:this.target.bottom+this.offsetBottom}},e}());t.default=i},function(e,t,n){"use strict";n.r(t);var r=function(){function e(e){this.page=e,this.modified=!0,this.currentRotate=0}return e.prototype.reset=function(){this.currentBitmapPromise&&(this.currentBitmapPromise.then((function(e){e.bitmap.delete()})),this.currentBitmapPromise=void 0),this.modified=!0},e.prototype.setCurrentRotate=function(e){this.currentRotate=e},e.prototype.getCurrentImageData=function(){return!this.modified&&this.currentBitmapPromise||(this.currentBitmapPromise=this.page.getBitmap(1,this.currentRotate,void 0,["page","annot"],"print","").then((function(e){return e.renderer.delete(),e.progressive.delete(),delete e.renderer,delete e.progressive,e})),this.modified=!1),this.currentBitmapPromise},e}();t.default=r},function(e,t,n){"use strict";var r;n.r(t),n.d(t,"SNAP_MODE",(function(){return r})),function(e){e.EndPoint="end-point",e.MidPoint="mid-point",e.IntersectionPoint="intersection-point",e.NearestPoint="nearest-point"}(r||(r={}))},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,o="~";function i(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,n,r,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new a(n,r||e,i),u=o?o+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function u(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(o=!1)),c.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(o?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},c.prototype.listeners=function(e){var t=o?o+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,i=n.length,a=new Array(i);r<i;r++)a[r]=n[r].fn;return a},c.prototype.listenerCount=function(e){var t=o?o+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,r,i,a){var s=o?o+e:e;if(!this._events[s])return!1;var u,c,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,r),!0;case 5:return d.fn.call(d.context,t,n,r,i),!0;case 6:return d.fn.call(d.context,t,n,r,i,a),!0}for(c=1,u=new Array(l-1);c<l;c++)u[c-1]=arguments[c];d.fn.apply(d.context,u)}else{var f,h=d.length;for(c=0;c<h;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),l){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,n);break;case 4:d[c].fn.call(d[c].context,t,n,r);break;default:if(!u)for(f=1,u=new Array(l-1);f<l;f++)u[f-1]=arguments[f];d[c].fn.apply(d[c].context,u)}}return!0},c.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,r){var i=o?o+e:e;if(!this._events[i])return this;if(!t)return u(this,i),this;var a=this._events[i];if(a.fn)a.fn!==t||r&&!a.once||n&&a.context!==n||u(this,i);else{for(var s=0,c=[],d=a.length;s<d;s++)(a[s].fn!==t||r&&!a[s].once||n&&a[s].context!==n)&&c.push(a[s]);c.length?this._events[i]=1===c.length?c[0]:c:u(this,i)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=o?o+e:e,this._events[t]&&u(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=o,c.EventEmitter=c,e.exports=c},function(e,t,n){"use strict";function r(e,t){var n=t.renderConfigLineWeight;void 0!==n&&e.SetRenderPathThinLine(!n);var r=t.pageDisplayPreferences;r&&!r.enhanceThinLinesChecked||e.SetRenderEnhanceThinLines(!0)}n.r(t),n.d(t,"setRendererThinLineByDocOps",(function(){return r}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var o="undefined"===("undefined"==typeof URL?"undefined":r(URL))?"undefined"===("undefined"==typeof webkitURL?"undefined":r(webkitURL))?null:webkitURL:URL,i=void 0,a=void 0;"undefined"!==("undefined"==typeof FileReaderSync?"undefined":r(FileReaderSync))?(i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size,r=new FileReaderSync;return r.readAsArrayBuffer(e.slice(t,t+n))},a=function(e){return new Blob([e])}):o?(i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size,r=o.createObjectURL(e),i=new XMLHttpRequest;i.open("GET",r,!1),i.responseType="arraybuffer",i.send(null);var a=i.status;return a>=200&&a<300||304===a?(o.revokeObjectURL(r),(e=i.response).slice?e.slice(t,t+n):new Uint8Array(e,t,n).buffer):null},a=function(e){return new Blob([e])}):(i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.byteLength;return e.slice?e.slice(t,n):new Uint8Array(e,t,n).buffer},a=function(e){return e});var s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.size=t,this.blockSize=8388608,this.blocks=[],this.loadingBlocks=[],this.blobCache=[],this.loadingCache={}}return e.prototype.push=function(e,t){for(var n=this.blocks,r=Math.max(0,e),o=Math.min(e+t,this.size),i=[],a=n.length;a--;){var s=n[a],u=s[0],c=s[1];u<=o&&c>=r&&(r=Math.min(r,u),o=Math.max(o,c),i.push(a))}for(var d=0,l=i.length;d<l;d++)n.splice(i[d],1);n.push([r,o])},e.prototype.avail=function(e,t){for(var n=e,r=e+t,o=this.blocks,i=o.length;i--;){var a=o[i],s=a[0],u=a[1];if(s<=n&&u>=r)return!0}return!1},e.prototype.full=function(){1===this.blocks.length&&0===this.blocks[0][0]&&(this.blocks[0][1],this.size)},e.prototype.checkLoadBuffer=function(e,t){for(var n=e,r=e+t,o=this.loadingBlocks,i=o.length;i--;){var a=o[i],s=a[0],u=a[1];if(s<=n&&u>=r)return!0}return!1},e.prototype.loadingBuffer=function(e,t){for(var n=this.loadingBlocks,r=Math.max(0,e),o=Math.min(e+t,this.size),i=[],a=n.length;a--;){var s=n[a],u=s[0],c=s[1];u<=o&&c>=r&&(r=Math.min(r,u),o=Math.max(o,c),i.push(a))}for(var d=0,l=i.length;d<l;d++)n.splice(i[d],1);n.push([r,o])},e.prototype.addBuffer=function(e,t,n){for(var r=new Uint8Array(n),o=this.blockSize,s=this.blobCache,u=e%o,c=0,d=o-u,l=Math.floor(e/o),f=Math.floor((e+t)/o);l<=f;l++){var h=s[l],p=void 0;h&&(p=i(h)),p||(p=new ArrayBuffer(o));var m=new Uint8Array(p);m.set(r.slice(c,d),u),s[l]=a(m),u=0,c+=o,d+=o}this.push(e,t)},e.prototype.getBuffer=function(e,t){e+t>this.size&&(t=this.size-e);for(var n=new ArrayBuffer(t),r=this.blockSize,o=this.blobCache,a=Math.floor(e/r),s=Math.floor((e+t)/r),u=e%r,c=Math.min(t,r-u),d=0,l=c,f=a,h=s;f<=h;f++){var p=o[f],m=void 0;if(p&&(m=i(p,u,c)),!m)return null;new Uint8Array(n,d,l-d).set(new Uint8Array(m)),u=0,t-=c,d+=c,l+=c=Math.min(t,r-u)}return n},e.prototype._getBufferCacheKey=function(e,t){return[e,t].join("-")},e.prototype.destroy=function(){for(var e=this.blobCache.length;e--;)delete this.blobCache[e]},e}();t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=s(n(38)),o=s(n(85)),i=s(n(105)),a=n(225);function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var c=function(){function e(t,n,r,o){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;u(this,e),this.doc=t,this.engine=t.engine,this.id=n,this.c_bookmark=r,this.c_doc=o,this.title=r.GetTitle().toString();var a=this.c_bookmark.GetColor().toString(16);this.color="#"+a.substr(2);var s=this.c_bookmark.GetStyle();this.isItalic=1&s,this.isBold=2&s,this.dst=r.GetDestination(),this.deep=i;var c=this.dst.IsEmpty();this.children=[],c?(this.pageIndex=null,this.pageTop=0,this.pageLeft=0):(this.pageIndex=this.dst.GetPageIndex(this.c_doc),this.pageTop=this.dst.GetTop(),this.pageLeft=this.dst.GetLeft())}return e.prototype.destroy=function(){this.dst.delete(),this.c_bookmark.delete(),this.children.forEach((function(e){return e.destroy()})),this.children=null,this.c_destination=null,this.c_doc=null,this.engine=null,this.c_bookmark=null},e.prototype.removeChild=function(e){var t=this.children;for(var n in t){var r=t[n];if(r.id==e)return t.splice(n,1),r;var o=r.removeChild(e);if(o)return o}},e.prototype.insert=function(t,n,o,i){var a=new this.engine.WString(t),s=this.c_bookmark.Insert(a,this.engine.BookmarkPosition.values[i]);(0,r.default)(a);var u={destination:{pageIndex:n,left:o.left,top:o.top,zoomMode:"ZoomFitHorz"},type:"TypeGoto"},c=this.doc.JR.actionManager,d=c.create(this.c_doc,u.type);s.SetAction(d),c.get(d,this.c_doc,this.doc.JR).create(u);var l=new e(this.doc,s.GetDict().GetObjNum(),s,this.c_doc,this.deep+1);return this.children.push(l),l},e.prototype.getBookmarkById=function(e){if(e==this.id)return this;var t=this.children;for(var n in t){var r=t[n].getBookmarkById(e);if(r)return r}},e.prototype.remove=function(){var e=this.c_doc.RemoveBookmark(this.c_bookmark);return this.destroy(),e},e.prototype.setProperty=function(e){for(var t in e)if("title"==t){var n=new this.engine.WString(e[t]);this.c_bookmark.SetTitle(n),n.delete(),this.title=this.c_bookmark.GetTitle().toString()}else if("style"==t){this.c_bookmark.SetStyle(e[t]);var r=this.c_bookmark.GetStyle();this.isItalic=1&r,this.isBold=2&r}else if("color"==t){this.c_bookmark.SetColor(e[t]);var o=this.c_bookmark.GetColor().toString(16);this.color="#"+o.substr(2)}else if("destination"==t){var i=e[t],a=new this.engine.Destination.CreateXYZ(this.c_doc,i.pageIndex,i.left,i.top,1);this.c_bookmark.SetDestination(a)}},e.prototype.toJson=function(){if(this.c_bookmark.IsEmpty())return[];var t=[];if(this.children=[],this.c_bookmark.HasChild())for(var n=this.c_bookmark.GetFirstChild();!n.IsEmpty();){var r=new e(this.doc,n.GetDict().GetObjNum(),n,this.c_doc,this.deep+1);n=n.GetNextSibling(),t.push(r.toJson()),this.children.push(r)}return{id:this.id,deep:this.deep,title:this.title,color:this.color,isBold:this.isBold,isItalic:this.isItalic,children:t,page:this.pageIndex,top:this.pageTop,left:this.pageLeft}},e.prototype.moveTo=function(e,t){var n=e.c_bookmark;return this.c_bookmark.MoveTo(n,this.engine.BookmarkPosition.values[t])},e.prototype.getDestination=function(){var e=new this.engine.String("A");if(!this.c_bookmark.GetDict().HasKey(e)){var t=this.c_bookmark.GetDestination();return t.IsEmpty()?void 0:{destination:new i.default(t,this.doc,this.engine).toJson(),objNumber:null,subAction:[],subActionCount:0,type:"TypeGoto"}}(0,r.default)(e)},e.prototype.setDestination=function(e){var t=this.c_bookmark.GetDict(),n=new this.engine.String("A");t.HasKey(n)&&t.RemoveAt(n),(0,r.default)(n);var o=i.default.create(this.engine,this.c_doc,e.destination);return this.c_bookmark.SetDestination(o),{destination:new i.default(o,this.doc,this.engine).toJson(),objNumber:null,subAction:[],subActionCount:0,type:"TypeGoto"}},e.prototype.getAction=function(){var e=new this.engine.String("Dest");if(!this.c_bookmark.GetDict().HasKey(e)){var t=this.c_bookmark.GetAction();return t.IsEmpty()?void 0:this.doc.JR.actionManager.get(t,this.doc,this.doc.JR).toJson()}(0,r.default)(e)},e.prototype.setAction=function(e){var t=this.doc.JR.actionManager,n=t.create(this.c_doc,e.type),o=this.c_bookmark.GetAction();if(o.IsEmpty())this.c_bookmark.SetAction(n);else{var i=o.GetSubActionCount();o.InsertSubAction(i,n),this.c_bookmark.SetAction(o)}var a=this.c_bookmark.GetDict(),s=new this.engine.String("Dest");a.HasKey(s)&&a.RemoveAt(s),(0,r.default)(s),t.get(n,this.c_doc,this.doc.JR).create(e)},e.prototype.moveAction=function(e,t){var n=new this.engine.Action(this.c_doc,this.c_doc.GetIndirectObject(e.objNumber).GetDict());this.c_bookmark.MoveAction(n,t)},e.prototype.removeAction=function(e){if(e){var t=this.c_bookmark.GetAction();return t=(0,o.default)(this.engine,this.c_doc,t,e.objNumber),e.objNumber&&t?(this.c_bookmark.SetAction(t),!0):this.c_bookmark.RemoveAction()}return this.c_bookmark.RemoveAction()},e.prototype.getCanonicalString=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(e){var r=new this.engine.WString(e),o=this.engine.TextSearchUtils.CanonicalFindText(r,t,n),i=o.canonical_text?o.canonical_text.toString():"";return r.delete(),i}},e.prototype.search=function(e,t,n){var r=this,o=!t.wholeWordsOnly&&!t.caseSensitive&&t.stemming,i=this.c_bookmark.GetTitle().toString(),s=i,u=null;if(t.isIgnoreDiacritics||t.isIgnoreAsia){var c=new this.engine.WString(s),d=this.engine.TextSearchUtils.CanonicalFindText(c,t.isIgnoreAsia,t.isIgnoreDiacritics);s=d.canonical_text?d.canonical_text.toString():"";var l=d.text_index_of_len_array,f=[];u=[];for(var h=0;h<=l.GetSize();h++)f[h]=0===h?0:f[h-1]+l.GetAt(h-1),u[f[h]]=h;for(var p=0;p<u.length;p++)void 0===u[p]&&(u[p]=u[p-1]);c.delete()}t.caseSensitive||(s=s.toLowerCase()),e.forEach((function(e){var c=e;t.caseSensitive||(c=c.toLowerCase()),(t.isIgnoreDiacritics||t.isIgnoreAsia)&&(c=r.getCanonicalString(c,t.isIgnoreAsia,t.isIgnoreDiacritics));var d=s.indexOf(c,0),l=void 0;if(o){var f=(l=(0,a.searchStemming)(r.engine,c,i)).next();f.done?d=-1:(d=f.value.index,c=f.value.oriWord)}for(;-1!==d;){var h=r.getCanonicalString(s[d-1]),p=r.getCanonicalString(s[d+c.length]),m=o?c.length:e.length;if(!t.wholeWordsOnly||!(/[0-9a-zA-Z]/.test(h)&&void 0!==h||/[0-9a-zA-Z]/.test(p)&&void 0!==p)){var g=null,y=null,_=d;u?(g=(0,a.getStartText)(i,u[d]),y=(0,a.getEndText)(i,u[d]+m),_=u[d]):(g=(0,a.getStartText)(i,d),y=(0,a.getEndText)(i,d+m)),n.push({startText:g,endText:y,word:i.substr(_,m),type:"bookmark",index:n.length,id:r.id});break}if(o){var v=l.next();v.done?d=-1:(d=v.value.index,c=v.value.oriWord)}else d=s.indexOf(c,d+1)}})),this.children.forEach((function(r){return r.search(e,t,n)}))},e}();t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(631),i=(r=o)&&r.__esModule?r:{default:r},a=n(3),s=n(104);var u=function(){function e(t,n,r,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.jrDoc=t,this.engineForm=n,this.engine=r,this.JR=o,this.fields={},this.changedWidget={}}return e.prototype.destroy=function(){this.engine=null,this.JR=null;var e=this.fields;for(var t in e){var n=e[t];0!==Object.keys(n).length&&n.destroy(),e[t]=null}this.fields=null,this.engineForm.delete(),this.engineForm=null},e.prototype.getField=function(e){return this.fields[e]},e.prototype.addJRField=function(e,t,n){var r=new i.default(this.jrDoc,this.engineForm,e,this.engine,this.JR);return this.fields[t||n]=r,r},e.prototype.setFieldsValue=function(e,t){for(var n in e)this.fields[n].setValue(e[n],t)},e.prototype.getFieldsValue=function(){var e={};for(var t in this.fields)e[t]=this.fields[t].getValue();return e},e.prototype.toJson=function(){for(var e=this.engineForm,t=e.NeedConstructAppearances(),n=(0,a.CWString)(this.engine,""),r=e.GetFieldCount(n),o=[],s=0;s<r;s++)try{var u=e.GetField(s,n);if(u.IsEmpty()){o.push({}),this.fields[s]={};continue}7==u.GetType().value&&(u=new this.engine.Signature(u));var c=new i.default(this.jrDoc,e,u,this.engine,this.JR),d=c.toJson(s);this.fields[u.GetName().toString()||s]=c,o.push(d)}catch(e){o.push({}),this.fields[s]={}}return Promise.all(o).then((function(n){for(var r=e.GetFieldsInCalculationOrder(),o=[],i=0;i<r.GetSize();i++){var a=r.GetAt(i);o.push(a.GetName().toString())}r.delete();var s=e.GetDefaultAppearance(),u=e.GetAlignment().value,c="",d="";try{s.font.IsEmpty()||(c=s.font.GetName().toString(),d=(d=s.font.GetFamilyName().toString()).replace(" ","").replace("-",""),s.font.IsBold()&&(d+="Bold"),s.font.IsItalic()&&(d+="Italic"))}catch(e){console.error("font name error")}return{needConstructAppearances:t,fields:n,DefaultAppearance:{flags:s.flags,fontName:c,textColor:s.text_color,textSize:s.text_Size,fullName:d},calculationOrder:o,alignment:u}}))},e.prototype.updateFormControl=function(e,t,n,r){var o=this.engineForm.GetDocument(),i=o.GetIndirectObject(t).GetDict(),u=(0,a.CString)(this.engine,"F"),d=0;i.GetElement(u)&&(d=i.GetElement(u).GetInteger());var l=this.engine;switch(this.changedWidget[t]=1,n){case"exportValue":var f=this.getControlByObjNum(e,t);f.SetExportValue((0,a.CWString)(l,r));for(var h=f.GetField(),p=h.GetControlCount(),m=[],g=0;g<p;g++){var y=h.GetControl(g);m.push(y.GetExportValue().toString())}return m;case"display":switch(r){case 0:d&=-2,d&=-3,d&=-33,d|=4;break;case 1:d&=-2,d&=-33,d|=6;break;case 2:d&=-2,d&=-5,d&=-3,d&=-33;break;case 3:d|=32,d|=4,d&=-3}i.SetAtInteger(u,d);break;case"hidden":r?d|=2:d&=-3,i.SetAtInteger(u,d);break;case"fillColor":case"borderColor":c(l,i,n,r);break;case"action":if(!r.data)break;var _=this.JR.actionManager.create(o,r.data.type);-1==r.trigger?i.SetAtReference((0,a.CString)(l,"A"),_.GetDict(),o):this.addAAToDict(i,_,r),this.JR.actionManager.get(_,o,this.JR).create(r.data);break;case"DA":var v=this.getControlByObjNum(e,t);if(!v)return;var b=JSON.parse(r),S=void 0!==b.fontName?l.DefAPFlags.e_FlagFont.value:0,w=void 0!==b.textColor?l.DefAPFlags.e_FlagTextColor.value:0,M=void 0!==b.textSize?l.DefAPFlags.e_FlagFontSize.value:0,D=void 0;if(b.fontName){var P=(0,s.mapFontName2StdID)(b.fontName);if(P){var T=[l.StandardID.e_StdIDCourier,l.StandardID.e_StdIDCourierB,l.StandardID.e_StdIDCourierBI,l.StandardID.e_StdIDCourierI,l.StandardID.e_StdIDHelvetica,l.StandardID.e_StdIDHelveticaB,l.StandardID.e_StdIDHelveticaBI,l.StandardID.e_StdIDHelveticaI,l.StandardID.e_StdIDTimes,l.StandardID.e_StdIDTimesB,l.StandardID.e_StdIDTimesBI,l.StandardID.e_StdIDTimesI,l.StandardID.e_StdIDSymbol,l.StandardID.e_StdIDZapfDingbats];D=new this.engine.Font(T[P])}else{var k=this.JR.getFontInfoByFontName(b.fontName),A=k.charset,L=k.style;D=new this.engine.Font((0,a.CWString)(l,b.fontName),L,A,0)}}else D=new this.engine.Font(0);var F=new this.engine.DefaultAppearance(S|w|M,D,b.textSize?b.textSize:0,b.textColor?b.textColor:0);try{v.SetDefaultAppearance(F)}catch(e){return isNaN(e)||(e=l.getErrorCode(e)),void console.warn(e)}}},e.prototype.getControlByObjNum=function(e,t){for(var n=this.fields[e].engineField,r=n.GetControlCount(),o=void 0,i=0;i<r;i++){var a=n.GetControl(i);if(t==a.GetDictionaryObjectNumber()){o=a;break}}return o},e.prototype.addAAToDict=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=this.engine,i=this.engineForm;i.GetDocument();if(this.jrDoc.addAA(e,t,n,r),10===n.trigger){for(var s=i.GetFieldsInCalculationOrder(),u=(0,a.CWString)(o,n.field),c=i.GetField(0,u),d=0;d<s.GetSize();d++){var l=s.GetAt(d);if(l.GetName().toString()==c.GetName().toString())return}s.Add(c),i.SetFieldsInCalculationOrder(s)}},e.prototype.hasWidgetChanged=function(e){var t=this.changedWidget[e];return delete this.changedWidget[e],t},e.prototype.copyControls=function(e,t,n){var r=this,o=this.engine,i=this.engineForm,s=(i.GetDocument(),o.TriggerEvent,[]);return n.forEach((function(e){var n=r.getField(e.fieldName),u=n.engineField,c=e.rect,d=c.left,l=c.right,f=c.top,h=c.bottom,p=new o.CFX_FloatRect(d,h,l,f),m=r.getWidget(u,e.srcObjectNumber);if(m){var g=i.AddControl(t.page,(0,a.CWString)(o,e.fieldName),u.GetType(),p);s.push(n);var y=g.GetWidget();r.copyWidget(m,y)}})),t.update(),Promise.all(s.map((function(e){return e.getControlsJson()}))).then((function(e){return s.map((function(t,n){return{fieldName:t.engineField.GetName().toString(),controlJsons:e[n]}}))}))},e.prototype.getWidget=function(e,t){for(var n=0,r=e.GetControlCount();n<r;n++){if(e.GetControl(n).GetDictionaryObjectNumber()==t)return e.GetControl(n).GetWidget()}},e.prototype.copyWidget=function(e,t){var n=this.engine,r=e.GetMKRotation();4!=r.value&&t.SetMKRotation(r);var o=e.GetMKBorderColor();o&&t.SetMKBorderColor(o),(o=e.GetMKBackgroundColor())&&t.SetMKBackgroundColor(o);var i=e.GetMKNormalCaption();i.toString().length&&t.SetMKNormalCaption(i),(i=e.GetMKRolloverCaption()).toString().length&&t.SetMKRolloverCaption(i),(i=e.GetMKDownCaption()).toString().length&&t.SetMKDownCaption(i);var a=e.GetMKNormalIconBitmap();if(a.IsEmpty()||t.SetMKNormalIconBitmap(a),(a=e.GetMKRolloverIconBitmap()).IsEmpty()||t.SetMKRolloverIconBitmap(a),(a=e.GetMKDownIconBitmap()).IsEmpty()||t.SetMKDownIconBitmap(a),1===e.GetField().GetType().value){var s=e.GetMKIconFit();void 0===s.scale_way_type&&(s.scale_way_type=n.ScaleWayType.e_ScaleWayAlways),t.SetMKIconFit(s)}t.SetMKIconCaptionRelation(e.GetMKIconCaptionRelation());var u=e.GetAppearanceState();u.toString().length&&t.SetAppearanceState(u),t.SetBorderInfo(e.GetBorderInfo());var c=e.GetControl();t.GetControl().SetDefaultAppearance(c.GetDefaultAppearance()),t.SetFlags(e.GetFlags());var d=e.GetAction();d.IsEmpty()||t.SetAction(d);for(var l=new n.AdditionalAction.CreateFromAnnot(e),f=new n.AdditionalAction.CreateFromAnnot(t),h=11;h<17;h++){var p=n.TriggerEvent.values[h],m=l.GetAction(p);m.IsEmpty()||f.SetAction(p,m)}t.ResetAppearanceStream()},e.prototype.duplicateWidget=function(e,t,n){var r=this,o=this.getField(t),i=o.engineField,s=this.getWidget(i,n);return e.forEach((function(e){i.GetControlCount(e.page);var n=r.engineForm.AddControl(e.page,(0,a.CWString)(r.engine,t),i.GetType(),s.GetRect()).GetWidget();r.copyWidget(s,n),e.update()})),o.getControlsJson()},e.prototype.duplicateField=function(e,t,n,r,o,i){var s=this,u=this.engine,c=this.engineForm,d=this.jrDoc,l=this.getField(e),f=this.getWidget(l.engineField,n),h=(0,a.CWString)(u,e);return i.map((function(e){var n=e.left,r=e.right,o=e.top,i=e.bottom,a=new u.CFX_FloatRect(n,i,r,o);return c.AddControl(t.page,h,l.engineField.GetType(),a)})).map((function(e){var t=e.GetWidget();return s.copyWidget(f,t),e})).splice(0,0,l.engineField.GetControl(0)),delete d.form,this.destroy(),t.update(),d},e.prototype.setCO=function(e){var t=this.engine,n=this.engineForm,r=new t.FieldArray;e.forEach((function(e){var o=(0,a.CWString)(t,e);r.Add(n.GetField(0,o))})),n.SetFieldsInCalculationOrder(r)},e}(),c=function(e,t,n,r){try{n="fillColor"==n?"BG":"BC";var o=t.GetElement((0,a.CString)(e,"MK"));if(!o)return void console.error("no MK Dictionary");o=o.GetDict();var i=(0,a.CString)(e,n);if(0===r)return void o.RemoveAt(i);var s=o.GetElement(i);if(s)for(var u=(s=s.GetArray()).GetElementCount(),c=[e.PDFObject.CreateFromFloat(((16711680&r)>>16)/256),e.PDFObject.CreateFromFloat(((65280&r)>>8)/256),e.PDFObject.CreateFromFloat((255&r)/256)],d=0;d<=u-1;d++)c[d]&&s.SetAt(d,c[d]);else(s=e.PDFArray.Create()).AddFloat(((16711680&r)>>16)/256),s.AddFloat(((65280&r)>>8)/256),s.AddFloat((255&r)/256);o.SetAt(i,s)}catch(e){console.error(e)}};t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=s(n(632)),o=n(3),i=s(n(38)),a=n(633);function s(e){return e&&e.__esModule?e:{default:e}}var u={e_KeyNameSigner:"signer",e_KeyNameLocation:"location",e_KeyNameReason:"reason",e_KeyNameContactInfo:"contact",e_KeyNameDN:"DN",e_KeyNameText:"text"},c=function(){function e(t,n,r,o,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.jrDoc=t,this.engineForm=n,this.engineField=r,this.engine=o,this.JR=i,this.label=""}return e.prototype.destroy=function(){this.engineField.delete(),this.engineForm=null,this.engineField=null,this.engine=null,this.JR=null},e.prototype.update=function(e,t){var n=this,r=this.engineField,s=this.engine,u=void 0,c=void 0,d=r.GetValue(),l=!1;switch(e){case"align":r.SetAlignment({value:t});break;case"flag":var f=r.GetDict(),h=(0,o.CString)(s,"Ff"),p=f.GetElement(h);l=16789512&((p?p.GetInteger():0)^t),r.SetFlags(t);break;case"maxLength":if(void 0===t){var m=new s.String("MaxLen");r.GetDict().RemoveAt(m),(0,i.default)(m)}else r.SetMaxLength(t);break;case"defaultValue":if(void 0===t){var g=new s.String("DV");r.GetDict().RemoveAt(g),(0,i.default)(g)}else c=new s.WString(t),r.SetDefaultValue(c),(0,i.default)(c);break;case"clearItems":var y=new s.ChoiceOptionArray;r.SetOptions(y),(0,i.default)(y);break;case"deleteItems":u=r.GetOptions();for(var _=new s.ChoiceOptionArray,v=0,b=u.GetSize();v<b;v++){var S=u.GetAt(v);if(v!=t)_.Add(S);else{r.GetValue().toString();S.option_value.toString()}}r.SetOptions(_),(0,i.default)(_);break;case"insertItemAt":var w=new s.ChoiceOption;w.option_value=new s.WString(""+t.value),w.option_label=new s.WString(t.label),w.selected=t.selected,w.default_selected=t.defaultSelected,u=r.GetOptions(),t.index<0||t.index>=u.GetSize()?u.Add(w):u.InsertAt(t.index,w),r.SetOptions(u),(0,i.default)(w,w.option_value,w.option_label);break;case"alternateName":if(""==t){var M=new s.String("TU");r.GetDict().RemoveAt(M),(0,i.default)(M);break}c=new s.WString(t),r.SetAlternateName(c),(0,i.default)(c);break;case"textColor":var D=r.GetDefaultAppearance();D.text_color=+t,r.SetDefaultAppearance(D);break;case"setItems":u=new s.ChoiceOptionArray;var P=!1;t.map((function(e){if(0!==e.value.length&&0!==e.label.length){var t=new s.ChoiceOption;t.option_value=new s.WString(""+e.value),t.option_label=new s.WString(""+e.label),(t.selected=e.selected)&&(P=!0,n.label=t.option_label),t.default_selected=e.defaultSelected,u.Add(t),(0,i.default)(t,t.option_value,t.option_label)}})),r.SetOptions(u),4==r.GetType().value&&P&&r.SetValue(this.label);break;case"displayValue":r.SetValue((0,o.CWString)(s,t)),this.label=t;break;case"AA":var T,k=t.trigger,A=t.data,L=this.JR.actionManager,F=this.jrDoc.doc;T=L.create(F,A.type),this.jrDoc.form.addAAToDict(r.GetDict(),T,{trigger:k,field:t.field});var I=L.get(T,this.jrDoc,this.JR);return I.create(A),I.toJson()}for(var x=r.GetControlCount(),C=0;C<x;C++){var R=r.GetControl(C).GetWidget();R.IsEmpty()||(l||"flag"!=e||t&a.FieldFlag.ButtonRadiosInUnison)&&R.ResetAppearanceStream()}this.label.length>0&&r.GetDict().SetAtWString((0,o.CString)(s,"V"),d);4==r.GetType().value&&(this.label="")},e.prototype.setValue=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Array.isArray(e)&&(e=e.map((function(e){return"("+e+")"})).join(""));var n=new this.engine.WString(e+"");if(this.engineField.SetValue(n),n.delete(),this.label="",t){var r=this.engineField,o=r.GetType(),i=r.GetValue();if(4==o.value)for(var a=r.GetOptions(),s=(i.toString(),0),u=a.GetSize();s<u;s++){var c=a.GetAt(s);if(c.selected){r.SetValue(c.option_label);break}}for(var d=0;d<this.engineField.GetControlCount();d++){var l=this.engineField.GetControl(d).GetWidget();!l.IsEmpty()&&l.ResetAppearanceStream()}4==o.value&&r.SetValue(i)}},e.prototype.getValue=function(){var e=this.engineField.GetFlags(),t=this.engineField.GetType().value;if(256==(256&e)&&5===t){for(var n=this.engineField.GetOptions(),r=[],o=0,i=n.GetSize();o<i;o++){var a=n.GetAt(o);a.selected&&r.push(a.option_value.toString())}return r}return this.engineField.GetValue().toString()},e.prototype.getControlsJson=function(){for(var e=[],t=this.engineField.GetControlCount(),n=0;n<t;n++){var o=this.engineField.GetControl(n),i=new r.default(this.jrDoc,o,this.engine);e.push(i.toJson()),i.destroy()}return Promise.all(e)},e.prototype.toJson=function(e){var t=this;try{for(var n=this.engineField,i=n.GetAlignment().value,a=n.GetAlternateName().toString(),s=[],u=n.GetControlCount(),c=0;c<u;c++){var d=n.GetControl(c);d=new r.default(this.jrDoc,d,this.engine),s.push(d.toJson()),d.destroy()}return Promise.all(s).then((function(e){var r=n.GetDefaultAppearance(),s=n.GetDefaultValue().toString(),u=0,c=n.GetDict();if(c){var d=(0,o.CString)(t.engine,"Ff"),l=c.GetElement(d);l&&(u=l.GetInteger())}var f=n.GetMappingName().toString(),h=n.GetMaxLength(),p=n.GetName().toString(),m=n.GetValue().toString(),g=n.GetType().value,y=n.GetOptions(),_=[];if(4===g||5===g){for(var v=[],b=0,S=y.GetSize();b<S;b++){var w=y.GetAt(b);_.push({label:w.option_label.toString(),value:w.option_value.toString(),selected:w.selected,defaultSelected:w.default_selected}),w.selected&&v.push(w.option_value.toString())}5===g&&(m=v.length>0?v.length>1?v:v[0]:"")}var M=n.GetTopVisibleIndex(),D=n.IsEmpty(),P="",T=!1;try{if(!r.font.IsEmpty()){var k=t.engineForm.GetDocument();P=t.JR.getPDFString(r.font.GetName()),T=r.font.IsEmbedded(k)}}catch(e){isNaN(e)||(e=engine.getErrorCode(e)),console.warn(e)}var A={alignment:i,alternateName:a,controls:e,DA:{flags:r.flags,fontName:P,textColor:r.text_color,textSize:r.text_size,isEmbedded:T},defaultValue:s,flag:u,mappingName:f,maxLength:h,name:p,options:_,topVisibleIndex:M,type:g,value:m,isEmpty:D,AA:t.getAAJson()};return 7===g&&t.getSignatureInfo(A),A}))}catch(e){return isNaN(e)||(e=engine.getErrorCode(e)),console.warn(e),{}}},e.prototype.getAAJson=function(){var e={},t=this.engineField.GetDict(),n=this.engine,r=t.GetElement((0,o.CString)(n,"AA"));if(r&&r.GetDict()){9==r.GetType().value&&(r=r.GetDirectObject());for(var i=r.GetDict(),a=new n.AdditionalAction(this.engineForm.GetDocument(),i),s=n.TriggerEvent,u=7;u<17;u++){var c=a.GetAction(s.values[u]);c.IsEmpty()||(e[u]=this.JR.actionManager.get(c,this.jrDoc,this.JR).toJson())}}return e},e.prototype.getSignatureInfo=function(e){var t=this.engine,n=this.engineField,r=e.isSigned=n.IsSigned(),i=n.GetFieldMDPAction().value,a=(e.lockAction={type:i},e.lockAction.fields=[]);if(i>1)for(var s=n.GetFieldMDPActionFields(),c=0;c<s.GetSize();c++)a.push(s.GetAt(c).toString());if(r){e.filter=n.GetFilter().toString(),e.subfilter=n.GetSubFilter().toString(),Object.keys(u).forEach((function(r){e[u[r]]=n.GetKeyValue(t.KeyName[r]).toString()}));var d=n.GetSignTime();d.IsValid()&&(d=d.ToUTCTime(),e.signTime=Date.UTC(d.year,d.month-1,d.day,d.hour,d.minute,d.second,d.milliseconds)),e.apFlag=n.GetAppearanceFlags(),e.isTimeStamp=n.IsTimeStamp();var l=n.GetDict(),f=n.GetBitmap();e.image=f.IsEmpty()?"":this.bitmapParseBlob(f),f.delete();var h=l.GetElement((0,o.CString)(t,"V")).GetDict().GetElement((0,o.CString)(t,"ByteRange")).GetArray(),p=e.byteRange=[];if(h)for(var m=h.GetElementCount(),g=0;g<m;g++)p.push(h.GetElement(g).GetInteger())}},e.prototype.setLockAction=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=this.engine,r=new n.WStringArray;0!=e?(t.forEach((function(e){r.Add((0,o.CWString)(n,e))})),this.engineField.SetFieldMDPActionFields({value:e},r)):this.engineField.GetDict().RemoveAt((0,o.CString)(n,"Lock"))},e.prototype.bitmapParseBlob=function(e){var t=this.engine,n="";if(!e.IsEmpty()){e.ConvertFormat(t.DIBFormat.e_DIBArgb);var r=e.GetWidth(),o=e.GetHeight(),i=e.GetBuffer(),a=o*e.GetPitch(),s=i+a,u=void 0;u=t.HEAPU8.buffer.slice?t.HEAPU8.buffer.slice(i,s):new Uint8Array(t.HEAPU8.buffer,i,a).buffer;var c=new Uint8Array(u),d=0,l=0,f=e.GetPitch();for(d=0;d<o;d++)for(l=0;l<r;l++){var h=d*f,p=[c[4*l+2+h],c[4*l+h]];c[4*l+h]=p[0],c[4*l+2+h]=p[1]}n={start:i,size:a,width:r,height:o,buffer:u}}return n},e}();t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.jrDoc=t,this.engineControl=n,this.engine=r}return e.prototype.destroy=function(){this.engineControl.delete(),this.engineControl=null,this.engine=null},e.prototype.toJson=function(){var e=this.engineControl,t=e.GetIndex(),n=e.IsChecked(),r=e.IsDefaultChecked(),o=e.IsEmpty();if(o)return{};var i=e.GetExportValue().toString(),a=e.GetDictionaryObjectNumber(),s=void 0,u=void 0,c="",d="";s=e.GetDefaultAppearance();try{s.font.IsEmpty()||(u=s.font.IsEmbedded(this.jrDoc.doc),c=s.font.GetName().toString(),d=(d=s.font.GetFamilyName().toString()).replace(" ","").replace("-",""),s.font.IsBold()&&(d+="Bold"),s.font.IsItalic()&&(d+="Italic"))}catch(e){isNaN(e)||(e=engine.getErrorCode(e)),console.warn(e)}return Promise.resolve().then((function(e){return Object.assign({},{index:t,isChecked:n,isDefaultChecked:r,isEmpty:o,objectNumber:a,exportValue:i},s?{DA:{flags:s.flags,textColor:s.text_color,textSize:s.text_size,isEmbedded:u,fontName:c,fullName:d}}:{})}))},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={ReadOnly:1,Required:2,NoExport:4,Hidden:8,ButtonNoToggleToOff:16384,ButtonRadiosInUnison:33554432,TextMultiline:4096,TextPassword:8192,TextDoNotSpellCheck:4194304,TextDoNotScroll:8388608,TextComb:16777216,ComboEdit:262144,ChoiceMultiSelect:2097152,CommitOnSelChange:67108864,inUnison:function(e){return e&r.ButtonRadiosInUnison},isHidden:function(e){return e&r.Hidden},isReadOnly:function(e){return e&r.ReadOnly},isRequired:function(e){return e&r.Required},isNoExport:function(e){return e&r.NoExport},isMultiline:function(e){return e&r.TextMultiline},isPassword:function(e){return e&r.TextPassword},isComb:function(e){return e&r.TextComb},isNoSpellCheck:function(e){return e&r.TextDoNotSpellCheck},isNoScroll:function(e){return e&r.TextDoNotScroll},isComboEdit:function(e){return e&r.ComboEdit},isChoiceMultiSelect:function(e){return e&r.ChoiceMultiSelect}},o={FlagExclude:1,FlagIncludeNoValueFields:2,FlagExportFormat:4,FlagGetMethod:8,FlagWithCoordinates:16,FlagAsXFDF:32,FlagIncludeAppendSaves:64,FlagIncludeAnnotations:128,FlagSubmitAsPDF:256,FlagCanonicalFormat:512,FlagExclNonUserAnnots:1024,FlagExclFKey:2048,FlagEmbedForm:8192,isExclude:function(e){return e&o.FlagExclude},isIncludeNoValueFields:function(e){return e&o.FlagIncludeNoValueFields},isHTML:function(e){return e&o.FlagExportFormat},isGetMethod:function(e){return e&o.FlagGetMethod},isXFDF:function(e){return e&o.FlagAsXFDF},isPDF:function(e){return e&o.FlagSubmitAsPDF},getType:function(e){var t=o.isHTML(e);if(t)return"HTML";var n=o.isXFDF(e);if(n)return"XFDF";var r=o.isPDF(e);return r?"PDF":t||n||r?void 0:"FDF"}},i={Unknown:0,PushButton:1,CheckBox:2,RadioButton:3,Text:6,ListBox:5,ComboBox:4,Sign:7,Barcode:8},a=r;t.FieldType=i,t.FieldFlag=a,t.FormActionFlags=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={None:"none",RC4:"rc4",AES128:"aes128",AES256:"aes256"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Unknown:-1,Signature:0,Encryption:1,SignatureAndEncryption:2}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pdfDoc=t,this.pdfObject=n}return e.prototype.getDict=function(){return this.pdfObject.GetDict()},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3);t.default=function(e,t,n,o){var i=new e.HeaderFooterContentGenerator,a=n.contentFormats,s=n.contents,u=[a.TopLeft||(s?[{type:"string",value:s.TopLeft}]:[]),a.TopCenter||(s?[{type:"string",value:s.TopCenter}]:[]),a.TopRight||(s?[{type:"string",value:s.TopRight}]:[]),a.BottomLeft||(s?[{type:"string",value:s.BottomLeft}]:[]),a.BottomCenter||(s?[{type:"string",value:s.BottomCenter}]:[]),a.BottomRight||(s?[{type:"string",value:s.BottomRight}]:[])];u=u.map((function(t){t.forEach((function(t){switch(t.type){case"string":return i.AddString((0,r.CWString)(e,t.value));case"pageNumber":return i.AddPageNumber({value:t.value});case"date":return i.AddDate({value:t.value})}}));var n=i.GenerateContent();i.Clear();var o=n.toString().replace(/([^ ])<</g,"$1 <<");return(0,r.CWString)(e,o)})),i.delete();var c=new e.HeaderFooterContent;c.Set.apply(c,function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(u));var d=void 0;d=o&&t.HasHeaderFooter()?t.GetEditableHeaderFooter():new e.HeaderFooter;var l="number"==typeof n.font?n.font:n.fontId,f=new e.Font({value:l||0}),h=new e.PageNumberRange;n.range?h.Set(n.range.start,n.range.end,{value:n.range.filter||0}):h.Set(1,t.GetPageCount(),{value:0});var p=new e.CFX_FloatRect;if(n.margin){var m=n.margin;p.left=m.left,p.bottom=m.bottom,p.top=m.top,p.right=m.right}return d.Set(f,n.textSize,n.textColor,h,p,n.hasTextShrinked,n.hasFixedSized,n.startPageNumber,c,!1,n.underline),c.delete(),h.delete(),p.delete(),d}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){var r={"./af":229,"./af.js":229,"./ar":230,"./ar-dz":231,"./ar-dz.js":231,"./ar-kw":232,"./ar-kw.js":232,"./ar-ly":233,"./ar-ly.js":233,"./ar-ma":234,"./ar-ma.js":234,"./ar-sa":235,"./ar-sa.js":235,"./ar-tn":236,"./ar-tn.js":236,"./ar.js":230,"./az":237,"./az.js":237,"./be":238,"./be.js":238,"./bg":239,"./bg.js":239,"./bm":240,"./bm.js":240,"./bn":241,"./bn-bd":242,"./bn-bd.js":242,"./bn.js":241,"./bo":243,"./bo.js":243,"./br":244,"./br.js":244,"./bs":245,"./bs.js":245,"./ca":246,"./ca.js":246,"./cs":247,"./cs.js":247,"./cv":248,"./cv.js":248,"./cy":249,"./cy.js":249,"./da":250,"./da.js":250,"./de":251,"./de-at":252,"./de-at.js":252,"./de-ch":253,"./de-ch.js":253,"./de.js":251,"./dv":254,"./dv.js":254,"./el":255,"./el.js":255,"./en-au":256,"./en-au.js":256,"./en-ca":257,"./en-ca.js":257,"./en-gb":258,"./en-gb.js":258,"./en-ie":259,"./en-ie.js":259,"./en-il":260,"./en-il.js":260,"./en-in":261,"./en-in.js":261,"./en-nz":262,"./en-nz.js":262,"./en-sg":263,"./en-sg.js":263,"./eo":264,"./eo.js":264,"./es":265,"./es-do":266,"./es-do.js":266,"./es-mx":267,"./es-mx.js":267,"./es-us":268,"./es-us.js":268,"./es.js":265,"./et":269,"./et.js":269,"./eu":270,"./eu.js":270,"./fa":271,"./fa.js":271,"./fi":272,"./fi.js":272,"./fil":273,"./fil.js":273,"./fo":274,"./fo.js":274,"./fr":275,"./fr-ca":276,"./fr-ca.js":276,"./fr-ch":277,"./fr-ch.js":277,"./fr.js":275,"./fy":278,"./fy.js":278,"./ga":279,"./ga.js":279,"./gd":280,"./gd.js":280,"./gl":281,"./gl.js":281,"./gom-deva":282,"./gom-deva.js":282,"./gom-latn":283,"./gom-latn.js":283,"./gu":284,"./gu.js":284,"./he":285,"./he.js":285,"./hi":286,"./hi.js":286,"./hr":287,"./hr.js":287,"./hu":288,"./hu.js":288,"./hy-am":289,"./hy-am.js":289,"./id":290,"./id.js":290,"./is":291,"./is.js":291,"./it":292,"./it-ch":293,"./it-ch.js":293,"./it.js":292,"./ja":294,"./ja.js":294,"./jv":295,"./jv.js":295,"./ka":296,"./ka.js":296,"./kk":297,"./kk.js":297,"./km":298,"./km.js":298,"./kn":299,"./kn.js":299,"./ko":300,"./ko.js":300,"./ku":301,"./ku.js":301,"./ky":302,"./ky.js":302,"./lb":303,"./lb.js":303,"./lo":304,"./lo.js":304,"./lt":305,"./lt.js":305,"./lv":306,"./lv.js":306,"./me":307,"./me.js":307,"./mi":308,"./mi.js":308,"./mk":309,"./mk.js":309,"./ml":310,"./ml.js":310,"./mn":311,"./mn.js":311,"./mr":312,"./mr.js":312,"./ms":313,"./ms-my":314,"./ms-my.js":314,"./ms.js":313,"./mt":315,"./mt.js":315,"./my":316,"./my.js":316,"./nb":317,"./nb.js":317,"./ne":318,"./ne.js":318,"./nl":319,"./nl-be":320,"./nl-be.js":320,"./nl.js":319,"./nn":321,"./nn.js":321,"./oc-lnc":322,"./oc-lnc.js":322,"./pa-in":323,"./pa-in.js":323,"./pl":324,"./pl.js":324,"./pt":325,"./pt-br":326,"./pt-br.js":326,"./pt.js":325,"./ro":327,"./ro.js":327,"./ru":328,"./ru.js":328,"./sd":329,"./sd.js":329,"./se":330,"./se.js":330,"./si":331,"./si.js":331,"./sk":332,"./sk.js":332,"./sl":333,"./sl.js":333,"./sq":334,"./sq.js":334,"./sr":335,"./sr-cyrl":336,"./sr-cyrl.js":336,"./sr.js":335,"./ss":337,"./ss.js":337,"./sv":338,"./sv.js":338,"./sw":339,"./sw.js":339,"./ta":340,"./ta.js":340,"./te":341,"./te.js":341,"./tet":342,"./tet.js":342,"./tg":343,"./tg.js":343,"./th":344,"./th.js":344,"./tk":345,"./tk.js":345,"./tl-ph":346,"./tl-ph.js":346,"./tlh":347,"./tlh.js":347,"./tr":348,"./tr.js":348,"./tzl":349,"./tzl.js":349,"./tzm":350,"./tzm-latn":351,"./tzm-latn.js":351,"./tzm.js":350,"./ug-cn":352,"./ug-cn.js":352,"./uk":353,"./uk.js":353,"./ur":354,"./ur.js":354,"./uz":355,"./uz-latn":356,"./uz-latn.js":356,"./uz.js":355,"./vi":357,"./vi.js":357,"./x-pseudo":358,"./x-pseudo.js":358,"./yo":359,"./yo.js":359,"./zh-cn":360,"./zh-cn.js":360,"./zh-hk":361,"./zh-hk.js":361,"./zh-mo":362,"./zh-mo.js":362,"./zh-tw":363,"./zh-tw.js":363};function o(e){var t=i(e);return n(t)}function i(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}o.keys=function(){return Object.keys(r)},o.resolve=i,e.exports=o,o.id=639},function(e,t,n){"use strict";function r(e,t){if(!e)throw new Error(t)}function o(e){return"number"==typeof e}function i(e){return o(e)&&Math.floor(e)===e}function a(e){return Math.pow(Math.floor(e),2)!==e}function s(e){return(e%360+360)%360%90==0}function u(e,t,n,r,o){return void 0===r&&(r=!1),void 0===o&&(o=!1),(r?e>=t:e>t)&&(o?e<=n:e<n)}function c(e,t,n){return void 0===n&&(n=.01),Math.abs(e-t)<n}function d(e,t,n){return void 0===n&&(n=.01),c(e.x,t.x)&&c(e.y,t.y)}function l(e){return null!=e}function f(e){return"function"==typeof e}function h(e){return"string"==typeof e}n.r(t),n.d(t,"assertThat",(function(){return r})),n.d(t,"isNumber",(function(){return o})),n.d(t,"isInteger",(function(){return i})),n.d(t,"isSquaredNumber",(function(){return a})),n.d(t,"isValidRotationAngle",(function(){return s})),n.d(t,"isNumberInRange",(function(){return u})),n.d(t,"isSamePoint",(function(){return d})),n.d(t,"isDefined",(function(){return l})),n.d(t,"isFunction",(function(){return f})),n.d(t,"isString",(function(){return h}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.engine=t,this.doc=n,this.attachments=new t.Attachments(n,new t.PDFNameTree(n,{value:3}))}return e.prototype.addEmbeddedFile=function(e,t){var n=this.engine,r=this.doc,o=new n.FileSpec(r,r.GetIndirectObject(t));if(o.IsEmpty())return!1;var i=new n.WString(e),a=this.attachments.AddEmbeddedFile(i,o);return i.delete(),i=null,a},e.prototype.setEmbeddedFile=function(e,t){var n=this.engine,r=this.doc;return!new n.FileSpec(r,r.GetIndirectObject(t)).IsEmpty()&&(!!this.removeEmbeddedFile(e)&&this.addEmbeddedFile(e,t))},e.prototype.removeEmbeddedFile=function(e){var t=new this.engine.WString(e),n=this.attachments.RemoveEmbeddedFile(t);return t.delete(),t=null,n},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(22),o=function(e,t,n){var r=t.GetType().value,o=t.GetWidth(),i=t.GetHeight(),a=t.GetOpacity(),s=t.GetXPosition(),u=t.GetYPosition(),c=t.CanChangeRenderingOrder(e.RenderingOrder.e_RenderingOrderFront),d=t.CanChangeRenderingOrder(e.RenderingOrder.e_RenderingOrderBack),l=n.GetSelectionCount();return{type:r,width:o,height:i,opacity:a,count:l,xPosition:s,yPosition:u,canChangeFront:c,canChangeBack:d,clipPathCount:1===l?n.GetSelection().GetAt(0).GetGraphicsObject().GetClipPathCount():0}},i=function(e){if(e.IsEmpty())return 0;for(var t=4278190080,n=(e=e.ConvertToRGB({value:0})).GetValue(),r=0;r<n.GetSize();r++){t|=(255*n.GetAt(r)|0)<<16-8*r}return t>>>0};function a(e){return e.IsEmpty()?0:e.GetColorSpace().GetColorSpaceType().value}t.default=function(e,t,n){if(t.IsEmpty())return{};if(function(e){var t=e.GetWidth(),n=e.GetHeight(),r=e.GetOpacity(),o=e.GetXPosition(),i=e.GetYPosition();return 0===t&&0===n&&0===r&&0===o&&0===i}(t))return{};switch(t.GetType().value){case 0:break;case 1:return function(e,t,n){var r=o(e,t,n),a=new e.TextObjectUtils(t);r.fontName=a.GetFont(!0).toString(),r.baseFontName=a.GetFont(!1).toString(),r.fontSize=a.GetFontSize(),r.fillColor=i(a.GetFillColor()),r.fillColorSpace=a.GetFillColor().GetColorSpace().GetColorSpaceType().value,r.strokeColor=i(a.GetStrokeColor()),r.strokeColorSpace=a.GetStrokeColor().GetColorSpace().GetColorSpaceType().value,r.horizontalScale=a.GetHorizontalScale(),r.charSpace=a.GetCharSpace(),r.wordSpace=a.GetWordSpace(),r.canRemoveTextKerning=a.CanRemoveTextKerning(),r.canMergeText=a.CanMergeText(),r.canSplitText=a.CanSplitText(),r.canText2Path=a.CanText2Path(),r.isWordSpaceValid=a.IsWordSpaceValid().value,r.fontIsBold=a.GetFontIsBold(),r.fontIsItalic=a.GetFontIsItalic(),r.textMode=a.GetTextMode().value;try{1===r.count?r.text=n.GetSelection().GetAt(0).GetGraphicsObject().GetTextObject().GetText().toString():r.text=""}catch(e){r.text=""}return r}(e,t,n);case 2:return function(e,t,n){var r=o(e,t,n),s=new e.PathObjectUtils(t);r.lineWidth=s.GetLineWidth(),r.miterLimit=s.GetMiterLimit(),r.lineCap=s.GetLineCap().value,r.lineJoin=s.GetLineJoin().value;for(var u=s.GetLineStyle(),c=r.lineStyle=[],d=0;d<u.GetSize();d++){var l=u.GetAt(d);c.push(l)}var f=s.GetFillColor();return r.fillColor=i(f),r.fillColorSpace=a(f),f=s.GetStrokeColor(),r.strokeColor=i(f),r.strokeColorSpace=a(f),r}(e,t,n);case 3:return function(e,t,n){return o(e,t,n)}(e,t,n);case 4:return function(e,t,n){var i=o(e,t,n),a=new e.ShadingObjectUtils(t);i.cursorColor=a.GetGridientCursorColor(),i.cursorLocation=a.GetGridientCursorLocation();var s=i.iCursorIndex=a.GetGridientCursorIndex();i.color=a.GetGridientColorAt(s);for(var u=a.GetGradientColor(),c=i.gradientArray=[],d=0;d<u.GetSize();d++){var l=u.GetAt(d);c.push({from:l.from,to:l.to,fromColor:(0,r.intColorToHex)(l.from_color),toColor:(0,r.intColorToHex)(l.to_color)})}return i}(e,t,n);case 5:return o(e,t,n)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){return{type:t.GetType().value,isEmpty:t.IsEmpty()}};t.default=function(e,t){if(t.IsEmpty())return{};switch(t.GetType().value){case 0:case 1:break;case 2:return function(e,t){var n=r(0,t),o=new e.TextEditor(t),i={isSelect:o.IsSelect(),canPaste:o.CanPaste(),isAdd:o.IsAdd()};return Object.assign(i,n)}(e,t);case 3:break;case 4:return function(e,t){var n=r(0,t),o={isClipPathMode:new e.PathEditor(t).IsClipPathMode()};return Object.assign(o,n)}(e,t);case 5:return function(e,t){var n=r(0,t),o={isReferenceLineWorking:new e.ShadingEditor(t).IsReferenceLineWorking()};return Object.assign(o,n)}(e,t)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.gsdkIns=n,this.pageEditor=t,this.undos=[],this.redos=[],this.editUndos=[],this.editRedos=[],this.aggregateCount=1,this.aggregatedItems=[]}return e.prototype.undo=function(e,t){var n=this.gsdkIns,r=void 0,o=void 0,i=t?"PEUndo":"PERedo";e?t?(r=this.editUndos,o=this.editRedos):(r=this.editRedos,o=this.editUndos):t?(r=this.undos,o=this.redos):(r=this.redos,o=this.undos);var a=r.pop();a&&(Array.isArray(a)?a.forEach((function(e){return n[i](e)})):n[i](a),o.push(a))},e.prototype.aggregateUndo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.aggregateCount=e},e.prototype.OnAddUndo=function(e,t){this.aggregatedItems.unshift(e),this.aggregateCount-=1,this.aggregateCount<=0&&(t?(this.editUndos.push(this.aggregatedItems),this.editRedos=[]):(this.undos.push(this.aggregatedItems),this.redos=[]),this.aggregateCount=1,this.aggregatedItems=[])},e.prototype.OnUndoRedoBeginEdit=function(e){this.editUndos=[],this.editRedos=[]},e.prototype.OnUndoRedoEndEdit=function(e){this.editUndos=[],this.editRedos=[]},e.prototype.destroy=function(){var e=this.gsdkIns;this.aggregateCount=1,this.aggregatedItems.forEach((function(t){e.PEUndoItemRelease(t)})),[this.editRedos,this.editUndos,this.undos,this.redos].forEach((function(t){return t.forEach((function(t){Array.isArray(t)?t.forEach((function(t){return e.PEUndoItemRelease(t)})):e.PEUndoItemRelease(t)}))}))},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.gsdkIns=n,this.pageEditor=t,this.pasteMargin=5,this.graphicArray=null,this.autoCalPastePos=!0,this.lastPageIndex=0,this.selectionX=0,this.selectionY=0,this.selectionHeight=0,this.pasteX=0,this.pasteY=0,this.offsetX=0,this.offsetY=0}return e.prototype.destroy=function(){this.pageEditor=null},e.prototype.CanPasteGraphicObject=function(){return!!this.graphicArray},e.prototype.CopyGraphicObject=function(){var e=this.gsdkIns;this._deleteGraphicArray();for(var t=this.pageEditor.PE.GetSelection(),n=new e.GraphicsObjectArray,r=t.GetSize(),o=-1/0,i=1/0,a=1/0,s=0;s<r;s++){var u=t.GetAt(s).GetGraphicsObject().Clone();n.Add(u);var c=u.GetRect(),d=c.top,l=c.left,f=c.bottom;o=Math.max(d,o),i=Math.min(l,i),a=Math.min(f,a)}this.selectionX=i,this.selectionY=o,this.selectionHeight=o-a,this.pasteX=i,this.pasteY=o,this.offsetY=this.selectionHeight+this.pasteMargin,this.lastPageIndex=this.pageEditor.lastEditorPage.GetPage().GetIndex(),this.graphicArray=n},e.prototype.PasteGraphicObject=function(){var e=this.pageEditor.lastEditorPage.GetPage(),t=e.GetIndex();this.autoCalPastePos&&(this.pasteX+=this.offsetX,this.pasteY-=this.offsetY,t!==this.lastPageIndex?(this.pasteX=0,this.pasteY=e.GetHeight(),this.lastPageIndex=t):this.pasteY<this.selectionHeight/2&&(this.pasteY=this.pageEditor.lastEditorPage.GetPage().GetHeight()));var n=this._pasteGraphicArrayAtPoint(this.pasteX,this.pasteY);return this.autoCalPastePos=!0,n},e.prototype.setPastePos=function(e,t){this.autoCalPastePos=!1,this.pasteX=e,this.pasteY=t},e.prototype._pasteGraphicArrayAtPoint=function(e,t){for(var n=this.gsdkIns,r=e-this.selectionX,o=t-this.selectionY,i=this.graphicArray.GetSize(),a=new n.GraphicsObjectArray,s=0;s<i;s++){var u=this.graphicArray.GetAt(s),c=u.GetRect(),d=u.Clone();this._moveGraphicObject(d,c.left+r,c.top+o),a.Add(d)}return a},e.prototype._moveGraphicObject=function(e,t,n){var r=this.gsdkIns,o=e.GetRect(),i=o.top-o.bottom,a=o.right-o.left,s=new r.CFX_FloatRect;s.top=n,s.bottom=n-i,s.left=t,s.right=t+a;var u=new r.Matrix;u.MatchRect(s,o),e.Transform(u,!0),s.delete()},e.prototype._deleteGraphicArray=function(){if(this.graphicArray){for(var e=this.graphicArray.GetSize(),t=0;t<e;t++)this.graphicArray.GetAt(t).delete();this.graphicArray.delete(),this.graphicArray=null}},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(104);var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.isStandard=!1,this.fontName="",this.fontIns=""}return e.prototype.setDefaultFont=function(e,t){this.isStandard=e.IsStandardFont(t),this.isStandard&&(this.fontName=e.GetBaseFontName(t).toString()),this.fontIns=e},e.prototype.getDefaultFont=function(e){return this.isStandard?new e.Font(this._getStandardID(this.fontName,e)):this.fontIns?this.fontIns:new e.Font(e.StandardID.e_StdIDHelvetica)},e.prototype.getDefaultFontName=function(e){if(this.isStandard)return this.fontName;if(!this.fontIns)return"Helvetica";try{return this.fontIns.GetBaseFontName(e).toString()}catch(e){var t=this.fontIns.GetName().toString();return r.FoxitFontMap[t]||t}},e.prototype._getStandardID=function(e,t){var n=t.StandardID;return{Courier:n.e_StdIDCourier,"Courier-Bold":n.e_StdIDCourierB,"Courier-BoldOblique":n.e_StdIDCourierBI,"Courier-Oblique":n.e_StdIDCourierI,Helvetica:n.e_StdIDHelvetica,"Helvetica-Bold":n.e_StdIDHelveticaB,"Helvetica-BoldOblique":n.e_StdIDHelveticaBI,"Helvetica-Oblique":n.e_StdIDHelveticaI,"Times-Roman":n.e_StdIDTimes,"Times-Bold":n.e_StdIDTimesB,"Times-BoldItalic":n.e_StdIDTimesBI,"Times-Italic":n.e_StdIDTimesI,Symbol:n.e_StdIDSymbol,ZapfDingbats:n.e_StdIDZapfDingbats}[e]||n.e_StdIDHelvetica},e.prototype.destroy=function(){this.fontIns=null},e}();t.default=o},function(e,t,n){"use strict";n.r(t),n.d(t,"VIRTUAL_PAGE_WIDTH",(function(){return s})),n.d(t,"VIRTUAL_PAGE_HEIGHT",(function(){return u}));var r=n(68),o=n.n(r);function i(e,t){var n=Array.prototype.slice.call(t).join(",");throw new Error("Illegal operations on virtual page: "+e+"("+n+")")}function a(e,t,n){var r=new e.Bitmap(t,n,e.DIBFormat.e_DIBRgb32,0,0),o=new e.FX_RECT;o.left=0,o.bottom=0,o.right=t,o.top=n,r.FillRect(4294638330,o);var i=r.GetBuffer(),a=r.GetHeight()*r.GetPitch(),s=i+a;return{buffer:e.HEAPU8.buffer.slice?e.HEAPU8.buffer.slice(i,s):new Uint8Array(e.HEAPU8.buffer,i,a).buffer,bitmap:r}}var s=800,u=300,c=function(){function e(e,t){this.index=e,this.pdfDoc=t,this.isVirtual=!0,this.width=s,this.height=u,this.id=o()("virtual_pdf_page"),this.engine=t.engine}return Object.defineProperty(e.prototype,"page",{get:function(){return i(".page",arguments)},enumerable:!1,configurable:!0}),e.prototype.addJRAnnot=function(){i("addJRAnnot",arguments)},e.prototype.clearEnginePage=function(){i("clearEnginePage",arguments)},e.prototype.reloadAnnots=function(){},e.prototype.hasAnnot=function(){return!1},e.prototype.parsedPage=function(){i("parsedPage",arguments)},e.prototype.reParsePage=function(){i("reParsePage",arguments)},e.prototype.getIndex=function(){return this.index},e.prototype.getObjNumber=function(){},e.prototype.getWidth=function(){return Promise.resolve(this.width)},e.prototype.getHeight=function(){return Promise.resolve(this.height)},e.prototype.getAnnots=function(){return Promise.resolve([])},e.prototype.getAnnotIDList=function(){return[]},e.prototype.getAnnotById=function(){return Promise.resolve(void 0)},e.prototype.getThumb=function(){var e;return e=this.height/this.width>1.29?258/this.height:200/this.width,this.getImageData(e)},e.prototype.getNativeAnnotById=function(){i("getNativeAnnotById",arguments)},e.prototype.getImageDataByTile=function(e,t,n,r,o,i){void 0===o&&(o=1),void 0===i&&(i=0);var s=a(this.engine,n,r),u=s.buffer;return s.bitmap.delete(),u},e.prototype.getImageData=function(e){void 0===e&&(e=1);var t=Math.max(1,this.width*e),n=Math.max(1,this.height*e),r=a(this.engine,t,n),o=r.buffer;return r.bitmap.delete(),Promise.resolve({buffer:o,width:t,height:n})},e.prototype.getRotation=function(){return 0},e.prototype.setRotation=function(){},e.prototype.destroy=function(){},e.prototype.resetBitmapCache=function(){},e.prototype.toJson=function(){return{id:this.id,index:this.index,width:this.width,height:this.height,rotation:0,annotCount:0,matrix:[1,0,0,1,0,0],objectNumber:-1,AA:{},mediaWidth:this.width,mediaHeight:this.height,isCropped:!1,isVirtual:!0,cropBox:{left:0,right:this.width,top:this.height,bottom:0}}},e.prototype.getBitmap=function(e,t,n,r,o,i){if(n.width<1||n.height<1)return Promise.resolve({image:{buffer:void 0},isVirtual:!0});var s=a(this.engine,n.width,n.height),u=s.buffer;return s.bitmap.delete(),Promise.resolve({image:{buffer:u,x:n.x||0,y:n.y||0,width:n.width,height:n.height,isVirtual:!0},isVirtual:!0})},e.prototype.renderAnnots=function(){},e.prototype.getPageAndHighlightBitmap=function(e,t,n,r){return this.getBitmap(e,t,n,0,[],!0)},e.prototype.getAnnotBitmap=function(){i("getAnnotBitmap",arguments)},e.prototype.getAnnotBitmapByRange=function(){i("getAnnotBitmapByRange",arguments)},e.prototype.getAnnotIdAtPoint=function(){i("getAnnotIdAtPoint",arguments)},e.prototype.getAnnotIdAtDevicePoint=function(){i("getAnnotIdAtDevicePoint",arguments)},e.prototype.getCharInfoAtPoint=function(){i("getCharInfoAtPoint",arguments)},e.prototype.getNormalTextPage=function(){i("getNormalTextPage",arguments)},e.prototype.getNormalTextPageSync=function(){i("getNormalTextPageSync",arguments)},e.prototype.removeAnnotById=function(){i("removeAnnotById",arguments)},e.prototype.removeAllAnnot=function(){},e.prototype.addImage=function(){i("addImage",arguments)},e.prototype.addAnnot=function(){i("addAnnot",arguments)},e.prototype.markRedactAnnot=function(){i("markRedactAnnot",arguments)},e.prototype.addAnnotGroup=function(){i("addAnnotGroup",arguments)},e.prototype.getTextRectsAtRect=function(){i("getTextRectsAtRect",arguments)},e.prototype.getTextContinuousRectsAtRect=function(){i("getTextContinuousRectsAtRect",arguments)},e.prototype.getTextContinuousCharInfoAtPoints=function(){i("getTextContinuousCharInfoAtPoints",arguments)},e.prototype.getTextContinuousCharsAtRect=function(){return Promise.resolve("")},e.prototype.getDoubleClickTextCharInfoAtPoint=function(){i("getDoubleClickTextCharInfoAtPoint",arguments)},e.prototype.getTextSearch=function(){i("getTextSearch",arguments)},e.prototype.update=function(){return Promise.resolve({index:this.index,annotIds:[]})},e.prototype.flattern=function(){i("flattern",arguments)},e.prototype.getGraphicsObjectAtPoint_s=function(){return Promise.resolve([])},e.prototype.getGraphicsObjectsCount=function(){return Promise.resolve(0)},e.prototype.getGraphicsObjectByIndex=function(){i("getGraphicsObjectByIndex",arguments)},e.prototype.getGraphicsObjectsInRect=function(){i("getGraphicsObjectsInRect",arguments)},e.prototype.getGraphicsObjectAtPoint=function(){i("getGraphicsObjectAtPoint",arguments)},e.prototype.checkPathObjects=function(){},e.prototype.addWatermark=function(){i("addWatermark",arguments)},e.prototype.pasteAnnot=function(){i("pasteAnnot",arguments)},e.prototype.calcContentBBox=function(){return{}},e.prototype.getBox=function(){return{}},e.prototype.getAnnotIdArrayByOrder=function(){return Promise.resolve([])},e.prototype.getPageDictionary=function(){return Promise.resolve({})},e.prototype.clearDesignerAssitCache=function(){},e.prototype.getSuggestedFormDesignerRect=function(){return Promise.resolve({left:0,right:0,top:0,bottom:0})},e.prototype.getSnappedPoint=function(e){return e},e.prototype.getTextRectCount=function(){return Promise.resolve(0)},e.prototype.getTextByRectIndex=function(){i("getTextByRectIndex",arguments)},e.prototype.normalize=function(){},e}();t.default=c},function(e,t,n){e.exports=n(649)},function(e,t,n){"use strict";var r=n(26),o=n(365),i=n(650),a=n(371);function s(e){var t=new i(e),n=o(i.prototype.request,t);return r.extend(n,i.prototype,t),r.extend(n,t),n}var u=s(n(160));u.Axios=i,u.create=function(e){return s(a(u.defaults,e))},u.Cancel=n(372),u.CancelToken=n(664),u.isCancel=n(370),u.all=function(e){return Promise.all(e)},u.spread=n(665),u.isAxiosError=n(666),e.exports=u,e.exports.default=u},function(e,t,n){"use strict";var r=n(26),o=n(366),i=n(651),a=n(652),s=n(371),u=n(662),c=u.validators;function d(e){this.defaults=e,this.interceptors={request:new i,response:new i}}d.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=s(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&u.assertOptions(t,{silentJSONParsing:c.transitional(c.boolean,"1.0.0"),forcedJSONParsing:c.transitional(c.boolean,"1.0.0"),clarifyTimeoutError:c.transitional(c.boolean,"1.0.0")},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var o,i=[];if(this.interceptors.response.forEach((function(e){i.push(e.fulfilled,e.rejected)})),!r){var d=[a,void 0];for(Array.prototype.unshift.apply(d,n),d=d.concat(i),o=Promise.resolve(e);d.length;)o=o.then(d.shift(),d.shift());return o}for(var l=e;n.length;){var f=n.shift(),h=n.shift();try{l=f(l)}catch(e){h(e);break}}try{o=a(l)}catch(e){return Promise.reject(e)}for(;i.length;)o=o.then(i.shift(),i.shift());return o},d.prototype.getUri=function(e){return e=s(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){d.prototype[e]=function(t,n){return this.request(s(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){d.prototype[e]=function(t,n,r){return this.request(s(r||{},{method:e,url:t,data:n}))}})),e.exports=d},function(e,t,n){"use strict";var r=n(26);function o(){this.handlers=[]}o.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},function(e,t,n){"use strict";var r=n(26),o=n(653),i=n(370),a=n(160);function s(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return s(e),e.headers=e.headers||{},e.data=o.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||a.adapter)(e).then((function(t){return s(e),t.data=o.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(s(e),t&&t.response&&(t.response.data=o.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,n){"use strict";var r=n(26),o=n(160);e.exports=function(e,t,n){var i=this||o;return r.forEach(n,(function(n){e=n.call(i,e,t)})),e}},function(e,t,n){"use strict";var r=n(26);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},function(e,t,n){"use strict";var r=n(369);e.exports=function(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(26);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,o,i,a){var s=[];s.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),r.isString(o)&&s.push("path="+o),r.isString(i)&&s.push("domain="+i),!0===a&&s.push("secure"),document.cookie=s.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)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";var r=n(658),o=n(659);e.exports=function(e,t){return e&&!r(t)?o(e,t):t}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(26),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,a={};return e?(r.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=r.trim(e.substr(0,i)).toLowerCase(),n=r.trim(e.substr(i+1)),t){if(a[t]&&o.indexOf(t)>=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([n]):a[t]?a[t]+", "+n:n}})),a):a}},function(e,t,n){"use strict";var r=n(26);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function o(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=o(window.location.href),function(t){var n=r.isString(t)?o(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var r=n(663),o={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){o[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var i={},a=r.version.split(".");function s(e,t){for(var n=t?t.split("."):a,r=e.split("."),o=0;o<3;o++){if(n[o]>r[o])return!0;if(n[o]<r[o])return!1}return!1}o.transitional=function(e,t,n){var o=t&&s(t);function a(e,t){return"[Axios v"+r.version+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,s){if(!1===e)throw new Error(a(r," has been removed in "+t));return o&&!i[r]&&(i[r]=!0,console.warn(a(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,s)}},e.exports={isOlderVersion:s,assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),o=r.length;o-- >0;){var i=r[o],a=t[i];if(a){var s=e[i],u=void 0===s||a(s,i,e);if(!0!==u)throw new TypeError("option "+i+" must be "+u)}else if(!0!==n)throw Error("Unknown option "+i)}},validators:o}},function(e){e.exports=JSON.parse('{"_args":[["axios@0.21.4","C:\\\\GitLab-Runner\\\\builds\\\\6fFoE8Hs\\\\0\\\\foxit\\\\phantom\\\\cloud\\\\phantompdf_online\\\\foxitwebsdk"]],"_from":"axios@0.21.4","_id":"axios@0.21.4","_inBundle":false,"_integrity":"sha1-xnuQ3AVo5cHPKwuFjEO6KOLtpXU=","_location":"/axios","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"axios@0.21.4","name":"axios","escapedName":"axios","rawSpec":"0.21.4","saveSpec":null,"fetchSpec":"0.21.4"},"_requiredBy":["/"],"_resolved":"https://registry.npmmirror.com/axios/download/axios-0.21.4.tgz","_spec":"0.21.4","_where":"C:\\\\GitLab-Runner\\\\builds\\\\6fFoE8Hs\\\\0\\\\foxit\\\\phantom\\\\cloud\\\\phantompdf_online\\\\foxitwebsdk","author":{"name":"Matt Zabriskie"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"bugs":{"url":"https://github.com/axios/axios/issues"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}],"dependencies":{"follow-redirects":"^1.14.0"},"description":"Promise based HTTP client for the browser and node.js","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"homepage":"https://axios-http.com","jsdelivr":"dist/axios.min.js","keywords":["xhr","http","ajax","promise","node"],"license":"MIT","main":"index.js","name":"axios","repository":{"type":"git","url":"git+https://github.com/axios/axios.git"},"scripts":{"build":"NODE_ENV=production grunt build","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","examples":"node ./examples/server.js","fix":"eslint --fix lib/**/*.js","postversion":"git push && git push --tags","preversion":"npm test","start":"node ./sandbox/server.js","test":"grunt test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"},"typings":"./index.d.ts","unpkg":"dist/axios.min.js","version":"0.21.4"}')},function(e,t,n){"use strict";var r=n(372);function o(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 r(e),t(n.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSummarizeCommentsShowInfoById=t.getAnnotThumbnailBitmap=t.getPaperSizeWidthAndHeight=t.getEngineFontSizeType=t.getEngineSortType=t.getEngineSummaryLayout=void 0;var r,o=n(37),i=(r=o)&&r.__esModule?r:{default:r},a=n(3);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var u={A0:[2384,3370],A1:[1684,2384],A2:[1191,1684],A3:[842,1191],A4:[595,842],A5:[420,595],A6:[298,420],"9_11":[648,792],"10_11":[720,792],"10_14":[720,1008],"11_17":[792,1224],"12_11":[864,792],"15_11":[1080,792],Letter:[612,792],Legal:[612,1008],Screen:[468,373],Tabloid:[792,1224],Ledger:[1224,792],Statement:[396,612],Executive:[522,756],Folio:[612,936],Quarto:[609,780],ANSI_C:[1224,1584],ANSI_D:[1584,2448],ANSI_E:[2448,3168],ANSI_F:[2016,2880],ARCH_A:[648,864],ARCH_B:[864,1296],ARCH_C:[1296,1728],ARCH_D:[1728,2592],ARCH_E:[2592,3456],ARCH_E1:[2160,3024],ARCH_E2:[1872,2736],ARCH_E3:[1944,2808],"B5_(ISO)":[499,709],"B4_(ISO)":[709,1001],"B2_(ISO)":[1417,2004],"B1_(ISO)":[2004,2835],"B5_(JIS)":[516,729],"B4_(JIS)":[729,1032],"B3_(JIS)":[1032,1460],"B2_(JIS)":[1460,2064],"B1_(JIS)":[2064,2920],"B0_(JIS)":[2920,4127]};var c=function(e){var t,n=e.AnnotationSummaryStringID;return s(t={},n.e_AnnotationSummaryStringIDAuthor.value,"author"),s(t,n.e_AnnotationSummaryStringIDDate.value,"date"),s(t,n.e_AnnotationSummaryStringIDPage.value,"page"),s(t,n.e_AnnotationSummaryStringIDType.value,"type"),s(t,n.e_AnnotationSummaryStringIDDocumentTitle.value,"documentTitle"),s(t,n.e_AnnotationSummaryStringIDPageTitle.value,"pageTitle"),s(t,n.e_AnnotationSummaryStringIDNoAnnotations.value,"noAnnotations"),s(t,n.e_AnnotationSummaryStringIDNumber.value,"number"),s(t,n.e_AnnotationSummaryStringIDSubject.value,"subject"),t};t.getEngineSummaryLayout=function(e,t){return e.SummaryLayout["e_SummaryLayout"+t]},t.getEngineSortType=function(e,t){return e.SortType["e_TypeSortBy"+t]},t.getEngineFontSizeType=function(e,t){return e.FontSizeType["e_FontSize"+t]},t.getPaperSizeWidthAndHeight=function(e){return u[e]},t.getAnnotThumbnailBitmap=function(e,t,n){var r=t.url,o=n.requestData("GET",!1,r);return i.default.createImage(e,o).GetFrameBitmap(0)},t.getSummarizeCommentsShowInfoById=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=c(e)[t.value]||"",o=n[r]||"";return new a.CWString(e,o)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3);function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(t){o(this,e),this.pdfDoc=t,this.doc=t.doc,this.engine=t.engine,this.c_articles=new t.engine.Articles(this.doc),this.articles=this.getArticles()}return e.prototype.getArticles=function(){this.engine;for(var e=this.c_articles.GetArticles(),t=e.GetSize(),n=[],r=0;r<t;r++){var o=e.GetAt(r),i=new a(this.pdfDoc,o,r);n.push(i)}return n},e.prototype.toJson=function(){for(var e=this.articles,t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.toJson())}return t},e.prototype.getThreadInfo=function(e){var t=void 0,n=0;for(this.engine;n<this.articles.length;n++){var r=this.articles[n];if(r.c_thread.GetDict().GetObjNum()===e){(t=r).index=n;break}}return t},e.prototype.insertThread=function(e){var t=e.author,n=e.keywords,r=e.subject,o=e.title,i=new this.engine.Thread(this.doc),s=this.articles.length,u=this.c_articles.InsertArticle(s,i);if(u){var c=new a(this.pdfDoc,i,s);u=c.update({author:t,keywords:n,subject:r,title:o}),this.articles.push(c)}return u},e.prototype.removeThread=function(e){var t=this.getThreadInfo(e);if(!t)return!1;var n=t.index,r=(t.thread,this.c_articles.RemoveArticle(n));return r&&this.articles.splice(n,1),r},e}(),a=function(){function e(t,n,r){o(this,e),this.pdfDoc=t,this.doc=t.doc,this.engine=t.engine,this.c_thread=n,this.children=this.getChildren(),this.index=r}return e.prototype.getChildren=function(){for(var e=this.c_thread.GetBeads(),t=e.GetSize(),n=[],r=0;r<t;r++){var o=e.GetAt(r),i=new s(this,o,r);n.push(i)}return n},e.prototype.getThreadInfoJson=function(){var e=this.c_thread,t=e.GetDict().GetObjNum(),n=e.GetThreadInfo();return{objNum:t,author:n.author.toString(),keywords:n.keywords.toString(),subject:n.subject.toString(),title:n.title.toString()}},e.prototype.toJson=function(){var e=this.getThreadInfoJson();return e.no=this.index+1,e.children=this.children.map((function(e){return e.toJson()})),e},e.prototype.update=function(e){var t=e.author,n=e.keywords,o=e.subject,i=e.title,a=this.engine,s=this.c_thread,u=s.GetThreadInfo();void 0!==t&&(u.author=(0,r.CWString)(a,t)),void 0!==n&&(u.keywords=(0,r.CWString)(a,n)),void 0!==o&&(u.subject=(0,r.CWString)(a,o)),void 0!==i&&(u.title=(0,r.CWString)(a,i));var c=s.SetThreadInfo(u);return c?this.getThreadInfoJson():c},e.prototype.getBeadInfo=function(e){var t=void 0,n=0;for(this.engine;n<this.children.length;n++){var r=this.children[n];if(r.c_bead.GetDict().GetObjNum()===e){(t=r).index=n;break}}return t},e.prototype.insertBead=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments[1],n=t.left,r=t.bottom,o=t.right,i=t.top,a=arguments[2],u=this.engine,c=this.c_thread,d=new u.Bead(this.doc);void 0===a&&(a=this.children.length);var l=new s(this,d,a),f=l.update({pageIndex:e,rect:{left:n,bottom:r,right:o,top:i}}),h=c.InsertBead(a,d);return h&&(this.children.splice(a,0,l),this.children.forEach((function(e,t){e.index=t}))),h?f:h},e.prototype.removeBead=function(e){var t=this.getBeadInfo(e);if(!t)return!1;var n=t.index,r=this.c_thread.RemoveBead(n);return r&&(this.children.splice(n,1),this.children.forEach((function(e,t){e.index=t}))),r},e}(),s=function(){function e(t,n,r){o(this,e);var i=t.pdfDoc;this.parentThread=t,this.pdfDoc=i,this.doc=i.doc,this.engine=i.engine,this.c_bead=n,this.index=r}return e.prototype.toJson=function(){var e=this.c_bead,t=e.GetBeadInfo(),n=[this.parentThread.index+1,this.index+1].join("-"),r=e.GetDict().GetObjNum(),o=t.page_index,i=t.rect;return{objNum:r,no:n,pageIndex:o,rect:{left:i.left,right:i.right,bottom:i.bottom,top:i.top}}},e.prototype.update=function(e){var t=e.pageIndex,n=e.rect,r=this.engine,o=this.c_bead,i=o.GetBeadInfo();if(void 0!==t&&(i.page_index=t),void 0!==n){var a=n.left,s=n.bottom,u=n.right,c=n.top,d=r.CFX_FloatRect;i.rect=new d(a,s,u,c)}var l=o.SetBeadInfo(i);return l?this.toJson():l},e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(670),o=u(n(44)),i=u(n(31)),a=u(n(161)),s=u(n(215));function u(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var d=function(){function e(){c(this,e),this.map={}}return e.prototype.getNode=function(e){return this.map[e]},e.prototype.setNode=function(e){var t=e.GetDict().GetObjNum();return this.map[t]=e,t},e.prototype.remove=function(e){var t=e.GetDict().GetObjNum();delete this.map[t]},e.prototype.clear=function(){this.map={}},e}(),l=function(){function e(t,n){c(this,e),this.doc=t,this.engine=n,this.engineDoc=t.doc,this.portfolio=n.Portfolio.CreatePortfolio(this.engineDoc),this.nodeCache=new d}var t,n;return e.prototype.getInfo=function(){for(var e=this.portfolio,t=[],n=this.getSchemaFieldsHandler(),r=0;r<n.GetSize();r++){var o=n.GetAt(r);t.push({isDefaultField:o.IsDefaultField(),isVisible:o.IsVisible(),keyName:o.GetKeyName().toString(),subtypeName:o.GetSubtypeName().toString(),displayName:o.GetDisplayName().toString(),schemaField:o})}return{initialFileSpecKeyName:e.GetInitialFileSpecKeyName().toString(),initialViewMode:e.GetInitialViewMode().value,isSortedInAscending:e.IsSortedInAscending(),sortingFieldKeyName:e.GetSortingFieldKeyName().toString(),fields:t}},e.prototype.setInfo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.engine,n=this.portfolio;if(void 0!==e.fields){var r=n.GetSchemaFields(),o=new t.SchemaFieldArray;(e.fields||[]).forEach((function(e){if(e.isDefaultField){for(var n=void 0,i=0;i<r.GetSize();i++){var a=r.GetAt(i);if(e.keyName===a.GetKeyName().toString()){a.SetVisibility(e.isVisible),n=a;break}}o.Add(n)}else{var s=new t.SchemaField;s.SetKeyName(new t.String(e.keyName)),s.SetSubtypeName(new t.String(e.subtypeName)),s.SetDisplayName(new t.WString(e.displayName)),s.SetVisibility(e.isVisible),o.Add(s)}})),n.SetSchemaFields(o)}void 0!==e.initialFileSpecKeyName&&n.SetInitialFileSpecKeyName(new t.WString(e.initialFileSpecKeyName)),e.initialViewMode&&n.SetInitialViewMode({value:e.initialViewMode}),void 0!==e.isSortedInAscending&&n.SetSortingOrder(e.isSortedInAscending),void 0!==e.sortingFieldKeyName&&n.SetSortingFieldKeyName(new t.String(e.sortingFieldKeyName))},e.prototype.getTreeNode=function(){if(this.engineDoc.IsPortfolio()){var e=this.engine,t=this.portfolio,n=this.getInfo().fields,r=t.GetRootNode();if(!r.IsEmpty()){var o=void 0,i=r.GetNodeType();return i===e.PortfolioNodeType.e_TypeFolder&&(r=new e.PortfolioFolderNode(r),o=this.folderNodeToJSON(r,n)),i===e.PortfolioNodeType.e_TypeFile&&(r=new e.PortfolioFileNode(r),o=this.fileNodeToJSON(r,n)),o}t.delete()}},e.prototype.getInitialNodePath=function(){var e=this.engine,t=this.portfolio,n=this.getInfo(),r=n.initialFileSpecKeyName,o=n.fields,i=t.GetRootNode();i=new e.PortfolioFolderNode(i);var a=[this.folderNodeToJSON(i,o)];if(!r)return a;var s=void 0;if(function t(n){for(var o=0;o<n.GetSize();o++){var i=n.GetAt(o);if(i.GetNodeType()===e.PortfolioNodeType.e_TypeFile){if(i=new e.PortfolioFileNode(i),r===i.GetKeyName().toString()){s=i;break}}else i.GetNodeType()===e.PortfolioNodeType.e_TypeFolder&&t((i=new e.PortfolioFolderNode(i)).GetSortedSubNodes())}}(i.GetSortedSubNodes()),!s||s.GetParentNode().IsEmpty())return a;var u=[];u.unshift(this.fileNodeToJSON(s,o));for(var c=s.GetParentNode();!c.IsEmpty()&&!c.IsRoot();)c=(s=s.GetParentNode()).GetParentNode(),u.unshift(this.folderNodeToJSON(s,o));return u.unshift(this.folderNodeToJSON(i,o)),u},e.prototype.addFiles=function(e,t,n){var r=this,o=this.engine,a=this.nodeCache.getNode(n);if(a&&a.GetNodeType()===o.PortfolioNodeType.e_TypeFolder){for(var s=a.GetSortedSubNodes().GetSize(),u=new FileReaderSync,c=function(t){var n=e[t];if(a.HasSameNameSubNode(new o.WString(n.name),o.PortfolioNodeType.e_TypeFile)){var s=void 0;for(var c in r.nodeCache.map){var d=r.nodeCache.map[c];if(d.GetNodeType()===o.PortfolioNodeType.e_TypeFile&&d.GetFileSpec().GetFileName().toString()===n.name){s=d;break}}s&&r.nodeCache.remove(s)}var l=o.ReaderCallback.implement({Release:function(){},GetSize:function(){return n.size},GetPosition:function(){return n.size},ReadBlock:function(e,t,r){var i=new Uint8Array(u.readAsArrayBuffer(n.slice(t,t+r)));return o.HEAPU8.set(i,e),!0}});a.AddFile(l,new o.WString(n.name)).GetFileSpec().SetModifiedDateTime(i.default.ToDateTime(o,n.lastModified||n.lastModifiedDate))},d=0;d<e.length;d++)c(d);if(void 0!==t){var l=a.GetSortedSubNodes().GetSize(),f=[];for(d=0;d<l-s;d++)f.unshift(l-1-d);this.changeSubNodesOrder(n,f,t)}}},e.prototype.createFolder=function(e,t){var n=this.engine,r=this.nodeCache.getNode(t);if(r&&r.GetNodeType()===n.PortfolioNodeType.e_TypeFolder){var o=r.AddSubFolder(new n.WString(e)),i=this.getInfo().fields;return this.folderNodeToJSON(o,i)}},e.prototype.removeSubNodes=function(e,t){var n=this,r=this.engine,o=this.nodeCache.getNode(e);o&&o.GetNodeType()===r.PortfolioNodeType.e_TypeFolder&&t.forEach((function(e){var t=n.nodeCache.getNode(e);if(t.GetNodeType()===r.PortfolioNodeType.e_TypeFile)n.nodeCache.remove(t);else{!function e(t){for(var o=t.GetSortedSubNodes(),i=0;i<o.GetSize();i++){var a=o.GetAt(i);a.GetNodeType()===r.PortfolioNodeType.e_TypeFile?n.nodeCache.remove(a):e(new r.PortfolioFolderNode(a))}n.nodeCache.remove(t)}(t)}o.RemoveSubNode(t)}))},e.prototype.regenerateTOC=function(e){var t=this,n=this.portfolio.GetTocPageIndexes();this.portfolio.StartGenerateTableOfContents(new this.engine.WString(e),!!n.GetSize(),null);for(var r=this.portfolio.GetTocPageIndexes(),o=[],i=0;i<n.GetSize();i++)o.push(n.GetAt(i));for(var a=[],u=0;u<r.GetSize();u++)a.push(r.GetAt(u));return o.forEach((function(e){if(t.doc.pageIndexMap[e]){var n=t.doc.pageIndexMap[e];delete t.doc.pageIndexMap[e],delete t.doc.pageCache[n.id],delete t.doc.pageIndexPromise[e]}})),{oldIndexes:o,newPages:a.map((function(e){var n=t.engineDoc.GetPage(e),r=new s.default(e,t.doc);return r.page=n,t.doc.updatePageIndexMap(e,r),t.doc.updatePageCache(r),r.toJson()}))}},e.prototype.nodeToJSONByCustomProperty=function(e,t,n,o){if(!e.IsDefaultField())if(n.HasCustomProperty(e)){var i=e.GetSubtypeName().toString();if("N"===i)o[t]=n.GetCustomPropertyIntegerValue(e);else if("S"===i)o[t]=n.GetCustomPropertyStringValue(e).toString();else if("D"===i){var a=(0,r.gsdkDateToLocal)(n.GetCustomPropertyDateTimeValue(e));o[t]=a?a.getTime():-1}else o[t]=""}else o[t]=""},e.prototype.folderNodeToJSON=function(e,t){var n=this,o={};t.forEach((function(t){n.nodeToJSONByCustomProperty(t.schemaField,t.displayName,e,o)}));try{o.Description=e.GetDescription().toString()}catch(e){o.Description=""}var i=(0,r.gsdkDateToLocal)(e.GetCreationDateTime());o.CreationDate=i?i.getTime():-1;var a=(0,r.gsdkDateToLocal)(e.GetModifiedDateTime());return o.ModDate=a?a.getTime():i,o.FileName=e.GetName().toString(),o.subNodeSize=e.GetSortedSubNodes().GetSize(),o.handle=this.nodeCache.setNode(e),o.type=1,o},e.prototype.fileNodeToJSON=function(e,t){var n=this,o={};t.forEach((function(t){n.nodeToJSONByCustomProperty(t.schemaField,t.displayName,e,o)}));var i=e.GetFileSpec();try{o.Description=i.GetDescription().toString()}catch(e){o.Description=""}var a=(0,r.gsdkDateToLocal)(i.GetCreationDateTime());o.CreationDate=a?a.getTime():-1;var s=(0,r.gsdkDateToLocal)(i.GetModifiedDateTime());return o.ModDate=s?s.getTime():a,o.CompressedSize=i.GetCompressedEmbeddedFileSize(),o.Size=i.GetFileSize(),o.FileName=i.GetFileName().toString(),o.subtype=i.GetSubtype().toString(),o.keyName=e.GetKeyName().toString(),o.handle=this.nodeCache.setNode(e),o.type=2,o},e.prototype.getFileStream=function(e,t){var n=t.writeStream,r=this.nodeCache.getNode(e),i=new o.default(r.GetFileSpec(),this);return 0===i.getFileSize()?Promise.resolve(0):i.getStream(n)},e.prototype.getStream=function(e){var t=this,n=this.engine,r=function(r){var i=[],s=new a.default,u=e.map((function(e){return t.nodeCache.getNode(e)})).filter((function(e){return!!e}));return function e(r,a){for(var s=0;s<a.length;s++){var u=a[s];if(u.GetNodeType()===n.PortfolioNodeType.e_TypeFile)!function(){u instanceof n.PortfolioFileNode||(u=new n.PortfolioFileNode(u));var e=new o.default(u.GetFileSpec(),t.doc),a=[],s=e.getStream((function(e,t,n){return a.push(e)})).then((function(){r.file(e.getFileName(),a,{binary:!0})}));i.push(s)}();else{u instanceof n.PortfolioFolderNode||(u=new n.PortfolioFolderNode(u));for(var c=u.GetSortedSubNodes(),d=[],l=0;l<c.GetSize();l++)d.push(c.GetAt(l));e(r.folder(u.GetName().toString()),d)}}}(s,u),Promise.all(i).then((function(){return s.generateAsync({type:"blob"}).then((function(e){return{blob:e,fileName:r}}))}))};if(1===e.length){var i=this.nodeCache.getNode(e[0]);if(i.GetNodeType()===n.PortfolioNodeType.e_TypeFile){var s=new o.default(i.GetFileSpec(),this.doc),u=[];return s.getStream((function(e,t,n){return u.push(e)})).then((function(){return{blob:new Blob(u,{type:"application/octet-stream"}),fileName:s.getFileName()}}))}return r(i.GetName().toString()+".zip")}return r("download.zip")},e.prototype.sendSortFolioParam=(t=regeneratorRuntime.mark((function e(t,n){var r,o,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.engine,this.engineDoc.IsPortfolio()){e.next=3;break}return e.abrupt("return");case 3:return o=this.portfolio,i=new r.String(t),e.next=7,o.SetSortingFieldKeyName(i);case 7:return e.next=9,o.SetSortingOrder(n);case 9:return e.abrupt("return",!0);case 10:case"end":return e.stop()}}),e,this)})),n=function(){var e=t.apply(this,arguments);return new Promise((function(t,n){return function r(o,i){try{var a=e[o](i),s=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(s).then((function(e){r("next",e)}),(function(e){r("throw",e)}));t(s)}("next")}))},function(e,t){return n.apply(this,arguments)}),e.prototype.getPortfolioSubNodes=function(e){var t=this.engine,n=[],r=this.nodeCache.getNode(e);if(!r)throw new Error("Nonexistent portfolio folder node!");var o=r.GetNodeType();if(o!==t.PortfolioNodeType.e_TypeFolder)return n;for(var i=this.getInfo().fields,a=r.GetSortedSubNodes(),s=a.GetSize(),u=0;u<s;u++){var c=a.GetAt(u);(o=c.GetNodeType())===t.PortfolioNodeType.e_TypeFolder&&(c=new t.PortfolioFolderNode(c),n.push(this.folderNodeToJSON(c,i))),o===t.PortfolioNodeType.e_TypeFile&&(c=new t.PortfolioFileNode(c),n.push(this.fileNodeToJSON(c,i)))}return n},e.prototype.getPDFDocByNodeHandle=function(e){var t=this.engine,n=this.nodeCache.getNode(e);if(n&&n.GetNodeType()!==t.PortfolioNodeType.e_TypeFolder){var r=n.GetFileSpec();if(".pdf"===r.GetFileName().toString().substr(-4)){var o=new t.PDFDoc(r.GetFileData(),!1);return o.Load(new t.String("")),o}}},e.prototype.changeSubNodesOrder=function(e,t,n){var r,o=this.engine,i=this.nodeCache.getNode(e);if(i&&i.GetNodeType()!==o.PortfolioNodeType.e_TypeFile){var a=i.GetSortedSubNodes(),s=new Array(a.GetSize()).fill(null);s.forEach((function(e,n,r){t.includes(n)||(r[n]=a.GetAt(n))}));var u=t.map((function(e){return a.GetAt(e)}));(r=s).splice.apply(r,[n,0].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(u))),s=s.filter((function(e){return!!e}));var c=new o.PortfolioNodeArray;s.forEach((function(e){return c.Add(e)})),i.ReorderSubNodes(c)}},e.prototype.moveSubNodeToSubFolderNode=function(e,t,n){var r=this.engine,o=this.nodeCache.getNode(e);if(o&&o.GetNodeType()!==r.PortfolioNodeType.e_TypeFile){var i=this.nodeCache.getNode(n);if(i&&i.GetNodeType()!==r.PortfolioNodeType.e_TypeFile)for(var a=0;a<t.length;a++){var s=this.nodeCache.getNode(t[a]);if(s){var u=void 0,c=void 0;s.GetNodeType()===r.PortfolioNodeType.e_TypeFile?(u=s.GetFileSpec().GetFileName(),c=r.PortfolioNodeType.e_TypeFile):(u=s.GetName(),c=r.PortfolioNodeType.e_TypeFolder);var d=i.HasSameNameSubNode(u,c);o.MoveSubNodeToSubFolderNode(s,i,d)}}}},e.prototype.hasSameNameSubNode=function(e,t,n){var r=this.engine,o=this.nodeCache.getNode(n);if(o&&o.GetNodeType()!==r.PortfolioNodeType.e_TypeFile)return o.HasSameNameSubNode(new r.WString(e),{value:t})},e.prototype.recordPDFFileByPortFolioNode=function(e){var t=this.engine,n=[];for(var r in e){var o=e[r],i=this.nodeCache.getNode(o),a=i.GetNodeType();if(a===t.PortfolioNodeType.e_TypeFile){var s=i.GetFileSpec();if(".pdf"===s.GetFileName().toString().substr(-4)){var u=s.GetFileData(),c=new t.PDFDoc(u,!1);if(c.Load(new t.String(""))===t.ErrorCode.e_ErrPassword){n.push("password");continue}var d=this.doc.JR.getPDFDocByEngineDoc(c);n.push(d.id)}}else a===t.PortfolioNodeType.e_TypeFolder&&this.recursionFolioNodePDFDoc(n,i)}return n},e.prototype.getFolioNodePDFDoc=function(){if(this.engineDoc.IsPortfolio()){var e=this.engine,t=this.portfolio.GetRootNode(),n=new e.PortfolioFolderNode(t);if(!n)throw new Error("Nonexistent portfolio folder node!");return this.recursionFolioNodePDFDoc([],n)}},e.prototype.recursionFolioNodePDFDoc=function(e,t){for(var n=this.engine,r=t.GetSortedSubNodes(),o=r.GetSize(),i=0;i<o;i++){var a=r.GetAt(i),s=a.GetNodeType();if(s===n.PortfolioNodeType.e_TypeFile){var u=(a=new n.PortfolioFileNode(a)).GetFileSpec();if(".pdf"===u.GetFileName().toString().substr(-4)){var c=u.GetFileData(),d=new n.PDFDoc(c,!1);if(d.Load(new n.String(""))===n.ErrorCode.e_ErrPassword)continue;var l=this.doc.JR.getPDFDocByEngineDoc(d);e.push(l.id)}}else if(s===n.PortfolioNodeType.e_TypeFolder){var f=new n.PortfolioFolderNode(a);this.recursionFolioNodePDFDoc(e,f)}}return e},e.prototype.getSchemaFieldsHandler=function(){for(var e=this.engine,t=this.portfolio,n=t.GetSchemaFields(),r=!1,o=!1,i=!1,a=!1,s=!1,u=!1,c=new e.SchemaFieldArray,d=0;d<n.GetSize();d++){var l=n.GetAt(d),f=l.GetSubtypeName().toString();switch(c.Add(l),f){case"F":r=!0;break;case"Desc":o=!0;break;case"ModDate":i=!0;break;case"Size":a=!0;break;case"CompressedSize":s=!0;break;case"CreationDate":u=!0}}var h=function(t,n,r){var o=new e.SchemaField;o.SetSubtypeName(new e.String(t)),o.SetKeyName(new e.String(n)),o.SetDisplayName(new e.WString(r)),o.SetVisibility(!0),c.Add(o)};return r||h("F","FileName","Name"),o||h("Desc","Description","Description"),i||h("ModDate","ModDate","Modified"),a||h("Size","Size","Size"),s||h("CompressedSize","CompressedSize","Compressed size"),u||h("CreationDate","CreationDate","Created"),t.SetSchemaFields(c),t.GetSchemaFields()},e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gsdkDateToLocal=function(e){return new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.milliseconds)}},function(e,t,n){"use strict";n.r(t),t.default={"arialbd_M.ttf":"69d839378ea59b548ce8c1d6e898d4dc","arialbi_M.ttf":"c0dd0b6d0eac90efac9326519a4165a4","ariali_M.ttf":"b70f39d993be031363a37edfd3858a93","arial_M.ttf":"fac7aaa5c76c9ce38db25b46e1a5da24","NotoNaskhArabic-Bold.ttf":"febcd5fae479715518a682af57a1422e","NotoNaskhArabic-Regular.ttf":"f11da773d5e424caa06cbe86b19c8c3b","NotoNirmalaui-Regular.ttf":"8300e4a9865b6231e32e46b1707b8f7b","NotoSans-Bold.ttf":"f0fbfd466cf418784f70671d60b1e3ae","NotoSans-BoldItalic.ttf":"50c48f215078a295208b49554aea3987","NotoSans-Regular.ttf":"7d9f89ded30222fd1266979e91adaf88","NotoSansCanadianAboriginal-Regular.ttf":"462d533ae85cece0541123b8b3572374","NotoSansCherokee-Regular.ttf":"a88159ea01ed8715b9cdd68c4013fccb","NotoSansCJKjp-DemiLight.otf":"30c649feb1b2f3e329d91796c3064110","NotoSansCJKjp-Light.otf":"b81b161eff7c869389aaa6015c04730a","NotoSansCJKjp-Medium.otf":"dd4cedc2ef66c81cab848ad9601e8144","NotoSansCJKjp-Regular.otf":"0501218c178d3763f2f9ae15744eae69","NotoSansCJKjp-Thin.otf":"27428f85a1f9fc06d37b1e4f772b332e","NotoSansCJKkr-DemiLight.otf":"f08d579f072fc995a0d0cf04930601c1","NotoSansCJKkr-Light.otf":"aa338e61e68bf72f6adfd2733847c90d","NotoSansCJKkr-Medium.otf":"3ebac294262ed84a17b4a4787837e23a","NotoSansCJKkr-Regular.otf":"4cf03dc23b8bb8d4a19bdca44c799133","NotoSansCJKkr-Thin.otf":"eae1fc05cf33c41e0031cdd11db599f7","NotoSansCJKtc-DemiLight.otf":"bec6ef360c6e7ac3734b6fe28a4126e2","NotoSansCJKtc-Light.otf":"468d6c5da548fecbda4fd5a23b912166","NotoSansCJKtc-Medium.otf":"f20459bfb276c641f12426b82f4be596","NotoSansCJKtc-Thin.otf":"8ecb59643a91f8e2c041f8fef92b47c2","NotoSansEthiopic-Bold.ttf":"22142e5eb5edaf965ce01e3fc1894c01","NotoSansEthiopic-Regular.ttf":"7e19f7808de91fd1c4c9789a5f0450de","NotoSansGujarati-Bold.ttf":"500303eb9e05a1de5e6c01fd25edf0b7","NotoSansGujarati-Regular.ttf":"a5f559c25908b12d7fcfdaa1600fd9f1","NotoSansHebrew-Bold.ttf":"b2c1b6906d9d77c5672fcc4f4a3c7b61","NotoSansHebrew-Regular.ttf":"681afbd524342551a9b3bf974c0ad433","NotoSansKhmer-Bold.ttf":"4a799c2835ed2e32e92d071add8e4228","NotoSansKhmer-Regular.ttf":"11217ceabbe48efc06cb950ec37189ef","NotoSansLao-Bold.ttf":"12da97798a3838ed577ca954d9d0c34b","NotoSansLao-Regular.ttf":"e5dadb678254367dcc3f91a1863fa74a","NotoSansMongolian-Regular.ttf":"e3426a66b65f03ca853cdc7bea355b8f","NotoSansMonoCJKjp-Regular.otf":"0beee38f74ab3756ada63bd7ce40cbad","NotoSansMonoCJKkr-Regular.otf":"2b7b9ff7c17b0de1c3b5e6059971e8b9","NotoSansMonoCJKsc-Regular.otf":"c24d3cd332ddf3aca147541507e5deec","NotoSansMonoCJKtc-Regular.otf":"fd7b80221cdfbed04eb69a371c0681b8","NotoSansPhagsPa-Regular.ttf":"857df25a1ff86fd325dc35efa2cb749d","NotoSansSC-Black.otf":"1a4015a208e09022a62256eac48eebe7","NotoSansSC-Bold.otf":"6038abbaa72926e043eac1ffc1726fd3","NotoSansSC-DemiLight.otf":"db2514b43a247c427c3732de541c09de","NotoSansSC-Light.otf":"65e7865c68f0062b0673296a266f888a","NotoSansSC-Medium.otf":"0c714136a7e02b5e4820a6c7c8e59be6","NotoSansSC-Regular.otf":"0a1fe01e7d921603e8ba185cdf1be994","NotoSansSC-Thin.otf":"fcc448ce50589e3a5309895b7e2716da","NotoSansSinhala-Bold.ttf":"d90775d13538cfa519812193a5c24986","NotoSansSinhala-Regular.ttf":"408ad25235ba342df73ed40683c5122a","NotoSansSyriacEastern-Regular.ttf":"555d860b3efcbedfd0928856bd0d1678","NotoSansTaiLe-Regular.ttf":"1611c941bde482ee7c5b50a9c4dc5f9f","NotoSansTamil-Bold.ttf":"1bd32f3eab7154c43e689394a8c62033","NotoSansTamil-Regular.ttf":"7a9bd984400243ea3bf443be7a261a6c","NotoSansTCLight.otf":"f5b0408d4cbf63865eba3dc8d9109bfd","NotoSansTelugu-Bold.ttf":"e47d4bd6e1d8a55d48b97b33b6b8b09d","NotoSansTelugu-Regular.ttf":"9c3e0075f045d1943a07b0c06cfde600","NotoSansThaana-Bold.ttf":"9c615895d006c4a4d74c12d5fa3c1eff","NotoSansThaana-Regular.ttf":"59d78c806149e8cc9f12211aabcf71fb","NotoSansThai-Bold.ttf":"269e5db28965fa7d9f7895a23d088c87","NotoSansThai-Regular.ttf":"057fa6d673e2dda7afbf19d4a5d30901","NotoSansTibetan-Bold.ttf":"7c712907f958ccf0ebfbc28bf275154a","NotoSansTibetan-Regular.ttf":"06a4dbcbf8ef798d42383f6f2869d7be","NotoSansYi-Regular.ttf":"9f73151e0398e0bc70c4e9549ff3b046","NotoSerifKhmer-Bold.ttf":"9ed9ad995a6ba799e64a1949ea2e88ad","NotoSerifKhmer-Regular.ttf":"6c7bde29fb840cdeb077cdb66da2d0ad","NotoSerifLao-Bold.ttf":"4d2fb002f26a6e146781a207e315f0c3","NotoSerifLao-Regular.ttf":"730051aa181cefd7357c1eefd1c228b2","NotoSerifThai-Bold.ttf":"d4d31e29ea92a2b72b01edabb8b8483b","NotoSerifThai-Regular.ttf":"657709f54d9b04cf4967fe32e03873ea"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=P(n(31)),o=P(n(673)),i=P(n(674)),a=P(n(675)),s=P(n(676)),u=P(n(679)),c=P(n(680)),d=P(n(681)),l=P(n(682)),f=P(n(683)),h=P(n(684)),p=P(n(685)),m=P(n(686)),g=P(n(687)),y=P(n(688)),_=P(n(689)),v=P(n(690)),b=P(n(691)),S=P(n(692)),w=P(n(693)),M=P(n(694)),D=P(n(695));P(n(696));function P(e){return e&&e.__esModule?e:{default:e}}var T=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.engine=t}return e.prototype.get=function(e,t){var n=this.engine.AnnotType;switch(e.GetType()){case n.e_Highlight:return new o.default(e,t);case n.e_Squiggly:return new d.default(e,t);case n.e_StrikeOut:return new i.default(e,t);case n.e_Underline:return new a.default(e,t);case n.e_Line:return new s.default(e,t);case n.e_PolyLine:return new u.default(e,t);case n.e_FileAttachment:return new h.default(e,t);case n.e_Note:return new l.default(e,t);case n.e_Circle:return new f.default(e,t);case n.e_Caret:return new p.default(e,t);case n.e_Polygon:return new c.default(e,t);case n.e_FreeText:return new g.default(e,t);case n.e_Square:return new m.default(e,t);case n.e_Sound:return new D.default(e,t);case n.e_Ink:return new v.default(e,t);case n.e_Stamp:return new y.default(e,t);case n.e_Link:return new _.default(e,t);case n.e_Screen:return new S.default(e,t);case n.e_Widget:return new b.default(e,t);case n.e_Popup:return new w.default(e,t);case n.e_Redact:return new M.default(e,t);default:return new r.default(e,t)}},e}();t.default=T},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(109),i=(r=o)&&r.__esModule?r:{default:r},a=n(3);function s(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 c(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var d=function(e){function t(){return s(this,t),u(this,e.apply(this,arguments))}return c(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Highlight(e)},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.annot,o=this.engine;return r.GetDict().HasKey((0,a.CString)(o,"AreaHi"))&&(n.isArea=!0),n},t.prototype.setRect=function(t){var n=this.engine,r=new n.QuadPointsArray,o=n.QuadPoints,i=n.PointF;return r.Add(new o(new i(t.left,t.top),new i(t.right,t.top),new i(t.left,t.bottom),new i(t.right,t.bottom))),this.annot.SetQuadPoints(r),this.annot.ResetAppearanceStream(),e.prototype.setRect.call(this,t)},t.prototype.move=function(e,t){var n=this.annot.GetRect(),r=n.left+e,o=n.right+e,i=n.top+t,a=n.bottom+t,s=this.engine,u=new s.QuadPointsArray,c=s.QuadPoints,d=s.PointF;u.Add(new c(new d(r,i),new d(o,i),new d(r,a),new d(o,a))),this.annot.SetQuadPoints(u),u.delete(),this.annot.ResetAppearanceStream();var l=new this.engine.CFX_FloatRect(r,a,o,i),f=this.annot.Move(l);return l.delete(),f},t.prototype.create=function(t){var n=e.prototype.create.call(this,t),r=t.color;return r=r||0==r?r:16776960,this.setBorderColor(r),n},t}(i.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(109);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.StrikeOut(e)},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t);return n.IRT&&"Group"==n.RT&&""==n.intent&&(n.intent="StrikeOutTextEdit"),this.isReplace()&&(n.typeAlias="Replace"),n},t.prototype.updateQuadPointsByCharIndex=function(t,n){return e.prototype.updateQuadPointsByCharIndex.call(this,t,n)},t.prototype.isReplace=function(){var e=this.annot,t=void 0,n=void 0;if(e.IsGrouped()&&(t=e.GetGroupElements())&&2===(n=t.GetSize())){for(var r=["AnnotType_e_StrikeOut","AnnotType_e_Caret"],o=n;o--;){var i=t.GetAt(o);if(-1===r.indexOf(i.GetType().constructor.name))return!1}return!0}return!1},t.prototype.create=function(t){var n=e.prototype.create.call(this,t),r=t.color;return t.subject&&"replace"===t.subject.toLocaleLowerCase()?(r=r||0==r?r:255,this.setBorderColor(r)):(r=r||0==r?r:16711680,this.setBorderColor(r)),n},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(109);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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var a=function(e){function t(n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(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}(this,e.call(this,n,r)),i=o.annot;return o.annot=new o.engine.Underline(i),o._freeSuperAnnot(o.annot,i),o}return i(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Underline(e)},t.prototype.create=function(t){var n=e.prototype.create.call(this,t),r=t.color;return r=r||0==r?r:6736947,this.setBorderColor(r),n},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=n(18),a=(r=i)&&r.__esModule?r:{default:r},s=n(20),u=n(77);n(3);function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(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 l(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var f=function(e){function t(){return c(this,t),d(this,e.apply(this,arguments))}return l(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Line(e)},t.prototype.calculateLength=function(){var e=this.annot.GetMeasureRatio().toString(),t=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD).toString();if(0==t.length&&(t=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString()),0!=e.length){"p"==t&&(t="pica");var n=this.annot.GetEndPoint(),r=this.annot.GetStartPoint(),i=n.x-r.x,a=n.y-r.y,s=Math.sqrt(i*i+a*a),c=e.match(/([\d.]+) (\w+) = ([\d.]+) (\w+)/);if(c){var d=o(c,5),l=d[1],f=d[2],h=d[3],p=d[4];"in"==f&&(f="inch"),f=(0,u.getUnitByName)(f),l=parseFloat(l),h=parseFloat(h),p=(0,u.getUnitByName)(p),s=s*h/f.convertTo(l,u.POINT),s=Math.round(100*s)/100;var m=this.annot.GetContent().toString(),g=m.indexOf("\n"),y=m.lastIndexOf(" "),_=(y>=0&&m.substr(y+1),m.substr(0,-1===g?g:g+1)),v=new this.engine.WString(_+s+" "+t);this.annot.SetContent(v),v.delete()}}},t.prototype.enableCaption=function(e){return this.annot.EnableCaption(e),this.annot.ResetAppearanceStream(),!0},t.prototype.setFillColor=function(e){if("number"!=typeof e)throw new Error("Incorrect color value: "+e);return 0===e?(this.annot.RemoveProperty({value:3}),this.annot.ResetAppearanceStream()):(this.annot.SetStyleFillColor(e),this.annot.ResetAppearanceStream()),[this]},t.prototype.setCaptionOffset=function(e,t){var n=new this.engine.PointF(e,t);this.annot.SetCaptionOffset(n),this.annot.ResetAppearanceStream()},t.prototype.setCaptionPositionType=function(e){},t.prototype.setEndPoint=function(e,t){var n=new this.engine.PointF(e,t);this.annot.SetEndPoint(n),this.calculateLength(),this.annot.ResetAppearanceStream()},t.prototype.setLeaderLineExtensionLength=function(e){this.annot.SetLeaderLineExtensionLength(e),this.annot.ResetAppearanceStream()},t.prototype.setLeaderLineLength=function(e){this.annot.SetLeaderLineLength(e),this.annot.ResetAppearanceStream()},t.prototype.setLeaderLineOffset=function(e){this.annot.SetLeaderLineOffset(e),this.annot.ResetAppearanceStream()},t.prototype.setLineEndStyle=function(e){var t=this.engine.EndingStyle.values[e];this.annot.SetLineEndStyle(t),this.annot.ResetAppearanceStream()},t.prototype.setLineStartStyle=function(e){var t=this.engine.EndingStyle.values[e];this.annot.SetLineStartStyle(t),this.annot.ResetAppearanceStream()},t.prototype.setMeasureConversionFactor=function(e,t){},t.prototype.setMeasureRatio=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.userSpaceValue,n=void 0===t?1:t,r=e.userSpaceUnit,o=void 0===r?"inch":r,i=e.realValue,a=void 0===i?1:i,s=e.realUnit,u=void 0===s?"inch":s,c=new this.engine.String(n+" "+o+" = "+a+" "+u);this.annot.SetMeasureRatio(c),this.calculateLength(),this.annot.ResetAppearanceStream(),c.delete()},t.prototype.setMeasureUnit=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=new this.engine.String(e);this.annot.SetMeasureUnit(this.engine.MeasureType.values[t],n),this.calculateLength(),this.annot.ResetAppearanceStream(),n.delete()},t.prototype.setStartPoint=function(e,t){var n=new this.engine.PointF(e,t);this.annot.SetStartPoint(n),n.delete(),this.calculateLength(),this.annot.ResetAppearanceStream()},t.prototype.create=function(t){var n=e.prototype.create.call(this,t),r=this.annot,o=t.startStyle,i=t.endStyle,a=t.rect,u=t.enableCaption,c=t.startPoint,d=t.endPoint;if(o=o||0,i=i||0,void 0!==s.LineEndingName[o]&&this.setLineStartStyle(o),t.length&&this.setLeaderLineLength(t.length),t.intent==s.Intents.LINE_DIMENSION&&(t.leaderLineLength&&this.setLeaderLineLength(t.leaderLineLength),t.leaderLineExtend&&this.setLeaderLineExtensionLength(t.leaderLineExtend)),t.borderWidth&&this.setBorderWidth(t.borderWidth),t.borderStyle&&this.setBorderStyle(t.borderStyle,t.borderStyleParam),t.styleFillColor&&this.setFillColor(t.styleFillColor),t.fillColor&&this.setFillColor(t.fillColor),s.LineEndingName[i]&&this.setLineEndStyle(i),"boolean"==typeof u&&r.EnableCaption(u),void 0!==c?this.setStartPoint(c.x,c.y):this.setStartPoint(a.left,a.top),void 0!==d?this.setEndPoint(d.x,d.y):this.setEndPoint(a.right,a.bottom),t.measure){this.annot.SetMeasureConversionFactor(0,2);var l=new this.engine.String(t.measure.unit);this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX,l),this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD,l),this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeA,l),this.setMeasureRatio(t.measure.ratio),l.delete()}return this.calculateLength(t.label),n},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t);if(0==n.borderInfo.width){n.borderInfo.width=1;var r=this.annot.GetBorderInfo();r.width=1,this.annot.SetBorderInfo(r)}var o=this.annot.GetCaptionOffset(),i=this.annot.GetCaptionPositionType(),a=this.annot.GetEndPoint(),s=this.annot.GetLeaderLineExtensionLength(),u=this.annot.GetLeaderLineLength(),c=this.annot.GetLeaderLineOffset(),d=this.annot.GetLineEndStyle(),l=this.annot.GetLineStartStyle(),f=this.annot.GetMeasureConversionFactor(0),h=void 0,p=void 0;try{h=this.annot.GetMeasureRatio().toString(),0==(p=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD).toString()).length&&(p=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString())}catch(e){h=this.JR.getHexString(this.annot.GetMeasureRatio()),0==(p=this.JR.getHexString(this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD))).length&&(p=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString())}var m=this.annot.GetStartPoint();n.styleFillColor=this.getFillColor();var g=this.annot.HasCaption(),y={captionOffset:{x:o.x,y:o.y},capPos:i.value,endPoint:{x:a.x,y:a.y},leaderLineExtensionLength:s,leaderLineLength:u,leaderLineOffset:c,endingStyle:d.value,startStyle:l.value,measureConversionFactor:f,measureRatio:h,measureUnit:p,startPoint:{x:m.x,y:m.y},hasCaption:g};return Object.assign(y,n)},t}(a.default);t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PixelUnit=t.Unit=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(157),i=n(155);function a(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var u=t.Unit=function(){function e(t,n){s(this,e),this.fromInchRate=t,this.name=n}return e.prototype.convertTo=function(e,t){return e/this.fromInchRate*t.fromInchRate},e.prototype.convertAreaTo=function(e,t){return e/Math.pow(this.fromInchRate,2)*Math.pow(t.fromInchRate,2)},r(e,[{key:"isPixel",get:function(){return!1}}]),e}();t.PixelUnit=function(e){function t(n){s(this,t);var r=function(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}(this,e.call(this,0,"px"));return r.orientation=n,Object.defineProperty(r,"fromInchRate",{get:function(){var e=(0,i.getDPI)();switch(n){case o.ORIENTATION_HORIZONTAL:return e.x;case o.ORIENTATION_VERTICAL:return e.y;default:return e.x}}}),r}return a(t,e),r(t,[{key:"isPixel",get:function(){return!0}}]),t}(u)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);t.default=e}(n(77));t.default={inch:"inch",custom:"custom",mi:"mi",pt:"pt",ft:"ft",yd:"yd",km:"km",m:"m",cm:"cm",mm:"mm",pica:"pica"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=n(18),a=(r=i)&&r.__esModule?r:{default:r},s=(n(3),n(20),n(77));function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 d(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var l=function(e){function t(){return u(this,t),c(this,e.apply(this,arguments))}return d(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.PolyLine(e)},t.prototype.setLineEndStyle=function(e){var t=this.engine.EndingStyle.values[e];this.annot.SetLineEndStyle(t),this.annot.ResetAppearanceStream()},t.prototype.setLineStartStyle=function(e){var t=this.engine.EndingStyle.values[e];this.annot.SetLineStartStyle(t),this.annot.ResetAppearanceStream()},t.prototype.setFillColor=function(e){if("number"!=typeof e)throw new Error("Incorrect color value: "+e);return 0===e?(this.annot.RemoveProperty({value:3}),this.annot.ResetAppearanceStream()):(this.annot.SetStyleFillColor(e),this.annot.ResetAppearanceStream()),[this]},t.prototype.calculatePerimeter=function(){var e=this.annot.GetMeasureRatio().toString(),t=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD).toString();if(0==t.length&&(t=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString()),0!=e.length){var n=this.annot.GetVertexes();if(!(n.length<2)){var r=e.match(/([\d.]+) (\w+) = ([\d.]+) (\w+)/);if(r){var i=o(r,5),a=i[1],u=i[2],c=i[3],d=i[4];u=(0,s.getUnitByName)(u),a=parseFloat(a),c=parseFloat(c),d=(0,s.getUnitByName)(d);for(var l=0,f=n.GetAt(0),h=1;h<n.GetSize();h++){var p=n.GetAt(h),m=p.x-f.x,g=p.y-f.y,y=Math.sqrt(m*m+g*g);l+=y=y*c/u.convertTo(a,s.POINT),f=p}var _=this.annot.GetContent().toString(),v=_.indexOf("\n"),b=_.lastIndexOf(" "),S=b>=0&&_.substr(b+1),w=_.substr(0,-1===v?v:v+1),M=new this.engine.WString(w+Math.round(100*l)/100+" "+S||t);this.annot.SetContent(M),M.delete()}}}},t.prototype.updateVertexes=function(e,t,n){var r=this.annot.GetVertexes(),o=new this.engine.PointF(t,n);r.SetAt(parseInt(e),o),o.delete(),this.annot.SetVertexes(r),this.calculatePerimeter(),this.annot.ResetAppearanceStream()},t.prototype.setVertexes=function(e){var t=this,n=e.reduce((function(e,n){var r=n.x,o=n.y,i=new t.engine.PointF(r,o);return e.Add(i),i.delete(),e}),new this.engine.PointFArray);this.annot.SetVertexes(n),this.annot.ResetAppearanceStream()},t.prototype.setMeasureRatio=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.userSpaceValue,n=void 0===t?1:t,r=e.userSpaceUnit,o=void 0===r?"inch":r,i=e.realValue,a=void 0===i?1:i,s=e.realUnit,u=void 0===s?"inch":s,c=new this.engine.String(n+" "+o+" = "+a+" "+u);this.annot.SetMeasureRatio(c),this.calculatePerimeter(),this.annot.ResetAppearanceStream(),c.delete()},t.prototype.create=function(t){var n=this,r=e.prototype.create.call(this,t);if(t.vertexes){var o=t.vertexes.reduce((function(e,t){var r=t.x,o=t.y,i=new n.engine.PointF(r,o);return e.Add(i),i.delete(),e}),new this.engine.PointFArray);this.annot.SetVertexes(o)}if(t.fillColor&&this.setFillColor(t.fillColor),t.borderWidth&&this.setBorderWidth(t.borderWidth),t.borderStyle&&this.setBorderStyle(t.borderStyle,t.borderStyleParam),t.startStyle&&this.setLineStartStyle(t.startStyle),t.endStyle&&this.setLineEndStyle(t.endStyle),t.measure){this.annot.SetMeasureConversionFactor(0,2);var i=new this.engine.String(t.measure.unit);this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX,i),this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD,i),this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeA,i),this.setMeasureRatio(t.measure.ratio),i.delete()}return r},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.annot.GetLineEndStyle(),o=this.annot.GetLineStartStyle(),i=this.annot.GetVertexes();n.fillColor=this.getFillColor();var a=this.annot.GetMeasureConversionFactor(0),s=void 0,u=void 0;try{s=this.annot.GetMeasureRatio().toString(),0==(u=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD).toString()).length&&(u=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString())}catch(e){s=this.JR.getHexString(this.annot.GetMeasureRatio()),0==(u=this.JR.getHexString(this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD))).length&&(u=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString())}for(var c=[],d=0;d<i.GetSize();d++){var l=i.GetAt(d);c.push({x:l.x,y:l.y})}var f={endingStyle:r.value,startStyle:o.value,vertexes:c,measureConversionFactor:a,measureRatio:s,measureUnit:u};return Object.assign(f,n)},t}(a.default);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=n(18),a=(r=i)&&r.__esModule?r:{default:r},s=(n(3),n(20),n(77));function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 d(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var l=function(e){function t(){return u(this,t),c(this,e.apply(this,arguments))}return d(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Polygon(e)},t.caculateTriangleArea=function(e,t,n,r){r[FIELD_USER_SPACE_SCALE],r[FIELD_USER_SPACE_UNIT],r[FIELD_REAL_SCALE]},t.caculatePolygonArea=function(e,t){for(var n={x:0,y:0},r=0,o=1;o<=e.length;++o)o<e.length?r+=MathAlgorithm.caculateTriangleArea(n,e[o-1],e[o],t):r+=MathAlgorithm.caculateTriangleArea(n,e[o-1],e[0],t);return Math.abs(r)},t.prototype.calculateArea=function(){var e=this.annot.GetMeasureRatio().toString(),t=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD).toString();if(0==t.length&&(t=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString()),0!=e.length){var n=this.annot.GetVertexes();if(!(n.length<2)){var r=e.match(/([\d.]+) (\w+) = ([\d.]+) (\w+)/);if(r){var i=o(r,5),a=i[1],u=i[2],c=i[3],d=i[4];u=(0,s.getUnitByName)(u),a=parseFloat(a),c=parseFloat(c),d=(0,s.getUnitByName)(d);var l=function(e,t,n){var r=e.x*t.y+t.x*n.y+n.x*e.y-(e.x*n.y+t.x*e.y+n.x*t.y);return r/=2,s.POINT.convertAreaTo(r,u)*Math.pow(c/a,2)},f=function(e){for(var t={x:0,y:0},n=0,r=1;r<=e.GetSize();++r)r<e.GetSize()?n+=l(t,e.GetAt(r-1),e.GetAt(r)):n+=l(t,e.GetAt(r-1),e.GetAt(0));return Math.abs(n)}(n),h=this.annot.GetContent().toString(),p=h.indexOf("\n"),m=h.lastIndexOf(" "),g=m>=0&&h.substr(m+1),y=h.substr(0,-1===p?p:p+1),_=new this.engine.WString(y+Math.round(100*f)/100+" sq "+g||t);this.annot.SetContent(_),_.delete()}}}},t.prototype.updateVertexes=function(e,t,n){var r=this.annot.GetVertexes(),o=new this.engine.PointF(t,n);r.SetAt(parseInt(e),o),o.delete(),this.annot.SetVertexes(r),this.calculateArea(),this.annot.ResetAppearanceStream()},t.prototype.setVertexes=function(e){var t=this,n=e.reduce((function(e,n){var r=n.x,o=n.y,i=new t.engine.PointF(r,o);return e.Add(i),i.delete(),e}),new this.engine.PointFArray);this.annot.SetVertexes(n),this.annot.ResetAppearanceStream()},t.prototype.setMeasureRatio=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.userSpaceValue,n=void 0===t?1:t,r=e.userSpaceUnit,o=void 0===r?"inch":r,i=e.realValue,a=void 0===i?1:i,s=e.realUnit,u=void 0===s?"inch":s,c=new this.engine.String(n+" "+o+" = "+a+" "+u);this.annot.SetMeasureRatio(c),this.calculateArea(),this.annot.ResetAppearanceStream(),c.delete()},t.prototype.create=function(t){var n=e.prototype.create.call(this,t);if(t.vertexes&&this.setVertexes(t.vertexes),t.borderWidth&&this.setBorderWidth(t.borderWidth),t.borderStyle&&this.setBorderStyle(t.borderStyle,t.borderStyleParam),t.fillColor&&this.setFillColor(t.fillColor),t.measure){this.annot.SetMeasureConversionFactor(0,2);var r=new this.engine.String(t.measure.unit);this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX,r),this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD,r),this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeA,r),this.setMeasureRatio(t.measure.ratio),r.delete()}return n},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t);n.fillColor=this.getFillColor();for(var r=this.annot.GetVertexes(),o=[],i=0;i<r.GetSize();i++){var a=r.GetAt(i);o.push({x:a.x,y:a.y})}var s=this.annot.GetMeasureConversionFactor(0),u=void 0,c=void 0;try{u=this.annot.GetMeasureRatio().toString(),0==(c=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD).toString()).length&&(c=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString())}catch(e){u=this.JR.getHexString(this.annot.GetMeasureRatio()),0==(c=this.JR.getHexString(this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD))).length&&(c=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString())}var d={vertexes:o,measureRatio:u,measureUnit:c,measureConversionFactor:s};return Object.assign(d,n)},t.prototype.setFillColor=function(t){return e.prototype._setFillColor.call(this,t)},t}(a.default);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(109);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Squiggly(e)},t.prototype.create=function(t){var n=e.prototype.create.call(this,t),r=t.color;return r=r||0==r?r:16737843,this.setBorderColor(r),n},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(18),i=(r=o)&&r.__esModule?r:{default:r},a=n(20),s=n(3);function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 d(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var l=function(e){function t(){return u(this,t),c(this,e.apply(this,arguments))}return d(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Note(e)},t.prototype.setIconName=function(e){var t=this.annot;return t.SetIconName((0,s.CString)(this.engine,e)),t.ResetAppearanceStream(),!0},t.prototype.setOpenStatus=function(e){return this.annot.SetOpenStatus(e),annot.ResetAppearanceStream(),!0},t.prototype.setStateName=function(e){var t=this.engine.StateModel,n=this.annot;if(!n.IsStateAnnot())return!1;var r=void 0,o=this.engine.MarkupState;switch(n.GetStateModel()){case t.e_StateModelMarked:switch(e){case a.MARKUP_ANNOTATION_STATE.UNMARKED:r=o.e_StateUnmarked;break;case a.MARKUP_ANNOTATION_STATE.MARKED:r=o.e_StateMarked;break;default:throw new Error("Illegal argument: incorrect state name in marked state model: "+e)}break;case t.e_StateModelReview:switch(e){case a.MARKUP_ANNOTATION_STATE.ACCEPTED:r=o.e_StateAccepted;break;case a.MARKUP_ANNOTATION_STATE.CANCELLED:r=o.e_StateCancelled;break;case a.MARKUP_ANNOTATION_STATE.COMPLETED:r=o.e_StateCompleted;break;case a.MARKUP_ANNOTATION_STATE.NONE:r=o.e_StateNone;break;case a.MARKUP_ANNOTATION_STATE.REJECTED:r=o.e_StateRejected;break;case a.MARKUP_ANNOTATION_STATE.DEFERRED:r=o.e_StateDeferred;break;case a.MARKUP_ANNOTATION_STATE.FUTURE:r=o.e_StateFuture;break;default:throw new Error("Illegal argument: incorrect state name in review state model: "+e)}}return n.SetState(r),!0},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t);if(n.flag|=24,n.iconName=this.annot.GetIconName().toString(),this.annot.IsStateAnnot()){var r=this.engine.MarkupState;switch(n.isStateAnnot=!0,this.annot.GetState()){case r.e_StateAccepted:n.state=a.MARKUP_ANNOTATION_STATE.ACCEPTED;break;case r.e_StateCancelled:n.state=a.MARKUP_ANNOTATION_STATE.CANCELLED;break;case r.e_StateCompleted:n.state=a.MARKUP_ANNOTATION_STATE.COMPLETED;break;case r.e_StateNone:n.state=a.MARKUP_ANNOTATION_STATE.NONE;break;case r.e_StateRejected:n.state=a.MARKUP_ANNOTATION_STATE.REJECTED;break;case r.e_StateDeferred:n.state=a.MARKUP_ANNOTATION_STATE.DEFERRED;break;case r.e_StateFuture:n.state=a.MARKUP_ANNOTATION_STATE.FUTURE;break;case r.e_StateUnmarked:n.state=a.MARKUP_ANNOTATION_STATE.UNMARKED;break;case r.e_StateMarked:n.state=a.MARKUP_ANNOTATION_STATE.MARKED;break;default:n.isStateAnnot=!1}var o=this.annot.GetStateModel();o&&(n.stateMode=o.value)}else n.isStateAnnot=!1;return n.isOpen=this.annot.GetOpenStatus(),n},t.prototype.create=function(t){var n=e.prototype.create.call(this,t);return t.icon&&this.setIconName(t.icon),this.annot.ResetAppearanceStream(),n},t}(i.default);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=s(n(18)),i=s(n(76)),a=(n(3),n(77));function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 d(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var l=function(e){function t(){return u(this,t),c(this,e.apply(this,arguments))}return d(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Circle(e)},t.prototype._calculateRectDiffer=function(){var e=this.annot.GetRect(),t=this.annot.GetInnerRect();return i.default.subtract(e,t)},t.prototype.move=function(e,t){var n=this.annot,r=i.default.on(n.GetRect()).move(e,t).extract();return this.annot.Move(r)},t.prototype.setRect=function(e){var t=new this.engine.CFX_FloatRect(e.left,e.bottom,e.right,e.top),n=this.annot.Move(t);return this.annot.ResetAppearanceStream(),t.delete(),this.calculateArea(),n},t.prototype.setInnerRect=function(e){var t=new this.engine.CFX_FloatRect(e.left,e.bottom,e.right,e.top);return this.annot.SetInnerRect(t),this.annot.ResetAppearanceStream(),t.delete(),!0},t.prototype.getInnerRect=function(){return i.default.on(this.annot.GetInnerRect()).toPlainObject()},t.prototype.setAnnotRectAndInnerRect=function(e,t){var n=new this.engine.CFX_FloatRect(e.left,e.bottom,e.right,e.top),r=this.annot.Move(n),o=new this.engine.CFX_FloatRect(t.left,t.bottom,t.right,t.top);return this.annot.SetInnerRect(o),this.annot.ResetAppearanceStream(),o.delete(),n.delete(),this.calculateArea(),r},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.getFillColor(),o=i.default.on(this.annot.GetInnerRect()).toPlainObject(),a=this.annot.GetMeasureConversionFactor(0),s=void 0,u=void 0;try{s=this.annot.GetMeasureRatio().toString(),0==(u=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD).toString()).length&&(u=this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX).toString())}catch(e){s=this.JR.getHexString(this.annot.GetMeasureRatio()),0==(u=this.JR.getHexString(this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD))).length&&(u=this.JR.getHexString(this.annot.GetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX)))}var c={fillColor:r,innerRect:o,measureConversionFactor:a,measureRatio:s,measureUnit:u};return Object.assign(n,c)},t.prototype.setFillColor=function(t){return e.prototype._setFillColor.call(this,t)},t.prototype.create=function(t){var n=e.prototype.create.call(this,t);if(t.borderWidth&&this.setBorderWidth(t.borderWidth),t.fillColor&&this.setFillColor(t.fillColor),t.borderStyle&&this.setBorderStyle(t.borderStyle,t.borderStyleParam),t.measure){this.annot.SetMeasureConversionFactor(0,2);var r=new this.engine.String(t.measure.unit);this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX,r),this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeD,r),this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeA,r),this.setMeasureRatio(t.measure.ratio),r.delete()}return n},t.prototype.calculateArea=function(){var e=this,t=this.annot.GetMeasureRatio().toString(),n=this.annot.GetMeasureUnit(0).toString();if(0!=t.length){var o=t.match(/(\d+) (\w+) = (\d+) (\w+)/);if(o){var i=r(o,5),s=i[1],u=i[2],c=i[3],d=i[4];u=(0,a.getUnitByName)(u),s=parseFloat(s),c=parseFloat(c),d=(0,a.getUnitByName)(d);var l=function(){var t=e.annot.GetRect(),n=(t.right-t.left)*(t.top-t.bottom)*Math.PI;return a.POINT.convertAreaTo(n/4,u)*Math.pow(c/s,2)}(),f=this.annot.GetContent().toString(),h=f.indexOf("\n"),p=f.lastIndexOf(" "),m=p>=0&&f.substr(p+1),g=f.substr(0,-1===h?h:h+1),y=new this.engine.WString(g+Math.round(100*l)/100+" sq "+m||n);this.annot.SetContent(y),y.delete()}}},t.prototype.setMeasureConversionFactor=function(e){this.annot.SetMeasureConversionFactor(0,e),this.calculateArea(),this.annot.ResetAppearanceStream()},t.prototype.setMeasureRatio=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.userSpaceValue,n=void 0===t?1:t,r=e.userSpaceUnit,o=void 0===r?"inch":r,i=e.realValue,a=void 0===i?1:i,s=e.realUnit,u=void 0===s?"inch":s,c=new this.engine.String(n+" "+o+" = "+a+" "+u);this.annot.SetMeasureRatio(c),this.calculateArea(),this.annot.ResetAppearanceStream(),c.delete()},t.prototype.setMeasureUnit=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=new this.engine.String(e);this.annot.SetMeasureUnit(this.engine.MeasureType.values[t],n),this.calculateArea(),this.annot.ResetAppearanceStream(),n.delete()},t}(o.default);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=s(n(18)),o=s(n(44)),i=n(3),a=s(n(31));function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 d(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var l=function(e){function t(){return u(this,t),c(this,e.apply(this,arguments))}return d(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.FileAttachment(e)},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.engine,a=this.annot,s=a.GetDict(),u=new o.default(this.getFileSpec(),this);n.fileSpec=u.toJson();var c=s.GetElement((0,i.CString)(r,"Contents"));if(c&&n.fileSpec){var d=c.GetWideString().toString();d!==n.fileSpec.fileName&&(n.fileSpec.description=d)}n.iconName=a.GetIconName().toString();var l=s.GetElement((0,i.CString)(r,"FS"));return l&&(l=l.GetDirectObject(),n.fObjNum=l.GetObjNum()),n},t.prototype.setIconName=function(e){var t=this.annot;return t.SetIconName(new this.engine.String(e)),t.ResetAppearanceStream(),!0},t.prototype.getFileSpec=function(){return this.annot.GetFileSpec()},t.prototype.create=function(t){var n=e.prototype.create.call(this,t),r=this.engine;try{t.iconName&&this.annot.SetIconName((0,i.CString)(r,t.iconName))}catch(e){console.log(e),isNaN(e)||(e=r.getErrorCode(e)),console.warn(e)}return this.setFile(t),this.annot.ResetAppearanceStream(),n},t.prototype.setFile=function(e){try{if(e.fObjNum){var t=this.doc,n=this.annot.GetDict(),r=new this.engine.String("FS");n.SetAtReference(r,t.GetIndirectObject(+e.fObjNum),t)}else if(e.buffer){var i=o.default.createFile(this.engine,this.annot.GetPage().GetDocument(),e.buffer),s=new o.default(i,this);e.fileName&&s.setFileName(e.fileName),e.file&&e.file.lastModifiedDate&&s.setModifiedDateTime(a.default.ToDateTime(this.engine,e.file.lastModifiedDate)),this.annot.SetFileSpec(i)}}catch(e){var u=this.engine,c=e instanceof u.ErrorCode?e:u.getErrorCode(e);console.warn(c)}return!0},t.prototype.getStream=function(e){var t=e.writeStream;return new o.default(this.getFileSpec(),this).getStream(t)},t}(r.default);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(18),i=(r=o)&&r.__esModule?r:{default:r},a=n(3);function s(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 c(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var d=function(e){function t(){return s(this,t),u(this,e.apply(this,arguments))}return c(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Caret(e)},t.prototype.moveRectByCharIndex=function(e){var t=this.annot,n=this.pdfPage.getNormalTextPageSync(),r=(n.GetTextRectCount(e,1),n.GetTextRect(0));n.delete();var o=t.GetRect(),i=new this.engine.CFX_FloatRect,a=o.right-o.left,s=o.top-o.bottom;i.left=r.right-a/2,i.right=r.right+a/2,i.top=r.bottom+s/5,i.bottom=r.bottom-4*s/5,t.Move(i),t.ResetAppearanceStream(),i.delete()},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.annot.GetInnerRect();return n.innerRect={top:r.top,right:r.right,bottom:r.bottom,left:r.left},this.isReplace()&&""==n.intent&&(n.intent="Replace"),n},t.prototype.create=function(t){var n=e.prototype.create.call(this,t),r=t.color;if(r||(r=t.subject&&"replace"===t.subject.toLocaleLowerCase()?r||0==r?r:255:r||0==r?r:10040217,this.setBorderColor(r)),t.rotation){var o=this.engine,i=new o.Matrix;i.Rotate(-t.rotation,!1),this.annot.GetDict().GetElement((0,a.CString)(o,"AP")).GetDict().GetElement((0,a.CString)(o,"N")).GetDict().SetAtMatrix((0,a.CString)(o,"Matrix"),i),i.delete()}return n},t.prototype.isReplace=function(){var e=this.annot,t=void 0,n=void 0;if(e.IsGrouped()&&(t=e.GetGroupElements())&&2===(n=t.GetSize())){for(var r=["AnnotType_e_StrikeOut","AnnotType_e_Caret"],o=n;o--;){var i=t.GetAt(o);if(-1===r.indexOf(i.GetType().constructor.name))return!1}return!0}return!1},t}(i.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=u(n(18)),i=u(n(76)),a=(n(3),n(20)),s=n(77);function u(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(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 l(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var f=function(e){function t(){return c(this,t),d(this,e.apply(this,arguments))}return l(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Square(e)},t.prototype._calculateRectDiffer=function(){var e=this.annot.GetRect(),t=this.annot.GetInnerRect();return i.default.subtract(e,t)},t.prototype.move=function(e,t){var n=this.annot,r=i.default.on(n.GetRect()).move(e,t).extract();return this.annot.Move(r)},t.prototype.setRect=function(e){var t=new this.engine.CFX_FloatRect(e.left,e.bottom,e.right,e.top),n=this.annot.Move(t);return this.annot.ResetAppearanceStream(),t.delete(),this.calculateArea(),n},t.prototype.setInnerRect=function(e){var t=new this.engine.CFX_FloatRect(e.left,e.bottom,e.right,e.top);return this.annot.SetInnerRect(t),this.annot.ResetAppearanceStream(),t.delete(),!0},t.prototype.setAnnotRectAndInnerRect=function(e,t){var n=new this.engine.CFX_FloatRect(e.left,e.bottom,e.right,e.top),r=this.annot.Move(n),o=new this.engine.CFX_FloatRect(t.left,t.bottom,t.right,t.top);return this.annot.SetInnerRect(o),n.delete(),o.delete(),this.annot.ResetAppearanceStream(),this.calculateArea(),r},t.prototype.getInnerRect=function(){return i.default.on(this.annot.GetInnerRect()).toPlainObject()},t.prototype.setBorderStyle=function(t,n){var r=this.annot.GetBorderInfo(),o=this.engine.BorderInfoStyle,i=e.prototype.setBorderStyle.call(this,t,n);if(t!==a.BORDER_STYLE.CLOUDY&&r.style===o.e_Cloudy){var s=this.annot.GetInnerRect(),u=this.annot.GetRect();this.annot.SetInnerRect(u),this.annot.Move(s),this.annot.ResetAppearanceStream()}return i},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.getFillColor(),o=i.default.on(this.annot.GetInnerRect()).toPlainObject(),a=this.annot.GetMeasureConversionFactor(0),s=void 0,u=void 0;try{s=this.annot.GetMeasureRatio().toString(),u=this.annot.GetMeasureUnit(0).toString()}catch(e){s=this.JR.getHexString(this.annot.GetMeasureRatio()),u=this.JR.getHexString(this.annot.GetMeasureUnit(0))}var c={fillColor:r,innerRect:o,measureConversionFactor:a,measureRatio:s,measureUnit:u};return Object.assign(n,c)},t.prototype.setFillColor=function(t){return e.prototype._setFillColor.call(this,t)},t.prototype.create=function(t){var n=e.prototype.create.call(this,t);if(t.fillColor&&this.setFillColor(t.fillColor),t.borderWidth&&this.setBorderWidth(t.borderWidth),t.borderStyle&&this.setBorderStyle(t.borderStyle,t.borderStyleParam),t.measure){this.annot.SetMeasureConversionFactor(0,2);var r=new this.engine.String(t.measure.unit);this.annot.SetMeasureUnit(this.engine.MeasureType.e_MeasureTypeX,r),this.setMeasureRatio(t.measure.ratio),r.delete()}return n},t.prototype.calculateArea=function(){var e=this,t=this.annot.GetMeasureRatio().toString(),n=this.annot.GetMeasureUnit(0).toString();if(0!=t.length){var o=t.match(/(\d+) (\w+) = (\d+) (\w+)/);if(o){var i=r(o,5),a=i[1],u=i[2],c=i[3],d=i[4];u=(0,s.getUnitByName)(u),a=parseInt(a),c=parseInt(c),d=(0,s.getUnitByName)(d);var l=function(){var t=e.annot.GetRect(),n=(t.right-t.left)*(t.top-t.bottom);return s.POINT.convertAreaTo(n,u)*Math.pow(c/a,2)}(),f=new this.engine.WString(Math.round(100*l)/100+" sq "+n);this.annot.SetContent(f),f.delete()}}},t.prototype.setMeasureConversionFactor=function(e){this.annot.SetMeasureConversionFactor(0,e),this.calculateArea(),this.annot.ResetAppearanceStream()},t.prototype.setMeasureRatio=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.userSpaceValue,n=void 0===t?1:t,r=e.userSpaceUnit,o=void 0===r?"inch":r,i=e.realValue,a=void 0===i?1:i,s=e.realUnit,u=void 0===s?"inch":s,c=new this.engine.String(n+" "+o+" = "+a+" "+u);this.annot.SetMeasureRatio(c),this.calculateArea(),this.annot.ResetAppearanceStream(),c.delete()},t.prototype.setMeasureUnit=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new this.engine.String(e);this.annot.SetMeasureUnit(this.engine.MeasureType.values[t],n),this.calculateArea(),this.annot.ResetAppearanceStream(),n.delete()},t}(o.default);t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(18)),o=n(20),i=u(n(159)),a=n(3),s=n(158);function u(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(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 l(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var f=function(e){function t(){return c(this,t),d(this,e.apply(this,arguments))}return l(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.FreeText(e)},t.prototype.setAlignment=function(e){this.annot.SetAlignment({value:e}),this.annot.ResetAppearanceStream()},t.prototype.getRotation=function(){return 90*this.annot.GetRotation().value},t.prototype.setRotation=function(e){var t=e/90;return this.annot.SetRotation({value:t}),this.annot.ResetAppearanceStream(),[this.getId()]},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.annot;if(n.intent===o.Intents.FREETEXT_CALLOUT){for(var i=r.GetCalloutLineEndingStyle().value,s=r.GetCalloutLinePoints(),u=[],c=s.GetSize();c--;){var d=s.GetAt(c);u[c]={x:d.x,y:d.y}}n.calloutLineEndingStyle=i,n.calloutLinePoints=u}var l=r.GetAlignment().value;n.intent===o.Intents.FREETEXT_TYPEWRITER&&0!==l&&(l=0,r.SetAlignment(this.engine.Alignment.e_AlignmentLeft)),n.justification=l;var f=this.getRotation();n.rotation=f;var h=r.GetDefaultAppearance();n.defaultAppearance={flags:h.flags,textColor:h.text_color,textSize:h.text_size},h.font.IsEmpty()||(n.fontName=h.font.GetName().toString());var p=this.annot.GetDict(),m=(0,a.CString)(this.engine,"RC"),g=p.GetElement(m),y="";g&&(y=this.JR.getPDFString(g.GetString())),n.fillColor=this.getFillColor();var _=r.GetInnerRect();return n.innerRect={top:_.top,right:_.right,bottom:_.bottom,left:_.left},n.RC=y,m=(0,a.CString)(this.engine,"FoxitTag"),p.GetElement(m)&&(n.modifiable=!1),n},t.prototype.setCalloutLineEndingStyle=function(e){this.annot.SetCalloutLineEndingStyle({value:e}),this.annot.ResetAppearanceStream()},t.prototype.setInnerRect=function(e){var t=new this.engine.CFX_FloatRect(e.left,e.bottom,e.right,e.top);return this.annot.SetInnerRect(t),"FreeTextCallout"!=this.annot.GetIntent()&&this.annot.ResetAppearanceStream(),t.delete(),!0},t.prototype.setAnnotRectAndInnerRect=function(e,t){var n=void 0;e.left>e.right&&(n=e.right,e.right=e.left,e.left=n),e.bottom>e.top&&(n=e.top,e.top=e.bottom,e.bottom=n);var r=e.top-e.bottom,o=e.right-e.left,i=this.annot.GetRect(),a=!0;Math.abs(r-i.right+i.left)<.01&&Math.abs(o-i.top+i.bottom)<.01&&(a=!1);var s=new this.engine.CFX_FloatRect(e.left,e.bottom,e.right,e.top),u=this.annot.Move(s),c=new this.engine.CFX_FloatRect(t.left,t.bottom,t.right,t.top);return this.annot.SetInnerRect(c),s.delete(),c.delete(),u&&(this.updateModifyTime(),a&&this.annot.ResetAppearanceStream(),this.pdfPage.resetBitmapCache()),u},t.prototype.setCalloutLinePoints=function(e){for(var t=new this.engine.PointFArray,n=this.engine.PointF,r=e.length,o=0;o<r;o++){var i=new n(e[o].x,e[o].y);t.Add(i),i.delete()}return this.annot.SetCalloutLinePoints(t),this.annot.ResetAppearanceStream(),t.delete(),!0},t.prototype.setDefaultAp=function(e){var t=e.textColor,n=e.textSize,r=e.font;0===t&&(t|=4278190080,t>>>=0);var o=new this.engine.Font(1),i=1;if(r){var s=r.name,u=r.styles,c=r.charset;i=this.engine.DefAPFlags.e_FlagFont.value,o=new this.engine.Font((0,a.CWString)(this.engine,s),u||0,this.engine.Charset.values[c]||this.engine.Charset.e_CharsetANSI,0)}if(t&&(i|=2),n&&(i|=4),i){var d=new this.engine.DefaultAppearance(i,o,n,t);return this.annot.SetDefaultAppearance(d),this.annot.ResetAppearanceStream(),o.delete(),d.delete(),!0}},t.prototype.setFillColor=function(t){return e.prototype._setFillColor.call(this,t)},t.prototype.create=function(t){if(e.prototype.create.call(this,t),t.rotation){var n=(0,s.convertToGSDKRotate)(this.engine,t.rotation);this.annot.SetRotation(n)}var r;(r=t["interior-color"]||t.interiorColor)&&this.setFillColor(r),t.fillColor&&this.setFillColor(t.fillColor),t.alignment&&this.setAlignment(t.alignment);var o;if((o=t.contents)&&this.setContent(o),t.borderWidth&&this.setBorderWidth(t.borderWidth),t.borderStyle&&this.setBorderStyle(t.borderStyle,t.borderStyleParam),t.DA){var i=this.engine;this.annot.GetDict().SetAtString((0,a.CString)(i,"DA"),(0,a.CString)(i,t.DA));var u={textColor:t.fontColor,textSize:Number(t.DA.split(" ")[1])};this.setDefaultAp(u)}if(t.defaultAppearance&&"{}"!==JSON.stringify(t.defaultAppearance)){this.engine,this.annot.GetDict();var c={textColor:t.defaultAppearance.textColor?Number(t.defaultAppearance.textColor):4278190080,textSize:t.defaultAppearance.textSize?Number(t.defaultAppearance.textSize):0};this.setDefaultAp(c)}if(this.setRect(t.rect),t.innerRect&&this.setInnerRect(t.innerRect),t.calloutLinePoints&&this.setCalloutLinePoints(t.calloutLinePoints),"FreeTextCallout"==t.intent){var d=t.calloutLineEndingStyle||t.startStyle;null==d?this.setCalloutLineEndingStyle(4):this.setCalloutLineEndingStyle(d)}return[this]},t.prototype.getWoffBlob=function(){var e=this.annot;if(!e.GetDefaultAppearance().font.IsEmpty()){var t="",n=(e.GetDict().GetElement(new this.engine.String("DA")).GetString().toString()+" ").match(/\/([^\s]*) /);if(n&&n.length>1){t=n[1].replace(/#20/g," ");var r=this.JR.getFontBuffer(t.toString(),524322);if(r)return new Blob([r],{type:"application/woff"})}return null}},t.prototype.getWoff=function(){var e=this.engine,t=this.annot.GetDefaultAppearance(),n=this.pdfPage.doc,r=t.font;if(r.IsEmpty())return null;if(r.IsEmbedded(n))return i.default.getWoffDataBuffer(r.GetWoffData(n),this.engine);var o=e.Charset.e_CharsetDefault.value;r.GetFontType(n)==e.FontTypes.e_FontTypeCIDFont&&(o=r.GetFontType(n).value);var a=this.JR.getFontBuffer(r.GetBaseFontName(n).toString(),r.GetStyles(n),0,o,r.IsBold()?700:400,!0);return a?{buffer:a}:null},t.prototype.setContent=function(t){var n=this.annot,r=n.GetDict(),o=n.GetDefaultAppearance(),i=(0,a.CString)(this.engine,"RC");return r.GetElement(i)&&r.RemoveAt(i),n.SetDefaultAppearance(o),e.prototype.setContent.call(this,t,!0)},t}(r.default);t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(18)),o=a(n(166)),i=n(3);function a(e){return e&&e.__esModule?e:{default:e}}function s(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 c(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var d=function(e){function t(){return s(this,t),u(this,e.apply(this,arguments))}return c(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Stamp(e)},t.prototype.setIconName=function(e){},t.prototype.getIconName=function(){return this.JR.getPDFString(this.annot.GetIconName())},t.prototype.create=function(t){var n=e.prototype.create.call(this,t),r=this.engine,a=this.annot;try{if(t.rotation&&this.setRotation(t.rotation),t.apObjeNum){t.rect&&this.setRect(t.rect);var s=this.doc,u=a.GetDict(),c=(0,i.CString)(r,"AP"),d=u.GetElement(c);d||(d=r.PDFDictionary.Create().GetDict(),u.SetAt(c,d)),d.GetDirectObject().GetDict().SetAtReference((0,i.CString)(r,"N"),s.GetIndirectObject(+t.apObjeNum),s)}else{var l=(0,o.default)();if(l.jr||l.initIconProvider(this.JR,this.engine),t.iconInfo&&(l.addIcon(t.iconInfo),t.iconCategory=t.iconInfo.category,t.icon=t.iconInfo.name),t.iconCategory&&(l.activeIcon(t.iconCategory,t.icon),l.enable(!0)),t.icon){var f=new r.WString(t.icon);a.SetIconName(f.UTF8Encode()),a.ResetAppearanceStream(),l.enable(!1),f.delete()}}}catch(e){isNaN(e)||(e=this.engine.getErrorCode(e)),console.warn(e)}return n},t.prototype.setAnnotAPBitmap=function(e,t){var n=this,r=this.engine.ReaderCallback.implement({Release:function(){},GetSize:function(){return t},ReadBlock:function(t,r,o){var i=new Uint8Array(n.JR.requestData("GET",!1,e,r,o));return n.engine.HEAPU8.set(i,t),!0}}),o=new this.engine.Image(r);this.annot.SetImage(o,0,0),this.annot.ResetAppearanceStream()},t.prototype.setRotation=function(e){var t=this.annot.GetRotation(),n=this.annot;return n.Rotate((360-t)%360),n.Rotate(e%360),n.ResetAppearanceStream(),[this.getId()]},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t);n.rotation=this.annot.GetRotation(),n.iconName=this.getIconName();var r=this.engine,o=this.annot.GetDict().GetElement((0,i.CString)(r,"AP")),a=o&&o.GetDirectObject().GetDict(),s=a&&a.GetElement((0,i.CString)(r,"N")),u=s&&s.GetDirectObject();return u&&(n.apObjeNum=u.GetObjNum()),n},t}(r.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(31)),o=n(3),i=a(n(85));function a(e){return e&&e.__esModule?e:{default:e}}function s(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 u(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var c=function(e){function t(n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=s(this,e.call(this,n,r)),a=(n=i.annot).GetAction();a.IsEmpty()||(i.action=i.JR.actionManager.get(a,i.doc,i.JR));var u=i.engine,c=(0,o.CString)(u,"AP"),d=i.annot.GetDict().GetElement(c);return c=(0,o.CString)(u,"N"),64&n.GetFlags()?s(i):(d&&d.GetDict().HasKey(c)||n.ResetAppearanceStream(),i)}return u(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Link(e)},t.prototype.destroy=function(){this.action&&this.action.destroy(),e.prototype.destroy.call(this)},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.annot.GetHighlightingMode()||{value:0};n.highlightingMode=r.value,n.action=this.action&&this.action.toJson();var i=this.annot.GetDict().GetElement((0,o.CString)(this.engine,"A")),a=i&&i.GetDirectObject();return a&&(n.aObjNum=a.GetObjNum()),n},t.prototype.setHighlightingMode=function(e){return this.annot.SetHighlightingMode(this.engine.HighlightingMode.values[e]),this.annot.ResetAppearanceStream(),[this.getId()]},t.prototype.setAction=function(e,t,n){var r=this.engine,o=t.type,i=this.annot.GetPage().GetDocument(),a=void 0;if(a=o?this.JR.actionManager.create(i,t.type):this.JR.actionManager.create(i,t),n){var s=this.annot.GetAction();if(n&&!s.IsEmpty()){var u=s.GetSubActionCount();return s.InsertSubAction(u,a),o&&this.JR.actionManager.get(a,this.doc,this.JR).create(t),this.JR.actionManager.get(s,this.doc,this.JR)}}if(this.action&&this.action.action.GetType()===r.ActionType.e_TypeURI&&r.ActionType["e_"+(o?t.type:t)]===r.ActionType.e_TypeGoto){var c=this.annot.GetDict(),d=c.GetElement(new r.String("A")).GetDirectObject();c.SetAtReference(new r.String("PA"),d,this.doc)}this.annot.SetAction(a);var l=this.JR.actionManager.get(this.annot.GetAction(),this.doc,this.JR);return o&&l.create(t),l},t.prototype.create=function(t){var n=e.prototype.create.call(this,t);if(t.borderWidth&&this.setBorderWidth(t.borderWidth),t.borderStyle&&this.setBorderStyle(t.borderStyle,t.borderStyleParam),void 0!==t.highlightingMode&&this.setHighlightingMode(t.highlightingMode),t.aObjNum){var r=this.annot.GetDict(),o=new this.engine.String("A");r.GetElement(o)||r.SetAtReference(o,this.doc.GetIndirectObject(+t.aObjNum),this.doc);var i=this.annot.GetAction();i.IsEmpty()||(this.action=this.JR.actionManager.get(i,this.doc,this.JR))}return n},t.prototype.setBorderStyle=function(t,n){return e.prototype.setBorderStyle.call(this,t,n),[this.getId()]},t.prototype.hasPA=function(){var e=this.engine;return this.annot.GetDict().HasKey(new e.String("PA"))},t.prototype.resetAByPA=function(){if(!this.hasPA())return!1;var e=this.engine,t=this.annot.GetDict(),n=new e.String("PA"),r=t.GetElement(n).GetDirectObject();return t.SetAtReference(new e.String("A"),r,this.doc),t.RemoveAt(n),!0},t.prototype.removeAction=function(e,t){var n=this.engine,r=this.pdfPage.pdfDoc.doc,o=this.annot,a=o.GetAction();return a=(0,i.default)(n,r,a,t),t&&a?(o.SetAction(a),[this.JR.actionManager.get(a,this,this.JR).toJson()]):(o.RemoveAction(),[])},t}(r.default);t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(18);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Ink(e)},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.annot.GetInkList(),o=[];if(!r.IsEmpty())for(var i=r.GetPointCount(),a=0;a<i;a++){var s=r.GetPoint(a),u=r.GetPointType(a);o.push({x:s.x,y:s.y,type:u.value})}return n.inkList=o,n},t.prototype.setInkList=function(e){var t=this,n=new this.engine.Path;return e.forEach((function(e){var r=new t.engine.PointF(e.x,e.y);1===e.type?n.MoveTo(r):n.LineTo(r),r.delete()})),this.annot.SetInkList(n),n.delete(),this.annot.ResetAppearanceStream(),!0},t.prototype.create=function(t){t.borderWidth&&this.setBorderWidth(t.borderWidth);var n=e.prototype.create.call(this,t),r=t.inkList;return r&&this.setInkList(r),n},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=d(n(31)),i=d(n(37)),a=n(3),s=d(n(38)),u=d(n(85)),c=n(374);function d(e){return e&&e.__esModule?e:{default:e}}function l(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var f=function(e){function t(n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(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}(this,e.call(this,n,r));o.engineWidget=o.annot,o.page=r;var i=r.pdfDoc.form;return i&&i.hasWidgetChanged(n.GetDict().GetObjNum())&&n.ResetAppearanceStream(),o}return l(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Widget(e)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.engineWidget=null},t.prototype.updateMKProperty=function(e,t){var n=this.engineWidget,o=n.GetDict(),s=this.pdfPage.doc,u=this.engine,c=!0,d=void 0,l=void 0;switch(e){case"alignment":var f=(0,a.CString)(u,"Q");void 0===t?o.RemoveAt(f):o.SetAtInteger(f,t);break;case"directionRTL":var h=(0,a.CString)(u,"MEOptions");void 0===t?o.RemoveAt(h):o.SetAtInteger(h,t);break;case"lineSpace":var p=(0,a.CString)(u,"LS");if(void 0===t)o.RemoveAt(p);else{var m=this.engine.PDFArray.Create();m.AddInteger(t[0]),m.AddFloat(t[1]),o.SetAt(p,m)}break;case"borderColor":0===t?n.RemoveMKEntry(u.MKEntry.e_MKEntryBorderColor):n.SetMKBorderColor(t);break;case"fillColor":0==t?n.RemoveMKEntry(u.MKEntry.e_MKEntryBackgroundColor):n.SetMKBackgroundColor(t);break;case"normalCaption":l=new u.WString(t),n.SetMKNormalCaption(l),l.delete();break;case"downCaption":l=new u.WString(t),n.SetMKDownCaption(l),l.delete();break;case"rotation":var g=u.Rotation.e_Rotation0;switch(t){case 1:g=u.Rotation.e_Rotation90;break;case 2:g=u.Rotation.e_Rotation180;break;case 3:g=u.Rotation.e_Rotation270}n.SetMKRotation(g);break;case"rolloverCaption":l=new u.WString(t),n.SetMKRolloverCaption(l),l.delete();break;case"normalIcon":d="I";case"downIcon":d||(d="IX");case"rolloverIcon":d||(d="RI");var y=(0,a.CString)(u,"MK"),_=o.GetElement(y);if(_&&_.GetDict()?_=_.GetDict():(_=u.PDFDictionary.Create(),o.SetAtReference(y,_,s)),d=(0,a.CString)(u,d),"number"==typeof t)_.SetAtReference(d,s.GetIndirectObject(t),s);else if("object"==(void 0===t?"undefined":r(t)))if(t)if(t.height>0&&t.width>0){var v=new u.String(t.stream),b=this.doc.CreateIcon(v,t.width,t.height);_.SetAtReference(d,b,s)}else if(t instanceof Uint8Array){var S=i.default.createImage(u,t);S?n.SetMKNormalIconImage(S,0):c=!1}else _.RemoveAt(d);else _.RemoveAt(d);for(var w=n.GetField(),M=w.GetControlCount(),D=_.GetElement(d),P=D?D.GetDirectObject().GetObjNum():0,T=0;P&&T<M;T++){var k=w.GetControl(T).GetWidget();if(!k.IsEmpty()){var A=k.GetDict();if(A.GetObjNum()!=o.GetObjNum()){var L=A.GetElement(y);L&&L.GetDict()?L=L.GetDict():(L=u.PDFDictionary.Create(),A.SetAtReference(y,L,s)),L.SetAtReference(d,s.GetIndirectObject(P),s),k.ResetAppearanceStream()}}}}var F=this.pdfPage.pdfDoc.form,I=n.GetField().GetName().toString(),x=F.getField(I),C=x.engineField,R=C.GetDict(),O=C.GetValue();return x.label.length>0&&C.SetValue((0,a.CWString)(u,x.label)),n.ResetAppearanceStream(),x.label.length>0&&R.SetAtWString((0,a.CString)(u,"V"),O),c},t.prototype.setAS=function(e){if(e){var t=this.engineWidget.GetDict(),n=this.engine,r=(0,a.CString)(n,"AS"),o=new n.String(e);t.SetAt(r,n.PDFObject.CreateFromName(o)),(0,s.default)(o)}},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.engineWidget,o=r.GetField(),i=r.GetControl(),s=r.GetAction(),u="";s.IsEmpty()||(u=this.JR.actionManager.get(s,this.doc,this.JR).toJson());var d=this.engine,l=["Off"],f=void 0,h={},p=void 0,m=void 0,g=void 0,y=void 0,_=0,v=0,b=[];if(!r.IsEmpty()){var S=r.GetDict();_=(_=S.GetElement((0,a.CString)(d,"Q")))?_.GetInteger():0,h=(0,c.getAA)(this.JR,this.page.doc,S);var w=(0,a.CString)(d,"AS");if(S.HasKey(w)){var M=this.engineWidget.GetAppearanceOnStateName();try{l.push(M.toString())}catch(e){l.push(this.JR.getHexString(M))}f=this.engineWidget.GetAppearanceState().toString()}w=(0,a.CString)(d,"AP"),y=S.HasKey(w);var D=S.GetElement((0,a.CString)(d,"MK"));D&&D.GetDict()&&((p=D.GetDict().GetElement((0,a.CString)(d,"I")))&&(p=p.GetDirectObject().GetObjNum()),(m=D.GetDict().GetElement((0,a.CString)(d,"RI")))&&(m=m.GetDirectObject().GetObjNum()),(g=D.GetDict().GetElement((0,a.CString)(d,"IX")))&&(g=g.GetDirectObject().GetObjNum()));var P=S.GetElement((0,a.CString)(d,"MEOptions"));P&&(v=P.GetInteger());var T=S.GetElement((0,a.CString)(d,"LS"));if(T){var k=T.GetArray();2===k.GetElementCount()&&(b.push(k.GetElement(0).GetInteger()),b.push(Number(k.GetElement(1).GetFloat().toFixed(1))))}}var A=r.GetHighlightingMode();A&&(A=A.value);var L=0;L=r.HasMKEntry(d.MKEntry.e_MKEntryBackgroundColor)?4278190080|r.GetMKBackgroundColor():0;var F=void 0;F=r.HasMKEntry(d.MKEntry.e_MKEntryBorderColor)?4278190080|r.GetMKBorderColor():0;var I=r.GetMKDownCaption().toString(),x=r.GetMKIconCaptionRelation().value,C=r.GetMKIconFit(),R=r.GetMKNormalCaption().toString(),O=r.GetMKRolloverCaption().toString(),G=r.GetMKRotation().value,E="",Y=0,j=void 0;o.IsEmpty()||(E=o.GetName().toString(),Y=o.GetType().value,j=i.GetIndex(),this.engineWidget.GetDict().HasKey((0,a.CString)(this.engine,"PMD"))&&(Y=8));var N=!1,B=void 0,H=void 0,W=void 0;if(!o.IsEmpty()){H=i.GetDefaultAppearance();try{H.font.IsEmpty()||(N=H.font.IsEmbedded(this.pdfPage.doc),B=H.font.GetName().toString(),W=(W=H.font.GetFamilyName().toString()).replace(" ","").replace("-",""),H.font.IsBold()&&(W+="Bold"),H.font.IsItalic()&&(W+="Italic"))}catch(e){isNaN(e)||(e=d.getErrorCode(e)),console.warn(e)}}return Object.assign(n,{highlightingMode:A,fillColor:L,iconFit:{fitBounds:C.fit_bounds,horizontalFraction:C.horizontal_fraction,isProportionalScaling:C.is_proportional_scaling,scaleWayType:C.scale_way_type?C.scale_way_type.value:C.scale_way_type,verticalFraction:C.vertical_fraction},MKBorderColor:F,downCaption:I,normalCaption:R,rolloverCaption:O,captionRelation:x,rotation:G,field:E,control:j,fieldType:Y,action:u,AA:h,ApStates:l,ApState:f,normalIcon:p,rolloverIcon:m,downIcon:g,hasAP:y,alignment:_,directionRTL:v,lineSpace:b},H?{DA:{flags:H.flags,textColor:H.text_color,textSize:H.text_size,isEmbedded:N,fontName:B,fullName:W}}:{})},t.prototype.setAction=function(e,t,n){var r,o=this.engine,i=this.JR.actionManager,a=this.engineWidget,s=this.annot.GetPage().GetDocument();if(r=i.create(s,t.type),-1==e)try{a.SetAction(r)}catch(e){isNaN(e)||(e=o.getErrorCode(e)),console.warn(e)}else{var u=a.GetField(),c=this.pdfPage.pdfDoc.form,d=e>10&&e<17?a.GetDict():u.GetDict();c.addAAToDict(d,r,{trigger:e,field:u.GetName().toString()},n)}var l=i.get(r,this.doc,this.JR);return l.create(t),l},t.prototype.setDefaultAppearance=function(e){var t=this.engine,n=JSON.parse(e),r=this.engineWidget,o=r.GetControl(),i=void 0!==n.fontName?t.DefAPFlags.e_FlagFont.value:0,s=void 0!==n.textColor?t.DefAPFlags.e_FlagTextColor.value:0,u=void 0!==n.textSize?t.DefAPFlags.e_FlagFontSize.value:0,c=void 0;if(n.fontName){var d=mapFontName2StdID(n.fontName);if(d){var l=[t.StandardID.e_StdIDCourier,t.StandardID.e_StdIDCourierB,t.StandardID.e_StdIDCourierBI,t.StandardID.e_StdIDCourierI,t.StandardID.e_StdIDHelvetica,t.StandardID.e_StdIDHelveticaB,t.StandardID.e_StdIDHelveticaBI,t.StandardID.e_StdIDHelveticaI,t.StandardID.e_StdIDTimes,t.StandardID.e_StdIDTimesB,t.StandardID.e_StdIDTimesBI,t.StandardID.e_StdIDTimesI,t.StandardID.e_StdIDSymbol,t.StandardID.e_StdIDZapfDingbats];c=new this.engine.Font(l[d])}else c=new this.engine.Font((0,a.CWString)(t,n.fontName),0,t.Charset.e_CharsetANSI,0)}else c=new this.engine.Font(0);var f=new this.engine.DefaultAppearance(i|s|u,c,n.textSize?n.textSize:0,n.textColor?n.textColor:0);try{o.SetDefaultAppearance(f)}catch(e){return isNaN(e)||(e=t.getErrorCode(e)),void console.warn(e)}r.ResetAppearanceStream()},t.prototype.getWidgetMkOption=function(){var e=this.engine,t=this.engineWidget.GetMKIconCaptionRelation();switch(t){case e.MKIconCaptionRelation.e_MKRelationNoIcon:t="e_MKRelationNoIcon";break;case e.MKIconCaptionRelation.e_MKRelationNoCaption:t="e_MKRelationNoCaption";break;case e.MKIconCaptionRelation.e_MKRelationCaptionBelowIcon:t="e_MKRelationCaptionBelowIcon";break;case e.MKIconCaptionRelation.e_MKRelationCaptionAboveIcon:t="e_MKRelationCaptionAboveIcon";break;case e.MKIconCaptionRelation.e_MKRelationCaptionRight:t="e_MKRelationCaptionRight";break;case e.MKIconCaptionRelation.e_MKRelationCaptionLeft:t="e_MKRelationCaptionLeft";break;case e.MKIconCaptionRelation.e_MKRelationCaptionOvrlayOnIcon:t="e_MKRelationCaptionOvrlayOnIcon";break;default:t=""}var n=this.engineWidget.GetHighlightingMode();switch(n){case e.HighlightingMode.e_HighlightingNone:n="e_HighlightingNone";break;case e.HighlightingMode.e_HighlightingInvert:n="e_HighlightingInvert";break;case e.HighlightingMode.e_HighlightingOutline:n="e_HighlightingOutline";break;case e.HighlightingMode.e_HighlightingPush:n="e_HighlightingPush";break;case e.HighlightingMode.e_HighlightingToggle:n="e_HighlightingToggle";break;default:n=""}var r=this.engineWidget.GetMKNormalCaption().toString(),o=this.engineWidget.GetMKDownCaption().toString(),i=this.engineWidget.GetMKRolloverCaption().toString();return{labelIcon:{up:{label:r,icon:this.bitmapParseBlob(this.engineWidget.GetMKNormalIconBitmap())},down:{label:o,icon:this.bitmapParseBlob(this.engineWidget.GetMKDownIconBitmap())},rollover:{label:i,icon:this.bitmapParseBlob(this.engineWidget.GetMKRolloverIconBitmap())}},layout:t,behavior:n}},t.prototype.setWidgetIconCaptionRelation=function(e){e=e||"e_MKRelationNoIcon";var t=this.engine.MKIconCaptionRelation[e];this.engineWidget.SetMKIconCaptionRelation(t),this.engineWidget.ResetAppearanceStream()},t.prototype.setWidgetHighlighting=function(e){e=e||"e_HighlightingPush";var t=this.engine.HighlightingMode[e];this.engineWidget.SetHighlightingMode(t),this.engineWidget.ResetAppearanceStream()},t.prototype.setWidgetMkCaption=function(e,t){switch(e=e||"up",t=(0,a.CWString)(this.engine,t||""),e){case"up":this.engineWidget.SetMKNormalCaption(t);break;case"down":this.engineWidget.SetMKDownCaption(t);break;case"rollover":this.engineWidget.SetMKRolloverCaption(t)}this.engineWidget.ResetAppearanceStream()},t.prototype.setWidgetMkIcon=function(e,t){e=e||"up";var n=void 0;switch(t&&(n=i.default.createImage(this.engine,t).GetFrameBitmap(0)),e){case"up":t?this.engineWidget.SetMKNormalIconBitmap(n):this.engineWidget.RemoveMKEntry(this.engine.MKEntry.e_MKEntryNormalIcon);break;case"down":t?this.engineWidget.SetMKDownIconBitmap(n):this.engineWidget.RemoveMKEntry(this.engine.MKEntry.e_MKEntryDownIcon);break;case"rollover":t?this.engineWidget.SetMKRolloverIconBitmap(n):this.engineWidget.RemoveMKEntry(this.engine.MKEntry.e_MKEntryRolloverIcon)}this.engineWidget.ResetAppearanceStream()},t.prototype.getWidgetIconFitOption=function(){var e=this.engine,t=this.engineWidget.GetMKIconFit(),n=t.scale_way_type,r=t.is_proportional_scaling,o=t.fit_bounds,i=t.horizontal_fraction,a=t.vertical_fraction;switch(n){case e.ScaleWayType.e_ScaleWayAlways:n="e_ScaleWayAlways";break;case e.ScaleWayType.e_ScaleWayBigger:n="e_ScaleWayBigger";break;case e.ScaleWayType.e_ScaleWaySmaller:n="e_ScaleWaySmaller";break;case e.ScaleWayType.e_ScaleWayNever:n="e_ScaleWayNever";break;default:n="e_ScaleWayAlways"}return{scale_way_type:n,is_proportional_scaling:r+"",fit_bounds:o,horizontal_fraction:i=(100*i).toFixed(0),vertical_fraction:a=(100*a).toFixed(0)}},t.prototype.setWidgetIconFitOption=function(e){var t=new this.engine.IconFit,n=this.engine.ScaleWayType[e.scale_way_type],r=e.is_proportional_scaling,o=e.horizontal_fraction,i=e.vertical_fraction,a=e.fit_bounds;o=parseFloat(o/100),i=parseFloat(i/100),t.Set(n,"true"===r,o,i,a),this.engineWidget.SetMKIconFit(t),this.engineWidget.ResetAppearanceStream()},t.prototype.bitmapParseBlob=function(e){var t=this.engine,n="";if(!e.IsEmpty()){e.ConvertFormat(t.DIBFormat.e_DIBArgb);var r=e.GetWidth(),o=e.GetHeight(),i=e.GetBuffer(),a=o*e.GetPitch(),s=i+a,u=void 0;u=t.HEAPU8.buffer.slice?t.HEAPU8.buffer.slice(i,s):new Uint8Array(t.HEAPU8.buffer,i,a).buffer;var c=new Uint8Array(u),d=0,l=0,f=e.GetPitch();for(d=0;d<o;d++)for(l=0;l<r;l++){var h=d*f,p=[c[4*l+2+h],c[4*l+h]];c[4*l+h]=p[0],c[4*l+2+h]=p[1]}n={start:i,size:a,width:r,height:o,buffer:u}}return n},t.prototype.removeAction=function(e,t){var n=this,r=this.engine,o=this.pdfPage.pdfDoc.form.engineForm.GetDocument(),i=this.engineWidget;if("-1"==e){var s=i.GetAction();return s=(0,u.default)(r,o,s,t),t&&s?(i.SetAction(s),[this.JR.actionManager.get(s,this,this.JR).toJson()]):(i.RemoveAction(),[])}e=r.TriggerEvent.values[e];var c=i.GetField(),d=i.GetDict(),l=c.GetDict(),f=[d,l];return d.GetObjNum()==l.GetObjNum()&&(f=[d,null]),f.map((function(i){if(i){var s=void 0,c=(0,a.CString)(r,"AA"),d=i.GetElement(c);if(d){var l=d.GetDict();if(s=new r.AdditionalAction(o,l),t){var f=s.GetAction(e);if(f.IsEmpty())return;if(f=(0,u.default)(r,o,f,t))return s.SetAction(e,f),n.JR.actionManager.get(f,n,n.JR).toJson();s.RemoveAction(e)}else s.RemoveAction(e)}}}))},t.prototype.moveAction=function(e,t,n){if(t){var r=this.pdfPage.doc,o=new this.engine.Action(r,r.GetIndirectObject(t.objNumber).GetDict()),i=this.engineWidget;i.GetAction();return i.MoveAction(o,n)}},t}(o.default);t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=l(n(31)),o=l(n(37)),i=l(n(44)),a=n(3),s=l(n(38)),u=l(n(74)),c=n(374),d=l(n(85));function l(e){return e&&e.__esModule?e:{default:e}}function f(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var h=[0,90,180,270],p=function(e){function t(n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(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}(this,e.call(this,n,r));o.isAudioVideo=!1;var i=o.annot.GetAction();return i.IsEmpty()||(o.action=o.JR.actionManager.get(i,o.doc,o.JR),"ActionType_e_TypeRendition"==o.action.getType()&&(o.isAudioVideo=!0)),o}return f(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Screen(e)},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t);this.isAudioVideo||(n.action=this.action&&this.action.toJson()),n.opacity=this.getOpacity(),n.rotation=h[this.getRotation()],n.title=this.getTitle(),n.isAudioVideo=this.isAudioVideo;var r=this.annot.GetDict(),o=this.engine,i=r.GetElement((0,a.CString)(o,"MK")),s=i&&i.GetDirectObject().GetDict(),u=r.GetElement((0,a.CString)(o,"A")),d=u&&u.GetDirectObject();if(d&&(n.aObjNum=d.GetObjNum()),s){var l=s.GetElement((0,a.CString)(o,"I")),f=l&&l.GetDirectObject();f&&(n.iObjNum=f.GetObjNum())}n.AA=(0,c.getAA)(this.JR,this.pdfPage.doc,this.annot.GetDict(),17,21);var p=r.GetElement((0,a.CString)(o,"AP"));if(p){var m=p.GetDirectObject().GetDict().GetElement((0,a.CString)(o,"N"));m&&m.GetDirectObject()&&(n.apObjNum=m.GetDirectObject().GetObjNum())}return n},t.prototype.setBorderColor=function(e){var t=this.annot;if(0==e)t.RemoveProperty({value:2});else{if(-1==e)return;t.SetBorderColor(e)}t.ResetAppearanceStream()},t.prototype.getAction=function(){return this.action?this.action:null},t.prototype.setAction=function(e,t,n){var r,o=this.engine,i=this.JR.actionManager,a=this.annot,s=this.annot.GetPage().GetDocument();if(r=i.create(s,t.type),-1==e)try{a.SetAction(r)}catch(e){isNaN(e)||(e=o.getErrorCode(e)),console.warn(e)}else{var u=a.GetDict();this.pdfPage.pdfDoc.addAA(u,r,{trigger:e},n)}var c=i.get(r,s,this.JR);return c.create(t),c},t.prototype.getOpacity=function(){return this.annot.GetOpacity()},t.prototype.getRotation=function(){return this.annot.GetRotation().value},t.prototype.getTitle=function(){return this.annot.GetTitle().toString()},t.prototype.create=function(t){if(t.rotation){var n={0:0,90:1,180:2,270:3}[t.rotation]||0;this.annot.SetRotation(this.engine.Rotation.values[n]||0)}t.borderWidth?this.setBorderWidth(t.borderWidth):this.setBorderWidth(0);var r=e.prototype.create.call(this,t);if(void 0!==t.opacity){var o=+t.opacity;this.setOpacity(o)}if(t.apObjNum){var i=this.doc,u=this.annot.GetDict(),c=this.engine,d=(0,a.CString)(c,"AP"),l=(0,a.CString)(c,"MK"),f=u.GetElement(d),h=u.GetElement(l);if(f||(f=c.PDFDictionary.Create().GetDict(),u.SetAt(d,f)),h||(h=c.PDFDictionary.Create().GetDict(),u.SetAt(l,h)),f.GetDirectObject().GetDict().SetAtReference((0,a.CString)(c,"N"),i.GetIndirectObject(+t.apObjNum),i),t.aObjNum){var p=(0,a.CString)(c,"A");u.GetElement(p)||u.SetAtReference(p,i.GetIndirectObject(+t.aObjNum),i);var m=this.annot.GetAction();m.IsEmpty()||(this.action=this.JR.actionManager.get(m,this.doc,this.JR),"ActionType_e_TypeRendition"==this.action.getType()&&(this.isAudioVideo=!0))}if(t.iObjNum){var g=h.GetDirectObject().GetDict();g.SetAtReference((0,a.CString)(c,"I"),i.GetIndirectObject(+t.iObjNum),i);var y=(0,a.CString)(c,"IF"),_=g.GetElement(y);_||(_=c.PDFDictionary.Create().GetDict(),g.SetAt(y,_));var v=_.GetDirectObject().GetDict(),b=(0,a.CString)(c,"FB"),S=(0,a.CString)(c,"P"),w=(0,a.CString)(c,"S"),M=c.PDFObject.CreateFromBoolean(!0),D=c.PDFObject.CreateFromName(S);v.SetAt(b,M),v.SetAt(w,D),(0,s.default)(M,D)}}else if(t.multiBuffer&&(this.setMultiMedia(t.multiBuffer,t.fileName,t.contentType),this.isAudioVideo=!0),t.buffer&&!this.setImage(t.buffer))return null;return r},t.prototype.setMultiMedia=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"video.mp4",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"video/mp4",r=this.annot.GetPage().GetDocument(),o=this.engine.Action.Create(r,this.engine.ActionType.e_TypeRendition),a=new this.engine.RenditionAction(o);a.SetOperationType(this.engine.OperationType.e_OpTypeAssociate),a.SetScreenAnnot(this.annot);var u=new this.engine.Rendition(r,null),c=new this.engine.WString(t);u.SetRenditionName(c),u.SetMediaClipName(c);var d=i.default.createFile(this.engine,r,e);d.SetFileName(c),u.SetMediaClipFile(d);var l=new this.engine.String(n);u.SetMediaClipContentType(l),a.InsertRendition(u,-1),this.annot.SetAction(a),this.annot.ResetAppearanceStream(),(0,s.default)(c,l,u,a),this.action=this.JR.actionManager.get(o,this.doc,this.JR)},t.prototype.setImage=function(e){try{var t=o.default.createImage(this.engine,e);this.annot.SetImage(t,0,0),this.annot.ResetAppearanceStream()}catch(e){var n=this.engine,r=e instanceof n.ErrorCode?n.getErrorCode(e):e;return u.default.getLogger("setImage").warn(r),!1}return!0},t.prototype.setOpacity=function(e){var t=this.annot;return e=+e,t.SetOpacity(e),t.ResetAppearanceStream(),[this.getId()]},t.prototype.setRotation=function(e){var t=this.annot,n=this.engine.Rotation,r={0:n.e_Rotation0,90:n.e_Rotation90,180:n.e_Rotation180,270:n.e_Rotation270};return t.SetRotation(r[e]),t.ResetAppearanceStream(),[this.getId()]},t.prototype.setBorderStyle=function(t,n){return e.prototype.setBorderStyle.call(this,t,n),[this.getId()]},t.prototype.setTitle=function(e){var t=this.annot,n=new this.engine.WString(e);return t.SetTitle(n),r.default.updateModifyTime(this.engine,t),n.delete(),[this.getId()]},t.prototype.removeAction=function(e,t){var n=this,r=this.engine,o=this.pdfPage.pdfDoc.doc,i=this.annot;if("-1"==e){var s=i.GetAction();return s=(0,d.default)(r,o,s,t),t&&s?(i.SetAction(s),[this.JR.actionManager.get(s,this,this.JR).toJson()]):(i.RemoveAction(),[])}return e=r.TriggerEvent.values[e],[i.GetDict()].map((function(i){if(i){var s=void 0,u=(0,a.CString)(r,"AA"),c=i.GetElement(u);if(c){var l=c.GetDict();if(s=new r.AdditionalAction(o,l),t){var f=s.GetAction(e);if(f.IsEmpty())return;if(f=(0,d.default)(r,o,f,t))return s.SetAction(e,f),n.JR.actionManager.get(f,n,n.JR).toJson();s.RemoveAction(e)}else s.RemoveAction(e)}}}))},t.prototype.moveAction=function(e,t,n){if(t){var r=this.pdfPage.doc,o=new this.engine.Action(r,r.GetIndirectObject(t.objNumber).GetDict()),i=this.engineWidget;i.GetAction();return i.MoveAction(o,n)}},t}(r.default);t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(31),i=(r=o)&&r.__esModule?r:{default:r},a=n(3);function s(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 c(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var d=function(e){function t(){return s(this,t),u(this,e.apply(this,arguments))}return c(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Popup(e)},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.annot;return n.openStatus=r.GetOpenStatus(),n},t.prototype.create=function(t){e.prototype.create.call(this,t);var n=(t.open||"no").toString();"yes"===n||"true"===n?this.setOpenStatus(!0):this.setOpenStatus(!1);var r=t.popId;return r&&this.annot.SetUniqueID((0,a.CWString)(this.engine,r)),[this]},t.prototype.setOpenStatus=function(e){return this.annot.SetOpenStatus(e),e},t}(i.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(18)),o=n(3),i=n(227),a=n(104),s=u(n(31));function u(e){return e&&e.__esModule?e:{default:e}}function c(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var d=function(e){function t(n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(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}(this,e.call(this,n,r));return o.gsdkIDs=[o.engine.StandardID.e_StdIDCourier,o.engine.StandardID.e_StdIDCourierB,o.engine.StandardID.e_StdIDCourierBI,o.engine.StandardID.e_StdIDCourierI,o.engine.StandardID.e_StdIDHelvetica,o.engine.StandardID.e_StdIDHelveticaB,o.engine.StandardID.e_StdIDHelveticaBI,o.engine.StandardID.e_StdIDHelveticaI,o.engine.StandardID.e_StdIDTimes,o.engine.StandardID.e_StdIDTimesB,o.engine.StandardID.e_StdIDTimesBI,o.engine.StandardID.e_StdIDTimesI,o.engine.StandardID.e_StdIDSymbol,o.engine.StandardID.e_StdIDZapfDingbats],o}return c(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Redact(e)},t.prototype.apply=function(){var e=this;if(!this.engine.Library.HasModuleLicenseRight({value:3}))return Promise.reject(i.error.noRedactionLicense);var t={},n=[];return this.pdfPage.getAnnots().then((function(n){return n.forEach((function(e){var n=e.getId();n&&(t[n]=e)})),e.annot.Apply()?e.pdfPage.update():new Error})).then((function(e){for(var r in t){t[r];-1===e.annotIds.indexOf(r)&&n.push(r)}return n}))},t.prototype.setRedactOverlayText=function(e){return this.engine.Library.HasModuleLicenseRight({value:3})?(void 0!==e&&(this.annot.SetOverlayText((0,o.CWString)(this.engine,e)),this.annot.ResetAppearanceStream()),!0):Promise.reject(i.error.noRedactionLicense)},t.prototype.removeRedactOverlayText=function(){return this.engine.Library.HasModuleLicenseRight({value:3})?(this.annot.RemoveOverlayText(),this.annot.ResetAppearanceStream(),!0):Promise.reject(i.error.noRedactionLicense)},t.prototype.setRedactOverlayTextAlignment=function(e){if(!this.engine.Library.HasModuleLicenseRight({value:3}))return Promise.reject(i.error.noRedactionLicense);var t=[this.engine.Alignment.e_AlignmentLeft,this.engine.Alignment.e_AlignmentCenter,this.engine.Alignment.e_AlignmentRight];return t[e]&&(this.annot.SetOverlayTextAlignment(t[e]),this.annot.ResetAppearanceStream()),!0},t.prototype.setRedactRepeat=function(e){return this.engine.Library.HasModuleLicenseRight({value:3})?(void 0!==e&&(this.annot.SetRepeat(e),this.annot.ResetAppearanceStream()),!0):Promise.reject(i.error.noRedactionLicense)},t.prototype.setRedactAutoFontSize=function(e){return this.engine.Library.HasModuleLicenseRight({value:3})?(void 0!==e&&(this.annot.SetAutoFontSize(e),this.annot.ResetAppearanceStream()),!0):Promise.reject(i.error.noRedactionLicense)},t.prototype.getRedactDefaultAppearance=function(){if(!this.engine.Library.HasModuleLicenseRight({value:3}))return Promise.reject(i.error.noRedactionLicense);var e=this.annot.GetDefaultAppearance(),t=e.font,n={textColor:e.text_color,textSize:e.text_size};return t.IsEmpty()||(n.fontName=t.GetName().toString()),n},t.prototype.setRedactDefaultAppearance=function(e){if(!this.engine.Library.HasModuleLicenseRight({value:3}))return Promise.reject(i.error.noRedactionLicense);var t=this.annot.GetDefaultAppearance(),n=e.textColor,r=e.textSize,s=e.fontName;void 0===n&&(n=t.text_color),void 0===r&&(r=t.text_size);var u=void 0;if(s){var c=(0,a.mapFontName2StdID)(s);u=null!=c?new this.engine.Font(this.gsdkIDs[c]):new this.engine.Font((0,o.CWString)(this.engine,s),0,this.engine.Charset.e_CharsetANSI,0)}else t.font.IsEmpty()&&(u=new this.engine.Font(this.engine.StandardID.e_StdIDHelvetica));var d=((u=u||t.font)?this.engine.DefAPFlags.e_FlagFont.value:0)|this.engine.DefAPFlags.e_FlagTextColor.value|(r>0?this.engine.DefAPFlags.e_FlagFontSize.value:0),l=new this.engine.DefaultAppearance(d,u,r,n||16711680),f=this.annot.SetDefaultAppearance(l);return this.annot.ResetAppearanceStream(),f},t.prototype.setRedactOpacity=function(e,t){return this.engine.Library.HasModuleLicenseRight({value:3})?(this.annot.SetOpacity(e,t),this.annot.ResetAppearanceStream(),!0):Promise.reject(i.error.noRedactionLicense)},t.prototype.setRedactApplyFillColor=function(e){return this.engine.Library.HasModuleLicenseRight({value:3})?(this.annot.SetApplyFillColor(e),this.annot.ResetAppearanceStream(),!0):Promise.reject(i.error.noRedactionLicense)},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t);n.quadPoints=this.getQuadPointsArray(),0===n.quadPoints.length?n.isArea=!0:n.isArea=!1,n.applyFillColor=this.annot.GetApplyFillColor(),n.fillColor=this.annot.GetFillColor(),n.overlayText=this.annot.GetOverlayText().toString(),n.justification=this.annot.GetOverlayTextAlignment().value;var r=this.annot.GetDefaultAppearance();if(n.defaultAppearance={flags:r.flags,textColor:r.text_color,textSize:r.text_size},!r.font.IsEmpty()){var o=r.font.GetName().toString();n.fontName=a.FoxitFontMap[o]}n.isRepeat=this.annot.GetRepeat(),n.isOverlayCode=this.annot.HasOverlayCode(),n.overlayCode=[];for(var i=this.annot.GetOverlayCode(),s=0;s<i.GetSize();s++)n.overlayCode.push(i.GetAt(s));return n},t.prototype.getQuadPointsArray=function(){var e=[],t=this.annot.GetDict(),n=(0,o.CString)(this.engine,"QuadPoints");if(t.HasKey(n))for(var r=t.GetElement(n).GetArray(),i=r.GetElementCount()/8,a=0;a<i;a++){var s=[];s.push({x:r.GetElement(8*a).GetFloat(),y:r.GetElement(8*a+1).GetFloat()},{x:r.GetElement(8*a+2).GetFloat(),y:r.GetElement(8*a+3).GetFloat()},{x:r.GetElement(8*a+4).GetFloat(),y:r.GetElement(8*a+5).GetFloat()},{x:r.GetElement(8*a+6).GetFloat(),y:r.GetElement(8*a+7).GetFloat()}),e.push(s)}return e},t.prototype.updateQuadPointsByCharIndex=function(e,t){try{if(-1===e||-1===t)return!1;if(e>t){var n=e;e=t,t=n}var r=this.pdfPage.getNormalTextPageSync(),i=r.GetTextRectCount(e,t-e+1);if(i<1)return r.delete(),!1;for(var a=this.engine,s=(new a.QuadPointsArray,a.QuadPoints,a.PointF),u=a.PDFArray.Create(),c=0,d=i;c<d;c++){var l=r.GetTextRect(c),f=r.GetBaselineRotation(c),h=l.top,p=l.right,m=l.bottom,g=l.left,y=new s(g,h),_=new s(p,h),v=new s(g,m),b=new s(p,m),S=void 0,w=void 0,M=void 0,D=void 0;switch(f.value%4){case 0:S=y,w=_,M=v,D=b;break;case 1:S=y,w=v,M=_,D=b;break;case 2:S=b,w=v,M=_,D=y;break;case 3:S=b,w=_,M=v,D=y}u.AddFloat(S.x),u.AddFloat(S.y),u.AddFloat(w.x),u.AddFloat(w.y),u.AddFloat(M.x),u.AddFloat(M.y),u.AddFloat(D.x),u.AddFloat(D.y)}var P=this.annot;return P.GetDict().SetAt((0,o.CString)(a,"QuadPoints"),u),P.ResetAppearanceStream(),r.delete(),!0}catch(e){isNaN(e)||(e=this.engine.getErrorCode(e))}},t.prototype.create=function(t){return e.prototype.create.call(this,t)},t.prototype.setRedactAppearance=function(e){var t=e.applyFillColor,n=e.isAutoFontSize,r=e.textColor,i=e.textSize,s=e.fontName,u=e.justification,c=e.isRepeat,d=e.overlayText,l=e.redactionCode,f=this.engine,h=this.annot.GetDefaultAppearance();void 0!==t&&this.annot.SetApplyFillColor(t),void 0!==n&&this.annot.SetAutoFontSize(n),r=void 0===r?h.text_color:r,i=void 0===i?h.text_size:parseFloat(i);var p=void 0;if(s){var m=(0,a.mapFontName2StdID)(s);p=m?new f.Font(this.gsdkIDs[m]):new f.Font((0,o.CWString)(f,s),0,f.Charset.e_CharsetANSI,0)}else h.font.IsEmpty()&&(p=new f.Font(f.StandardID.e_StdIDHelvetica));var g=((p=p||h.font)?f.DefAPFlags.e_FlagFont.value:0)|f.DefAPFlags.e_FlagTextColor.value|(i>0?f.DefAPFlags.e_FlagFontSize.value:0),y=new f.DefaultAppearance(g,p,i,r||16711680);if(this.annot.SetDefaultAppearance(y),"0"===u&&this.annot.SetOverlayTextAlignment(f.Alignment.e_AlignmentLeft),"1"===u&&this.annot.SetOverlayTextAlignment(f.Alignment.e_AlignmentCenter),"2"===u&&this.annot.SetOverlayTextAlignment(f.Alignment.e_AlignmentRight),void 0!==c&&this.annot.SetRepeat(c),void 0!==d&&this.annot.SetOverlayText((0,o.CWString)(f,d)),l){var _=new f.Int32Array;l.forEach((function(e){return _.Add(e)})),this.annot.SetOverlayCode(_)}else this.annot.RemoveOverlayCode();return this.annot.ResetAppearanceStream(),!0},t.prototype.removeOverlayText=function(){this.engine;return this.annot.RemoveOverlayText(),this.annot.ResetAppearanceStream(),!0},t.prototype.setRedactFillColor=function(e,t){if("number"!=typeof e)throw new Error("Incorrect color value: "+e);void 0===t&&(t=!1),e<0&&(e=0);var n=this.annot,r=this.engine;0===e?n.RemoveProperty({value:3}):(n.SetOpacity(n.GetOpacity(),t),n.SetFillColor&&n.SetFillColor(e)),n.ResetAppearanceStream(),s.default.updateModifyTime(r,n)},t}(r.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(18)),o=(c(n(76)),n(3)),i=c(n(38)),a=c(n(44)),s=c(n(37)),u=n(375);function c(e){return e&&e.__esModule?e:{default:e}}function d(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var l=function(e){function t(n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(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}(this,e.call(this,n,r));return o.isAudioVideo=!0,o}return d(t,e),t.prototype.constructEngineAnnot=function(e){return new this.engine.Sound(e)},t.prototype.getSoundStream=function(){return this.annot.GetSoundStream()},t.prototype.toJson=function(t){var n=e.prototype.toJson.call(this,t),r=this.engine;this.isAudioVideo||(n.action=this.action&&this.action.toJson()),n.opacity=this.getOpacity(),n.isAudioVideo=this.isAudioVideo;try{n.title=this.annot.GetTitle().toString();var i=this.getSoundStream(),a=this.annot.GetSamplingRate(),s=this.annot.GetBits(),c=this.annot.GetChannelCount();if(i){var d=i.GetDataSize(!1);if(d>0){var l=r._malloc(d);i.GetData(!1,d,l);var f=(0,u.getArrayBufferFrom)(r,l,d);n.soundObj={data:f,sampleRate:a,sampleBits:s,channel:c,size:d},r._free(l)}}}catch(e){console.error(e)}var h=this.annot.GetDict(),p=h.GetElement((0,o.CString)(r,"AP"));if(p){var m=p.GetDirectObject().GetDict().GetElement((0,o.CString)(r,"N")),g=h.GetElement((0,o.CString)(r,"A")),y=g&&g.GetDirectObject();y&&(n.aObjNum=y.GetObjNum()),m&&m.GetDirectObject()&&(n.apObjNum=m.GetDirectObject().GetObjNum())}var _=h.GetElement((0,o.CString)(r,"MK")),v=_&&_.GetDirectObject().GetDict();if(v){var b=v.GetElement((0,o.CString)(r,"I")),S=b&&b.GetDirectObject();S&&(n.iObjNum=S.GetObjNum())}var w=h.GetElement((0,o.CString)(r,"Name"));return w&&(n.iconName=(w.GetName()||"").toString()),n},t.prototype.setBorderColor=function(e){var t=this.annot;if(0==e)t.RemoveProperty({value:2});else{if(-1==e)return;t.SetBorderColor(e)}t.ResetAppearanceStream()},t.prototype.getOpacity=function(){return this.annot.GetOpacity()},t.prototype.getTitle=function(){return this.annot.GetTitle()},t.prototype.create=function(t){t.rotate&&this.annot.SetRotation(this.engine.Rotation.values[t.rotate]),t.borderWidth&&this.setBorderWidth(t.borderWidth);var n=e.prototype.create.call(this,t);if(this.setBorderWidth(0),void 0!==t.opacity){var r=+t.opacity;this.setOpacity(r)}if(t.apObjNum){var a=this.doc,s=this.annot.GetDict(),u=this.engine,c=(0,o.CString)(u,"AP"),d=(0,o.CString)(u,"MK"),l=s.GetElement(c),f=s.GetElement(d);if(l||(l=u.PDFDictionary.Create().GetDict(),s.SetAt(c,l)),f||(f=u.PDFDictionary.Create().GetDict(),s.SetAt(d,f)),l.GetDirectObject().GetDict().SetAtReference((0,o.CString)(u,"N"),a.GetIndirectObject(+t.apObjNum),a),t.aObjNum){var h=(0,o.CString)(u,"A");s.GetElement(h)||s.SetAtReference(h,a.GetIndirectObject(+t.aObjNum),a);var p=this.annot.GetAction();p.IsEmpty()||(this.action=this.JR.actionManager.get(p,this.doc,this.JR),"ActionType_e_TypeRendition"==this.action.getType()&&(this.isAudioVideo=!0))}if(t.iObjNum){var m=f.GetDirectObject().GetDict();m.SetAtReference((0,o.CString)(u,"I"),a.GetIndirectObject(+t.iObjNum),a);var g=(0,o.CString)(u,"IF"),y=m.GetElement(g);y||(y=u.PDFDictionary.Create().GetDict(),m.SetAt(g,y));var _=y.GetDirectObject().GetDict(),v=(0,o.CString)(u,"FB"),b=(0,o.CString)(u,"P"),S=(0,o.CString)(u,"S"),w=u.PDFObject.CreateFromBoolean(!0),M=u.PDFObject.CreateFromName(b);_.SetAt(v,w),_.SetAt(S,M),(0,i.default)(w,M)}}else t.multiBuffer&&(this.setMultiMedia(t.multiBuffer,t.fileName,t.contentType),this.isAudioVideo=!0),t.buffer?this.setImage(t.buffer):this.annot.ResetAppearanceStream();return n},t.prototype.setMultiMedia=function(e,t,n){var r=this.annot.GetPage().GetDocument(),o=this.engine.Action.Create(r,this.engine.ActionType.e_TypeRendition),s=new this.engine.RenditionAction(o);s.SetOperationType(this.engine.OperationType.e_OpTypeAssociate),s.SetScreenAnnot(this.annot);var u=new this.engine.Rendition(r,null),c=new this.engine.WString(t);u.SetRenditionName(c),u.SetMediaClipName(c);var d=a.default.createFile(this.engine,r,e);d.SetFileName(c),u.SetMediaClipFile(d);var l=new this.engine.String(n);u.SetMediaClipContentType(l),s.InsertRendition(u,-1),this.annot.SetAction(s),this.annot.ResetAppearanceStream(),(0,i.default)(c,l,u,s),this.action=this.JR.actionManager.get(o,this.doc,this.JR)},t.prototype.setImage=function(e){try{var t=s.default.createImage(this.engine,e);this.annot.SetImage(t,0,0),this.annot.ResetAppearanceStream()}catch(e){var n=this.engine,r=e instanceof n.ErrorCode?e:n.getErrorCode(e);console.warn(r)}return!0},t.prototype.setOpacity=function(e){var t=this.annot;return e=+e,t.SetOpacity(e),t.ResetAppearanceStream(),[this.getId()]},t.prototype.setRotation=function(e){var t=this.annot,n=this.engine.Rotation,r={0:n.e_Rotation0,90:n.e_Rotation90,180:n.e_Rotation180,270:n.e_Rotation270};return t.SetRotation(r[e]),t.ResetAppearanceStream(),[this.getId()]},t.prototype.setBorderStyle=function(t,n){return e.prototype.setBorderStyle.call(this,t,n),[this.getId()]},t.prototype.removeAction=function(){return this.annot.RemoveAction(),!0},t}(r.default);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=o(n(18));o(n(76));function o(e){return e&&e.__esModule?e:{default:e}}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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var a=function(e){function t(n,r){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(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}(this,e.call(this,n,r))}return i(t,e),t}(r.default);t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=_(n(19)),o=_(n(698)),i=_(n(699)),a=_(n(700)),s=_(n(701)),u=_(n(702)),c=_(n(703)),d=_(n(704)),l=_(n(705)),f=_(n(706)),h=_(n(707)),p=_(n(708)),m=_(n(709)),g=_(n(711)),y=_(n(712));function _(e){return e&&e.__esModule?e:{default:e}}var v=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.engine=t}return e.prototype.get=function(e,t,n){var _=this.engine,v=_.ActionType;switch(e&&!e.IsEmpty()&&e.GetType()||null){case v.e_TypeThread:return new y.default(e,t,_,n);case v.e_TypeSetOCGState:return new g.default(e,t,_,n);case v.e_TypeURI:return new o.default(e,t,_,n);case v.e_TypeLaunch:return new a.default(e,t,_,n);case v.e_TypeNamed:return new s.default(e,t,_,n);case v.e_TypeJavaScript:return new u.default(e,t,_,n);case v.e_TypeResetForm:return new d.default(e,t,_,n);case v.e_TypeSubmitForm:return new c.default(e,t,_,n);case v.e_TypeImportData:return new l.default(e,t,_,n);case v.e_TypeGoto:return new i.default(e,t,_,n);case v.e_TypeRendition:return new f.default(e,t,_,n);case v.e_TypeHide:return new h.default(e,t,_,n);case v.e_TypeGoToR:return new p.default(e,t,_,n);case v.e_TypeGoToE:return new m.default(e,t,_,n);case v.e_TypeUnknown:case v.e_TypeSound:case v.e_TypeMovie:case v.e_TypeTrans:case v.e_TypeGoTo3DView:default:return new r.default(e,t,_,n)}},e.prototype.create=function(e,t){var n=this.engine.ActionType;return r.default.create(this.engine,e,n["e_"+t])},e.prototype.getActionByDict=function(e,t){return new this.engine.Action(e,t)},e}();t.default=v},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(19);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.createAction=function(e){return new this.engine.URIAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);return t.uri=this.getURI(),t},t.prototype.setActionData=function(e){return this.setURI(e.uri),!0},t.prototype.create=function(e){return e.uri&&this.setURI(e.uri),!0},t.prototype.getURI=function(){var e=this.action.GetURI(),t=void 0;try{t=e.toString()}catch(s){isNaN(s)||(s=this.engine.getErrorCode(s)),console.warn(s);for(var n="",r=e.GetLength(),o=e.GetBuffer(),i=0;i<r;i++){var a=this.engine.HEAP8[o+i]>>>0&255;n+=String.fromCharCode(a)}t=n}return t},t.prototype.setURI=function(e){var t=new this.engine.String(e);this.action.SetURI(t),t.delete()},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=i(n(19)),o=i(n(105));function i(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 s(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 u(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var c=function(e){function t(){return a(this,t),s(this,e.apply(this,arguments))}return u(t,e),t.prototype.createAction=function(e){return new this.engine.GotoAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this),n=this.getDestination();return t.destination=n.toJson(),t},t.prototype.getDestination=function(){return new o.default(this.action.GetDestination(),this.doc,this.engine)},t.prototype.setActionData=function(e){return this.setDestination(e.destination||e)},t.prototype.create=function(e){if(e.destination)return this.setDestination(e.destination)},t.prototype.setDestination=function(e){var t=this.doc;t.doc&&(t=t.doc);var n=o.default.create(this.engine,t,e);return this.action.SetDestination(n),!0},t}(r.default);t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(19)),o=a(n(44)),i=n(3);function a(e){return e&&e.__esModule?e:{default:e}}function s(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 c(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var d=function(e){function t(){return s(this,t),u(this,e.apply(this,arguments))}return c(t,e),t.prototype.createAction=function(e){return new this.engine.LaunchAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this),n=this.getFileSpec();return t.fileSpec=n.toJson(),t},t.prototype.getFileSpec=function(){return this.fileSpec=new o.default(this.action.GetFileSpec(),this)},t.prototype.setActionData=function(e){try{if(e.fileSpec)return this.create(e);e.buffer&&this.setFileSpec(e)}catch(e){return!1}return!0},t.prototype.create=function(e){if(e.fileSpec){var t=new this.engine.FileSpec(this.doc);return t.SetFileName((0,i.CWString)(this.engine,e.fileSpec.fileName)),this.action.SetFileSpec(t),!0}try{data.buffer&&this.setFileSpec(e)}catch(e){return!1}return!0},t.prototype.setFileSpec=function(e){var t=o.default.createFile(this.engine,this.doc,e.buffer);new o.default(t,this).setFileName(e.fileName),this.action.SetFileSpec(t)},t}(r.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(19);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.createAction=function(e){return new this.engine.NamedAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);return t.name=this.getName(),t},t.prototype.setActionData=function(e){try{this.setName(e.name)}catch(e){return!1}return!0},t.prototype.create=function(e){try{this.setName(e.name)}catch(e){return!1}return!0},t.prototype.getName=function(){return this.action.GetName().toString()},t.prototype.setName=function(e){var t=new this.engine.String(e);this.action.SetName(t),t.delete()},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(3),i=n(19);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(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 u(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var c=function(e){function t(){return a(this,t),s(this,e.apply(this,arguments))}return u(t,e),t.prototype.createAction=function(e){return new this.engine.JavaScriptAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);return t.javascript=this.getScript(),t},t.prototype.setActionData=function(e){try{this.setScript(e.script||e.javascript)}catch(e){return!1}return!0},t.prototype.create=function(e){var t=e.script;t||(t=e.javascript);try{t&&this.setScript(t)}catch(e){return!1}return!0},t.prototype.getScript=function(){return this.action.GetScript().toString()},t.prototype.setScript=function(e){var t=this.engine,n=(0,o.CWString)(t,e);this.action.GetDict().SetAtWString((0,o.CString)(t,"JS"),n),n.delete()},t}(((r=i)&&r.__esModule?r:{default:r}).default);t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(19);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.createAction=function(e){return new this.engine.SubmitFormAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);return t.flags=this.getFlags(),t.url=this.getURL(),t.fieldNames=this.getFieldNames(),t},t.prototype.setActionData=function(e){try{this.setFlags(e.flags||0),e.url&&this.setURL(e.url),e.fieldNames&&this.setFieldNames(e.fieldNames)}catch(e){return!1}return!0},t.prototype.create=function(e){try{e.flags&&this.setFlags(e.flags),e.url&&this.setURL(e.url),e.fieldNames&&this.setFieldNames(e.fieldNames)}catch(e){return!1}return!0},t.prototype.getFieldNames=function(){for(var e=this.action.GetFieldNames(),t=[],n=e.GetSize(),r=0;r<n;r++)t.push(e.GetAt(r).toString());return t},t.prototype.getFlags=function(){return this.action.GetFlags()},t.prototype.getURL=function(){var e=this.action.GetURL();return 0===e.GetLength()?null:this.JR.getPDFString(e)},t.prototype.setFieldNames=function(e){var t=this,n=new this.engine.WStringArray;e.forEach((function(e){var r=new t.engine.WString(e);n.Add(r),r.delete()}));var r=this.action.SetFieldNames(n);return n.delete(),r},t.prototype.setFlags=function(e){return this.action.SetFlags(Number(e))},t.prototype.setURL=function(e){return this.action.SetURL(new this.engine.String(e))},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(19);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.createAction=function(e){return new this.engine.ResetFormAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);return t.flags=this.getFlags(),t.fieldNames=this.getFieldNames(),t},t.prototype.setActionData=function(e){try{e.flags&&this.setFlags(e.flags),e.fieldNames&&this.setFieldNames(e.fieldNames)}catch(e){return!1}return!0},t.prototype.create=function(e){try{e.flags&&this.setFlags(e.flags),e.fieldNames&&this.setFieldNames(e.fieldNames)}catch(e){return!1}return!0},t.prototype.getFieldNames=function(){for(var e=this.action.GetFieldNames(),t=[],n=e.GetSize(),r=0;r<n;r++)t.push(e.GetAt(r).toString());return t},t.prototype.getFlags=function(){return this.action.GetFlags()},t.prototype.setFieldNames=function(e){var t=this,n=new this.engine.WStringArray;e.forEach((function(e){var r=new t.engine.WString(e);n.Add(r),r.delete()}));var r=this.action.SetFieldNames(n);return n.delete(),r},t.prototype.setFlags=function(e){return this.action.SetFlags(Number(e))},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(19)),o=a(n(44)),i=n(3);function a(e){return e&&e.__esModule?e:{default:e}}function s(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 c(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var d=function(e){function t(){return s(this,t),u(this,e.apply(this,arguments))}return c(t,e),t.prototype.createAction=function(e){return new this.engine.ImportDataAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this),n=this.getFDFFileSpec();return t.fileSpec=n.toJson(),t},t.prototype.setActionData=function(e){try{if(e.fileSpec)return this.create(e);e.buffer&&this.setFDFFileSpec(e)}catch(e){return!1}return!0},t.prototype.create=function(e){if(e.fileSpec){var t=new this.engine.FileSpec(this.doc);return t.SetFileName((0,i.CWString)(this.engine,e.fileSpec.fileName)),this.action.SetFDFFileSpec(t),!0}try{e.buffer&&this.setFDFFileSpec(e)}catch(e){return!1}return!0},t.prototype.getFDFFileSpec=function(){return this.fileSpec=new o.default(this.action.GetFDFFileSpec(),this)},t.prototype.setFDFFileSpec=function(e){var t=o.default.createFile(this.engine,this.doc,e.buffer);new o.default(t,this).setFileName(e.fileName),this.action.SetFDFFileSpec(t)},t}(r.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=i(n(19)),o=i(n(44));function i(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 s(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 u(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var c=function(e){function t(){return a(this,t),s(this,e.apply(this,arguments))}return u(t,e),t.prototype.createAction=function(e){return new this.engine.RenditionAction(e)},t.prototype.toJson=function(){for(var t=this,n=e.prototype.toJson.call(this),r=this.action.GetRenditionCount(),i=[],a=function(e){var n=t.action.GetRendition(e),r=n.GetMediaClipContentType(),a=void 0;try{a=r.toString()}catch(e){for(var s="",u=r.GetLength(),c=r.GetBuffer(),d=0;d<u;d++){var l=t.engine.HEAP8[c+d]>>>0&255;s+=String.fromCharCode(l)}a=s}var f=n.GetMediaClipFile(),h=f.GetFileName().toString(),p=new o.default(f,t),m=p.getFileSize(),g=new Uint8Array(m);p.getStream((function(e,t,n){var r=new Uint8Array(e);g.set(r,t)})),i.push({fileSize:m,fileName:h,contentType:a,buffer:g})},s=0;s<r;s++)a(s);return n.renditions=i,n},t}(r.default);t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(19);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.createAction=function(e){return new this.engine.HideAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);return t.fieldNames=this.getFieldNames(),t.hideState=this.getHideState(),t},t.prototype.getFieldNames=function(){for(var e=this.action.GetFieldNames(),t=[],n=0;n<e.GetSize();n++)t.push(e.GetAt(n).toString());return t},t.prototype.getHideState=function(){return this.action.GetHideState()},t.prototype.setActionData=function(e){try{this.setFieldNames(e.fieldNames),this.setHideState(e.hideState)}catch(e){return!1}return!0},t.prototype.create=function(e){try{e.fieldNames&&this.setFieldNames(e.fieldNames),this.setHideState(e.hideState)}catch(e){return!1}return!0},t.prototype.setFieldNames=function(e){var t=this,n=new this.engine.WStringArray;e.forEach((function(e){var r=new t.engine.WString(e);n.Add(r),r.delete()}));var r=this.action.SetFieldNames(n);return n.delete(),r},t.prototype.setHideState=function(e){return this.action.SetHideState(e)},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(19)),o=a(n(105)),i=a(n(44));function a(e){return e&&e.__esModule?e:{default:e}}function s(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 c(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var d=function(e){function t(){return s(this,t),u(this,e.apply(this,arguments))}return c(t,e),t.prototype.createAction=function(e){return new this.engine.RemoteGotoAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);t.destinationName=this.getDestinationName();var n=this.getDestination();t.destination=n.toJson();var r=this.getFileSpec();return t.fileSpec=r.toJson(),t.newWindowFlag=this.getNewWindowFlag(),t},t.prototype.getDestinationName=function(){return this.action.GetDestinationName().toString()},t.prototype.getDestination=function(){return new o.default(this.action.GetDestination(),this.doc,this.engine)},t.prototype.getFileSpec=function(){return this.fileSpec=new i.default(this.action.GetFileSpec(),this)},t.prototype.getNewWindowFlag=function(){return this.action.GetNewWindowFlag().value},t.prototype.setActionData=function(e){this.setDestination(e),e.destinationName&&this.setDestinationName(e.destinationName),this.setFileSpec(e.buffer,e.fileName),e.newWindowFlag&&this.setNewWindowFlag(e.newWindowFlag)},t.prototype.create=function(e){this.setDestination(e.destination),e.destinationName&&this.setDestinationName(e.destinationName),this.setFileSpec(e.buffer,e.fileName),e.newWindowFlag&&this.setNewWindowFlag(e.newWindowFlag)},t.prototype.setDestination=function(e){var t=this.doc,n=null;switch(e.type){case"ZoomXYZ":n=o.default.createXYZ;break;case"ZoomFitPage":n=o.default.createFitPage;break;case"ZoomFitHorz":n=o.default.createFitHorz;break;case"ZoomFitVert":n=o.default.createFitVert;break;case"ZoomFitRect":n=o.default.createFitRect;break;case"ZoomFitBBox":n=o.default.createFitBBox;break;case"ZoomFitBHorz":n=o.default.createFitBHorz;break;default:n=o.default.createFitBVert}var r=n(this.engine,t,e);return this.action.SetDestination(r),!0},t.prototype.setDestinationName=function(e){return this.action.SetDestinationName(e),!0},t.prototype.setFileSpec=function(e,t){var n=i.default.createFile(this.engine,this.doc,e);new i.default(n,this).setFileName(t),this.action.SetFileSpec(n)},t.prototype.setNewWindowFlag=function(e){var t=[this.engine.NewWindowFlag.e_NewWindowFlagFalse,this.engine.NewWindowFlag.e_NewWindowFlagTrue,this.engine.NewWindowFlag.e_NewWindowFlagNone];this.action.SetNewWindowFlag(t[e])},t}(r.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=s(n(19)),o=s(n(105)),i=s(n(44)),a=s(n(710));function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 d(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var l=function(e){function t(){return u(this,t),c(this,e.apply(this,arguments))}return d(t,e),t.prototype.createAction=function(e){return new this.engine.EmbeddedGotoAction(e)},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);t.destinationName=this.getDestinationName();var n=this.getDestination();t.destination=n.toJson();var r=this.getRootFile();return t.rootFile=r.toJson(),t.newWindowFlag=this.getNewWindowFlag(),this.action.GetTarget().IsEmpty()||(t.target=this.getTarget().toJson()),t},t.prototype.getDestinationName=function(){return this.action.GetDestinationName().toString()},t.prototype.getDestination=function(){return new o.default(this.action.GetDestination(),this.doc,this.engine)},t.prototype.getRootFile=function(){return this.fileSpec=new i.default(this.action.GetRootFile(),this)},t.prototype.getNewWindowFlag=function(){return this.action.GetNewWindowFlag().value},t.prototype.getTarget=function(){return new a.default(this.action.GetTarget(),this.engine,this.doc)},t.prototype.setActionData=function(e){this.setDestination(e),e.destinationName&&this.setDestinationName(e.destinationName),e.buffer&&this.setRootFile(e.buffer,e.fileName),e.newWindowFlag&&this.setNewWindowFlag(e.newWindowFlag),this.setTarget(e.target)},t.prototype.create=function(e){this.setDestination(e.destination),e.destinationName&&this.setDestinationName(e.destinationName),e.buffer&&this.setRootFile(e.buffer,e.fileName),e.newWindowFlag&&this.setNewWindowFlag(e.newWindowFlag),e.target&&this.setTarget(e.target)},t.prototype.setDestination=function(e){var t=this.doc,n=null;switch(e.type){case"ZoomXYZ":n=o.default.createXYZ;break;case"ZoomFitPage":n=o.default.createFitPage;break;case"ZoomFitHorz":n=o.default.createFitHorz;break;case"ZoomFitVert":n=o.default.createFitVert;break;case"ZoomFitRect":n=o.default.createFitRect;break;case"ZoomFitBBox":n=o.default.createFitBBox;break;case"ZoomFitBHorz":n=o.default.createFitBHorz;break;default:n=o.default.createFitBVert}var r=n(this.engine,t,e);return this.action.SetDestination(r),!0},t.prototype.setDestinationName=function(e){return this.action.SetDestinationName(e),!0},t.prototype.setRootFile=function(e,t){var n=i.default.createFile(this.engine,this.doc,e);new i.default(n,this).setFileName(t);try{this.action.SetRootFile(n)}catch(e){isNaN(e)||(e=this.engine.getErrorCode(e)),console.warn(e)}},t.prototype.setNewWindowFlag=function(e){var t=[this.engine.NewWindowFlag.e_NewWindowFlagFalse,this.engine.NewWindowFlag.e_NewWindowFlagTrue,this.engine.NewWindowFlag.e_NewWindowFlagNone];this.action.SetNewWindowFlag(t[e])},t.prototype.setTarget=function(e){var t=e.attachedFileName,n=e.fileAttachmentAnnotIndex,r=e.pageIndex,o=e.relationship,i=e.target,s=a.default.create(this.engine,this.doc),u=new a.default(s,this.engine,this.doc);t&&u.setAttachedFileName(t),n>=0&&u.setFileAttachmentAnnotIndex(n),r>=0&&u.setPageIndex(r),o&&u.setRelationship(o),i&&u.setTarget(i),this.action.SetTarget(s)},t}(r.default);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.engine=n,this.doc=r,this.embeddedGotoTarget=t}return e.create=function(e,t){return new e.EmbeddedGotoTarget(t)},e.prototype.toJson=function(){var e=this.getAttachedFileName(),t=this.getFileAttachmentAnnotIndex(),n=this.getPageIndex(),r=this.getRelationship(),o=void 0;return this.embeddedGotoTarget.GetTarget().IsEmpty()||(o=this.getTarget().toJson()),{attachedFileName:e,fileAttachmentAnnotIndex:t,pageIndex:n,relationship:r,target:o}},e.prototype.getAttachedFileName=function(){return this.embeddedGotoTarget.GetAttachedFileName().toString()},e.prototype.getFileAttachmentAnnotIndex=function(){return this.embeddedGotoTarget.GetFileAttachmentAnnotIndex()},e.prototype.getPageIndex=function(){return this.embeddedGotoTarget.GetPageIndex()},e.prototype.getRelationship=function(){return this.embeddedGotoTarget.GetRelationship().toString()},e.prototype.getTarget=function(){return new this.constructor(this.embeddedGotoTarget.GetTarget())},e.prototype.setAttachedFileName=function(e){this.embeddedGotoTarget.SetAttachedFileName(new this.engine.WString(e))},e.prototype.setFileAttachmentAnnotIndex=function(e){this.embeddedGotoTarget.SetFileAttachmentAnnotIndex(e)},e.prototype.setPageIndex=function(e){this.embeddedGotoTarget.SetPageIndex(e)},e.prototype.setRelationship=function(e){this.embeddedGotoTarget.SetRelationship(new this.engine.String(e))},e.prototype.setTarget=function(e){var t=e.attachedFileName,n=e.fileAttachmentAnnotIndex,r=e.pageIndex,o=e.relationship,i=e.target,a=this.constructor.create(this.engine,this.doc),s=new this.constructor(a,this.engine,this.doc);t&&s.setAttachedFileName(t),n>=0&&s.setFileAttachmentAnnotIndex(n),r>=0&&s.setPageIndex(r),o&&s.setRelationship(o),i&&s.setTarget(i),this.embeddedGotoTarget.SetTarget(a)},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=i(n(19)),o=i(n(226));function i(e){return e&&e.__esModule?e:{default:e}}function a(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var s=function(e){function t(n,r,i,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var s=function(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}(this,e.call(this,n,r,i,a));s.action=new s.engine.SetOCGStateAction(n);var u=r.doc||r;return s.pdflayer=new o.default(u,i),s}return a(t,e),t.prototype.toJson=function(){for(var t=e.prototype.toJson.call(this),n=[],r=[],o=this.action.GetOCGStateCount(),i=0;i<o;i++)for(var a=this.action.GetOCGStateArray(i),s=a.GetSize(),u=0;u<s;u++){var c=a.GetAt(u).GetObjNum();0===i?n.push(c):r.push(c)}return t.visibleLayerIds=n,t.hideLayerIds=r,t},t.prototype.setOCGState=function(e,t){var n=this.engine.OCGState,r=n.e_OCGStateOff,o=n.e_OCGStateOn;return e.length>0&&this._setState(e,r),t.length>0&&this._setState(t,o),this.toJson()},t.prototype._setState=function(e,t){for(var n=new this.engine.PDFDictionaryArray,r=0;r<e.length;r++){var o=this.pdflayer.getLayerNodeById(e[r]).layer_node;n.Add(o.GetDict())}this.action.InsertOCGStates(this.doc,0,t,n)},t.prototype.setActionData=function(e){this.create(e)},t.prototype.create=function(e){var t=e.hideLayerIds,n=e.visibleLayerIds;try{return this.setOCGState(t,n)}catch(e){return console.error(e),!1}},t}(r.default);t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(19);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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var a=function(e){function t(n,r,o,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(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}(this,e.call(this,n,r,o,i));return a.doc=r,a.engine=o,a.action=new a.engine.ThreadAction(n),a}return i(t,e),t.prototype.toJson=function(){var t=e.prototype.toJson.call(this);return this.action.IsDestThreadInCurrentDoc()?(t.dest_thread=this.action.GetDestinationThread(),t.dest_thread_index=this.action.GetDestinationThreadIndex(),t.dest_thread_title=this.action.GetDestinationThreadTitle().toString()):t.file_spec=this.action.GetFileSpec(),t},t.prototype.setActionData=function(e){try{this.setThreadIndex(e.dest_thread_index)}catch(e){return!1}return!0},t.prototype.create=function(e){try{this.setThreadIndex(e.dest_thread_index)}catch(e){console.error(e)}return!0},t.prototype.setThreadIndex=function(e){var t=new this.engine.FileSpec(this.doc);this.action.SetDestinationThreadIndex(t,e)},t}(((r=o)&&r.__esModule?r:{default:r}).default);t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(87)),o=u(n(714)),i=u(n(715)),a=u(n(716)),s=u(n(376));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.engine=t,this.jr=n}return e.prototype.get=function(e,t,n){var u=this.engine,c=u.GraphicsObjectType;switch(e.GetType()){case c.e_TypeText:return new o.default(e,t,n,u,this.jr);case c.e_TypePath:return new i.default(e,t,n,u,this.jr);case c.e_TypeImage:return new a.default(e,t,n,u,this.jr);case c.e_TypeFormXObject:return new s.default(e,t,n,u,this.jr);default:return new r.default(e,t,n,u,this.jr)}},e.prototype.create=function(e,t,n){var r=this.engine,s=r.GraphicsObjectType;switch(e.type){case s.e_TypeText.value:return o.default.create(e,t,n,r,this);case s.e_TypePath.value:return i.default.create(e,t,n,r,this);case s.e_TypeImage.value:return a.default.create(e,t,n,r,this);default:return}},e}();t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(87)),o=u(n(159)),i=n(373),a=n(3),s=u(n(38));function u(e){return e&&e.__esModule?e:{default:e}}function c(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function d(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var l=function(e){function t(n,r,o,i,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var s=function(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}(this,e.call(this,n,r,o,i));return s.graphicsObject=n.GetTextObject(),s.jr=a,s}return d(t,e),t.create=function(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=r.TextObject.Create(),c=e.originPosition;if(!c)throw new Error("originPosition is required");var d=c.x,l=c.y,f=e.charspace||0,h=e.wordspace||0,p=e.fontSize||12,m=e.textmatrix||[1,0,0,1],g=r.Mode.values[e.textmode||0],y=void 0;if(e.font){var _=e.font;if(void 0!==_.standardId)y=new r.Font(r.StandardID.values[_.standardId]);else{var v=new r.WString(_.name);y=new r.Font(v,_.styles,r.Charset.values[1==_.charset?0:_.charset],_.weight||0),(0,s.default)(v)}}else y=new r.Font((0,a.CWString)(r,"FoxitSansOTF"),458863,r.Charset.e_CharsetANSI,400);var b=u.GetTextState(t);b.font=y,b.font_size=p,b.charspace=f,b.wordspace=h,b.textmode=g;var S=new r.PointF(d,l);//!!info.italic, info.weight || 400);
283
+ if(b.origin_position=S,b.textmatrix=m,u.SetTextState(t,b,!1,400),e.matrix){var w=e.matrix;u.SetMatrix(new r.Matrix(w[0],w[1],w[2],w[3],w[4],w[5]))}var M=new r.WString(e.text||"");u.SetText(M),e.fillColor&&u.SetFillColor((4278190080|e.fillColor)>>>0),i=i||t.GetLastGraphicsObjectPosition(r.GraphicsObjectType.e_TypeAll),t.InsertGraphicsObject(i,u),e.text&&t.GenerateContent();var D=o.get(u,t,n);return e.text&&e.text.length>0&&D.setText(e.text),(0,s.default)(y,S,M),D},t.prototype.toJson=function(){var t=e.prototype.toJson.call(this),n={},r=this.engine,o=this.c_page,a=o.GetDocument(),s=this.graphicsObject.GetTextState(o),u=s.font,c={};if(!u.IsEmpty()){c.name=u.GetName().toString();var d=u.GetFamilyName().toString();c.familyName=d;var l=c.name;try{l=u.GetBaseFontName(a).toString()||l}catch(e){}c.baseName=l,c.ascent=u.GetAscent(),c.descent=u.GetDescent(),c.isItalic=u.IsItalic();var f=(c.isBold=u.IsBold())?700:400,h=void 0,p=c.styles=u.GetStyles(a),m=r.Charset.e_CharsetDefault.value;u.GetFontType(a)==r.FontTypes.e_FontTypeCIDFont&&(void 0!==(m=u.GetCIDCharset(a))&&m!==r.Charset.e_CharsetDefault||(m=r.Charset.values[(0,i.getCharsetFromName)(l)])||(m=r.Charset.e_CharsetANSI),m===r.CIDCharset.e_CIDCharsetJAPAN1?m=r.Charset.e_CharsetShift_JIS:m===r.CIDCharset.e_CIDCharsetKOREA1&&(m=r.Charset.e_CharsetHangeul),m=m.value),c.charset=m,u.IsEmbedded(a)?(c.isEmbedded=!0,c.nameKey="fv_"+this.id):u.IsStandardFont(a)?(c.isStandard=!0,c.standardId=u.GetStandard14Font(a).value,(h=(0,i.getGlyphMatch)(l,m,0,f,p))&&(h="fv_"+h[0].url.replace(/\./g,"_"),c.nameKey=h)):(h=(0,i.getGlyphMatch)(l,m,0,f,p))&&(h="fv_"+h[0].url.replace(/\./g,"_"),c.nameKey=h)}return n.textState={text:this.graphicsObject.GetText().toString(),charSpace:s.charspace,font:c,size:s.font_size,position:{x:s.origin_position.x,y:s.origin_position.y},matrix:[s.GetMatrixA(),s.GetMatrixB(),s.GetMatrixC(),s.GetMatrixD()],mode:s.textmode.value,wordSpace:s.wordspace},Object.assign({},t,n)},t.prototype.setText=function(e){for(var t=this.engine,n=this.c_page,r=n.GetDocument(),o=this.graphicsObject,s=o.GetTextState(n),u=o.GetMatrix(),c=parseInt(180*Math.atan2(u.b,u.a)/Math.PI),d=s.font,l=p(o,n,t.GraphicsObjectType.e_TypeText)||n.GetLastGraphicsObjectPosition(t.GraphicsObjectType.e_TypeAll),y=e.split(/\n/),_=[o],v=y.length-1;v>0;v--){var b=o.Clone().GetTextObject();_[v]=b,b.SetText((0,a.CWString)(t,"")),n.InsertGraphicsObject(l,b)}var S=[];if(d.IsEmpty())return Promise.resolve();if(d.IsStandardFont(r))for(var w=0,M=y.length;w<M;w++)if(e=y[w],o=_[w],!e||/^[\u0000-\u00FF]+$/.test(e))o.SetText(new this.engine.WString(e)),S[w]=[o];else{S[w]=m(e,/[\u0000-\u00FF]+/g,o,n,d,t,this,w)}else if(d.IsEmbedded(r))for(var D=o.GetText().toString(),P=new RegExp("^["+D+"]+$"),T=0,k=y.length;T<k;T++)e=y[T],o=_[T],!e||P.test(e)?(o.SetText(new this.engine.WString(e)),S[T]=[o]):S[T]=m(e,new RegExp("["+D+"]+","g"),o,n,d,t,this);else for(var A=0,L=y.length;A<L;A++)if(e=y[A],o=_[A],d.GetFontType(r)==t.FontTypes.e_FontTypeCIDFont){var F=f(t,d,r);if(F&&F!==t.Charset.e_CharsetDefault){var I=h(F=F.value);if(I)!e||new RegExp("^"+I.source+"$").test(e)?(o.SetText(new t.WString(e)),S[A]=[o]):S[A]=m(e,I,o,n,d,t,this,A);else{var x=g(e,o,n,d,t,0);S[A]=x,x.length>1&&(A||this.graphicsObject!==o||(this.graphicsObject=x[0]),n.RemoveGraphicsObject(o))}}else{var C=g(e,o,n,d,t,0);S[A]=C,C.length>1&&(A||this.graphicsObject!==o||(this.graphicsObject=C[0]),n.RemoveGraphicsObject(o))}}else{var R=d.GetName().toString();try{R=d.GetBaseFontName(r).toString()||R}catch(e){}var O=h((0,i.getCharsetFromName)(R,!1)||t.Charset.e_CharsetANSI.value);if(O)!e||new RegExp("^"+O.source+"$").test(e)?(o.SetText(new t.WString(e)),S[A]=[o]):S[A]=m(e,O,o,n,d,t,this,A);else{var G=g(e,o,n,d,t,0);S[A]=G,G.length>1&&(A||this.graphicsObject!==o||(this.graphicsObject=G[0]),n.RemoveGraphicsObject(o))}}for(var E=0,Y=0,j=0,N=S.length;j<N;j++)for(var B=S[j],H=0,W=B.length;H<W;H++){var U=B[H].GetRect(),z=U.top-U.bottom;E=Math.max(E,z);var J=U.right-U.left;Y=Math.max(Y,J)}E+=3,Y+=3;for(var V=0,K=0,q=1,Z=S.length;q<Z;q++){switch(c){case 0:V-=E;break;case 90:K+=Y;break;case 180:case-180:V+=E;break;case 270:case-90:K-=Y}for(var X=S[q],Q=0,$=X.length;Q<$;Q++){var ee=X[Q],te=ee.GetTextState(n);if(te.origin_position=new t.PointF(te.origin_position.x+K,te.origin_position.y+V),ee.SetTextState(n,te,!1,400),!ee.GetText().toString()){var ne=new t.WString("");ee.SetText(ne)}}}this.isParentPage()||this.parent.graphicsObject.GetGraphicsObjects().GenerateContent();return n.GenerateContent(),this.reParsePage()},t.prototype.setItalic=function(e){var t=this.c_page,n=t.GetDocument(),r=this.graphicsObject,o=this.engine,a=r.GetTextState(t),u=a.font,c=void 0;if(u.IsEmpty())return Promise.resolve();if(u.IsStandardFont(n)){var d=o.StandardID,l=u.GetStandard14Font(n),h=void 0;if(e)switch(l){case d.e_StdIDCourier:h=d.e_StdIDCourierI;break;case d.e_StdIDCourierB:h=d.e_StdIDCourierBI;break;case d.e_StdIDHelvetica:h=d.e_StdIDHelveticaI;break;case d.e_StdIDHelveticaB:h=d.e_StdIDHelveticaBI;break;case d.e_StdIDTimes:h=d.e_StdIDTimesI;break;case d.e_StdIDTimesB:h=d.e_StdIDTimesBI}else switch(l){case d.e_StdIDCourierI:h=d.e_StdIDCourier;break;case d.e_StdIDCourierBI:h=d.e_StdIDCourierB;break;case d.e_StdIDHelveticaI:h=d.e_StdIDHelvetica;break;case d.e_StdIDHelveticaBI:h=d.e_StdIDHelveticaB;break;case d.e_StdIDTimesI:h=d.e_StdIDTimes;break;case d.e_StdIDTimesBI:h=d.e_StdIDTimesB}h&&(c=new o.Font(h))}else{var p=u.GetStyles(n),m=o.Styles.e_StyleItalic.value;e?p|=m:p&=~m;var g=f(o,u,n),y=u.GetName().toString();try{y=u.GetBaseFontName(n).toString()||y}catch(e){}if(!g||g===o.Charset.e_CharsetDefault){var _=(0,i.getCharsetFromName)(y);if(-1===_)return Promise.resolve();g=o.Charset.values[_]}g&&g!==o.Charset.e_CharsetDefault||(g=o.Charset.e_CharsetANSI);var v=new o.WString(y);c=new o.Font(v,p,g,u.IsBold()?700:400),(0,s.default)(v)}if(c){if(a.font=c,r.SetTextState(t,a,!1,400),r.GetText().toString()||r.SetText(new this.engine.WString("")),!this.isParentPage())this.parent.graphicsObject.GetGraphicsObjects().GenerateContent();return t.GenerateContent(),(0,s.default)(c),this.reParsePage()}return Promise.resolve()},t.prototype.setBold=function(e){var t=this.c_page,n=t.GetDocument(),r=this.graphicsObject,o=this.engine,a=r.GetTextState(t),u=a.font,c=void 0;if(u.IsEmpty())return Promise.resolve();if(u.IsStandardFont(n)){var d=o.StandardID,l=u.GetStandard14Font(n),h=void 0;if(e)switch(l){case d.e_StdIDCourier:h=d.e_StdIDCourierB;break;case d.e_StdIDCourierI:h=d.e_StdIDCourierBI;break;case d.e_StdIDHelvetica:h=d.e_StdIDHelveticaB;break;case d.e_StdIDHelveticaI:h=d.e_StdIDHelveticaBI;break;case d.e_StdIDTimes:h=d.e_StdIDTimesB;break;case d.e_StdIDTimesI:h=d.e_StdIDTimesBI}else switch(l){case d.e_StdIDCourierB:h=d.e_StdIDCourier;break;case d.e_StdIDCourierBI:h=d.e_StdIDCourierI;break;case d.e_StdIDHelveticaB:h=d.e_StdIDHelvetica;break;case d.e_StdIDHelveticaBI:h=d.e_StdIDHelveticaI;break;case d.e_StdIDTimesB:h=d.e_StdIDTimes;break;case d.e_StdIDTimesBI:h=d.e_StdIDTimesI}h&&(c=new o.Font(h))}else{var p=u.GetStyles(n),m=o.Styles.e_StylesBold.value;e?p|=m:p&=~m;var g=f(o,u,n),y=u.GetName().toString();try{y=u.GetBaseFontName(n).toString()||y}catch(e){}if(!g||g===o.Charset.e_CharsetDefault){var _=(0,i.getCharsetFromName)(y);if(-1===_)return Promise.resolve();g=o.Charset.values[_]}g&&g!==o.Charset.e_CharsetDefault||(g=o.Charset.e_CharsetANSI);var v=new o.WString(y);c=new o.Font(v,p,g,e?700:400),(0,s.default)(v)}if(c){if(a.font=c,r.SetTextState(t,a,!1,400),r.GetText().toString()||r.SetText(new this.engine.WString("")),!this.isParentPage())this.parent.graphicsObject.GetGraphicsObjects().GenerateContent();return t.GenerateContent(),(0,s.default)(c),this.reParsePage()}return Promise.resolve()},t.prototype.setFontSize=function(e){var t=this.c_page,n=this.graphicsObject,r=n.GetTextState(t);r.font;if(r.font_size=e,n.SetTextState(t,r,!1,400),n.GetText().toString()||n.SetText((0,a.CWString)(this.engine,"")),!this.isParentPage()){var o=this.parent.graphicsObject.GetGraphicsObjects();o.GenerateContent()}return t.GenerateContent(),this.reParsePage()},t.prototype.setStandardFont=function(e){var t=this.graphicsObject,n=t.GetText().toString(),r=this.engine,o=this.c_page;e=r.StandardID.values[e];var i=t.GetTextState(o),a=i.font;return a=new r.Font(e),i.font=a,t.SetTextState(o,i,!1,400),this.setText(n)},t.prototype.setFontByName=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:458863,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.c_page,o=this.graphicsObject,i=o.GetText().toString(),a=o.GetTextState(r),u=a.font,c=this.engine,d=new c.WString(e);return u=new c.Font(d,t,c.Charset.values[n]||c.Charset.e_CharsetANSI,400),(0,s.default)(d),a.font=u,o.SetTextState(r,a,!1,400),this.setText(i)},t.prototype.setFillColor=function(e){(this.graphicsObject.SetFillColor((4278190080|e)>>>0),this.isParentPage())||this.parent.graphicsObject.GetGraphicsObjects().GenerateContent();return this.c_page.GenerateContent(),this.toJson()},t.prototype.reParsePage=function(){return Promise.resolve()},t.prototype.getWoff=function(){var e=this.engine,t=this.c_page,n=t.GetDocument(),r=this.graphicsObject.GetTextState(t).font;if(r.IsEmpty())return null;if(r.IsEmbedded(n))return o.default.getWoffDataBuffer(r.GetWoffData(n),this.engine);var i=f(e,r,n)||0;i&&(i=i.value);var a=r.GetName().toString();try{a=r.GetBaseFontName(n).toString()||a}catch(e){}var s=this.jr.getFontBuffer(a,r.GetStyles(n),0,i,r.IsBold()?700:400,!0);return s?{buffer:s}:null},t}(r.default);function f(e,t,n){var r=e.Charset,o=e.CIDCharset,i=void 0;if(t.GetFontType(n)==e.FontTypes.e_FontTypeCIDFont)switch(t.GetCIDCharset(n)){case o.e_CIDCharsetGB1:case o.CIDCharsetCNS1:case o.CIDCharsetJAPAN1:case o.CIDCharsetKOREA1:i=r.e_CharsetGB2312;break;case o.CIDCharsetUNICODE:i=r.e_CharsetANSI}return i}function h(e){switch(e){case 0:case 2:case 238:case 204:return/[\u0000-\u00FF]+/g;case 134:return/[\u0000-\u007f\u8140-\uA0FE\uA996\uA1A1-\uA9FE\uA840-\uA9A0\uF8A1-\uFEFE\uA140-\uA7A0\u200F-\u2027\u2E80-\u303F\u31C0-\u4DBF\u4E00-\u9FBF\uFF00-\uFFEF]+/g;case 136:return/[\u4E00-\uA0FE\uA140-\uA3BF\uA259-\uA261\uA3C0-\uA3FE\u2E80-\u303F\u31C0-\u4DBF\uFF00-\uFFEF]+/g;case 128:return/[\u0000-\u007f\u2E80-\u4DBF\u4E00-\u9FBF\uF900-\uFAFF\uFE30-\uFE4F]+/g;case 129:return/[\u0000-\u007f\u1100-\u11FF\u3130-\u318F\uAC00-\uD7AF\uFF00-\uFFEF\u2E80-\u303F\u31C0-\u4DBF\u4E00-\u9FBF\uF900-\uFAFF\uFE30-\uFE4F]+/g;case 222:return/[\u0E00-\u0E7F]+/g;case 161:case 162:case 186:return/[\u0370-\u03FF\u1F00-\u1FFF]+/g;case 177:return/[\u0590-\u05FF]+/g;case 178:return/[\u0600-\u06FF\u0750-\u077F\uFB50-\uFDFF\uFE70-\uFEFF]+/g;case 1:default:return!1}}function p(e,t,n){for(var r=t.GetFirstGraphicsObjectPosition(n);r;){if(t.GetGraphicsObject(r).GetTextObject().$$.ptr===e.$$.ptr)return r;r=t.GetNextGraphicsObjectPosition(r,n)}return r}function m(e,t,n,r,o,i,a,s){var u=[],d=0,l=t.exec(e),f=e.length;if(l){var h=l.index,m=l[0];h!==d&&u.push([0,e.slice(d,h)]),u.push([1,m]),d=h+m.length}else u=[[0,e]],d=f;for(;l=t.exec(e);){var y=l.index,_=l[0];u.push([0,e.slice(d,y)]),u.push([1,_]),d=y+_.length}d<f&&u.push([0,e.slice(d)]);for(var v=0,b=[],S=u.length,w=p(n,r,i.GraphicsObjectType.e_TypeText)||r.GetLastGraphicsObjectPosition(i.GraphicsObjectType.e_TypeAll),M=S;M--;){var D=n.Clone().GetTextObject();r.InsertGraphicsObject(w,D),b[M]=D}S&&(a.graphicsObject=b[0]);for(var P=void 0,T=[],k=0,A=S;k<A;k++){var L=b[k],F=u[k],I=F[0],x=F[1],C=L.GetTextState(r);if(C.origin_position=new i.PointF(C.origin_position.x+v,C.origin_position.y),L.SetTextState(r,C,!1,400),I)L.SetText(new i.WString(x)),T.push(L);else{var R=g(x,L,r,o,i,v);T.push.apply(T,c(R)),R.length>1&&(s||a.graphicsObject!==L||(a.graphicsObject=R[0]),r.RemoveGraphicsObject(L))}v+=(P=L.GetRect()).right-P.left+1}return S&&r.RemoveGraphicsObject(n),T}function g(e,t,n,r,o,i){var a=r.IsBold()?700:400,u=[o.Charset.e_CharsetANSI,o.Charset.e_CharsetSymbol,o.Charset.e_CharsetShift_JIS,o.Charset.e_CharsetHangeul,o.Charset.e_CharsetGB2312,o.Charset.e_CharsetChineseBig5],d=n.GetDocument(),l=function e(t){for(var n=[[/[\u0000-\u00FF]+/g,{name:"Arial",styles:32,charset:1}],[/[\u0000-\u007f\u8140-\uA0FE\uA996\uA1A1-\uA9FE\uA840-\uA9A0\uF8A1-\uFEFE\uA140-\uA7A0\u200F-\u2027\u2E80-\u303F\u31C0-\u4DBF\u4E00-\u9FBF\uFF00-\uFFEF]+/g,{name:"SimSun",styles:34,charset:134}],[/[\u4E00-\uA0FE\uA140-\uA3BF\uA259-\uA261\uA3C0-\uA3FE\u2E80-\u303F\u31C0-\u4DBF\uFF00-\uFFEF]+/g,{name:"SimSun",styles:34,charset:136}],[/[\u0000-\u007f\u2E80-\u4DBF\u4E00-\u9FBF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF]+/g,{name:"Meiryo",styles:34,charset:128}],[/[\u0000-\u007f\u1100-\u11FF\u3130-\u318F\uAC00-\uD7AF\uFF00-\uFFEF\u2E80-\u303F\u31C0-\u4DBF\u4E00-\u9FBF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF]+/g,{name:"Korean",styles:32,charset:129}],[/[\u0E00-\u0E7F]+/g,{name:"Angsana New",styles:32,charset:222}],[/[\u0370-\u03FF\u1F00-\u1FFF]+/g,{name:"Arial",styles:32,charset:161}],[/[\u0590-\u05FF]+/g,{name:"Aharoni",styles:32,charset:177}],[/[\u0600-\u06FF\u0750-\u077F\uFB50-\uFDFF\uFE70-\uFEFF]+/g,{name:"Arabic",styles:32,charset:178}]],r=0,o=n.length;r<o;r++)if(new RegExp("^"+n[r][0].source+"$").test(t))return[{text:t,info:n[r][1]}];for(var i=[],a=0,s=void 0,u=0,d=n.length;u<d;u++){for(n[u][0].lastIndex=a;s=n[u][0].exec(t);){var l=s.index;if(l>a){var f=t.slice(a,l);i.push.apply(i,c(e(f)))}var h=s[0];i.push({text:h,info:n[u][1]}),a=l+h.length}if(a>=t.length)break}return i.length?i:[{text:t,info:null}]}(e);if(1===l.length){var f=t,h=l[0].info;if(h){var m=t.GetTextState(n),g=o.Charset.values[h.charset]||o.Charset.e_CharsetANSI;m.font=new o.Font(new o.WString(h.name),h.styles,g,a);var y=m.font.IsEmbedded(d);if(m.font.IsSupportEmbedded(d)&&!y&&-1===u.indexOf(g)){var _=m.font.Embed(d);_.IsEmpty()||(m.font=_)}f.SetTextState(n,m,!1,400)}return f.SetText(new o.WString(l[0].text)),[f]}for(var v=p(t,n,o.GraphicsObjectType.e_TypeText)||n.GetLastGraphicsObjectPosition(o.GraphicsObjectType.e_TypeAll),b=[],S=l.length;S--;){var w=t.Clone().GetTextObject();n.InsertGraphicsObject(v,w),b[S]=w}for(var M=0,D=l.length;M<D;M++){var P=b[M],T=P.GetTextState(n),k=l[M],A=k.text,L=k.info,F=void 0;if(T.origin_position=new o.PointF(T.origin_position.x+i,T.origin_position.y),L){F=new o.WString(L.name);var I=o.Charset.values[L.charset]||o.Charset.e_CharsetANSI;T.font=new o.Font(F,L.styles,I,a);var x=T.font.IsEmbedded(d);if(T.font.IsSupportEmbedded(d)&&!x&&-1===u.indexOf(I)){var C=T.font.Embed(d);C.IsEmpty()||(T.font=C)}(0,s.default)(F)}P.SetTextState(n,T,!1,400),F=new o.WString(A),P.SetText(F);var R=P.GetRect();i+=R.right-R.left+1,(0,s.default)(F,T.origin_position)}return b}t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(87)),o=a(n(376)),i=a(n(38));function a(e){return e&&e.__esModule?e:{default:e}}function s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(n,r,o,i,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var s=function(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}(this,e.call(this,n,r,o,i,a));return s.graphicsObject=n.GetPathObject(),s}return s(t,e),t.prototype.toJson=function(){for(var t=this.graphicsObject,n=e.prototype.toJson.call(this),r=this.graphicsObject.GetPathData(),o=r.GetPointCount(),i=[],a=0;a<o;a++){var s=r.GetPoint(a);i.push({x:s.x,y:s.y,type:r.GetPointType(a).value})}var u={fillMode:t.GetFillMode().value,strokeState:t.GetStrokeState(),path:i,needStroke:t.GetStrokeState()};return Object.assign(u,n)},t.prototype.setBorderColor=function(t){return this.graphicsObject.SetStrokeState(0!==t),e.prototype.setBorderColor.call(this,t)},t.prototype.setFillColor=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(0===e)this.graphicsObject.SetFillColor(4278190080),this.graphicsObject.SetFillMode(this.engine.FillMode.e_FillModeNone);else{var n=255*this.graphicsObject.GetFillOpacity()|0;this.graphicsObject.SetFillColor((16777215&e|n<<24)>>>0),this.graphicsObject.SetFillMode(this.engine.FillMode.e_FillModeWinding)}return t&&this.c_page.GenerateContent(),this.toJson()},t.prototype.isPointInLine=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,r=this.graphicsObject.GetPathData(),i=r.GetPointCount(),a=void 0,s=void 0,u=void 0,l=void 0,f=void 0,h=void 0,p=this.graphicsObject.GetMatrix();if(this.page instanceof o.default){var m=this.page.graphicsObject.GetMatrix();m.Concat(p.a,p.b,p.c,p.d,p.e,p.f,!1),p.delete(),p=m}for(var g=[],y=0;y<i;y++){var _=r.GetPoint(y);switch(_=p.TransformPoint(_.x,_.y),r.GetPointType(y).value){case 1:s=a=[_.x,_.y];break;case 2:l=(u=[_.x,_.y])[0]-s[0],f=u[1]-s[1],h=Math.max(Math.abs(l),Math.abs(f));for(var v=0;v<h;v++){var b=[s[0]+l*v/h,s[1]+f*v/h];if(c([e,t],b)<n)return!0}s=u;break;case 3:l=s[0]-a[0],f=s[1]-a[1],h=Math.max(Math.abs(l),Math.abs(f));for(var S=0;S<h;S++){var w=[a[0]+l*S/h,a[1]+f*S/h];if(c([e,t],w)<n)return!0}a=s=[];case 4:case 5:var M=[_.x,_.y];if(g.push(M),h=Math.ceil(Math.max(Math.abs(_.x-s[0]),Math.abs(_.y-s[1]))),3==g.length){for(var D=0;D<h;D++){var P=d(D/h,s,g[0],g[1],g[2]);if(c([e,t],P)<n)return!0}g=[],s=M}}}return!1},t.create=function(e,t,n,r,o){var a=r.PathObject.Create();try{var s=new r.Path,u=[],c=void 0,d=!0,l=!1,f=void 0;try{for(var h,p=e.points[Symbol.iterator]();!(d=(h=p.next()).done);d=!0){var m=h.value;switch(m[0]){case"m":c=new r.PointF(m[1],m[2]),s.MoveTo(c),c.delete();break;case"l":c=new r.PointF(m[1],m[2]),s.LineTo(c),c.delete();break;case"c":u.push(new r.PointF(m[1],m[2])),3==u.length&&(s.CubicBezierTo(u[0],u[1],u[2]),u.length=0);break;case"h":s.CloseFigure()}}}catch(e){l=!0,f=e}finally{try{!d&&p.return&&p.return()}finally{if(l)throw f}}(0,i.default)(u),a.SetPathData(s),s.delete(),a.SetStrokeColor(4278190080);var g=a.GetGraphState();g.line_width=e.borderWidth||1,a.SetGraphState(g);var y=t.GetLastGraphicsObjectPosition(r.GraphicsObjectType.e_TypeAll);t.InsertGraphicsObject(y,a),t.GenerateContent(),t.StartParse(0,null,!0),y=t.GetLastGraphicsObjectPosition(r.GraphicsObjectType.e_TypeAll),a=t.GetGraphicsObject(y)}catch(e){isNaN(e)||(e=this.engine.getErrorCode(e)),console.warn(e)}return o.get(a,t,n)},t}(r.default);function c(e,t){var n=t[1]-e[1],r=t[0]-e[0];return Math.sqrt(r*r+n*n)}function d(e,t,n,r,o){var i=[1,1],a=1-e;return i[0]=t[0]*a*a*a+3*n[0]*e*a*a+3*r[0]*e*e*a+o[0]*e*e*e,i[1]=t[1]*a*a*a+3*n[1]*e*a*a+3*r[1]*e*e*a+o[1]*e*e*e,i}t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(87)),o=a(n(37)),i=n(375);function a(e){return e&&e.__esModule?e:{default:e}}function s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u=function(e){function t(n,r,o,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(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}(this,e.call(this,n,r,o,i));return a.imageObject=n.GetImageObject(),a}return s(t,e),t.prototype.setRotation=function(e){var t=e*Math.PI/180,n=this.graphicsObject.GetRect(),r={x:(n.right+n.left)/2,y:(n.top+n.bottom)/2},o=new this.engine.Matrix;return o.RotateAt(-t,-r.x,-r.y,0),this.graphicsObject.Transform(o,!0),this.c_page.GenerateContent(),o.delete(),this.toJson()},t.create=function(e,t,n,r,i){var a=r.ImageObject.Create(n.doc);try{var s=o.default.createImage(r,e.buffer);a.SetImage(s,0);var u=a.GetMatrix(),c=e.rect,d=c.left,l=c.right,f=c.top,h=c.bottom;u.a=l-d,u.d=f-h,u.Translate(d,h,0),a.SetMatrix(u);var p=t.GetLastGraphicsObjectPosition(r.GraphicsObjectType.e_TypeAll);t.InsertGraphicsObject(p,a),t.GenerateContent(),t.StartParse(0,null,!0),p=t.GetLastGraphicsObjectPosition(r.GraphicsObjectType.e_TypeAll),a=t.GetGraphicsObject(p)}catch(e){isNaN(e)||(e=this.engine.getErrorCode(e)),console.warn(e)}return i.get(a,t,n)},t.prototype.getStream=function(){var e=this.engine,t=this.imageObject.GetStream();if(t){var n=t.GetDataSize(!1);if(!(n<=0)){var r=e._malloc(n);t.GetData(!1,n,r);var o=(0,i.getArrayBufferFrom)(e,r,n);return e._free(r),o}}},t}(r.default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(22);var o=void 0,i={Release:function(){},TextChanged:function(){},IsShiftKeyDown:function(){},IsControlKeyDown:function(){},GetPageWindow:function(){return 33}},a={Release:function(){},OnSelectionChange:function(){postMessage({workflow:"out",type:"selectionChange"})},KillTimer:function(e){postMessage({workflow:"out",type:"toggleCaret",msg:!1}),clearInterval(e)},OnCaretChange:function(e,t,n){postMessage({workflow:"out",type:"caretChange",msg:{charProp:{lineLeading:e.fLineLeading,lineIndent:e.fLineIndent,alignment:e.nAlignment,enableSoftReturn:e.bEnableSoftReturn,rtl:e.bRTL,secSpace:e.fSecSpace},wordProp:{fontSize:t.fFontSize,wordColor:(0,r.intColorToHex)(t.dwWordColor),strokeColor:(0,r.intColorToHex)(t.dwStrokeColor),scriptType:t.nScriptType,wordStyle:t.nWordStyle,charSpace:t.fCharSpace,horzScale:t.nHorzScale,wordSpace:t.fWordSpace,xOffset:t.fXOffset,yOffset:t.fYOffset,renderingMode:t.nRenderingMode,lineWidth:t.fLineWidth,charCode:t.dwCharCode,alphal:t.nAlphal/255,isCross:Boolean(4&t.nWordStyle),isUnderline:Boolean(2&t.nWordStyle),isBold:Boolean(262144&t.nWordStyle||11===t.nRenderingMode),isItalic:Boolean(64&t.nWordStyle)},fontName:n}})},OnCursorChange:function(e,t){postMessage({workflow:"out",type:"cursorChange",msg:t.value})},OnEnterEdit:function(e,t){return postMessage({workflow:"out",type:"enterEdit",msg:t.value}),!1},OnProcessEdit:function(e,t){return postMessage({workflow:"out",type:"processEdit",msg:t.value}),!1}},s={Release:function(){},Show:function(e,t){postMessage({workflow:"out",type:"showTipMsg",msg:e})},MoveTo:function(e){postMessage({workflow:"out",type:"moveTip",msg:{x:e.x,y:e.y}})},SetTip:function(e,t){postMessage({workflow:"out",type:"setTipMsg",msg:e.toString()})}},u={},c={},d={Release:function(){},CreatePopupMenu:function(){var e=(Date.now()+1e3*Math.random()|0)%2147483647;return u[e]=[],e},CreatePopupSubMenu:function(){var e=(Date.now()+1e3*Math.random()|0)%2147483647;return u[e]=[],e},AppendMenuItem:function(e,t){var n={name:t,enable:!0,isCheck:!0,id:t};c[t]=n,u[e].push(n)},AppendSubMenu:function(e,t,n){u[e].push({name:t,subItems:u[n]})},RemoveMenuItem:function(e,t,n){},AppendSeparator:function(e){u[e].push({name:"-"})},EnableMenuItem:function(e,t,n,r){var o=c[t];o&&(o.enable=n)},CheckMenuItem:function(e,t,n){c[t].isCheck=n},InsertMenuItem:function(e,t,n,r){},InsertSeparator:function(e,t){},DestroyMenu:function(e){u={}},IsMenuEnabled:function(e){return!0}},l="",f={Release:function(){},CanPasteGraphicObject:function(){},GetClipboardText:function(){return new o.WString(l)},SetClipboardText:function(e,t){var n=t.toString();l=n,postMessage({workflow:"out",type:"setClipboardText",msg:n})},IsFormatAvailable:function(){return!0},PasteBitmap:function(){return!0},CopyBitmap:function(){},CopyGraphicObject:function(){},PasteGraphicObject:function(){}},h=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),o=t,this.setCallbacks(n),i.IsShiftKeyDown=n.IsShiftKeyDown,i.IsControlKeyDown=n.IsControlKeyDown;var u=t.EditPageContextCallback.implement(i),c=t.EditPageContext.Create(u);a.OnInvalid=n.OnInvalid,a.OnExitEdit=n.OnExitEdit,a.SetTimerCallback=this.SetTimerCallback.bind(this);var l=t.OperationNotifierCallback.implement(a),h=t.TipsCallback.implement(s),p=t.ClipboardCallback.implement(f);c.SetOperationNotifierCallback(l),c.SetTipsCallback(h),c.SetClipboardCallback(p);var m=t.PopupMenuCallback.implement(d);c.SetPopupMenuCallback(m),c.SetRotateCtrlIcon(r[0]),c.SetBitmap(t.ImageResourceID.e_ImageResourceIDRedPoint,r[1]),c.SetBitmap(t.ImageResourceID.e_ImageResourceIDBluePoint,r[2]),c.SetBitmap(t.ImageResourceID.e_ImageResourceIDGreenPoint,r[3]),c.SetSystemDPI(96,96),this.context=c}return e.prototype.SetTimerCallback=function(e,t){var n=setInterval((function(){o.OnTimeout(t,n)}),e);return postMessage({workflow:"out",type:"toggleCaret",msg:!0}),n},e.prototype.setCallbacks=function(e){return this.callbacks=e,["GetRenderMatrix","GetClientRect","GetPageVisibleRect","GetPageRect","GetPageViewScale","GetDefaultEditorPage","GetLatestPDFPage","GetTemplate","GetToolbarFontName","GetString"].forEach((function(t){return i[t]=e[t]})),["OnInvalid","OnSetPropsAsDefault","OnAddUndo","OnUndoRedoBeginEdit","OnUndoRedoEndEdit"].forEach((function(t){return a[t]=e[t]})),d.TrackPopupMenu=function(t,n,r,o){return e.TrackPopupMenu(u[t],n,r,o)},["CopyGraphicObject","PasteGraphicObject","CanPasteGraphicObject"].forEach((function(t){return f[t]=e[t]})),this.context},e}();t.default=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=navigator.platform,o=0;/^win/i.test(r)?o=0:/^mac/i.test(r)?o=1:(/^linux/i.test(r)||/^x11/i.test(r))&&(o=2),t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=(n(3),i(n(110)));n(167),i(n(379));function i(e){return e&&e.__esModule?e:{default:e}}function a(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var s={},u={},c=new(function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(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}(this,e.call(this));return n.workerObj=s,n.apis=u,n}return a(t,e),t}(o.default)),d=void 0,l=function(e,t){if(!t)throw console.warn(e),new Error("Unable to updateField: document not found by id: "+e)};function f(e,t,n){return s.getDocByID(n).then((function(e){return e.hasForm()?e.loadForm().toJson():null})).then((function(t){var n=[];t&&(n=t.fields.map((function(e){return e.image?e.image.buffer:null})).filter(Boolean)),s.resolve(e,t,n)})).catch((function(r){if(isNaN(r)||(r=t.getErrorCode(r)),r!==t.ErrorCode.e_ErrDataNotReady)throw r;setTimeout((function(){f(e,t,n)}),200)}))}u.loadForm=function(e,t){var n=t.docId;if(d)return f(e,d,n);s.jrPromise.then((function(t){return d=t.engine,f(e,d,n)}))},u.hasForm=function(e,t){var n=t.docId;return s.getDocByID(n).then((function(t){s.resolve(e,t.hasForm())}))},u.updateField=function(e,t){var n=t.docId,r=t.title,o=t.key,i=t.value;return s.getDocByID(n).then((function(e){var t=e.loadForm().getField(r);return t.update(o,i)||t.toJson()})).then((function(t){s.resolve(e,t)}))},u.setFieldValue=function(e,t){var n=t.docId,r=t.title,o=t.value;return s.getDocByID(n).then((function(t){l(n,t),t.loadForm().getField(r).setValue(o),s.resolve(e)}))},u.updateMKProperty=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.key,a=t.value;return s.getDocByID(n).then((function(e){return e.getPageById(r).getAnnotById(o)})).then((function(t){s.resolve(e,t.updateMKProperty(i,a))}))},u.setWidgetAS=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.AS;return s.getDocByID(n).then((function(e){return e.getPageById(r).getAnnotById(o)})).then((function(t){return t.setAS(i),s.resolve(e)}))},u.getFieldsValue=function(e,t){var n=t.docId;return s.getDocByID(n).then((function(t){var n=t.loadForm();s.resolve(e,n.getFieldsValue())}))},u.addControl=function(e,t){var n=t.docId,r=t.pageIndex,o=t.fieldName,i=t.fieldType,a=t.rect,u=t.options;return s.getDocByID(n).then((function(e){l(n,e);var t=e.loadForm(),s=t.engineForm,c=e.engine,d=e.JR,f=new c.WString(""),h=s.GetFieldCount(f);f.delete();var p=new c.CFX_FloatRect(a.left,a.bottom,a.right,a.top);return e.getPageByIndex(r).then((function(n){var r=new c.WString(o);if(o){var a=s.ValidateFieldName(c.FieldType.values[i],r);if(!a)for(var l=o.replace(/[^0-9]/gi,""),f=o.substr(0,o.indexOf(l)),m=parseInt(l);m++,r=new c.WString(f+m),!(a=s.ValidateFieldName(c.FieldType.values[i],r)););}var g=void 0,y=void 0;if(7==i){if((y=n.page.AddSignature(p,r,c.SignatureType.e_SignatureTypeOrdinary,!1)).IsEmpty())return{failed:!0}}else try{var _=(g=s.AddControl(n.page,r,c.FieldType.values[i],p)).GetWidget();if(u&&void 0!==u.mkRotate&&_.SetMKRotation({value:u.mkRotate}),1==i){var v=_.GetMKIconFit();v.horizontal_fraction=parseFloat(.5),v.vertical_fraction=parseFloat(.5),v.scale_way_type||(v.scale_way_type=c.ScaleWayType.e_ScaleWayAlways),_.SetMKIconFit(v)}if(u&&u.stateName,u&&"CreateImageStateHandler"===u.stateName){_.SetMKIconCaptionRelation(c.MKIconCaptionRelation.e_MKRelationNoCaption),_.SetHighlightingMode(c.HighlightingMode.e_HighlightingInvert);var b=_.GetMKIconFit();b.is_proportional_scaling=!0,_.SetMKIconFit(b);var S=d.createReaderCallback(u.imagePath),w=new c.Image(S);_.SetMKNormalIconImage(w,0);var M=c.Action.Create(e.doc,c.ActionType.e_TypeJavaScript),D=new c.JavaScriptAction(M);D.SetScript(new c.WString("event.target.buttonImportIcon()")),_.SetAction(D)}_.ResetAppearanceStream(),y=g.GetField()}catch(e){console.log(e)}if(!y)throw new Error("Field not exist");if(y.IsEmpty())throw new Error("Permission error");p.delete();var P=new c.WString(""),T=s.GetFieldCount(P);return P.delete(),r.delete(),n.update().then((function(){var e=y.GetFlags(),n=y.GetDict();if(n){var r=new c.String("Ff"),a=n.GetElement(r);a&&(e=a.GetInteger()),r.delete()}if(o=y.GetName().toString(),0==h)return t.toJson().then((function(t){return{form:t,fieldName:o,fieldFlags:e}}));if(T==h)return t.getField(o).getControlsJson().then((function(t){return{controls:t,fieldName:o,fieldFlags:e}}));var s=t.addJRField(y,o,T-1);return 7==i?s.toJson():s.getControlsJson().then((function(t){return{controls:t,fieldName:o,fieldFlags:e}}))}))}))})).then((function(t){s.resolve(e,t)}))},u.validateFieldName=function(e,t){var n=t.docId,r=t.fieldName,o=t.fieldType;return s.getDocByID(n).then((function(e){l(n,e),8==o&&(o=6);var t=e.engine;return e.loadForm().engineForm.ValidateFieldName(t.FieldType.values[o],new t.WString(r))})).then((function(t){s.resolve(e,t)}))},u.renameField=function(e,t){var n=t.docId,r=t.fieldName,o=t.newName;return s.getDocByID(n).then((function(e){l(n,e);var t=e.engine,i=e.loadForm(),a=i.engineForm;delete e.form;var s=new t.WString(r),u=a.GetField(0,s);s.delete(),s=new t.WString(o);for(var c=a.RenameField(u,s),d=(u=a.GetField(0,s)).GetControlCount(),f=0;f<d;f++){u.GetControl(f).GetWidget().ResetAppearanceStream()}return s.delete(),i.destroy(),!!c&&e.loadForm().toJson()})).then((function(t){s.resolve(e,t)}))},u.removeField=function(e,t){var n=t.docId,r=t.fieldName;return s.getDocByID(n).then((function(e){if(!e)throw console.warn(n),new Error(n);var t=e.engine,o=e.loadForm().engineForm,i=new t.WString(r),a=o.GetField(0,i);i.delete();for(var s={},u=a.GetControlCount(),c=0;c<u;c++){s[a.GetControl(c).GetWidget().GetPage().GetIndex()]=1}7==a.GetType().value?e.doc.RemoveSignature(new t.Signature(a)):o.RemoveField(a),e.reloadPageAnnots(Object.keys(s))})).then((function(t){s.resolve(e,!0)}))},u.removeControl=function(e,t){var n=t.docId,r=t.pageIndex,o=t.fieldName,i=t.controlObjectNumber;return s.getDocByID(n).then((function(t){l(n,t);var a=t.loadForm(),u=a.engineForm,c=a.getField(o).engineField;if(7==c.GetType().value)r=c.GetControl(0).GetWidget().GetPage().GetIndex(),t.doc.RemoveSignature(c);else{for(var d=c.GetControlCount(),f=void 0,h=0;h<d;h++){var p=c.GetControl(h);p.GetWidget().GetDict().GetObjNum()==i&&(r=(f=p).GetWidget().GetPage().GetIndex())}f&&!f.IsEmpty()&&u.RemoveControl(f)}t.getPageByIndex(r).then((function(e){e.update()})),s.resolve(e,!0)}))},u.fixPageFields=function(e,t){var n=t.docId,r=t.pageIndex;return s.getDocByID(n).then((function(t){l(n,t),t.loadForm().engineForm.FixPageFields(r),s.resolve(e,!0)}))},u.getControlCount=function(e,t){var n=t.docId,o=t.pageIndex;return s.getDocByID(n).then((function(e){return l(n,e),Promise.all([e,e.getPageByIndex(o)])})).then((function(e){var t=r(e,2),n=t[0],o=t[1];return o.isVirtual?0:n.loadForm().engineForm.GetControlCount(o.page)})).then((function(t){s.resolve(e,t)}))},u.setFieldsValue=function(e,t){var n=t.docId,r=t.fieldsValue,o=t.resetAP;return s.getDocByID(n).then((function(t){l(n,t),t.loadForm().setFieldsValue(r,o),s.resolve(e,!0)}))},u.updateFormControl=function(e,t){var n=t.docId,r=t.fieldName,o=t.objectNumber,i=t.key,a=t.value;return s.getDocByID(n).then((function(t){l(n,t);var u=t.loadForm().updateFormControl(r,o,i,a);s.resolve(e,u||!0)}))},u.setLockAction=function(e,t){var n=t.docId,r=t.title,o=t.type,i=t.fieldNames;return s.getDocByID(n).then((function(e){l(n,e),e.loadForm().getField(r).setLockAction(o,i)})).then((function(){s.resolve(e)}),(function(t){s.reject(e,{err:-1},[],t)}))},u.getControlPageIndex=function(e,t){var n=t.docId,r=t.fieldName,o=t.objectNumber;return s.getDocByID(n).then((function(e){l(n,e);for(var t=e.loadForm().getField(r).engineField,i=t.GetControlCount(),a=0;a<i;a++){var s=t.GetControl(a);if(o==s.GetDictionaryObjectNumber()){var u=s.GetWidget();return u.IsEmpty()?-1:u.GetPage().GetIndex()}}return-1})).then((function(t){s.resolve(e,t)}),(function(t){s.reject(e,{err:-1},[],t)}))},u.copyControls=function(e,t){var n=t.docId,o=(t.pageIndex,t.dstPageIndex),i=t.controls;return s.getDocByID(n).then((function(e){return l(n,e),Promise.all([0,e.getPageByIndex(o)]).then((function(t){var n=r(t,2),o=n[0],a=n[1];return e.loadForm().copyControls(o,a,i)}))})).then((function(t){s.resolve(e,t)}),(function(t){s.reject(e,{err:-1},[],t)}))},u.duplicateWidget=function(e,t){var n=t.docId,r=t.pages,o=t.fieldName,i=t.objectNumber;return s.getDocByID(n).then((function(e){l(n,e);var t=r.map((function(t){return e.getPageByIndex(t)})),a=e.loadForm();return Promise.all(t).then((function(e){return a.duplicateWidget(e,o,i)}))})).then((function(t){s.resolve(e,t)}),(function(t){s.reject(e,{err:-1},[],t)}))},u.removeAction=function(e,t){var n=t.docId,r=t.pageId,o=t.annotId,i=t.trigger,a=(t.parentObject,t.objectNumber);return s.getDocByID(n).then((function(e){return e.getPageById(r).getAnnotById(o)})).then((function(t){s.resolve(e,t.removeAction(i,a))}))},u.duplicateField=function(e,t){var n=t.docId,o=t.fieldName,i=t.pageIndex,a=t.annotObjNum,u=t.columns,c=t.rows,d=t.positions;return s.getDocByID(n).then((function(e){return l(n,e),Promise.all([e,e.getPageByIndex(i)])})).then((function(e){var t=r(e,2),n=t[0],i=t[1];return n.loadForm().duplicateField(o,i,a,u,c,d)})).then((function(e){return e.loadForm().toJson()})).then((function(t){s.resolve(e,t)}),(function(t){s.reject(e,{err:-1},[],t)}))},u.setCO=function(e,t){var n=t.docId,r=t.CO;return s.getDocByID(n).then((function(t){l(n,t);t.engine;t.loadForm().setCO(r),s.resolve(e,!0)}))},u.moveControl=function(e,t){var n=t.docId,r=t.fieldId,o=t.fieldName,i=t.newName;return s.getDocByID(n).then((function(e){l(n,e);for(var t=e.engine,a=e.loadForm(),s=a.engineForm,u=a.getField(o).engineField,c=u.GetControlCount(),d=new t.WString(i),f="",h=0;h<c;h++){var p=u.GetControl(h);if(p.GetWidget().GetDict().GetObjNum()===r){f=s.MoveControl(p,d);break}}return delete e.form,d.delete(),a.destroy(),!!f&&e.loadForm().toJson()})).then((function(t){s.resolve(e,t)}))},u.getAAJson=function(e,t){var n=t.docId,r=t.fieldName;return s.getDocByID(n).then((function(e){return e.loadForm().getField(r).getAAJson()})).then((function(t){s.resolve(e,t)}))},t.default=c.extendsWorkerAPI.bind(c)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={success:0,file:1,format:2,password:3,handle:4,certificate:5,unknown:6,invalidLicense:7,param:8,unsupported:9,outOfMemory:10,securityHandler:11,notParsed:12,notFound:13,invalidType:14,conflict:15,unknownState:16,dataNotReady:17,invalidData:18,xFALoadError:19,notLoaded:20,invalidState:21,notCDRM:22,canNotConnectToServer:23,invalidUserToken:24,noRights:25,rightsExpired:26,deviceLimitation:27,canNotRemoveSecurityFromServer:28,canNotGetACL:29,canNotSetACL:30,isAlreadyCPDF:31,isAlreadyCDRM:32,canNotUploadDocInfo:33,canNotUploadCDRMInfo:34,invalidWrapper:35,canNotGetClientID:36,canNotGetUserToken:37,invalidACL:38,invalidClientID:39,OCREngineNotInit:40,diskFull:41,OCRTrialIsEnd:42,filePathNotExist:43,complianceEngineNotInit:44,complianceEngineInvalidUnlockCode:45,complianceEngineInitFailed:46,timeStampServerMgrNotInit:47,LTVVerifyModeNotSet:48,LTVRevocationCallbackNotSet:49,LTVCannotSwitchVersion:50,LTVCannotCheckDTS:51,LTVCannotLoadDSS:52,LTVCannotLoadDTS:53,needSigned:54,complianceResourceFile:55,timeStampServerMgrNoDefaltServer:56,defaultTimeStampServer:57,noConnectedPDFModuleRight:58,noXFAModuleRight:59,noRedactionModuleRight:60,noRMSModuleRight:61,noOCRModuleRight:62,noComparisonModuleRight:63,noComplianceModuleRight:64,noOptimizerModuleRight:65,noConversionModuleRight:66,collaborationSession:1400}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(380)),o=a(n(168)),i=a(n(381));function a(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var u=function(){function e(){s(this,e),this.init.apply(this,arguments)}return e.prototype.init=function(){if(1==arguments.length)this.info={type:arguments[0]};else{var e=Array.prototype.slice.call(arguments),t=e[0],n=e[1],r=e[2],o=(e[3],e[4]),i=e[5];this.info=t,this.factory=n,this.doc=r,this.host=i,this.eventEmitter=o}this.initSubAction()},e.prototype.checkInserted=function(){if(!this.doc.api)throw new Error("Please insert this action to a host first.")},e.prototype.initSubAction=function(){var e=this;this.subAction=[],this.info.subAction&&this.info.subAction.forEach((function(t){e.subAction.push(e.factory.createAction(t,e.doc,e.doc.api,e.eventEmitter,e.host))}))},e.prototype.appendSubAction=function(e){this.subAction.push(e),this.info.subAction=this.info.subAction||[],this.info.subAction.push(e.info)},e.prototype.getType=function(){return this.info.type},e.prototype.getSubActionCount=function(){return this.info.subAction.length||0},e.prototype.getSubAction=function(e){return this.subAction[e]},e.prototype.insertSubAction=function(t,n){var r=this;if(this.checkInserted(),"number"!=typeof t)throw new Error("param error. Only number is available.");return t=Math.max(0,Math.min(t,this.getSubActionCount())),n instanceof e&&(n=n.getType()),this.doc.api.insertSubAction(this.doc.getId(),this.info.objNumber,t,n).then((function(e){return r.updateAction(e),e}))},e.prototype.setSubAction=function(t,n){var r=this;if(this.checkInserted(),"number"!=typeof t)throw new Error("param error. Only number is available.");var o=this.getSubActionCount();if(0===o)throw new Error("Cannot be set without sub action.");return t=Math.max(0,Math.min(t,o-1)),n instanceof e&&(n=n.getType()),this.doc.api.setSubAction(this.doc.getId(),this.info.objNumber,t,n).then((function(e){return r.updateAction(e),e}))},e.prototype.removeAllSubActions=function(){var e=this;if(this.doc.api)return this.doc.api.removeAllSubActions(this.doc.getId(),this.info.objNumber).then((function(t){e.updateAction(t)}))},e.prototype.removeSubAction=function(e){var t=this;if(this.doc.api){if("number"!=typeof e)throw new Error("param error. Only number is available.");var n=this.getSubActionCount();if(0===n)throw new Error("Cannot be remove without sub action.");return e=Math.max(0,Math.min(e,n-1)),this.doc.api.removeSubAction(this.doc.getId(),this.info.objNumber,e).then((function(e){t.updateAction(e)}))}},e.prototype.setActionData=function(e){var t=this;return this.doc.api.setActionData(this.doc.getId(),this.info.objNumber,e).then((function(e){t.updateAction(e)}))},e.prototype.updateAction=function(e){Object.assign(this.info,e),this.initSubAction(),this.host&&(this.eventEmitter.emit(o.default.actionUpdated,this.host),this.host instanceof r.default&&this.eventEmitter.emit(o.default.annotationUpdated,[this.host],this.host.getPDFPage(),"widget"===this.host.getType()?i.default.formFieldActionUpdated:i.default.actionDataUpdated))},e.prototype.checkOutData=function(e){return!0},e.prototype.exportToJson=function(){return{type:this.getType()}},e}();t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNameEncode=t.xfdfJsonToAddJson=t.default=void 0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(20),i=n(167);function a(e){return{unknowntype:"UnKnownType",text:"Text",link:"Link",freetext:"FreeText",line:"Line",square:"Square",circle:"Circle",polygon:"Polygon",polyline:"PolyLine",highlight:"Highlight",underline:"Underline",squiggly:"Squiggly",strikeout:"StrikeOut",stamp:"Stamp",caret:"Caret",ink:"Ink",psink:"PsInk",fileattachment:"FileAttachment",sound:"Sound",movie:"Movie",widget:"Widget",screen:"Screen",printermark:"PrinterMark",trapnet:"TrapNet",watermark:"Watermark","3d":"3D",popup:"Popup",redact:"Redact"}[e.toString().toLowerCase()]}var s="WRRRRRRRRWWRWWRRRRRRRRRRRRRRRRRRWRRRRDRRDDRNRNNDNNNNNNNNNNRRDRDRRRRRRRRRRRRRRRRRRRRRRRRRRRRDRDRRRRRRRRRRRRRRRRRRRRRRRRRRRRRDRDRRWRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRW";function u(e){var t=e.length,n=0,r=void 0;for(r=0;r<t;r++){var o=e.charCodeAt(r);o>=128||"W"==s[o]||"#"==e[r]||"D"==s[o]?n+=3:n++}if(n==t)return e;var i="";for(r=0;r<t;r++){var a=e.charCodeAt(r);if(a>=128||"W"==s[a]||"#"==e[r]||"D"==s[a]){if("W"==s[a]&&0==a)continue;i+="#",i+="0123456789ABCDEF"[parseInt(a/16)],i+="0123456789ABCDEF"[a%16]}else i+=e[r]}return i}function c(e){var t=void 0;for(t=0;t<e.length&&!(e.charCodeAt(t)>255);t++);if(t===e.length)return"("+e.replace(/([\(|\)])/g,"\\$1")+")";var n="<FEFF";for(t=0;t<e.length;t++){for(var r=e.charCodeAt(t).toString(16);r.length<4;)r="0"+r;n+=r}return n+">"}function d(e){for(var t=[],n=0;n<e.length;n++)t.push(e.charCodeAt(n));return new Uint8Array(t)}var l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.JSONToFDF=function(t){for(var n={next:2,annotRef:[],file:"%FDF-1.2\n1 0 obj<</FDF<</Annots[{annotsRefArray}]>>/Type/Catalog>>endobj\n"},r=[],o=0,i=t.length;o<i;o++){var a=t[o];a.type&&(a.deleted?r.push({name:a.name,page:a.page}):e.singleAnnotJSONToFDF(n,a,!1))}return new Blob([d(n.file.replace(/\{annotsRefArray\}/,n.annotRef.join(" "))+"trailer\n<</Root 1 0 R>>\n%%EOF")],{type:"application/fdf"})},e.singleAnnotJSONToFDF=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=void 0,s=t.next;if(r?i="Popup":r="popup"==(i=a(n&&n.type&&n.type.toLowerCase()||"")).toLowerCase(),!i||"link"==i.toLowerCase()||"screen"==i.toLowerCase()||"sound"==i.toLowerCase())return 0;var d=n.style||"S";d=d.toUpperCase()[0];var l=n.width,h=n.color||"",m="C"==d?"C":"S",g=n.intensity,y=0===n.opacity?0:n.opacity||1,_=c(n.contents||""),v=n.flags||"print",b=v.split(",");for(var S in v=0,o.AnnotFlagsName)-1!=b.indexOf(o.AnnotFlagsName[S])&&(v|=1<<parseInt(S));var w=n.creationdate,M=n.date,D=n.name||"",P=n.page,T=(n.rect||"").replace(/,/g," "),k=c(n.subject||"subject"),A=c(n.title||"title"),L=n["interior-color"]||n.interiorColor,F=s+" 0 obj\n<</Rect ["+T+"]/Subtype /"+i+"/NM ("+D+")";for(var I in n.customEntries)F+="/"+I+" "+c(n.customEntries[I])+"\n";if(t.annotRef.push(s+" 0 R "),t.next++,!r){if(F+="/M ("+M+")/CA "+y+"/Contents "+_+"/CreationDate ("+w+")/F "+v+"/Page "+P+"/Subj "+k+"/T "+A+"/Type /Annot",n.replyType){var x=void 0;F+="/RT /"+((x="string"==typeof n.replyType&&n.replyType||"Group")[0].toUpperCase()+x.substr(1))}n.inreplyto&&(F+="/IRT ("+n.inreplyto+")"),n.measureRatio&&(F+="/Measure<</R("+n.measureRatio+")/X[<</C "+n.measureConversionFactor+"/U("+n.measureUnit+")>>]/Type/Measure/Subtype/RL>>")}if(d||l){d=d||"S",l=l||"0",g=g||"0",m=m||"S";var C=(n.dashes||"").replace(/,/g," ");F+="/BS <</S /"+d+" /W "+l+" /D ["+C+"]>>/BE <</S /"+m+" /I "+g+">>"}"FreeText"!=i?(h&&(F+="/C "+p(h)),L&&(F+="/IC "+p(L))):(L&&(F+="/C "+p(L)),h&&(F+="/IC "+p(h),F+="/DS (color:"+n.fontColor+")")),void 0!==n.rotation&&(F+="/Rotate "+n.rotation);var R="";switch(i){case"Text":case"Note":F=F.replace(/\/Subtype\s?\/Note/,"/Subtype /Text"),n.icon&&(F+="/Name/"+u(n.icon));var O=void 0;(O=n.state)&&(F+="/State("+O+")/StateModel("+n.statemodel+")");break;case"Link":return"";case"FreeText":F=F.replace(/\/C\s?\[[\s\S]*?\]/,""),L&&(F+="/C "+p(L));var G=n.defaultappearance,E=n.justification,Y="/DA ("+G+")/Q "+E,j=n.intent||n.IT;if(j&&(Y+="/IT /"+j),n.callout){var N=n.callout.replace(/,/g," ");Y+="/CL ["+N+"]",Y+="/LE/"+n.head}if(n.fringe){var B=n.fringe.replace(/,/g," ");Y+="/RD ["+B+"]"}R=Y;break;case"Line":var H="yes"===n.caption,W=n.head,U=n.tail,z="[/"+W+"/"+U+"]",J=n.leaderLength,V=n.start.replace(/,/g," "),K=n.end.replace(/,/g," "),q=V+" "+K,Z=n.leaderExtend,X=n.leaderOffset,Q=n.captionOffset?n.captionOffset.x+" "+n.captionOffset.y:"",$=n.intent,ee="/Cap "+H+"/LE "+z+"/LL "+J+"/L ["+q+"]/LLE "+Z+"/LLO "+X;Q&&(ee+="/CO ["+Q+"]"),$&&(ee+="/IT /"+$),R=ee;break;case"Square":case"Circle":var te=n.intent,ne=n.fringe.replace(/,/g," "),re="/RD ["+ne+"]";te&&(re+="/IT /"+te),n.measureRatio&&n.measureUnit&&void 0!==n.measureConversionFactor&&(re+="/Measure<</R("+n.measureRatio+")/X[<</C "+n.measureConversionFactor+"/U("+n.measureUnit+")>>]/Type/Measure/Subtype/RL>>"),R=re;break;case"Polygon":case"PolyLine":var oe=n.vertices.replace(/[,|;]/g," "),ie=n.intent,ae="/Vertices ["+oe+"]";if(ie&&(ae+="/IT /"+ie),"PolygonDimension"===ie&&n.measureRatio&&n.measureUnit&&void 0!==n.measureConversionFactor&&(ae+="/Measure<</R("+n.measureRatio+")/X[<</C "+n.measureConversionFactor+"/U("+n.measureUnit+")>>]/Type/Measure/Subtype/RL>>"),"PolyLine"==i){var se=n.head,ue=n.tail,ce="[/"+se+"/"+ue+"]";ae+="/LE "+ce}R=ae;break;case"Redact":if(R+="/OC "+p(h),R+="/Repeat "+("yes"==n.repeat?"true":"false"),"Redact"==i){R+="/OverlayText"+c(n["overlay-text"]||n.overlaText||"");var de=n.defaultappearance;R+="/DA ("+de+")",R+="/Q "+(n.justification||0)}case"StrikeOut":case"Highlight":case"Squiggly":case"Underline":if(n.coords){var le=n.coords.replace(/,/g," ");R+="/QuadPoints ["+le+"]"}break;case"Caret":var fe=n.fringe.replace(/,/g," "),he="/RD ["+fe+"]";R=he;break;case"Stamp":if(n.icon&&(R="/Name/"+u(n.icon)),n.raw&&n.raw.N){var pe=f(t,n.raw,n.raw.N);R+="/AP<</N "+pe+" 0 R>>\n"}break;case"Ink":if("["===n.inklist[0]){var me=n.inklist.substr(1,n.inklist.length-2).split("],["),ge="";me.map((function(e){ge+="["+e.replace(/[,|;]/g," ")+"]"}));var ye="/InkList ["+ge+"]";R=ye}else R="/InkList [["+n.inklist.replace(/[,|;]/g," ")+"]]";break;case"Popup":R="/Open "+("yes"==n.open?"true":"false");break;case"Sound":var _e=f(t,n,{Filter:"/ASCIIHexDecode",R:n.rate,Type:"/Sound",stream:n.soundStream});R+="/Sound "+_e+" 0 R";case"FileAttachment":if(n.icon&&(R+="/Name/"+u(n.icon)),n.raw){var ve=f(t,n.raw,n.raw.FS);R+="/FS "+ve+" 0 R "}}if(n.popup){var be=e.singleAnnotJSONToFDF(t,n.popup,!0);R+="/Popup "+be+" 0 R"}return t.file+=F+R+">>\nendobj\n",s},e}(),f=function(e,t,n){var r=e.next;e.next++;var o="";if(o+=r+" 0 obj\n","string"==typeof n)o+=n;else if(n instanceof Array)o+="["+n.map((function(n){return h(e,t,n)})).join(" ")+"]";else{o+="<<\n";for(var i in n)"stream"!=i&&(o+="/"+i+" "+h(e,t,n[i]));if(o+=">>",n.stream){for(var a="",s=0;s<n.stream.length;s+=2){var u=parseInt(n.stream[s],16),c=parseInt(n.stream[s+1],16);a+=String.fromCharCode((u<<4)+c)}o+="stream\n"+a+"\nendstream"}}return o+="\nendobj\n",e.file+=o,r},h=function e(t,n,o){if(null===o)return"null";var i=void 0===o?"undefined":r(o);if("number"==i)return o;if("string"==i){if("/"==o[0])return"/"+u(o.replace("/",""));if("<"==o[0])return o;var a;return(a=o.match(/^(\d*)R$/))?f(t,n,n[a[1]])+" 0 R":"("+o+")"}if("boolean"==i)return o?"true":"false";if(o instanceof Array)return"["+o.map((function(r){return e(t,n,r)})).join(" ")+"]";var s="<<";for(var c in o)s+="/"+c+" "+e(t,n,o[c]);return s+">>"},p=function(e){var t=e.match(/\#?(\w{2})(\w{2})(\w{2})/),n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,o=parseInt(t[3],16)/255;return"["+n.toFixed(2)+" "+r.toFixed(2)+" "+o.toFixed(2)+"]"},m=function(e){for(var t in o.LineEndingName)if(o.LineEndingName[t]==e)return+t;return 0};t.default=l,t.xfdfJsonToAddJson=function(e){var t={type:e.type,opacity:e.opacity,name:e.name,contents:e.contents,subject:e.subject,title:e.title,icon:e.icon,intent:e.intent||e.IT,DA:e.defaultappearance,alignment:e.justification,enableCaption:"yes"==e.caption},n=e.fontColor;n&&(t.fontColor=parseInt(n.replace("#",""),16));var r=void 0;(r=e.color)&&(t.color=parseInt(r.replace("#",""),16));var a=e["interior-color"]||e.interiorColor;a&&(t.styleFillColor=t.fillColor=parseInt(a.replace("#",""),16));var s=e.flags||"print",u=s.split(",");for(var c in s=0,o.AnnotFlagsName)-1!=u.indexOf(o.AnnotFlagsName[c])&&(s|=1<<parseInt(c));t.flag=s;var d=(e.rect||"").split(",");d.length&&(t.rect={left:+d[0],top:+d[3],right:+d[2],bottom:+d[1]});var l=(e.fringe||"").split(",");4===l.length&&(t.innerRect={left:t.rect.left+ +l[0],top:t.rect.top-+l[3],right:t.rect.right-+l[2],bottom:t.rect.bottom+ +l[1]});var f=e.coords;if(f){f=f.split(","),t.coords=[];for(var h=0,p=f.length;h<p;h+=8){var g=Math.min(+f[0],+f[2],+f[4],+f[6]),y=Math.max(+f[0],+f[2],+f[4],+f[6]),_=Math.max(+f[1],+f[3],+f[5],+f[7]),v=Math.min(+f[1],+f[3],+f[5],+f[7]);t.coords.push({left:g,right:y,top:_,bottom:v})}}var b=e.callout;if(b){b=b.split(","),t.calloutLinePoints=[];for(var S=0,w=b.length;S<w;S+=2)t.calloutLinePoints.push({x:+b[S],y:+b[S+1]})}var M=e.head;M&&(t.startStyle=m(M));var D=e.tail;D&&(t.endStyle=m(D));var P=e.vertices;if(P){t.vertexes=[],P=P.split(";");for(var T=0;T<P.length;T++){var k=P[T].split(",");t.vertexes.push({x:+k[0],y:+k[1]})}}var A=e.inklist;if(A){t.inkList=[],A=JSON.parse("["+A.replace(/;/g,",")+"]");for(var L=0;L<A.length;L++)for(var F=A[L],I=0;I<F.length;I+=2){var x=F[I],C=0==I?1:2;t.inkList.push({x:x,y:F[I+1],type:C})}}var R=i.Border_Style[e.style||"solid"];t.borderInfo={style:R,width:e.width||1};var O=e.dashes;O&&(t.borderInfo.dashes=JSON.parse("["+O+"]"));var G=e.intensity;G&&(t.borderInfo.cloudIntensity=G);var E=e.start;E&&(E=E.split(","),t.startPoint={x:+E[0],y:+E[1]});var Y=e.end;return Y&&(Y=Y.split(","),t.endPoint={x:+Y[0],y:+Y[1]}),t},t.PDFNameEncode=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function e(t,n,r,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.left=t,this.bottom=n,this.right=r,this.top=o}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={print:4,modify:8,extract:16,annotForm:32,fillForm:256,extractAccess:512,assemble:1024,printHigh:2048}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={invisible:1,hidden:2,print:4,noZoom:8,noRotate:16,noView:32,readOnly:64,locked:128,toggleNoView:256,lockedContents:512}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=n(110),a=(r=i)&&r.__esModule?r:{default:r};function s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u={},c={},d=new(function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(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}(this,e.call(this));return n.workerObj=u,n.apis=c,n}return s(t,e),t.prototype.extendsWorkerAPI=function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.prototype.extendsWorkerAPI.apply(this,n),this},t.prototype.clearObjectFromCache=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];g.apply(null,t)},t}(a.default)),l={};function f(e,t,n){var r=l[t]=l[t]||{};(r[n]=r[n]||{})[e.id]=e}var h={};function p(e,t,n,r){var o=h[t]=h[t]||{};(o[n]=o[n]||{})[r]=e}function m(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=void 0;try{o=l[e][t][n]}catch(e){}if(!o&&!r)throw new Error("Couldn't obtain the graphic object from cache and the operation cannot be performed!");return o}function g(e,t,n){try{n?delete l[e][t][n]:t?delete l[e][t]:e&&delete l[e]}catch(e){}}c.getGraphicsObjectAtPoint=function(e,t){var n=t.docId,r=t.pageId,o=t.point,i=t.tolerance,a=t.type,s=t.rect;return u.getPageByID(n,r).then((function(e){return s?e.getGraphicsObjectsInRect(s,i,a):e.getGraphicsObjectAtPoint(o,i,a)})).then((function(t){if(t instanceof Array){var o=[];return t.forEach((function(e){f(e,n,r),o.push(e.toJson())})),void u.resolve(e,o)}t?(f(t,n,r),u.resolve(e,t.toJson())):u.resolve(e,{})}))},c.setGraphicsObjectMatrix=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.matrix,a=m(n,r,o);a.setMatrix(i),u.resolve(e,a.toJson())},c.setGraphicsObjectRect=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.rect,a=m(n,r,o);a.setRect(i,!0),u.resolve(e,a.toJson())},c.getGraphicsObjectBitmap=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.scale,a=t.rotation,s=m(n,r,o).render(i,a,null);u.resolve(e,s,[s.buffer])},c.setGraphicsObjectBorderStyle=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.style,a=t.dashes,s=m(n,r,o);s.setBorderStyle(i,a,!0),u.resolve(e,s.toJson())},c.setGraphicsObjectBorderWidth=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.width,a=m(n,r,o);a.setBorderWidth(i,!0),u.resolve(e,a.toJson())},c.setGraphicsObjectBorderColor=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.color,a=void 0,s=m(n,r,o);s&&(a=s.setBorderColor(i,!0)),u.resolve(e,a)},c.setGraphicsObjectFillColor=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.color,a=m(n,r,o);a.setFillColor(i,!0),u.resolve(e,a.toJson())},c.setGraphicsObjectOpacity=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.opacity,a=void 0,s=m(n,r,o);s&&(a=s.setOpacity(parseFloat(i),!0)),u.resolve(e,a)},c.addGraphicsObject=function(e,t){var n=t.docId,r=t.pageId,i=t.info;return Promise.all([u.jrPromise,u.getPageByID(n,r)]).then((function(e){var t=o(e,2),n=t[0],r=t[1];return Promise.all([n,r,r.c_pagePromise])})).then((function(e){var t=o(e,3),n=t[0],r=t[1],a=t[2];return n.graphicsObjectManager.create(i,a,r)})).then((function(t){f(t,n,r),u.resolve(e,t.toJson())}))},c.setImageObjectOpacity=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.opacity,a=void 0,s=m(n,r,o);s&&(a=s.setOpacity(i,!0)),u.resolve(e,a)},c.removeGraphicsObject=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=void 0,a=m(n,r,o,!0);a&&(i=a.remove(),a=null,g(n,r,o)),u.resolve(e,i)},c.moveGraphicsObjectByPosition=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.type,a=t.graphicObjectId,s=void 0,c=m(n,r,o,!0);c&&(s=c.moveToPosition(i,a)),u.resolve(e,s)},c.setImageObjectRotation=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.rotation,a=m(n,r,o);a.setRotation(i,!0),u.resolve(e,a.toJson())},c.getImageObjectStream=function(e,t){var n=m(t.docId,t.pageId,t.id);u.resolve(e,n.getStream())},c.setTextObjectChar=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.char,a=m(n,r,o);return a.setText(i).then((function(){u.resolve(e,a.toJson())}))},c.setTextObjectItalic=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.italic,a=m(n,r,o);return a.setItalic(i).then((function(){u.resolve(e,a.toJson())}))},c.setTextObjectBold=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.bold,a=m(n,r,o);return a.setBold(i).then((function(){u.resolve(e,a.toJson())}))},c.setTextObjectFontSize=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.size,a=m(n,r,o);return a.setFontSize(i).then((function(){u.resolve(e,a.toJson())}))},c.setTextObjectStandardFont=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.standardId,a=m(n,r,o);return a.setStandardFont(i).then((function(){u.resolve(e,a.toJson())}))},c.setTextObjectFontByName=function(e,t){var n=t.docId,r=t.pageId,o=t.id,i=t.name,a=t.styles,s=t.charset,c=m(n,r,o);return c.setFontByName(i,a,s).then((function(){u.resolve(e,c.toJson())}))},c.getTextObjectWoff=function(e,t){var n=m(t.docId,t.pageId,t.id).getWoff();return u.resolve(e,n,[])},c.pasteGraphicObject=function(e,t,n,r,o,i){var a=h[t][r.id][o],s=n.page,c=s.GetLastGraphicsObjectPosition(n.engine.GraphicsObjectType.e_TypeAll);s.InsertGraphicsObject(c,a.graphicsObject),a.setRect(i),s.GenerateContent(),f(a,t,n.id),function(e,t,n){try{n?delete h[e][t][n]:t?delete h[e][t]:e&&delete h[e]}catch(e){}}(t,r.id,o);var d=a.graphicsObject.Clone();p(n.JR.graphicsObjectManager.get(d,s,n),t,r.id,o),u.resolve(e,a.toJson())},c.getGraphicsObjectByIndex=function(e,t){var n=t.docId,r=t.pageId,o=t.index;return u.getPageByID(n,r).then((function(e){return e.getGraphicsObjectByIndex(o)})).then((function(t){t?(f(t,n,r),u.resolve(e,t.toJson())):u.resolve(e,{})}))},c.getGraphicsObjectsCount=function(e,t){var n=t.docId,r=t.pageId;return u.getPageByID(n,r).then((function(e){return e.getGraphicsObjectsCount()})).then((function(t){u.resolve(e,t)}))},c.addPageImage=function(e,t){var n=t.docId,r=t.pageId,o=t.imageBuffer,i=t.point,a=t.width,s=t.height,c=t.rotation;return u.getPageByID(n,r).then((function(e){return e.addImage(o,i,a,s,c)})).then((function(t){f(t,n,r),u.resolve(e,t.toJson())}))},c.cloneGraphicObject=function(e,t){var n=t.docId,r=t.pageId,o=t.srcPageId,i=t.ids;h={};var a=i.map((function(e){return m(n,o,e)}));return u.getPageByID(n,r).then((function(t){var r=a.map((function(e){return e.graphicsObject.Clone()})),o=t.page,s=[],c=[];r.forEach((function(e){s.push(t.JR.graphicsObjectManager.get(e,o,t))})),s.forEach((function(e,r){p(e,n,t.id,i[r]),c.push(e.toJson())})),u.resolve(e,c)}))},t.default=d.extendsWorkerAPI.bind(d)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(382),o=(n(3),s(n(110))),i=(s(n(379)),s(n(828))),a=s(n(364));function s(e){return e&&e.__esModule?e:{default:e}}function u(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var c={},d={},l=new(function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(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}(this,e.call(this));return n.workerObj=c,n.apis=d,n}return u(t,e),t}(o.default));d.handlePageEditorEvent=function(e,t){var n=t.docId,o=t.fn,i=t.delay,s=t.args;return c.getDocByID(n).then((function(t){(0,r.initGSDKModule)(t.engine,r.ModulePageEditor);var n=(0,a.default)(t,s);try{c.resolve(e,n.handle(o,i,s))}catch(e){console.error(e)}}))},d.updateWinlessMatrix=function(e,t){var n=t.docId,o=t.type,s=t.matrixes;return c.getDocByID(n).then((function(t){switch(o){case 1:(0,r.initGSDKModule)(t.engine,r.ModuleTouchup),(0,i.default)(t.engine,t).updateMatrix(s);break;default:(0,a.default)(t).updateMatrix(s)}c.resolve(e)}))},d.changePEProperty=function(e,t){var n=t.docId,r=t.type,o=t.fn,i=t.param;return c.getDocByID(n).then((function(t){var n=(0,a.default)(t);c.resolve(e,n.changePEProperty(r,o,i))}))},d.changeEditingProperty=function(e,t){var n=t.docId,r=t.fn,o=t.args;return c.getDocByID(n).then((function(t){var n=(0,a.default)(t);c.resolve(e,n.changeEditingProperty(r,o))}))},d.triggerPopMenuAction=function(e,t){var n=t.docId,r=t.action;return c.getDocByID(n).then((function(t){var n=(0,a.default)(t);c.resolve(e,n.triggerPopMenuAction(r))}))},d.handleTouchUpEvent=function(e,t){var n=t.docId,o=t.fn,a=t.args;return c.getDocByID(n).then((function(t){(0,r.initGSDKModule)(t.engine,r.ModuleTouchup);var n=(0,i.default)(t.engine,t);c.resolve(e,n.handleTouchUpEvent(o,a))}))},d.handleFindReplaceEvent=function(e,t){var n=t.docId,o=t.fn,a=t.args;return c.getDocByID(n).then((function(e){return(0,r.initGSDKModule)(e.engine,r.ModuleTouchup),(0,i.default)(e.engine,e).handleFindReplaceEvent(o,a)})).then((function(t){return c.resolve(e,t)}))},d.triggerTUPopMenuAction=function(e,t){var n=t.docId,r=t.action;return c.getDocByID(n).then((function(t){var n=(0,i.default)(t.engine,t);c.resolve(e,n.triggerPopMenuAction(r))}))},d.reInitPageEditor=function(e,t){var n=t.docId;return c.getDocByID(n).then((function(t){var n=t.pageEditor;n&&(n.oldEditPages=n.editPages,n.editPages={}),c.resolve(e)}))},t.default=l.extendsWorkerAPI.bind(l)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=a(n(729)),i=a(n(110));function a(e){return e&&e.__esModule?e:{default:e}}function s(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):function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}}(e,t))}var u={},c={},d=new(function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(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}(this,e.call(this));return n.workerObj=u,n.apis=c,n.cache={},n}return s(t,e),t.prototype.extendsWorkerAPI=function(){for(var t=this,n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.prototype.extendsWorkerAPI.apply(this,r),u.jrPromise.then((function(e){return t.jr=e})),this},t.prototype.clearObjectCache=function(e){if(e){var t=r(this.cache[e],2);t[0],t[1];delete this.cache[e]}else for(var n in this.cache){var o=r(this.cache[n],2);o[0],o[1];delete this.cache[n]}},t.prototype.getCachedObject=function(e){return this.cache[e]},t.prototype.cacheObject=function(e,t,n){return n=n||e.$$.ptr,t?this.cache[n]=[e,t]:this.cache[n][0]=e,n},t}(i.default)),l=function(e){var t=e.docId,n=e.pageId,r=e.type,o=e.rect,i=e.rotation;return u.getPageByID(t,n).then((function(e){var t=e.engine,n=new t.FillSign(e.page),a=o.right-o.left,s=o.top-o.bottom,u=n.AddObject({value:r},new t.PointF(o.left,o.bottom),a,s,{value:i});return[d.cacheObject(u,n),u,t]}))},f=function(e,t){var n=d.jr.createReaderCallback(t),r=new engine.Image(n).GetFrameBitmap(0);e.SetBitmap(r),e.GenerateContent()},h=function(e){var t=e.docId,n=e.pageId,r=e.rect,i=e.textState,a=e.text,s=e.isComb,c=e.rotation;return u.getPageByID(t,n).then((function(e){var t=e.engine,n=new t.TextState;n.version=1,n.font=new t.Font(t.StandardID.e_StdIDHelvetica),n.font_size=i.fontSize,n.charspace=i.charspace,n.textmode={value:i.textMode},n.wordspace=i.wordspace;var u=c;u%=4;var l=new t.Matrix;l.Rotate(u/2*Math.PI,!1),n.SetMatrixA(l.a),n.SetMatrixB(l.b),n.SetMatrixC(l.c),n.SetMatrixD(l.d);for(var f=new t.TextFillSignObjectDataArray,h=0;h<a.length;h++){var p=new t.TextFillSignObjectData(n,new t.WString(a.charAt(h)));f.Add(p)}var m=new t.FillSign(e.page),g=t.Rotation.values[u],y=m.AddTextObject(f,new t.PointF(r.left,r.bottom),1,1,g,s);(y=new t.TextFillSignObject(y)).GenerateContent();d.cacheObject(y,m);var _=(0,o.default)(t,d,m,y);return _.textState.matrix=[l.a,l.b,l.c,l.d],_}))};c.addPathFillSignObject=function(e,t){l(t).then((function(n){var o=r(n,2),i=o[0],a=o[1];a.GenerateContent();var s=a.GetRect();u.resolve(e,{id:i,type:t.type,rect:{left:s.left,right:s.right,top:s.top,bottom:s.bottom}})}))},c.moveFillSignObject=function(e,t){var n=t.id,i=t.rect,a=t.rotation,s=d.jr.engine,c=d.getCachedObject(n),l=r(c,2),f=l[0],h=l[1],p=i.right-i.left,m=i.top-i.bottom;f.Move(new s.PointF(i.left,i.bottom),p,m,{value:a||0}),f.GenerateContent(),u.resolve(e,(0,o.default)(s,d,h,f))},c.addTextFillSignObject=function(e,t){h(t).then((function(t){u.resolve(e,t)}))},c.addSignatureFillSignObject=function(e,t){t.type=6,l(t).then((function(n){var o=r(n,3),i=o[0],a=o[1];a=new o[2].SignatureFillSignObject(a),f(a,t.url),i=d.cacheObject(a),u.resolve(e,{id:i,rect:{left:rect.left,right:rect.right,top:rect.top,bottom:rect.bottom},type:6})}))},c.updateTextFillSign=function(e,t){var n=t.docId,i=t.pageId,a=t.id,s=t.property;return u.getPageByID(n,i).then((function(t){var c=t.engine,l=d.getCachedObject(a),f=r(l,2),p=f[0],m=f[1],g=p.GetTextDataArray(),y=void 0,_=!1,v=void 0;if(0==g.GetSize())y=new c.TextState,v=new c.WString(""),_=!0;else{var b=g.GetAt(0);y=b.text_state,v=b.text}Array.isArray(s)||(s=[s]);var S=!1,w=void 0,M=void 0,D=void 0;if(s.forEach((function(e){var t=e.key,n=e.value;if(void 0!==n)switch(t){case"rect":S=!0,w=n;break;case"font":break;case"fontSize":y.font_size=n,M=n;break;case"charspace":y.charspace=n;break;case"textMode":y.textmode=n;break;case"wordspace":y.wordspace=n;break;case"text":v=new c.WString(n),D=n}})),S){var P=(0,o.default)(c,d,m,p);m.RemoveObject(p),d.clearObjectCache(a),P=Object.assign(P,{docId:n,pageId:i}),M&&(P.textState.fontSize=M),D&&(P.text=D);var T=P.matrix;return P.rotation=0,0==T[0]&&1==T[1]&&-1==T[2]&&0==T[3]&&(w&&(w.right=w.left+1,w.top=w.bottom+1),P.rotation=1),-1==T[0]&&0==T[1]&&0==T[2]&&-1==T[3]&&(w&&(w.left=w.right-1,w.top=w.bottom+1),P.rotation=2),0==T[0]&&-1==T[1]&&1==T[2]&&0==T[3]&&(w&&(w.left=w.right-1,w.bottom=w.top-1),P.rotation=3),w&&(P.rect=w),void h(P).then((function(t){var n=t.id,r=d.getCachedObject(n);d.clearObjectCache(n),d.cacheObject(r[0],r[1],a),t.textState.fontSize=y.font_size,t.id=a,_&&(y.delete(),v.delete()),u.resolve(e,t)}))}var k=new c.TextFillSignObjectData(y,v),A=new c.TextFillSignObjectDataArray;A.Add(k),p.SetTextDataArray(A,!1),p.GenerateContent(),_&&(y.delete(),v.delete()),k.delete(),A.delete();var L=(0,o.default)(c,d,m,p);u.resolve(e,L)}))},c.updateFillSign=function(e,t){t.docId,t.pageId;var n=t.id,o=t.property,i=d.getCachedObject(n),a=r(i,2),s=a[0];a[1];f(s,o.url),u.resolve(e)},c.getFillSignObject=function(e,t){var n=t.docId,r=t.pageId,i=t.point;return u.getPageByID(n,r).then((function(t){var n=t.engine,r=new n.FillSign(t.page),a=r.GetObjectAtPoint(new n.PointF(i.x,i.y));if(a.IsEmpty())return u.resolve(e,{empty:!0});var s=(0,o.default)(n,d,r,a);u.resolve(e,s)}))},c.removeFillSignObject=function(e,t){var n=t.docId,o=t.pageId,i=t.id;return u.getPageByID(n,o).then((function(t){var n=d.getCachedObject(i),o=r(n,2),a=o[0];o[1].RemoveObject(a),t.page.GenerateContent(),d.clearObjectCache(i),u.resolve(e)}))},t.default=d.extendsWorkerAPI.bind(d)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n,r){var o=r.GetRect(),a=r.GetType().value;0==a?r=new e.TextFillSignObject(r):6!=a&&7!=a||(r=new e.SignatureFillSignObject(r));var s={id:t.cacheObject(r,n),rect:{left:o.left,right:o.right,top:o.top,bottom:o.bottom},type:a};0==a&&Object.assign(s,(0,i.default)(r));return s};var r,o=n(730),i=(r=o)&&r.__esModule?r:{default:r}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.GetRect(),n=e.GetTextDataArray(),r=e.GetFormXObject().GetMatrix(),o={};if(n.GetSize()>0){var i=n.GetAt(0).text_state;o={fontId:i.font.GetName().toString(),fontSize:i.font_size,charspace:i.charspace,textMode:i.textmode.value,wordspace:i.wordspace,matrix:[i.GetMatrixA(),i.GetMatrixB(),i.GetMatrixC(),i.GetMatrixD()]}}else o={fontSize:12,charspace:0,wordspace:0,matrix:[1,0,0,1]};for(var a="",s=0,u=n.GetSize();s<u;s++){var c=n.GetAt(s);a+=c.text.toString()}return{rect:{left:t.left,right:t.right,top:t.top,bottom:t.bottom},text:a,isComb:e.IsCombFieldMode(),textState:o,matrix:[r.a,r.b,r.c,r.d,r.e,r.f]}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};function o(e,t){var n=e.engine.PageLabelsStyle;switch(t){case n.e_None:return"none";case n.e_DecimalNums:return"decimalNums";case n.e_UpperRomanNums:return"upperRomanNums";case n.e_LowerRomanNums:return"lowerRomanNums";case n.e_UpperLetters:return"upperLetters";case n.e_LowerLetters:return"lowerLetters"}return"decimalNums"}function i(e,t,n){var o=n.styleType,i=void 0===o?"decimalNums":o,a=n.prefix,s=void 0===a?"":a,u=n.start,c=void 0===u?1:u,d=e.engine,l=new d.PageLabels(e.doc),f=e.doc.GetPageCount(),h=r(t,2),p=h[0],m=h[1],g=m+1;if(g<f){var y=l.HasPageLabel(m);if(0==l.HasPageLabel(g)){var _=d.PageLabelsStyle.e_DecimalNums,v="",b=-1;if(0==y){for(var S=m-1;S>=0;S--)if(l.HasPageLabel(S)){_=l.GetPageLabelStyle(S),v=l.GetPageLabelPrefix(S);var w=l.GetPageLabelStart(S);b=p<=S?w:p-S+w;break}-1===b&&(b=p+1)}else _=l.GetPageLabelStyle(m),v=l.GetPageLabelPrefix(m),b=l.GetPageLabelStart(m);v=v instanceof d.WString?v:new d.WString(v),l.SetPageLabel(g,_,b,v)}}var M=new d.WString(s),D=function(e,t){var n={none:"e_None",decimalNums:"e_DecimalNums",upperRomanNums:"e_UpperRomanNums",lowerRomanNums:"e_LowerRomanNums",upperLetters:"e_UpperLetters",lowerLetters:"e_LowerLetters"}[t];return e.engine.PageLabelsStyle[n]}(e,i);l.SetPageLabel(p,D,c,M);for(var P=p+1;P<=m;P++)l.HasPageLabel(P)&&l.RemovePageLabel(P)}function a(e,t){var n=e.engine,o=new n.PageLabels(e.doc),i=e.doc.GetPageCount(),a=r(t,2),s=a[0],u=a[1],c=u+1,d=!0;if(c<i){var l=o.HasPageLabel(u);if(0==o.HasPageLabel(c)){var f=n.PageLabelsStyle.e_None,h="",p=-1;if(0==l){for(var m=u-1;m>=0;m--)if(o.HasPageLabel(m)){f=o.GetPageLabelStyle(m),h=o.GetPageLabelPrefix(m),s<=m?p=o.GetPageLabelStart(m):d=!1;break}-1===p&&(p=s+1)}else f=o.GetPageLabelStyle(u),h=o.GetPageLabelPrefix(u),p=o.GetPageLabelStart(u);h=h instanceof n.WString?h:new n.WString(h),o.SetPageLabel(c,f,p,h)}}if(0!=d)for(var g=u;g>=s;g--)0!=g&&o.HasPageLabel(g)&&o.RemovePageLabel(g)}t.getPageIndexByLabelText=function(e,t){for(var n=e.doc,r=new e.engine.PageLabels(n),o=n.GetPageCount(),i=0;i<o;i++){if(r.GetPageLabelTitle(i).toString()===t)return i}return-1},t.getCurrentPageLabelInfo=function(e,t){var n=new e.engine.PageLabels(e.doc),r=n.GetPageLabelPrefix(t),i=n.GetPageLabelTitle(t);for(;!n.HasPageLabel(t)&&t>0;)t--;var a=n.GetPageLabelStyle(t),s=n.GetPageLabelStart(t);return{hasLabel:n.HasPageLabel(t),style:o(e,a),firstNumber:s,prefix:r.toString(),title:i.toString()}},t.checkDocIsUseLogicPage=function(e){var t=e.engine,n=e.doc,r=new t.PageLabels(n);if(!r.HasPageLabel(0))return!1;for(var o=n.GetPageCount(),i=0;i<o;i++){if(r.HasPageLabel(i)&&(r.GetPageLabelStyle(i)!==t.PageLabelsStyle.e_DecimalNums||""!==r.GetPageLabelPrefix(i).toString()))return!0}return!1},t.formatPageNumbers=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};!0===t?a(e,n):i(e,n,r)};t.UpdatePageLabels=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.insertPagesByRange=function(e,t){var n=!0,r=!1,o=void 0;try{for(var i,a=t[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var s=i.value;this.insertPages(e,s,1)}}catch(e){r=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw o}}},e.insertPages=function(e,t,n){var r=e.engine,o=new r.PageOperationInfo;o.type=r.PageOperationType.e_PageOperationInsert,o.page_index_1=t,o.page_count=n,e.doc.UpdatePageLabels(o)},e.deletePages=function(e,t){var n=e.engine,o=new n.PageOperationInfo;o.type=n.PageOperationType.e_PageOperationDelete;var i=!0,a=!1,s=void 0;try{for(var u,c=t[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var d=u.value,l=r(d,2),f=l[0],h=l[1];h=void 0===h?f:h,o.page_index_range.AddSegment(f,h,n.RangeFilter.e_All)}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}e.doc.UpdatePageLabels(o)},e.reversePages=function(e,t){var n=e.engine,r=new n.PageOperationInfo;r.type=n.PageOperationType.e_PageOperationReverse;var o=!0,i=!1,a=void 0;try{for(var s,u=t[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value;r.page_index_range.AddSegment(c,c,n.RangeFilter.e_All)}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}e.doc.UpdatePageLabels(r)},e.replacePages=function(e,t,n,r,o){var i=e.engine,a=new i.PageOperationInfo;a.type=i.PageOperationType.e_PageOperationReplace,a.page_index_1=t,a.page_count=n-t+1,a.page_index_range.AddSegment(r,o,i.RangeFilter.e_All),e.doc.UpdatePageLabels(a)},e.swapPages=function(e,t,n){var r=e.engine,o=new r.PageOperationInfo;o.type=r.PageOperationType.e_PageOperationSwap,o.page_index_1=t,o.page_index_2=n,e.doc.UpdatePageLabels(o)},e.movePages=function(e,t,n){var r=e.doc.GetPageCount(),o=n;t[0]<n&&(o=n-1),o<0&&(o=0),o>=r&&(o=r-1);var i=e.engine,a=new i.PageOperationInfo;a.type=i.PageOperationType.e_PageOperationMove;var s=!0,u=!1,c=void 0;try{for(var d,l=t[Symbol.iterator]();!(s=(d=l.next()).done);s=!0){var f=d.value;a.page_index_range.AddSegment(f,f,i.RangeFilter.e_All)}}catch(e){u=!0,c=e}finally{try{!s&&l.return&&l.return()}finally{if(u)throw c}}a.page_index_1=o,e.doc.UpdatePageLabels(a)},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return JSON.parse(JSON.stringify(e)).reduce((function(e,t){if(2===t.length){for(var n=[],r=t[0];r<t[1];r++)n.push(r);t=n}return e.concat(t)}),[])}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o;t.sanitizeDocument=(r=i(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.doc,e.next=3,n.Sanitize();case 3:return r=e.sent,e.abrupt("return",r);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)}),t.removeHiddenInfo=(o=i(regeneratorRuntime.mark((function e(t,n){var r,o,i,s,u,c,d,l,f,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=t.doc,o=t.engine,i=new o.RemoveInfo,s=!0,u=!1,c=void 0,e.prev=6,d=a[Symbol.iterator]();!(s=(l=d.next()).done);s=!0)f=l.value,i[f]=!!n[f];e.next=14;break;case 10:e.prev=10,e.t0=e.catch(6),u=!0,c=e.t0;case 14:e.prev=14,e.prev=15,!s&&d.return&&d.return();case 17:if(e.prev=17,!u){e.next=20;break}throw c;case 20:return e.finish(17);case 21:return e.finish(14);case 22:return e.next=24,r.RemoveHiddenInfo(i);case 24:return h=e.sent,e.abrupt("return",h);case 26:case"end":return e.stop()}}),e,this,[[6,10,14,22],[15,,17,21]])}))),function(e,t){return o.apply(this,arguments)});function i(e){return function(){var t=e.apply(this,arguments);return new Promise((function(e,n){return function r(o,i){try{var a=t[o](i),s=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(s).then((function(e){r("next",e)}),(function(e){r("throw",e)}));e(s)}("next")}))}}var a=["bRemoveBookmark","bRemoveComment","bRemoveContent","bRemoveFileattachment","bRemoveForm","bRemoveHideLayer","bRemoveHideText","bRemoveLink","bRemoveMetadata","bRemoveOverlaping","bRemoveSearchIndex"]},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return A})),n.d(t,"WORK_FLOW",(function(){return S}));var r,o,i=n(176),a=n.n(i),s=n(127),u=n(22),c=n(3),d=function(){this.Release=function(){},this.FindFontInFormatBar=function(e){},this.EnableFormatToolBar=function(e){},this.SetOwnerFontName=function(e){for(var t=[],n=0,r=e.GetSize();n<r;n++)t.push(e.GetAt(n).toString());postMessage({workflow:S,type:"fontNameChange",msg:t})},this.ClearOwnerFontName=function(e){},this.UpdateTextFormat=function(e,t,n){postMessage({workflow:S,type:"updateTextFormat",msg:{secProps:{lineLeading:e.fLineLeading,lineIndent:e.fLineIndent,alignment:e.nAlignment,enableSoftReturn:e.bEnableSoftReturn,rtl:e.bRTL,secSpace:e.fSecSpace},wordProp:{fontSize:t.fFontSize,wordColor:Object(u.intColorToHex)(t.dwWordColor),strokeColor:Object(u.intColorToHex)(t.dwStrokeColor),scriptType:t.nScriptType,wordStyle:t.nWordStyle,charSpace:t.fCharSpace,horzScale:t.nHorzScale,wordSpace:t.fWordSpace,xOffset:t.fXOffset,yOffset:t.fYOffset,renderingMode:t.nRenderingMode,lineWidth:t.fLineWidth,charCode:t.dwCharCode,alphal:t.nAlphal/255,isCross:Boolean(4&t.nWordStyle),isUnderline:Boolean(2&t.nWordStyle),isBold:Boolean(262144&t.nWordStyle||11===t.nRenderingMode),isItalic:Boolean(64&t.nWordStyle)},fontName:n?n.toString():"Helvetica"}})}},l={},f={},h={trackPopupMenu:function(e,t,n,r){},TrackPopupMenu:function(e,t,n,r){return h.trackPopupMenu(l[e],t,n,r)},Release:function(){},CreatePopupMenu:function(){var e=(Date.now()+1e3*Math.random()|0)%2147483647;return l[e]=[],e},CreatePopupSubMenu:function(){var e=(Date.now()+1e3*Math.random()|0)%2147483647;return l[e]=[],e},AppendMenuItem:function(e,t){var n={name:t,enable:!0,isCheck:!0,id:t};f[t]=n,l[e].push(n)},AppendSubMenu:function(e,t,n){l[e].push({name:t,subItems:l[n]})},RemoveMenuItem:function(e,t,n){},AppendSeparator:function(e){l[e].push({name:"-"})},EnableMenuItem:function(e,t,n,r){var o=f[t];o&&(o.enable=n)},CheckMenuItem:function(e,t,n){f[t].isCheck=n},InsertMenuItem:function(e,t,n,r){},InsertSeparator:function(e,t){},DestroyMenu:function(e){l={}},IsMenuEnabled:function(e){return!0}},p=h,m=function(){function e(){this.isEdit=!1,this.isGroup=!1}return e.prototype.Release=function(){},e.prototype.BeginEdit=function(e){this.isEdit=!0},e.prototype.EndEdit=function(){this.isEdit=!1,this.endEditCallback()},e.prototype.IsUndoRedoing=function(){},e.prototype.BeginUndoGroup=function(){this.isGroup=!0},e.prototype.EndUndoGroup=function(e){this.isGroup=!1,this.endCallback()},e.prototype.SetOwnUndoMode=function(e){},e.prototype.Restore=function(e){},e.prototype.registerEndGroup=function(e){this.endCallback=e},e.prototype.registerEndEdit=function(e){this.endEditCallback=e},e}(),g=!0,y=!1;var _,v,b,S="touchup",w=(v=[],function(e){_&&clearTimeout(_),v=v.concat(e),_=setTimeout((function(){postMessage({workflow:S,type:"revertBackground",msg:v}),v=[]}),20)}),M=function(){function e(e){var t=this;this.lastUndo=[],this.undos=[],this.redos=[],this.Undo=function(e){try{var n=t.undos,o=t.redos;e||(n=t.redos,o=t.undos);var i=n.pop();if(!i)return;if(Array.isArray(i))for(var a=i.length-1;a>=0;a--)r.TouchupUndo(i[a],e);else r.TouchupUndo(i,e);o.push(i)}catch(e){console.log("undo err",e)}},this.undoCallback=e,e.registerEndGroup((function(){t.undos.push(t.lastUndo),t.lastUndo=[]})),e.registerEndEdit((function(){t.undos=[],t.redos=[]}))}return e.prototype.Release=function(){},e.prototype.OnEnterEditing=function(e){return postMessage({workflow:S,type:"enterEdit"}),!1},e.prototype.OnExitEditing=function(){return postMessage({workflow:S,type:"exitEdit"}),!1},e.prototype.OnInvalid=function(e,t,n){},e.prototype.SetTimerCallback=function(e,t){var n=setInterval((function(){r.OnTimeout(t,n)}),e);return g&&postMessage({workflow:S,type:"toggleCaret",msg:!0}),n},e.prototype.KillTimer=function(e){g&&postMessage({workflow:S,type:"toggleCaret",msg:!1}),clearInterval(e)},e.prototype.OnAddUndo=function(e){postMessage({workflow:S,type:"docModified"}),this.undoCallback.isGroup?this.lastUndo.push(e):(this.undos.push(e),this.redos=[])},e.prototype.OnChangeDoc=function(e){},e.prototype.OnLROnPageWithoutText=function(e){var t=e.GetPage().GetIndex();postMessage({workflow:S,type:"pageWithoutText",msg:t})},e.prototype.OnTextInputReachesLimit=function(e){},e}(),D={Create:function(e,t){return postMessage({workflow:S,type:"progressCreate",msg:[e,t]}),101},IsCancelled:function(e){return!1}};b=self.Proxy?new Proxy(D,{get:function(e,t){return e[t]?e[t]:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];postMessage({workflow:S,type:"progress"+t.toString(),msg:e.map((function(e){return e instanceof r.WString?e.toString():e}))})}}}):function(){};var P=function(){function e(){var e=this;this.visibleIndexes=[],this.Release=function(){},this.GetRenderMatrix=function(t){var n=new r.Matrix,o=t.GetPage(),i=e.matrixes[o.GetIndex()];if(!i)return n;var a=i[2];n.Set(a.a,a.b,a.c,a.d,a.e,a.f);var s=e.matrixes.dpr||1;return n.Scale(s,s,!1),n},this.GetClientRect=function(t){var n=e.matrixes.uiRect,o=n.width,i=n.height,a=e.matrixes.dpr||1,s=new r.CFX_FloatRect;return s.left=0,s.top=0,s.right=o*a,s.bottom=i*a,s},this.GetPageVisibleRect=function(t){var n=t.GetPage(),o=e.matrixes[n.GetIndex()],i=new r.CFX_FloatRect;if(!o)return i;var a=o[3],s=e.matrixes.dpr||1;i.left=a.left*s,i.top=a.top*s,i.right=a.right*s,i.bottom=a.bottom*s;var u=e.GetRenderMatrix(t),c=new r.Matrix;return c.SetReverse(u),c.TransformRect(i),u.delete(),c.delete(),i},this.GetPageRect=function(t){var n=t.GetPage(),o=e.matrixes[n.GetIndex()],i=new r.CFX_FloatRect;if(!o)return i;var a=o[4],s=e.matrixes.dpr||1;return i.left=a.left*s,i.top=a.top*s,i.right=a.right*s,i.bottom=a.bottom*s,i},this.GetPageViewScale=function(t){var n=t.GetPage().GetIndex(),r=e.matrixes[n];return r?r[0]:4/3},this.GotoPageView=function(e,t,n){var r=e.GetPage().GetIndex();return postMessage({workflow:S,type:"gotoPageView",msg:{index:r,left:t,top:n}}),!0},this.ScrollToCenterPoint=function(e,t){var n=e.GetPage().GetIndex();postMessage({workflow:S,type:"gotoPageView",msg:{index:n,left:t.x,top:t.y}})},this.Scroll=function(e,t){console.log("Scroll")},this.GetString=function(e){return Object(c.CWString)(r,"string"+e)},this.ShowMessageBox=function(e,t,n){return postMessage({workflow:S,type:"showMessageBox",msg:{id:e.value,flag:t,data:n}}),!0},this.ChangeCursor=function(e){postMessage({workflow:S,type:"cursorChange",msg:e&&e.value})},this.GetPageWindow=function(e){return 1e3},this.SetClipboardText=function(t,n){e.text=n.toString()},this.GetClipboardText=function(){return Object(c.CWString)(r,e.text||"")}}return e.prototype.DrawRect=function(e,t){for(var n=[],r=0,o=t.GetSize();r<o;r++){var i=t.GetAt(r);n.push({left:0|i.left,top:0|i.top,right:0|i.right,bottom:0|i.bottom})}return w(n),!0},e}(),T=function(){function e(){this.rects=[]}return e.prototype.Release=function(){},e.prototype.OnEnterReplaceAll=function(e){},e.prototype.OnExitReplaceAll=function(e){},e.prototype.GetLastedDocTempPath=function(e){return Object(c.CWString)(r,"c:/fakepath.pdf")},e.prototype.ReParseTextPage=function(e,t,n){},e.prototype.AddSelectTextRects=function(e,t){if(g){for(var n=[],r=e.GetPage().GetIndex(),o=0;o<t.GetSize();o++){var i=t.GetAt(o),a={left:i.left,right:i.right,top:i.top,bottom:i.bottom};n.push(a),this.rects.push(a)}postMessage({workflow:S,type:"addTextRects",msg:{rects:n,index:r,caller:"AddSelectTextRects"}})}},e.prototype.GetSelectPDFRect=function(e){var t=new r.RectFArray;return this.rects.forEach((function(e){var n=new r.CFX_FloatRect(e.left,e.bottom,e.right,e.top);t.Add(n)})),t},e.prototype.AddSelect=function(e,t){if(g){var n=e.GetPage().GetIndex();this.rects=[];for(var r=0;r<t.GetSize();r++){var o=t.GetAt(r);this.rects.push({left:o.left,right:o.right,top:o.top,bottom:o.bottom})}postMessage({workflow:S,type:"addTextRects",msg:{rects:this.rects,index:n,caller:"AddSelect"}})}},e.prototype.DeselectAll=function(){this.rects=[]},e}(),k=function(){function e(){var e=this;this.targets={},this.controlDown=!1,this.shiftDown=!1,this.popMenuAction=-1,this.modifiedObjects=[],this.OnContentChange=function(t,n,r){if(1!=t.value&&r)for(var o=0;o<r.GetSize();o++){var i=r.GetAt(o);e.modifiedObjects.push(i)}},this.setJRMgr=function(t){e.jrMgr=t},this.OnInvalid=function(t,n,r){if(void 0===r&&(r=!1),e.target.Render&&!Array.isArray(e.lastEditorPage)){var o=e.lastEditorPage.GetPage(),i=e.providerCallback.matrixes.uiRect,a=e.providerCallback.matrixes.dpr,u={width:i.width*a,height:i.height*a},c=s.default.render((function(t){var n=e.GetVisiblePage(e.doc.doc);return e.target.Render(n,t)}),o,u);postMessage({workflow:S,type:"updateView",msg:{bitmapInfo:c,redraw:r}})}},this.GetVisiblePage=function(t){var n=new r.TouchupEditorPageArray;return e.providerCallback.visibleIndexes.forEach((function(e){var o=t.GetPage(e),i=r.TUEditorPage.Create(o,101);n.Add(i)})),n},this.GetDefaultEditorPage=function(){var t=e.providerCallback.visibleIndexes[0],n=e.doc.doc.GetPage(t);return r.TUEditorPage.Create(n,101)},this.TrackPopupMenu=function(t,n,r,o){if(-1!==e.popMenuAction){var i=e.popMenuAction;return e.popMenuAction=-1,i}var a={},s=o.GetPage().GetIndex(),u=e.providerCallback.matrixes.dpr||1;return a.position={x:n/u,y:r/u},a.menu=t,a.pageIndex=s,postMessage({workflow:S,type:"showPopupMenu",msg:a}),-1>>>0},this.GetPage=function(t,n){return r.TUEditorPage.Create(e.doc.pageIndexMap[n].page,100)},this.GetCurrentEditorPage=function(){var t=e.providerCallback.visibleIndexes[0];return r.TUEditorPage.Create(e.doc.pageIndexMap[t].page,100)},this.IsShiftKeyDown=function(){return e.shiftDown},this.IsControlKeyDown=function(){return e.controlDown}}return e.prototype.setCObject=function(e,t,n){this.providerCallback=n,this.operationNotifier=t,this.editPages={},this.doc=e},e.prototype.updateMatrix=function(e){var t=this;this.providerCallback.matrixes=e,this.providerCallback.visibleIndexes=e.visibleIndexes,this.lastEditorPage=r.TUEditorPage.Create(this.doc.doc.GetPage(e.visibleIndexes[0]),101),this.target&&(clearTimeout(this.updateTask),this.updateTask=setTimeout((function(){t.OnInvalid(null,[]),t.updateTask=null}),100))},e.prototype.handleFindReplaceEvent=function(e,t){var n=this;void 0===t&&(t=[]);var o=this.findReplace;if(o||(o=this.findReplace=this.jrMgr.GetFindReplace()),"AbortReplaceAll"!=e){if("ReplaceAll"==e)return g=!1,y=!1,this.doc.getPageCount().then((function(e){var i=0,a=[t[0],0,{type:"FindOption",value:4|3&t[1].value}],s=[t[2]],c=t[3]||0,d=0,l=Object(u.getJRArgs)(r,n,a,r.TUEditorPage),f=Object(u.getJRArgs)(r,n,s,r.TUEditorPage),h=function(t){if(l[1]=t,postMessage({workflow:S,type:"replaceAllProgress",msg:{pageIndex:d,total:e}}),y&&postMessage({workflow:S,type:"replaceAllProgress",msg:{pageIndex:-1}}),d>=e||y)return g=!0,i;i+=function(e,t,n){for(var r=0;;){if(!e.Find.apply(e,t))break;e.Replace.apply(e,n),r++}return r}(o,l,f),d++;var n=t+1;return n>=e&&(n=0),Object(u.nextTick)().then((function(){return h(n)}))};return h(c)}));var i=Object(u.getJRArgs)(r,this,t,r.TUEditorPage);return"Find"==e?this.doc.getPageByIndex(t[1]).then((function(e){return e.parsedPage()})).then((function(t){return o[e].apply(o,i)})):o[e].apply(o,i)}y=!0},e.prototype.triggerPopMenuAction=function(e){var t=this;this.popMenuAction=e,this.target.OnRButtonUp&&this.target.OnRButtonUp.apply(this.target,this.lastRButtonUpArgs),setTimeout((function(){t.OnInvalid(null,[],!0)}))},e.prototype.handleTouchUpEvent=function(e,t){var n=this;void 0===t&&(t=[]);var i=this.target;switch("OnKeyDown"==e&&(17==t[0]&&(this.controlDown=!0),16==t[0]&&(this.shiftDown=!0)),"OnKeyUp"==e&&(17==t[0]&&(this.controlDown=!1),16==t[0]&&(this.shiftDown=!1)),e){case"OnLButtonDown":var a=Object(u.getJRArgs)(r,this,t,r.TUEditorPage),s=i&&i.OnLButtonDown;return s&&s.apply(i,a);case"Undo":return void this.operationNotifier.Undo(t[0]);case"OnActivate":var c=t[0];if(i=this.targets[c])this.target=i;else{switch(c){case"touchup":i=this.target=this.targets[c]=this.jrMgr.GetTouchup();break;case"spellcheck":i=this.target=this.targets[c]=this.jrMgr.GetTouchupSpellCheck();break;case"joinSplit":i=this.target=this.targets[c]=this.jrMgr.GetJoinSplit()}setTimeout((function(){n.OnInvalid(null,[],!0)}))}t=[];break;case"OnChar":for(var d in t[0])this.target.OnChar(t[0].charCodeAt(d));return;case"OnRButtonUp":var l=Object(u.getJRArgs)(r,this,t,r.TUEditorPage);return this.lastRButtonUpArgs=l,void(this.target.OnRButtonUp&&this.target.OnRButtonUp.apply(this.target,l));case"GetEditInfo":return void(o=this.target.GetEditInfo());case"EditContent":return void this.target.EditContent(o);case"JoinSplitToEditText":var f=this.targets.joinSplit.GetEditInfo(),h=this.target=this.targets[c]=this.jrMgr.GetTouchup();return h.OnActivate(),void setTimeout((function(){n.OnInvalid(null,[],!0),f.editor_page.IsEmpty()||h.EditContent(f)}))}var p=Object(u.getJRArgs)(r,this,t,r.TUEditorPage),m=i&&i[e];return m&&m.apply(i,p)},e.prototype.destroy=function(){var e=this;for(var t in["tu","providerCallback","operationNotifier","lastInvalid","lastEditorPage","editPages","doc","jrMgr","popMenuAction"].forEach((function(t){return e[t]=[]})),this.targets){this.targets[t].delete()}},e.prototype.generateContent=function(){for(var e in this.editPages){this.editPages[e].GetPage().GenerateContent()}this.modifiedObjects.forEach((function(e){return e.GenerateContent()})),this.modifiedObjects=[]},e}(),A=function(e,t){if(t.touchup)return t.touchup;r=e,s.default.setGSDK(e);var n=t.touchup=new k,o=new P;o.IsShiftKeyDown=n.IsShiftKeyDown,o.IsControlKeyDown=n.IsControlKeyDown;var i=new e.TouchupProvider(e.TouchupProviderCallback.implement(o)),u=new m,c=new M(u);return u.Restore=c.Undo,c.OnContentChange=n.OnContentChange,c.OnInvalid=a()(n.OnInvalid,50),o.GetVisiblePage=n.GetVisiblePage,o.GetDefaultEditorPage=n.GetDefaultEditorPage,o.GetPage=n.GetPage,i.SetOperationNotifierCallback(e.TouchupOperationNotifierCallback.implement(c)),i.SetProgressBarCallback(e.ProgressBarCallback.implement(b)),p.trackPopupMenu=n.TrackPopupMenu,i.SetPopupMenuCallback(e.TouchupPopupMenuCallback.implement(p)),i.SetTextFormatCallback(e.TextFormatCallback.implement(new d)),i.SetFindReplaceCallback(e.FindReplaceCallback.implement(new T)),i.SetUndoCallback(e.UndoCallback.implement(u)),o.GetLatestPDFPage=function(e,n){return t.pageIndexMap[n].page},o.GetCurrentEditorPage=n.GetCurrentEditorPage,i.SetIsSpellCheckAvailable(!1),n.setJRMgr(t.touchupMgr=new e.TouchupMgr(i,t.doc)),t.addDestroyHook((function(e){t.touchupMgr.delete(),t.touchup.destroy(),t.touchupMgr=null,t.touchup=null,r=null})),t.beforeSave((function(e){return t.touchup.generateContent()})),n.setCObject(t,c,o),n}}])}));