trqVue/public/CloudSign/core/pdf.js
2025-03-09 19:40:08 +08:00

1 line
662 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("pdfjs-dist/build/pdf",[],t):"object"==typeof exports?exports["pdfjs-dist/build/pdf"]=t():e["pdfjs-dist/build/pdf"]=e.pdfjsDistBuildPdf=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=98)}([function(e,t,n){"use strict";var r=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unreachable=t.warn=t.utf8StringToString=t.stringToUTF8String=t.stringToPDFString=t.stringToBytes=t.string32=t.shadow=t.setVerbosityLevel=t.ReadableStream=t.removeNullCharacters=t.readUint32=t.readUint16=t.readInt8=t.log2=t.loadJpegStream=t.isEvalSupported=t.isLittleEndian=t.createValidAbsoluteUrl=t.isSameOrigin=t.isNodeJS=t.isSpace=t.isString=t.isNum=t.isEmptyObj=t.isBool=t.isArrayBuffer=t.info=t.getVerbosityLevel=t.getLookupTableFactory=t.deprecated=t.createObjectURL=t.createPromiseCapability=t.createBlob=t.bytesToString=t.assert=t.arraysToBytes=t.arrayByteLength=t.FormatError=t.XRefParseException=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.TextRenderingMode=t.StreamType=t.StatTimer=t.PasswordResponses=t.PasswordException=t.PageViewport=t.NotImplementedException=t.NativeImageDecoding=t.MissingPDFException=t.MissingDataException=t.MessageHandler=t.InvalidPDFException=t.AbortException=t.CMapCompressionType=t.ImageKind=t.FontType=t.AnnotationType=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationBorderStyleType=t.UNSUPPORTED_FEATURES=t.VERBOSITY_LEVELS=t.OPS=t.IDENTITY_MATRIX=t.FONT_IDENTITY_MATRIX=t.BaseException=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};n(99);var i=n(140),a={errors:0,warnings:1,infos:5},o=a.warnings;function s(e){o>=a.warnings&&console.log("Warning: "+e)}function l(e){throw new Error(e)}function c(e,t){e||l(t)}var u=function(){function e(e,t){this.name="PasswordException",this.message=e,this.code=t}return e.prototype=new Error,e.constructor=e,e}(),d=function(){function e(e,t){this.name="UnknownErrorException",this.message=e,this.details=t}return e.prototype=new Error,e.constructor=e,e}(),h=function(){function e(e){this.name="InvalidPDFException",this.message=e}return e.prototype=new Error,e.constructor=e,e}(),p=function(){function e(e){this.name="MissingPDFException",this.message=e}return e.prototype=new Error,e.constructor=e,e}(),f=function(){function e(e,t){this.name="UnexpectedResponseException",this.message=e,this.status=t}return e.prototype=new Error,e.constructor=e,e}(),m=function(){function e(e){this.message=e}return e.prototype=new Error,e.prototype.name="NotImplementedException",e.constructor=e,e}(),g=function(){function e(e,t){this.begin=e,this.end=t,this.message="Missing data ["+e+", "+t+")"}return e.prototype=new Error,e.prototype.name="MissingDataException",e.constructor=e,e}(),v=function(){function e(e){this.message=e}return e.prototype=new Error,e.prototype.name="XRefParseException",e.constructor=e,e}(),y=function(){function e(e){this.message=e}return e.prototype=new Error,e.prototype.name="FormatError",e.constructor=e,e}(),b=function(){function e(e){this.name="AbortException",this.message=e}return e.prototype=new Error,e.constructor=e,e}(),w=/\x00/g;function S(e){c("string"==typeof e,"Invalid argument for stringToBytes");for(var t=e.length,n=new Uint8Array(t),r=0;r<t;++r)n[r]=255&e.charCodeAt(r);return n}function _(e){return void 0!==e.length?e.length:(c(void 0!==e.byteLength),e.byteLength)}var P=function(){function e(){}var t=["rgb(",0,",",0,",",0,")"];e.makeCssRgb=function(e,n,r){return t[1]=e,t[3]=n,t[5]=r,t.join("")},e.transform=function(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]},e.applyTransform=function(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]},e.applyInverseTransform=function(e,t){var n=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/n,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/n]},e.getAxialAlignedBoundingBox=function(t,n){var r=e.applyTransform(t,n),i=e.applyTransform(t.slice(2,4),n),a=e.applyTransform([t[0],t[3]],n),o=e.applyTransform([t[2],t[1]],n);return[Math.min(r[0],i[0],a[0],o[0]),Math.min(r[1],i[1],a[1],o[1]),Math.max(r[0],i[0],a[0],o[0]),Math.max(r[1],i[1],a[1],o[1])]},e.inverseTransform=function(e){var t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]},e.apply3dTransform=function(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]},e.singularValueDecompose2dScale=function(e){var t=[e[0],e[2],e[1],e[3]],n=e[0]*t[0]+e[1]*t[2],r=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],a=e[2]*t[1]+e[3]*t[3],o=(n+a)/2,s=Math.sqrt((n+a)*(n+a)-4*(n*a-i*r))/2,l=o+s||1,c=o-s||1;return[Math.sqrt(l),Math.sqrt(c)]},e.normalizeRect=function(e){var t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t},e.intersect=function(t,n){function r(e,t){return e-t}var i=[t[0],t[2],n[0],n[2]].sort(r),a=[t[1],t[3],n[1],n[3]].sort(r),o=[];return t=e.normalizeRect(t),n=e.normalizeRect(n),(i[0]===t[0]&&i[1]===n[0]||i[0]===n[0]&&i[1]===t[0])&&(o[0]=i[1],o[2]=i[2],(a[0]===t[1]&&a[1]===n[1]||a[0]===n[1]&&a[1]===t[1])&&(o[1]=a[1],o[3]=a[2],o))};var n=["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM","","X","XX","XXX","XL","L","LX","LXX","LXXX","XC","","I","II","III","IV","V","VI","VII","VIII","IX"];return e.toRoman=function(e,t){c(Number.isInteger(e)&&e>0,"The number should be a positive integer.");for(var r,i=[];e>=1e3;)e-=1e3,i.push("M");r=e/100|0,e%=100,i.push(n[r]),r=e/10|0,e%=10,i.push(n[10+r]),i.push(n[20+e]);var a=i.join("");return t?a.toLowerCase():a},e.appendToArray=function(e,t){Array.prototype.push.apply(e,t)},e.prependToArray=function(e,t){Array.prototype.unshift.apply(e,t)},e.extendObj=function(e,t){for(var n in t)e[n]=t[n]},e.getInheritableProperty=function(e,t,n){for(;e&&!e.has(t);)e=e.get("Parent");return e?n?e.getArray(t):e.get(t):null},e.inherit=function(e,t,n){for(var r in e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n)e.prototype[r]=n[r]},e.loadScript=function(e,t){var n=document.createElement("script"),r=!1;n.setAttribute("src",e),t&&(n.onload=function(){r||t(),r=!0}),document.getElementsByTagName("head")[0].appendChild(n)},e}(),A=function(){function e(e,t,n,r,i,a){this.viewBox=e,this.scale=t,this.rotation=n,this.offsetX=r,this.offsetY=i;var o,s,l,c,u,d,h,p,f=(e[2]+e[0])/2,m=(e[3]+e[1])/2;switch(n=(n%=360)<0?n+360:n){case 180:o=-1,s=0,l=0,c=1;break;case 90:o=0,s=1,l=1,c=0;break;case 270:o=0,s=-1,l=-1,c=0;break;default:o=1,s=0,l=0,c=-1}a&&(l=-l,c=-c),0===o?(u=Math.abs(m-e[1])*t+r,d=Math.abs(f-e[0])*t+i,h=Math.abs(e[3]-e[1])*t,p=Math.abs(e[2]-e[0])*t):(u=Math.abs(f-e[0])*t+r,d=Math.abs(m-e[1])*t+i,h=Math.abs(e[2]-e[0])*t,p=Math.abs(e[3]-e[1])*t),this.transform=[o*t,s*t,l*t,c*t,u-o*t*f-l*t*m,d-s*t*f-c*t*m],this.width=h,this.height=p,this.fontScale=t}return e.prototype={clone:function(t){var n="scale"in(t=t||{})?t.scale:this.scale,r="rotation"in t?t.rotation:this.rotation;return new e(this.viewBox.slice(),n,r,this.offsetX,this.offsetY,t.dontFlip)},convertToViewportPoint:function(e,t){return P.applyTransform([e,t],this.transform)},convertToViewportRectangle:function(e){var t=P.applyTransform([e[0],e[1]],this.transform),n=P.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],n[0],n[1]]},convertToPdfPoint:function(e,t){return P.applyInverseTransform([e,t],this.transform)}},e}(),k=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function C(){var e={};return e.promise=new Promise(function(t,n){e.resolve=t,e.reject=n}),e}var x,T=function(){function e(e,t,n){for(;e.length<n;)e+=t;return e}function t(){this.started=Object.create(null),this.times=[],this.enabled=!0}return t.prototype={time:function(e){this.enabled&&(e in this.started&&s("Timer is already running for "+e),this.started[e]=Date.now())},timeEnd:function(e){this.enabled&&(e in this.started||s("Timer has not been started for "+e),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e])},toString:function(){var t,n,r=this.times,i="",a=0;for(t=0,n=r.length;t<n;++t){var o=r[t].name;o.length>a&&(a=o.length)}for(t=0,n=r.length;t<n;++t){var s=r[t],l=s.end-s.start;i+=e(s.name," ",a)+" "+l+"ms\n"}return i}},t}(),D=function(e,t){if("undefined"!=typeof Blob)return new Blob([e],{type:t});throw new Error('The "Blob" constructor is not supported.')},E=(x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",function(e,t){if(!(arguments.length>2&&void 0!==arguments[2]&&arguments[2])&&URL.createObjectURL){var n=D(e,t);return URL.createObjectURL(n)}for(var r="data:"+t+";base64,",i=0,a=e.length;i<a;i+=3){var o=255&e[i],s=255&e[i+1],l=255&e[i+2];r+=x[o>>2]+x[(3&o)<<4|s>>4]+x[i+1<a?(15&s)<<2|l>>6:64]+x[i+2<a?63&l:64]}return r});function I(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return e?new Promise(function(r,i){r(e.apply(n,t))}):Promise.resolve(void 0)}function O(e){if("object"!==(void 0===e?"undefined":r(e)))return e;switch(e.name){case"AbortException":return new b(e.message);case"MissingPDFException":return new p(e.message);case"UnexpectedResponseException":return new f(e.message,e.status);default:return new d(e.message,e.details)}}function R(e,t,n){t?e.resolve():e.reject(n)}function M(e,t,n){var r=this;this.sourceName=e,this.targetName=t,this.comObj=n,this.callbackId=1,this.streamId=1,this.postMessageTransfers=!0,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null);var i=this.callbacksCapabilities=Object.create(null),a=this.actionHandler=Object.create(null);this._onComObjOnMessage=function(e){var t=e.data;if(t.targetName===r.sourceName)if(t.stream)r._processStreamMessage(t);else if(t.isReply){var o=t.callbackId;if(!(t.callbackId in i))throw new Error("Cannot resolve callback "+o);var s=i[o];delete i[o],"error"in t?s.reject(O(t.error)):s.resolve(t.data)}else{if(!(t.action in a))throw new Error("Unknown action from worker: "+t.action);var l=a[t.action];if(t.callbackId){var c=r.sourceName,u=t.sourceName;Promise.resolve().then(function(){return l[0].call(l[1],t.data)}).then(function(e){n.postMessage({sourceName:c,targetName:u,isReply:!0,callbackId:t.callbackId,data:e})},function(e){n.postMessage({sourceName:c,targetName:u,isReply:!0,callbackId:t.callbackId,error:function(e){return!(e instanceof Error)||e instanceof b||e instanceof p||e instanceof f||e instanceof d?e:new d(e.message,e.toString())}(e)})})}else t.streamId?r._createStreamSink(t):l[0].call(l[1],t.data)}},n.addEventListener("message",this._onComObjOnMessage)}M.prototype={on:function(e,t,n){var r=this.actionHandler;if(r[e])throw new Error('There is already an actionName called "'+e+'"');r[e]=[t,n]},send:function(e,t,n){var r={sourceName:this.sourceName,targetName:this.targetName,action:e,data:t};this.postMessage(r,n)},sendWithPromise:function(e,t,n){var r=this.callbackId++,i={sourceName:this.sourceName,targetName:this.targetName,action:e,data:t,callbackId:r},a=C();this.callbacksCapabilities[r]=a;try{this.postMessage(i,n)}catch(e){a.reject(e)}return a.promise},sendWithStream:function(e,t,n,r){var a=this,o=this.streamId++,s=this.sourceName,l=this.targetName;return new i.ReadableStream({start:function(n){var r=C();return a.streamControllers[o]={controller:n,startCall:r,isClosed:!1},a.postMessage({sourceName:s,targetName:l,action:e,streamId:o,data:t,desiredSize:n.desiredSize}),r.promise},pull:function(e){var t=C();return a.streamControllers[o].pullCall=t,a.postMessage({sourceName:s,targetName:l,stream:"pull",streamId:o,desiredSize:e.desiredSize}),t.promise},cancel:function(e){var t=C();return a.streamControllers[o].cancelCall=t,a.streamControllers[o].isClosed=!0,a.postMessage({sourceName:s,targetName:l,stream:"cancel",reason:e,streamId:o}),t.promise}},n)},_createStreamSink:function(e){var t=this,n=this,r=this.actionHandler[e.action],i=e.streamId,a=e.desiredSize,o=this.sourceName,s=e.sourceName,l=function(e){var n=e.stream,r=e.chunk,a=e.transfers,l=e.success,c=e.reason;t.postMessage({sourceName:o,targetName:s,stream:n,streamId:i,chunk:r,success:l,reason:c},a)},c={enqueue:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments[2];if(!this.isCancelled){var r=this.desiredSize;this.desiredSize-=t,r>0&&this.desiredSize<=0&&(this.sinkCapability=C(),this.ready=this.sinkCapability.promise),l({stream:"enqueue",chunk:e,transfers:n})}},close:function(){this.isCancelled||(this.isCancelled=!0,l({stream:"close"}),delete n.streamSinks[i])},error:function(e){this.isCancelled||(this.isCancelled=!0,l({stream:"error",reason:e}))},sinkCapability:C(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:a,ready:null};c.sinkCapability.resolve(),c.ready=c.sinkCapability.promise,this.streamSinks[i]=c,I(r[0],[e.data,c],r[1]).then(function(){l({stream:"start_complete",success:!0})},function(e){l({stream:"start_complete",success:!1,reason:e})})},_processStreamMessage:function(e){var t=this,n=this.sourceName,r=e.sourceName,i=e.streamId,a=function(e){var a=e.stream,o=e.success,s=e.reason;t.comObj.postMessage({sourceName:n,targetName:r,stream:a,success:o,streamId:i,reason:s})},o=function(){Promise.all([t.streamControllers[e.streamId].startCall,t.streamControllers[e.streamId].pullCall,t.streamControllers[e.streamId].cancelCall].map(function(e){return e&&(t=e.promise,Promise.resolve(t).catch(function(){}));var t})).then(function(){delete t.streamControllers[e.streamId]})};switch(e.stream){case"start_complete":R(this.streamControllers[e.streamId].startCall,e.success,O(e.reason));break;case"pull_complete":R(this.streamControllers[e.streamId].pullCall,e.success,O(e.reason));break;case"pull":if(!this.streamSinks[e.streamId]){a({stream:"pull_complete",success:!0});break}this.streamSinks[e.streamId].desiredSize<=0&&e.desiredSize>0&&this.streamSinks[e.streamId].sinkCapability.resolve(),this.streamSinks[e.streamId].desiredSize=e.desiredSize,I(this.streamSinks[e.streamId].onPull).then(function(){a({stream:"pull_complete",success:!0})},function(e){a({stream:"pull_complete",success:!1,reason:e})});break;case"enqueue":c(this.streamControllers[e.streamId],"enqueue should have stream controller"),this.streamControllers[e.streamId].isClosed||this.streamControllers[e.streamId].controller.enqueue(e.chunk);break;case"close":if(c(this.streamControllers[e.streamId],"close should have stream controller"),this.streamControllers[e.streamId].isClosed)break;this.streamControllers[e.streamId].isClosed=!0,this.streamControllers[e.streamId].controller.close(),o();break;case"error":c(this.streamControllers[e.streamId],"error should have stream controller"),this.streamControllers[e.streamId].controller.error(O(e.reason)),o();break;case"cancel_complete":R(this.streamControllers[e.streamId].cancelCall,e.success,O(e.reason)),o();break;case"cancel":if(!this.streamSinks[e.streamId])break;I(this.streamSinks[e.streamId].onCancel,[O(e.reason)]).then(function(){a({stream:"cancel_complete",success:!0})},function(e){a({stream:"cancel_complete",success:!1,reason:e})}),this.streamSinks[e.streamId].sinkCapability.reject(O(e.reason)),this.streamSinks[e.streamId].isCancelled=!0,delete this.streamSinks[e.streamId];break;default:throw new Error("Unexpected stream case")}},postMessage:function(e,t){t&&this.postMessageTransfers?this.comObj.postMessage(e,t):this.comObj.postMessage(e)},destroy:function(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}};var W=function(){function e(t,n){this.constructor===e&&l("Cannot initialize BaseException."),this.message=t,this.name=n}return e.prototype=new Error,e.constructor=e,e}();t.BaseException=W,t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0],t.IDENTITY_MATRIX=[1,0,0,1,0,0],t.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},t.VERBOSITY_LEVELS=a,t.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",smask:"smask",shadingPattern:"shadingPattern",font:"font"},t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},t.AnnotationFieldFlag={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864},t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512},t.AnnotationType={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},t.FontType={UNKNOWN:0,TYPE1:1,TYPE1C:2,CIDFONTTYPE0:3,CIDFONTTYPE0C:4,TRUETYPE:5,CIDFONTTYPE2:6,TYPE3:7,OPENTYPE:8,TYPE0:9,MMTYPE1:10},t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},t.CMapCompressionType={NONE:0,BINARY:1,STREAM:2},t.AbortException=b,t.InvalidPDFException=h,t.MessageHandler=M,t.MissingDataException=g,t.MissingPDFException=p,t.NativeImageDecoding={NONE:"none",DECODE:"decode",DISPLAY:"display"},t.NotImplementedException=m,t.PageViewport=A,t.PasswordException=u,t.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},t.StatTimer=T,t.StreamType={UNKNOWN:0,FLATE:1,LZW:2,DCT:3,JPX:4,JBIG:5,A85:6,AHX:7,CCF:8,RL:9},t.TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},t.UnexpectedResponseException=f,t.UnknownErrorException=d,t.Util=P,t.XRefParseException=v,t.FormatError=y,t.arrayByteLength=_,t.arraysToBytes=function(e){if(1===e.length&&e[0]instanceof Uint8Array)return e[0];var t,n,r,i=0,a=e.length;for(t=0;t<a;t++)i+=r=_(n=e[t]);var o=0,s=new Uint8Array(i);for(t=0;t<a;t++)(n=e[t])instanceof Uint8Array||(n="string"==typeof n?S(n):new Uint8Array(n)),r=n.byteLength,s.set(n,o),o+=r;return s},t.assert=c,t.bytesToString=function(e){c(null!==e&&"object"===(void 0===e?"undefined":r(e))&&void 0!==e.length,"Invalid argument for bytesToString");var t=e.length;if(t<8192)return String.fromCharCode.apply(null,e);for(var n=[],i=0;i<t;i+=8192){var a=Math.min(i+8192,t),o=e.subarray(i,a);n.push(String.fromCharCode.apply(null,o))}return n.join("")},t.createBlob=D,t.createPromiseCapability=C,t.createObjectURL=E,t.deprecated=function(e){console.log("Deprecated API usage: "+e)},t.getLookupTableFactory=function(e){var t;return function(){return e&&(t=Object.create(null),e(t),e=null),t}},t.getVerbosityLevel=function(){return o},t.info=function(e){o>=a.infos&&console.log("Info: "+e)},t.isArrayBuffer=function(e){return"object"===(void 0===e?"undefined":r(e))&&null!==e&&void 0!==e.byteLength},t.isBool=function(e){return"boolean"==typeof e},t.isEmptyObj=function(e){for(var t in e)return!1;return!0},t.isNum=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSpace=function(e){return 32===e||9===e||13===e||10===e},t.isNodeJS=function(){return"object"===("undefined"==typeof process?"undefined":r(process))&&process+""=="[object process]"},t.isSameOrigin=function(e,t){try{var n=new URL(e);if(!n.origin||"null"===n.origin)return!1}catch(e){return!1}var r=new URL(t,n);return n.origin===r.origin},t.createValidAbsoluteUrl=function(e,t){if(!e)return null;try{var n=t?new URL(e,t):new URL(e);if(function(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(n))return n}catch(e){}return null},t.isLittleEndian=function(){var e=new Uint8Array(4);return e[0]=1,1===new Uint32Array(e.buffer,0,1)[0]},t.isEvalSupported=function(){try{return new Function(""),!0}catch(e){return!1}},t.loadJpegStream=function(e,t,n){var r=new Image;r.onload=function(){n.resolve(e,r)},r.onerror=function(){n.resolve(e,null),s("Error during JPEG image loading")},r.src=t},t.log2=function(e){return e<=0?0:Math.ceil(Math.log2(e))},t.readInt8=function(e,t){return e[t]<<24>>24},t.readUint16=function(e,t){return e[t]<<8|e[t+1]},t.readUint32=function(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0},t.removeNullCharacters=function(e){return"string"!=typeof e?(s("The argument for removeNullCharacters must be a string."),e):e.replace(w,"")},t.ReadableStream=i.ReadableStream,t.setVerbosityLevel=function(e){o=e},t.shadow=function(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!1}),n},t.string32=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},t.stringToBytes=S,t.stringToPDFString=function(e){var t,n=e.length,r=[];if("þ"===e[0]&&"ÿ"===e[1])for(t=2;t<n;t+=2)r.push(String.fromCharCode(e.charCodeAt(t)<<8|e.charCodeAt(t+1)));else for(t=0;t<n;++t){var i=k[e.charCodeAt(t)];r.push(i?String.fromCharCode(i):e.charAt(t))}return r.join("")},t.stringToUTF8String=function(e){return decodeURIComponent(escape(e))},t.utf8StringToString=function(e){return unescape(encodeURIComponent(e))},t.warn=s,t.unreachable=l},function(e,t,n){"use strict";var r,i,a,o,s="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=function(){var e=e||function(e,t){var n;"undefined"!=typeof window&&window.crypto&&(n=window.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&"undefined"!=typeof global&&global.crypto&&(n=global.crypto);var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),a={},o=a.lib={},s=o.Base={extend:function(e){var t=i(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},l=o.WordArray=s.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=void 0!=t?t:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var a=0;a<i;a++){var o=n[a>>>2]>>>24-a%4*8&255;t[r+a>>>2]|=o<<24-(r+a)%4*8}else for(a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(r());return new l.init(t,e)}}),c=a.enc={},u=c.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push((a>>>4).toString(16)),r.push((15&a).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new l.init(n,t/2)}},d=c.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(a))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new l.init(n,t)}},h=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,i=r.words,a=r.sigBytes,o=this.blockSize,s=a/(4*o),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*o,u=e.min(4*c,a);if(c){for(var d=0;d<c;d+=o)this._doProcessBlock(i,d);n=i.splice(0,c),r.sigBytes-=u}return new l.init(n,u)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(o.Hasher=p.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new f.HMAC.init(e,n).finalize(t)}}}),a.algo={});return a}(Math);return e},"object"===s(t)?e.exports=t=o():(i=[],void 0===(a="function"==typeof(r=o)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){"use strict";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};e.exports=function(e){return"object"===(void 0===e?"undefined":r(e))?null!==e:"function"==typeof e}},function(e,t,n){"use strict";var r=n(44)("wks"),i=n(19),a=n(0).Symbol,o="function"==typeof a;(e.exports=function(e){return r[e]||(r[e]=o&&a[e]||(o?a:i)("Symbol."+e))}).store=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pxCovertToMM=t.mmCovertToPx=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};t.scrollToResizeScreen=function(){if(window.navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)){var e=void 0,t=void 0;t=setInterval(function(){e=document.documentElement.scrollTop||document.body.scrollTop,e-=1,window.scrollTo(0,e),e+=1,window.scrollTo(0,e),clearInterval(t)},100)}},t.computeTextWdith=function(e,t,n){if(n){var r=document.createElement("canvas"),i=r.getContext("2d");return i.font=t+"px "+n,i.measureText(e).width}return t*e.length},t.closeOverlay=function(){var e=window.KGPdfViewerWebApp.PDFViewerApplication.overlayManager;if(e._active.length){var t=[];return e._active.forEach(function(n){t.push(e.close(n))}),Promise.all(t)}return Promise.resolve()},t.createTextLayerElement=function(e,t,n,r,i,a,o){var s=document.createElement("div"),l=Math.sin((360-a)*Math.PI/180),c=Math.cos((360-a)*Math.PI/180);return s.innerText=e,s.style.left=t-r*l/2+"px",s.style.top=n-r*c/2+"px",s.style.fontSize=r*o+"px",s.style.fontFamily=i,s.style.transform="rotate("+a+"deg) translate(-50%, -50%)",s},t.renderTextLayerElements=function(e,t){var n=e.textLayer;if(n){var r=n.textLayerDiv;if(r)for(var i=r.querySelector("endOfContent"),a=0;a<t.length;a++)r.insertBefore(t[a],i)}},t.leftTopTransformToLeftBottom=function(e,t){return{x:e.x,y:t-e.y}},t.trim=function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},t.unique=function(e){for(var t=0;t<e.length;t++)for(var n=t+1;n<e.length;n++)e[t]===e[n]&&(e.splice(n,1),n--);return e},t.getDom=function(e,t,n){for(var r=[],i=document.getElementsByTagName(e),a=0;a<i.length;a++)n===i[a].getAttribute(t)&&r.push(i[a]);return r},t.deepCopy=function e(t,n){var n=n||{};for(var i in t)if("object"==r(t[i])){var a=Array.isArray(t[i]);n[i]=1==a?[]:{},e(t[i],n[i])}else n[i]=t[i];return n},t.deleteSessionItem=function(e){sessionStorage.removeItem(e)},t.getSessionItem=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=sessionStorage.getItem(e);if(n)return t?s.default.decrypt(n,c).toString(a.default):n;return null},t.setSessionItem=function(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2]?sessionStorage.setItem(e,s.default.encrypt(t,c).toString()):sessionStorage.setItem(e,t)},t.deleteCookieAndStorage=function(e){o.default.remove(e),localStorage.removeItem(e)},t.getCookieOrStorage=function(e){var t=o.default.get(e),n=localStorage.getItem(e);return t||(n||"")},t.setCookieOrStorage=function(e,t,n){o.default.set(e,t,n),o.default.get(e)||localStorage.setItem(e,t)},t.randomString=function(e){e=e||32;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890",n="",r=0;r<e;r++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},t.functionalJudgment=function(e){var t=window.KGPdfViewerWebApp,n=t.textToSeal,r=t.prepareStamp,i=t.readOnly,a=t.fileType,o=t.additionText,s=t.pagingSeal,l=t.sealOrigin,c=t.certOrigin,u=t.multipleStamp,d=t.useCaptcha,h=t.disableSignaturePad,p=t.fjrs,f=t.mobile,m=t.download,g=t.watermark,v=t.showPrintBtn,y=t.verifyChainInfo,b=t.annotation,w=t.stampType,S=t.sealType,_=t.scanStamp,P=t.openLocalFile,A=t.secretSeal,k=t.indicateSeal,C=t.useTextWidget,x=t.isUrlDoc,T=t.sealPreLocation,D=t.globalAnnotation,E=t.iWebAuth,I=t.isUkey,O=t.stampSystemOrigin,R=t.unifySealPlatformV2,M=t.fingerPrint;switch(e){case"stamp":return x||!n&&!r&&!i;case"prepareStamp":return r&&!i;case"additionText":return o&&!r&&"PDF"===a;case"captcha":return d&&!r;case"pagingSeal":return s;case"openLocalFile":return P&&window.FormData;case"stampConfirm":return u&&!r;case"signature":return!(x||!(0===l&&0===c&&("PT"===S&&0===w||"GM"===S&&2===w||"OFD"===a)||1===l&&1===c&&("GM"===S&&2===w||"OFD"===a)||-1===c)||d||i||n||h||null!=p||r||_);case"download":return m&&!i;case"fjrs":return!i&&!r&&null!=p;case"scanStamp":return!i&&!r&&_&&1===O&&!R;case"textToSeal":return n&&!r&&!i&&0===f;case"watermark":return g&&!i;case"print":return v||n&&0===f&&!i;case"blockChain":return y;case"certValidity":return 2==w&&"GB"==S&&"1"==l&&"1"==c;case"annotation":return b;case"secretSeal":return A&&"1"==l&&"1"==c;case"indicateSeal":return k;case"textConfirm":return C;case"sealPreLocation":return null!=T;case"docSignConfirm":return!!D;case"iWebAuth":return E.scan||E.uKey;case"isUkey":return I;case"unifySealPlatformV2":return R;case"fingerPrint":return!!M;default:return!1}},t.convertRGB=function(e){for(var t="",n=0;n<3;n++){var r=parseInt(e[n]),i="0123456789ABCDEF",a="",o=r%16;a=i.substr(o,1),t+=i.substr(o=(r-o)/16,1)+a}return t},t.convertHex=function(e){function t(e,t,n,r){return parseInt(e.slice(t,n),r)}e=function(e){var t=[],n=e;if(3==e.length){for(var r=0;r<3;r++)t[r]=e.slice(r,r+1)+e.slice(r,r+1);n=t.join("")}return n}(e);for(var n=[],r=0;r<3;r++)n[r]=t(e,2*r,2*r+2,16);return n},t.hexToRgb=function(e){var t=e.toLowerCase();if(/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t)){if(4===t.length){for(var n="#",r=1;r<4;r+=1)n+=t.slice(r,r+1).concat(t.slice(r,r+1));t=n}for(var i=[],r=1;r<7;r+=2)i.push(parseInt("0x"+t.slice(r,r+2)));return{rgb:"rgb("+i.join(",")+")",rgbArr:i}}return t},t.IsFontExist=function(e){if(""==e)return"";var t=document.createElement("span"),n="测试文字";t.style.fontSize="72px",t.innerHTML=n;var r=document.getElementsByTagName("body")[0];r.appendChild(t),t.style.fontFamily=n;var i=t.offsetWidth,a=t.offsetHeight;t.style.fontFamily=e+","+n;var o=t.offsetWidth!=i||t.offsetHeight!=a;return r.removeChild(t),!!o},t.toTransparentImg=function(e){var t=[255,255,255,255],n=null,r=t[0],i=t[1],a=t[2],o=t[3],s=void 0,l=void 0,c=void 0,u=void 0,d=document.createElement("canvas"),h=d.getContext("2d"),p=e.width,f=e.height;d.width=p,d.height=f,h.drawImage(e,0,0),n=h.getImageData(0,0,p,f);for(var m=0;m<n.data.length;m+=4){s=n.data[m],l=n.data[m+1],c=n.data[m+2],u=n.data[m+3];var g=Math.sqrt(Math.pow(s-r,2)+Math.pow(l-i,2)+Math.pow(c-a,2)+Math.pow(u-o,2));g<=60&&(n.data[m]=0,n.data[m+1]=0,n.data[m+2]=0,n.data[m+3]=0)}return h.putImageData(n,0,0),d.toDataURL("image/png")},t.externalSign=function(e,t,n,r){if(null==window.KGPdfViewerWebApp.externalSign||"function"!=typeof window.KGPdfViewerWebApp.externalSign)r("外部签名接口未定义");else{for(var o=[],s=function(t){var n=e[t].needSigMessage;0==window.KGPdfViewerWebApp.stampType&&(n=i.default.stringify(a.default.parse(n))),o.push(new Promise(function(e){return window.KGPdfViewerWebApp.externalSign(n,e)}))},l=0;l<e.length;l++)s(l);Promise.all(o).then(function(n){for(var r=[],i=void 0,a=0;a<n.length;a++){var o=n[a],s=o.cert,l=o.signedData,c=o.message;if(!s||!l){i={message:c||"外部接口签名失败"};break}0==window.KGPdfViewerWebApp.stampType?e[a].certSignMsg=l:e[a].sigedData=l;var u={cert:s,signedData:[e[a]]};r.push(t(u))}return i?Promise.reject(i):Promise.all(r)}).then(function(){n&&n()}).catch(function(e){r(e.message||"外部接口签名失败")})}},t.mergerConfig=function(e,t){for(var n in t)!0===t.hasOwnProperty(n)&&(e[n]=t[n]);return e},t.flatten=function(e){var t={};return function e(n,r){if(Object(r)!==r)n&&(t[n]=r);else if(Array.isArray(r)){for(var i=0,a=r.length;i<a;i++)e(n+"["+i+"]",r[i]);0===r.length&&n&&(t[n]=[])}else{var o=!0;for(var s in r)o=!1,e((n?n+".":n)+s,r[s]);o&&n&&(t[n]={})}}("",e),t},t.titleCase=function(e){return e.slice(0,1).toUpperCase()+e.slice(1)},t.isMobile=function(){var e=navigator.userAgent.toLowerCase(),t="ipad"==e.match(/ipad/i),n="iphone"==e.match(/iphone/i),r="ipod"==e.match(/ipd/i),i="android"==e.match(/android/i),a="blackberry"==e.match(/blackberry/i),o="symbianos"==e.match(/symbianos/i);return!!(t||n||r||i||a||o)},t.parseCilentSealImgData=function(e){var t=e.substring(0,65),n=e.substring(65);return i.default.stringify(i.default.parse(n,t))},t.closest=function(e,t){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;if(!document.documentElement.contains(t))return null;do{if(!t.matches)return null;if(t.matches(e))return t;t=t.parentNode}while(null!==t);return null});return e.closest(t)},t._deepClone=function e(t){var n=void 0;if("object"===(void 0===t?"undefined":r(t)))for(var i in n=Array.isArray(t)?[]:{},t)t.hasOwnProperty(i)&&("object"!==r(t[i])?n[i]=t[i]:n[i]=e(t[i]));else n=t;return n},t.sortClass=function(e,t){return n=e,r=function(e){var n=e;return t.forEach(function(e){n=n[e]}),n},i={},n.forEach(function(e){var t=JSON.stringify(r(e));i[t]=i[t]||[],i[t].push(e)}),Object.keys(i).map(function(e){return i[e]});var n,r,i},t.removePrototype=function(e){var t=Object.create(null);for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},t.transformData=function(e){var t=window.KGPdfViewerWebApp,n=t.aesEncrypt,r=t.postEncrypt,i=void 0!==r&&r,a=void 0,o=Object.create(null);a=i?n(JSON.stringify(e)):e;return o.isEncrypt=i,o.data=a,o},t.getXYPoint=function(e,t){var n=void 0,r=void 0,i=void 0,a=void 0,o=u(e,t);switch(o){case"left-top":i=e.left/t.width,a=e.top/t.height,n=t.width*a,r=t.height*i;break;case"right-top":i=(t.width-e.left-e.width)/t.width,a=e.top/t.height,n=t.width*a,r=(t.height-e.width)*(1-i);break;case"left-bottom":i=e.left/t.width,a=(t.height-e.top-e.height)/t.height,n=(t.width-e.height)*(1-a),r=t.height*i;break;case"right-bottom":i=(t.width-e.left-e.width)/t.width,a=(t.height-e.top-e.height)/t.height,n=(t.width-e.height)*(1-a),r=(t.height-e.width)*(1-i)}return{XYType:o,r_top:n,r_left:r,xsacle:i,ysacle:a}},t.getXYPoint_diffentSize=function(e){var t=e.tempSeal,n=e.hRatio,r=e.wRatio,i=void 0,a=void 0;switch(t.XYType){case"left-top":i=t.top*n,a=t.left*r;break;case"right-top":i=t.top*n,a=t.left*r+t.width*r-t.width;break;case"left-bottom":i=t.top*n+t.height*n-t.height,a=t.left*r;break;case"right-bottom":i=t.top*n+t.height*n-t.height,a=t.left*r+t.width*r-t.width}return{d_top:i,d_left:a}},t.isIE=function(){return navigator.userAgent.indexOf("Trident")>=0},t.pxConversionMm=function(e){return e/d()[0]*25.4},t.mmConversionPx=function(e){return e/25.4*d()[0]},t.proxyFunction=function(e,t,n){Function.prototype.before||(Function.prototype.before=function(e){var t=this;return function(){var n=e.apply(this,arguments);return n&&t.apply(this,arguments)}});Function.prototype.after||(Function.prototype.after=function(e){var t=this;return function(){return t.apply(this,arguments),e.apply(this,arguments)}});return t[e](n)},t.download=function(e,t){(function(e){return new Promise(function(t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="blob",n.onload=function(){200===n.status&&t(n.response)},n.send()})})(e+"?docType=0&action=download&documentId="+t+"&t="+(new Date).getTime()).then(function(e){!function(e){if(window.navigator.msSaveBlob)return window.navigator.msSaveBlob(e,decodeURIComponent(t));var n=document.createElement("a");n.href=window.URL.createObjectURL(e),n.download=decodeURIComponent(t),(document.body||document.documentElement).appendChild(n),n.click(),n.parentNode.removeChild(n)}(e)})},t.limitQueueFn=function(e,t,n){var r=0,i=0,a=new Array(e.length).fill(0);return new Promise(function(o,s){for(var l=0;l<t;l++)c();function c(){new Promise(function(t,i){var a=e[r];r++,t(n(a))}).then(function(t){a[i]=t,i++,r<e.length?c():o(a)})}})};var i=l(n(15)),a=l(n(32)),o=l(n(149)),s=l(n(88));function l(e){return e&&e.__esModule?e:{default:e}}var c="+97]4Up@<ZS3(#V0y55-Z-e0";t.mmCovertToPx=function(e){return Math.round(e/(1/(720/254)))},t.pxCovertToMM=function(e){return Math.round(e*(1/(720/254)))};var u=function(e,t){var n="";return n+=e.left+e.width/2<t.width/2?"left":"right",n+="-",n+=e.top+e.height/2<t.height/2?"top":"bottom"};function d(){var e=new Array;if(window.screen.deviceXDPI)e[0]=window.screen.deviceXDPI,e[1]=window.screen.deviceYDPI;else{var t=document.createElement("DIV");t.style.cssText="width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden",document.body.appendChild(t),e[0]=parseInt(t.offsetWidth),e[1]=parseInt(t.offsetHeight),t.parentNode.removeChild(t)}return e}},function(e,t,n){"use strict";var r=e.exports={version:"2.6.11"};"number"==typeof __e&&(__e=r)},function(e,t,n){"use strict";var r=n(0),i=n(6),a=n(9),o=n(18),s=n(12),l=function e(t,n,l){var c,u,d,h,p=t&e.F,f=t&e.G,m=t&e.P,g=t&e.B,v=f?r:t&e.S?r[n]||(r[n]={}):(r[n]||{}).prototype,y=f?i:i[n]||(i[n]={}),b=y.prototype||(y.prototype={});for(c in f&&(l=n),l)d=((u=!p&&v&&void 0!==v[c])?v:l)[c],h=g&&u?s(d,r):m&&"function"==typeof d?s(Function.call,d):d,v&&o(v,c,d,t&e.U),y[c]!=d&&a(y,c,h),m&&b[c]!=d&&(b[c]=d)};r.core=i,l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t,n){"use strict";e.exports=!n(16)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";var r=n(17),i=n(33);e.exports=n(8)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";var r=n(3);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){"use strict";var r={}.hasOwnProperty;e.exports=function(e,t){return r.call(e,t)}},function(e,t,n){"use strict";var r=n(27);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){"use strict";var r=n(20),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DOMSVGFactory=t.DOMCMapReaderFactory=t.DOMCanvasFactory=t.DEFAULT_LINK_REL=t.getDefaultSetting=t.LinkTarget=t.getFilenameFromUrl=t.isValidUrl=t.isExternalLinkTargetSet=t.addLinkAttributes=t.RenderingCancelledException=t.CustomStyle=void 0;var r,i=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}}(),a=n(1),o=n(25),s=(r=o)&&r.__esModule?r:{default:r};function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var c="noopener noreferrer nofollow",u="http://www.w3.org/2000/svg",d=function(){function e(){l(this,e)}return i(e,[{key:"create",value:function(e,t){if(e<=0||t<=0)throw new Error("invalid canvas size");var n=document.createElement("canvas"),r=n.getContext("2d");return n.width=e,n.height=t,{canvas:n,context:r}}},{key:"reset",value:function(e,t,n){if(!e.canvas)throw new Error("canvas is not specified");if(t<=0||n<=0)throw new Error("invalid canvas size");e.canvas.width=t,e.canvas.height=n}},{key:"destroy",value:function(e){if(!e.canvas)throw new Error("canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}}]),e}(),h=function(){function e(t){var n=t.baseUrl,r=void 0===n?null:n,i=t.isCompressed,a=void 0!==i&&i;l(this,e),this.baseUrl=r,this.isCompressed=a}return i(e,[{key:"fetch",value:function(e){var t=this,n=e.name;return this.baseUrl?n?new Promise(function(e,r){var i=t.baseUrl+n+(t.isCompressed?".bcmap":""),o=new XMLHttpRequest;o.open("GET",i,!0),t.isCompressed&&(o.responseType="arraybuffer"),o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE){if(200===o.status||0===o.status){var n=void 0;if(t.isCompressed&&o.response?n=new Uint8Array(o.response):!t.isCompressed&&o.responseText&&(n=(0,a.stringToBytes)(o.responseText)),n)return void e({cMapData:n,compressionType:t.isCompressed?a.CMapCompressionType.BINARY:a.CMapCompressionType.NONE})}r(new Error("Unable to load "+(t.isCompressed?"binary ":"")+"CMap at: "+i))}},o.send(null)}):Promise.reject(new Error("CMap name must be specified.")):Promise.reject(new Error('CMap baseUrl must be specified, see "PDFJS.cMapUrl" (and also "PDFJS.cMapPacked").'))}}]),e}(),p=function(){function e(){l(this,e)}return i(e,[{key:"create",value:function(e,t){(0,a.assert)(e>0&&t>0,"Invalid SVG dimensions");var n=document.createElementNS(u,"svg:svg");return n.setAttribute("version","1.1"),n.setAttribute("width",e+"px"),n.setAttribute("height",t+"px"),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox","0 0 "+e+" "+t),n}},{key:"createElement",value:function(e){return(0,a.assert)("string"==typeof e,"Invalid SVG element type"),document.createElementNS(u,e)}}]),e}(),f=function(){var e=["ms","Moz","Webkit","O"],t=Object.create(null);function n(){}return n.getProp=function(n,r){if(1===arguments.length&&"string"==typeof t[n])return t[n];var i,a,o=(r=r||document.documentElement).style;if("string"==typeof o[n])return t[n]=n;a=n.charAt(0).toUpperCase()+n.slice(1);for(var s=0,l=e.length;s<l;s++)if("string"==typeof o[i=e[s]+a])return t[n]=i;return t[n]="undefined"},n.setProp=function(e,t,n){var r=this.getProp(e);"undefined"!==r&&(t.style[r]=n)},n}(),m=function(){function e(e,t){this.message=e,this.type=t}return e.prototype=new Error,e.prototype.name="RenderingCancelledException",e.constructor=e,e}(),g={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4},v=["","_self","_blank","_parent","_top"];function y(e){var t=s.default.PDFJS;switch(e){case"pdfBug":return!!t&&t.pdfBug;case"disableAutoFetch":return!!t&&t.disableAutoFetch;case"disableStream":return!!t&&t.disableStream;case"disableRange":return!!t&&t.disableRange;case"disableFontFace":return!!t&&t.disableFontFace;case"disableCreateObjectURL":return!!t&&t.disableCreateObjectURL;case"disableWebGL":return!t||t.disableWebGL;case"cMapUrl":return t?t.cMapUrl:null;case"cMapPacked":return!!t&&t.cMapPacked;case"postMessageTransfers":return!t||t.postMessageTransfers;case"workerPort":return t?t.workerPort:null;case"workerSrc":return t?t.workerSrc:null;case"disableWorker":return!!t&&t.disableWorker;case"maxImageSize":return t?t.maxImageSize:-1;case"imageResourcesPath":return t?t.imageResourcesPath:"";case"isEvalSupported":return!t||t.isEvalSupported;case"externalLinkTarget":if(!t)return g.NONE;switch(t.externalLinkTarget){case g.NONE:case g.SELF:case g.BLANK:case g.PARENT:case g.TOP:return t.externalLinkTarget}return(0,a.warn)("PDFJS.externalLinkTarget is invalid: "+t.externalLinkTarget),t.externalLinkTarget=g.NONE,g.NONE;case"externalLinkRel":return t?t.externalLinkRel:c;case"enableStats":return!(!t||!t.enableStats);case"pdfjsNext":return!(!t||!t.pdfjsNext);default:throw new Error("Unknown default setting: "+e)}}t.CustomStyle=f,t.RenderingCancelledException=m,t.addLinkAttributes=function(e,t){var n=t&&t.url;if(e.href=e.title=n?(0,a.removeNullCharacters)(n):"",n){var r=t.target;void 0===r&&(r=y("externalLinkTarget")),e.target=v[r];var i=t.rel;void 0===i&&(i=y("externalLinkRel")),e.rel=i}},t.isExternalLinkTargetSet=function(){switch(y("externalLinkTarget")){case g.NONE:return!1;case g.SELF:case g.BLANK:case g.PARENT:case g.TOP:return!0}},t.isValidUrl=function(e,t){(0,a.deprecated)("isValidUrl(), please use createValidAbsoluteUrl() instead.");var n=t?"http://example.com":null;return null!==(0,a.createValidAbsoluteUrl)(e,n)},t.getFilenameFromUrl=function(e){var t=e.indexOf("#"),n=e.indexOf("?"),r=Math.min(t>0?t:e.length,n>0?n:e.length);return e.substring(e.lastIndexOf("/",r)+1,r)},t.LinkTarget=g,t.getDefaultSetting=y,t.DEFAULT_LINK_REL=c,t.DOMCanvasFactory=d,t.DOMCMapReaderFactory=h,t.DOMSVGFactory=p},function(e,t,n){"use strict";var r,i,a,o,s="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=function(e){return function(){var t=e,n=t.lib.WordArray;t.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],a=0;a<n;a+=3)for(var o=(t[a>>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<n;s++)i.push(r.charAt(o>>>6*(3-s)&63));var l=r.charAt(64);if(l)for(;i.length%4;)i.push(l);return i.join("")},parse:function(e,t){for(var r=e.length,i=(t=t||this._map,[]),a=0;a<t.length;a++)i[t.charCodeAt(a)]=a;var o=t.charAt(64);if(o){var s=e.indexOf(o);-1!==s&&(r=s)}return function(e,t,r){for(var i=[],a=0,o=0;o<t;o++)if(o%4){var s=r[e.charCodeAt(o-1)]<<o%4*2,l=r[e.charCodeAt(o)]>>>6-o%4*2,c=s|l;i[a>>>2]|=c<<24-a%4*8,a++}return n.create(i,a)}(e,r,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64},"object"===s(t)?e.exports=t=o(n(2)):(i=[n(2)],void 0===(a="function"==typeof(r=o)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){"use strict";var r=n(10),i=n(62),a=n(43),o=Object.defineProperty;t.f=n(8)?Object.defineProperty:function(e,t,n){if(r(e),t=a(t,!0),r(n),i)try{return o(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){"use strict";var r=n(0),i=n(9),a=n(11),o=n(19)("src"),s=n(103),l=(""+s).split("toString");n(6).inspectSource=function(e){return s.call(e)},(e.exports=function(e,t,n,s){var c="function"==typeof n;c&&(a(n,"name")||i(n,"name",t)),e[t]!==n&&(c&&(a(n,o)||i(n,o,e[t]?""+e[t]:l.join(String(t)))),e===r?e[t]=n:s?e[t]?e[t]=n:i(e,t,n):(delete e[t],i(e,t,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[o]||s.call(this)})},function(e,t,n){"use strict";var r=0,i=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++r+i).toString(36))}},function(e,t,n){"use strict";var r=Math.ceil,i=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?i:r)(e)}},function(e,t,n){"use strict";var r=n(46);e.exports=function(e){return Object(r(e))}},function(e,t,n){"use strict";e.exports={}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFRenderingQueue=t.RenderingStates=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}}(),i=n(24),a=n(165),o=n(5);var s={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1}return r(e,[{key:"setViewer",value:function(e){this.pdfViewer=e}},{key:"setThumbnailViewer",value:function(e){this.pdfThumbnailViewer=e}},{key:"isHighestPriority",value:function(e){return this.highestPriorityPage===e.renderingId}},{key:"renderHighestPriority",value:function(e){this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),this.pdfViewer.forceRendering(e)||this.pdfThumbnailViewer&&this.isThumbnailViewEnabled&&this.pdfThumbnailViewer.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4))}},{key:"getHighestPriority",value:function(e,t,n){var r=e.views,i=r.length;if(0===i)return!1;for(var a=0;a<i;++a){var o=r[a].view;if(!this.isViewFinished(o))return o}if(n){var s=e.last.id;if(t[s]&&!this.isViewFinished(t[s]))return t[s]}else{var l=e.first.id-2;if(t[l]&&!this.isViewFinished(t[l]))return t[l]}return null}},{key:"isViewFinished",value:function(e){return e.renderingState===s.FINISHED}},{key:"renderView",value:function(e){var t=this;switch(e.renderingState){case s.FINISHED:return!1;case s.PAUSED:this.highestPriorityPage=e.renderingId,e.resume();break;case s.RUNNING:this.highestPriorityPage=e.renderingId;break;case s.INITIAL:this.highestPriorityPage=e.renderingId;var n=function(){if(t.renderHighestPriority(),null!=e.canvas){var n=e.viewport.scale*(e.canvas.width/e.canvas.offsetWidth),r=e.pdfPage.newStamps;for(var s in r){var l=(I=r[s]).querySelector("img"),c=I.style.width,u=I.style.height,d=c.substring(0,c.length-2)*n,h=u.substring(0,u.length-2)*n,p=I.style.left,f=I.style.top,m=p.substring(0,p.length-2)*n,g=f.substring(0,f.length-2)*n;(O=e.canvas.getContext("2d")).globalCompositeOperation="multiply","multiply"!==O.globalCompositeOperation&&(O.globalAlpha=.75),O.drawImage(l,m,g,d,h)}for(var v=e.pdfPage.textToSeals,y=0;y<v.length;y++){var b=v[y].section,w=b.querySelector("img"),S=(0,i.getNumbOfPx)(b.style.width)*n,_=(0,i.getNumbOfPx)(b.style.height)*n,P=((0,i.getNumbOfPx)(b.style.left)+1)*n,A=((0,i.getNumbOfPx)(b.style.top)+1)*n,k=e.canvas.getContext("2d");k.globalCompositeOperation="multiply","multiply"!==k.globalCompositeOperation&&(k.globalAlpha=.75),k.drawImage(w,P,A,S,_)}var C=e.pdfPage.newWatermark;for(var x in C){var T=C[x];(0,a.renderWaterMark)(T,e.canvas,n,e.canvas.width,e.canvas.height,null,!0).then(function(t){(0,o.renderTextLayerElements)(e,t)})}var D=e.pdfPage.newDocSigns;for(var E in D){var I,O;l=(I=D[E]).querySelector("img"),c=I.style.width,u=I.style.height,d=c.substring(0,c.length-2)*n,h=u.substring(0,u.length-2)*n,p=I.style.left,f=I.style.top,m=p.substring(0,p.length-2)*n,g=f.substring(0,f.length-2)*n;(O=e.canvas.getContext("2d")).globalCompositeOperation="source-over",(O=e.canvas.getContext("2d")).drawImage(l,m,g,d,h)}}e.deleteStampCallback&&(e.deleteStampCallback(),e.deleteStampCallback=null),e.reRenderWait&&(e.destroy(),e.renderingState=0,e.renderingQueue.renderView(e),e.reRenderWait=!1)};e.draw().then(n,n)}return!0}}]),e}();t.RenderingStates=s,t.PDFRenderingQueue=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertScreenToViewportPoint=t.getNumbOfPx=t.getPath=t.CustomStyle=t.PDFStamp=void 0;var r,i="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},a=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=n(23),s=n(148),l=n(154),c=n(41),u=n(56),d=n(95),h=(r=d)&&r.__esModule?r:{default:r},p=n(94),f=n(5),m=n(164);var g=function(){var e=["ms","Moz","Webkit","O"],t=Object.create(null);function n(){}return n.getProp=function(n,r){if(1===arguments.length&&"string"==typeof t[n])return t[n];var i,a,o=(r=r||document.documentElement).style;if("string"==typeof o[n])return t[n]=n;a=n.charAt(0).toUpperCase()+n.slice(1);for(var s=0,l=e.length;s<l;s++)if("string"==typeof o[i=e[s]+a])return t[n]=i;return t[n]="undefined"},n.setProp=function(e,t,n){var r=this.getProp(e);"undefined"!==r&&(t.style[r]=n)},n}();function v(e){var t=e.path;if(!t){t=[];var n=e.target;for(t.push(n);n.parentNode;)n=n.parentNode,t.push(n)}return t}function y(e){return parseFloat(e.substring(0,e.length-2))}function b(e,t){for(var n=v(e),r=0;r<n.length;r++){var i=n[r],a=i.id,o=i.className;if(a&&o)if(-1!=a.indexOf("pageContainer")&&"page"===o){for(var s=n[r++];"viewerContainer"!=s.id;)s=n[r++];var l=a.substring(13),c=window.hightMap.get(l);if(!c){c=0;for(var u=1;u<l;u++){c+=document.getElementById("pageContainer"+u).clientHeight+12}window.hightMap.set(l,c)}var d=e.clientY,h=e.clientX;if(null==d){var p=e.touches[0];h=p.clientX,d=p.clientY}var f=s.scrollTop+(d-48)-(c+10),m=s.scrollLeft+h,g=y(i.style.width),b=s.clientWidth;return{node:i,pageNumber:l,pageX:b>=g?m-(b-g)/2:m,pageY:f}}}return null}window.hightMap={set:function(e,t){this[e]=t},get:function(e){return this[e]},contains:function(e){return null!=this[e]},remove:function(e){delete this[e]},removeAll:function(){for(var e in this)"function"!=typeof this[e]&&delete this[e]}};var w=function(){function e(e,t,n){if(this.isStamp=!1,this.toolbarButton=e,this.secondaryToolbarButton=t,this.app=n,this.sidebar=n.pdfSidebar,this.fileType=window.KGPdfViewerWebApp.fileType,this.seal=null,this.capability=null,this.touchstartEvent=null,this.pdfStampSeal=new s.PDFStampSeal(l.KGPdfViewerWebApp),this.stampMobileTip=document.getElementById("stamp-mobile-tip"),this.stampMobieCancel=document.getElementById("stamp-mobile-cancel"),this.isContinuityStampCheck=!1,this.continuityRange=null,this.isStampOfQfz=!1,this.tempSeals=[],this.stampSealType="default",this.renderSignatureSeals=this.renderSignatureSeals.bind(this),this.selectSign=null,this.removeSignBtn=document.getElementById("docSignRemove"),this.selectSealData=null,!window.KGPdfViewerWebApp.chainStamp){var r=this;this.continuityStampModal=new m.KG_ModalFactory(this.app,this.app.overlayManager,{overlayName:"KG_CustomModalOverlay",message:"印章改变位置,拖动在指定位置",width:320,buttons:[{content:"当前签章",callback:function(){delete r.selectSealData.lastSelected},type:"primary"},{content:"全局签章",callback:function(){var e=void 0,t=void 0,n=r.selectSealData,i=n.lastSelected,a=i.index,o=i.scale,s=i.tempStampSections,l=n.extraPosition[a],c=l.left,u=l.top,h=l.xsacle,p=l.ysacle,m=l.XYType;n.top=u,n.left=c,n.xsacle=h,n.ysacle=p,n.XYType=m,s.map(function(r){var i=Object.values(r)[0],a=i.isRotate,s=i.isDiffentSize,l=i.ratio,h=i.page;if(a){var p=(0,f.getXYPoint)(n,{width:h.height/o,height:h.width/o}),m=p.r_left,g=p.r_top;e=g,t=m}else e=u,t=c;if(s){var v=(0,f.getXYPoint_diffentSize)({wRatio:l.wRatio,hRatio:l.hRatio,tempSeal:n}),y=v.d_top,b=v.d_left;e=y,t=b}(0,d.setSectionStyle)(i,o,t,e)}),delete n.lastSelected,n.extraPosition=Object.create(null)}}]})}this.initStampPosition(),this.init()}return e.prototype={init:function(){var e=this,t=this;function n(e,n){e.preventDefault(),e.stopPropagation(),t.app.secondaryToolbar.close();var r=window.KGPdfViewerWebApp.getSelectSealPrompt();if((t.tempSeals.length||t.isStamp)&&null!==r.seals&&r.seals.length>0){t.isStamp=!1,t.app.KGStampConfirm.hide(),r.open();for(var i=1;i<t.app.pagesCount;i++){var a=t.app.pdfViewer.getPageView(i-1).pdfPage.tempStamps;for(var o in a)if(a.hasOwnProperty(o)){var s=a[o].querySelector(".deleteTempStampSection");s&&(s.style.display="none");var l=a[o].querySelector(".scaleTempStampSection");l&&(l.style.display="none")}}document.body.style.cursor="default",document.onmousemove=null}else t.stamp(n)}window.KGPdfViewerWebApp.elecSigModeCheckFile().then(function(t){t.status||e.app.KGAlertPrompt.open(t.message);var r=window.KGPdfViewerWebApp.btnPositionConfig,i=r.toolbar,a=void 0===i?[]:i,o=r.sidebar,s=void 0===o?[]:o;if((0,f.functionalJudgment)("secretSeal")){var l=e.app.appConfig.KG_SecretSeal,c=l.button,u=l.secondaryButton;a.indexOf("stamp")>-1&&(c.removeAttribute("hidden"),t.status?c.onclick=function(e){return n(e,"secret")}:c.setAttribute("disabled",!0)),s.indexOf("stamp")>-1&&(u.removeAttribute("hidden"),t.status?u.onclick=function(e){return n(e,"secret")}:u.setAttribute("disabled",!0))}else a.indexOf("stamp")>-1&&!window.KGPdfViewerWebApp.isUrlDoc&&!window.KGPdfViewerWebApp.scanStamp&&!window.KGPdfViewerWebApp.unifySealPlatformV2&&(e.toolbarButton.removeAttribute("hidden"),t.status?e.toolbarButton.onclick=n:e.toolbarButton.setAttribute("disabled",!0)),s.indexOf("stamp")>-1&&!window.KGPdfViewerWebApp.isUrlDoc&&!window.KGPdfViewerWebApp.scanStamp&&!window.KGPdfViewerWebApp.unifySealPlatformV2&&(e.secondaryToolbarButton.removeAttribute("hidden"),t.status?e.secondaryToolbarButton.onclick=n:e.secondaryToolbarButton.setAttribute("disabled",!0)),2==window.KGPdfViewerWebApp.stampSystemOrigin&&(e.secondaryToolbarButton.removeAttribute("hidden"),t.status?e.secondaryToolbarButton.onclick=n:e.secondaryToolbarButton.setAttribute("disabled",!0),document.getElementById("secondaryKgSignature").setAttribute("hidden",!0));"0"===window.KGPdfViewerWebApp.mobile.toString()?(document.oncontextmenu=e.onDocumentContextmenu.bind(e),document.addEventListener("click",e.onDocumentClick.bind(e))):(document.ontouchstart=e.onDocumentTouchStart.bind(e),document.ontouchmove=e.onDocumentTouchMove.bind(e),document.ontouchend=e.onDocumentTouchEnd.bind(e))})},onDocumentClick:function(e){0===e.button&&((0,u.removeStampMenu)(),this.documentClick(e)),this.editDocSign(e)},onDocumentContextmenu:function(e){if(this.isStamp)if(e&&(e.preventDefault(),e.stopPropagation()),this.tempSeals.length){this.app.KGStampConfirm.show(),this.tempSeals.forEach(function(e){e.eventRegister()});for(var t=1;t<=this.app.pagesCount;t++){var n=this.app.pdfViewer.getPageView(t-1).pdfPage.tempStamps;for(var r in n)if(n.hasOwnProperty(r)){var i=n[r].querySelector(".deleteTempStampSection");i&&(i.style.display="block");var a=n[r].querySelector(".scaleTempStampSection");a&&(a.style.display="block")}}}else this.app.KG_ScanStamp&&this.app.KG_ScanStamp.clearSealData();this.cancelStamp()},onDocumentTouchStart:function(e){this.isStamp&&(this.touchstartEvent=e),this.editDocSign(e)},onDocumentTouchMove:function(){this.touchstartEvent=null},onDocumentTouchEnd:function(e){null!=this.touchstartEvent?this.documentClick(this.touchstartEvent):"rightMenu"!==e.target.parentNode.id&&(0,u.removeStampMenu)()},addStamp:function(e,t){var n=(0,f.deepCopy)(e);n.sealdata.forEach(function(e,t){delete e.qfzSeal}),t&&t.removeAttribute("class"),this.cancelStamp(),this.capability.resolve(n)},setSealData:function(e){this.seal=e.seal,this.isContinuityStampCheck=e.isContinuityStampCheck,this.isStampOfQfz=e.isStampOfQfz,this.continuityRange=e.continuityRange,this.getSealObjectCallback(e)},getSealObjectCallback:function(e){var t=this;this.seal=e.seal,this.isContinuityStampCheck=e.isContinuityStampCheck,this.continuityRange=e.continuityRange,this.isStampOfQfz=e.isStampOfQfz,this.capability=this.pdfStampSeal.createAddSealPromise();var n=this.app.KG_SealPreLocation;!n||n.hasStamp?(this.app.KGStampConfirm&&this.app.KGStampConfirm.hide(),this.tempSeals.length&&this.tempSeals.forEach(function(e){e.eventUnregister()}),("stamp"===this.stampPosition.mode||e.isContinuityStampCheck||e.isStampOfQfz)&&("1"===window.KGPdfViewerWebApp.mobile.toString()?(this.stampMobileTip.style.display="block",this.stampMobieCancel.addEventListener("click",function(e){t.stampMobileTip.style.display="none",t.tempSeals.length&&t.app.KGStampConfirm.show(),t.cancelStamp()}),this.isStamp=!0,document.ontouchstart=this.app.pdfStamp.onDocumentTouchStart.bind(this),document.ontouchmove=this.app.pdfStamp.onDocumentTouchMove.bind(this),document.ontouchend=this.app.pdfStamp.onDocumentTouchEnd.bind(this)):(document.body.style.cursor="move",this.stopMoveStamp||(document.onmousemove=function(e){t.isStamp=!0,t.movestamp(e,t)})))):n.isStamp||(n.deletePreSeal(),this.isStamp=!0,n.isStamp=!0,this.movestamp(void 0,this),this.documentClick())},documentClick:function(e){var t=this;if(this.isStamp){var n=void 0;if(e)n=b(e,this.sidebar);else{var r=this.app,i=r.KG_SealPreLocation,a=r.pdfViewer;if(i){var o=i.seal.page;n={node:a.getPageView(o-1).div,pageNumber:o}}}if(n){window.KGPdfViewerWebApp.allowFollow&&window.KGPdfViewerWebApp.multipleStamp||(this.isStamp=!1,document.body.style.cursor="default",document.onmousemove=null);var s=n,l=s.node,u=s.pageNumber;"1"===window.KGPdfViewerWebApp.mobile.toString()&&(this.stampMobileTip.style.display="none",this.movestamp(e,this));var p=document.getElementById(l.id+"stamp");if(p){var m=this.app.pdfViewer,g=this.seal;if(g.left=y(p.style.left),g.top=y(p.style.top),g.width=y(p.style.width),g.height=y(p.style.height),this.isContinuityStampCheck){g.isContinuityStampCheck=!0,g.page=this.continuityRange;var v=(T=m.getPageView(u-1)).viewport.scale,w=(T.width,T.height/v),S=T.div,_=parseInt(getComputedStyle(S).width),P=parseInt(getComputedStyle(S).height),A=(0,f.getXYPoint)(g,{width:_/v,height:P/v}),k=A.XYType,C=A.xsacle,x=A.ysacle;A.r_left,A.r_top;g.XYType=k,g.xsacle=C,g.ysacle=x,g.actionPageInfo=(0,f.removePrototype)({width:_,height:P,direction:P>_?"vertical":"horizontal"})}else if(this.isStampOfQfz){var T;w=(T=m.getPageView(u-1)).height/T.viewport.scale;g.bottom=w-g.top-g.height,g.isStampOfQfz=!0,g.pageAttr.bottom=g.bottom;var D=g.top+g.height;g.pageAttr.top=D,g.qfzSeal.forEach(function(e){e.top=g.top,e.width*=g.height/e.height,e.height=g.height}),delete g.isContinuityStampCheck,delete g.xsacle,delete g.ysacle,delete g.left,delete g.top,delete g.bottom}else g.page=u,g.hasOwnProperty("isContinuityStampCheck")&&delete g.isContinuityStampCheck,g.hasOwnProperty("xsacle")&&delete g.xsacle,g.hasOwnProperty("ysacle")&&delete g.ysacle;var E=(0,c.createCapability)();if(window.KGPdfViewerWebApp.multipleStamp)g.isStampOfQfz||(g.currentPage=u),this.tempSeals.push(new h.default(p,g)),this.tempSeals.length&&(this.app.KGStampConfirm.show(),this.app.KGStampConfirm.sealDatas=this.tempSeals.map(function(e){return e.sealData}),this.app.KGStampConfirm.capability=E,window.KGPdfViewerWebApp.allowFollow&&"1"!==window.KGPdfViewerWebApp.mobile.toString()||this.onDocumentContextmenu());else{if(g.isStampOfQfz){for(var I=0;I<g.qfzSeal.length;I++){var O=g.qfzSeal[I];O.sealdata=[],O.sealdata[0]={left:O.left,width:O.width,imgdata:O.imgdata},delete O.left,delete O.width,delete O.imgdata;var R=p.cloneNode(!0);R.setAttribute("id",p.id+"-"+O.page);var M=m.getPageView(O.page-1),W=M.viewport,L=M.annotationLayer,N=W.scale,F=M.width/N;R.style.width=O.sealdata[0].width+"px",R.style.height=O.height+"px",O.sealdata[0].left=F-O.sealdata[0].width,(0,d.setSectionStyle)(R,N,O.sealdata[0].left,O.top),R.querySelector("img").src=O.sealdata[0].imgdata,O.section=R,Object.defineProperty(O,"section",{enumerable:!1}),L&&(L.div||(L.div=document.createElement("div"),L.div.className="annotationLayer",M.div.appendChild(L.div)),L.div.appendChild(R))}p.parentNode.removeChild(p)}!0===window.KGPdfViewerWebApp.useCaptcha?(this.app.KGCaptcha.okCallback=function(e){t.addStamp({sealdata:[g],capability:E,captcha:e})},this.app.KGCaptcha.cancelCallback=function(){t.isStamp=!0,t.cancelStamp()},this.app.KGCaptcha.open(g.phone)):this.addStamp({sealdata:[g],capability:E})}E.promise.then(this.renderSignatureSeals)}}}},renderSignatureSeals:function(e){var t=this,n=e.status,r=e.message,i=e.successPassBackParameter,a=this.app.pdfViewer;if(this.app.KG_ScanStamp&&this.app.KG_ScanStamp.clearSealData(),n){if(window.KGPdfViewerWebApp.multipleStamp){var o=this.tempSeals.concat();if("OFD"===self.fileType&&window.KGPdfViewerWebApp.multipleStamp&&"1"===window.KGPdfViewerWebApp.sealOrigin.toString()&&(o=o.filter(function(e){return e.ofdStampSuccess})),!o||!o.length)return;if("OFD"===window.KGPdfViewerWebApp.fileType||2==window.KGPdfViewerWebApp.stampType)(0,f.sortClass)(o,["sealData","esid"]).forEach(function(e){var n=void 0;e.forEach(function(e,r){if(0===r&&(n=e.section.getAttribute("data-annotation-id")),e.sealData.isStampOfQfz){var i=e.section.getAttribute("data-annotation-id");t.app.appConfig.viewerContainer.querySelectorAll('section[data-annotation-id="'+i+'"]').forEach(function(e){e.setAttribute("data-annotation-id",n)})}else e.section.setAttribute("data-annotation-id",n)})});var s=o[0].section.getAttribute("data-annotation-id");o.forEach(function(e,n){e.section.removeAttribute("class");var r=function(e){e.removeAttribute("class");var t=e.querySelector(".deleteTempStampSection");t&&e.removeChild(t);var n=e.querySelector(".scaleTempStampSection");n&&e.removeChild(n)};if(r(e.section),e.sealData.isContinuityStampCheck)for(var i=e.sealData.page.split("-"),o=parseInt(i[0]),l=parseInt(i[1]),c=e.sealData._tempStampkey,u=o;u<=l;u++){for(var d=a.getPageView(u-1),h=d.pdfPage.tempStamps,p=null,f=Object.keys(h),m=0;m<=f.length;m++){var g=f[m];if(-1!=g.indexOf(c)){p=h[g].cloneNode(!0);break}}if(!p)return;r(p),p.id=n+"-"+s+"-"+u;var v=e.section.getAttribute("data-annotation-id");if(p.setAttribute("data-annotation-id",v),1===window.KGPdfViewerWebApp.stampType)0==window.KGPdfViewerWebApp.getSelectSealPrompt().sigWithDifferentCert&&p.setAttribute("data-annotation-id",s);t.updatePageView(d,p)}else if(e.sealData.isStampOfQfz)for(var y=0;y<e.sealData.qfzSeal.length;y++){var b=e.sealData.qfzSeal[y],w=e.section.id+"-"+b.page,S=a.getPageView(b.page-1),_=S.pdfPage.tempStamps[w];_.removeAttribute("class");var P=_.querySelector(".deleteTempStampSection");P&&_.removeChild(P);var A=_.querySelector(".scaleTempStampSection");A&&_.removeChild(A),_.id=n+"-"+s+"-"+y+"-"+b.page,t.updatePageView(S,_)}else{var k=a.getPageView(Number(e.sealData.page)-1),C=e.section.cloneNode(!0);if(C.id=n+"-"+s,1===window.KGPdfViewerWebApp.stampType)0==window.KGPdfViewerWebApp.getSelectSealPrompt().sigWithDifferentCert&&C.setAttribute("data-annotation-id",s);t.updateUI(k,C);var x=k.annotationLayer;x&&(x.div||(x.div=document.createElement("div"),x.div.className="annotationLayer",k.div.appendChild(x.div)),x.div.appendChild(C))}}),this.clearTempSeals(!1)}else{section.className="";var l=section.getAttribute("data-annotation-id");if(self.isContinuityStampCheck){var c=self.continuityRange.split("-"),u=parseInt(c[0]),d=parseInt(c[1]),h=section.cloneNode(!0);section.parentNode.removeChild(section);for(var p=u;p<=d;p++){var m=h.cloneNode(!0);m.setAttribute("id",p+"-"+l);var v=a.getPageView(p-1),y=v.width/v.viewport.scale*xsacle,b=v.height/v.viewport.scale*ysacle;m.style.left=y+"px",m.style.top=b+"px",g.setProp("transformOrigin",m,-1*y+"px "+-1*b+"px"),self.updatePageView(v,m)}}else if(self.isStampOfQfz)for(var w=0;w<sealdata.qfzSeal.length;w++){var S=sealdata.qfzSeal[w],_=a.getPageView(S.page-1);S.section.removeAttribute("class"),S.section.id=S.page+"-"+l,this.updatePageView(_,S.section)}else{var P=a.getPageView(pageNumber-1);section.id=l,self.updateUI(P,section),window.KGPdfViewerWebApp.isUrlDoc&&(i||(i={}),i.section=section)}}var A=this.app.KG_SealPreLocation;A&&!A.hasStamp&&(A.hasStamp=!0,window.KGPdfViewerWebApp.multipleStamp=A.previewMultipleStampConfig),window.KGPdfViewerWebApp.stampSuccess&&(!window.KGPdfViewerWebApp.fjrs||window.KGPdfViewerWebApp.fjrs&&!window.KGPdfViewerWebApp.isServer)&&window.KGPdfViewerWebApp.stampSuccess(i)}else{this.removeStampNode(),window.hightMap.removeAll(),window.KGPdfViewerWebApp.multipleStamp&&(this.cancelStamp(),this.clearTempSeals(!0)),null!=window.KGPdfViewerWebApp.externalStampSeal&&window.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt.open(r||"调用外部接口加盖签章失败!")}},updatePageView:function(e,t){var n=t,r=e.pdfPage,i=e.annotationLayer;if(i)if(2!==e.renderingState){if(1===e.renderingState)return e.reRenderWait=!0,void(r.newStamps[n.id]=n);i.div||(i.div=document.createElement("div"),i.div.className="annotationLayer",e.div.appendChild(i.div)),i.div.appendChild(n),this.updateUI(e,n)}else r.newStamps[n.id]=n;else r.newStamps[n.id]=n},updateUI:function(e,t){var n=e.pdfPage,r=t.style.width,i=t.style.height,a=y(t.style.left),s=y(t.style.top),l=y(r),c=y(i),d=t.querySelector("img");d.style.display="none";var h=(0,u.createSealNode)(n,e,t,r,i);if(t.appendChild(h),n.newStamps[t.id]=t,void 0!==e.canvas){var p=e.viewport.scale*(e.canvas.width/e.canvas.offsetWidth),f=a*p,m=s*p,g=e.canvas.getContext("2d");g.globalCompositeOperation="multiply","multiply"!==g.globalCompositeOperation&&(g.globalAlpha=.85);var v=this;d.onload=function(){g.drawImage(d,f,m,l*p,c*p);var t=v.app.pdfThumbnailViewer.getThumbnail(n.pageIndex);t.renderingState=o.RenderingStates.INITIAL,t.setImage(e)},d.src=d.src}},stamp:function(e){var t=this;this.pdfStampSeal.getSealObjet(e).then(function(e){var n=e.isStampOfQfz,r=e.isContinuityStampCheck;if(n||r)return t.stampDefault(e);var i=t.stampPosition,a=i.page,o=i.pos,s=i.text;switch(i.mode){case"stamp":t.stampDefault(e);break;case"stampOfXY":t.stampOfXY(a,o.x,o.y,e.seal);break;case"stampOfText":t.stampOfText(a,s,e.seal)}})},SCSJTT_getFirstSealFromServer:function(e,t){this.pdfStampSeal.SCSJTT_getFirstSealFromServer(e,t)},movestamp:function(e,t){if(!t.stopMoveStamp){var n=void 0,r=this.app,i=r.KG_SealPreLocation,a=r.pdfViewer;if(e)n=b(e,this.sidebar);else if(i){var o=i.seal,s=o.page,l=o.left,c=o.top,u=o.width,d=o.height;n={node:a.getPageView(s-1).div,pageNumber:s,pageX:(l+u/2)*a.currentScale*96/72,pageY:(c+d/2)*a.currentScale*96/72}}if(n){var h=n,f=h.node,m=h.pageNumber,v=h.pageX,y=h.pageY;f.style.overflow="hidden";var w=t.app.pdfViewer.getPageView(m-1),S=w.annotationLayer;S.div||(S.div=document.createElement("div"),S.div.className="annotationLayer",f.appendChild(S.div));var _=w.viewport.scale;if(v>0&&y>0||i){var P=document.getElementById(f.id+"stamp"),A=v/_-t.seal.width/2,k=y/_-t.seal.height/2,C=(new Date).getTime();P?(P.setAttribute("data-annotation-id",C),P.style.transform="matrix("+_+", 0, 0, "+_+", 0, 0)",P.style.left=A+"px",P.style.top=k+"px",g.setProp("transform",P,"matrix("+_+", 0, 0, "+_+", 0, 0)"),g.setProp("transformOrigin",P,-1*A+"px "+-1*k+"px")):(this.removeStampNode(),(P=this._createSection(this.seal,f.id+"stamp",C,"stamp",A,k,_)).querySelector("img").addEventListener("mousedown",p.eventPreventDefault),S.div.appendChild(P))}else this.removeStampNode()}else this.removeStampNode()}},_createSection:function(e,t,n,r,i,a,o){var s=document.createElement("section");s.setAttribute("data-annotation-id",n),s.id=t,s.className=r,s.style.width=e.width+"px",s.style.height=e.height+"px";var l=document.createElement("img");return l.src=e.imgdata,l.style.width="100%",l.style.height="100%",l.style.opacity="0.8",s.appendChild(l),s.style.transform="matrix("+o+", 0, 0, "+o+", 0, 0)",s.style.left=i+"px",s.style.top=a+"px",g.setProp("transform",s,"matrix("+o+", 0, 0, "+o+", 0, 0)"),g.setProp("transformOrigin",s,-1*i+"px "+-1*a+"px"),s},cancelStamp:function(){this.stopMoveStamp=!1,this.stampSealType="default",this.isStamp&&(this.isStamp=!1,document.body.style.cursor="default",document.onmousemove=null,this.removeStampNode(),window.hightMap.removeAll())},clearTempSeals:function(){for(var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.app,n=t.pagesCount,r=t.pdfViewer,i=1;i<=n;i++){var a=r.getPageView(i-1),o=a.pdfPage.tempStamps,s=a.annotationLayer;for(var l in o)if(o.hasOwnProperty(l)){if(s&&s.div&&document.getElementById(o[l].id)){var c=!1;if(3===l.split("-").length)o[l].getAttribute("class")||(c=!0);(!c||c&&e)&&s.div.removeChild(o[l])}delete o[l]}}this.tempSeals=[]},removeStampNode:function(){var e=document.getElementsByClassName("stamp");0!==e.length&&e[0].parentNode.removeChild(e[0])},checkPageNum:function(e){var t=window.KGPdfViewerWebApp.getNumPages();if(e||(e="0-"+t),-1!==e.indexOf(","))return{pages:e,chunk_pages:e.split(",").map(function(e){var t=e.split("-"),n=a(t,2),r=n[0],i=n[1];return[r,void 0===i?r:i].map(Number)})};if(1==e.length){if(e>t)return{pages:e,begin:e,end:e};e=e+"-"+e}if(!/^\d+-\d+$/.test(e))return{error:"页码格式不正确!"};var n=e.split("-"),r=parseInt(n[0]),i=parseInt(n[1]);if(r>i){var o=r;r=i,i=o}return r<1&&(r=1),r>t&&(r=t),i>t&&(i=t),{pages:r+"-"+i,begin:r,end:i}},stampDefault:function(e){var t=this,n={capability:this.pdfStampSeal.createAddSealPromise()};for(var r in e)n[r]=e[r];l.KGPdfViewerWebApp.selectedSeal?l.KGPdfViewerWebApp.selectedSeal(e.seal).then(function(e){e&&t.getSealObjectCallback(n)}):this.getSealObjectCallback(n)},stampOfXY:function(e,t,n,r,o){var s=this,l=this.checkPageNum(e),u=l.begin,d=l.end,h=l.chunk_pages,p=l.pages,f=l.error;if(f)return this.app.KGAlertPrompt.open(f);var m=this;this.stopMoveStamp=!0,(r?Promise.resolve({seal:r}):this.pdfStampSeal.getSealObjet()).then(function(e){var r=e.seal,l=m.pdfStampSeal.createAddSealPromise(),f=null;Array.isArray(r)?f=r:((f=r).left=t,f.top=n,f.page=p,f.isStampOfXY=!0);var g=(0,c.createCapability)(),v={sealdata:Array.isArray(r)?f:[f],capability:g};l.resolve(v),g.promise.then(function(e){var s=this;if(e.status)if(o&&o(),Array.isArray(r))for(var l=function(e){var t=r[e],n=m.checkPageNum(t.page),i=n.begin,o=n.end,l=n.chunk_pages,c=(n.pages,n.error);if(c)return{v:s.app.KGAlertPrompt.open(c)};var u=(new Date).getTime(),d=m.app.pdfViewer.getPageView(0),h=d.viewport.scale,p=m._createSection(t,"",u,"",t.left,t.top,h),f=function(e,t){for(var n=window.KGPdfViewerWebApp.getNumPages(),r=e;r<=t;r++){if(r>n)return;d=m.app.pdfViewer.getPageView(r-1);var i=p.cloneNode(!0);i.id=(new Date).getTime()+"-"+b+1,m.updatePageView(d,i)}};l?l.map(function(e){var t=a(e,2),n=t[0],r=t[1];f(n,r)}):f(i,o)},c=0;c<r.length;c++){var p=l(c);if("object"===(void 0===p?"undefined":i(p)))return p.v}else{var f=(new Date).getTime(),g=m.app.pdfViewer.getPageView(0),v=g.viewport.scale,y=m._createSection(r,"",f,"",t,n,v),b=0,w=function(e,t){for(var n=window.KGPdfViewerWebApp.getNumPages(),r=e;r<=t;r++){if(r>n)return;g=m.app.pdfViewer.getPageView(r-1);var i=y.cloneNode(!0);i.id=(new Date).getTime()+"-"+b++,m.updatePageView(g,i)}};h?h.map(function(e){var t=a(e,2),n=t[0],r=t[1];w(n,r)}):w(u,d)}}).finally(function(){s.onDocumentContextmenu()})})},stampOfText:function(e,t,n,r){var i=this,a=this.checkPageNum(e),o=a.pages,s=a.error;if(s)return this.app.KGAlertPrompt.open(s);var l=this;this.stopMoveStamp=!0,(n?Promise.resolve({seal:n}):this.pdfStampSeal.getSealObjet()).then(function(e){var n=e.seal,a=l.pdfStampSeal.createAddSealPromise(),s=null;Array.isArray(n)?s=n:((s=n).page=o,s.isStampOfText=!0,s.text=t);var u=(0,c.createCapability)(),d={sealdata:Array.isArray(n)?s:[s],capability:u};a.resolve(d),u.promise.then(function(e){if(e.status)if(r&&r(),Array.isArray(n))for(var t=0;t<n.length;t++){var i=n[t],a=l.checkPageNum(i.page),o=(a.begin,a.end,a.chunk_pages,a.pages,a.error);if(o)return this.app.KGAlertPrompt.open(o);for(var c=(new Date).getTime(),u=e.textPositions,d=0;d<u.length;d++){var h=u[d],p=h.page,f=h.x-i.width/2+i.offsetX,m=h.y-i.height/2+i.offsetY,g=l.app.pdfViewer.getPageView(p-1),v=g.viewport.scale,y=(new Date).getTime()+"-"+d,b=l._createSection(i,y,c,"",f,m,v);l.updatePageView(g,b)}var w=e.successPassBackParameter;window.KGPdfViewerWebApp.stampSuccess&&window.KGPdfViewerWebApp.stampSuccess(w)}else{for(var S=(new Date).getTime(),_=e.textPositions,P=0;P<_.length;P++){var A=_[P],k=A.page,C=A.x-s.width/2,x=A.y-s.height/2,T=l.app.pdfViewer.getPageView(k-1),D=T.viewport.scale,E=(new Date).getTime()+"-"+P,I=l._createSection(s,E,S,"",C,x,D);l.updatePageView(T,I)}var O=e.successPassBackParameter;window.KGPdfViewerWebApp.stampSuccess&&window.KGPdfViewerWebApp.stampSuccess(O)}}).finally(function(){i.onDocumentContextmenu()})})},editDocSign:function(e){var t,n,r,i=(0,f.closest)(e.target,"section");if(i){var a=i.classList[0];if(-1==["lineAnnotation","circleAnnotation","squareAnnotation"].indexOf(a))return;var o=window.KGPdfViewerWebApp,s=o.PDFViewerApplication,l=o.globalAnnotation,c=o.deleteDocSignOnCanvas,u=(0,f.closest)(e.target,".page"),d=Number(u.dataset.pageNumber),h=s.pdfViewer.getPageView(d-1);if(this.selectSign==i)return;var p=i.getAttribute("data-author")||"";if((l.author||"")!=p)return s.KGAlertPrompt.open("您没有权限操作该批注!");var m=(t=Array.prototype.slice.call(document.getElementsByClassName("lineAnnotation")),n=Array.prototype.slice.call(document.getElementsByClassName("circleAnnotation")),r=Array.prototype.slice.call(document.getElementsByClassName("squareAnnotation")),t.concat(n).concat(r));m.map(function(e){e.style["pointer-events"]="none"}),i.style["pointer-events"]="all";var g=e.target;"svg:svg"!=g.tagName&&"svg"!=g.tagName||(g=g.firstChild);var v=h.viewport.scale,y=parseInt(i.style.top);d>1&&(y+=(u.offsetTop-12)/v),c(i,h),this.app.KG_DocSign.editDocSign({top:y,left:parseInt(i.style.left),editData:{scale:v,pageNumber:d,pdfPageView:h,shape:g.tagName,section:i.cloneNode(!0),element:g.cloneNode(!0),strokeWidth:parseInt(g.getAttribute("stroke-width"))}}),m.map(function(e){e.style["pointer-events"]="all"})}},initStampPosition:function(){this.stampPosition={mode:"stamp"};var e=window.KGPdfViewerWebApp,t=e.stampPosition,n=e.fileType;t&&"PDF"==n&&(this.stampPosition=Object.assign({},t),this.stampPosition.pos&&(this.stampPosition.mode="stampOfXY"),!this.stampPosition.pos&&this.stampPosition.text&&(this.stampPosition.mode="stampOfText"))}},e}();t.PDFStamp=w,t.CustomStyle=g,t.getPath=v,t.getNumbOfPx=y,t.convertScreenToViewportPoint=b},function(e,t,n){"use strict";e.exports="undefined"!=typeof window&&window.Math===Math?window:"undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:{}},function(e,t,n){"use strict";e.exports=!1},function(e,t,n){"use strict";e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){"use strict";var r=n(18);e.exports=function(e,t,n){for(var i in t)r(e,i,t[i],n);return e}},function(e,t,n){"use strict";e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){"use strict";var r={}.toString;e.exports=function(e){return r.call(e).slice(8,-1)}},function(e,t,n){"use strict";var r=n(17).f,i=n(11),a=n(4)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,a)&&r(e,a,{configurable:!0,value:t})}},function(e,t,n){"use strict";var r,i,a,o,s="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=function(e){return e.enc.Utf8},"object"===s(t)?e.exports=t=o(n(2)):(i=[n(2)],void 0===(a="function"==typeof(r=o)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){"use strict";var r=n(45),i=n(46);e.exports=function(e){return r(i(e))}},function(e,t,n){"use strict";var r=n(20),i=Math.max,a=Math.min;e.exports=function(e,t){return(e=r(e))<0?i(e+t,0):a(e,t)}},function(e,t,n){"use strict";var r=n(30),i=n(4)("toStringTag"),a="Arguments"==r(function(){return arguments}());e.exports=function(e){var t,n,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?n:a?r(t):"Object"==(o=r(t))&&"function"==typeof t.callee?"Arguments":o}},function(e,t,n){"use strict";var r=n(12),i=n(122),a=n(69),o=n(10),s=n(13),l=n(73),c={},u={},d=e.exports=function(e,t,n,d,h){var p,f,m,g,v=h?function(){return e}:l(e),y=r(n,d,t?2:1),b=0;if("function"!=typeof v)throw TypeError(e+" is not iterable!");if(a(v)){for(p=s(e.length);p>b;b++)if((g=t?y(o(f=e[b])[0],f[1]):y(e[b]))===c||g===u)return g}else for(m=v.call(e);!(f=m.next()).done;)if((g=i(m,y,f.value,t))===c||g===u)return g};d.BREAK=c,d.RETURN=u},function(e,t,n){"use strict";var r,i,a,o,s="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=function(e){var t,n,r,i,a,o,s;return n=(t=e).lib,r=n.Base,i=n.WordArray,a=t.algo,o=a.MD5,s=a.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:o,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n,r=this.cfg,a=r.hasher.create(),o=i.create(),s=o.words,l=r.keySize,c=r.iterations;s.length<l;){n&&a.update(n),n=a.update(e).finalize(t),a.reset();for(var u=1;u<c;u++)n=a.finalize(n),a.reset();o.concat(n)}return o.sigBytes=4*l,o}}),t.EvpKDF=function(e,t,n){return s.create(n).compute(e,t)},e.EvpKDF},"object"===s(t)?e.exports=t=o(n(2),n(90),n(91)):(i=[n(2),n(90),n(91)],void 0===(a="function"==typeof(r=o)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getOfdSealsByTG=t.WebKGVerify=t.getCertByScanStamp=t.pdfSM2RegionSign=t.deleteOfdSeal=t.ofdSign=t.getOfdSeals=t.getCert=t.getKeySN=t.KG_OFD=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},i=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}}(),a=n(40),o=n(5),s=u(n(15)),l=u(n(32)),c=n(59);function u(e){return e&&e.__esModule?e:{default:e}}var d=function(){function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.kg=new a.KG("ISIGNATURESERVER.iSignatureServerCtrl.1","2015DB05-ABB5-4924-A66FA88D7919C782");var n=(0,a.createCapability)();this.promise=n.promise;var r=window.KGPdfViewerWebApp.appCode;this.kg.init().then(function(){t.kg.invoke("SetParamByName","APPCODE",r).then(n.resolve)})}return i(e,[{key:"WebOpenKey",value:function(e){var t=this;return this.kg.invoke("WebOpenKey",e).then(function(e){return e&&"none"!==e&&"0"!==e.toString()?Promise.resolve(e):t.WebGetLastErrorMsg("开启密钥盘失败")})}},{key:"WebCloseKey",value:function(e){return this.kg.invoke("WebCloseKey",e)}},{key:"WebGetKeyCount",value:function(){var e=this;return this.kg.invoke("WebGetKeyCount","").then(function(t){return isNaN(Number(t))||1!==Number(t)?Number(t)>1?Promise.reject({message:"插入了太多的密钥盘"}):-1===Number(t)?e.WebGetLastErrorMsg("授权已过期"):Promise.reject({message:"没有插入密钥盘"}):Promise.resolve()})}},{key:"WebKeyIsNotAdmin",value:function(e){var t=this;return this.kg.invoke("WebKeyIsAdmin",e).then(function(e){return"false"===e||!1===e?Promise.resolve():t.WebGetLastErrorMsg("没有检测到用户密钥盘")})}},{key:"WebSign",value:function(e,t){var n=this;return this.kg.invoke("WebSign",e,t).then(function(e){return e?Promise.resolve(e):n.WebGetLastErrorMsg("数据签名失败")})}},{key:"WebVerifyPin",value:function(e,t){var n=this;return this.kg.invoke("WebVerifyPin",e,t).then(function(e){return e&&"0"===e?Promise.resolve():(window.KGPdfViewerWebApp.getPasswordPrompt().clearRememberedPwd(),n.WebGetLastErrorMsg("密钥盘密码错误"))})}},{key:"WebSetAlgoFlag",value:function(){var e=this,t=window.KGPdfViewerWebApp.algorithmType.key;if(null!=t){var n="sm2"===t.toLowerCase(),r="rsa"===t.toLowerCase(),i=n?0:r?1:null;return null!=i?this.kg.invoke("WebSetAlgoFlag",i).then(function(t){return t?Promise.resolve():e.WebGetLastErrorMsg("获取证书失败")}):Promise.resolve()}return Promise.resolve()}},{key:"WebGetSignCertByContainerName",value:function(e){var t=this,n=window.KGPdfViewerWebApp.adaptContainer;return this.kg.invoke("WebGetCertByContainerName",e,0,"").then(function(e){if(e.result){if(e.data=e.data.filter(function(e){return 2==e.certAlgo&&0==e.certExpiration}),0===e.data.length)return Promise.reject({message:"没有有效的证书"});for(var i=[],a=function(t){if(0!==(i=e.data.filter(function(e){return e.containername===n[t]})).length)return{v:Promise.resolve(i[0].cert)}},o=0;o<n.length;o++){var s=a(o);if("object"===(void 0===s?"undefined":r(s)))return s.v}return Promise.resolve(e.data[0].cert)}return t.WebGetLastErrorMsg()})}},{key:"WebGetFirstCert",value:function(e){var t=this;return this.kg.invoke("WebGetCertData",e,0).then(function(e){return e&&"none"!==e?Promise.resolve(e):t.WebGetLastErrorMsg("获取证书失败")})}},{key:"WebGetCertData",value:function(e){return 0!==window.KGPdfViewerWebApp.adaptContainer.length?this.WebGetSignCertByContainerName(e):this.WebGetFirstCert(e)}},{key:"WebGetSealCount",value:function(e){var t=this;return this.kg.invoke("WebGetSealCount",e).then(function(e){return!isNaN(Number(e))&&Number(e)>=1?Promise.resolve(Number(e)):t.WebGetLastErrorMsg("密钥盘中不存在印章")})}},{key:"WebGetSealCount_TG",value:function(e){return this.kg.invoke("WebGetSealCount",e).then(function(e){return!isNaN(Number(e))&&Number(e)>=1?Promise.resolve(Number(e)):Promise.reject({seals:[],status:!1})})}},{key:"WebGetSealData",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.kg.invoke("WebGetSealData",e,n).then(function(e){return e&&"none"!==e?Promise.resolve(e):t.WebGetLastErrorMsg("获取印章失败(印章索引:"+n+"")})}},{key:"WebGetKeySerialNumber",value:function(e){var t=this;return this.kg.invoke("WebGetKeySerialNumber",e).then(function(e){return e&&"none"!==e?Promise.resolve(e):t.WebGetLastErrorMsg("获取密钥盘序列号失败")})}},{key:"WebGetKeyUnit",value:function(e){var t=this;return this.kg.invoke("WebGetKeyUnit",e).then(function(e){return e&&"none"!==e?Promise.resolve(e):t.WebGetLastErrorMsg("获取用章单位失败")})}},{key:"WebGetLastErrorMsg",value:function(e){return this.kg.invoke("WebGetLastErrorMsg").then(function(t){return t&&"none"!==t?Promise.reject({message:t.value||t,defaultMsg:e}):Promise.reject({message:e,defaultMsg:e})})}},{key:"WebKGVerify",value:function(e,t,n){var r=this;return this.kg.invoke("WebKGVerify",e,t,n).then(function(e){var t="true"==e;return t?Promise.resolve(t):r.WebGetLastErrorMsg("程序异常")})}}]),e}();t.KG_OFD=d,t.getKeySN=function(){var e=new d;return e.promise.then(function(){return e.WebGetKeyCount()}).then(function(){return e.WebOpenKey(0)}).then(function(t){return e.WebGetKeySerialNumber(t)})},t.getCert=function(e,t,n,r){var i=new d,a=void 0;i.promise.then(function(){return i.WebGetKeyCount()}).then(function(){return i.WebOpenKey(0)}).then(function(e){return a=e,i.WebKeyIsNotAdmin(a)}).then(function(){return i.WebVerifyPin(a,e)}).then(function(){return i.WebSetAlgoFlag()}).then(function(){return i.WebGetCertData(a)}).then(function(e){return t(e)}).then(function(e){n&&n(e)}).catch(function(e){var t=e.message;return r(t),Promise.resolve()}).then(function(){if(null!=a)return i.WebCloseKey(a)})},t.getOfdSeals=function(e,t,n,r){var i=new d,a=void 0,o=void 0,s=void 0,l=void 0;i.promise.then(function(){return i.WebGetKeyCount()}).then(function(){return i.WebOpenKey(0)}).then(function(e){return a=e,i.WebKeyIsNotAdmin(e)}).then(function(){return i.WebVerifyPin(a,e)}).then(function(){return i.WebGetKeySerialNumber(a)}).then(function(e){return o=e,(0,c.verifyKeySn)(e)}).then(function(){return i.WebGetKeyUnit(a)}).then(function(e){return s=e,i.WebSetAlgoFlag()}).then(function(){return i.WebGetCertData(a)}).then(function(e){return l=e,i.WebGetSealCount(a)}).then(function(e){for(var t=[],n=0;n<e;n++)t.push(i.WebGetSealData(a,n));return Promise.all(t)}).then(function(e){if(!e||0===e.length)return i.WebGetLastErrorMsg("获取印章失败");var n={action:"handleCilentSeal",keySN:o,unitName:s,stampType:window.KGPdfViewerWebApp.stampType,seals:e};return window.KGPdfViewerWebApp.cilentSeals=e,t&&t(n)}).then(function(e){var t=e.data;n&&n(t,l,o)}).catch(function(e){return e&&r&&r({message:e.message,defaultMsg:e.defaultMsg}),Promise.resolve()}).then(function(){if(null!=a)return i.WebCloseKey(a)})},t.ofdSign=function(e,t,n,r,i,a){var o=new d,s=void 0,l=void 0;o.promise.then(function(){return o.WebGetKeyCount()}).then(function(){return o.WebOpenKey(0)}).then(function(e){return s=e,o.WebKeyIsNotAdmin(e)}).then(function(){return o.WebVerifyPin(s,e)}).then(function(){return 1==window.KGPdfViewerWebApp.sealOrigin?o.WebGetKeySerialNumber(s).then(function(e){return t!==e?Promise.reject({message:"密钥盘已更换"}):Promise.resolve()}):Promise.resolve()}).then(function(){return o.WebSetAlgoFlag()}).then(function(){return o.WebGetCertData(s)}).then(function(e){l=e;for(var t=[],r=0;r<n.length;r++)t.push(o.WebSign(s,n[r].toSignData));return Promise.all(t)}).then(function(e){for(var t=[],i=0;i<e.length;i++){var a={signedData:e[i],cert:l,sealType:n[i].sealType,toSignData:n[i].toSignData,signDirPath:n[i].signDirPath};t.push(r(a))}return Promise.all(t)}).catch(function(e){var t=e.message;return a&&a(t),Promise.resolve()}).then(function(){return null!=s?o.WebCloseKey(s):Promise.resolve()}).then(function(){i&&i()})},t.deleteOfdSeal=function(e,t,n){var r=new d,i=void 0,a=(0,o.randomString)();r.promise.then(function(){return r.WebGetKeyCount()}).then(function(){return r.WebOpenKey(0)}).then(function(e){return i=e,r.WebKeyIsNotAdmin(e)}).then(function(){return r.WebVerifyPin(i,e)}).then(function(){return r.WebGetKeySerialNumber(i)}).then(function(e){return(0,c.verifyKeySn)(e)}).then(function(){return r.WebSetAlgoFlag()}).then(function(){var e=s.default.stringify(l.default.parse(a));return r.WebSign(i,e)}).then(function(e){return t(a,e)}).catch(function(e){return e&&n&&n(e.message||e.defaultMsg||e),Promise.resolve()}).then(function(){if(null!=i)return r.WebCloseKey(i)})},t.pdfSM2RegionSign=function(e,t,n,r,i,a){var o=new d,s=void 0,l=void 0;o.promise.then(function(){return o.WebGetKeyCount()}).then(function(){return o.WebOpenKey(0)}).then(function(e){return s=e,o.WebKeyIsNotAdmin(e)}).then(function(){return o.WebVerifyPin(s,e)}).then(function(){return 1==window.KGPdfViewerWebApp.sealOrigin?o.WebGetKeySerialNumber(s).then(function(e){return t!==e?Promise.reject({message:"密钥盘已更换"}):Promise.resolve()}):Promise.resolve()}).then(function(){return o.WebSetAlgoFlag()}).then(function(){return o.WebGetCertData(s)}).then(function(e){l=e;for(var t=[],r=0;r<n.length;r++)t.push(o.WebSign(s,n[r].needSigMessage));return Promise.all(t)}).then(function(e){for(var t=[],i=0;i<n.length;i++){n[i].sigedData=e[i];var a={cert:l,signedData:[n[i]]};t.push(r(a))}return Promise.all(t)}).catch(function(e){var t=e.message;return a&&a(t),Promise.resolve()}).then(function(){return null!=s?o.WebCloseKey(s):Promise.resolve()}).then(function(){i&&i()})},t.getCertByScanStamp=function(e,t,n,r){var i=new d,a=void 0,o={token:t};i.promise.then(function(){return i.WebGetKeyCount()}).then(function(){return i.WebOpenKey(0)}).then(function(e){return a=e,i.WebKeyIsNotAdmin(a)}).then(function(){return i.WebVerifyPin(a,e)}).then(function(){return i.WebSetAlgoFlag()}).then(function(){return i.WebGetCertData(a)}).then(function(e){return o.cert=e,i.WebSign(a,t)}).then(function(e){o.signData=e,n(o)}).catch(function(e){var t=e.message;return r(t),Promise.resolve()}).then(function(){if(null!=a)return i.WebCloseKey(a)})},t.WebKGVerify=function(e,t,n,r,i){var a=new d,o=void 0;return a.promise.then(function(){return a.WebGetKeyCount()}).then(function(){return a.WebOpenKey(0)}).then(function(e){return o=e,a.WebKeyIsNotAdmin(e)}).then(function(){return a.WebVerifyPin(o,n)}).then(function(){return a.WebKGVerify(e,t,o)}).then(function(e){r&&r(e)}).catch(function(e){var t=e.message;return i&&i(t),Promise.resolve()}).then(function(){if(null!=o)return a.WebCloseKey(o)})},t.getOfdSealsByTG=function(e,t,n,r){var i=new d,a=void 0,o=void 0,s=void 0,l=void 0;i.promise.then(function(){return i.WebGetKeyCount()}).then(function(){return i.WebOpenKey(0)}).then(function(e){return a=e,i.WebKeyIsNotAdmin(e)}).then(function(){return i.WebVerifyPin(a,e)}).then(function(){return i.WebGetKeySerialNumber(a)}).then(function(e){return o=e,(0,c.verifyKeySn)(e)}).then(function(){return i.WebGetKeyUnit(a)}).then(function(e){return s=e,i.WebSetAlgoFlag()}).then(function(){return i.WebGetCertData(a)}).then(function(e){return l=e,i.WebGetSealCount_TG(a)}).then(function(e){for(var t=[],n=0;n<e;n++)t.push(i.WebGetSealData(a,n));return Promise.all(t)}).then(function(e){if(!e||0===e.length)return i.WebGetLastErrorMsg("获取印章失败");var n={action:"handleCilentSeal",keySN:o,unitName:s,stampType:window.KGPdfViewerWebApp.stampType,seals:e};return window.KGPdfViewerWebApp.cilentSeals=e,t&&t(n)}).then(function(e){var t=e.data;n&&n(t,l,o)}).catch(function(e){return e&&r&&r({message:e.message,defaultMsg:e.defaultMsg,status:e.status}),Promise.resolve()}).then(function(){if(null!=a)return i.WebCloseKey(a)})}},function(module,exports,__w_pdfjs_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},_timeout=6e4;window.kgAlert=function(e){window.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt.open(e)},window.kgAlert||(window.kgAlert=function(e){window.alert(e)});var createCapability=function(){var e={};return e.promise=new Promise(function(t,n){e.resolve=t,e.reject=n}),e};function createCORSRequest(e,t,n){var r=new XMLHttpRequest;return"withCredentials"in r?r.open(e,t,!0):"undefined"!=typeof XDomainRequest&&(r=new XDomainRequest).open(e,t),r}var defaultOptions={url:"",method:"post",data:"",async:!0,callback:function(e){},error:function(){}},xhr={init:function(e){e.method=e.method||defaultOptions.method,e.async=e.async||defaultOptions.async,e.callback=e.callback||defaultOptions.callback,e.data=e.data||defaultOptions.data},ajax:function(e){this.init(e);var t=new XMLHttpRequest;"withCredentials"in xhr?t.open(e.method,e.url,e.async):"undefined"!=typeof XDomainRequest?(t=new XDomainRequest).open(e.method,e.url,e.async):t.open(e.method,e.url,e.async),t.onload=function(e){},t.ontimeout=function(e){},t.onerror=function(e){},xhr.send(e.data)},post:function(){},get:function(e){this.init(e)}},KG=function(e,t){this.url="https:"===window.location.protocol?"https://local.kinggrid.com:9582":"http://127.0.0.1:9581",this.progid=e,this.inter=t,this.caller=0,this.time=_timeout};KG.prototype={init:function init(){var disableTips=arguments.length>0&&void 0!==arguments[0]&&arguments[0],self=this,capability=createCapability(),val=JSON.stringify({GetInterface:{progid:this.progid,interface:this.inter},usercode:window.KGPdfViewerWebApp.clientCode}),xhr=createCORSRequest("POST",this.url+"/GetInterface",this);return xhr.timeout=_timeout,window.KGPdfViewerWebApp.hasClientServer=!1,xhr.onload=function(e){if(window.KGPdfViewerWebApp.hasClientServer=!0,null==this.status||200===this.status||304===this.status||disableTips){var obj=eval("("+this.responseText+")");"0"===obj.value.toString()||"none"===obj.value&&!disableTips?window.kgAlert(self.progid+"控件初始化失败!"):(self.caller=obj.value,capability.resolve())}else window.kgAlert("签章客户端服务异常status = "+this.status)},xhr.ontimeout=function(){disableTips||(window.kgAlert("签章客户端服务请求超时!"),window.KGPdfViewerWebApp.getTipPrompt().close())},xhr.onerror=function(){disableTips||(window.kgAlert("签章客户端未安装或未启动!"),window.KGPdfViewerWebApp.getTipPrompt().close())},xhr.send("value="+val),capability.promise},invoke:function invoke(method){var capability=createCapability(),self=this,params=[];if(arguments.length>=2)for(var i=1;i<arguments.length;i++){var typeVal=_typeof(arguments[i]),value=null!=arguments[i]?arguments[i].toString():"null",data=null;data="boolean"===typeVal?{type:"BOOL",value:value}:"number"===typeVal?{type:"LONG",value:value}:{type:"BSTR",value:value},params.push(data)}var val=JSON.stringify({MethodCall:{caller:this.caller,function:method,params:params},usercode:window.KGPdfViewerWebApp.clientCode}),xhr=createCORSRequest("POST",this.url+"/MethodCall",this);return xhr.timeout=self.time,xhr.onload=function(e){if(self.time=_timeout,void 0==this.status||200==this.status||304==this.status){var obj=eval("("+this.responseText+")");capability.resolve(obj.value)}else window.kgAlert("签章客户端服务异常status = "+this.status)},xhr.ontimeout=function(e){self.time=_timeout,window.kgAlert("签章客户端服务请求超时!"),window.KGPdfViewerWebApp.getTipPrompt().close()},xhr.onerror=function(e){window.kgAlert("签章客户端未安装或未启动!"),window.KGPdfViewerWebApp.getTipPrompt().close()},xhr.send("value="+val),capability.promise},get:function get(property){var capability=createCapability(),self=this,val=JSON.stringify({PropertyCall:{caller:this.caller,property:property},usercode:window.KGPdfViewerWebApp.clientCode}),xhr=createCORSRequest("POST",this.url+"/PropCall",this);return xhr.timeout=self.time,xhr.onload=function(e){if(void 0==this.status||200==this.status||304==this.status){var obj=eval("("+this.responseText+")");capability.resolve(obj.value)}else window.kgAlert("签章客户端服务异常status = "+this.status)},xhr.ontimeout=function(e){window.kgAlert("签章客户端服务请求超时!")},xhr.onerror=function(e){window.kgAlert("签章客户端未安装或未启动!")},xhr.send("value="+val),capability.promise},put:function put(property,value){var self=this,typeVal=void 0===value?"undefined":_typeof(value),_value=void 0!=value?value.toString():"null",data=null;data="boolean"===typeVal?{type:"BOOL",value:_value}:"number"===typeVal?{type:"LONG",value:_value}:{type:"BSTR",value:_value};var val=JSON.stringify({PropertyCallPut:{caller:self.caller,property:property,params:[data]},usercode:window.KGPdfViewerWebApp.clientCode}),capability=createCapability(),xhr=createCORSRequest("POST",this.url+"/PropCall",this);return xhr.timeout=self.time,xhr.onload=function(e){if(200==this.status&&304==this.status){var obj=eval("("+this.responseText+")");capability.resolve(obj.value)}else window.kgAlert("签章客户端服务异常status="+this.status)},xhr.ontimeout=function(e){window.kgAlert("签章客户端服务请求超时!")},xhr.onerror=function(e){window.kgAlert("签章客户端未安装或未启动!")},xhr.send("value="+val),capability.promise},setUrl:function(e){this.url=e}},exports.createCapability=createCapability,exports.KG=KG},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cryptAPISig=t.cryptAPICtrl=t.iWebAssistError=t.iWebAssist=t.createCapability=void 0;var r=n(40),i=n(93),a=n(153);t.createCapability=r.createCapability,t.iWebAssist=i.iWebAssist,t.iWebAssistError=i.iWebAssistError,t.cryptAPICtrl=a.cryptAPICtrl,t.cryptAPISig=a.cryptAPISig},function(e,t,n){"use strict";var r=n(3),i=n(0).document,a=r(i)&&r(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,n){"use strict";var r=n(3);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){"use strict";var r=n(6),i=n(0),a=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(e.exports=function(e,t){return a[e]||(a[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:n(26)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(e,t,n){"use strict";var r=n(30);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){"use strict";e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){"use strict";var r=n(44)("keys"),i=n(19);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t,n){"use strict";e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){"use strict";var r=n(66),i=n(48);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t,n){"use strict";var r=n(12),i=n(45),a=n(21),o=n(13),s=n(106);e.exports=function(e,t){var n=1==e,l=2==e,c=3==e,u=4==e,d=6==e,h=5==e||d,p=t||s;return function(t,s,f){for(var m,g,v=a(t),y=i(v),b=r(s,f,3),w=o(y.length),S=0,_=n?p(t,w):l?p(t,0):void 0;w>S;S++)if((h||S in y)&&(g=b(m=y[S],S,v),e))if(n)_[S]=g;else if(g)switch(e){case 3:return!0;case 5:return m;case 6:return S;case 2:_.push(m)}else if(u)return!1;return d?-1:c||u?u:_}}},function(e,t,n){"use strict";var r=n(10),i=n(27),a=n(4)("species");e.exports=function(e,t){var n,o=r(e).constructor;return void 0===o||void 0==(n=r(o)[a])?t:i(n)}},function(e,t,n){"use strict";var r=n(4)("iterator"),i=!1;try{var a=[7][r]();a.return=function(){i=!0},Array.from(a,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var n=!1;try{var a=[7],o=a[r]();o.next=function(){return{done:n=!0}},a[r]=function(){return o},e(a)}catch(e){}return n}},function(e,t,n){"use strict";var r=n(27);e.exports.f=function(e){return new function(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=r(t),this.reject=r(n)}(e)}},function(e,t,n){"use strict";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},i=n(19)("meta"),a=n(3),o=n(11),s=n(17).f,l=0,c=Object.isExtensible||function(){return!0},u=!n(16)(function(){return c(Object.preventExtensions({}))}),d=function(e){s(e,i,{value:{i:"O"+ ++l,w:{}}})},h=e.exports={KEY:i,NEED:!1,fastKey:function(e,t){if(!a(e))return"symbol"==(void 0===e?"undefined":r(e))?e:("string"==typeof e?"S":"P")+e;if(!o(e,i)){if(!c(e))return"F";if(!t)return"E";d(e)}return e[i].i},getWeak:function(e,t){if(!o(e,i)){if(!c(e))return!0;if(!t)return!1;d(e)}return e[i].w},onFreeze:function(e){return u&&h.NEED&&c(e)&&!o(e,i)&&d(e),e}}},function(e,t,n){"use strict";var r=n(3);e.exports=function(e,t){if(!r(e)||e._t!==t)throw TypeError("Incompatible receiver, "+t+" required!");return e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deleteOneSeal=t.removeStampMenu=t.createSealNode=void 0;var r=n(23),i=n(58),a=n(39),o=n(24),s=n(41),l=n(59),c=n(5);var u=null;function d(e,t,n,r,d,m){var g=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],v=window.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt,y=(0,o.getNumbOfPx)(n.style.left),b=(0,o.getNumbOfPx)(n.style.top),w=(0,o.getNumbOfPx)(n.style.width),S=(0,o.getNumbOfPx)(n.style.height);function _(r){r.preventDefault(),r.stopPropagation();var s=t.pdfViewer.app,d=(e.pageIndex,t.viewport.scale),p=(0,o.convertScreenToViewportPoint)(r,s.pdfSidebar),m=p.pageX/d,g=p.pageY/d,y=window.KGPdfViewerWebApp.PDFViewerApplication,b=y.KG_FJRS,w=y.KG_ScanStamp,S=y.KG_UkeyStamp,_=y.KG_ScanStamp_V2;if(_)_.delete(function(){return f(t,s,e,n,m,g,"")});else if(!0===window.KGPdfViewerWebApp.useCaptcha)(0,l.getPhone)().then(function(r){s.KGCaptcha.okCallback=function(r){f(t,s,e,n,m,g,r)},s.KGCaptcha.open(r)});else if(b&&b.delKeySN&&"1"===b.bSignByCalibrary)b.deleteScanStamp(function(){f(t,s,e,n,m,g,"")});else if(!(w||S&&"1"==window.KGPdfViewerWebApp.stampModel)||window.KGPdfViewerWebApp.fjrs&&window.KGPdfViewerWebApp.fjrs.isScanStamp){var P=window.KGPdfViewerWebApp.getPasswordPrompt();P.setUpdateCallback(function(r){var o=window.KGPdfViewerWebApp,l=o.certOrigin,d=o.sealOrigin,p=o.fileType,y=o.isSM,b=o.stampModel,w=function(){f(t,s,e,n,m,g,r)};if(1==l&&"OFD"===p){var S=function(i,a){return f(t,s,e,n,m,g,r,i,a)},_=function(e){return(0,c.closeOverlay)().then(function(){return v.open(e)})};if(!0===window.KGPdfViewerWebApp.useNFSSystem)(0,i.deleteNFSSeal)(r,S,_);else new Promise(function(e){if(y){var t=void 0;(0,a.WebKGVerify)(u,"",r,function(e){t=e},_).then(function(){return e(t)})}else e(!0)}).then(function(e){return e&&(0,a.deleteOfdSeal)(r,S,_)})}else window.KGPdfViewerWebApp.fjrs&&window.KGPdfViewerWebApp.fjrs.isFjrs?"0"===window.KGPdfViewerWebApp._stampOrigin?f(t,s,e,n,m,g,r):h({password:r,deleteSealCallback:w}):1==l||1==d||"2"==b?h({password:r,deleteSealCallback:w}):f(t,s,e,n,m,g,r)}),P.open(!1,"delete")}else"1"==window.KGPdfViewerWebApp.stampModel?S.delete(function(){f(t,s,e,n,m,g,"")}):w.getQrCodeImage("delete",function(){f(t,s,e,n,m,g,"")})}var P=m.querySelector(".delSealNode");function A(r){if(r.preventDefault(),r.stopPropagation(),!window.KGPdfViewerWebApp.isUrlDoc){var i=window.KGPdfViewerWebApp.PDFViewerApplication,l=i.KG_SealPreLocation;if(!(i.KG_IWebAuth||l&&n.dataset.annotationId==l.annotId)){var u=t.pdfViewer.app,d=t.viewport.scale,h=(0,o.convertScreenToViewportPoint)(r,u.pdfSidebar),p=h.pageX,f=h.pageY,m=p/d,_=f/d;if(g){if(!(m>=y&&m<=y+w&&_>=b&&_<=b+S))return}else{var P=t.getPagePoint(p,f),A=P[0],k=P[1],C=t.viewport.viewBox;if(k=Math.abs(C[3]-C[1])-k,!(A>=y&&A<=y+w&&k>=b&&k<=b+S))return}var x=window.KGPdfViewerWebApp.getTipPrompt();switch(t.pdfViewer.app.l10n._lang){case"zh-TW":x.open("正在驗證印章...");break;case"en-US":x.open("Verifying seal...");break;default:x.open("正在验证印章...")}new Promise(function(t){null!=window.KGPdfViewerWebApp.externalVerifySeal?window.KGPdfViewerWebApp.externalVerifySeal(t,window.KGPdfViewerWebApp.documentId,e.pageIndex+1,m,_):window.KGPdfViewerWebApp.fjrs&&window.KGPdfViewerWebApp.fjrs.isFjrs?window.KGPdfViewerWebApp.hasClientServer?window.KGPdfViewerWebApp.verifySeal(e.pageIndex+1,m,_,t,"1"):window.KGPdfViewerWebApp.verifySeal(e.pageIndex+1,m,_,t,"2"):window.KGPdfViewerWebApp.verifySeal(e.pageIndex+1,m,_,t)}).then(function(t){if(t.status){var n=window.KGPdfViewerWebApp.PDFViewerApplication.KG_VerifySealPrompt,i=t.seal.cert;if(window.KGPdfViewerWebApp.fjrs&&window.KGPdfViewerWebApp.fjrs.isFjrs){if(window.KGPdfViewerWebApp.hasClientServer){var o=new s.iWebAssist({cilentType:"0"});return Promise.all([o.promise]).then(function(){return window.KGPdfViewerWebApp.PDFViewerApplication.KG_FJRS?i.bSignByCalibrary?o.setParamByName("FJRSISPHONE","1"):o.setParamByName("FJRSISPHONE","0"):Promise.resolve()}).then(function(){return o.verifySignMessage(i.newHash,i.sigData)}).then(function(r){r.result?(i.sigEffectiveness=!0,x.close().then(function(){return n.open(t)})):new Promise(function(t){window.KGPdfViewerWebApp.verifySeal(e.pageIndex+1,m,_,t,"2")}).then(function(e){i.sigEffectiveness=e.seal&&e.seal.cert&&e.seal.cert.sigEffectiveness,x.close().then(function(){return n.open(e)})})})}return i.sigEffectiveness=t.seal&&t.seal.cert&&t.seal.cert.sigEffectiveness,void x.close().then(function(){return n.open(t)})}if(!("OFD"!==window.KGPdfViewerWebApp.fileType||t.seal.effectiveness&&t.seal.cert.sigEffectiveness||null!=window.KGPdfViewerWebApp.externalVerifySeal)){var l=void 0;switch(r.target.nodeName.toUpperCase()){case"DIV":l=r.target;break;case"SVG":l=r.target.parentNode;break;case"SECTION":l=r.target.firstChild}if(l&&!window.KGPdfViewerWebApp.stampMask){var u="width:"+(w-2)+"px;height:"+(S-2)+"px";l.innerHTML='<svg viewBox="0 0 10 10" style="opacity:0.9;'+u+'" wmode="transparent" xmlns="http://www.w3.org/2000/svg" version="1.1" stroke="#FF0000"><line x1="2" y1="2" x2="8" y2="8"/><line x1="2" y1="8" x2="8" y2="2"/></svg>'}}if(i&&i.newHash&&null==window.KGPdfViewerWebApp.externalVerifySeal){var d=new s.iWebAssist({cilentType:"0"});return Promise.all([d.promise]).then(function(){return window.KGPdfViewerWebApp.PDFViewerApplication.KG_FJRS?i.bSignByCalibrary?d.setParamByName("FJRSISPHONE","1"):d.setParamByName("FJRSISPHONE","0"):Promise.resolve()}).then(function(){return d.verifySignMessage(i.newHash,i.sigData)}).then(function(e){if(e.result)i.sigEffectiveness=!0;else{if("-8"!=e.errcode)return"-1"==e.errcode?void v.open("未安装签名组件"):void v.open(e.errmsg||"签名验证失败errcode="+e.errcode);i.sigEffectiveness=!1}x.close().then(function(){return n.open(t)})})}var h=!0;new Promise(function(e){var n=window.KGPdfViewerWebApp,r=n.isSM,i=n.fileType;if(r&&"OFD"==i){var o=function(e){return(0,c.closeOverlay)().then(function(){h=!1,v.open(e)})},s=function(e){t.seal.effectiveness=e,t.seal.cert.sigEffectiveness=e,l.remember()},l=window.KGPdfViewerWebApp.getPasswordPrompt();l.open(),l.setUpdateCallback(function(n){var r=t.seal.sm,i=r.dataHashBase64,l=r.sesSignatureBase64;(0,a.WebKGVerify)(l,i,n,s,o).then(function(){e(t)})})}else e(t)}).then(function(e){h&&x.close().then(function(){return n.open(e)})})}else x.close().then(function(){return v.open(t.message)})})}}}function k(r){if(r.preventDefault(),r.stopPropagation(),!window.KGPdfViewerWebApp.isUrlDoc){var i=window.KGPdfViewerWebApp.PDFViewerApplication,a=i.KG_SealPreLocation;if(!(i.KG_IWebAuth||a&&n.dataset.annotationId==a.annotId)){var s=document.getElementById("rightMenu");s&&s.parentNode.removeChild(s);var l=t.pdfViewer.app,c=t.viewport.scale,d=(0,o.convertScreenToViewportPoint)(r,l.pdfSidebar),h=d.pageX,f=d.pageY,m=h/c,v=f/c;if(g){if(!(m>=y&&m<=y+w&&v>=b&&v<=b+S))return}else{var P=t.getPagePoint(h,f),k=P[0],C=P[1],x=t.viewport.viewBox;if(C=Math.abs(x[3]-x[1])-C,!(k>=y&&k<=y+w&&C>=b&&C<=b+S))return}var T=l.KG_FJRS;T&&(T.delKeySN=null),window.KGPdfViewerWebApp.checkLastone(e.pageIndex+1,m,v).then(function(e){if(e){var n=document.createElement("div");n.id="rightMenu",n.style.position="absolute",n.style["background-color"]="white",n.style.border="1px solid #999",n.style.zIndex="200",t.viewport.width<parseFloat(h)+94&&(h-=94),t.viewport.height<parseFloat(f)+70&&(f-=70),n.style.top=f+"px",n.style.left=h+"px";var i='<span class="menuVerifySeal" data-l10n-id="menuVerifySeal">签章验证</span>';e.status&&2!=window.KGPdfViewerWebApp.stampSystemOrigin?(n.innerHTML=i+'<span class="menuDeleteSeal" data-l10n-id="menuDeleteSeal">删除签章</span>',window.KGPdfViewerWebApp._stampOrigin=e.stampOrigin,T&&e.keySN&&(T.delKeySN=e.keySN,T.bSignByCalibrary=e.bSignByCalibrary),window.KGPdfViewerWebApp.scanStamp&&(l.KG_ScanStamp.esid=e.esid,l.KG_ScanStamp.sealType=e.sealType),window.KGPdfViewerWebApp.isUkey&&(l.KG_UkeyStamp.esid=e.esid),e.stampModel?window.KGPdfViewerWebApp.stampModel=e.stampModel:window.KGPdfViewerWebApp.stampModel=null,u=window.KGPdfViewerWebApp.isSM?e.sesSignatureBase64:null):n.innerHTML=i,t.div.appendChild(n),t.pdfViewer.app.l10n.translate(n);var a=n.querySelector(".menuVerifySeal"),o=n.querySelector(".menuDeleteSeal");a.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),A(r),p()}),a.oncontextmenu=null,o&&o.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),_(r),p()})}})}}}if(n.onmouseout=function(e){P&&(P.style.display="none"),m.style.border="1px dashed transparent"},n.onmouseover=function(e){m.style.border="1px dashed black",P&&(P.style.display="block")},"0"===window.KGPdfViewerWebApp.mobile.toString()){if(n.addEventListener("click",A),P&&P.addEventListener("click",_),window.KGPdfViewerWebApp.readOnly)return;n.oncontextmenu=k}else n.addEventListener("touchstart",function(e){e.preventDefault(),e.stopPropagation(),window.touchstartEvent=e,window.KGPdfViewerWebApp.readOnly||(window.kgTimer=setTimeout(function(){window.kgTimer=0,k(e)},500))}),n.addEventListener("touchend",function(e){if(e.preventDefault(),e.stopPropagation(),0!=window.kgTimer)return clearTimeout(window.kgTimer),A(window.touchstartEvent),!1})}function h(e){var t=e.password,n=e.deleteSealCallback,r=window.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt,i=new s.iWebAssist({cilentType:"0"});Promise.all([i.promise]).then(function(){return i.getKeyOtherInfo()}).then(function(e){if(!e.result){var a=s.iWebAssistError.getKeyOtherInfo,o=e.errmsg||a[e.errcode]||"未知异常";return window.KGPdfViewerWebApp.getTipPrompt().close(),void r.open(o)}var l=e.Res,c=l.substring(1,l.length-1);i.verifyPin(t,c).then(function(e){if(e.result)window.KGPdfViewerWebApp.fjrs&&window.KGPdfViewerWebApp.fjrs.isFjrs?window.KGPdfViewerWebApp.PDFViewerApplication.KG_FJRS.delKeySN=c:window.KGPdfViewerWebApp.userId=c,n&&n();else{var t={"-1":"未安装签名组件","-2":"待验证pin的key和当前插入的key不匹配",1:"没有检测到用户key",2:"非法为授权的key",3:"没有找到key驱动文件",4:"插入太多的key",7:"密码错误",8:"非法授权key",9:"网络连接失败"}[e.errcode]||e.errmsg||"未知异常";r.open(t)}})})}function p(){var e=document.getElementById("rightMenu");e&&e.parentNode.removeChild(e)}function f(e,t,n,i,a,o,s,l,u){var d=n.pageIndex;window.KGPdfViewerWebApp.deleteSeal(d+1,a,o,s,l,u).then(function(a){return(0,c.closeOverlay)().then(function(){if(a.data.status){if(window.KGPdfViewerWebApp.deleteSealSuccess&&window.KGPdfViewerWebApp.deleteSealSuccess(),!1===window.KGPdfViewerWebApp.useCaptcha)window.KGPdfViewerWebApp.getPasswordPrompt().remember("delete");if("OFD"===window.KGPdfViewerWebApp.fileType)!function(e,t){function n(t){t.renderingState!==r.RenderingStates.RUNNING&&t.renderingState!==r.RenderingStates.PAUSED?(t.deleteStampCallback=function(){var n=t.div.querySelector(".canvasWrapper");n&&t.div.removeChild(n);var i=e.pdfThumbnailViewer.getThumbnail(t.pdfPage.pageIndex);i.renderingState=r.RenderingStates.INITIAL,i.setImage(t)},t.renderingState=r.RenderingStates.INITIAL,t.renderingQueue.renderView(t)):t.reRenderWait=!0}var i=e.pdfViewer,a=e.pagesCount,o=t.getAttribute("data-annotation-id"),s=t.getAttribute("data-goldGridSeal-id");if(s)for(var l=0;l<a;l++){var c=i.getPageView(l),u=c.pdfPage,d=c.annotationLayer;if(null==u.delOFDSeal&&(u.delOFDSeal={}),u.reloadOperatorList=!0,null!=d&&d.div){var h=d.div.querySelectorAll("section[data-goldGridSeal-id]");if(h.length)for(var p=0;p<h.length;p++){var f=h[p];f.getAttribute("data-goldGridSeal-id")===s&&(u.delOFDSeal[s]=!0,d.div.removeChild(f),n(c))}}else u.delOFDSeal[s]=!0}else for(var m=0;m<a;m++){var g=i.getPageView(m),v=g.pdfPage,y=v.newStamps,b=g.annotationLayer;for(var w in y)if(y.hasOwnProperty(w)){var S=y[w],_=S.getAttribute("data-annotation-id");_===o&&(delete y[w],null!=b&&b.div&&(b.div.removeChild(S),n(g)))}}}(t,i);else{var o=a.data.delSeals;if(o){var s=e.pdfViewer,l=i.getAttribute("data-annotation-id");i.id?g(o,s,l):g(o,s)}else m(e,t,n,i)}}else{var c=window.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt;"密码错误"===a.data.message&&window.KGPdfViewerWebApp.getPasswordPrompt().clearRememberedPwd(),c.open(a.data.message)}})})}function m(e,t,n,r,i){var a=!0;if(void 0!=i&&(a=i),n.newStamps[r.id])delete n.newStamps[r.id];else{n.delAnnotions||(n.delAnnotions={});var o=r.getAttribute("data-annotation-id");n.delAnnotions[o]=!0,n.reloadOperatorList=!0}var s=e.div;s.querySelector(".annotationLayer").removeChild(r),a&&(2!=e.renderingState?1!=e.renderingState?(e.deleteStampCallback=function(){var r=s.querySelector(".canvasWrapper"),i=s.querySelector(".textLayer");r&&s.removeChild(r),i&&s.removeChild(i);var a=t.pdfThumbnailViewer.getThumbnail(n.pageIndex);a.renderingState=0,a.setImage(e)},e.renderingState=0,e.renderingQueue.renderView(e)):e.reRenderWait=!0:n.reloadOperatorList&&(e.reRenderWait=!0))}function g(e,t,n){var r=t.app;if(n)for(var i in e){var a=i,o=t.getPageView(a),s=o.pdfPage,l=o.div.querySelector(".annotationLayer");if(l&&0!=l.children.length){for(var c=[],u=l.children,d=0;d<u.length;d++){var h=u[d];h.getAttribute("data-annotation-id")==n&&c.push(h)}for(var p=0;p<c.length;p++){var f=c[p];p+1==c.length?m(o,r,o.pdfPage,f):m(o,r,o.pdfPage,f,!1)}}else{var g=s.newStamps;for(var v in g){g[v].getAttribute("data-annotation-id")==n&&delete g[v]}}}else for(var i in e){var y=i,b=e[i],w=t.getPageView(y),S=w.pdfPage,_=w.div.querySelector(".annotationLayer");if(_)for(var P=0;P<b.length;P++)for(var A=_.children,k=0;k<A.length;k++){var C=A[k],x=C.getAttribute("data-annotation-id");b[P]==x&&(P+1==b.length?m(w,r,w.pdfPage,C):m(w,r,w.pdfPage,C,!1))}else{S.delAnnotions||(S.delAnnotions={});for(var T=0;T<b.length;T++){var D=b[T];S.delAnnotions[D]=!0}S.reloadOperatorList=!0;var E=r.pdfThumbnailViewer.getThumbnail(S.pageIndex);E.renderingState=0,E.setImage(w)}}}t.createSealNode=function(e,t,n,r,i,a){n.style["border-width"]="0";var s=document.createElement("div"),l=(0,o.getNumbOfPx)(r)-2,c=(0,o.getNumbOfPx)(i)-2;s.style.width=l+"px",s.style.height=c+"px",s.style.border="1px dashed transparent",s.style.cursor="pointer";var u="width:"+l+"px;height:"+c+"px";if(a){var h=a.data.id,p=null,f=new Promise(function(e){p=e}),m=window.KGPdfViewerWebApp.PDFViewerApplication.KG_IWebAuth;"PDF"!==window.KGPdfViewerWebApp.fileType||m?p({status:!0,effectiveness:!0}):null!=window.KGPdfViewerWebApp.externalVerifyOnLoad?window.KGPdfViewerWebApp.externalVerifyOnLoad(p,window.KGPdfViewerWebApp.documentId,e.pageIndex+1,h):window.KGPdfViewerWebApp.verifySealOnLoad(e.pageIndex+1,h,p),f.then(function(a){if(a.status){var o=null;o=a.effectiveness||window.KGPdfViewerWebApp.stampMask?'<svg viewBox="0 0 1 1" style="opacity:0.0;background-color:white;'+u+'" wmode="transparent" xmlns="http://www.w3.org/2000/svg" version="1.1"></svg>':'<svg viewBox="0 0 10 10" style="opacity:0.9;'+u+'" wmode="transparent" xmlns="http://www.w3.org/2000/svg" version="1.1" stroke="#FF0000"><line x1="2" y1="2" x2="8" y2="8"/><line x1="2" y1="8" x2="8" y2="2"/></svg>',"1"===window.KGPdfViewerWebApp.mobile.toString()?s.innerHTML=o:s.innerHTML=o+"",d(e,t,n,r,i,s,!1)}else console.log("seal is not exist id = "+h)})}else{var g='<svg viewBox="0 0 1 1" style="opacity:0.0;background-color:white;'+u+'" wmode="transparent" xmlns="http://www.w3.org/2000/svg" version="1.1"></svg>';"1"===window.KGPdfViewerWebApp.mobile.toString()?s.innerHTML=g:s.innerHTML=g+"",d(e,t,n,r,i,s)}return s},t.removeStampMenu=p,t.deleteOneSeal=m},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.axios=t.myaxios=void 0;var r=n(5),i=n(151),a=i.axios.create({withCredentials:!0,headers:{"X-Requested-With":"XMLHttpRequest","Content-Type":"application/json"}}),o={post:function(e,t){var n={};return n.promise=new Promise(function(e,t){n.resolve=e,n.reject=t}),a.post(e,(0,r.transformData)(t)).then(function(e){n.resolve(e)}).catch(function(e){(0,r.closeOverlay)().then(function(){var t=window.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt;null!=e.response?t.open("请求异常,状态码:"+e.response.status):t.open("网络连接异常:"+e.message)}),n.reject()}),n.promise}};t.myaxios=o,t.axios=i.axios},function(e,t,n){"use strict";function r(e){return new Promise(function(t,n){var r=document.getElementById("SMObj"),i=r.WebGetKeyCount();if(isNaN(Number(i))||1!==Number(i))Number(i)>1?n({message:"插入了太多的密钥盘"}):-1===Number(i)?n({message:o(r,"授权已过期")}):n({message:o(r,"没有插入密钥盘")});else{var a=r.WebOpenKey(0);if(a&&"none"!==a&&"0"!==a.toString()){var s=r.WebKeyIsAdmin(a);if("false"===s||!1===s){var l=r.WebVerifyPin(a,e);if(l&&"-1"!==l.toString())t({SMObj:r,keyHandle:a});else window.KGPdfViewerWebApp.getPasswordPrompt().clearRememberedPwd(),n({message:o(r,"密钥盘密码错误,请输入正确的密码"),defaultMsg:"密钥盘密码错误"})}else n({message:"没有检测到用户密钥盘"})}else n({message:o(r,"开启密钥盘失败")})}})}function i(e,t){e.WebCloseKey(t)}function a(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return new Promise(function(r,i){var a=e.WebGetSealData(t,n);a&&"none"!==a?r(a):i({message:o(e,"获取印章失败(印章索引:"+n+"")})})}function o(e,t){var n=e.WebGetLastErrorMsg();return n&&"none"!==n?n:t}function s(e,t,n){return new Promise(function(r,i){var a=e.WebSign(t,n);a&&"-1"!==a.toString()?r(a):i({message:o(e,"数据签名失败")})})}Object.defineProperty(t,"__esModule",{value:!0}),t.closeNFSKey=i,t.getNFSSeals=function(e,t,n,s){var l=void 0,c=void 0,u=void 0,d=void 0,h=void 0;return r(e).then(function(e){var t=e.SMObj,n=e.keyHandle;return d=t,h=n,new Promise(function(e,t){var n=d.WebGetSealCount(h);!isNaN(Number(n))&&Number(n)>=1?e(n):t({message:o(d,"密钥盘中不存在印章")})})}).then(function(e){for(var t=[],n=0;n<e;n++)t.push(a(d,h,n));return Promise.all(t)}).then(function(e){if(!e||0===e.length)return Promise.reject({message:o(d,"获取印章失败")});l=d.WebGetKeySerialNumber(h),c=d.WebGetCertData(h),u=d.WebGetKeyUnit(h);var n={action:"handleCilentSeal",keySN:l,unitName:u,seals:e};return t&&t(n)}).then(function(e){var t=e.data;n&&n(t,c,l)}).catch(function(e){var t=e.message,n=e.defaultMsg;return s&&s({message:t,defaultMsg:n}),Promise.resolve()}).then(function(){return null!=h&&i(d,h),Promise.resolve()})},t.NFSSign=function(e,t,n,a,o,l){var c=void 0,u=void 0,d=void 0;return r(e).then(function(e){var r=e.SMObj,i=e.keyHandle;u=i;var a=(c=r).WebGetKeySerialNumber(u);if(t!==a)return Promise.reject({message:"密钥盘已更换"});d=c.WebGetCertData(u);for(var o=[],l=0;l<n.length;l++)o.push(s(c,u,n[l].toSignData));return Promise.all(o)}).then(function(e){for(var t=[],r=0;r<e.length;r++){var i={signedData:e[r],cert:d,sealType:n[r].sealType,toSignData:n[r].toSignData,signDirPath:n[r].signDirPath};t.push(a(i))}return Promise.all(t)}).then(function(){o&&o()}).catch(function(e){var t=e.message;return l&&l(t),Promise.resolve()}).then(function(){null!=u&&i(c,u)})},t.deleteNFSSeal=function(e,t,n){var a=void 0,o=void 0;return r(e).then(function(e){var t=e.SMObj,n=e.keyHandle;a=t,o=n}).then(function(){return t&&t()}).catch(function(e){var t=e.message;return n&&n(t),Promise.resolve()}).then(function(){null!=o&&i(a,o)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPhone=t.verifyKeySn=t.sendCaptcha=t.getFontList=void 0;var r=n(57),i=n(5),a=[{en:"Network Error",zh:"网络错误"}];function o(e){window.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt.open(e)}var s=r.axios.create({headers:{"X-Requested-With":"XMLHttpRequest","Content-Type":"application/json"}});s.interceptors.response.use(function(e){return e.data&&!1===e.data.status?((0,i.closeOverlay)().then(function(){o(e.data.message||"程序异常,请联系管理员!")}),Promise.reject()):e.data},function(e){if(e.message){var t=a.filter(function(t){return e.message.indexOf(t.en)>-1})[0];o(t?t.zh:e.message)}else o("程序异常,请联系管理员!");return Promise.reject(e)}),t.getFontList=function(){return s.post(window.KGPdfViewerWebApp.getDocTypeUrl(),(0,i.transformData)({action:"getFonts",documentId:window.KGPdfViewerWebApp.documentId,docType:window.KGPdfViewerWebApp.docType}))},t.sendCaptcha=function(){return s.post(window.KGPdfViewerWebApp.getDocTypeUrl(),(0,i.transformData)({action:"sendCaptcha",keySN:window.KGPdfViewerWebApp.userId}))},t.verifyKeySn=function(e){var t=window.KGPdfViewerWebApp,n=t.userCode,r=t.isCa3,a=t.mobile,o=t.fileType;return n&&r&&"OFD"===o.toUpperCase()&&0==a?s.post(window.KGPdfViewerWebApp.getDocTypeUrl(),(0,i.transformData)({action:"verifyKeySn",keySN:e,userCode:n})):Promise.resolve()},t.getPhone=function(){return s.post(window.KGPdfViewerWebApp.getDocTypeUrl(),(0,i.transformData)({action:"getPhone",keySN:window.KGPdfViewerWebApp.userId})).then(function(e){return e.phone})}},function(e,t,n){"use strict";(function(e){var r,i,a,o="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};a=function(){var t,r;function i(){return t.apply(null,arguments)}function a(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function s(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function l(e){return void 0===e}function c(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function u(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function d(e,t){var n,r=[];for(n=0;n<e.length;++n)r.push(t(e[n],n));return r}function h(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function p(e,t){for(var n in t)h(t,n)&&(e[n]=t[n]);return h(t,"toString")&&(e.toString=t.toString),h(t,"valueOf")&&(e.valueOf=t.valueOf),e}function f(e,t,n,r){return It(e,t,n,r,!0).utc()}function m(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function g(e){if(null==e._isValid){var t=m(e),n=r.call(t.parsedDateParts,function(e){return null!=e}),i=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(i=i&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return i;e._isValid=i}return e._isValid}function v(e){var t=f(NaN);return null!=e?p(m(t),e):m(t).userInvalidated=!0,t}r=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,r=0;r<n;r++)if(r in t&&e.call(this,t[r],r,t))return!0;return!1};var y=i.momentProperties=[];function b(e,t){var n,r,i;if(l(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),l(t._i)||(e._i=t._i),l(t._f)||(e._f=t._f),l(t._l)||(e._l=t._l),l(t._strict)||(e._strict=t._strict),l(t._tzm)||(e._tzm=t._tzm),l(t._isUTC)||(e._isUTC=t._isUTC),l(t._offset)||(e._offset=t._offset),l(t._pf)||(e._pf=m(t)),l(t._locale)||(e._locale=t._locale),y.length>0)for(n=0;n<y.length;n++)l(i=t[r=y[n]])||(e[r]=i);return e}var w=!1;function S(e){b(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===w&&(w=!0,i.updateOffset(this),w=!1)}function _(e){return e instanceof S||null!=e&&null!=e._isAMomentObject}function P(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function A(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=P(t)),n}function k(e,t,n){var r,i=Math.min(e.length,t.length),a=Math.abs(e.length-t.length),o=0;for(r=0;r<i;r++)(n&&e[r]!==t[r]||!n&&A(e[r])!==A(t[r]))&&o++;return o+a}function C(e){!1===i.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function x(e,t){var n=!0;return p(function(){if(null!=i.deprecationHandler&&i.deprecationHandler(null,e),n){for(var r,a=[],s=0;s<arguments.length;s++){if(r="","object"===o(arguments[s])){for(var l in r+="\n["+s+"] ",arguments[0])r+=l+": "+arguments[0][l]+", ";r=r.slice(0,-2)}else r=arguments[s];a.push(r)}C(e+"\nArguments: "+Array.prototype.slice.call(a).join("")+"\n"+(new Error).stack),n=!1}return t.apply(this,arguments)},t)}var T,D={};function E(e,t){null!=i.deprecationHandler&&i.deprecationHandler(e,t),D[e]||(C(t),D[e]=!0)}function I(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function O(e,t){var n,r=p({},e);for(n in t)h(t,n)&&(s(e[n])&&s(t[n])?(r[n]={},p(r[n],e[n]),p(r[n],t[n])):null!=t[n]?r[n]=t[n]:delete r[n]);for(n in e)h(e,n)&&!h(t,n)&&s(e[n])&&(r[n]=p({},r[n]));return r}function R(e){null!=e&&this.set(e)}i.suppressDeprecationWarnings=!1,i.deprecationHandler=null,T=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)h(e,t)&&n.push(t);return n};var M={};function W(e,t){var n=e.toLowerCase();M[n]=M[n+"s"]=M[t]=e}function L(e){return"string"==typeof e?M[e]||M[e.toLowerCase()]:void 0}function N(e){var t,n,r={};for(n in e)h(e,n)&&(t=L(n))&&(r[t]=e[n]);return r}var F={};function G(e,t){F[e]=t}function V(e,t,n){var r=""+Math.abs(e),i=t-r.length;return(e>=0?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}var K=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,j=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,B={},U={};function q(e,t,n,r){var i=r;"string"==typeof r&&(i=function(){return this[r]()}),e&&(U[e]=i),t&&(U[t[0]]=function(){return V(i.apply(this,arguments),t[1],t[2])}),n&&(U[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function z(e,t){return e.isValid()?(t=Y(t,e.localeData()),B[t]=B[t]||function(e){var t,n,r,i=e.match(K);for(t=0,n=i.length;t<n;t++)U[i[t]]?i[t]=U[i[t]]:i[t]=(r=i[t]).match(/\[[\s\S]/)?r.replace(/^\[|\]$/g,""):r.replace(/\\/g,"");return function(t){var r,a="";for(r=0;r<n;r++)a+=I(i[r])?i[r].call(t,e):i[r];return a}}(t),B[t](e)):e.localeData().invalidDate()}function Y(e,t){var n=5;function r(e){return t.longDateFormat(e)||e}for(j.lastIndex=0;n>=0&&j.test(e);)e=e.replace(j,r),j.lastIndex=0,n-=1;return e}var H=/\d/,X=/\d\d/,J=/\d{3}/,Q=/\d{4}/,Z=/[+-]?\d{6}/,$=/\d\d?/,ee=/\d\d\d\d?/,te=/\d\d\d\d\d\d?/,ne=/\d{1,3}/,re=/\d{1,4}/,ie=/[+-]?\d{1,6}/,ae=/\d+/,oe=/[+-]?\d+/,se=/Z|[+-]\d\d:?\d\d/gi,le=/Z|[+-]\d\d(?::?\d\d)?/gi,ce=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,ue={};function de(e,t,n){ue[e]=I(t)?t:function(e,r){return e&&n?n:t}}function he(e,t){return h(ue,e)?ue[e](t._strict,t._locale):new RegExp(pe(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,r,i){return t||n||r||i})))}function pe(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var fe={};function me(e,t){var n,r=t;for("string"==typeof e&&(e=[e]),c(t)&&(r=function(e,n){n[t]=A(e)}),n=0;n<e.length;n++)fe[e[n]]=r}function ge(e,t){me(e,function(e,n,r,i){r._w=r._w||{},t(e,r._w,r,i)})}function ve(e,t,n){null!=t&&h(fe,e)&&fe[e](t,n._a,n,e)}var ye=0,be=1,we=2,Se=3,_e=4,Pe=5,Ae=6,ke=7,Ce=8;function xe(e){return Te(e)?366:365}function Te(e){return e%4==0&&e%100!=0||e%400==0}q("Y",0,0,function(){var e=this.year();return e<=9999?""+e:"+"+e}),q(0,["YY",2],0,function(){return this.year()%100}),q(0,["YYYY",4],0,"year"),q(0,["YYYYY",5],0,"year"),q(0,["YYYYYY",6,!0],0,"year"),W("year","y"),G("year",1),de("Y",oe),de("YY",$,X),de("YYYY",re,Q),de("YYYYY",ie,Z),de("YYYYYY",ie,Z),me(["YYYYY","YYYYYY"],ye),me("YYYY",function(e,t){t[ye]=2===e.length?i.parseTwoDigitYear(e):A(e)}),me("YY",function(e,t){t[ye]=i.parseTwoDigitYear(e)}),me("Y",function(e,t){t[ye]=parseInt(e,10)}),i.parseTwoDigitYear=function(e){return A(e)+(A(e)>68?1900:2e3)};var De,Ee=Ie("FullYear",!0);function Ie(e,t){return function(n){return null!=n?(Re(this,e,n),i.updateOffset(this,t),this):Oe(this,e)}}function Oe(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function Re(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&Te(e.year())&&1===e.month()&&29===e.date()?e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),Me(n,e.month())):e._d["set"+(e._isUTC?"UTC":"")+t](n))}function Me(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,r=(t%(n=12)+n)%n;return e+=(t-r)/12,1===r?Te(e)?29:28:31-r%7%2}De=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},q("M",["MM",2],"Mo",function(){return this.month()+1}),q("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),q("MMMM",0,0,function(e){return this.localeData().months(this,e)}),W("month","M"),G("month",8),de("M",$),de("MM",$,X),de("MMM",function(e,t){return t.monthsShortRegex(e)}),de("MMMM",function(e,t){return t.monthsRegex(e)}),me(["M","MM"],function(e,t){t[be]=A(e)-1}),me(["MMM","MMMM"],function(e,t,n,r){var i=n._locale.monthsParse(e,r,n._strict);null!=i?t[be]=i:m(n).invalidMonth=e});var We=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Le="January_February_March_April_May_June_July_August_September_October_November_December".split("_");var Ne="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function Fe(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=A(t);else if(!c(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),Me(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function Ge(e){return null!=e?(Fe(this,e),i.updateOffset(this,!0),this):Oe(this,"Month")}var Ve=ce;var Ke=ce;function je(){function e(e,t){return t.length-e.length}var t,n,r=[],i=[],a=[];for(t=0;t<12;t++)n=f([2e3,t]),r.push(this.monthsShort(n,"")),i.push(this.months(n,"")),a.push(this.months(n,"")),a.push(this.monthsShort(n,""));for(r.sort(e),i.sort(e),a.sort(e),t=0;t<12;t++)r[t]=pe(r[t]),i[t]=pe(i[t]);for(t=0;t<24;t++)a[t]=pe(a[t]);this._monthsRegex=new RegExp("^("+a.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Be(e){var t;if(e<100&&e>=0){var n=Array.prototype.slice.call(arguments);n[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)}else t=new Date(Date.UTC.apply(null,arguments));return t}function Ue(e,t,n){var r=7+t-n;return-((7+Be(e,0,r).getUTCDay()-t)%7)+r-1}function qe(e,t,n,r,i){var a,o,s=1+7*(t-1)+(7+n-r)%7+Ue(e,r,i);return s<=0?o=xe(a=e-1)+s:s>xe(e)?(a=e+1,o=s-xe(e)):(a=e,o=s),{year:a,dayOfYear:o}}function ze(e,t,n){var r,i,a=Ue(e.year(),t,n),o=Math.floor((e.dayOfYear()-a-1)/7)+1;return o<1?r=o+Ye(i=e.year()-1,t,n):o>Ye(e.year(),t,n)?(r=o-Ye(e.year(),t,n),i=e.year()+1):(i=e.year(),r=o),{week:r,year:i}}function Ye(e,t,n){var r=Ue(e,t,n),i=Ue(e+1,t,n);return(xe(e)-r+i)/7}q("w",["ww",2],"wo","week"),q("W",["WW",2],"Wo","isoWeek"),W("week","w"),W("isoWeek","W"),G("week",5),G("isoWeek",5),de("w",$),de("ww",$,X),de("W",$),de("WW",$,X),ge(["w","ww","W","WW"],function(e,t,n,r){t[r.substr(0,1)]=A(e)});function He(e,t){return e.slice(t,7).concat(e.slice(0,t))}q("d",0,"do","day"),q("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),q("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),q("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),q("e",0,0,"weekday"),q("E",0,0,"isoWeekday"),W("day","d"),W("weekday","e"),W("isoWeekday","E"),G("day",11),G("weekday",11),G("isoWeekday",11),de("d",$),de("e",$),de("E",$),de("dd",function(e,t){return t.weekdaysMinRegex(e)}),de("ddd",function(e,t){return t.weekdaysShortRegex(e)}),de("dddd",function(e,t){return t.weekdaysRegex(e)}),ge(["dd","ddd","dddd"],function(e,t,n,r){var i=n._locale.weekdaysParse(e,r,n._strict);null!=i?t.d=i:m(n).invalidWeekday=e}),ge(["d","e","E"],function(e,t,n,r){t[r]=A(e)});var Xe="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var Je="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var Qe="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var Ze=ce;var $e=ce;var et=ce;function tt(){function e(e,t){return t.length-e.length}var t,n,r,i,a,o=[],s=[],l=[],c=[];for(t=0;t<7;t++)n=f([2e3,1]).day(t),r=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),a=this.weekdays(n,""),o.push(r),s.push(i),l.push(a),c.push(r),c.push(i),c.push(a);for(o.sort(e),s.sort(e),l.sort(e),c.sort(e),t=0;t<7;t++)s[t]=pe(s[t]),l[t]=pe(l[t]),c[t]=pe(c[t]);this._weekdaysRegex=new RegExp("^("+c.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+o.join("|")+")","i")}function nt(){return this.hours()%12||12}function rt(e,t){q(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function it(e,t){return t._meridiemParse}q("H",["HH",2],0,"hour"),q("h",["hh",2],0,nt),q("k",["kk",2],0,function(){return this.hours()||24}),q("hmm",0,0,function(){return""+nt.apply(this)+V(this.minutes(),2)}),q("hmmss",0,0,function(){return""+nt.apply(this)+V(this.minutes(),2)+V(this.seconds(),2)}),q("Hmm",0,0,function(){return""+this.hours()+V(this.minutes(),2)}),q("Hmmss",0,0,function(){return""+this.hours()+V(this.minutes(),2)+V(this.seconds(),2)}),rt("a",!0),rt("A",!1),W("hour","h"),G("hour",13),de("a",it),de("A",it),de("H",$),de("h",$),de("k",$),de("HH",$,X),de("hh",$,X),de("kk",$,X),de("hmm",ee),de("hmmss",te),de("Hmm",ee),de("Hmmss",te),me(["H","HH"],Se),me(["k","kk"],function(e,t,n){var r=A(e);t[Se]=24===r?0:r}),me(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),me(["h","hh"],function(e,t,n){t[Se]=A(e),m(n).bigHour=!0}),me("hmm",function(e,t,n){var r=e.length-2;t[Se]=A(e.substr(0,r)),t[_e]=A(e.substr(r)),m(n).bigHour=!0}),me("hmmss",function(e,t,n){var r=e.length-4,i=e.length-2;t[Se]=A(e.substr(0,r)),t[_e]=A(e.substr(r,2)),t[Pe]=A(e.substr(i)),m(n).bigHour=!0}),me("Hmm",function(e,t,n){var r=e.length-2;t[Se]=A(e.substr(0,r)),t[_e]=A(e.substr(r))}),me("Hmmss",function(e,t,n){var r=e.length-4,i=e.length-2;t[Se]=A(e.substr(0,r)),t[_e]=A(e.substr(r,2)),t[Pe]=A(e.substr(i))});var at,ot=Ie("Hours",!0),st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Le,monthsShort:Ne,week:{dow:0,doy:6},weekdays:Xe,weekdaysMin:Qe,weekdaysShort:Je,meridiemParse:/[ap]\.?m?\.?/i},lt={},ct={};function ut(e){return e?e.toLowerCase().replace("_","-"):e}function dt(t){var r=null;if(!lt[t]&&void 0!==e&&e&&e.exports)try{r=at._abbr;n(157),ht(r)}catch(e){}return lt[t]}function ht(e,t){var n;return e&&((n=l(t)?ft(e):pt(e,t))?at=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),at._abbr}function pt(e,t){if(null!==t){var n,r=st;if(t.abbr=e,null!=lt[e])E("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),r=lt[e]._config;else if(null!=t.parentLocale)if(null!=lt[t.parentLocale])r=lt[t.parentLocale]._config;else{if(null==(n=dt(t.parentLocale)))return ct[t.parentLocale]||(ct[t.parentLocale]=[]),ct[t.parentLocale].push({name:e,config:t}),null;r=n._config}return lt[e]=new R(O(r,t)),ct[e]&&ct[e].forEach(function(e){pt(e.name,e.config)}),ht(e),lt[e]}return delete lt[e],null}function ft(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return at;if(!a(e)){if(t=dt(e))return t;e=[e]}return function(e){for(var t,n,r,i,a=0;a<e.length;){for(t=(i=ut(e[a]).split("-")).length,n=(n=ut(e[a+1]))?n.split("-"):null;t>0;){if(r=dt(i.slice(0,t).join("-")))return r;if(n&&n.length>=t&&k(i,n,!0)>=t-1)break;t--}a++}return at}(e)}function mt(e){var t,n=e._a;return n&&-2===m(e).overflow&&(t=n[be]<0||n[be]>11?be:n[we]<1||n[we]>Me(n[ye],n[be])?we:n[Se]<0||n[Se]>24||24===n[Se]&&(0!==n[_e]||0!==n[Pe]||0!==n[Ae])?Se:n[_e]<0||n[_e]>59?_e:n[Pe]<0||n[Pe]>59?Pe:n[Ae]<0||n[Ae]>999?Ae:-1,m(e)._overflowDayOfYear&&(t<ye||t>we)&&(t=we),m(e)._overflowWeeks&&-1===t&&(t=ke),m(e)._overflowWeekday&&-1===t&&(t=Ce),m(e).overflow=t),e}function gt(e,t,n){return null!=e?e:null!=t?t:n}function vt(e){var t,n,r,a,o,s=[];if(!e._d){for(r=function(e){var t=new Date(i.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}(e),e._w&&null==e._a[we]&&null==e._a[be]&&function(e){var t,n,r,i,a,o,s,l;if(null!=(t=e._w).GG||null!=t.W||null!=t.E)a=1,o=4,n=gt(t.GG,e._a[ye],ze(Ot(),1,4).year),r=gt(t.W,1),((i=gt(t.E,1))<1||i>7)&&(l=!0);else{a=e._locale._week.dow,o=e._locale._week.doy;var c=ze(Ot(),a,o);n=gt(t.gg,e._a[ye],c.year),r=gt(t.w,c.week),null!=t.d?((i=t.d)<0||i>6)&&(l=!0):null!=t.e?(i=t.e+a,(t.e<0||t.e>6)&&(l=!0)):i=a}r<1||r>Ye(n,a,o)?m(e)._overflowWeeks=!0:null!=l?m(e)._overflowWeekday=!0:(s=qe(n,r,i,a,o),e._a[ye]=s.year,e._dayOfYear=s.dayOfYear)}(e),null!=e._dayOfYear&&(o=gt(e._a[ye],r[ye]),(e._dayOfYear>xe(o)||0===e._dayOfYear)&&(m(e)._overflowDayOfYear=!0),n=Be(o,0,e._dayOfYear),e._a[be]=n.getUTCMonth(),e._a[we]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=s[t]=r[t];for(;t<7;t++)e._a[t]=s[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[Se]&&0===e._a[_e]&&0===e._a[Pe]&&0===e._a[Ae]&&(e._nextDay=!0,e._a[Se]=0),e._d=(e._useUTC?Be:function(e,t,n,r,i,a,o){var s;return e<100&&e>=0?(s=new Date(e+400,t,n,r,i,a,o),isFinite(s.getFullYear())&&s.setFullYear(e)):s=new Date(e,t,n,r,i,a,o),s}).apply(null,s),a=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Se]=24),e._w&&void 0!==e._w.d&&e._w.d!==a&&(m(e).weekdayMismatch=!0)}}var yt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,bt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,wt=/Z|[+-]\d\d(?::?\d\d)?/,St=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],_t=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Pt=/^\/?Date\((\-?\d+)/i;function At(e){var t,n,r,i,a,o,s=e._i,l=yt.exec(s)||bt.exec(s);if(l){for(m(e).iso=!0,t=0,n=St.length;t<n;t++)if(St[t][1].exec(l[1])){i=St[t][0],r=!1!==St[t][2];break}if(null==i)return void(e._isValid=!1);if(l[3]){for(t=0,n=_t.length;t<n;t++)if(_t[t][1].exec(l[3])){a=(l[2]||" ")+_t[t][0];break}if(null==a)return void(e._isValid=!1)}if(!r&&null!=a)return void(e._isValid=!1);if(l[4]){if(!wt.exec(l[4]))return void(e._isValid=!1);o="Z"}e._f=i+(a||"")+(o||""),Dt(e)}else e._isValid=!1}var kt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;function Ct(e,t,n,r,i,a){var o=[function(e){var t=parseInt(e,10);if(t<=49)return 2e3+t;if(t<=999)return 1900+t;return t}(e),Ne.indexOf(t),parseInt(n,10),parseInt(r,10),parseInt(i,10)];return a&&o.push(parseInt(a,10)),o}var xt={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Tt(e){var t=kt.exec(e._i.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(t){var n=Ct(t[4],t[3],t[2],t[5],t[6],t[7]);if(!function(e,t,n){return!e||Je.indexOf(e)===new Date(t[0],t[1],t[2]).getDay()||(m(n).weekdayMismatch=!0,n._isValid=!1,!1)}(t[1],n,e))return;e._a=n,e._tzm=function(e,t,n){if(e)return xt[e];if(t)return 0;var r=parseInt(n,10),i=r%100;return(r-i)/100*60+i}(t[8],t[9],t[10]),e._d=Be.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),m(e).rfc2822=!0}else e._isValid=!1}function Dt(e){if(e._f!==i.ISO_8601)if(e._f!==i.RFC_2822){e._a=[],m(e).empty=!0;var t,n,r,a,o,s=""+e._i,l=s.length,c=0;for(r=Y(e._f,e._locale).match(K)||[],t=0;t<r.length;t++)a=r[t],(n=(s.match(he(a,e))||[])[0])&&((o=s.substr(0,s.indexOf(n))).length>0&&m(e).unusedInput.push(o),s=s.slice(s.indexOf(n)+n.length),c+=n.length),U[a]?(n?m(e).empty=!1:m(e).unusedTokens.push(a),ve(a,n,e)):e._strict&&!n&&m(e).unusedTokens.push(a);m(e).charsLeftOver=l-c,s.length>0&&m(e).unusedInput.push(s),e._a[Se]<=12&&!0===m(e).bigHour&&e._a[Se]>0&&(m(e).bigHour=void 0),m(e).parsedDateParts=e._a.slice(0),m(e).meridiem=e._meridiem,e._a[Se]=function(e,t,n){var r;if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?((r=e.isPM(n))&&t<12&&(t+=12),r||12!==t||(t=0),t):t}(e._locale,e._a[Se],e._meridiem),vt(e),mt(e)}else Tt(e);else At(e)}function Et(e){var t=e._i,n=e._f;return e._locale=e._locale||ft(e._l),null===t||void 0===n&&""===t?v({nullInput:!0}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),_(t)?new S(mt(t)):(u(t)?e._d=t:a(n)?function(e){var t,n,r,i,a;if(0===e._f.length)return m(e).invalidFormat=!0,void(e._d=new Date(NaN));for(i=0;i<e._f.length;i++)a=0,t=b({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],Dt(t),g(t)&&(a+=m(t).charsLeftOver,a+=10*m(t).unusedTokens.length,m(t).score=a,(null==r||a<r)&&(r=a,n=t));p(e,n||t)}(e):n?Dt(e):function(e){var t=e._i;l(t)?e._d=new Date(i.now()):u(t)?e._d=new Date(t.valueOf()):"string"==typeof t?function(e){var t=Pt.exec(e._i);null===t?(At(e),!1===e._isValid&&(delete e._isValid,Tt(e),!1===e._isValid&&(delete e._isValid,i.createFromInputFallback(e)))):e._d=new Date(+t[1])}(e):a(t)?(e._a=d(t.slice(0),function(e){return parseInt(e,10)}),vt(e)):s(t)?function(e){if(!e._d){var t=N(e._i);e._a=d([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),vt(e)}}(e):c(t)?e._d=new Date(t):i.createFromInputFallback(e)}(e),g(e)||(e._d=null),e))}function It(e,t,n,r,i){var o,l={};return!0!==n&&!1!==n||(r=n,n=void 0),(s(e)&&function(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0}(e)||a(e)&&0===e.length)&&(e=void 0),l._isAMomentObject=!0,l._useUTC=l._isUTC=i,l._l=n,l._i=e,l._f=t,l._strict=r,(o=new S(mt(Et(l))))._nextDay&&(o.add(1,"d"),o._nextDay=void 0),o}function Ot(e,t,n,r){return It(e,t,n,r,!1)}i.createFromInputFallback=x("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),i.ISO_8601=function(){},i.RFC_2822=function(){};var Rt=x("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=Ot.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:v()}),Mt=x("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=Ot.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:v()});function Wt(e,t){var n,r;if(1===t.length&&a(t[0])&&(t=t[0]),!t.length)return Ot();for(n=t[0],r=1;r<t.length;++r)t[r].isValid()&&!t[r][e](n)||(n=t[r]);return n}var Lt=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Nt(e){var t=N(e),n=t.year||0,r=t.quarter||0,i=t.month||0,a=t.week||t.isoWeek||0,o=t.day||0,s=t.hour||0,l=t.minute||0,c=t.second||0,u=t.millisecond||0;this._isValid=function(e){for(var t in e)if(-1===De.call(Lt,t)||null!=e[t]&&isNaN(e[t]))return!1;for(var n=!1,r=0;r<Lt.length;++r)if(e[Lt[r]]){if(n)return!1;parseFloat(e[Lt[r]])!==A(e[Lt[r]])&&(n=!0)}return!0}(t),this._milliseconds=+u+1e3*c+6e4*l+1e3*s*60*60,this._days=+o+7*a,this._months=+i+3*r+12*n,this._data={},this._locale=ft(),this._bubble()}function Ft(e){return e instanceof Nt}function Gt(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Vt(e,t){q(e,0,0,function(){var e=this.utcOffset(),n="+";return e<0&&(e=-e,n="-"),n+V(~~(e/60),2)+t+V(~~e%60,2)})}Vt("Z",":"),Vt("ZZ",""),de("Z",le),de("ZZ",le),me(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=jt(le,e)});var Kt=/([\+\-]|\d\d)/gi;function jt(e,t){var n=(t||"").match(e);if(null===n)return null;var r=((n[n.length-1]||[])+"").match(Kt)||["-",0,0],i=60*r[1]+A(r[2]);return 0===i?0:"+"===r[0]?i:-i}function Bt(e,t){var n,r;return t._isUTC?(n=t.clone(),r=(_(e)||u(e)?e.valueOf():Ot(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+r),i.updateOffset(n,!1),n):Ot(e).local()}function Ut(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function qt(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}i.updateOffset=function(){};var zt=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Yt=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Ht(e,t){var n,r,i,a=e,s=null;return Ft(e)?a={ms:e._milliseconds,d:e._days,M:e._months}:c(e)?(a={},t?a[t]=e:a.milliseconds=e):(s=zt.exec(e))?(n="-"===s[1]?-1:1,a={y:0,d:A(s[we])*n,h:A(s[Se])*n,m:A(s[_e])*n,s:A(s[Pe])*n,ms:A(Gt(1e3*s[Ae]))*n}):(s=Yt.exec(e))?(n="-"===s[1]?-1:1,a={y:Xt(s[2],n),M:Xt(s[3],n),w:Xt(s[4],n),d:Xt(s[5],n),h:Xt(s[6],n),m:Xt(s[7],n),s:Xt(s[8],n)}):null==a?a={}:"object"===(void 0===a?"undefined":o(a))&&("from"in a||"to"in a)&&(i=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Bt(t,e),e.isBefore(t)?n=Jt(e,t):((n=Jt(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(Ot(a.from),Ot(a.to)),(a={}).ms=i.milliseconds,a.M=i.months),r=new Nt(a),Ft(e)&&h(e,"_locale")&&(r._locale=e._locale),r}function Xt(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function Jt(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function Qt(e,t){return function(n,r){var i;return null===r||isNaN(+r)||(E(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=n,n=r,r=i),Zt(this,Ht(n="string"==typeof n?+n:n,r),e),this}}function Zt(e,t,n,r){var a=t._milliseconds,o=Gt(t._days),s=Gt(t._months);e.isValid()&&(r=null==r||r,s&&Fe(e,Oe(e,"Month")+s*n),o&&Re(e,"Date",Oe(e,"Date")+o*n),a&&e._d.setTime(e._d.valueOf()+a*n),r&&i.updateOffset(e,o||s))}Ht.fn=Nt.prototype,Ht.invalid=function(){return Ht(NaN)};var $t=Qt(1,"add"),en=Qt(-1,"subtract");function tn(e,t){var n=12*(t.year()-e.year())+(t.month()-e.month()),r=e.clone().add(n,"months");return-(n+(t-r<0?(t-r)/(r-e.clone().add(n-1,"months")):(t-r)/(e.clone().add(n+1,"months")-r)))||0}function nn(e){var t;return void 0===e?this._locale._abbr:(null!=(t=ft(e))&&(this._locale=t),this)}i.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",i.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var rn=x("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function an(){return this._locale}var on=1e3,sn=60*on,ln=60*sn,cn=3506328*ln;function un(e,t){return(e%t+t)%t}function dn(e,t,n){return e<100&&e>=0?new Date(e+400,t,n)-cn:new Date(e,t,n).valueOf()}function hn(e,t,n){return e<100&&e>=0?Date.UTC(e+400,t,n)-cn:Date.UTC(e,t,n)}function pn(e,t){q(0,[e,e.length],0,t)}function fn(e,t,n,r,i){var a;return null==e?ze(this,r,i).year:(t>(a=Ye(e,r,i))&&(t=a),function(e,t,n,r,i){var a=qe(e,t,n,r,i),o=Be(a.year,0,a.dayOfYear);return this.year(o.getUTCFullYear()),this.month(o.getUTCMonth()),this.date(o.getUTCDate()),this}.call(this,e,t,n,r,i))}q(0,["gg",2],0,function(){return this.weekYear()%100}),q(0,["GG",2],0,function(){return this.isoWeekYear()%100}),pn("gggg","weekYear"),pn("ggggg","weekYear"),pn("GGGG","isoWeekYear"),pn("GGGGG","isoWeekYear"),W("weekYear","gg"),W("isoWeekYear","GG"),G("weekYear",1),G("isoWeekYear",1),de("G",oe),de("g",oe),de("GG",$,X),de("gg",$,X),de("GGGG",re,Q),de("gggg",re,Q),de("GGGGG",ie,Z),de("ggggg",ie,Z),ge(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,r){t[r.substr(0,2)]=A(e)}),ge(["gg","GG"],function(e,t,n,r){t[r]=i.parseTwoDigitYear(e)}),q("Q",0,"Qo","quarter"),W("quarter","Q"),G("quarter",7),de("Q",H),me("Q",function(e,t){t[be]=3*(A(e)-1)}),q("D",["DD",2],"Do","date"),W("date","D"),G("date",9),de("D",$),de("DD",$,X),de("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),me(["D","DD"],we),me("Do",function(e,t){t[we]=A(e.match($)[0])});var mn=Ie("Date",!0);q("DDD",["DDDD",3],"DDDo","dayOfYear"),W("dayOfYear","DDD"),G("dayOfYear",4),de("DDD",ne),de("DDDD",J),me(["DDD","DDDD"],function(e,t,n){n._dayOfYear=A(e)}),q("m",["mm",2],0,"minute"),W("minute","m"),G("minute",14),de("m",$),de("mm",$,X),me(["m","mm"],_e);var gn=Ie("Minutes",!1);q("s",["ss",2],0,"second"),W("second","s"),G("second",15),de("s",$),de("ss",$,X),me(["s","ss"],Pe);var vn,yn=Ie("Seconds",!1);for(q("S",0,0,function(){return~~(this.millisecond()/100)}),q(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),q(0,["SSS",3],0,"millisecond"),q(0,["SSSS",4],0,function(){return 10*this.millisecond()}),q(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),q(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),q(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),q(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),q(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),W("millisecond","ms"),G("millisecond",16),de("S",ne,H),de("SS",ne,X),de("SSS",ne,J),vn="SSSS";vn.length<=9;vn+="S")de(vn,ae);function bn(e,t){t[Ae]=A(1e3*("0."+e))}for(vn="S";vn.length<=9;vn+="S")me(vn,bn);var wn=Ie("Milliseconds",!1);q("z",0,0,"zoneAbbr"),q("zz",0,0,"zoneName");var Sn=S.prototype;function _n(e){return e}Sn.add=$t,Sn.calendar=function(e,t){var n=e||Ot(),r=Bt(n,this).startOf("day"),a=i.calendarFormat(this,r)||"sameElse",o=t&&(I(t[a])?t[a].call(this,n):t[a]);return this.format(o||this.localeData().calendar(a,this,Ot(n)))},Sn.clone=function(){return new S(this)},Sn.diff=function(e,t,n){var r,i,a;if(!this.isValid())return NaN;if(!(r=Bt(e,this)).isValid())return NaN;switch(i=6e4*(r.utcOffset()-this.utcOffset()),t=L(t)){case"year":a=tn(this,r)/12;break;case"month":a=tn(this,r);break;case"quarter":a=tn(this,r)/3;break;case"second":a=(this-r)/1e3;break;case"minute":a=(this-r)/6e4;break;case"hour":a=(this-r)/36e5;break;case"day":a=(this-r-i)/864e5;break;case"week":a=(this-r-i)/6048e5;break;default:a=this-r}return n?a:P(a)},Sn.endOf=function(e){var t;if(void 0===(e=L(e))||"millisecond"===e||!this.isValid())return this;var n=this._isUTC?hn:dn;switch(e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=ln-un(t+(this._isUTC?0:this.utcOffset()*sn),ln)-1;break;case"minute":t=this._d.valueOf(),t+=sn-un(t,sn)-1;break;case"second":t=this._d.valueOf(),t+=on-un(t,on)-1}return this._d.setTime(t),i.updateOffset(this,!0),this},Sn.format=function(e){e||(e=this.isUtc()?i.defaultFormatUtc:i.defaultFormat);var t=z(this,e);return this.localeData().postformat(t)},Sn.from=function(e,t){return this.isValid()&&(_(e)&&e.isValid()||Ot(e).isValid())?Ht({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},Sn.fromNow=function(e){return this.from(Ot(),e)},Sn.to=function(e,t){return this.isValid()&&(_(e)&&e.isValid()||Ot(e).isValid())?Ht({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},Sn.toNow=function(e){return this.to(Ot(),e)},Sn.get=function(e){return I(this[e=L(e)])?this[e]():this},Sn.invalidAt=function(){return m(this).overflow},Sn.isAfter=function(e,t){var n=_(e)?e:Ot(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=L(t)||"millisecond")?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())},Sn.isBefore=function(e,t){var n=_(e)?e:Ot(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=L(t)||"millisecond")?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())},Sn.isBetween=function(e,t,n,r){var i=_(e)?e:Ot(e),a=_(t)?t:Ot(t);return!!(this.isValid()&&i.isValid()&&a.isValid())&&("("===(r=r||"()")[0]?this.isAfter(i,n):!this.isBefore(i,n))&&(")"===r[1]?this.isBefore(a,n):!this.isAfter(a,n))},Sn.isSame=function(e,t){var n,r=_(e)?e:Ot(e);return!(!this.isValid()||!r.isValid())&&("millisecond"===(t=L(t)||"millisecond")?this.valueOf()===r.valueOf():(n=r.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))},Sn.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},Sn.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},Sn.isValid=function(){return g(this)},Sn.lang=rn,Sn.locale=nn,Sn.localeData=an,Sn.max=Mt,Sn.min=Rt,Sn.parsingFlags=function(){return p({},m(this))},Sn.set=function(e,t){if("object"===(void 0===e?"undefined":o(e)))for(var n=function(e){var t=[];for(var n in e)t.push({unit:n,priority:F[n]});return t.sort(function(e,t){return e.priority-t.priority}),t}(e=N(e)),r=0;r<n.length;r++)this[n[r].unit](e[n[r].unit]);else if(I(this[e=L(e)]))return this[e](t);return this},Sn.startOf=function(e){var t;if(void 0===(e=L(e))||"millisecond"===e||!this.isValid())return this;var n=this._isUTC?hn:dn;switch(e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=un(t+(this._isUTC?0:this.utcOffset()*sn),ln);break;case"minute":t=this._d.valueOf(),t-=un(t,sn);break;case"second":t=this._d.valueOf(),t-=un(t,on)}return this._d.setTime(t),i.updateOffset(this,!0),this},Sn.subtract=en,Sn.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},Sn.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},Sn.toDate=function(){return new Date(this.valueOf())},Sn.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;return n.year()<0||n.year()>9999?z(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):I(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",z(n,"Z")):z(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},Sn.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var n="["+e+'("]',r=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i=t+'[")]';return this.format(n+r+"-MM-DD[T]HH:mm:ss.SSS"+i)},Sn.toJSON=function(){return this.isValid()?this.toISOString():null},Sn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},Sn.unix=function(){return Math.floor(this.valueOf()/1e3)},Sn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},Sn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},Sn.year=Ee,Sn.isLeapYear=function(){return Te(this.year())},Sn.weekYear=function(e){return fn.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},Sn.isoWeekYear=function(e){return fn.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},Sn.quarter=Sn.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},Sn.month=Ge,Sn.daysInMonth=function(){return Me(this.year(),this.month())},Sn.week=Sn.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},Sn.isoWeek=Sn.isoWeeks=function(e){var t=ze(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},Sn.weeksInYear=function(){var e=this.localeData()._week;return Ye(this.year(),e.dow,e.doy)},Sn.isoWeeksInYear=function(){return Ye(this.year(),1,4)},Sn.date=mn,Sn.day=Sn.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=function(e,t){return"string"!=typeof e?e:isNaN(e)?"number"==typeof(e=t.weekdaysParse(e))?e:null:parseInt(e,10)}(e,this.localeData()),this.add(e-t,"d")):t},Sn.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},Sn.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=function(e,t){return"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}(e,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7},Sn.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},Sn.hour=Sn.hours=ot,Sn.minute=Sn.minutes=gn,Sn.second=Sn.seconds=yn,Sn.millisecond=Sn.milliseconds=wn,Sn.utcOffset=function(e,t,n){var r,a=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null!=e){if("string"==typeof e){if(null===(e=jt(le,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(r=Ut(this)),this._offset=e,this._isUTC=!0,null!=r&&this.add(r,"m"),a!==e&&(!t||this._changeInProgress?Zt(this,Ht(e-a,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,i.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?a:Ut(this)},Sn.utc=function(e){return this.utcOffset(0,e)},Sn.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Ut(this),"m")),this},Sn.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=jt(se,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},Sn.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?Ot(e).utcOffset():0,(this.utcOffset()-e)%60==0)},Sn.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},Sn.isLocal=function(){return!!this.isValid()&&!this._isUTC},Sn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},Sn.isUtc=qt,Sn.isUTC=qt,Sn.zoneAbbr=function(){return this._isUTC?"UTC":""},Sn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},Sn.dates=x("dates accessor is deprecated. Use date instead.",mn),Sn.months=x("months accessor is deprecated. Use month instead",Ge),Sn.years=x("years accessor is deprecated. Use year instead",Ee),Sn.zone=x("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),Sn.isDSTShifted=x("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e={};if(b(e,this),(e=Et(e))._a){var t=e._isUTC?f(e._a):Ot(e._a);this._isDSTShifted=this.isValid()&&k(e._a,t.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted});var Pn=R.prototype;function An(e,t,n,r){var i=ft(),a=f().set(r,t);return i[n](a,e)}function kn(e,t,n){if(c(e)&&(t=e,e=void 0),e=e||"",null!=t)return An(e,t,n,"month");var r,i=[];for(r=0;r<12;r++)i[r]=An(e,r,n,"month");return i}function Cn(e,t,n,r){"boolean"==typeof e?(c(t)&&(n=t,t=void 0),t=t||""):(n=t=e,e=!1,c(t)&&(n=t,t=void 0),t=t||"");var i,a=ft(),o=e?a._week.dow:0;if(null!=n)return An(t,(n+o)%7,r,"day");var s=[];for(i=0;i<7;i++)s[i]=An(t,(i+o)%7,r,"day");return s}Pn.calendar=function(e,t,n){var r=this._calendar[e]||this._calendar.sameElse;return I(r)?r.call(t,n):r},Pn.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])},Pn.invalidDate=function(){return this._invalidDate},Pn.ordinal=function(e){return this._ordinal.replace("%d",e)},Pn.preparse=_n,Pn.postformat=_n,Pn.relativeTime=function(e,t,n,r){var i=this._relativeTime[n];return I(i)?i(e,t,n,r):i.replace(/%d/i,e)},Pn.pastFuture=function(e,t){var n=this._relativeTime[e>0?"future":"past"];return I(n)?n(t):n.replace(/%s/i,t)},Pn.set=function(e){var t,n;for(n in e)I(t=e[n])?this[n]=t:this["_"+n]=t;this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},Pn.months=function(e,t){return e?a(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||We).test(t)?"format":"standalone"][e.month()]:a(this._months)?this._months:this._months.standalone},Pn.monthsShort=function(e,t){return e?a(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[We.test(t)?"format":"standalone"][e.month()]:a(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},Pn.monthsParse=function(e,t,n){var r,i,a;if(this._monthsParseExact)return function(e,t,n){var r,i,a,o=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],r=0;r<12;++r)a=f([2e3,r]),this._shortMonthsParse[r]=this.monthsShort(a,"").toLocaleLowerCase(),this._longMonthsParse[r]=this.months(a,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=De.call(this._shortMonthsParse,o))?i:null:-1!==(i=De.call(this._longMonthsParse,o))?i:null:"MMM"===t?-1!==(i=De.call(this._shortMonthsParse,o))?i:-1!==(i=De.call(this._longMonthsParse,o))?i:null:-1!==(i=De.call(this._longMonthsParse,o))?i:-1!==(i=De.call(this._shortMonthsParse,o))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++){if(i=f([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[r]||(a="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(a.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[r].test(e))return r;if(n&&"MMM"===t&&this._shortMonthsParse[r].test(e))return r;if(!n&&this._monthsParse[r].test(e))return r}},Pn.monthsRegex=function(e){return this._monthsParseExact?(h(this,"_monthsRegex")||je.call(this),e?this._monthsStrictRegex:this._monthsRegex):(h(this,"_monthsRegex")||(this._monthsRegex=Ke),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},Pn.monthsShortRegex=function(e){return this._monthsParseExact?(h(this,"_monthsRegex")||je.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(h(this,"_monthsShortRegex")||(this._monthsShortRegex=Ve),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},Pn.week=function(e){return ze(e,this._week.dow,this._week.doy).week},Pn.firstDayOfYear=function(){return this._week.doy},Pn.firstDayOfWeek=function(){return this._week.dow},Pn.weekdays=function(e,t){var n=a(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?He(n,this._week.dow):e?n[e.day()]:n},Pn.weekdaysMin=function(e){return!0===e?He(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},Pn.weekdaysShort=function(e){return!0===e?He(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},Pn.weekdaysParse=function(e,t,n){var r,i,a;if(this._weekdaysParseExact)return function(e,t,n){var r,i,a,o=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)a=f([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(a,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(a,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(a,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=De.call(this._weekdaysParse,o))?i:null:"ddd"===t?-1!==(i=De.call(this._shortWeekdaysParse,o))?i:null:-1!==(i=De.call(this._minWeekdaysParse,o))?i:null:"dddd"===t?-1!==(i=De.call(this._weekdaysParse,o))?i:-1!==(i=De.call(this._shortWeekdaysParse,o))?i:-1!==(i=De.call(this._minWeekdaysParse,o))?i:null:"ddd"===t?-1!==(i=De.call(this._shortWeekdaysParse,o))?i:-1!==(i=De.call(this._weekdaysParse,o))?i:-1!==(i=De.call(this._minWeekdaysParse,o))?i:null:-1!==(i=De.call(this._minWeekdaysParse,o))?i:-1!==(i=De.call(this._weekdaysParse,o))?i:-1!==(i=De.call(this._shortWeekdaysParse,o))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(i=f([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(a="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(a.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[r].test(e))return r;if(n&&"ddd"===t&&this._shortWeekdaysParse[r].test(e))return r;if(n&&"dd"===t&&this._minWeekdaysParse[r].test(e))return r;if(!n&&this._weekdaysParse[r].test(e))return r}},Pn.weekdaysRegex=function(e){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||tt.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(h(this,"_weekdaysRegex")||(this._weekdaysRegex=Ze),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},Pn.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||tt.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(h(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=$e),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},Pn.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||tt.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(h(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=et),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},Pn.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},Pn.meridiem=function(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"},ht("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===A(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),i.lang=x("moment.lang is deprecated. Use moment.locale instead.",ht),i.langData=x("moment.langData is deprecated. Use moment.localeData instead.",ft);var xn=Math.abs;function Tn(e,t,n,r){var i=Ht(t,n);return e._milliseconds+=r*i._milliseconds,e._days+=r*i._days,e._months+=r*i._months,e._bubble()}function Dn(e){return e<0?Math.floor(e):Math.ceil(e)}function En(e){return 4800*e/146097}function In(e){return 146097*e/4800}function On(e){return function(){return this.as(e)}}var Rn=On("ms"),Mn=On("s"),Wn=On("m"),Ln=On("h"),Nn=On("d"),Fn=On("w"),Gn=On("M"),Vn=On("Q"),Kn=On("y");function jn(e){return function(){return this.isValid()?this._data[e]:NaN}}var Bn=jn("milliseconds"),Un=jn("seconds"),qn=jn("minutes"),zn=jn("hours"),Yn=jn("days"),Hn=jn("months"),Xn=jn("years");var Jn=Math.round,Qn={ss:44,s:45,m:45,h:22,d:26,M:11};var Zn=Math.abs;function $n(e){return(e>0)-(e<0)||+e}function er(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n=Zn(this._milliseconds)/1e3,r=Zn(this._days),i=Zn(this._months);t=P((e=P(n/60))/60),n%=60,e%=60;var a=P(i/12),o=i%=12,s=r,l=t,c=e,u=n?n.toFixed(3).replace(/\.?0+$/,""):"",d=this.asSeconds();if(!d)return"P0D";var h=d<0?"-":"",p=$n(this._months)!==$n(d)?"-":"",f=$n(this._days)!==$n(d)?"-":"",m=$n(this._milliseconds)!==$n(d)?"-":"";return h+"P"+(a?p+a+"Y":"")+(o?p+o+"M":"")+(s?f+s+"D":"")+(l||c||u?"T":"")+(l?m+l+"H":"")+(c?m+c+"M":"")+(u?m+u+"S":"")}var tr=Nt.prototype;return tr.isValid=function(){return this._isValid},tr.abs=function(){var e=this._data;return this._milliseconds=xn(this._milliseconds),this._days=xn(this._days),this._months=xn(this._months),e.milliseconds=xn(e.milliseconds),e.seconds=xn(e.seconds),e.minutes=xn(e.minutes),e.hours=xn(e.hours),e.months=xn(e.months),e.years=xn(e.years),this},tr.add=function(e,t){return Tn(this,e,t,1)},tr.subtract=function(e,t){return Tn(this,e,t,-1)},tr.as=function(e){if(!this.isValid())return NaN;var t,n,r=this._milliseconds;if("month"===(e=L(e))||"quarter"===e||"year"===e)switch(t=this._days+r/864e5,n=this._months+En(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(In(this._months)),e){case"week":return t/7+r/6048e5;case"day":return t+r/864e5;case"hour":return 24*t+r/36e5;case"minute":return 1440*t+r/6e4;case"second":return 86400*t+r/1e3;case"millisecond":return Math.floor(864e5*t)+r;default:throw new Error("Unknown unit "+e)}},tr.asMilliseconds=Rn,tr.asSeconds=Mn,tr.asMinutes=Wn,tr.asHours=Ln,tr.asDays=Nn,tr.asWeeks=Fn,tr.asMonths=Gn,tr.asQuarters=Vn,tr.asYears=Kn,tr.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*A(this._months/12):NaN},tr._bubble=function(){var e,t,n,r,i,a=this._milliseconds,o=this._days,s=this._months,l=this._data;return a>=0&&o>=0&&s>=0||a<=0&&o<=0&&s<=0||(a+=864e5*Dn(In(s)+o),o=0,s=0),l.milliseconds=a%1e3,e=P(a/1e3),l.seconds=e%60,t=P(e/60),l.minutes=t%60,n=P(t/60),l.hours=n%24,s+=i=P(En(o+=P(n/24))),o-=Dn(In(i)),r=P(s/12),s%=12,l.days=o,l.months=s,l.years=r,this},tr.clone=function(){return Ht(this)},tr.get=function(e){return e=L(e),this.isValid()?this[e+"s"]():NaN},tr.milliseconds=Bn,tr.seconds=Un,tr.minutes=qn,tr.hours=zn,tr.days=Yn,tr.weeks=function(){return P(this.days()/7)},tr.months=Hn,tr.years=Xn,tr.humanize=function(e){if(!this.isValid())return this.localeData().invalidDate();var t=this.localeData(),n=function(e,t,n){var r=Ht(e).abs(),i=Jn(r.as("s")),a=Jn(r.as("m")),o=Jn(r.as("h")),s=Jn(r.as("d")),l=Jn(r.as("M")),c=Jn(r.as("y")),u=i<=Qn.ss&&["s",i]||i<Qn.s&&["ss",i]||a<=1&&["m"]||a<Qn.m&&["mm",a]||o<=1&&["h"]||o<Qn.h&&["hh",o]||s<=1&&["d"]||s<Qn.d&&["dd",s]||l<=1&&["M"]||l<Qn.M&&["MM",l]||c<=1&&["y"]||["yy",c];return u[2]=t,u[3]=+e>0,u[4]=n,function(e,t,n,r,i){return i.relativeTime(t||1,!!n,e,r)}.apply(null,u)}(this,!e,t);return e&&(n=t.pastFuture(+this,n)),t.postformat(n)},tr.toISOString=er,tr.toString=er,tr.toJSON=er,tr.locale=nn,tr.localeData=an,tr.toIsoString=x("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",er),tr.lang=rn,q("X",0,0,"unix"),q("x",0,0,"valueOf"),de("x",oe),de("X",/[+-]?\d+(\.\d{1,3})?/),me("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),me("x",function(e,t,n){n._d=new Date(A(e))}),i.version="2.24.0",t=Ot,i.fn=Sn,i.min=function(){return Wt("isBefore",[].slice.call(arguments,0))},i.max=function(){return Wt("isAfter",[].slice.call(arguments,0))},i.now=function(){return Date.now?Date.now():+new Date},i.utc=f,i.unix=function(e){return Ot(1e3*e)},i.months=function(e,t){return kn(e,t,"months")},i.isDate=u,i.locale=ht,i.invalid=v,i.duration=Ht,i.isMoment=_,i.weekdays=function(e,t,n){return Cn(e,t,n,"weekdays")},i.parseZone=function(){return Ot.apply(null,arguments).parseZone()},i.localeData=ft,i.isDuration=Ft,i.monthsShort=function(e,t){return kn(e,t,"monthsShort")},i.weekdaysMin=function(e,t,n){return Cn(e,t,n,"weekdaysMin")},i.defineLocale=pt,i.updateLocale=function(e,t){if(null!=t){var n,r,i=st;null!=(r=dt(e))&&(i=r._config),(n=new R(t=O(i,t))).parentLocale=lt[e],lt[e]=n,ht(e)}else null!=lt[e]&&(null!=lt[e].parentLocale?lt[e]=lt[e].parentLocale:null!=lt[e]&&delete lt[e]);return lt[e]},i.locales=function(){return T(lt)},i.weekdaysShort=function(e,t,n){return Cn(e,t,n,"weekdaysShort")},i.normalizeUnits=L,i.relativeTimeRounding=function(e){return void 0===e?Jn:"function"==typeof e&&(Jn=e,!0)},i.relativeTimeThreshold=function(e,t){return void 0!==Qn[e]&&(void 0===t?Qn[e]:(Qn[e]=t,"s"===e&&(Qn.ss=t-1),!0))},i.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},i.prototype=Sn,i.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},i},"object"===o(t)&&void 0!==e?e.exports=a():void 0===(i="function"==typeof(r=a)?r.call(t,n,t,e):r)||(e.exports=i)}).call(t,n(156)(e))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateResponseStatus=t.validateRangeRequestCapabilities=t.createResponseStatusError=void 0;var r=n(1);t.createResponseStatusError=function(e,t){return 404===e||0===e&&/^file:/.test(t)?new r.MissingPDFException('Missing PDF "'+t+'".'):new r.UnexpectedResponseException("Unexpected server response ("+e+') while retrieving PDF "'+t+'".',e)},t.validateRangeRequestCapabilities=function(e){var t=e.getResponseHeader,n=e.isHttp,i=e.rangeChunkSize,a=e.disableRange;(0,r.assert)(i>0);var o={allowRangeRequests:!1,suggestedLength:void 0};if(a||!n)return o;if("bytes"!==t("Accept-Ranges"))return o;if("identity"!==(t("Content-Encoding")||"identity"))return o;var s=parseInt(t("Content-Length"),10);return Number.isInteger(s)?(o.suggestedLength=s,s<=2*i?o:(window.KGPdfViewerWebApp.getTipPrompt().open("加载中..."),o.allowRangeRequests=!0,o)):o},t.validateResponseStatus=function(e){return 200===e||206===e}},function(e,t,n){"use strict";e.exports=!n(8)&&!n(16)(function(){return 7!=Object.defineProperty(n(42)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";for(var r,i=n(0),a=n(9),o=n(19),s=o("typed_array"),l=o("view"),c=!(!i.ArrayBuffer||!i.DataView),u=c,d=0,h="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");d<9;)(r=i[h[d++]])?(a(r.prototype,s,!0),a(r.prototype,l,!0)):u=!1;e.exports={ABV:c,CONSTR:u,TYPED:s,VIEW:l}},function(e,t,n){"use strict";var r=n(20),i=n(13);e.exports=function(e){if(void 0===e)return 0;var t=r(e),n=i(t);if(t!==n)throw RangeError("Wrong length!");return n}},function(e,t,n){"use strict";var r=n(66),i=n(48).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},function(e,t,n){"use strict";var r=n(11),i=n(34),a=n(67)(!1),o=n(47)("IE_PROTO");e.exports=function(e,t){var n,s=i(e),l=0,c=[];for(n in s)n!=o&&r(s,n)&&c.push(n);for(;t.length>l;)r(s,n=t[l++])&&(~a(c,n)||c.push(n));return c}},function(e,t,n){"use strict";var r=n(34),i=n(13),a=n(35);e.exports=function(e){return function(t,n,o){var s,l=r(t),c=i(l.length),u=a(o,c);if(e&&n!=n){for(;c>u;)if((s=l[u++])!=s)return!0}else for(;c>u;u++)if((e||u in l)&&l[u]===n)return e||u||0;return!e&&-1}}},function(e,t,n){"use strict";var r=n(21),i=n(35),a=n(13);e.exports=function(e){for(var t=r(this),n=a(t.length),o=arguments.length,s=i(o>1?arguments[1]:void 0,n),l=o>2?arguments[2]:void 0,c=void 0===l?n:i(l,n);c>s;)t[s++]=e;return t}},function(e,t,n){"use strict";var r=n(22),i=n(4)("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||a[i]===e)}},function(e,t,n){"use strict";var r=n(10),i=n(105),a=n(48),o=n(47)("IE_PROTO"),s=function(){},l=function(){var e,t=n(42)("iframe"),r=a.length;for(t.style.display="none",n(71).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),l=e.F;r--;)delete l.prototype[a[r]];return l()};e.exports=Object.create||function(e,t){var n;return null!==e?(s.prototype=r(e),n=new s,s.prototype=null,n[o]=e):n=l(),void 0===t?n:i(n,t)}},function(e,t,n){"use strict";var r=n(0).document;e.exports=r&&r.documentElement},function(e,t,n){"use strict";var r=n(11),i=n(21),a=n(47)("IE_PROTO"),o=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),r(e,a)?e[a]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?o:null}},function(e,t,n){"use strict";var r=n(36),i=n(4)("iterator"),a=n(22);e.exports=n(6).getIteratorMethod=function(e){if(void 0!=e)return e[i]||e["@@iterator"]||a[r(e)]}},function(e,t,n){"use strict";var r=n(109),i=n(110),a=n(22),o=n(34);e.exports=n(75)(Array,"Array",function(e,t){this._t=o(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):i(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])},"values"),a.Arguments=a.Array,r("keys"),r("values"),r("entries")},function(e,t,n){"use strict";var r=n(26),i=n(7),a=n(18),o=n(9),s=n(22),l=n(111),c=n(31),u=n(72),d=n(4)("iterator"),h=!([].keys&&"next"in[].keys()),p=function(){return this};e.exports=function(e,t,n,f,m,g,v){l(n,t,f);var y,b,w,S=function(e){if(!h&&e in k)return k[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},_=t+" Iterator",P="values"==m,A=!1,k=e.prototype,C=k[d]||k["@@iterator"]||m&&k[m],x=C||S(m),T=m?P?S("entries"):x:void 0,D="Array"==t&&k.entries||C;if(D&&(w=u(D.call(new e)))!==Object.prototype&&w.next&&(c(w,_,!0),r||"function"==typeof w[d]||o(w,d,p)),P&&C&&"values"!==C.name&&(A=!0,x=function(){return C.call(this)}),r&&!v||!h&&!A&&k[d]||o(k,d,x),s[t]=x,s[_]=p,m)if(y={values:P?x:S("values"),keys:g?x:S("keys"),entries:T},v)for(b in y)b in k||a(k,b,y[b]);else i(i.P+i.F*(h||A),t,y);return y}},function(e,t,n){"use strict";var r=n(0),i=n(17),a=n(8),o=n(4)("species");e.exports=function(e){var t=r[e];a&&t&&!t[o]&&i.f(t,o,{configurable:!0,get:function(){return this}})}},function(e,t,n){"use strict";var r=n(78),i=n(33),a=n(34),o=n(43),s=n(11),l=n(62),c=Object.getOwnPropertyDescriptor;t.f=n(8)?c:function(e,t){if(e=a(e),t=o(t,!0),l)try{return c(e,t)}catch(e){}if(s(e,t))return i(!r.f.call(e,t),e[t])}},function(e,t,n){"use strict";t.f={}.propertyIsEnumerable},function(e,t,n){"use strict";var r=n(36),i={};i[n(4)("toStringTag")]="z",i+""!="[object z]"&&n(18)(Object.prototype,"toString",function(){return"[object "+r(this)+"]"},!0)},function(e,t,n){"use strict";for(var r=n(74),i=n(49),a=n(18),o=n(0),s=n(9),l=n(22),c=n(4),u=c("iterator"),d=c("toStringTag"),h=l.Array,p={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},f=i(p),m=0;m<f.length;m++){var g,v=f[m],y=p[v],b=o[v],w=b&&b.prototype;if(w&&(w[u]||s(w,u,h),w[d]||s(w,d,v),l[v]=h,y))for(g in r)w[g]||a(w,g,r[g],!0)}},function(e,t,n){"use strict";var r,i,a,o=n(12),s=n(123),l=n(71),c=n(42),u=n(0),d=u.process,h=u.setImmediate,p=u.clearImmediate,f=u.MessageChannel,m=u.Dispatch,g=0,v={},y=function(){var e=+this;if(v.hasOwnProperty(e)){var t=v[e];delete v[e],t()}},b=function(e){y.call(e.data)};h&&p||(h=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return v[++g]=function(){s("function"==typeof e?e:Function(e),t)},r(g),g},p=function(e){delete v[e]},"process"==n(30)(d)?r=function(e){d.nextTick(o(y,e,1))}:m&&m.now?r=function(e){m.now(o(y,e,1))}:f?(a=(i=new f).port2,i.port1.onmessage=b,r=o(a.postMessage,a,1)):u.addEventListener&&"function"==typeof postMessage&&!u.importScripts?(r=function(e){u.postMessage(e+"","*")},u.addEventListener("message",b,!1)):r="onreadystatechange"in c("script")?function(e){l.appendChild(c("script")).onreadystatechange=function(){l.removeChild(this),y.call(e)}}:function(e){setTimeout(o(y,e,1),0)}),e.exports={set:h,clear:p}},function(e,t,n){"use strict";e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},function(e,t,n){"use strict";var r=n(10),i=n(3),a=n(53);e.exports=function(e,t){if(r(e),i(t)&&t.constructor===e)return t;var n=a.f(e);return(0,n.resolve)(t),n.promise}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.build=t.version=t._UnsupportedManager=t.setPDFNetworkStreamClass=t.PDFPageProxy=t.PDFDocumentProxy=t.PDFWorker=t.PDFDataRangeTransport=t.LoopbackPort=t.getDocument=void 0;var r,i=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}}(),a="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(1),s=n(14),l=n(143),c=n(144),u=n(25),d=(r=u)&&r.__esModule?r:{default:r},h=n(86),p=n(147);var f,m=65536,g=!1,v=!1,y="undefined"!=typeof document&&document.currentScript?document.currentScript.src:null,b=null,w=!1;"undefined"==typeof window?(g=!0,void 0===require.ensure&&(require.ensure=require("node-ensure")),w=!0):"undefined"!=typeof require&&"function"==typeof require.ensure&&(w=!0),"undefined"!=typeof requirejs&&requirejs.toUrl&&(f=requirejs.toUrl("pdfjs-dist/build/pdf.worker.js"));var S,_="undefined"!=typeof requirejs&&requirejs.load;b=w?function(e){require.ensure([],function(){var t;t=require("./pdf.worker.js"),e(t.WorkerMessageHandler)})}:_?function(e){requirejs(["pdfjs-dist/build/pdf.worker"],function(t){e(t.WorkerMessageHandler)})}:null;var P,A=function(){var e=0;function t(){this._capability=(0,o.createPromiseCapability)(),this._transport=null,this._worker=null,this.docId="d"+e++,this.destroyed=!1,this.onPassword=null,this.onProgress=null,this.onUnsupportedFeature=null}return t.prototype={get promise(){return this._capability.promise},destroy:function(){var e=this;return this.destroyed=!0,(this._transport?this._transport.destroy():Promise.resolve()).then(function(){e._transport=null,e._worker&&(e._worker.destroy(),e._worker=null)})},then:function(e,t){return this.promise.then.apply(this.promise,arguments)}},t}(),k=function(){function e(e,t){this.length=e,this.initialData=t,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._readyCapability=(0,o.createPromiseCapability)()}return e.prototype={addRangeListener:function(e){this._rangeListeners.push(e)},addProgressListener:function(e){this._progressListeners.push(e)},addProgressiveReadListener:function(e){this._progressiveReadListeners.push(e)},onDataRange:function(e,t){for(var n=this._rangeListeners,r=0,i=n.length;r<i;++r)n[r](e,t)},onDataProgress:function(e){var t=this;this._readyCapability.promise.then(function(){for(var n=t._progressListeners,r=0,i=n.length;r<i;++r)n[r](e)})},onDataProgressiveRead:function(e){var t=this;this._readyCapability.promise.then(function(){for(var n=t._progressiveReadListeners,r=0,i=n.length;r<i;++r)n[r](e)})},transportReady:function(){this._readyCapability.resolve()},requestDataRange:function(e,t){throw new Error("Abstract method PDFDataRangeTransport.requestDataRange")},abort:function(){}},e}(),C=function(){function e(e,t,n){this.pdfInfo=e,this.transport=t,this.loadingTask=n}return e.prototype={get numPages(){return this.pdfInfo.numPages},get fingerprint(){return this.pdfInfo.fingerprint},getPage:function(e){return this.transport.getPage(e)},getPageIndex:function(e){return this.transport.getPageIndex(e)},getDestinations:function(){return this.transport.getDestinations()},getDestination:function(e){return this.transport.getDestination(e)},getPageLabels:function(){return this.transport.getPageLabels()},getPageMode:function(){return this.transport.getPageMode()},getAttachments:function(){return this.transport.getAttachments()},getJavaScript:function(){return this.transport.getJavaScript()},getOutline:function(){return this.transport.getOutline()},getMetadata:function(){return this.transport.getMetadata()},getData:function(){return this.transport.getData()},getDownloadInfo:function(){return this.transport.downloadInfoCapability.promise},getStats:function(){return this.transport.getStats()},cleanup:function(){this.transport.startCleanup()},destroy:function(){return this.loadingTask.destroy()}},e}(),x=function(){function e(e,t,n){this.pageIndex=e,this.pageInfo=t,this.transport=n,this.stats=new o.StatTimer,this.stats.enabled=(0,s.getDefaultSetting)("enableStats"),this.commonObjs=n.commonObjs,this.objs=new I,this.cleanupAfterRender=!1,this.pendingCleanup=!1,this.intentStates=Object.create(null),this.destroyed=!1,this.newStamps={},this.tempStamps={},this.textToSeals=[],this.prepareStamps={},this.newWatermark={},this.newDocSigns={},this.needRestore=!1}return e.prototype={get pageNumber(){return this.pageIndex+1},get rotate(){return this.pageInfo.rotate},get ref(){return this.pageInfo.ref},get userUnit(){return this.pageInfo.userUnit},get view(){return this.pageInfo.view},getViewport:function(e,t){return arguments.length<2&&(t=this.rotate),new o.PageViewport(this.view,e,t,0,0)},getAnnotations:function(e){var t=e&&e.intent||null;return this.annotationsPromise&&this.annotationsIntent===t||(this.annotationsPromise=this.transport.getAnnotations(this.pageIndex,t),this.annotationsIntent=t),this.annotationsPromise},render:function(e){var t=this,n=this.stats;n.time("Overall"),this.pendingCleanup=!1;var r="print"===e.intent?"print":"display",i=e.canvasFactory||new s.DOMCanvasFactory;this.intentStates[r]||(this.intentStates[r]=Object.create(null));var a=this.intentStates[r];"print"==r&&(this.reloadOperatorList=!0),a.displayReadyCapability&&!this.reloadOperatorList||(this.reloadOperatorList=!1,a.receivingOperatorList=!0,a.displayReadyCapability=(0,o.createPromiseCapability)(),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1},this.stats.time("Page Request"),this.transport.messageHandler.send("RenderPageRequest",{pageIndex:this.pageNumber-1,intent:r,delAnnotions:this.delAnnotions,delOFDSeal:this.delOFDSeal,needRestore:this.needRestore,disableTextAnnotation:this.disableTextAnnotation,disableDocSignAnnotation:this.disableDocSignAnnotation,renderInteractiveForms:!0===e.renderInteractiveForms}),this.needRestore=!1);var l=function(r){var i=a.renderTasks.indexOf(u);i>=0&&a.renderTasks.splice(i,1),t.cleanupAfterRender&&(t.pendingCleanup=!0),t._tryCleanup(),r?u.capability.reject(r):u.capability.resolve(),c(e),n.timeEnd("Rendering"),n.timeEnd("Overall")},c=function(n){var i=n.canvasContext;if("print"===r){var a=function(e,t,n){var r=e.querySelector("img"),a=e.style.width,o=e.style.height,s=a.substring(0,a.length-2)*t,l=o.substring(0,o.length-2)*t,c=e.style.left,u=e.style.top,d=c.substring(0,c.length-2)*t,h=u.substring(0,u.length-2)*t;i.globalCompositeOperation=n,i.globalCompositeOperation!==n&&(i.globalAlpha=.85),i.drawImage(r,d,h,s,l)},o=e.transform[0];for(var s in t.newStamps)a(t.newStamps[s],o,"multiply");for(var l in t.newDocSigns)a(t.newDocSigns[l],o,"source-over")}},u=new R(l,e,this.objs,this.commonObjs,a.operatorList,this.pageNumber,i);u.useRequestAnimationFrame="print"!==r,a.renderTasks||(a.renderTasks=[]),a.renderTasks.push(u);var d=u.task;return e.continueCallback&&((0,o.deprecated)("render is used with continueCallback parameter"),d.onContinue=e.continueCallback),a.displayReadyCapability.promise.then(function(e){t.pendingCleanup?l():(n.time("Rendering"),u.initializeGraphics(e),u.operatorListChanged())}).catch(l),d},getOperatorList:function(){this.intentStates.oplist||(this.intentStates.oplist=Object.create(null));var e,t=this.intentStates.oplist;return t.opListReadCapability||((e={}).operatorListChanged=function(){if(t.operatorList.lastChunk){t.opListReadCapability.resolve(t.operatorList);var n=t.renderTasks.indexOf(e);n>=0&&t.renderTasks.splice(n,1)}},t.receivingOperatorList=!0,t.opListReadCapability=(0,o.createPromiseCapability)(),t.renderTasks=[],t.renderTasks.push(e),t.operatorList={fnArray:[],argsArray:[],lastChunk:!1},this.transport.messageHandler.send("RenderPageRequest",{pageIndex:this.pageIndex,intent:"oplist"})),t.opListReadCapability.promise},streamTextContent:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this.pageNumber-1,normalizeWhitespace:!0===e.normalizeWhitespace,combineTextItems:!0!==e.disableCombineTextItems},{highWaterMark:100,size:function(e){return e.items.length}})},getTextContent:function(e){e=e||{};var t=this.streamTextContent(e);return new Promise(function(e,n){var r=t.getReader(),i={items:[],styles:Object.create(null)};!function t(){r.read().then(function(n){var r=n.value;n.done?e(i):(o.Util.extendObj(i.styles,r.styles),o.Util.appendToArray(i.items,r.items),t())},n)}()})},_destroy:function(){this.destroyed=!0,this.transport.pageCache[this.pageIndex]=null;var e=[];return Object.keys(this.intentStates).forEach(function(t){"oplist"!==t&&this.intentStates[t].renderTasks.forEach(function(t){var n=t.capability.promise.catch(function(){});e.push(n),t.cancel()})},this),this.objs.clear(),this.annotationsPromise=null,this.pendingCleanup=!1,Promise.all(e)},destroy:function(){(0,o.deprecated)("page destroy method, use cleanup() instead"),this.cleanup()},cleanup:function(){this.pendingCleanup=!0,this._tryCleanup()},_tryCleanup:function(){this.pendingCleanup&&!Object.keys(this.intentStates).some(function(e){var t=this.intentStates[e];return 0!==t.renderTasks.length||t.receivingOperatorList},this)&&(Object.keys(this.intentStates).forEach(function(e){delete this.intentStates[e]},this),this.objs.clear(),this.annotationsPromise=null,this.pendingCleanup=!1)},_startRenderPage:function(e,t){var n=this.intentStates[t];n.displayReadyCapability&&n.displayReadyCapability.resolve(e)},_renderPageChunk:function(e,t){var n,r,i=this.intentStates[t];for(n=0,r=e.length;n<r;n++)i.operatorList.fnArray.push(e.fnArray[n]),i.operatorList.argsArray.push(e.argsArray[n]);for(i.operatorList.lastChunk=e.lastChunk,n=0;n<i.renderTasks.length;n++)i.renderTasks[n].operatorListChanged();e.lastChunk&&(i.receivingOperatorList=!1,this._tryCleanup())}},e}(),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._listeners=[],this._defer=t,this._deferred=Promise.resolve(void 0)}return i(e,[{key:"postMessage",value:function(e,t){var n=this;if(this._defer){var r=new WeakMap,i={data:function e(n){if("object"!==(void 0===n?"undefined":a(n))||null===n)return n;if(r.has(n))return r.get(n);var i,s;if((s=n.buffer)&&(0,o.isArrayBuffer)(s)){var l=t&&t.indexOf(s)>=0;return i=n===s?n:l?new n.constructor(s,n.byteOffset,n.byteLength):new n.constructor(n),r.set(n,i),i}for(var c in i=Array.isArray(n)?[]:{},r.set(n,i),n){for(var u,d=n;!(u=Object.getOwnPropertyDescriptor(d,c));)d=Object.getPrototypeOf(d);void 0!==u.value&&"function"!=typeof u.value&&(i[c]=e(u.value))}return i}(e)};this._deferred.then(function(){n._listeners.forEach(function(e){e.call(this,i)},n)})}else this._listeners.forEach(function(t){t.call(this,{data:e})},this)}},{key:"addEventListener",value:function(e,t){this._listeners.push(t)}},{key:"removeEventListener",value:function(e,t){var n=this._listeners.indexOf(t);this._listeners.splice(n,1)}},{key:"terminate",value:function(){this._listeners=[]}}]),e}(),D=function(){var e=0;function t(){if(void 0!==f)return f;if((0,s.getDefaultSetting)("workerSrc"))return(0,s.getDefaultSetting)("workerSrc");if(y)return y.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2");throw new Error("No PDFJS.workerSrc specified")}var n=void 0;var r=new WeakMap;function i(e,t){if(t&&r.has(t))throw new Error("Cannot use more than one PDFWorker per port");if(this.name=e,this.destroyed=!1,this.postMessageTransfers=!0,this._readyCapability=(0,o.createPromiseCapability)(),this._port=null,this._webWorker=null,this._messageHandler=null,t)return r.set(t,this),void this._initializeFromPort(t);this._initialize()}return i.prototype={get promise(){return this._readyCapability.promise},get port(){return this._port},get messageHandler(){return this._messageHandler},_initializeFromPort:function(e){this._port=e,this._messageHandler=new o.MessageHandler("main","worker",e),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve()},_initialize:function(){var e,n,r=this;if(!g&&!(0,s.getDefaultSetting)("disableWorker")&&"undefined"!=typeof Worker){var i=t();try{(0,o.isSameOrigin)(window.location.href,i)||(e=new URL(i,window.location).href,n="importScripts('"+e+"');",i=URL.createObjectURL(new Blob([n])));var a=new Worker(i),l=new o.MessageHandler("main","worker",a),c=function(){a.removeEventListener("error",u),l.destroy(),a.terminate(),r.destroyed?r._readyCapability.reject(new Error("Worker was destroyed")):r._setupFakeWorker()},u=function(){r._webWorker||c()};a.addEventListener("error",u),l.on("test",function(e){(a.removeEventListener("error",u),r.destroyed)?c():e&&e.supportTypedArray?(r._messageHandler=l,r._port=a,r._webWorker=a,e.supportTransfers||(r.postMessageTransfers=!1,v=!0),r._readyCapability.resolve(),l.send("configure",{verbosity:(0,o.getVerbosityLevel)()})):(r._setupFakeWorker(),l.destroy(),a.terminate())}),l.on("console_log",function(e){console.log.apply(console,e)}),l.on("console_error",function(e){console.error.apply(console,e)}),l.on("ready",function(e){if(a.removeEventListener("error",u),r.destroyed)c();else try{d()}catch(e){r._setupFakeWorker()}});var d=function(){var e=(0,s.getDefaultSetting)("postMessageTransfers")&&!v,t=new Uint8Array([e?255:0]);try{l.send("test",t,[t.buffer])}catch(e){(0,o.info)("Cannot use postMessage transfers"),t[0]=0,l.send("test",t)}};return void d()}catch(e){(0,o.info)("The worker has been disabled.")}}this._setupFakeWorker()},_setupFakeWorker:function(){var r=this;g||(0,s.getDefaultSetting)("disableWorker")||((0,o.warn)("Setting up fake worker."),g=!0),(n?n.promise:(n=(0,o.createPromiseCapability)(),(b||function(e){o.Util.loadScript(t(),function(){e(window.pdfjsDistBuildPdfWorker.WorkerMessageHandler)})})(n.resolve),n.promise)).then(function(t){if(r.destroyed)r._readyCapability.reject(new Error("Worker was destroyed"));else{var n=Uint8Array!==Float32Array,i=new T(n);r._port=i;var a="fake"+e++,s=new o.MessageHandler(a+"_worker",a,i);t.setup(s,i);var l=new o.MessageHandler(a,a+"_worker",i);r._messageHandler=l,r._readyCapability.resolve()}})},destroy:function(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),r.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}},i.fromPort=function(e){return r.has(e)?r.get(e):new i(null,e)},i}(),E=function(){function e(e,t,n,r){this.messageHandler=e,this.loadingTask=t,this.commonObjs=new I,this.fontLoader=new l.FontLoader(t.docId),this.CMapReaderFactory=new r({baseUrl:(0,s.getDefaultSetting)("cMapUrl"),isCompressed:(0,s.getDefaultSetting)("cMapPacked")}),this.destroyed=!1,this.destroyCapability=null,this._passwordCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.pageCache=[],this.pagePromises=[],this.downloadInfoCapability=(0,o.createPromiseCapability)(),this.setupMessageHandler()}return e.prototype={destroy:function(){var e=this;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=(0,o.createPromiseCapability)(),this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));var t=[];this.pageCache.forEach(function(e){e&&t.push(e._destroy())}),this.pageCache=[],this.pagePromises=[];var n=this.messageHandler.sendWithPromise("Terminate",null);return t.push(n),Promise.all(t).then(function(){e.fontLoader.clear(),e._networkStream&&e._networkStream.cancelAllRequests(),e.messageHandler&&(e.messageHandler.destroy(),e.messageHandler=null),e.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise},setupMessageHandler:function(){var e=this.messageHandler,t=this.loadingTask;e.on("GetReader",function(e,t){var n=this;(0,o.assert)(this._networkStream),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=function(e){n._lastProgress={loaded:e.loaded,total:e.total}},t.onPull=function(){n._fullReader.read().then(function(e){var n=e.value;e.done?t.close():((0,o.assert)((0,o.isArrayBuffer)(n)),t.enqueue(new Uint8Array(n),1,[n]))}).catch(function(e){t.error(e)})},t.onCancel=function(e){n._fullReader.cancel(e)}},this),e.on("ReaderHeadersReady",function(e){var t=this,n=(0,o.createPromiseCapability)(),r=this._fullReader;return r.headersReady.then(function(){if(!r.isStreamingSupported||!r.isRangeSupported){if(t._lastProgress){var e=t.loadingTask;e.onProgress&&e.onProgress(t._lastProgress)}r.onProgress=function(e){var n=t.loadingTask;n.onProgress&&n.onProgress({loaded:e.loaded,total:e.total})}}n.resolve({isStreamingSupported:r.isStreamingSupported,isRangeSupported:r.isRangeSupported,contentLength:r.contentLength})},n.reject),n.promise},this),e.on("GetRangeReader",function(e,t){(0,o.assert)(this._networkStream);var n=this._networkStream.getRangeReader(e.begin,e.end);t.onPull=function(){n.read().then(function(e){var n=e.value;e.done?t.close():((0,o.assert)((0,o.isArrayBuffer)(n)),t.enqueue(new Uint8Array(n),1,[n]))}).catch(function(e){t.error(e)})},t.onCancel=function(e){n.cancel(e)}},this),e.on("GetDoc",function(e){var t=e.pdfInfo;this.numPages=e.pdfInfo.numPages;var n=this.loadingTask,r=new C(t,this,n);this.pdfDocument=r,n._capability.resolve(r)},this),e.on("PasswordRequest",function(e){var n=this;if(this._passwordCapability=(0,o.createPromiseCapability)(),t.onPassword){t.onPassword(function(e){n._passwordCapability.resolve({password:e})},e.code)}else this._passwordCapability.reject(new o.PasswordException(e.message,e.code));return this._passwordCapability.promise},this),e.on("PasswordException",function(e){t._capability.reject(new o.PasswordException(e.message,e.code))},this),e.on("InvalidPDF",function(e){this.loadingTask._capability.reject(new o.InvalidPDFException(e.message))},this),e.on("MissingPDF",function(e){this.loadingTask._capability.reject(new o.MissingPDFException(e.message))},this),e.on("UnexpectedResponse",function(e){this.loadingTask._capability.reject(new o.UnexpectedResponseException(e.message,e.status))},this),e.on("UnknownError",function(e){this.loadingTask._capability.reject(new o.UnknownErrorException(e.message,e.details))},this),e.on("DataLoaded",function(e){this.downloadInfoCapability.resolve(e)},this),e.on("PDFManagerReady",function(e){},this),e.on("StartRenderPage",function(e){if(!this.destroyed){var t=this.pageCache[e.pageIndex];t.stats.timeEnd("Page Request"),t._startRenderPage(e.transparency,e.intent)}},this),e.on("RenderPageChunk",function(e){this.destroyed||this.pageCache[e.pageIndex]._renderPageChunk(e.operatorList,e.intent)},this),e.on("commonobj",function(e){var t=this;if(!this.destroyed){var n=e[0],r=e[1];if(!this.commonObjs.hasData(n))switch(r){case"Font":var i=e[2];if("error"in i){var a=i.error;(0,o.warn)("Error during font loading: "+a),this.commonObjs.resolve(n,a);break}var c=null;(0,s.getDefaultSetting)("pdfBug")&&d.default.FontInspector&&d.default.FontInspector.enabled&&(c={registerFont:function(e,t){d.default.FontInspector.fontAdded(e,t)}});var u=new l.FontFaceObject(i,{isEvalSupported:(0,s.getDefaultSetting)("isEvalSupported"),disableFontFace:(0,s.getDefaultSetting)("disableFontFace"),fontRegistry:c});this.fontLoader.bind([u],function(e){t.commonObjs.resolve(n,u)});break;case"FontPath":this.commonObjs.resolve(n,e[2]);break;default:throw new Error("Got unknown common object type "+r)}}},this),e.on("obj",function(e){if(!this.destroyed){var t,n=e[0],r=e[1],i=e[2],a=this.pageCache[r];if(!a.objs.hasData(n))switch(i){case"JpegStream":t=e[3],(0,o.loadJpegStream)(n,t,a.objs);break;case"Image":t=e[3],a.objs.resolve(n,t);t&&"data"in t&&t.data.length>8e6&&(a.cleanupAfterRender=!0);break;default:throw new Error("Got unknown object type "+i)}}},this),e.on("DocProgress",function(e){if(!this.destroyed){var t=this.loadingTask;t.onProgress&&t.onProgress({loaded:e.loaded,total:e.total})}},this),e.on("PageError",function(e){if(!this.destroyed){var t=this.pageCache[e.pageNum-1].intentStates[e.intent];if(!t.displayReadyCapability)throw new Error(e.error);if(t.displayReadyCapability.reject(e.error),t.operatorList){t.operatorList.lastChunk=!0;for(var n=0;n<t.renderTasks.length;n++)t.renderTasks[n].operatorListChanged()}}},this),e.on("UnsupportedFeature",function(e){if(!this.destroyed){var t=e.featureId,n=this.loadingTask;n.onUnsupportedFeature&&n.onUnsupportedFeature(t),M.notify(t)}},this),e.on("JpegDecode",function(e){if(this.destroyed)return Promise.reject(new Error("Worker was destroyed"));if("undefined"==typeof document)return Promise.reject(new Error('"document" is not defined.'));var t=e[0],n=e[1];return 3!==n&&1!==n?Promise.reject(new Error("Only 3 components or 1 component can be returned")):new Promise(function(e,r){var i=new Image;i.onload=function(){var t=i.width,r=i.height,a=t*r,o=4*a,s=new Uint8Array(a*n),l=document.createElement("canvas");l.width=t,l.height=r;var c=l.getContext("2d");c.drawImage(i,0,0);var u,d,h=c.getImageData(0,0,t,r).data;if(3===n)for(u=0,d=0;u<o;u+=4,d+=3)s[d]=h[u],s[d+1]=h[u+1],s[d+2]=h[u+2];else if(1===n)for(u=0,d=0;u<o;u+=4,d++)s[d]=h[u];e({data:s,width:t,height:r})},i.onerror=function(){r(new Error("JpegDecode failed to load image"))},i.src=t})},this),e.on("FetchBuiltInCMap",function(e){return this.destroyed?Promise.reject(new Error("Worker was destroyed")):this.CMapReaderFactory.fetch({name:e.name})},this)},getData:function(){return this.messageHandler.sendWithPromise("GetData",null)},getPage:function(e,t){var n=this;if(!Number.isInteger(e)||e<=0||e>this.numPages)return Promise.reject(new Error("Invalid page request"));var r=e-1;if(r in this.pagePromises)return this.pagePromises[r];var i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:r}).then(function(e){if(n.destroyed)throw new Error("Transport destroyed");var t=new x(r,e,n);return n.pageCache[r]=t,t});return this.pagePromises[r]=i,i},getPageIndex:function(e){return this.messageHandler.sendWithPromise("GetPageIndex",{ref:e}).catch(function(e){return Promise.reject(new Error(e))})},getAnnotations:function(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})},getDestinations:function(){return this.messageHandler.sendWithPromise("GetDestinations",null)},getDestination:function(e){return this.messageHandler.sendWithPromise("GetDestination",{id:e})},getPageLabels:function(){return this.messageHandler.sendWithPromise("GetPageLabels",null)},getPageMode:function(){return this.messageHandler.sendWithPromise("GetPageMode",null)},getAttachments:function(){return this.messageHandler.sendWithPromise("GetAttachments",null)},getJavaScript:function(){return this.messageHandler.sendWithPromise("GetJavaScript",null)},getOutline:function(){return this.messageHandler.sendWithPromise("GetOutline",null)},getMetadata:function(){return this.messageHandler.sendWithPromise("GetMetadata",null).then(function(e){return{info:e[0],metadata:e[1]?new h.Metadata(e[1]):null}})},getStats:function(){return this.messageHandler.sendWithPromise("GetStats",null)},startCleanup:function(){var e=this;this.messageHandler.sendWithPromise("Cleanup",null).then(function(){for(var t=0,n=e.pageCache.length;t<n;t++){var r=e.pageCache[t];r&&r.cleanup()}e.commonObjs.clear(),e.fontLoader.clear()})}},e}(),I=function(){function e(){this.objs=Object.create(null)}return e.prototype={ensureObj:function(e){if(this.objs[e])return this.objs[e];var t={capability:(0,o.createPromiseCapability)(),data:null,resolved:!1};return this.objs[e]=t,t},get:function(e,t){if(t)return this.ensureObj(e).capability.promise.then(t),null;var n=this.objs[e];if(!n||!n.resolved)throw new Error("Requesting object that isn't resolved yet "+e);return n.data},resolve:function(e,t){var n=this.ensureObj(e);n.resolved=!0,n.data=t,n.capability.resolve(t)},isResolved:function(e){var t=this.objs;return!!t[e]&&t[e].resolved},hasData:function(e){return this.isResolved(e)},getData:function(e){var t=this.objs;return t[e]&&t[e].resolved?t[e].data:null},clear:function(){this.objs=Object.create(null)}},e}(),O=function(){function e(e){this._internalRenderTask=e,this.onContinue=null}return e.prototype={get promise(){return this._internalRenderTask.capability.promise},cancel:function(){this._internalRenderTask.cancel()},then:function(e,t){return this.promise.then.apply(this.promise,arguments)}},e}(),R=function(){var e=new WeakMap;function t(e,t,n,r,i,a,s){this.callback=e,this.params=t,this.objs=n,this.commonObjs=r,this.operatorListIdx=null,this.operatorList=i,this.pageNumber=a,this.canvasFactory=s,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this.useRequestAnimationFrame=!1,this.cancelled=!1,this.capability=(0,o.createPromiseCapability)(),this.task=new O(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvasContext.canvas}return t.prototype={initializeGraphics:function(t){if(this._canvas){if(e.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");e.set(this._canvas,this)}if(!this.cancelled){(0,s.getDefaultSetting)("pdfBug")&&d.default.StepperManager&&d.default.StepperManager.enabled&&(this.stepper=d.default.StepperManager.create(this.pageNumber-1),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());var n=this.params;this.gfx=new c.CanvasGraphics(n.canvasContext,this.commonObjs,this.objs,this.canvasFactory,n.imageLayer),this.gfx.beginDrawing({transform:n.transform,viewport:n.viewport,transparency:t,background:n.background}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback&&this.graphicsReadyCallback()}},cancel:function(){this.running=!1,this.cancelled=!0,this._canvas&&e.delete(this._canvas),(0,s.getDefaultSetting)("pdfjsNext")?this.callback(new s.RenderingCancelledException("Rendering cancelled, page "+this.pageNumber,"canvas")):this.callback("cancelled")},operatorListChanged:function(){this.graphicsReady?(this.stepper&&this.stepper.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)},_continue:function(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())},_scheduleNext:function(){this.useRequestAnimationFrame&&"undefined"!=typeof window?window.requestAnimationFrame(this._nextBound):Promise.resolve(void 0).then(this._nextBound)},_next:function(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),this._canvas&&e.delete(this._canvas),this.callback())))}},t}(),M=(P=[],{listen:function(e){(0,o.deprecated)("Global UnsupportedManager.listen is used: use PDFDocumentLoadingTask.onUnsupportedFeature instead"),P.push(e)},notify:function(e){for(var t=0,n=P.length;t<n;t++)P[t](e)}});t.version="1.10.0",t.build="d08dce4",t.getDocument=function(e,t,n,r){var i,l=new A;if(arguments.length>1&&(0,o.deprecated)("getDocument is called with pdfDataRangeTransport, passwordCallback or progressCallback argument"),t&&(t instanceof k||((t=Object.create(t)).length=e.length,t.initialData=e.initialData,t.abort||(t.abort=function(){})),(e=Object.create(e)).range=t),l.onPassword=n||null,l.onProgress=r||null,"string"==typeof e)i={url:e};else if((0,o.isArrayBuffer)(e))i={data:e};else if(e instanceof k)i={range:e};else{if("object"!==(void 0===e?"undefined":a(e)))throw new Error("Invalid parameter in getDocument, need either Uint8Array, string or a parameter object");if(!e.url&&!e.data&&!e.range)throw new Error("Invalid parameter object: need either .data, .range or .url");i=e}var c={},u=null,d=null,h=s.DOMCMapReaderFactory;for(var f in i)if("url"!==f||"undefined"==typeof window)if("range"!==f)if("worker"!==f)if("data"!==f||i[f]instanceof Uint8Array)"CMapReaderFactory"!==f?c[f]=i[f]:h=i[f];else{var g=i[f];if("string"==typeof g)c[f]=(0,o.stringToBytes)(g);else if("object"!==(void 0===g?"undefined":a(g))||null===g||isNaN(g.length)){if(!(0,o.isArrayBuffer)(g))throw new Error("Invalid PDF binary data: either typed array, string or array-like object is expected in the data property.");c[f]=new Uint8Array(g)}else c[f]=new Uint8Array(g)}else d=i[f];else u=i[f];else c[f]=new URL(i[f],window.location).href;if(c.rangeChunkSize=c.rangeChunkSize||m,c.ignoreErrors=!0!==c.stopAtErrors,void 0!==c.disableNativeImageDecoder&&(0,o.deprecated)("parameter disableNativeImageDecoder, use nativeImageDecoderSupport instead"),c.nativeImageDecoderSupport=c.nativeImageDecoderSupport||(!0===c.disableNativeImageDecoder?o.NativeImageDecoding.NONE:o.NativeImageDecoding.DECODE),c.nativeImageDecoderSupport!==o.NativeImageDecoding.DECODE&&c.nativeImageDecoderSupport!==o.NativeImageDecoding.NONE&&c.nativeImageDecoderSupport!==o.NativeImageDecoding.DISPLAY&&((0,o.warn)("Invalid parameter nativeImageDecoderSupport: need a state of enum {NativeImageDecoding}"),c.nativeImageDecoderSupport=o.NativeImageDecoding.DECODE),!d){var y=(0,s.getDefaultSetting)("workerPort");d=y?D.fromPort(y):new D,l._worker=d}var b=l.docId;return d.promise.then(function(){if(l.destroyed)throw new Error("Loading aborted");return function(e,t,n,r){return e.destroyed?Promise.reject(new Error("Worker was destroyed")):(t.disableAutoFetch=(0,s.getDefaultSetting)("disableAutoFetch"),t.disableStream=(0,s.getDefaultSetting)("disableStream"),t.chunkedViewerLoading=!!n,n&&(t.length=n.length,t.initialData=n.initialData),e.messageHandler.sendWithPromise("GetDocRequest",{docId:r,apiVersion:"1.10.0",source:{data:t.data,url:t.url,password:t.password,disableAutoFetch:t.disableAutoFetch,rangeChunkSize:t.rangeChunkSize,length:t.length},maxImageSize:(0,s.getDefaultSetting)("maxImageSize"),disableFontFace:(0,s.getDefaultSetting)("disableFontFace"),disableCreateObjectURL:(0,s.getDefaultSetting)("disableCreateObjectURL"),postMessageTransfers:(0,s.getDefaultSetting)("postMessageTransfers")&&!v,docBaseUrl:t.docBaseUrl,nativeImageDecoderSupport:t.nativeImageDecoderSupport,ignoreErrors:t.ignoreErrors,isEvalSupported:(0,s.getDefaultSetting)("isEvalSupported")}).then(function(t){if(e.destroyed)throw new Error("Worker was destroyed");return t}))}(d,c,u,b).then(function(e){if(l.destroyed)throw new Error("Loading aborted");var t=void 0;u?t=new p.PDFDataTransportStream(c,u):c.data||(t=new S({source:c,disableRange:(0,s.getDefaultSetting)("disableRange")}));var n=new o.MessageHandler(b,e,d.port);n.postMessageTransfers=d.postMessageTransfers;var r=new E(n,l,t,h);l._transport=r,n.send("Ready",null)})}).catch(l._capability.reject),l},t.LoopbackPort=T,t.PDFDataRangeTransport=k,t.PDFWorker=D,t.PDFDocumentProxy=C,t.PDFPageProxy=x,t.setPDFNetworkStreamClass=function(e){S=e},t._UnsupportedManager=M,t.version="1.10.0",t.build="d08dce4"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebGLUtils=void 0;var r=n(14),i=n(1),a=function(){function e(e,t,n){var r=e.createShader(n);if(e.shaderSource(r,t),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS)){var i=e.getShaderInfoLog(r);throw new Error("Error during shader compilation: "+i)}return r}function t(t,n){return e(t,n,t.VERTEX_SHADER)}function n(t,n){return e(t,n,t.FRAGMENT_SHADER)}function a(e,t){for(var n=e.createProgram(),r=0,i=t.length;r<i;++r)e.attachShader(n,t[r]);if(e.linkProgram(n),!e.getProgramParameter(n,e.LINK_STATUS)){var a=e.getProgramInfoLog(n);throw new Error("Error during program linking: "+a)}return n}function o(e,t,n){e.activeTexture(n);var r=e.createTexture();return e.bindTexture(e.TEXTURE_2D,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),r}var s,l;function c(){s||(l=document.createElement("canvas"),s=l.getContext("webgl",{premultipliedalpha:!1}))}var u=" attribute vec2 a_position; attribute vec2 a_texCoord; uniform vec2 u_resolution; varying vec2 v_texCoord; void main() { vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0; gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); v_texCoord = a_texCoord; } ",d=" precision mediump float; uniform vec4 u_backdrop; uniform int u_subtype; uniform sampler2D u_image; uniform sampler2D u_mask; varying vec2 v_texCoord; void main() { vec4 imageColor = texture2D(u_image, v_texCoord); vec4 maskColor = texture2D(u_mask, v_texCoord); if (u_backdrop.a > 0.0) { maskColor.rgb = maskColor.rgb * maskColor.a + u_backdrop.rgb * (1.0 - maskColor.a); } float lum; if (u_subtype == 0) { lum = maskColor.a; } else { lum = maskColor.r * 0.3 + maskColor.g * 0.59 + maskColor.b * 0.11; } imageColor.a *= lum; imageColor.rgb *= imageColor.a; gl_FragColor = imageColor; } ",h=null;var p=" attribute vec2 a_position; attribute vec3 a_color; uniform vec2 u_resolution; uniform vec2 u_scale; uniform vec2 u_offset; varying vec4 v_color; void main() { vec2 position = (a_position + u_offset) * u_scale; vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); v_color = vec4(a_color / 255.0, 1.0); } ",f=" precision mediump float; varying vec4 v_color; void main() { gl_FragColor = v_color; } ",m=null;return{get isEnabled(){if((0,r.getDefaultSetting)("disableWebGL"))return!1;var e=!1;try{c(),e=!!s}catch(e){}return(0,i.shadow)(this,"isEnabled",e)},composeSMask:function(e,r,i){var p=e.width,f=e.height;h||function(){var e,r;c(),e=l,l=null,r=s,s=null;var i=a(r,[t(r,u),n(r,d)]);r.useProgram(i);var o={};o.gl=r,o.canvas=e,o.resolutionLocation=r.getUniformLocation(i,"u_resolution"),o.positionLocation=r.getAttribLocation(i,"a_position"),o.backdropLocation=r.getUniformLocation(i,"u_backdrop"),o.subtypeLocation=r.getUniformLocation(i,"u_subtype");var p=r.getAttribLocation(i,"a_texCoord"),f=r.getUniformLocation(i,"u_image"),m=r.getUniformLocation(i,"u_mask"),g=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,g),r.bufferData(r.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),r.STATIC_DRAW),r.enableVertexAttribArray(p),r.vertexAttribPointer(p,2,r.FLOAT,!1,0,0),r.uniform1i(f,0),r.uniform1i(m,1),h=o}();var m=h,g=m.canvas,v=m.gl;g.width=p,g.height=f,v.viewport(0,0,v.drawingBufferWidth,v.drawingBufferHeight),v.uniform2f(m.resolutionLocation,p,f),i.backdrop?v.uniform4f(m.resolutionLocation,i.backdrop[0],i.backdrop[1],i.backdrop[2],1):v.uniform4f(m.resolutionLocation,0,0,0,0),v.uniform1i(m.subtypeLocation,"Luminosity"===i.subtype?1:0);var y=o(v,e,v.TEXTURE0),b=o(v,r,v.TEXTURE1),w=v.createBuffer();return v.bindBuffer(v.ARRAY_BUFFER,w),v.bufferData(v.ARRAY_BUFFER,new Float32Array([0,0,p,0,0,f,0,f,p,0,p,f]),v.STATIC_DRAW),v.enableVertexAttribArray(m.positionLocation),v.vertexAttribPointer(m.positionLocation,2,v.FLOAT,!1,0,0),v.clearColor(0,0,0,0),v.enable(v.BLEND),v.blendFunc(v.ONE,v.ONE_MINUS_SRC_ALPHA),v.clear(v.COLOR_BUFFER_BIT),v.drawArrays(v.TRIANGLES,0,6),v.flush(),v.deleteTexture(y),v.deleteTexture(b),v.deleteBuffer(w),g},drawFigures:function(e,r,i,o,u){m||function(){var e,r;c(),e=l,l=null,r=s,s=null;var i=a(r,[t(r,p),n(r,f)]);r.useProgram(i);var o={};o.gl=r,o.canvas=e,o.resolutionLocation=r.getUniformLocation(i,"u_resolution"),o.scaleLocation=r.getUniformLocation(i,"u_scale"),o.offsetLocation=r.getUniformLocation(i,"u_offset"),o.positionLocation=r.getAttribLocation(i,"a_position"),o.colorLocation=r.getAttribLocation(i,"a_color"),m=o}();var d=m,h=d.canvas,g=d.gl;h.width=e,h.height=r,g.viewport(0,0,g.drawingBufferWidth,g.drawingBufferHeight),g.uniform2f(d.resolutionLocation,e,r);var v,y,b,w=0;for(v=0,y=o.length;v<y;v++)switch(o[v].type){case"lattice":w+=((b=o[v].coords.length/o[v].verticesPerRow|0)-1)*(o[v].verticesPerRow-1)*6;break;case"triangles":w+=o[v].coords.length}var S=new Float32Array(2*w),_=new Uint8Array(3*w),P=u.coords,A=u.colors,k=0,C=0;for(v=0,y=o.length;v<y;v++){var x=o[v],T=x.coords,D=x.colors;switch(x.type){case"lattice":var E=x.verticesPerRow;b=T.length/E|0;for(var I=1;I<b;I++)for(var O=I*E+1,R=1;R<E;R++,O++)S[k]=P[T[O-E-1]],S[k+1]=P[T[O-E-1]+1],S[k+2]=P[T[O-E]],S[k+3]=P[T[O-E]+1],S[k+4]=P[T[O-1]],S[k+5]=P[T[O-1]+1],_[C]=A[D[O-E-1]],_[C+1]=A[D[O-E-1]+1],_[C+2]=A[D[O-E-1]+2],_[C+3]=A[D[O-E]],_[C+4]=A[D[O-E]+1],_[C+5]=A[D[O-E]+2],_[C+6]=A[D[O-1]],_[C+7]=A[D[O-1]+1],_[C+8]=A[D[O-1]+2],S[k+6]=S[k+2],S[k+7]=S[k+3],S[k+8]=S[k+4],S[k+9]=S[k+5],S[k+10]=P[T[O]],S[k+11]=P[T[O]+1],_[C+9]=_[C+3],_[C+10]=_[C+4],_[C+11]=_[C+5],_[C+12]=_[C+6],_[C+13]=_[C+7],_[C+14]=_[C+8],_[C+15]=A[D[O]],_[C+16]=A[D[O]+1],_[C+17]=A[D[O]+2],k+=12,C+=18;break;case"triangles":for(var M=0,W=T.length;M<W;M++)S[k]=P[T[M]],S[k+1]=P[T[M]+1],_[C]=A[D[M]],_[C+1]=A[D[M]+1],_[C+2]=A[D[M]+2],k+=2,C+=3}}i?g.clearColor(i[0]/255,i[1]/255,i[2]/255,1):g.clearColor(0,0,0,0),g.clear(g.COLOR_BUFFER_BIT);var L=g.createBuffer();g.bindBuffer(g.ARRAY_BUFFER,L),g.bufferData(g.ARRAY_BUFFER,S,g.STATIC_DRAW),g.enableVertexAttribArray(d.positionLocation),g.vertexAttribPointer(d.positionLocation,2,g.FLOAT,!1,0,0);var N=g.createBuffer();return g.bindBuffer(g.ARRAY_BUFFER,N),g.bufferData(g.ARRAY_BUFFER,_,g.STATIC_DRAW),g.enableVertexAttribArray(d.colorLocation),g.vertexAttribPointer(d.colorLocation,3,g.UNSIGNED_BYTE,!1,0,0),g.uniform2f(d.scaleLocation,u.scaleX,u.scaleY),g.uniform2f(d.offsetLocation,u.offsetX,u.offsetY),g.drawArrays(g.TRIANGLES,0,w),g.flush(),g.deleteBuffer(L),g.deleteBuffer(N),h},clear:function(){h&&h.canvas&&(h.canvas.width=0,h.canvas.height=0),m&&m.canvas&&(m.canvas.width=0,m.canvas.height=0),h=null,m=null}}}();t.WebGLUtils=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=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}}(),i=n(1),a=n(146);var o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,i.assert)("string"==typeof t,"Metadata: input is not a string"),t=this._repair(t);var n=(new a.SimpleXMLParser).parseFromString(t);this._metadata=Object.create(null),n&&this._parse(n)}return r(e,[{key:"_repair",value:function(e){return e.replace(/>\\376\\377([^<]+)/g,function(e,t){for(var n=t.replace(/\\([0-3])([0-7])([0-7])/g,function(e,t,n,r){return String.fromCharCode(64*t+8*n+1*r)}),r="",i=0,a=n.length;i<a;i+=2){var o=256*n.charCodeAt(i)+n.charCodeAt(i+1);r+=o>=32&&o<127&&60!==o&&62!==o&&38!==o?String.fromCharCode(o):"&#x"+(65536+o).toString(16).substring(1)+";"}return">"+r})}},{key:"_parse",value:function(e){var t=e.documentElement;if("rdf:rdf"!==t.nodeName.toLowerCase())for(t=t.firstChild;t&&"rdf:rdf"!==t.nodeName.toLowerCase();)t=t.nextSibling;var n=t?t.nodeName.toLowerCase():null;if(t&&"rdf:rdf"===n&&t.hasChildNodes())for(var r=t.childNodes,i=0,a=r.length;i<a;i++){var o=r[i];if("rdf:description"===o.nodeName.toLowerCase())for(var s=0,l=o.childNodes.length;s<l;s++)if("#text"!==o.childNodes[s].nodeName.toLowerCase()){var c=o.childNodes[s],u=c.nodeName.toLowerCase();this._metadata[u]=c.textContent.trim()}}}},{key:"get",value:function(e){return this._metadata[e]||null}},{key:"getAll",value:function(){return this._metadata}},{key:"has",value:function(e){return void 0!==this._metadata[e]}},{key:"metadata",get:function(){return(0,i.deprecated)("`metadata` getter; use `getAll()` instead."),this.getAll()}}]),e}();t.Metadata=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PopupElement=t.AnnotationLayer=void 0;var r=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=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}}(),a=n(14),o=n(1),s=n(56),l=n(5);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 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):e.__proto__=t)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var h=function(){function e(){d(this,e)}return i(e,null,[{key:"create",value:function(e){switch(e.data.annotationType){case o.AnnotationType.LINK:return new m(e);case o.AnnotationType.TEXT:return new g(e);case o.AnnotationType.WIDGET:switch(e.data.fieldType){case"Tx":return new y(e);case"Btn":if(e.data.radioButton)return new w(e);if(e.data.checkBox)return new b(e);(0,o.warn)("Unimplemented button widget annotation: pushbutton");break;case"Ch":return new S(e)}return new v(e);case o.AnnotationType.POPUP:return new _(e);case o.AnnotationType.LINE:return new A(e);case o.AnnotationType.SQUARE:return new k(e);case o.AnnotationType.CIRCLE:return new C(e);case o.AnnotationType.POLYLINE:return new x(e);case o.AnnotationType.POLYGON:return new T(e);case o.AnnotationType.HIGHLIGHT:return new D(e);case o.AnnotationType.UNDERLINE:return new E(e);case o.AnnotationType.SQUIGGLY:return new I(e);case o.AnnotationType.STRIKEOUT:return new O(e);case o.AnnotationType.STAMP:return new R(e);case o.AnnotationType.FILEATTACHMENT:return new M(e);case"prepareStamp":return new f(e);default:return new p(e)}}}]),e}(),p=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];d(this,e),this.isRenderable=n,this.data=t.data,this.layer=t.layer,this.page=t.page,this.pdfPageView=t.pdfPageView,this.viewport=t.viewport,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderInteractiveForms=t.renderInteractiveForms,this.svgFactory=t.svgFactory,"GoldGrid:AddSeal"!==this.data.subtype&&"Sig"!==this.data.fieldType||(this.isRenderable=!0),this.isRenderable&&(this.container=this._createContainer(r))}return i(e,[{key:"_createContainer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.data,n=this.page,r=this.viewport,i=document.createElement("section"),s=t.rect[2]-t.rect[0],l=t.rect[3]-t.rect[1];i.setAttribute("data-annotation-id",t.id),i.setAttribute("data-goldGridSeal-id",t.goldGridSealId);var c=o.Util.normalizeRect([t.rect[0],n.view[3]-t.rect[1]+n.view[1],t.rect[2],n.view[3]-t.rect[3]+n.view[1]]);if(a.CustomStyle.setProp("transform",i,"matrix("+r.transform.join(",")+")"),a.CustomStyle.setProp("transformOrigin",i,-c[0]+"px "+-c[1]+"px"),!e&&t.borderStyle.width>0){i.style.borderWidth=t.borderStyle.width+"px",t.borderStyle.style!==o.AnnotationBorderStyleType.UNDERLINE&&(s-=2*t.borderStyle.width,l-=2*t.borderStyle.width);var u=t.borderStyle.horizontalCornerRadius,d=t.borderStyle.verticalCornerRadius;if(u>0||d>0){var h=u+"px / "+d+"px";a.CustomStyle.setProp("borderRadius",i,h)}switch(t.borderStyle.style){case o.AnnotationBorderStyleType.SOLID:i.style.borderStyle="solid";break;case o.AnnotationBorderStyleType.DASHED:i.style.borderStyle="dashed";break;case o.AnnotationBorderStyleType.BEVELED:(0,o.warn)("Unimplemented border style: beveled");break;case o.AnnotationBorderStyleType.INSET:(0,o.warn)("Unimplemented border style: inset");break;case o.AnnotationBorderStyleType.UNDERLINE:i.style.borderBottomStyle="solid"}t.color?i.style.borderColor=o.Util.makeCssRgb(0|t.color[0],0|t.color[1],0|t.color[2]):i.style.borderWidth=0}return i.style.left=c[0]+"px",i.style.top=c[1]+"px","Stamp"===t.subtype?(i.style.width=s-1+"px",i.style.height=l-1+"px"):(i.style.width=s+"px",i.style.height=l+"px"),i}},{key:"_createPopup",value:function(e,t,n){t||((t=document.createElement("div")).style.height=e.style.height,t.style.width=e.style.width,e.appendChild(t));var r=new P({container:e,trigger:t,color:n.color,title:n.title,contents:n.contents,hideWrapper:!0,viewport:this.viewport}).render();r.style.left=e.style.width,e.appendChild(r)}},{key:"render",value:function(){var e=this.pdfPageView.div,t=(e.querySelector(".canvasWrapper"),e.querySelector(".textLayer"),this.layer,this.container),n=this.container.style.width,r=this.container.style.height,i=(0,s.createSealNode)(this.page,this.pdfPageView,t,n,r,this);return this.container.appendChild(i),this.container}}]),e}(),f=function(e){function t(e){return d(this,t),c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,(0,l.functionalJudgment)("prepareStamp")))}return u(t,p),i(t,[{key:"render",value:function(){return this.container.className="stampAnnotation",window.KGPdfViewerWebApp.mobile?(this.container.addEventListener("touchstart",window.KGPdfViewerWebApp.PDFViewerApplication.KGPrepareStamp.pressStart),this.container.addEventListener("touchmove",window.KGPdfViewerWebApp.PDFViewerApplication.KGPrepareStamp.pressEnd),this.container.addEventListener("touchend",window.KGPdfViewerWebApp.PDFViewerApplication.KGPrepareStamp.pressEnd)):this.container.addEventListener("contextmenu",window.KGPdfViewerWebApp.PDFViewerApplication.KGPrepareStamp.createRightMenu),this.container}}]),t}(),m=function(e){function t(e){d(this,t);var n=!!(e.data.url||e.data.dest||e.data.action);return c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n))}return u(t,p),i(t,[{key:"render",value:function(){this.container.className="linkAnnotation";var e=document.createElement("a");return(0,a.addLinkAttributes)(e,{url:this.data.url,target:this.data.newWindow?a.LinkTarget.BLANK:void 0}),this.data.url||(this.data.action?this._bindNamedAction(e,this.data.action):this._bindLink(e,this.data.dest)),this.container.appendChild(e),this.container}},{key:"_bindLink",value:function(e,t){var n=this;e.href=this.linkService.getDestinationHash(t),e.onclick=function(){return t&&n.linkService.navigateTo(t),!1},t&&(e.className="internalLink")}},{key:"_bindNamedAction",value:function(e,t){var n=this;e.href=this.linkService.getAnchorUrl(""),e.onclick=function(){return n.linkService.executeNamedAction(t),!1},e.className="internalLink"}}]),t}(),g=function(e){function t(e){d(this,t);var n=!!(e.data.hasPopup||e.data.title||e.data.contents);return c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n))}return u(t,p),i(t,[{key:"render",value:function(){this.container.className="textAnnotation";var e=document.createElement("img");return e.style.height=this.container.style.height,e.style.width=this.container.style.width,e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.alt="[{{type}} Annotation]",e.dataset.l10nId="text_annotation_type",e.dataset.l10nArgs=JSON.stringify({type:this.data.name}),this.data.hasPopup||this._createPopup(this.container,e,this.data),this.container.appendChild(e),this.container}}]),t}(),v=function(e){function t(){return d(this,t),c(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return u(t,p),i(t,[{key:"render",value:function(){return this.container}}]),t}(),y=function(e){function t(e){d(this,t);var n=e.renderInteractiveForms||!e.data.hasAppearance&&!!e.data.fieldValue;return c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n))}return u(t,v),i(t,[{key:"render",value:function(){this.container.className="textWidgetAnnotation";var e=null;if(this.renderInteractiveForms){if(this.data.multiLine?(e=document.createElement("textarea")).textContent=this.data.fieldValue:((e=document.createElement("input")).type="text",e.setAttribute("value",this.data.fieldValue)),e.disabled=this.data.readOnly,null!==this.data.maxLen&&(e.maxLength=this.data.maxLen),this.data.comb){var t=(this.data.rect[2]-this.data.rect[0])/this.data.maxLen;e.classList.add("comb"),e.style.letterSpacing="calc("+t+"px - 1ch)"}}else{(e=document.createElement("div")).textContent=this.data.fieldValue,e.style.verticalAlign="middle",e.style.display="table-cell";var n=null;this.data.fontRefName&&(n=this.page.commonObjs.getData(this.data.fontRefName)),this._setTextStyle(e,n)}if(null!==this.data.textAlignment&&(e.style.textAlign=["left","center","right"][this.data.textAlignment]),!0===window.KGPdfViewerWebApp.useTextWidget){var r=window.KGPdfViewerWebApp.PDFViewerApplication,i=r.KG_TextWidget,a=r.KG_TextConfirm;i.setTextWidgetValue(this.data.fieldName,this.data.fieldValue),e.onchange=function(e){i.setTextWidgetValue(this.data.fieldName,e.target.value)}.bind(this),e.onkeyup=function(e){a.show()}.bind(this)}return this.container.appendChild(e),this.container}},{key:"_setTextStyle",value:function(e,t){var n=e.style;if(n.fontSize=this.data.fontSize+"px",n.direction=this.data.fontDirection<0?"rtl":"ltr",t){n.fontWeight=t.black?t.bold?"900":"bold":t.bold?"bold":"normal",n.fontStyle=t.italic?"italic":"normal";var r=t.loadedName?'"'+t.loadedName+'", ':"",i=t.fallbackName||"Helvetica, sans-serif";n.fontFamily=r+i}}}]),t}(),b=function(e){function t(e){return d(this,t),c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,e.renderInteractiveForms))}return u(t,v),i(t,[{key:"render",value:function(){this.container.className="buttonWidgetAnnotation checkBox";var e=document.createElement("input");if(e.disabled=this.data.readOnly,e.type="checkbox",this.data.fieldValue&&"Off"!==this.data.fieldValue&&e.setAttribute("checked",!0),!0===window.KGPdfViewerWebApp.useTextWidget){var t=window.KGPdfViewerWebApp.PDFViewerApplication,n=t.KG_TextWidget,r=t.KG_TextConfirm,i=this.data.fieldValue?this.data.fieldValue:"Off";n.setTextWidgetValue(this.data.fieldName,i),e.onchange=function(e){var t=e.target.checked?"0":"Off";n.setTextWidgetValue(this.data.fieldName,t),r.show()}.bind(this)}return this.container.appendChild(e),this.container}}]),t}(),w=function(e){function t(e){return d(this,t),c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,e.renderInteractiveForms))}return u(t,v),i(t,[{key:"render",value:function(){this.container.className="buttonWidgetAnnotation radioButton";var e=document.createElement("input");if(e.disabled=this.data.readOnly,e.type="radio",e.name=this.data.fieldName,e.value=this.data.buttonValue,this.data.fieldValue===this.data.buttonValue&&e.setAttribute("checked",!0),!0===window.KGPdfViewerWebApp.useTextWidget){var t=window.KGPdfViewerWebApp.PDFViewerApplication,n=t.KG_TextWidget,r=t.KG_TextConfirm,i=this.data.fieldValue?this.data.fieldValue:"-1";n.setTextWidgetValue(this.data.fieldName,i),e.onchange=function(e){n.setTextWidgetValue(this.data.fieldName,e.target.value),r.show()}.bind(this)}return this.container.appendChild(e),this.container}}]),t}(),S=function(e){function t(e){return d(this,t),c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,e.renderInteractiveForms))}return u(t,v),i(t,[{key:"render",value:function(){this.container.className="choiceWidgetAnnotation";var e=document.createElement("select");e.disabled=this.data.readOnly,this.data.combo||(e.size=this.data.options.length,this.data.multiSelect&&(e.multiple=!0));for(var t=0,n=this.data.options.length;t<n;t++){var r=this.data.options[t],i=document.createElement("option");i.textContent=r.displayValue,i.value=r.exportValue,this.data.fieldValue.indexOf(r.displayValue)>=0&&i.setAttribute("selected",!0),e.appendChild(i)}if(!0===window.KGPdfViewerWebApp.useTextWidget){var a=window.KGPdfViewerWebApp.PDFViewerApplication,o=a.KG_TextWidget,s=a.KG_TextConfirm;o.setTextWidgetValue(this.data.fieldName,this.data.fieldValue[0]),e.onchange=function(e){o.setTextWidgetValue(this.data.fieldName,e.target.value),s.show()}.bind(this)}return this.container.appendChild(e),this.container}}]),t}(),_=function(e){function t(e){d(this,t);var n=!(!e.data.title&&!e.data.contents);return c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n))}return u(t,p),i(t,[{key:"render",value:function(){if(this.container.className="popupAnnotation",["Line","Square","Circle","PolyLine","Polygon"].indexOf(this.data.parentType)>=0)return this.container;var e='[data-annotation-id="'+this.data.parentId+'"]',t=this.layer.querySelector(e);if(!t)return this.container;var n=new P({container:this.container,trigger:t,color:this.data.color,title:this.data.title,contents:this.data.contents}),r=parseFloat(t.style.left),i=parseFloat(t.style.width);return a.CustomStyle.setProp("transformOrigin",this.container,-(r+i)+"px -"+t.style.top),this.container.style.left=r+i+"px",this.container.appendChild(n.render()),this.container}}]),t}(),P=function(){function e(t){d(this,e),this.container=t.container,this.trigger=t.trigger,this.color=t.color,this.title=t.title,this.contents=t.contents,this.hideWrapper=t.hideWrapper||!1,this.viewport=t.viewport,this.pinned=!1}return i(e,[{key:"render",value:function(){var e=document.createElement("div");e.className="popupWrapper",this.hideElement=this.hideWrapper?e:this.container,this.hideElement.setAttribute("hidden",!0);var t=document.createElement("div");t.className="popup",t.style.fontSize="14px";var n=this.color;if(n){var r=.7*(255-n[0])+n[0],i=.7*(255-n[1])+n[1],a=.7*(255-n[2])+n[2];t.style.backgroundColor=o.Util.makeCssRgb(0|r,0|i,0|a)}var s=this._formatContents(this.contents),l=document.createElement("h1");return l.textContent=this.title,this.trigger.addEventListener("click",this._toggle.bind(this)),this.trigger.addEventListener("mouseover",this._show.bind(this,!1)),this.trigger.addEventListener("mouseout",this._hide.bind(this,!1)),t.addEventListener("click",this._hide.bind(this,!0)),t.appendChild(l),t.appendChild(s),e.appendChild(t),e}},{key:"_formatContents",value:function(e){for(var t=document.createElement("p"),n=e.split(/(?:\r\n?|\n)/),r=0,i=n.length;r<i;++r){var a=n[r];t.appendChild(document.createTextNode(a)),r<i-1&&t.appendChild(document.createElement("br"))}return t}},{key:"_toggle",value:function(){this.pinned?this._hide(!0):this._show(!0)}},{key:"_show",value:function(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this.pinned=!0),this.hideElement.hasAttribute("hidden")&&(this.hideElement.removeAttribute("hidden"),this.container.style.zIndex+=1,this.viewport)){var e=Number(this.container.style.width.slice(0,-2)),t=Number(this.container.style.height.slice(0,-2)),n=Number(this.container.style.left.slice(0,-2)),r=Number(this.container.style.top.slice(0,-2)),i=this.viewport.viewBox[2],a=this.viewport.viewBox[3],o=this.viewport.scale;e+n+50>i&&(this.hideElement.style.left="-"+(this.hideElement.querySelector(".popup").offsetWidth+5*o)+"px"),t+r+50>a&&(this.hideElement.style.top="-"+t+"px")}}},{key:"_hide",value:function(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(this.pinned=!1),this.hideElement.hasAttribute("hidden")||this.pinned||(this.hideElement.setAttribute("hidden",!0),this.container.style.zIndex-=1)}}]),e}(),A=function(e){function t(e){d(this,t);var n=!!(e.data.hasPopup||e.data.title||e.data.contents),r=window.KGPdfViewerWebApp.globalAnnotation;r&&(n=-1==(r.hideList||[]).indexOf(e.data.title));return c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,!0))}return u(t,p),i(t,[{key:"render",value:function(){this.container.className="lineAnnotation";var e=this.data,t=e.rect[2]-e.rect[0],n=e.rect[3]-e.rect[1],i=this.svgFactory.create(t,n),a=this.svgFactory.createElement("line"),o=r(e.lineCoordinates,4),s=o[0],l=o[1],c=o[2],u=o[3],d=void 0,h=void 0,p=void 0,f=void 0;l<u&&s<c?(d=e.rect[2]-c,p=e.rect[2]-s,h=e.rect[3]-l,f=e.rect[3]-u):(d=e.rect[2]-s,p=e.rect[2]-c,h=e.rect[3]-u,f=e.rect[3]-l),a.setAttribute("x1",d),a.setAttribute("y1",h),a.setAttribute("x2",p),a.setAttribute("y2",f),a.setAttribute("stroke-width",e.borderStyle.width),a.setAttribute("stroke","transparent");var m=r(e.color,3),g=m[0],v=m[1],y=m[2];return this.container.setAttribute("data-rgb","rgb("+g+","+v+","+y+")"),this.container.setAttribute("data-author",e.title),i.appendChild(a),this.container.appendChild(i),this.container}}]),t}(),k=function(e){function t(e){d(this,t);var n=!!(e.data.hasPopup||e.data.title||e.data.contents),r=window.KGPdfViewerWebApp.globalAnnotation;r&&(n=-1==(r.hideList||[]).indexOf(e.data.title));return c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,!0))}return u(t,p),i(t,[{key:"render",value:function(){this.container.className="squareAnnotation";var e=this.data,t=e.rect[2]-e.rect[0],n=e.rect[3]-e.rect[1],i=this.svgFactory.create(t,n),a=e.borderStyle.width,o=this.svgFactory.createElement("rect");o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",t-a),o.setAttribute("height",n-a),o.setAttribute("stroke-width",a),o.setAttribute("stroke","transparent"),o.setAttribute("fill","none");var s=r(e.color,3),l=s[0],c=s[1],u=s[2];return this.container.setAttribute("data-rgb","rgb("+l+","+c+","+u+")"),this.container.setAttribute("data-author",e.title),i.appendChild(o),this.container.appendChild(i),this.container}}]),t}(),C=function(e){function t(e){d(this,t);var n=!!(e.data.hasPopup||e.data.title||e.data.contents),r=window.KGPdfViewerWebApp.globalAnnotation;r&&(n=-1==(r.hideList||[]).indexOf(e.data.title));return c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,!0))}return u(t,p),i(t,[{key:"render",value:function(){this.container.className="circleAnnotation";var e=this.data,t=e.rect[2]-e.rect[0],n=e.rect[3]-e.rect[1],i=this.svgFactory.create(t,n),a=e.borderStyle.width,o=this.svgFactory.createElement("ellipse");o.setAttribute("cx",t/2),o.setAttribute("cy",n/2),o.setAttribute("rx",t/2-a/2),o.setAttribute("ry",n/2-a/2),o.setAttribute("stroke-width",a),o.setAttribute("stroke","transparent"),o.setAttribute("fill","none");var s=r(e.color,3),l=s[0],c=s[1],u=s[2];return this.container.setAttribute("data-rgb","rgb("+l+","+c+","+u+")"),this.container.setAttribute("data-author",e.title),i.appendChild(o),this.container.appendChild(i),this.container}}]),t}(),x=function(e){function t(e){d(this,t);var n=!!(e.data.hasPopup||e.data.title||e.data.contents),r=c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,!0));return r.containerClassName="polylineAnnotation",r.svgElementName="svg:polyline",r}return u(t,p),i(t,[{key:"render",value:function(){this.container.className=this.containerClassName;for(var e=this.data,t=e.rect[2]-e.rect[0],n=e.rect[3]-e.rect[1],r=this.svgFactory.create(t,n),i=e.vertices,a=[],o=0,s=i.length;o<s;o++){var l=i[o].x-e.rect[0],c=e.rect[3]-i[o].y;a.push(l+","+c)}a=a.join(" ");var u=e.borderStyle.width,d=this.svgFactory.createElement(this.svgElementName);return d.setAttribute("points",a),d.setAttribute("stroke-width",u),d.setAttribute("stroke","transparent"),d.setAttribute("fill","none"),r.appendChild(d),this.container.append(r),this._createPopup(this.container,d,e),this.container}}]),t}(),T=function(e){function t(e){d(this,t);var n=c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.containerClassName="polygonAnnotation",n.svgElementName="svg:polygon",n}return u(t,x),t}(),D=function(e){function t(e){d(this,t);var n=!!(e.data.hasPopup||e.data.title||e.data.contents);return c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,!0))}return u(t,p),i(t,[{key:"render",value:function(){return this.container.className="highlightAnnotation",this.data.hasPopup||this._createPopup(this.container,null,this.data),this.container}}]),t}(),E=function(e){function t(e){d(this,t);var n=!!(e.data.hasPopup||e.data.title||e.data.contents);return c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,!0))}return u(t,p),i(t,[{key:"render",value:function(){return this.container.className="underlineAnnotation",this.data.hasPopup||this._createPopup(this.container,null,this.data),this.container}}]),t}(),I=function(e){function t(e){d(this,t);var n=!!(e.data.hasPopup||e.data.title||e.data.contents);return c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,!0))}return u(t,p),i(t,[{key:"render",value:function(){return this.container.className="squigglyAnnotation",this.data.hasPopup||this._createPopup(this.container,null,this.data),this.container}}]),t}(),O=function(e){function t(e){d(this,t);var n=!!(e.data.hasPopup||e.data.title||e.data.contents);return c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,!0))}return u(t,p),i(t,[{key:"render",value:function(){return this.container.className="strikeoutAnnotation",this.data.hasPopup||this._createPopup(this.container,null,this.data),this.container}}]),t}(),R=function(e){function t(e){d(this,t);var n=!!(e.data.hasPopup||e.data.title||e.data.contents);return c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,!0))}return u(t,p),i(t,[{key:"render",value:function(){this.container.className="stampAnnotation";var e=this.data.color;if(e&&(this.container.setAttribute("data-color","rgb("+e[0]+", "+e[1]+", "+e[2]+")"),this.container.childNododes||this.container.classList.add("stamp-mask-annotation")),window.KGPdfViewerWebApp.indicateSeal)if(0==window.KGPdfViewerWebApp.mobile)this.container.addEventListener("contextmenu",window.KGPdfViewerWebApp.PDFViewerApplication.KG_IndicateSeal.createRightMenu);else{var t=null;this.container.addEventListener("contextmenu",function(e){e.preventDefault(),e.stopPropagation()}),this.container.addEventListener("touchstart",function(e){t=setTimeout(function(){window.KGPdfViewerWebApp.PDFViewerApplication.KG_IndicateSeal.createRightMenu(e)},500)}),this.container.addEventListener("touchend",function(){clearTimeout(t)})}return this.container}}]),t}(),M=function(e){function t(e){d(this,t);var n=c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,!0)),r=n.data.file;return n.filename=(0,a.getFilenameFromUrl)(r.filename),n.content=r.content,n.linkService.onFileAttachmentAnnotation({id:(0,o.stringToPDFString)(r.filename),filename:r.filename,content:r.content}),n}return u(t,p),i(t,[{key:"render",value:function(){this.container.className="fileAttachmentAnnotation";var e=document.createElement("div");return e.style.height=this.container.style.height,e.style.width=this.container.style.width,e.addEventListener("dblclick",this._download.bind(this)),this.data.hasPopup||!this.data.title&&!this.data.contents||this._createPopup(this.container,e,this.data),this.container.appendChild(e),this.container}},{key:"_download",value:function(){this.downloadManager?this.downloadManager.downloadData(this.content,this.filename,""):(0,o.warn)("Download cannot be started due to unavailable download manager")}}]),t}(),W=function(){function e(){d(this,e)}return i(e,null,[{key:"render",value:function(e){for(var t=0,n=e.annotations.length;t<n;t++){var r=e.annotations[t];if(r){var i=h.create({data:r,layer:e.div,page:e.page,pdfPageView:e.pdfPageView,viewport:e.viewport,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||(0,a.getDefaultSetting)("imageResourcesPath"),renderInteractiveForms:e.renderInteractiveForms||!1,svgFactory:new a.DOMSVGFactory});i.isRenderable&&e.div.appendChild(i.render())}}}},{key:"update",value:function(e){for(var t=0,n=e.annotations.length;t<n;t++){var r=e.annotations[t],i=e.div.querySelector('[data-annotation-id="'+r.id+'"]');i&&a.CustomStyle.setProp("transform",i,"matrix("+e.viewport.transform.join(",")+")")}e.div.removeAttribute("hidden")}}]),e}();t.AnnotationLayer=W,t.PopupElement=P},function(e,t,n){"use strict";var r,i,a,o,s="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=function(e){return function(){var t=e,n=t.lib.BlockCipher,r=t.algo,i=[],a=[],o=[],s=[],l=[],c=[],u=[],d=[],h=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,r=0;for(t=0;t<256;t++){var f=r^r<<1^r<<2^r<<3^r<<4;f=f>>>8^255&f^99,i[n]=f,a[f]=n;var m=e[n],g=e[m],v=e[g],y=257*e[f]^16843008*f;o[n]=y<<24|y>>>8,s[n]=y<<16|y>>>16,l[n]=y<<8|y>>>24,c[n]=y;y=16843009*v^65537*g^257*m^16843008*n;u[f]=y<<24|y>>>8,d[f]=y<<16|y>>>16,h[f]=y<<8|y>>>24,p[f]=y,n?(n=m^e[e[e[v^m]]],r^=e[e[r]]):n=r=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],m=r.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,r=4*((this._nRounds=n+6)+1),a=this._keySchedule=[],o=0;o<r;o++)o<n?a[o]=t[o]:(c=a[o-1],o%n?n>6&&o%n==4&&(c=i[c>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c]):(c=i[(c=c<<8|c>>>24)>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c],c^=f[o/n|0]<<24),a[o]=a[o-n]^c);for(var s=this._invKeySchedule=[],l=0;l<r;l++){o=r-l;if(l%4)var c=a[o];else c=a[o-4];s[l]=l<4||o<=4?c:u[i[c>>>24]]^d[i[c>>>16&255]]^h[i[c>>>8&255]]^p[i[255&c]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,l,c,i)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,u,d,h,p,a);n=e[t+1];e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,a,o,s){for(var l=this._nRounds,c=e[t]^n[0],u=e[t+1]^n[1],d=e[t+2]^n[2],h=e[t+3]^n[3],p=4,f=1;f<l;f++){var m=r[c>>>24]^i[u>>>16&255]^a[d>>>8&255]^o[255&h]^n[p++],g=r[u>>>24]^i[d>>>16&255]^a[h>>>8&255]^o[255&c]^n[p++],v=r[d>>>24]^i[h>>>16&255]^a[c>>>8&255]^o[255&u]^n[p++],y=r[h>>>24]^i[c>>>16&255]^a[u>>>8&255]^o[255&d]^n[p++];c=m,u=g,d=v,h=y}m=(s[c>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&h])^n[p++],g=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[h>>>8&255]<<8|s[255&c])^n[p++],v=(s[d>>>24]<<24|s[h>>>16&255]<<16|s[c>>>8&255]<<8|s[255&u])^n[p++],y=(s[h>>>24]<<24|s[c>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^n[p++];e[t]=m,e[t+1]=g,e[t+2]=v,e[t+3]=y},keySize:8});t.AES=n._createHelper(m)}(),e.AES},"object"===s(t)?e.exports=t=o(n(2),n(15),n(89),n(38),n(92)):(i=[n(2),n(15),n(89),n(38),n(92)],void 0===(a="function"==typeof(r=o)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){"use strict";var r,i,a,o,s="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=function(e){return function(t){var n=e,r=n.lib,i=r.WordArray,a=r.Hasher,o=n.algo,s=[];!function(){for(var e=0;e<64;e++)s[e]=4294967296*t.abs(t.sin(e+1))|0}();var l=o.MD5=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,i=e[r];e[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var a=this._hash.words,o=e[t+0],l=e[t+1],p=e[t+2],f=e[t+3],m=e[t+4],g=e[t+5],v=e[t+6],y=e[t+7],b=e[t+8],w=e[t+9],S=e[t+10],_=e[t+11],P=e[t+12],A=e[t+13],k=e[t+14],C=e[t+15],x=a[0],T=a[1],D=a[2],E=a[3];T=h(T=h(T=h(T=h(T=d(T=d(T=d(T=d(T=u(T=u(T=u(T=u(T=c(T=c(T=c(T=c(T,D=c(D,E=c(E,x=c(x,T,D,E,o,7,s[0]),T,D,l,12,s[1]),x,T,p,17,s[2]),E,x,f,22,s[3]),D=c(D,E=c(E,x=c(x,T,D,E,m,7,s[4]),T,D,g,12,s[5]),x,T,v,17,s[6]),E,x,y,22,s[7]),D=c(D,E=c(E,x=c(x,T,D,E,b,7,s[8]),T,D,w,12,s[9]),x,T,S,17,s[10]),E,x,_,22,s[11]),D=c(D,E=c(E,x=c(x,T,D,E,P,7,s[12]),T,D,A,12,s[13]),x,T,k,17,s[14]),E,x,C,22,s[15]),D=u(D,E=u(E,x=u(x,T,D,E,l,5,s[16]),T,D,v,9,s[17]),x,T,_,14,s[18]),E,x,o,20,s[19]),D=u(D,E=u(E,x=u(x,T,D,E,g,5,s[20]),T,D,S,9,s[21]),x,T,C,14,s[22]),E,x,m,20,s[23]),D=u(D,E=u(E,x=u(x,T,D,E,w,5,s[24]),T,D,k,9,s[25]),x,T,f,14,s[26]),E,x,b,20,s[27]),D=u(D,E=u(E,x=u(x,T,D,E,A,5,s[28]),T,D,p,9,s[29]),x,T,y,14,s[30]),E,x,P,20,s[31]),D=d(D,E=d(E,x=d(x,T,D,E,g,4,s[32]),T,D,b,11,s[33]),x,T,_,16,s[34]),E,x,k,23,s[35]),D=d(D,E=d(E,x=d(x,T,D,E,l,4,s[36]),T,D,m,11,s[37]),x,T,y,16,s[38]),E,x,S,23,s[39]),D=d(D,E=d(E,x=d(x,T,D,E,A,4,s[40]),T,D,o,11,s[41]),x,T,f,16,s[42]),E,x,v,23,s[43]),D=d(D,E=d(E,x=d(x,T,D,E,w,4,s[44]),T,D,P,11,s[45]),x,T,C,16,s[46]),E,x,p,23,s[47]),D=h(D,E=h(E,x=h(x,T,D,E,o,6,s[48]),T,D,y,10,s[49]),x,T,k,15,s[50]),E,x,g,21,s[51]),D=h(D,E=h(E,x=h(x,T,D,E,P,6,s[52]),T,D,f,10,s[53]),x,T,S,15,s[54]),E,x,l,21,s[55]),D=h(D,E=h(E,x=h(x,T,D,E,b,6,s[56]),T,D,C,10,s[57]),x,T,v,15,s[58]),E,x,A,21,s[59]),D=h(D,E=h(E,x=h(x,T,D,E,m,6,s[60]),T,D,_,10,s[61]),x,T,p,15,s[62]),E,x,w,21,s[63]),a[0]=a[0]+x|0,a[1]=a[1]+T|0,a[2]=a[2]+D|0,a[3]=a[3]+E|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;n[i>>>5]|=128<<24-i%32;var a=t.floor(r/4294967296),o=r;n[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),n[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),e.sigBytes=4*(n.length+1),this._process();for(var s=this._hash,l=s.words,c=0;c<4;c++){var u=l[c];l[c]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return s},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,n,r,i,a,o){var s=e+(t&n|~t&r)+i+o;return(s<<a|s>>>32-a)+t}function u(e,t,n,r,i,a,o){var s=e+(t&r|n&~r)+i+o;return(s<<a|s>>>32-a)+t}function d(e,t,n,r,i,a,o){var s=e+(t^n^r)+i+o;return(s<<a|s>>>32-a)+t}function h(e,t,n,r,i,a,o){var s=e+(n^(t|~r))+i+o;return(s<<a|s>>>32-a)+t}n.MD5=a._createHelper(l),n.HmacMD5=a._createHmacHelper(l)}(Math),e.MD5},"object"===s(t)?e.exports=t=o(n(2)):(i=[n(2)],void 0===(a="function"==typeof(r=o)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){"use strict";var r,i,a,o,s="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=function(e){var t,n,r,i,a,o;return n=(t=e).lib,r=n.WordArray,i=n.Hasher,a=[],o=t.algo.SHA1=i.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],l=n[4],c=0;c<80;c++){if(c<16)a[c]=0|e[t+c];else{var u=a[c-3]^a[c-8]^a[c-14]^a[c-16];a[c]=u<<1|u>>>31}var d=(r<<5|r>>>27)+l+a[c];d+=c<20?1518500249+(i&o|~i&s):c<40?1859775393+(i^o^s):c<60?(i&o|i&s|o&s)-1894007588:(i^o^s)-899497514,l=s,s=o,o=i<<30|i>>>2,i=r,r=d}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+l|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA1=i._createHelper(o),t.HmacSHA1=i._createHmacHelper(o),e.SHA1},"object"===s(t)?e.exports=t=o(n(2)):(i=[n(2)],void 0===(a="function"==typeof(r=o)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){"use strict";var r,i,a,o,s="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=function(e){var t,n,r;n=(t=e).lib.Base,r=t.enc.Utf8,t.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var n=e.blockSize,i=4*n;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),o=this._iKey=t.clone(),s=a.words,l=o.words,c=0;c<n;c++)s[c]^=1549556828,l[c]^=909522486;a.sigBytes=o.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})},"object"===s(t)?e.exports=t=o(n(2)):(i=[n(2)],void 0===(a="function"==typeof(r=o)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){"use strict";var r,i,a,o,s="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=function(e){e.lib.Cipher||function(t){var n=e,r=n.lib,i=r.Base,a=r.WordArray,o=r.BufferedBlockAlgorithm,s=n.enc,l=(s.Utf8,s.Base64),c=n.algo.EvpKDF,u=r.Cipher=o.extend({cfg:i.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?b:v}return function(t){return{encrypt:function(n,r,i){return e(r).encrypt(t,n,r,i)},decrypt:function(n,r,i){return e(r).decrypt(t,n,r,i)}}}}()}),d=(r.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),n.mode={}),h=r.BlockCipherMode=i.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=d.CBC=function(){var e=h.extend();function n(e,n,r){var i,a=this._iv;a?(i=a,this._iv=t):i=this._prevBlock;for(var o=0;o<r;o++)e[n+o]^=i[o]}return e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize;n.call(this,e,t,i),r.encryptBlock(e,t),this._prevBlock=e.slice(t,t+i)}}),e.Decryptor=e.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,a=e.slice(t,t+i);r.decryptBlock(e,t),n.call(this,e,t,i),this._prevBlock=a}}),e}(),f=(n.pad={}).Pkcs7={pad:function(e,t){for(var n=4*t,r=n-e.sigBytes%n,i=r<<24|r<<16|r<<8|r,o=[],s=0;s<r;s+=4)o.push(i);var l=a.create(o,r);e.concat(l)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},m=(r.BlockCipher=u.extend({cfg:u.cfg.extend({mode:p,padding:f}),reset:function(){var e;u.reset.call(this);var t=this.cfg,n=t.iv,r=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=r.createEncryptor:(e=r.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,n&&n.words):(this._mode=e.call(r,this,n&&n.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4}),r.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}})),g=(n.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,n=e.salt;return(n?a.create([1398893684,1701076831]).concat(n).concat(t):t).toString(l)},parse:function(e){var t,n=l.parse(e),r=n.words;return 1398893684==r[0]&&1701076831==r[1]&&(t=a.create(r.slice(2,4)),r.splice(0,4),n.sigBytes-=16),m.create({ciphertext:n,salt:t})}},v=r.SerializableCipher=i.extend({cfg:i.extend({format:g}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r),a=i.finalize(t),o=i.cfg;return m.create({ciphertext:a,key:n,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(n.kdf={}).OpenSSL={execute:function(e,t,n,r){r||(r=a.random(8));var i=c.create({keySize:t+n}).compute(e,r),o=a.create(i.words.slice(t),4*n);return i.sigBytes=4*t,m.create({key:i,iv:o,salt:r})}},b=r.PasswordBasedCipher=v.extend({cfg:v.cfg.extend({kdf:y}),encrypt:function(e,t,n,r){var i=(r=this.cfg.extend(r)).kdf.execute(n,e.keySize,e.ivSize);r.iv=i.iv;var a=v.encrypt.call(this,e,t,i.key,r);return a.mixIn(i),a},decrypt:function(e,t,n,r){r=this.cfg.extend(r),t=this._parse(t,r.format);var i=r.kdf.execute(n,e.keySize,e.ivSize,t.salt);return r.iv=i.iv,v.decrypt.call(this,e,t,i.key,r)}})}()},"object"===s(t)?e.exports=t=o(n(2),n(38)):(i=[n(2),n(38)],void 0===(a="function"==typeof(r=o)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.iWebAssistError=t.iWebAssist=void 0;var r=n(5),i=n(40);var a=function(e,t){this.kg=new i.KG("IWEBASSIST.iWebAssistCtrl.1","4240FB41-A213-42B6-8CB5E6705C99B319");var n=(0,i.createCapability)();this.promise=n.promise;var r=this,a=window.KGPdfViewerWebApp.softType,o=window.KGPdfViewerWebApp.appCode;this.kg.init(t).then(function(){"0"===(e||{}).clientType?r.kg.invoke("SetParamByName","SOFTTYPE",a).then(r.kg.invoke("SetParamByName","APPCODE",o)).then(n.resolve):n.resolve()})};a.prototype={getCspName:function(){var e=this.kg,t=(0,i.createCapability)();return e.invoke("KGGetPublicParm","Public","CSPName","").then(function(e){0==e.indexOf("M")&&function e(t,n,r){var i=r;return t.indexOf(n)>=0&&i<4&&(i++,i=e(t.substr(t.indexOf(n)+1,t.length),n,i)),i}(e,"W",0)>0&&(e=e.replace(e.substring(e.indexOf("M")+1,e.indexOf("W")),"&")),t.resolve(e)}),t.promise},setParamByName:function(e,t){return this.kg.invoke("SetParamByName",e,t)},getKeyInfo:function(){return this.kg.invoke("KGGetKeyInfo")},getKeyOtherInfo:function(){return this.kg.invoke("KGGetKeyOtherInfo","0")},getParamByName:function(e){return this.kg.invoke("GetParamByName",e)},makeGMV4Data:function(e){return this.kg.invoke("makeGMV4Data",window.KGPdfViewerWebApp.getPasswordPrompt().pwd,e.imgdata.split(",")[1],e.imgExt,(0,r.pxCovertToMM)(e.width)/10,(0,r.pxCovertToMM)(e.height)/10,e.signName,5)},getCert:function(){this.kg.invoke("KGGetCerInfo","")},verifyPin:function(e,t){return this.kg.invoke("KGVerifyPin",e,t)},sig_pkcs7:function(e,t,n){return"Base64"===n?this.kg.invoke("KGCrySignMessageEX",e,t,t.length,"Base64"):this.kg.invoke("KGCrySignMessage",e,t,t.length)},verifySignMessage:function(e,t){return this.kg.invoke("KGVerifySignMessage","",e,t)},getPublicParam:function(e,t,n){return t||(t=""),n||(n=""),this.kg.invoke("KGGetPublicParm",e,t,n)}};t.iWebAssist=a,t.iWebAssistError={getKeyInfo:{"-1":"未安装组件",1:"请插入电子密钥盘",2:"没有进行正确初始化的电子密钥盘",3:"没有找到key驱动文件",4:"插入太多的key",8:"非法授权的电子密钥盘",11:"密钥盘中不存在印章",12:"获取印章信息失败","-101":"获取钥匙盘有效期异常,请重新尝试签章","-103":"钥匙盘未生效,不能签章","-104":"钥匙盘已过期,不能签章",35:"钥匙盘未生效,不能签章",36:"钥匙盘已过期,不能签章",37:"授权信息结构非法",38:"验证失败,签章证书已经过期或还未生效",39:"验证失败,签章证书不受颁发机构信任",40:"验证失败,签章证书已被吊销",41:"验证失败,签章证书根证书未安装或无效的根证书",42:"验证失败,吊销列表文件不存在",43:"验证失败,未检测到证书",44:"验证失败,根证书文件不存在",45:"验证失败,根证书和该证书的根证书不配套",46:"验证失败,吊销列表和该证书的吊销列表不配套"},getKeyOtherInfo:{"-100":"不支持此类型的信息获取","-4":"插入太多的密钥盘","-3":"连接签章服务器失败","-2":"获取失败","-1":"未安装管理组件",1:"请插入电子密钥盘",2:"没有进行正确初始化的电子密钥盘",3:"没有找到key驱动文件",4:"插入太多的key",8:"非法授权的电子密钥盘",11:"密钥盘中不存在印章",12:"获取印章信息失败","-101":"获取钥匙盘有效期异常,请重新尝试签章","-103":"钥匙盘未生效,不能签章","-104":"钥匙盘已过期,不能签章"},verifyPin:{"-1":"未安装签名组件","-2":"待验证pin的key和当前插入的key不匹配","-3":"未安装手机盾组件",1:"没有检测到用户key",2:"非法为授权的key",3:"没有找到key驱动文件",4:"插入太多的key",7:"密码错误",8:"非法授权key",9:"网络连接失败",10:"签章助手登录失败"}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.activeSealClassName=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}}();t.arrayDeepCopy=f,t.eventPreventDefault=m,t.sealSectionId=g,t.createSealSection=v,t.removeSealSection=y;var i=n(23),a=h(n(15)),o=n(5),s=h(n(60)),l=h(n(158)),c=n(24),u=n(56),d=n(95);function h(e){return e&&e.__esModule?e:{default:e}}var p=t.activeSealClassName="stamp";function f(e){var t=[];return e.forEach(function(e,n){for(var r in t.push({}),e)e.hasOwnProperty(r)&&(t[n][r]=e[r])}),t}function m(e){e.preventDefault()}function g(e){return e+"-"+(new Date).getTime()}function v(e,t,n,r,i,a,o){var s=document.createElement("section");s.setAttribute("data-annotation-id",n),s.id=t,s.className=r,s.style.width=e.width+"px",s.style.height=e.height+"px";var l=document.createElement("img");return l.src=e.imgData||e.imgdata,l.style.width="100%",l.style.height="100%",l.style.opacity="0.9",s.appendChild(l),(0,d.setSectionStyle)(s,o,i,a),s}function y(e){var t=document.getElementsByClassName(e);0!==t.length&&t[0].parentNode.removeChild(t[0])}function b(e,t,n,r,i,a){var o=arguments.length>6&&void 0!==arguments[6]&&arguments[6],s=arguments[7],l=e.getContext("2d"),c=e.width,u=e.height;l.fillStyle="#FFFFFF",l.fillRect(0,0,c,u),l.fillStyle=n,l.fillRect(0,0,c,u);var d=(u-t*(r+1))/r;if(l.font="normal normal normal "+a+"px SimSun serif",l.textAlign="center",l.textBaseline="middle",o){l.fillStyle="#FFFFFF";var h=.16*(c-2*t),p=u-2*t;l.fillRect(t,t,h,p);for(var f=0;f<r;f++)l.fillStyle="#FFFFFF",l.fillRect(h+2*t,t*(f+1)+d*f,c-h-3*t,d),i&&i[f]&&(l.fillStyle=n,l.fillText(i[f],h+2*t+(c-h-3*t)/2,t*(f+1.5)+d*(f+.5),c-h-4*t));l.fillStyle=n;var m=0;switch(s.length){case 1:m=1.8;break;case 2:m=1.4;break;case 3:m=1.2;break;default:m=0}for(var g=0;g<s.length;g++)l.fillText(s[g],h/2+t,(g+1)*(p/s.length)-a*m/s.length)}else for(var v=0;v<r;v++)l.fillStyle="#FFFFFF",l.fillRect(t,t*(v+1)+d*v,c-2*t,d),i&&i[v]&&(l.fillStyle=n,l.fillText(i[v],c/2,t*(v+1.5)+d*(v+.5),c-3*t))}var w=function(){function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.overlayName=t.overlayName,this.container=t.container;var i=window.KGPdfViewerWebApp.btnPositionConfig,a=i.toolbar,s=i.sidebar;this.docSave=t.docSave,a.indexOf("docSave")>-1&&(this.docSave.removeAttribute("hidden"),this.docSave.onclick=this.save.bind(this)),this.secondaryDocSave=t.secondaryDocSave,s.indexOf("docSave")>-1&&(this.secondaryDocSave.removeAttribute("hidden"),this.secondaryDocSave.onclick=this.save.bind(this)),this.docSaveAs=t.docSaveAs,a.indexOf("docSaveAs")>-1&&(this.docSaveAs.removeAttribute("hidden"),this.docSaveAs.onclick=this.saveAs.bind(this)),this.secondaryDocSaveAs=t.secondaryDocSaveAs,s.indexOf("docSaveAs")>-1&&(this.secondaryDocSaveAs.removeAttribute("hidden"),this.secondaryDocSaveAs.onclick=this.saveAs.bind(this)),this.textToSealCanvasContainer=t.textToSealCanvasContainer,this.indicateSealCanvasContainer=t.indicateSealCanvasContainer,this.invariantSealCanvasContainer=t.invariantSealCanvasContainer,this.textToSealCanvas=t.textToSealCanvas,this.indicateSealCanvas=t.indicateSealCanvas,this.invariantSealCanvas=t.invariantSealCanvas,this.textToSealContainer=t.textToSealContainer,this.textToSealText=t.textToSealText,this.textToSealNum=t.textToSealNum,this.textToSealDate=t.textToSealDate,this.textToSealColor=t.textToSealColor,this.indicateSealContainer=t.indicateSealContainer,this.indicateSealText=t.indicateSealText,this.indicateSealNum=t.indicateSealNum,this.indicateSealDate=t.indicateSealDate,this.indicateSealColor=t.indicateSealColor,this.invariantSealContainer=t.invariantSealContainer,this.button=t.button,a.indexOf("textToSeal")>-1&&(this.button.removeAttribute("hidden"),this.button.onclick=this.open.bind(this)),this.secondaryButton=t.secondaryButton,s.indexOf("textToSeal")>-1&&(this.secondaryButton.removeAttribute("hidden"),this.secondaryButton.onclick=this.open.bind(this)),this.exportBtn=t.exportBtn,a.indexOf("exportAnnotations")>-1&&(this.exportBtn.removeAttribute("hidden"),this.exportBtn.onclick=function(){r.export(function(e){window.KGPdfViewerWebApp.exportKGAnnotations(e)})}),this.secondaryExportBtn=t.secondaryExportBtn,s.indexOf("exportAnnotations")>-1&&(this.secondaryExportBtn.removeAttribute("hidden"),this.secondaryExportBtn.onclick=function(){r.export(function(e){window.KGPdfViewerWebApp.exportKGAnnotations(e)})}),this.showTextToSealBtn=t.showTextToSealBtn,this.showIndicateSealBtn=t.showIndicateSealBtn,this.showInvariantSealBtn=t.showInvariantSealBtn,this.okButton=t.okButton,this.cancelButton=t.cancelButton,this.seals=[],this.activeSeal=null,this.movingData={offsetX:0,offsetY:0,isMoving:!1,movingSealSection:null},this.app=n,this.overlayManager=this.app.overlayManager,this.overlayManager.register(this.overlayName,this.container,this.close.bind(this),!0),this.showTextToSealBtn.onclick=this.showTextToSeal.bind(this),this.showIndicateSealBtn.onclick=this.showIndicateSeal.bind(this),this.showInvariantSealBtn.onclick=this.showInvariantSeal.bind(this),this.okButton.onclick=this.ok.bind(this),this.cancelButton.onclick=this.close.bind(this),this.export=this.export.bind(this),window.exportKGAnnotations=this.export,document.body.addEventListener("click",u.removeStampMenu),l.default.path="./stamp/laydate/",this.onDocumentContextmenu=this.onDocumentContextmenu.bind(this),this.onDocumentClick=this.onDocumentClick.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.createRightMenu=this.createRightMenu.bind(this),this.handleTextToSealDateChange=this.handleTextToSealDateChange.bind(this),this.handleIndicateSealDateChange=this.handleIndicateSealDateChange.bind(this),this.drawTextToSeal=this.drawTextToSeal.bind(this),this.drawIndicateSeal=this.drawIndicateSeal.bind(this),this.handleSealOnMoveStart=this.handleSealOnMoveStart.bind(this),this.handleSealOnMoving=this.handleSealOnMoving.bind(this),this.handleSealOnMoveEnd=this.handleSealOnMoveEnd.bind(this),this.textToSealText.oninput=this.textToSealNum.oninput=this.textToSealDate.onchange=this.textToSealColor.onchange=this.drawTextToSeal,this.indicateSealText.oninput=this.indicateSealNum.oninput=this.indicateSealDate.onchange=this.indicateSealColor.onchange=this.drawIndicateSeal,this.textToSealText.onblur=this.textToSealNum.onblur=this.textToSealDate.onblur=this.textToSealColor.onblur=this.indicateSealText.onblur=this.indicateSealNum.onblur=this.indicateSealDate.onblur=this.indicateSealColor.onblur=o.scrollToResizeScreen}return r(e,[{key:"init",value:function(){this.textToSealText.value=window.KGPdfViewerWebApp.textToSealDefault.textToSealText,this.indicateSealText.value=window.KGPdfViewerWebApp.textToSealDefault.indicateSealText,this.textToSealNum.value=window.KGPdfViewerWebApp.textToSealDefault.textToSealNum,this.indicateSealNum.value=window.KGPdfViewerWebApp.textToSealDefault.indicateSealNum,l.default.render({elem:this.textToSealDate,value:new Date,format:"yyyy年M月d日",showBottom:!1,done:this.handleTextToSealDateChange,ready:this.handleTextToSealDateChange}),l.default.render({elem:this.indicateSealDate,value:new Date,format:"yyyy年M月d日",showBottom:!1,done:this.handleIndicateSealDateChange,ready:this.handleIndicateSealDateChange}),this.textToSealDate.value=(0,s.default)().format("YYYY年M月D日"),this.indicateSealDate.value=(0,s.default)().format("YYYY年M月D日"),this.textToSealColor.jscolor.fromString(window.KGPdfViewerWebApp.textToSealDefault.color.slice(1)),this.indicateSealColor.jscolor.fromString(window.KGPdfViewerWebApp.textToSealDefault.color.slice(1)),this.showTextToSeal()}},{key:"handleTextToSealDateChange",value:function(e){this.textToSealDate.value="string"==typeof e?e:e.year+"年"+e.month+"月"+e.date+"日",this.drawTextToSeal()}},{key:"handleIndicateSealDateChange",value:function(e){this.indicateSealDate.value="string"==typeof e?e:e.year+"年"+e.month+"月"+e.date+"日",this.drawIndicateSeal()}},{key:"open",value:function(){var e=this;null==this.activeSeal&&this.overlayManager.open(this.overlayName).then(function(){e.init()})}},{key:"close",value:function(){var e=this;return this.overlayManager.close(this.overlayName).then(function(){e.textToSealColor.jscolor.hide(),e.indicateSealColor.jscolor.hide()})}},{key:"ok",value:function(){var e=this,t=void 0,n=void 0;"block"===this.textToSealContainer.style.display?(t=this.textToSealCanvas,n=window.KGPdfViewerWebApp.textToSealDefault.textToSealType):"block"===this.indicateSealContainer.style.display?(t=this.indicateSealCanvas,n=window.KGPdfViewerWebApp.textToSealDefault.indicateSealType):(t=this.invariantSealCanvas,n=window.KGPdfViewerWebApp.textToSealDefault.invariantSealType);var r=t.toDataURL("image/png",1);return window.KGPdfViewerWebApp.transparentImg(r).then(function(i){if(!i||"string"!=typeof i)return Promise.reject("生成印章失败");e.activeSeal={originImgData:r,imgData:"data:image/png;base64,"+i,width:.25*t.width,height:.25*t.height,customType:n},document.body.style.cursor="move"}).then(function(){return e.close()}).then(function(){e.documentEventRegister(!0)}).catch(function(t){e.close().then(function(){e.app.KGAlertPrompt.open(t)})})}},{key:"documentEventRegister",value:function(e){e?(document.body.addEventListener("contextmenu",this.onDocumentContextmenu),document.body.addEventListener("mousedown",this.onDocumentClick),document.body.addEventListener("mousemove",this.onMouseMove),this.sealSectionEventRegister(!1)):(document.body.removeEventListener("contextmenu",this.onDocumentContextmenu),document.body.removeEventListener("mousedown",this.onDocumentClick),document.body.removeEventListener("mousemove",this.onMouseMove),this.sealSectionEventRegister(!0))}},{key:"handleSealOnMoveStart",value:function(e){e&&"IMG"===e.target.nodeName&&0===e.button&&(this.movingData.movingSealSection=e.target.parentNode,this.movingData.offsetX=e.offsetX,this.movingData.offsetY=e.offsetY,this.movingData.isMoving=!0,this.movingData.movingSealSection.querySelector("img").style.opacity=.9)}},{key:"handleSealOnMoving",value:function(e){var t=this;if(this.movingData.isMoving){var n=(0,c.convertScreenToViewportPoint)(e,this.app.pdfSidebar);if(n){var r=n.pageX,a=n.pageY,o=n.pageNumber,s=this.app.pdfViewer.getPageView(Number(o)-1),l=s.annotationLayer,u=s.viewport.scale,h=this.seals.filter(function(e){return e.section.id===t.movingData.movingSealSection.id})[0];if(h&&!h.hasSaved&&(h.left=r/u-this.movingData.offsetX,h.top=a/u-this.movingData.offsetY,(0,d.setSectionStyle)(this.movingData.movingSealSection,u,h.left,h.top),Number(h.page)>1&&Number(o)<Number(h.page)||Number(h.page)<this.app.pagesCount&&Number(o)>Number(h.page))){this.movingData.movingSealSection.parentNode.removeChild(this.movingData.movingSealSection),l.div||(l.div=document.createElement("div"),l.div.className="annotationLayer",s.div.appendChild(l.div)),l.div.appendChild(this.movingData.movingSealSection);var p=this.app.pdfViewer.getPageView(Number(h.page)-1);p.deleteStampCallback=function(){var e=p.div.querySelector(".canvasWrapper"),n=p.div.querySelector(".textLayer");e&&p.div.removeChild(e),n&&p.div.removeChild(n);var r=t.app.pdfThumbnailViewer.getThumbnail(p.pdfPage.pageIndex);r.renderingState=i.RenderingStates.INITIAL,r.setImage(p)},p.renderingState=i.RenderingStates.INITIAL,p.renderingQueue.renderView(p);for(var f=0;f<p.pdfPage.textToSeals.length;f++)if(p.pdfPage.textToSeals[f].section.id===h.section.id){p.pdfPage.textToSeals.splice(f,1);break}h.page=o,s.pdfPage.textToSeals.push(h)}}}}},{key:"handleSealOnMoveEnd",value:function(e){var t=this;if(this.movingData.isMoving){this.movingData.isMoving=!1;var n=(0,c.convertScreenToViewportPoint)(e,this.app.pdfSidebar);if(n){var r=n.pageNumber,a=this.app.pdfViewer.getPageView(Number(r)-1);a.deleteStampCallback=function(){var e=a.div.querySelector(".canvasWrapper"),n=a.div.querySelector(".textLayer");e&&a.div.removeChild(e),n&&a.div.removeChild(n),t.movingData.movingSealSection.querySelector("img").style.opacity=0;var r=t.app.pdfThumbnailViewer.getThumbnail(a.pdfPage.pageIndex);r.renderingState=i.RenderingStates.INITIAL,r.setImage(a)},a.renderingState=i.RenderingStates.INITIAL,a.renderingQueue.renderView(a)}}}},{key:"sealSectionEventRegister",value:function(e){var t=this;e?(this.seals.forEach(function(e){e.section&&e.section.addEventListener("mousedown",t.handleSealOnMoveStart)}),document.body.addEventListener("mousemove",this.handleSealOnMoving),document.body.addEventListener("mouseup",this.handleSealOnMoveEnd)):(this.seals.forEach(function(e){e.section&&e.section.removeEventListener("mouseout",t.handleSealOnMoveStart)}),document.body.removeEventListener("mousemove",this.handleSealOnMoving),document.body.removeEventListener("mouseup",this.handleSealOnMoveEnd))}},{key:"onMouseMove",value:function(e){var t=(0,c.convertScreenToViewportPoint)(e,this.app.pdfSidebar);if(t){var n=t.node,r=t.pageNumber,i=t.pageX,a=t.pageY,o=g(r);n.style.overflow="hidden";var s=this.app.pdfViewer.getPageView(r-1),l=s.annotationLayer,u=s.viewport.scale;if(l.div||(l.div=document.createElement("div"),l.div.className="annotationLayer",n.appendChild(l.div)),i>0&&a>0){this.activeSeal.section=document.getElementById(o);var h=i/u-this.activeSeal.width/2,f=a/u-this.activeSeal.height/2;if(this.activeSeal.section)(0,d.setSectionStyle)(this.activeSeal.section,u,h,f);else{y(p);var m=(new Date).getTime();this.activeSeal.section=v(this.activeSeal,o,m,p,h,f,u),l.div.appendChild(this.activeSeal.section)}}else y(p)}else y(p)}},{key:"onDocumentContextmenu",value:function(e){e.preventDefault(),y(p),this.activeSeal=null,document.body.style.cursor="default",this.documentEventRegister(!1)}},{key:"onDocumentClick",value:function(e){if(e&&0===e.button){var t=(0,c.convertScreenToViewportPoint)(e,this.app.pdfSidebar);if(t){var n=t.pageNumber,r=t.pageX,i=t.pageY,a=this.app.pdfViewer.getPageView(n-1),o=a.pdfPage.textToSeals;if(r<0||r>a.width||i<0||i>a.height)return;this.activeSeal.section.setAttribute("class","stampAnnotation"),this.activeSeal.left=(0,c.getNumbOfPx)(this.activeSeal.section.style.left),this.activeSeal.top=(0,c.getNumbOfPx)(this.activeSeal.section.style.top),this.activeSeal.width=(0,c.getNumbOfPx)(this.activeSeal.section.style.width),this.activeSeal.height=(0,c.getNumbOfPx)(this.activeSeal.section.style.height),this.activeSeal.page=n,this.activeSeal.createTime=(0,s.default)().format("YYYY-MM-DD HH:mm:ss"),this.activeSeal.section.style.zIndex="2",this.seals.push(this.activeSeal),o.push(this.activeSeal),this.activeSeal.section.querySelector("img").addEventListener("mousedown",m),this.activeSeal.section.querySelector("img").addEventListener("contextmenu",this.createRightMenu),this.updateUI(a,this.activeSeal.section),window.KGPdfViewerWebApp.textToSealCb(),this.onDocumentContextmenu(e)}}}},{key:"updateUI",value:function(e,t){var n=e.pdfPage,r=e.canvas,a=e.viewport,o=t.querySelector("img");o.style.opacity=0;var s=r.getContext("2d");s.globalCompositeOperation="multiply","multiply"!==s.globalCompositeOperation&&(s.globalAlpha=.85);var l=a.scale*(e.canvas.width/e.canvas.offsetWidth),u=((0,c.getNumbOfPx)(t.style.left)+1)*l,d=((0,c.getNumbOfPx)(t.style.top)+1)*l,h=(0,c.getNumbOfPx)(t.style.width)*l,p=(0,c.getNumbOfPx)(t.style.height)*l;s.drawImage(o,u,d,h,p);var f=this.app.pdfThumbnailViewer.getThumbnail(n.pageIndex);f.renderingState=i.RenderingStates.INITIAL,f.setImage(e)}},{key:"createRightMenu",value:function(e){if(e&&"IMG"===e.target.nodeName){e.preventDefault();var t=e.target.parentNode,n=this.seals.filter(function(e){return e.section.id===t.id})[0];if(n){if(n.hasSaved)return;(0,u.removeStampMenu)();var r=(0,c.convertScreenToViewportPoint)(e,this.app.pdfSidebar),a=r.pageNumber,o=r.pageX,s=r.pageY,l=this.app.pdfViewer.getPageView(a-1),d=document.createElement("div");d.id="rightMenu",d.style.position="absolute",d.style["background-color"]="white",d.style.border="1px solid #999",d.style.zIndex="200",l.viewport.width<parseFloat(o)+94&&(o-=94),l.viewport.height<parseFloat(s)+70&&(s-=70),d.style.top=s+"px",d.style.left=o+"px";var h=document.createElement("span");h.classList.add("menuDeleteSeal"),h.setAttribute("data-l10n-id","menuDeleteSeal"),d.appendChild(h),h.addEventListener("contextmenu",m),h.addEventListener("click",function(){var t=this;(0,u.removeStampMenu)();var n=e.target.parentNode;n.parentNode.removeChild(n);for(var r=this.seals.filter(function(e){return e.section.id===n.id})[0],a=this.app.pdfViewer.getPageView(r.page-1),o=a.pdfPage.textToSeals,s=0;s<o.length;s++)if(o[s].section.id===r.section.id){o.splice(s,1);break}for(var l=0;l<this.seals.length;l++)if(this.seals[l].section.id===n.id){this.seals.splice(l,1);break}a.deleteStampCallback=function(){var e=a.div.querySelector(".canvasWrapper"),n=a.div.querySelector(".textLayer");e&&a.div.removeChild(e),n&&a.div.removeChild(n);var r=t.app.pdfThumbnailViewer.getThumbnail(a.pdfPage.pageIndex);r.renderingState=i.RenderingStates.INITIAL,r.setImage(a)},a.renderingState=i.RenderingStates.INITIAL,a.renderingQueue.renderView(a)}.bind(this)),l.div.appendChild(d),this.app.l10n.translate(d)}}}},{key:"showTextToSeal",value:function(){switch(this.app.l10n._lang){case"zh-TW":this.container.querySelector(".kgtitle").innerHTML="轉文章";break;case"en-US":this.container.querySelector(".kgtitle").innerHTML="TextToSeal";break;default:this.container.querySelector(".kgtitle").innerHTML="转文章"}this.showTextToSealBtn.setAttribute("class","selected"),this.showTextToSealBtn.parentNode.style.borderBottomColor="#fff",this.textToSealContainer.style.display="block",this.showInvariantSealBtn.removeAttribute("class"),this.showInvariantSealBtn.parentNode.style.borderBottomColor="rgb(153, 153, 153)",this.invariantSealContainer.style.display="none",this.showIndicateSealBtn.removeAttribute("class"),this.showIndicateSealBtn.parentNode.style.borderBottomColor="rgb(153, 153, 153)",this.indicateSealContainer.style.display="none",this.drawTextToSeal()}},{key:"showIndicateSeal",value:function(){switch(this.app.l10n._lang){case"zh-TW":this.container.querySelector(".kgtitle").innerHTML="批示章";break;case"en-US":this.container.querySelector(".kgtitle").innerHTML="IndicateSeal";break;default:this.container.querySelector(".kgtitle").innerHTML="批示章"}this.showIndicateSealBtn.setAttribute("class","selected"),this.indicateSealContainer.style.display="block",this.showIndicateSealBtn.parentNode.style.borderBottomColor="#fff",this.showTextToSealBtn.removeAttribute("class"),this.textToSealContainer.style.display="none",this.showTextToSealBtn.parentNode.style.borderBottomColor="rgb(153, 153, 153)",this.showInvariantSealBtn.removeAttribute("class"),this.showInvariantSealBtn.parentNode.style.borderBottomColor="rgb(153, 153, 153)",this.invariantSealContainer.style.display="none",this.drawIndicateSeal()}},{key:"showInvariantSeal",value:function(){switch(this.app.l10n._lang){case"zh-TW":this.container.querySelector(".kgtitle").innerHTML="固定章";break;case"en-US":this.container.querySelector(".kgtitle").innerHTML="InvariantSeal";break;default:this.container.querySelector(".kgtitle").innerHTML="固定章"}this.showInvariantSealBtn.setAttribute("class","selected"),this.invariantSealContainer.style.display="block",this.showInvariantSealBtn.parentNode.style.borderBottomColor="#fff",this.showTextToSealBtn.removeAttribute("class"),this.textToSealContainer.style.display="none",this.showTextToSealBtn.parentNode.style.borderBottomColor="rgb(153, 153, 153)",this.showIndicateSealBtn.removeAttribute("class"),this.showIndicateSealBtn.parentNode.style.borderBottomColor="rgb(153, 153, 153)",this.indicateSealContainer.style.display="none",this.drawInvariantSeal()}},{key:"drawTextToSeal",value:function(){var e=this.textToSealCanvas;b(e,7,"#"+this.textToSealColor.value,3,[this.textToSealText.value,"第 "+this.textToSealNum.value+" 号",this.textToSealDate.value],Math.ceil(e.width/9))}},{key:"drawIndicateSeal",value:function(){var e=this.indicateSealCanvas,t="#"+this.indicateSealColor.value,n=this.indicateSealText.value;b(e,7,t,2,["网第 "+this.indicateSealNum.value+" 号",this.indicateSealDate.value],Math.ceil(e.width/9),!0,n)}},{key:"drawInvariantSeal",value:function(){var e=this.invariantSealCanvas,t=window.KGPdfViewerWebApp.textToSealDefault.invariantSealImgPath,n=new Image;n.onload=function(){var t=e.getContext("2d");function r(r){t.drawImage(n,0,0,n.width,n.height,(e.width-n.width*r*4)/2,(e.height-n.height*r*4)/2,n.width*r*4,n.height*r*4)}var i=e.height/e.width,a=n.height/n.width;t.fillStyle="#FFFFFF",t.fillRect(0,0,e.width,e.height),a<=i&&n.width>n.height?r(e.width/(4*n.width)):r(e.height/(4*n.height))},n.src=t}},{key:"export",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=f(this.seals),o=f(this.app.kgAnnotationViewer.annotationList),l="D:"+(0,s.default)().format("YYYYMMDDHHmmss")+"+08'00'";r||(i=i.filter(function(e){return!e.hasSaved})),i.forEach(function(e){var t;t=window.KGPdfViewerWebApp.PDFViewerApplication.pdfViewer.getPageView(Number(e.page)-1).viewport.viewBox[3]-e.height-e.top,e.x=e.left,e.y=t,e.styleId="12",e.styleName="Stamp",e.pageNo=e.page,e.curDateTime=l,e.authorName=window.KGPdfViewerWebApp.userId,e.annotInfo=JSON.stringify({customType:e.customType,type:e.styleName,author:e.authorName});var n=e.originImgData.split(",")[1];e.annotSignature=a.default.parse(n).toString(),delete e.customType,delete e.top,delete e.left,delete e.section,delete e.page,delete e.imgData,delete e.originImgData,delete e.hasSaved}),o.forEach(function(e){var t;t=window.KGPdfViewerWebApp.PDFViewerApplication.pdfViewer.getPageView(Number(e.page)-1).viewport.viewBox[3]-e.height-e.y,e.y=t,e.styleId="12",e.styleName="Stamp",e.pageNo=e.page,e.curDateTime=l,delete e.page});var c=void 0;if(c=t?JSON.stringify({d:i.concat(o)}).slice(5,-1):JSON.stringify({d:i}).slice(5,-1),n&&this.seals.forEach(function(e){e.hasSaved=!0}),!e)return c;e(c)}},{key:"save",value:function(){var e=window.KGPdfViewerWebApp.getTipPrompt(),t=window.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt;e.open("正在合并文档..."),this.export(function(n){window.KGPdfViewerWebApp.saveAnnotations(n).then(function(n){e.close(),"status"in n&&!1===n.status&&t.open(n.message)})},!1,!0,!1)}},{key:"saveAs",value:function(){this.export(function(e){window.KGPdfViewerWebApp.saveAnnotations(e,!0)},!1,!1,!1)}}]),e}();t.default=w},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!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}}();t.rotateBase64Img=function(e,t,n){var r=document.createElement("canvas"),i=r.getContext("2d"),a=void 0,o=void 0,s=void 0;if(t%90!=0)throw console.error("旋转角度必须是90的倍数!"),"旋转角度必须是90的倍数!";var l=t/90%4,c={sx:0,sy:0,ex:0,ey:0},u=new Image;u.crossOrigin="anonymous",u.src=e,u.onload=function(){switch(a=u.width,o=u.height,s=a>o?a:o,r.width=2*s,r.height=2*s,l){case 0:c.sx=s,c.sy=s,c.ex=s+a,c.ey=s+o;break;case 1:c.sx=s-o,c.sy=s,c.ex=s,c.ey=s+a;break;case 2:c.sx=s-a,c.sy=s-o,c.ex=s,c.ey=s;break;case 3:c.sx=s,c.sy=s-a,c.ex=s+o,c.ey=s+a}i.translate(s,s),i.rotate(t*Math.PI/180),i.drawImage(u,0,0);var e=i.getImageData(c.sx,c.sy,c.ex,c.ey);l%2==0?(r.width=a,r.height=o):(r.width=o,r.height=a),i.putImageData(e,0,0),n&&n(r.toDataURL())}},t.setSectionStyle=s;var i=n(14),a=n(24),o=n(5);function s(e,t,n,r,o,s){o&&(e.style.width=o+"px"),s&&(e.style.height=s+"px"),e.style.transform="matrix("+t+", 0, 0, "+t+", 0, 0)",n&&(e.style.left=n+"px"),r&&(e.style.top=r+"px"),i.CustomStyle.setProp("transform",e,"matrix("+t+", 0, 0, "+t+", 0, 0)"),i.CustomStyle.setProp("transformOrigin",e,-1*(n||(0,a.getNumbOfPx)(e.style.left))+"px "+-1*r+"px")}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.app=window.KGPdfViewerWebApp.PDFViewerApplication,this.isMobile="1"===window.KGPdfViewerWebApp.mobile.toString(),this.deleteNodeSize=this.isMobile?27:18,this.createScaleNode=this.createScaleNode.bind(this);var r=t.id+"-"+(new Date).getTime().toString();for(var i in this.section=t.cloneNode(!0),this.section.setAttribute("id",r),this.section.setAttribute("class","tempStampSection"),this.sealData={},n)n.hasOwnProperty(i)&&(this.sealData[i]=n[i]);if(this.sealData.lastSelected=Object.create(null),this.sealData.extraPosition=Object.create(null),this.banNodeList=[],this.sealData._tempStampkey=r,this.sealData.isContinuityStampCheck)for(var a=this.sealData.page.split("-"),l=parseInt(a[0]),c=parseInt(a[1]),u=this.sealData.actionPageInfo,d=l;d<=c;d++){var h=this.section.cloneNode(!0);h.setAttribute("id",this.section.id+"-"+d);var p=this.app.pdfViewer.getPageView(d-1),f=p.div,m=parseInt(getComputedStyle(f).width),g=parseInt(getComputedStyle(f).height),v={width:m,height:g,direction:g>m?"vertical":"horizontal"},y=u.direction!=v.direction,b=y?u.height!=v.width:u.width!=v.width,w=p.viewport,S=p.annotationLayer,_=p.pdfPage.tempStamps,P=w.scale;if(this.createDeleteNode(h),h.querySelector("img").onmousedown=function(e){e.preventDefault()},h.oncontextmenu=function(e){e.preventDefault()},y){var A=(0,o.getXYPoint)(this.sealData,{width:g/P,height:m/P});s(h,P,A.r_left,A.r_top)}if(b){var k=v.width/u.width,C=v.height/u.height,x=(0,o.getXYPoint_diffentSize)({wRatio:k,hRatio:C,tempSeal:this.sealData}),T=x.d_top;s(h,P,x.d_left,T)}_[h.id]=h,S&&(S.div||(S.div=document.createElement("div"),S.div.className="annotationLayer",p.div.appendChild(S.div)),S.div.appendChild(h))}else if(this.sealData.isStampOfQfz)for(var D=0;D<this.sealData.qfzSeal.length;D++){var E=this.sealData.qfzSeal[D];E.sealdata=[],E.sealdata[0]={left:E.left,width:E.width,imgdata:E.imgdata},delete E.left,delete E.width,delete E.imgdata;var I=this.section.cloneNode(!0);I.setAttribute("id",this.section.id+"-"+E.page);var O=this.app.pdfViewer.getPageView(E.page-1),R=O.viewport,M=O.annotationLayer,W=O.pdfPage.tempStamps,L=R.scale,N=O.width/L;I.style.width=E.sealdata[0].width+"px",I.style.height=E.height+"px",E.sealdata[0].left=N-E.sealdata[0].width,s(I,L,E.sealdata[0].left,E.top),I.querySelector("img").src=E.sealdata[0].imgdata,this.createDeleteNode(I),I.querySelector("img").onmousedown=function(e){e.preventDefault()},I.oncontextmenu=function(e){e.preventDefault()},W[I.id]=I,M&&(M.div||(M.div=document.createElement("div"),M.div.className="annotationLayer",O.div.appendChild(M.div)),M.div.appendChild(I))}else{var F=this.app.pdfViewer.getPageView(Number(this.sealData.currentPage)-1),G=F.annotationLayer,V=F.div,K=F.pdfPage.tempStamps;if(this.createDeleteNode(this.section),"signature"!==this.sealData.sealType||window.KGPdfViewerWebApp.fingerPrint||this.createScaleNode(this.section),this.section.querySelector("img").onmousedown=function(e){e.preventDefault()},this.section.oncontextmenu=function(e){e.preventDefault()},K[this.section.id]=this.section,!G)return;G.div||(G.div=document.createElement("div"),G.div.className="annotationLayer",V.appendChild(G.div)),G.div.appendChild(this.section)}}return r(e,[{key:"createScaleNode",value:function(e){if(!window.KGPdfViewerWebApp.hideDeleteNode){var t=document.createElement("a"),n=document.createElement("img");t.classList.add("scaleTempStampSection"),t.style.cursor="se-resize",t.style.position="absolute",t.style.padding="10px",n.setAttribute("src","images/move.png"),n.style.width="100%",n.style.height="100%",this.isMobile?(t.style.width="24px",t.style.height="24px",t.style.right="-22px",t.style.bottom="-22px"):(t.style.width="16px",t.style.height="16px",t.style.right="-18px",t.style.bottom="-18px",n.addEventListener("mousedown",function(e){e.preventDefault()})),e.appendChild(t),t.appendChild(n)}}},{key:"createDeleteNode",value:function(e){if(!window.KGPdfViewerWebApp.hideDeleteNode){var t=document.createElement("a"),n=document.createElement("img");t.setAttribute("class","deleteTempStampSection"),t.style.padding="10px",n.setAttribute("src","images/close.png"),this.isMobile?(t.style.width="24px",t.style.height="24px",t.style.right="-22px",t.style.top="-22px"):this.sealData.isStampOfQfz?(t.style.width="16px",t.style.height="16px",t.style.left="-18px",t.style.top="-18px"):(t.style.width="16px",t.style.height="16px",t.style.right="-18px",t.style.top="-18px"),e.appendChild(t),t.appendChild(n)}}},{key:"delete",value:function(e){var t=void 0;if("IMG"===e.target.nodeName&&e.target.parentNode.classList.contains("deleteTempStampSection"))t=e.target.parentNode.parentNode;else{if(!e.target.classList.contains("deleteTempStampSection"))return;t=e.target.parentNode}var n=this.sealData.isContinuityStampCheck?t.id.slice(0,-2):t.id;if(this.sealData.isContinuityStampCheck){var r=this.sealData.page.split("-"),i=parseInt(r[0]),a=parseInt(r[1]);n=[n.split("-")[0],n.split("-")[1]].join("-");for(var o=i;o<=a;o++){var s=this.app.pdfViewer.getPageView(o-1),l=s.annotationLayer,c=s.pdfPage.tempStamps,u=n+"-"+o,d=document.getElementById(u);c.hasOwnProperty(u)&&delete c[u],d&&l&&l.div&&l.div.removeChild(d)}window.KGPdfViewerWebApp.chainStamp||this.banNodeList.map(function(e){e.style["pointer-events"]="auto"})}else if(this.sealData.isStampOfQfz)for(var h=0;h<this.sealData.qfzSeal.length;h++){var p=this.sealData.qfzSeal[h],f=this.app.pdfViewer.getPageView(p.page-1),m=f.annotationLayer,g=f.pdfPage.tempStamps,v=(n=[n.split("-")[0],n.split("-")[1]].join("-"))+"-"+p.page,y=document.getElementById(v);g.hasOwnProperty(v)&&delete g[v],y&&m&&m.div&&m.div.removeChild(y)}else{var b=this.app.pdfViewer.getPageView(Number(this.sealData.page)-1),w=b.annotationLayer,S=b.pdfPage.tempStamps,_=document.getElementById(n);S.hasOwnProperty(n)&&delete S.id,_&&w&&w.div&&w.div.removeChild(_)}this.app.pdfStamp.tempSeals=this.app.pdfStamp.tempSeals.filter(function(e){return e.section.id!==n}),this.app.KGStampConfirm.sealDatas=this.app.pdfStamp.tempSeals.map(function(e){return e.sealData}),this.app.pdfStamp.tempSeals.length||(this.app.pdfStamp.cancelStamp(),this.app.KGStampConfirm.hide(),this.app.KG_ScanStamp&&this.app.KG_ScanStamp.clearSealData())}},{key:"eventRegister",value:function(){var e=this.app,t=e.pdfViewer,n=e.pdfSidebar,r=this.sealData,i=this.section,l=this;function c(c){var u=!1,d=!1,h=!1,p=0,f=0,m=0,g=0;function v(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.currentPage,i=t.getPageView(Number(n)-1).pdfPage.tempStamps;i.hasOwnProperty(e.id)&&delete i[e.id]}function y(e,n){if(!r.isStampOfQfz){r.page=r.currentPage=parseInt(e);var i=t.getPageView(parseInt(e)-1),a=i.annotationLayer;i.pdfPage.tempStamps[n.id]=n,a.div||(a.div=document.createElement("div"),a.div.className="annotationLayer",i.div.appendChild(a.div)),n.parentNode.removeChild(n),a.div.appendChild(n)}}function b(e){e.preventDefault(),e.stopPropagation(),c.style.zIndex=200,!window.KGPdfViewerWebApp.chainStamp&&r.isContinuityStampCheck&&(l.banNodeList=[].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)}(c.parentNode.children)),l.banNodeList.map(function(e){e.style["pointer-events"]="none"}),c.style["pointer-events"]="auto"),("IMG"===e.target.nodeName&&e.target.parentNode.classList.contains("deleteTempStampSection")||e.target.classList.contains("deleteTempStampSection"))&&l.delete(e),("IMG"===e.target.nodeName&&e.target.parentNode.classList.contains("scaleTempStampSection")||e.target.classList.contains("scaleTempStampSection"))&&(g=l.isMobile?e.touches[0].clientX:e.clientX,m=(0,a.getNumbOfPx)(c.style.width),h=!0),("IMG"===e.target.nodeName&&e.target.parentNode.classList.contains("tempStampSection")||e.target.classList.contains("tempStampSection"))&&(p=e.offsetX||e.target.offsetWidth/2,f=e.offsetY||e.target.offsetHeight/2,u=!0),l.isMobile&&(document.ontouchmove=w,document.ontouchend=S)}function w(b){if(!window.KGPdfViewerWebApp.chainStamp&&r.isContinuityStampCheck){if("IMG"!==b.target.nodeName)return;if("move"!==window.getComputedStyle(b.target.parentNode).cursor)return}if(u){var w=(0,a.convertScreenToViewportPoint)(b,n);if(w){var S=(0,a.getNumbOfPx)(c.style.height),_=w.pageNumber,P=w.pageX,A=w.pageY,k=t.getPageView(parseInt(_)-1),C=k.viewport.scale,x=k.width/C,T=k.height/C,D=P/C-p,E=A/C-f,I=r.left,O=r.top,R=r.xsacle,M=r.ysacle;if(r.isStampOfQfz?(E<0&&(E=0),E>T-S&&(E=T-S)):r.left=D,r.top=E,r.isContinuityStampCheck){d=!0;var W=k.div,L=parseInt(getComputedStyle(W).width),N=parseInt(getComputedStyle(W).height),F={width:L,height:N,direction:N>L?"vertical":"horizontal"},G=(0,o.getXYPoint)(r,{width:L/C,height:N/C}),V=G.XYType,K=G.xsacle,j=G.ysacle,B=G.r_left,U=G.r_top;r.xsacle=K,r.ysacle=j,s(i,C,D,E);for(var q=r.page.split("-"),z=parseInt(q[0]),Y=parseInt(q[1]),H=[],X=z;X<=Y;X++){var J=e.pdfViewer.getPageView(X-1),Q=J.div,Z=J.pdfPage.tempStamps,$=parseInt(getComputedStyle(Q).width),ee=parseInt(getComputedStyle(Q).height),te={width:$,height:ee,direction:ee>$?"vertical":"horizontal"},ne=F.direction!=te.direction,re=ne?F.height!=te.width:F.width!=te.width,ie={wRatio:te.width/F.width,hRatio:te.height/F.height};for(var ae in Z)-1!=ae.indexOf(i.id)&&(Z[ae].isRotate=ne,Z[ae].isDiffentSize=re,Z[ae].ratio=ie,Z[ae].page={width:$,height:ee},H.push((be={},we=ae,Se=Z[ae],we in be?Object.defineProperty(be,we,{value:Se,enumerable:!0,configurable:!0,writable:!0}):be[we]=Se,be)))}if(window.KGPdfViewerWebApp.chainStamp){r.XYType=V;var oe=void 0,se=void 0;H.map(function(e,t){var n=i.id+"-"+(t+z);if(e.hasOwnProperty(n)){var a=e[n],l=a.isRotate,c=a.isDiffentSize,u=a.ratio;if(l?(oe=U,se=B):(oe=E,se=D),c){var d=(0,o.getXYPoint_diffentSize)({wRatio:u.wRatio,hRatio:u.hRatio,tempSeal:r}),h=d.d_top,p=d.d_left;oe=h,se=p}s(e[n],C,se,oe)}})}else{var le=(0,o.closest)(b.target,"section");if(!le)return;var ce=(0,o.getXYPoint)(r,{width:L/C,height:N/C}),ue=ce.xsacle,de=ce.ysacle;s(le,C,D,E),r.extraPosition[_]=(0,o.removePrototype)({left:D,top:E,xsacle:ue,ysacle:de,XYType:V}),r.lastSelected=(0,o.removePrototype)({index:_,tempStampSections:H,scale:C}),r.top=O,r.left=I,r.xsacle=R,r.ysacle=M,l.app.pdfStamp.selectSealData=l.sealData}}else if(r.isStampOfQfz){r.xsacle=D/x,r.ysacle=E/T,s(i,C,null,E);var he=(0,a.getNumbOfPx)(c.style.height),pe=(0,a.getNumbOfPx)(c.style.top),fe=T-pe-he;r.pageAttr.bottom=fe,r.pageAttr.top=pe+he;for(var me=0;me<r.qfzSeal.length;me++){var ge=r.qfzSeal[me];ge.top=E;var ve=i.id+"-"+ge.page,ye=e.pdfViewer.getPageView(ge.page-1).pdfPage.tempStamps;ye.hasOwnProperty(ve)&&s(ye[ve],C,null,E)}}else s(c,C,D,E),l.isMobile?(r.currentPage<e.pagesCount&&E+S/2>T&&(v(c),y(parseInt(_)+1,c)),r.currentPage>1&&E<0&&-E>S/2&&(v(c),y(parseInt(_)-1,c))):(r.currentPage>1&&Number(_)<Number(r.currentPage)||r.currentPage<e.pagesCount&&Number(_)>Number(r.currentPage))&&(v(c),y(_,c))}}var be,we,Se;if(h){var _e=(0,a.convertScreenToViewportPoint)(b,n);if(_e){var Pe=_e.pageNumber,Ae=t.getPageView(parseInt(Pe)-1).viewport.scale,ke=(0,a.getNumbOfPx)(c.style.width)*Ae,Ce=(0,a.getNumbOfPx)(c.style.height)*Ae,xe=Ce/ke;l.isMobile?r.width=ke=(m*Ae-g+b.touches[0].clientX)/Ae:r.width=ke=(m*Ae-g+b.clientX)/Ae,r.height=Ce=ke*xe,s(c,Ae,void 0,void 0,ke,Ce)}}}function S(){d&&function(){if(window.KGPdfViewerWebApp.chainStamp)return;r.isContinuityStampCheck&&l.banNodeList.map(function(e){e.style["pointer-events"]="auto"});l.app.pdfStamp.continuityStampModal.open()}(),c.style.zIndex=100,d=!1,u=!1,h=!1,p=0,f=0,m=0,g=0}l.isMobile?c.ontouchstart=b:c.onmouseenter=function(){c.onmousedown=b,document.onmousemove=w,document.onmouseup=S}}if(r.isContinuityStampCheck)for(var u=r.page.split("-"),d=parseInt(u[0]),h=parseInt(u[1]),p=d;p<=h;p++){var f=i.id+"-"+p,m=e.pdfViewer.getPageView(p-1).pdfPage.tempStamps;m.hasOwnProperty(f)&&c(m[f])}else if(r.isStampOfQfz)for(var g=0;g<r.qfzSeal.length;g++){var v=r.qfzSeal[g],y=i.id+"-"+v.page,b=e.pdfViewer.getPageView(v.page-1).pdfPage.tempStamps;b.hasOwnProperty(y)&&c(b[y])}else{var w=i.id,S=e.pdfViewer.getPageView(Number(r.page)-1).pdfPage.tempStamps;S.hasOwnProperty(w)&&c(S[w])}}},{key:"eventUnregister",value:function(){var e=this.app,t=this.sealData,n=this.section;if(t.isContinuityStampCheck)for(var r=t.page.split("-"),i=parseInt(r[0]),a=parseInt(r[1]),o=i;o<=a;o++){var s=n.id+"-"+o,l=e.pdfViewer.getPageView(o-1).pdfPage.tempStamps;l.hasOwnProperty(s)&&(l[s].onmouseenter=null)}else if(t.isStampOfQfz)for(var c=0;c<t.qfzSeal.length;c++){var u=t.qfzSeal[c],d=n.id+"-"+u.page,h=e.pdfViewer.getPageView(u.page-1).pdfPage.tempStamps;h.hasOwnProperty(d)&&(h[d].onmouseenter=null)}else{var p=n.id,f=e.pdfViewer.getPageView(Number(t.page)-1).pdfPage.tempStamps;f.hasOwnProperty(p)&&(f[p].onmouseenter=null)}}}]),e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.renderTextLayer=void 0;var r=n(1),i=n(14),a=function(){var e=1e5,t=/\S/;var n=["left: ",0,"px; top: ",0,"px; font-size: ",0,"px; font-family: ","",";"];function a(e,a,o){var s,l=document.createElement("div"),c={style:null,angle:0,canvasWidth:0,isWhitespace:!1,originalTransform:null,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,scale:1};if(e._textDivs.push(l),s=a.str,!t.test(s))return c.isWhitespace=!0,void e._textDivProperties.set(l,c);var u=r.Util.transform(e._viewport.transform,a.transform),d=Math.atan2(u[1],u[0]),h=o[a.fontName];h.vertical&&(d+=Math.PI/2);var p,f,m=Math.sqrt(u[2]*u[2]+u[3]*u[3]),g=m;if(h.ascent?g=h.ascent*g:h.descent&&(g=(1+h.descent)*g),0===d?(p=u[4],f=u[5]-g):(p=u[4]+g*Math.sin(d),f=u[5]-g*Math.cos(d)),n[1]=p,n[3]=f,n[5]=m,n[7]=h.fontFamily,c.style=n.join(""),l.setAttribute("style",c.style),l.textContent=a.str,(0,i.getDefaultSetting)("pdfBug")&&(l.dataset.fontName=a.fontName),0!==d&&(c.angle=d*(180/Math.PI)),a.str.length>1&&(h.vertical?c.canvasWidth=a.height*e._viewport.scale:c.canvasWidth=a.width*e._viewport.scale),e._textDivProperties.set(l,c),e._textContentStream&&e._layoutText(l),e._enhanceTextSelection){var v=1,y=0;0!==d&&(v=Math.cos(d),y=Math.sin(d));var b,w,S=(h.vertical?a.height:a.width)*e._viewport.scale,_=m;0!==d?(b=[v,y,-y,v,p,f],w=r.Util.getAxialAlignedBoundingBox([0,0,S,_],b)):w=[p,f,p+S,f+_],e._bounds.push({left:w[0],top:w[1],right:w[2],bottom:w[3],div:l,size:[S,_],m:b})}}function o(t){if(!t._canceled){var n=t._textDivs,r=t._capability,i=n.length;if(i>e)return t._renderingDone=!0,void r.resolve();if(!t._textContentStream)for(var a=0;a<i;a++)t._layoutText(n[a]);t._renderingDone=!0,r.resolve()}}function s(e){for(var t=e._bounds,n=e._viewport,i=function(e,t,n){var r=n.map(function(e,t){return{x1:e.left,y1:e.top,x2:e.right,y2:e.bottom,index:t,x1New:void 0,x2New:void 0}});l(e,r);var i=new Array(n.length);return r.forEach(function(e){var t=e.index;i[t]={left:e.x1New,top:0,right:e.x2New,bottom:0}}),n.map(function(t,n){var a=i[n],o=r[n];o.x1=t.top,o.y1=e-a.right,o.x2=t.bottom,o.y2=e-a.left,o.index=n,o.x1New=void 0,o.x2New=void 0}),l(t,r),r.forEach(function(e){var t=e.index;i[t].top=e.x1New,i[t].bottom=e.x2New}),i}(n.width,n.height,t),a=0;a<i.length;a++){var o=t[a].div,s=e._textDivProperties.get(o);if(0!==s.angle){var c=i[a],u=t[a],d=u.m,h=d[0],p=d[1],f=[[0,0],[0,u.size[1]],[u.size[0],0],u.size],m=new Float64Array(64);f.forEach(function(e,t){var n=r.Util.applyTransform(e,d);m[t+0]=h&&(c.left-n[0])/h,m[t+4]=p&&(c.top-n[1])/p,m[t+8]=h&&(c.right-n[0])/h,m[t+12]=p&&(c.bottom-n[1])/p,m[t+16]=p&&(c.left-n[0])/-p,m[t+20]=h&&(c.top-n[1])/h,m[t+24]=p&&(c.right-n[0])/-p,m[t+28]=h&&(c.bottom-n[1])/h,m[t+32]=h&&(c.left-n[0])/-h,m[t+36]=p&&(c.top-n[1])/-p,m[t+40]=h&&(c.right-n[0])/-h,m[t+44]=p&&(c.bottom-n[1])/-p,m[t+48]=p&&(c.left-n[0])/p,m[t+52]=h&&(c.top-n[1])/-h,m[t+56]=p&&(c.right-n[0])/p,m[t+60]=h&&(c.bottom-n[1])/-h});var g=function(e,t,n){for(var r=0,i=0;i<n;i++){var a=e[t++];a>0&&(r=r?Math.min(a,r):a)}return r},v=1+Math.min(Math.abs(h),Math.abs(p));s.paddingLeft=g(m,32,16)/v,s.paddingTop=g(m,48,16)/v,s.paddingRight=g(m,0,16)/v,s.paddingBottom=g(m,16,16)/v,e._textDivProperties.set(o,s)}else s.paddingLeft=t[a].left-i[a].left,s.paddingTop=t[a].top-i[a].top,s.paddingRight=i[a].right-t[a].right,s.paddingBottom=i[a].bottom-t[a].bottom,e._textDivProperties.set(o,s)}}function l(e,t){t.sort(function(e,t){return e.x1-t.x1||e.index-t.index});var n=[{start:-1/0,end:1/0,boundary:{x1:-1/0,y1:-1/0,x2:0,y2:1/0,index:-1,x1New:0,x2New:0}}];t.forEach(function(e){for(var t=0;t<n.length&&n[t].end<=e.y1;)t++;for(var r,i,a=n.length-1;a>=0&&n[a].start>=e.y2;)a--;var o,s,l=-1/0;for(o=t;o<=a;o++){var c;(c=(i=(r=n[o]).boundary).x2>e.x1?i.index>e.index?i.x1New:e.x1:void 0===i.x2New?(i.x2+e.x1)/2:i.x2New)>l&&(l=c)}for(e.x1New=l,o=t;o<=a;o++)void 0===(i=(r=n[o]).boundary).x2New?i.x2>e.x1?i.index>e.index&&(i.x2New=i.x2):i.x2New=l:i.x2New>l&&(i.x2New=Math.max(l,i.x2));var u=[],d=null;for(o=t;o<=a;o++){var h=(i=(r=n[o]).boundary).x2>e.x2?i:e;d===h?u[u.length-1].end=r.end:(u.push({start:r.start,end:r.end,boundary:h}),d=h)}for(n[t].start<e.y1&&(u[0].start=e.y1,u.unshift({start:n[t].start,end:e.y1,boundary:n[t].boundary})),e.y2<n[a].end&&(u[u.length-1].end=e.y2,u.push({start:e.y2,end:n[a].end,boundary:n[a].boundary})),o=t;o<=a;o++)if(void 0===(i=(r=n[o]).boundary).x2New){var p=!1;for(s=t-1;!p&&s>=0&&n[s].start>=i.y1;s--)p=n[s].boundary===i;for(s=a+1;!p&&s<n.length&&n[s].end<=i.y2;s++)p=n[s].boundary===i;for(s=0;!p&&s<u.length;s++)p=u[s].boundary===i;p||(i.x2New=l)}Array.prototype.splice.apply(n,[t,a-t+1].concat(u))}),n.forEach(function(t){var n=t.boundary;void 0===n.x2New&&(n.x2New=Math.max(e,n.x2))})}function c(e){var t=e.textContent,n=e.textContentStream,i=e.container,a=e.viewport,o=e.textDivs,s=e.textContentItemsStr,l=e.enhanceTextSelection;this._textContent=t,this._textContentStream=n,this._container=i,this._viewport=a,this._textDivs=o||[],this._textContentItemsStr=s||[],this._enhanceTextSelection=!!l,this._reader=null,this._layoutTextLastFontSize=null,this._layoutTextLastFontFamily=null,this._layoutTextCtx=null,this._textDivProperties=new WeakMap,this._renderingDone=!1,this._canceled=!1,this._capability=(0,r.createPromiseCapability)(),this._renderTimer=null,this._bounds=[]}return c.prototype={get promise(){return this._capability.promise},cancel:function(){this._reader&&(this._reader.cancel(new r.AbortException("text layer task cancelled")),this._reader=null),this._canceled=!0,null!==this._renderTimer&&(clearTimeout(this._renderTimer),this._renderTimer=null),this._capability.reject("canceled")},_processItems:function(e,t){for(var n=0,r=e.length;n<r;n++)this._textContentItemsStr.push(e[n].str),a(this,e[n],t)},_layoutText:function(e){var t=this._container,n=this._textDivProperties.get(e);if(!n.isWhitespace){var r=e.style.fontSize,a=e.style.fontFamily;r===this._layoutTextLastFontSize&&a===this._layoutTextLastFontFamily||(this._layoutTextCtx.font=r+" "+a,this._lastFontSize=r,this._lastFontFamily=a);var o=this._layoutTextCtx.measureText(e.textContent).width,s="";0!==n.canvasWidth&&o>0&&(n.scale=n.canvasWidth/o,s="scaleX("+n.scale+")"),0!==n.angle&&(s="rotate("+n.angle+"deg) "+s),""!==s&&(n.originalTransform=s,i.CustomStyle.setProp("transform",e,s)),this._textDivProperties.set(e,n),t.appendChild(e)}},_render:function(e){var t=this,n=(0,r.createPromiseCapability)(),i=Object.create(null),a=document.createElement("canvas");if(a.mozOpaque=!0,this._layoutTextCtx=a.getContext("2d",{alpha:!1}),this._textContent){var s=this._textContent.items,l=this._textContent.styles;this._processItems(s,l),n.resolve()}else{if(!this._textContentStream)throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');this._reader=this._textContentStream.getReader(),function e(){t._reader.read().then(function(a){var o=a.value;a.done?n.resolve():(r.Util.extendObj(i,o.styles),t._processItems(o.items,i),e())},n.reject)}()}n.promise.then(function(){i=null,e?t._renderTimer=setTimeout(function(){o(t),t._renderTimer=null},e):o(t)},this._capability.reject)},expandTextDivs:function(e){if(this._enhanceTextSelection&&this._renderingDone){null!==this._bounds&&(s(this),this._bounds=null);for(var t=0,n=this._textDivs.length;t<n;t++){var r=this._textDivs[t],a=this._textDivProperties.get(r);if(!a.isWhitespace)if(e){var o="",l="";1!==a.scale&&(o="scaleX("+a.scale+")"),0!==a.angle&&(o="rotate("+a.angle+"deg) "+o),0!==a.paddingLeft&&(l+=" padding-left: "+a.paddingLeft/a.scale+"px;",o+=" translateX("+-a.paddingLeft/a.scale+"px)"),0!==a.paddingTop&&(l+=" padding-top: "+a.paddingTop+"px;",o+=" translateY("+-a.paddingTop+"px)"),0!==a.paddingRight&&(l+=" padding-right: "+a.paddingRight/a.scale+"px;"),0!==a.paddingBottom&&(l+=" padding-bottom: "+a.paddingBottom+"px;"),""!==l&&r.setAttribute("style",a.style+l),""!==o&&i.CustomStyle.setProp("transform",r,o)}else r.style.padding=0,i.CustomStyle.setProp("transform",r,a.originalTransform||"")}}}},function(e){var t=new c({textContent:e.textContent,textContentStream:e.textContentStream,container:e.container,viewport:e.viewport,textDivs:e.textDivs,textContentItemsStr:e.textContentItemsStr,enhanceTextSelection:e.enhanceTextSelection});return t._render(e.timeout),t}}();t.renderTextLayer=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SVGGraphics=void 0;var r,i=n(1),a=n(14),o={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},s=function(){for(var e=new Uint8Array([137,80,78,71,13,10,26,10]),t=12,n=new Int32Array(256),r=0;r<256;r++){for(var a=r,o=0;o<8;o++)a=1&a?3988292384^a>>1&2147483647:a>>1&2147483647;n[r]=a}function s(e,t,r,i){var a=i,o=t.length;r[a]=o>>24&255,r[a+1]=o>>16&255,r[a+2]=o>>8&255,r[a+3]=255&o,r[a+=4]=255&e.charCodeAt(0),r[a+1]=255&e.charCodeAt(1),r[a+2]=255&e.charCodeAt(2),r[a+3]=255&e.charCodeAt(3),a+=4,r.set(t,a);var s=function(e,t,r){for(var i=-1,a=t;a<r;a++){var o=255&(i^e[a]);i=i>>>8^n[o]}return-1^i}(r,i+4,a+=t.length);r[a]=s>>24&255,r[a+1]=s>>16&255,r[a+2]=s>>8&255,r[a+3]=255&s}function l(e){var t=e.length,n=Math.ceil(t/65535),r=new Uint8Array(2+t+5*n+4),i=0;r[i++]=120,r[i++]=156;for(var a=0;t>65535;)r[i++]=0,r[i++]=255,r[i++]=255,r[i++]=0,r[i++]=0,r.set(e.subarray(a,a+65535),i),i+=65535,a+=65535,t-=65535;r[i++]=1,r[i++]=255&t,r[i++]=t>>8&255,r[i++]=255&~t,r[i++]=(65535&~t)>>8&255,r.set(e.subarray(a),i),i+=e.length-a;var o=function(e,t,n){for(var r=1,i=0,a=t;a<n;++a)i=(i+(r=(r+(255&e[a]))%65521))%65521;return i<<16|r}(e,0,e.length);return r[i++]=o>>24&255,r[i++]=o>>16&255,r[i++]=o>>8&255,r[i++]=255&o,r}function c(n,r,a){var o,c,u,d=n.width,h=n.height,p=n.data;switch(r){case i.ImageKind.GRAYSCALE_1BPP:c=0,o=1,u=d+7>>3;break;case i.ImageKind.RGB_24BPP:c=2,o=8,u=3*d;break;case i.ImageKind.RGBA_32BPP:c=6,o=8,u=4*d;break;default:throw new Error("invalid format")}var f,m,g=new Uint8Array((1+u)*h),v=0,y=0;for(f=0;f<h;++f)g[v++]=0,g.set(p.subarray(y,y+u),v),y+=u,v+=u;if(r===i.ImageKind.GRAYSCALE_1BPP)for(v=0,f=0;f<h;f++)for(v++,m=0;m<u;m++)g[v++]^=255;var b=new Uint8Array([d>>24&255,d>>16&255,d>>8&255,255&d,h>>24&255,h>>16&255,h>>8&255,255&h,o,c,0,0,0]),w=function(e){if(!(0,i.isNodeJS)())return l(e);try{var t;t=parseInt(process.versions.node)>=8?e:new Buffer(e);var n=require("zlib").deflateSync(t,{level:9});return n instanceof Uint8Array?n:new Uint8Array(n)}catch(e){(0,i.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+e)}return l(e)}(g),S=e.length+3*t+b.length+w.length,_=new Uint8Array(S),P=0;return _.set(e,P),s("IHDR",b,_,P+=e.length),s("IDATA",w,_,P+=t+b.length),P+=t+w.length,s("IEND",new Uint8Array(0),_,P),(0,i.createObjectURL)(_,"image/png",a)}return function(e,t){return c(e,void 0===e.kind?i.ImageKind.GRAYSCALE_1BPP:e.kind,t)}}(),l=function(){function e(){this.fontSizeScale=1,this.fontWeight=o.fontWeight,this.fontSize=0,this.textMatrix=i.IDENTITY_MATRIX,this.fontMatrix=i.FONT_IDENTITY_MATRIX,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=o.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}return e.prototype={clone:function(){return Object.create(this)},setCurrentPoint:function(e,t){this.x=e,this.y=t}},e}();t.SVGGraphics=r=function(){function e(e){if(Number.isInteger(e))return e.toString();var t=e.toFixed(10),n=t.length-1;if("0"!==t[n])return t;do{n--}while("0"===t[n]);return t.substr(0,"."===t[n]?n:n+1)}function t(t){if(0===t[4]&&0===t[5]){if(0===t[1]&&0===t[2])return 1===t[0]&&1===t[3]?"":"scale("+e(t[0])+" "+e(t[3])+")";if(t[0]===t[3]&&t[1]===-t[2])return"rotate("+e(180*Math.acos(t[0])/Math.PI)+")"}else if(1===t[0]&&0===t[1]&&0===t[2]&&1===t[3])return"translate("+e(t[4])+" "+e(t[5])+")";return"matrix("+e(t[0])+" "+e(t[1])+" "+e(t[2])+" "+e(t[3])+" "+e(t[4])+" "+e(t[5])+")"}function n(e,t,n){this.svgFactory=new a.DOMSVGFactory,this.current=new l,this.transformMatrix=i.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=e,this.objs=t,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!n}var r="http://www.w3.org/1999/xlink",c=["butt","round","square"],u=["miter","round","bevel"],d=0,h=0;return n.prototype={save:function(){this.transformStack.push(this.transformMatrix);var e=this.current;this.extraStack.push(e),this.current=e.clone()},restore:function(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null},group:function(e){this.save(),this.executeOpTree(e),this.restore()},loadDependencies:function(e){for(var t=this,n=e.fnArray,r=n.length,a=e.argsArray,o=0;o<r;o++)if(i.OPS.dependency===n[o])for(var s=a[o],l=0,c=s.length;l<c;l++){var u,d=s[l];u="g_"===d.substring(0,2)?new Promise(function(e){t.commonObjs.get(d,e)}):new Promise(function(e){t.objs.get(d,e)}),this.current.dependencies.push(u)}return Promise.all(this.current.dependencies)},transform:function(e,t,n,r,a,o){var s=[e,t,n,r,a,o];this.transformMatrix=i.Util.transform(this.transformMatrix,s),this.tgrp=null},getSVG:function(e,t){var n=this;this.viewport=t;var r=this._initialize(t);return this.loadDependencies(e).then(function(){n.transformMatrix=i.IDENTITY_MATRIX;var t=n.convertOpList(e);return n.executeOpTree(t),r})},convertOpList:function(e){var t=e.argsArray,n=e.fnArray,r=n.length,a=[],o=[];for(var s in i.OPS)a[i.OPS[s]]=s;for(var l=0;l<r;l++){var c=n[l];o.push({fnId:c,fn:a[c],args:t[l]})}return function(e){for(var t=[],n=[],r=e.length,i=0;i<r;i++)"save"!==e[i].fn?"restore"===e[i].fn?t=n.pop():t.push(e[i]):(t.push({fnId:92,fn:"group",items:[]}),n.push(t),t=t[t.length-1].items);return t}(o)},executeOpTree:function(e){for(var t=e.length,n=0;n<t;n++){var r=e[n].fn,a=e[n].fnId,o=e[n].args;switch(0|a){case i.OPS.beginText:this.beginText();break;case i.OPS.setLeading:this.setLeading(o);break;case i.OPS.setLeadingMoveText:this.setLeadingMoveText(o[0],o[1]);break;case i.OPS.setFont:this.setFont(o);break;case i.OPS.showText:case i.OPS.showSpacedText:this.showText(o[0]);break;case i.OPS.endText:this.endText();break;case i.OPS.moveText:this.moveText(o[0],o[1]);break;case i.OPS.setCharSpacing:this.setCharSpacing(o[0]);break;case i.OPS.setWordSpacing:this.setWordSpacing(o[0]);break;case i.OPS.setHScale:this.setHScale(o[0]);break;case i.OPS.setTextMatrix:this.setTextMatrix(o[0],o[1],o[2],o[3],o[4],o[5]);break;case i.OPS.setTextRise:this.setTextRise(o[0]);break;case i.OPS.setLineWidth:this.setLineWidth(o[0]);break;case i.OPS.setLineJoin:this.setLineJoin(o[0]);break;case i.OPS.setLineCap:this.setLineCap(o[0]);break;case i.OPS.setMiterLimit:this.setMiterLimit(o[0]);break;case i.OPS.setFillRGBColor:this.setFillRGBColor(o[0],o[1],o[2]);break;case i.OPS.setStrokeRGBColor:this.setStrokeRGBColor(o[0],o[1],o[2]);break;case i.OPS.setDash:this.setDash(o[0],o[1]);break;case i.OPS.setGState:this.setGState(o[0]);break;case i.OPS.fill:this.fill();break;case i.OPS.eoFill:this.eoFill();break;case i.OPS.stroke:this.stroke();break;case i.OPS.fillStroke:this.fillStroke();break;case i.OPS.eoFillStroke:this.eoFillStroke();break;case i.OPS.clip:this.clip("nonzero");break;case i.OPS.eoClip:this.clip("evenodd");break;case i.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case i.OPS.paintJpegXObject:this.paintJpegXObject(o[0],o[1],o[2]);break;case i.OPS.paintImageXObject:this.paintImageXObject(o[0]);break;case i.OPS.paintInlineImageXObject:this.paintInlineImageXObject(o[0]);break;case i.OPS.paintImageMaskXObject:this.paintImageMaskXObject(o[0]);break;case i.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(o[0],o[1]);break;case i.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case i.OPS.closePath:this.closePath();break;case i.OPS.closeStroke:this.closeStroke();break;case i.OPS.closeFillStroke:this.closeFillStroke();break;case i.OPS.nextLine:this.nextLine();break;case i.OPS.transform:this.transform(o[0],o[1],o[2],o[3],o[4],o[5]);break;case i.OPS.constructPath:this.constructPath(o[0],o[1]);break;case i.OPS.endPath:this.endPath();break;case 92:this.group(e[n].items);break;default:(0,i.warn)("Unimplemented operator "+r)}}},setWordSpacing:function(e){this.current.wordSpacing=e},setCharSpacing:function(e){this.current.charSpacing=e},nextLine:function(){this.moveText(0,this.current.leading)},setTextMatrix:function(t,n,r,i,a,o){var s=this.current;this.current.textMatrix=this.current.lineMatrix=[t,n,r,i,a,o],this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,s.xcoords=[],s.tspan=this.svgFactory.createElement("svg:tspan"),s.tspan.setAttributeNS(null,"font-family",s.fontFamily),s.tspan.setAttributeNS(null,"font-size",e(s.fontSize)+"px"),s.tspan.setAttributeNS(null,"y",e(-s.y)),s.txtElement=this.svgFactory.createElement("svg:text"),s.txtElement.appendChild(s.tspan)},beginText:function(){this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.current.textMatrix=i.IDENTITY_MATRIX,this.current.lineMatrix=i.IDENTITY_MATRIX,this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.txtElement=this.svgFactory.createElement("svg:text"),this.current.txtgrp=this.svgFactory.createElement("svg:g"),this.current.xcoords=[]},moveText:function(t,n){var r=this.current;this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=n,r.xcoords=[],r.tspan=this.svgFactory.createElement("svg:tspan"),r.tspan.setAttributeNS(null,"font-family",r.fontFamily),r.tspan.setAttributeNS(null,"font-size",e(r.fontSize)+"px"),r.tspan.setAttributeNS(null,"y",e(-r.y))},showText:function(n){var r=this.current,a=r.font,s=r.fontSize;if(0!==s){var l,c=r.charSpacing,u=r.wordSpacing,d=r.fontDirection,h=r.textHScale*d,p=n.length,f=a.vertical,m=s*r.fontMatrix[0],g=0;for(l=0;l<p;++l){var v=n[l];if(null!==v)if((0,i.isNum)(v))g+=-v*s*.001;else{var y=v.width,b=v.fontChar,w=y*m+((v.isSpace?u:0)+c)*d;v.isInFont||a.missingFile?(r.xcoords.push(r.x+g*h),r.tspan.textContent+=b,g+=w):g+=w}else g+=d*u}f?r.y-=g*h:r.x+=g*h,r.tspan.setAttributeNS(null,"x",r.xcoords.map(e).join(" ")),r.tspan.setAttributeNS(null,"y",e(-r.y)),r.tspan.setAttributeNS(null,"font-family",r.fontFamily),r.tspan.setAttributeNS(null,"font-size",e(r.fontSize)+"px"),r.fontStyle!==o.fontStyle&&r.tspan.setAttributeNS(null,"font-style",r.fontStyle),r.fontWeight!==o.fontWeight&&r.tspan.setAttributeNS(null,"font-weight",r.fontWeight),r.fillColor!==o.fillColor&&r.tspan.setAttributeNS(null,"fill",r.fillColor);var S=r.textMatrix;0!==r.textRise&&((S=S.slice())[5]+=r.textRise),r.txtElement.setAttributeNS(null,"transform",t(S)+" scale(1, -1)"),r.txtElement.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),r.txtElement.appendChild(r.tspan),r.txtgrp.appendChild(r.txtElement),this._ensureTransformGroup().appendChild(r.txtElement)}},setLeadingMoveText:function(e,t){this.setLeading(-t),this.moveText(e,t)},addFontStyle:function(e){this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.appendChild(this.cssStyle));var t=(0,i.createObjectURL)(e.data,e.mimetype,this.forceDataSchema);this.cssStyle.textContent+='@font-face { font-family: "'+e.loadedName+'"; src: url('+t+"); }\n"},setFont:function(t){var n=this.current,r=this.commonObjs.get(t[0]),a=t[1];this.current.font=r,this.embedFonts&&r.data&&!this.embeddedFonts[r.loadedName]&&(this.addFontStyle(r),this.embeddedFonts[r.loadedName]=r),n.fontMatrix=r.fontMatrix?r.fontMatrix:i.FONT_IDENTITY_MATRIX;var o=r.black?r.bold?"bolder":"bold":r.bold?"bold":"normal",s=r.italic?"italic":"normal";a<0?(a=-a,n.fontDirection=-1):n.fontDirection=1,n.fontSize=a,n.fontFamily=r.loadedName,n.fontWeight=o,n.fontStyle=s,n.tspan=this.svgFactory.createElement("svg:tspan"),n.tspan.setAttributeNS(null,"y",e(-n.y)),n.xcoords=[]},endText:function(){},setLineWidth:function(e){this.current.lineWidth=e},setLineCap:function(e){this.current.lineCap=c[e]},setLineJoin:function(e){this.current.lineJoin=u[e]},setMiterLimit:function(e){this.current.miterLimit=e},setStrokeAlpha:function(e){this.current.strokeAlpha=e},setStrokeRGBColor:function(e,t,n){var r=i.Util.makeCssRgb(e,t,n);this.current.strokeColor=r},setFillAlpha:function(e){this.current.fillAlpha=e},setFillRGBColor:function(e,t,n){var r=i.Util.makeCssRgb(e,t,n);this.current.fillColor=r,this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[]},setDash:function(e,t){this.current.dashArray=e,this.current.dashPhase=t},constructPath:function(t,n){var r=this.current,a=r.x,o=r.y;r.path=this.svgFactory.createElement("svg:path");for(var s=[],l=t.length,c=0,u=0;c<l;c++)switch(0|t[c]){case i.OPS.rectangle:a=n[u++],o=n[u++];var d=a+n[u++],h=o+n[u++];s.push("M",e(a),e(o),"L",e(d),e(o),"L",e(d),e(h),"L",e(a),e(h),"Z");break;case i.OPS.moveTo:a=n[u++],o=n[u++],s.push("M",e(a),e(o));break;case i.OPS.lineTo:a=n[u++],o=n[u++],s.push("L",e(a),e(o));break;case i.OPS.curveTo:a=n[u+4],o=n[u+5],s.push("C",e(n[u]),e(n[u+1]),e(n[u+2]),e(n[u+3]),e(a),e(o)),u+=6;break;case i.OPS.curveTo2:a=n[u+2],o=n[u+3],s.push("C",e(a),e(o),e(n[u]),e(n[u+1]),e(n[u+2]),e(n[u+3])),u+=4;break;case i.OPS.curveTo3:a=n[u+2],o=n[u+3],s.push("C",e(n[u]),e(n[u+1]),e(a),e(o),e(a),e(o)),u+=4;break;case i.OPS.closePath:s.push("Z")}r.path.setAttributeNS(null,"d",s.join(" ")),r.path.setAttributeNS(null,"fill","none"),this._ensureTransformGroup().appendChild(r.path),r.element=r.path,r.setCurrentPoint(a,o)},endPath:function(){if(this.pendingClip){var e=this.current,n="clippath"+d;d++;var r=this.svgFactory.createElement("svg:clipPath");r.setAttributeNS(null,"id",n),r.setAttributeNS(null,"transform",t(this.transformMatrix));var i=e.element.cloneNode();"evenodd"===this.pendingClip?i.setAttributeNS(null,"clip-rule","evenodd"):i.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,r.appendChild(i),this.defs.appendChild(r),e.activeClipUrl&&(e.clipGroup=null,this.extraStack.forEach(function(e){e.clipGroup=null})),e.activeClipUrl="url(#"+n+")",this.tgrp=null}},clip:function(e){this.pendingClip=e},closePath:function(){var e=this.current,t=e.path.getAttributeNS(null,"d");t+="Z",e.path.setAttributeNS(null,"d",t)},setLeading:function(e){this.current.leading=-e},setTextRise:function(e){this.current.textRise=e},setHScale:function(e){this.current.textHScale=e/100},setGState:function(e){for(var t=0,n=e.length;t<n;t++){var r=e[t],a=r[0],o=r[1];switch(a){case"LW":this.setLineWidth(o);break;case"LC":this.setLineCap(o);break;case"LJ":this.setLineJoin(o);break;case"ML":this.setMiterLimit(o);break;case"D":this.setDash(o[0],o[1]);break;case"Font":this.setFont(o);break;case"CA":this.setStrokeAlpha(o);break;case"ca":this.setFillAlpha(o);break;default:(0,i.warn)("Unimplemented graphic state "+a)}}},fill:function(){var e=this.current;e.element.setAttributeNS(null,"fill",e.fillColor),e.element.setAttributeNS(null,"fill-opacity",e.fillAlpha)},stroke:function(){var t=this.current;t.element.setAttributeNS(null,"stroke",t.strokeColor),t.element.setAttributeNS(null,"stroke-opacity",t.strokeAlpha),t.element.setAttributeNS(null,"stroke-miterlimit",e(t.miterLimit)),t.element.setAttributeNS(null,"stroke-linecap",t.lineCap),t.element.setAttributeNS(null,"stroke-linejoin",t.lineJoin),t.element.setAttributeNS(null,"stroke-width",e(t.lineWidth)+"px"),t.element.setAttributeNS(null,"stroke-dasharray",t.dashArray.map(e).join(" ")),t.element.setAttributeNS(null,"stroke-dashoffset",e(t.dashPhase)+"px"),t.element.setAttributeNS(null,"fill","none")},eoFill:function(){this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fill()},fillStroke:function(){this.stroke(),this.fill()},eoFillStroke:function(){this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()},closeStroke:function(){this.closePath(),this.stroke()},closeFillStroke:function(){this.closePath(),this.fillStroke()},paintSolidColorImageMask:function(){var e=this.current,t=this.svgFactory.createElement("svg:rect");t.setAttributeNS(null,"x","0"),t.setAttributeNS(null,"y","0"),t.setAttributeNS(null,"width","1px"),t.setAttributeNS(null,"height","1px"),t.setAttributeNS(null,"fill",e.fillColor),this._ensureTransformGroup().appendChild(t)},paintJpegXObject:function(t,n,i){var a=this.objs.get(t),o=this.svgFactory.createElement("svg:image");o.setAttributeNS(r,"xlink:href",a.src),o.setAttributeNS(null,"width",e(n)),o.setAttributeNS(null,"height",e(i)),o.setAttributeNS(null,"x","0"),o.setAttributeNS(null,"y",e(-i)),o.setAttributeNS(null,"transform","scale("+e(1/n)+" "+e(-1/i)+")"),this._ensureTransformGroup().appendChild(o)},paintImageXObject:function(e){var t=this.objs.get(e);t?this.paintInlineImageXObject(t):(0,i.warn)("Dependent image isn't ready yet")},paintInlineImageXObject:function(t,n){var i=t.width,a=t.height,o=s(t,this.forceDataSchema),l=this.svgFactory.createElement("svg:rect");l.setAttributeNS(null,"x","0"),l.setAttributeNS(null,"y","0"),l.setAttributeNS(null,"width",e(i)),l.setAttributeNS(null,"height",e(a)),this.current.element=l,this.clip("nonzero");var c=this.svgFactory.createElement("svg:image");c.setAttributeNS(r,"xlink:href",o),c.setAttributeNS(null,"x","0"),c.setAttributeNS(null,"y",e(-a)),c.setAttributeNS(null,"width",e(i)+"px"),c.setAttributeNS(null,"height",e(a)+"px"),c.setAttributeNS(null,"transform","scale("+e(1/i)+" "+e(-1/a)+")"),n?n.appendChild(c):this._ensureTransformGroup().appendChild(c)},paintImageMaskXObject:function(t){var n=this.current,r=t.width,i=t.height,a=n.fillColor;n.maskId="mask"+h++;var o=this.svgFactory.createElement("svg:mask");o.setAttributeNS(null,"id",n.maskId);var s=this.svgFactory.createElement("svg:rect");s.setAttributeNS(null,"x","0"),s.setAttributeNS(null,"y","0"),s.setAttributeNS(null,"width",e(r)),s.setAttributeNS(null,"height",e(i)),s.setAttributeNS(null,"fill",a),s.setAttributeNS(null,"mask","url(#"+n.maskId+")"),this.defs.appendChild(o),this._ensureTransformGroup().appendChild(s),this.paintInlineImageXObject(t,o)},paintFormXObjectBegin:function(t,n){if(Array.isArray(t)&&6===t.length&&this.transform(t[0],t[1],t[2],t[3],t[4],t[5]),Array.isArray(n)&&4===n.length){var r=n[2]-n[0],i=n[3]-n[1],a=this.svgFactory.createElement("svg:rect");a.setAttributeNS(null,"x",n[0]),a.setAttributeNS(null,"y",n[1]),a.setAttributeNS(null,"width",e(r)),a.setAttributeNS(null,"height",e(i)),this.current.element=a,this.clip("nonzero"),this.endPath()}},paintFormXObjectEnd:function(){},_initialize:function(e){var n=this.svgFactory.create(e.width,e.height),r=this.svgFactory.createElement("svg:defs");n.appendChild(r),this.defs=r;var i=this.svgFactory.createElement("svg:g");return i.setAttributeNS(null,"transform",t(e.transform)),n.appendChild(i),this.svg=i,n},_ensureClipGroup:function(){if(!this.current.clipGroup){var e=this.svgFactory.createElement("svg:g");e.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.appendChild(e),this.current.clipGroup=e}return this.current.clipGroup},_ensureTransformGroup:function(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",t(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().appendChild(this.tgrp):this.svg.appendChild(this.tgrp)),this.tgrp}},n}(),t.SVGGraphics=r},function(e,t,n){"use strict";var r=n(1),i=n(142),a=n(84),o=n(96),s=n(87),l=n(14),c=n(97);if(r.isNodeJS()){var u=n(166).PDFNodeStream;a.setPDFNetworkStreamClass(u)}else if("undefined"!=typeof Response&&"body"in Response.prototype&&"undefined"!=typeof ReadableStream){var d=n(167).PDFFetchStream;a.setPDFNetworkStreamClass(d)}else{var h=n(168).PDFNetworkStream;a.setPDFNetworkStreamClass(h)}t.PDFJS=i.PDFJS,t.build=a.build,t.version=a.version,t.getDocument=a.getDocument,t.LoopbackPort=a.LoopbackPort,t.PDFDataRangeTransport=a.PDFDataRangeTransport,t.PDFWorker=a.PDFWorker,t.renderTextLayer=o.renderTextLayer,t.AnnotationLayer=s.AnnotationLayer,t.CustomStyle=l.CustomStyle,t.createPromiseCapability=r.createPromiseCapability,t.PasswordResponses=r.PasswordResponses,t.InvalidPDFException=r.InvalidPDFException,t.MissingPDFException=r.MissingPDFException,t.SVGGraphics=c.SVGGraphics,t.NativeImageDecoding=r.NativeImageDecoding,t.UnexpectedResponseException=r.UnexpectedResponseException,t.OPS=r.OPS,t.UNSUPPORTED_FEATURES=r.UNSUPPORTED_FEATURES,t.isValidUrl=l.isValidUrl,t.createValidAbsoluteUrl=r.createValidAbsoluteUrl,t.createObjectURL=r.createObjectURL,t.removeNullCharacters=r.removeNullCharacters,t.shadow=r.shadow,t.createBlob=r.createBlob,t.RenderingCancelledException=l.RenderingCancelledException,t.getFilenameFromUrl=l.getFilenameFromUrl,t.addLinkAttributes=l.addLinkAttributes,t.StatTimer=r.StatTimer},function(e,t,n){"use strict";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};if("undefined"==typeof PDFJS||!PDFJS.compatibilityChecked){var i=n(25),a="undefined"!=typeof navigator&&navigator.userAgent||"",o=/Android/.test(a),s=/Android\s[0-2][^\d]/.test(a),l=/Android\s[0-4][^\d]/.test(a),c=a.indexOf("Chrom")>=0,u=(/Chrome\/(39|40)\./.test(a),a.indexOf("CriOS")>=0),d=a.indexOf("Trident")>=0,h=/\b(iPad|iPhone|iPod)(?=;)/.test(a),p=a.indexOf("Opera")>=0,f=/Safari\//.test(a)&&!/(Chrome\/|Android\s)/.test(a),m="object"===("undefined"==typeof window?"undefined":r(window))&&"object"===("undefined"==typeof document?"undefined":r(document));"undefined"==typeof PDFJS&&(i.PDFJS={}),PDFJS.compatibilityChecked=!0,function(){if("undefined"==typeof Uint8ClampedArray&&(i.Uint8ClampedArray=n(100)),"undefined"!=typeof Uint8Array)return void 0===Uint8Array.prototype.subarray&&(Uint8Array.prototype.subarray=function(e,t){return new Uint8Array(this.slice(e,t))},Float32Array.prototype.subarray=function(e,t){return new Float32Array(this.slice(e,t))}),void("undefined"==typeof Float64Array&&(i.Float64Array=Float32Array));function e(e,t){return new l(this.slice(e,t))}function t(e,t){arguments.length<2&&(t=0);for(var n=0,r=e.length;n<r;++n,++t)this[t]=255&e[n]}function a(e,t){this.buffer=e,this.byteLength=e.length,this.length=t,function(e){for(;o<e;)Object.defineProperty(a.prototype,o,s(o)),o++}(this.length)}a.prototype=Object.create(null);var o=0;function s(e){return{get:function(){var t=this.buffer,n=e<<2;return(t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24)>>>0},set:function(t){var n=this.buffer,r=e<<2;n[r]=255&t,n[r+1]=t>>8&255,n[r+2]=t>>16&255,n[r+3]=t>>>24&255}}}function l(n){var i,a,o;if("number"==typeof n)for(i=[],a=0;a<n;++a)i[a]=0;else if("slice"in n)i=n.slice(0);else for(i=[],a=0,o=n.length;a<o;++a)i[a]=n[a];return i.subarray=e,i.buffer=i,i.byteLength=i.length,i.set=t,"object"===(void 0===n?"undefined":r(n))&&n.buffer&&(i.buffer=n.buffer),i}i.Uint8Array=l,i.Int8Array=l,i.Int32Array=l,i.Uint16Array=l,i.Float32Array=l,i.Float64Array=l,i.Uint32Array=function(){if(3===arguments.length){if(0!==arguments[1])throw new Error("offset !== 0 is not supported");return new a(arguments[0],arguments[2])}return l.apply(this,arguments)}}(),function(){if(m&&window.CanvasPixelArray){var e=window.CanvasPixelArray.prototype;"buffer"in e||(Object.defineProperty(e,"buffer",{get:function(){return this},enumerable:!1,configurable:!0}),Object.defineProperty(e,"byteLength",{get:function(){return this.length},enumerable:!1,configurable:!0}))}}(),i.URL||(i.URL=i.webkitURL),function(){if(void 0!==Object.defineProperty){var e=!0;try{m&&Object.defineProperty(new Image,"id",{value:"test"});var t=function(){};t.prototype={get id(){}},Object.defineProperty(new t,"id",{value:"",configurable:!0,enumerable:!0,writable:!1})}catch(t){e=!1}if(e)return}Object.defineProperty=function(e,t,n){delete e[t],"get"in n&&e.__defineGetter__(t,n.get),"set"in n&&e.__defineSetter__(t,n.set),"value"in n&&(e.__defineSetter__(t,function(e){return this.__defineGetter__(t,function(){return e}),e}),e[t]=n.value)}}(),function(){if("undefined"!=typeof XMLHttpRequest){var e=XMLHttpRequest.prototype,t=new XMLHttpRequest;"overrideMimeType"in t||Object.defineProperty(e,"overrideMimeType",{value:function(e){}}),"responseType"in t||(Object.defineProperty(e,"responseType",{get:function(){return this._responseType||"text"},set:function(e){"text"!==e&&"arraybuffer"!==e||(this._responseType=e,"arraybuffer"===e&&"function"==typeof this.overrideMimeType&&this.overrideMimeType("text/plain; charset=x-user-defined"))}}),"undefined"==typeof VBArray?Object.defineProperty(e,"response",{get:function(){if("arraybuffer"!==this.responseType)return this.responseText;var e,t=this.responseText,n=t.length,r=new Uint8Array(n);for(e=0;e<n;++e)r[e]=255&t.charCodeAt(e);return r.buffer}}):Object.defineProperty(e,"response",{get:function(){return"arraybuffer"===this.responseType?new Uint8Array(new VBArray(this.responseBody).toArray()):this.responseText}}))}}(),function(){if(!("btoa"in i)){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.btoa=function(t){var n,r,i="";for(n=0,r=t.length;n<r;n+=3){var a=255&t.charCodeAt(n),o=255&t.charCodeAt(n+1),s=255&t.charCodeAt(n+2),l=(3&a)<<4|o>>4,c=n+1<r?(15&o)<<2|s>>6:64,u=n+2<r?63&s:64;i+=e.charAt(a>>2)+e.charAt(l)+e.charAt(c)+e.charAt(u)}return i}}}(),function(){if(!("atob"in i)){i.atob=function(e){if((e=e.replace(/=+$/,"")).length%4==1)throw new Error("bad atob input");for(var t,n,r=0,i=0,a="";n=e.charAt(i++);~n&&(t=r%4?64*t+n:n,r++%4)?a+=String.fromCharCode(255&t>>(-2*r&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return a}}}(),void 0===Function.prototype.bind&&(Function.prototype.bind=function(e){var t=this,n=Array.prototype.slice.call(arguments,1);return function(){var r=n.concat(Array.prototype.slice.call(arguments));return t.apply(e,r)}}),m&&("dataset"in document.createElement("div")||Object.defineProperty(HTMLElement.prototype,"dataset",{get:function(){if(this._dataset)return this._dataset;for(var e={},t=0,n=this.attributes.length;t<n;t++){var r=this.attributes[t];"data-"===r.name.substring(0,5)&&(e[r.name.substring(5).replace(/\-([a-z])/g,function(e,t){return t.toUpperCase()})]=r.value)}return Object.defineProperty(this,"_dataset",{value:e,writable:!1,enumerable:!1}),e},enumerable:!0})),function(){function e(e,t,n,r){var i=(e.className||"").split(/\s+/g);""===i[0]&&i.shift();var a=i.indexOf(t);return a<0&&n&&i.push(t),a>=0&&r&&i.splice(a,1),e.className=i.join(" "),a>=0}if(m&&!("classList"in document.createElement("div"))){var t={add:function(t){e(this.element,t,!0,!1)},contains:function(t){return e(this.element,t,!1,!1)},remove:function(t){e(this.element,t,!1,!0)},toggle:function(t){e(this.element,t,!0,!0)}};Object.defineProperty(HTMLElement.prototype,"classList",{get:function(){if(this._classList)return this._classList;var e=Object.create(t,{element:{value:this,writable:!1,enumerable:!0}});return Object.defineProperty(this,"_classList",{value:e,writable:!1,enumerable:!1}),e},enumerable:!0})}}(),function(){if(!("undefined"==typeof importScripts||"console"in i)){var e={},t={log:function(){var e=Array.prototype.slice.call(arguments);i.postMessage({targetName:"main",action:"console_log",data:e})},error:function(){var e=Array.prototype.slice.call(arguments);i.postMessage({targetName:"main",action:"console_error",data:e})},time:function(t){e[t]=Date.now()},timeEnd:function(t){var n=e[t];if(!n)throw new Error("Unknown timer name "+t);this.log("Timer:",t,Date.now()-n)}};i.console=t}}(),function(){var e;if(m){if("console"in window)return"bind"in console.log?void 0:(console.log=(e=console.log,function(t){return e(t)}),console.error=function(e){return function(t){return e(t)}}(console.error),void(console.warn=function(e){return function(t){return e(t)}}(console.warn)));window.console={log:function(){},error:function(){},warn:function(){}}}}(),function(){p&&document.addEventListener("click",function(e){(function e(t){return t.disabled||t.parentNode&&e(t.parentNode)})(e.target)&&e.stopPropagation()},!0)}(),(d||u)&&(PDFJS.disableCreateObjectURL=!0),"undefined"!=typeof navigator&&("language"in navigator||(PDFJS.locale=navigator.userLanguage||"en-US")),(f||h)&&(PDFJS.disableRange=!0,PDFJS.disableStream=!0),m&&(history.pushState&&!s||(PDFJS.disableHistory=!0)),function(){if(m)if(window.CanvasPixelArray)"function"!=typeof window.CanvasPixelArray.prototype.set&&(window.CanvasPixelArray.prototype.set=function(e){for(var t=0,n=this.length;t<n;t++)this[t]=e[t]});else{var e,t=!1;if(c?t=(e=a.match(/Chrom(e|ium)\/([0-9]+)\./))&&parseInt(e[2])<21:o?t=l:f&&(t=(e=a.match(/Version\/([0-9]+)\.([0-9]+)\.([0-9]+) Safari\//))&&parseInt(e[1])<6),t){var n=window.CanvasRenderingContext2D.prototype,r=n.createImageData;n.createImageData=function(e,t){var n=r.call(this,e,t);return n.data.set=function(e){for(var t=0,n=this.length;t<n;t++)this[t]=e[t]},n},n=null}}}(),function(){function e(){window.requestAnimationFrame=function(e){return window.setTimeout(e,20)},window.cancelAnimationFrame=function(e){window.clearTimeout(e)}}m&&(h?e():"requestAnimationFrame"in window||(window.requestAnimationFrame=window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame,window.requestAnimationFrame||e()))}(),(h||o)&&(PDFJS.maxCanvasPixels=5242880),m&&d&&window.parent!==window&&(PDFJS.disableFullscreen=!0),m&&("currentScript"in document||Object.defineProperty(document,"currentScript",{get:function(){var e=document.getElementsByTagName("script");return e[e.length-1]},enumerable:!0,configurable:!0})),function(){if(m){var e=document.createElement("input");try{e.type="number"}catch(r){var t=e.constructor.prototype,n=Object.getOwnPropertyDescriptor(t,"type");Object.defineProperty(t,"type",{get:function(){return n.get.call(this)},set:function(e){n.set.call(this,"number"===e?"text":e)},enumerable:!0,configurable:!0})}}}(),function(){if(m&&document.attachEvent){var e=document.constructor.prototype,t=Object.getOwnPropertyDescriptor(e,"readyState");Object.defineProperty(e,"readyState",{get:function(){var e=t.get.call(this);return"interactive"===e?"loading":e},set:function(e){t.set.call(this,e)},enumerable:!0,configurable:!0})}}(),m&&void 0===Element.prototype.remove&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)}),Number.isNaN||(Number.isNaN=n(113)),Number.isInteger||(Number.isInteger=n(115)),i.Promise||(i.Promise=n(118)),i.WeakMap||(i.WeakMap=n(128)),function(){var e=!1;try{if("function"==typeof URL&&"object"===r(URL.prototype)&&"origin"in URL.prototype){var t=new URL("b","http://a");t.pathname="c%20d",e="http://a/c%20d"===t.href}}catch(e){}if(!e){var n=Object.create(null);n.ftp=21,n.file=0,n.gopher=70,n.http=80,n.https=443,n.ws=80,n.wss=443;var a=Object.create(null);a["%2e"]=".",a[".%2e"]="..",a["%2e."]="..",a["%2e%2e"]="..";var o,s=/[a-zA-Z]/,l=/[a-zA-Z0-9\+\-\.]/;v.prototype={toString:function(){return this.href},get href(){if(this._isInvalid)return this._url;var e="";return""===this._username&&null===this._password||(e=this._username+(null!==this._password?":"+this._password:"")+"@"),this.protocol+(this._isRelative?"//"+e+this.host:"")+this.pathname+this._query+this._fragment},set href(e){g.call(this),m.call(this,e)},get protocol(){return this._scheme+":"},set protocol(e){this._isInvalid||m.call(this,e+":","scheme start")},get host(){return this._isInvalid?"":this._port?this._host+":"+this._port:this._host},set host(e){!this._isInvalid&&this._isRelative&&m.call(this,e,"host")},get hostname(){return this._host},set hostname(e){!this._isInvalid&&this._isRelative&&m.call(this,e,"hostname")},get port(){return this._port},set port(e){!this._isInvalid&&this._isRelative&&m.call(this,e,"port")},get pathname(){return this._isInvalid?"":this._isRelative?"/"+this._path.join("/"):this._schemeData},set pathname(e){!this._isInvalid&&this._isRelative&&(this._path=[],m.call(this,e,"relative path start"))},get search(){return this._isInvalid||!this._query||"?"===this._query?"":this._query},set search(e){!this._isInvalid&&this._isRelative&&(this._query="?","?"===e[0]&&(e=e.slice(1)),m.call(this,e,"query"))},get hash(){return this._isInvalid||!this._fragment||"#"===this._fragment?"":this._fragment},set hash(e){this._isInvalid||(this._fragment="#","#"===e[0]&&(e=e.slice(1)),m.call(this,e,"fragment"))},get origin(){var e;if(this._isInvalid||!this._scheme)return"";switch(this._scheme){case"data":case"file":case"javascript":case"mailto":return"null";case"blob":try{return new v(this._schemeData).origin||"null"}catch(e){}return"null"}return(e=this.host)?this._scheme+"://"+e:""}};var c=i.URL;c&&(v.createObjectURL=function(e){return c.createObjectURL.apply(c,arguments)},v.revokeObjectURL=function(e){c.revokeObjectURL(e)}),i.URL=v}function u(e){return void 0!==n[e]}function d(){g.call(this),this._isInvalid=!0}function h(e){return""===e&&d.call(this),e.toLowerCase()}function p(e){var t=e.charCodeAt(0);return t>32&&t<127&&-1===[34,35,60,62,63,96].indexOf(t)?e:encodeURIComponent(e)}function f(e){var t=e.charCodeAt(0);return t>32&&t<127&&-1===[34,35,60,62,96].indexOf(t)?e:encodeURIComponent(e)}function m(e,t,r){function i(e){b.push(e)}var c=t||"scheme start",m=0,g="",v=!1,y=!1,b=[];e:for(;(e[m-1]!==o||0===m)&&!this._isInvalid;){var w=e[m];switch(c){case"scheme start":if(!w||!s.test(w)){if(t){i("Invalid scheme.");break e}g="",c="no scheme";continue}g+=w.toLowerCase(),c="scheme";break;case"scheme":if(w&&l.test(w))g+=w.toLowerCase();else{if(":"!==w){if(t){if(w===o)break e;i("Code point not allowed in scheme: "+w);break e}g="",m=0,c="no scheme";continue}if(this._scheme=g,g="",t)break e;u(this._scheme)&&(this._isRelative=!0),c="file"===this._scheme?"relative":this._isRelative&&r&&r._scheme===this._scheme?"relative or authority":this._isRelative?"authority first slash":"scheme data"}break;case"scheme data":"?"===w?(this._query="?",c="query"):"#"===w?(this._fragment="#",c="fragment"):w!==o&&"\t"!==w&&"\n"!==w&&"\r"!==w&&(this._schemeData+=p(w));break;case"no scheme":if(r&&u(r._scheme)){c="relative";continue}i("Missing scheme."),d.call(this);break;case"relative or authority":if("/"!==w||"/"!==e[m+1]){i("Expected /, got: "+w),c="relative";continue}c="authority ignore slashes";break;case"relative":if(this._isRelative=!0,"file"!==this._scheme&&(this._scheme=r._scheme),w===o){this._host=r._host,this._port=r._port,this._path=r._path.slice(),this._query=r._query,this._username=r._username,this._password=r._password;break e}if("/"===w||"\\"===w)"\\"===w&&i("\\ is an invalid code point."),c="relative slash";else if("?"===w)this._host=r._host,this._port=r._port,this._path=r._path.slice(),this._query="?",this._username=r._username,this._password=r._password,c="query";else{if("#"!==w){var S=e[m+1],_=e[m+2];("file"!==this._scheme||!s.test(w)||":"!==S&&"|"!==S||_!==o&&"/"!==_&&"\\"!==_&&"?"!==_&&"#"!==_)&&(this._host=r._host,this._port=r._port,this._username=r._username,this._password=r._password,this._path=r._path.slice(),this._path.pop()),c="relative path";continue}this._host=r._host,this._port=r._port,this._path=r._path.slice(),this._query=r._query,this._fragment="#",this._username=r._username,this._password=r._password,c="fragment"}break;case"relative slash":if("/"!==w&&"\\"!==w){"file"!==this._scheme&&(this._host=r._host,this._port=r._port,this._username=r._username,this._password=r._password),c="relative path";continue}"\\"===w&&i("\\ is an invalid code point."),c="file"===this._scheme?"file host":"authority ignore slashes";break;case"authority first slash":if("/"!==w){i("Expected '/', got: "+w),c="authority ignore slashes";continue}c="authority second slash";break;case"authority second slash":if(c="authority ignore slashes","/"!==w){i("Expected '/', got: "+w);continue}break;case"authority ignore slashes":if("/"!==w&&"\\"!==w){c="authority";continue}i("Expected authority, got: "+w);break;case"authority":if("@"===w){v&&(i("@ already seen."),g+="%40"),v=!0;for(var P=0;P<g.length;P++){var A=g[P];if("\t"!==A&&"\n"!==A&&"\r"!==A)if(":"!==A||null!==this._password){var k=p(A);null!==this._password?this._password+=k:this._username+=k}else this._password="";else i("Invalid whitespace in authority.")}g=""}else{if(w===o||"/"===w||"\\"===w||"?"===w||"#"===w){m-=g.length,g="",c="host";continue}g+=w}break;case"file host":if(w===o||"/"===w||"\\"===w||"?"===w||"#"===w){2!==g.length||!s.test(g[0])||":"!==g[1]&&"|"!==g[1]?0===g.length?c="relative path start":(this._host=h.call(this,g),g="",c="relative path start"):c="relative path";continue}"\t"===w||"\n"===w||"\r"===w?i("Invalid whitespace in file host."):g+=w;break;case"host":case"hostname":if(":"!==w||y){if(w===o||"/"===w||"\\"===w||"?"===w||"#"===w){if(this._host=h.call(this,g),g="",c="relative path start",t)break e;continue}"\t"!==w&&"\n"!==w&&"\r"!==w?("["===w?y=!0:"]"===w&&(y=!1),g+=w):i("Invalid code point in host/hostname: "+w)}else if(this._host=h.call(this,g),g="",c="port","hostname"===t)break e;break;case"port":if(/[0-9]/.test(w))g+=w;else{if(w===o||"/"===w||"\\"===w||"?"===w||"#"===w||t){if(""!==g){var C=parseInt(g,10);C!==n[this._scheme]&&(this._port=C+""),g=""}if(t)break e;c="relative path start";continue}"\t"===w||"\n"===w||"\r"===w?i("Invalid code point in port: "+w):d.call(this)}break;case"relative path start":if("\\"===w&&i("'\\' not allowed in path."),c="relative path","/"!==w&&"\\"!==w)continue;break;case"relative path":var x;if(w!==o&&"/"!==w&&"\\"!==w&&(t||"?"!==w&&"#"!==w))"\t"!==w&&"\n"!==w&&"\r"!==w&&(g+=p(w));else"\\"===w&&i("\\ not allowed in relative path."),(x=a[g.toLowerCase()])&&(g=x),".."===g?(this._path.pop(),"/"!==w&&"\\"!==w&&this._path.push("")):"."===g&&"/"!==w&&"\\"!==w?this._path.push(""):"."!==g&&("file"===this._scheme&&0===this._path.length&&2===g.length&&s.test(g[0])&&"|"===g[1]&&(g=g[0]+":"),this._path.push(g)),g="","?"===w?(this._query="?",c="query"):"#"===w&&(this._fragment="#",c="fragment");break;case"query":t||"#"!==w?w!==o&&"\t"!==w&&"\n"!==w&&"\r"!==w&&(this._query+=f(w)):(this._fragment="#",c="fragment");break;case"fragment":w!==o&&"\t"!==w&&"\n"!==w&&"\r"!==w&&(this._fragment+=w)}m++}}function g(){this._scheme="",this._schemeData="",this._username="",this._password=null,this._host="",this._port="",this._path=[],this._query="",this._fragment="",this._isInvalid=!1,this._isRelative=!1}function v(e,t){void 0===t||t instanceof v||(t=new v(String(t))),this._url=e,g.call(this);var n=e.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g,"");m.call(this,n,null,t)}}()}},function(e,t,n){"use strict";n(101),e.exports=n(6).Uint8ClampedArray},function(e,t,n){"use strict";n(102)("Uint8",1,function(e){return function(t,n,r){return e(this,t,n,r)}},!0)},function(e,t,n){"use strict";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};if(n(8)){var i=n(26),a=n(0),o=n(16),s=n(7),l=n(63),c=n(104),u=n(12),d=n(29),h=n(33),p=n(9),f=n(28),m=n(20),g=n(13),v=n(64),y=n(35),b=n(43),w=n(11),S=n(36),_=n(3),P=n(21),A=n(69),k=n(70),C=n(72),x=n(65).f,T=n(73),D=n(19),E=n(4),I=n(50),O=n(67),R=n(51),M=n(74),W=n(22),L=n(52),N=n(76),F=n(68),G=n(112),V=n(17),K=n(77),j=V.f,B=K.f,U=a.RangeError,q=a.TypeError,z=a.Uint8Array,Y=Array.prototype,H=c.ArrayBuffer,X=c.DataView,J=I(0),Q=I(2),Z=I(3),$=I(4),ee=I(5),te=I(6),ne=O(!0),re=O(!1),ie=M.values,ae=M.keys,oe=M.entries,se=Y.lastIndexOf,le=Y.reduce,ce=Y.reduceRight,ue=Y.join,de=Y.sort,he=Y.slice,pe=Y.toString,fe=Y.toLocaleString,me=E("iterator"),ge=E("toStringTag"),ve=D("typed_constructor"),ye=D("def_constructor"),be=l.CONSTR,we=l.TYPED,Se=l.VIEW,_e=I(1,function(e,t){return xe(R(e,e[ye]),t)}),Pe=o(function(){return 1===new z(new Uint16Array([1]).buffer)[0]}),Ae=!!z&&!!z.prototype.set&&o(function(){new z(1).set({})}),ke=function(e,t){var n=m(e);if(n<0||n%t)throw U("Wrong offset!");return n},Ce=function(e){if(_(e)&&we in e)return e;throw q(e+" is not a typed array!")},xe=function(e,t){if(!(_(e)&&ve in e))throw q("It is not a typed array constructor!");return new e(t)},Te=function(e,t){return De(R(e,e[ye]),t)},De=function(e,t){for(var n=0,r=t.length,i=xe(e,r);r>n;)i[n]=t[n++];return i},Ee=function(e,t,n){j(e,t,{get:function(){return this._d[n]}})},Ie=function(e){var t,n,r,i,a,o,s=P(e),l=arguments.length,c=l>1?arguments[1]:void 0,d=void 0!==c,h=T(s);if(void 0!=h&&!A(h)){for(o=h.call(s),r=[],t=0;!(a=o.next()).done;t++)r.push(a.value);s=r}for(d&&l>2&&(c=u(c,arguments[2],2)),t=0,n=g(s.length),i=xe(this,n);n>t;t++)i[t]=d?c(s[t],t):s[t];return i},Oe=function(){for(var e=0,t=arguments.length,n=xe(this,t);t>e;)n[e]=arguments[e++];return n},Re=!!z&&o(function(){fe.call(new z(1))}),Me=function(){return fe.apply(Re?he.call(Ce(this)):Ce(this),arguments)},We={copyWithin:function(e,t){return G.call(Ce(this),e,t,arguments.length>2?arguments[2]:void 0)},every:function(e){return $(Ce(this),e,arguments.length>1?arguments[1]:void 0)},fill:function(e){return F.apply(Ce(this),arguments)},filter:function(e){return Te(this,Q(Ce(this),e,arguments.length>1?arguments[1]:void 0))},find:function(e){return ee(Ce(this),e,arguments.length>1?arguments[1]:void 0)},findIndex:function(e){return te(Ce(this),e,arguments.length>1?arguments[1]:void 0)},forEach:function(e){J(Ce(this),e,arguments.length>1?arguments[1]:void 0)},indexOf:function(e){return re(Ce(this),e,arguments.length>1?arguments[1]:void 0)},includes:function(e){return ne(Ce(this),e,arguments.length>1?arguments[1]:void 0)},join:function(e){return ue.apply(Ce(this),arguments)},lastIndexOf:function(e){return se.apply(Ce(this),arguments)},map:function(e){return _e(Ce(this),e,arguments.length>1?arguments[1]:void 0)},reduce:function(e){return le.apply(Ce(this),arguments)},reduceRight:function(e){return ce.apply(Ce(this),arguments)},reverse:function(){for(var e,t=Ce(this).length,n=Math.floor(t/2),r=0;r<n;)e=this[r],this[r++]=this[--t],this[t]=e;return this},some:function(e){return Z(Ce(this),e,arguments.length>1?arguments[1]:void 0)},sort:function(e){return de.call(Ce(this),e)},subarray:function(e,t){var n=Ce(this),r=n.length,i=y(e,r);return new(R(n,n[ye]))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,g((void 0===t?r:y(t,r))-i))}},Le=function(e,t){return Te(this,he.call(Ce(this),e,t))},Ne=function(e){Ce(this);var t=ke(arguments[1],1),n=this.length,r=P(e),i=g(r.length),a=0;if(i+t>n)throw U("Wrong length!");for(;a<i;)this[t+a]=r[a++]},Fe={entries:function(){return oe.call(Ce(this))},keys:function(){return ae.call(Ce(this))},values:function(){return ie.call(Ce(this))}},Ge=function(e,t){return _(e)&&e[we]&&"symbol"!=(void 0===t?"undefined":r(t))&&t in e&&String(+t)==String(t)},Ve=function(e,t){return Ge(e,t=b(t,!0))?h(2,e[t]):B(e,t)},Ke=function(e,t,n){return!(Ge(e,t=b(t,!0))&&_(n)&&w(n,"value"))||w(n,"get")||w(n,"set")||n.configurable||w(n,"writable")&&!n.writable||w(n,"enumerable")&&!n.enumerable?j(e,t,n):(e[t]=n.value,e)};be||(K.f=Ve,V.f=Ke),s(s.S+s.F*!be,"Object",{getOwnPropertyDescriptor:Ve,defineProperty:Ke}),o(function(){pe.call({})})&&(pe=fe=function(){return ue.call(this)});var je=f({},We);f(je,Fe),p(je,me,Fe.values),f(je,{slice:Le,set:Ne,constructor:function(){},toString:pe,toLocaleString:Me}),Ee(je,"buffer","b"),Ee(je,"byteOffset","o"),Ee(je,"byteLength","l"),Ee(je,"length","e"),j(je,ge,{get:function(){return this[we]}}),e.exports=function(e,t,n,r){var c=e+((r=!!r)?"Clamped":"")+"Array",u="get"+e,h="set"+e,f=a[c],m=f||{},y=f&&C(f),b=!f||!l.ABV,w={},P=f&&f.prototype,A=function(e,n){j(e,n,{get:function(){return function(e,n){var r=e._d;return r.v[u](n*t+r.o,Pe)}(this,n)},set:function(e){return function(e,n,i){var a=e._d;r&&(i=(i=Math.round(i))<0?0:i>255?255:255&i),a.v[h](n*t+a.o,i,Pe)}(this,n,e)},enumerable:!0})};b?(f=n(function(e,n,r,i){d(e,f,c,"_d");var a,o,s,l,u=0,h=0;if(_(n)){if(!(n instanceof H||"ArrayBuffer"==(l=S(n))||"SharedArrayBuffer"==l))return we in n?De(f,n):Ie.call(f,n);a=n,h=ke(r,t);var m=n.byteLength;if(void 0===i){if(m%t)throw U("Wrong length!");if((o=m-h)<0)throw U("Wrong length!")}else if((o=g(i)*t)+h>m)throw U("Wrong length!");s=o/t}else s=v(n),a=new H(o=s*t);for(p(e,"_d",{b:a,o:h,l:o,e:s,v:new X(a)});u<s;)A(e,u++)}),P=f.prototype=k(je),p(P,"constructor",f)):o(function(){f(1)})&&o(function(){new f(-1)})&&L(function(e){new f,new f(null),new f(1.5),new f(e)},!0)||(f=n(function(e,n,r,i){var a;return d(e,f,c),_(n)?n instanceof H||"ArrayBuffer"==(a=S(n))||"SharedArrayBuffer"==a?void 0!==i?new m(n,ke(r,t),i):void 0!==r?new m(n,ke(r,t)):new m(n):we in n?De(f,n):Ie.call(f,n):new m(v(n))}),J(y!==Function.prototype?x(m).concat(x(y)):x(m),function(e){e in f||p(f,e,m[e])}),f.prototype=P,i||(P.constructor=f));var T=P[me],D=!!T&&("values"==T.name||void 0==T.name),E=Fe.values;p(f,ve,!0),p(P,we,c),p(P,Se,!0),p(P,ye,f),(r?new f(1)[ge]==c:ge in P)||j(P,ge,{get:function(){return c}}),w[c]=f,s(s.G+s.W+s.F*(f!=m),w),s(s.S,c,{BYTES_PER_ELEMENT:t}),s(s.S+s.F*o(function(){m.of.call(f,1)}),c,{from:Ie,of:Oe}),"BYTES_PER_ELEMENT"in P||p(P,"BYTES_PER_ELEMENT",t),s(s.P,c,We),N(c),s(s.P+s.F*Ae,c,{set:Ne}),s(s.P+s.F*!D,c,Fe),i||P.toString==pe||(P.toString=pe),s(s.P+s.F*o(function(){new f(1).slice()}),c,{slice:Le}),s(s.P+s.F*(o(function(){return[1,2].toLocaleString()!=new f([1,2]).toLocaleString()})||!o(function(){P.toLocaleString.call([1,2])})),c,{toLocaleString:Me}),W[c]=D?T:E,i||D||p(P,me,E)}}else e.exports=function(){}},function(e,t,n){"use strict";e.exports=n(44)("native-function-to-string",Function.toString)},function(e,t,n){"use strict";var r=n(0),i=n(8),a=n(26),o=n(63),s=n(9),l=n(28),c=n(16),u=n(29),d=n(20),h=n(13),p=n(64),f=n(65).f,m=n(17).f,g=n(68),v=n(31),y="prototype",b="Wrong index!",w=r.ArrayBuffer,S=r.DataView,_=r.Math,P=r.RangeError,A=r.Infinity,k=w,C=_.abs,x=_.pow,T=_.floor,D=_.log,E=_.LN2,I=i?"_b":"buffer",O=i?"_l":"byteLength",R=i?"_o":"byteOffset";function M(e,t,n){var r,i,a,o=new Array(n),s=8*n-t-1,l=(1<<s)-1,c=l>>1,u=23===t?x(2,-24)-x(2,-77):0,d=0,h=e<0||0===e&&1/e<0?1:0;for((e=C(e))!=e||e===A?(i=e!=e?1:0,r=l):(r=T(D(e)/E),e*(a=x(2,-r))<1&&(r--,a*=2),(e+=r+c>=1?u/a:u*x(2,1-c))*a>=2&&(r++,a/=2),r+c>=l?(i=0,r=l):r+c>=1?(i=(e*a-1)*x(2,t),r+=c):(i=e*x(2,c-1)*x(2,t),r=0));t>=8;o[d++]=255&i,i/=256,t-=8);for(r=r<<t|i,s+=t;s>0;o[d++]=255&r,r/=256,s-=8);return o[--d]|=128*h,o}function W(e,t,n){var r,i=8*n-t-1,a=(1<<i)-1,o=a>>1,s=i-7,l=n-1,c=e[l--],u=127&c;for(c>>=7;s>0;u=256*u+e[l],l--,s-=8);for(r=u&(1<<-s)-1,u>>=-s,s+=t;s>0;r=256*r+e[l],l--,s-=8);if(0===u)u=1-o;else{if(u===a)return r?NaN:c?-A:A;r+=x(2,t),u-=o}return(c?-1:1)*r*x(2,u-t)}function L(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]}function N(e){return[255&e]}function F(e){return[255&e,e>>8&255]}function G(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]}function V(e){return M(e,52,8)}function K(e){return M(e,23,4)}function j(e,t,n){m(e[y],t,{get:function(){return this[n]}})}function B(e,t,n,r){var i=p(+n);if(i+t>e[O])throw P(b);var a=e[I]._b,o=i+e[R],s=a.slice(o,o+t);return r?s:s.reverse()}function U(e,t,n,r,i,a){var o=p(+n);if(o+t>e[O])throw P(b);for(var s=e[I]._b,l=o+e[R],c=r(+i),u=0;u<t;u++)s[l+u]=c[a?u:t-u-1]}if(o.ABV){if(!c(function(){w(1)})||!c(function(){new w(-1)})||c(function(){return new w,new w(1.5),new w(NaN),"ArrayBuffer"!=w.name})){for(var q,z=(w=function(e){return u(this,w),new k(p(e))})[y]=k[y],Y=f(k),H=0;Y.length>H;)(q=Y[H++])in w||s(w,q,k[q]);a||(z.constructor=w)}var X=new S(new w(2)),J=S[y].setInt8;X.setInt8(0,2147483648),X.setInt8(1,2147483649),!X.getInt8(0)&&X.getInt8(1)||l(S[y],{setInt8:function(e,t){J.call(this,e,t<<24>>24)},setUint8:function(e,t){J.call(this,e,t<<24>>24)}},!0)}else w=function(e){u(this,w,"ArrayBuffer");var t=p(e);this._b=g.call(new Array(t),0),this[O]=t},S=function(e,t,n){u(this,S,"DataView"),u(e,w,"DataView");var r=e[O],i=d(t);if(i<0||i>r)throw P("Wrong offset!");if(i+(n=void 0===n?r-i:h(n))>r)throw P("Wrong length!");this[I]=e,this[R]=i,this[O]=n},i&&(j(w,"byteLength","_l"),j(S,"buffer","_b"),j(S,"byteLength","_l"),j(S,"byteOffset","_o")),l(S[y],{getInt8:function(e){return B(this,1,e)[0]<<24>>24},getUint8:function(e){return B(this,1,e)[0]},getInt16:function(e){var t=B(this,2,e,arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=B(this,2,e,arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return L(B(this,4,e,arguments[1]))},getUint32:function(e){return L(B(this,4,e,arguments[1]))>>>0},getFloat32:function(e){return W(B(this,4,e,arguments[1]),23,4)},getFloat64:function(e){return W(B(this,8,e,arguments[1]),52,8)},setInt8:function(e,t){U(this,1,e,N,t)},setUint8:function(e,t){U(this,1,e,N,t)},setInt16:function(e,t){U(this,2,e,F,t,arguments[2])},setUint16:function(e,t){U(this,2,e,F,t,arguments[2])},setInt32:function(e,t){U(this,4,e,G,t,arguments[2])},setUint32:function(e,t){U(this,4,e,G,t,arguments[2])},setFloat32:function(e,t){U(this,4,e,K,t,arguments[2])},setFloat64:function(e,t){U(this,8,e,V,t,arguments[2])}});v(w,"ArrayBuffer"),v(S,"DataView"),s(S[y],o.VIEW,!0),t.ArrayBuffer=w,t.DataView=S},function(e,t,n){"use strict";var r=n(17),i=n(10),a=n(49);e.exports=n(8)?Object.defineProperties:function(e,t){i(e);for(var n,o=a(t),s=o.length,l=0;s>l;)r.f(e,n=o[l++],t[n]);return e}},function(e,t,n){"use strict";var r=n(107);e.exports=function(e,t){return new(r(e))(t)}},function(e,t,n){"use strict";var r=n(3),i=n(108),a=n(4)("species");e.exports=function(e){var t;return i(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!i(t.prototype)||(t=void 0),r(t)&&null===(t=t[a])&&(t=void 0)),void 0===t?Array:t}},function(e,t,n){"use strict";var r=n(30);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){"use strict";var r=n(4)("unscopables"),i=Array.prototype;void 0==i[r]&&n(9)(i,r,{}),e.exports=function(e){i[r][e]=!0}},function(e,t,n){"use strict";e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){"use strict";var r=n(70),i=n(33),a=n(31),o={};n(9)(o,n(4)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(o,{next:i(1,n)}),a(e,t+" Iterator")}},function(e,t,n){"use strict";var r=n(21),i=n(35),a=n(13);e.exports=[].copyWithin||function(e,t){var n=r(this),o=a(n.length),s=i(e,o),l=i(t,o),c=arguments.length>2?arguments[2]:void 0,u=Math.min((void 0===c?o:i(c,o))-l,o-s),d=1;for(l<s&&s<l+u&&(d=-1,l+=u-1,s+=u-1);u-- >0;)l in n?n[s]=n[l]:delete n[s],s+=d,l+=d;return n}},function(e,t,n){"use strict";n(114),e.exports=n(6).Number.isNaN},function(e,t,n){"use strict";var r=n(7);r(r.S,"Number",{isNaN:function(e){return e!=e}})},function(e,t,n){"use strict";n(116),e.exports=n(6).Number.isInteger},function(e,t,n){"use strict";var r=n(7);r(r.S,"Number",{isInteger:n(117)})},function(e,t,n){"use strict";var r=n(3),i=Math.floor;e.exports=function(e){return!r(e)&&isFinite(e)&&i(e)===e}},function(e,t,n){"use strict";n(79),n(119),n(80),n(121),n(126),n(127),e.exports=n(6).Promise},function(e,t,n){"use strict";var r=n(120)(!0);n(75)(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(20),i=n(46);e.exports=function(e){return function(t,n){var a,o,s=String(i(t)),l=r(n),c=s.length;return l<0||l>=c?e?"":void 0:(a=s.charCodeAt(l))<55296||a>56319||l+1===c||(o=s.charCodeAt(l+1))<56320||o>57343?e?s.charAt(l):a:e?s.slice(l,l+2):o-56320+(a-55296<<10)+65536}}},function(e,t,n){"use strict";var r,i,a,o,s=n(26),l=n(0),c=n(12),u=n(36),d=n(7),h=n(3),p=n(27),f=n(29),m=n(37),g=n(51),v=n(81).set,y=n(124)(),b=n(53),w=n(82),S=n(125),_=n(83),P=l.TypeError,A=l.process,k=A&&A.versions,C=k&&k.v8||"",x=l.Promise,T="process"==u(A),D=function(){},E=i=b.f,I=!!function(){try{var e=x.resolve(1),t=(e.constructor={})[n(4)("species")]=function(e){e(D,D)};return(T||"function"==typeof PromiseRejectionEvent)&&e.then(D)instanceof t&&0!==C.indexOf("6.6")&&-1===S.indexOf("Chrome/66")}catch(e){}}(),O=function(e){var t;return!(!h(e)||"function"!=typeof(t=e.then))&&t},R=function(e,t){if(!e._n){e._n=!0;var n=e._c;y(function(){for(var r=e._v,i=1==e._s,a=0,o=function(t){var n,a,o,s=i?t.ok:t.fail,l=t.resolve,c=t.reject,u=t.domain;try{s?(i||(2==e._h&&L(e),e._h=1),!0===s?n=r:(u&&u.enter(),n=s(r),u&&(u.exit(),o=!0)),n===t.promise?c(P("Promise-chain cycle")):(a=O(n))?a.call(n,l,c):l(n)):c(r)}catch(e){u&&!o&&u.exit(),c(e)}};n.length>a;)o(n[a++]);e._c=[],e._n=!1,t&&!e._h&&M(e)})}},M=function(e){v.call(l,function(){var t,n,r,i=e._v,a=W(e);if(a&&(t=w(function(){T?A.emit("unhandledRejection",i,e):(n=l.onunhandledrejection)?n({promise:e,reason:i}):(r=l.console)&&r.error&&r.error("Unhandled promise rejection",i)}),e._h=T||W(e)?2:1),e._a=void 0,a&&t.e)throw t.v})},W=function(e){return 1!==e._h&&0===(e._a||e._c).length},L=function(e){v.call(l,function(){var t;T?A.emit("rejectionHandled",e):(t=l.onrejectionhandled)&&t({promise:e,reason:e._v})})},N=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()),R(t,!0))},F=function e(t){var n,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===t)throw P("Promise can't be resolved itself");(n=O(t))?y(function(){var i={_w:r,_d:!1};try{n.call(t,c(e,i,1),c(N,i,1))}catch(e){N.call(i,e)}}):(r._v=t,r._s=1,R(r,!1))}catch(e){N.call({_w:r,_d:!1},e)}}};I||(x=function(e){f(this,x,"Promise","_h"),p(e),r.call(this);try{e(c(F,this,1),c(N,this,1))}catch(e){N.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(28)(x.prototype,{then:function(e,t){var n=E(g(this,x));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=T?A.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&R(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),a=function(){var e=new r;this.promise=e,this.resolve=c(F,e,1),this.reject=c(N,e,1)},b.f=E=function(e){return e===x||e===o?new a(e):i(e)}),d(d.G+d.W+d.F*!I,{Promise:x}),n(31)(x,"Promise"),n(76)("Promise"),o=n(6).Promise,d(d.S+d.F*!I,"Promise",{reject:function(e){var t=E(this);return(0,t.reject)(e),t.promise}}),d(d.S+d.F*(s||!I),"Promise",{resolve:function(e){return _(s&&this===o?x:this,e)}}),d(d.S+d.F*!(I&&n(52)(function(e){x.all(e).catch(D)})),"Promise",{all:function(e){var t=this,n=E(t),r=n.resolve,i=n.reject,a=w(function(){var n=[],a=0,o=1;m(e,!1,function(e){var s=a++,l=!1;n.push(void 0),o++,t.resolve(e).then(function(e){l||(l=!0,n[s]=e,--o||r(n))},i)}),--o||r(n)});return a.e&&i(a.v),n.promise},race:function(e){var t=this,n=E(t),r=n.reject,i=w(function(){m(e,!1,function(e){t.resolve(e).then(n.resolve,r)})});return i.e&&r(i.v),n.promise}})},function(e,t,n){"use strict";var r=n(10);e.exports=function(e,t,n,i){try{return i?t(r(n)[0],n[1]):t(n)}catch(t){var a=e.return;throw void 0!==a&&r(a.call(e)),t}}},function(e,t,n){"use strict";e.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){"use strict";var r=n(0),i=n(81).set,a=r.MutationObserver||r.WebKitMutationObserver,o=r.process,s=r.Promise,l="process"==n(30)(o);e.exports=function(){var e,t,n,c=function(){var r,i;for(l&&(r=o.domain)&&r.exit();e;){i=e.fn,e=e.next;try{i()}catch(r){throw e?n():t=void 0,r}}t=void 0,r&&r.enter()};if(l)n=function(){o.nextTick(c)};else if(!a||r.navigator&&r.navigator.standalone)if(s&&s.resolve){var u=s.resolve(void 0);n=function(){u.then(c)}}else n=function(){i.call(r,c)};else{var d=!0,h=document.createTextNode("");new a(c).observe(h,{characterData:!0}),n=function(){h.data=d=!d}}return function(r){var i={fn:r,next:void 0};t&&(t.next=i),e||(e=i,n()),t=i}}},function(e,t,n){"use strict";var r=n(0).navigator;e.exports=r&&r.userAgent||""},function(e,t,n){"use strict";var r=n(7),i=n(6),a=n(0),o=n(51),s=n(83);r(r.P+r.R,"Promise",{finally:function(e){var t=o(this,i.Promise||a.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(7),i=n(53),a=n(82);r(r.S,"Promise",{try:function(e){var t=i.f(this),n=a(e);return(n.e?t.reject:t.resolve)(n.v),t.promise}})},function(e,t,n){"use strict";n(79),n(80),n(129),n(136),n(138),e.exports=n(6).WeakMap},function(e,t,n){"use strict";var r,i=n(0),a=n(50)(0),o=n(18),s=n(54),l=n(130),c=n(132),u=n(3),d=n(55),h=n(55),p=!i.ActiveXObject&&"ActiveXObject"in i,f=s.getWeak,m=Object.isExtensible,g=c.ufstore,v=function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},y={get:function(e){if(u(e)){var t=f(e);return!0===t?g(d(this,"WeakMap")).get(e):t?t[this._i]:void 0}},set:function(e,t){return c.def(d(this,"WeakMap"),e,t)}},b=e.exports=n(133)("WeakMap",v,y,c,!0,!0);h&&p&&(l((r=c.getConstructor(v,"WeakMap")).prototype,y),s.NEED=!0,a(["delete","has","get","set"],function(e){var t=b.prototype,n=t[e];o(t,e,function(t,i){if(u(t)&&!m(t)){this._f||(this._f=new r);var a=this._f[e](t,i);return"set"==e?this:a}return n.call(this,t,i)})}))},function(e,t,n){"use strict";var r=n(8),i=n(49),a=n(131),o=n(78),s=n(21),l=n(45),c=Object.assign;e.exports=!c||n(16)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=c({},e)[n]||Object.keys(c({},t)).join("")!=r})?function(e,t){for(var n=s(e),c=arguments.length,u=1,d=a.f,h=o.f;c>u;)for(var p,f=l(arguments[u++]),m=d?i(f).concat(d(f)):i(f),g=m.length,v=0;g>v;)p=m[v++],r&&!h.call(f,p)||(n[p]=f[p]);return n}:c},function(e,t,n){"use strict";t.f=Object.getOwnPropertySymbols},function(e,t,n){"use strict";var r=n(28),i=n(54).getWeak,a=n(10),o=n(3),s=n(29),l=n(37),c=n(50),u=n(11),d=n(55),h=c(5),p=c(6),f=0,m=function(e){return e._l||(e._l=new g)},g=function(){this.a=[]},v=function(e,t){return h(e.a,function(e){return e[0]===t})};g.prototype={get:function(e){var t=v(this,e);if(t)return t[1]},has:function(e){return!!v(this,e)},set:function(e,t){var n=v(this,e);n?n[1]=t:this.a.push([e,t])},delete:function(e){var t=p(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}},e.exports={getConstructor:function(e,t,n,a){var c=e(function(e,r){s(e,c,t,"_i"),e._t=t,e._i=f++,e._l=void 0,void 0!=r&&l(r,n,e[a],e)});return r(c.prototype,{delete:function(e){if(!o(e))return!1;var n=i(e);return!0===n?m(d(this,t)).delete(e):n&&u(n,this._i)&&delete n[this._i]},has:function(e){if(!o(e))return!1;var n=i(e);return!0===n?m(d(this,t)).has(e):n&&u(n,this._i)}}),c},def:function(e,t,n){var r=i(a(t),!0);return!0===r?m(e).set(t,n):r[e._i]=n,e},ufstore:m}},function(e,t,n){"use strict";var r=n(0),i=n(7),a=n(18),o=n(28),s=n(54),l=n(37),c=n(29),u=n(3),d=n(16),h=n(52),p=n(31),f=n(134);e.exports=function(e,t,n,m,g,v){var y=r[e],b=y,w=g?"set":"add",S=b&&b.prototype,_={},P=function(e){var t=S[e];a(S,e,"delete"==e?function(e){return!(v&&!u(e))&&t.call(this,0===e?0:e)}:"has"==e?function(e){return!(v&&!u(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return v&&!u(e)?void 0:t.call(this,0===e?0:e)}:"add"==e?function(e){return t.call(this,0===e?0:e),this}:function(e,n){return t.call(this,0===e?0:e,n),this})};if("function"==typeof b&&(v||S.forEach&&!d(function(){(new b).entries().next()}))){var A=new b,k=A[w](v?{}:-0,1)!=A,C=d(function(){A.has(1)}),x=h(function(e){new b(e)}),T=!v&&d(function(){for(var e=new b,t=5;t--;)e[w](t,t);return!e.has(-0)});x||((b=t(function(t,n){c(t,b,e);var r=f(new y,t,b);return void 0!=n&&l(n,g,r[w],r),r})).prototype=S,S.constructor=b),(C||T)&&(P("delete"),P("has"),g&&P("get")),(T||k)&&P(w),v&&S.clear&&delete S.clear}else b=m.getConstructor(t,e,g,w),o(b.prototype,n),s.NEED=!0;return p(b,e),_[e]=b,i(i.G+i.W+i.F*(b!=y),_),v||m.setStrong(b,e,g),b}},function(e,t,n){"use strict";var r=n(3),i=n(135).set;e.exports=function(e,t,n){var a,o=t.constructor;return o!==n&&"function"==typeof o&&(a=o.prototype)!==n.prototype&&r(a)&&i&&i(e,a),e}},function(e,t,n){"use strict";var r=n(3),i=n(10),a=function(e,t){if(i(e),!r(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,r){try{(r=n(12)(Function.call,n(77).f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,n){return a(e,n),t?e.__proto__=n:r(e,n),e}}({},!1):void 0),check:a}},function(e,t,n){"use strict";n(137)("WeakMap")},function(e,t,n){"use strict";var r=n(7);e.exports=function(e){r(r.S,e,{of:function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];return new this(t)}})}},function(e,t,n){"use strict";n(139)("WeakMap")},function(e,t,n){"use strict";var r=n(7),i=n(27),a=n(12),o=n(37);e.exports=function(e){r(r.S,e,{from:function(e){var t,n,r,s,l=arguments[1];return i(this),(t=void 0!==l)&&i(l),void 0==e?new this:(n=[],t?(r=0,s=a(l,arguments[2],2),o(e,!1,function(e){n.push(s(e,r++))})):o(e,!1,n.push,n),new this(n))}})}},function(e,t,n){"use strict";var r=!1;if("undefined"!=typeof ReadableStream)try{new ReadableStream({start:function(e){e.close()}}),r=!0}catch(e){}t.ReadableStream=r?ReadableStream:n(141).ReadableStream},function(e,t,n){"use strict";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};!function(e,t){for(var n in t)e[n]=t[n]}(t,function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t,n){var i="function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?function(e){return void 0===e?"undefined":r(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":r(e)},a=n(1).assert;function o(e){return"string"==typeof e||"symbol"===(void 0===e?"undefined":i(e))}function s(e,t,n){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,n)}t.typeIsObject=function(e){return"object"===(void 0===e?"undefined":i(e))&&null!==e||"function"==typeof e},t.createDataProperty=function(e,n,r){a(t.typeIsObject(e)),Object.defineProperty(e,n,{value:r,writable:!0,enumerable:!0,configurable:!0})},t.createArrayFromList=function(e){return e.slice()},t.ArrayBufferCopy=function(e,t,n,r,i){new Uint8Array(e).set(new Uint8Array(n,r,i),t)},t.CreateIterResultObject=function(e,t){a("boolean"==typeof t);var n={};return Object.defineProperty(n,"value",{value:e,enumerable:!0,writable:!0,configurable:!0}),Object.defineProperty(n,"done",{value:t,enumerable:!0,writable:!0,configurable:!0}),n},t.IsFiniteNonNegativeNumber=function(e){return!Number.isNaN(e)&&(e!==1/0&&!(e<0))},t.InvokeOrNoop=function(e,t,n){a(void 0!==e),a(o(t)),a(Array.isArray(n));var r=e[t];if(void 0!==r)return s(r,e,n)},t.PromiseInvokeOrNoop=function(e,n,r){a(void 0!==e),a(o(n)),a(Array.isArray(r));try{return Promise.resolve(t.InvokeOrNoop(e,n,r))}catch(e){return Promise.reject(e)}},t.PromiseInvokeOrPerformFallback=function(e,t,n,r,i){a(void 0!==e),a(o(t)),a(Array.isArray(n)),a(Array.isArray(i));var l=void 0;try{l=e[t]}catch(e){return Promise.reject(e)}if(void 0===l)return r.apply(null,i);try{return Promise.resolve(s(l,e,n))}catch(e){return Promise.reject(e)}},t.TransferArrayBuffer=function(e){return e.slice()},t.ValidateAndNormalizeHighWaterMark=function(e){if(e=Number(e),Number.isNaN(e)||e<0)throw new RangeError("highWaterMark property of a queuing strategy must be non-negative and non-NaN");return e},t.ValidateAndNormalizeQueuingStrategy=function(e,n){if(void 0!==e&&"function"!=typeof e)throw new TypeError("size property of a queuing strategy must be a function");return{size:e,highWaterMark:n=t.ValidateAndNormalizeHighWaterMark(n)}}},function(e,t,n){function r(e){this.name="AssertionError",this.message=e||"",this.stack=(new Error).stack}r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,e.exports={rethrowAssertionErrorRejection:function(e){e&&e.constructor===r&&setTimeout(function(){throw e},0)},AssertionError:r,assert:function(e,t){if(!e)throw new r(t)}}},function(e,t,n){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}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=n(0),o=a.InvokeOrNoop,s=a.PromiseInvokeOrNoop,l=a.ValidateAndNormalizeQueuingStrategy,c=a.typeIsObject,u=n(1),d=u.assert,h=u.rethrowAssertionErrorRejection,p=n(3),f=p.DequeueValue,m=p.EnqueueValueWithSize,g=p.PeekQueueValue,v=p.ResetQueue,y=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.size,a=n.highWaterMark,o=void 0===a?1:a;if(i(this,e),this._state="writable",this._storedError=void 0,this._writer=void 0,this._writableStreamController=void 0,this._writeRequests=[],this._inFlightWriteRequest=void 0,this._closeRequest=void 0,this._inFlightCloseRequest=void 0,this._pendingAbortRequest=void 0,this._backpressure=!1,void 0!==t.type)throw new RangeError("Invalid type is specified");this._writableStreamController=new F(this,t,r,o),this._writableStreamController.__startSteps()}return r(e,[{key:"abort",value:function(e){return!1===w(this)?Promise.reject(U("abort")):!0===S(this)?Promise.reject(new TypeError("Cannot abort a stream that already has a writer")):_(this,e)}},{key:"getWriter",value:function(){if(!1===w(this))throw U("getWriter");return b(this)}},{key:"locked",get:function(){if(!1===w(this))throw U("locked");return S(this)}}]),e}();function b(e){return new I(e)}function w(e){return!!c(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")}function S(e){return d(!0===w(e),"IsWritableStreamLocked should only be used on known writable streams"),void 0!==e._writer}function _(e,t){var n=e._state;if("closed"===n)return Promise.resolve(void 0);if("errored"===n)return Promise.reject(e._storedError);var r=new TypeError("Requested to abort");if(void 0!==e._pendingAbortRequest)return Promise.reject(r);d("writable"===n||"erroring"===n,"state must be writable or erroring");var i=!1;"erroring"===n&&(i=!0,t=void 0);var a=new Promise(function(n,r){e._pendingAbortRequest={_resolve:n,_reject:r,_reason:t,_wasAlreadyErroring:i}});return!1===i&&A(e,r),a}function P(e,t){var n=e._state;"writable"!==n?(d("erroring"===n),k(e)):A(e,t)}function A(e,t){d(void 0===e._storedError,"stream._storedError === undefined"),d("writable"===e._state,"state must be writable");var n=e._writableStreamController;d(void 0!==n,"controller must not be undefined"),e._state="erroring",e._storedError=t;var r=e._writer;void 0!==r&&W(r,t),!1===T(e)&&!0===n._started&&k(e)}function k(e){d("erroring"===e._state,"stream._state === erroring"),d(!1===T(e),"WritableStreamHasOperationMarkedInFlight(stream) === false"),e._state="errored",e._writableStreamController.__errorSteps();for(var t=e._storedError,n=0;n<e._writeRequests.length;n++){e._writeRequests[n]._reject(t)}if(e._writeRequests=[],void 0!==e._pendingAbortRequest){var r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,!0===r._wasAlreadyErroring)return r._reject(t),void D(e);e._writableStreamController.__abortSteps(r._reason).then(function(){r._resolve(),D(e)},function(t){r._reject(t),D(e)})}else D(e)}function C(e){d(void 0!==e._inFlightCloseRequest),e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0;var t=e._state;d("writable"===t||"erroring"===t),"erroring"===t&&(e._storedError=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";var n=e._writer;void 0!==n&&function(e){d(void 0!==e._closedPromise_resolve,"writer._closedPromise_resolve !== undefined"),d(void 0!==e._closedPromise_reject,"writer._closedPromise_reject !== undefined"),d("pending"===e._closedPromiseState,"writer._closedPromiseState is pending"),e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved"}(n),d(void 0===e._pendingAbortRequest,"stream._pendingAbortRequest === undefined"),d(void 0===e._storedError,"stream._storedError === undefined")}function x(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function T(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}function D(e){d("errored"===e._state,'_stream_.[[state]] is `"errored"`'),void 0!==e._closeRequest&&(d(void 0===e._inFlightCloseRequest),e._closeRequest._reject(e._storedError),e._closeRequest=void 0);var t=e._writer;void 0!==t&&(H(t,e._storedError),t._closedPromise.catch(function(){}))}function E(e,t){d("writable"===e._state),d(!1===x(e));var n=e._writer;void 0!==n&&t!==e._backpressure&&(!0===t?function(e){d(void 0===e._readyPromise_resolve,"writer._readyPromise_resolve === undefined"),d(void 0===e._readyPromise_reject,"writer._readyPromise_reject === undefined"),e._readyPromise=new Promise(function(t,n){e._readyPromise_resolve=t,e._readyPromise_reject=n}),e._readyPromiseState="pending"}(n):(d(!1===t),Q(n))),e._backpressure=t}e.exports={AcquireWritableStreamDefaultWriter:b,IsWritableStream:w,IsWritableStreamLocked:S,WritableStream:y,WritableStreamAbort:_,WritableStreamDefaultControllerError:B,WritableStreamDefaultWriterCloseWithErrorPropagation:function(e){var t=e._ownerWritableStream;d(void 0!==t);var n=t._state;if(!0===x(t)||"closed"===n)return Promise.resolve();if("errored"===n)return Promise.reject(t._storedError);return d("writable"===n||"erroring"===n),R(e)},WritableStreamDefaultWriterRelease:L,WritableStreamDefaultWriterWrite:N,WritableStreamCloseQueuedOrInFlight:x};var I=function(){function e(t){if(i(this,e),!1===w(t))throw new TypeError("WritableStreamDefaultWriter can only be constructed with a WritableStream instance");if(!0===S(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t,t._writer=this;var n,r=t._state;if("writable"===r)!1===x(t)&&!0===t._backpressure?((n=this)._readyPromise=new Promise(function(e,t){n._readyPromise_resolve=e,n._readyPromise_reject=t}),n._readyPromiseState="pending"):J(this),Y(this);else if("erroring"===r)X(this,t._storedError),this._readyPromise.catch(function(){}),Y(this);else if("closed"===r)J(this),function(e){e._closedPromise=Promise.resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved"}(this);else{d("errored"===r,"state must be errored");var a=t._storedError;X(this,a),this._readyPromise.catch(function(){}),function(e,t){e._closedPromise=Promise.reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected"}(this,a),this._closedPromise.catch(function(){})}}return r(e,[{key:"abort",value:function(e){return!1===O(this)?Promise.reject(q("abort")):void 0===this._ownerWritableStream?Promise.reject(z("abort")):function(e,t){var n=e._ownerWritableStream;return d(void 0!==n),_(n,t)}(this,e)}},{key:"close",value:function(){if(!1===O(this))return Promise.reject(q("close"));var e=this._ownerWritableStream;return void 0===e?Promise.reject(z("close")):!0===x(e)?Promise.reject(new TypeError("cannot close an already-closing stream")):R(this)}},{key:"releaseLock",value:function(){if(!1===O(this))throw q("releaseLock");var e=this._ownerWritableStream;void 0!==e&&(d(void 0!==e._writer),L(this))}},{key:"write",value:function(e){return!1===O(this)?Promise.reject(q("write")):void 0===this._ownerWritableStream?Promise.reject(z("write to")):N(this,e)}},{key:"closed",get:function(){return!1===O(this)?Promise.reject(q("closed")):this._closedPromise}},{key:"desiredSize",get:function(){if(!1===O(this))throw q("desiredSize");if(void 0===this._ownerWritableStream)throw z("desiredSize");return function(e){var t=e._ownerWritableStream,n=t._state;if("errored"===n||"erroring"===n)return null;if("closed"===n)return 0;return G(t._writableStreamController)}(this)}},{key:"ready",get:function(){return!1===O(this)?Promise.reject(q("ready")):this._readyPromise}}]),e}();function O(e){return!!c(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")}function R(e){var t=e._ownerWritableStream;d(void 0!==t);var n=t._state;if("closed"===n||"errored"===n)return Promise.reject(new TypeError("The stream (in "+n+" state) is not in the writable state and cannot be closed"));d("writable"===n||"erroring"===n),d(!1===x(t));var r,i=new Promise(function(e,n){var r={_resolve:e,_reject:n};t._closeRequest=r});return!0===t._backpressure&&"writable"===n&&Q(e),r=t._writableStreamController,m(r,"close",0),V(r),i}function M(e,t){"pending"===e._closedPromiseState?H(e,t):function(e,t){d(void 0===e._closedPromise_resolve,"writer._closedPromise_resolve === undefined"),d(void 0===e._closedPromise_reject,"writer._closedPromise_reject === undefined"),d("pending"!==e._closedPromiseState,"writer._closedPromiseState is not pending"),e._closedPromise=Promise.reject(t),e._closedPromiseState="rejected"}(e,t),e._closedPromise.catch(function(){})}function W(e,t){"pending"===e._readyPromiseState?function(e,t){d(void 0!==e._readyPromise_resolve,"writer._readyPromise_resolve !== undefined"),d(void 0!==e._readyPromise_reject,"writer._readyPromise_reject !== undefined"),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected"}(e,t):function(e,t){d(void 0===e._readyPromise_resolve,"writer._readyPromise_resolve === undefined"),d(void 0===e._readyPromise_reject,"writer._readyPromise_reject === undefined"),e._readyPromise=Promise.reject(t),e._readyPromiseState="rejected"}(e,t),e._readyPromise.catch(function(){})}function L(e){var t=e._ownerWritableStream;d(void 0!==t),d(t._writer===e);var n=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");W(e,n),M(e,n),t._writer=void 0,e._ownerWritableStream=void 0}function N(e,t){var n=e._ownerWritableStream;d(void 0!==n);var r=n._writableStreamController,i=function(e,t){var n=e._strategySize;if(void 0===n)return 1;try{return n(t)}catch(t){return K(e,t),1}}(r,t);if(n!==e._ownerWritableStream)return Promise.reject(z("write to"));var a=n._state;if("errored"===a)return Promise.reject(n._storedError);if(!0===x(n)||"closed"===a)return Promise.reject(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===a)return Promise.reject(n._storedError);d("writable"===a);var o=function(e){return d(!0===S(e)),d("writable"===e._state),new Promise(function(t,n){var r={_resolve:t,_reject:n};e._writeRequests.push(r)})}(n);return function(e,t,n){var r={chunk:t};try{m(e,r,n)}catch(t){return void K(e,t)}var i=e._controlledWritableStream;if(!1===x(i)&&"writable"===i._state){var a=j(e);E(i,a)}V(e)}(r,t,i),o}var F=function(){function e(t,n,r,a){if(i(this,e),!1===w(t))throw new TypeError("WritableStreamDefaultController can only be constructed with a WritableStream instance");if(void 0!==t._writableStreamController)throw new TypeError("WritableStreamDefaultController instances can only be created by the WritableStream constructor");this._controlledWritableStream=t,this._underlyingSink=n,this._queue=void 0,this._queueTotalSize=void 0,v(this),this._started=!1;var o=l(r,a);this._strategySize=o.size,this._strategyHWM=o.highWaterMark,E(t,j(this))}return r(e,[{key:"error",value:function(e){if(!1===function(e){if(!c(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_underlyingSink"))return!1;return!0}(this))throw new TypeError("WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController");"writable"===this._controlledWritableStream._state&&B(this,e)}},{key:"__abortSteps",value:function(e){return s(this._underlyingSink,"abort",[e])}},{key:"__errorSteps",value:function(){v(this)}},{key:"__startSteps",value:function(){var e=this,t=o(this._underlyingSink,"start",[this]),n=this._controlledWritableStream;Promise.resolve(t).then(function(){d("writable"===n._state||"erroring"===n._state),e._started=!0,V(e)},function(t){d("writable"===n._state||"erroring"===n._state),e._started=!0,P(n,t)}).catch(h)}}]),e}();function G(e){return e._strategyHWM-e._queueTotalSize}function V(e){var t=e._controlledWritableStream;if(!1!==e._started&&void 0===t._inFlightWriteRequest){var n=t._state;if("closed"!==n&&"errored"!==n)if("erroring"!==n){if(0!==e._queue.length){var r=g(e);"close"===r?function(e){var t=e._controlledWritableStream;(function(e){d(void 0===e._inFlightCloseRequest),d(void 0!==e._closeRequest),e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),f(e),d(0===e._queue.length,"queue must be empty once the final write record is dequeued"),s(e._underlyingSink,"close",[]).then(function(){C(t)},function(e){!function(e,t){d(void 0!==e._inFlightCloseRequest),e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,d("writable"===e._state||"erroring"===e._state),void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),P(e,t)}(t,e)}).catch(h)}(e):function(e,t){var n=e._controlledWritableStream;(function(e){d(void 0===e._inFlightWriteRequest,"there must be no pending write request"),d(0!==e._writeRequests.length,"writeRequests must not be empty"),e._inFlightWriteRequest=e._writeRequests.shift()})(n),s(e._underlyingSink,"write",[t,e]).then(function(){!function(e){d(void 0!==e._inFlightWriteRequest),e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(n);var t=n._state;if(d("writable"===t||"erroring"===t),f(e),!1===x(n)&&"writable"===t){var r=j(e);E(n,r)}V(e)},function(e){!function(e,t){d(void 0!==e._inFlightWriteRequest),e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,d("writable"===e._state||"erroring"===e._state),P(e,t)}(n,e)}).catch(h)}(e,r.chunk)}}else k(t)}}function K(e,t){"writable"===e._controlledWritableStream._state&&B(e,t)}function j(e){return G(e)<=0}function B(e,t){var n=e._controlledWritableStream;d("writable"===n._state),A(n,t)}function U(e){return new TypeError("WritableStream.prototype."+e+" can only be used on a WritableStream")}function q(e){return new TypeError("WritableStreamDefaultWriter.prototype."+e+" can only be used on a WritableStreamDefaultWriter")}function z(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function Y(e){e._closedPromise=new Promise(function(t,n){e._closedPromise_resolve=t,e._closedPromise_reject=n,e._closedPromiseState="pending"})}function H(e,t){d(void 0!==e._closedPromise_resolve,"writer._closedPromise_resolve !== undefined"),d(void 0!==e._closedPromise_reject,"writer._closedPromise_reject !== undefined"),d("pending"===e._closedPromiseState,"writer._closedPromiseState is pending"),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected"}function X(e,t){e._readyPromise=Promise.reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected"}function J(e){e._readyPromise=Promise.resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled"}function Q(e){d(void 0!==e._readyPromise_resolve,"writer._readyPromise_resolve !== undefined"),d(void 0!==e._readyPromise_reject,"writer._readyPromise_reject !== undefined"),e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled"}},function(e,t,n){var r=n(0).IsFiniteNonNegativeNumber,i=n(1).assert;t.DequeueValue=function(e){i("_queue"in e&&"_queueTotalSize"in e,"Spec-level failure: DequeueValue should only be used on containers with [[queue]] and [[queueTotalSize]]."),i(e._queue.length>0,"Spec-level failure: should never dequeue from an empty queue.");var t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value},t.EnqueueValueWithSize=function(e,t,n){if(i("_queue"in e&&"_queueTotalSize"in e,"Spec-level failure: EnqueueValueWithSize should only be used on containers with [[queue]] and [[queueTotalSize]]."),n=Number(n),!r(n))throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:t,size:n}),e._queueTotalSize+=n},t.PeekQueueValue=function(e){return i("_queue"in e&&"_queueTotalSize"in e,"Spec-level failure: PeekQueueValue should only be used on containers with [[queue]] and [[queueTotalSize]]."),i(e._queue.length>0,"Spec-level failure: should never peek at an empty queue."),e._queue[0].value},t.ResetQueue=function(e){i("_queue"in e&&"_queueTotalSize"in e,"Spec-level failure: ResetQueue should only be used on containers with [[queue]] and [[queueTotalSize]]."),e._queue=[],e._queueTotalSize=0}},function(e,t,n){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}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=n(0),o=a.ArrayBufferCopy,s=a.CreateIterResultObject,l=a.IsFiniteNonNegativeNumber,c=a.InvokeOrNoop,u=a.PromiseInvokeOrNoop,d=a.TransferArrayBuffer,h=a.ValidateAndNormalizeQueuingStrategy,p=a.ValidateAndNormalizeHighWaterMark,f=n(0),m=f.createArrayFromList,g=f.createDataProperty,v=f.typeIsObject,y=n(1),b=y.assert,w=y.rethrowAssertionErrorRejection,S=n(3),_=S.DequeueValue,P=S.EnqueueValueWithSize,A=S.ResetQueue,k=n(2),C=k.AcquireWritableStreamDefaultWriter,x=k.IsWritableStream,T=k.IsWritableStreamLocked,D=k.WritableStreamAbort,E=k.WritableStreamDefaultWriterCloseWithErrorPropagation,I=k.WritableStreamDefaultWriterRelease,O=k.WritableStreamDefaultWriterWrite,R=k.WritableStreamCloseQueuedOrInFlight,M=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.size,a=n.highWaterMark;i(this,e),this._state="readable",this._reader=void 0,this._storedError=void 0,this._disturbed=!1,this._readableStreamController=void 0;var o=t.type;if("bytes"===String(o))void 0===a&&(a=0),this._readableStreamController=new he(this,t,a);else{if(void 0!==o)throw new RangeError("Invalid type is specified");void 0===a&&(a=1),this._readableStreamController=new re(this,t,r,a)}}return r(e,[{key:"cancel",value:function(e){return!1===L(this)?Promise.reject(De("cancel")):!0===N(this)?Promise.reject(new TypeError("Cannot cancel a stream that already has a reader")):K(this,e)}},{key:"getReader",value:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mode;if(!1===L(this))throw De("getReader");if(void 0===e)return W(this);if("byob"===(e=String(e)))return new J(this);throw new RangeError("Invalid mode is specified")}},{key:"pipeThrough",value:function(e,t){var n=e.writable,r=e.readable;return function(e){try{Promise.prototype.then.call(e,void 0,function(){})}catch(e){}}(this.pipeTo(n,t)),r}},{key:"pipeTo",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.preventClose,i=n.preventAbort,a=n.preventCancel;if(!1===L(this))return Promise.reject(De("pipeTo"));if(!1===x(e))return Promise.reject(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));if(r=Boolean(r),i=Boolean(i),a=Boolean(a),!0===N(this))return Promise.reject(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream"));if(!0===T(e))return Promise.reject(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream"));var o=W(this),s=C(e),l=!1,c=Promise.resolve();return new Promise(function(n,u){var d,h,p;if(g(t,o._closedPromise,function(t){!1===i?v(function(){return D(e,t)},!0,t):y(!0,t)}),g(e,s._closedPromise,function(e){!1===a?v(function(){return K(t,e)},!0,e):y(!0,e)}),d=t,h=o._closedPromise,p=function(){!1===r?v(function(){return E(s)}):y()},"closed"===d._state?p():h.then(p).catch(w),!0===R(e)||"closed"===e._state){var f=new TypeError("the destination writable stream closed before all data could be piped to it");!1===a?v(function(){return K(t,f)},!0,f):y(!0,f)}function m(){var e=c;return c.then(function(){return e!==c?m():void 0})}function g(e,t,n){"errored"===e._state?n(e._storedError):t.catch(n).catch(w)}function v(t,n,r){function i(){t().then(function(){return b(n,r)},function(e){return b(!0,e)}).catch(w)}!0!==l&&(l=!0,"writable"===e._state&&!1===R(e)?m().then(i):i())}function y(t,n){!0!==l&&(l=!0,"writable"===e._state&&!1===R(e)?m().then(function(){return b(t,n)}).catch(w):b(t,n))}function b(e,t){I(s),te(o),e?u(t):n(void 0)}(function e(){return c=Promise.resolve(),!0===l?Promise.resolve():s._readyPromise.then(function(){return ne(o).then(function(e){var t=e.value;!0!==e.done&&(c=O(s,t).catch(function(){}))})}).then(e)})().catch(function(e){c=Promise.resolve(),w(e)})})}},{key:"tee",value:function(){if(!1===L(this))throw De("tee");var e=F(this,!1);return m(e)}},{key:"locked",get:function(){if(!1===L(this))throw De("locked");return N(this)}}]),e}();function W(e){return new X(e)}function L(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")}function N(e){return b(!0===L(e),"IsReadableStreamLocked should only be used on known readable streams"),void 0!==e._reader}function F(e,t){b(!0===L(e)),b("boolean"==typeof t);var n=W(e),r={closedOrErrored:!1,canceled1:!1,canceled2:!1,reason1:void 0,reason2:void 0};r.promise=new Promise(function(e){r._resolve=e});var i=function(){return function e(){var t=e._reader,n=e._branch1,r=e._branch2,i=e._teeState;return ne(t).then(function(e){b(v(e));var t=e.value,a=e.done;if(b("boolean"==typeof a),!0===a&&!1===i.closedOrErrored&&(!1===i.canceled1&&oe(n),!1===i.canceled2&&oe(r),i.closedOrErrored=!0),!0!==i.closedOrErrored){var o=t,s=t;!1===i.canceled1&&se(n,o),!1===i.canceled2&&se(r,s)}})}}();i._reader=n,i._teeState=r,i._cloneForBranch2=t;var a=function(){return function e(t){var n=e._stream,r=e._teeState;r.canceled1=!0;r.reason1=t;if(!0===r.canceled2){var i=m([r.reason1,r.reason2]),a=K(n,i);r._resolve(a)}return r.promise}}();a._stream=e,a._teeState=r;var o=function(){return function e(t){var n=e._stream,r=e._teeState;r.canceled2=!0;r.reason2=t;if(!0===r.canceled1){var i=m([r.reason1,r.reason2]),a=K(n,i);r._resolve(a)}return r.promise}}();o._stream=e,o._teeState=r;var s=Object.create(Object.prototype);g(s,"pull",i),g(s,"cancel",a);var l=new M(s),c=Object.create(Object.prototype);g(c,"pull",i),g(c,"cancel",o);var u=new M(c);return i._branch1=l._readableStreamController,i._branch2=u._readableStreamController,n._closedPromise.catch(function(e){!0!==r.closedOrErrored&&(le(i._branch1,e),le(i._branch2,e),r.closedOrErrored=!0)}),[l,u]}function G(e){return b(!0===Q(e._reader)),b("readable"===e._state||"closed"===e._state),new Promise(function(t,n){var r={_resolve:t,_reject:n};e._reader._readIntoRequests.push(r)})}function V(e){return b(!0===Z(e._reader)),b("readable"===e._state),new Promise(function(t,n){var r={_resolve:t,_reject:n};e._reader._readRequests.push(r)})}function K(e,t){return e._disturbed=!0,"closed"===e._state?Promise.resolve(void 0):"errored"===e._state?Promise.reject(e._storedError):(j(e),e._readableStreamController.__cancelSteps(t).then(function(){}))}function j(e){b("readable"===e._state),e._state="closed";var t=e._reader;if(void 0!==t){if(!0===Z(t)){for(var n=0;n<t._readRequests.length;n++){(0,t._readRequests[n]._resolve)(s(void 0,!0))}t._readRequests=[]}!function(e){b(void 0!==e._closedPromise_resolve),b(void 0!==e._closedPromise_reject),e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}(t)}}function B(e,t){b(!0===L(e),"stream must be ReadableStream"),b("readable"===e._state,"state must be readable"),e._state="errored",e._storedError=t;var n=e._reader;if(void 0!==n){if(!0===Z(n)){for(var r=0;r<n._readRequests.length;r++){n._readRequests[r]._reject(t)}n._readRequests=[]}else{b(Q(n),"reader must be ReadableStreamBYOBReader");for(var i=0;i<n._readIntoRequests.length;i++){n._readIntoRequests[i]._reject(t)}n._readIntoRequests=[]}Oe(n,t),n._closedPromise.catch(function(){})}}function U(e,t,n){var r=e._reader;b(r._readRequests.length>0),r._readRequests.shift()._resolve(s(t,n))}function q(e){return e._reader._readIntoRequests.length}function z(e){return e._reader._readRequests.length}function Y(e){var t=e._reader;return void 0!==t&&!1!==Q(t)}function H(e){var t=e._reader;return void 0!==t&&!1!==Z(t)}e.exports={ReadableStream:M,IsReadableStreamDisturbed:function(e){return b(!0===L(e),"IsReadableStreamDisturbed should only be used on known readable streams"),e._disturbed},ReadableStreamDefaultControllerClose:oe,ReadableStreamDefaultControllerEnqueue:se,ReadableStreamDefaultControllerError:le,ReadableStreamDefaultControllerGetDesiredSize:ue};var X=function(){function e(t){if(i(this,e),!1===L(t))throw new TypeError("ReadableStreamDefaultReader can only be constructed with a ReadableStream instance");if(!0===N(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");$(this,t),this._readRequests=[]}return r(e,[{key:"cancel",value:function(e){return!1===Z(this)?Promise.reject(Ie("cancel")):void 0===this._ownerReadableStream?Promise.reject(Ee("cancel")):ee(this,e)}},{key:"read",value:function(){return!1===Z(this)?Promise.reject(Ie("read")):void 0===this._ownerReadableStream?Promise.reject(Ee("read from")):ne(this)}},{key:"releaseLock",value:function(){if(!1===Z(this))throw Ie("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");te(this)}}},{key:"closed",get:function(){return!1===Z(this)?Promise.reject(Ie("closed")):this._closedPromise}}]),e}(),J=function(){function e(t){if(i(this,e),!L(t))throw new TypeError("ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a byte source");if(!1===pe(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");if(N(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");$(this,t),this._readIntoRequests=[]}return r(e,[{key:"cancel",value:function(e){return Q(this)?void 0===this._ownerReadableStream?Promise.reject(Ee("cancel")):ee(this,e):Promise.reject(Re("cancel"))}},{key:"read",value:function(e){return Q(this)?void 0===this._ownerReadableStream?Promise.reject(Ee("read from")):ArrayBuffer.isView(e)?0===e.byteLength?Promise.reject(new TypeError("view must have non-zero byteLength")):function(e,t){var n=e._ownerReadableStream;if(b(void 0!==n),n._disturbed=!0,"errored"===n._state)return Promise.reject(n._storedError);return function(e,t){var n=e._controlledReadableStream,r=1;t.constructor!==DataView&&(r=t.constructor.BYTES_PER_ELEMENT);var i=t.constructor,a={buffer:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength,bytesFilled:0,elementSize:r,ctor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return a.buffer=d(a.buffer),e._pendingPullIntos.push(a),G(n);if("closed"===n._state){var o=new t.constructor(a.buffer,a.byteOffset,0);return Promise.resolve(s(o,!0))}if(e._queueTotalSize>0){if(!0===we(e,a)){var l=ye(a);return _e(e),Promise.resolve(s(l,!1))}if(!0===e._closeRequested){var c=new TypeError("Insufficient bytes to fill elements in the given buffer");return xe(e,c),Promise.reject(c)}}a.buffer=d(a.buffer),e._pendingPullIntos.push(a);var u=G(n);return me(e),u}(n._readableStreamController,t)}(this,e):Promise.reject(new TypeError("view must be an array buffer view")):Promise.reject(Re("read"))}},{key:"releaseLock",value:function(){if(!Q(this))throw Re("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");te(this)}}},{key:"closed",get:function(){return Q(this)?this._closedPromise:Promise.reject(Re("closed"))}}]),e}();function Q(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")}function Z(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")}function $(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?function(e){e._closedPromise=new Promise(function(t,n){e._closedPromise_resolve=t,e._closedPromise_reject=n})}(e):"closed"===t._state?function(e){e._closedPromise=Promise.resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}(e):(b("errored"===t._state,"state must be errored"),function(e,t){e._closedPromise=Promise.reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}(e,t._storedError),e._closedPromise.catch(function(){}))}function ee(e,t){var n=e._ownerReadableStream;return b(void 0!==n),K(n,t)}function te(e){b(void 0!==e._ownerReadableStream),b(e._ownerReadableStream._reader===e),"readable"===e._ownerReadableStream._state?Oe(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e,t){b(void 0===e._closedPromise_resolve),b(void 0===e._closedPromise_reject),e._closedPromise=Promise.reject(t)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._closedPromise.catch(function(){}),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function ne(e){var t=e._ownerReadableStream;return b(void 0!==t),t._disturbed=!0,"closed"===t._state?Promise.resolve(s(void 0,!0)):"errored"===t._state?Promise.reject(t._storedError):(b("readable"===t._state),t._readableStreamController.__pullSteps())}var re=function(){function e(t,n,r,a){if(i(this,e),!1===L(t))throw new TypeError("ReadableStreamDefaultController can only be constructed with a ReadableStream instance");if(void 0!==t._readableStreamController)throw new TypeError("ReadableStreamDefaultController instances can only be created by the ReadableStream constructor");this._controlledReadableStream=t,this._underlyingSource=n,this._queue=void 0,this._queueTotalSize=void 0,A(this),this._started=!1,this._closeRequested=!1,this._pullAgain=!1,this._pulling=!1;var o=h(r,a);this._strategySize=o.size,this._strategyHWM=o.highWaterMark;var s=this,l=c(n,"start",[this]);Promise.resolve(l).then(function(){s._started=!0,b(!1===s._pulling),b(!1===s._pullAgain),ae(s)},function(e){ce(s,e)}).catch(w)}return r(e,[{key:"close",value:function(){if(!1===ie(this))throw Me("close");if(!0===this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var e=this._controlledReadableStream._state;if("readable"!==e)throw new TypeError("The stream (in "+e+" state) is not in the readable state and cannot be closed");oe(this)}},{key:"enqueue",value:function(e){if(!1===ie(this))throw Me("enqueue");if(!0===this._closeRequested)throw new TypeError("stream is closed or draining");var t=this._controlledReadableStream._state;if("readable"!==t)throw new TypeError("The stream (in "+t+" state) is not in the readable state and cannot be enqueued to");return se(this,e)}},{key:"error",value:function(e){if(!1===ie(this))throw Me("error");var t=this._controlledReadableStream;if("readable"!==t._state)throw new TypeError("The stream is "+t._state+" and so cannot be errored");le(this,e)}},{key:"__cancelSteps",value:function(e){return A(this),u(this._underlyingSource,"cancel",[e])}},{key:"__pullSteps",value:function(){var e=this._controlledReadableStream;if(this._queue.length>0){var t=_(this);return!0===this._closeRequested&&0===this._queue.length?j(e):ae(this),Promise.resolve(s(t,!1))}var n=V(e);return ae(this),n}},{key:"desiredSize",get:function(){if(!1===ie(this))throw Me("desiredSize");return ue(this)}}]),e}();function ie(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_underlyingSource")}function ae(e){!1!==function(e){var t=e._controlledReadableStream;if("closed"===t._state||"errored"===t._state)return!1;if(!0===e._closeRequested)return!1;if(!1===e._started)return!1;if(!0===N(t)&&z(t)>0)return!0;if(ue(e)>0)return!0;return!1}(e)&&(!0!==e._pulling?(b(!1===e._pullAgain),e._pulling=!0,u(e._underlyingSource,"pull",[e]).then(function(){if(e._pulling=!1,!0===e._pullAgain)return e._pullAgain=!1,ae(e)},function(t){ce(e,t)}).catch(w)):e._pullAgain=!0)}function oe(e){var t=e._controlledReadableStream;b(!1===e._closeRequested),b("readable"===t._state),e._closeRequested=!0,0===e._queue.length&&j(t)}function se(e,t){var n=e._controlledReadableStream;if(b(!1===e._closeRequested),b("readable"===n._state),!0===N(n)&&z(n)>0)U(n,t,!1);else{var r=1;if(void 0!==e._strategySize){var i=e._strategySize;try{r=i(t)}catch(t){throw ce(e,t),t}}try{P(e,t,r)}catch(t){throw ce(e,t),t}}ae(e)}function le(e,t){var n=e._controlledReadableStream;b("readable"===n._state),A(e),B(n,t)}function ce(e,t){"readable"===e._controlledReadableStream._state&&le(e,t)}function ue(e){var t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}var de=function(){function e(t,n){i(this,e),this._associatedReadableByteStreamController=t,this._view=n}return r(e,[{key:"respond",value:function(e){if(!1===fe(this))throw We("respond");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");!function(e,t){if(t=Number(t),!1===l(t))throw new RangeError("bytesWritten must be a finite");b(e._pendingPullIntos.length>0),ke(e,t)}(this._associatedReadableByteStreamController,e)}},{key:"respondWithNewView",value:function(e){if(!1===fe(this))throw We("respond");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");!function(e,t){b(e._pendingPullIntos.length>0);var n=e._pendingPullIntos[0];if(n.byteOffset+n.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(n.byteLength!==t.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");n.buffer=t.buffer,ke(e,t.byteLength)}(this._associatedReadableByteStreamController,e)}},{key:"view",get:function(){return this._view}}]),e}(),he=function(){function e(t,n,r){if(i(this,e),!1===L(t))throw new TypeError("ReadableByteStreamController can only be constructed with a ReadableStream instance given a byte source");if(void 0!==t._readableStreamController)throw new TypeError("ReadableByteStreamController instances can only be created by the ReadableStream constructor given a byte source");this._controlledReadableStream=t,this._underlyingByteSource=n,this._pullAgain=!1,this._pulling=!1,ge(this),this._queue=this._queueTotalSize=void 0,A(this),this._closeRequested=!1,this._started=!1,this._strategyHWM=p(r);var a=n.autoAllocateChunkSize;if(void 0!==a&&(!1===Number.isInteger(a)||a<=0))throw new RangeError("autoAllocateChunkSize must be a positive integer");this._autoAllocateChunkSize=a,this._pendingPullIntos=[];var o=this,s=c(n,"start",[this]);Promise.resolve(s).then(function(){o._started=!0,b(!1===o._pulling),b(!1===o._pullAgain),me(o)},function(e){"readable"===t._state&&xe(o,e)}).catch(w)}return r(e,[{key:"close",value:function(){if(!1===pe(this))throw Le("close");if(!0===this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var e=this._controlledReadableStream._state;if("readable"!==e)throw new TypeError("The stream (in "+e+" state) is not in the readable state and cannot be closed");!function(e){var t=e._controlledReadableStream;if(b(!1===e._closeRequested),b("readable"===t._state),e._queueTotalSize>0)return void(e._closeRequested=!0);if(e._pendingPullIntos.length>0){var n=e._pendingPullIntos[0];if(n.bytesFilled>0){var r=new TypeError("Insufficient bytes to fill elements in the given buffer");throw xe(e,r),r}}j(t)}(this)}},{key:"enqueue",value:function(e){if(!1===pe(this))throw Le("enqueue");if(!0===this._closeRequested)throw new TypeError("stream is closed or draining");var t=this._controlledReadableStream._state;if("readable"!==t)throw new TypeError("The stream (in "+t+" state) is not in the readable state and cannot be enqueued to");if(!ArrayBuffer.isView(e))throw new TypeError("You can only enqueue array buffer views when using a ReadableByteStreamController");!function(e,t){var n=e._controlledReadableStream;b(!1===e._closeRequested),b("readable"===n._state);var r=t.buffer,i=t.byteOffset,a=t.byteLength,o=d(r);if(!0===H(n))if(0===z(n))be(e,o,i,a);else{b(0===e._queue.length);var s=new Uint8Array(o,i,a);U(n,s,!1)}else!0===Y(n)?(be(e,o,i,a),Ae(e)):(b(!1===N(n),"stream must not be locked"),be(e,o,i,a))}(this,e)}},{key:"error",value:function(e){if(!1===pe(this))throw Le("error");var t=this._controlledReadableStream;if("readable"!==t._state)throw new TypeError("The stream is "+t._state+" and so cannot be errored");xe(this,e)}},{key:"__cancelSteps",value:function(e){this._pendingPullIntos.length>0&&(this._pendingPullIntos[0].bytesFilled=0);return A(this),u(this._underlyingByteSource,"cancel",[e])}},{key:"__pullSteps",value:function(){var e=this._controlledReadableStream;if(b(!0===H(e)),this._queueTotalSize>0){b(0===z(e));var t=this._queue.shift();this._queueTotalSize-=t.byteLength,_e(this);var n=void 0;try{n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}catch(e){return Promise.reject(e)}return Promise.resolve(s(n,!1))}var r=this._autoAllocateChunkSize;if(void 0!==r){var i=void 0;try{i=new ArrayBuffer(r)}catch(e){return Promise.reject(e)}var a={buffer:i,byteOffset:0,byteLength:r,bytesFilled:0,elementSize:1,ctor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(a)}var o=V(e);return me(this),o}},{key:"byobRequest",get:function(){if(!1===pe(this))throw Le("byobRequest");if(void 0===this._byobRequest&&this._pendingPullIntos.length>0){var e=this._pendingPullIntos[0],t=new Uint8Array(e.buffer,e.byteOffset+e.bytesFilled,e.byteLength-e.bytesFilled);this._byobRequest=new de(this,t)}return this._byobRequest}},{key:"desiredSize",get:function(){if(!1===pe(this))throw Le("desiredSize");return Te(this)}}]),e}();function pe(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_underlyingByteSource")}function fe(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")}function me(e){!1!==function(e){var t=e._controlledReadableStream;if("readable"!==t._state)return!1;if(!0===e._closeRequested)return!1;if(!1===e._started)return!1;if(!0===H(t)&&z(t)>0)return!0;if(!0===Y(t)&&q(t)>0)return!0;if(Te(e)>0)return!0;return!1}(e)&&(!0!==e._pulling?(b(!1===e._pullAgain),e._pulling=!0,u(e._underlyingByteSource,"pull",[e]).then(function(){e._pulling=!1,!0===e._pullAgain&&(e._pullAgain=!1,me(e))},function(t){"readable"===e._controlledReadableStream._state&&xe(e,t)}).catch(w)):e._pullAgain=!0)}function ge(e){Pe(e),e._pendingPullIntos=[]}function ve(e,t){b("errored"!==e._state,"state must not be errored");var n=!1;"closed"===e._state&&(b(0===t.bytesFilled),n=!0);var r=ye(t);"default"===t.readerType?U(e,r,n):(b("byob"===t.readerType),function(e,t,n){var r=e._reader;b(r._readIntoRequests.length>0),r._readIntoRequests.shift()._resolve(s(t,n))}(e,r,n))}function ye(e){var t=e.bytesFilled,n=e.elementSize;return b(t<=e.byteLength),b(t%n==0),new e.ctor(e.buffer,e.byteOffset,t/n)}function be(e,t,n,r){e._queue.push({buffer:t,byteOffset:n,byteLength:r}),e._queueTotalSize+=r}function we(e,t){var n=t.elementSize,r=t.bytesFilled-t.bytesFilled%n,i=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),a=t.bytesFilled+i,s=a-a%n,l=i,c=!1;s>r&&(l=s-t.bytesFilled,c=!0);for(var u=e._queue;l>0;){var d=u[0],h=Math.min(l,d.byteLength),p=t.byteOffset+t.bytesFilled;o(t.buffer,p,d.buffer,d.byteOffset,h),d.byteLength===h?u.shift():(d.byteOffset+=h,d.byteLength-=h),e._queueTotalSize-=h,Se(e,h,t),l-=h}return!1===c&&(b(0===e._queueTotalSize,"queue must be empty"),b(t.bytesFilled>0),b(t.bytesFilled<t.elementSize)),c}function Se(e,t,n){b(0===e._pendingPullIntos.length||e._pendingPullIntos[0]===n),Pe(e),n.bytesFilled+=t}function _e(e){b("readable"===e._controlledReadableStream._state),0===e._queueTotalSize&&!0===e._closeRequested?j(e._controlledReadableStream):me(e)}function Pe(e){void 0!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=void 0,e._byobRequest=void 0)}function Ae(e){for(b(!1===e._closeRequested);e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;var t=e._pendingPullIntos[0];!0===we(e,t)&&(Ce(e),ve(e._controlledReadableStream,t))}}function ke(e,t){var n=e._pendingPullIntos[0],r=e._controlledReadableStream;if("closed"===r._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream");!function(e,t){t.buffer=d(t.buffer),b(0===t.bytesFilled,"bytesFilled must be 0");var n=e._controlledReadableStream;if(!0===Y(n))for(;q(n)>0;)ve(n,Ce(e))}(e,n)}else b("readable"===r._state),function(e,t,n){if(n.bytesFilled+t>n.byteLength)throw new RangeError("bytesWritten out of range");if(Se(e,t,n),!(n.bytesFilled<n.elementSize)){Ce(e);var r=n.bytesFilled%n.elementSize;if(r>0){var i=n.byteOffset+n.bytesFilled,a=n.buffer.slice(i-r,i);be(e,a,0,a.byteLength)}n.buffer=d(n.buffer),n.bytesFilled-=r,ve(e._controlledReadableStream,n),Ae(e)}}(e,t,n)}function Ce(e){var t=e._pendingPullIntos.shift();return Pe(e),t}function xe(e,t){var n=e._controlledReadableStream;b("readable"===n._state),ge(e),A(e),B(n,t)}function Te(e){var t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function De(e){return new TypeError("ReadableStream.prototype."+e+" can only be used on a ReadableStream")}function Ee(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function Ie(e){return new TypeError("ReadableStreamDefaultReader.prototype."+e+" can only be used on a ReadableStreamDefaultReader")}function Oe(e,t){b(void 0!==e._closedPromise_resolve),b(void 0!==e._closedPromise_reject),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}function Re(e){return new TypeError("ReadableStreamBYOBReader.prototype."+e+" can only be used on a ReadableStreamBYOBReader")}function Me(e){return new TypeError("ReadableStreamDefaultController.prototype."+e+" can only be used on a ReadableStreamDefaultController")}function We(e){return new TypeError("ReadableStreamBYOBRequest.prototype."+e+" can only be used on a ReadableStreamBYOBRequest")}function Le(e){return new TypeError("ReadableByteStreamController.prototype."+e+" can only be used on a ReadableByteStreamController")}},function(e,t,n){var r=n(6),i=n(4),a=n(2);t.TransformStream=r.TransformStream,t.ReadableStream=i.ReadableStream,t.IsReadableStreamDisturbed=i.IsReadableStreamDisturbed,t.ReadableStreamDefaultControllerClose=i.ReadableStreamDefaultControllerClose,t.ReadableStreamDefaultControllerEnqueue=i.ReadableStreamDefaultControllerEnqueue,t.ReadableStreamDefaultControllerError=i.ReadableStreamDefaultControllerError,t.ReadableStreamDefaultControllerGetDesiredSize=i.ReadableStreamDefaultControllerGetDesiredSize,t.AcquireWritableStreamDefaultWriter=a.AcquireWritableStreamDefaultWriter,t.IsWritableStream=a.IsWritableStream,t.IsWritableStreamLocked=a.IsWritableStreamLocked,t.WritableStream=a.WritableStream,t.WritableStreamAbort=a.WritableStreamAbort,t.WritableStreamDefaultControllerError=a.WritableStreamDefaultControllerError,t.WritableStreamDefaultWriterCloseWithErrorPropagation=a.WritableStreamDefaultWriterCloseWithErrorPropagation,t.WritableStreamDefaultWriterRelease=a.WritableStreamDefaultWriterRelease,t.WritableStreamDefaultWriterWrite=a.WritableStreamDefaultWriterWrite},function(e,t,n){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}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=n(1).assert,o=n(0),s=o.InvokeOrNoop,l=o.PromiseInvokeOrPerformFallback,c=o.PromiseInvokeOrNoop,u=o.typeIsObject,d=n(4),h=d.ReadableStream,p=d.ReadableStreamDefaultControllerClose,f=d.ReadableStreamDefaultControllerEnqueue,m=d.ReadableStreamDefaultControllerError,g=d.ReadableStreamDefaultControllerGetDesiredSize,v=n(2),y=v.WritableStream,b=v.WritableStreamDefaultControllerError;function w(e,t){if(!0===e._errored)throw new TypeError("TransformStream is already errored");if(!0===e._readableClosed)throw new TypeError("Readable side is already closed");var n=e._readableController;try{f(n,t)}catch(t){throw e._readableClosed=!0,_(e,t),e._storedError}!0===g(n)<=0&&!1===e._backpressure&&k(e,!0)}function S(e){a(!1===e._errored),a(!1===e._readableClosed);try{p(e._readableController)}catch(e){a(!1)}e._readableClosed=!0}function _(e,t){!1===e._errored&&P(e,t)}function P(e,t){a(!1===e._errored),e._errored=!0,e._storedError=t,!1===e._writableDone&&b(e._writableController,t),!1===e._readableClosed&&m(e._readableController,t)}function A(e){return a(void 0!==e._backpressureChangePromise,"_backpressureChangePromise should have been initialized"),!1===e._backpressure?Promise.resolve():(a(!0===e._backpressure,"_backpressure should have been initialized"),e._backpressureChangePromise)}function k(e,t){a(e._backpressure!==t,"TransformStreamSetBackpressure() should be called only when backpressure is changed"),void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(t),e._backpressureChangePromise=new Promise(function(t){e._backpressureChangePromise_resolve=t}),e._backpressureChangePromise.then(function(e){a(e!==t,"_backpressureChangePromise should be fulfilled only when backpressure is changed")}),e._backpressure=t}function C(e,t){return w(t._controlledTransformStream,e),Promise.resolve()}function x(e){return!!u(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")}function T(e){return!!u(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")}var D=function(){function e(t,n){i(this,e),this._transformStream=t,this._startPromise=n}return r(e,[{key:"start",value:function(e){var t=this._transformStream;return t._writableController=e,this._startPromise.then(function(){return A(t)})}},{key:"write",value:function(e){return function(e,t){a(!1===e._errored),a(!1===e._transforming),a(!1===e._backpressure),e._transforming=!0;var n=e._transformer,r=e._transformStreamController;return l(n,"transform",[t,r],C,[t,r]).then(function(){return e._transforming=!1,A(e)},function(t){return _(e,t),Promise.reject(t)})}(this._transformStream,e)}},{key:"abort",value:function(){var e=this._transformStream;e._writableDone=!0,P(e,new TypeError("Writable side aborted"))}},{key:"close",value:function(){var e=this._transformStream;return a(!1===e._transforming),e._writableDone=!0,c(e._transformer,"flush",[e._transformStreamController]).then(function(){return!0===e._errored?Promise.reject(e._storedError):(!1===e._readableClosed&&S(e),Promise.resolve())}).catch(function(t){return _(e,t),Promise.reject(e._storedError)})}}]),e}(),E=function(){function e(t,n){i(this,e),this._transformStream=t,this._startPromise=n}return r(e,[{key:"start",value:function(e){var t=this._transformStream;return t._readableController=e,this._startPromise.then(function(){return a(void 0!==t._backpressureChangePromise,"_backpressureChangePromise should have been initialized"),!0===t._backpressure?Promise.resolve():(a(!1===t._backpressure,"_backpressure should have been initialized"),t._backpressureChangePromise)})}},{key:"pull",value:function(){var e=this._transformStream;return a(!0===e._backpressure,"pull() should be never called while _backpressure is false"),a(void 0!==e._backpressureChangePromise,"_backpressureChangePromise should have been initialized"),k(e,!1),e._backpressureChangePromise}},{key:"cancel",value:function(){var e=this._transformStream;e._readableClosed=!0,P(e,new TypeError("Readable side canceled"))}}]),e}(),I=function(){function e(t){if(i(this,e),!1===T(t))throw new TypeError("TransformStreamDefaultController can only be constructed with a TransformStream instance");if(void 0!==t._transformStreamController)throw new TypeError("TransformStreamDefaultController instances can only be created by the TransformStream constructor");this._controlledTransformStream=t}return r(e,[{key:"enqueue",value:function(e){if(!1===x(this))throw R("enqueue");w(this._controlledTransformStream,e)}},{key:"close",value:function(){if(!1===x(this))throw R("close");!function(e){if(!0===e._errored)throw new TypeError("TransformStream is already errored");if(!0===e._readableClosed)throw new TypeError("Readable side is already closed");S(e)}(this._controlledTransformStream)}},{key:"error",value:function(e){if(!1===x(this))throw R("error");!function(e,t){if(!0===e._errored)throw new TypeError("TransformStream is already errored");P(e,t)}(this._controlledTransformStream,e)}},{key:"desiredSize",get:function(){if(!1===x(this))throw R("desiredSize");var e=this._controlledTransformStream._readableController;return g(e)}}]),e}(),O=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),this._transformer=t;var n=t.readableStrategy,r=t.writableStrategy;this._transforming=!1,this._errored=!1,this._storedError=void 0,this._writableController=void 0,this._readableController=void 0,this._transformStreamController=void 0,this._writableDone=!1,this._readableClosed=!1,this._backpressure=void 0,this._backpressureChangePromise=void 0,this._backpressureChangePromise_resolve=void 0,this._transformStreamController=new I(this);var o=void 0,l=new Promise(function(e){o=e}),c=new E(this,l);this._readable=new h(c,n);var u=new D(this,l);this._writable=new y(u,r),a(void 0!==this._writableController),a(void 0!==this._readableController),k(this,g(this._readableController)<=0);var d=this,p=s(t,"start",[d._transformStreamController]);o(p),l.catch(function(e){!1===d._errored&&(d._errored=!0,d._storedError=e)})}return r(e,[{key:"readable",get:function(){if(!1===T(this))throw M("readable");return this._readable}},{key:"writable",get:function(){if(!1===T(this))throw M("writable");return this._writable}}]),e}();function R(e){return new TypeError("TransformStreamDefaultController.prototype."+e+" can only be used on a TransformStreamDefaultController")}function M(e){return new TypeError("TransformStream.prototype."+e+" can only be used on a TransformStream")}e.exports={TransformStream:O}},function(e,t,n){e.exports=n(5)}]))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFJS=t.globalScope=void 0;var r,i=n(84),a=n(14),o=n(1),s=n(87),l=n(25),c=(r=l)&&r.__esModule?r:{default:r},u=n(86),d=n(96),h=n(97);c.default.PDFJS||(c.default.PDFJS={});var p=c.default.PDFJS;p.version="1.10.0",p.build="d08dce4",p.pdfBug=!1,void 0!==p.verbosity&&(0,o.setVerbosityLevel)(p.verbosity),delete p.verbosity,Object.defineProperty(p,"verbosity",{get:function(){return(0,o.getVerbosityLevel)()},set:function(e){(0,o.setVerbosityLevel)(e)},enumerable:!0,configurable:!0}),p.VERBOSITY_LEVELS=o.VERBOSITY_LEVELS,p.OPS=o.OPS,p.UNSUPPORTED_FEATURES=o.UNSUPPORTED_FEATURES,p.isValidUrl=a.isValidUrl,p.shadow=o.shadow,p.createBlob=o.createBlob,p.createObjectURL=function(e,t){return(0,o.createObjectURL)(e,t,p.disableCreateObjectURL)},Object.defineProperty(p,"isLittleEndian",{configurable:!0,get:function(){return(0,o.shadow)(p,"isLittleEndian",(0,o.isLittleEndian)())}}),p.removeNullCharacters=o.removeNullCharacters,p.PasswordResponses=o.PasswordResponses,p.PasswordException=o.PasswordException,p.UnknownErrorException=o.UnknownErrorException,p.InvalidPDFException=o.InvalidPDFException,p.MissingPDFException=o.MissingPDFException,p.UnexpectedResponseException=o.UnexpectedResponseException,p.Util=o.Util,p.PageViewport=o.PageViewport,p.createPromiseCapability=o.createPromiseCapability,p.maxImageSize=void 0===p.maxImageSize?-1:p.maxImageSize,p.cMapUrl=void 0===p.cMapUrl?null:p.cMapUrl,p.cMapPacked=void 0!==p.cMapPacked&&p.cMapPacked,p.disableFontFace=void 0!==p.disableFontFace&&p.disableFontFace,p.imageResourcesPath=void 0===p.imageResourcesPath?"":p.imageResourcesPath,p.disableWorker=void 0!==p.disableWorker&&p.disableWorker,p.workerSrc=void 0===p.workerSrc?null:p.workerSrc,p.workerPort=void 0===p.workerPort?null:p.workerPort,p.disableRange=void 0!==p.disableRange&&p.disableRange,p.disableStream=void 0!==p.disableStream&&p.disableStream,p.disableAutoFetch=void 0!==p.disableAutoFetch&&p.disableAutoFetch,p.pdfBug=void 0!==p.pdfBug&&p.pdfBug,p.postMessageTransfers=void 0===p.postMessageTransfers||p.postMessageTransfers,p.disableCreateObjectURL=void 0!==p.disableCreateObjectURL&&p.disableCreateObjectURL,p.disableWebGL=void 0===p.disableWebGL||p.disableWebGL,p.externalLinkTarget=void 0===p.externalLinkTarget?a.LinkTarget.NONE:p.externalLinkTarget,p.externalLinkRel=void 0===p.externalLinkRel?a.DEFAULT_LINK_REL:p.externalLinkRel,p.isEvalSupported=void 0===p.isEvalSupported||p.isEvalSupported,p.pdfjsNext=void 0!==p.pdfjsNext&&p.pdfjsNext;var f=p.openExternalLinksInNewWindow;delete p.openExternalLinksInNewWindow,Object.defineProperty(p,"openExternalLinksInNewWindow",{get:function(){return p.externalLinkTarget===a.LinkTarget.BLANK},set:function(e){e&&(0,o.deprecated)('PDFJS.openExternalLinksInNewWindow, please use "PDFJS.externalLinkTarget = PDFJS.LinkTarget.BLANK" instead.'),p.externalLinkTarget===a.LinkTarget.NONE?p.externalLinkTarget=e?a.LinkTarget.BLANK:a.LinkTarget.NONE:(0,o.warn)("PDFJS.externalLinkTarget is already initialized")},enumerable:!0,configurable:!0}),f&&(p.openExternalLinksInNewWindow=f),p.getDocument=i.getDocument,p.LoopbackPort=i.LoopbackPort,p.PDFDataRangeTransport=i.PDFDataRangeTransport,p.PDFWorker=i.PDFWorker,p.hasCanvasTypedArrays=!0,p.CustomStyle=a.CustomStyle,p.LinkTarget=a.LinkTarget,p.addLinkAttributes=a.addLinkAttributes,p.getFilenameFromUrl=a.getFilenameFromUrl,p.isExternalLinkTargetSet=a.isExternalLinkTargetSet,p.AnnotationLayer=s.AnnotationLayer,p.renderTextLayer=d.renderTextLayer,p.Metadata=u.Metadata,p.SVGGraphics=h.SVGGraphics,p.UnsupportedManager=i._UnsupportedManager,t.globalScope=c.default,t.PDFJS=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FontLoader=t.FontFaceObject=void 0;var r=n(1);function i(e){this.docId=e,this.styleElement=null,this.nativeFontFaces=[],this.loadTestFontId=0,this.loadingContext={requests:[],nextRequestId:0}}i.prototype={insertRule:function(e){var t=this.styleElement;t||((t=this.styleElement=document.createElement("style")).id="PDFJS_FONT_STYLE_TAG_"+this.docId,document.documentElement.getElementsByTagName("head")[0].appendChild(t));var n=t.sheet;n.insertRule(e,n.cssRules.length)},clear:function(){this.styleElement&&(this.styleElement.remove(),this.styleElement=null),this.nativeFontFaces.forEach(function(e){document.fonts.delete(e)}),this.nativeFontFaces.length=0}};Object.defineProperty(i.prototype,"loadTestFont",{get:function(){return(0,r.shadow)(this,"loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))},configurable:!0}),i.prototype.addNativeFontFace=function(e){this.nativeFontFaces.push(e),document.fonts.add(e)},i.prototype.bind=function(e,t){for(var n=[],a=[],o=[],s=function(e){return e.loaded.catch(function(t){(0,r.warn)('Failed to load font "'+e.family+'": '+t)})},l=i.isFontLoadingAPISupported&&!i.isSyncFontLoadingSupported,c=0,u=e.length;c<u;c++){var d=e[c];if(!d.attached&&!1!==d.loading)if(d.attached=!0,l){var h=d.createNativeFontFace();h&&(this.addNativeFontFace(h),o.push(s(h)))}else{var p=d.createFontFaceRule();p&&(this.insertRule(p),n.push(p),a.push(d))}}var f=this.queueLoadingCallback(t);l?Promise.all(o).then(function(){f.complete()}):n.length>0&&!i.isSyncFontLoadingSupported?this.prepareFontLoadEvent(n,a,f):f.complete()},i.prototype.queueLoadingCallback=function(e){var t=this.loadingContext,n={id:"pdfjs-font-loading-"+t.nextRequestId++,complete:function(){for((0,r.assert)(!n.end,"completeRequest() cannot be called twice"),n.end=Date.now();t.requests.length>0&&t.requests[0].end;){var e=t.requests.shift();setTimeout(e.callback,0)}},callback:e,started:Date.now()};return t.requests.push(n),n},i.prototype.prepareFontLoadEvent=function(e,t,n){function i(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function a(e,t,n,r){return e.substr(0,t)+r+e.substr(t+n)}var o,s,l=document.createElement("canvas");l.width=1,l.height=1;var c=l.getContext("2d"),u=0;var d="lt"+Date.now()+this.loadTestFontId++,h=this.loadTestFont,p=i(h=a(h,976,d.length,d),16);for(o=0,s=d.length-3;o<s;o+=4)p=p-1482184792+i(d,o)|0;o<d.length&&(p=p-1482184792+i(d+"XXX",o)|0),h=a(h,16,4,(0,r.string32)(p));var f='@font-face { font-family:"'+d+'";src:'+("url(data:font/opentype;base64,"+btoa(h)+");")+"}";this.insertRule(f);var m=[];for(o=0,s=t.length;o<s;o++)m.push(t[o].loadedName);m.push(d);var g=document.createElement("div");for(g.setAttribute("style","visibility: hidden;width: 10px; height: 10px;position: absolute; top: 0px; left: 0px;"),o=0,s=m.length;o<s;++o){var v=document.createElement("span");v.textContent="Hi",v.style.fontFamily=m[o],g.appendChild(v)}document.body.appendChild(g),function e(t,n){if(++u>30)return(0,r.warn)("Load test font never loaded."),void n();c.font="30px "+t,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0?n():setTimeout(e.bind(null,t,n))}(d,function(){document.body.removeChild(g),n.complete()})},i.isFontLoadingAPISupported="undefined"!=typeof document&&!!document.fonts;Object.defineProperty(i,"isSyncFontLoadingSupported",{get:function(){return(0,r.shadow)(i,"isSyncFontLoadingSupported",function(){if("undefined"==typeof navigator)return!0;var e=!1,t=/Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);return t&&t[1]>=14&&(e=!0),e}())},enumerable:!0,configurable:!0});var a={get value(){return(0,r.shadow)(this,"value",(0,r.isEvalSupported)())}},o=function(){function e(e,t){for(var n in this.compiledGlyphs=Object.create(null),e)this[n]=e[n];this.options=t}return e.prototype={createNativeFontFace:function(){if(!this.data)return null;if(this.options.disableFontFace)return this.disableFontFace=!0,null;var e=new FontFace(this.loadedName,this.data,{});return this.options.fontRegistry&&this.options.fontRegistry.registerFont(this),e},createFontFaceRule:function(){if(!this.data)return null;if(this.options.disableFontFace)return this.disableFontFace=!0,null;var e=(0,r.bytesToString)(new Uint8Array(this.data)),t=this.loadedName,n="url(data:"+this.mimetype+";base64,"+btoa(e)+");",i='@font-face { font-family:"'+t+'";src:'+n+"}";return this.options.fontRegistry&&this.options.fontRegistry.registerFont(this,n),i},getPathGenerator:function(e,t){if(!(t in this.compiledGlyphs)){var n,r,i,o=e.get(this.loadedName+"_path_"+t);if(this.options.isEvalSupported&&a.value){var s,l="";for(r=0,i=o.length;r<i;r++)s=void 0!==(n=o[r]).args?n.args.join(","):"",l+="c."+n.cmd+"("+s+");\n";this.compiledGlyphs[t]=new Function("c","size",l)}else this.compiledGlyphs[t]=function(e,t){for(r=0,i=o.length;r<i;r++)"scale"===(n=o[r]).cmd&&(n.args=[t,-t]),e[n.cmd].apply(e,n.args)}}return this.compiledGlyphs[t]}},e}();t.FontFaceObject=o,t.FontLoader=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CanvasGraphics=void 0;var r=n(1),i=n(145),a=n(85),o=16,s={get value(){return(0,r.shadow)(s,"value",(0,r.isLittleEndian)())}};function l(e){e.mozCurrentTransform||(e._originalSave=e.save,e._originalRestore=e.restore,e._originalRotate=e.rotate,e._originalScale=e.scale,e._originalTranslate=e.translate,e._originalTransform=e.transform,e._originalSetTransform=e.setTransform,e._transformMatrix=e._transformMatrix||[1,0,0,1,0,0],e._transformStack=[],Object.defineProperty(e,"mozCurrentTransform",{get:function(){return this._transformMatrix}}),Object.defineProperty(e,"mozCurrentTransformInverse",{get:function(){var e=this._transformMatrix,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=t*i-n*r,l=n*r-t*i;return[i/s,n/l,r/l,t/s,(i*a-r*o)/l,(n*a-t*o)/s]}}),e.save=function(){var e=this._transformMatrix;this._transformStack.push(e),this._transformMatrix=e.slice(0,6),this._originalSave()},e.restore=function(){var e=this._transformStack.pop();e&&(this._transformMatrix=e,this._originalRestore())},e.translate=function(e,t){var n=this._transformMatrix;n[4]=n[0]*e+n[2]*t+n[4],n[5]=n[1]*e+n[3]*t+n[5],this._originalTranslate(e,t)},e.scale=function(e,t){var n=this._transformMatrix;n[0]=n[0]*e,n[1]=n[1]*e,n[2]=n[2]*t,n[3]=n[3]*t,this._originalScale(e,t)},e.transform=function(t,n,r,i,a,o){var s=this._transformMatrix;this._transformMatrix=[s[0]*t+s[2]*n,s[1]*t+s[3]*n,s[0]*r+s[2]*i,s[1]*r+s[3]*i,s[0]*a+s[2]*o+s[4],s[1]*a+s[3]*o+s[5]],e._originalTransform(t,n,r,i,a,o)},e.setTransform=function(t,n,r,i,a,o){this._transformMatrix=[t,n,r,i,a,o],e._originalSetTransform(t,n,r,i,a,o)},e.rotate=function(e){var t=Math.cos(e),n=Math.sin(e),r=this._transformMatrix;this._transformMatrix=[r[0]*t+r[2]*n,r[1]*t+r[3]*n,r[0]*-n+r[2]*t,r[1]*-n+r[3]*t,r[4],r[5]],this._originalRotate(e)})}var c=function(){function e(e){this.canvasFactory=e,this.cache=Object.create(null)}return e.prototype={getCanvas:function(e,t,n,r){var i;return void 0!==this.cache[e]?(i=this.cache[e],this.canvasFactory.reset(i,t,n),i.context.setTransform(1,0,0,1,0,0)):(i=this.canvasFactory.create(t,n),this.cache[e]=i),r&&l(i.context),i},clear:function(){for(var e in this.cache){var t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}},e}();var u=function(){function e(){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=r.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=r.FONT_IDENTITY_MATRIX,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=r.TextRenderingMode.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.resumeSMaskCtx=null}return e.prototype={clone:function(){return Object.create(this)},setCurrentPoint:function(e,t){this.x=e,this.y=t}},e}(),d=function(){function e(e,t,n,r,i){this.ctx=e,this.current=new u,this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=n,this.canvasFactory=r,this.imageLayer=i,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.cachedCanvases=new c(this.canvasFactory),e&&l(e),this.cachedGetSinglePixelWidth=null}function t(e,t){if("undefined"!=typeof ImageData&&t instanceof ImageData)e.putImageData(t,0,0);else{var n,i,a,l,c,u=t.height,d=t.width,h=u%o,p=(u-h)/o,f=0===h?p:p+1,m=e.createImageData(d,o),g=0,v=t.data,y=m.data;if(t.kind===r.ImageKind.GRAYSCALE_1BPP){var b=v.byteLength,w=new Uint32Array(y.buffer,0,y.byteLength>>2),S=w.length,_=d+7>>3,P=4294967295,A=s.value?4278190080:255;for(i=0;i<f;i++){for(l=i<p?o:h,n=0,a=0;a<l;a++){for(var k=b-g,C=0,x=k>_?d:8*k-7,T=-8&x,D=0,E=0;C<T;C+=8)E=v[g++],w[n++]=128&E?P:A,w[n++]=64&E?P:A,w[n++]=32&E?P:A,w[n++]=16&E?P:A,w[n++]=8&E?P:A,w[n++]=4&E?P:A,w[n++]=2&E?P:A,w[n++]=1&E?P:A;for(;C<x;C++)0===D&&(E=v[g++],D=128),w[n++]=E&D?P:A,D>>=1}for(;n<S;)w[n++]=0;e.putImageData(m,0,i*o)}}else if(t.kind===r.ImageKind.RGBA_32BPP){for(a=0,c=d*o*4,i=0;i<p;i++)y.set(v.subarray(g,g+c)),g+=c,e.putImageData(m,0,a),a+=o;i<f&&(c=d*h*4,y.set(v.subarray(g,g+c)),e.putImageData(m,0,a))}else{if(t.kind!==r.ImageKind.RGB_24BPP)throw new Error("bad image kind: "+t.kind);for(c=d*(l=o),i=0;i<f;i++){for(i>=p&&(c=d*(l=h)),n=0,a=c;a--;)y[n++]=v[g++],y[n++]=v[g++],y[n++]=v[g++],y[n++]=255;e.putImageData(m,0,i*o)}}}}function n(e,t){for(var n=t.height,r=t.width,i=n%o,a=(n-i)/o,s=0===i?a:a+1,l=e.createImageData(r,o),c=0,u=t.data,d=l.data,h=0;h<s;h++){for(var p=h<a?o:i,f=3,m=0;m<p;m++)for(var g=0,v=0;v<r;v++){if(!g){var y=u[c++];g=128}d[f]=y&g?0:255,f+=4,g>>=1}e.putImageData(l,0,h*o)}}function d(e,t){for(var n=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"],r=0,i=n.length;r<i;r++){var a=n[r];void 0!==e[a]&&(t[a]=e[a])}void 0!==e.setLineDash&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function h(e){e.strokeStyle="#000000",e.fillStyle="#000000",e.fillRule="nonzero",e.globalAlpha=1,e.lineWidth=1,e.lineCap="butt",e.lineJoin="miter",e.miterLimit=10,e.globalCompositeOperation="source-over",e.font="10px sans-serif",void 0!==e.setLineDash&&(e.setLineDash([]),e.lineDashOffset=0)}function p(e,t,n,r){for(var i=e.length,a=3;a<i;a+=4){var o=e[a];if(0===o)e[a-3]=t,e[a-2]=n,e[a-1]=r;else if(o<255){var s=255-o;e[a-3]=e[a-3]*o+t*s>>8,e[a-2]=e[a-2]*o+n*s>>8,e[a-1]=e[a-1]*o+r*s>>8}}}function f(e,t,n){for(var r=e.length,i=3;i<r;i+=4){var a=n?n[e[i]]:e[i];t[i]=t[i]*a*(1/255)|0}}function m(e,t,n){for(var r=e.length,i=3;i<r;i+=4){var a=77*e[i-3]+152*e[i-2]+28*e[i-1];t[i]=n?t[i]*n[a>>8]>>8:t[i]*a>>16}}function g(e,t,n){var r=t.canvas,i=t.context;e.setTransform(t.scaleX,0,0,t.scaleY,t.offsetX,t.offsetY);var o=t.backdrop||null;if(!t.transferMap&&a.WebGLUtils.isEnabled){var s=a.WebGLUtils.composeSMask(n.canvas,r,{subtype:t.subtype,backdrop:o});return e.setTransform(1,0,0,1,0,0),void e.drawImage(s,t.offsetX,t.offsetY)}!function(e,t,n,r,i,a,o){var s,l=!!a,c=l?a[0]:0,u=l?a[1]:0,d=l?a[2]:0;s="Luminosity"===i?m:f;for(var h=Math.min(r,Math.ceil(1048576/n)),g=0;g<r;g+=h){var v=Math.min(h,r-g),y=e.getImageData(0,g,n,v),b=t.getImageData(0,g,n,v);l&&p(y.data,c,u,d),s(y.data,b.data,o),e.putImageData(b,0,g)}}(i,n,r.width,r.height,t.subtype,o,t.transferMap),e.drawImage(r,0,0)}var v=["butt","round","square"],y=["miter","round","bevel"],b={},w={};for(var S in e.prototype={beginDrawing:function(e){var t=e.transform,n=e.viewport,r=e.transparency,i=e.background,a=void 0===i?null:i,o=this.ctx.canvas.width,s=this.ctx.canvas.height;if(this.ctx.save(),this.ctx.fillStyle=a||"rgb(255, 255, 255)",this.ctx.fillRect(0,0,o,s),this.ctx.restore(),r){var l=this.cachedCanvases.getCanvas("transparent",o,s,!0);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform.apply(this.ctx,this.compositeCtx.mozCurrentTransform)}this.ctx.save(),h(this.ctx),t&&this.ctx.transform.apply(this.ctx,t),this.ctx.transform.apply(this.ctx,n.transform),this.baseTransform=this.ctx.mozCurrentTransform.slice(),this.imageLayer&&this.imageLayer.beginLayout()},executeOperatorList:function(e,t,n,i){var a=e.argsArray,o=e.fnArray,s=t||0,l=a.length;if(l===s)return s;for(var c,u=l-s>10&&"function"==typeof n,d=u?Date.now()+15:0,h=0,p=this.commonObjs,f=this.objs;;){if(void 0!==i&&s===i.nextBreakPoint)return i.breakIt(s,n),s;if((c=o[s])!==r.OPS.dependency)this[c].apply(this,a[s]);else for(var m=a[s],g=0,v=m.length;g<v;g++){var y=m[g],b="g"===y[0]&&"_"===y[1]?p:f;if(!b.isResolved(y))return b.get(y,n),s}if(++s===l)return s;if(u&&++h>10){if(Date.now()>d)return n(),s;h=0}}},endDrawing:function(){null!==this.current.activeSMask&&this.endSMaskGroup(),this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null),this.cachedCanvases.clear(),a.WebGLUtils.clear(),this.imageLayer&&this.imageLayer.endLayout()},setLineWidth:function(e){this.current.lineWidth=e,this.ctx.lineWidth=e},setLineCap:function(e){this.ctx.lineCap=v[e]},setLineJoin:function(e){this.ctx.lineJoin=y[e]},setMiterLimit:function(e){this.ctx.miterLimit=e},setDash:function(e,t){var n=this.ctx;void 0!==n.setLineDash&&(n.setLineDash(e),n.lineDashOffset=t)},setRenderingIntent:function(e){},setFlatness:function(e){},setGState:function(e){for(var t=0,n=e.length;t<n;t++){var r=e[t],i=r[0],a=r[1];switch(i){case"LW":this.setLineWidth(a);break;case"LC":this.setLineCap(a);break;case"LJ":this.setLineJoin(a);break;case"ML":this.setMiterLimit(a);break;case"D":this.setDash(a[0],a[1]);break;case"RI":this.setRenderingIntent(a);break;case"FL":this.setFlatness(a);break;case"Font":this.setFont(a[0],a[1]);break;case"CA":this.current.strokeAlpha=r[1];break;case"ca":this.current.fillAlpha=r[1],this.ctx.globalAlpha=r[1];break;case"BM":this.ctx.globalCompositeOperation=a,this.ctx.globalCompositeOperation!==a&&(this.ctx.globalAlpha=.75);break;case"SMask":this.current.activeSMask&&(this.stateStack.length>0&&this.stateStack[this.stateStack.length-1].activeSMask===this.current.activeSMask?this.suspendSMaskGroup():this.endSMaskGroup()),this.current.activeSMask=a?this.tempSMask:null,this.current.activeSMask&&this.beginSMaskGroup(),this.tempSMask=null}}},beginSMaskGroup:function(){var e=this.current.activeSMask,t=e.canvas.width,n=e.canvas.height,r="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(r,t,n,!0),a=this.ctx,o=a.mozCurrentTransform;this.ctx.save();var s=i.context;s.scale(1/e.scaleX,1/e.scaleY),s.translate(-e.offsetX,-e.offsetY),s.transform.apply(s,o),e.startTransformInverse=s.mozCurrentTransformInverse,d(a,s),this.ctx=s,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(a),this.groupLevel++},suspendSMaskGroup:function(){var e=this.ctx;this.groupLevel--,this.ctx=this.groupStack.pop(),g(this.ctx,this.current.activeSMask,e),this.ctx.restore(),this.ctx.save(),d(e,this.ctx),this.current.resumeSMaskCtx=e;var t=r.Util.transform(this.current.activeSMask.startTransformInverse,e.mozCurrentTransform);this.ctx.transform.apply(this.ctx,t),e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,e.canvas.width,e.canvas.height),e.restore()},resumeSMaskGroup:function(){var e=this.current.resumeSMaskCtx,t=this.ctx;this.ctx=e,this.groupStack.push(t),this.groupLevel++},endSMaskGroup:function(){var e=this.ctx;this.groupLevel--,this.ctx=this.groupStack.pop(),g(this.ctx,this.current.activeSMask,e),this.ctx.restore(),d(e,this.ctx);var t=r.Util.transform(this.current.activeSMask.startTransformInverse,e.mozCurrentTransform);this.ctx.transform.apply(this.ctx,t)},save:function(){this.ctx.save();var e=this.current;this.stateStack.push(e),this.current=e.clone(),this.current.resumeSMaskCtx=null},restore:function(){this.current.resumeSMaskCtx&&this.resumeSMaskGroup(),null===this.current.activeSMask||0!==this.stateStack.length&&this.stateStack[this.stateStack.length-1].activeSMask===this.current.activeSMask||this.endSMaskGroup(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.ctx.restore(),this.pendingClip=null,this.cachedGetSinglePixelWidth=null)},transform:function(e,t,n,r,i,a){this.ctx.transform(e,t,n,r,i,a),this.cachedGetSinglePixelWidth=null},constructPath:function(e,t){for(var n=this.ctx,i=this.current,a=i.x,o=i.y,s=0,l=0,c=e.length;s<c;s++)switch(0|e[s]){case r.OPS.rectangle:a=t[l++],o=t[l++];var u=t[l++],d=t[l++];0===u&&(u=this.getSinglePixelWidth()),0===d&&(d=this.getSinglePixelWidth());var h=a+u,p=o+d;this.ctx.moveTo(a,o),this.ctx.lineTo(h,o),this.ctx.lineTo(h,p),this.ctx.lineTo(a,p),this.ctx.lineTo(a,o),this.ctx.closePath();break;case r.OPS.moveTo:a=t[l++],o=t[l++],n.moveTo(a,o);break;case r.OPS.lineTo:a=t[l++],o=t[l++],n.lineTo(a,o);break;case r.OPS.curveTo:a=t[l+4],o=t[l+5],n.bezierCurveTo(t[l],t[l+1],t[l+2],t[l+3],a,o),l+=6;break;case r.OPS.curveTo2:n.bezierCurveTo(a,o,t[l],t[l+1],t[l+2],t[l+3]),a=t[l+2],o=t[l+3],l+=4;break;case r.OPS.curveTo3:a=t[l+2],o=t[l+3],n.bezierCurveTo(t[l],t[l+1],a,o,a,o),l+=4;break;case r.OPS.closePath:n.closePath()}i.setCurrentPoint(a,o)},closePath:function(){this.ctx.closePath()},stroke:function(e){e=void 0===e||e;var t=this.ctx,n=this.current.strokeColor;t.lineWidth=Math.max(.65*this.getSinglePixelWidth(),this.current.lineWidth),t.globalAlpha=this.current.strokeAlpha,n&&n.hasOwnProperty("type")&&"Pattern"===n.type?(t.save(),t.strokeStyle=n.getPattern(t,this),t.stroke(),t.restore()):t.stroke(),e&&this.consumePath(),t.globalAlpha=this.current.fillAlpha},closeStroke:function(){this.closePath(),this.stroke()},fill:function(e){e=void 0===e||e;var t=this.ctx,n=this.current.fillColor,r=!1;this.current.patternFill&&(t.save(),this.baseTransform&&t.setTransform.apply(t,this.baseTransform),t.fillStyle=n.getPattern(t,this),r=!0),this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill(),r&&t.restore(),e&&this.consumePath()},eoFill:function(){this.pendingEOFill=!0,this.fill()},fillStroke:function(){this.fill(!1),this.stroke(!1),this.consumePath()},eoFillStroke:function(){this.pendingEOFill=!0,this.fillStroke()},closeFillStroke:function(){this.closePath(),this.fillStroke()},closeEOFillStroke:function(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()},endPath:function(){this.consumePath()},clip:function(){this.pendingClip=b},eoClip:function(){this.pendingClip=w},beginText:function(){this.current.textMatrix=r.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0},endText:function(){var e=this.pendingTextPaths,t=this.ctx;if(void 0!==e){t.save(),t.beginPath();for(var n=0;n<e.length;n++){var r=e[n];t.setTransform.apply(t,r.transform),t.translate(r.x,r.y),r.addToPath(t,r.fontSize)}t.restore(),t.clip(),t.beginPath(),delete this.pendingTextPaths}else t.beginPath()},setCharSpacing:function(e){this.current.charSpacing=e},setWordSpacing:function(e){this.current.wordSpacing=e},setHScale:function(e){this.current.textHScale=e/100},setLeading:function(e){this.current.leading=-e},setFont:function(e,t){var n=this.commonObjs.get(e),i=this.current;if(!n)throw new Error("Can't find font for "+e);if(i.fontMatrix=n.fontMatrix?n.fontMatrix:r.FONT_IDENTITY_MATRIX,0!==i.fontMatrix[0]&&0!==i.fontMatrix[3]||(0,r.warn)("Invalid font matrix for font "+e),t<0?(t=-t,i.fontDirection=-1):i.fontDirection=1,this.current.font=n,this.current.fontSize=t,!n.isType3Font){var a=n.loadedName||"sans-serif",o=n.black?"900":n.bold?"bold":"normal",s=n.italic?"italic":"normal",l='"'+a+'", '+n.fallbackName,c=t<16?16:t>100?100:t;this.current.fontSizeScale=t/c;var u=s+" "+o+" "+c+"px "+l;this.ctx.font=u}},setTextRenderingMode:function(e){this.current.textRenderingMode=e},setTextRise:function(e){this.current.textRise=e},moveText:function(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t},setLeadingMoveText:function(e,t){this.setLeading(-t),this.moveText(e,t)},setTextMatrix:function(e,t,n,r,i,a){this.current.textMatrix=[e,t,n,r,i,a],this.current.textMatrixScale=Math.sqrt(e*e+t*t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0},nextLine:function(){this.moveText(0,this.current.leading)},paintChar:function(e,t,n){var i,a=this.ctx,o=this.current,s=o.font,l=o.textRenderingMode,c=o.fontSize/o.fontSizeScale,u=l&r.TextRenderingMode.FILL_STROKE_MASK,d=!!(l&r.TextRenderingMode.ADD_TO_PATH_FLAG);((s.disableFontFace||d)&&(i=s.getPathGenerator(this.commonObjs,e)),s.disableFontFace?(a.save(),a.translate(t,n),a.beginPath(),i(a,c),u!==r.TextRenderingMode.FILL&&u!==r.TextRenderingMode.FILL_STROKE||a.fill(),u!==r.TextRenderingMode.STROKE&&u!==r.TextRenderingMode.FILL_STROKE||a.stroke(),a.restore()):(u!==r.TextRenderingMode.FILL&&u!==r.TextRenderingMode.FILL_STROKE||a.fillText(e,t,n),u!==r.TextRenderingMode.STROKE&&u!==r.TextRenderingMode.FILL_STROKE||a.strokeText(e,t,n)),d)&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:a.mozCurrentTransform,x:t,y:n,fontSize:c,addToPath:i})},get isFontSubpixelAAEnabled(){var e=this.canvasFactory.create(10,10).context;e.scale(1.5,1),e.fillText("I",0,10);for(var t=e.getImageData(0,0,10,10).data,n=!1,i=3;i<t.length;i+=4)if(t[i]>0&&t[i]<255){n=!0;break}return(0,r.shadow)(this,"isFontSubpixelAAEnabled",n)},showText:function(e){var t=this.current,n=t.font;if(n.isType3Font)return this.showType3Text(e);var i=t.fontSize;if(0!==i){var a=this.ctx,o=t.fontSizeScale,s=t.charSpacing,l=t.wordSpacing,c=t.fontDirection,u=t.textHScale*c,d=e.length,h=n.vertical,p=h?1:-1,f=n.defaultVMetrics,m=i*t.fontMatrix[0],g=t.textRenderingMode===r.TextRenderingMode.FILL&&!n.disableFontFace;a.save(),a.transform.apply(a,t.textMatrix),a.translate(t.x,t.y+t.textRise),t.patternFill&&(a.fillStyle=t.fillColor.getPattern(a,this)),c>0?a.scale(u,-1):a.scale(u,1);var v=t.lineWidth,y=t.textMatrixScale;if(0===y||0===v){var b=t.textRenderingMode&r.TextRenderingMode.FILL_STROKE_MASK;b!==r.TextRenderingMode.STROKE&&b!==r.TextRenderingMode.FILL_STROKE||(this.cachedGetSinglePixelWidth=null,v=.65*this.getSinglePixelWidth())}else v/=y;1!==o&&(a.scale(o,o),v/=o),a.lineWidth=v;var w,S=0;for(w=0;w<d;++w){var _=e[w];if((0,r.isNum)(_))S+=p*_*i/1e3;else{var P,A,k,C,x,T,D,E=!1,I=(_.isSpace?l:0)+s,O=_.fontChar,R=_.accent,M=_.width;if(h)x=_.vmetric||f,T=-(T=_.vmetric?x[1]:.5*M)*m,D=x[2]*m,M=x?-x[0]:M,P=T/o,A=(S+D)/o;else P=S/o,A=0;if(n.remeasure&&M>0){var W=1e3*a.measureText(O).width/i*o;if(M<W&&this.isFontSubpixelAAEnabled){var L=M/W;E=!0,a.save(),a.scale(L,1),P/=L}else M!==W&&(P+=(M-W)/2e3*i/o)}(_.isInFont||n.missingFile)&&(g&&!R?a.fillText(O,P,A):(this.paintChar(O,P,A),R&&(k=P+R.offset.x/o,C=A-R.offset.y/o,this.paintChar(R.fontChar,k,C)))),S+=M*m+I*c,E&&a.restore()}}h?t.y-=S*u:t.x+=S*u,a.restore()}},showType3Text:function(e){var t,n,i,a,o=this.ctx,s=this.current,l=s.font,c=s.fontSize,u=s.fontDirection,d=l.vertical?1:-1,h=s.charSpacing,p=s.wordSpacing,f=s.textHScale*u,m=s.fontMatrix||r.FONT_IDENTITY_MATRIX,g=e.length;if(!(s.textRenderingMode===r.TextRenderingMode.INVISIBLE)&&0!==c){for(this.cachedGetSinglePixelWidth=null,o.save(),o.transform.apply(o,s.textMatrix),o.translate(s.x,s.y),o.scale(f,u),t=0;t<g;++t)if(n=e[t],(0,r.isNum)(n))a=d*n*c/1e3,this.ctx.translate(a,0),s.x+=a*f;else{var v=(n.isSpace?p:0)+h,y=l.charProcOperatorList[n.operatorListId];if(y)this.processingType3=n,this.save(),o.scale(c,c),o.transform.apply(o,m),this.executeOperatorList(y),this.restore(),i=r.Util.applyTransform([n.width,0],m)[0]*c+v,o.translate(i,0),s.x+=i*f;else(0,r.warn)('Type3 character "'+n.operatorListId+'" is not available.')}o.restore(),this.processingType3=null}},setCharWidth:function(e,t){},setCharWidthAndBounds:function(e,t,n,r,i,a){this.ctx.rect(n,r,i-n,a-r),this.clip(),this.endPath()},getColorN_Pattern:function(t){var n,r=this;if("TilingPattern"===t[0]){var a=t[1],o=this.baseTransform||this.ctx.mozCurrentTransform.slice(),s={createCanvasGraphics:function(t){return new e(t,r.commonObjs,r.objs,r.canvasFactory)}};n=new i.TilingPattern(t,a,this.ctx,s,o)}else n=(0,i.getShadingPatternFromIR)(t);return n},setStrokeColorN:function(){this.current.strokeColor=this.getColorN_Pattern(arguments)},setFillColorN:function(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0},setStrokeRGBColor:function(e,t,n){var i=r.Util.makeCssRgb(e,t,n);this.ctx.strokeStyle=i,this.current.strokeColor=i},setFillRGBColor:function(e,t,n){var i=r.Util.makeCssRgb(e,t,n);this.ctx.fillStyle=i,this.current.fillColor=i,this.current.patternFill=!1},shadingFill:function(e){var t=this.ctx;this.save();var n=(0,i.getShadingPatternFromIR)(e);t.fillStyle=n.getPattern(t,this,!0);var a=t.mozCurrentTransformInverse;if(a){var o=t.canvas,s=o.width,l=o.height,c=r.Util.applyTransform([0,0],a),u=r.Util.applyTransform([0,l],a),d=r.Util.applyTransform([s,0],a),h=r.Util.applyTransform([s,l],a),p=Math.min(c[0],u[0],d[0],h[0]),f=Math.min(c[1],u[1],d[1],h[1]),m=Math.max(c[0],u[0],d[0],h[0]),g=Math.max(c[1],u[1],d[1],h[1]);this.ctx.fillRect(p,f,m-p,g-f)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.restore()},beginInlineImage:function(){throw new Error("Should not call beginInlineImage")},beginImageData:function(){throw new Error("Should not call beginImageData")},paintFormXObjectBegin:function(e,t){if(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(e)&&6===e.length&&this.transform.apply(this,e),this.baseTransform=this.ctx.mozCurrentTransform,Array.isArray(t)&&4===t.length){var n=t[2]-t[0],r=t[3]-t[1];this.ctx.rect(t[0],t[1],n,r),this.clip(),this.endPath()}},paintFormXObjectEnd:function(){this.restore(),this.baseTransform=this.baseTransformStack.pop()},beginGroup:function(e){this.save();var t=this.ctx;e.isolated||(0,r.info)("TODO: Support non-isolated groups."),e.knockout&&(0,r.warn)("Knockout groups not supported.");var n=t.mozCurrentTransform;if(e.matrix&&t.transform.apply(t,e.matrix),!e.bbox)throw new Error("Bounding box is required.");var i=r.Util.getAxialAlignedBoundingBox(e.bbox,t.mozCurrentTransform),a=[0,0,t.canvas.width,t.canvas.height];i=r.Util.intersect(i,a)||[0,0,0,0];var o=Math.floor(i[0]),s=Math.floor(i[1]),l=Math.max(Math.ceil(i[2])-o,1),c=Math.max(Math.ceil(i[3])-s,1),u=1,h=1;l>4096&&(u=l/4096,l=4096),c>4096&&(h=c/4096,c=4096);var p="groupAt"+this.groupLevel;e.smask&&(p+="_smask_"+this.smaskCounter++%2);var f=this.cachedCanvases.getCanvas(p,l,c,!0),m=f.context;m.scale(1/u,1/h),m.translate(-o,-s),m.transform.apply(m,n),e.smask?this.smaskStack.push({canvas:f.canvas,context:m,offsetX:o,offsetY:s,scaleX:u,scaleY:h,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(o,s),t.scale(u,h)),d(t,m),this.ctx=m,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++,this.current.activeSMask=null},endGroup:function(e){this.groupLevel--;var t=this.ctx;this.ctx=this.groupStack.pop(),void 0!==this.ctx.imageSmoothingEnabled?this.ctx.imageSmoothingEnabled=!1:this.ctx.mozImageSmoothingEnabled=!1,e.smask?this.tempSMask=this.smaskStack.pop():this.ctx.drawImage(t.canvas,0,0),this.restore()},beginAnnotations:function(){for(var e=0;e<5;e++)this.ctx.restore();this.save(),this.baseTransform&&this.ctx.setTransform.apply(this.ctx,this.baseTransform)},endAnnotations:function(){this.restore()},beginAnnotation:function(e,t,n){if(this.save(),h(this.ctx),this.current=new u,Array.isArray(e)&&4===e.length){var r=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],r,i),this.clip(),this.endPath()}this.transform.apply(this,t),this.transform.apply(this,n)},endAnnotation:function(){this.restore()},paintJpegXObject:function(e,t,n){var i=this,a=this.objs.get(e);if(a){this.save();var o=this.ctx;if(o.scale(1/t,-1/n),window.KGPdfViewerWebApp.repairJpegXObjectByIE({width:a.width,height:a.height,callback:function(e){i.ctx.globalAlpha=e}}),o.drawImage(a,0,0,a.width,a.height,0,-n,t,n),this.imageLayer){var s=o.mozCurrentTransformInverse,l=this.getCanvasPosition(0,0);this.imageLayer.appendImage({objId:e,left:l[0],top:l[1],width:t/s[0],height:n/s[3]})}this.restore()}else(0,r.warn)("Dependent image isn't ready yet")},paintImageMaskXObject:function(e){var t=this.ctx,r=e.width,i=e.height,a=this.current.fillColor,o=this.current.patternFill,s=this.processingType3;if(s&&void 0===s.compiled&&(s.compiled=r<=1e3&&i<=1e3?function(e){var t,n,r,i,a=e.width,o=e.height,s=a+1,l=new Uint8Array(s*(o+1)),c=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),u=a+7&-8,d=e.data,h=new Uint8Array(u*o),p=0;for(t=0,i=d.length;t<i;t++)for(var f=128,m=d[t];f>0;)h[p++]=m&f?0:255,f>>=1;var g=0;for(0!==h[p=0]&&(l[0]=1,++g),n=1;n<a;n++)h[p]!==h[p+1]&&(l[n]=h[p]?2:1,++g),p++;for(0!==h[p]&&(l[n]=2,++g),t=1;t<o;t++){r=t*s,h[(p=t*u)-u]!==h[p]&&(l[r]=h[p]?1:8,++g);var v=(h[p]?4:0)+(h[p-u]?8:0);for(n=1;n<a;n++)c[v=(v>>2)+(h[p+1]?4:0)+(h[p-u+1]?8:0)]&&(l[r+n]=c[v],++g),p++;if(h[p-u]!==h[p]&&(l[r+n]=h[p]?2:4,++g),g>1e3)return null}for(r=t*s,0!==h[p=u*(o-1)]&&(l[r]=8,++g),n=1;n<a;n++)h[p]!==h[p+1]&&(l[r+n]=h[p]?4:8,++g),p++;if(0!==h[p]&&(l[r+n]=4,++g),g>1e3)return null;var y=new Int32Array([0,s,-1,0,-s,0,0,0,1]),b=[];for(t=0;g&&t<=o;t++){for(var w=t*s,S=w+a;w<S&&!l[w];)w++;if(w!==S){var _,P=[w%s,t],A=l[w],k=w;do{var C=y[A];do{w+=C}while(!l[w]);5!==(_=l[w])&&10!==_?(A=_,l[w]=0):(A=_&51*A>>4,l[w]&=A>>2|A<<2),P.push(w%s),P.push(w/s|0),--g}while(k!==w);b.push(P),--t}}return function(e){e.save(),e.scale(1/a,-1/o),e.translate(0,-o),e.beginPath();for(var t=0,n=b.length;t<n;t++){var r=b[t];e.moveTo(r[0],r[1]);for(var i=2,s=r.length;i<s;i+=2)e.lineTo(r[i],r[i+1])}e.fill(),e.beginPath(),e.restore()}}({data:e.data,width:r,height:i}):null),s&&s.compiled)s.compiled(t);else{var l=this.cachedCanvases.getCanvas("maskCanvas",r,i),c=l.context;c.save(),n(c,e),c.globalCompositeOperation="source-in",c.fillStyle=o?a.getPattern(c,this):a,c.fillRect(0,0,r,i),c.restore(),this.paintInlineImageXObject(l.canvas)}},paintImageMaskXObjectRepeat:function(e,t,r,i){var a=e.width,o=e.height,s=this.current.fillColor,l=this.current.patternFill,c=this.cachedCanvases.getCanvas("maskCanvas",a,o),u=c.context;u.save(),n(u,e),u.globalCompositeOperation="source-in",u.fillStyle=l?s.getPattern(u,this):s,u.fillRect(0,0,a,o),u.restore();for(var d=this.ctx,h=0,p=i.length;h<p;h+=2)d.save(),d.transform(t,0,0,r,i[h],i[h+1]),d.scale(1,-1),d.drawImage(c.canvas,0,0,a,o,0,-1,1,1),d.restore()},paintImageMaskXObjectGroup:function(e){for(var t=this.ctx,r=this.current.fillColor,i=this.current.patternFill,a=0,o=e.length;a<o;a++){var s=e[a],l=s.width,c=s.height,u=this.cachedCanvases.getCanvas("maskCanvas",l,c),d=u.context;d.save(),n(d,s),d.globalCompositeOperation="source-in",d.fillStyle=i?r.getPattern(d,this):r,d.fillRect(0,0,l,c),d.restore(),t.save(),t.transform.apply(t,s.transform),t.scale(1,-1),t.drawImage(u.canvas,0,0,l,c,0,-1,1,1),t.restore()}},paintImageXObject:function(e){var t=this.objs.get(e);t?this.paintInlineImageXObject(t):(0,r.warn)("Dependent image isn't ready yet")},paintImageXObjectRepeat:function(e,t,n,i){var a=this.objs.get(e);if(a){for(var o=a.width,s=a.height,l=[],c=0,u=i.length;c<u;c+=2)l.push({transform:[t,0,0,n,i[c],i[c+1]],x:0,y:0,w:o,h:s});this.paintInlineImageXObjectGroup(a,l)}else(0,r.warn)("Dependent image isn't ready yet")},paintInlineImageXObject:function(e){var n=e.width,r=e.height,i=this.ctx;this.save(),i.scale(1/n,-1/r);var a,o,s=i.mozCurrentTransformInverse,l=s[0],c=s[1],u=Math.max(Math.sqrt(l*l+c*c),1),d=s[2],h=s[3],p=Math.max(Math.sqrt(d*d+h*h),1);if(e instanceof HTMLElement||!e.data)a=e;else{var f=(o=this.cachedCanvases.getCanvas("inlineImage",n,r)).context;t(f,e),a=o.canvas}for(var m=n,g=r,v="prescale1";u>2&&m>1||p>2&&g>1;){var y=m,b=g;u>2&&m>1&&(u/=m/(y=Math.ceil(m/2))),p>2&&g>1&&(p/=g/(b=Math.ceil(g/2))),(f=(o=this.cachedCanvases.getCanvas(v,y,b)).context).clearRect(0,0,y,b),f.drawImage(a,0,0,m,g,0,0,y,b),a=o.canvas,m=y,g=b,v="prescale1"===v?"prescale2":"prescale1"}if(i.drawImage(a,0,0,m,g,0,-r,n,r),this.imageLayer){var w=this.getCanvasPosition(0,-r);this.imageLayer.appendImage({imgData:e,left:w[0],top:w[1],width:n/s[0],height:r/s[3]})}this.restore()},paintInlineImageXObjectGroup:function(e,n){var r=this.ctx,i=e.width,a=e.height,o=this.cachedCanvases.getCanvas("inlineImage",i,a);t(o.context,e);for(var s=0,l=n.length;s<l;s++){var c=n[s];if(r.save(),r.transform.apply(r,c.transform),r.scale(1,-1),r.drawImage(o.canvas,c.x,c.y,c.w,c.h,0,-1,1,1),this.imageLayer){var u=this.getCanvasPosition(c.x,c.y);this.imageLayer.appendImage({imgData:e,left:u[0],top:u[1],width:i,height:a})}r.restore()}},paintSolidColorImageMask:function(){this.ctx.fillRect(0,0,1,1)},paintXObject:function(){(0,r.warn)("Unsupported 'paintXObject' command.")},markPoint:function(e){},markPointProps:function(e,t){},beginMarkedContent:function(e){},beginMarkedContentProps:function(e,t){},endMarkedContent:function(){},beginCompat:function(){},endCompat:function(){},consumePath:function(){var e=this.ctx;this.pendingClip&&(this.pendingClip===w?e.clip("evenodd"):e.clip(),this.pendingClip=null),e.beginPath()},getSinglePixelWidth:function(e){if(null===this.cachedGetSinglePixelWidth){this.ctx.save();var t=this.ctx.mozCurrentTransformInverse;this.ctx.restore(),this.cachedGetSinglePixelWidth=Math.sqrt(Math.max(t[0]*t[0]+t[1]*t[1],t[2]*t[2]+t[3]*t[3]))}return this.cachedGetSinglePixelWidth},getCanvasPosition:function(e,t){var n=this.ctx.mozCurrentTransform;return[n[0]*e+n[2]*t+n[4],n[1]*e+n[3]*t+n[5]]}},r.OPS)e.prototype[r.OPS[S]]=e.prototype[S];return e}();t.CanvasGraphics=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TilingPattern=t.getShadingPatternFromIR=void 0;var r=n(1),i=n(85),a={RadialAxial:{fromIR:function(e){var t=e[1],n=e[2],r=e[3],i=e[4],a=e[5],o=e[6];return{type:"Pattern",getPattern:function(e){var s;"axial"===t?s=e.createLinearGradient(r[0],r[1],i[0],i[1]):"radial"===t&&(s=e.createRadialGradient(r[0],r[1],a,i[0],i[1],o));for(var l=0,c=n.length;l<c;++l){var u=n[l];s.addColorStop(u[0],u[1])}return s}}}}},o=function(){function e(e,t,n,r,i,a,o,s){var l,c=t.coords,u=t.colors,d=e.data,h=4*e.width;c[n+1]>c[r+1]&&(l=n,n=r,r=l,l=a,a=o,o=l),c[r+1]>c[i+1]&&(l=r,r=i,i=l,l=o,o=s,s=l),c[n+1]>c[r+1]&&(l=n,n=r,r=l,l=a,a=o,o=l);var p=(c[n]+t.offsetX)*t.scaleX,f=(c[n+1]+t.offsetY)*t.scaleY,m=(c[r]+t.offsetX)*t.scaleX,g=(c[r+1]+t.offsetY)*t.scaleY,v=(c[i]+t.offsetX)*t.scaleX,y=(c[i+1]+t.offsetY)*t.scaleY;if(!(f>=y))for(var b,w,S,_,P,A,k,C,x,T=u[a],D=u[a+1],E=u[a+2],I=u[o],O=u[o+1],R=u[o+2],M=u[s],W=u[s+1],L=u[s+2],N=Math.round(f),F=Math.round(y),G=N;G<=F;G++){G<g?(b=p-(p-m)*(x=G<f?0:f===g?1:(f-G)/(f-g)),w=T-(T-I)*x,S=D-(D-O)*x,_=E-(E-R)*x):(b=m-(m-v)*(x=G>y?1:g===y?0:(g-G)/(g-y)),w=I-(I-M)*x,S=O-(O-W)*x,_=R-(R-L)*x),P=p-(p-v)*(x=G<f?0:G>y?1:(f-G)/(f-y)),A=T-(T-M)*x,k=D-(D-W)*x,C=E-(E-L)*x;for(var V=Math.round(Math.min(b,P)),K=Math.round(Math.max(b,P)),j=h*G+4*V,B=V;B<=K;B++)x=(x=(b-B)/(b-P))<0?0:x>1?1:x,d[j++]=w-(w-A)*x|0,d[j++]=S-(S-k)*x|0,d[j++]=_-(_-C)*x|0,d[j++]=255}}function t(t,n,r){var i,a,o=n.coords,s=n.colors;switch(n.type){case"lattice":var l=n.verticesPerRow,c=Math.floor(o.length/l)-1,u=l-1;for(i=0;i<c;i++)for(var d=i*l,h=0;h<u;h++,d++)e(t,r,o[d],o[d+1],o[d+l],s[d],s[d+1],s[d+l]),e(t,r,o[d+l+1],o[d+1],o[d+l],s[d+l+1],s[d+1],s[d+l]);break;case"triangles":for(i=0,a=o.length;i<a;i+=3)e(t,r,o[i],o[i+1],o[i+2],s[i],s[i+1],s[i+2]);break;default:throw new Error("illegal figure")}}return function(e,n,r,a,o,s,l){var c,u,d,h,p=Math.floor(e[0]),f=Math.floor(e[1]),m=Math.ceil(e[2])-p,g=Math.ceil(e[3])-f,v=Math.min(Math.ceil(Math.abs(m*n[0]*1.1)),3e3),y=Math.min(Math.ceil(Math.abs(g*n[1]*1.1)),3e3),b=m/v,w=g/y,S={coords:r,colors:a,offsetX:-p,offsetY:-f,scaleX:1/b,scaleY:1/w},_=v+4,P=y+4;if(i.WebGLUtils.isEnabled)c=i.WebGLUtils.drawFigures(v,y,s,o,S),(u=l.getCanvas("mesh",_,P,!1)).context.drawImage(c,2,2),c=u.canvas;else{var A=(u=l.getCanvas("mesh",_,P,!1)).context,k=A.createImageData(v,y);if(s){var C=k.data;for(d=0,h=C.length;d<h;d+=4)C[d]=s[0],C[d+1]=s[1],C[d+2]=s[2],C[d+3]=255}for(d=0;d<o.length;d++)t(k,o[d],S);A.putImageData(k,2,2),c=u.canvas}return{canvas:c,offsetX:p-2*b,offsetY:f-2*w,scaleX:b,scaleY:w}}}();a.Mesh={fromIR:function(e){var t=e[2],n=e[3],i=e[4],a=e[5],s=e[6],l=e[8];return{type:"Pattern",getPattern:function(e,c,u){var d;if(u)d=r.Util.singularValueDecompose2dScale(e.mozCurrentTransform);else if(d=r.Util.singularValueDecompose2dScale(c.baseTransform),s){var h=r.Util.singularValueDecompose2dScale(s);d=[d[0]*h[0],d[1]*h[1]]}var p=o(a,d,t,n,i,u?null:l,c.cachedCanvases);return u||(e.setTransform.apply(e,c.baseTransform),s&&e.transform.apply(e,s)),e.translate(p.offsetX,p.offsetY),e.scale(p.scaleX,p.scaleY),e.createPattern(p.canvas,"no-repeat")}}}},a.Dummy={fromIR:function(){return{type:"Pattern",getPattern:function(){return"hotpink"}}}};var s=function(){var e=1,t=2;function n(e,t,n,r,i){this.operatorList=e[2],this.matrix=e[3]||[1,0,0,1,0,0],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.canvasGraphicsFactory=r,this.baseTransform=i,this.type="Pattern",this.ctx=n}return n.prototype={createPatternCanvas:function(e){var t=this.operatorList,n=this.bbox,i=this.xstep,a=this.ystep,o=this.paintType,s=this.tilingType,l=this.color,c=this.canvasGraphicsFactory;(0,r.info)("TilingType: "+s);var u=n[0],d=n[1],h=n[2],p=n[3],f=[u,d],m=[u+i,d+a],g=m[0]-f[0],v=m[1]-f[1],y=r.Util.singularValueDecompose2dScale(this.matrix),b=r.Util.singularValueDecompose2dScale(this.baseTransform),w=[y[0]*b[0],y[1]*b[1]];g=Math.min(Math.ceil(Math.abs(g*w[0])),3e3),v=Math.min(Math.ceil(Math.abs(v*w[1])),3e3);var S=e.cachedCanvases.getCanvas("pattern",g,v,!0),_=S.context,P=c.createCanvasGraphics(_);P.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(P,o,l),this.setScale(g,v,i,a),this.transformToScale(P);var A=[1,0,0,1,-f[0],-f[1]];return P.transform.apply(P,A),this.clipBbox(P,n,u,d,h,p),P.executeOperatorList(t),S.canvas},setScale:function(e,t,n,r){this.scale=[e/n,t/r]},transformToScale:function(e){var t=this.scale,n=[t[0],0,0,t[1],0,0];e.transform.apply(e,n)},scaleToContext:function(){var e=this.scale;this.ctx.scale(1/e[0],1/e[1])},clipBbox:function(e,t,n,r,i,a){if(Array.isArray(t)&&4===t.length){var o=i-n,s=a-r;e.ctx.rect(n,r,o,s),e.clip(),e.endPath()}},setFillAndStrokeStyleToContext:function(n,i,a){var o=n.ctx,s=n.current;switch(i){case e:var l=this.ctx;o.fillStyle=l.fillStyle,o.strokeStyle=l.strokeStyle,s.fillColor=l.fillStyle,s.strokeColor=l.strokeStyle;break;case t:var c=r.Util.makeCssRgb(a[0],a[1],a[2]);o.fillStyle=c,o.strokeStyle=c,s.fillColor=c,s.strokeColor=c;break;default:throw new r.FormatError("Unsupported paint type: "+i)}},getPattern:function(e,t){var n=this.createPatternCanvas(t);return(e=this.ctx).setTransform.apply(e,this.baseTransform),e.transform.apply(e,this.matrix),this.scaleToContext(),e.createPattern(n,"repeat")}},n}();t.getShadingPatternFromIR=function(e){var t=a[e[0]];if(!t)throw new Error("Unknown IR type: "+e[0]);return t.fromIR(e)},t.TilingPattern=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=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}}();function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o={NoError:0,EndOfDocument:-1,UnterminatedCdat:-2,UnterminatedXmlDeclaration:-3,UnterminatedDoctypeDeclaration:-4,UnterminatedComment:-5,MalformedElement:-6,OutOfMemory:-7,UnterminatedAttributeValue:-8,UnterminatedElement:-9,ElementNeverBegun:-10};function s(e,t){var n=e[t];return" "===n||"\n"===n||"\r"===n||"\t"===n}var l=function(){function e(){a(this,e)}return i(e,[{key:"_resolveEntities",value:function(e){return e.replace(/&([^;]+);/g,function(e,t){if("#x"===t.substring(0,2))return String.fromCharCode(parseInt(t.substring(2),16));if("#"===t.substring(0,1))return String.fromCharCode(parseInt(t.substring(1),10));switch(t){case"lt":return"<";case"gt":return">";case"amp":return"&";case"quot":return'"'}return this.onResolveEntity(t)})}},{key:"_parseContent",value:function(e,t){var n,r=t,i=[];function a(){for(;r<e.length&&s(e,r);)++r}for(;r<e.length&&!s(e,r)&&">"!==e[r]&&"/"!==e[r];)++r;for(n=e.substring(t,r),a();r<e.length&&">"!==e[r]&&"/"!==e[r]&&"?"!==e[r];){a();for(var o,l="";r<e.length&&!s(e,r)&&"="!==e[r];)l+=e[r],++r;if(a(),"="!==e[r])return null;++r,a();var c=e[r];if('"'!==c&&"'"!==c)return null;var u=e.indexOf(c,++r);if(u<0)return null;o=e.substring(r,u),i.push({name:l,value:this._resolveEntities(o)}),r=u+1,a()}return{name:n,attributes:i,parsed:r-t}}},{key:"_parseProcessingInstruction",value:function(e,t){var n,r=t;for(;r<e.length&&!s(e,r)&&">"!==e[r]&&"/"!==e[r];)++r;n=e.substring(t,r),function(){for(;r<e.length&&s(e,r);)++r}();for(var i=r;r<e.length&&("?"!==e[r]||">"!==e[r+1]);)++r;return{name:n,value:e.substring(i,r),parsed:r-t}}},{key:"parseXml",value:function(e){for(var t=0;t<e.length;){var n=t;if("<"===e[t]){var r=void 0;switch(e[++n]){case"/":if(++n,(r=e.indexOf(">",n))<0)return void this.onError(o.UnterminatedElement);this.onEndElement(e.substring(n,r)),n=r+1;break;case"?":++n;var i=this._parseProcessingInstruction(e,n);if("?>"!==e.substring(n+i.parsed,n+i.parsed+2))return void this.onError(o.UnterminatedXmlDeclaration);this.onPi(i.name,i.value),n+=i.parsed+2;break;case"!":if("--"===e.substring(n+1,n+3)){if((r=e.indexOf("--\x3e",n+3))<0)return void this.onError(o.UnterminatedComment);this.onComment(e.substring(n+3,r)),n=r+3}else if("[CDATA["===e.substring(n+1,n+8)){if((r=e.indexOf("]]>",n+8))<0)return void this.onError(o.UnterminatedCdat);this.onCdata(e.substring(n+8,r)),n=r+3}else{if("DOCTYPE"!==e.substring(n+1,n+8))return void this.onError(o.MalformedElement);var a=e.indexOf("[",n+8),s=!1;if((r=e.indexOf(">",n+8))<0)return void this.onError(o.UnterminatedDoctypeDeclaration);if(a>0&&r>a){if((r=e.indexOf("]>",n+8))<0)return void this.onError(o.UnterminatedDoctypeDeclaration);s=!0}var l=e.substring(n+8,r+(s?1:0));this.onDoctype(l),n=r+(s?2:1)}break;default:var c=this._parseContent(e,n);if(null===c)return void this.onError(o.MalformedElement);var u=!1;if("/>"===e.substring(n+c.parsed,n+c.parsed+2))u=!0;else if(">"!==e.substring(n+c.parsed,n+c.parsed+1))return void this.onError(o.UnterminatedElement);this.onBeginElement(c.name,c.attributes,u),n+=c.parsed+(u?2:1)}}else{for(;n<e.length&&"<"!==e[n];)n++;var d=e.substring(t,n);this.onText(this._resolveEntities(d))}t=n}}},{key:"onResolveEntity",value:function(e){return"&"+e+";"}},{key:"onPi",value:function(e,t){}},{key:"onComment",value:function(e){}},{key:"onCdata",value:function(e){}},{key:"onDoctype",value:function(e){}},{key:"onText",value:function(e){}},{key:"onBeginElement",value:function(e,t,n){}},{key:"onEndElement",value:function(e){}},{key:"onError",value:function(e){}}]),e}(),c=function(){function e(t,n){a(this,e),this.nodeName=t,this.nodeValue=n,Object.defineProperty(this,"parentNode",{value:null,writable:!0})}return i(e,[{key:"hasChildNodes",value:function(){return this.childNodes&&this.childNodes.length>0}},{key:"firstChild",get:function(){return this.childNodes[0]}},{key:"nextSibling",get:function(){var e=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[e+1]}},{key:"textContent",get:function(){return this.childNodes?this.childNodes.map(function(e){return e.textContent}).join(""):this.nodeValue||""}}]),e}(),u=function(e){function t(){a(this,t);var e=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,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._currentFragment=null,e._stack=null,e._errorCode=o.NoError,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l),i(t,[{key:"parseFromString",value:function(e){if(this._currentFragment=[],this._stack=[],this._errorCode=o.NoError,this.parseXml(e),this._errorCode===o.NoError)return{documentElement:r(this._currentFragment,1)[0]}}},{key:"onResolveEntity",value:function(e){switch(e){case"apos":return"'"}return function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,r)}if("value"in i)return i.value;var o=i.get;return void 0!==o?o.call(r):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"onResolveEntity",this).call(this,e)}},{key:"onText",value:function(e){if(!function(e){for(var t=0,n=e.length;t<n;t++)if(!s(e,t))return!1;return!0}(e)){var t=new c("#text",e);this._currentFragment.push(t)}}},{key:"onCdata",value:function(e){var t=new c("#text",e);this._currentFragment.push(t)}},{key:"onBeginElement",value:function(e,t,n){var r=new c(e);r.childNodes=[],this._currentFragment.push(r),n||(this._stack.push(this._currentFragment),this._currentFragment=r.childNodes)}},{key:"onEndElement",value:function(e){this._currentFragment=this._stack.pop();for(var t=this._currentFragment[this._currentFragment.length-1],n=0,r=t.childNodes.length;n<r;n++)t.childNodes[n].parentNode=t}},{key:"onError",value:function(e){this._errorCode=e}}]),t}();t.SimpleXMLParser=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFDataTransportStream=void 0;var r=n(1),i=function(){function e(e,t){var n=this;(0,r.assert)(t),this._queuedChunks=[];var i=e.initialData;if(i&&i.length>0){var a=new Uint8Array(i).buffer;this._queuedChunks.push(a)}this._pdfDataRangeTransport=t,this._isRangeSupported=!e.disableRange,this._isStreamingSupported=!e.disableStream,this._contentLength=e.length,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener(function(e,t){n._onReceiveData({begin:e,chunk:t})}),this._pdfDataRangeTransport.addProgressListener(function(e){n._onProgress({loaded:e})}),this._pdfDataRangeTransport.addProgressiveReadListener(function(e){n._onReceiveData({chunk:e})}),this._pdfDataRangeTransport.transportReady()}function t(e,t){this._stream=e,this._done=!1,this._queuedChunks=t||[],this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}function n(e,t,n){this._stream=e,this._begin=t,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}return e.prototype={_onReceiveData:function(e){var t=new Uint8Array(e.chunk).buffer;if(void 0===e.begin)this._fullRequestReader?this._fullRequestReader._enqueue(t):this._queuedChunks.push(t);else{var n=this._rangeReaders.some(function(n){return n._begin===e.begin&&(n._enqueue(t),!0)});(0,r.assert)(n)}},_onProgress:function(e){if(this._rangeReaders.length>0){var t=this._rangeReaders[0];t.onProgress&&t.onProgress({loaded:e.loaded})}},_removeRangeReader:function(e){var t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)},getFullReader:function(){(0,r.assert)(!this._fullRequestReader);var e=this._queuedChunks;return this._queuedChunks=null,new t(this,e)},getRangeReader:function(e,t){var r=new n(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(r),r},cancelAllRequests:function(e){this._fullRequestReader&&this._fullRequestReader.cancel(e),this._rangeReaders.slice(0).forEach(function(t){t.cancel(e)}),this._pdfDataRangeTransport.abort()}},t.prototype={_enqueue:function(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e))},get headersReady(){return this._headersReady},get isRangeSupported(){return this._stream._isRangeSupported},get isStreamingSupported(){return this._stream._isStreamingSupported},get contentLength(){return this._stream._contentLength},read:function(){if(this._queuedChunks.length>0){var e=this._queuedChunks.shift();return Promise.resolve({value:e,done:!1})}if(this._done)return Promise.resolve({value:void 0,done:!0});var t=(0,r.createPromiseCapability)();return this._requests.push(t),t.promise},cancel:function(e){this._done=!0,this._requests.forEach(function(e){e.resolve({value:void 0,done:!0})}),this._requests=[]}},n.prototype={_enqueue:function(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else this._requests.shift().resolve({value:e,done:!1}),this._requests.forEach(function(e){e.resolve({value:void 0,done:!0})}),this._requests=[];this._done=!0,this._stream._removeRangeReader(this)}},get isStreamingSupported(){return!1},read:function(){if(this._queuedChunk){var e=this._queuedChunk;return this._queuedChunk=null,Promise.resolve({value:e,done:!1})}if(this._done)return Promise.resolve({value:void 0,done:!0});var t=(0,r.createPromiseCapability)();return this._requests.push(t),t.promise},cancel:function(e){this._done=!0,this._requests.forEach(function(e){e.resolve({value:void 0,done:!0})}),this._requests=[],this._stream._removeRangeReader(this)}},e}();t.PDFDataTransportStream=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFStampSeal=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},i=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}}(),a=n(57),o=n(58),s=n(39),l=n(5),c=n(152),u=n(41),d=p(n(15)),h=p(n(32));function p(e){return e&&e.__esModule?e:{default:e}}var f=u.iWebAssistError.getKeyInfo,m=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.KGPdfViewerWebApp=t,this.userCode=this.KGPdfViewerWebApp.userCode,this.imgTag=this.KGPdfViewerWebApp.imgTag,this.keyPwd=null,this.passwordPrompt=t.getPasswordPrompt(),this.getSealsFromServer=this.getSealsFromServer.bind(this),this.SCSJTT_getFirstSealFromServer=this.SCSJTT_getFirstSealFromServer.bind(this),this.getSealsFromKey_OFD=this.getSealsFromKey_OFD.bind(this),this.getSealsFromKey_PDF=this.getSealsFromKey_PDF.bind(this),this.transparentImg=this.transparentImg.bind(this),this.passwordPromptCallback=this.passwordPromptCallback.bind(this)}return i(e,[{key:"createAddSealPromise",value:function(){var e=this,t=(0,u.createCapability)(),n=this.KGPdfViewerWebApp,i=n.externalStampSeal,a=n.externalUnit,o=n.sealOrigin,s=n.certOrigin,c=n.fileType,d=n.stampType,h=n.sealType,p=n.externalSign,f=n.PDFViewerApplication;return t.promise.then(function(t){var n=t.capability,i=t.sealdata,a=t.captcha;if("OFD"===c||2==d&&"GM"==h){var p=function(){e.KGPdfViewerWebApp.getTipPrompt().open("正在进行签章加盖...");for(var t=[],r=void 0,c=function(e){var n=i[e];"signature"==n.sealType?1===o&&1===s?(r||(r=new u.iWebAssist({cilentType:"0"})),t.push(new Promise(function(e,t){r.promise.then(function(){return r.makeGMV4Data(n)}).then(function(r){r.result?(n.version=4,n.sealData=r.res,e(n)):t(r.errmsg)}).catch(function(e){(0,l.closeOverlay)().then(function(){window.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt.open(e)})})}))):t.push(window.KGPdfViewerWebApp.transformSignatureToGmSeal(n)):t.push(n)},d=0;d<i.length;d++)c(d);return{v:Promise.all(t).then(function(e){return Promise.resolve({capability:n,sealdata:e,captcha:a})}).catch(function(e){n.resolve({status:!1}),f.KGAlertPrompt.open(e)})}}();if("object"===(void 0===p?"undefined":r(p)))return p.v}return Promise.resolve({capability:n,sealdata:i,captcha:a})}).then(function(t){if(t)if(null!=i){var n=t.sealdata.map(function(e){var t=f.pdfViewer.getPageView(Number(e.page)-1).viewport.viewBox,n=(t[2],t[3]),r=n-e.top,i=e.left+e.width,o=n-e.top-e.height,s=e.left;switch(a){case"mm":return e.top=(0,l.pxCovertToMM)(r),e.right=(0,l.pxCovertToMM)(i),e.bottom=(0,l.pxCovertToMM)(o),e.left=(0,l.pxCovertToMM)(s),e.width=(0,l.pxCovertToMM)(e.width),e.height=(0,l.pxCovertToMM)(e.height),e;case"cm":return e.top=(0,l.pxCovertToMM)(r)/10,e.right=(0,l.pxCovertToMM)(i)/10,e.bottom=(0,l.pxCovertToMM)(o)/10,e.left=(0,l.pxCovertToMM)(s)/10,e.width=(0,l.pxCovertToMM)(e.width)/10,e.height=(0,l.pxCovertToMM)(e.height)/10,e;default:return e.top=r,e.right=i,e.bottom=o,e.left=s,e}});i(t.capability.resolve,n)}else 1==s&&("OFD"===c||"PDF"===c&&2==d||null!=p)?e.KGPdfViewerWebApp.addOFDSeal(t):(e.sealdata=t.sealdata,e.KGPdfViewerWebApp.addSeal(t,e.sigAndReWriteSigData.bind(e)))}),t}},{key:"SCSJTT_getFirstSealFromServer",value:function(e,t){var n=this,r=window.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt,i=function(){var r={action:"getSeals",keySN:window.KGPdfViewerWebApp.userId,userCode:window.KGPdfViewerWebApp.userCode,imgTag:window.KGPdfViewerWebApp.imgTag,sealType:window.KGPdfViewerWebApp.sealType,appCode:window.KGPdfViewerWebApp.appCode,sealOrigin:window.KGPdfViewerWebApp.sealOrigin,certOrigin:window.KGPdfViewerWebApp.certOrigin,isEncrypt:window.KGPdfViewerWebApp.encryptPWd,isUkey:window.KGPdfViewerWebApp.isUkey,disable:!1,stampSystemOrigin:window.KGPdfViewerWebApp.stampSystemOrigin},i=window.KGPdfViewerWebApp.encryptPWd?window.KGPdfViewerWebApp.aesEncrypt(e||n.keyPwd):e||n.keyPwd;if(window.KGPdfViewerWebApp.useCaptcha||window.KGPdfViewerWebApp.isUkey||window.KGPdfViewerWebApp.fjrs&&window.KGPdfViewerWebApp.fjrs.isServer){var o=window.KGPdfViewerWebApp.encryptPWd?window.KGPdfViewerWebApp.aesEncrypt("123456"):"123456";r.useCaptcha=window.KGPdfViewerWebApp.useCaptcha,r.password=o}else r.password=i;a.myaxios.post(n.KGPdfViewerWebApp.getDocTypeUrl(),r).then(function(e){e.data.hasOwnProperty("sigWithDifferentCert")&&(n.KGPdfViewerWebApp.getSelectSealPrompt().sigWithDifferentCert=e.data.sigWithDifferentCert),(0,l.closeOverlay)().then(function(){if(e.data.seals){var n=e.data.seals[0];n.signSN=d.default.stringify(h.default.parse(n.signSN)),t(n)}else t([])})})};0==window.KGPdfViewerWebApp.sealOrigin&&1==window.KGPdfViewerWebApp.certOrigin&&"GM"==window.KGPdfViewerWebApp.sealType?(0,s.getCert)(this.keyPwd,function(e){return window.KGPdfViewerWebApp.cert=e,Promise.resolve()},i,function(e){(0,l.closeOverlay)().then(function(){r.open(e||"获取证书失败")})}):i()}},{key:"getSealsFromServer",value:function(e){var t=this,n=window.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt,r=window.KGPdfViewerWebApp.passwordPrompt.pwdConfig,i=r.type,o=r.disable,c=function(){var r={action:"getSeals",keySN:window.KGPdfViewerWebApp.userId,userCode:window.KGPdfViewerWebApp.userCode,imgTag:window.KGPdfViewerWebApp.imgTag,sealType:window.KGPdfViewerWebApp.sealType,appCode:window.KGPdfViewerWebApp.appCode,sealOrigin:window.KGPdfViewerWebApp.sealOrigin,certOrigin:window.KGPdfViewerWebApp.certOrigin,isEncrypt:window.KGPdfViewerWebApp.encryptPWd,isUkey:window.KGPdfViewerWebApp.isUkey,disable:o,stampSystemOrigin:window.KGPdfViewerWebApp.stampSystemOrigin};if(!o&&i&&(r.verifyType=i),null!=window.KGPdfViewerWebApp.filterSealNames){if(!Array.isArray(window.KGPdfViewerWebApp.filterSealNames))return n.open("印章名称列表filterSealNames格式不正确");r.filterSealNames=(0,l.unique)(window.KGPdfViewerWebApp.filterSealNames)}window.KGPdfViewerWebApp.isUkey&&(r.esidList=window.KGPdfViewerWebApp.PDFViewerApplication.KG_UkeyStamp.esidList);var s=window.KGPdfViewerWebApp.encryptPWd?window.KGPdfViewerWebApp.aesEncrypt(t.keyPwd):t.keyPwd;if(window.KGPdfViewerWebApp.useCaptcha||window.KGPdfViewerWebApp.isUkey||window.KGPdfViewerWebApp.fjrs&&window.KGPdfViewerWebApp.fjrs.isServer){var c=window.KGPdfViewerWebApp.encryptPWd?window.KGPdfViewerWebApp.aesEncrypt("123456"):"123456";r.useCaptcha=window.KGPdfViewerWebApp.useCaptcha,r.password=c}else r.password=s;a.myaxios.post(t.KGPdfViewerWebApp.getDocTypeUrl(),r).then(function(n){n.data.hasOwnProperty("sigWithDifferentCert")&&(t.KGPdfViewerWebApp.getSelectSealPrompt().sigWithDifferentCert=n.data.sigWithDifferentCert),(0,l.closeOverlay)().then(function(){window.KGPdfViewerWebApp.fjrs&&window.KGPdfViewerWebApp.fjrs.isServer&&n.data.status&&n.data.seals.forEach(function(e){e.bSignByCalibrary="1"}),e(n.data)})})};0==window.KGPdfViewerWebApp.sealOrigin&&1==window.KGPdfViewerWebApp.certOrigin&&"GM"==window.KGPdfViewerWebApp.sealType?(0,s.getCert)(this.keyPwd,function(e){return window.KGPdfViewerWebApp.cert=e,Promise.resolve()},c,function(e){(0,l.closeOverlay)().then(function(){n.open(e||"获取证书失败")})}):c()}},{key:"getSealsFromKey_OFD",value:function(e){var t=this,n=function(e){return a.myaxios.post(t.KGPdfViewerWebApp.getDocTypeUrl(),e)},r=function(n,r,i){return(0,l.closeOverlay)().then(function(){t.KGPdfViewerWebApp.keySN=i,t.KGPdfViewerWebApp.cert=r,e(n)})},i=function(t){var n=t.message,r=t.defaultMsg;return(0,l.closeOverlay)().then(function(){e({status:!1,message:n,defaultMsg:r})})};!0===this.KGPdfViewerWebApp.useNFSSystem?(0,o.getNFSSeals)(this.keyPwd,n,r,i):(0,s.getOfdSeals)(this.keyPwd,n,r,i)}},{key:"getKeySN_PDF",value:function(){var e=new u.iWebAssist({clientType:"0"});return Promise.resolve(e.promise).then(function(){return e.getKeyInfo()}).then(function(e){if(!e.result){var t=e.errmsg||f[e.errcode]||f[e.errmsg]||"未知异常";return Promise.reject(t)}return Promise.resolve(e.keysn)})}},{key:"getSealsFromKey_PDF",value:function(e,t){var n=this,r=this.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt,i=this.KGPdfViewerWebApp.PDFViewerApplication.KG_FJRS,o=new u.iWebAssist({clientType:"0"});t&&t.keySN?Promise.resolve(o.promise).then(function(){var i=t.keySN;o.verifyPin(n.keyPwd,i).then(function(o){if(!o.result){var s=o.errmsg||{"-1":"未安装签名组件","-2":"待验证pin的key和当前插入的key不匹配",1:"没有检测到用户key",2:"非法为授权的key",3:"没有找到key驱动文件",4:"插入太多的key",7:"密码错误",8:"非法授权key",9:"网络连接失败"}[o.errcode]||"未知异常";return n.KGPdfViewerWebApp.getTipPrompt().close(),r.open(s),void window.KGPdfViewerWebApp.getPasswordPrompt().clearRememberedPwd()}if(null!=t.seals&&""!=t.seals){var l={action:"handleCilentSeal",keySN:i,unitName:t.orgname,stampType:n.KGPdfViewerWebApp.stampType,seals:t.seals};a.myaxios.post(n.KGPdfViewerWebApp.getDocTypeUrl(),l).then(function(t){e(t.data)})}else r.open(f[11])})}).finally(function(){n.KGPdfViewerWebApp.getTipPrompt().close()}):Promise.resolve(o.promise).then(function(){return i?o.setParamByName("FJRSISPHONE","0").then(function(){return o.setParamByName("ISPHONE","0")}):Promise.resolve()}).then(function(){return new Promise(function(e,t){n.userCode&&o.setParamByName("USERCODE",n.userCode),(n.imgTag||"0"==n.imgTag)&&o.setParamByName("SIGNTYPE",n.imgTag),e()})}).then(function(){return o.getKeyInfo()}).then(function(t){if(t.result){var i=t.usercode,s=t.seals,c=t.keysn,u=void 0;if(window.KGPdfViewerWebApp.fjrs&&window.KGPdfViewerWebApp.fjrs.isFjrs){u=o.verifyPin(n.keyPwd,c).then(function(e){if(!e.result){var t=e.errmsg||{"-1":"未安装签名组件","-2":"待验证pin的key和当前插入的key不匹配",1:"没有检测到用户key",2:"非法为授权的key",3:"没有找到key驱动文件",4:"插入太多的key",7:"密码错误",8:"非法授权key",9:"网络连接失败"}[e.errcode]||"未知异常";return n.KGPdfViewerWebApp.getTipPrompt().close(),r.open(t),void window.KGPdfViewerWebApp.getPasswordPrompt().clearRememberedPwd()}return Promise.resolve()});for(var d=0,h=s.length;d<h;d++)s[d].usercode=i,s[d].sesealinfo&&delete s[d].sesealinfo,s[d].certlist&&delete s[d].certlist,s[d].signercert&&delete s[d].signercert}else{u=Promise.resolve();for(var p=0,m=s.length;p<m;p++)s[p].usercode=i,s[p].imgdata=(0,l.parseCilentSealImgData)(s[p].imgdata),s[p].sesealinfo&&delete s[p].sesealinfo,s[p].certlist&&delete s[p].certlist,s[p].signercert&&delete s[p].signercert}n.KGPdfViewerWebApp.userId=c,u.then(function(){if(null!=t.seals&&""!=t.seals){var i={action:"handleCilentSeal",keySN:c,unitName:t.orgname,stampType:n.KGPdfViewerWebApp.stampType,seals:t.seals};a.myaxios.post(n.KGPdfViewerWebApp.getDocTypeUrl(),i).then(function(t){e(t.data)})}else r.open(f[11])})}else{var g=t.errmsg||f[t.errcode]||f[t.errmsg]||"未知异常";r.open(g)}}).finally(function(){n.KGPdfViewerWebApp.getTipPrompt().close()})}},{key:"transparentImg",value:function(e){var t=this;return(0,l.closeOverlay)().then(function(){return t.KGPdfViewerWebApp.getTipPrompt().open("正在获取印章...")}).then(function(){return new Promise(function(t){setTimeout(function(){return t((0,c.transparent)(e.seal.imgdata))},100)})}).then(function(e){return t.KGPdfViewerWebApp.getTipPrompt().close(),e}).then(function(t){return e.seal.imgdata=t,e.seal.imgExt="png",e})}},{key:"passwordPromptCallback",value:function(e,t,n){var r=this;this.keyPwd=e,0==this.KGPdfViewerWebApp.sealOrigin?1==this.KGPdfViewerWebApp.certOrigin&&null==this.KGPdfViewerWebApp.externalSign?Promise.resolve("OFD"==this.KGPdfViewerWebApp.fileType?(0,s.getKeySN)():this.getKeySN_PDF()).then(function(e){r.KGPdfViewerWebApp.userId=e,r.getSealsFromServer(t)}).catch(function(e){r.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt.open(e.message)}):this.getSealsFromServer(t):"OFD"===this.KGPdfViewerWebApp.fileType||"PDF"===this.KGPdfViewerWebApp.fileType&&2==this.KGPdfViewerWebApp.stampType?this.getSealsFromKey_OFD(t):this.getSealsFromKey_PDF(t,n)}},{key:"getSealObjet",value:function(e){var t=this,n=this.KGPdfViewerWebApp,r=n.externalGetSeals,i=n.PDFViewerApplication,a=n.externalUnit,o=n.imageTransparent,s=i.KGAlertPrompt,c=i.KG_FJRS,u=i.KG_ScanStamp,p=i.pdfStamp,f=i.KG_UkeyStamp,m=i.KG_ScanStamp_V2,g=i.KG_Finger_Print,v=window.KGPdfViewerWebApp.passwordPrompt.pwdConfig.disable;return new Promise(function(n){"fingerPrint"==e?g.stamp(n):"scan_v2"==e?m.stamp(n):c&&c.config.isScanStamp?c.handleScanClick(n,t.getSealsFromServer):u&&"scan"===e?(t.KGPdfViewerWebApp.systemStampMode=e,u.handleScanClick(n)):!0===t.KGPdfViewerWebApp.isUkey&&"ukey"===e?f.seals?n({status:!0,seals:f.seals}):(t.KGPdfViewerWebApp.systemStampMode=e,t.getSealsFromServer(n)):v||!0===t.KGPdfViewerWebApp.useCaptcha?t.getSealsFromServer(n):null!==r?r(n):window.KGPdfViewerWebApp.fjrs&&window.KGPdfViewerWebApp.fjrs.isFjrs&&1===window.KGPdfViewerWebApp.certOrigin&&1===window.KGPdfViewerWebApp.sealOrigin?t.getKeySn().then(function(e){t.passwordPrompt.open(!0,"add"),t.passwordPrompt.setUpdateCallback(function(r){t.passwordPromptCallback(r,n,e)})}):(t.passwordPrompt.open(!0,"add"),t.passwordPrompt.setUpdateCallback(function(e){t.passwordPromptCallback(e,n)}))}).then(function(n){return new Promise(function(i,c){if(n.status)if(t.passwordPrompt.remember(),null!=r&&(n.seals=n.seals.map(function(e){switch(a){case"mm":return e.width=(0,l.mmCovertToPx)(e.width),e.height=(0,l.mmCovertToPx)(e.height),e;case"cm":return e.width=(0,l.mmCovertToPx)(10*e.width),e.height=(0,l.mmCovertToPx)(10*e.height),e;default:return e}})),null!=r&&1==n.seals.length){var u={seal:n.seals[0]};p.setSealData(u),i(u)}else{var f=t.KGPdfViewerWebApp.getSelectSealPrompt();if(n.seals=t.filterSeals(n.seals),!n.seals.length&&!t.KGPdfViewerWebApp.unifySealPlatformV2){return s.open("没有可用的印章!")}new Promise(function(r){if((0,l.functionalJudgment)("secretSeal")&&"secret"==e){for(var i=void 0,a=0;a<n.seals.length&&(i=n.seals[a]).hasOwnProperty("sealtag");a++);var o=document.createElement("canvas"),c=o.getContext("2d"),u=new Image;u.src=t.KGPdfViewerWebApp.secretSealImg,u.onload=function(){i.width=o.width=72*this.width/96,i.height=o.height=72*this.height/96,c.drawImage(u,0,0,i.width,i.height);var e=o.toDataURL();i.imgdata=e,i.imgExt="png",i.isSecretSeal=!0,i.signSN=d.default.stringify(h.default.parse(i.signSN)),f.setSeals([i]),r()},u.onerror=function(){s.open("加载暗章图片失败!")}}else{var p=n.seals.map(function(e){return e.signSN=d.default.stringify(h.default.parse(e.signSN)),e});f.setSeals(p),r()}}).then(function(){f.setUpdateCallback(function(e){var n=e.seal,r={isContinuityStampCheck:e.isContinuityStampCheck,continuityRange:e.continuityRange,isStampOfQfz:e.isStampOfQfz};!0===o?(r.seal=n,t.transparentImg(r).then(function(e){p.setSealData(e),i(e)})):(r.seal=n,p.setSealData(r),i(r))}),(0,l.closeOverlay)().then(setTimeout(function(){switch(p.stampSealType){case"default":f.open();break;case"singleSeal":f.singleSealNoSelectSealPrompt();break;case"pagingSeal":f.pagingSealNoSelectSealPrompt(n.seals[0]);break;case"continuitySeal":f.continuitySealNoSelectSealPrompt()}},50))})}else{if(n.message&&"密码错误"==n.message||n.defaultMsg&&"密钥盘密码错误"==n.defaultMsg)window.KGPdfViewerWebApp.getPasswordPrompt().clearRememberedPwd(),s.closeCallback=function(){t.getSealObjet(e)};s.open(n.message||"获取印章失败")}})})}},{key:"getKeySn",value:function(){var e=this,t=this.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt,n=this.KGPdfViewerWebApp.PDFViewerApplication.KG_FJRS,r=new u.iWebAssist({clientType:"0"});return Promise.resolve(r.promise).then(function(){return n?r.setParamByName("FJRSISPHONE","0").then(function(){return r.setParamByName("ISPHONE","0")}):Promise.resolve()}).then(function(){return new Promise(function(t,n){e.userCode&&r.setParamByName("USERCODE",e.userCode),(e.imgTag||"0"==e.imgTag)&&r.setParamByName("SIGNTYPE",e.imgTag),t()})}).then(function(){return r.getKeyInfo()}).then(function(r){if(r.result){for(var i=r.usercode,a=r.seals,o=r.keysn,s=0,c=a.length;s<c;s++)a[s].usercode=i,n||(a[s].imgdata=(0,l.parseCilentSealImgData)(a[s].imgdata)),a[s].sesealinfo&&delete a[s].sesealinfo,a[s].certlist&&delete a[s].certlist,a[s].signercert&&delete a[s].signercert;return e.KGPdfViewerWebApp.userId=o,{keySN:o,seals:a,orgname:r.orgname,phoneshield:r.phoneshield,result:r.result,servertime:r.servertime,sinopec:r.sinopec,usercode:r.usercode}}var u=r.errmsg||f[r.errcode]||f[r.errmsg]||"未知异常";t.open(u)}).finally(function(){e.KGPdfViewerWebApp.getTipPrompt().close()})}},{key:"sigAndReWriteSigData",value:function(e,t){var n=this.KGPdfViewerWebApp,r=n.stampType,i=n.userId,a=n.iWebAuth,o=this.keyPwd,s=this;if(1==r)if(a.scan||a.uKey){var l=window.KGPdfViewerWebApp.PDFViewerApplication.KG_IWebAuth,c=e[0].needSigMessage;l.sign(c).then(function(n){var r=n.sigData,i=n.cert;e[0].sigData=r,s.KGPdfViewerWebApp.reWriteSigData(e,i,t)})}else{var p=new u.iWebAssist({clientType:"0"});Promise.all([p.promise]).then(function(){return p.getCspName()}).then(function(n){var r=e;(0,u.cryptAPISig)(n,o,r).then(function(e){if(e.result){var n=e.message.sigedData,r=e.message.cert;s.KGPdfViewerWebApp.reWriteSigData(n,r,t)}else s.KGPdfViewerWebApp.sigError(),e.message?s.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt.open(e.message):e.warnning&&s.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt.open(e.warnning)})})}else if(2===r);else if(null!=window.KGPdfViewerWebApp.externalSign);else if(window.KGPdfViewerWebApp.fjrs&&window.KGPdfViewerWebApp.fjrs.isServer)window.KGPdfViewerWebApp.PDFViewerApplication.KG_FJRS.p7Sign(e);else{var f=new u.iWebAssist({clientType:"0"});Promise.all([f.promise]).then(function(){var n=(0,u.createCapability)(),r=e;!function e(t,a){if(t>=r.length)n.resolve({ret:!0,0:r,1:a});else{var l=r[t],c=l.sealtag;Promise.resolve().then(function(){if("GB"===c){var e=void 0;return f.setParamByName("CLEARGBSESEALINFO","").then(function(){return f.getKeyInfo()}).then(function(t){return e=t.seals[0],f.setParamByName("GBSESEALINFO",e.sesealinfo)}).then(function(){return f.setParamByName("GBSIGNSN",e.signsn)})}if("GM"===c){var t=s.sealdata.filter(function(e){return"GM"===e.sealtag})[0].signSN;return f.setParamByName("ISGM","1").then(function(){return f.setParamByName("SIGNSN",d.default.parse(t).toString())})}return Promise.resolve()}).then(function(){var e=s.KGPdfViewerWebApp.PDFViewerApplication.KG_FJRS;return e?e.config.isScanStamp?f.setParamByName("FJRSTOKEN",e.token):f.setParamByName("FJRSTOKEN","undefined"):Promise.resolve()}).then(function(){return f.setParamByName("KEYSN",i)}).then(function(){f.sig_pkcs7(o,l.needSigMessage).then(function(r){r.result?(l.certSignMsg=d.default.stringify(h.default.parse(r.signeddata)),void 0===a&&(a=r.certinfo.crtdata),e(t+1,a)):n.resolve({ret:!1,msg:r.errmsg||{"-1":"未安装签名组件","-12":"获取证书失败","-13":"签名时,加载证书失败","-15":"签名数据不能为空","-16":"密码不能为空","-17":"解析证书失败","-2":"待验证pin的key和当前插入的key不匹配",1:"没有检测到用户key",2:"非法为授权的key",3:"没有找到key驱动文件",4:"插入太多的key",7:"密码错误",8:"非法授权key"}[r.errcode]})})}).then(function(){"GB"===c&&(f.setParamByName("GBSESEALINFO",""),f.setParamByName("GBSIGNSN",""))})}}(0),n.promise.then(function(e){if(e.ret){var n=e[0],r=e[1],i=n;s.KGPdfViewerWebApp.reWriteSigData(i,r,t)}else s.KGPdfViewerWebApp.sigError(),s.KGPdfViewerWebApp.PDFViewerApplication.KGAlertPrompt.open(e.msg)})})}}},{key:"filterSeals",value:function(e){var t=window.KGPdfViewerWebApp.filterSealNames;if(!t)return e;if(Array.isArray(t)){var n=Array.from(new Set(t));return e=e.filter(function(e){return-1!==n.indexOf(e.signName)})}}}]),e}();t.PDFStampSeal=m},function(e,t,n){"use strict";var r,i,a="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};!function(o){var s;if(n(150)&&(void 0!==(i="function"==typeof(r=o)?r.call(t,n,t,e):r)&&(e.exports=i),s=!0),"object"==a(t)&&(e.exports=o(),s=!0),!s){var l=window.Cookies,c=window.Cookies=o();c.noConflict=function(){return window.Cookies=l,c}}}(function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function i(){}function a(t,n,a){if("undefined"!=typeof document){"number"==typeof(a=e({path:"/"},i.defaults,a)).expires&&(a.expires=new Date(1*new Date+864e5*a.expires)),a.expires=a.expires?a.expires.toUTCString():"";try{var o=JSON.stringify(n);/^[\{\[]/.test(o)&&(n=o)}catch(e){}n=r.write?r.write(n,t):encodeURIComponent(n+"").replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(t+"").replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var s="";for(var l in a)a[l]&&(s+="; "+l,!0!==a[l]&&(s+="="+a[l].split(";")[0]));return document.cookie=t+"="+n+s}}function o(e,n){if("undefined"!=typeof document){for(var i={},a=document.cookie?document.cookie.split("; "):[],o=0;o<a.length;o++){var s=a[o].split("="),l=s.slice(1).join("=");n||'"'!==l.charAt(0)||(l=l.slice(1,-1));try{var c=t(s[0]);if(l=(r.read||r)(l,c)||t(l),n)try{l=JSON.parse(l)}catch(e){}if(i[c]=l,e===c)break}catch(e){}}return e?i[e]:i}}return i.set=a,i.get=function(e){return o(e,!1)},i.getJSON=function(e){return o(e,!0)},i.remove=function(t,n){a(t,"",e(n,{expires:-1}))},i.defaults={},i.withConverter=n,i}(function(){})})},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i,a="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};r=window,i=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){var r=n(2),i=n(3),a=n(5),o=n(6);function s(e){var t=new a(e),n=i(a.prototype.request,t);return r.extend(n,a.prototype,t),r.extend(n,t),n}var l=s(o);l.Axios=a,l.create=function(e){return s(r.merge(o,e))},l.Cancel=n(23),l.CancelToken=n(24),l.isCancel=n(20),l.all=function(e){return Promise.all(e)},l.spread=n(25),e.exports=l,e.exports.default=l},function(e,t,n){var r=n(3),i=n(4),o=Object.prototype.toString;function s(e){return"[object Array]"===o.call(e)}function l(e){return null!==e&&"object"===(void 0===e?"undefined":a(e))}function c(e){return"[object Function]"===o.call(e)}function u(e,t){if(null!==e&&void 0!==e)if("object"===(void 0===e?"undefined":a(e))||s(e)||(e=[e]),s(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}e.exports={isArray:s,isArrayBuffer:function(e){return"[object ArrayBuffer]"===o.call(e)},isBuffer:i,isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:l,isUndefined:function(e){return void 0===e},isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:c,isStream:function(e){return l(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:u,merge:function e(){var t={};function n(n,r){"object"===a(t[r])&&"object"===(void 0===n?"undefined":a(n))?t[r]=e(t[r],n):t[r]=n}for(var r=0,i=arguments.length;r<i;r++)u(arguments[r],n);return t},extend:function(e,t,n){return u(t,function(t,i){e[i]=n&&"function"==typeof t?r(t,n):t}),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(e,t){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){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(n(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}(e)||!!e._isBuffer)}},function(e,t,n){var r=n(6),i=n(2),a=n(17),o=n(18);function s(e){this.defaults=e,this.interceptors={request:new a,response:new a}}s.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),(e=i.merge(r,this.defaults,{method:"get"},e)).method=e.method.toLowerCase();var t=[o,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},i.forEach(["delete","get","head","options"],function(e){s.prototype[e]=function(t,n){return this.request(i.merge(n||{},{method:e,url:t}))}}),i.forEach(["post","put","patch"],function(e){s.prototype[e]=function(t,n,r){return this.request(i.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=s},function(e,t,n){var r=n(2),i=n(7),a={"Content-Type":"application/x-www-form-urlencoded"};function o(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var s,l={adapter:("undefined"!=typeof XMLHttpRequest?s=n(8):"undefined"!=typeof process&&(s=n(8)),s),transformRequest:[function(e,t){if(i(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e))return e;if(r.isArrayBufferView(e))return e.buffer;if(r.isURLSearchParams(e))return o(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();if(r.isObject(e)){if("application/json"===t["Content-Type"])return o(t,"application/json;charset=utf-8"),JSON.stringify(e);o(t,"application/x-www-form-urlencoded;charset=utf-8");var n=new Array;for(var a in e)n.push(a+"="+encodeURI(e[a]));return n.join("&")}return e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};l.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],function(e){l.headers[e]={}}),r.forEach(["post","put","patch"],function(e){l.headers[e]=r.merge(a)}),e.exports=l},function(e,t,n){var r=n(2);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){var r=n(2),i=n(9),a=n(12),o=n(13),s=n(14),l=n(10),c="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||n(15);e.exports=function(e){return new Promise(function(t,u){var d=e.data,h=e.headers;r.isFormData(d)&&delete h["Content-Type"];var p=new XMLHttpRequest,f="onreadystatechange",m=!1;if(window.XMLHttpRequest||"undefined"==typeof window||!window.XDomainRequest||"withCredentials"in p||s(e.url)||(p=new window.XDomainRequest,f="onload",m=!0,p.onprogress=function(){},p.ontimeout=function(){}),e.auth){var g=e.auth.username||"",v=e.auth.password||"";h.Authorization="Basic "+c(g+":"+v)}if(p.open(e.method.toUpperCase(),a(e.url,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,p[f]=function(){if(p&&(4===p.readyState||m)&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in p?o(p.getAllResponseHeaders()):null,r={data:e.responseType&&"text"!==e.responseType?p.response:p.responseText,status:1223===p.status?204:p.status,statusText:1223===p.status?"No Content":p.statusText,headers:n,config:e,request:p};i(t,u,r),p=null}},p.onerror=function(){u(l("Network Error",e,null,p)),p=null},p.ontimeout=function(){u(l("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",p)),p=null},r.isStandardBrowserEnv()){var y=n(16),b=(e.withCredentials||s(e.url))&&e.xsrfCookieName?y.read(e.xsrfCookieName):void 0;b&&(h[e.xsrfHeaderName]=b)}if("setRequestHeader"in p&&r.forEach(h,function(e,t){void 0===d&&"content-type"===t.toLowerCase()?delete h[t]:p.setRequestHeader(t,e)}),e.withCredentials&&(p.withCredentials=!0),e.responseType)try{p.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"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(),u(e),p=null)}),void 0===d&&(d=null),p.send(d)})}},function(e,t,n){var r=n(10);e.exports=function(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){var r=n(11);e.exports=function(e,t,n,i,a){var o=new Error(e);return r(o,t,n,i,a)}},function(e,t){e.exports=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e}},function(e,t,n){var r=n(2);function i(e){return encodeURIComponent(e).replace(/%40/gi,"@").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 a;if(n)a=n(t);else if(r.isURLSearchParams(t))a=t.toString();else{var o=[];r.forEach(t,function(e,t){null!==e&&void 0!==e&&(r.isArray(e)&&(t+="[]"),r.isArray(e)||(e=[e]),r.forEach(e,function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),o.push(i(t)+"="+i(e))}))}),a=o.join("&")}return a&&(e+=(-1===e.indexOf("?")?"?":"&")+a),e}},function(e,t,n){var r=n(2),i=["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,a,o={};return e?(r.forEach(e.split("\n"),function(e){if(a=e.indexOf(":"),t=r.trim(e.substr(0,a)).toLowerCase(),n=r.trim(e.substr(a+1)),t){if(o[t]&&i.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}}),o):o}},function(e,t,n){var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(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=i(window.location.href),function(t){var n=r.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function r(){this.message="String contains an invalid character"}r.prototype=new Error,r.prototype.code=5,r.prototype.name="InvalidCharacterError",e.exports=function(e){for(var t,i,a=String(e),o="",s=0,l=n;a.charAt(0|s)||(l="=",s%1);o+=l.charAt(63&t>>8-s%1*8)){if((i=a.charCodeAt(s+=.75))>255)throw new r;t=t<<8|i}return o}},function(e,t,n){var r=n(2);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,i,a,o){var s=[];s.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),r.isString(i)&&s.push("path="+i),r.isString(a)&&s.push("domain="+a),!0===o&&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){var r=n(2);function i(){this.handlers=[]}i.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){r.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=i},function(e,t,n){var r=n(2),i=n(19),a=n(20),o=n(6),s=n(21),l=n(22);function c(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return c(e),e.baseURL&&!s(e.url)&&(e.url=l(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(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||o.adapter)(e).then(function(t){return c(e),t.data=i(t.data,t.headers,e.transformResponse),t},function(t){return a(t)||(c(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){var r=n(2);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t){e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t){e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t){function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,n){var r=n(23);function i(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))})}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i(function(t){e=t}),cancel:e}},e.exports=i},function(e,t){e.exports=function(e){return function(t){return e.apply(null,t)}}}])},r.axios=i(),t.axios=axios},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transparent=function(e){var t=document.createElement("canvas"),n=t.getContext("2d"),r=new Image,i=null,a=new Promise(function(e){i=e});return r.onload=function(){t.width=this.width,t.height=this.height,n.drawImage(r,0,0,this.width,this.height);for(var a=n.getImageData(0,0,1,1).data,o=n.getImageData(0,this.height-1,1,1).data,s=(n.getImageData(this.width-1,this.height-1,1,1).data,n.getImageData(this.width-1,0,1,1).data),l=[a,o,s,s],c=!0,u=0;u<l.length;u++){var d=l[u];if(!(d[0]>225&&d[1]>225&&d[2]>225&&d[3]>225)){c=!1;break}}if(c){for(var h=0;h<this.width;h++)for(var p=0;p<this.height;p++){var f=n.getImageData(h,p,1,1),m=f.data;m[0]>225&&m[1]>225&&m[2]>225&&m[3]>225&&(f.data[0]=0,f.data[1]=0,f.data[2]=0,f.data[3]=0,n.putImageData(f,h,p))}i(t.toDataURL())}else i(e)},r.src=e,a}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cryptAPICtrl=t.cryptAPISig=void 0;var r=n(40),i=function(){this.kg=new r.KG("KG_Crypt_COM_API.CryptAPICtrl.1","FD5FA7DB-CBF7-4804-8147DE5A56CC8ADF"),this.promise=this.kg.init()};i.prototype={getCert:function(e){var t=this.kg,n=(0,r.createCapability)(),i=this;return this.getCtnArray(e).then(function(r){i.begin(e).then(function(e){return t.invoke("KGCryptExportKey",6,1,0)}).then(function(e){t.invoke("KGCryptDestroyKey").then(function(){return t.invoke("KGCryptFinalize",0)}).then(function(){n.resolve(e)})})}),n.promise},begin:function(e){var t=this.kg,n=(0,r.createCapability)();return this.getCtnArray(e).then(function(n){return t.invoke("KGCryptInitialize",e,n[0],1,0)}).then(function(){return t.invoke("KGCryptGetUserKey",2)}).then(function(e){0==e?n.resolve(2):t.invoke("KGCryptGetUserKey",1).then(function(e){0==e?n.resolve(1):n.resolve(-1)})}),n.promise},sig:function(e,t){var n=this.kg,i=(0,r.createCapability)();return n.invoke("KGCryptCreateHash",32772).then(function(){return n.invoke("KGCryptSetHashValue",t,t.length)}).then(function(){return n.time=45e3,n.invoke("KGCryptSignHash",e,0)}).then(function(e){n.invoke("KGCryptDestroyHash").then(function(){"none"===e?i.reject():i.resolve(e)})}),i.promise},exportCert:function(){return this.kg.invoke("KGCryptExportKey",0,1,0)},end:function(){var e=this.kg,t=(0,r.createCapability)();return e.invoke("KGCryptFinalize",0).then(function(){t.resolve(0)}),t.promise},setKeyPwd:function(e){void 0===e&&(e="");var t=function(e){for(var t="",n=0;n<e.length;n++)t+=e.charCodeAt(n).toString(16);return t}(e)+"00";return this.kg.invoke("KGCryptSetPin",t,t.length,32)},getCtnArray:function(e){var t=this.kg,n=this,i=(0,r.createCapability)();return t.invoke("KGCryptInitialize",e,"",1,-268435424).then(function(){return t.invoke("KGCryptGetContainers",0)}).then(function(e){t.invoke("KGCryptFinalize",0).then(function(){n.end().then(function(){i.resolve(e.split("$n"))})})}),i.promise}};t.cryptAPISig=function(e,t,n){var a=new i,o=(0,r.createCapability)(),s={result:!1};return Promise.all([a.promise]).then(function(){return a.begin(e)}).then(function(e){if(o.promise.then(function(){a.end()},function(){a.end()}),-1==e)return s.message="请插入密钥盘或者密钥盘中不存在证书!",void o.resolve(s);(null==t?Promise.resolve(0):a.setKeyPwd(t)).then(function(t){if(0!=t)return s.message="密钥盘密码错误或密钥盘被锁!",void o.resolve(s);a.exportCert().then(function(t){if("none"==t)return s.message="获取签名证书失败!",void o.resolve(s);var i=(0,r.createCapability)();!function t(n,r){var l=n[r];a.sig(e,l.needSigMessage).then(function(e){if(l.sigData=e,!l.sigData)return s.message="签名失败!",void o.resolve(s);r==n.length-1?i.resolve(n):t(n,r+1)},function(){s.warnning="签名失败!",o.resolve(s)})}(n,0),i.promise.then(function(e){s.result=!0,s.message={cert:t,sigedData:e},o.resolve(s)})})})}),o.promise},t.cryptAPICtrl=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KGPdfViewerWebApp=void 0;var r=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=n(23),a=n(57),o=n(58),s=n(39),l=n(155),c=S(n(159)),u=n(160),d=n(24),h=n(161),p=n(162),f=n(163),m=n(5),g=n(93),v=S(n(15)),y=S(n(32)),b=S(n(88)),w=S(n(2));function S(e){return e&&e.__esModule?e:{default:e}}var _="#$~%kinggrid%~$#",P={PDFViewerApplication:null,adaptContainer:[],passwordPrompt:null,selectSealPrompt:null,alertPrompt:null,tipPrompt:null,confirmOverlay:null,url:null,documentId:null,fileType:"PDF",cert:null,userId:null,userCode:null,imgTag:null,softType:0,sealOrigin:0,sealType:"PT",certOrigin:0,stampType:0,imageTransparent:!1,capability:null,mobile:0,pdfPwd:"",needTipFileSize:1536,readOnly:!1,multipleStamp:!0,hideDeleteNode:!1,allowFollow:!1,additionText:!0,additionTextConfig:{},additionTextDefaultConfig:{presetTexts:[],color:"000",fontSize:18,timeFontSize:18,maxLength:200,font:"宋体",textPosition:"right_bottom",timePosition:"right_bottom",timeFormat:"YYYY年MM月DD日",loaction:"fixed",percentY:50,defaultText:"",isSelect:!1},useCaptcha:!1,pagingSeal:!0,textToSeal:!1,textToSealDefault:{textToSealText:"中共北京市委转文",indicateSealText:"领导",textToSealNum:"123456",indicateSealNum:"1234",color:"#2c2cff",visibleType:"MarkHandwrite",textToSealType:"textToSeal",indicateSealType:"indicateSeal",invariantSealType:"invariantSeal",invariantSealImgPath:"./images/yfs.png"},annotation:!1,annotationDefaultConfig:{mode:"text",height:360,width:720,minHeight:200,minWidth:640,font:"宋体",size:"24",color:"black",line:"5",callback:null,wrapSize:null,editable:!0,extend:null,annotationSuccess:null,annotationQueueSuccess:null},annotationConfig:{},openAnnotationPanel:function(){return window.KGPdfViewerWebApp.PDFViewerApplication.KG_Annotation.show()},annotationVisibleType:null,disableSignaturePad:!1,clientCode:"",clientErrorConfig:[],prepareStamp:null,indicateSeal:!1,indicateSealDefaultConfig:{authorName:null,name:"领导",number:"",color:"#088ED7"},indicateSealConfig:{},indicateSealSuccess:function(e){},textToSealCb:function(){},exportKGAnnotations:function(e){console.log(e)},exportKGAnnotationList:function(){var e=this.PDFViewerApplication.kgAnnotationViewer,t=e.annotationList,n=e.formatSealsData(),r=void 0;return null!=this.annotationVisibleType?r=this.annotationVisibleType:this.textToSealDefault.visibleType&&(r=this.textToSealDefault.visibleType),r?t.concat(n).filter(function(e){try{var t=JSON.parse(e.annotInfo);return!(!t||!t.hasOwnProperty("customType"))&&t.customType.toString()===r}catch(e){return!1}}).sort(function(e,t){return Number(e.page||e.pageNo)-Number(t.page||t.pageNo)}):[]},navigateToKGAnnotation:function(e,t,n){var r=this.PDFViewerApplication.pdfViewer,a=r.getPageView(Number(e)-1),o=a.viewport.viewBox[3],s=[{num:e,gen:0},{name:"XYZ"},t,o-n,0];r.scrollPageIntoView({pageNumber:e,destArray:s}),a.onAfterDraw=function(){for(var e=a.annotationLayer.div.getElementsByTagName("section"),r=void 0,i=0;i<e.length;i++){var o=Math.round((0,d.getNumbOfPx)(e[i].style.left)),s=Math.round((0,d.getNumbOfPx)(e[i].style.top));if(o>=Math.round(t)-3&&o<=Math.round(t)+3&&s>=Math.round(n)-3&&s<=Math.round(n)+3){r=e[i];break}}r&&(0,l.setBorder)(r),a.onAfterDraw=null},a.destroy(),a.renderingState=i.RenderingStates.INITIAL,a.draw()},exportKGBookmarks:function(){var e=this.PDFViewerApplication.pdfOutlineViewer.outline,t=[];return null!=e&&function e(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=0;r<t.length;r++)n[r]={},n[r].title=t[r].title,n[r].data=JSON.stringify({dest:t[r].dest}),n[r].children=[],t[r].items.length&&e(t[r].items,n[r].children)}(e,t),t},navigateToKGBookmark:function(e){var t=JSON.parse(e).dest;this.PDFViewerApplication.pdfLinkService.navigateTo(t)},useNFSSystem:!1,showPrintBtn:!1,watermark:!1,addWatermarkSuccess:function(){console.log("添加水印成功~")},secretSeal:!1,secretSealImg:"./images/secret-seal.png",disableTextAnnotation:!1,downlaod:!1,fjrs:null,appCode:"",scanStamp:!1,getQrCodeBase64Image:function(e){console.log(e)},filterSealNames:null,useTextWidget:!1,disableRotate:!0,btnPositionConfig:{toolbar:["stamp"],sidebar:["prepareStamp","indicateSeal","signature","download","scanStamp","textToSeal","exportAnnotations","docSave","docSaveAs","print","watermark","annotation","openLocalFile","docSign","iWebAuthScan","iWebAuthUkey","Ukey"]},themeColor:"#1890ff",setThemeColorStyle:function(){var e,t,n,r=void 0,i=void 0,a=void 0,o=void 0;if(r=this.themeColor.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i))6===r[1].length?(i=parseInt(r[1].substr(0,2),16),a=parseInt(r[1].substr(2,2),16),o=parseInt(r[1].substr(4,2),16)):(i=parseInt(r[1].charAt(0)+r[1].charAt(0),16),a=parseInt(r[1].charAt(1)+r[1].charAt(1),16),o=parseInt(r[1].charAt(2)+r[1].charAt(2),16));else if(r=this.themeColor.match(/^\W*rgba?\(([^)]*)\)\W*$/i)){var s=r[1].split(","),l=void 0,c=void 0,u=void 0;s.length>=3&&(l=s[0].match(/^\s*(\d*)(\.\d+)?\s*$/))&&(c=s[1].match(/^\s*(\d*)(\.\d+)?\s*$/))&&(u=s[2].match(/^\s*(\d*)(\.\d+)?\s*$/))&&(i=parseFloat((l[1]||"0")+(l[2]||"")),a=parseFloat((c[1]||"0")+(c[2]||"")),o=parseFloat((u[1]||"0")+(u[2]||"")))}if(t="rgba("+(i=Math.max(0,Math.min(255,i)))+", "+(a=Math.max(0,Math.min(255,a)))+", "+(o=Math.max(0,Math.min(255,o)))+", .2)",n="rgba("+i+", "+a+", "+o+", .7)",!(e="rgb("+i+", "+a+", "+o+")"))throw Error("颜色格式不正确");var d=document.createElement("style");d.type="text/css",d.innerHTML="\n #KG_CertValidityOverlay .certDays {\n color: "+e+";\n }\n\n .layui-laydate .layui-laydate-header i:hover,\n .layui-laydate .layui-laydate-header span:hover {\n color: "+e+";\n }\n\n .layui-laydate .layui-laydate-content .layui-this {\n background-color: "+e+" !important;\n }\n\n .kg_checkbox_wrapper.kg_checkbox_wrapper-checked:before {\n color: "+e+";\n }\n\n .kg_radio_wrapper.kg_radio_wrapper-checked:before {\n color: "+e+";\n }\n\n .thumbnail.selected > .thumbnailSelectionRing > .thumbnailImage {\n box-shadow: 0 0 0 2px "+e+";\n }\n\n #loadingBar .progress {\n background-color: "+e+";\n }\n\n #toolbarSidebar .toolbarButton.toggled {\n border-bottom: 2px solid "+e+";\n background-color: "+t+";\n }\n\n .toolbarButton:hover,\n .toolbarButton:focus,\n .toolbarButton:hover:active,\n .splitToolbarButton.toggled > .toolbarButton.toggled,\n .toolbarButton.toggled:hover:active {\n color: "+e+";\n }\n\n .secondaryToolbarButton:hover,\n .secondaryToolbarButton:focus,\n .secondaryToolbarButton.toggled,\n .secondaryToolbarButton:hover:active,\n .secondaryToolbarButton.toggled:hover:active {\n color: "+e+";\n }\n\n .dropdownToolbarButton:hover,\n .dropdownToolbarButton:focus,\n #pageNumber:hover,\n #pageNumber:focus {\n border: 1px solid "+e+";\n }\n\n #sidebarContainer .toolbarButton.toggled:hover:active,\n .outlineItemToggler:hover,\n .outlineItemToggler:hover + a,\n .outlineItemToggler:hover ~ .outlineItems,\n .outlineItem > a:hover,\n .annotationItem > a:hover,\n .attachmentsItem > button:hover {\n color: "+e+";\n }\n\n .KG_VerifySealPrompt_Tab:hover {\n color: "+e+";\n }\n\n .KG_VerifySealPrompt_Tab.active {\n color: "+e+";\n border-bottom: 2px solid "+e+";\n }\n\n .KG_VerifySealPrompt_Tip_Copy {\n color: "+e+";\n }\n\n .KG_VerifySealPrompt_Tip_Copy:hover {\n color: "+n+";\n }\n\n .kg_productInfo_copyright > p > a:hover {\n color: "+e+";\n }\n\n #kgTextToSealOverlay .kgdialog .tab .selected {\n color: "+e+";\n }\n\n #documentPropertiesOverlay #fileType {\n color: "+e+";\n border: 2px solid "+e+";\n }\n\n .KG_GuideTip_NeverShow:hover {\n color: "+e+";\n }\n\n .toolbarField:hover {\n border-color: "+e+";\n }\n\n .toolbarField:focus {\n border-color: "+e+";\n }\n\n .btn:hover,\n .btn:focus {\n color: "+e+";\n border-color: "+e+";\n }\n\n .btn-primary {\n background-color: "+e+";\n border-color: "+e+";\n }\n\n .btn-primary:hover,\n .btn-primary:focus {\n color: #fff;\n background-color: "+n+";\n border-color: "+n+";\n }\n\n .btn-border-primary {\n color: "+e+";\n border-color: "+e+";\n }\n\n .btn-text-primary {\n color: "+e+";\n }\n\n .btn-text-primary:hover,\n .btn-text-primary:focus {\n background-color: "+t+";\n }\n\n #kg-seal-left:hover, #kg-seal-right:hover {\n color: "+e+";\n }\n\n .kgInput:hover, .kgInput:focus {\n border: 1px solid "+e+";\n }\n\n #sign-msg-thick.active, #sign-msg-thick:hover {\n color: "+e+";\n }\n\n #sign-msg-thick-drop {\n border: 2px solid "+e+";\n }\n\n .kg_progress_active {\n background-color: "+e+";\n }\n ",document.getElementsByTagName("head").item(0).appendChild(d)},surreadPrint:!1,setSurreadPrintConfig:function(e){if(!this.PDFViewerApplication.KG_SurreadPrint)throw new Error("[打印控制组件异常] 未初始化");this.PDFViewerApplication.KG_SurreadPrint.combineConfig(e)},getSurreadPrintConfig:function(){if(!this.PDFViewerApplication.KG_SurreadPrint)throw new Error("[打印控制组件异常] 未初始化");var e=this.surreadPrint;return{customParam:e.customParam,print:e.print,watermark:e.watermark,showPannel:e.showPannel,printerList:e.printerList}},setAppCode:function(e){var t=this;e&&(this.appCode=e);var n=new g.iWebAssist;return n.promise.then(function(){return n.setParamByName("APPCODE",t.appCode)})},language:"zh-CN",checkFile:!1,algorithmType:{cloud:"RSA",key:null},verifyChainInfo:!1,openLocalFile:!1,uploadLocalFileUrl:null,uploadLocalFileSuccess:function(e){console.log("Upload success: ",e)},stampSuccess:function(e){},deleteSealSuccess:function(){},externalSign:null,externalGetSeals:null,externalStampSeal:null,externalVerifyOnLoad:null,externalVerifySeal:null,externalUnit:"px",externalSeals:null,sealPreLocation:null,renderExternalSealsComplete:function(e){console.log(e)},externalDeleteSeal:function(e,t){this.PDFViewerApplication.KG_NoServer.deleteSeal(e,t)},disableDelete:!1,license:null,version:null,selectedSeal:null,isCa3:!1,isUrlDoc:!1,currentView:"",iWebAuth:{scan:!1,uKey:!1},getCurrentView:function(){return this.currentView.split("#")[1]},setCurrentView:function(e){this.PDFViewerApplication.setInitialView(e)},getConfirmPrompt:function(){if(null==this.confirmPrompt){var e=this.PDFViewerApplication;this.confirmPrompt=new c.default(e,e.overlayManager)}return this.confirmPrompt},getPasswordPrompt:function(){if(null==this.passwordPrompt){var e=this.PDFViewerApplication;this.passwordPrompt=new u.KGPasswordPrompt(e.appConfig.kgpasswordOverlay,e.overlayManager,e.l10n)}return this.passwordPrompt},getSelectSealPrompt:function(){if(null==this.selectSealPrompt){var e=this.PDFViewerApplication;this.selectSealPrompt=new h.SelectSealPrompt(e.appConfig.selectSealOverlay,e.overlayManager,e.l10n)}return this.selectSealPrompt},getAlertPrompt:function(){if(null==this.alertPrompt){var e=this.PDFViewerApplication;this.alertPrompt=new p.AlertPrompt(e.appConfig.alertPromptOverlay,e.overlayManager,e.l10n)}return this.alertPrompt},getTipPrompt:function(){if(null==this.tipPrompt){var e=this.PDFViewerApplication;this.tipPrompt=new f.KGTipPrompt(null,e.overlayManager,e.l10n)}return this.tipPrompt},setUrl:function(e){this.url=e},getUrl:function(){return this.url},open:function(e,t){var n=this;this.setDocumentId(encodeURIComponent(e)),this.setFileType(t),this.pdfPwd="";var r=this.isUrlDoc?e:this.getDocTypeUrl()+"&action=download&documentId="+encodeURIComponent(e)+"&t="+(new Date).getTime();this.PDFViewerApplication.open(r).then(function(){n.openDocSuccess(),!0!==n.textToSeal&&null==window.KGPdfViewerWebApp.annotationVisibleType||0!==n.docType||n.PDFViewerApplication.kgAnnotationViewer.init()})},repairFileAndOpen:function(){var e=this,t=this.isUrlDoc?this.documentId:this.getDocTypeUrl()+"&action=download&repairPdf=true&documentId="+encodeURIComponent(this.documentId)+"&t="+(new Date).getTime();this.PDFViewerApplication.open(t).then(function(){e.openDocSuccess(),!0!==e.textToSeal&&null==window.KGPdfViewerWebApp.annotationVisibleType||0!==e.docType||e.PDFViewerApplication.kgAnnotationViewer.init()})},openDocSuccess:function(){console.log("打开文档成功~")},getDocTypeUrl:function(){var e=this.url;return e.indexOf("?")>-1?e+="&":e+="?",e+"docType="+this.docType},setFileType:function(e){this.fileType=e?e.toUpperCase():this.fileType.toUpperCase(),"PDF"!==this.fileType&&"OFD"!==this.fileType&&(this.fileType="PDF"),this.docType="OFD"===this.fileType?1:0,"OFD"===this.fileType&&(this.textToSeal=!1)},getFileType:function(){return this.fileType},getPdfPwd:function(){return this.encryptPWd?this.aesEncrypt(this.pdfPwd):this.pdfPwd},setDocumentId:function(e){this.documentId=e},setSealOrigin:function(e){this.sealOrigin=e},getSealOrigin:function(){return this.sealOrigin},getNumPages:function(){return this.PDFViewerApplication.pdfDocument.numPages},stamp:function(){this.PDFViewerApplication.pdfStamp.stamp()},SCSJTT_getFirstSealFromServer:function(e,t){this.PDFViewerApplication.pdfStamp.SCSJTT_getFirstSealFromServer(e,t)},stampOfXY:function(e,t,n,r,i){this.PDFViewerApplication.pdfStamp.stampOfXY(e,t,n,r,i)},stampOfText:function(e,t,n,r){this.PDFViewerApplication.pdfStamp.stampOfText(e,t,n,r)},getUserBeforeSign:function(e){var t={action:"getUser",password:this.encryptPWd?this.aesEncrypt(e):e,keySN:this.userId,userCode:this.userCode,isEncrypt:this.encryptPWd,stampSystemOrigin:window.KGPdfViewerWebApp.stampSystemOrigin,appCode:this.appCode};return a.myaxios.post(this.url,t)},transformSignatureToGmSeal:function(e){var t=this,n={action:"getSealData",keySN:e.keySN,imgdata:e.imgdata.split(",")[1],imgExt:e.imgExt,signName:e.signName,width:(0,m.pxCovertToMM)(e.width),height:(0,m.pxCovertToMM)(e.height),stampSystemOrigin:window.KGPdfViewerWebApp.stampSystemOrigin};return a.myaxios.post(this.url,n).then(function(n){if(n.data.status){var r=n.data,i=r.sealData,a=r.version;return e.version=a,e.sealData=i,Promise.resolve(e)}return t.getTipPrompt().close(),Promise.reject(n.data.message)})},addSeal:function(e,t){var n=this,i=this.certOrigin,o=this.sealType,s=this.fileType,l=this.stampType,c=e.sealdata,u=e.capability,d=this.getTipPrompt();switch(this.PDFViewerApplication.l10n._lang){case"zh-TW":d.open("正在進行簽章加蓋...");break;case"en-US":d.open("Signing and stamping...");break;default:d.open("正在进行签章加盖...")}var h=this.iWebAuth.scan||this.iWebAuth.uKey,p="string"==typeof this.algorithmType?this.algorithmType:this.algorithmType.cloud;h&&(p=window.KGPdfViewerWebApp.PDFViewerApplication.KG_IWebAuth.algorithmType);var f={action:"stampSeal",documentId:this.documentId,pdfPwd:this.getPdfPwd(),stampType:this.stampType,certOrigin:window.KGPdfViewerWebApp.fjrs&&window.KGPdfViewerWebApp.fjrs.isServer?1:this.certOrigin,seals:c,sealType:o,clientCode:this.clientCode,isWebAuth:h,appCode:this.appCode,algorithmType:p,stampSystemOrigin:window.KGPdfViewerWebApp.stampSystemOrigin,unifySealPlatformV2:window.KGPdfViewerWebApp.unifySealPlatformV2};if(window.KGPdfViewerWebApp.unifySealPlatformV2){var g=this.PDFViewerApplication.KG_ScanStamp_V2,v=g.code,y=g.token;f.code=v,f.token=y}!0===this.useCaptcha&&(f.captcha=e.captcha),this.scanStamp&&"scan"==this.systemStampMode&&(f.scanStamp=!0,f.userToken=this.PDFViewerApplication.KG_ScanStamp.userToken,f.qrcodeId=this.PDFViewerApplication.KG_ScanStamp.scanId,f.qrCodeUserUid=this.PDFViewerApplication.KG_ScanStamp.qrCodeUserUid,f.qrCodeUserName=this.PDFViewerApplication.KG_ScanStamp.qrCodeUserName,f.scanSealType=this.PDFViewerApplication.KG_ScanStamp.sealType),f.isUkey=this.isUkey&&"ukey"==this.systemStampMode;var b=this.PDFViewerApplication,w=b.pdfStamp,S=b.pdfDocument,_=this.isLoadComplete()?[S.getDownloadInfo(),u.resolve]:[Promise.resolve({}),w.renderSignatureSeals],P=r(_,2),A=P[0],k=P[1];A.then(function(e){if(e.length&&(length/1024>n.needTipFileSize||1==n.certOrigin))switch(n.PDFViewerApplication.l10n._lang){case"zh-TW":d.open("正在進行簽章加蓋...");break;case"en-US":d.open("Signing and stamping...");break;default:d.open("正在进行签章加盖...")}("OFD"===s||"PDF"===s&&2===l)&&(f.seals=(0,m.sortClass)(f.seals,["esid"])),a.myaxios.post(n.getDocTypeUrl(),f).then(function(e){(0,m.closeOverlay)().then(function(){var r=e.data;if(r.status){if(n.annotation){var a=n.PDFViewerApplication.KG_Annotation,o=a.defaultConfig,s=a.userInput,l=a.extendValue,c=a.isAnnotation,h=a.annotQueue;c&&o.annotationSuccess&&!h&&(o.annotationSuccess(s,l),n.PDFViewerApplication.KG_Annotation.resetAnnotationExtendValue())}if(1==i){var p=r.sigObj;switch(n.capability=u,n.PDFViewerApplication.l10n._lang){case"zh-TW":d.open("正在進行簽章加蓋...");break;case"en-US":d.open("Signing and stamping...");break;default:d.open("正在进行签章加盖...")}t(p,{textPositions:r.textPositions})}else{if(window.KGPdfViewerWebApp.fjrs&&window.KGPdfViewerWebApp.fjrs.isServer){var f=r.sigObj;switch(n.capability=u,n.PDFViewerApplication.l10n._lang){case"zh-TW":d.open("正在進行簽章加蓋...");break;case"en-US":d.open("Signing and stamping...");break;default:d.open("正在进行签章加盖...")}t(f,{textPositions:r.textPositions})}k({status:!0,textPositions:r.textPositions,successPassBackParameter:r.successPassBackParameter})}}else n.PDFViewerApplication.KGAlertPrompt.open(r.message),k({status:!1})})}).catch(function(){k({status:!1})})})},addOFDSeal:function(e){var t=this,n=(0,m.sortClass)(e.sealdata,["esid"]),i=e.capability;this.capability=i;var l=this.PDFViewerApplication,c=l.pdfStamp,u=l.pdfDocument,d=l.KG_UkeyStamp,h=c.pdfStampSeal.keyPwd||this.getPasswordPrompt().pwd||d.password,p=this,f=c.tempSeals,g=this.getTipPrompt(),v=this.isLoadComplete()?[u.getDownloadInfo(),i.resolve]:[Promise.resolve({}),c.renderSignatureSeals],y=r(v,2),b=y[0],w=y[1];b.then(function(e){if(e.length&&(length/1024>t.needTipFileSize||"1"===t.certOrigin.toString()))switch(t.PDFViewerApplication.l10n._lang){case"zh-TW":g.open("正在進行簽章加蓋...");break;case"en-US":g.open("Signing and stamping...");break;default:g.open("正在进行签章加盖...")}var r=function(e){return(0,m.closeOverlay)().then(function(){return t.PDFViewerApplication.KGAlertPrompt.open(e)}).then(function(){w({status:!1}),t.sigError()})};!function e(t){var i=n[t][0].esid,l={certOrigin:p.certOrigin,cert:p.cert,seals:[n[t]],sealType:p.sealType};p.fjrs&&p.fjrs.isServer&&(l={certOrigin:1,cert:p.PDFViewerApplication.KG_FJRS.sealListInfo[0].certBase64,seals:n[t],sealType:1});var c={action:"stampSeal",documentId:p.documentId,pdfPwd:p.getPdfPwd(),stampType:p.stampType,certOrigin:l.certOrigin,cert:l.cert,seals:l.seals,sealType:l.sealType,isEncrypt:p.encryptPWd,isSM:p.isSM&&"OFD"==p.fileType,stampSystemOrigin:window.KGPdfViewerWebApp.stampSystemOrigin,appCode:window.KGPdfViewerWebApp.appCode};a.myaxios.post(p.getDocTypeUrl(),c).then(function(a){var l=a.data,c=l.status,u=l.sigObj,d=l.message,g=l.textPositions;if(c&&u){if(p.multipleStamp){var v=!0,y=!1,b=void 0;try{for(var S,_=f[Symbol.iterator]();!(v=(S=_.next()).done);v=!0){var P=S.value;P.sealData.esid==i&&(P.ofdStampSuccess=!0)}}catch(e){y=!0,b=e}finally{try{!v&&_.return&&_.return()}finally{if(y)throw b}}}var A=function(e){var r=e.signedData,i=e.cert,a=e.sealType,o=e.toSignData,s=e.signDirPath,l=!1;return t>=n.length-1&&(l=!0),p.reWriteSigData(r,i,{textPositions:g},a,o,s,l)},k=function(){++t<n.length?e(t):w({status:!0,textPositions:g})};!0===p.useNFSSystem?(0,o.NFSSign)(h,p.keySN,u,A,k,r):null!=p.externalSign?(0,m.externalSign)(u,A,k,r):2==p.stampType&&"PDF"==p.fileType?(0,s.pdfSM2RegionSign)(h,p.keySN,u,A,k,r):(0,s.ofdSign)(h,p.keySN,u,A,k,r)}else(0,m.closeOverlay)().then(function(){return r(d||"加盖印章出现错误,中止操作")})})}(0)})},modifyText:function(e){var t=this,n={action:"FilltextField",documentId:this.documentId,fileType:this.fileType,data:e};a.myaxios.post(this.getDocTypeUrl(),n).then(function(e){(0,m.closeOverlay)().then(function(){var n=e.data;n.status||t.PDFViewerApplication.KGAlertPrompt.open(n.message)})})},reWriteSigData:function(e,t,n,r,i,o){var s=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],l=this.iWebAuth.scan||this.iWebAuth.uKey,c={action:"reWriteSigData",documentId:this.documentId,keySN:this.keySN||this.userId,pdfPwd:this.getPdfPwd(),clientCode:this.clientCode,stampType:this.stampType,isWebAuth:l,cert:t?v.default.stringify(y.default.parse(t)):null,isEncrypt:this.encryptPWd,isSM:this.isSM&&"OFD"==this.fileType};null!=this.externalSign&&(c.externalSign=!0),"OFD"===this.fileType?c.data=[{sealType:r,toSignData:i,signDirPath:o,signData:e}]:c.data=e;var u=this,d=this.PDFViewerApplication.pdfStamp,h=this.isLoadComplete()?u.capability.resolve:d.renderSignatureSeals;return a.myaxios.post(this.getDocTypeUrl(),c).then(function(e){var t=e.data;t.status?s&&((0,m.closeOverlay)(),h({status:!0,textPositions:n.textPositions,successPassBackParameter:t.successPassBackParameter})):((0,m.closeOverlay)(),u.PDFViewerApplication.KGAlertPrompt.open(t.message),h({status:!1}))}).catch(function(){h({status:!1})})},sigError:function(){var e=this,t={action:"reWriteSigData",clientCode:this.clientCode,documentId:this.documentId,stampType:this.stampType,error:!0};e.getTipPrompt().close(),a.myaxios.post(this.getDocTypeUrl(),t).then(function(t){var n=t.data;e.capability.resolve(!1),n.status||e.app.KGAlertPrompt.open(n.message)})},deleteSeal:function(e,t,n,r,i,o){var s={action:"deleteSeal",documentId:this.documentId,pdfPwd:this.getPdfPwd(),keySN:this.userId,userCode:this.userCode,certOrigin:this.certOrigin,page:e,x:t,y:n,isEncrypt:this.encryptPWd,isSM:this.isSM&&"OFD"==this.fileType,appCode:this.appCode,unifySealPlatformV2:this.unifySealPlatformV2};if(this.PDFViewerApplication.KG_FJRS&&this.PDFViewerApplication.KG_FJRS.delKeySN&&(s.keySN=this.PDFViewerApplication.KG_FJRS.delKeySN),!0===this.useCaptcha?s.captcha=r:s.password=r,this.unifySealPlatformV2){var l=this.PDFViewerApplication.KG_ScanStamp_V2,c=l.code,u=l.token;s.code=c,s.token=u}return i&&o&&(s.rand=i,s.signedBase64=o),!window.KGPdfViewerWebApp.stampModel&&this.scanStamp&&(s.scanStamp=!0,s.userToken=this.PDFViewerApplication.KG_ScanStamp.userToken,s.qrcodeId=this.PDFViewerApplication.KG_ScanStamp.scanId,s.qrCodeUserUid=this.PDFViewerApplication.KG_ScanStamp.qrCodeUserUid,s.qrCodeUserName=this.PDFViewerApplication.KG_ScanStamp.qrCodeUserName),a.myaxios.post(this.getDocTypeUrl(),s)},verifySeal:function(e,t,n,r,i){var o=this.certOrigin;i&&("1"===i?o=1:"2"===i&&(o=0));var s={action:"verifySeal",documentId:this.documentId,pdfPwd:this.getPdfPwd(),certOrigin:o,isScanStamp:this.scanStamp,page:e,x:t,y:n,isEncrypt:this.encryptPWd,isSM:this.isSM&&"OFD"==this.fileType,isUkey:this.isUkey};window.KGPdfViewerWebApp.fjrs&&window.KGPdfViewerWebApp.fjrs.isFjrs&&(s.isfjrs=!0),a.myaxios.post(this.getDocTypeUrl(),s).then(function(e){r(e.data)})},verifySealOnLoad:function(e,t,n){var r={action:"verifySealOnLoad",documentId:this.documentId,pdfPwd:this.getPdfPwd(),page:e,indRefNumber:t,isEncrypt:this.encryptPWd};a.myaxios.post(this.getDocTypeUrl(),r).then(function(e){n(e.data)})},checkLastone:function(e,t,n){var r=this;this.cancelCheckLastOne&&this.cancelCheckLastOne();var i=a.axios.CancelToken,o={action:"checkLastone",documentId:this.documentId,page:e,x:t,y:n};return this.disableDelete?Promise.resolve({status:!1}):"OFD"===this.fileType||1==this.stampType||2==this.stampType||1==this.scanStamp||this.PDFViewerApplication.KG_FJRS?a.axios.post(this.getDocTypeUrl(),(0,m.transformData)(o),{cancelToken:new i(function(e){r.cancelCheckLastOne=e}),withCredentials:!0,headers:{"X-Requested-With":"XMLHttpRequest","Content-Type":"application/json"}}).then(function(e){return e.data}).catch(function(e){e instanceof a.axios.Cancel?console.log("取消请求"):r.PDFViewerApplication.KGAlertPrompt.open(e.message)}):Promise.resolve({status:!0})},transparentImg:function(e){var t={action:"imageToTransparence",imagedata:e};return a.myaxios.post(this.getDocTypeUrl(),t).then(function(e){return e.data})},getAnnotationList:function(){var e={action:"getAnnotsList",documentId:this.documentId};return a.myaxios.post(this.getDocTypeUrl(),e).then(function(e){return e.data})},addWatermark:function(e){var t=this,n={action:"addWatermark",documentId:this.documentId};for(var r in e)n[r]=e[r];return a.myaxios.post(this.getDocTypeUrl(),n).then(function(e){return e.data.status&&t.addWatermarkSuccess(),e.data})},saveAnnotations:function(e){if(!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])){var t={action:"improtAnnots",documentId:this.documentId,annotsData:e,saveAs:!1};return a.myaxios.post(this.getDocTypeUrl(),t).then(function(e){return e.data})}var n=document.getElementById("saveAnnotations");n&&n.parentNode.removeChild(n);var r=document.createElement("form");r.id="saveAnnotations",r.method="POST",r.action=this.getDocTypeUrl(),r.style.display="none",document.body.appendChild(r);var i=document.createElement("input");i.name="action",i.value="improtAnnots",r.appendChild(i);var o=document.createElement("input");o.name="documentId",o.value=this.documentId,r.appendChild(o);var s=document.createElement("input");s.name="annotsData",s.value=e,r.appendChild(s);var l=document.createElement("input");l.name="saveAs",l.value="true",r.appendChild(l),r.submit()},getLicenseInfo:function(){return a.myaxios.post(this.getDocTypeUrl(),{action:"getLicenseInfo"}).then(function(e){return e.data})},elecSigModeCheckFile:function(){if(this.checkFile&&0==this.stampType&&0==this.docType){var e={action:"elecSigModeCheckFile",documentId:this.documentId};return a.myaxios.post(this.getDocTypeUrl(),e).then(function(e){return e.data})}return Promise.resolve({status:!0})},verifyAllSeal:function(e,t,n){var r={action:"verifyAllSeal",documentId:this.documentId,saveType:t,fileUrl:e,stampSystemOrigin:window.KGPdfViewerWebApp.stampSystemOrigin},i={result:{validCount:0,invalidCount:0},errorCode:"",errorMessage:""};a.myaxios.post(this.getDocTypeUrl(),r).then(function(e){if(e.data.status){for(var t=[],n=e.data.signInfoArray,r=function(e){var r=!1,a=!1,o=n[e],s=o.effectiveness,l=o.newHash,c=o.sigData;t.push(new Promise(function(e){if(r=s){if(l&&c){var t=new g.iWebAssist({cilentType:"0"});return Promise.resolve(t.promise).then(function(){return t.verifySignMessage(l,c)}).then(function(t){t&&(a=!!t.result),e({sealEffectiveness:r,signEffectiveness:a})})}e({sealEffectiveness:r,signEffectiveness:a=!0})}else e({sealEffectiveness:r})}).then(function(e){var t=e.sealEffectiveness,n=e.signEffectiveness;t&&n?i.result.validCount++:i.result.invalidCount++}))},a=0;a<n.length;a++)r(a);return Promise.all(t)}var o=e.data.message;return Promise.reject(o||"程序异常,验证失败")}).then(function(){n(i)}).catch(function(e){console.log(e)})},getQrCodeImage:function(e,t,n){var r={action:"getQrCodeImage",scanSealType:t,esid:n,stampSystemOrigin:window.KGPdfViewerWebApp.stampSystemOrigin};switch(e){case"stamp":r.way="1";break;case"delete":r.way="2"}return a.myaxios.post(this.getDocTypeUrl(),r).then(function(e){return e.data})},getQrCodeToken:function(e){var t={action:"getQrCodeToken",qrcodeId:e,stampSystemOrigin:window.KGPdfViewerWebApp.stampSystemOrigin};return a.myaxios.post(this.getDocTypeUrl(),t).then(function(e){return e.data})},exitSession:function(e){var t={action:"exitSession",userToken:e};return a.myaxios.post(this.getDocTypeUrl(),t).then(function(e){return e.data})},certExpiryVerify:function(e,t){var n={action:"certExpiryVerify",cert:e,days:t};return a.myaxios.post(this.getDocTypeUrl(),n).then(function(e){return e.data&&1==e.data.status?e.data:Promise.reject({message:e.data.message})})},customVerifyOption:null,defaultVerifyOptionByOFD:{seal:{_map:{sealID:{value:"sealID",title:"印章序列"},signDate:{value:"signDate",title:"签章时间"},signName:{value:"sealName",title:"签名名称"},unitName:{value:"sealVid",title:"授权单位"},userName:{value:"userName",title:"用户名称"},validStart:{value:"validStart",title:"起始时间"},validEnd:{value:"validEnd",title:"截止时间"}},_show:["unitName","userName","signName","sealID","signDate","validStart","validEnd"]},cert:{_map:{issuerDN:{value:"issuerDN",title:"证书签发者"},serialNumber:{value:"serialNumber",title:"证书序列号"},sigAlg:{value:"sigAlg",title:"签名算法"},subjectDN:{value:"subjectDN",title:"证书使用者"},notBefore:{value:"notBefore",title:"起始时间"},notAfter:{value:"notAfter",title:"截止时间"}},_show:["serialNumber","subjectDN","issuerDN","sigAlg","notBefore","notAfter"]},tsa:{tsaCert:{_map:{issuerDN:{value:"issuerDN",title:"时间戳机构"},serialNumber:{value:"serialNumber",title:"证书序列号"},sigAlg:{value:"sigAlg",title:"签名算法"},subjectDN:{value:"subjectDN",title:"证书使用者"},notBefore:{value:"notBefore",title:"起始时间"},notAfter:{value:"notAfter",title:"截止时间"}},_show:["subjectDN","serialNumber","issuerDN","sigAlg","notBefore","notAfter"]},_map:{tsaTime:{value:"tsaTime",title:"签名时间"},tsaEffectiveness:{value:"tsaEffectiveness",title:"时间戳验证"}},_show:["tsaTime"]},chain:{},_map:{seal:{value:"seal",title:"签章信息"},cert:{value:"cert",title:"证书信息"},tsa:{value:"tsaInfo",title:"时间戳"},chain:{value:"chain",title:"区块链"}}},defaultVerifyOptionByPDF:{seal:{_map:{appName:{value:"appName",title:"应用程序"},signDateTime:{value:"signDateTime",title:"签章时间"},signName:{value:"signName",title:"签名名称"},signSN:{value:"signSN",title:"印章标识"},sealValidStart:{value:"sealValidStart",title:"开始时间"},sealValidEnd:{value:"sealValidEnd",title:"结束时间"}},_show:["appName","signSN","signName","sealValidStart","sealValidEnd","signDateTime"]},cert:{_map:{issuerDN:{value:"issuerDN",title:"证书签发者"},serialNumber:{value:"serialNumber",title:"证书序列号"},sigAlg:{value:"sigAlg",title:"签名算法"},subjectDN:{value:"subjectDN",title:"证书使用者"},notBefore:{value:"notBefore",title:"起始时间"},notAfter:{value:"notAfter",title:"截止时间"}},_show:["serialNumber","subjectDN","issuerDN","sigAlg","notBefore","notAfter"]},tsa:{tsaCert:{_map:{issuerDN:{value:"issuerDN",title:"时间戳机构"},serialNumber:{value:"serialNumber",title:"证书序列号"},sigAlg:{value:"sigAlg",title:"签名算法"},subjectDN:{value:"subjectDN",title:"证书使用者"},notBefore:{value:"notBefore",title:"起始时间"},notAfter:{value:"notAfter",title:"截止时间"}},_show:["subjectDN","serialNumber","issuerDN","sigAlg","notBefore","notAfter"]},_map:{tsaTime:{value:"tsaTime",title:"时间戳时间"},tsaEffectiveness:{value:"tsaEffectiveness",title:"时间戳验证"}},_show:["tsaTime"]},chain:{},_map:{seal:{value:"seal",title:"签章信息"},cert:{value:"cert",title:"证书信息"},tsa:{value:"tsaInfo",title:"时间戳"},chain:{value:"chain",title:"区块链"}}},paginSealDefaultConfig:{beginPage:1,range:"allPage",setting:1,firstPagePercent:50,otherPageNum:3,averagePageNum:2},paginSealConfig:null,singlePageSeal:!1,continuityRange:null,customScanDialog:{information:['打开"码上办事APP"','进入"电子印章服务",点击右上角扫码按钮'],imageName:"kg_extend_img.png"},password:"",pwdDefaultConfig:{defaultPwd:null,disable:!1,tips:null,tipsColor:"#868686",type:null,keepRemember:!1},watermarkConfig:{text:"金格科技",file:"",font:"黑体",size:32,color:"c9c9c9",rotate:45,opacity:80,isTiled:!1,density:100,vertical:"middle",horizontal:"center"},previewWatermark:null,getAuthCode:function(e,t){e(null)},encryptPWd:!1,aesEncrypt:function(e){return b.default.encrypt(w.default.enc.Utf8.parse(e),w.default.enc.Utf8.parse("AaBbCcDdEeFfGgH1"),{iv:w.default.enc.Utf8.parse(_),mode:w.default.mode.CBC,padding:w.default.pad.Pkcs7}).ciphertext.toString()},aesDecrypt:function(e){var t=w.default.enc.Hex.parse(e),n=w.default.enc.Base64.stringify(t);return w.default.AES.decrypt(n,w.default.enc.Utf8.parse("AaBbCcDdEeFfGgH1"),{iv:w.default.enc.Utf8.parse(_),mode:w.default.mode.CBC,padding:w.default.pad.Pkcs7}).toString(w.default.enc.Utf8).toString()},globalAnnotation:null,addDocSign:function(e){var t={action:"addAnnot",documentId:this.documentId,annots:e};return a.myaxios.post(this.getDocTypeUrl(),t)},deleteDocSign:function(e,t,n,r,i,o){var s={action:"deleteAnnot",documentId:this.documentId,page:e,x:t,y:n,authorName:o||this.globalAnnotation.author},l=this;return a.myaxios.post(this.getDocTypeUrl(),s).then(function(e){var t=e.data;(0,m.closeOverlay)().then(function(){t.status?l.deleteDocSignOnCanvas(r,i):l.PDFViewerApplication.KGAlertPrompt.open(t.message)})})},deleteDocSignOnCanvas:function(e,t){var n=e.getAttribute("data-annotation-id"),r=t.pdfPage;if(r.newDocSigns[n]?delete r.newDocSigns[n]:(r.delAnnotions||(r.delAnnotions={}),r.delAnnotions[n]=!0,r.reloadOperatorList=!0),1!=t.renderingState){var i=t.div,a=i.querySelector(".annotationLayer");e.parentNode==a&&a.removeChild(e),t.deleteStampCallback=function(){var e=i.querySelector(".canvasWrapper"),n=i.querySelector(".textLayer");e&&i.removeChild(e),n&&i.removeChild(n);var a=window.KGPdfViewerWebApp.PDFViewerApplication.pdfThumbnailViewer.getThumbnail(r.pageIndex);a.renderingState=0,a.setImage(t)},t.renderingState=0,t.renderingQueue.renderView(t)}else t.reRenderWait=!0},certFromKey:!1,getExternalToken:null,isLoadComplete:function(){return!!window.KGPdfViewerWebApp.documentLoaded},enableButtons:function(){[].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)}(document.querySelectorAll(".kg_disabled"))).forEach(function(e){e.removeAttribute("disabled"),e.classList.remove("kg_disabled")})},chainStamp:!0,postEncrypt:!1,cancelStampCallback:function(){},isSM:!1,isUkey:!1,systemStampMode:null,stampModel:null,rangeChunkSize:1048576,repairJpegConfig:{size:0,opacity:75},repairJpegXObjectByIE:function(e){var t=e.width,n=e.height,r=e.callback,i=window.KGPdfViewerWebApp.repairJpegConfig,a=i.size,o=i.opacity;if((0,m.isIE)()&&a){var s=(0,m.pxConversionMm)(t),l=(0,m.pxConversionMm)(n),c=10*a;(s<c||l<c)&&r&&r(o/100)}},stampMask:null,downloadDoc:function(){var e=window.KGPdfViewerWebApp,t=e.url,n=e.documentId;(0,m.download)(t,n)},stampSystemOrigin:1,unifySealPlatformV2:!1,fingerPrint:null};window.KGPdfViewerWebApp=P,window.exportKGBookmarks=P.exportKGBookmarks.bind(window.KGPdfViewerWebApp),window.navigateToKGBookmarks=P.navigateToKGBookmark.bind(window.KGPdfViewerWebApp),window.exportKGAnnotationList=P.exportKGAnnotationList.bind(window.KGPdfViewerWebApp),window.navigateToKGAnnotation=P.navigateToKGAnnotation.bind(window.KGPdfViewerWebApp),window.setAppCode=P.setAppCode.bind(window.KGPdfViewerWebApp),window.getAuthCode=P.getAuthCode.bind(window.KGPdfViewerWebApp),null!=P.externalSign&&(window.KGPdfViewerWebApp.externalSignCallback=window.KGPdfViewerWebApp.externalSign=P.externalSign.bind(window.KGPdfViewerWebApp)),window.verifyAllSeal=P.verifyAllSeal.bind(window.KGPdfViewerWebApp),t.KGPdfViewerWebApp=P},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KGAnnotationViewer=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}}();t.setBorder=s;var i=n(23),a=n(94),o=n(24);function s(e){for(var t=document.getElementsByClassName("stampAnnotation"),n=0;n<t.length;n++)t[n].style.border&&(t[n].style.border="");e&&"SECTION"===e.nodeName&&(e.style.border="1px dashed #000")}var l=function(){function e(t){var n=t.app,r=t.container,i=t.button;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.app=n,this.container=r,this.button=i,this.annotationList=[],!0===window.KGPdfViewerWebApp.textToSeal||null!=window.KGPdfViewerWebApp.annotationVisibleType?this.app.pdfViewer.container.addEventListener("click",s):this.button.style.display="none"}return r(e,[{key:"init",value:function(){var e=this;window.KGPdfViewerWebApp.getAnnotationList().then(function(t){t&&t instanceof Array==!0?e.annotationList=t.map(function(e){return e.x=e.X,e.y=e.Y,e.page=e.pageNo,delete e.X,delete e.Y,delete e.pageNo,e}):e.annotationList=[],e.renderList()})}},{key:"renderList",value:function(){var e=this;this.container.innerHTML="";var t=this.formatSealsData(),n=void 0;null!=window.KGPdfViewerWebApp.annotationVisibleType?n=window.KGPdfViewerWebApp.annotationVisibleType:window.KGPdfViewerWebApp.textToSealDefault.visibleType&&(n=window.KGPdfViewerWebApp.textToSealDefault.visibleType),(n?this.annotationList.concat(t).filter(function(e){try{var t=JSON.parse(e.annotInfo);return!(!t||!t.hasOwnProperty("customType"))&&t.customType.toString()===n}catch(e){return!1}}).sort(function(e,t){return Number(e.page||e.pageNo)-Number(t.page||t.pageNo)}):[]).forEach(function(t){var n=document.createElement("div");n.setAttribute("class","annotationItem");var r=document.createElement("a"),a=Number(t.page||t.pageNo);r.title=r.innerText="第"+a+"页 "+t.authorName+"\n"+t.createTime;var l=e.app.pdfViewer,c=l.getPageView(a-1),u=c.viewport.viewBox[3]-t.y,d=[{num:a,gen:0},{name:"XYZ"},t.x,u,0];r.onclick=function(){l.scrollPageIntoView({pageNumber:a,destArray:d}),c.onAfterDraw=function(){for(var e=c.annotationLayer.div.getElementsByTagName("section"),n=void 0,r=0;r<e.length;r++){var i=Math.round((0,o.getNumbOfPx)(e[r].style.left)),a=Math.round(t.x),l=Math.round((0,o.getNumbOfPx)(e[r].style.top)),u=Math.round(t.y);if(i>=a-3&&i<=a+3&&l>=u-3&&l<=u+3){n=e[r];break}}n&&s(n),c.onAfterDraw=null},c.destroy(),c.renderingState=i.RenderingStates.INITIAL,c.draw(),l.update()},n.appendChild(r),e.container.appendChild(n)})}},{key:"formatSealsData",value:function(){var e=this.app.KGTextToSeal?(0,a.arrayDeepCopy)(this.app.KGTextToSeal.seals):[];return e.forEach(function(e){e.x=e.left,e.y=e.top,e.authorName=window.KGPdfViewerWebApp.userId,delete e.createTime,delete e.imgData,delete e.height,delete e.width,delete e.section,delete e.top,delete e.left}),e}}]),e}();t.KGAnnotationViewer=l},function(e,t,n){"use strict";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){"use strict";var r,i,a,o,s="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=function(e){return e.defineLocale("zh-cn",{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日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点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||"晚上"===t?e+12:e>=11?e:e+12},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:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",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 年"},week:{dow:1,doy:4}})},"object"===s(t)&&void 0!==e?o(n(60)):(i=[n(60)],void 0===(a="function"==typeof(r=o)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){"use strict";var r,i,a,o,s,l,c,u,d,h,p,f,m,g,v,y,b="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=window.layui&&layui.define,s={getPath:(i=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,n=t.length-1,r=n;r>0;r--)if("interactive"===t[r].readyState){e=t[r].src;break}return e||t[n].src}(),i.substring(0,i.lastIndexOf("/")+1)),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,t,n){if(l.path){var r=document.getElementsByTagName("head")[0],i=document.createElement("link");"string"==typeof t&&(n=t);var a="layuicss-"+(n||e).replace(/\.|\//g,""),o=0;i.rel="stylesheet",i.href=l.path+e,i.id=a,document.getElementById(a)||r.appendChild(i),"function"==typeof t&&function e(){if(++o>80)return window.console&&console.error("laydate.css: Invalid");1989===parseInt(s.getStyle(document.getElementById(a),"width"))?t():setTimeout(e,100)}()}}},l={v:"5.0.9",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:s.getPath,set:function(e){return this.config=v.extend({},this.config,e),this},ready:function(e){var t=(o?"modules/laydate/":"theme/")+"default/laydate.css?v="+l.v;return o?layui.addcss(t,e,"laydate"):s.link(t,e,"laydate"),this}},c="layui-this",u="laydate-disabled",d="开始日期超出了结束日期<br>建议重新选择",h=[100,2e5],p="layui-laydate-list",f="layui-laydate-hint",m=".laydate-btns-confirm",g=function(e){var t=this;t.index=++l.index,t.config=v.extend({},t.config,l.config,e),l.ready(function(){t.init()})},v=function(e){return new y(e)},(y=function(e){for(var t=0,n="object"===(void 0===e?"undefined":b(e))?[e]:(this.selector=e,document.querySelectorAll(e||null));t<n.length;t++)this.push(n[t])}).prototype=[],y.prototype.constructor=y,v.extend=function(){var e=1,t=arguments,n=function e(t,n){for(var r in t=t||(n.constructor===Array?[]:{}),n)t[r]=n[r]&&n[r].constructor===Object?e(t[r],n[r]):n[r];return t};for(t[0]="object"===b(t[0])?t[0]:{};e<t.length;e++)"object"===b(t[e])&&n(t[0],t[e]);return t[0]},v.ie=(a=navigator.userAgent.toLowerCase(),!!(window.ActiveXObject||"ActiveXObject"in window)&&((a.match(/msie\s(\d+)/)||[])[1]||"11")),v.stope=function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!0},v.each=function(e,t){var n;if("function"!=typeof t)return this;if((e=e||[]).constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;n<e.length&&!t.call(e[n],n,e[n]);n++);return this},v.digit=function(e,t,n){var r="";e=String(e),t=t||2;for(var i=e.length;i<t;i++)r+="0";return e<Math.pow(10,t)?r+(0|e):e},v.elem=function(e,t){var n=document.createElement(e);return v.each(t||{},function(e,t){n.setAttribute(e,t)}),n},y.addStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),v.each(t,function(t,n){new RegExp("\\b"+n+"\\b").test(e)||(e=e+" "+n)}),e.replace(/^\s|\s$/,"")},y.removeStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),v.each(t,function(t,n){var r=new RegExp("\\b"+n+"\\b");r.test(e)&&(e=e.replace(r,""))}),e.replace(/\s+/," ").replace(/^\s|\s$/,"")},y.prototype.find=function(e){var t=this,n=0,r=[],i="object"===(void 0===e?"undefined":b(e));return this.each(function(a,o){for(var s=i?[e]:o.querySelectorAll(e||null);n<s.length;n++)r.push(s[n]);t.shift()}),i||(t.selector=(t.selector?t.selector+" ":"")+e),v.each(r,function(e,n){t.push(n)}),t},y.prototype.each=function(e){return v.each.call(this,this,e)},y.prototype.addClass=function(e,t){return this.each(function(n,r){r.className=y[t?"removeStr":"addStr"](r.className,e)})},y.prototype.removeClass=function(e){return this.addClass(e,!0)},y.prototype.hasClass=function(e){var t=!1;return this.each(function(n,r){new RegExp("\\b"+e+"\\b").test(r.className)&&(t=!0)}),t},y.prototype.attr=function(e,t){var n=this;return void 0===t?function(){if(n.length>0)return n[0].getAttribute(e)}():n.each(function(n,r){r.setAttribute(e,t)})},y.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},y.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},y.prototype.val=function(e){return this.each(function(t,n){n.value=e})},y.prototype.append=function(e){return this.each(function(t,n){"object"===(void 0===e?"undefined":b(e))?n.appendChild(e):n.innerHTML=n.innerHTML+e})},y.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},y.prototype.on=function(e,t){return this.each(function(n,r){r.attachEvent?r.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(r,e)}):r.addEventListener(e,t,!1)})},y.prototype.off=function(e,t){return this.each(function(n,r){r.detachEvent?r.detachEvent("on"+e,t):r.removeEventListener(e,t,!1)})},g.isLeapYear=function(e){return e%4==0&&e%100!=0||e%400==0},g.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},g.prototype.lang=function(){var e={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return e[this.config.lang]||e.cn},g.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",r="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=v(t.elem),t.eventElem=v(t.eventElem),t.elem[0]&&(!0===t.range&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",v.each(e.format,function(t,r){var i=new RegExp(n).test(r)?"\\d{"+(new RegExp(n).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(r)?4:r.length:/^yyyy$/.test(r)?"1,4":/^y$/.test(r)?"1,308":"1,2")+"}":"\\"+r;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=v.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),v.each(["min","max"],function(e,n){var r=[],i=[];if("number"==typeof t[n]){var a=t[n],o=(new Date).getTime(),s=new Date(a?a<864e5?o+864e5*a:a:o);r=[s.getFullYear(),s.getMonth()+1,s.getDate()],a<864e5||(i=[s.getHours(),s.getMinutes(),s.getSeconds()])}else r=(t[n].match(/\d+-\d+-\d+/)||[""])[0].split("-"),i=(t[n].match(/\d+:\d+:\d+/)||[""])[0].split(":");t[n]={year:0|r[0]||(new Date).getFullYear(),month:r[1]?(0|r[1])-1:(new Date).getMonth(),date:0|r[2]||(new Date).getDate(),hours:0|i[0],minutes:0|i[1],seconds:0|i[2]}}),e.elemID="layui-laydate"+t.elem.attr("lay-key"),(t.show||r)&&e.render(),r||e.events(),t.value&&(t.value.constructor===Date?e.setValue(e.parse(0,e.systemDate(t.value))):e.setValue(t.value)))},g.prototype.render=function(){var e,t,n=this.config,r=this.lang(),i="static"===n.position,a=this.elem=v.elem("div",{id:this.elemID,class:["layui-laydate",n.range?" layui-laydate-range":"",i?" layui-laydate-static":"",n.theme&&"default"!==n.theme&&!/^#/.test(n.theme)?" laydate-theme-"+n.theme:""].join("")}),o=this.elemMain=[],s=this.elemHeader=[],l=this.elemCont=[],c=this.table=[],u=this.footer=v.elem("div",{class:"layui-laydate-footer"});if(n.zIndex&&(a.style.zIndex=n.zIndex),v.each(new Array(2),function(e){if(!n.range&&e>0)return!0;var t,i=v.elem("div",{class:"layui-laydate-header"}),a=[(t=v.elem("i",{class:"layui-icon laydate-icon laydate-prev-y"}),t.innerHTML="&#xe65a;",t),function(){var e=v.elem("i",{class:"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="&#xe603;",e}(),function(){var e=v.elem("div",{class:"laydate-set-ym"}),t=v.elem("span"),n=v.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=v.elem("i",{class:"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="&#xe602;",e}(),function(){var e=v.elem("i",{class:"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="&#xe65b;",e}()],u=v.elem("div",{class:"layui-laydate-content"}),d=v.elem("table"),h=v.elem("thead"),p=v.elem("tr");v.each(a,function(e,t){i.appendChild(t)}),h.appendChild(p),v.each(new Array(6),function(e){var t=d.insertRow(0);v.each(new Array(7),function(n){if(0===e){var i=v.elem("th");i.innerHTML=r.weeks[n],p.appendChild(i)}t.insertCell(n)})}),d.insertBefore(h,d.children[0]),u.appendChild(d),o[e]=v.elem("div",{class:"layui-laydate-main laydate-main-list-"+e}),o[e].appendChild(i),o[e].appendChild(u),s.push(a),l.push(u),c.push(d)}),v(u).html((e=[],t=[],"datetime"===n.type&&e.push('<span lay-type="datetime" class="laydate-btns-time">'+r.timeTips+"</span>"),v.each(n.btns,function(e,a){var o=r.tools[a]||"btn";n.range&&"now"===a||(i&&"clear"===a&&(o="cn"===n.lang?"重置":"Reset"),t.push('<span lay-type="'+a+'" class="laydate-btns-'+a+'">'+o+"</span>"))}),e.push('<div class="laydate-footer-btns">'+t.join("")+"</div>"),e.join(""))),v.each(o,function(e,t){a.appendChild(t)}),n.showBottom&&a.appendChild(u),/^#/.test(n.theme)){var d=v.elem("style"),h=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,this.elemID).replace(/{{theme}}/g,n.theme);"styleSheet"in d?(d.setAttribute("type","text/css"),d.styleSheet.cssText=h):d.innerHTML=h,v(a).addClass("laydate-theme-molv"),a.appendChild(d)}this.remove(g.thisElemDate),i?n.elem.append(a):(document.body.appendChild(a),this.position()),this.checkDate().calendar(),this.changeEvent(),g.thisElemDate=this.elemID,"function"==typeof n.ready&&n.ready(v.extend({},n.dateTime,{month:n.dateTime.month+1}))},g.prototype.remove=function(e){this.config;var t=v("#"+(e||this.elemID));return t.hasClass("layui-laydate-static")||this.checkDate(function(){t.remove()}),this},g.prototype.position=function(){var e=this.config,t=(this.bindElem||e.elem[0]).getBoundingClientRect(),n=this.elem.offsetWidth,r=this.elem.offsetHeight,i=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},a=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},o=t.left,s=t.bottom;o+n+5>a("width")&&(o=a("width")-n-5),s+r+5>a()&&(s=t.top>r?t.top-r:a()-r,s-=10),e.position&&(this.elem.style.position=e.position),this.elem.style.left=o+("fixed"===e.position?0:i(1))+"px",this.elem.style.top=s+("fixed"===e.position?0:i())+"px"},g.prototype.hint=function(e){var t=this,n=(t.config,v.elem("div",{class:f}));n.innerHTML=e||"",v(t.elem).find("."+f).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){v(t.elem).find("."+f).remove()},3e3)},g.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},g.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},g.prototype.checkDate=function(e){var t,n,r=this,i=(new Date,r.config),a=i.dateTime=i.dateTime||r.systemDate(),o=r.bindElem||i.elem[0],s=(r.isInput(o),r.isInput(o)?o.value:"static"===i.position?"":o.innerHTML),c=function(e){e.year>h[1]&&(e.year=h[1],n=!0),e.month>11&&(e.month=11,n=!0),e.hours>23&&(e.hours=0,n=!0),e.minutes>59&&(e.minutes=0,e.hours++,n=!0),e.seconds>59&&(e.seconds=0,e.minutes++,n=!0),t=l.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,n=!0)},u=function(e,t,a){var o=["startTime","endTime"];t=(t.match(r.EXP_SPLIT)||[]).slice(1),a=a||0,i.range&&(r[o[a]]=r[o[a]]||{}),v.each(r.format,function(s,l){var c=parseFloat(t[s]);t[s].length<l.length&&(n=!0),/yyyy|y/.test(l)?(c<h[0]&&(c=h[0],n=!0),e.year=c):/MM|M/.test(l)?(c<1&&(c=1,n=!0),e.month=c-1):/dd|d/.test(l)?(c<1&&(c=1,n=!0),e.date=c):/HH|H/.test(l)?(c<1&&(c=0,n=!0),e.hours=c,i.range&&(r[o[a]].hours=c)):/mm|m/.test(l)?(c<1&&(c=0,n=!0),e.minutes=c,i.range&&(r[o[a]].minutes=c)):/ss|s/.test(l)&&(c<1&&(c=0,n=!0),e.seconds=c,i.range&&(r[o[a]].seconds=c))}),c(e)};return"limit"===e?(c(a),r):("string"==typeof(s=s||i.value)&&(s=s.replace(/\s+/g," ").replace(/^\s|\s$/g,"")),r.startState&&!r.endState&&(delete r.startState,r.endState=!0),"string"==typeof s&&s?r.EXP_IF.test(s)?i.range?(s=s.split(" "+i.range+" "),r.startDate=r.startDate||r.systemDate(),r.endDate=r.endDate||r.systemDate(),i.dateTime=v.extend({},r.startDate),v.each([r.startDate,r.endDate],function(e,t){u(t,s[e],e)})):u(a,s):(r.hint("日期格式不合法<br>必须遵循下述格式:<br>"+(i.range?i.format+" "+i.range+" "+i.format:i.format)+"<br>已为你重置"),n=!0):s&&s.constructor===Date?i.dateTime=r.systemDate(s):(i.dateTime=r.systemDate(),delete r.startState,delete r.endState,delete r.startDate,delete r.endDate,delete r.startTime,delete r.endTime),c(a),n&&s&&r.setValue(i.range?r.endDate?r.parse():"":r.parse()),e&&e(),r)},g.prototype.mark=function(e,t){var n,r=this.config;return v.each(r.mark,function(e,r){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=r||t[2])}),n&&e.html('<span class="laydate-day-mark">'+n+"</span>"),this},g.prototype.limit=function(e,t,n,r){var i,a=this,o=a.config,s={},l=o[n>41?"endDate":"dateTime"],c=v.extend({},l,t||{});return v.each({now:c,min:o.min,max:o.max},function(e,t){var n;s[e]=a.newDate(v.extend({year:t.year,month:t.month,date:t.date},(n={},v.each(r,function(e,r){n[r]=t[r]}),n))).getTime()}),i=s.now<s.min||s.now>s.max,e&&e[i?"addClass":"removeClass"](u),i},g.prototype.calendar=function(e){var t,n,r,i=this,a=i.config,o=e||a.dateTime,s=new Date,u=i.lang(),d="date"!==a.type&&"datetime"!==a.type,p=e?1:0,f=v(i.table[p]).find("td"),g=v(i.elemHeader[p][2]).find("span");if(o.year<h[0]&&(o.year=h[0],i.hint("最低只能支持到公元"+h[0]+"年")),o.year>h[1]&&(o.year=h[1],i.hint("最高只能支持到公元"+h[1]+"年")),i.firstDate||(i.firstDate=v.extend({},o)),s.setFullYear(o.year,o.month,1),t=s.getDay(),n=l.getEndDate(o.month||12,o.year),r=l.getEndDate(o.month+1,o.year),v.each(f,function(e,s){var l=[o.year,o.month],u=0;(s=v(s)).removeAttr("class"),e<t?(u=n-t+e,s.addClass("laydate-day-prev"),l=i.getAsYM(o.year,o.month,"sub")):e>=t&&e<r+t?(u=e-t,a.range||u+1===o.date&&s.addClass(c)):(u=e-r-t,s.addClass("laydate-day-next"),l=i.getAsYM(o.year,o.month)),l[1]++,l[2]=u+1,s.attr("lay-ymd",l.join("-")).html(l[2]),i.mark(s,l).limit(s,{year:l[0],month:l[1]-1,date:l[2]},e)}),v(g[0]).attr("lay-ym",o.year+"-"+(o.month+1)),v(g[1]).attr("lay-ym",o.year+"-"+(o.month+1)),"cn"===a.lang?(v(g[0]).attr("lay-type","year").html(o.year+"年"),v(g[1]).attr("lay-type","month").html(o.month+1+"月")):(v(g[0]).attr("lay-type","month").html(u.month[o.month]),v(g[1]).attr("lay-type","year").html(o.year)),d&&(a.range&&(e?i.endDate=i.endDate||{year:o.year+("year"===a.type?1:0),month:o.month+("month"===a.type?0:-1)}:i.startDate=i.startDate||{year:o.year,month:o.month},e&&(i.listYM=[[i.startDate.year,i.startDate.month+1],[i.endDate.year,i.endDate.month+1]],i.list(a.type,0).list(a.type,1),"time"===a.type?i.setBtnStatus("时间",v.extend({},i.systemDate(),i.startTime),v.extend({},i.systemDate(),i.endTime)):i.setBtnStatus(!0))),a.range||(i.listYM=[[o.year,o.month+1]],i.list(a.type,0))),a.range&&!e){var y=i.getAsYM(o.year,o.month);i.calendar(v.extend({},o,{year:y[0],month:y[1]}))}return a.range||i.limit(v(i.footer).find(m),null,0,["hours","minutes","seconds"]),a.range&&e&&!d&&i.stampRange(),i},g.prototype.list=function(e,t){var n=this,r=n.config,i=r.dateTime,a=n.lang(),o=r.range&&"date"!==r.type&&"datetime"!==r.type,s=v.elem("ul",{class:p+" "+{year:"laydate-year-list",month:"laydate-month-list",time:"laydate-time-list"}[e]}),l=n.elemHeader[t],d=v(l[2]).find("span"),h=n.elemCont[t||0],f=v(h).find("."+p)[0],g="cn"===r.lang,y=g?"年":"",b=n.listYM[t]||{},w=["hours","minutes","seconds"],S=["startTime","endTime"][t];if(b[0]<1&&(b[0]=1),"year"===e){var _,P=_=b[0]-7;P<1&&(P=_=1),v.each(new Array(15),function(e){var i=v.elem("li",{"lay-ym":_}),a={year:_};_==b[0]&&v(i).addClass(c),i.innerHTML=_+y,s.appendChild(i),_<n.firstDate.year?(a.month=r.min.month,a.date=r.min.date):_>=n.firstDate.year&&(a.month=r.max.month,a.date=r.max.date),n.limit(v(i),a,t),_++}),v(d[g?0:1]).attr("lay-ym",_-8+"-"+b[1]).html(P+y+" - "+(_-1+y))}else if("month"===e)v.each(new Array(12),function(e){var i=v.elem("li",{"lay-ym":e}),o={year:b[0],month:e};e+1==b[1]&&v(i).addClass(c),i.innerHTML=a.month[e]+(g?"月":""),s.appendChild(i),b[0]<n.firstDate.year?o.date=r.min.date:b[0]>=n.firstDate.year&&(o.date=r.max.date),n.limit(v(i),o,t)}),v(d[g?0:1]).attr("lay-ym",b[0]+"-"+b[1]).html(b[0]+y);else if("time"===e){var A=function(){v(s).find("ol").each(function(e,r){v(r).find("li").each(function(r,i){n.limit(v(i),[{hours:r},{hours:n[S].hours,minutes:r},{hours:n[S].hours,minutes:n[S].minutes,seconds:r}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),r.range||n.limit(v(n.footer).find(m),n[S],0,["hours","minutes","seconds"])};r.range?n[S]||(n[S]={hours:0,minutes:0,seconds:0}):n[S]=i,v.each([24,60,60],function(e,t){var r=v.elem("li"),i=["<p>"+a.time[e]+"</p><ol>"];v.each(new Array(t),function(t){i.push("<li"+(n[S][w[e]]===t?' class="'+c+'"':"")+">"+v.digit(t,2)+"</li>")}),r.innerHTML=i.join("")+"</ol>",s.appendChild(r)}),A()}if(f&&h.removeChild(f),h.appendChild(s),"year"===e||"month"===e)v(n.elemMain[t]).addClass("laydate-ym-show"),v(s).find("li").on("click",function(){var a=0|v(this).attr("lay-ym");if(!v(this).hasClass(u)){if(0===t)i[e]=a,o&&(n.startDate[e]=a),n.limit(v(n.footer).find(m),null,0);else if(o)n.endDate[e]=a;else{var l="year"===e?n.getAsYM(a,b[1]-1,"sub"):n.getAsYM(b[0],a,"sub");v.extend(i,{year:l[0],month:l[1]})}"year"===r.type||"month"===r.type?(v(s).find("."+c).removeClass(c),v(this).addClass(c),"month"===r.type&&"year"===e&&(n.listYM[t][0]=a,o&&(n[["startDate","endDate"][t]].year=a),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),r.range||n.done(null,"change"),v(n.footer).find(".laydate-btns-time").removeClass(u)}});else{var k=v.elem("span",{class:"laydate-time-text"}),C=function(){v(s).find("ol").each(function(e){var t=this,r=v(t).find("li");t.scrollTop=30*(n[S][w[e]]-2),t.scrollTop<=0&&r.each(function(e,n){if(!v(this).hasClass(u))return t.scrollTop=30*(e-2),!0})})},x=v(l[2]).find(".laydate-time-text");C(),k.innerHTML=r.range?[a.startTime,a.endTime][t]:a.timeTips,v(n.elemMain[t]).addClass("laydate-time-show"),x[0]&&x.remove(),l[2].appendChild(k),v(s).find("ol").each(function(e){var t=this;v(t).find("li").on("click",function(){var a=0|this.innerHTML;v(this).hasClass(u)||(r.range?n[S][w[e]]=a:i[w[e]]=a,v(t).find("."+c).removeClass(c),v(this).addClass(c),A(),C(),(n.endDate||"time"===r.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},g.prototype.listYM=[],g.prototype.closeList=function(){var e=this;e.config,v.each(e.elemCont,function(t,n){v(this).find("."+p).remove(),v(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),v(e.elem).find(".laydate-time-text").remove()},g.prototype.setBtnStatus=function(e,t,n){var r,i=this.config,a=v(this.footer).find(m);i.range&&"date"!==i.type&&"time"!==i.type&&(t=t||this.startDate,n=n||this.endDate,r=this.newDate(t).getTime()>this.newDate(n).getTime(),this.limit(null,t)||this.limit(null,n)?a.addClass(u):a[r?"addClass":"removeClass"](u),e&&r&&this.hint("string"==typeof e?d.replace(/日期/g,e):d))},g.prototype.parse=function(e,t){var n=this.config,r=t||(e?v.extend({},this.endDate,this.endTime):n.range?v.extend({},this.startDate,this.startTime):n.dateTime),i=this.format.concat();return v.each(i,function(e,t){/yyyy|y/.test(t)?i[e]=v.digit(r.year,t.length):/MM|M/.test(t)?i[e]=v.digit(r.month+1,t.length):/dd|d/.test(t)?i[e]=v.digit(r.date,t.length):/HH|H/.test(t)?i[e]=v.digit(r.hours,t.length):/mm|m/.test(t)?i[e]=v.digit(r.minutes,t.length):/ss|s/.test(t)&&(i[e]=v.digit(r.seconds,t.length))}),n.range&&!e?i.join("")+" "+n.range+" "+this.parse(1):i.join("")},g.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},g.prototype.setValue=function(e){var t=this.config,n=this.bindElem||t.elem[0],r=this.isInput(n)?"val":"html";return"static"===t.position||v(n)[r](e||""),this},g.prototype.stampRange=function(){var e,t,n=this,r=n.config,i=v(n.elem).find("td");if(r.range&&!n.endDate&&v(n.footer).find(m).addClass(u),n.endDate){if(e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t)return n.hint(d);v.each(i,function(r,i){var a=v(i).attr("lay-ymd").split("-"),o=n.newDate({year:a[0],month:a[1]-1,date:a[2]}).getTime();v(i).removeClass("laydate-selected "+c),o!==e&&o!==t||v(i).addClass(v(i).hasClass("laydate-day-prev")||v(i).hasClass("laydate-day-next")?"laydate-selected":c),o>e&&o<t&&v(i).addClass("laydate-selected")})}},g.prototype.done=function(e,t){var n=this.config,r=v.extend({},this.startDate?v.extend(this.startDate,this.startTime):n.dateTime),i=v.extend({},v.extend(this.endDate,this.endTime));return v.each([r,i],function(e,t){"month"in t&&v.extend(t,{month:t.month+1})}),e=e||[this.parse(),r,i],"function"==typeof n[t||"done"]&&n[t||"done"].apply(n,e),this},g.prototype.choose=function(e){var t=this,n=t.config,r=n.dateTime,i=v(t.elem).find("td"),a=e.attr("lay-ymd").split("-"),o=function(e){new Date,e&&v.extend(r,a),n.range&&(t.startDate?v.extend(t.startDate,a):t.startDate=v.extend({},a,t.startTime),t.startYMD=a)};if(a={year:0|a[0],month:(0|a[1])-1,date:0|a[2]},!e.hasClass(u))if(n.range){if(v.each(["startTime","endTime"],function(e,n){t[n]=t[n]||{hours:0,minutes:0,seconds:0}}),t.endState)o(),delete t.endState,delete t.endDate,t.startState=!0,i.removeClass(c+" laydate-selected"),e.addClass(c);else if(t.startState){if(e.addClass(c),t.endDate?v.extend(t.endDate,a):t.endDate=v.extend({},a,t.endTime),t.newDate(a).getTime()<t.newDate(t.startYMD).getTime()){var s=v.extend({},t.endDate,{hours:t.startDate.hours,minutes:t.startDate.minutes,seconds:t.startDate.seconds});v.extend(t.endDate,t.startDate,{hours:t.endDate.hours,minutes:t.endDate.minutes,seconds:t.endDate.seconds}),t.startDate=s}n.showBottom||t.done(),t.stampRange(),t.endState=!0,t.done(null,"change")}else e.addClass(c),o(),t.startState=!0;v(t.footer).find(m)[t.endDate?"removeClass":"addClass"](u)}else"static"===n.position?(o(!0),t.calendar().done().done(null,"change")):"date"===n.type?(o(!0),t.setValue(t.parse()).remove().done()):"datetime"===n.type&&(o(!0),t.calendar().done(null,"change"))},g.prototype.tool=function(e,t){var n=this,r=n.config,i=r.dateTime,a="static"===r.position,o={datetime:function(){v(e).hasClass(u)||(n.list("time",0),r.range&&n.list("time",1),v(e).attr("lay-type","date").html(n.lang().dateTips))},date:function(){n.closeList(),v(e).attr("lay-type","datetime").html(n.lang().timeTips)},clear:function(){n.setValue("").remove(),a&&(v.extend(i,n.firstDate),n.calendar()),r.range&&(delete n.startState,delete n.endState,delete n.endDate,delete n.startTime,delete n.endTime),n.done(["",{},{}])},now:function(){var e=new Date;v.extend(i,n.systemDate(),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()}),n.setValue(n.parse()).remove(),a&&n.calendar(),n.done()},confirm:function(){if(r.range){if(!n.endDate)return n.hint("请先选择日期范围");if(v(e).hasClass(u))return n.hint("time"===r.type?d.replace(/日期/g,"时间"):d)}else if(v(e).hasClass(u))return n.hint("不在有效日期或时间范围内");n.done(),n.setValue(n.parse()).remove()}};o[t]&&o[t]()},g.prototype.change=function(e){var t=this,n=t.config,r=n.dateTime,i=n.range&&("year"===n.type||"month"===n.type),a=t.elemCont[e||0],o=t.listYM[e],s=function(s){var l=["startDate","endDate"][e],c=v(a).find(".laydate-year-list")[0],u=v(a).find(".laydate-month-list")[0];return c&&(o[0]=s?o[0]-15:o[0]+15,t.list("year",e)),u&&(s?o[0]--:o[0]++,t.list("month",e)),(c||u)&&(v.extend(r,{year:o[0]}),i&&(t[l].year=o[0]),n.range||t.done(null,"change"),t.setBtnStatus(),n.range||t.limit(v(t.footer).find(m),{year:o[0]})),c||u};return{prevYear:function(){s("sub")||(r.year--,t.checkDate("limit").calendar(),n.range||t.done(null,"change"))},prevMonth:function(){var e=t.getAsYM(r.year,r.month,"sub");v.extend(r,{year:e[0],month:e[1]}),t.checkDate("limit").calendar(),n.range||t.done(null,"change")},nextMonth:function(){var e=t.getAsYM(r.year,r.month);v.extend(r,{year:e[0],month:e[1]}),t.checkDate("limit").calendar(),n.range||t.done(null,"change")},nextYear:function(){s()||(r.year++,t.checkDate("limit").calendar(),n.range||t.done(null,"change"))}}},g.prototype.changeEvent=function(){var e=this;e.config,v(e.elem).on("click",function(e){v.stope(e)}),v.each(e.elemHeader,function(t,n){v(n[0]).on("click",function(n){e.change(t).prevYear()}),v(n[1]).on("click",function(n){e.change(t).prevMonth()}),v(n[2]).find("span").on("click",function(n){var r=v(this),i=r.attr("lay-ym"),a=r.attr("lay-type");i&&(i=i.split("-"),e.listYM[t]=[0|i[0],0|i[1]],e.list(a,t),v(e.footer).find(".laydate-btns-time").addClass(u))}),v(n[3]).on("click",function(n){e.change(t).nextMonth()}),v(n[4]).on("click",function(n){e.change(t).nextYear()})}),v.each(e.table,function(t,n){v(n).find("td").on("click",function(){e.choose(v(this))})}),v(e.footer).find("span").on("click",function(){var t=v(this).attr("lay-type");e.tool(this,t)})},g.prototype.isInput=function(e){return/input|textarea/.test(e.tagName.toLocaleLowerCase())},g.prototype.events=function(){var e=this,t=e.config,n=function(n,r){n.on(t.trigger,function(){r&&(e.bindElem=this),e.render()})};t.elem[0]&&!t.elem[0].eventHandler&&(n(t.elem,"bind"),n(t.eventElem),v(document).on("click",function(n){n.target!==t.elem[0]&&n.target!==t.eventElem[0]&&n.target!==v(t.closeStop)[0]&&e.remove()}).on("keydown",function(t){13===t.keyCode&&v("#"+e.elemID)[0]&&e.elemID===g.thisElem&&(t.preventDefault(),v(e.footer).find(m)[0].click())}),v(window).on("resize",function(){if(!e.elem||!v(".layui-laydate")[0])return!1;e.position()}),t.elem[0].eventHandler=!0)},l.render=function(e){var t=new g(e);return function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}}.call(t)},l.getEndDate=function(e,t){var n=new Date;return n.setFullYear(t||n.getFullYear(),e||n.getMonth()+1,1),new Date(n.getTime()-864e5).getDate()},window.lay=window.lay||v,o?(l.ready(),layui.define(function(e){l.path=layui.cache.dir,e("laydate",l)})):void 0===(r=function(){return l}.call(t,n,t,e))||(e.exports=r)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!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}}();var i=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.overlayName=t.appConfig.kgConfirmOverlay.overlayName,this.container=t.appConfig.kgConfirmOverlay.container,this.okButton=t.appConfig.kgConfirmOverlay.okButton,this.cancelButton=t.appConfig.kgConfirmOverlay.cancelButton,this.okCallback=null,this.cancelCallback=null,this.overlayManager=n,this.overlayManager.register(this.overlayName,this.container,this.close.bind(this),!0)}return r(e,[{key:"setContent",value:function(e){document.getElementById(this.overlayName).querySelector("p").innerHTML=e}},{key:"open",value:function(){this.overlayManager.open(this.overlayName)}},{key:"close",value:function(){var e=this;this.overlayManager.close(this.overlayName).then(function(){e.app.KG_ScanStamp&&e.app.KG_ScanStamp.clearSealData(),e.cancelCallback&&e.cancelCallback()})}},{key:"ok",value:function(){var e=this;this.overlayManager.close(this.overlayName).then(function(){e.okCallback&&e.okCallback()})}},{key:"setOKCallback",value:function(e){this.okCallback=null!=e?e:null,this.okButton.onclick=this.ok.bind(this)}},{key:"setCancelCallback",value:function(e){this.cancelCallback=null!=e?e:null,this.cancelButton.onclick=this.close.bind(this)}}]),e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KGPasswordPrompt=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}}(),i=s(n(15)),a=s(n(32)),o=n(5);function s(e){return e&&e.__esModule?e:{default:e}}var l=function(){function e(t,n,r){var i=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.overlayName=t.overlayName,this.container=t.container,this.label=t.label,this.input=t.input,this.rememberPwd=document.getElementById("rememberPwd"),this.rememberPwdWrapper=this.container.querySelector(".kg_checkbox_wrapper"),this.rememberPwdWrapper.onclick=this.onRememberPwdWrapperClick.bind(this),this.pwd=null,this.submitButton=t.submitButton,this.cancelButton=t.cancelButton,this.overlayManager=n,this.l10n=r,this.tipMsg=document.getElementById("kg_tip_msg");var a=window.KGPdfViewerWebApp,s=a.pwdConfig,l=a.pwdDefaultConfig;this.pwdConfig=(0,o.mergerConfig)(l,s),this.updateCallback=null,this.submitButton.addEventListener("click",this.verify.bind(this),!1),this.cancelButton.addEventListener("click",this.close.bind(this)),this.input.addEventListener("keydown",function(e){i.input.classList.remove("KG_Input_Error"),i.container.querySelector(".kg_error_msg").style.visibility="hidden",13===e.keyCode&&i.verify()}),this.container.getElementsByTagName("form")[0].addEventListener("submit",function(e){e.preventDefault()}),this.closeBtn=this.container.querySelector(".kg_dialog_close"),this.closeBtn.addEventListener("click",this.close.bind(this)),!!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)&&(this.input.onblur=function(e){setTimeout(function(){if("INPUT"!==document.activeElement.tagName){var e="pc";/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)?e="ios":/(Android)/i.test(navigator.userAgent)&&(e="android"),"ios"===e&&document.activeElement.scrollIntoViewIfNeeded(!0)}},100)}),this.overlayManager.register(this.overlayName,this.container,this.close.bind(this),!0)}return r(e,[{key:"onRememberPwdWrapperClick",value:function(e){this.rememberPwd.checked=!this.rememberPwd.checked,this.rememberPwd.checked?this.rememberPwdWrapper.classList.add("kg_checkbox_wrapper-checked"):this.rememberPwdWrapper.classList.remove("kg_checkbox_wrapper-checked")}},{key:"open",value:function(e,t){var n=this;return this.certValidity=e||!1,this.overlayManager.open(this.overlayName).then(function(){n.pwd=n.getRememberedPwd(t);var e=n.pwdConfig,r=e.defaultPwd,i=e.keepRemember,a=window.KGPdfViewerWebApp,o=a.password,s=a.sealOrigin;n.setTipMsg(n.pwdConfig),i&&(n.rememberPwd.checked=!0,n.rememberPwdWrapper.classList.add("kg_checkbox_wrapper-checked")),(r||o)&&0==s&&(n.pwd=r||o),n.pwd?(n.input.value=n.pwd,n.rememberPwd.checked=!0,n.rememberPwdWrapper.classList.add("kg_checkbox_wrapper-checked"),n.verify()):(n.input.value="",n.input.focus())})}},{key:"close",value:function(){var e=this;this.overlayManager.close(this.overlayName).then(function(){e.pwd||(e.rememberPwd.checked=!1,e.rememberPwdWrapper.classList.remove("kg_checkbox_wrapper-checked"),(0,o.deleteCookieAndStorage)("KG_Remember"),e.input.classList.remove("KG_Input_Error"),e.container.querySelector(".kg_error_msg").style.visibility="hidden")})}},{key:"verify",value:function(){var e=this,t=this.input.value;t&&t.length>0?this.overlayManager.close(this.overlayName).then(function(){switch(e.l10n._lang){case"zh-TW":window.KGPdfViewerWebApp.getTipPrompt().open("正在驗證密碼...");break;case"en-US":window.KGPdfViewerWebApp.getTipPrompt().open("Verifying password...");break;default:window.KGPdfViewerWebApp.getTipPrompt().open("正在验证密码...")}(0,o.functionalJudgment)("certValidity")&&e.certValidity?new Promise(function(e){window.KGPdfViewerWebApp.PDFViewerApplication.KG_CertValidity.verify(t,e)}).then(function(){e.updateCallback(t)}):e.updateCallback(t)}):(this.input.classList.add("KG_Input_Error"),this.container.querySelector(".kg_error_msg").style.visibility="visible",this.input.focus())}},{key:"setUpdateCallback",value:function(e){this.updateCallback=e}},{key:"remember",value:function(e){if(this.pwd)this.rememberPwd.checked||this.clearRememberedPwd();else if(this.rememberPwd.checked){var t=window.KGPdfViewerWebApp.userId;window.KGPdfViewerWebApp.fjrs&&window.KGPdfViewerWebApp.fjrs.isFjrs&&"delete"===e&&(t=window.KGPdfViewerWebApp.PDFViewerApplication.KG_FJRS.delKeySN);var n=window.KGPdfViewerWebApp.userCode,r=this.input.value,s=t?"userId="+t+";password="+r:"userCode="+n+";password="+r,l=i.default.stringify(a.default.parse(s));(0,o.setCookieOrStorage)("KG_Remember",l,{expires:7})}}},{key:"getRememberedPwd",value:function(e){var t=(0,o.getCookieOrStorage)("KG_Remember"),n=a.default.stringify(i.default.parse(t)),r=n.split(";password=")[0].split("userId=")[1],s=n.split(";password=")[0].split("userCode=")[1],l=n.split(";password=")[1];if(window.KGPdfViewerWebApp.fjrs&&window.KGPdfViewerWebApp.fjrs.isFjrs){if("add"===e){if(r===window.KGPdfViewerWebApp.userId||s===window.KGPdfViewerWebApp.userCode)return l}else if("delete"===e&&(r===window.KGPdfViewerWebApp.PDFViewerApplication.KG_FJRS.delKeySN||s===window.KGPdfViewerWebApp.userCode))return l}else if(r===window.KGPdfViewerWebApp.userId||s===window.KGPdfViewerWebApp.userCode)return l;return!1}},{key:"clearRememberedPwd",value:function(){(0,o.deleteCookieAndStorage)("KG_Remember"),this.rememberPwd.checked=!1,this.rememberPwdWrapper.classList.remove("kg_checkbox_wrapper-checked")}},{key:"setTipMsg",value:function(e){var t=e.tips,n=e.tipsColor;t&&(this.tipMsg.style.display="block",this.tipMsg.innerHTML=t,this.tipMsg.style.color=n)}}]),e}();t.KGPasswordPrompt=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SelectSealPrompt=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}}(),i=n(5),a=n(41),o=n(39);var s=function(){function e(t,n,r){var a=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.overlayName=t.overlayName,this.container=t.container,this.submitButton=t.submitButton,this.cancelButton=t.cancelButton,this.img=t.img,this.sealLeft=t.sealLeft,this.sealRight=t.sealRight,this.kgSealIdx=document.getElementById("kg-seal-idx"),this.kgSealTotalNumb=document.getElementById("kg-seal-totalNumb"),this.continuityStamp=document.getElementById("continuity-stamp"),this.continuityRange=document.getElementById("continuity-range"),this.continuityRange.onblur=i.scrollToResizeScreen,this.img.oncontextmenu=function(e){e.preventDefault()},this.img.onmousedown=function(e){e.preventDefault()},this.additionText=document.getElementById("addition-text"),this.showAdditionConfig=document.getElementById("show-addition-config"),this.pagingSealWrapper=document.getElementById("paging-seal-wrapper"),this.additionTextWrapper=document.getElementById("addition-text-wrapper"),this.noSealsWrapper=document.getElementById("kg_no_seals_wrapper"),this.sealsWrapper=document.getElementById("kg_seals_wrapper"),this.fileType=window.KGPdfViewerWebApp.fileType,this.stampType=window.KGPdfViewerWebApp.stampType,this.pagingSeal=document.getElementById("paging-seal"),this.showPagingSealConfig=document.getElementById("paging-seal-config"),this.closeBtn=this.container.querySelector(".kg_dialog_close"),this.close=this.close.bind(this),this.closeBtn.addEventListener("click",function(){return a.close(!0)}),this.overlayManager=n,this.l10n=r,this.updateCallback=null,this.reason=null,this.seals=null,this.sealIdx=0,this.isQfz=!1,this.sigWithDifferentCert=!0,this.verify=this.verify.bind(this),this.clientVerify=this.clientVerify.bind(this),this.displaySealsWapper=this.displaySealsWapper.bind(this),this.submitButton.addEventListener("click",function(){a.clientVerify().then(function(e){e&&a.verify()})},!1),this.cancelButton.addEventListener("click",function(){var e=window.KGPdfViewerWebApp.PDFViewerApplication,t=e.pdfStamp,n=e.pagesCount,r=e.pdfViewer,i=e.KGStampConfirm;if(null!=t)if(t.tempSeals.length){for(var o=1;o<n;o++){var s=r.getPageView(o-1).pdfPage.tempStamps;for(var l in s)s.hasOwnProperty(l)&&(s[l].querySelector(".deleteTempStampSection").style.display="block")}i&&i.show()}else t.isStamp&&t.cancelStamp();a.deleteAllOriginImgData(),a.pagingSeal.checked&&a.onPagingSealWrapperClick(),a.close(!0)}),this.sealLeft.addEventListener("click",this.left.bind(this)),this.sealRight.addEventListener("click",this.right.bind(this)),this.overlayManager.register(this.overlayName,this.container,this.close,!1),this.hideStampBtnFunList=[],this.continuityStampWrapper=document.getElementById("continuity-stamp-wrapper"),this.KG_StampContinuity=document.getElementById("KG_StampContinuity");var o=this.continuityStampWrapper.querySelector(".KG_StampContinuity_Tip");this.KG_StampContinuity.addEventListener("mouseover",function(){o.style.opacity=1}),this.KG_StampContinuity.addEventListener("mouseout",function(){o.style.opacity=0}),window.KGPdfViewerWebApp.prepareStamp?(this.continuityStampWrapper.setAttribute("hidden",!0),this.hideStampBtnFunList.push(function(){a.continuityStampWrapper.setAttribute("hidden",!0)})):this.continuityStampWrapper.onclick=this.onContinuityStampWrapperClick.bind(this),null!=window.KGPdfViewerWebApp.externalGetSeals&&(this.continuityStampWrapper.setAttribute("hidden",!0),this.pagingSealWrapper.setAttribute("hidden",!0),this.additionTextWrapper.setAttribute("hidden",!0),this.hideStampBtnFunList.push(function(){a.continuityStampWrapper.setAttribute("hidden",!0),a.pagingSealWrapper.setAttribute("hidden",!0),a.additionTextWrapper.setAttribute("hidden",!0)})),window.KGPdfViewerWebApp.PDFViewerApplication.KG_SealPreLocation&&(this.continuityStampWrapper.setAttribute("hidden",!0),this.pagingSealWrapper.setAttribute("hidden",!0),this.additionTextWrapper.setAttribute("hidden",!0),this.hideStampBtnFunList.push(function(){a.continuityStampWrapper.setAttribute("hidden",!0),a.pagingSealWrapper.setAttribute("hidden",!0),a.additionTextWrapper.setAttribute("hidden",!0)})),this.additionTextWrapper.onclick=this.onAdditionTextWrapperClick.bind(this),"OFD"===this.fileType||2==this.stampType?this.additionTextWrapper.style.display="none":this.showAdditionConfig.onclick=function(){var e="origin"in a.seals[a.sealIdx]?a.seals[a.sealIdx].origin.imgdata:a.seals[a.sealIdx].imgdata,t="origin"in a.seals[a.sealIdx]?a.seals[a.sealIdx].origin.height:a.seals[a.sealIdx].height,n="origin"in a.seals[a.sealIdx]?a.seals[a.sealIdx].origin.width:a.seals[a.sealIdx].width,r=a.seals[a.sealIdx].imgExt,i=a.seals[a.sealIdx].selectSealInfo?a.seals[a.sealIdx].selectSealInfo:{textValue:"",timePosition:window.KGPdfViewerWebApp.additionTextConfig.timePosition,textPosition:window.KGPdfViewerWebApp.additionTextConfig.textPosition,timeSize:window.KGPdfViewerWebApp.additionTextConfig.timeFontSize,textSize:window.KGPdfViewerWebApp.additionTextConfig.fontSize,color:window.KGPdfViewerWebApp.additionTextConfig.color,font:window.KGPdfViewerWebApp.additionTextConfig.font,percentY:window.KGPdfViewerWebApp.additionTextConfig.percentY};window.KGPdfViewerWebApp.PDFViewerApplication.KGAdditionTextConfig.open(e,n,t,r,i)},this.pagingSealWrapper.onclick=this.onPagingSealWrapperClick.bind(this),1===window.KGPdfViewerWebApp.PDFViewerApplication.pagesCount?this.pagingSealWrapper.style.display="none":(this.KGPagingSeal=window.KGPdfViewerWebApp.PDFViewerApplication.KGPagingSeal,this.KGPagingSeal?this.showPagingSealConfig.onclick=function(){var e=a.seals[a.sealIdx];a.KGPagingSeal.open(e)}:window.KGPdfViewerWebApp.prepareStamp&&(this.showPagingSealConfig.onclick=function(){a.KGPagingSeal=window.KGPdfViewerWebApp.PDFViewerApplication.KGPagingSeal;var e=a.seals[a.sealIdx];a.KGPagingSeal.open(e)}))}return r(e,[{key:"onContinuityStampWrapperClick",value:function(e){e&&e.target.id===this.continuityRange.id||(this.continuityStamp.checked=!this.continuityStamp.checked,this.continuityStamp.checked?(this.continuityStampWrapper.classList.add("kg_checkbox_wrapper-checked"),this.pagingSeal.checked&&this.onPagingSealWrapperClick()):this.continuityStampWrapper.classList.remove("kg_checkbox_wrapper-checked"))}},{key:"onAdditionTextWrapperClick",value:function(e){if(!e||e.target.id!==this.showAdditionConfig.id){this.additionText.checked=!this.additionText.checked;var t=window.KGPdfViewerWebApp.additionTextConfig.isSelect;if(this.additionText.checked)this.additionTextWrapper.classList.add("kg_checkbox_wrapper-checked"),this.pagingSeal.checked&&this.onPagingSealWrapperClick(),this.showAdditionConfig.style.display="block",this.saveOriginImgData(),this.showAdditionConfig.click(),this.seals[this.sealIdx].isSelect=!0;else this.additionTextWrapper.classList.remove("kg_checkbox_wrapper-checked"),this.showAdditionConfig.style.display="none",this.deleteOriginImgData(),t&&(this.seals[this.sealIdx].imgdata=this.seals[this.sealIdx].origin.imgdata,this.seals[this.sealIdx].width=this.seals[this.sealIdx].origin.width,this.seals[this.sealIdx].height=this.seals[this.sealIdx].origin.height),this.img.src=this.seals[this.sealIdx].imgdata,this.seals[this.sealIdx].isSelect=!1,window.KGPdfViewerWebApp.PDFViewerApplication.KGAdditionTextConfig.init()}}},{key:"onPagingSealWrapperClick",value:function(e){e&&e.target.id===this.showPagingSealConfig.id||(this.pagingSeal.checked=!this.pagingSeal.checked,this.pagingSeal.checked?(this.pagingSealWrapper.classList.add("kg_checkbox_wrapper-checked"),this.continuityStamp.checked&&this.onContinuityStampWrapperClick(),this.additionText.checked&&this.deleteAllOriginImgData(),window.KGPdfViewerWebApp.additionTextConfig.isSelect&&this.additionText.checked&&this.onAdditionTextWrapperClick(),this.showPagingSealConfig.style.display="block",this.showPagingSealConfig.click()):(this.pagingSealWrapper.classList.remove("kg_checkbox_wrapper-checked"),this.seals[this.sealIdx].hasOwnProperty("qfzSeal")&&delete this.seals[this.sealIdx].qfzSeal,this.showPagingSealConfig.style.display="none"))}},{key:"displaySealsWapper",value:function(){this.seals.length?(this.sealsWrapper.removeAttribute("hidden"),this.submitButton.removeAttribute("disabled"),this.noSealsWrapper.setAttribute("hidden",!0)):(this.noSealsWrapper.removeAttribute("hidden"),this.sealsWrapper.setAttribute("hidden",!0),this.submitButton.setAttribute("disabled",!0))}},{key:"init",value:function(){if(this.seals.length){if(this.sealIdx=0,this.sealLeft.setAttribute("disabled",!0),this.kgSealIdx.innerHTML="1",this.kgSealTotalNumb.innerHTML=this.seals.length,this.continuityRange.value="1-"+window.KGPdfViewerWebApp.getNumPages(),1===this.seals.length?this.sealRight.setAttribute("disabled",!0):this.sealRight.removeAttribute("disabled"),this.seals[0].isSecretSeal)this.continuityStampWrapper.setAttribute("hidden",!0),this.pagingSealWrapper.setAttribute("hidden",!0),this.additionTextWrapper.setAttribute("hidden",!0);else{this.continuityStampWrapper.removeAttribute("hidden"),this.pagingSealWrapper.removeAttribute("hidden"),this.additionTextWrapper.removeAttribute("hidden");for(var e=0,t=this.hideStampBtnFunList.length;e<t;e++)this.hideStampBtnFunList[e]()}this.img.src=this.seals[this.sealIdx].imgdata,this.additionTextCheckedAndAdditionConfigDisplay()}}},{key:"open",value:function(){var e=this;this.overlayManager.open(this.overlayName).then(function(){e.init()})}},{key:"close",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.overlayManager._active.indexOf(this.overlayName)>-1&&this.overlayManager.close(this.overlayName).then(function(){e&&window.KGPdfViewerWebApp.cancelStampCallback()})}},{key:"verify",value:function(e){e&&e.preventDefault(),e&&e.stopPropagation();var t=void 0,n=void 0;null!=window.KGPdfViewerWebApp.continuityRange&&(t=window.KGPdfViewerWebApp.continuityRange.beginPage,n=window.KGPdfViewerWebApp.continuityRange.endPage);var r=window.KGPdfViewerWebApp.getNumPages();(!t||t<=0)&&(t=1),(!n||n>r)&&(n=r);var i=t+"-"+(n||r),a=this.continuityRange.value||i||"1-"+r;if(/^\d+-\d+$/.test(a)){var o=a.split("-"),s=parseInt(o[0]),l=parseInt(o[1]);if(s>l){var c=l;return l=s,void(s=c)}s<=0&&(s=1),l>window.KGPdfViewerWebApp.getNumPages()&&(l=window.KGPdfViewerWebApp.getNumPages());var u={};for(var d in this.seals[this.sealIdx])this.seals[this.sealIdx].hasOwnProperty(d)&&(u[d]=this.seals[this.sealIdx][d]);this.close();var h={seal:u,isContinuityStampCheck:this.continuityStamp.checked,isStampOfQfz:this.pagingSeal.checked,continuityRange:s+"-"+l};if(this.isQfz=this.pagingSeal.checked,this.deleteAllOriginImgData(),this.pagingSeal.checked&&this.onPagingSealWrapperClick(),window.KGPdfViewerWebApp.stampMask)document.getElementById("KG_StampMask").setAttribute("style","pointer-events: none");return this.updateCallback(h)}this.continuityRange.focus()}},{key:"clientVerify",value:function(){var e=this;return new Promise(function(t){var n=void 0,r=window.KGPdfViewerWebApp,a=r.isSM,s=r.fileType,l=r.cilentSeals,c=r.PDFViewerApplication.KGAlertPrompt;if(a&&"OFD"==s){var u=window.KGPdfViewerWebApp.PDFViewerApplication.pdfStamp.pdfStampSeal.keyPwd,d=l[e.sealIdx];(0,o.WebKGVerify)(d,"",u,function(e){n=e},function(e){return(0,i.closeOverlay)().then(function(){return c.open(e)})}).then(function(){t(n)})}else t(!0)})}},{key:"left",value:function(){if(this.sealIdx>0){if(this.sealIdx--,this.kgSealIdx.innerHTML=this.sealIdx+1,this.deleteAllOriginImgData(),this.additionTextCheckedAndAdditionConfigDisplay(),"PDF"===this.fileType){var e=window.KGPdfViewerWebApp.PDFViewerApplication.KGAdditionTextConfig;e&&e.init()}this.pagingSeal.checked&&this.onPagingSealWrapperClick(),this.img.src=this.seals[this.sealIdx].imgdata,this.sealRight.removeAttribute("disabled")}this.sealIdx<=0&&this.sealLeft.setAttribute("disabled",!0)}},{key:"right",value:function(){if(this.sealIdx<this.seals.length-1){if(this.sealIdx++,this.kgSealIdx.innerHTML=this.sealIdx+1,this.deleteAllOriginImgData(),this.additionTextCheckedAndAdditionConfigDisplay(),"PDF"===this.fileType){var e=window.KGPdfViewerWebApp.PDFViewerApplication.KGAdditionTextConfig;e&&e.init()}this.pagingSeal.checked&&this.onPagingSealWrapperClick(),this.img.src=this.seals[this.sealIdx].imgdata,this.sealLeft.removeAttribute("disabled")}this.sealIdx>=this.seals.length-1&&this.sealRight.setAttribute("disabled",!0)}},{key:"setSeals",value:function(e){var t=window.KGPdfViewerWebApp.additionTextConfig.isSelect,n=window.KGPdfViewerWebApp.additionText;this.seals=t&&n?this.sealsAddTextAndSaveOriginSeals(e):e,this.displaySealsWapper()}},{key:"updateSeals",value:function(e){this.setSeals(e),this.init(),e.length&&(this.continuityStamp.checked=!1,this.continuityStampWrapper.classList.remove("kg_checkbox_wrapper-checked"),this.pagingSeal.checked=!1,this.pagingSealWrapper.classList.remove("kg_checkbox_wrapper-checked"),this.seals[this.sealIdx].hasOwnProperty("qfzSeal")&&delete this.seals[this.sealIdx].qfzSeal,this.showPagingSealConfig.style.display="none")}},{key:"sealsAddTextAndSaveOriginSeals",value:function(e){for(var t=window.KGPdfViewerWebApp.PDFViewerApplication.KGAdditionTextConfig,n=function(n){e[n].origin={};var r=new Image,i=new Image;i.onload=function(){t.imgExt=e[n].imgExt,t.sealImg=i,t.xRadio=e[n].width/r.width,t.yRadio=e[n].height/r.height;var a=t.drawText();e[n].imgdata=a.data,e[n].width=a.width,e[n].height=a.height},r.src=e[n].imgdata,r.onload=function(){var t=e[n].imgdata;i.src=t,e[n].origin.imgdata=t,e[n].origin.width=e[n].width,e[n].origin.height=e[n].height,e[n].isSelect=!0}},r=0;r<e.length;r++)n(r);return e}},{key:"additionTextCheckedAndAdditionConfigDisplay",value:function(){window.KGPdfViewerWebApp.additionTextConfig.isSelect&&(this.seals[this.sealIdx].isSelect?this.additionText.parentNode.classList.add("kg_checkbox_wrapper-checked"):this.additionText.parentNode.classList.remove("kg_checkbox_wrapper-checked"),this.showAdditionConfig.style.display=this.seals[this.sealIdx].isSelect?"block":"none",this.additionText.checked=!!this.seals[this.sealIdx].isSelect)}},{key:"setUpdateCallback",value:function(e,t){this.updateCallback=e,this.reason=t}},{key:"saveOriginImgData",value:function(){window.KGPdfViewerWebApp.additionTextConfig.isSelect||(this.seals[this.sealIdx].origin={imgdata:this.seals[this.sealIdx].imgdata,width:this.seals[this.sealIdx].width,height:this.seals[this.sealIdx].height})}},{key:"deleteOriginImgData",value:function(){if(!window.KGPdfViewerWebApp.additionTextConfig.isSelect){for(var e in this.seals[this.sealIdx].origin)this.seals[this.sealIdx].origin.hasOwnProperty(e)&&(this.seals[this.sealIdx][e]=this.seals[this.sealIdx].origin[e]);delete this.seals[this.sealIdx].origin}}},{key:"deleteAllOriginImgData",value:function(){if(!window.KGPdfViewerWebApp.additionTextConfig.isSelect){for(var e=0;e<this.seals.length;e++){for(var t in this.seals[e].origin)this.seals[e].origin.hasOwnProperty(t)&&(this.seals[e][t]=this.seals[e].origin[t]);delete this.seals[e].origin}this.additionText.checked&&this.onAdditionTextWrapperClick()}}},{key:"pagingSealNoSelectSealPrompt",value:function(e){var t=this,n=window.KGPdfViewerWebApp.PDFViewerApplication.KGPagingSeal;this.pagingSeal.checked=!0,this.continuityStamp.checked=!1,this.capability=(0,a.createCapability)(),n.noSelectSealPrompt(e),this.capability.promise.then(function(){t.verify(),t.pagingSeal.checked=!1})}},{key:"continuitySealNoSelectSealPrompt",value:function(){this.continuityStamp.checked=!0,this.pagingSeal.checked=!1,this.verify(),this.continuityStamp.checked=!1}},{key:"singleSealNoSelectSealPrompt",value:function(){this.continuityStamp.checked=!1,this.pagingSeal.checked=!1,this.verify()}}]),e}();t.SelectSealPrompt=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!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}}();t.KG_AlertPrompt=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.app=t,this.overlayName=n.overlayName,this.container=n.container,this.close=this.close.bind(this),this.createDom=this.createDom.bind(this),this.init=this.init.bind(this),this.createDom(),this.init(),this.overlayManager=r,this.overlayManager.register(this.overlayName,this.container,this.close,!1),this.closeCallback=null}return r(e,[{key:"createDom",value:function(){var e=document.createElement("div");e.classList.add("kg_dialog_header"),this.container.appendChild(e);var t=document.createElement("div");t.classList.add("kg_dialog_title"),t.setAttribute("data-l10n-id","alert_title"),e.appendChild(t),this.closeBtn=document.createElement("button"),this.closeBtn.classList.add("kg_dialog_close"),this.closeBtn.innerHTML="×",e.appendChild(this.closeBtn);var n=document.createElement("div");n.classList.add("dialog"),this.container.appendChild(n),this.content=document.createElement("p"),this.content.classList.add("KG_AlertPrompt_Content"),n.appendChild(this.content);var r=document.createElement("div");r.classList.add("KG_Form_Footer"),n.appendChild(r),this.okBtn=document.createElement("button"),this.okBtn.setAttribute("data-l10n-id","password_ok"),this.okBtn.classList.add("btn"),this.okBtn.classList.add("btn-primary"),r.appendChild(this.okBtn),this.app.l10n.translate(this.container)}},{key:"init",value:function(){this.okBtn.addEventListener("click",this.close),this.closeBtn.addEventListener("click",this.close)}},{key:"open",value:function(e){var t=this;return window.KGPdfViewerWebApp.getTipPrompt().close(),this.overlayManager.open(this.overlayName).then(function(){var n=window.KGPdfViewerWebApp.clientErrorConfig.filter(function(t){return e.indexOf(t.errCode)>-1})[0];n?(t.content.innerHTML=n.errText||e,t.closeCallback=n.errCallback):t.content.innerHTML=e})}},{key:"close",value:function(){var e=this;this.overlayManager.close(this.overlayName).then(function(){e.closeCallback&&(e.closeCallback(),e.closeCallback=null)})}}]),e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!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}}();var i=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.overlayName="kgTipOverlay",this.container=document.getElementById("kgTipOverlay"),this.kgTipMsg=document.getElementById("kgTipMsg"),this.overlayManager=n,this.l10n=r,this.overlayManager.register(this.overlayName,this.container,this.close.bind(this),!0).then(function(){})}return r(e,[{key:"open",value:function(e){var t=this;return this.overlayManager.open(this.overlayName).then(function(){t.kgTipMsg.querySelector("span").innerHTML=e})}},{key:"reset",value:function(e){this.kgTipMsg.querySelector("span").innerHTML=e}},{key:"close",value:function(){var e=this;if(this.overlayManager.active.indexOf(this.overlayName)>-1)return this.overlayManager.close(this.overlayName).then(function(){e.kgTipMsg.querySelector("span").innerHTML=""})}}]),e}();t.KGTipPrompt=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!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}}();t.KG_ModalFactory=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.app=t,this.close=this.close.bind(this),this.createDom=this.createDom.bind(this),this.config=r,this.overlayName=this.config.overlayName,this.overlayManager=n,this.register(this.overlayName),this.createDom(),this.overlayManager.register(this.overlayName,this.container,this.close,!1)}return r(e,[{key:"register",value:function(e){if(document.getElementById(e))throw new Error(e+"已存在")}},{key:"createDom",value:function(){var e=this;this.overlayContainer=document.createElement("div"),this.overlayContainer.classList.add("KG_OverlayContainer"),this.overlayContainer.classList.add("hidden"),this.container=document.createElement("div"),this.container.setAttribute("id",this.overlayName),this.container.classList.add("container"),this.container.classList.add("hidden"),this.overlayContainer.appendChild(this.container),document.getElementById("outerContainer").appendChild(this.overlayContainer);var t=document.createElement("div");t.classList.add("kg_dialog_header"),this.container.appendChild(t);var n=document.createElement("div");n.classList.add("kg_dialog_title"),n.setAttribute("data-l10n-id","alert_title"),t.appendChild(n),this.closeBtn=document.createElement("button"),this.closeBtn.classList.add("kg_dialog_close"),this.closeBtn.innerHTML="×",this.closeBtn.addEventListener("click",this.close),t.appendChild(this.closeBtn);var r=document.createElement("div");r.classList.add("dialog"),this.container.appendChild(r);var i=(this.config.width||280)+"px";t.style.width=i,r.style.width=i,this.content=document.createElement("p"),this.content.classList.add("KG_CustomModal_Content"),r.appendChild(this.content);var a=document.createElement("div");a.classList.add("KG_Form_Footer"),r.appendChild(a),this.config.buttons.map(function(t){var n=document.createElement("button");n.innerHTML=t.content,n.classList.add("btn"),n.classList.add("custom_btn"),"primary"==t.type&&n.classList.add("btn-primary");n.addEventListener("click",function(){t.callback(),e.close()}),a.appendChild(n)}),this.app.l10n.translate(this.container)}},{key:"open",value:function(e){var t=this;return this.overlayManager.open(this.overlayName).then(function(){t.content.innerHTML=e||t.config.message})}},{key:"close",value:function(){this.overlayManager.close(this.overlayName)}}]),e}()},function(module,exports,__w_pdfjs_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KG_Watermark=void 0;var _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}}();exports.renderWaterMark=renderWaterMark;var _pdf_rendering_queue=__w_pdfjs_require__(23),_utils=__w_pdfjs_require__(5),_request=__w_pdfjs_require__(59);function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var rotateOptions=[{label:"旋转45°",value:45},{label:"水平",value:0},{label:"旋转-45°",value:-45},{label:"自定义",value:"custom"}],verticalOptions=[{label:"顶部对齐",value:"top"},{label:"居中",value:"middle"},{label:"底部对齐",value:"bottom"},{label:"自定义",value:"custom"}],horizontalOptions=[{label:"左对齐",value:"left"},{label:"居中",value:"center"},{label:"右对齐",value:"right"},{label:"自定义",value:"custom"}];function getDistance(e){var t={x:0,y:0},n=e.rotate,r=n*Math.PI/180,i=void 0,a=void 0;"text"===e.source&&(i=(0,_utils.computeTextWdith)(e.text,e.fontSize)/e.density,a=e.fontSize/e.density);"file"===e.source&&(i=e.fileWidth/e.density,a=e.fileHeight/e.density);var o=Math.sqrt(Math.pow(i,2)+Math.pow(a,2)),s=Math.atan(a/i),l=0,c=0;return 0===n||180===n?(c=a,l=i):90===n||270===n?(c=i,l=a):0<n&&n<90?(c=o*Math.abs(Math.sin(r+s)),l=o*Math.abs(Math.cos(r+s))):90<n&&n<180?(c=o*Math.abs(Math.sin(Math.PI-r+s)),l=o*Math.abs(Math.cos(Math.PI-r+s))):180<n&&n<270?(c=o*Math.abs(Math.sin(r-Math.PI+s)),l=o*Math.abs(Math.cos(r-Math.PI+s))):270<n&&n<360&&(c=o*Math.abs(Math.sin(2*Math.PI-r+s)),l=o*Math.abs(Math.cos(2*Math.PI-r+s))),t.x=l,t.y=c,t}function getXYPositions(e,t,n,r,i,a){for(var o={x:[],y:[]},s=e,l=e;!((s-=n)<0);)o.x.push(s);for(o.x.push(e);!((l+=n)>i);)o.x.push(l);for(var c=t,u=t;!((c+=r)>a);)o.y.push(c);for(o.y.push(t);!((u-=r)<0);)o.y.push(u);return o}function renderWaterMark(e,t,n,r,i,a,o){var s=document.createElement("canvas");s.width=r,s.height=i;var l=s.getContext("2d"),c=s.width/2,u=s.height/2;return l.translate(s.width/2,s.height/2),l.rotate(e.rotate*Math.PI/180),l.translate(-s.width/2,-s.height/2),l.globalAlpha=e.opacity,new Promise(function(o){if("text"===e.source&&e.text)l.textAlign="center",l.fillStyle=e.color,l.font=e.fontSize*n+"px "+e.font,l.fillText(e.text,c,u),o();else if("file"===e.source&&e.file){var s=new Image;s.onload=function(){var t=s.width*n,r=s.height*n;e.fileWidth=s.width,e.fileHeight=s.height,l.drawImage(s,0,0,s.width,s.height,c-t/2,u-r/2,t,r),o()},s.src=e.file}else if(a){t.width=r,t.height=i,t.getContext("2d").drawImage(a.canvas,0,0,a.canvas.width,a.canvas.height,0,0,r,i)}}).then(function(){var l=s.toDataURL("png",1);return new Promise(function(s){var c=new Image;c.onload=function(){var l=t.getContext("2d");a&&(t.width=r,t.height=i,l.drawImage(a.canvas,0,0,a.canvas.width,a.canvas.height,0,0,r,i));var u=r/2,d=i/2,h=[];if("tile"===e.fullscreen){var p,f,m=getDistance(e),g=m.x,v=m.y;p=f=g>v?g:v;for(var y=getXYPositions(r/2,i/2,p*n,f*n,r,i),b=0;b<y.x.length;b++)for(var w=0;w<y.y.length;w++)l.drawImage(c,0,0,c.width,c.height,y.x[b]-c.width/2,y.y[w]-c.height/2,c.width,c.height),"text"===e.source&&o&&h.push((0,_utils.createTextLayerElement)(e.text,y.x[b],y.y[w],e.fontSize,e.font,e.rotate,n))}else{var S=e.position.x*n,_=e.position.y*n;l.drawImage(c,0,0,c.width,c.height,u-c.width/2+S,d-c.height/2+_,c.width,c.height),"text"===e.source&&o&&h.push((0,_utils.createTextLayerElement)(e.text,u+S,d+_,e.fontSize,e.font,e.rotate,n))}s(h)},c.src=l})})}var KG_Watermark=exports.KG_Watermark=function(){function KG_Watermark(e,t,n){_classCallCheck(this,KG_Watermark),this.app=e,this.overlayName=t.overlayName,this.container=t.container,this.toolbarBtn=t.toolbarBtn,this.secondaryToolbarBtn=t.secondaryToolbarBtn,this.overlayManager=n,this.fontList=[],this.fileBase64="",this.watermarkConfig=(0,_utils.mergerConfig)(window.KGPdfViewerWebApp.watermarkConfig,window.KGPdfViewerWebApp.previewWatermark),this.open=this.open.bind(this),this.getFontList=this.getFontList.bind(this),this.getWaterMarkConfig=this.getWaterMarkConfig.bind(this),this.drawPreview=this.drawPreview.bind(this),this.disableText=this.disableText.bind(this),this.disableFile=this.disableFile.bind(this),this.disableDensity=this.disableDensity.bind(this),this.disablePosition=this.disablePosition.bind(this),this.deleteWatermarkFromDocument=this.deleteWatermarkFromDocument.bind(this),this.renderWatermarkOnDocument=this.renderWatermarkOnDocument.bind(this),this.onOk=this.onOk.bind(this),this.close=this.close.bind(this),this.overlayManager.register(this.overlayName,this.container,this.close,!0),this.createDom=this.createDom.bind(this),this.createDom(),this.init=this.init.bind(this),this.init(),this.reset=this.reset.bind(this)}return _createClass(KG_Watermark,[{key:"disableText",value:function(e){this.textInput.classList.remove("KG_Input_Error"),this.textInput.disabled=e,this.textInput.classList[e?"add":"remove"]("KG_Input_Disabled"),this.fontSelect.disabled=e,this.fontSelect.classList[e?"add":"remove"]("KG_Input_Disabled"),this.fontSizeInput.disabled=e,this.fontSizeInput.classList[e?"add":"remove"]("KG_Input_Disabled"),this.colorInput.disabled=e,this.colorInput.classList[e?"add":"remove"]("KG_Input_Disabled"),this.colorInput.jscolor.showOnClick=!e}},{key:"disableFile",value:function(e){this.fileNameInput.classList.remove("KG_Input_Error"),this.fileNameInput.disabled=e,this.fileNameInput.classList[e?"add":"remove"]("KG_Input_Disabled"),this.fileUploadBtn.disabled=e,this.fileUploadBtn.classList[e?"add":"remove"]("KG_Btn_Disabled")}},{key:"disableDensity",value:function(e){this.densityInput.disabled=e,this.densityInput.classList[e?"add":"remove"]("KG_Input_Disabled")}},{key:"disablePosition",value:function(e){this.verticalSelect.disabled=e,this.verticalSelect.classList[e?"add":"remove"]("KG_Input_Disabled"),this.verticalCustomInput.disabled=e,this.verticalCustomInput.classList[e?"add":"remove"]("KG_Input_Disabled"),this.horizontalSelect.disabled=e,this.horizontalSelect.classList[e?"add":"remove"]("KG_Input_Disabled"),this.horizontalCustomInput.disabled=e,this.horizontalCustomInput.classList[e?"add":"remove"]("KG_Input_Disabled")}},{key:"createDom",value:function(){var e=document.createElement("div");e.classList.add("kg_dialog_header"),this.container.appendChild(e);var t=document.createElement("div");t.classList.add("kg_dialog_title"),t.setAttribute("data-l10n-id","watermark_title"),e.appendChild(t),this.closeBtn=document.createElement("button"),this.closeBtn.classList.add("kg_dialog_close"),this.closeBtn.innerHTML="×",e.appendChild(this.closeBtn);var n=document.createElement("div");n.classList.add("dialog"),this.container.appendChild(n),this.iframe=document.createElement("iframe"),this.iframe.style.display="none",this.iframe.name="KG_Watermark_iframe",n.appendChild(this.iframe);var r=document.createElement("div");r.classList.add("KG_Clearfix"),n.appendChild(r);var i=document.createElement("div");i.classList.add("KG_Watermark_ConfigContainer"),r.appendChild(i);var a=document.createElement("fieldset");a.classList.add("KG_Form_Fieldset"),i.appendChild(a);var o=document.createElement("legend");o.setAttribute("data-l10n-id","watermark_source"),o.classList.add("KG_Form_Legend"),a.appendChild(o),this.textContainer=document.createElement("div"),this.textContainer.classList.add("KG_Form_Item"),this.textContainer.classList.add("kg_radio_wrapper"),a.appendChild(this.textContainer);var s=document.createElement("label");s.setAttribute("data-l10n-id","watermark_text"),s.classList.add("KG_Form_Label"),this.textContainer.appendChild(s),this.textRadio=document.createElement("input"),this.textRadio.type="radio",this.textRadio.name="source",this.textRadio.value="text",this.textContainer.appendChild(this.textRadio),this.textInput=document.createElement("input"),this.textInput.classList.add("kgInput"),this.textInput.autocomplete="off",this.textInput.type="text",this.textInput.style.marginLeft="11px",this.textInput.style.width="calc(100% - 119px)",this.textContainer.appendChild(this.textInput);var l=document.createElement("div");l.classList.add("KG_Form_Item"),a.appendChild(l);var c=document.createElement("label");c.setAttribute("data-l10n-id","watermark_font"),c.classList.add("KG_Form_Label"),l.appendChild(c),this.fontSelect=document.createElement("select"),this.fontSelect.classList.add("kgInput"),l.appendChild(this.fontSelect);var u=document.createElement("div");u.classList.add("KG_Form_Item"),a.appendChild(u);var d=document.createElement("label");d.setAttribute("data-l10n-id","watermark_fontSize"),d.classList.add("KG_Form_Label"),u.appendChild(d),this.fontSizeInput=document.createElement("input"),this.fontSizeInput.type="number",this.fontSizeInput.min=12,this.fontSizeInput.classList.add("kgInput"),u.appendChild(this.fontSizeInput);var h=document.createElement("div");h.classList.add("KG_Form_Item"),a.appendChild(h);var p=document.createElement("label");p.setAttribute("data-l10n-id","watermark_fontColor"),p.classList.add("KG_Form_Label"),h.appendChild(p),this.colorInput=document.createElement("input"),this.colorInput.type="text",this.colorInput.classList.add("kgInput"),this.colorInput.classList.add("jscolor"),this.colorInput.jscolor=new jscolor(this.colorInput),h.appendChild(this.colorInput),this.fileContainer=document.createElement("div"),this.fileContainer.classList.add("KG_Form_Item"),this.fileContainer.classList.add("kg_radio_wrapper"),a.appendChild(this.fileContainer);var f=document.createElement("label");f.setAttribute("data-l10n-id","watermark_uploadFile"),f.classList.add("KG_Form_Label"),this.fileContainer.appendChild(f),this.fileRadio=document.createElement("input"),this.fileRadio.type="radio",this.fileRadio.name="source",this.fileRadio.value="file",this.fileContainer.appendChild(this.fileRadio),this.fileNameInput=document.createElement("input"),this.fileNameInput.classList.add("kgInput"),this.fileNameInput.readOnly=!0,this.fileNameInput.type="text",this.fileNameInput.style.marginLeft="11px","en-US"===this.app.l10n._lang?this.fileNameInput.style.width="calc(100% - 191px)":this.fileNameInput.style.width="calc(100% - 195px)",this.fileContainer.appendChild(this.fileNameInput),this.fileUploadBtn=document.createElement("button"),this.fileUploadBtn.setAttribute("data-l10n-id","watermark_uploadBtn"),this.fileUploadBtn.classList.add("btn"),this.fileUploadBtn.classList.add("btn-primary"),this.fileUploadBtn.type="button",this.fileUploadBtn.style.marginLeft="12px","en-US"===this.app.l10n._lang?this.fileUploadBtn.style.width="74px":this.fileUploadBtn.style.width="64px",this.fileContainer.appendChild(this.fileUploadBtn),this.fileForm=document.createElement("form"),this.fileForm.setAttribute("enctype","multipart/form-data");var m=window.KGPdfViewerWebApp.getDocTypeUrl(),g=window.KGPdfViewerWebApp.documentId,v=(new Date).getTime();this.fileForm.setAttribute("action",m+"&action=imageToBase64&documentId="+g+"&t="+v),this.fileForm.style.display="none",this.fileForm.target=this.iframe.name,this.fileForm.method="POST",this.fileContainer.appendChild(this.fileForm),this.fileInput=document.createElement("input"),this.fileInput.name="file",this.fileInput.type="file",this.fileInput.accept="image/*",this.fileForm.appendChild(this.fileInput);var y=document.createElement("fieldset");y.classList.add("KG_Form_Fieldset"),i.appendChild(y);var b=document.createElement("legend");b.setAttribute("data-l10n-id","watermark_exterior"),b.classList.add("KG_Form_Legend"),y.appendChild(b);var w=document.createElement("div");w.classList.add("KG_Form_Item"),y.appendChild(w);var S=document.createElement("label");S.setAttribute("data-l10n-id","watermark_rotate"),S.classList.add("KG_Form_Label"),w.appendChild(S),this.rotateSelect=document.createElement("select"),this.rotateSelect.classList.add("kgInput"),w.appendChild(this.rotateSelect);for(var _=0;_<rotateOptions.length;_++){var P=document.createElement("option");P.setAttribute("data-l10n-id","watermark_rotate_option_"+rotateOptions[_].value),P.value=rotateOptions[_].value,this.rotateSelect.appendChild(P)}this.rotateCustomInput=document.createElement("input"),this.rotateCustomInput.classList.add("kgInput"),this.rotateCustomInput.type="number",this.rotateCustomInput.style.marginLeft="6px",this.rotateCustomInput.style.display="none",w.appendChild(this.rotateCustomInput),this.rotateUnit=document.createElement("span"),this.rotateUnit.innerHTML="°",this.rotateUnit.style.marginLeft="6px",this.rotateUnit.style.display="none",w.appendChild(this.rotateUnit);var A=document.createElement("div");A.classList.add("KG_Form_Item"),y.appendChild(A);var k=document.createElement("label");k.setAttribute("data-l10n-id","watermark_opacity"),k.classList.add("KG_Form_Label"),A.appendChild(k),this.opacityInput=document.createElement("input"),this.opacityInput.classList.add("kgInput"),this.opacityInput.type="number",this.opacityInput.min=0,this.opacityInput.max=100,A.appendChild(this.opacityInput);var C=document.createElement("span");C.innerHTML="%",C.style.marginLeft="6px",A.appendChild(C);var x=document.createElement("fieldset");x.classList.add("KG_Form_Fieldset"),i.appendChild(x);var T=document.createElement("legend");T.setAttribute("data-l10n-id","watermark_position"),T.classList.add("KG_Form_Legend"),x.appendChild(T),this.fullScreenContainer=document.createElement("div"),this.fullScreenContainer.classList.add("KG_Form_Item"),this.fullScreenContainer.classList.add("kg_checkbox_wrapper"),x.appendChild(this.fullScreenContainer);var D=document.createElement("label");D.setAttribute("data-l10n-id","watermark_tiled"),D.classList.add("KG_Form_Label"),this.fullScreenContainer.appendChild(D),this.fullScreenCheckBox=document.createElement("input"),this.fullScreenCheckBox.type="checkbox",this.fullScreenCheckBox.classList.add("KG_CheckBox"),this.fullScreenContainer.appendChild(this.fullScreenCheckBox);var E=document.createElement("div");E.classList.add("KG_Form_Item"),x.appendChild(E);var I=document.createElement("label");I.setAttribute("data-l10n-id","watermark_density"),I.classList.add("KG_Form_Label"),E.appendChild(I),this.densityInput=document.createElement("input"),this.densityInput.classList.add("kgInput"),this.densityInput.type="number",this.densityInput.min=1,this.densityInput.max=100,E.appendChild(this.densityInput);var O=document.createElement("div");O.classList.add("KG_Form_Item"),x.appendChild(O);var R=document.createElement("label");R.setAttribute("data-l10n-id","watermark_vertical"),R.classList.add("KG_Form_Label"),O.appendChild(R),this.verticalSelect=document.createElement("select"),this.verticalSelect.classList.add("kgInput"),O.appendChild(this.verticalSelect);for(var M=0;M<verticalOptions.length;M++){var W=document.createElement("option");W.setAttribute("data-l10n-id","watermark_vertical_option_"+verticalOptions[M].value),W.value=verticalOptions[M].value,this.verticalSelect.appendChild(W)}this.verticalCustomInput=document.createElement("input"),this.verticalCustomInput.classList.add("kgInput"),this.verticalCustomInput.type="number",this.verticalCustomInput.style.marginLeft="6px",this.verticalCustomInput.style.display="none",O.appendChild(this.verticalCustomInput),this.verticalUnit=document.createElement("span"),this.verticalUnit.innerHTML="px",this.verticalUnit.style.marginLeft="6px",this.verticalUnit.style.display="none",O.appendChild(this.verticalUnit);var L=document.createElement("div");L.classList.add("KG_Form_Item"),x.appendChild(L);var N=document.createElement("label");N.setAttribute("data-l10n-id","watermark_horizontal"),N.classList.add("KG_Form_Label"),L.appendChild(N),this.horizontalSelect=document.createElement("select"),this.horizontalSelect.classList.add("kgInput"),L.appendChild(this.horizontalSelect);for(var F=0;F<horizontalOptions.length;F++){var G=document.createElement("option");G.setAttribute("data-l10n-id","watermark_horizontal_option_"+horizontalOptions[F].value),G.value=horizontalOptions[F].value,this.horizontalSelect.appendChild(G)}this.horizontalCustomInput=document.createElement("input"),this.horizontalCustomInput.classList.add("kgInput"),this.horizontalCustomInput.type="number",this.horizontalCustomInput.style.marginLeft="6px",this.horizontalCustomInput.style.display="none",L.appendChild(this.horizontalCustomInput),this.horizontalUnit=document.createElement("span"),this.horizontalUnit.innerHTML="px",this.horizontalUnit.style.marginLeft="6px",this.horizontalUnit.style.display="none",L.appendChild(this.horizontalUnit);var V=document.createElement("div");V.classList.add("KG_Watermark_PreviewContainer"),r.appendChild(V);var K=document.createElement("fieldset");K.classList.add("KG_Form_Fieldset"),V.appendChild(K);var j=document.createElement("legend");j.setAttribute("data-l10n-id","watermark_preview"),j.classList.add("KG_Form_Legend"),K.appendChild(j),this.previewCanvas=document.createElement("canvas"),K.appendChild(this.previewCanvas);var B=document.createElement("div");B.classList.add("KG_Form_Footer"),n.appendChild(B),this.cancelBtn=document.createElement("button"),this.cancelBtn.setAttribute("data-l10n-id","password_cancel"),this.cancelBtn.classList.add("btn"),B.appendChild(this.cancelBtn),this.okBtn=document.createElement("button"),this.okBtn.setAttribute("data-l10n-id","password_ok"),this.okBtn.classList.add("btn"),this.okBtn.classList.add("btn-primary"),this.okBtn.style.marginLeft="15px",B.appendChild(this.okBtn),this.app.l10n.translate(this.container)}},{key:"reset",value:function(){var e=this.watermarkConfig,t=e.text,n=(e.file,e.font),r=e.size,i=e.color,a=e.rotate,o=e.opacity,s=e.isTiled,l=e.density,c=e.vertical,u=e.horizontal;this.textRadio.checked=!0,this.textContainer.classList.add("kg_radio_wrapper-checked"),this.fileContainer.classList.remove("kg_radio_wrapper-checked"),this.disableText(!1),this.disableFile(!0),this.textInput.value=t,this.fontSelect.value=this.fontList[0].title||n,this.fontSizeInput.value=r,this.colorInput.jscolor.fromString(i),this.fileForm.reset(),this.fileNameInput.value="",this.fileBase64="",-1!=[45,0,-45].indexOf(a)?(this.rotateSelect.value=a,this.rotateCustomInput.style.display="none"):(this.rotateSelect.value="custom",this.rotateCustomInput.style.display="inline",this.rotateUnit.style.display="inline"),this.rotateCustomInput.value=+a,this.opacityInput.value=+o,this.fullScreenCheckBox.checked=s||!1,s?(this.fullScreenContainer.classList.add("kg_checkbox_wrapper-checked"),this.disablePosition(!1),this.disablePosition(!0)):(this.fullScreenContainer.classList.remove("kg_checkbox_wrapper-checked"),this.disableDensity(!0),this.disablePosition(!1)),this.densityInput.value=+l,-1!=["top","middle","bottom"].indexOf(c)?(this.verticalSelect.value=c,this.verticalCustomInput.value=0,this.verticalCustomInput.style.display="none",this.verticalUnit.style.display="none"):(this.verticalSelect.value="custom",this.verticalCustomInput.value=+c,this.verticalCustomInput.style.display="inline",this.verticalUnit.style.display="inline"),-1!=["left","center","right"].indexOf(u)?(this.horizontalSelect.value=u,this.horizontalCustomInput.value=0,this.horizontalCustomInput.style.display="none",this.horizontalUnit.style.display="none"):(this.horizontalSelect.value="custom",this.horizontalCustomInput.value=+u,this.horizontalCustomInput.style.display="inline",this.horizontalUnit.style.display="inline")}},{key:"init",value:function init(){var _this=this,_window$KGPdfViewerWe=window.KGPdfViewerWebApp.btnPositionConfig,toolbar=_window$KGPdfViewerWe.toolbar,sidebar=_window$KGPdfViewerWe.sidebar;toolbar.indexOf("watermark")>-1&&(this.toolbarBtn.removeAttribute("hidden"),this.toolbarBtn.addEventListener("click",this.open)),sidebar.indexOf("watermark")>-1&&(this.secondaryToolbarBtn.removeAttribute("hidden"),this.secondaryToolbarBtn.addEventListener("click",this.open)),this.textContainer.addEventListener("click",function(e){e.currentTarget.querySelector('input[type="radio"]').value===_this.textRadio.value&&(_this.textRadio.checked=!0,_this.textContainer.classList.add("kg_radio_wrapper-checked"),_this.fileContainer.classList.remove("kg_radio_wrapper-checked"),_this.disableFile(!0),_this.disableText(!1),_this.drawPreview())}),this.textInput.addEventListener("input",function(e){_this.textInput.classList.remove("KG_Input_Error"),_this.drawPreview()}),this.fontSelect.addEventListener("change",function(e){!0===_this.textRadio.checked&&_this.drawPreview()}),this.fontSizeInput.addEventListener("input",function(e){var t=Number(e.target.value);isNaN(t)&&(_this.fontSizeInput.value=defaultFontSize),t<=12&&(_this.fontSizeInput.value=12),!0===_this.textRadio.checked&&_this.drawPreview()}),this.colorInput.addEventListener("change",function(e){!0===_this.textRadio.checked&&_this.drawPreview()}),this.fileContainer.addEventListener("click",function(e){e.currentTarget.querySelector('input[type="radio"]').value===_this.fileRadio.value&&(_this.fileRadio.checked=!0,_this.textContainer.classList.remove("kg_radio_wrapper-checked"),_this.fileContainer.classList.add("kg_radio_wrapper-checked"),_this.disableFile(!1),_this.disableText(!0),_this.drawPreview())}),this.fileUploadBtn.addEventListener("click",function(e){_this.fileNameInput.classList.remove("KG_Input_Error"),_this.fileInput.click()}),this.fileInput.addEventListener("change",function(e){var KGAlertPrompt=_this.app.KGAlertPrompt;KGAlertPrompt.closeCallback=function(){return _this.overlayManager.open(_this.overlayName)},new Promise(function(resolve){if("function"==typeof FileReader&&_this.fileInput.files){var file=_this.fileInput.files[0];if(!/image\/\w+/.test(file.type)){switch(_this.app.l10n._lang){case"zh-TW":KGAlertPrompt.open("請上傳圖片文件!");break;case"en-US":KGAlertPrompt.open("Please upload an image file!");break;default:KGAlertPrompt.open("请上传图片文件!")}return}var reader=new FileReader;reader.onload=function(e){_this.fileBase64=e.target.result,resolve(file.name)},reader.readAsDataURL(file)}else{var value=e.target.value,fileName=value.split("\\")[value.split("\\").length-1],fileType=fileName.split(".")[fileName.split(".").length-1].toLocaleLowerCase();if(-1===["jpg","jpeg","gif","svg","png"].indexOf(fileType)){switch(_this.app.l10n._lang){case"zh-TW":KGAlertPrompt.open("請上傳壹個圖片文件。");break;case"en-US":KGAlertPrompt.open("Please upload an image file.");break;default:KGAlertPrompt.open("请上传一个图片文件。")}return}_this.fileForm.submit();var times=0,timer=setInterval(function(){times++;var iframeBody=_this.iframe.contentWindow.document.body,response=void 0;if(response=iframeBody.childNodes.length>0?iframeBody.childNodes[0].innerHTML:iframeBody.innerHTML,response){var result=eval("("+response+")");result&&result.status&&(_this.fileBase64="data:image/"+fileType+";base64,"+result.dataBase64),clearInterval(timer),_this.iframe.contentWindow.document.body.innerHTML="",resolve(fileName)}if(times>=8){switch(_this.app.l10n._lang){case"zh-TW":KGAlertPrompt.open("圖片文件轉換失敗。");break;case"en-US":KGAlertPrompt.open("Image file conversion failed.");break;default:tipPrompt.open("图片文件转换失败。")}clearInterval(timer)}},500)}}).then(function(e){_this.fileNameInput.value=e,!0===_this.fileRadio.checked&&_this.drawPreview()}).finally(function(){_this.fileForm.reset()})}),this.rotateSelect.addEventListener("change",function(e){"custom"===e.target.value?(_this.rotateCustomInput.style.display="inline",_this.rotateUnit.style.display="inline"):(_this.rotateCustomInput.style.display="none",_this.rotateUnit.style.display="none"),_this.drawPreview()}),this.rotateCustomInput.addEventListener("input",function(e){var t=Number(e.target.value);isNaN(t)&&(_this.rotateCustomInput.value=defaultRotate),_this.drawPreview()}),this.opacityInput.addEventListener("input",function(e){var t=Number(e.target.value);isNaN(t)&&(_this.opacityInput.value=defaultOpacity),t<0&&(_this.opacityInput.value=0),t>100&&(_this.opacityInput.value=100),_this.drawPreview()}),this.fullScreenContainer.addEventListener("click",function(e){_this.fullScreenCheckBox.checked=!_this.fullScreenCheckBox.checked,_this.fullScreenCheckBox.checked?(_this.fullScreenContainer.classList.add("kg_checkbox_wrapper-checked"),_this.disableDensity(!1),_this.disablePosition(!0)):(_this.fullScreenContainer.classList.remove("kg_checkbox_wrapper-checked"),_this.disableDensity(!0),_this.disablePosition(!1)),_this.drawPreview()}),this.densityInput.addEventListener("input",function(e){var t=Number(e.target.value);isNaN(t)?_this.densityInput.value=defaultDensity:t<=0?_this.densityInput.value=1:t>100&&(_this.densityInput.value=100),_this.drawPreview()}),this.verticalSelect.addEventListener("change",function(e){_this.verticalCustomInput.style.display="custom"===e.target.value?"inline":"none",_this.verticalUnit.style.display="custom"===e.target.value?"inline":"none",_this.drawPreview()}),this.verticalCustomInput.addEventListener("input",function(e){var t=Number(e.target.value);isNaN(t)&&(_this.verticalCustomInput.value=0),_this.drawPreview()}),this.horizontalSelect.addEventListener("change",function(e){_this.horizontalCustomInput.style.display="custom"===e.target.value?"inline":"none",_this.horizontalUnit.style.display="custom"===e.target.value?"inline":"none",_this.drawPreview()}),this.horizontalCustomInput.addEventListener("input",function(e){var t=Number(e.target.value);isNaN(t)&&(_this.horizontalCustomInput.value=0),_this.drawPreview()}),this.okBtn.addEventListener("click",this.onOk),this.cancelBtn.addEventListener("click",this.close),this.closeBtn.addEventListener("click",this.close)}},{key:"open",value:function(){var e=this;return this.app.secondaryToolbar.close(),this.getFontList().then(function(){return e.overlayManager.open(e.overlayName)}).then(function(){var t=e.app.KGWatermarkConfirm;t.container.classList.contains("hidden")?e.reset():t.hide(),e.drawPreview()}).catch(function(){e.app.KGPdfViewerWebApp.getTipPrompt().close()})}},{key:"close",value:function(){var e=this;return this.overlayManager.close(this.overlayName).then(function(){e.watermarkTime&&e.deleteWatermarkFromDocument()})}},{key:"getFontList",value:function(){var e=this;if(0===this.fontList.length){var t=window.KGPdfViewerWebApp.getTipPrompt();switch(this.app.l10n._lang){case"zh-TW":t.open("正在獲取字體...");break;case"en-US":t.open("Getting fonts...");break;default:t.open("正在获取字体...")}return(0,_request.getFontList)().then(function(n){var r=[];for(var i in e.fontSelect.innerHTML="",n)if("status"!==i){r.push({title:i,value:n[i]});var a=document.createElement("option");a.value=i,a.innerHTML=i,e.fontSelect.appendChild(a)}return e.fontList=r,t.close(),Promise.resolve()})}return Promise.resolve()}},{key:"drawPreview",value:function(){if(!(document.body.clientWidth<720)){var e=this.app.pdfViewer.getPageView(this.app.page-1),t=e.viewport.scale,n=e.width/t,r=e.height/t,i=.5*n,a=.5*r;return renderWaterMark(this.getWaterMarkConfig(n,r),this.previewCanvas,.5,i,a,e,!1)}}},{key:"getWaterMarkConfig",value:function(e,t){var n={};this.textRadio.checked&&(n.source="text"),this.fileRadio.checked&&(n.source="file"),"text"===n.source&&(n.text=(0,_utils.trim)(this.textInput.value),n.font=this.fontSelect.value||this.watermarkConfig.font,n.fontName=this.fontList.filter(function(e){return e.title===n.font})[0].value,n.fontSize=Number(this.fontSizeInput.value),n.fontSize<=0&&(n.fontSize=defaultFontSize),n.color=this.colorInput.style.backgroundColor),"file"===n.source&&(n.file=this.fileBase64);var r=this.rotateSelect.value;if(n.rotate="custom"===r?Number(this.rotateCustomInput.value)%360:Number(r)%360,n.rotate<0&&(n.rotate=360+n.rotate),n.rotate=0!==n.rotate?360-n.rotate:0,n.opacity=Number(this.opacityInput.value)/100,n.fullscreen=this.fullScreenCheckBox.checked?"tile":"no","no"===n.fullscreen){n.position={x:0,y:0};var i=this.verticalSelect.value;"custom"===i?n.position.y=Number(this.verticalCustomInput.value):"top"===i?n.position.y=-t/2+20:"bottom"===i?n.position.y=t/2-20:"middle"===i&&(n.position.y=0);var a=this.horizontalSelect.value;"custom"===a?n.position.x=Number(this.horizontalCustomInput.value):"left"===a?n.position.x=-e/2+20:"right"===a?n.position.x=e/2-20:"center"===a&&(n.position.x=0),n.leftBottomPosition=(0,_utils.leftTopTransformToLeftBottom)({x:e/2+n.position.x,y:t/2+n.position.y},t)}else n.density=Number(this.densityInput.value),n.density<=0&&(n.density=1),n.density=n.density/100;return n}},{key:"onOk",value:function(){var e=this,t=this.app.KGAlertPrompt;if(t.closeCallback=function(){return e.overlayManager.open(e.overlayName)},!this.textRadio.checked||this.textInput.value){if(!this.fileRadio.checked||this.fileBase64){for(var n=this.app.pagesCount,r={},i=0;i<n;i++){var a=this.app.pdfViewer.getPageView(i),o=a.viewport.scale,s=a.width/o,l=a.height/o,c=this.getWaterMarkConfig(s,l);0===i?("text"===c.source&&(r.text=c.text,r.color=c.color.slice(4,-1).split(", ").join(","),r.fontName=c.fontName,r.fontSize=c.fontSize),"file"===c.source&&(r.file=c.file.split("base64,")[c.file.split("base64,").length-1]),"tile"===c.fullscreen&&(r.density=c.density),"no"===c.fullscreen&&(r.leftBottomPosition=[c.leftBottomPosition]),r.source=c.source,r.fullscreen=c.fullscreen,r.opacity=c.opacity,r.rotate=0!==c.rotate?360-c.rotate:0):"no"===c.fullscreen&&r.leftBottomPosition.push(c.leftBottomPosition)}var u=window.KGPdfViewerWebApp.getTipPrompt(),d=this.app.KGWatermarkConfirm;return this.close().then(function(){return e.watermarkTime=(new Date).getTime(),e.renderWatermarkOnDocument()}).then(function(){return new Promise(function(t){d.show(),d.okCallback=function(){switch(e.app.l10n._lang){case"zh-TW":u.open("正在添加水印...");break;case"en-US":u.open("Adding watermark...");break;default:u.open("正在添加水印...")}t(window.KGPdfViewerWebApp.addWatermark(r))},d.closeCallback=function(){e.deleteWatermarkFromDocument(),t({status:!0})}})}).then(function(t){if(u.overlayManager.active.indexOf("kgTipOverlay")>-1&&u.close(),!0===t.status)d.hide();else{if(t.message)return Promise.reject(t.message);switch(e.app.l10n._lang){case"zh-TW":return Promise.reject("添加水印失敗,請聯系管理員處理。");case"en-US":return Promise.reject("Failed to add watermark, please contact the administrator。");default:return Promise.reject("添加水印失败,请联系管理员处理。")}}}).catch(function(e){t.open(e)}).finally(function(){e.watermarkTime=null})}switch(t.closeCallback=function(){return e.overlayManager.open(e.overlayName).then(function(){e.fileNameInput.classList.add("KG_Input_Error"),e.fileNameInput.focus()})},this.app.l10n._lang){case"zh-TW":t.open("水印文件不能為空。");break;case"en-US":t.open("Watermark file cannot be empty.");break;default:t.open("水印文件不能为空。")}}else switch(t.closeCallback=function(){return e.overlayManager.open(e.overlayName).then(function(){e.textInput.classList.add("KG_Input_Error"),e.textInput.focus()})},this.app.l10n._lang){case"zh-TW":t.open("水印文本不能為空。");break;case"en-US":t.open("Watermark text cannot be empty.");break;default:t.open("水印文本不能为空。")}}},{key:"deleteWatermarkFromDocument",value:function(){var e=this;if(this.watermarkTime){for(var t=this.app.pagesCount,n=function(t){var n=e.app.pdfViewer.getPageView(t),r=n.canvas;delete n.pdfPage.newWatermark[e.watermarkTime],r&&(n.deleteStampCallback=function(){var t=n.div.querySelector(".canvasWrapper"),r=n.div.querySelector(".textLayer");t&&n.div.removeChild(t),r&&n.div.removeChild(r);var i=e.app.pdfThumbnailViewer.getThumbnail(n.pdfPage.pageIndex);i.renderingState=_pdf_rendering_queue.RenderingStates.INITIAL,i.setImage(n)},n.renderingState=_pdf_rendering_queue.RenderingStates.INITIAL,n.renderingQueue.renderView(n))},r=0;r<t;r++)n(r);this.watermarkTime=null}}},{key:"renderWatermarkOnDocument",value:function(){var e=this;if(this.watermarkTime){for(var t=[],n=!!PDFJS.disableTextLayer||window.navigator.userAgent.indexOf("MSIE 9.0")>0,r=this.app.pagesCount,i=function(r){var i=e.app.pdfViewer.getPageView(r),a=i.canvas,o=i.viewport.scale,s=i.width/o,l=i.height/o,c=e.getWaterMarkConfig(s,l);for(var u in null==i.pdfPage.newWatermark&&(i.pdfPage.newWatermark={}),i.pdfPage.newWatermark[e.watermarkTime]={},c)i.pdfPage.newWatermark[e.watermarkTime][u]=c[u];if(3==i.renderingState){var d=a.width/a.offsetWidth;t.push(renderWaterMark(c,a,o*d,a.width,a.height,null,!n).then(function(e){return(0,_utils.renderTextLayerElements)(i,e)}))}},a=0;a<r;a++)i(a);return Promise.all(t)}}},{key:"renderWatermarkOnlyWeb",value:function(){var e=this;return this.fontList=[{title:"黑体",value:"SIMHEI.TTF"},{title:"楷体",value:"SIMKAI.TTF"},{title:"宋体",value:"SIMSUN.TTC"},{title:"微软雅黑",value:"msyh.ttf"}],this.reset(),this.watermarkTime=(new Date).getTime(),this.renderWatermarkOnDocument().then(function(){e.watermarkTime=null,e.fontList=[]})}}]),KG_Watermark}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNodeStream=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}}(),i=n(1),a=n(61);function o(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):e.__proto__=t)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var c=require("fs"),u=require("http"),d=require("https"),h=require("url"),p=function(){function e(t){l(this,e),this.options=t,this.source=t.source,this.url=h.parse(this.source.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol||!this.url.host,this.httpHeaders=this.isHttp&&this.source.httpHeaders||{},this._fullRequest=null,this._rangeRequestReaders=[]}return r(e,[{key:"getFullReader",value:function(){return(0,i.assert)(!this._fullRequest),this._fullRequest=this.isFsUrl?new b(this):new v(this),this._fullRequest}},{key:"getRangeReader",value:function(e,t){var n=this.isFsUrl?new w(this,e,t):new y(this,e,t);return this._rangeRequestReaders.push(n),n}},{key:"cancelAllRequests",value:function(e){this._fullRequest&&this._fullRequest.cancel(e),this._rangeRequestReaders.slice(0).forEach(function(t){t.cancel(e)})}}]),e}(),f=function(){function e(t){l(this,e),this._url=t.url,this._done=!1,this._errored=!1,this._reason=null,this.onProgress=null,this._contentLength=t.source.length,this._loaded=0,this._disableRange=t.options.disableRange||!1,this._rangeChunkSize=t.source.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!t.source.disableStream,this._isRangeSupported=!t.options.disableRange,this._readableStream=null,this._readCapability=(0,i.createPromiseCapability)(),this._headersCapability=(0,i.createPromiseCapability)()}return r(e,[{key:"read",value:function(){var e=this;return this._readCapability.promise.then(function(){if(e._done)return Promise.resolve({value:void 0,done:!0});if(e._errored)return Promise.reject(e._reason);var t=e._readableStream.read();if(null===t)return e._readCapability=(0,i.createPromiseCapability)(),e.read();e._loaded+=t.length,e.onProgress&&e.onProgress({loaded:e._loaded,total:e._contentLength});var n=new Uint8Array(t).buffer;return Promise.resolve({value:n,done:!1})})}},{key:"cancel",value:function(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}},{key:"_error",value:function(e){this._errored=!0,this._reason=e,this._readCapability.resolve()}},{key:"_setReadableStream",value:function(e){var t=this;this._readableStream=e,e.on("readable",function(){t._readCapability.resolve()}),e.on("end",function(){e.destroy(),t._done=!0,t._readCapability.resolve()}),e.on("error",function(e){t._error(e)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new i.AbortException("streaming is disabled")),this._errored&&this._readableStream.destroy(this._reason)}},{key:"headersReady",get:function(){return this._headersCapability.promise}},{key:"contentLength",get:function(){return this._contentLength}},{key:"isRangeSupported",get:function(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}}]),e}(),m=function(){function e(t){l(this,e),this._url=t.url,this._done=!1,this._errored=!1,this._reason=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=(0,i.createPromiseCapability)(),this._isStreamingSupported=!t.source.disableStream}return r(e,[{key:"read",value:function(){var e=this;return this._readCapability.promise.then(function(){if(e._done)return Promise.resolve({value:void 0,done:!0});if(e._errored)return Promise.reject(e._reason);var t=e._readableStream.read();if(null===t)return e._readCapability=(0,i.createPromiseCapability)(),e.read();e._loaded+=t.length,e.onProgress&&e.onProgress({loaded:e._loaded});var n=new Uint8Array(t).buffer;return Promise.resolve({value:n,done:!1})})}},{key:"cancel",value:function(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}},{key:"_error",value:function(e){this._errored=!0,this._reason=e,this._readCapability.resolve()}},{key:"_setReadableStream",value:function(e){var t=this;this._readableStream=e,e.on("readable",function(){t._readCapability.resolve()}),e.on("end",function(){e.destroy(),t._done=!0,t._readCapability.resolve()}),e.on("error",function(e){t._error(e)}),this._errored&&this._readableStream.destroy(this._reason)}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}}]),e}();function g(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}var v=function(e){function t(e){l(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),r=function(t){n._headersCapability.resolve(),n._setReadableStream(t);var r=(0,a.validateRangeRequestCapabilities)({getResponseHeader:function(e){return n._readableStream.headers[e.toLowerCase()]},isHttp:e.isHttp,rangeChunkSize:n._rangeChunkSize,disableRange:n._disableRange}),i=r.allowRangeRequests,o=r.suggestedLength;i&&(n._isRangeSupported=!0),n._contentLength=o};return n._request=null,"http:"===n._url.protocol?n._request=u.request(g(n._url,e.httpHeaders),r):n._request=d.request(g(n._url,e.httpHeaders),r),n._request.on("error",function(e){n._errored=!0,n._reason=e,n._headersCapability.reject(e)}),n._request.end(),n}return s(t,f),t}(),y=function(e){function t(e,n,r){l(this,t);var i=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));for(var a in i._httpHeaders={},e.httpHeaders){var s=e.httpHeaders[a];void 0!==s&&(i._httpHeaders[a]=s)}return i._httpHeaders.Range="bytes="+n+"-"+(r-1),i._request=null,"http:"===i._url.protocol?i._request=u.request(g(i._url,i._httpHeaders),function(e){i._setReadableStream(e)}):i._request=d.request(g(i._url,i._httpHeaders),function(e){i._setReadableStream(e)}),i._request.on("error",function(e){i._errored=!0,i._reason=e}),i._request.end(),i}return s(t,m),t}(),b=function(e){function t(e){l(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),r=decodeURI(n._url.path);return c.lstat(r,function(e,t){if(e)return n._errored=!0,n._reason=e,void n._headersCapability.reject(e);n._contentLength=t.size,n._setReadableStream(c.createReadStream(r)),n._headersCapability.resolve()}),n}return s(t,f),t}(),w=function(e){function t(e,n,r){l(this,t);var i=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i._setReadableStream(c.createReadStream(decodeURI(i._url.path),{start:n,end:r-1})),i}return s(t,m),t}();t.PDFNodeStream=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFetchStream=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}}(),i=n(1),a=n(61);function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){return{method:"GET",headers:e,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}var l=function(){function e(t){o(this,e),this.options=t,this.source=t.source,this.isHttp=/^https?:/i.test(this.source.url),this.httpHeaders=this.isHttp&&this.source.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}return r(e,[{key:"getFullReader",value:function(){return(0,i.assert)(!this._fullRequestReader),this._fullRequestReader=new c(this),this._fullRequestReader}},{key:"getRangeReader",value:function(e,t){var n=new u(this,e,t);return this._rangeRequestReaders.push(n),n}},{key:"cancelAllRequests",value:function(e){this._fullRequestReader&&this._fullRequestReader.cancel(e),this._rangeRequestReaders.slice(0).forEach(function(t){t.cancel(e)})}}]),e}(),c=function(){function e(t){var n=this;for(var r in o(this,e),this._stream=t,this._reader=null,this._loaded=0,this._withCredentials=t.source.withCredentials,this._contentLength=this._stream.source.length,this._headersCapability=(0,i.createPromiseCapability)(),this._disableRange=this._stream.options.disableRange,this._rangeChunkSize=this._stream.source.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isRangeSupported=!this._stream.options.disableRange,this._isStreamingSupported=!this._stream.source.disableStream,this._headers=new Headers,this._stream.httpHeaders){var l=this._stream.httpHeaders[r];void 0!==l&&this._headers.append(r,l)}var c=this._stream.source.url;this._withCredentials=!0;var u=s(this._headers,this._withCredentials);fetch(c,u).then(function(e){if(!(0,a.validateResponseStatus)(e.status))throw(0,a.createResponseStatusError)(e.status,c);n._reader=e.body.getReader(),n._headersCapability.resolve();var t=(0,a.validateRangeRequestCapabilities)({getResponseHeader:function(t){return e.headers.get(t)},isHttp:n._stream.isHttp,rangeChunkSize:n._rangeChunkSize,disableRange:n._disableRange}),r=t.allowRangeRequests,o=t.suggestedLength;n._contentLength=o,n._isRangeSupported=r,!n._isStreamingSupported&&n._isRangeSupported&&n.cancel(new i.AbortException("streaming is disabled"))}).catch(this._headersCapability.reject),this.onProgress=null}return r(e,[{key:"read",value:function(){var e=this;return this._headersCapability.promise.then(function(){return e._reader.read().then(function(t){var n=t.value,r=t.done;if(r)return Promise.resolve({value:n,done:r});e._loaded+=n.byteLength,e.onProgress&&e.onProgress({loaded:e._loaded,total:e._contentLength});var i=new Uint8Array(n).buffer;return Promise.resolve({value:i,done:!1})})})}},{key:"cancel",value:function(e){this._reader&&this._reader.cancel(e)}},{key:"headersReady",get:function(){return this._headersCapability.promise}},{key:"contentLength",get:function(){return this._contentLength}},{key:"isRangeSupported",get:function(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}}]),e}(),u=function(){function e(t,n,r){var l=this;for(var c in o(this,e),this._stream=t,this._reader=null,this._loaded=0,this._withCredentials=t.source.withCredentials,this._readCapability=(0,i.createPromiseCapability)(),this._isStreamingSupported=!t.source.disableStream,this._headers=new Headers,this._stream.httpHeaders){var u=this._stream.httpHeaders[c];void 0!==u&&this._headers.append(c,u)}var d=n+"-"+(r-1);this._headers.append("Range","bytes="+d);var h=this._stream.source.url;this._withCredentials=!0;var p=s(this._headers,this._withCredentials);fetch(h,p).then(function(e){if(!(0,a.validateResponseStatus)(e.status))throw(0,a.createResponseStatusError)(e.status,h);l._readCapability.resolve(),l._reader=e.body.getReader()}),this.onProgress=null}return r(e,[{key:"read",value:function(){var e=this;return this._readCapability.promise.then(function(){return e._reader.read().then(function(t){var n=t.value,r=t.done;if(r)return Promise.resolve({value:n,done:r});e._loaded+=n.byteLength,e.onProgress&&e.onProgress({loaded:e._loaded});var i=new Uint8Array(n).buffer;return Promise.resolve({value:i,done:!1})})})}},{key:"cancel",value:function(e){this._reader&&this._reader.cancel(e)}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}}]),e}();t.PDFFetchStream=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkManager=t.PDFNetworkStream=void 0;var r,i=n(1),a=n(61),o=n(25),s=(r=o)&&r.__esModule?r:{default:r};function l(e,t){this.url=e,t=t||{},this.isHttp=/^https?:/i.test(e),this.httpHeaders=this.isHttp&&t.httpHeaders||{},this.withCredentials=t.withCredentials||!1,this.getXhr=t.getXhr||function(){return new XMLHttpRequest},this.currXhrId=0,this.pendingRequests=Object.create(null),this.loadedRequests=Object.create(null)}function c(e){var t=e.response;return"string"!=typeof t?t:(0,i.stringToBytes)(t).buffer}var u=function(){try{var e=new XMLHttpRequest;return e.open("GET",s.default.location.href),e.responseType="moz-chunked-arraybuffer","moz-chunked-arraybuffer"===e.responseType}catch(e){return!1}}();function d(e){this._options=e;var t=e.source;this._manager=new l(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}function h(e,t){this._manager=e;var n=t.source,r={onHeadersReceived:this._onHeadersReceived.bind(this),onProgressiveData:n.disableStream?null:this._onProgressiveData.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=n.url,this._fullRequestId=e.requestFull(r),this._headersReceivedCapability=(0,i.createPromiseCapability)(),this._disableRange=t.disableRange||!1,this._contentLength=n.length,this._rangeChunkSize=n.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this.onProgress=null}function p(e,t,n){this._manager=e;var r={onDone:this._onDone.bind(this),onProgress:this._onProgress.bind(this)};this._requestId=e.requestRange(t,n,r),this._requests=[],this._queuedChunk=null,this._done=!1,this.onProgress=null,this.onClosed=null}l.prototype={requestRange:function(e,t,n){var r={begin:e,end:t};for(var i in n)r[i]=n[i];return this.request(r)},requestFull:function(e){return this.request(e)},request:function(e){var t=this.getXhr(),n=this.currXhrId++,r=this.pendingRequests[n]={xhr:t};for(var i in t.open("GET",this.url),t.withCredentials=this.withCredentials,this.httpHeaders){var a=this.httpHeaders[i];void 0!==a&&t.setRequestHeader(i,a)}if(this.isHttp&&"begin"in e&&"end"in e){var o=e.begin+"-"+(e.end-1);t.setRequestHeader("Range","bytes="+o),r.expectedStatus=206}else r.expectedStatus=200;return u&&!!e.onProgressiveData?(t.responseType="moz-chunked-arraybuffer",r.onProgressiveData=e.onProgressiveData,r.mozChunked=!0):t.responseType="arraybuffer",e.onError&&(t.onerror=function(n){e.onError(t.status)}),t.onreadystatechange=this.onStateChange.bind(this,n),t.onprogress=this.onProgress.bind(this,n),r.onHeadersReceived=e.onHeadersReceived,r.onDone=e.onDone,r.onError=e.onError,r.onProgress=e.onProgress,t.send(null),n},onProgress:function(e,t){var n=this.pendingRequests[e];if(n){if(n.mozChunked){var r=c(n.xhr);n.onProgressiveData(r)}var i=n.onProgress;i&&i(t)}},onStateChange:function(e,t){var n=this.pendingRequests[e];if(n){var r=n.xhr;if(r.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),4===r.readyState&&e in this.pendingRequests)if(delete this.pendingRequests[e],0===r.status&&this.isHttp)n.onError&&n.onError(r.status);else{var i=r.status||200;if(200===i&&206===n.expectedStatus||i===n.expectedStatus){this.loadedRequests[e]=!0;var a=c(r);if(206===i){var o=r.getResponseHeader("Content-Range"),s=/bytes (\d+)-(\d+)\/(\d+)/.exec(o),l=parseInt(s[1],10);n.onDone({begin:l,chunk:a})}else n.onProgressiveData?n.onDone(null):a?n.onDone({begin:0,chunk:a}):n.onError&&n.onError(r.status)}else n.onError&&n.onError(r.status)}}},hasPendingRequests:function(){for(var e in this.pendingRequests)return!0;return!1},getRequestXhr:function(e){return this.pendingRequests[e].xhr},isStreamingRequest:function(e){return!!this.pendingRequests[e].onProgressiveData},isPendingRequest:function(e){return e in this.pendingRequests},isLoadedRequest:function(e){return e in this.loadedRequests},abortAllRequests:function(){for(var e in this.pendingRequests)this.abortRequest(0|e)},abortRequest:function(e){var t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}},d.prototype={_onRangeRequestReaderClosed:function(e){var t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)},getFullReader:function(){return(0,i.assert)(!this._fullRequestReader),this._fullRequestReader=new h(this._manager,this._options),this._fullRequestReader},getRangeReader:function(e,t){var n=new p(this._manager,e,t);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n},cancelAllRequests:function(e){this._fullRequestReader&&this._fullRequestReader.cancel(e),this._rangeRequestReaders.slice(0).forEach(function(t){t.cancel(e)})}},h.prototype={_onHeadersReceived:function(){var e=this._fullRequestId,t=this._manager.getRequestXhr(e),n=(0,a.validateRangeRequestCapabilities)({getResponseHeader:function(e){return t.getResponseHeader(e)},isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange}),r=n.allowRangeRequests,i=n.suggestedLength;this._contentLength=i||this._contentLength,r&&(this._isRangeSupported=!0);var o=this._manager;o.isStreamingRequest(e)?this._isStreamingSupported=!0:this._isRangeSupported&&o.abortRequest(e),this._headersReceivedCapability.resolve()},_onProgressiveData:function(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._cachedChunks.push(e)},_onDone:function(e){e&&this._onProgressiveData(e.chunk),this._done=!0,this._cachedChunks.length>0||(this._requests.forEach(function(e){e.resolve({value:void 0,done:!0})}),this._requests=[])},_onError:function(e){var t=this._url,n=(0,a.createResponseStatusError)(e,t);this._storedError=n,this._headersReceivedCapability.reject(n),this._requests.forEach(function(e){e.reject(n)}),this._requests=[],this._cachedChunks=[]},_onProgress:function(e){this.onProgress&&this.onProgress({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})},get isRangeSupported(){return this._isRangeSupported},get isStreamingSupported(){return this._isStreamingSupported},get contentLength(){return this._contentLength},get headersReady(){return this._headersReceivedCapability.promise},read:function(){if(this._storedError)return Promise.reject(this._storedError);if(this._cachedChunks.length>0){var e=this._cachedChunks.shift();return Promise.resolve({value:e,done:!1})}if(this._done)return Promise.resolve({value:void 0,done:!0});var t=(0,i.createPromiseCapability)();return this._requests.push(t),t.promise},cancel:function(e){this._done=!0,this._headersReceivedCapability.reject(e),this._requests.forEach(function(e){e.resolve({value:void 0,done:!0})}),this._requests=[],this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}},p.prototype={_close:function(){this.onClosed&&this.onClosed(this)},_onDone:function(e){var t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t;this._done=!0,this._requests.forEach(function(e){e.resolve({value:void 0,done:!0})}),this._requests=[],this._close()},_onProgress:function(e){!this.isStreamingSupported&&this.onProgress&&this.onProgress({loaded:e.loaded})},get isStreamingSupported(){return!1},read:function(){if(null!==this._queuedChunk){var e=this._queuedChunk;return this._queuedChunk=null,Promise.resolve({value:e,done:!1})}if(this._done)return Promise.resolve({value:void 0,done:!0});var t=(0,i.createPromiseCapability)();return this._requests.push(t),t.promise},cancel:function(e){this._done=!0,this._requests.forEach(function(e){e.resolve({value:void 0,done:!0})}),this._requests=[],this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}},t.PDFNetworkStream=d,t.NetworkManager=l}])});