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.
Files changed (47) hide show
  1. package/dist/ie/index.cjs.js +4461 -0
  2. package/dist/ie/index.cjs.js.map +1 -0
  3. package/dist/ie/index.cjs.min.js +1 -0
  4. package/dist/ie/index.esm.js +4457 -0
  5. package/dist/ie/index.esm.js.map +1 -0
  6. package/dist/ie/index.esm.min.js +1 -0
  7. package/dist/ie/index.iife.js +4466 -0
  8. package/dist/ie/index.iife.js.map +1 -0
  9. package/dist/ie/index.iife.min.js +1 -0
  10. package/dist/ie/index.umd.js +4467 -0
  11. package/dist/ie/index.umd.js.map +1 -0
  12. package/dist/ie/index.umd.min.js +1 -0
  13. package/dist/ie/types/src/core/blind.d.ts +18 -0
  14. package/dist/ie/types/src/core/canvas.d.ts +51 -0
  15. package/dist/ie/types/src/core/image.d.ts +22 -0
  16. package/dist/ie/types/src/core/layout/grid.d.ts +14 -0
  17. package/dist/ie/types/src/core/layout/index.d.ts +4 -0
  18. package/dist/ie/types/src/core/watermark.d.ts +48 -0
  19. package/dist/ie/types/src/index.d.ts +5 -0
  20. package/dist/ie/types/src/index.ie.d.ts +6 -0
  21. package/dist/ie/types/src/style/index.d.ts +1 -0
  22. package/dist/ie/types/src/types/index.d.ts +127 -0
  23. package/dist/ie/types/src/utils/bootstrap.d.ts +2 -0
  24. package/dist/ie/types/src/utils/index.d.ts +14 -0
  25. package/dist/ie/types/src/utils/initialization.d.ts +19 -0
  26. package/dist/ie/types/tests/core/blind.test.d.ts +1 -0
  27. package/dist/ie/types/tests/core/image.test.d.ts +1 -0
  28. package/dist/ie/types/tests/core/watermark.test.d.ts +1 -0
  29. package/dist/ie/types/tests/utils/index.d.ts +1 -0
  30. package/dist/ie/types/tests/utils/index.test.d.ts +1 -0
  31. package/dist/index.cjs.js +33 -12
  32. package/dist/index.cjs.js.map +1 -1
  33. package/dist/index.cjs.min.js +1 -1
  34. package/dist/index.esm.js +33 -12
  35. package/dist/index.esm.js.map +1 -1
  36. package/dist/index.esm.min.js +1 -1
  37. package/dist/index.iife.js +33 -12
  38. package/dist/index.iife.js.map +1 -1
  39. package/dist/index.iife.min.js +1 -1
  40. package/dist/index.umd.js +33 -12
  41. package/dist/index.umd.js.map +1 -1
  42. package/dist/index.umd.min.js +1 -1
  43. package/dist/types/src/core/watermark.d.ts +1 -0
  44. package/dist/types/src/index.ie.d.ts +6 -0
  45. package/package.json +35 -26
  46. package/dist/types/docs/components/config.d.ts +0 -72
  47. package/dist/types/jest.setup.d.ts +0 -1
