watermark-js-plus 1.5.2 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ie/index.cjs.js +4461 -0
- package/dist/ie/index.cjs.js.map +1 -0
- package/dist/ie/index.cjs.min.js +1 -0
- package/dist/ie/index.esm.js +4457 -0
- package/dist/ie/index.esm.js.map +1 -0
- package/dist/ie/index.esm.min.js +1 -0
- package/dist/ie/index.iife.js +4466 -0
- package/dist/ie/index.iife.js.map +1 -0
- package/dist/ie/index.iife.min.js +1 -0
- package/dist/ie/index.umd.js +4467 -0
- package/dist/ie/index.umd.js.map +1 -0
- package/dist/ie/index.umd.min.js +1 -0
- package/dist/ie/types/src/core/blind.d.ts +18 -0
- package/dist/ie/types/src/core/canvas.d.ts +51 -0
- package/dist/ie/types/src/core/image.d.ts +22 -0
- package/dist/ie/types/src/core/layout/grid.d.ts +14 -0
- package/dist/ie/types/src/core/layout/index.d.ts +4 -0
- package/dist/ie/types/src/core/watermark.d.ts +48 -0
- package/dist/ie/types/src/index.d.ts +5 -0
- package/dist/ie/types/src/index.ie.d.ts +6 -0
- package/dist/ie/types/src/style/index.d.ts +1 -0
- package/dist/ie/types/src/types/index.d.ts +127 -0
- package/dist/ie/types/src/utils/bootstrap.d.ts +2 -0
- package/dist/ie/types/src/utils/index.d.ts +14 -0
- package/dist/ie/types/src/utils/initialization.d.ts +19 -0
- package/dist/ie/types/tests/core/blind.test.d.ts +1 -0
- package/dist/ie/types/tests/core/image.test.d.ts +1 -0
- package/dist/ie/types/tests/core/watermark.test.d.ts +1 -0
- package/dist/ie/types/tests/utils/index.d.ts +1 -0
- package/dist/ie/types/tests/utils/index.test.d.ts +1 -0
- package/dist/index.cjs.js +33 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.esm.js +33 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.iife.js +33 -12
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.umd.js +33 -12
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/types/src/core/watermark.d.ts +1 -0
- package/dist/types/src/index.ie.d.ts +6 -0
- package/package.json +35 -26
- package/dist/types/docs/components/config.d.ts +0 -72
- package/dist/types/jest.setup.d.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).WatermarkPlus={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=function(t){return t&&t.Math===Math&&t},r=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||n("object"==typeof e&&e)||function(){return this}()||Function("return this")(),i={},o=function(t){try{return!!t()}catch(t){return!0}},a=!o((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),s=!o((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),c=s,l=Function.prototype.call,u=c?l.bind(l):function(){return l.apply(l,arguments)},d={},h={}.propertyIsEnumerable,f=Object.getOwnPropertyDescriptor,p=f&&!h.call({1:2},1);d.f=p?function(t){var e=f(this,t);return!!e&&e.enumerable}:h;var v,y,m=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},g=s,w=Function.prototype,b=w.call,x=g&&w.bind.bind(b,b),S=g?x:function(t){return function(){return b.apply(t,arguments)}},O=S,P=O({}.toString),E=O("".slice),k=function(t){return E(P(t),8,-1)},T=o,C=k,A=Object,j=S("".split),_=T((function(){return!A("z").propertyIsEnumerable(0)}))?function(t){return"String"===C(t)?j(t,""):A(t)}:A,R=function(t){return null==t},L=R,D=TypeError,I=function(t){if(L(t))throw new D("Can't call method on "+t);return t},B=_,H=I,N=function(t){return B(H(t))},W="object"==typeof document&&document.all,U=void 0===W&&void 0!==W?function(t){return"function"==typeof t||t===W}:function(t){return"function"==typeof t},F=U,M=function(t){return"object"==typeof t?null!==t:F(t)},G=r,q=U,z=function(t,e){return arguments.length<2?(n=G[t],q(n)?n:void 0):G[t]&&G[t][e];var n},V=S({}.isPrototypeOf),X=r.navigator,Y=X&&X.userAgent,$=Y?String(Y):"",K=r,J=$,Z=K.process,Q=K.Deno,tt=Z&&Z.versions||Q&&Q.version,et=tt&&tt.v8;et&&(y=(v=et.split("."))[0]>0&&v[0]<4?1:+(v[0]+v[1])),!y&&J&&(!(v=J.match(/Edge\/(\d+)/))||v[1]>=74)&&(v=J.match(/Chrome\/(\d+)/))&&(y=+v[1]);var nt=y,rt=nt,it=o,ot=r.String,at=!!Object.getOwnPropertySymbols&&!it((function(){var t=Symbol("symbol detection");return!ot(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&rt&&rt<41})),st=at&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ct=z,lt=U,ut=V,dt=Object,ht=st?function(t){return"symbol"==typeof t}:function(t){var e=ct("Symbol");return lt(e)&&ut(e.prototype,dt(t))},ft=String,pt=function(t){try{return ft(t)}catch(t){return"Object"}},vt=U,yt=pt,mt=TypeError,gt=function(t){if(vt(t))return t;throw new mt(yt(t)+" is not a function")},wt=gt,bt=R,xt=function(t,e){var n=t[e];return bt(n)?void 0:wt(n)},St=u,Ot=U,Pt=M,Et=TypeError,kt={exports:{}},Tt=r,Ct=Object.defineProperty,At=function(t,e){try{Ct(Tt,t,{value:e,configurable:!0,writable:!0})}catch(n){Tt[t]=e}return e},jt=r,_t=At,Rt="__core-js_shared__",Lt=kt.exports=jt[Rt]||_t(Rt,{});(Lt.versions||(Lt.versions=[])).push({version:"3.38.1",mode:"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Dt=kt.exports,It=Dt,Bt=function(t,e){return It[t]||(It[t]=e||{})},Ht=I,Nt=Object,Wt=function(t){return Nt(Ht(t))},Ut=Wt,Ft=S({}.hasOwnProperty),Mt=Object.hasOwn||function(t,e){return Ft(Ut(t),e)},Gt=S,qt=0,zt=Math.random(),Vt=Gt(1..toString),Xt=function(t){return"Symbol("+(void 0===t?"":t)+")_"+Vt(++qt+zt,36)},Yt=Bt,$t=Mt,Kt=Xt,Jt=at,Zt=st,Qt=r.Symbol,te=Yt("wks"),ee=Zt?Qt.for||Qt:Qt&&Qt.withoutSetter||Kt,ne=function(t){return $t(te,t)||(te[t]=Jt&&$t(Qt,t)?Qt[t]:ee("Symbol."+t)),te[t]},re=u,ie=M,oe=ht,ae=xt,se=function(t,e){var n,r;if("string"===e&&Ot(n=t.toString)&&!Pt(r=St(n,t)))return r;if(Ot(n=t.valueOf)&&!Pt(r=St(n,t)))return r;if("string"!==e&&Ot(n=t.toString)&&!Pt(r=St(n,t)))return r;throw new Et("Can't convert object to primitive value")},ce=TypeError,le=ne("toPrimitive"),ue=function(t,e){if(!ie(t)||oe(t))return t;var n,r=ae(t,le);if(r){if(void 0===e&&(e="default"),n=re(r,t,e),!ie(n)||oe(n))return n;throw new ce("Can't convert object to primitive value")}return void 0===e&&(e="number"),se(t,e)},de=ht,he=function(t){var e=ue(t,"string");return de(e)?e:e+""},fe=M,pe=r.document,ve=fe(pe)&&fe(pe.createElement),ye=function(t){return ve?pe.createElement(t):{}},me=ye,ge=!a&&!o((function(){return 7!==Object.defineProperty(me("div"),"a",{get:function(){return 7}}).a})),we=a,be=u,xe=d,Se=m,Oe=N,Pe=he,Ee=Mt,ke=ge,Te=Object.getOwnPropertyDescriptor;i.f=we?Te:function(t,e){if(t=Oe(t),e=Pe(e),ke)try{return Te(t,e)}catch(t){}if(Ee(t,e))return Se(!be(xe.f,t,e),t[e])};var Ce={},Ae=a&&o((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),je=M,_e=String,Re=TypeError,Le=function(t){if(je(t))return t;throw new Re(_e(t)+" is not an object")},De=a,Ie=ge,Be=Ae,He=Le,Ne=he,We=TypeError,Ue=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Me="enumerable",Ge="configurable",qe="writable";Ce.f=De?Be?function(t,e,n){if(He(t),e=Ne(e),He(n),"function"==typeof t&&"prototype"===e&&"value"in n&&qe in n&&!n[qe]){var r=Fe(t,e);r&&r[qe]&&(t[e]=n.value,n={configurable:Ge in n?n[Ge]:r[Ge],enumerable:Me in n?n[Me]:r[Me],writable:!1})}return Ue(t,e,n)}:Ue:function(t,e,n){if(He(t),e=Ne(e),He(n),Ie)try{return Ue(t,e,n)}catch(t){}if("get"in n||"set"in n)throw new We("Accessors not supported");return"value"in n&&(t[e]=n.value),t};var ze=Ce,Ve=m,Xe=a?function(t,e,n){return ze.f(t,e,Ve(1,n))}:function(t,e,n){return t[e]=n,t},Ye={exports:{}},$e=a,Ke=Mt,Je=Function.prototype,Ze=$e&&Object.getOwnPropertyDescriptor,Qe=Ke(Je,"name"),tn={EXISTS:Qe,PROPER:Qe&&"something"===function(){}.name,CONFIGURABLE:Qe&&(!$e||$e&&Ze(Je,"name").configurable)},en=U,nn=Dt,rn=S(Function.toString);en(nn.inspectSource)||(nn.inspectSource=function(t){return rn(t)});var on,an,sn,cn=nn.inspectSource,ln=U,un=r.WeakMap,dn=ln(un)&&/native code/.test(String(un)),hn=Xt,fn=Bt("keys"),pn=function(t){return fn[t]||(fn[t]=hn(t))},vn={},yn=dn,mn=r,gn=M,wn=Xe,bn=Mt,xn=Dt,Sn=pn,On=vn,Pn="Object already initialized",En=mn.TypeError,kn=mn.WeakMap;if(yn||xn.state){var Tn=xn.state||(xn.state=new kn);Tn.get=Tn.get,Tn.has=Tn.has,Tn.set=Tn.set,on=function(t,e){if(Tn.has(t))throw new En(Pn);return e.facade=t,Tn.set(t,e),e},an=function(t){return Tn.get(t)||{}},sn=function(t){return Tn.has(t)}}else{var Cn=Sn("state");On[Cn]=!0,on=function(t,e){if(bn(t,Cn))throw new En(Pn);return e.facade=t,wn(t,Cn,e),e},an=function(t){return bn(t,Cn)?t[Cn]:{}},sn=function(t){return bn(t,Cn)}}var An={set:on,get:an,has:sn,enforce:function(t){return sn(t)?an(t):on(t,{})},getterFor:function(t){return function(e){var n;if(!gn(e)||(n=an(e)).type!==t)throw new En("Incompatible receiver, "+t+" required");return n}}},jn=S,_n=o,Rn=U,Ln=Mt,Dn=a,In=tn.CONFIGURABLE,Bn=cn,Hn=An.enforce,Nn=An.get,Wn=String,Un=Object.defineProperty,Fn=jn("".slice),Mn=jn("".replace),Gn=jn([].join),qn=Dn&&!_n((function(){return 8!==Un((function(){}),"length",{value:8}).length})),zn=String(String).split("String"),Vn=Ye.exports=function(t,e,n){"Symbol("===Fn(Wn(e),0,7)&&(e="["+Mn(Wn(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!Ln(t,"name")||In&&t.name!==e)&&(Dn?Un(t,"name",{value:e,configurable:!0}):t.name=e),qn&&n&&Ln(n,"arity")&&t.length!==n.arity&&Un(t,"length",{value:n.arity});try{n&&Ln(n,"constructor")&&n.constructor?Dn&&Un(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=Hn(t);return Ln(r,"source")||(r.source=Gn(zn,"string"==typeof e?e:"")),t};Function.prototype.toString=Vn((function(){return Rn(this)&&Nn(this).source||Bn(this)}),"toString");var Xn=Ye.exports,Yn=U,$n=Ce,Kn=Xn,Jn=At,Zn=function(t,e,n,r){r||(r={});var i=r.enumerable,o=void 0!==r.name?r.name:e;if(Yn(n)&&Kn(n,o,r),r.global)i?t[e]=n:Jn(e,n);else{try{r.unsafe?t[e]&&(i=!0):delete t[e]}catch(t){}i?t[e]=n:$n.f(t,e,{value:n,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return t},Qn={},tr=Math.ceil,er=Math.floor,nr=Math.trunc||function(t){var e=+t;return(e>0?er:tr)(e)},rr=function(t){var e=+t;return e!=e||0===e?0:nr(e)},ir=rr,or=Math.max,ar=Math.min,sr=function(t,e){var n=ir(t);return n<0?or(n+e,0):ar(n,e)},cr=rr,lr=Math.min,ur=function(t){var e=cr(t);return e>0?lr(e,9007199254740991):0},dr=function(t){return ur(t.length)},hr=N,fr=sr,pr=dr,vr=function(t){return function(e,n,r){var i=hr(e),o=pr(i);if(0===o)return!t&&-1;var a,s=fr(r,o);if(t&&n!=n){for(;o>s;)if((a=i[s++])!=a)return!0}else for(;o>s;s++)if((t||s in i)&&i[s]===n)return t||s||0;return!t&&-1}},yr={includes:vr(!0),indexOf:vr(!1)},mr=Mt,gr=N,wr=yr.indexOf,br=vn,xr=S([].push),Sr=function(t,e){var n,r=gr(t),i=0,o=[];for(n in r)!mr(br,n)&&mr(r,n)&&xr(o,n);for(;e.length>i;)mr(r,n=e[i++])&&(~wr(o,n)||xr(o,n));return o},Or=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Pr=Sr,Er=Or.concat("length","prototype");Qn.f=Object.getOwnPropertyNames||function(t){return Pr(t,Er)};var kr={};kr.f=Object.getOwnPropertySymbols;var Tr=z,Cr=Qn,Ar=kr,jr=Le,_r=S([].concat),Rr=Tr("Reflect","ownKeys")||function(t){var e=Cr.f(jr(t)),n=Ar.f;return n?_r(e,n(t)):e},Lr=Mt,Dr=Rr,Ir=i,Br=Ce,Hr=o,Nr=U,Wr=/#|\.prototype\./,Ur=function(t,e){var n=Mr[Fr(t)];return n===qr||n!==Gr&&(Nr(e)?Hr(e):!!e)},Fr=Ur.normalize=function(t){return String(t).replace(Wr,".").toLowerCase()},Mr=Ur.data={},Gr=Ur.NATIVE="N",qr=Ur.POLYFILL="P",zr=Ur,Vr=r,Xr=i.f,Yr=Xe,$r=Zn,Kr=At,Jr=function(t,e,n){for(var r=Dr(e),i=Br.f,o=Ir.f,a=0;a<r.length;a++){var s=r[a];Lr(t,s)||n&&Lr(n,s)||i(t,s,o(e,s))}},Zr=zr,Qr=function(t,e){var n,r,i,o,a,s=t.target,c=t.global,l=t.stat;if(n=c?Vr:l?Vr[s]||Kr(s,{}):Vr[s]&&Vr[s].prototype)for(r in e){if(o=e[r],i=t.dontCallGetSet?(a=Xr(n,r))&&a.value:n[r],!Zr(c?r:s+(l?".":"#")+r,t.forced)&&void 0!==i){if(typeof o==typeof i)continue;Jr(o,i)}(t.sham||i&&i.sham)&&Yr(o,"sham",!0),$r(n,r,o,t)}},ti=k,ei=S,ni=function(t){if("Function"===ti(t))return ei(t)},ri=gt,ii=s,oi=ni(ni.bind),ai=function(t,e){return ri(t),void 0===e?t:ii?oi(t,e):function(){return t.apply(e,arguments)}},si=u,ci=Le,li=xt,ui=function(t,e,n){var r,i;ci(t);try{if(!(r=li(t,"return"))){if("throw"===e)throw n;return n}r=si(r,t)}catch(t){i=!0,r=t}if("throw"===e)throw n;if(i)throw r;return ci(r),n},di=Le,hi=ui,fi={},pi=fi,vi=ne("iterator"),yi=Array.prototype,mi=function(t){return void 0!==t&&(pi.Array===t||yi[vi]===t)},gi={};gi[ne("toStringTag")]="z";var wi="[object z]"===String(gi),bi=U,xi=k,Si=ne("toStringTag"),Oi=Object,Pi="Arguments"===xi(function(){return arguments}()),Ei=wi?xi:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Oi(t),Si))?n:Pi?xi(e):"Object"===(r=xi(e))&&bi(e.callee)?"Arguments":r},ki=S,Ti=o,Ci=U,Ai=Ei,ji=cn,_i=function(){},Ri=z("Reflect","construct"),Li=/^\s*(?:class|function)\b/,Di=ki(Li.exec),Ii=!Li.test(_i),Bi=function(t){if(!Ci(t))return!1;try{return Ri(_i,[],t),!0}catch(t){return!1}},Hi=function(t){if(!Ci(t))return!1;switch(Ai(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ii||!!Di(Li,ji(t))}catch(t){return!0}};Hi.sham=!0;var Ni=!Ri||Ti((function(){var t;return Bi(Bi.call)||!Bi(Object)||!Bi((function(){t=!0}))||t}))?Hi:Bi,Wi=a,Ui=Ce,Fi=m,Mi=Ei,Gi=xt,qi=R,zi=fi,Vi=ne("iterator"),Xi=function(t){if(!qi(t))return Gi(t,Vi)||Gi(t,"@@iterator")||zi[Mi(t)]},Yi=u,$i=gt,Ki=Le,Ji=pt,Zi=Xi,Qi=TypeError,to=function(t,e){var n=arguments.length<2?Zi(t):e;if($i(n))return Ki(Yi(n,t));throw new Qi(Ji(t)+" is not iterable")},eo=ai,no=u,ro=Wt,io=function(t,e,n,r){try{return r?e(di(n)[0],n[1]):e(n)}catch(e){hi(t,"throw",e)}},oo=mi,ao=Ni,so=dr,co=function(t,e,n){Wi?Ui.f(t,e,Fi(0,n)):t[e]=n},lo=to,uo=Xi,ho=Array,fo=ne("iterator"),po=!1;try{var vo=0,yo={next:function(){return{done:!!vo++}},return:function(){po=!0}};yo[fo]=function(){return this},Array.from(yo,(function(){throw 2}))}catch(t){}var mo=function(t,e){try{if(!e&&!po)return!1}catch(t){return!1}var n=!1;try{var r={};r[fo]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n},go=function(t){var e=ro(t),n=ao(this),r=arguments.length,i=r>1?arguments[1]:void 0,o=void 0!==i;o&&(i=eo(i,r>2?arguments[2]:void 0));var a,s,c,l,u,d,h=uo(e),f=0;if(!h||this===ho&&oo(h))for(a=so(e),s=n?new this(a):ho(a);a>f;f++)d=o?i(e[f],f):e[f],co(s,f,d);else for(s=n?new this:[],u=(l=lo(e,h)).next;!(c=no(u,l)).done;f++)d=o?io(l,i,[c.value,f],!0):c.value,co(s,f,d);return s.length=f,s};Qr({target:"Array",stat:!0,forced:!mo((function(t){Array.from(t)}))},{from:go});var wo,bo,xo,So,Oo=r,Po=$,Eo=k,ko=function(t){return Po.slice(0,t.length)===t},To=ko("Bun/")?"BUN":ko("Cloudflare-Workers")?"CLOUDFLARE":ko("Deno/")?"DENO":ko("Node.js/")?"NODE":Oo.Bun&&"string"==typeof Bun.version?"BUN":Oo.Deno&&"object"==typeof Deno.version?"DENO":"process"===Eo(Oo.process)?"NODE":Oo.window&&Oo.document?"BROWSER":"REST",Co="NODE"===To,Ao=S,jo=gt,_o=M,Ro=function(t){return _o(t)||null===t},Lo=String,Do=TypeError,Io=function(t,e,n){try{return Ao(jo(Object.getOwnPropertyDescriptor(t,e)[n]))}catch(t){}},Bo=M,Ho=I,No=function(t){if(Ro(t))return t;throw new Do("Can't set "+Lo(t)+" as a prototype")},Wo=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=Io(Object.prototype,"__proto__","set"))(n,[]),e=n instanceof Array}catch(t){}return function(n,r){return Ho(n),No(r),Bo(n)?(e?t(n,r):n.__proto__=r,n):n}}():void 0),Uo=Ce.f,Fo=Mt,Mo=ne("toStringTag"),Go=Xn,qo=Ce,zo=z,Vo=function(t,e,n){return n.get&&Go(n.get,e,{getter:!0}),n.set&&Go(n.set,e,{setter:!0}),qo.f(t,e,n)},Xo=a,Yo=ne("species"),$o=V,Ko=TypeError,Jo=Ni,Zo=pt,Qo=TypeError,ta=Le,ea=function(t){if(Jo(t))return t;throw new Qo(Zo(t)+" is not a constructor")},na=R,ra=ne("species"),ia=s,oa=Function.prototype,aa=oa.apply,sa=oa.call,ca="object"==typeof Reflect&&Reflect.apply||(ia?sa.bind(aa):function(){return sa.apply(aa,arguments)}),la=z("document","documentElement"),ua=S([].slice),da=TypeError,ha=/(?:ipad|iphone|ipod).*applewebkit/i.test($),fa=r,pa=ca,va=ai,ya=U,ma=Mt,ga=o,wa=la,ba=ua,xa=ye,Sa=function(t,e){if(t<e)throw new da("Not enough arguments");return t},Oa=ha,Pa=Co,Ea=fa.setImmediate,ka=fa.clearImmediate,Ta=fa.process,Ca=fa.Dispatch,Aa=fa.Function,ja=fa.MessageChannel,_a=fa.String,Ra=0,La={},Da="onreadystatechange";ga((function(){wo=fa.location}));var Ia=function(t){if(ma(La,t)){var e=La[t];delete La[t],e()}},Ba=function(t){return function(){Ia(t)}},Ha=function(t){Ia(t.data)},Na=function(t){fa.postMessage(_a(t),wo.protocol+"//"+wo.host)};Ea&&ka||(Ea=function(t){Sa(arguments.length,1);var e=ya(t)?t:Aa(t),n=ba(arguments,1);return La[++Ra]=function(){pa(e,void 0,n)},bo(Ra),Ra},ka=function(t){delete La[t]},Pa?bo=function(t){Ta.nextTick(Ba(t))}:Ca&&Ca.now?bo=function(t){Ca.now(Ba(t))}:ja&&!Oa?(So=(xo=new ja).port2,xo.port1.onmessage=Ha,bo=va(So.postMessage,So)):fa.addEventListener&&ya(fa.postMessage)&&!fa.importScripts&&wo&&"file:"!==wo.protocol&&!ga(Na)?(bo=Na,fa.addEventListener("message",Ha,!1)):bo=Da in xa("script")?function(t){wa.appendChild(xa("script"))[Da]=function(){wa.removeChild(this),Ia(t)}}:function(t){setTimeout(Ba(t),0)});var Wa={set:Ea,clear:ka},Ua=r,Fa=a,Ma=Object.getOwnPropertyDescriptor,Ga=function(){this.head=null,this.tail=null};Ga.prototype={add:function(t){var e={item:t,next:null},n=this.tail;n?n.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}};var qa,za,Va,Xa,Ya,$a=Ga,Ka=/ipad|iphone|ipod/i.test($)&&"undefined"!=typeof Pebble,Ja=/web0s(?!.*chrome)/i.test($),Za=r,Qa=function(t){if(!Fa)return Ua[t];var e=Ma(Ua,t);return e&&e.value},ts=ai,es=Wa.set,ns=$a,rs=ha,is=Ka,os=Ja,as=Co,ss=Za.MutationObserver||Za.WebKitMutationObserver,cs=Za.document,ls=Za.process,us=Za.Promise,ds=Qa("queueMicrotask");if(!ds){var hs=new ns,fs=function(){var t,e;for(as&&(t=ls.domain)&&t.exit();e=hs.get();)try{e()}catch(t){throw hs.head&&qa(),t}t&&t.enter()};rs||as||os||!ss||!cs?!is&&us&&us.resolve?((Xa=us.resolve(void 0)).constructor=us,Ya=ts(Xa.then,Xa),qa=function(){Ya(fs)}):as?qa=function(){ls.nextTick(fs)}:(es=ts(es,Za),qa=function(){es(fs)}):(za=!0,Va=cs.createTextNode(""),new ss(fs).observe(Va,{characterData:!0}),qa=function(){Va.data=za=!za}),ds=function(t){hs.head||qa(),hs.add(t)}}var ps=ds,vs=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},ys=r.Promise,ms=r,gs=ys,ws=U,bs=zr,xs=cn,Ss=ne,Os=To,Ps=nt;gs&&gs.prototype;var Es=Ss("species"),ks=!1,Ts=ws(ms.PromiseRejectionEvent),Cs=bs("Promise",(function(){var t=xs(gs),e=t!==String(gs);if(!e&&66===Ps)return!0;if(!Ps||Ps<51||!/native code/.test(t)){var n=new gs((function(t){t(1)})),r=function(t){t((function(){}),(function(){}))};if((n.constructor={})[Es]=r,!(ks=n.then((function(){}))instanceof r))return!0}return!(e||"BROWSER"!==Os&&"DENO"!==Os||Ts)})),As={CONSTRUCTOR:Cs,REJECTION_EVENT:Ts,SUBCLASSING:ks},js={},_s=gt,Rs=TypeError,Ls=function(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw new Rs("Bad Promise constructor");e=t,n=r})),this.resolve=_s(e),this.reject=_s(n)};js.f=function(t){return new Ls(t)};var Ds,Is,Bs,Hs=Qr,Ns=Co,Ws=r,Us=u,Fs=Zn,Ms=Wo,Gs=function(t,e,n){t&&!n&&(t=t.prototype),t&&!Fo(t,Mo)&&Uo(t,Mo,{configurable:!0,value:e})},qs=function(t){var e=zo(t);Xo&&e&&!e[Yo]&&Vo(e,Yo,{configurable:!0,get:function(){return this}})},zs=gt,Vs=U,Xs=M,Ys=function(t,e){if($o(e,t))return t;throw new Ko("Incorrect invocation")},$s=function(t,e){var n,r=ta(t).constructor;return void 0===r||na(n=ta(r)[ra])?e:ea(n)},Ks=Wa.set,Js=ps,Zs=function(t,e){},Qs=vs,tc=$a,ec=An,nc=ys,rc=js,ic="Promise",oc=As.CONSTRUCTOR,ac=As.REJECTION_EVENT,sc=As.SUBCLASSING,cc=ec.getterFor(ic),lc=ec.set,uc=nc&&nc.prototype,dc=nc,hc=uc,fc=Ws.TypeError,pc=Ws.document,vc=Ws.process,yc=rc.f,mc=yc,gc=!!(pc&&pc.createEvent&&Ws.dispatchEvent),wc="unhandledrejection",bc=function(t){var e;return!(!Xs(t)||!Vs(e=t.then))&&e},xc=function(t,e){var n,r,i,o=e.value,a=1===e.state,s=a?t.ok:t.fail,c=t.resolve,l=t.reject,u=t.domain;try{s?(a||(2===e.rejection&&kc(e),e.rejection=1),!0===s?n=o:(u&&u.enter(),n=s(o),u&&(u.exit(),i=!0)),n===t.promise?l(new fc("Promise-chain cycle")):(r=bc(n))?Us(r,n,c,l):c(n)):l(o)}catch(t){u&&!i&&u.exit(),l(t)}},Sc=function(t,e){t.notified||(t.notified=!0,Js((function(){for(var n,r=t.reactions;n=r.get();)xc(n,t);t.notified=!1,e&&!t.rejection&&Pc(t)})))},Oc=function(t,e,n){var r,i;gc?((r=pc.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),Ws.dispatchEvent(r)):r={promise:e,reason:n},!ac&&(i=Ws["on"+t])?i(r):t===wc&&Zs("Unhandled promise rejection",n)},Pc=function(t){Us(Ks,Ws,(function(){var e,n=t.facade,r=t.value;if(Ec(t)&&(e=Qs((function(){Ns?vc.emit("unhandledRejection",r,n):Oc(wc,n,r)})),t.rejection=Ns||Ec(t)?2:1,e.error))throw e.value}))},Ec=function(t){return 1!==t.rejection&&!t.parent},kc=function(t){Us(Ks,Ws,(function(){var e=t.facade;Ns?vc.emit("rejectionHandled",e):Oc("rejectionhandled",e,t.value)}))},Tc=function(t,e,n){return function(r){t(e,r,n)}},Cc=function(t,e,n){t.done||(t.done=!0,n&&(t=n),t.value=e,t.state=2,Sc(t,!0))},Ac=function(t,e,n){if(!t.done){t.done=!0,n&&(t=n);try{if(t.facade===e)throw new fc("Promise can't be resolved itself");var r=bc(e);r?Js((function(){var n={done:!1};try{Us(r,e,Tc(Ac,n,t),Tc(Cc,n,t))}catch(e){Cc(n,e,t)}})):(t.value=e,t.state=1,Sc(t,!1))}catch(e){Cc({done:!1},e,t)}}};if(oc&&(hc=(dc=function(t){Ys(this,hc),zs(t),Us(Ds,this);var e=cc(this);try{t(Tc(Ac,e),Tc(Cc,e))}catch(t){Cc(e,t)}}).prototype,(Ds=function(t){lc(this,{type:ic,done:!1,notified:!1,parent:!1,reactions:new tc,rejection:!1,state:0,value:null})}).prototype=Fs(hc,"then",(function(t,e){var n=cc(this),r=yc($s(this,dc));return n.parent=!0,r.ok=!Vs(t)||t,r.fail=Vs(e)&&e,r.domain=Ns?vc.domain:void 0,0===n.state?n.reactions.add(r):Js((function(){xc(r,n)})),r.promise})),Is=function(){var t=new Ds,e=cc(t);this.promise=t,this.resolve=Tc(Ac,e),this.reject=Tc(Cc,e)},rc.f=yc=function(t){return t===dc||undefined===t?new Is(t):mc(t)},Vs(nc)&&uc!==Object.prototype)){Bs=uc.then,sc||Fs(uc,"then",(function(t,e){var n=this;return new dc((function(t,e){Us(Bs,n,t,e)})).then(t,e)}),{unsafe:!0});try{delete uc.constructor}catch(t){}Ms&&Ms(uc,hc)}Hs({global:!0,constructor:!0,wrap:!0,forced:oc},{Promise:dc}),Gs(dc,ic,!1),qs(ic);var jc=ai,_c=u,Rc=Le,Lc=pt,Dc=mi,Ic=dr,Bc=V,Hc=to,Nc=Xi,Wc=ui,Uc=TypeError,Fc=function(t,e){this.stopped=t,this.result=e},Mc=Fc.prototype,Gc=function(t,e,n){var r,i,o,a,s,c,l,u=n&&n.that,d=!(!n||!n.AS_ENTRIES),h=!(!n||!n.IS_RECORD),f=!(!n||!n.IS_ITERATOR),p=!(!n||!n.INTERRUPTED),v=jc(e,u),y=function(t){return r&&Wc(r,"normal",t),new Fc(!0,t)},m=function(t){return d?(Rc(t),p?v(t[0],t[1],y):v(t[0],t[1])):p?v(t,y):v(t)};if(h)r=t.iterator;else if(f)r=t;else{if(!(i=Nc(t)))throw new Uc(Lc(t)+" is not iterable");if(Dc(i)){for(o=0,a=Ic(t);a>o;o++)if((s=m(t[o]))&&Bc(Mc,s))return s;return new Fc(!1)}r=Hc(t,i)}for(c=h?t.next:r.next;!(l=_c(c,r)).done;){try{s=m(l.value)}catch(t){Wc(r,"throw",t)}if("object"==typeof s&&s&&Bc(Mc,s))return s}return new Fc(!1)},qc=ys,zc=As.CONSTRUCTOR||!mo((function(t){qc.all(t).then(void 0,(function(){}))})),Vc=u,Xc=gt,Yc=js,$c=vs,Kc=Gc;Qr({target:"Promise",stat:!0,forced:zc},{all:function(t){var e=this,n=Yc.f(e),r=n.resolve,i=n.reject,o=$c((function(){var n=Xc(e.resolve),o=[],a=0,s=1;Kc(t,(function(t){var c=a++,l=!1;s++,Vc(n,e,t).then((function(t){l||(l=!0,o[c]=t,--s||r(o))}),i)})),--s||r(o)}));return o.error&&i(o.value),n.promise}});var Jc=Qr,Zc=As.CONSTRUCTOR,Qc=ys,tl=z,el=U,nl=Zn,rl=Qc&&Qc.prototype;if(Jc({target:"Promise",proto:!0,forced:Zc,real:!0},{catch:function(t){return this.then(void 0,t)}}),el(Qc)){var il=tl("Promise").prototype.catch;rl.catch!==il&&nl(rl,"catch",il,{unsafe:!0})}var ol=u,al=gt,sl=js,cl=vs,ll=Gc;Qr({target:"Promise",stat:!0,forced:zc},{race:function(t){var e=this,n=sl.f(e),r=n.reject,i=cl((function(){var i=al(e.resolve);ll(t,(function(t){ol(i,e,t).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var ul=js;Qr({target:"Promise",stat:!0,forced:As.CONSTRUCTOR},{reject:function(t){var e=ul.f(this);return(0,e.reject)(t),e.promise}});var dl=Le,hl=M,fl=js,pl=Qr,vl=As.CONSTRUCTOR,yl=function(t,e){if(dl(t),hl(e)&&e.constructor===t)return e;var n=fl.f(t);return(0,n.resolve)(e),n.promise};z("Promise"),pl({target:"Promise",stat:!0,forced:vl},{resolve:function(t){return yl(this,t)}});var ml={},gl=Sr,wl=Or,bl=Object.keys||function(t){return gl(t,wl)},xl=a,Sl=Ae,Ol=Ce,Pl=Le,El=N,kl=bl;ml.f=xl&&!Sl?Object.defineProperties:function(t,e){Pl(t);for(var n,r=El(e),i=kl(e),o=i.length,a=0;o>a;)Ol.f(t,n=i[a++],r[n]);return t};var Tl,Cl=Le,Al=ml,jl=Or,_l=vn,Rl=la,Ll=ye,Dl="prototype",Il="script",Bl=pn("IE_PROTO"),Hl=function(){},Nl=function(t){return"<"+Il+">"+t+"</"+Il+">"},Wl=function(t){t.write(Nl("")),t.close();var e=t.parentWindow.Object;return t=null,e},Ul=function(){try{Tl=new ActiveXObject("htmlfile")}catch(t){}var t,e,n;Ul="undefined"!=typeof document?document.domain&&Tl?Wl(Tl):(e=Ll("iframe"),n="java"+Il+":",e.style.display="none",Rl.appendChild(e),e.src=String(n),(t=e.contentWindow.document).open(),t.write(Nl("document.F=Object")),t.close(),t.F):Wl(Tl);for(var r=jl.length;r--;)delete Ul[Dl][jl[r]];return Ul()};_l[Bl]=!0;var Fl=ne,Ml=Object.create||function(t,e){var n;return null!==t?(Hl[Dl]=Cl(t),n=new Hl,Hl[Dl]=null,n[Bl]=t):n=Ul(),void 0===e?n:Al.f(n,e)},Gl=Ce.f,ql=Fl("unscopables"),zl=Array.prototype;void 0===zl[ql]&&Gl(zl,ql,{configurable:!0,value:Ml(null)});var Vl=function(t){zl[ql][t]=!0},Xl=yr.includes,Yl=Vl;Qr({target:"Array",proto:!0,forced:o((function(){return!Array(1).includes()}))},{includes:function(t){return Xl(this,t,arguments.length>1?arguments[1]:void 0)}}),Yl("includes");var $l=Wt,Kl=sr,Jl=dr,Zl=function(t){for(var e=$l(this),n=Jl(e),r=arguments.length,i=Kl(r>1?arguments[1]:void 0,n),o=r>2?arguments[2]:void 0,a=void 0===o?n:Kl(o,n);a>i;)e[i++]=t;return e},Ql=Vl;Qr({target:"Array",proto:!0},{fill:Zl}),Ql("fill");var tu="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||"undefined"!=typeof global&&global||{},eu="URLSearchParams"in tu,nu="Symbol"in tu&&"iterator"in Symbol,ru="FileReader"in tu&&"Blob"in tu&&function(){try{return new Blob,!0}catch(t){return!1}}(),iu="FormData"in tu,ou="ArrayBuffer"in tu;if(ou)var au=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],su=ArrayBuffer.isView||function(t){return t&&au.indexOf(Object.prototype.toString.call(t))>-1};function cu(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function lu(t){return"string"!=typeof t&&(t=String(t)),t}function uu(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return nu&&(e[Symbol.iterator]=function(){return e}),e}function du(t){this.map={},t instanceof du?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function hu(t){if(!t._noBody)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function fu(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function pu(t){var e=new FileReader,n=fu(e);return e.readAsArrayBuffer(t),n}function vu(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function yu(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:ru&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:iu&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:eu&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():ou&&ru&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=vu(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):ou&&(ArrayBuffer.prototype.isPrototypeOf(t)||su(t))?this._bodyArrayBuffer=vu(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):eu&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},ru&&(this.blob=function(){var t=hu(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=hu(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(ru)return this.blob().then(pu);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t=hu(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,n=fu(e),r=/charset=([A-Za-z0-9_-]+)/.exec(t.type),i=r?r[1]:"utf-8";return e.readAsText(t,i),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},iu&&(this.formData=function(){return this.text().then(wu)}),this.json=function(){return this.text().then(JSON.parse)},this}du.prototype.append=function(t,e){t=cu(t),e=lu(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},du.prototype.delete=function(t){delete this.map[cu(t)]},du.prototype.get=function(t){return t=cu(t),this.has(t)?this.map[t]:null},du.prototype.has=function(t){return this.map.hasOwnProperty(cu(t))},du.prototype.set=function(t,e){this.map[cu(t)]=lu(e)},du.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},du.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),uu(t)},du.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),uu(t)},du.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),uu(t)},nu&&(du.prototype[Symbol.iterator]=du.prototype.entries);var mu=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function gu(t,e){if(!(this instanceof gu))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n=(e=e||{}).body;if(t instanceof gu){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new du(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new du(e.headers)),this.method=function(t){var e=t.toUpperCase();return mu.indexOf(e)>-1?e:t}(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in tu)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var r=/([?&])_=[^&]*/;if(r.test(this.url))this.url=this.url.replace(r,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function wu(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function bu(t,e){if(!(this instanceof bu))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new du(e.headers),this.url=e.url||"",this._initBody(t)}gu.prototype.clone=function(){return new gu(this,{body:this._bodyInit})},yu.call(gu.prototype),yu.call(bu.prototype),bu.prototype.clone=function(){return new bu(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new du(this.headers),url:this.url})},bu.error=function(){var t=new bu(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var xu=[301,302,303,307,308];bu.redirect=function(t,e){if(-1===xu.indexOf(e))throw new RangeError("Invalid status code");return new bu(null,{status:e,headers:{location:t}})};var Su=tu.DOMException;try{new Su}catch(t){(Su=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack}).prototype=Object.create(Error.prototype),Su.prototype.constructor=Su}function Ou(t,e){return new Promise((function(n,r){var i=new gu(t,e);if(i.signal&&i.signal.aborted)return r(new Su("Aborted","AbortError"));var o=new XMLHttpRequest;function a(){o.abort()}if(o.onload=function(){var t,e,r={statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",e=new du,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var n=t.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();try{e.append(r,i)}catch(t){}}})),e)};0===i.url.indexOf("file://")&&(o.status<200||o.status>599)?r.status=200:r.status=o.status,r.url="responseURL"in o?o.responseURL:r.headers.get("X-Request-URL");var a="response"in o?o.response:o.responseText;setTimeout((function(){n(new bu(a,r))}),0)},o.onerror=function(){setTimeout((function(){r(new TypeError("Network request failed"))}),0)},o.ontimeout=function(){setTimeout((function(){r(new TypeError("Network request timed out"))}),0)},o.onabort=function(){setTimeout((function(){r(new Su("Aborted","AbortError"))}),0)},o.open(i.method,function(t){try{return""===t&&tu.location.href?tu.location.href:t}catch(e){return t}}(i.url),!0),"include"===i.credentials?o.withCredentials=!0:"omit"===i.credentials&&(o.withCredentials=!1),"responseType"in o&&(ru?o.responseType="blob":ou&&(o.responseType="arraybuffer")),e&&"object"==typeof e.headers&&!(e.headers instanceof du||tu.Headers&&e.headers instanceof tu.Headers)){var s=[];Object.getOwnPropertyNames(e.headers).forEach((function(t){s.push(cu(t)),o.setRequestHeader(t,lu(e.headers[t]))})),i.headers.forEach((function(t,e){-1===s.indexOf(e)&&o.setRequestHeader(e,t)}))}else i.headers.forEach((function(t,e){o.setRequestHeader(e,t)}));i.signal&&(i.signal.addEventListener("abort",a),o.onreadystatechange=function(){4===o.readyState&&i.signal.removeEventListener("abort",a)}),o.send(void 0===i._bodyInit?null:i._bodyInit)}))}Ou.polyfill=!0,tu.fetch||(tu.fetch=Ou,tu.Headers=du,tu.Request=gu,tu.Response=bu);!function(t,e){void 0===e&&(e={});var n=e.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}}("@keyframes watermark{0%{background-position:0 0}25%{background-position:100% 100%}50%{background-position:0 0}75%{background-position:100% -100%}to{background-position:0 0}}");var Pu=function(t,e){return Pu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},Pu(t,e)};var Eu=function(){return Eu=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Eu.apply(this,arguments)};function ku(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))}function Tu(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}var Cu=function(t){return t.toDataURL("image/png",1)},Au=function(t){return"function"==typeof t},ju=function(t){return void 0===t},_u=function(t,e,n){void 0===e&&(e={}),void 0===n&&(n="http://www.w3.org/2000/svg");var r=document.createElementNS(n,t);for(var i in e)r.setAttribute(i,e[i]);return r},Ru=function(t,e){return ku(void 0,void 0,void 0,(function(){var n,r,i,o,a,s,c,l,u;return Tu(this,(function(d){switch(d.label){case 0:return n=_u("svg",{xmlns:"http://www.w3.org/2000/svg"}),(r=document.createElement("div")).setAttribute("xmlns","http://www.w3.org/1999/xhtml"),r.style.cssText="\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n font: ".concat(t.font,";\n color: ").concat(e.fontColor,";\n"),r.innerHTML="<div class='rich-text-content'>".concat(e.content,"</div>"),document.body.appendChild(r),[4,Lu(r)];case 1:return d.sent(),i=null===(u=r.querySelector(".rich-text-content"))||void 0===u?void 0:u.getBoundingClientRect(),o=null==i?void 0:i.width,a=null==i?void 0:i.height,document.body.removeChild(r),s=e.richTextWidth||o||e.width,c=e.richTextHeight||a||e.height,n.setAttribute("width",s.toString()),n.setAttribute("height",c.toString()),(l=_u("foreignObject",{width:s.toString(),height:c.toString()})).appendChild(r),n.appendChild(l),[2,{element:n,width:s,height:c}]}}))}))};function Lu(t){return ku(this,void 0,void 0,(function(){var e,n,r,i,o;return Tu(this,(function(a){switch(a.label){case 0:e=t.querySelectorAll("img"),n=function(t){var e,n,r,i;return Tu(this,(function(o){switch(o.label){case 0:if(!(e=t.getAttribute("src")))return[3,6];o.label=1;case 1:return o.trys.push([1,5,,6]),[4,fetch(e)];case 2:return[4,o.sent().blob()];case 3:return n=o.sent(),[4,new Promise((function(t,e){var r=new FileReader;r.onloadend=function(){return t(r.result)},r.onerror=e,r.readAsDataURL(n)}))];case 4:return r=o.sent(),"string"==typeof r&&t.setAttribute("src",r),[3,6];case 5:return i=o.sent(),console.error("Error converting ".concat(e," to base64:"),i),[3,6];case 6:return[2]}}))},r=0,i=Array.from(e),a.label=1;case 1:return r<i.length?(o=i[r],[5,n(o)]):[3,4];case 2:a.sent(),a.label=3;case 3:return r++,[3,1];case 4:return[2]}}))}))}var Du=function(t,e){return ju(t)?e:t},Iu=function(t,e,n){void 0===e&&(e=void 0),void 0===n&&(n=void 0);var r=new Image;return r.setAttribute("crossOrigin","Anonymous"),!ju(e)&&(r.width=e),!ju(n)&&(r.height=n),r.src=t,new Promise((function(t){r.onload=function(){t(r)}}))},Bu={width:300,height:300,rotate:45,layout:"default",auxiliaryLine:!1,translatePlacement:"middle",contentType:"text",content:"hello watermark-js-plus",textType:"fill",imageWidth:0,imageHeight:0,lineHeight:30,zIndex:2147483647,backgroundPosition:"0 0",backgroundRepeat:"repeat",fontSize:"20px",fontFamily:"sans-serif",fontStyle:"",fontVariant:"",fontColor:"#000",fontWeight:"normal",filter:"none",letterSpacing:"0px",wordSpacing:"0px",globalAlpha:.5,mode:"default",mutationObserve:!0,movable:!1,parent:"body",onSuccess:function(){},onBeforeDestroy:function(){},onDestroyed:function(){},onObserveError:function(){}},Hu=function(){function t(e,n){this.props=e,this.options=n,this.canvas=t.createCanvas(this.options.width,this.options.height),this.recommendOptions=function(t,e,n){var r=t.getContext("2d");if(null===r)throw new Error("get context error");r.font="".concat(e.fontStyle," ").concat(e.fontVariant," ").concat(e.fontWeight," ").concat(e.fontSize," ").concat(e.fontFamily),r.filter=e.filter,r.letterSpacing=e.letterSpacing,r.wordSpacing=e.wordSpacing,(null==e?void 0:e.rotate)&&(e.rotate=(360-e.rotate%360)*(Math.PI/180)),ju(n.textRowMaxWidth)&&(e.textRowMaxWidth=e.width);var i={image:{rect:{width:e.imageWidth,height:e.imageHeight},position:{x:0,y:0}},textLine:{data:[],yOffsetValue:0},advancedStyleParams:{linear:{x0:0,x1:0},radial:{x0:0,y0:0,r0:0,x1:0,y1:0,r1:0},conic:{x:0,y:0,startAngle:0},pattern:{}}};switch(e.contentType){case"text":i.textLine.data=[e.content];break;case"multi-line-text":i.textLine.data=function(t,e,n){for(var r=[],i="",o="",a=0,s=e.length;a<s;a++)"\n"!==(o=e.charAt(a))?(i+=o,t.measureText(i).width>n&&(r.push(i.substring(0,i.length-1)),i="",a--)):(r.push(i),i="");return r.push(i),r}(r,e.content,e.textRowMaxWidth)}var o=e.width/2,a=e.height/2,s="middle",c="center";switch(ju(null==n?void 0:n.translateX)||ju(null==n?void 0:n.translateY)?(i.advancedStyleParams.linear.x0=-e.width/2,i.advancedStyleParams.linear.x1=e.width/2,i.advancedStyleParams.radial.r0=0,i.advancedStyleParams.radial.r1=e.width/2):(o=null==n?void 0:n.translateX,a=null==n?void 0:n.translateY,s="top",c="left"),n.translatePlacement){case"top":o=e.width/2,a=0,s="top",i.advancedStyleParams.linear.x0=-e.width/2,i.advancedStyleParams.linear.x1=e.width/2,i.advancedStyleParams.radial.y0=i.textLine.data.length*e.lineHeight/2,i.advancedStyleParams.radial.y1=i.textLine.data.length*e.lineHeight/2,i.advancedStyleParams.conic.y=i.textLine.data.length*e.lineHeight/2;break;case"top-start":o=0,a=0,s="top",c="start",i.advancedStyleParams.linear.x0=0,i.advancedStyleParams.linear.x1=e.width,i.advancedStyleParams.radial.x0=e.width/2,i.advancedStyleParams.radial.y0=i.textLine.data.length*e.lineHeight/2,i.advancedStyleParams.radial.x1=e.width/2,i.advancedStyleParams.radial.y1=i.textLine.data.length*e.lineHeight/2,i.advancedStyleParams.conic.x=e.width/2,i.advancedStyleParams.conic.y=i.textLine.data.length*e.lineHeight/2;break;case"top-end":o=e.width,a=0,s="top",c="end",i.advancedStyleParams.linear.x0=0,i.advancedStyleParams.linear.x1=-e.width,i.advancedStyleParams.radial.x0=-e.width/2,i.advancedStyleParams.radial.y0=i.textLine.data.length*e.lineHeight/2,i.advancedStyleParams.radial.x1=-e.width/2,i.advancedStyleParams.radial.y1=i.textLine.data.length*e.lineHeight/2,i.advancedStyleParams.conic.x=-e.width/2,i.advancedStyleParams.conic.y=i.textLine.data.length*e.lineHeight/2;break;case"bottom":o=e.width/2,a=e.height,s="bottom",i.advancedStyleParams.linear.x0=-e.width/2,i.advancedStyleParams.linear.x1=e.width/2,i.advancedStyleParams.radial.y0=-i.textLine.data.length*e.lineHeight/2,i.advancedStyleParams.radial.y1=-i.textLine.data.length*e.lineHeight/2,i.advancedStyleParams.conic.x=0,i.advancedStyleParams.conic.y=-i.textLine.data.length*e.lineHeight/2;break;case"bottom-start":o=0,a=e.height,s="bottom",c="start",i.advancedStyleParams.linear.x0=0,i.advancedStyleParams.linear.x1=e.width,i.advancedStyleParams.radial.x0=e.width/2,i.advancedStyleParams.radial.y0=-i.textLine.data.length*e.lineHeight/2,i.advancedStyleParams.radial.x1=e.width/2,i.advancedStyleParams.radial.y1=-i.textLine.data.length*e.lineHeight/2,i.advancedStyleParams.conic.x=e.width/2,i.advancedStyleParams.conic.y=-i.textLine.data.length*e.lineHeight/2;break;case"bottom-end":o=e.width,a=e.height,s="bottom",c="end",i.advancedStyleParams.linear.x0=0,i.advancedStyleParams.linear.x1=-e.width,i.advancedStyleParams.radial.x0=-e.width/2,i.advancedStyleParams.radial.y0=-i.textLine.data.length*e.lineHeight/2,i.advancedStyleParams.radial.x1=-e.width/2,i.advancedStyleParams.radial.y1=-i.textLine.data.length*e.lineHeight/2,i.advancedStyleParams.conic.x=-e.width/2,i.advancedStyleParams.conic.y=-i.textLine.data.length*e.lineHeight/2;break;case"left":o=0,a=e.height/2,c="start",i.advancedStyleParams.linear.x0=0,i.advancedStyleParams.linear.x1=e.width,i.advancedStyleParams.radial.x0=e.width/2,i.advancedStyleParams.radial.x1=e.width/2,i.advancedStyleParams.conic.x=e.width/2,i.advancedStyleParams.conic.y=0;break;case"right":o=e.width,a=e.height/2,c="end",i.advancedStyleParams.linear.x0=0,i.advancedStyleParams.linear.x1=-e.width,i.advancedStyleParams.radial.x0=-e.width/2,i.advancedStyleParams.radial.x1=-e.width/2,i.advancedStyleParams.conic.x=-e.width/2,i.advancedStyleParams.conic.y=0}if(e.translateX=o,e.translateY=a,ju(null==n?void 0:n.textBaseline)&&(e.textBaseline=s),ju(null==n?void 0:n.textAlign)&&(e.textAlign=c),["text","multi-line-text"].includes(e.contentType))switch(e.textBaseline){case"middle":i.textLine.yOffsetValue=(i.textLine.data.length-1)*e.lineHeight/2;break;case"bottom":case"alphabetic":case"ideographic":i.textLine.yOffsetValue=(i.textLine.data.length-1)*e.lineHeight+(e.lineHeight-parseInt(e.fontSize))/2;break;case"top":case"hanging":i.textLine.yOffsetValue=-e.lineHeight/2+parseInt(e.fontSize)/2}return i}(this.canvas,this.options,this.props)}return t.createCanvas=function(t,e){var n,r=window.devicePixelRatio||1,i=document.createElement("canvas");return i.width=t*r,i.height=e*r,i.style.width="".concat(t,"px"),i.style.height="".concat(e,"px"),null===(n=i.getContext("2d"))||void 0===n||n.setTransform(r,0,0,r,0,0),i},t.clearCanvas=function(t){var e=t.getContext("2d");if(null===e)throw new Error("get context error");e.restore(),e.clearRect(0,0,t.width,t.height)},t.prototype.getCanvas=function(){return this.canvas},t.prototype.clear=function(){t.clearCanvas(this.canvas)},t.prototype.draw=function(){var t=this,e=this.canvas.getContext("2d");if(null===e)throw new Error("get context error");return this.options.auxiliaryLine&&(e.beginPath(),e.rect(0,0,this.options.width,this.options.height),e.lineWidth=1,e.strokeStyle="#000",e.stroke(),e.closePath(),e.beginPath(),e.rect(this.options.translateX,this.options.translateY,1,1),e.lineWidth=1,e.strokeStyle="#f00",e.stroke(),e.closePath()),this.setStyle(e),e.save(),e.translate(this.options.translateX,this.options.translateY),e.rotate(this.options.rotate),new Promise((function(n){switch(t.options.contentType){case"text":t.drawText(e,n);break;case"image":t.drawImage(e,n);break;case"multi-line-text":t.drawMultiLineText(e,n);break;case"rich-text":t.drawRichText(e,n)}}))},t.prototype.setStyle=function(t){var e,n="fillStyle";"stroke"===this.options.textType&&(n="strokeStyle");var r=this.options.fontColor;if(null===(e=this.options)||void 0===e?void 0:e.advancedStyle)switch(this.options.advancedStyle.type){case"linear":r=this.createLinearGradient(t);break;case"radial":r=this.createRadialGradient(t);break;case"conic":r=this.createConicGradient(t);break;case"pattern":r=this.createPattern(t)}t[n]&&r&&(t[n]=r),this.options.textAlign&&(t.textAlign=this.options.textAlign),this.options.textBaseline&&(t.textBaseline=this.options.textBaseline),t.globalAlpha=this.options.globalAlpha,this.options.shadowStyle&&(t.shadowBlur=Du(this.options.shadowStyle.shadowBlur,0),t.shadowColor=Du(this.options.shadowStyle.shadowColor,"#00000000"),t.shadowOffsetX=Du(this.options.shadowStyle.shadowOffsetX,0),t.shadowOffsetY=Du(this.options.shadowStyle.shadowOffsetY,0)),Au(this.options.extraDrawFunc)&&this.options.extraDrawFunc(t)},t.prototype.createLinearGradient=function(t){var e,n,r,i,o,a,s,c,l,u,d,h,f,p,v,y=t.createLinearGradient(Du(null===(r=null===(n=null===(e=this.options.advancedStyle)||void 0===e?void 0:e.params)||void 0===n?void 0:n.linear)||void 0===r?void 0:r.x0,this.recommendOptions.advancedStyleParams.linear.x0),Du(null===(a=null===(o=null===(i=this.options.advancedStyle)||void 0===i?void 0:i.params)||void 0===o?void 0:o.linear)||void 0===a?void 0:a.y0,0),Du(null===(l=null===(c=null===(s=this.options.advancedStyle)||void 0===s?void 0:s.params)||void 0===c?void 0:c.linear)||void 0===l?void 0:l.x1,this.recommendOptions.advancedStyleParams.linear.x1),Du(null===(h=null===(d=null===(u=this.options.advancedStyle)||void 0===u?void 0:u.params)||void 0===d?void 0:d.linear)||void 0===h?void 0:h.y1,0));return null===(v=null===(p=null===(f=this.options)||void 0===f?void 0:f.advancedStyle)||void 0===p?void 0:p.colorStops)||void 0===v||v.forEach((function(t){y.addColorStop(t.offset,t.color)})),y},t.prototype.createConicGradient=function(t){var e,n,r,i,o,a,s,c,l,u,d,h,f,p,v,y=t.createConicGradient(Du(null===(i=null===(r=null===(n=null===(e=this.options)||void 0===e?void 0:e.advancedStyle)||void 0===n?void 0:n.params)||void 0===r?void 0:r.conic)||void 0===i?void 0:i.startAngle,0),Du(null===(c=null===(s=null===(a=null===(o=this.options)||void 0===o?void 0:o.advancedStyle)||void 0===a?void 0:a.params)||void 0===s?void 0:s.conic)||void 0===c?void 0:c.x,this.recommendOptions.advancedStyleParams.conic.x),Du(null===(h=null===(d=null===(u=null===(l=this.options)||void 0===l?void 0:l.advancedStyle)||void 0===u?void 0:u.params)||void 0===d?void 0:d.conic)||void 0===h?void 0:h.y,this.recommendOptions.advancedStyleParams.conic.y));return null===(v=null===(p=null===(f=this.options)||void 0===f?void 0:f.advancedStyle)||void 0===p?void 0:p.colorStops)||void 0===v||v.forEach((function(t){y.addColorStop(t.offset,t.color)})),y},t.prototype.createRadialGradient=function(t){var e,n,r,i,o,a,s,c,l,u,d,h,f,p,v,y,m,g,w,b,x,S,O,P,E,k,T,C=t.createRadialGradient(Du(null===(i=null===(r=null===(n=null===(e=this.options)||void 0===e?void 0:e.advancedStyle)||void 0===n?void 0:n.params)||void 0===r?void 0:r.radial)||void 0===i?void 0:i.x0,this.recommendOptions.advancedStyleParams.radial.x0),Du(null===(c=null===(s=null===(a=null===(o=this.options)||void 0===o?void 0:o.advancedStyle)||void 0===a?void 0:a.params)||void 0===s?void 0:s.radial)||void 0===c?void 0:c.y0,this.recommendOptions.advancedStyleParams.radial.y0),Du(null===(h=null===(d=null===(u=null===(l=this.options)||void 0===l?void 0:l.advancedStyle)||void 0===u?void 0:u.params)||void 0===d?void 0:d.radial)||void 0===h?void 0:h.r0,this.recommendOptions.advancedStyleParams.radial.r0),Du(null===(y=null===(v=null===(p=null===(f=this.options)||void 0===f?void 0:f.advancedStyle)||void 0===p?void 0:p.params)||void 0===v?void 0:v.radial)||void 0===y?void 0:y.x1,this.recommendOptions.advancedStyleParams.radial.x1),Du(null===(b=null===(w=null===(g=null===(m=this.options)||void 0===m?void 0:m.advancedStyle)||void 0===g?void 0:g.params)||void 0===w?void 0:w.radial)||void 0===b?void 0:b.y1,this.recommendOptions.advancedStyleParams.radial.y1),Du(null===(P=null===(O=null===(S=null===(x=this.options)||void 0===x?void 0:x.advancedStyle)||void 0===S?void 0:S.params)||void 0===O?void 0:O.radial)||void 0===P?void 0:P.r1,this.recommendOptions.advancedStyleParams.radial.r1));return null===(T=null===(k=null===(E=this.options)||void 0===E?void 0:E.advancedStyle)||void 0===k?void 0:k.colorStops)||void 0===T||T.forEach((function(t){C.addColorStop(t.offset,t.color)})),C},t.prototype.createPattern=function(t){var e,n,r,i,o,a,s,c;return t.createPattern(null===(i=null===(r=null===(n=null===(e=this.options)||void 0===e?void 0:e.advancedStyle)||void 0===n?void 0:n.params)||void 0===r?void 0:r.pattern)||void 0===i?void 0:i.image,(null===(c=null===(s=null===(a=null===(o=this.options)||void 0===o?void 0:o.advancedStyle)||void 0===a?void 0:a.params)||void 0===s?void 0:s.pattern)||void 0===c?void 0:c.repetition)||"")},t.prototype.setText=function(t,e){var n="fillText";"stroke"===this.options.textType&&(n="strokeText"),t[n]&&t[n](e.text,e.x,e.y,e.maxWidth)},t.prototype.drawText=function(t,e){this.setText(t,{text:this.options.content,x:0,y:0-this.recommendOptions.textLine.yOffsetValue,maxWidth:this.options.textRowMaxWidth||this.options.width}),e(t.canvas)},t.prototype.drawImage=function(t,e){var n=this;Iu(this.options.image).then((function(r){var i=n.getImageRect(r),o=i.width,a=i.height,s=n.getDrawImagePosition(o,a);t.drawImage(r,s.x,s.y,o,a),e(t.canvas)}))},t.prototype.drawMultiLineText=function(t,e){var n=this,r=this.recommendOptions.textLine.data,i=this.recommendOptions.textLine.yOffsetValue;r.forEach((function(e,r){n.setText(t,{text:e,x:0,y:n.options.lineHeight*r-i,maxWidth:n.options.textRowMaxWidth||n.options.width})})),e(t.canvas)},t.prototype.drawRichText=function(t,e){return ku(this,void 0,void 0,(function(){var n,r=this;return Tu(this,(function(i){switch(i.label){case 0:return[4,Ru(t,this.options)];case 1:return n=i.sent(),Iu((o=n.element,a=o.outerHTML.replace(/<(img|br|input|hr|embed)(.*?)>/g,"<$1$2/>").replace(/\n/g,"").replace(/\t/g,"").replace(/#/g,"%23"),"data:image/svg+xml;charset=utf-8,".concat(a)),n.width,n.height).then((function(n){var i=r.getDrawImagePosition(n.width,n.height);t.drawImage(n,i.x,i.y,n.width,n.height),e(t.canvas)})),[2]}var o,a}))}))},t.prototype.getImageRect=function(t){var e={width:this.options.imageWidth||0,height:this.options.imageHeight||0};switch(!0){case 0!==e.width&&0===e.height:e.height=e.width*t.height/t.width;break;case 0===e.width&&0!==e.height:e.width=e.height*t.width/t.height;break;case 0===e.width&&0===e.height:e.width=t.width,e.height=t.height}return e},t.prototype.getDrawImagePosition=function(t,e){var n,r,i={x:-t/2,y:-e/2};switch(this.options.translatePlacement){case"top":i.x=-t/2,i.y=0;break;case"top-start":i.x=0,i.y=0;break;case"top-end":i.x=-t,i.y=0;break;case"bottom":i.x=-t/2,i.y=-e;break;case"bottom-start":i.x=0,i.y=-e;break;case"bottom-end":i.x=-t,i.y=-e;break;case"left":i.x=0,i.y=-e/2;break;case"right":i.x=-t,i.y=-e/2}return!ju(null===(n=this.props)||void 0===n?void 0:n.translateX)&&(i.x=0),!ju(null===(r=this.props)||void 0===r?void 0:r.translateY)&&(i.y=0),i},t}(),Nu=function(){function t(t,e){var n,r,i,o,a,s,c;this.options=t,this.partialWidth=this.options.width,this.partialHeight=this.options.height,this.rows=(null===(n=this.options.gridLayoutOptions)||void 0===n?void 0:n.rows)||1,this.cols=(null===(r=this.options.gridLayoutOptions)||void 0===r?void 0:r.cols)||1,this.matrix=(null===(i=this.options.gridLayoutOptions)||void 0===i?void 0:i.matrix)||(a=this.rows,s=this.cols,c=1,Array.from({length:a},(function(){return new Array(s).fill(c)}))),this.gap=(null===(o=this.options.gridLayoutOptions)||void 0===o?void 0:o.gap)||[0,0],this.partialCanvas=e}return t.prototype.draw=function(){var t,e,n,r,i,o,a,s,c=Hu.createCanvas((null===(t=this.options.gridLayoutOptions)||void 0===t?void 0:t.width)||this.partialWidth*this.cols+this.gap[0]*this.cols,(null===(e=this.options.gridLayoutOptions)||void 0===e?void 0:e.height)||this.partialHeight*this.rows+this.gap[1]*this.rows),l=c.getContext("2d");(null===(n=this.options.gridLayoutOptions)||void 0===n?void 0:n.backgroundImage)&&(null==l||l.drawImage(null===(r=this.options.gridLayoutOptions)||void 0===r?void 0:r.backgroundImage,0,0,null===(i=this.options.gridLayoutOptions)||void 0===i?void 0:i.width,null===(o=this.options.gridLayoutOptions)||void 0===o?void 0:o.height));for(var u=0;u<this.rows;u++)for(var d=0;d<this.cols;d++)(null===(s=null===(a=this.matrix)||void 0===a?void 0:a[u])||void 0===s?void 0:s[d])&&(null==l||l.drawImage(this.partialCanvas,this.partialWidth*d+this.gap[0]*d,this.partialHeight*u+this.gap[1]*u,this.partialWidth,this.partialHeight));return c},t}(),Wu=function(t,e){return"grid"===t.layout?new Nu(t,e).draw():e},Uu=function(){function t(t){void 0===t&&(t={}),this.parentElement=document.body,this.isCreating=!1,this.props=t,this.options=Eu(Eu({},Bu),t),this.changeParentElement(this.options.parent),this.watermarkCanvas=new Hu(this.props,this.options),"undefined"!=typeof window&&(Object.defineProperty(window,"MutationObserver",{writable:!1,configurable:!1}),Object.defineProperty(window,"requestAnimationFrame",{writable:!1,configurable:!1}))}return t.prototype.changeOptions=function(){return ku(this,arguments,void 0,(function(t,e,n){return void 0===t&&(t={}),void 0===e&&(e="overwrite"),void 0===n&&(n=!0),Tu(this,(function(r){switch(r.label){case 0:return this.initConfigData(t,e),n?(this.remove(),[4,this.create()]):[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},t.prototype.create=function(){return ku(this,void 0,void 0,(function(){var t,e,n,r,i,o,a,s,c,l,u,d;return Tu(this,(function(h){switch(h.label){case 0:return this.isCreating?[2]:(this.isCreating=!0,this.validateUnique()&&this.validateContent()?(t=ju(this.watermarkDom),[4,null===(o=this.watermarkCanvas)||void 0===o?void 0:o.draw()]):(this.isCreating=!1,[2]));case 1:if(h.sent(),this.layoutCanvas=Wu(this.options,null===(a=this.watermarkCanvas)||void 0===a?void 0:a.getCanvas()),e=Cu(this.layoutCanvas),null===(s=this.watermarkCanvas)||void 0===s||s.clear(),this.watermarkDom=document.createElement("div"),n=document.createElement("div"),this.watermarkDom.__WATERMARK__="watermark",this.watermarkDom.__WATERMARK__INSTANCE__=this,r=this.checkParentElementType(),this.watermarkDom.style.cssText="\n z-index:".concat(this.options.zIndex,"!important;display:block!important;visibility:visible!important;transform:none!important;scale:none!important;\n ").concat("custom"===r?"top:0!important;bottom:0!important;left:0!important;right:0!important;height:100%!important;pointer-events:none!important;position:absolute!important;":"position:relative!important;","\n "),i=function(t){var e,n,r;if("grid"===t.layout){var i=(null===(e=t.gridLayoutOptions)||void 0===e?void 0:e.cols)||1,o=(null===(n=t.gridLayoutOptions)||void 0===n?void 0:n.rows)||1,a=(null===(r=t.gridLayoutOptions)||void 0===r?void 0:r.gap)||[0,0];return[t.width*i+a[0]*i,t.height*o+a[1]*o]}return[t.width,t.height]}(this.options),n.style.cssText="\n display:block!important;visibility:visible!important;pointer-events:none;top:0;bottom:0;left:0;right:0;transform:none!important;scale:none!important;\n position:".concat("root"===r?"fixed":"absolute","!important;-webkit-print-color-adjust:exact!important;width:100%!important;height:100%!important;\n z-index:").concat(this.options.zIndex,"!important;background-image:url(").concat(e,")!important;background-repeat:").concat(this.options.backgroundRepeat,"!important;\n background-size:").concat(i[0],"px ").concat(i[1],"px!important;background-position:").concat(this.options.backgroundPosition,";\n ").concat(this.options.movable?"animation: 200s ease 0s infinite normal none running watermark !important;":"","\n "),this.watermarkDom.appendChild(n),this.parentElement.appendChild(this.watermarkDom),this.options.mutationObserve)try{this.bindMutationObserve()}catch(t){null===(l=(c=this.options).onObserveError)||void 0===l||l.call(c)}return t&&(null===(d=(u=this.options).onSuccess)||void 0===d||d.call(u)),this.isCreating=!1,[2]}}))}))},t.prototype.destroy=function(){this.remove(),this.watermarkDom=void 0},t.prototype.check=function(){return ku(this,void 0,void 0,(function(){return Tu(this,(function(t){switch(t.label){case 0:return this.parentElement.contains(this.watermarkDom)?[3,2]:(this.remove(),[4,this.create()]);case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t.prototype.remove=function(){var t,e,n,r,i,o,a,s;null===(e=(t=this.options).onBeforeDestroy)||void 0===e||e.call(t),null===(n=this.observer)||void 0===n||n.disconnect(),null===(r=this.parentObserve)||void 0===r||r.disconnect(),this.unbindCheckWatermarkElementEvent(),null===(o=null===(i=this.watermarkDom)||void 0===i?void 0:i.parentNode)||void 0===o||o.removeChild(this.watermarkDom),null===(s=(a=this.options).onDestroyed)||void 0===s||s.call(a)},t.prototype.initConfigData=function(t,e){var n=this;void 0===e&&(e="overwrite"),"append"===e?Object.keys(t).forEach((function(e){n.props&&(n.props[e]=t[e])})):this.props=t,this.options=Eu(Eu({},Bu),this.props),this.changeParentElement(this.options.parent),this.watermarkCanvas=new Hu(this.props,this.options)},t.prototype.changeParentElement=function(t){if("string"==typeof t){var e=document.querySelector(t);e&&(this.parentElement=e)}else this.parentElement=t;this.parentElement||console.error("[WatermarkJsPlus]: please pass a valid parent element.")},t.prototype.validateUnique=function(){var t=!0;return Array.from(this.parentElement.childNodes).forEach((function(e){t&&Object.hasOwnProperty.call(e,"__WATERMARK__")&&(t=!1)})),t},t.prototype.validateContent=function(){switch(this.options.contentType){case"image":return Object.hasOwnProperty.call(this.options,"image");case"multi-line-text":case"rich-text":case"text":return this.options.content.length>0}return!1},t.prototype.checkParentElementType=function(){return["html","body"].includes(this.parentElement.tagName.toLocaleLowerCase())?"root":"custom"},t.prototype.checkWatermarkElement=function(){return ku(this,void 0,void 0,(function(){return Tu(this,(function(t){switch(t.label){case 0:return this.parentElement.contains(this.watermarkDom)?[3,2]:(this.remove(),[4,this.create()]);case 1:t.sent(),t.label=2;case 2:return this.bindCheckWatermarkElementEvent(),[2]}}))}))},t.prototype.bindMutationObserve=function(){var t=this;this.watermarkDom&&(this.bindCheckWatermarkElementEvent(),this.observer=new MutationObserver((function(e){return ku(t,void 0,void 0,(function(){return Tu(this,(function(t){switch(t.label){case 0:return e.length>0?(this.remove(),[4,this.create()]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))})),this.observer.observe(this.watermarkDom,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),this.parentObserve=new MutationObserver((function(e){return ku(t,void 0,void 0,(function(){var t,n,r,i;return Tu(this,(function(o){switch(o.label){case 0:t=0,n=e,o.label=1;case 1:return t<n.length?(null==(r=n[t])?void 0:r.target)===this.watermarkDom||(null===(i=null==r?void 0:r.removedNodes)||void 0===i?void 0:i[0])===this.watermarkDom||"childList"===r.type&&r.target===this.parentElement&&r.target.lastChild!==this.watermarkDom?(this.remove(),[4,this.create()]):[3,3]:[3,4];case 2:o.sent(),o.label=3;case 3:return t++,[3,1];case 4:return[2]}}))}))})),this.parentObserve.observe(this.parentElement,{attributes:!0,childList:!0,subtree:!0,characterData:!0}))},t.prototype.bindCheckWatermarkElementEvent=function(){this.unbindCheckWatermarkElementEvent(),this.checkWatermarkElementRequestID=requestAnimationFrame(this.checkWatermarkElement.bind(this))},t.prototype.unbindCheckWatermarkElementEvent=function(){ju(this.checkWatermarkElementRequestID)||cancelAnimationFrame(this.checkWatermarkElementRequestID)},t}(),Fu=function(t){function e(e){void 0===e&&(e={});return t.call(this,Eu(Eu({},e),{globalAlpha:.005,mode:"blind"}))||this}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Pu(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.decode=function(t){var e=t.url,n=void 0===e?"":e,r=t.fillColor,i=void 0===r?"#000":r,o=t.compositeOperation,a=void 0===o?"color-burn":o,s=t.mode,c=void 0===s?"canvas":s,l=t.compositeTimes,u=void 0===l?3:l,d=t.onSuccess;if(n&&"canvas"===c){var h=new Image;h.src=n,h.addEventListener("load",(function(){var t=h.width,e=h.height,n=Hu.createCanvas(t,e),r=n.getContext("2d");if(!r)throw new Error("get context error");r.drawImage(h,0,0,t,e),r.globalCompositeOperation=a,r.fillStyle=i;for(var o=0;o<u;o++)r.fillRect(0,0,t,e);var s=Cu(n);Au(d)&&(null==d||d(s))}))}},e}(Uu),Mu=function(){function t(t){var e;void 0===t&&(t={}),this.drew=!1,this.props=t,this.options=Eu(Eu({},Bu),t),this.watermarkCanvas=new Hu(this.props,this.options),this.originalSrc=null===(e=this.props.dom)||void 0===e?void 0:e.src,this.backgroundImage=this.getBackgroundImage()}return t.prototype.create=function(){return ku(this,void 0,void 0,(function(){var t,e,n,r,i;return Tu(this,(function(o){switch(o.label){case 0:return this.drew?[2]:[4,null===(t=this.watermarkCanvas)||void 0===t?void 0:t.draw()];case 1:return o.sent(),this.options.layout="grid",this.options.gridLayoutOptions=Eu(Eu({},this.options.gridLayoutOptions),{width:null===(e=this.backgroundImage)||void 0===e?void 0:e.width,height:null===(n=this.backgroundImage)||void 0===n?void 0:n.height,backgroundImage:this.backgroundImage}),this.layoutCanvas=Wu(this.options,null===(r=this.watermarkCanvas)||void 0===r?void 0:r.getCanvas()),this.options.dom.src=Cu(this.layoutCanvas),null===(i=this.watermarkCanvas)||void 0===i||i.clear(),this.drew=!0,[2]}}))}))},t.prototype.destroy=function(){this.options.dom.src=this.originalSrc,this.drew=!1},t.prototype.getBackgroundImage=function(){if(this.options.dom)return this.options.dom},t}();t.BlindWatermark=Fu,t.ImageWatermark=Mu,t.Watermark=Uu}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DecodeBlindWatermarkOptions, WatermarkOptions } from '../types';
|
|
2
|
+
import { Watermark } from './watermark';
|
|
3
|
+
/**
|
|
4
|
+
* BlindWatermark class
|
|
5
|
+
*/
|
|
6
|
+
declare class BlindWatermark extends Watermark {
|
|
7
|
+
/**
|
|
8
|
+
* BlindWatermark constructor
|
|
9
|
+
* @param props - blind watermark options
|
|
10
|
+
*/
|
|
11
|
+
constructor(props?: Partial<WatermarkOptions>);
|
|
12
|
+
/**
|
|
13
|
+
* Decode blind watermark.
|
|
14
|
+
* @param props - decode options
|
|
15
|
+
*/
|
|
16
|
+
static decode(props: Partial<DecodeBlindWatermarkOptions>): void;
|
|
17
|
+
}
|
|
18
|
+
export { BlindWatermark };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { WatermarkOptions } from '../types';
|
|
2
|
+
declare class WatermarkCanvas {
|
|
3
|
+
private readonly options;
|
|
4
|
+
private readonly props?;
|
|
5
|
+
private readonly canvas;
|
|
6
|
+
recommendOptions: {
|
|
7
|
+
image: {
|
|
8
|
+
rect: {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
};
|
|
12
|
+
position: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
textLine: {
|
|
18
|
+
data: string[];
|
|
19
|
+
yOffsetValue: number;
|
|
20
|
+
};
|
|
21
|
+
advancedStyleParams: import("../types").AdvancedStyleParamsType;
|
|
22
|
+
};
|
|
23
|
+
constructor(args: Partial<WatermarkOptions>, options: WatermarkOptions);
|
|
24
|
+
/**
|
|
25
|
+
* Create an HD canvas.
|
|
26
|
+
* @param width - width of canvas
|
|
27
|
+
* @param height - height of canvas
|
|
28
|
+
*/
|
|
29
|
+
static createCanvas(width: number, height: number): HTMLCanvasElement;
|
|
30
|
+
/**
|
|
31
|
+
* Clean the canvas
|
|
32
|
+
* @param canvas
|
|
33
|
+
*/
|
|
34
|
+
static clearCanvas(canvas: HTMLCanvasElement): void;
|
|
35
|
+
getCanvas(): HTMLCanvasElement;
|
|
36
|
+
clear(): void;
|
|
37
|
+
draw(): Promise<HTMLCanvasElement>;
|
|
38
|
+
private setStyle;
|
|
39
|
+
private createLinearGradient;
|
|
40
|
+
private createConicGradient;
|
|
41
|
+
private createRadialGradient;
|
|
42
|
+
private createPattern;
|
|
43
|
+
private setText;
|
|
44
|
+
private drawText;
|
|
45
|
+
private drawImage;
|
|
46
|
+
private drawMultiLineText;
|
|
47
|
+
private drawRichText;
|
|
48
|
+
private getImageRect;
|
|
49
|
+
private getDrawImagePosition;
|
|
50
|
+
}
|
|
51
|
+
export { WatermarkCanvas };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ImageWatermarkOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* ImageWatermark class
|
|
4
|
+
*/
|
|
5
|
+
declare class ImageWatermark {
|
|
6
|
+
private readonly options;
|
|
7
|
+
private readonly props?;
|
|
8
|
+
private watermarkCanvas?;
|
|
9
|
+
private layoutCanvas?;
|
|
10
|
+
private readonly originalSrc?;
|
|
11
|
+
private readonly backgroundImage?;
|
|
12
|
+
private drew;
|
|
13
|
+
/**
|
|
14
|
+
* ImageWatermark constructor
|
|
15
|
+
* @param args - image watermark args
|
|
16
|
+
*/
|
|
17
|
+
constructor(args?: Partial<ImageWatermarkOptions>);
|
|
18
|
+
create(): Promise<void>;
|
|
19
|
+
destroy(): void;
|
|
20
|
+
private getBackgroundImage;
|
|
21
|
+
}
|
|
22
|
+
export { ImageWatermark };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { WatermarkOptions } from '../../types';
|
|
2
|
+
declare class GridLayout {
|
|
3
|
+
private readonly options;
|
|
4
|
+
private readonly partialCanvas;
|
|
5
|
+
private readonly partialWidth;
|
|
6
|
+
private readonly partialHeight;
|
|
7
|
+
private readonly cols;
|
|
8
|
+
private readonly rows;
|
|
9
|
+
private readonly matrix;
|
|
10
|
+
private readonly gap;
|
|
11
|
+
constructor(args: WatermarkOptions, partialCanvas: HTMLCanvasElement);
|
|
12
|
+
draw(): HTMLCanvasElement;
|
|
13
|
+
}
|
|
14
|
+
export { GridLayout };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WatermarkOptions } from '../../types';
|
|
2
|
+
declare const renderLayout: (options: WatermarkOptions, partialCanvas: HTMLCanvasElement) => HTMLCanvasElement;
|
|
3
|
+
declare const generateBackgroundSize: (options: WatermarkOptions) => number[];
|
|
4
|
+
export { renderLayout, generateBackgroundSize };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ChangeOptionsMode, WatermarkOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Watermark class
|
|
4
|
+
*/
|
|
5
|
+
declare class Watermark {
|
|
6
|
+
private options;
|
|
7
|
+
private parentElement;
|
|
8
|
+
private observer?;
|
|
9
|
+
private parentObserve?;
|
|
10
|
+
private watermarkDom?;
|
|
11
|
+
private props?;
|
|
12
|
+
private layoutCanvas?;
|
|
13
|
+
private checkWatermarkElementRequestID?;
|
|
14
|
+
private watermarkCanvas?;
|
|
15
|
+
private isCreating;
|
|
16
|
+
/**
|
|
17
|
+
* Watermark constructor
|
|
18
|
+
* @param args - watermark args
|
|
19
|
+
*/
|
|
20
|
+
constructor(args?: Partial<WatermarkOptions>);
|
|
21
|
+
/**
|
|
22
|
+
* Change watermark options
|
|
23
|
+
* @param args
|
|
24
|
+
* @param mode
|
|
25
|
+
* @param redraw
|
|
26
|
+
*/
|
|
27
|
+
changeOptions(args?: Partial<WatermarkOptions>, mode?: ChangeOptionsMode, redraw?: boolean): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Creating a watermark.
|
|
30
|
+
*/
|
|
31
|
+
create(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Delete this watermark.
|
|
34
|
+
*/
|
|
35
|
+
destroy(): void;
|
|
36
|
+
check(): Promise<void>;
|
|
37
|
+
private remove;
|
|
38
|
+
private initConfigData;
|
|
39
|
+
private changeParentElement;
|
|
40
|
+
private validateUnique;
|
|
41
|
+
private validateContent;
|
|
42
|
+
private checkParentElementType;
|
|
43
|
+
private checkWatermarkElement;
|
|
44
|
+
private bindMutationObserve;
|
|
45
|
+
private bindCheckWatermarkElementEvent;
|
|
46
|
+
private unbindCheckWatermarkElementEvent;
|
|
47
|
+
}
|
|
48
|
+
export { Watermark };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './global.scss';
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
export type ContentTypeType = 'text' | 'image' | 'multi-line-text' | 'rich-text';
|
|
2
|
+
export type LayoutType = 'default' | 'grid';
|
|
3
|
+
export type TextAlignType = 'center' | 'end' | 'left' | 'right' | 'start';
|
|
4
|
+
export type TextBaselineType = 'alphabetic' | 'hanging' | 'ideographic' | 'top' | 'bottom' | 'middle';
|
|
5
|
+
export type CreateWatermarkModeType = 'default' | 'blind';
|
|
6
|
+
export type DecodeBlindWatermarkModeType = 'canvas' | 'html' | 'svg';
|
|
7
|
+
export type TranslatePlacementType = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'right' | 'middle';
|
|
8
|
+
export type TextType = 'fill' | 'stroke';
|
|
9
|
+
export type ChangeOptionsMode = 'overwrite' | 'append';
|
|
10
|
+
export type Matrix<T> = Array<Array<T>>;
|
|
11
|
+
export interface CanvasShadowStyles {
|
|
12
|
+
shadowBlur: number;
|
|
13
|
+
shadowColor: string;
|
|
14
|
+
shadowOffsetX: number;
|
|
15
|
+
shadowOffsetY: number;
|
|
16
|
+
}
|
|
17
|
+
export interface AdvancedStyleParamsType {
|
|
18
|
+
linear: Partial<{
|
|
19
|
+
x0: number;
|
|
20
|
+
y0: number;
|
|
21
|
+
x1: number;
|
|
22
|
+
y1: number;
|
|
23
|
+
}>;
|
|
24
|
+
radial: Partial<{
|
|
25
|
+
x0: number;
|
|
26
|
+
y0: number;
|
|
27
|
+
r0: number;
|
|
28
|
+
x1: number;
|
|
29
|
+
y1: number;
|
|
30
|
+
r1: number;
|
|
31
|
+
}>;
|
|
32
|
+
conic: Partial<{
|
|
33
|
+
startAngle: number;
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
}>;
|
|
37
|
+
pattern: Partial<{
|
|
38
|
+
image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas;
|
|
39
|
+
repetition: string;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
export interface AdvancedStyleType {
|
|
43
|
+
type: 'linear' | 'radial' | 'conic' | 'pattern';
|
|
44
|
+
params?: Partial<AdvancedStyleParamsType>;
|
|
45
|
+
colorStops?: {
|
|
46
|
+
offset: number;
|
|
47
|
+
color: string;
|
|
48
|
+
}[];
|
|
49
|
+
}
|
|
50
|
+
export interface WatermarkDom extends HTMLDivElement {
|
|
51
|
+
__WATERMARK__?: string;
|
|
52
|
+
__WATERMARK__INSTANCE__?: any;
|
|
53
|
+
}
|
|
54
|
+
export interface LayoutOptions {
|
|
55
|
+
}
|
|
56
|
+
export interface GridLayoutOptions extends LayoutOptions {
|
|
57
|
+
rows?: number;
|
|
58
|
+
cols?: number;
|
|
59
|
+
gap?: [number, number];
|
|
60
|
+
matrix?: Matrix<number>;
|
|
61
|
+
width?: number;
|
|
62
|
+
height?: number;
|
|
63
|
+
backgroundImage?: any;
|
|
64
|
+
}
|
|
65
|
+
export interface WatermarkOptions {
|
|
66
|
+
width: number;
|
|
67
|
+
height: number;
|
|
68
|
+
rotate: number;
|
|
69
|
+
layout: LayoutType;
|
|
70
|
+
gridLayoutOptions?: GridLayoutOptions;
|
|
71
|
+
auxiliaryLine: boolean;
|
|
72
|
+
globalAlpha: number;
|
|
73
|
+
zIndex: number;
|
|
74
|
+
mutationObserve: boolean;
|
|
75
|
+
movable: boolean;
|
|
76
|
+
mode: CreateWatermarkModeType;
|
|
77
|
+
parent: Element | string;
|
|
78
|
+
backgroundPosition: string;
|
|
79
|
+
backgroundRepeat: string;
|
|
80
|
+
translatePlacement: TranslatePlacementType;
|
|
81
|
+
translateX?: number;
|
|
82
|
+
translateY?: number;
|
|
83
|
+
contentType: ContentTypeType;
|
|
84
|
+
content: string;
|
|
85
|
+
textType: TextType;
|
|
86
|
+
lineHeight: number;
|
|
87
|
+
fontSize: string;
|
|
88
|
+
fontFamily: string;
|
|
89
|
+
fontStyle: string;
|
|
90
|
+
fontVariant: string;
|
|
91
|
+
fontColor: string;
|
|
92
|
+
fontWeight: string;
|
|
93
|
+
textAlign?: TextAlignType;
|
|
94
|
+
textBaseline?: TextBaselineType;
|
|
95
|
+
filter: string;
|
|
96
|
+
letterSpacing: string;
|
|
97
|
+
wordSpacing: string;
|
|
98
|
+
textRowMaxWidth?: number;
|
|
99
|
+
richTextWidth?: number;
|
|
100
|
+
richTextHeight?: number;
|
|
101
|
+
image?: string;
|
|
102
|
+
imageWidth: number;
|
|
103
|
+
imageHeight: number;
|
|
104
|
+
shadowStyle?: Partial<CanvasShadowStyles>;
|
|
105
|
+
advancedStyle?: AdvancedStyleType;
|
|
106
|
+
extraDrawFunc?: Function;
|
|
107
|
+
onSuccess: Function;
|
|
108
|
+
onBeforeDestroy: Function;
|
|
109
|
+
onDestroyed: Function;
|
|
110
|
+
onObserveError: Function;
|
|
111
|
+
}
|
|
112
|
+
export interface DecodeBlindWatermarkOptions {
|
|
113
|
+
url: string;
|
|
114
|
+
fillColor: string;
|
|
115
|
+
compositeOperation: string;
|
|
116
|
+
mode: DecodeBlindWatermarkModeType;
|
|
117
|
+
compositeTimes: number;
|
|
118
|
+
onSuccess: Function;
|
|
119
|
+
}
|
|
120
|
+
export interface CustomContentSVGType {
|
|
121
|
+
element: Element;
|
|
122
|
+
width: number;
|
|
123
|
+
height: number;
|
|
124
|
+
}
|
|
125
|
+
export interface ImageWatermarkOptions extends WatermarkOptions {
|
|
126
|
+
dom: HTMLImageElement;
|
|
127
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CustomContentSVGType, WatermarkOptions } from '../types';
|
|
2
|
+
export declare const convertImage: (canvas: HTMLCanvasElement) => string;
|
|
3
|
+
export declare const isFunction: (value: Function) => boolean;
|
|
4
|
+
export declare const isUndefined: (value: any) => boolean;
|
|
5
|
+
export declare const isString: (value: any) => boolean;
|
|
6
|
+
export declare const createSVGElement: (tagName: string, attrs?: {
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
}, namespaceURI?: string) => Element;
|
|
9
|
+
export declare const getMultiLineData: (ctx: CanvasRenderingContext2D, text: string, maxWidth: number) => string[];
|
|
10
|
+
export declare const createCustomContentSVG: (ctx: CanvasRenderingContext2D, options: WatermarkOptions) => Promise<CustomContentSVGType>;
|
|
11
|
+
export declare const convertSVGToImage: (svg: Element) => string;
|
|
12
|
+
export declare const getValue: (v1: any, v2: any) => any;
|
|
13
|
+
export declare const loadImage: (url: string, width?: number | undefined, height?: number | undefined) => Promise<HTMLImageElement>;
|
|
14
|
+
export declare const generateMatrix: (rows: number, columns: number, value: any) => any[][];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AdvancedStyleParamsType, WatermarkOptions } from '../types';
|
|
2
|
+
export declare const initialOptions: WatermarkOptions;
|
|
3
|
+
export declare const generateRecommendOptions: (canvas: HTMLCanvasElement, options: WatermarkOptions, args: Partial<WatermarkOptions>) => {
|
|
4
|
+
image: {
|
|
5
|
+
rect: {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
};
|
|
9
|
+
position: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
textLine: {
|
|
15
|
+
data: string[];
|
|
16
|
+
yOffsetValue: number;
|
|
17
|
+
};
|
|
18
|
+
advancedStyleParams: AdvancedStyleParamsType;
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|