@@ -0,0 +1 @@
1
+ var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},e=function(t){return t&&t.Math===Math&&t},n=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof t&&t)||e("object"==typeof t&&t)||function(){return this}()||Function("return this")(),r={},i=function(t){try{return!!t()}catch(t){return!0}},o=!i((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),a=!i((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),s=a,c=Function.prototype.call,l=s?c.bind(c):function(){return c.apply(c,arguments)},u={},d={}.propertyIsEnumerable,h=Object.getOwnPropertyDescriptor,f=h&&!d.call({1:2},1);u.f=f?function(t){var e=h(this,t);return!!e&&e.enumerable}:d;var p,v,y=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},m=a,g=Function.prototype,w=g.call,b=m&&g.bind.bind(w,w),x=m?b:function(t){return function(){return w.apply(t,arguments)}},S=x,O=S({}.toString),P=S("".slice),E=function(t){return P(O(t),8,-1)},k=i,T=E,C=Object,A=x("".split),j=k((function(){return!C("z").propertyIsEnumerable(0)}))?function(t){return"String"===T(t)?A(t,""):C(t)}:C,_=function(t){return null==t},R=_,L=TypeError,D=function(t){if(R(t))throw new L("Can't call method on "+t);return t},I=j,B=D,H=function(t){return I(B(t))},N="object"==typeof document&&document.all,U=void 0===N&&void 0!==N?function(t){return"function"==typeof t||t===N}:function(t){return"function"==typeof t},F=U,W=function(t){return"object"==typeof t?null!==t:F(t)},M=n,G=U,q=function(t,e){return arguments.length<2?(n=M[t],G(n)?n:void 0):M[t]&&M[t][e];var n},z=x({}.isPrototypeOf),V=n.navigator,X=V&&V.userAgent,Y=X?String(X):"",$=n,K=Y,J=$.process,Z=$.Deno,Q=J&&J.versions||Z&&Z.version,tt=Q&&Q.v8;tt&&(v=(p=tt.split("."))[0]>0&&p[0]<4?1:+(p[0]+p[1])),!v&&K&&(!(p=K.match(/Edge\/(\d+)/))||p[1]>=74)&&(p=K.match(/Chrome\/(\d+)/))&&(v=+p[1]);var et=v,nt=et,rt=i,it=n.String,ot=!!Object.getOwnPropertySymbols&&!rt((function(){var t=Symbol("symbol detection");return!it(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&nt&&nt<41})),at=ot&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,st=q,ct=U,lt=z,ut=Object,dt=at?function(t){return"symbol"==typeof t}:function(t){var e=st("Symbol");return ct(e)&&lt(e.prototype,ut(t))},ht=String,ft=function(t){try{return ht(t)}catch(t){return"Object"}},pt=U,vt=ft,yt=TypeError,mt=function(t){if(pt(t))return t;throw new yt(vt(t)+" is not a function")},gt=mt,wt=_,bt=function(t,e){var n=t[e];return wt(n)?void 0:gt(n)},xt=l,St=U,Ot=W,Pt=TypeError,Et={exports:{}},kt=n,Tt=Object.defineProperty,Ct=function(t,e){try{Tt(kt,t,{value:e,configurable:!0,writable:!0})}catch(n){kt[t]=e}return e},At=n,jt=Ct,_t="__core-js_shared__",Rt=Et.exports=At[_t]||jt(_t,{});(Rt.versions||(Rt.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 Lt=Et.exports,Dt=Lt,It=function(t,e){return Dt[t]||(Dt[t]=e||{})},Bt=D,Ht=Object,Nt=function(t){return Ht(Bt(t))},Ut=Nt,Ft=x({}.hasOwnProperty),Wt=Object.hasOwn||function(t,e){return Ft(Ut(t),e)},Mt=x,Gt=0,qt=Math.random(),zt=Mt(1..toString),Vt=function(t){return"Symbol("+(void 0===t?"":t)+")_"+zt(++Gt+qt,36)},Xt=It,Yt=Wt,$t=Vt,Kt=ot,Jt=at,Zt=n.Symbol,Qt=Xt("wks"),te=Jt?Zt.for||Zt:Zt&&Zt.withoutSetter||$t,ee=function(t){return Yt(Qt,t)||(Qt[t]=Kt&&Yt(Zt,t)?Zt[t]:te("Symbol."+t)),Qt[t]},ne=l,re=W,ie=dt,oe=bt,ae=function(t,e){var n,r;if("string"===e&&St(n=t.toString)&&!Ot(r=xt(n,t)))return r;if(St(n=t.valueOf)&&!Ot(r=xt(n,t)))return r;if("string"!==e&&St(n=t.toString)&&!Ot(r=xt(n,t)))return r;throw new Pt("Can't convert object to primitive value")},se=TypeError,ce=ee("toPrimitive"),le=function(t,e){if(!re(t)||ie(t))return t;var n,r=oe(t,ce);if(r){if(void 0===e&&(e="default"),n=ne(r,t,e),!re(n)||ie(n))return n;throw new se("Can't convert object to primitive value")}return void 0===e&&(e="number"),ae(t,e)},ue=dt,de=function(t){var e=le(t,"string");return ue(e)?e:e+""},he=W,fe=n.document,pe=he(fe)&&he(fe.createElement),ve=function(t){return pe?fe.createElement(t):{}},ye=ve,me=!o&&!i((function(){return 7!==Object.defineProperty(ye("div"),"a",{get:function(){return 7}}).a})),ge=o,we=l,be=u,xe=y,Se=H,Oe=de,Pe=Wt,Ee=me,ke=Object.getOwnPropertyDescriptor;r.f=ge?ke:function(t,e){if(t=Se(t),e=Oe(e),Ee)try{return ke(t,e)}catch(t){}if(Pe(t,e))return xe(!we(be.f,t,e),t[e])};var Te={},Ce=o&&i((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Ae=W,je=String,_e=TypeError,Re=function(t){if(Ae(t))return t;throw new _e(je(t)+" is not an object")},Le=o,De=me,Ie=Ce,Be=Re,He=de,Ne=TypeError,Ue=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,We="enumerable",Me="configurable",Ge="writable";Te.f=Le?Ie?function(t,e,n){if(Be(t),e=He(e),Be(n),"function"==typeof t&&"prototype"===e&&"value"in n&&Ge in n&&!n[Ge]){var r=Fe(t,e);r&&r[Ge]&&(t[e]=n.value,n={configurable:Me in n?n[Me]:r[Me],enumerable:We in n?n[We]:r[We],writable:!1})}return Ue(t,e,n)}:Ue:function(t,e,n){if(Be(t),e=He(e),Be(n),De)try{return Ue(t,e,n)}catch(t){}if("get"in n||"set"in n)throw new Ne("Accessors not supported");return"value"in n&&(t[e]=n.value),t};var qe=Te,ze=y,Ve=o?function(t,e,n){return qe.f(t,e,ze(1,n))}:function(t,e,n){return t[e]=n,t},Xe={exports:{}},Ye=o,$e=Wt,Ke=Function.prototype,Je=Ye&&Object.getOwnPropertyDescriptor,Ze=$e(Ke,"name"),Qe={EXISTS:Ze,PROPER:Ze&&"something"===function(){}.name,CONFIGURABLE:Ze&&(!Ye||Ye&&Je(Ke,"name").configurable)},tn=U,en=Lt,nn=x(Function.toString);tn(en.inspectSource)||(en.inspectSource=function(t){return nn(t)});var rn,on,an,sn=en.inspectSource,cn=U,ln=n.WeakMap,un=cn(ln)&&/native code/.test(String(ln)),dn=Vt,hn=It("keys"),fn=function(t){return hn[t]||(hn[t]=dn(t))},pn={},vn=un,yn=n,mn=W,gn=Ve,wn=Wt,bn=Lt,xn=fn,Sn=pn,On="Object already initialized",Pn=yn.TypeError,En=yn.WeakMap;if(vn||bn.state){var kn=bn.state||(bn.state=new En);kn.get=kn.get,kn.has=kn.has,kn.set=kn.set,rn=function(t,e){if(kn.has(t))throw new Pn(On);return e.facade=t,kn.set(t,e),e},on=function(t){return kn.get(t)||{}},an=function(t){return kn.has(t)}}else{var Tn=xn("state");Sn[Tn]=!0,rn=function(t,e){if(wn(t,Tn))throw new Pn(On);return e.facade=t,gn(t,Tn,e),e},on=function(t){return wn(t,Tn)?t[Tn]:{}},an=function(t){return wn(t,Tn)}}var Cn={set:rn,get:on,has:an,enforce:function(t){return an(t)?on(t):rn(t,{})},getterFor:function(t){return function(e){var n;if(!mn(e)||(n=on(e)).type!==t)throw new Pn("Incompatible receiver, "+t+" required");return n}}},An=x,jn=i,_n=U,Rn=Wt,Ln=o,Dn=Qe.CONFIGURABLE,In=sn,Bn=Cn.enforce,Hn=Cn.get,Nn=String,Un=Object.defineProperty,Fn=An("".slice),Wn=An("".replace),Mn=An([].join),Gn=Ln&&!jn((function(){return 8!==Un((function(){}),"length",{value:8}).length})),qn=String(String).split("String"),zn=Xe.exports=function(t,e,n){"Symbol("===Fn(Nn(e),0,7)&&(e="["+Wn(Nn(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!Rn(t,"name")||Dn&&t.name!==e)&&(Ln?Un(t,"name",{value:e,configurable:!0}):t.name=e),Gn&&n&&Rn(n,"arity")&&t.length!==n.arity&&Un(t,"length",{value:n.arity});try{n&&Rn(n,"constructor")&&n.constructor?Ln&&Un(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=Bn(t);return Rn(r,"source")||(r.source=Mn(qn,"string"==typeof e?e:"")),t};Function.prototype.toString=zn((function(){return _n(this)&&Hn(this).source||In(this)}),"toString");var Vn=Xe.exports,Xn=U,Yn=Te,$n=Vn,Kn=Ct,Jn=function(t,e,n,r){r||(r={});var i=r.enumerable,o=void 0!==r.name?r.name:e;if(Xn(n)&&$n(n,o,r),r.global)i?t[e]=n:Kn(e,n);else{try{r.unsafe?t[e]&&(i=!0):delete t[e]}catch(t){}i?t[e]=n:Yn.f(t,e,{value:n,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return t},Zn={},Qn=Math.ceil,tr=Math.floor,er=Math.trunc||function(t){var e=+t;return(e>0?tr:Qn)(e)},nr=function(t){var e=+t;return e!=e||0===e?0:er(e)},rr=nr,ir=Math.max,or=Math.min,ar=function(t,e){var n=rr(t);return n<0?ir(n+e,0):or(n,e)},sr=nr,cr=Math.min,lr=function(t){var e=sr(t);return e>0?cr(e,9007199254740991):0},ur=function(t){return lr(t.length)},dr=H,hr=ar,fr=ur,pr=function(t){return function(e,n,r){var i=dr(e),o=fr(i);if(0===o)return!t&&-1;var a,s=hr(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}},vr={includes:pr(!0),indexOf:pr(!1)},yr=Wt,mr=H,gr=vr.indexOf,wr=pn,br=x([].push),xr=function(t,e){var n,r=mr(t),i=0,o=[];for(n in r)!yr(wr,n)&&yr(r,n)&&br(o,n);for(;e.length>i;)yr(r,n=e[i++])&&(~gr(o,n)||br(o,n));return o},Sr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Or=xr,Pr=Sr.concat("length","prototype");Zn.f=Object.getOwnPropertyNames||function(t){return Or(t,Pr)};var Er={};Er.f=Object.getOwnPropertySymbols;var kr=q,Tr=Zn,Cr=Er,Ar=Re,jr=x([].concat),_r=kr("Reflect","ownKeys")||function(t){var e=Tr.f(Ar(t)),n=Cr.f;return n?jr(e,n(t)):e},Rr=Wt,Lr=_r,Dr=r,Ir=Te,Br=i,Hr=U,Nr=/#|\.prototype\./,Ur=function(t,e){var n=Wr[Fr(t)];return n===Gr||n!==Mr&&(Hr(e)?Br(e):!!e)},Fr=Ur.normalize=function(t){return String(t).replace(Nr,".").toLowerCase()},Wr=Ur.data={},Mr=Ur.NATIVE="N",Gr=Ur.POLYFILL="P",qr=Ur,zr=n,Vr=r.f,Xr=Ve,Yr=Jn,$r=Ct,Kr=function(t,e,n){for(var r=Lr(e),i=Ir.f,o=Dr.f,a=0;a<r.length;a++){var s=r[a];Rr(t,s)||n&&Rr(n,s)||i(t,s,o(e,s))}},Jr=qr,Zr=function(t,e){var n,r,i,o,a,s=t.target,c=t.global,l=t.stat;if(n=c?zr:l?zr[s]||$r(s,{}):zr[s]&&zr[s].prototype)for(r in e){if(o=e[r],i=t.dontCallGetSet?(a=Vr(n,r))&&a.value:n[r],!Jr(c?r:s+(l?".":"#")+r,t.forced)&&void 0!==i){if(typeof o==typeof i)continue;Kr(o,i)}(t.sham||i&&i.sham)&&Xr(o,"sham",!0),Yr(n,r,o,t)}},Qr=E,ti=x,ei=function(t){if("Function"===Qr(t))return ti(t)},ni=mt,ri=a,ii=ei(ei.bind),oi=function(t,e){return ni(t),void 0===e?t:ri?ii(t,e):function(){return t.apply(e,arguments)}},ai=l,si=Re,ci=bt,li=function(t,e,n){var r,i;si(t);try{if(!(r=ci(t,"return"))){if("throw"===e)throw n;return n}r=ai(r,t)}catch(t){i=!0,r=t}if("throw"===e)throw n;if(i)throw r;return si(r),n},ui=Re,di=li,hi={},fi=hi,pi=ee("iterator"),vi=Array.prototype,yi=function(t){return void 0!==t&&(fi.Array===t||vi[pi]===t)},mi={};mi[ee("toStringTag")]="z";var gi="[object z]"===String(mi),wi=U,bi=E,xi=ee("toStringTag"),Si=Object,Oi="Arguments"===bi(function(){return arguments}()),Pi=gi?bi: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=Si(t),xi))?n:Oi?bi(e):"Object"===(r=bi(e))&&wi(e.callee)?"Arguments":r},Ei=x,ki=i,Ti=U,Ci=Pi,Ai=sn,ji=function(){},_i=q("Reflect","construct"),Ri=/^\s*(?:class|function)\b/,Li=Ei(Ri.exec),Di=!Ri.test(ji),Ii=function(t){if(!Ti(t))return!1;try{return _i(ji,[],t),!0}catch(t){return!1}},Bi=function(t){if(!Ti(t))return!1;switch(Ci(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Di||!!Li(Ri,Ai(t))}catch(t){return!0}};Bi.sham=!0;var Hi=!_i||ki((function(){var t;return Ii(Ii.call)||!Ii(Object)||!Ii((function(){t=!0}))||t}))?Bi:Ii,Ni=o,Ui=Te,Fi=y,Wi=Pi,Mi=bt,Gi=_,qi=hi,zi=ee("iterator"),Vi=function(t){if(!Gi(t))return Mi(t,zi)||Mi(t,"@@iterator")||qi[Wi(t)]},Xi=l,Yi=mt,$i=Re,Ki=ft,Ji=Vi,Zi=TypeError,Qi=function(t,e){var n=arguments.length<2?Ji(t):e;if(Yi(n))return $i(Xi(n,t));throw new Zi(Ki(t)+" is not iterable")},to=oi,eo=l,no=Nt,ro=function(t,e,n,r){try{return r?e(ui(n)[0],n[1]):e(n)}catch(e){di(t,"throw",e)}},io=yi,oo=Hi,ao=ur,so=function(t,e,n){Ni?Ui.f(t,e,Fi(0,n)):t[e]=n},co=Qi,lo=Vi,uo=Array,ho=ee("iterator"),fo=!1;try{var po=0,vo={next:function(){return{done:!!po++}},return:function(){fo=!0}};vo[ho]=function(){return this},Array.from(vo,(function(){throw 2}))}catch(t){}var yo=function(t,e){try{if(!e&&!fo)return!1}catch(t){return!1}var n=!1;try{var r={};r[ho]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n},mo=function(t){var e=no(t),n=oo(this),r=arguments.length,i=r>1?arguments[1]:void 0,o=void 0!==i;o&&(i=to(i,r>2?arguments[2]:void 0));var a,s,c,l,u,d,h=lo(e),f=0;if(!h||this===uo&&io(h))for(a=ao(e),s=n?new this(a):uo(a);a>f;f++)d=o?i(e[f],f):e[f],so(s,f,d);else for(s=n?new this:[],u=(l=co(e,h)).next;!(c=eo(u,l)).done;f++)d=o?ro(l,i,[c.value,f],!0):c.value,so(s,f,d);return s.length=f,s};Zr({target:"Array",stat:!0,forced:!yo((function(t){Array.from(t)}))},{from:mo});var go,wo,bo,xo,So=n,Oo=Y,Po=E,Eo=function(t){return Oo.slice(0,t.length)===t},ko=Eo("Bun/")?"BUN":Eo("Cloudflare-Workers")?"CLOUDFLARE":Eo("Deno/")?"DENO":Eo("Node.js/")?"NODE":So.Bun&&"string"==typeof Bun.version?"BUN":So.Deno&&"object"==typeof Deno.version?"DENO":"process"===Po(So.process)?"NODE":So.window&&So.document?"BROWSER":"REST",To="NODE"===ko,Co=x,Ao=mt,jo=W,_o=function(t){return jo(t)||null===t},Ro=String,Lo=TypeError,Do=function(t,e,n){try{return Co(Ao(Object.getOwnPropertyDescriptor(t,e)[n]))}catch(t){}},Io=W,Bo=D,Ho=function(t){if(_o(t))return t;throw new Lo("Can't set "+Ro(t)+" as a prototype")},No=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=Do(Object.prototype,"__proto__","set"))(n,[]),e=n instanceof Array}catch(t){}return function(n,r){return Bo(n),Ho(r),Io(n)?(e?t(n,r):n.__proto__=r,n):n}}():void 0),Uo=Te.f,Fo=Wt,Wo=ee("toStringTag"),Mo=Vn,Go=Te,qo=q,zo=function(t,e,n){return n.get&&Mo(n.get,e,{getter:!0}),n.set&&Mo(n.set,e,{setter:!0}),Go.f(t,e,n)},Vo=o,Xo=ee("species"),Yo=z,$o=TypeError,Ko=Hi,Jo=ft,Zo=TypeError,Qo=Re,ta=function(t){if(Ko(t))return t;throw new Zo(Jo(t)+" is not a constructor")},ea=_,na=ee("species"),ra=a,ia=Function.prototype,oa=ia.apply,aa=ia.call,sa="object"==typeof Reflect&&Reflect.apply||(ra?aa.bind(oa):function(){return aa.apply(oa,arguments)}),ca=q("document","documentElement"),la=x([].slice),ua=TypeError,da=/(?:ipad|iphone|ipod).*applewebkit/i.test(Y),ha=n,fa=sa,pa=oi,va=U,ya=Wt,ma=i,ga=ca,wa=la,ba=ve,xa=function(t,e){if(t<e)throw new ua("Not enough arguments");return t},Sa=da,Oa=To,Pa=ha.setImmediate,Ea=ha.clearImmediate,ka=ha.process,Ta=ha.Dispatch,Ca=ha.Function,Aa=ha.MessageChannel,ja=ha.String,_a=0,Ra={},La="onreadystatechange";ma((function(){go=ha.location}));var Da=function(t){if(ya(Ra,t)){var e=Ra[t];delete Ra[t],e()}},Ia=function(t){return function(){Da(t)}},Ba=function(t){Da(t.data)},Ha=function(t){ha.postMessage(ja(t),go.protocol+"//"+go.host)};Pa&&Ea||(Pa=function(t){xa(arguments.length,1);var e=va(t)?t:Ca(t),n=wa(arguments,1);return Ra[++_a]=function(){fa(e,void 0,n)},wo(_a),_a},Ea=function(t){delete Ra[t]},Oa?wo=function(t){ka.nextTick(Ia(t))}:Ta&&Ta.now?wo=function(t){Ta.now(Ia(t))}:Aa&&!Sa?(xo=(bo=new Aa).port2,bo.port1.onmessage=Ba,wo=pa(xo.postMessage,xo)):ha.addEventListener&&va(ha.postMessage)&&!ha.importScripts&&go&&"file:"!==go.protocol&&!ma(Ha)?(wo=Ha,ha.addEventListener("message",Ba,!1)):wo=La in ba("script")?function(t){ga.appendChild(ba("script"))[La]=function(){ga.removeChild(this),Da(t)}}:function(t){setTimeout(Ia(t),0)});var Na={set:Pa,clear:Ea},Ua=n,Fa=o,Wa=Object.getOwnPropertyDescriptor,Ma=function(){this.head=null,this.tail=null};Ma.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 Ga,qa,za,Va,Xa,Ya=Ma,$a=/ipad|iphone|ipod/i.test(Y)&&"undefined"!=typeof Pebble,Ka=/web0s(?!.*chrome)/i.test(Y),Ja=n,Za=function(t){if(!Fa)return Ua[t];var e=Wa(Ua,t);return e&&e.value},Qa=oi,ts=Na.set,es=Ya,ns=da,rs=$a,is=Ka,os=To,as=Ja.MutationObserver||Ja.WebKitMutationObserver,ss=Ja.document,cs=Ja.process,ls=Ja.Promise,us=Za("queueMicrotask");if(!us){var ds=new es,hs=function(){var t,e;for(os&&(t=cs.domain)&&t.exit();e=ds.get();)try{e()}catch(t){throw ds.head&&Ga(),t}t&&t.enter()};ns||os||is||!as||!ss?!rs&&ls&&ls.resolve?((Va=ls.resolve(void 0)).constructor=ls,Xa=Qa(Va.then,Va),Ga=function(){Xa(hs)}):os?Ga=function(){cs.nextTick(hs)}:(ts=Qa(ts,Ja),Ga=function(){ts(hs)}):(qa=!0,za=ss.createTextNode(""),new as(hs).observe(za,{characterData:!0}),Ga=function(){za.data=qa=!qa}),us=function(t){ds.head||Ga(),ds.add(t)}}var fs=us,ps=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},vs=n.Promise,ys=n,ms=vs,gs=U,ws=qr,bs=sn,xs=ee,Ss=ko,Os=et;ms&&ms.prototype;var Ps=xs("species"),Es=!1,ks=gs(ys.PromiseRejectionEvent),Ts=ws("Promise",(function(){var t=bs(ms),e=t!==String(ms);if(!e&&66===Os)return!0;if(!Os||Os<51||!/native code/.test(t)){var n=new ms((function(t){t(1)})),r=function(t){t((function(){}),(function(){}))};if((n.constructor={})[Ps]=r,!(Es=n.then((function(){}))instanceof r))return!0}return!(e||"BROWSER"!==Ss&&"DENO"!==Ss||ks)})),Cs={CONSTRUCTOR:Ts,REJECTION_EVENT:ks,SUBCLASSING:Es},As={},js=mt,_s=TypeError,Rs=function(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw new _s("Bad Promise constructor");e=t,n=r})),this.resolve=js(e),this.reject=js(n)};As.f=function(t){return new Rs(t)};var Ls,Ds,Is,Bs=Zr,Hs=To,Ns=n,Us=l,Fs=Jn,Ws=No,Ms=function(t,e,n){t&&!n&&(t=t.prototype),t&&!Fo(t,Wo)&&Uo(t,Wo,{configurable:!0,value:e})},Gs=function(t){var e=qo(t);Vo&&e&&!e[Xo]&&zo(e,Xo,{configurable:!0,get:function(){return this}})},qs=mt,zs=U,Vs=W,Xs=function(t,e){if(Yo(e,t))return t;throw new $o("Incorrect invocation")},Ys=function(t,e){var n,r=Qo(t).constructor;return void 0===r||ea(n=Qo(r)[na])?e:ta(n)},$s=Na.set,Ks=fs,Js=function(t,e){},Zs=ps,Qs=Ya,tc=Cn,ec=vs,nc=As,rc="Promise",ic=Cs.CONSTRUCTOR,oc=Cs.REJECTION_EVENT,ac=Cs.SUBCLASSING,sc=tc.getterFor(rc),cc=tc.set,lc=ec&&ec.prototype,uc=ec,dc=lc,hc=Ns.TypeError,fc=Ns.document,pc=Ns.process,vc=nc.f,yc=vc,mc=!!(fc&&fc.createEvent&&Ns.dispatchEvent),gc="unhandledrejection",wc=function(t){var e;return!(!Vs(t)||!zs(e=t.then))&&e},bc=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&&Ec(e),e.rejection=1),!0===s?n=o:(u&&u.enter(),n=s(o),u&&(u.exit(),i=!0)),n===t.promise?l(new hc("Promise-chain cycle")):(r=wc(n))?Us(r,n,c,l):c(n)):l(o)}catch(t){u&&!i&&u.exit(),l(t)}},xc=function(t,e){t.notified||(t.notified=!0,Ks((function(){for(var n,r=t.reactions;n=r.get();)bc(n,t);t.notified=!1,e&&!t.rejection&&Oc(t)})))},Sc=function(t,e,n){var r,i;mc?((r=fc.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),Ns.dispatchEvent(r)):r={promise:e,reason:n},!oc&&(i=Ns["on"+t])?i(r):t===gc&&Js("Unhandled promise rejection",n)},Oc=function(t){Us($s,Ns,(function(){var e,n=t.facade,r=t.value;if(Pc(t)&&(e=Zs((function(){Hs?pc.emit("unhandledRejection",r,n):Sc(gc,n,r)})),t.rejection=Hs||Pc(t)?2:1,e.error))throw e.value}))},Pc=function(t){return 1!==t.rejection&&!t.parent},Ec=function(t){Us($s,Ns,(function(){var e=t.facade;Hs?pc.emit("rejectionHandled",e):Sc("rejectionhandled",e,t.value)}))},kc=function(t,e,n){return function(r){t(e,r,n)}},Tc=function(t,e,n){t.done||(t.done=!0,n&&(t=n),t.value=e,t.state=2,xc(t,!0))},Cc=function(t,e,n){if(!t.done){t.done=!0,n&&(t=n);try{if(t.facade===e)throw new hc("Promise can't be resolved itself");var r=wc(e);r?Ks((function(){var n={done:!1};try{Us(r,e,kc(Cc,n,t),kc(Tc,n,t))}catch(e){Tc(n,e,t)}})):(t.value=e,t.state=1,xc(t,!1))}catch(e){Tc({done:!1},e,t)}}};if(ic&&(dc=(uc=function(t){Xs(this,dc),qs(t),Us(Ls,this);var e=sc(this);try{t(kc(Cc,e),kc(Tc,e))}catch(t){Tc(e,t)}}).prototype,(Ls=function(t){cc(this,{type:rc,done:!1,notified:!1,parent:!1,reactions:new Qs,rejection:!1,state:0,value:null})}).prototype=Fs(dc,"then",(function(t,e){var n=sc(this),r=vc(Ys(this,uc));return n.parent=!0,r.ok=!zs(t)||t,r.fail=zs(e)&&e,r.domain=Hs?pc.domain:void 0,0===n.state?n.reactions.add(r):Ks((function(){bc(r,n)})),r.promise})),Ds=function(){var t=new Ls,e=sc(t);this.promise=t,this.resolve=kc(Cc,e),this.reject=kc(Tc,e)},nc.f=vc=function(t){return t===uc||undefined===t?new Ds(t):yc(t)},zs(ec)&&lc!==Object.prototype)){Is=lc.then,ac||Fs(lc,"then",(function(t,e){var n=this;return new uc((function(t,e){Us(Is,n,t,e)})).then(t,e)}),{unsafe:!0});try{delete lc.constructor}catch(t){}Ws&&Ws(lc,dc)}Bs({global:!0,constructor:!0,wrap:!0,forced:ic},{Promise:uc}),Ms(uc,rc,!1),Gs(rc);var Ac=oi,jc=l,_c=Re,Rc=ft,Lc=yi,Dc=ur,Ic=z,Bc=Qi,Hc=Vi,Nc=li,Uc=TypeError,Fc=function(t,e){this.stopped=t,this.result=e},Wc=Fc.prototype,Mc=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=Ac(e,u),y=function(t){return r&&Nc(r,"normal",t),new Fc(!0,t)},m=function(t){return d?(_c(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=Hc(t)))throw new Uc(Rc(t)+" is not iterable");if(Lc(i)){for(o=0,a=Dc(t);a>o;o++)if((s=m(t[o]))&&Ic(Wc,s))return s;return new Fc(!1)}r=Bc(t,i)}for(c=h?t.next:r.next;!(l=jc(c,r)).done;){try{s=m(l.value)}catch(t){Nc(r,"throw",t)}if("object"==typeof s&&s&&Ic(Wc,s))return s}return new Fc(!1)},Gc=vs,qc=Cs.CONSTRUCTOR||!yo((function(t){Gc.all(t).then(void 0,(function(){}))})),zc=l,Vc=mt,Xc=As,Yc=ps,$c=Mc;Zr({target:"Promise",stat:!0,forced:qc},{all:function(t){var e=this,n=Xc.f(e),r=n.resolve,i=n.reject,o=Yc((function(){var n=Vc(e.resolve),o=[],a=0,s=1;$c(t,(function(t){var c=a++,l=!1;s++,zc(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 Kc=Zr,Jc=Cs.CONSTRUCTOR,Zc=vs,Qc=q,tl=U,el=Jn,nl=Zc&&Zc.prototype;if(Kc({target:"Promise",proto:!0,forced:Jc,real:!0},{catch:function(t){return this.then(void 0,t)}}),tl(Zc)){var rl=Qc("Promise").prototype.catch;nl.catch!==rl&&el(nl,"catch",rl,{unsafe:!0})}var il=l,ol=mt,al=As,sl=ps,cl=Mc;Zr({target:"Promise",stat:!0,forced:qc},{race:function(t){var e=this,n=al.f(e),r=n.reject,i=sl((function(){var i=ol(e.resolve);cl(t,(function(t){il(i,e,t).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var ll=As;Zr({target:"Promise",stat:!0,forced:Cs.CONSTRUCTOR},{reject:function(t){var e=ll.f(this);return(0,e.reject)(t),e.promise}});var ul=Re,dl=W,hl=As,fl=Zr,pl=Cs.CONSTRUCTOR,vl=function(t,e){if(ul(t),dl(e)&&e.constructor===t)return e;var n=hl.f(t);return(0,n.resolve)(e),n.promise};q("Promise"),fl({target:"Promise",stat:!0,forced:pl},{resolve:function(t){return vl(this,t)}});var yl={},ml=xr,gl=Sr,wl=Object.keys||function(t){return ml(t,gl)},bl=o,xl=Ce,Sl=Te,Ol=Re,Pl=H,El=wl;yl.f=bl&&!xl?Object.defineProperties:function(t,e){Ol(t);for(var n,r=Pl(e),i=El(e),o=i.length,a=0;o>a;)Sl.f(t,n=i[a++],r[n]);return t};var kl,Tl=Re,Cl=yl,Al=Sr,jl=pn,_l=ca,Rl=ve,Ll="prototype",Dl="script",Il=fn("IE_PROTO"),Bl=function(){},Hl=function(t){return"<"+Dl+">"+t+"</"+Dl+">"},Nl=function(t){t.write(Hl("")),t.close();var e=t.parentWindow.Object;return t=null,e},Ul=function(){try{kl=new ActiveXObject("htmlfile")}catch(t){}var t,e,n;Ul="undefined"!=typeof document?document.domain&&kl?Nl(kl):(e=Rl("iframe"),n="java"+Dl+":",e.style.display="none",_l.appendChild(e),e.src=String(n),(t=e.contentWindow.document).open(),t.write(Hl("document.F=Object")),t.close(),t.F):Nl(kl);for(var r=Al.length;r--;)delete Ul[Ll][Al[r]];return Ul()};jl[Il]=!0;var Fl=ee,Wl=Object.create||function(t,e){var n;return null!==t?(Bl[Ll]=Tl(t),n=new Bl,Bl[Ll]=null,n[Il]=t):n=Ul(),void 0===e?n:Cl.f(n,e)},Ml=Te.f,Gl=Fl("unscopables"),ql=Array.prototype;void 0===ql[Gl]&&Ml(ql,Gl,{configurable:!0,value:Wl(null)});var zl=function(t){ql[Gl][t]=!0},Vl=vr.includes,Xl=zl;Zr({target:"Array",proto:!0,forced:i((function(){return!Array(1).includes()}))},{includes:function(t){return Vl(this,t,arguments.length>1?arguments[1]:void 0)}}),Xl("includes");var Yl=Nt,$l=ar,Kl=ur,Jl=zl;Zr({target:"Array",proto:!0},{fill:function(t){for(var e=Yl(this),n=Kl(e),r=arguments.length,i=$l(r>1?arguments[1]:void 0,n),o=r>2?arguments[2]:void 0,a=void 0===o?n:$l(o,n);a>i;)e[i++]=t;return e}}),Jl("fill");var Zl="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||"undefined"!=typeof global&&global||{},Ql="URLSearchParams"in Zl,tu="Symbol"in Zl&&"iterator"in Symbol,eu="FileReader"in Zl&&"Blob"in Zl&&function(){try{return new Blob,!0}catch(t){return!1}}(),nu="FormData"in Zl,ru="ArrayBuffer"in Zl;if(ru)var iu=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],ou=ArrayBuffer.isView||function(t){return t&&iu.indexOf(Object.prototype.toString.call(t))>-1};function au(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 su(t){return"string"!=typeof t&&(t=String(t)),t}function cu(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return tu&&(e[Symbol.iterator]=function(){return e}),e}function lu(t){this.map={},t instanceof lu?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 uu(t){if(!t._noBody)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function du(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function hu(t){var e=new FileReader,n=du(e);return e.readAsArrayBuffer(t),n}function fu(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function pu(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:eu&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:nu&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:Ql&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():ru&&eu&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=fu(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):ru&&(ArrayBuffer.prototype.isPrototypeOf(t)||ou(t))?this._bodyArrayBuffer=fu(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):Ql&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},eu&&(this.blob=function(){var t=uu(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=uu(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(eu)return this.blob().then(hu);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t=uu(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,n=du(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)},nu&&(this.formData=function(){return this.text().then(mu)}),this.json=function(){return this.text().then(JSON.parse)},this}lu.prototype.append=function(t,e){t=au(t),e=su(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},lu.prototype.delete=function(t){delete this.map[au(t)]},lu.prototype.get=function(t){return t=au(t),this.has(t)?this.map[t]:null},lu.prototype.has=function(t){return this.map.hasOwnProperty(au(t))},lu.prototype.set=function(t,e){this.map[au(t)]=su(e)},lu.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},lu.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),cu(t)},lu.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),cu(t)},lu.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),cu(t)},tu&&(lu.prototype[Symbol.iterator]=lu.prototype.entries);var vu=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function yu(t,e){if(!(this instanceof yu))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 yu){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new lu(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 lu(e.headers)),this.method=function(t){var e=t.toUpperCase();return vu.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 Zl)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 mu(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 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.');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 lu(e.headers),this.url=e.url||"",this._initBody(t)}yu.prototype.clone=function(){return new yu(this,{body:this._bodyInit})},pu.call(yu.prototype),pu.call(gu.prototype),gu.prototype.clone=function(){return new gu(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new lu(this.headers),url:this.url})},gu.error=function(){var t=new gu(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var wu=[301,302,303,307,308];gu.redirect=function(t,e){if(-1===wu.indexOf(e))throw new RangeError("Invalid status code");return new gu(null,{status:e,headers:{location:t}})};var bu=Zl.DOMException;try{new bu}catch(t){(bu=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack}).prototype=Object.create(Error.prototype),bu.prototype.constructor=bu}function xu(t,e){return new Promise((function(n,r){var i=new yu(t,e);if(i.signal&&i.signal.aborted)return r(new bu("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 lu,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 gu(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 bu("Aborted","AbortError"))}),0)},o.open(i.method,function(t){try{return""===t&&Zl.location.href?Zl.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&&(eu?o.responseType="blob":ru&&(o.responseType="arraybuffer")),e&&"object"==typeof e.headers&&!(e.headers instanceof lu||Zl.Headers&&e.headers instanceof Zl.Headers)){var s=[];Object.getOwnPropertyNames(e.headers).forEach((function(t){s.push(au(t)),o.setRequestHeader(t,su(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)}))}xu.polyfill=!0,Zl.fetch||(Zl.fetch=xu,Zl.Headers=lu,Zl.Request=yu,Zl.Response=gu);!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 Su=function(t,e){return Su=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])},Su(t,e)};var Ou=function(){return Ou=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},Ou.apply(this,arguments)};function Pu(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 Eu(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 ku=function(t){return t.toDataURL("image/png",1)},Tu=function(t){return"function"==typeof t},Cu=function(t){return void 0===t},Au=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},ju=function(t,e){return Pu(void 0,void 0,void 0,(function(){var n,r,i,o,a,s,c,l,u;return Eu(this,(function(d){switch(d.label){case 0:return n=Au("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,_u(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=Au("foreignObject",{width:s.toString(),height:c.toString()})).appendChild(r),n.appendChild(l),[2,{element:n,width:s,height:c}]}}))}))};function _u(t){return Pu(this,void 0,void 0,(function(){var e,n,r,i,o;return Eu(this,(function(a){switch(a.label){case 0:e=t.querySelectorAll("img"),n=function(t){var e,n,r,i;return Eu(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 Ru=function(t,e){return Cu(t)?e:t},Lu=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"),!Cu(e)&&(r.width=e),!Cu(n)&&(r.height=n),r.src=t,new Promise((function(t){r.onload=function(){t(r)}}))},Du={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(){}},Iu=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)),Cu(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(Cu(null==n?void 0:n.translateX)||Cu(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,Cu(null==n?void 0:n.textBaseline)&&(e.textBaseline=s),Cu(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=Ru(this.options.shadowStyle.shadowBlur,0),t.shadowColor=Ru(this.options.shadowStyle.shadowColor,"#00000000"),t.shadowOffsetX=Ru(this.options.shadowStyle.shadowOffsetX,0),t.shadowOffsetY=Ru(this.options.shadowStyle.shadowOffsetY,0)),Tu(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(Ru(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),Ru(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),Ru(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),Ru(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(Ru(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),Ru(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),Ru(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(Ru(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),Ru(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),Ru(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),Ru(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),Ru(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),Ru(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;Lu(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 Pu(this,void 0,void 0,(function(){var n,r=this;return Eu(this,(function(i){switch(i.label){case 0:return[4,ju(t,this.options)];case 1:return n=i.sent(),Lu((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!Cu(null===(n=this.props)||void 0===n?void 0:n.translateX)&&(i.x=0),!Cu(null===(r=this.props)||void 0===r?void 0:r.translateY)&&(i.y=0),i},t}(),Bu=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=Iu.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}(),Hu=function(t,e){return"grid"===t.layout?new Bu(t,e).draw():e},Nu=function(){function t(t){void 0===t&&(t={}),this.parentElement=document.body,this.isCreating=!1,this.props=t,this.options=Ou(Ou({},Du),t),this.changeParentElement(this.options.parent),this.watermarkCanvas=new Iu(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 Pu(this,arguments,void 0,(function(t,e,n){return void 0===t&&(t={}),void 0===e&&(e="overwrite"),void 0===n&&(n=!0),Eu(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 Pu(this,void 0,void 0,(function(){var t,e,n,r,i,o,a,s,c,l,u,d;return Eu(this,(function(h){switch(h.label){case 0:return this.isCreating?[2]:(this.isCreating=!0,this.validateUnique()&&this.validateContent()?(t=Cu(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=Hu(this.options,null===(a=this.watermarkCanvas)||void 0===a?void 0:a.getCanvas()),e=ku(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 Pu(this,void 0,void 0,(function(){return Eu(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=Ou(Ou({},Du),this.props),this.changeParentElement(this.options.parent),this.watermarkCanvas=new Iu(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 Pu(this,void 0,void 0,(function(){return Eu(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 Pu(t,void 0,void 0,(function(){return Eu(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 Pu(t,void 0,void 0,(function(){var t,n,r,i;return Eu(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(){Cu(this.checkWatermarkElementRequestID)||cancelAnimationFrame(this.checkWatermarkElementRequestID)},t}(),Uu=function(t){function e(e){void 0===e&&(e={});return t.call(this,Ou(Ou({},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}Su(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=Iu.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=ku(n);Tu(d)&&(null==d||d(s))}))}},e}(Nu),Fu=function(){function t(t){var e;void 0===t&&(t={}),this.drew=!1,this.props=t,this.options=Ou(Ou({},Du),t),this.watermarkCanvas=new Iu(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 Pu(this,void 0,void 0,(function(){var t,e,n,r,i;return Eu(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=Ou(Ou({},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=Hu(this.options,null===(r=this.watermarkCanvas)||void 0===r?void 0:r.getCanvas()),this.options.dom.src=ku(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}();export{Uu as BlindWatermark,Fu as ImageWatermark,Nu as Watermark};