image-salon-sdk 1.0.46 → 1.0.47

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.
@@ -1,8 +1,8 @@
1
1
  import './style.css';
2
- (function(ne,le){typeof exports=="object"&&typeof module<"u"?module.exports=le():typeof define=="function"&&define.amd?define(le):(ne=typeof globalThis<"u"?globalThis:ne||self,ne.ImageSalonSdk=le())})(this,function(){"use strict";var Ds=Object.defineProperty;var qr=ne=>{throw TypeError(ne)};var Rs=(ne,le,he)=>le in ne?Ds(ne,le,{enumerable:!0,configurable:!0,writable:!0,value:he}):ne[le]=he;var pe=(ne,le,he)=>Rs(ne,typeof le!="symbol"?le+"":le,he),Kr=(ne,le,he)=>le.has(ne)||qr("Cannot "+he);var F=(ne,le,he)=>(Kr(ne,le,"read from private field"),he?he.call(ne):le.get(ne)),X=(ne,le,he)=>le.has(ne)?qr("Cannot add the same private member more than once"):le instanceof WeakSet?le.add(ne):le.set(ne,he),$=(ne,le,he,Ut)=>(Kr(ne,le,"write to private field"),Ut?Ut.call(ne,he):le.set(ne,he),he);var pt,et,Ht,At,Ae,ve,mt,we,Ie,ot,je,Ot,vt,at,tt,kt,$t,Yt,Ft,Nt,gt,St,lt,ct,It,Lt,wt,Wt,en,De,yt,tn,An,nn,_e,Pt,Tt,jt,vn,kn,Zt;function ne(s){let e=typeof s;if(e=="object"){if(Array.isArray(s))return"array";if(s===null)return"null"}return e}function le(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}let he="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Ut=[];for(let s=0;s<he.length;s++)Ut[he[s].charCodeAt(0)]=s;Ut[45]=he.indexOf("+"),Ut[95]=he.indexOf("/");function Zn(s){let e=s.length*3/4;s[s.length-2]=="="?e-=2:s[s.length-1]=="="&&(e-=1);let t=new Uint8Array(e),n=0,r=0,i,o=0;for(let a=0;a<s.length;a++){if(i=Ut[s.charCodeAt(a)],i===void 0)switch(s[a]){case"=":r=0;case`
3
- `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(r){case 0:o=i,r=1;break;case 1:t[n++]=o<<2|(i&48)>>4,o=i,r=2;break;case 2:t[n++]=(o&15)<<4|(i&60)>>2,o=i,r=3;break;case 3:t[n++]=(o&3)<<6|i,r=0;break}}if(r==1)throw Error("invalid base64 string.");return t.subarray(0,n)}function qn(s){let e="",t=0,n,r=0;for(let i=0;i<s.length;i++)switch(n=s[i],t){case 0:e+=he[n>>2],r=(n&3)<<4,t=1;break;case 1:e+=he[r|n>>4],r=(n&15)<<2,t=2;break;case 2:e+=he[r|n>>6],e+=he[n&63],t=0;break}return t&&(e+=he[r],e+="=",t==1&&(e+="=")),e}var G;(function(s){s.symbol=Symbol.for("protobuf-ts/unknown"),s.onRead=(t,n,r,i,o)=>{(e(n)?n[s.symbol]:n[s.symbol]=[]).push({no:r,wireType:i,data:o})},s.onWrite=(t,n,r)=>{for(let{no:i,wireType:o,data:a}of s.list(n))r.tag(i,o).raw(a)},s.list=(t,n)=>{if(e(t)){let r=t[s.symbol];return n?r.filter(i=>i.no==n):r}return[]},s.last=(t,n)=>s.list(t,n).slice(-1)[0];const e=t=>t&&Array.isArray(t[s.symbol])})(G||(G={}));function zr(s,e){return Object.assign(Object.assign({},s),e)}var j;(function(s){s[s.Varint=0]="Varint",s[s.Bit64=1]="Bit64",s[s.LengthDelimited=2]="LengthDelimited",s[s.StartGroup=3]="StartGroup",s[s.EndGroup=4]="EndGroup",s[s.Bit32=5]="Bit32"})(j||(j={}));function Xr(){let s=0,e=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(s|=(r&127)<<n,!(r&128))return this.assertBounds(),[s,e]}let t=this.buf[this.pos++];if(s|=(t&15)<<28,e=(t&112)>>4,!(t&128))return this.assertBounds(),[s,e];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(e|=(r&127)<<n,!(r&128))return this.assertBounds(),[s,e]}throw new Error("invalid varint")}function Nn(s,e,t){for(let i=0;i<28;i=i+7){const o=s>>>i,a=!(!(o>>>7)&&e==0),c=(a?o|128:o)&255;if(t.push(c),!a)return}const n=s>>>28&15|(e&7)<<4,r=!!(e>>3);if(t.push((r?n|128:n)&255),!!r){for(let i=3;i<31;i=i+7){const o=e>>>i,a=!!(o>>>7),c=(a?o|128:o)&255;if(t.push(c),!a)return}t.push(e>>>31&1)}}const sn=65536*65536;function Kn(s){let e=s[0]=="-";e&&(s=s.slice(1));const t=1e6;let n=0,r=0;function i(o,a){const c=Number(s.slice(o,a));r*=t,n=n*t+c,n>=sn&&(r=r+(n/sn|0),n=n%sn)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),[e,n,r]}function In(s,e){if(e>>>0<=2097151)return""+(sn*e+(s>>>0));let t=s&16777215,n=(s>>>24|e<<8)>>>0&16777215,r=e>>16&65535,i=t+n*6777216+r*6710656,o=n+r*8147497,a=r*2,c=1e7;i>=c&&(o+=Math.floor(i/c),i%=c),o>=c&&(a+=Math.floor(o/c),o%=c);function h(l,u){let d=l?String(l):"";return u?"0000000".slice(d.length)+d:d}return h(a,0)+h(o,a)+h(i,1)}function zn(s,e){if(s>=0){for(;s>127;)e.push(s&127|128),s=s>>>7;e.push(s)}else{for(let t=0;t<9;t++)e.push(s&127|128),s=s>>7;e.push(1)}}function Gr(){let s=this.buf[this.pos++],e=s&127;if(!(s&128))return this.assertBounds(),e;if(s=this.buf[this.pos++],e|=(s&127)<<7,!(s&128))return this.assertBounds(),e;if(s=this.buf[this.pos++],e|=(s&127)<<14,!(s&128))return this.assertBounds(),e;if(s=this.buf[this.pos++],e|=(s&127)<<21,!(s&128))return this.assertBounds(),e;s=this.buf[this.pos++],e|=(s&15)<<28;for(let t=5;s&128&&t<10;t++)s=this.buf[this.pos++];if(s&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}let ie;function Jr(){const s=new DataView(new ArrayBuffer(8));ie=globalThis.BigInt!==void 0&&typeof s.getBigInt64=="function"&&typeof s.getBigUint64=="function"&&typeof s.setBigInt64=="function"&&typeof s.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:s}:void 0}Jr();function Xn(s){if(!s)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}const Gn=/^-?[0-9]+$/,on=4294967296,an=2147483648;class Jn{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*on+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}}class Oe extends Jn{static from(e){if(ie)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=ie.C(e);case"number":if(e===0)return this.ZERO;e=ie.C(e);case"bigint":if(!e)return this.ZERO;if(e<ie.UMIN)throw new Error("signed value for ulong");if(e>ie.UMAX)throw new Error("ulong too large");return ie.V.setBigUint64(0,e,!0),new Oe(ie.V.getInt32(0,!0),ie.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!Gn.test(e))throw new Error("string is no integer");let[t,n,r]=Kn(e);if(t)throw new Error("signed value for ulong");return new Oe(n,r);case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");if(e<0)throw new Error("signed value for ulong");return new Oe(e,e/on)}throw new Error("unknown value "+typeof e)}toString(){return ie?this.toBigInt().toString():In(this.lo,this.hi)}toBigInt(){return Xn(ie),ie.V.setInt32(0,this.lo,!0),ie.V.setInt32(4,this.hi,!0),ie.V.getBigUint64(0,!0)}}Oe.ZERO=new Oe(0,0);class Ce extends Jn{static from(e){if(ie)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=ie.C(e);case"number":if(e===0)return this.ZERO;e=ie.C(e);case"bigint":if(!e)return this.ZERO;if(e<ie.MIN)throw new Error("signed long too small");if(e>ie.MAX)throw new Error("signed long too large");return ie.V.setBigInt64(0,e,!0),new Ce(ie.V.getInt32(0,!0),ie.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!Gn.test(e))throw new Error("string is no integer");let[t,n,r]=Kn(e);if(t){if(r>an||r==an&&n!=0)throw new Error("signed long too small")}else if(r>=an)throw new Error("signed long too large");let i=new Ce(n,r);return t?i.negate():i;case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");return e>0?new Ce(e,e/on):new Ce(-e,-e/on).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return(this.hi&an)!==0}negate(){let e=~this.hi,t=this.lo;return t?t=~t+1:e+=1,new Ce(t,e)}toString(){if(ie)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+In(e.lo,e.hi)}return In(this.lo,this.hi)}toBigInt(){return Xn(ie),ie.V.setInt32(0,this.lo,!0),ie.V.setInt32(4,this.hi,!0),ie.V.getBigInt64(0,!0)}}Ce.ZERO=new Ce(0,0);const Qn={readUnknownField:!0,readerFactory:s=>new Yr(s)};function Qr(s){return s?Object.assign(Object.assign({},Qn),s):Qn}class Yr{constructor(e,t){this.varint64=Xr,this.uint32=Gr,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e){let t=this.pos;switch(e){case j.Varint:for(;this.buf[this.pos++]&128;);break;case j.Bit64:this.pos+=4;case j.Bit32:this.pos+=4;break;case j.LengthDelimited:let n=this.uint32();this.pos+=n;break;case j.StartGroup:let r;for(;(r=this.tag()[1])!==j.EndGroup;)this.skip(r);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(t,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return new Ce(...this.varint64())}uint64(){return new Oe(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,new Ce(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new Oe(this.sfixed32(),this.sfixed32())}sfixed64(){return new Ce(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}}function J(s,e){if(!s)throw new Error(e)}const ei=34028234663852886e22,ti=-34028234663852886e22,ni=4294967295,ri=2147483647,ii=-2147483648;function Xt(s){if(typeof s!="number")throw new Error("invalid int 32: "+typeof s);if(!Number.isInteger(s)||s>ri||s<ii)throw new Error("invalid int 32: "+s)}function ln(s){if(typeof s!="number")throw new Error("invalid uint 32: "+typeof s);if(!Number.isInteger(s)||s>ni||s<0)throw new Error("invalid uint 32: "+s)}function Ln(s){if(typeof s!="number")throw new Error("invalid float 32: "+typeof s);if(Number.isFinite(s)&&(s>ei||s<ti))throw new Error("invalid float 32: "+s)}const Yn={writeUnknownFields:!0,writerFactory:()=>new oi};function si(s){return s?Object.assign(Object.assign({},Yn),s):Yn}class oi{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let t=new Uint8Array(e),n=0;for(let r=0;r<this.chunks.length;r++)t.set(this.chunks[r],n),n+=this.chunks[r].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(ln(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return Xt(e),zn(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){Ln(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){ln(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){Xt(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return Xt(e),e=(e<<1^e>>31)>>>0,zn(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=Ce.from(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=Oe.from(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=Ce.from(e);return Nn(t.lo,t.hi,this.buf),this}sint64(e){let t=Ce.from(e),n=t.hi>>31,r=t.lo<<1^n,i=(t.hi<<1|t.lo>>>31)^n;return Nn(r,i,this.buf),this}uint64(e){let t=Oe.from(e);return Nn(t.lo,t.hi,this.buf),this}}const er={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},tr={ignoreUnknownFields:!1};function ai(s){return s?Object.assign(Object.assign({},tr),s):tr}function li(s){return s?Object.assign(Object.assign({},er),s):er}function ci(s,e){var t,n;let r=Object.assign(Object.assign({},s),e);return r.typeRegistry=[...(t=s==null?void 0:s.typeRegistry)!==null&&t!==void 0?t:[],...(n=e==null?void 0:e.typeRegistry)!==null&&n!==void 0?n:[]],r}const nr=Symbol.for("protobuf-ts/message-type");function Tn(s){let e=!1;const t=[];for(let n=0;n<s.length;n++){let r=s.charAt(n);r=="_"?e=!0:/\d/.test(r)?(t.push(r),e=!0):e?(t.push(r.toUpperCase()),e=!1):n==0?t.push(r.toLowerCase()):t.push(r)}return t.join("")}var D;(function(s){s[s.DOUBLE=1]="DOUBLE",s[s.FLOAT=2]="FLOAT",s[s.INT64=3]="INT64",s[s.UINT64=4]="UINT64",s[s.INT32=5]="INT32",s[s.FIXED64=6]="FIXED64",s[s.FIXED32=7]="FIXED32",s[s.BOOL=8]="BOOL",s[s.STRING=9]="STRING",s[s.BYTES=12]="BYTES",s[s.UINT32=13]="UINT32",s[s.SFIXED32=15]="SFIXED32",s[s.SFIXED64=16]="SFIXED64",s[s.SINT32=17]="SINT32",s[s.SINT64=18]="SINT64"})(D||(D={}));var rt;(function(s){s[s.BIGINT=0]="BIGINT",s[s.STRING=1]="STRING",s[s.NUMBER=2]="NUMBER"})(rt||(rt={}));var cn;(function(s){s[s.NO=0]="NO",s[s.PACKED=1]="PACKED",s[s.UNPACKED=2]="UNPACKED"})(cn||(cn={}));function di(s){var e,t,n,r;return s.localName=(e=s.localName)!==null&&e!==void 0?e:Tn(s.name),s.jsonName=(t=s.jsonName)!==null&&t!==void 0?t:Tn(s.name),s.repeat=(n=s.repeat)!==null&&n!==void 0?n:cn.NO,s.opt=(r=s.opt)!==null&&r!==void 0?r:s.repeat||s.oneof?!1:s.kind=="message",s}function hi(s){if(typeof s!="object"||s===null||!s.hasOwnProperty("oneofKind"))return!1;switch(typeof s.oneofKind){case"string":return s[s.oneofKind]===void 0?!1:Object.keys(s).length==2;case"undefined":return Object.keys(s).length==1;default:return!1}}class ui{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}prepare(){if(this.data)return;const e=[],t=[],n=[];for(let r of this.fields)if(r.oneof)n.includes(r.oneof)||(n.push(r.oneof),e.push(r.oneof),t.push(r.oneof));else switch(t.push(r.localName),r.kind){case"scalar":case"enum":(!r.opt||r.repeat)&&e.push(r.localName);break;case"message":r.repeat&&e.push(r.localName);break;case"map":e.push(r.localName);break}this.data={req:e,known:t,oneofs:Object.values(n)}}is(e,t,n=!1){if(t<0)return!0;if(e==null||typeof e!="object")return!1;this.prepare();let r=Object.keys(e),i=this.data;if(r.length<i.req.length||i.req.some(o=>!r.includes(o))||!n&&r.some(o=>!i.known.includes(o)))return!1;if(t<1)return!0;for(const o of i.oneofs){const a=e[o];if(!hi(a))return!1;if(a.oneofKind===void 0)continue;const c=this.fields.find(h=>h.localName===a.oneofKind);if(!c||!this.field(a[a.oneofKind],c,n,t))return!1}for(const o of this.fields)if(o.oneof===void 0&&!this.field(e[o.localName],o,n,t))return!1;return!0}field(e,t,n,r){let i=t.repeat;switch(t.kind){case"scalar":return e===void 0?t.opt:i?this.scalars(e,t.T,r,t.L):this.scalar(e,t.T,t.L);case"enum":return e===void 0?t.opt:i?this.scalars(e,D.INT32,r):this.scalar(e,D.INT32);case"message":return e===void 0?!0:i?this.messages(e,t.T(),n,r):this.message(e,t.T(),n,r);case"map":if(typeof e!="object"||e===null)return!1;if(r<2)return!0;if(!this.mapKeys(e,t.K,r))return!1;switch(t.V.kind){case"scalar":return this.scalars(Object.values(e),t.V.T,r,t.V.L);case"enum":return this.scalars(Object.values(e),D.INT32,r);case"message":return this.messages(Object.values(e),t.V.T(),n,r)}break}return!0}message(e,t,n,r){return n?t.isAssignable(e,r):t.is(e,r)}messages(e,t,n,r){if(!Array.isArray(e))return!1;if(r<2)return!0;if(n){for(let i=0;i<e.length&&i<r;i++)if(!t.isAssignable(e[i],r-1))return!1}else for(let i=0;i<e.length&&i<r;i++)if(!t.is(e[i],r-1))return!1;return!0}scalar(e,t,n){let r=typeof e;switch(t){case D.UINT64:case D.FIXED64:case D.INT64:case D.SFIXED64:case D.SINT64:switch(n){case rt.BIGINT:return r=="bigint";case rt.NUMBER:return r=="number"&&!isNaN(e);default:return r=="string"}case D.BOOL:return r=="boolean";case D.STRING:return r=="string";case D.BYTES:return e instanceof Uint8Array;case D.DOUBLE:case D.FLOAT:return r=="number"&&!isNaN(e);default:return r=="number"&&Number.isInteger(e)}}scalars(e,t,n,r){if(!Array.isArray(e))return!1;if(n<2)return!0;if(Array.isArray(e)){for(let i=0;i<e.length&&i<n;i++)if(!this.scalar(e[i],t,r))return!1}return!0}mapKeys(e,t,n){let r=Object.keys(e);switch(t){case D.INT32:case D.FIXED32:case D.SFIXED32:case D.SINT32:case D.UINT32:return this.scalars(r.slice(0,n).map(i=>parseInt(i)),t,n);case D.BOOL:return this.scalars(r.slice(0,n).map(i=>i=="true"?!0:i=="false"?!1:i),t,n);default:return this.scalars(r,t,n,rt.STRING)}}}function Ge(s,e){switch(e){case rt.BIGINT:return s.toBigInt();case rt.NUMBER:return s.toNumber();default:return s.toString()}}class fi{constructor(e){this.info=e}prepare(){var e;if(this.fMap===void 0){this.fMap={};const t=(e=this.info.fields)!==null&&e!==void 0?e:[];for(const n of t)this.fMap[n.name]=n,this.fMap[n.jsonName]=n,this.fMap[n.localName]=n}}assert(e,t,n){if(!e){let r=ne(n);throw(r=="number"||r=="boolean")&&(r=n.toString()),new Error(`Cannot parse JSON ${r} for ${this.info.typeName}#${t}`)}}read(e,t,n){this.prepare();const r=[];for(const[i,o]of Object.entries(e)){const a=this.fMap[i];if(!a){if(!n.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${i}`);continue}const c=a.localName;let h;if(a.oneof){if(o===null&&(a.kind!=="enum"||a.T()[0]!=="google.protobuf.NullValue"))continue;if(r.includes(a.oneof))throw new Error(`Multiple members of the oneof group "${a.oneof}" of ${this.info.typeName} are present in JSON.`);r.push(a.oneof),h=t[a.oneof]={oneofKind:c}}else h=t;if(a.kind=="map"){if(o===null)continue;this.assert(le(o),a.name,o);const l=h[c];for(const[u,d]of Object.entries(o)){this.assert(d!==null,a.name+" map value",null);let f;switch(a.V.kind){case"message":f=a.V.T().internalJsonRead(d,n);break;case"enum":if(f=this.enum(a.V.T(),d,a.name,n.ignoreUnknownFields),f===!1)continue;break;case"scalar":f=this.scalar(d,a.V.T,a.V.L,a.name);break}this.assert(f!==void 0,a.name+" map value",d);let y=u;a.K==D.BOOL&&(y=y=="true"?!0:y=="false"?!1:y),y=this.scalar(y,a.K,rt.STRING,a.name).toString(),l[y]=f}}else if(a.repeat){if(o===null)continue;this.assert(Array.isArray(o),a.name,o);const l=h[c];for(const u of o){this.assert(u!==null,a.name,null);let d;switch(a.kind){case"message":d=a.T().internalJsonRead(u,n);break;case"enum":if(d=this.enum(a.T(),u,a.name,n.ignoreUnknownFields),d===!1)continue;break;case"scalar":d=this.scalar(u,a.T,a.L,a.name);break}this.assert(d!==void 0,a.name,o),l.push(d)}}else switch(a.kind){case"message":if(o===null&&a.T().typeName!="google.protobuf.Value"){this.assert(a.oneof===void 0,a.name+" (oneof member)",null);continue}h[c]=a.T().internalJsonRead(o,n,h[c]);break;case"enum":let l=this.enum(a.T(),o,a.name,n.ignoreUnknownFields);if(l===!1)continue;h[c]=l;break;case"scalar":h[c]=this.scalar(o,a.T,a.L,a.name);break}}}enum(e,t,n,r){if(e[0]=="google.protobuf.NullValue"&&J(t===null||t==="NULL_VALUE",`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} only accepts null.`),t===null)return 0;switch(typeof t){case"number":return J(Number.isInteger(t),`Unable to parse field ${this.info.typeName}#${n}, enum can only be integral number, got ${t}.`),t;case"string":let i=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(i=t.substring(e[2].length));let o=e[1][i];return typeof o>"u"&&r?!1:(J(typeof o=="number",`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} has no value for "${t}".`),o)}J(!1,`Unable to parse field ${this.info.typeName}#${n}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,n,r){let i;try{switch(t){case D.DOUBLE:case D.FLOAT:if(e===null)return 0;if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""){i="empty string";break}if(typeof e=="string"&&e.trim().length!==e.length){i="extra whitespace";break}if(typeof e!="string"&&typeof e!="number")break;let o=Number(e);if(Number.isNaN(o)){i="not a number";break}if(!Number.isFinite(o)){i="too large or small";break}return t==D.FLOAT&&Ln(o),o;case D.INT32:case D.FIXED32:case D.SFIXED32:case D.SINT32:case D.UINT32:if(e===null)return 0;let a;if(typeof e=="number"?a=e:e===""?i="empty string":typeof e=="string"&&(e.trim().length!==e.length?i="extra whitespace":a=Number(e)),a===void 0)break;return t==D.UINT32?ln(a):Xt(a),a;case D.INT64:case D.SFIXED64:case D.SINT64:if(e===null)return Ge(Ce.ZERO,n);if(typeof e!="number"&&typeof e!="string")break;return Ge(Ce.from(e),n);case D.FIXED64:case D.UINT64:if(e===null)return Ge(Oe.ZERO,n);if(typeof e!="number"&&typeof e!="string")break;return Ge(Oe.from(e),n);case D.BOOL:if(e===null)return!1;if(typeof e!="boolean")break;return e;case D.STRING:if(e===null)return"";if(typeof e!="string"){i="extra whitespace";break}try{encodeURIComponent(e)}catch(c){c="invalid UTF8";break}return e;case D.BYTES:if(e===null||e==="")return new Uint8Array(0);if(typeof e!="string")break;return Zn(e)}}catch(o){i=o.message}this.assert(!1,r+(i?" - "+i:""),e)}}class pi{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}write(e,t){const n={},r=e;for(const i of this.fields){if(!i.oneof){let h=this.field(i,r[i.localName],t);h!==void 0&&(n[t.useProtoFieldName?i.name:i.jsonName]=h);continue}const o=r[i.oneof];if(o.oneofKind!==i.localName)continue;const a=i.kind=="scalar"||i.kind=="enum"?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t;let c=this.field(i,o[i.localName],a);J(c!==void 0),n[t.useProtoFieldName?i.name:i.jsonName]=c}return n}field(e,t,n){let r;if(e.kind=="map"){J(typeof t=="object"&&t!==null);const i={};switch(e.V.kind){case"scalar":for(const[c,h]of Object.entries(t)){const l=this.scalar(e.V.T,h,e.name,!1,!0);J(l!==void 0),i[c.toString()]=l}break;case"message":const o=e.V.T();for(const[c,h]of Object.entries(t)){const l=this.message(o,h,e.name,n);J(l!==void 0),i[c.toString()]=l}break;case"enum":const a=e.V.T();for(const[c,h]of Object.entries(t)){J(h===void 0||typeof h=="number");const l=this.enum(a,h,e.name,!1,!0,n.enumAsInteger);J(l!==void 0),i[c.toString()]=l}break}(n.emitDefaultValues||Object.keys(i).length>0)&&(r=i)}else if(e.repeat){J(Array.isArray(t));const i=[];switch(e.kind){case"scalar":for(let c=0;c<t.length;c++){const h=this.scalar(e.T,t[c],e.name,e.opt,!0);J(h!==void 0),i.push(h)}break;case"enum":const o=e.T();for(let c=0;c<t.length;c++){J(t[c]===void 0||typeof t[c]=="number");const h=this.enum(o,t[c],e.name,e.opt,!0,n.enumAsInteger);J(h!==void 0),i.push(h)}break;case"message":const a=e.T();for(let c=0;c<t.length;c++){const h=this.message(a,t[c],e.name,n);J(h!==void 0),i.push(h)}break}(n.emitDefaultValues||i.length>0||n.emitDefaultValues)&&(r=i)}else switch(e.kind){case"scalar":r=this.scalar(e.T,t,e.name,e.opt,n.emitDefaultValues);break;case"enum":r=this.enum(e.T(),t,e.name,e.opt,n.emitDefaultValues,n.enumAsInteger);break;case"message":r=this.message(e.T(),t,e.name,n);break}return r}enum(e,t,n,r,i,o){if(e[0]=="google.protobuf.NullValue")return!i&&!r?void 0:null;if(t===void 0){J(r);return}if(!(t===0&&!i&&!r))return J(typeof t=="number"),J(Number.isInteger(t)),o||!e[1].hasOwnProperty(t)?t:e[2]?e[2]+e[1][t]:e[1][t]}message(e,t,n,r){return t===void 0?r.emitDefaultValues?null:void 0:e.internalJsonWrite(t,r)}scalar(e,t,n,r,i){if(t===void 0){J(r);return}const o=i||r;switch(e){case D.INT32:case D.SFIXED32:case D.SINT32:return t===0?o?0:void 0:(Xt(t),t);case D.FIXED32:case D.UINT32:return t===0?o?0:void 0:(ln(t),t);case D.FLOAT:Ln(t);case D.DOUBLE:return t===0?o?0:void 0:(J(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t);case D.STRING:return t===""?o?"":void 0:(J(typeof t=="string"),t);case D.BOOL:return t===!1?o?!1:void 0:(J(typeof t=="boolean"),t);case D.UINT64:case D.FIXED64:J(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let a=Oe.from(t);return a.isZero()&&!o?void 0:a.toString();case D.INT64:case D.SFIXED64:case D.SINT64:J(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let c=Ce.from(t);return c.isZero()&&!o?void 0:c.toString();case D.BYTES:return J(t instanceof Uint8Array),t.byteLength?qn(t):o?"":void 0}}}function xn(s,e=rt.STRING){switch(s){case D.BOOL:return!1;case D.UINT64:case D.FIXED64:return Ge(Oe.ZERO,e);case D.INT64:case D.SFIXED64:case D.SINT64:return Ge(Ce.ZERO,e);case D.DOUBLE:case D.FLOAT:return 0;case D.BYTES:return new Uint8Array(0);case D.STRING:return"";default:return 0}}class mi{constructor(e){this.info=e}prepare(){var e;if(!this.fieldNoToField){const t=(e=this.info.fields)!==null&&e!==void 0?e:[];this.fieldNoToField=new Map(t.map(n=>[n.no,n]))}}read(e,t,n,r){this.prepare();const i=r===void 0?e.len:e.pos+r;for(;e.pos<i;){const[o,a]=e.tag(),c=this.fieldNoToField.get(o);if(!c){let d=n.readUnknownField;if(d=="throw")throw new Error(`Unknown field ${o} (wire type ${a}) for ${this.info.typeName}`);let f=e.skip(a);d!==!1&&(d===!0?G.onRead:d)(this.info.typeName,t,o,a,f);continue}let h=t,l=c.repeat,u=c.localName;switch(c.oneof&&(h=h[c.oneof],h.oneofKind!==u&&(h=t[c.oneof]={oneofKind:u})),c.kind){case"scalar":case"enum":let d=c.kind=="enum"?D.INT32:c.T,f=c.kind=="scalar"?c.L:void 0;if(l){let L=h[u];if(a==j.LengthDelimited&&d!=D.STRING&&d!=D.BYTES){let C=e.uint32()+e.pos;for(;e.pos<C;)L.push(this.scalar(e,d,f))}else L.push(this.scalar(e,d,f))}else h[u]=this.scalar(e,d,f);break;case"message":if(l){let L=h[u],C=c.T().internalBinaryRead(e,e.uint32(),n);L.push(C)}else h[u]=c.T().internalBinaryRead(e,e.uint32(),n,h[u]);break;case"map":let[y,I]=this.mapEntry(c,e,n);h[u][y]=I;break}}}mapEntry(e,t,n){let r=t.uint32(),i=t.pos+r,o,a;for(;t.pos<i;){let[c,h]=t.tag();switch(c){case 1:e.K==D.BOOL?o=t.bool().toString():o=this.scalar(t,e.K,rt.STRING);break;case 2:switch(e.V.kind){case"scalar":a=this.scalar(t,e.V.T,e.V.L);break;case"enum":a=t.int32();break;case"message":a=e.V.T().internalBinaryRead(t,t.uint32(),n);break}break;default:throw new Error(`Unknown field ${c} (wire type ${h}) in map entry for ${this.info.typeName}#${e.name}`)}}if(o===void 0){let c=xn(e.K);o=e.K==D.BOOL?c.toString():c}if(a===void 0)switch(e.V.kind){case"scalar":a=xn(e.V.T,e.V.L);break;case"enum":a=0;break;case"message":a=e.V.T().create();break}return[o,a]}scalar(e,t,n){switch(t){case D.INT32:return e.int32();case D.STRING:return e.string();case D.BOOL:return e.bool();case D.DOUBLE:return e.double();case D.FLOAT:return e.float();case D.INT64:return Ge(e.int64(),n);case D.UINT64:return Ge(e.uint64(),n);case D.FIXED64:return Ge(e.fixed64(),n);case D.FIXED32:return e.fixed32();case D.BYTES:return e.bytes();case D.UINT32:return e.uint32();case D.SFIXED32:return e.sfixed32();case D.SFIXED64:return Ge(e.sfixed64(),n);case D.SINT32:return e.sint32();case D.SINT64:return Ge(e.sint64(),n)}}}class gi{constructor(e){this.info=e}prepare(){if(!this.fields){const e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((t,n)=>t.no-n.no)}}write(e,t,n){this.prepare();for(const i of this.fields){let o,a,c=i.repeat,h=i.localName;if(i.oneof){const l=e[i.oneof];if(l.oneofKind!==h)continue;o=l[h],a=!0}else o=e[h],a=!1;switch(i.kind){case"scalar":case"enum":let l=i.kind=="enum"?D.INT32:i.T;if(c)if(J(Array.isArray(o)),c==cn.PACKED)this.packed(t,l,i.no,o);else for(const u of o)this.scalar(t,l,i.no,u,!0);else o===void 0?J(i.opt):this.scalar(t,l,i.no,o,a||i.opt);break;case"message":if(c){J(Array.isArray(o));for(const u of o)this.message(t,n,i.T(),i.no,u)}else this.message(t,n,i.T(),i.no,o);break;case"map":J(typeof o=="object"&&o!==null);for(const[u,d]of Object.entries(o))this.mapEntry(t,n,i,u,d);break}}let r=n.writeUnknownFields;r!==!1&&(r===!0?G.onWrite:r)(this.info.typeName,e,t)}mapEntry(e,t,n,r,i){e.tag(n.no,j.LengthDelimited),e.fork();let o=r;switch(n.K){case D.INT32:case D.FIXED32:case D.UINT32:case D.SFIXED32:case D.SINT32:o=Number.parseInt(r);break;case D.BOOL:J(r=="true"||r=="false"),o=r=="true";break}switch(this.scalar(e,n.K,1,o,!0),n.V.kind){case"scalar":this.scalar(e,n.V.T,2,i,!0);break;case"enum":this.scalar(e,D.INT32,2,i,!0);break;case"message":this.message(e,t,n.V.T(),2,i);break}e.join()}message(e,t,n,r,i){i!==void 0&&(n.internalBinaryWrite(i,e.tag(r,j.LengthDelimited).fork(),t),e.join())}scalar(e,t,n,r,i){let[o,a,c]=this.scalarInfo(t,r);(!c||i)&&(e.tag(n,o),e[a](r))}packed(e,t,n,r){if(!r.length)return;J(t!==D.BYTES&&t!==D.STRING),e.tag(n,j.LengthDelimited),e.fork();let[,i]=this.scalarInfo(t);for(let o=0;o<r.length;o++)e[i](r[o]);e.join()}scalarInfo(e,t){let n=j.Varint,r,i=t===void 0,o=t===0;switch(e){case D.INT32:r="int32";break;case D.STRING:o=i||!t.length,n=j.LengthDelimited,r="string";break;case D.BOOL:o=t===!1,r="bool";break;case D.UINT32:r="uint32";break;case D.DOUBLE:n=j.Bit64,r="double";break;case D.FLOAT:n=j.Bit32,r="float";break;case D.INT64:o=i||Ce.from(t).isZero(),r="int64";break;case D.UINT64:o=i||Oe.from(t).isZero(),r="uint64";break;case D.FIXED64:o=i||Oe.from(t).isZero(),n=j.Bit64,r="fixed64";break;case D.BYTES:o=i||!t.byteLength,n=j.LengthDelimited,r="bytes";break;case D.FIXED32:n=j.Bit32,r="fixed32";break;case D.SFIXED32:n=j.Bit32,r="sfixed32";break;case D.SFIXED64:o=i||Ce.from(t).isZero(),n=j.Bit64,r="sfixed64";break;case D.SINT32:r="sint32";break;case D.SINT64:o=i||Ce.from(t).isZero(),r="sint64";break}return[n,r,i||o]}}function wi(s){const e=s.messagePrototype?Object.create(s.messagePrototype):Object.defineProperty({},nr,{value:s});for(let t of s.fields){let n=t.localName;if(!t.opt)if(t.oneof)e[t.oneof]={oneofKind:void 0};else if(t.repeat)e[n]=[];else switch(t.kind){case"scalar":e[n]=xn(t.T,t.L);break;case"enum":e[n]=0;break;case"map":e[n]={};break}}return e}function Fe(s,e,t){let n,r=t,i;for(let o of s.fields){let a=o.localName;if(o.oneof){const c=r[o.oneof];if((c==null?void 0:c.oneofKind)==null)continue;if(n=c[a],i=e[o.oneof],i.oneofKind=c.oneofKind,n==null){delete i[a];continue}}else if(n=r[a],i=e,n==null)continue;switch(o.repeat&&(i[a].length=n.length),o.kind){case"scalar":case"enum":if(o.repeat)for(let h=0;h<n.length;h++)i[a][h]=n[h];else i[a]=n;break;case"message":let c=o.T();if(o.repeat)for(let h=0;h<n.length;h++)i[a][h]=c.create(n[h]);else i[a]===void 0?i[a]=c.create(n):c.mergePartial(i[a],n);break;case"map":switch(o.V.kind){case"scalar":case"enum":Object.assign(i[a],n);break;case"message":let h=o.V.T();for(let l of Object.keys(n))i[a][l]=h.create(n[l]);break}break}}}function yi(s,e,t){if(e===t)return!0;if(!e||!t)return!1;for(let n of s.fields){let r=n.localName,i=n.oneof?e[n.oneof][r]:e[r],o=n.oneof?t[n.oneof][r]:t[r];switch(n.kind){case"enum":case"scalar":let a=n.kind=="enum"?D.INT32:n.T;if(!(n.repeat?ir(a,i,o):rr(a,i,o)))return!1;break;case"map":if(!(n.V.kind=="message"?sr(n.V.T(),dn(i),dn(o)):ir(n.V.kind=="enum"?D.INT32:n.V.T,dn(i),dn(o))))return!1;break;case"message":let c=n.T();if(!(n.repeat?sr(c,i,o):c.equals(i,o)))return!1;break}}return!0}const dn=Object.values;function rr(s,e,t){if(e===t)return!0;if(s!==D.BYTES)return!1;let n=e,r=t;if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++)if(n[i]!=r[i])return!1;return!0}function ir(s,e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!rr(s,e[n],t[n]))return!1;return!0}function sr(s,e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!s.equals(e[n],t[n]))return!1;return!0}const bi=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({}));class xe{constructor(e,t,n){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(di),this.options=n??{},this.messagePrototype=Object.create(null,Object.assign(Object.assign({},bi),{[nr]:{value:this}})),this.refTypeCheck=new ui(this),this.refJsonReader=new fi(this),this.refJsonWriter=new pi(this),this.refBinReader=new mi(this),this.refBinWriter=new gi(this)}create(e){let t=wi(this);return e!==void 0&&Fe(this,t,e),t}clone(e){let t=this.create();return Fe(this,t,e),t}equals(e,t){return yi(this,e,t)}is(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!1)}isAssignable(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!0)}mergePartial(e,t){Fe(this,e,t)}fromBinary(e,t){let n=Qr(t);return this.internalBinaryRead(n.readerFactory(e),e.byteLength,n)}fromJson(e,t){return this.internalJsonRead(e,ai(t))}fromJsonString(e,t){let n=JSON.parse(e);return this.fromJson(n,t)}toJson(e,t){return this.internalJsonWrite(e,li(t))}toJsonString(e,t){var n;let r=this.toJson(e,t);return JSON.stringify(r,null,(n=t==null?void 0:t.prettySpaces)!==null&&n!==void 0?n:0)}toBinary(e,t){let n=si(t);return this.internalBinaryWrite(e,n.writerFactory(),n).finish()}internalJsonRead(e,t,n){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let r=n??this.create();return this.refJsonReader.read(e,r,t),r}throw new Error(`Unable to parse message ${this.typeName} from JSON ${ne(e)}.`)}internalJsonWrite(e,t){return this.refJsonWriter.write(e,t)}internalBinaryWrite(e,t,n){return this.refBinWriter.write(e,t,n),t}internalBinaryRead(e,t,n,r){let i=r??this.create();return this.refBinReader.read(e,i,n,t),i}}function Ci(s,e){var t,n,r;let i=s;return i.service=e,i.localName=(t=i.localName)!==null&&t!==void 0?t:Tn(i.name),i.serverStreaming=!!i.serverStreaming,i.clientStreaming=!!i.clientStreaming,i.options=(n=i.options)!==null&&n!==void 0?n:{},i.idempotency=(r=i.idempotency)!==null&&r!==void 0?r:void 0,i}class _n{constructor(e,t,n){this.typeName=e,this.methods=t.map(r=>Ci(r,this)),this.options=n??{}}}class se extends Error{constructor(e,t="UNKNOWN",n){super(e),this.name="RpcError",Object.setPrototypeOf(this,new.target.prototype),this.code=t,this.meta=n??{}}toString(){const e=[this.name+": "+this.message];this.code&&(e.push(""),e.push("Code: "+this.code)),this.serviceName&&this.methodName&&e.push("Method: "+this.serviceName+"/"+this.methodName);let t=Object.entries(this.meta);if(t.length){e.push(""),e.push("Meta:");for(let[n,r]of t)e.push(` ${n}: ${r}`)}return e.join(`
2
+ (function(ne,le){typeof exports=="object"&&typeof module<"u"?module.exports=le():typeof define=="function"&&define.amd?define(le):(ne=typeof globalThis<"u"?globalThis:ne||self,ne.ImageSalonSdk=le())})(this,function(){"use strict";var Ds=Object.defineProperty;var qr=ne=>{throw TypeError(ne)};var Rs=(ne,le,he)=>le in ne?Ds(ne,le,{enumerable:!0,configurable:!0,writable:!0,value:he}):ne[le]=he;var pe=(ne,le,he)=>Rs(ne,typeof le!="symbol"?le+"":le,he),Kr=(ne,le,he)=>le.has(ne)||qr("Cannot "+he);var F=(ne,le,he)=>(Kr(ne,le,"read from private field"),he?he.call(ne):le.get(ne)),X=(ne,le,he)=>le.has(ne)?qr("Cannot add the same private member more than once"):le instanceof WeakSet?le.add(ne):le.set(ne,he),$=(ne,le,he,Ut)=>(Kr(ne,le,"write to private field"),Ut?Ut.call(ne,he):le.set(ne,he),he);var pt,et,Ht,At,Ae,ve,mt,we,Ie,ot,je,Ot,vt,at,tt,kt,$t,Wt,Ft,Nt,gt,St,lt,ct,It,Lt,wt,Pt,en,De,yt,tn,An,nn,_e,jt,Tt,Zt,vn,kn,qt;function ne(s){let e=typeof s;if(e=="object"){if(Array.isArray(s))return"array";if(s===null)return"null"}return e}function le(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}let he="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Ut=[];for(let s=0;s<he.length;s++)Ut[he[s].charCodeAt(0)]=s;Ut[45]=he.indexOf("+"),Ut[95]=he.indexOf("/");function Zn(s){let e=s.length*3/4;s[s.length-2]=="="?e-=2:s[s.length-1]=="="&&(e-=1);let t=new Uint8Array(e),n=0,r=0,i,o=0;for(let a=0;a<s.length;a++){if(i=Ut[s.charCodeAt(a)],i===void 0)switch(s[a]){case"=":r=0;case`
3
+ `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(r){case 0:o=i,r=1;break;case 1:t[n++]=o<<2|(i&48)>>4,o=i,r=2;break;case 2:t[n++]=(o&15)<<4|(i&60)>>2,o=i,r=3;break;case 3:t[n++]=(o&3)<<6|i,r=0;break}}if(r==1)throw Error("invalid base64 string.");return t.subarray(0,n)}function qn(s){let e="",t=0,n,r=0;for(let i=0;i<s.length;i++)switch(n=s[i],t){case 0:e+=he[n>>2],r=(n&3)<<4,t=1;break;case 1:e+=he[r|n>>4],r=(n&15)<<2,t=2;break;case 2:e+=he[r|n>>6],e+=he[n&63],t=0;break}return t&&(e+=he[r],e+="=",t==1&&(e+="=")),e}var G;(function(s){s.symbol=Symbol.for("protobuf-ts/unknown"),s.onRead=(t,n,r,i,o)=>{(e(n)?n[s.symbol]:n[s.symbol]=[]).push({no:r,wireType:i,data:o})},s.onWrite=(t,n,r)=>{for(let{no:i,wireType:o,data:a}of s.list(n))r.tag(i,o).raw(a)},s.list=(t,n)=>{if(e(t)){let r=t[s.symbol];return n?r.filter(i=>i.no==n):r}return[]},s.last=(t,n)=>s.list(t,n).slice(-1)[0];const e=t=>t&&Array.isArray(t[s.symbol])})(G||(G={}));function zr(s,e){return Object.assign(Object.assign({},s),e)}var j;(function(s){s[s.Varint=0]="Varint",s[s.Bit64=1]="Bit64",s[s.LengthDelimited=2]="LengthDelimited",s[s.StartGroup=3]="StartGroup",s[s.EndGroup=4]="EndGroup",s[s.Bit32=5]="Bit32"})(j||(j={}));function Xr(){let s=0,e=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(s|=(r&127)<<n,!(r&128))return this.assertBounds(),[s,e]}let t=this.buf[this.pos++];if(s|=(t&15)<<28,e=(t&112)>>4,!(t&128))return this.assertBounds(),[s,e];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(e|=(r&127)<<n,!(r&128))return this.assertBounds(),[s,e]}throw new Error("invalid varint")}function Nn(s,e,t){for(let i=0;i<28;i=i+7){const o=s>>>i,a=!(!(o>>>7)&&e==0),c=(a?o|128:o)&255;if(t.push(c),!a)return}const n=s>>>28&15|(e&7)<<4,r=!!(e>>3);if(t.push((r?n|128:n)&255),!!r){for(let i=3;i<31;i=i+7){const o=e>>>i,a=!!(o>>>7),c=(a?o|128:o)&255;if(t.push(c),!a)return}t.push(e>>>31&1)}}const sn=65536*65536;function Kn(s){let e=s[0]=="-";e&&(s=s.slice(1));const t=1e6;let n=0,r=0;function i(o,a){const c=Number(s.slice(o,a));r*=t,n=n*t+c,n>=sn&&(r=r+(n/sn|0),n=n%sn)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),[e,n,r]}function In(s,e){if(e>>>0<=2097151)return""+(sn*e+(s>>>0));let t=s&16777215,n=(s>>>24|e<<8)>>>0&16777215,r=e>>16&65535,i=t+n*6777216+r*6710656,o=n+r*8147497,a=r*2,c=1e7;i>=c&&(o+=Math.floor(i/c),i%=c),o>=c&&(a+=Math.floor(o/c),o%=c);function h(l,u){let d=l?String(l):"";return u?"0000000".slice(d.length)+d:d}return h(a,0)+h(o,a)+h(i,1)}function zn(s,e){if(s>=0){for(;s>127;)e.push(s&127|128),s=s>>>7;e.push(s)}else{for(let t=0;t<9;t++)e.push(s&127|128),s=s>>7;e.push(1)}}function Gr(){let s=this.buf[this.pos++],e=s&127;if(!(s&128))return this.assertBounds(),e;if(s=this.buf[this.pos++],e|=(s&127)<<7,!(s&128))return this.assertBounds(),e;if(s=this.buf[this.pos++],e|=(s&127)<<14,!(s&128))return this.assertBounds(),e;if(s=this.buf[this.pos++],e|=(s&127)<<21,!(s&128))return this.assertBounds(),e;s=this.buf[this.pos++],e|=(s&15)<<28;for(let t=5;s&128&&t<10;t++)s=this.buf[this.pos++];if(s&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}let ie;function Jr(){const s=new DataView(new ArrayBuffer(8));ie=globalThis.BigInt!==void 0&&typeof s.getBigInt64=="function"&&typeof s.getBigUint64=="function"&&typeof s.setBigInt64=="function"&&typeof s.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:s}:void 0}Jr();function Xn(s){if(!s)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}const Gn=/^-?[0-9]+$/,on=4294967296,an=2147483648;class Jn{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*on+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}}class Oe extends Jn{static from(e){if(ie)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=ie.C(e);case"number":if(e===0)return this.ZERO;e=ie.C(e);case"bigint":if(!e)return this.ZERO;if(e<ie.UMIN)throw new Error("signed value for ulong");if(e>ie.UMAX)throw new Error("ulong too large");return ie.V.setBigUint64(0,e,!0),new Oe(ie.V.getInt32(0,!0),ie.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!Gn.test(e))throw new Error("string is no integer");let[t,n,r]=Kn(e);if(t)throw new Error("signed value for ulong");return new Oe(n,r);case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");if(e<0)throw new Error("signed value for ulong");return new Oe(e,e/on)}throw new Error("unknown value "+typeof e)}toString(){return ie?this.toBigInt().toString():In(this.lo,this.hi)}toBigInt(){return Xn(ie),ie.V.setInt32(0,this.lo,!0),ie.V.setInt32(4,this.hi,!0),ie.V.getBigUint64(0,!0)}}Oe.ZERO=new Oe(0,0);class Ce extends Jn{static from(e){if(ie)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=ie.C(e);case"number":if(e===0)return this.ZERO;e=ie.C(e);case"bigint":if(!e)return this.ZERO;if(e<ie.MIN)throw new Error("signed long too small");if(e>ie.MAX)throw new Error("signed long too large");return ie.V.setBigInt64(0,e,!0),new Ce(ie.V.getInt32(0,!0),ie.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!Gn.test(e))throw new Error("string is no integer");let[t,n,r]=Kn(e);if(t){if(r>an||r==an&&n!=0)throw new Error("signed long too small")}else if(r>=an)throw new Error("signed long too large");let i=new Ce(n,r);return t?i.negate():i;case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");return e>0?new Ce(e,e/on):new Ce(-e,-e/on).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return(this.hi&an)!==0}negate(){let e=~this.hi,t=this.lo;return t?t=~t+1:e+=1,new Ce(t,e)}toString(){if(ie)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+In(e.lo,e.hi)}return In(this.lo,this.hi)}toBigInt(){return Xn(ie),ie.V.setInt32(0,this.lo,!0),ie.V.setInt32(4,this.hi,!0),ie.V.getBigInt64(0,!0)}}Ce.ZERO=new Ce(0,0);const Qn={readUnknownField:!0,readerFactory:s=>new Yr(s)};function Qr(s){return s?Object.assign(Object.assign({},Qn),s):Qn}class Yr{constructor(e,t){this.varint64=Xr,this.uint32=Gr,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e){let t=this.pos;switch(e){case j.Varint:for(;this.buf[this.pos++]&128;);break;case j.Bit64:this.pos+=4;case j.Bit32:this.pos+=4;break;case j.LengthDelimited:let n=this.uint32();this.pos+=n;break;case j.StartGroup:let r;for(;(r=this.tag()[1])!==j.EndGroup;)this.skip(r);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(t,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return new Ce(...this.varint64())}uint64(){return new Oe(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,new Ce(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new Oe(this.sfixed32(),this.sfixed32())}sfixed64(){return new Ce(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}}function J(s,e){if(!s)throw new Error(e)}const ei=34028234663852886e22,ti=-34028234663852886e22,ni=4294967295,ri=2147483647,ii=-2147483648;function Gt(s){if(typeof s!="number")throw new Error("invalid int 32: "+typeof s);if(!Number.isInteger(s)||s>ri||s<ii)throw new Error("invalid int 32: "+s)}function ln(s){if(typeof s!="number")throw new Error("invalid uint 32: "+typeof s);if(!Number.isInteger(s)||s>ni||s<0)throw new Error("invalid uint 32: "+s)}function Ln(s){if(typeof s!="number")throw new Error("invalid float 32: "+typeof s);if(Number.isFinite(s)&&(s>ei||s<ti))throw new Error("invalid float 32: "+s)}const Yn={writeUnknownFields:!0,writerFactory:()=>new oi};function si(s){return s?Object.assign(Object.assign({},Yn),s):Yn}class oi{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let t=new Uint8Array(e),n=0;for(let r=0;r<this.chunks.length;r++)t.set(this.chunks[r],n),n+=this.chunks[r].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(ln(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return Gt(e),zn(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){Ln(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){ln(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){Gt(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return Gt(e),e=(e<<1^e>>31)>>>0,zn(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=Ce.from(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=Oe.from(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=Ce.from(e);return Nn(t.lo,t.hi,this.buf),this}sint64(e){let t=Ce.from(e),n=t.hi>>31,r=t.lo<<1^n,i=(t.hi<<1|t.lo>>>31)^n;return Nn(r,i,this.buf),this}uint64(e){let t=Oe.from(e);return Nn(t.lo,t.hi,this.buf),this}}const er={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},tr={ignoreUnknownFields:!1};function ai(s){return s?Object.assign(Object.assign({},tr),s):tr}function li(s){return s?Object.assign(Object.assign({},er),s):er}function ci(s,e){var t,n;let r=Object.assign(Object.assign({},s),e);return r.typeRegistry=[...(t=s==null?void 0:s.typeRegistry)!==null&&t!==void 0?t:[],...(n=e==null?void 0:e.typeRegistry)!==null&&n!==void 0?n:[]],r}const nr=Symbol.for("protobuf-ts/message-type");function Tn(s){let e=!1;const t=[];for(let n=0;n<s.length;n++){let r=s.charAt(n);r=="_"?e=!0:/\d/.test(r)?(t.push(r),e=!0):e?(t.push(r.toUpperCase()),e=!1):n==0?t.push(r.toLowerCase()):t.push(r)}return t.join("")}var D;(function(s){s[s.DOUBLE=1]="DOUBLE",s[s.FLOAT=2]="FLOAT",s[s.INT64=3]="INT64",s[s.UINT64=4]="UINT64",s[s.INT32=5]="INT32",s[s.FIXED64=6]="FIXED64",s[s.FIXED32=7]="FIXED32",s[s.BOOL=8]="BOOL",s[s.STRING=9]="STRING",s[s.BYTES=12]="BYTES",s[s.UINT32=13]="UINT32",s[s.SFIXED32=15]="SFIXED32",s[s.SFIXED64=16]="SFIXED64",s[s.SINT32=17]="SINT32",s[s.SINT64=18]="SINT64"})(D||(D={}));var rt;(function(s){s[s.BIGINT=0]="BIGINT",s[s.STRING=1]="STRING",s[s.NUMBER=2]="NUMBER"})(rt||(rt={}));var cn;(function(s){s[s.NO=0]="NO",s[s.PACKED=1]="PACKED",s[s.UNPACKED=2]="UNPACKED"})(cn||(cn={}));function di(s){var e,t,n,r;return s.localName=(e=s.localName)!==null&&e!==void 0?e:Tn(s.name),s.jsonName=(t=s.jsonName)!==null&&t!==void 0?t:Tn(s.name),s.repeat=(n=s.repeat)!==null&&n!==void 0?n:cn.NO,s.opt=(r=s.opt)!==null&&r!==void 0?r:s.repeat||s.oneof?!1:s.kind=="message",s}function hi(s){if(typeof s!="object"||s===null||!s.hasOwnProperty("oneofKind"))return!1;switch(typeof s.oneofKind){case"string":return s[s.oneofKind]===void 0?!1:Object.keys(s).length==2;case"undefined":return Object.keys(s).length==1;default:return!1}}class ui{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}prepare(){if(this.data)return;const e=[],t=[],n=[];for(let r of this.fields)if(r.oneof)n.includes(r.oneof)||(n.push(r.oneof),e.push(r.oneof),t.push(r.oneof));else switch(t.push(r.localName),r.kind){case"scalar":case"enum":(!r.opt||r.repeat)&&e.push(r.localName);break;case"message":r.repeat&&e.push(r.localName);break;case"map":e.push(r.localName);break}this.data={req:e,known:t,oneofs:Object.values(n)}}is(e,t,n=!1){if(t<0)return!0;if(e==null||typeof e!="object")return!1;this.prepare();let r=Object.keys(e),i=this.data;if(r.length<i.req.length||i.req.some(o=>!r.includes(o))||!n&&r.some(o=>!i.known.includes(o)))return!1;if(t<1)return!0;for(const o of i.oneofs){const a=e[o];if(!hi(a))return!1;if(a.oneofKind===void 0)continue;const c=this.fields.find(h=>h.localName===a.oneofKind);if(!c||!this.field(a[a.oneofKind],c,n,t))return!1}for(const o of this.fields)if(o.oneof===void 0&&!this.field(e[o.localName],o,n,t))return!1;return!0}field(e,t,n,r){let i=t.repeat;switch(t.kind){case"scalar":return e===void 0?t.opt:i?this.scalars(e,t.T,r,t.L):this.scalar(e,t.T,t.L);case"enum":return e===void 0?t.opt:i?this.scalars(e,D.INT32,r):this.scalar(e,D.INT32);case"message":return e===void 0?!0:i?this.messages(e,t.T(),n,r):this.message(e,t.T(),n,r);case"map":if(typeof e!="object"||e===null)return!1;if(r<2)return!0;if(!this.mapKeys(e,t.K,r))return!1;switch(t.V.kind){case"scalar":return this.scalars(Object.values(e),t.V.T,r,t.V.L);case"enum":return this.scalars(Object.values(e),D.INT32,r);case"message":return this.messages(Object.values(e),t.V.T(),n,r)}break}return!0}message(e,t,n,r){return n?t.isAssignable(e,r):t.is(e,r)}messages(e,t,n,r){if(!Array.isArray(e))return!1;if(r<2)return!0;if(n){for(let i=0;i<e.length&&i<r;i++)if(!t.isAssignable(e[i],r-1))return!1}else for(let i=0;i<e.length&&i<r;i++)if(!t.is(e[i],r-1))return!1;return!0}scalar(e,t,n){let r=typeof e;switch(t){case D.UINT64:case D.FIXED64:case D.INT64:case D.SFIXED64:case D.SINT64:switch(n){case rt.BIGINT:return r=="bigint";case rt.NUMBER:return r=="number"&&!isNaN(e);default:return r=="string"}case D.BOOL:return r=="boolean";case D.STRING:return r=="string";case D.BYTES:return e instanceof Uint8Array;case D.DOUBLE:case D.FLOAT:return r=="number"&&!isNaN(e);default:return r=="number"&&Number.isInteger(e)}}scalars(e,t,n,r){if(!Array.isArray(e))return!1;if(n<2)return!0;if(Array.isArray(e)){for(let i=0;i<e.length&&i<n;i++)if(!this.scalar(e[i],t,r))return!1}return!0}mapKeys(e,t,n){let r=Object.keys(e);switch(t){case D.INT32:case D.FIXED32:case D.SFIXED32:case D.SINT32:case D.UINT32:return this.scalars(r.slice(0,n).map(i=>parseInt(i)),t,n);case D.BOOL:return this.scalars(r.slice(0,n).map(i=>i=="true"?!0:i=="false"?!1:i),t,n);default:return this.scalars(r,t,n,rt.STRING)}}}function Ge(s,e){switch(e){case rt.BIGINT:return s.toBigInt();case rt.NUMBER:return s.toNumber();default:return s.toString()}}class fi{constructor(e){this.info=e}prepare(){var e;if(this.fMap===void 0){this.fMap={};const t=(e=this.info.fields)!==null&&e!==void 0?e:[];for(const n of t)this.fMap[n.name]=n,this.fMap[n.jsonName]=n,this.fMap[n.localName]=n}}assert(e,t,n){if(!e){let r=ne(n);throw(r=="number"||r=="boolean")&&(r=n.toString()),new Error(`Cannot parse JSON ${r} for ${this.info.typeName}#${t}`)}}read(e,t,n){this.prepare();const r=[];for(const[i,o]of Object.entries(e)){const a=this.fMap[i];if(!a){if(!n.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${i}`);continue}const c=a.localName;let h;if(a.oneof){if(o===null&&(a.kind!=="enum"||a.T()[0]!=="google.protobuf.NullValue"))continue;if(r.includes(a.oneof))throw new Error(`Multiple members of the oneof group "${a.oneof}" of ${this.info.typeName} are present in JSON.`);r.push(a.oneof),h=t[a.oneof]={oneofKind:c}}else h=t;if(a.kind=="map"){if(o===null)continue;this.assert(le(o),a.name,o);const l=h[c];for(const[u,d]of Object.entries(o)){this.assert(d!==null,a.name+" map value",null);let f;switch(a.V.kind){case"message":f=a.V.T().internalJsonRead(d,n);break;case"enum":if(f=this.enum(a.V.T(),d,a.name,n.ignoreUnknownFields),f===!1)continue;break;case"scalar":f=this.scalar(d,a.V.T,a.V.L,a.name);break}this.assert(f!==void 0,a.name+" map value",d);let y=u;a.K==D.BOOL&&(y=y=="true"?!0:y=="false"?!1:y),y=this.scalar(y,a.K,rt.STRING,a.name).toString(),l[y]=f}}else if(a.repeat){if(o===null)continue;this.assert(Array.isArray(o),a.name,o);const l=h[c];for(const u of o){this.assert(u!==null,a.name,null);let d;switch(a.kind){case"message":d=a.T().internalJsonRead(u,n);break;case"enum":if(d=this.enum(a.T(),u,a.name,n.ignoreUnknownFields),d===!1)continue;break;case"scalar":d=this.scalar(u,a.T,a.L,a.name);break}this.assert(d!==void 0,a.name,o),l.push(d)}}else switch(a.kind){case"message":if(o===null&&a.T().typeName!="google.protobuf.Value"){this.assert(a.oneof===void 0,a.name+" (oneof member)",null);continue}h[c]=a.T().internalJsonRead(o,n,h[c]);break;case"enum":let l=this.enum(a.T(),o,a.name,n.ignoreUnknownFields);if(l===!1)continue;h[c]=l;break;case"scalar":h[c]=this.scalar(o,a.T,a.L,a.name);break}}}enum(e,t,n,r){if(e[0]=="google.protobuf.NullValue"&&J(t===null||t==="NULL_VALUE",`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} only accepts null.`),t===null)return 0;switch(typeof t){case"number":return J(Number.isInteger(t),`Unable to parse field ${this.info.typeName}#${n}, enum can only be integral number, got ${t}.`),t;case"string":let i=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(i=t.substring(e[2].length));let o=e[1][i];return typeof o>"u"&&r?!1:(J(typeof o=="number",`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} has no value for "${t}".`),o)}J(!1,`Unable to parse field ${this.info.typeName}#${n}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,n,r){let i;try{switch(t){case D.DOUBLE:case D.FLOAT:if(e===null)return 0;if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""){i="empty string";break}if(typeof e=="string"&&e.trim().length!==e.length){i="extra whitespace";break}if(typeof e!="string"&&typeof e!="number")break;let o=Number(e);if(Number.isNaN(o)){i="not a number";break}if(!Number.isFinite(o)){i="too large or small";break}return t==D.FLOAT&&Ln(o),o;case D.INT32:case D.FIXED32:case D.SFIXED32:case D.SINT32:case D.UINT32:if(e===null)return 0;let a;if(typeof e=="number"?a=e:e===""?i="empty string":typeof e=="string"&&(e.trim().length!==e.length?i="extra whitespace":a=Number(e)),a===void 0)break;return t==D.UINT32?ln(a):Gt(a),a;case D.INT64:case D.SFIXED64:case D.SINT64:if(e===null)return Ge(Ce.ZERO,n);if(typeof e!="number"&&typeof e!="string")break;return Ge(Ce.from(e),n);case D.FIXED64:case D.UINT64:if(e===null)return Ge(Oe.ZERO,n);if(typeof e!="number"&&typeof e!="string")break;return Ge(Oe.from(e),n);case D.BOOL:if(e===null)return!1;if(typeof e!="boolean")break;return e;case D.STRING:if(e===null)return"";if(typeof e!="string"){i="extra whitespace";break}try{encodeURIComponent(e)}catch(c){c="invalid UTF8";break}return e;case D.BYTES:if(e===null||e==="")return new Uint8Array(0);if(typeof e!="string")break;return Zn(e)}}catch(o){i=o.message}this.assert(!1,r+(i?" - "+i:""),e)}}class pi{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}write(e,t){const n={},r=e;for(const i of this.fields){if(!i.oneof){let h=this.field(i,r[i.localName],t);h!==void 0&&(n[t.useProtoFieldName?i.name:i.jsonName]=h);continue}const o=r[i.oneof];if(o.oneofKind!==i.localName)continue;const a=i.kind=="scalar"||i.kind=="enum"?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t;let c=this.field(i,o[i.localName],a);J(c!==void 0),n[t.useProtoFieldName?i.name:i.jsonName]=c}return n}field(e,t,n){let r;if(e.kind=="map"){J(typeof t=="object"&&t!==null);const i={};switch(e.V.kind){case"scalar":for(const[c,h]of Object.entries(t)){const l=this.scalar(e.V.T,h,e.name,!1,!0);J(l!==void 0),i[c.toString()]=l}break;case"message":const o=e.V.T();for(const[c,h]of Object.entries(t)){const l=this.message(o,h,e.name,n);J(l!==void 0),i[c.toString()]=l}break;case"enum":const a=e.V.T();for(const[c,h]of Object.entries(t)){J(h===void 0||typeof h=="number");const l=this.enum(a,h,e.name,!1,!0,n.enumAsInteger);J(l!==void 0),i[c.toString()]=l}break}(n.emitDefaultValues||Object.keys(i).length>0)&&(r=i)}else if(e.repeat){J(Array.isArray(t));const i=[];switch(e.kind){case"scalar":for(let c=0;c<t.length;c++){const h=this.scalar(e.T,t[c],e.name,e.opt,!0);J(h!==void 0),i.push(h)}break;case"enum":const o=e.T();for(let c=0;c<t.length;c++){J(t[c]===void 0||typeof t[c]=="number");const h=this.enum(o,t[c],e.name,e.opt,!0,n.enumAsInteger);J(h!==void 0),i.push(h)}break;case"message":const a=e.T();for(let c=0;c<t.length;c++){const h=this.message(a,t[c],e.name,n);J(h!==void 0),i.push(h)}break}(n.emitDefaultValues||i.length>0||n.emitDefaultValues)&&(r=i)}else switch(e.kind){case"scalar":r=this.scalar(e.T,t,e.name,e.opt,n.emitDefaultValues);break;case"enum":r=this.enum(e.T(),t,e.name,e.opt,n.emitDefaultValues,n.enumAsInteger);break;case"message":r=this.message(e.T(),t,e.name,n);break}return r}enum(e,t,n,r,i,o){if(e[0]=="google.protobuf.NullValue")return!i&&!r?void 0:null;if(t===void 0){J(r);return}if(!(t===0&&!i&&!r))return J(typeof t=="number"),J(Number.isInteger(t)),o||!e[1].hasOwnProperty(t)?t:e[2]?e[2]+e[1][t]:e[1][t]}message(e,t,n,r){return t===void 0?r.emitDefaultValues?null:void 0:e.internalJsonWrite(t,r)}scalar(e,t,n,r,i){if(t===void 0){J(r);return}const o=i||r;switch(e){case D.INT32:case D.SFIXED32:case D.SINT32:return t===0?o?0:void 0:(Gt(t),t);case D.FIXED32:case D.UINT32:return t===0?o?0:void 0:(ln(t),t);case D.FLOAT:Ln(t);case D.DOUBLE:return t===0?o?0:void 0:(J(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t);case D.STRING:return t===""?o?"":void 0:(J(typeof t=="string"),t);case D.BOOL:return t===!1?o?!1:void 0:(J(typeof t=="boolean"),t);case D.UINT64:case D.FIXED64:J(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let a=Oe.from(t);return a.isZero()&&!o?void 0:a.toString();case D.INT64:case D.SFIXED64:case D.SINT64:J(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let c=Ce.from(t);return c.isZero()&&!o?void 0:c.toString();case D.BYTES:return J(t instanceof Uint8Array),t.byteLength?qn(t):o?"":void 0}}}function xn(s,e=rt.STRING){switch(s){case D.BOOL:return!1;case D.UINT64:case D.FIXED64:return Ge(Oe.ZERO,e);case D.INT64:case D.SFIXED64:case D.SINT64:return Ge(Ce.ZERO,e);case D.DOUBLE:case D.FLOAT:return 0;case D.BYTES:return new Uint8Array(0);case D.STRING:return"";default:return 0}}class mi{constructor(e){this.info=e}prepare(){var e;if(!this.fieldNoToField){const t=(e=this.info.fields)!==null&&e!==void 0?e:[];this.fieldNoToField=new Map(t.map(n=>[n.no,n]))}}read(e,t,n,r){this.prepare();const i=r===void 0?e.len:e.pos+r;for(;e.pos<i;){const[o,a]=e.tag(),c=this.fieldNoToField.get(o);if(!c){let d=n.readUnknownField;if(d=="throw")throw new Error(`Unknown field ${o} (wire type ${a}) for ${this.info.typeName}`);let f=e.skip(a);d!==!1&&(d===!0?G.onRead:d)(this.info.typeName,t,o,a,f);continue}let h=t,l=c.repeat,u=c.localName;switch(c.oneof&&(h=h[c.oneof],h.oneofKind!==u&&(h=t[c.oneof]={oneofKind:u})),c.kind){case"scalar":case"enum":let d=c.kind=="enum"?D.INT32:c.T,f=c.kind=="scalar"?c.L:void 0;if(l){let L=h[u];if(a==j.LengthDelimited&&d!=D.STRING&&d!=D.BYTES){let C=e.uint32()+e.pos;for(;e.pos<C;)L.push(this.scalar(e,d,f))}else L.push(this.scalar(e,d,f))}else h[u]=this.scalar(e,d,f);break;case"message":if(l){let L=h[u],C=c.T().internalBinaryRead(e,e.uint32(),n);L.push(C)}else h[u]=c.T().internalBinaryRead(e,e.uint32(),n,h[u]);break;case"map":let[y,I]=this.mapEntry(c,e,n);h[u][y]=I;break}}}mapEntry(e,t,n){let r=t.uint32(),i=t.pos+r,o,a;for(;t.pos<i;){let[c,h]=t.tag();switch(c){case 1:e.K==D.BOOL?o=t.bool().toString():o=this.scalar(t,e.K,rt.STRING);break;case 2:switch(e.V.kind){case"scalar":a=this.scalar(t,e.V.T,e.V.L);break;case"enum":a=t.int32();break;case"message":a=e.V.T().internalBinaryRead(t,t.uint32(),n);break}break;default:throw new Error(`Unknown field ${c} (wire type ${h}) in map entry for ${this.info.typeName}#${e.name}`)}}if(o===void 0){let c=xn(e.K);o=e.K==D.BOOL?c.toString():c}if(a===void 0)switch(e.V.kind){case"scalar":a=xn(e.V.T,e.V.L);break;case"enum":a=0;break;case"message":a=e.V.T().create();break}return[o,a]}scalar(e,t,n){switch(t){case D.INT32:return e.int32();case D.STRING:return e.string();case D.BOOL:return e.bool();case D.DOUBLE:return e.double();case D.FLOAT:return e.float();case D.INT64:return Ge(e.int64(),n);case D.UINT64:return Ge(e.uint64(),n);case D.FIXED64:return Ge(e.fixed64(),n);case D.FIXED32:return e.fixed32();case D.BYTES:return e.bytes();case D.UINT32:return e.uint32();case D.SFIXED32:return e.sfixed32();case D.SFIXED64:return Ge(e.sfixed64(),n);case D.SINT32:return e.sint32();case D.SINT64:return Ge(e.sint64(),n)}}}class gi{constructor(e){this.info=e}prepare(){if(!this.fields){const e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((t,n)=>t.no-n.no)}}write(e,t,n){this.prepare();for(const i of this.fields){let o,a,c=i.repeat,h=i.localName;if(i.oneof){const l=e[i.oneof];if(l.oneofKind!==h)continue;o=l[h],a=!0}else o=e[h],a=!1;switch(i.kind){case"scalar":case"enum":let l=i.kind=="enum"?D.INT32:i.T;if(c)if(J(Array.isArray(o)),c==cn.PACKED)this.packed(t,l,i.no,o);else for(const u of o)this.scalar(t,l,i.no,u,!0);else o===void 0?J(i.opt):this.scalar(t,l,i.no,o,a||i.opt);break;case"message":if(c){J(Array.isArray(o));for(const u of o)this.message(t,n,i.T(),i.no,u)}else this.message(t,n,i.T(),i.no,o);break;case"map":J(typeof o=="object"&&o!==null);for(const[u,d]of Object.entries(o))this.mapEntry(t,n,i,u,d);break}}let r=n.writeUnknownFields;r!==!1&&(r===!0?G.onWrite:r)(this.info.typeName,e,t)}mapEntry(e,t,n,r,i){e.tag(n.no,j.LengthDelimited),e.fork();let o=r;switch(n.K){case D.INT32:case D.FIXED32:case D.UINT32:case D.SFIXED32:case D.SINT32:o=Number.parseInt(r);break;case D.BOOL:J(r=="true"||r=="false"),o=r=="true";break}switch(this.scalar(e,n.K,1,o,!0),n.V.kind){case"scalar":this.scalar(e,n.V.T,2,i,!0);break;case"enum":this.scalar(e,D.INT32,2,i,!0);break;case"message":this.message(e,t,n.V.T(),2,i);break}e.join()}message(e,t,n,r,i){i!==void 0&&(n.internalBinaryWrite(i,e.tag(r,j.LengthDelimited).fork(),t),e.join())}scalar(e,t,n,r,i){let[o,a,c]=this.scalarInfo(t,r);(!c||i)&&(e.tag(n,o),e[a](r))}packed(e,t,n,r){if(!r.length)return;J(t!==D.BYTES&&t!==D.STRING),e.tag(n,j.LengthDelimited),e.fork();let[,i]=this.scalarInfo(t);for(let o=0;o<r.length;o++)e[i](r[o]);e.join()}scalarInfo(e,t){let n=j.Varint,r,i=t===void 0,o=t===0;switch(e){case D.INT32:r="int32";break;case D.STRING:o=i||!t.length,n=j.LengthDelimited,r="string";break;case D.BOOL:o=t===!1,r="bool";break;case D.UINT32:r="uint32";break;case D.DOUBLE:n=j.Bit64,r="double";break;case D.FLOAT:n=j.Bit32,r="float";break;case D.INT64:o=i||Ce.from(t).isZero(),r="int64";break;case D.UINT64:o=i||Oe.from(t).isZero(),r="uint64";break;case D.FIXED64:o=i||Oe.from(t).isZero(),n=j.Bit64,r="fixed64";break;case D.BYTES:o=i||!t.byteLength,n=j.LengthDelimited,r="bytes";break;case D.FIXED32:n=j.Bit32,r="fixed32";break;case D.SFIXED32:n=j.Bit32,r="sfixed32";break;case D.SFIXED64:o=i||Ce.from(t).isZero(),n=j.Bit64,r="sfixed64";break;case D.SINT32:r="sint32";break;case D.SINT64:o=i||Ce.from(t).isZero(),r="sint64";break}return[n,r,i||o]}}function wi(s){const e=s.messagePrototype?Object.create(s.messagePrototype):Object.defineProperty({},nr,{value:s});for(let t of s.fields){let n=t.localName;if(!t.opt)if(t.oneof)e[t.oneof]={oneofKind:void 0};else if(t.repeat)e[n]=[];else switch(t.kind){case"scalar":e[n]=xn(t.T,t.L);break;case"enum":e[n]=0;break;case"map":e[n]={};break}}return e}function Fe(s,e,t){let n,r=t,i;for(let o of s.fields){let a=o.localName;if(o.oneof){const c=r[o.oneof];if((c==null?void 0:c.oneofKind)==null)continue;if(n=c[a],i=e[o.oneof],i.oneofKind=c.oneofKind,n==null){delete i[a];continue}}else if(n=r[a],i=e,n==null)continue;switch(o.repeat&&(i[a].length=n.length),o.kind){case"scalar":case"enum":if(o.repeat)for(let h=0;h<n.length;h++)i[a][h]=n[h];else i[a]=n;break;case"message":let c=o.T();if(o.repeat)for(let h=0;h<n.length;h++)i[a][h]=c.create(n[h]);else i[a]===void 0?i[a]=c.create(n):c.mergePartial(i[a],n);break;case"map":switch(o.V.kind){case"scalar":case"enum":Object.assign(i[a],n);break;case"message":let h=o.V.T();for(let l of Object.keys(n))i[a][l]=h.create(n[l]);break}break}}}function yi(s,e,t){if(e===t)return!0;if(!e||!t)return!1;for(let n of s.fields){let r=n.localName,i=n.oneof?e[n.oneof][r]:e[r],o=n.oneof?t[n.oneof][r]:t[r];switch(n.kind){case"enum":case"scalar":let a=n.kind=="enum"?D.INT32:n.T;if(!(n.repeat?ir(a,i,o):rr(a,i,o)))return!1;break;case"map":if(!(n.V.kind=="message"?sr(n.V.T(),dn(i),dn(o)):ir(n.V.kind=="enum"?D.INT32:n.V.T,dn(i),dn(o))))return!1;break;case"message":let c=n.T();if(!(n.repeat?sr(c,i,o):c.equals(i,o)))return!1;break}}return!0}const dn=Object.values;function rr(s,e,t){if(e===t)return!0;if(s!==D.BYTES)return!1;let n=e,r=t;if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++)if(n[i]!=r[i])return!1;return!0}function ir(s,e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!rr(s,e[n],t[n]))return!1;return!0}function sr(s,e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!s.equals(e[n],t[n]))return!1;return!0}const bi=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({}));class xe{constructor(e,t,n){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(di),this.options=n??{},this.messagePrototype=Object.create(null,Object.assign(Object.assign({},bi),{[nr]:{value:this}})),this.refTypeCheck=new ui(this),this.refJsonReader=new fi(this),this.refJsonWriter=new pi(this),this.refBinReader=new mi(this),this.refBinWriter=new gi(this)}create(e){let t=wi(this);return e!==void 0&&Fe(this,t,e),t}clone(e){let t=this.create();return Fe(this,t,e),t}equals(e,t){return yi(this,e,t)}is(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!1)}isAssignable(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!0)}mergePartial(e,t){Fe(this,e,t)}fromBinary(e,t){let n=Qr(t);return this.internalBinaryRead(n.readerFactory(e),e.byteLength,n)}fromJson(e,t){return this.internalJsonRead(e,ai(t))}fromJsonString(e,t){let n=JSON.parse(e);return this.fromJson(n,t)}toJson(e,t){return this.internalJsonWrite(e,li(t))}toJsonString(e,t){var n;let r=this.toJson(e,t);return JSON.stringify(r,null,(n=t==null?void 0:t.prettySpaces)!==null&&n!==void 0?n:0)}toBinary(e,t){let n=si(t);return this.internalBinaryWrite(e,n.writerFactory(),n).finish()}internalJsonRead(e,t,n){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let r=n??this.create();return this.refJsonReader.read(e,r,t),r}throw new Error(`Unable to parse message ${this.typeName} from JSON ${ne(e)}.`)}internalJsonWrite(e,t){return this.refJsonWriter.write(e,t)}internalBinaryWrite(e,t,n){return this.refBinWriter.write(e,t,n),t}internalBinaryRead(e,t,n,r){let i=r??this.create();return this.refBinReader.read(e,i,n,t),i}}function Ci(s,e){var t,n,r;let i=s;return i.service=e,i.localName=(t=i.localName)!==null&&t!==void 0?t:Tn(i.name),i.serverStreaming=!!i.serverStreaming,i.clientStreaming=!!i.clientStreaming,i.options=(n=i.options)!==null&&n!==void 0?n:{},i.idempotency=(r=i.idempotency)!==null&&r!==void 0?r:void 0,i}class _n{constructor(e,t,n){this.typeName=e,this.methods=t.map(r=>Ci(r,this)),this.options=n??{}}}class se extends Error{constructor(e,t="UNKNOWN",n){super(e),this.name="RpcError",Object.setPrototypeOf(this,new.target.prototype),this.code=t,this.meta=n??{}}toString(){const e=[this.name+": "+this.message];this.code&&(e.push(""),e.push("Code: "+this.code)),this.serviceName&&this.methodName&&e.push("Method: "+this.serviceName+"/"+this.methodName);let t=Object.entries(this.meta);if(t.length){e.push(""),e.push("Meta:");for(let[n,r]of t)e.push(` ${n}: ${r}`)}return e.join(`
4
4
  `)}}function Ei(s,e){if(!e)return s;let t={};hn(s,t),hn(e,t);for(let n of Object.keys(e)){let r=e[n];switch(n){case"jsonOptions":t.jsonOptions=ci(s.jsonOptions,t.jsonOptions);break;case"binaryOptions":t.binaryOptions=zr(s.binaryOptions,t.binaryOptions);break;case"meta":t.meta={},hn(s.meta,t.meta),hn(e.meta,t.meta);break;case"interceptors":t.interceptors=s.interceptors?s.interceptors.concat(r):r.concat();break}}return t}function hn(s,e){if(!s)return;let t=e;for(let[n,r]of Object.entries(s))r instanceof Date?t[n]=new Date(r.getTime()):Array.isArray(r)?t[n]=r.concat():t[n]=r}var Ze;(function(s){s[s.PENDING=0]="PENDING",s[s.REJECTED=1]="REJECTED",s[s.RESOLVED=2]="RESOLVED"})(Ze||(Ze={}));class Ct{constructor(e=!0){this._state=Ze.PENDING,this._promise=new Promise((t,n)=>{this._resolve=t,this._reject=n}),e&&this._promise.catch(t=>{})}get state(){return this._state}get promise(){return this._promise}resolve(e){if(this.state!==Ze.PENDING)throw new Error(`cannot resolve ${Ze[this.state].toLowerCase()}`);this._resolve(e),this._state=Ze.RESOLVED}reject(e){if(this.state!==Ze.PENDING)throw new Error(`cannot reject ${Ze[this.state].toLowerCase()}`);this._reject(e),this._state=Ze.REJECTED}resolvePending(e){this._state===Ze.PENDING&&this.resolve(e)}rejectPending(e){this._state===Ze.PENDING&&this.reject(e)}}class Ai{constructor(){this._lis={nxt:[],msg:[],err:[],cmp:[]},this._closed=!1}onNext(e){return this.addLis(e,this._lis.nxt)}onMessage(e){return this.addLis(e,this._lis.msg)}onError(e){return this.addLis(e,this._lis.err)}onComplete(e){return this.addLis(e,this._lis.cmp)}addLis(e,t){return t.push(e),()=>{let n=t.indexOf(e);n>=0&&t.splice(n,1)}}clearLis(){for(let e of Object.values(this._lis))e.splice(0,e.length)}get closed(){return this._closed!==!1}notifyNext(e,t,n){J((e?1:0)+(t?1:0)+(n?1:0)<=1,"only one emission at a time"),e&&this.notifyMessage(e),t&&this.notifyError(t),n&&this.notifyComplete()}notifyMessage(e){J(!this.closed,"stream is closed"),this.pushIt({value:e,done:!1}),this._lis.msg.forEach(t=>t(e)),this._lis.nxt.forEach(t=>t(e,void 0,!1))}notifyError(e){J(!this.closed,"stream is closed"),this._closed=e,this.pushIt(e),this._lis.err.forEach(t=>t(e)),this._lis.nxt.forEach(t=>t(void 0,e,!1)),this.clearLis()}notifyComplete(){J(!this.closed,"stream is closed"),this._closed=!0,this.pushIt({value:null,done:!0}),this._lis.cmp.forEach(e=>e()),this._lis.nxt.forEach(e=>e(void 0,void 0,!0)),this.clearLis()}[Symbol.asyncIterator](){return this._itState||(this._itState={q:[]}),this._closed===!0?this.pushIt({value:null,done:!0}):this._closed!==!1&&this.pushIt(this._closed),{next:()=>{let e=this._itState;J(e,"bad state"),J(!e.p,"iterator contract broken");let t=e.q.shift();return t?"value"in t?Promise.resolve(t):Promise.reject(t):(e.p=new Ct,e.p.promise)}}}pushIt(e){let t=this._itState;if(t)if(t.p){const n=t.p;J(n.state==Ze.PENDING,"iterator contract broken"),"value"in e?n.resolve(e):n.reject(e),delete t.p}else t.q.push(e)}}var vi=function(s,e,t,n){function r(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(l){try{h(n.next(l))}catch(u){o(u)}}function c(l){try{h(n.throw(l))}catch(u){o(u)}}function h(l){l.done?i(l.value):r(l.value).then(a,c)}h((n=n.apply(s,e||[])).next())})};class ki{constructor(e,t,n,r,i,o,a){this.method=e,this.requestHeaders=t,this.request=n,this.headers=r,this.response=i,this.status=o,this.trailers=a}then(e,t){return this.promiseFinished().then(n=>e?Promise.resolve(e(n)):n,n=>t?Promise.resolve(t(n)):Promise.reject(n))}promiseFinished(){return vi(this,void 0,void 0,function*(){let[e,t,n,r]=yield Promise.all([this.headers,this.response,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,response:t,status:n,trailers:r}})}}var Fi=function(s,e,t,n){function r(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(l){try{h(n.next(l))}catch(u){o(u)}}function c(l){try{h(n.throw(l))}catch(u){o(u)}}function h(l){l.done?i(l.value):r(l.value).then(a,c)}h((n=n.apply(s,e||[])).next())})};class Ni{constructor(e,t,n,r,i,o,a){this.method=e,this.requestHeaders=t,this.request=n,this.headers=r,this.responses=i,this.status=o,this.trailers=a}then(e,t){return this.promiseFinished().then(n=>e?Promise.resolve(e(n)):n,n=>t?Promise.resolve(t(n)):Promise.reject(n))}promiseFinished(){return Fi(this,void 0,void 0,function*(){let[e,t,n]=yield Promise.all([this.headers,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,status:t,trailers:n}})}}function qe(s,e,t,n,r){var i;{let o=(a,c,h)=>e.unary(a,c,h);for(const a of((i=n.interceptors)!==null&&i!==void 0?i:[]).filter(c=>c.interceptUnary).reverse()){const c=o;o=(h,l,u)=>a.interceptUnary(c,h,l,u)}return o(t,r,n)}}var P;(function(s){s[s.OK=0]="OK",s[s.CANCELLED=1]="CANCELLED",s[s.UNKNOWN=2]="UNKNOWN",s[s.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",s[s.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",s[s.NOT_FOUND=5]="NOT_FOUND",s[s.ALREADY_EXISTS=6]="ALREADY_EXISTS",s[s.PERMISSION_DENIED=7]="PERMISSION_DENIED",s[s.UNAUTHENTICATED=16]="UNAUTHENTICATED",s[s.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",s[s.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",s[s.ABORTED=10]="ABORTED",s[s.OUT_OF_RANGE=11]="OUT_OF_RANGE",s[s.UNIMPLEMENTED=12]="UNIMPLEMENTED",s[s.INTERNAL=13]="INTERNAL",s[s.UNAVAILABLE=14]="UNAVAILABLE",s[s.DATA_LOSS=15]="DATA_LOSS"})(P||(P={}));var Ii=function(s,e,t,n){function r(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(l){try{h(n.next(l))}catch(u){o(u)}}function c(l){try{h(n.throw(l))}catch(u){o(u)}}function h(l){l.done?i(l.value):r(l.value).then(a,c)}h((n=n.apply(s,e||[])).next())})};function or(s,e,t,n,r){if(n)for(let[i,o]of Object.entries(n))if(typeof o=="string")s.append(i,o);else for(let a of o)s.append(i,a);if(s.set("Content-Type",e==="text"?"application/grpc-web-text":"application/grpc-web+proto"),e=="text"&&s.set("Accept","application/grpc-web-text"),s.set("X-Grpc-Web","1"),typeof t=="number"){if(t<=0)throw new se(`timeout ${t} ms exceeded`,P[P.DEADLINE_EXCEEDED]);s.set("grpc-timeout",`${t}m`)}else if(t){const i=t.getTime(),o=Date.now();if(i<=o)throw new se(`deadline ${t} exceeded`,P[P.DEADLINE_EXCEEDED]);s.set("grpc-timeout",`${i-o}m`)}return s}function ar(s,e){let t=new Uint8Array(5+s.length);t[0]=Je.DATA;for(let n=s.length,r=4;r>0;r--)t[r]=n%256,n>>>=8;return t.set(s,5),e==="binary"?t:qn(t)}function Un(s,e,t){if(arguments.length===1){let c=s,h;try{h=c.type}catch{}switch(h){case"error":case"opaque":case"opaqueredirect":throw new se(`fetch response type ${c.type}`,P[P.UNKNOWN])}return Un(_i(c.headers),c.status,c.statusText)}let n=s,r=e>=200&&e<300,i=ur(n),[o,a]=hr(n);return(o===void 0||o===P.OK)&&!r&&(o=Ui(e),a=t),[o,a,i]}function lr(s){let e=xi(s),[t,n]=hr(e),r=ur(e);return[t??P.OK,n,r]}var Je;(function(s){s[s.DATA=0]="DATA",s[s.TRAILER=128]="TRAILER"})(Je||(Je={}));function cr(s,e,t){return Ii(this,void 0,void 0,function*(){let n,r="",i=new Uint8Array(0),o=Ti(e);if(Li(s)){let a=s.getReader();n={next:()=>a.read()}}else n=s[Symbol.asyncIterator]();for(;;){let a=yield n.next();if(a.value!==void 0){if(o==="text"){for(let h=0;h<a.value.length;h++)r+=String.fromCharCode(a.value[h]);let c=r.length-r.length%4;if(c===0)continue;i=dr(i,Zn(r.substring(0,c))),r=r.substring(c)}else i=dr(i,a.value);for(;i.length>=5&&i[0]===Je.DATA;){let c=0;for(let h=1;h<5;h++)c=(c<<8)+i[h];if(i.length-5>=c)t(Je.DATA,i.subarray(5,5+c)),i=i.subarray(5+c);else break}}if(a.done){if(i.length===0)break;if(i[0]!==Je.TRAILER||i.length<5)throw new se("premature EOF",P[P.DATA_LOSS]);t(Je.TRAILER,i.subarray(5));break}}})}const Li=s=>typeof s.getReader=="function";function dr(s,e){let t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function Ti(s){switch(s){case"application/grpc-web-text":case"application/grpc-web-text+proto":return"text";case"application/grpc-web":case"application/grpc-web+proto":return"binary";case void 0:case null:throw new se("missing response content type",P[P.INTERNAL]);default:throw new se("unexpected response content type: "+s,P[P.INTERNAL])}}function hr(s){let e,t,n=s["grpc-message"];if(n!==void 0){if(Array.isArray(n))return[P.INTERNAL,"invalid grpc-web message"];t=n}let r=s["grpc-status"];if(r!==void 0){if(Array.isArray(r))return[P.INTERNAL,"invalid grpc-web status"];if(e=parseInt(r,10),P[e]===void 0)return[P.INTERNAL,"invalid grpc-web status"]}return[e,t]}function ur(s){let e={};for(let[t,n]of Object.entries(s))switch(t){case"grpc-message":case"grpc-status":case"content-type":break;default:e[t]=n}return e}function xi(s){let e={};for(let t of String.fromCharCode.apply(String,s).trim().split(`\r
5
- `)){if(t=="")continue;let[n,...r]=t.split(":");const i=r.join(":").trim();n=n.trim();let o=e[n];typeof o=="string"?e[n]=[o,i]:Array.isArray(o)?o.push(i):e[n]=i}return e}function _i(s){let e={};return s.forEach((t,n)=>{let r=e[n];typeof r=="string"?e[n]=[r,t]:Array.isArray(r)?r.push(t):e[n]=t}),e}function Ui(s){switch(s){case 200:return P.OK;case 400:return P.INVALID_ARGUMENT;case 401:return P.UNAUTHENTICATED;case 403:return P.PERMISSION_DENIED;case 404:return P.NOT_FOUND;case 409:return P.ABORTED;case 412:return P.FAILED_PRECONDITION;case 429:return P.RESOURCE_EXHAUSTED;case 499:return P.CANCELLED;case 500:return P.UNKNOWN;case 501:return P.UNIMPLEMENTED;case 503:return P.UNAVAILABLE;case 504:return P.DEADLINE_EXCEEDED;default:return P.UNKNOWN}}class Bi{constructor(e){this.defaultOptions=e}mergeOptions(e){return Ei(this.defaultOptions,e)}makeUrl(e,t){let n=t.baseUrl;return n.endsWith("/")&&(n=n.substring(0,n.length-1)),`${n}/${e.service.typeName}/${e.name}`}clientStreaming(e){const t=new se("Client streaming is not supported by grpc-web",P[P.UNIMPLEMENTED]);throw t.methodName=e.name,t.serviceName=e.service.typeName,t}duplex(e){const t=new se("Duplex streaming is not supported by grpc-web",P[P.UNIMPLEMENTED]);throw t.methodName=e.name,t.serviceName=e.service.typeName,t}serverStreaming(e,t,n){var r,i,o,a;let c=n,h=(r=c.format)!==null&&r!==void 0?r:"text",l=(i=c.fetchInit)!==null&&i!==void 0?i:{},u=this.makeUrl(e,c),d=e.I.toBinary(t,c.binaryOptions),f=new Ct,y=new Ai,I=!0,L,C=new Ct,R,O=new Ct;return globalThis.fetch(u,Object.assign(Object.assign({},l),{method:"POST",headers:or(new globalThis.Headers,h,c.timeout,c.meta),body:ar(d,h),signal:(o=n.abort)!==null&&o!==void 0?o:null})).then(v=>{let[x,b,B]=Un(v);if(f.resolve(B),x!=null&&x!==P.OK)throw new se(b??P[x],P[x],B);return x!=null&&(L={code:P[x],detail:b??P[x]}),v}).then(v=>{if(!v.body)throw new se("missing response body",P[P.INTERNAL]);return cr(v.body,v.headers.get("content-type"),(x,b)=>{switch(x){case Je.DATA:y.notifyMessage(e.O.fromBinary(b,c.binaryOptions)),I=!1;break;case Je.TRAILER:let B,m;[B,m,R]=lr(b),L={code:P[B],detail:m??P[B]};break}})}).then(()=>{if(!R&&!I)throw new se("missing trailers",P[P.DATA_LOSS]);if(!L)throw new se("missing status",P[P.INTERNAL]);if(L.code!=="OK")throw new se(L.detail,L.code,R);y.notifyComplete(),C.resolve(L),O.resolve(R||{})}).catch(v=>{let x;v instanceof se?x=v:v instanceof Error&&v.name==="AbortError"?x=new se(v.message,P[P.CANCELLED]):x=new se(v instanceof Error?v.message:""+v,P[P.INTERNAL]),x.methodName=e.name,x.serviceName=e.service.typeName,f.rejectPending(x),y.notifyError(x),C.rejectPending(x),O.rejectPending(x)}),new Ni(e,(a=c.meta)!==null&&a!==void 0?a:{},t,f.promise,y,C.promise,O.promise)}unary(e,t,n){var r,i,o,a;let c=n,h=(r=c.format)!==null&&r!==void 0?r:"text",l=(i=c.fetchInit)!==null&&i!==void 0?i:{},u=this.makeUrl(e,c),d=e.I.toBinary(t,c.binaryOptions),f=new Ct,y,I=new Ct,L,C=new Ct,R,O=new Ct;return globalThis.fetch(u,Object.assign(Object.assign({},l),{method:"POST",headers:or(new globalThis.Headers,h,c.timeout,c.meta),body:ar(d,h),signal:(o=n.abort)!==null&&o!==void 0?o:null})).then(v=>{let[x,b,B]=Un(v);if(f.resolve(B),x!=null&&x!==P.OK)throw new se(b??P[x],P[x],B);return x!=null&&(L={code:P[x],detail:b??P[x]}),v}).then(v=>{if(!v.body)throw new se("missing response body",P[P.INTERNAL]);return cr(v.body,v.headers.get("content-type"),(x,b)=>{switch(x){case Je.DATA:if(y)throw new se("unary call received 2nd message",P[P.DATA_LOSS]);y=e.O.fromBinary(b,c.binaryOptions);break;case Je.TRAILER:let B,m;[B,m,R]=lr(b),L={code:P[B],detail:m??P[B]};break}})}).then(()=>{if(!R&&y)throw new se("missing trailers",P[P.DATA_LOSS]);if(!L)throw new se("missing status",P[P.INTERNAL]);if(!y&&L.code==="OK")throw new se("expected error status",P[P.DATA_LOSS]);if(!y)throw new se(L.detail,L.code,R);if(I.resolve(y),L.code!=="OK")throw new se(L.detail,L.code,R);C.resolve(L),O.resolve(R||{})}).catch(v=>{let x;v instanceof se?x=v:v instanceof Error&&v.name==="AbortError"?x=new se(v.message,P[P.CANCELLED]):x=new se(v instanceof Error?v.message:""+v,P[P.INTERNAL]),x.methodName=e.name,x.serviceName=e.service.typeName,f.rejectPending(x),I.rejectPending(x),C.rejectPending(x),O.rejectPending(x)}),new ki(e,(a=c.meta)!==null&&a!==void 0?a:{},t,f.promise,I.promise,C.promise,O.promise)}}var un=(s=>(s[s.IMAGE=0]="IMAGE",s[s.AUDIO=1]="AUDIO",s[s.VIDEO=2]="VIDEO",s[s.ALL=3]="ALL",s[s.FOLDER=4]="FOLDER",s))(un||{});class Oi extends xe{constructor(){super("com.hamropatro.grpc.cms.SearchRequest",[{no:1,name:"search_value",kind:"scalar",T:9},{no:2,name:"cursor",kind:"scalar",T:9},{no:3,name:"limit",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.searchValue="",t.cursor="",t.limit=0,e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.searchValue=e.string();break;case 2:i.cursor=e.string();break;case 3:i.limit=e.int32();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.searchValue!==""&&t.tag(1,j.LengthDelimited).string(e.searchValue),e.cursor!==""&&t.tag(2,j.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(3,j.Varint).int32(e.limit);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const fr=new Oi;class Si extends xe{constructor(){super("com.hamropatro.grpc.cms.SearchResult",[{no:1,name:"items",kind:"message",repeat:1,T:()=>Qe},{no:2,name:"next_page_cursor",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.items=[],t.nextPageCursor="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.items.push(Qe.internalBinaryRead(e,e.uint32(),n));break;case 2:i.nextPageCursor=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){for(let i=0;i<e.items.length;i++)Qe.internalBinaryWrite(e.items[i],t.tag(1,j.LengthDelimited).fork(),n).join();e.nextPageCursor!==""&&t.tag(2,j.LengthDelimited).string(e.nextPageCursor);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Di=new Si;class Ri extends xe{constructor(){super("com.hamropatro.grpc.cms.CreateFileRequest",[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"folder_name",kind:"scalar",T:9},{no:3,name:"nested_folder_name",kind:"scalar",T:9},{no:4,name:"url",kind:"scalar",T:9},{no:5,name:"type",kind:"enum",T:()=>["com.hamropatro.grpc.cms.FileType",un]},{no:6,name:"extension",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.name="",t.folderName="",t.nestedFolderName="",t.url="",t.type=0,t.extension="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.name=e.string();break;case 2:i.folderName=e.string();break;case 3:i.nestedFolderName=e.string();break;case 4:i.url=e.string();break;case 5:i.type=e.int32();break;case 6:i.extension=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.name!==""&&t.tag(1,j.LengthDelimited).string(e.name),e.folderName!==""&&t.tag(2,j.LengthDelimited).string(e.folderName),e.nestedFolderName!==""&&t.tag(3,j.LengthDelimited).string(e.nestedFolderName),e.url!==""&&t.tag(4,j.LengthDelimited).string(e.url),e.type!==0&&t.tag(5,j.Varint).int32(e.type),e.extension!==""&&t.tag(6,j.LengthDelimited).string(e.extension);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const pr=new Ri;class Mi extends xe{constructor(){super("com.hamropatro.grpc.cms.CreateUserFileRequest",[{no:1,name:"url",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:()=>["com.hamropatro.grpc.cms.FileType",un]},{no:3,name:"extension",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.url="",t.type=0,t.extension="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.url=e.string();break;case 2:i.type=e.int32();break;case 3:i.extension=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.url!==""&&t.tag(1,j.LengthDelimited).string(e.url),e.type!==0&&t.tag(2,j.Varint).int32(e.type),e.extension!==""&&t.tag(3,j.LengthDelimited).string(e.extension);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const mr=new Mi;class Vi extends xe{constructor(){super("com.hamropatro.grpc.cms.File",[{no:1,name:"key",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"folder_name",kind:"scalar",T:9},{no:4,name:"nested_folder_name",kind:"scalar",T:9},{no:5,name:"url",kind:"scalar",T:9},{no:6,name:"thumbor_url",kind:"scalar",T:9},{no:7,name:"proxy_url",kind:"scalar",T:9},{no:8,name:"type",kind:"enum",T:()=>["com.hamropatro.grpc.cms.FileType",un]},{no:9,name:"metadata",kind:"message",T:()=>Bn}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",t.name="",t.folderName="",t.nestedFolderName="",t.url="",t.thumborUrl="",t.proxyUrl="",t.type=0,e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.key=e.string();break;case 2:i.name=e.string();break;case 3:i.folderName=e.string();break;case 4:i.nestedFolderName=e.string();break;case 5:i.url=e.string();break;case 6:i.thumborUrl=e.string();break;case 7:i.proxyUrl=e.string();break;case 8:i.type=e.int32();break;case 9:i.metadata=Bn.internalBinaryRead(e,e.uint32(),n,i.metadata);break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key),e.name!==""&&t.tag(2,j.LengthDelimited).string(e.name),e.folderName!==""&&t.tag(3,j.LengthDelimited).string(e.folderName),e.nestedFolderName!==""&&t.tag(4,j.LengthDelimited).string(e.nestedFolderName),e.url!==""&&t.tag(5,j.LengthDelimited).string(e.url),e.thumborUrl!==""&&t.tag(6,j.LengthDelimited).string(e.thumborUrl),e.proxyUrl!==""&&t.tag(7,j.LengthDelimited).string(e.proxyUrl),e.type!==0&&t.tag(8,j.Varint).int32(e.type),e.metadata&&Bn.internalBinaryWrite(e.metadata,t.tag(9,j.LengthDelimited).fork(),n).join();let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Qe=new Vi;class Hi extends xe{constructor(){super("com.hamropatro.grpc.cms.FileMetadata",[{no:1,name:"height",kind:"scalar",T:5},{no:2,name:"width",kind:"scalar",T:5},{no:3,name:"background_color",kind:"scalar",T:9},{no:4,name:"aspect_ratio",kind:"scalar",T:1}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.height=0,t.width=0,t.backgroundColor="",t.aspectRatio=0,e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.height=e.int32();break;case 2:i.width=e.int32();break;case 3:i.backgroundColor=e.string();break;case 4:i.aspectRatio=e.double();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.height!==0&&t.tag(1,j.Varint).int32(e.height),e.width!==0&&t.tag(2,j.Varint).int32(e.width),e.backgroundColor!==""&&t.tag(3,j.LengthDelimited).string(e.backgroundColor),e.aspectRatio!==0&&t.tag(4,j.Bit64).double(e.aspectRatio);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Bn=new Hi;class $i extends xe{constructor(){super("com.hamropatro.grpc.cms.DeleteFileRequest",[{no:1,name:"key",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.key=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const gr=new $i;class Wi extends xe{constructor(){super("com.hamropatro.grpc.cms.DeleteFileResponse",[{no:1,name:"is_deleted",kind:"scalar",T:8}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.isDeleted=!1,e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.isDeleted=e.bool();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.isDeleted!==!1&&t.tag(1,j.Varint).bool(e.isDeleted);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Pi=new Wi;class ji extends xe{constructor(){super("com.hamropatro.grpc.cms.GetFilesByFolderRequest",[{no:1,name:"folder_name",kind:"scalar",T:9},{no:2,name:"cursor",kind:"scalar",T:9},{no:3,name:"limit",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.folderName="",t.cursor="",t.limit=0,e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.folderName=e.string();break;case 2:i.cursor=e.string();break;case 3:i.limit=e.int32();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.folderName!==""&&t.tag(1,j.LengthDelimited).string(e.folderName),e.cursor!==""&&t.tag(2,j.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(3,j.Varint).int32(e.limit);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const wr=new ji;class Zi extends xe{constructor(){super("com.hamropatro.grpc.cms.GetFilesByFolderResponse",[{no:1,name:"files",kind:"message",repeat:1,T:()=>Qe},{no:2,name:"next_cursor",kind:"scalar",T:9},{no:3,name:"has_more",kind:"scalar",T:8}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.files=[],t.nextCursor="",t.hasMore=!1,e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.files.push(Qe.internalBinaryRead(e,e.uint32(),n));break;case 2:i.nextCursor=e.string();break;case 3:i.hasMore=e.bool();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){for(let i=0;i<e.files.length;i++)Qe.internalBinaryWrite(e.files[i],t.tag(1,j.LengthDelimited).fork(),n).join();e.nextCursor!==""&&t.tag(2,j.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,j.Varint).bool(e.hasMore);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const qi=new Zi,On=new _n("com.hamropatro.grpc.cms.FileService",[{name:"createFile",options:{},I:pr,O:Qe},{name:"updateFile",options:{},I:Qe,O:Qe},{name:"deleteFile",options:{},I:gr,O:Pi},{name:"getFilesByFolder",options:{},I:wr,O:qi},{name:"createUserFile",options:{},I:mr,O:Qe},{name:"search",options:{},I:fr,O:Di}]);class Mt{constructor(e){pe(this,"typeName",On.typeName);pe(this,"methods",On.methods);pe(this,"options",On.options);this._transport=e}createFile(e,t){const n=this.methods[0],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}updateFile(e,t){const n=this.methods[1],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}deleteFile(e,t){const n=this.methods[2],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}getFilesByFolder(e,t){const n=this.methods[3],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}createUserFile(e,t){const n=this.methods[4],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}search(e,t){const n=this.methods[5],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}}const Ki=async(s,e,t,n,r,i)=>{var o;try{const a=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,c=new Mt(a),h=pr.create();return h.name=s,h.nestedFolderName=e,h.url=t,h.type=n,h.folderName=r,await c.createFile(h,i)}catch(a){throw a}},zi=async(s,e,t)=>{var n;try{const r=(n=window.ImageSalonSDK)==null?void 0:n.grpcConfig,i=new Mt(r),o=mr.create();return o.url=s,o.type=e,await i.createUserFile(o,t)}catch(r){throw r}},Xi=async(s,e,t,n)=>{var r;try{const i=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=new Mt(i),a=wr.create();return a.folderName=s,a.cursor=e,a.limit=t,await o.getFilesByFolder(a,n)}catch(i){throw i}},Gi=async(s,e,t=20,n)=>{var r;try{const i=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=new Mt(i),a=fr.create();return a.searchValue=s,a.cursor=e,a.limit=t,await o.search(a,n)}catch(i){throw i}},Ji=async(s,e,t,n,r,i,o,a,c)=>{var h;try{const l=(h=window.ImageSalonSDK)==null?void 0:h.grpcConfig,u=new Mt(l),d=Qe.create();return d.key=s,d.name=e,d.nestedFolderName=t,d.url=n,d.thumborUrl=r,d.proxyUrl=i,d.type=o,d.folderName=a,await u.updateFile(d,c)}catch(l){throw l}},Qi=async(s,e)=>{var t;try{const n=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,r=new Mt(n),i=gr.create();return i.key=s,await r.deleteFile(i,e)}catch(n){throw n}};class Yi extends xe{constructor(){super("com.hamropatro.grpc.cms.DeleteFolderRequest",[{no:1,name:"key",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.key=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const yr=new Yi;class es extends xe{constructor(){super("com.hamropatro.grpc.cms.CreateFolderRequest",[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"nested_folder_name",kind:"scalar",T:9},{no:3,name:"created_by",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.name="",t.nestedFolderName="",t.createdBy="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.name=e.string();break;case 2:i.nestedFolderName=e.string();break;case 3:i.createdBy=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.name!==""&&t.tag(1,j.LengthDelimited).string(e.name),e.nestedFolderName!==""&&t.tag(2,j.LengthDelimited).string(e.nestedFolderName),e.createdBy!==""&&t.tag(3,j.LengthDelimited).string(e.createdBy);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const br=new es;class ts extends xe{constructor(){super("com.hamropatro.grpc.cms.GetAllFoldersRequest",[{no:1,name:"cursor",kind:"scalar",T:9},{no:2,name:"limit",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.cursor="",t.limit=0,e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.cursor=e.string();break;case 2:i.limit=e.int32();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.cursor!==""&&t.tag(1,j.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(2,j.Varint).int32(e.limit);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Cr=new ts;class ns extends xe{constructor(){super("com.hamropatro.grpc.cms.GetAllFoldersResponse",[{no:1,name:"folder",kind:"message",repeat:1,T:()=>Et},{no:2,name:"next_cursor",kind:"scalar",T:9},{no:3,name:"has_more",kind:"scalar",T:8}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.folder=[],t.nextCursor="",t.hasMore=!1,e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.folder.push(Et.internalBinaryRead(e,e.uint32(),n));break;case 2:i.nextCursor=e.string();break;case 3:i.hasMore=e.bool();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){for(let i=0;i<e.folder.length;i++)Et.internalBinaryWrite(e.folder[i],t.tag(1,j.LengthDelimited).fork(),n).join();e.nextCursor!==""&&t.tag(2,j.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,j.Varint).bool(e.hasMore);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const rs=new ns;class is extends xe{constructor(){super("com.hamropatro.grpc.cms.Folder",[{no:1,name:"key",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"nested_folder_name",kind:"scalar",T:9},{no:4,name:"created_by",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",t.name="",t.nestedFolderName="",t.createdBy="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.key=e.string();break;case 2:i.name=e.string();break;case 3:i.nestedFolderName=e.string();break;case 4:i.createdBy=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key),e.name!==""&&t.tag(2,j.LengthDelimited).string(e.name),e.nestedFolderName!==""&&t.tag(3,j.LengthDelimited).string(e.nestedFolderName),e.createdBy!==""&&t.tag(4,j.LengthDelimited).string(e.createdBy);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Et=new is,Sn=new _n("com.hamropatro.grpc.cms.FolderService",[{name:"createFolder",options:{},I:br,O:Et},{name:"getFolders",options:{},I:Cr,O:rs},{name:"updateFolder",options:{},I:Et,O:Et},{name:"deleteFolder",options:{},I:yr,O:Et}]);class fn{constructor(e){pe(this,"typeName",Sn.typeName);pe(this,"methods",Sn.methods);pe(this,"options",Sn.options);this._transport=e}createFolder(e,t){const n=this.methods[0],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}getFolders(e,t){const n=this.methods[1],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}updateFolder(e,t){const n=this.methods[2],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}deleteFolder(e,t){const n=this.methods[3],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}}const ss=async(s,e=20,t)=>{var o;const n=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,r=new fn(n),i=Cr.create();try{return i.cursor=s,i.limit=e,await r.getFolders(i,t)}catch(a){throw a}},os=async(s,e,t,n)=>{var r;try{const i=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=new fn(i),a=br.create();return a.name=s,a.nestedFolderName=e,a.createdBy=t,await o.createFolder(a,n)}catch(i){throw i}},as=async(s,e,t,n,r)=>{var i;try{const o=(i=window.ImageSalonSDK)==null?void 0:i.grpcConfig,a=new fn(o),c=Et.create();return c.name=e,c.key=s,c.nestedFolderName=t,c.createdBy=n,await a.updateFolder(c,r)}catch(o){throw o}},ls=async(s,e)=>{var t;try{const n=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,r=new fn(n),i=yr.create();return i.key=s,await r.deleteFolder(i,e)}catch(n){throw n}},Dn=(s,e,t)=>{const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.setAttribute("width",s||"20"),n.setAttribute("height",e||"20"),n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("fill","none"),n.setAttribute("stroke",t||"#ee3f3f"),n.setAttribute("stroke-width","2"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.classList.add("lucide","lucide-circle-alert");const r=document.createElementNS("http://www.w3.org/2000/svg","circle");r.setAttribute("cx","12"),r.setAttribute("cy","12"),r.setAttribute("r","10");const i=document.createElementNS("http://www.w3.org/2000/svg","line");i.setAttribute("x1","12"),i.setAttribute("x2","12"),i.setAttribute("y1","8"),i.setAttribute("y2","12");const o=document.createElementNS("http://www.w3.org/2000/svg","line");return o.setAttribute("x1","12"),o.setAttribute("x2","12.01"),o.setAttribute("y1","16"),o.setAttribute("y2","16"),n.appendChild(r),n.appendChild(i),n.appendChild(o),n};function Er(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("height","24px"),s.setAttribute("width","24px"),s.setAttribute("viewBox","0 -960 960 960"),s.setAttribute("fill","#333");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"),s.appendChild(e),s}function cs(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width","12"),s.setAttribute("height","12"),s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","none"),s.setAttribute("stroke","currentColor"),s.setAttribute("stroke-width","2"),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.classList.add("lucide","lucide-music-4");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M9 18V5l12-2v13");const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d","m9 9 12-2");const n=document.createElementNS("http://www.w3.org/2000/svg","circle");n.setAttribute("cx","6"),n.setAttribute("cy","18"),n.setAttribute("r","3");const r=document.createElementNS("http://www.w3.org/2000/svg","circle");return r.setAttribute("cx","18"),r.setAttribute("cy","16"),r.setAttribute("r","3"),s.appendChild(e),s.appendChild(t),s.appendChild(n),s.appendChild(r),document.body.appendChild(s),s}const Ar=s=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("width","20"),e.setAttribute("height","20"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke",s||"currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.classList.add("lucide","lucide-circle-check-big");const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d","M21.801 10A10 10 0 1 1 17 3.335");const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","m9 11 3 3L22 4"),e.appendChild(t),e.appendChild(n),e};function Rn(s="#333"){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("x","0px"),e.setAttribute("y","0px"),e.setAttribute("width","18"),e.setAttribute("height","18"),e.setAttribute("viewBox","0 0 50 50"),e.setAttribute("fill",s);const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d","M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z"),e.appendChild(t),e}function vr(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width","16"),s.setAttribute("height","16"),s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","none"),s.setAttribute("stroke","#2c96f8"),s.setAttribute("stroke-width","2"),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.classList.add("lucide","lucide-pencil");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z");const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d","m15 5 4 4"),s.appendChild(e),s.appendChild(t),document.body.appendChild(s),s}function Gt(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/folder"),s.setAttribute("x","0px"),s.setAttribute("y","0px"),s.setAttribute("width","24"),s.setAttribute("height","24"),s.setAttribute("viewBox","0 0 48 48");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("fill","#FFA000"),e.setAttribute("d","M40,12H22l-4-4H8c-2.2,0-4,1.8-4,4v8h40v-4C44,13.8,42.2,12,40,12z");const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("fill","#FFCA28"),t.setAttribute("d","M40,12H8c-2.2,0-4,1.8-4,4v20c0,2.2,1.8,4,4,4h32c2.2,0,4-1.8,4-4V16C44,13.8,42.2,12,40,12z"),s.appendChild(e),s.appendChild(t),s}function ds(){const s="http://www.w3.org/2000/svg",e=document.createElementNS(s,"svg");e.setAttribute("width","12"),e.setAttribute("height","12"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","3"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.classList.add("lucide","lucide-image");const t=document.createElementNS(s,"rect");t.setAttribute("width","18"),t.setAttribute("height","18"),t.setAttribute("x","3"),t.setAttribute("y","3"),t.setAttribute("rx","2"),t.setAttribute("ry","2");const n=document.createElementNS(s,"circle");n.setAttribute("cx","9"),n.setAttribute("cy","9"),n.setAttribute("r","2");const r=document.createElementNS(s,"path");return r.setAttribute("d","m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"),e.appendChild(t),e.appendChild(n),e.appendChild(r),document.body.appendChild(e),e}function hs(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("height","24px"),s.setAttribute("viewBox","0 -960 960 960"),s.setAttribute("width","24px"),s.setAttribute("fill","currentColor");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","m488-400-65 65 56 56 161-161-161-161-56 56 65 65H320v80h168ZM160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640v400q0 33-23.5 56.5T800-160H160Zm0-80h640v-400H447l-80-80H160v480Zm0 0v-480 480Z"),s.appendChild(e),s}function kr(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("fill","none"),s.setAttribute("width","20"),s.setAttribute("height","20"),s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("stroke-width","1.5"),s.setAttribute("stroke","currentColor"),s.setAttribute("class","size-2");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.setAttribute("d","M12 4.5v15m7.5-7.5h-15"),s.appendChild(e),s}function us(){const s="http://www.w3.org/2000/svg",e=document.createElementNS(s,"svg");e.setAttribute("width","16"),e.setAttribute("height","16"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.classList.add("lucide","lucide-eye");const t=document.createElementNS(s,"path");t.setAttribute("d","M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"),e.appendChild(t);const n=document.createElementNS(s,"circle");return n.setAttribute("cx","12"),n.setAttribute("cy","12"),n.setAttribute("r","3"),e.appendChild(n),document.body.appendChild(e),e}function fs(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("height","24px"),s.setAttribute("width","24px"),s.setAttribute("viewBox","0 0 30 30"),s.setAttribute("fill","#999");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M 13 3 C 7.4889971 3 3 7.4889971 3 13 C 3 18.511003 7.4889971 23 13 23 C 15.396508 23 17.597385 22.148986 19.322266 20.736328 L 25.292969 26.707031 A 1.0001 1.0001 0 1 0 26.707031 25.292969 L 20.736328 19.322266 C 22.148986 17.597385 23 15.396508 23 13 C 23 7.4889971 18.511003 3 13 3 z M 13 5 C 17.430123 5 21 8.5698774 21 13 C 21 17.430123 17.430123 21 13 21 C 8.5698774 21 5 17.430123 5 13 C 5 8.5698774 8.5698774 5 13 5 z"),s.appendChild(e),s}function Fr(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width","16"),s.setAttribute("height","16"),s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","none"),s.setAttribute("stroke","#f14b4b"),s.setAttribute("stroke-width","2"),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.classList.add("lucide","lucide-trash-2");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M3 6h18");const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d","M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6");const n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("d","M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2");const r=document.createElementNS("http://www.w3.org/2000/svg","line");r.setAttribute("x1","10"),r.setAttribute("x2","10"),r.setAttribute("y1","11"),r.setAttribute("y2","17");const i=document.createElementNS("http://www.w3.org/2000/svg","line");return i.setAttribute("x1","14"),i.setAttribute("x2","14"),i.setAttribute("y1","11"),i.setAttribute("y2","17"),s.appendChild(e),s.appendChild(t),s.appendChild(n),s.appendChild(r),s.appendChild(i),document.body.appendChild(s),s}function Mn(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width","24"),s.setAttribute("height","24"),s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","none"),s.setAttribute("stroke","currentColor"),s.setAttribute("stroke-width","2"),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.classList.add("lucide","lucide-upload");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4");const t=document.createElementNS("http://www.w3.org/2000/svg","polyline");t.setAttribute("points","17 8 12 3 7 8");const n=document.createElementNS("http://www.w3.org/2000/svg","line");return n.setAttribute("x1","12"),n.setAttribute("x2","12"),n.setAttribute("y1","3"),n.setAttribute("y2","15"),s.appendChild(e),s.appendChild(t),s.appendChild(n),s}function ps(){const s="http://www.w3.org/2000/svg",e=document.createElementNS(s,"svg");e.setAttribute("width","12"),e.setAttribute("height","12"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","3"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.classList.add("lucide","lucide-video");const t=document.createElementNS(s,"path");t.setAttribute("d","m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5");const n=document.createElementNS(s,"rect");return n.setAttribute("x","2"),n.setAttribute("y","6"),n.setAttribute("width","14"),n.setAttribute("height","12"),n.setAttribute("rx","2"),e.appendChild(t),e.appendChild(n),document.body.appendChild(e),e}function ee(s,e,t,n,r){let i=document.createElement(s);return e&&(i.className+=e),t&&(i.style.cssText=t),n&&(i.textContent=n),r&&r.appendChild(i),i}class ms{constructor(){X(this,pt);X(this,et);X(this,Ht,"#fff");$(this,pt,document.createElementNS("http://www.w3.org/2000/svg","svg")),F(this,pt).setAttribute("viewBox","25 25 50 50"),F(this,pt).classList.add("loader-svg"),$(this,et,document.createElementNS("http://www.w3.org/2000/svg","circle")),F(this,et).setAttribute("r","20"),F(this,et).setAttribute("cy","50"),F(this,et).setAttribute("cx","50"),F(this,et).setAttribute("stroke",F(this,Ht)),F(this,et).classList.add("loader-circle"),F(this,pt).appendChild(F(this,et))}show(e,t){t&&($(this,Ht,t),F(this,et).setAttribute("stroke",F(this,Ht))),e.appendChild(F(this,pt))}hide(){F(this,pt).remove()}}pt=new WeakMap,et=new WeakMap,Ht=new WeakMap;const Nr=new ms,pn=document.body;class Ir{constructor(){pe(this,"main");pe(this,"dialogContainer");pe(this,"dialog");pe(this,"dialogBackdrop");pe(this,"dialogContent");pe(this,"dialogHeader");pe(this,"dialogBody");pe(this,"dialogFooter");pe(this,"confirmButton");pe(this,"cancelButton");pe(this,"confirmCallback");pe(this,"cancelCallback");this.main=ee("div"),this.dialog=ee("div"),this.confirmCallback=void 0,this.cancelCallback=void 0}_init(e){this.main=ee("div","dialog-presentation","","",pn),this.main.setAttribute("role","presentation"),this.dialogContainer=ee("div","dialog-container","","",this.main),this.dialogBackdrop=ee("div","dialog-backdrop","","",this.dialogContainer),this.dialog=ee("div","dialog","","",this.dialogContainer),this.dialog.setAttribute("tabIndex","-1");const t=document.activeElement;if(t&&t!==document.body&&(t.blur(),this.dialog.focus()),this.dialog.className="dialog",this.dialogContent=ee("div","dialog-content","","",this.dialog),e!=null&&e.dialogContentStyle&&Object.assign(this.dialogContent.style,e.dialogContentStyle),this.confirmButton=ee("button","dialog-btn confirm","","",this.dialogFooter),this.confirmButton.type="button",this.cancelButton=ee("button","dialog-btn cancel","","",this.dialogFooter),this.cancelButton.type="button",e.showCloseBtn){const n=ee("button","dialog-close-btn","","",this.dialogContent);n.appendChild(Rn()),n.onclick=()=>this.hide()}return e.header&&this._setHeader(e),this._setBody(e),this._setFooter(e),this.confirmButton.textContent=e.confirmButtonText||"Upload",this.cancelButton.textContent=e.cancelButtonText||"Cancel",pn.style.overflow="hidden",this.confirmButton.textContent=e.confirmButtonText||"Upload",this.cancelButton.textContent=e.cancelButtonText||"Cancel",pn.classList.add("dialog-visible"),new Promise(n=>{const r=i=>()=>{this.hide(),n(i==="confirm")};this.confirmCallback=e.onConfirm||r("confirm"),this.confirmButton.addEventListener("click",this.confirmCallback),this.cancelCallback=e.onCancel||r("cancel"),this.cancelButton.addEventListener("click",this.cancelCallback)})}_setHeader(e){if(this.dialogHeader=ee("div","dialog-header","","",this.dialogContent),!e.header)this.dialogHeader.innerHTML="";else if(typeof e.header=="string"){const t=ee("h4","dialog-header-text","","",this.dialogHeader);t.textContent=e.header}else this.dialogHeader.innerHTML="",this.dialogHeader.appendChild(e.header)}_setBody(e){this.dialogBody=ee("div","dialog-body","","",this.dialogContent),typeof e.content=="string"?this.dialogBody.innerHTML=e.content:(this.dialogBody.innerHTML="",this.dialogBody.appendChild(e.content))}_setFooter(e){this.dialogFooter=ee("div","dialog-footer","","",this.dialogContent),e.showFooter?this.dialogFooter.append(this.cancelButton,this.confirmButton):(this.dialogFooter.innerHTML="",this.dialogFooter.remove())}show(e){this._init(e),setTimeout(()=>{this.dialogContainer.style.opacity="1",this.dialog.style.transform="scale(1)",this.dialog.style.transition="transform 150ms ease-in",this.dialog.style.opacity="1",this.dialogBackdrop.style.opacity="1"},150)}hide(){this.main||pn.style.removeProperty("overflow"),this.dialog.style.transform="scale(0.8)",this.dialog.style.transition="transform 150ms ease-out",this.dialogBackdrop.style.opacity="0",setTimeout(()=>{this.dialogContainer.style.opacity="0",this.dialog.style.opacity="0",this.dialogContent.style.opacity="0",this.main.remove()},150)}updateUploadBtn(e){e?(Nr.show(this.confirmButton),this.confirmButton.disabled=!0):(Nr.hide(),this.confirmButton.disabled=!1)}}const mn=new Ir,Ee=new Ir;class gs{constructor(){pe(this,"main");pe(this,"dialogBody");this.main=ee("div"),this.dialogBody=ee("div"),this.hide()}show(e){this.main=ee("div","popover","","",e.mainContainer),this.dialogBody=ee("div","popover-body","","",this.main),this.main.id=e.divId,this.dialogBody.append(e.content)}hide(){this.main.remove()}}const Ke=new gs;var it=(s=>(s[s.IMAGE=0]="IMAGE",s[s.AUDIO=1]="AUDIO",s[s.VIDEO=2]="VIDEO",s[s.ALL=3]="ALL",s[s.FOLDER=4]="FOLDER",s))(it||{});const Jt={0:"IMAGE",1:"AUDIO",2:"VIDEO",3:"ALL",4:"FOLDER"};function Lr(s){switch(s){case"image":return Jt[it.IMAGE];case"video":return Jt[it.VIDEO];case"audio":return Jt[it.AUDIO];default:return Jt[it.ALL]}}function ws(s){const e={};s.forEach(r=>{e[r.key]={...r,children:{}}});const t=r=>(Object.values(e).filter(o=>o.nestedFolderName==r.key).forEach(o=>{r.children[o.key]=t(o)}),r);return s.reduce((r,i)=>(i.nestedFolderName||r.push(t(e[i.key])),r),[])}function ys(s,e){const t=n=>{if(n.key===e.nestedFolderName)return n.children[e.key]={...e,children:{}},!0;for(const r in n.children){const i=n.children[r];if(t(i))return!0}return!1};for(const n of s)if(t(n))break;return s}const bs=async(s,e)=>{let t;try{s&&(t={Authorization:s,"app-id":e==="production"?"hamropatro":"hamropatro-android"})}catch(r){if(r)throw r}return{meta:t}};function K(s,e){const t=document.createElement("div");return s&&(t.className=s),e&&(t.id=e),t}function Qt(s,e,t){const n=document.createElement("p");return e&&(n.className=e),t&&(n.id=t),s&&(n.textContent=s),n}function oe(s,e){const t=document.createElement("span");return e&&(t.className=e),s&&(t.textContent=s),t}function Tr(s,e,t,n){const r=document.createElement("img");return e&&(r.className=e),r.src=s,r}function Cs(s,e,t){const n=document.createElement("video"),r=document.createElement("source");return n.className=e,r.src=s,n.appendChild(r),n}function Es(s,e,t){const n=document.createElement("audio"),r=document.createElement("source");return n.className=e,n.controls=!0,r.src=s,n.appendChild(r),n}function Pe(s,e,t,n,r){const i=document.createElement("button");return e&&(i.className=e),t&&(i.id=t),s&&(i.textContent=s),r&&(i.innerHTML=r),i.disabled=n,i}function Vn(s,e,t){const n=document.createElement("input");return n.className=e,n.defaultValue=t,s&&(n.type=s),n}class As extends xe{constructor(){super("com.hamropatro.grpc.cms.ImageUploadRequest",[{no:1,name:"mime_type",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.mimeType="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.mimeType=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.mimeType!==""&&t.tag(1,j.LengthDelimited).string(e.mimeType);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Hn=new As;class vs extends xe{constructor(){super("com.hamropatro.grpc.cms.ImageUploadResponse",[{no:1,name:"key",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",t.url="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.key=e.string();break;case 2:i.url=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key),e.url!==""&&t.tag(2,j.LengthDelimited).string(e.url);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const xr=new vs,$n=new _n("com.hamropatro.grpc.cms.ImageUploadService",[{name:"Upload",options:{},I:Hn,O:xr},{name:"UploadUserImage",options:{},I:Hn,O:xr}]);class ks{constructor(e){pe(this,"typeName",$n.typeName);pe(this,"methods",$n.methods);pe(this,"options",$n.options);this._transport=e}upload(e,t){const n=this.methods[0],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}uploadUserImage(e,t){const n=this.methods[1],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}}const Fs=async(s,e,t=!0)=>{var o;const n=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,r=new ks(n),i=Hn.create();try{return i.mimeType=s,t?await r.upload(i,e):await r.uploadUserImage(i,e)}catch(a){throw a}};function Ns(s,e){return e.forEach(function(t){t&&typeof t!="string"&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if(n!=="default"&&!(n in s)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(s,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(s)}function _r(s,e){return new Promise(function(t,n){let r;return Is(s).then(function(i){try{return r=i,t(new Blob([e.slice(0,2),r,e.slice(2)],{type:"image/jpeg"}))}catch(o){return n(o)}},n)})}const Is=s=>new Promise((e,t)=>{const n=new FileReader;n.addEventListener("load",({target:{result:r}})=>{const i=new DataView(r);let o=0;if(i.getUint16(o)!==65496)return t("not a valid JPEG");for(o+=2;;){const a=i.getUint16(o);if(a===65498)break;const c=i.getUint16(o+2);if(a===65505&&i.getUint32(o+4)===1165519206){const h=o+10;let l;switch(i.getUint16(h)){case 18761:l=!0;break;case 19789:l=!1;break;default:return t("TIFF header contains invalid endian")}if(i.getUint16(h+2,l)!==42)return t("TIFF header contains invalid version");const u=i.getUint32(h+4,l),d=h+u+2+12*i.getUint16(h+u,l);for(let f=h+u+2;f<d;f+=12)if(i.getUint16(f,l)==274){if(i.getUint16(f+2,l)!==3)return t("Orientation data type is invalid");if(i.getUint32(f+4,l)!==1)return t("Orientation data count is invalid");i.setUint16(f+8,1,l);break}return e(r.slice(o,o+2+c))}o+=2+c}return e(new Blob)}),n.readAsArrayBuffer(s)});var gn={},Ls={get exports(){return gn},set exports(s){gn=s}};(function(s){var e,t,n={};Ls.exports=n,n.parse=function(r,i){for(var o=n.bin.readUshort,a=n.bin.readUint,c=0,h={},l=new Uint8Array(r),u=l.length-4;a(l,u)!=101010256;)u--;c=u,c+=4;var d=o(l,c+=4);o(l,c+=2);var f=a(l,c+=2),y=a(l,c+=4);c+=4,c=y;for(var I=0;I<d;I++){a(l,c),c+=4,c+=4,c+=4,a(l,c+=4),f=a(l,c+=4);var L=a(l,c+=4),C=o(l,c+=4),R=o(l,c+2),O=o(l,c+4);c+=6;var v=a(l,c+=8);c+=4,c+=C+R+O,n._readLocal(l,v,h,f,L,i)}return h},n._readLocal=function(r,i,o,a,c,h){var l=n.bin.readUshort,u=n.bin.readUint;u(r,i),l(r,i+=4),l(r,i+=2);var d=l(r,i+=2);u(r,i+=2),u(r,i+=4),i+=4;var f=l(r,i+=8),y=l(r,i+=2);i+=2;var I=n.bin.readUTF8(r,i,f);if(i+=f,i+=y,h)o[I]={size:c,csize:a};else{var L=new Uint8Array(r.buffer,i);if(d==0)o[I]=new Uint8Array(L.buffer.slice(i,i+a));else{if(d!=8)throw"unknown compression method: "+d;var C=new Uint8Array(c);n.inflateRaw(L,C),o[I]=C}}},n.inflateRaw=function(r,i){return n.F.inflate(r,i)},n.inflate=function(r,i){return r[0],r[1],n.inflateRaw(new Uint8Array(r.buffer,r.byteOffset+2,r.length-6),i)},n.deflate=function(r,i){i==null&&(i={level:6});var o=0,a=new Uint8Array(50+Math.floor(1.1*r.length));a[o]=120,a[o+1]=156,o+=2,o=n.F.deflateRaw(r,a,o,i.level);var c=n.adler(r,0,r.length);return a[o+0]=c>>>24&255,a[o+1]=c>>>16&255,a[o+2]=c>>>8&255,a[o+3]=c>>>0&255,new Uint8Array(a.buffer,0,o+4)},n.deflateRaw=function(r,i){i==null&&(i={level:6});var o=new Uint8Array(50+Math.floor(1.1*r.length)),a=n.F.deflateRaw(r,o,a,i.level);return new Uint8Array(o.buffer,0,a)},n.encode=function(r,i){i==null&&(i=!1);var o=0,a=n.bin.writeUint,c=n.bin.writeUshort,h={};for(var l in r){var u=!n._noNeed(l)&&!i,d=r[l],f=n.crc.crc(d,0,d.length);h[l]={cpr:u,usize:d.length,crc:f,file:u?n.deflateRaw(d):d}}for(var l in h)o+=h[l].file.length+30+46+2*n.bin.sizeUTF8(l);o+=22;var y=new Uint8Array(o),I=0,L=[];for(var l in h){var C=h[l];L.push(I),I=n._writeHeader(y,I,l,C,0)}var R=0,O=I;for(var l in h)C=h[l],L.push(I),I=n._writeHeader(y,I,l,C,1,L[R++]);var v=I-O;return a(y,I,101010256),I+=4,c(y,I+=4,R),c(y,I+=2,R),a(y,I+=2,v),a(y,I+=4,O),I+=4,I+=2,y.buffer},n._noNeed=function(r){var i=r.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(i)!=-1},n._writeHeader=function(r,i,o,a,c,h){var l=n.bin.writeUint,u=n.bin.writeUshort,d=a.file;return l(r,i,c==0?67324752:33639248),i+=4,c==1&&(i+=2),u(r,i,20),u(r,i+=2,0),u(r,i+=2,a.cpr?8:0),l(r,i+=2,0),l(r,i+=4,a.crc),l(r,i+=4,d.length),l(r,i+=4,a.usize),u(r,i+=4,n.bin.sizeUTF8(o)),u(r,i+=2,0),i+=2,c==1&&(i+=2,i+=2,l(r,i+=6,h),i+=4),i+=n.bin.writeUTF8(r,i,o),c==0&&(r.set(d,i),i+=d.length),i},n.crc={table:function(){for(var r=new Uint32Array(256),i=0;i<256;i++){for(var o=i,a=0;a<8;a++)1&o?o=3988292384^o>>>1:o>>>=1;r[i]=o}return r}(),update:function(r,i,o,a){for(var c=0;c<a;c++)r=n.crc.table[255&(r^i[o+c])]^r>>>8;return r},crc:function(r,i,o){return 4294967295^n.crc.update(4294967295,r,i,o)}},n.adler=function(r,i,o){for(var a=1,c=0,h=i,l=i+o;h<l;){for(var u=Math.min(h+5552,l);h<u;)c+=a+=r[h++];a%=65521,c%=65521}return c<<16|a},n.bin={readUshort:function(r,i){return r[i]|r[i+1]<<8},writeUshort:function(r,i,o){r[i]=255&o,r[i+1]=o>>8&255},readUint:function(r,i){return 16777216*r[i+3]+(r[i+2]<<16|r[i+1]<<8|r[i])},writeUint:function(r,i,o){r[i]=255&o,r[i+1]=o>>8&255,r[i+2]=o>>16&255,r[i+3]=o>>24&255},readASCII:function(r,i,o){for(var a="",c=0;c<o;c++)a+=String.fromCharCode(r[i+c]);return a},writeASCII:function(r,i,o){for(var a=0;a<o.length;a++)r[i+a]=o.charCodeAt(a)},pad:function(r){return r.length<2?"0"+r:r},readUTF8:function(r,i,o){for(var a,c="",h=0;h<o;h++)c+="%"+n.bin.pad(r[i+h].toString(16));try{a=decodeURIComponent(c)}catch{return n.bin.readASCII(r,i,o)}return a},writeUTF8:function(r,i,o){for(var a=o.length,c=0,h=0;h<a;h++){var l=o.charCodeAt(h);if(!(4294967168&l))r[i+c]=l,c++;else if(!(4294965248&l))r[i+c]=192|l>>6,r[i+c+1]=128|l>>0&63,c+=2;else if(!(4294901760&l))r[i+c]=224|l>>12,r[i+c+1]=128|l>>6&63,r[i+c+2]=128|l>>0&63,c+=3;else{if(4292870144&l)throw"e";r[i+c]=240|l>>18,r[i+c+1]=128|l>>12&63,r[i+c+2]=128|l>>6&63,r[i+c+3]=128|l>>0&63,c+=4}}return c},sizeUTF8:function(r){for(var i=r.length,o=0,a=0;a<i;a++){var c=r.charCodeAt(a);if(!(4294967168&c))o++;else if(!(4294965248&c))o+=2;else if(!(4294901760&c))o+=3;else{if(4292870144&c)throw"e";o+=4}}return o}},n.F={},n.F.deflateRaw=function(r,i,o,a){var c=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][a],h=n.F.U,l=n.F._goodIndex;n.F._hash;var u=n.F._putsE,d=0,f=o<<3,y=0,I=r.length;if(a==0){for(;d<I;)u(i,f,d+(N=Math.min(65535,I-d))==I?1:0),f=n.F._copyExact(r,d,N,i,f+8),d+=N;return f>>>3}var L=h.lits,C=h.strt,R=h.prev,O=0,v=0,x=0,b=0,B=0,m=0;for(I>2&&(C[m=n.F._hash(r,0)]=0),d=0;d<I;d++){if(B=m,d+1<I-2){m=n.F._hash(r,d+1);var g=d+1&32767;R[g]=C[m],C[m]=g}if(y<=d){(O>14e3||v>26697)&&I-d>100&&(y<d&&(L[O]=d-y,O+=2,y=d),f=n.F._writeBlock(d==I-1||y==I?1:0,L,O,b,r,x,d-x,i,f),O=v=b=0,x=d);var A=0;d<I-2&&(A=n.F._bestMatch(r,d,R,B,Math.min(c[2],I-d),c[3]));var N=A>>>16,k=65535&A;if(A!=0){k=65535&A;var T=l(N=A>>>16,h.of0);h.lhst[257+T]++;var E=l(k,h.df0);h.dhst[E]++,b+=h.exb[T]+h.dxb[E],L[O]=N<<23|d-y,L[O+1]=k<<16|T<<8|E,O+=2,y=d+N}else h.lhst[r[d]]++;v++}}for(x==d&&r.length!=0||(y<d&&(L[O]=d-y,O+=2,y=d),f=n.F._writeBlock(1,L,O,b,r,x,d-x,i,f),O=0,v=0,O=v=b=0,x=d);7&f;)f++;return f>>>3},n.F._bestMatch=function(r,i,o,a,c,h){var l=32767&i,u=o[l],d=l-u+32768&32767;if(u==l||a!=n.F._hash(r,i-d))return 0;for(var f=0,y=0,I=Math.min(32767,i);d<=I&&--h!=0&&u!=l;){if(f==0||r[i+f]==r[i+f-d]){var L=n.F._howLong(r,i,d);if(L>f){if(y=d,(f=L)>=c)break;d+2<L&&(L=d+2);for(var C=0,R=0;R<L-2;R++){var O=i-d+R+32768&32767,v=O-o[O]+32768&32767;v>C&&(C=v,u=O)}}}d+=(l=u)-(u=o[l])+32768&32767}return f<<16|y},n.F._howLong=function(r,i,o){if(r[i]!=r[i-o]||r[i+1]!=r[i+1-o]||r[i+2]!=r[i+2-o])return 0;var a=i,c=Math.min(r.length,i+258);for(i+=3;i<c&&r[i]==r[i-o];)i++;return i-a},n.F._hash=function(r,i){return(r[i]<<8|r[i+1])+(r[i+2]<<4)&65535},n.saved=0,n.F._writeBlock=function(r,i,o,a,c,h,l,u,d){var f,y,I,L,C,R,O,v,x,b=n.F.U,B=n.F._putsF,m=n.F._putsE;b.lhst[256]++,y=(f=n.F.getTrees())[0],I=f[1],L=f[2],C=f[3],R=f[4],O=f[5],v=f[6],x=f[7];var g=32+(d+3&7?8-(d+3&7):0)+(l<<3),A=a+n.F.contSize(b.fltree,b.lhst)+n.F.contSize(b.fdtree,b.dhst),N=a+n.F.contSize(b.ltree,b.lhst)+n.F.contSize(b.dtree,b.dhst);N+=14+3*O+n.F.contSize(b.itree,b.ihst)+(2*b.ihst[16]+3*b.ihst[17]+7*b.ihst[18]);for(var k=0;k<286;k++)b.lhst[k]=0;for(k=0;k<30;k++)b.dhst[k]=0;for(k=0;k<19;k++)b.ihst[k]=0;var T=g<A&&g<N?0:A<N?1:2;if(B(u,d,r),B(u,d+1,T),d+=3,T==0){for(;7&d;)d++;d=n.F._copyExact(c,h,l,u,d)}else{var E,U;if(T==1&&(E=b.fltree,U=b.fdtree),T==2){n.F.makeCodes(b.ltree,y),n.F.revCodes(b.ltree,y),n.F.makeCodes(b.dtree,I),n.F.revCodes(b.dtree,I),n.F.makeCodes(b.itree,L),n.F.revCodes(b.itree,L),E=b.ltree,U=b.dtree,m(u,d,C-257),m(u,d+=5,R-1),m(u,d+=5,O-4),d+=4;for(var w=0;w<O;w++)m(u,d+3*w,b.itree[1+(b.ordr[w]<<1)]);d+=3*O,d=n.F._codeTiny(v,b.itree,u,d),d=n.F._codeTiny(x,b.itree,u,d)}for(var p=h,M=0;M<o;M+=2){for(var _=i[M],V=_>>>23,q=p+(8388607&_);p<q;)d=n.F._writeLit(c[p++],E,u,d);if(V!=0){var W=i[M+1],Z=W>>16,H=W>>8&255,S=255&W;m(u,d=n.F._writeLit(257+H,E,u,d),V-b.of0[H]),d+=b.exb[H],B(u,d=n.F._writeLit(S,U,u,d),Z-b.df0[S]),d+=b.dxb[S],p+=V}}d=n.F._writeLit(256,E,u,d)}return d},n.F._copyExact=function(r,i,o,a,c){var h=c>>>3;return a[h]=o,a[h+1]=o>>>8,a[h+2]=255-a[h],a[h+3]=255-a[h+1],h+=4,a.set(new Uint8Array(r.buffer,i,o),h),c+(o+4<<3)},n.F.getTrees=function(){for(var r=n.F.U,i=n.F._hufTree(r.lhst,r.ltree,15),o=n.F._hufTree(r.dhst,r.dtree,15),a=[],c=n.F._lenCodes(r.ltree,a),h=[],l=n.F._lenCodes(r.dtree,h),u=0;u<a.length;u+=2)r.ihst[a[u]]++;for(u=0;u<h.length;u+=2)r.ihst[h[u]]++;for(var d=n.F._hufTree(r.ihst,r.itree,7),f=19;f>4&&r.itree[1+(r.ordr[f-1]<<1)]==0;)f--;return[i,o,d,c,l,f,a,h]},n.F.getSecond=function(r){for(var i=[],o=0;o<r.length;o+=2)i.push(r[o+1]);return i},n.F.nonZero=function(r){for(var i="",o=0;o<r.length;o+=2)r[o+1]!=0&&(i+=(o>>1)+",");return i},n.F.contSize=function(r,i){for(var o=0,a=0;a<i.length;a++)o+=i[a]*r[1+(a<<1)];return o},n.F._codeTiny=function(r,i,o,a){for(var c=0;c<r.length;c+=2){var h=r[c],l=r[c+1];a=n.F._writeLit(h,i,o,a);var u=h==16?2:h==17?3:7;h>15&&(n.F._putsE(o,a,l,u),a+=u)}return a},n.F._lenCodes=function(r,i){for(var o=r.length;o!=2&&r[o-1]==0;)o-=2;for(var a=0;a<o;a+=2){var c=r[a+1],h=a+3<o?r[a+3]:-1,l=a+5<o?r[a+5]:-1,u=a==0?-1:r[a-1];if(c==0&&h==c&&l==c){for(var d=a+5;d+2<o&&r[d+2]==c;)d+=2;(f=Math.min(d+1-a>>>1,138))<11?i.push(17,f-3):i.push(18,f-11),a+=2*f-2}else if(c==u&&h==c&&l==c){for(d=a+5;d+2<o&&r[d+2]==c;)d+=2;var f=Math.min(d+1-a>>>1,6);i.push(16,f-3),a+=2*f-2}else i.push(c,0)}return o>>>1},n.F._hufTree=function(r,i,o){var a=[],c=r.length,h=i.length,l=0;for(l=0;l<h;l+=2)i[l]=0,i[l+1]=0;for(l=0;l<c;l++)r[l]!=0&&a.push({lit:l,f:r[l]});var u=a.length,d=a.slice(0);if(u==0)return 0;if(u==1){var f=a[0].lit;return d=f==0?1:0,i[1+(f<<1)]=1,i[1+(d<<1)]=1,1}a.sort(function(v,x){return v.f-x.f});var y=a[0],I=a[1],L=0,C=1,R=2;for(a[0]={lit:-1,f:y.f+I.f,l:y,r:I,d:0};C!=u-1;)y=L!=C&&(R==u||a[L].f<a[R].f)?a[L++]:a[R++],I=L!=C&&(R==u||a[L].f<a[R].f)?a[L++]:a[R++],a[C++]={lit:-1,f:y.f+I.f,l:y,r:I};var O=n.F.setDepth(a[C-1],0);for(O>o&&(n.F.restrictDepth(d,o,O),O=o),l=0;l<u;l++)i[1+(d[l].lit<<1)]=d[l].d;return O},n.F.setDepth=function(r,i){return r.lit!=-1?(r.d=i,i):Math.max(n.F.setDepth(r.l,i+1),n.F.setDepth(r.r,i+1))},n.F.restrictDepth=function(r,i,o){var a=0,c=1<<o-i,h=0;for(r.sort(function(u,d){return d.d==u.d?u.f-d.f:d.d-u.d}),a=0;a<r.length&&r[a].d>i;a++){var l=r[a].d;r[a].d=i,h+=c-(1<<o-l)}for(h>>>=o-i;h>0;)(l=r[a].d)<i?(r[a].d++,h-=1<<i-l-1):a++;for(;a>=0;a--)r[a].d==i&&h<0&&(r[a].d--,h++);h!=0&&console.log("debt left")},n.F._goodIndex=function(r,i){var o=0;return i[16|o]<=r&&(o|=16),i[8|o]<=r&&(o|=8),i[4|o]<=r&&(o|=4),i[2|o]<=r&&(o|=2),i[1|o]<=r&&(o|=1),o},n.F._writeLit=function(r,i,o,a){return n.F._putsF(o,a,i[r<<1]),a+i[1+(r<<1)]},n.F.inflate=function(r,i){var o=Uint8Array;if(r[0]==3&&r[1]==0)return i||new o(0);var a=n.F,c=a._bitsF,h=a._bitsE,l=a._decodeTiny,u=a.makeCodes,d=a.codes2map,f=a._get17,y=a.U,I=i==null;I&&(i=new o(r.length>>>2<<3));for(var L,C,R=0,O=0,v=0,x=0,b=0,B=0,m=0,g=0,A=0;R==0;)if(R=c(r,A,1),O=c(r,A+1,2),A+=3,O!=0){if(I&&(i=n.F._check(i,g+(1<<17))),O==1&&(L=y.flmap,C=y.fdmap,B=511,m=31),O==2){v=h(r,A,5)+257,x=h(r,A+5,5)+1,b=h(r,A+10,4)+4,A+=14;for(var N=0;N<38;N+=2)y.itree[N]=0,y.itree[N+1]=0;var k=1;for(N=0;N<b;N++){var T=h(r,A+3*N,3);y.itree[1+(y.ordr[N]<<1)]=T,T>k&&(k=T)}A+=3*b,u(y.itree,k),d(y.itree,k,y.imap),L=y.lmap,C=y.dmap,A=l(y.imap,(1<<k)-1,v+x,r,A,y.ttree);var E=a._copyOut(y.ttree,0,v,y.ltree);B=(1<<E)-1;var U=a._copyOut(y.ttree,v,x,y.dtree);m=(1<<U)-1,u(y.ltree,E),d(y.ltree,E,L),u(y.dtree,U),d(y.dtree,U,C)}for(;;){var w=L[f(r,A)&B];A+=15&w;var p=w>>>4;if(!(p>>>8))i[g++]=p;else{if(p==256)break;var M=g+p-254;if(p>264){var _=y.ldef[p-257];M=g+(_>>>3)+h(r,A,7&_),A+=7&_}var V=C[f(r,A)&m];A+=15&V;var q=V>>>4,W=y.ddef[q],Z=(W>>>4)+c(r,A,15&W);for(A+=15&W,I&&(i=n.F._check(i,g+(1<<17)));g<M;)i[g]=i[g++-Z],i[g]=i[g++-Z],i[g]=i[g++-Z],i[g]=i[g++-Z];g=M}}}else{7&A&&(A+=8-(7&A));var H=4+(A>>>3),S=r[H-4]|r[H-3]<<8;I&&(i=n.F._check(i,g+S)),i.set(new o(r.buffer,r.byteOffset+H,S),g),A=H+S<<3,g+=S}return i.length==g?i:i.slice(0,g)},n.F._check=function(r,i){var o=r.length;if(i<=o)return r;var a=new Uint8Array(Math.max(o<<1,i));return a.set(r,0),a},n.F._decodeTiny=function(r,i,o,a,c,h){for(var l=n.F._bitsE,u=n.F._get17,d=0;d<o;){var f=r[u(a,c)&i];c+=15&f;var y=f>>>4;if(y<=15)h[d]=y,d++;else{var I=0,L=0;y==16?(L=3+l(a,c,2),c+=2,I=h[d-1]):y==17?(L=3+l(a,c,3),c+=3):y==18&&(L=11+l(a,c,7),c+=7);for(var C=d+L;d<C;)h[d]=I,d++}}return c},n.F._copyOut=function(r,i,o,a){for(var c=0,h=0,l=a.length>>>1;h<o;){var u=r[h+i];a[h<<1]=0,a[1+(h<<1)]=u,u>c&&(c=u),h++}for(;h<l;)a[h<<1]=0,a[1+(h<<1)]=0,h++;return c},n.F.makeCodes=function(r,i){for(var o,a,c,h,l=n.F.U,u=r.length,d=l.bl_count,f=0;f<=i;f++)d[f]=0;for(f=1;f<u;f+=2)d[r[f]]++;var y=l.next_code;for(o=0,d[0]=0,a=1;a<=i;a++)o=o+d[a-1]<<1,y[a]=o;for(c=0;c<u;c+=2)(h=r[c+1])!=0&&(r[c]=y[h],y[h]++)},n.F.codes2map=function(r,i,o){for(var a=r.length,c=n.F.U.rev15,h=0;h<a;h+=2)if(r[h+1]!=0)for(var l=h>>1,u=r[h+1],d=l<<4|u,f=i-u,y=r[h]<<f,I=y+(1<<f);y!=I;)o[c[y]>>>15-i]=d,y++},n.F.revCodes=function(r,i){for(var o=n.F.U.rev15,a=15-i,c=0;c<r.length;c+=2){var h=r[c]<<i-r[c+1];r[c]=o[h]>>>a}},n.F._putsE=function(r,i,o){o<<=7&i;var a=i>>>3;r[a]|=o,r[a+1]|=o>>>8},n.F._putsF=function(r,i,o){o<<=7&i;var a=i>>>3;r[a]|=o,r[a+1]|=o>>>8,r[a+2]|=o>>>16},n.F._bitsE=function(r,i,o){return(r[i>>>3]|r[1+(i>>>3)]<<8)>>>(7&i)&(1<<o)-1},n.F._bitsF=function(r,i,o){return(r[i>>>3]|r[1+(i>>>3)]<<8|r[2+(i>>>3)]<<16)>>>(7&i)&(1<<o)-1},n.F._get17=function(r,i){return(r[i>>>3]|r[1+(i>>>3)]<<8|r[2+(i>>>3)]<<16)>>>(7&i)},n.F._get25=function(r,i){return(r[i>>>3]|r[1+(i>>>3)]<<8|r[2+(i>>>3)]<<16|r[3+(i>>>3)]<<24)>>>(7&i)},n.F.U=(e=Uint16Array,t=Uint32Array,{next_code:new e(16),bl_count:new e(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new e(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new t(32),flmap:new e(512),fltree:[],fdmap:new e(32),fdtree:[],lmap:new e(32768),ltree:[],ttree:[],dmap:new e(32768),dtree:[],imap:new e(512),itree:[],rev15:new e(32768),lhst:new t(286),dhst:new t(30),ihst:new t(19),lits:new t(15e3),strt:new e(65536),prev:new e(32768)}),function(){for(var r=n.F.U,i=0;i<32768;i++){var o=i;o=(4278255360&(o=(4042322160&(o=(3435973836&(o=(2863311530&o)>>>1|(1431655765&o)<<1))>>>2|(858993459&o)<<2))>>>4|(252645135&o)<<4))>>>8|(16711935&o)<<8,r.rev15[i]=(o>>>16|o<<16)>>>17}function a(c,h,l){for(;h--!=0;)c.push(0,l)}for(i=0;i<32;i++)r.ldef[i]=r.of0[i]<<3|r.exb[i],r.ddef[i]=r.df0[i]<<4|r.dxb[i];a(r.fltree,144,8),a(r.fltree,112,9),a(r.fltree,24,7),a(r.fltree,8,8),n.F.makeCodes(r.fltree,9),n.F.codes2map(r.fltree,9,r.flmap),n.F.revCodes(r.fltree,9),a(r.fdtree,32,5),n.F.makeCodes(r.fdtree,5),n.F.codes2map(r.fdtree,5,r.fdmap),n.F.revCodes(r.fdtree,5),a(r.itree,19,0),a(r.ltree,286,0),a(r.dtree,30,0),a(r.ttree,320,0)}()})();var Ts=Ns({__proto__:null,default:gn},[gn]);const Ye=function(){var s={nextZero(l,u){for(;l[u]!=0;)u++;return u},readUshort:(l,u)=>l[u]<<8|l[u+1],writeUshort(l,u,d){l[u]=d>>8&255,l[u+1]=255&d},readUint:(l,u)=>16777216*l[u]+(l[u+1]<<16|l[u+2]<<8|l[u+3]),writeUint(l,u,d){l[u]=d>>24&255,l[u+1]=d>>16&255,l[u+2]=d>>8&255,l[u+3]=255&d},readASCII(l,u,d){let f="";for(let y=0;y<d;y++)f+=String.fromCharCode(l[u+y]);return f},writeASCII(l,u,d){for(let f=0;f<d.length;f++)l[u+f]=d.charCodeAt(f)},readBytes(l,u,d){const f=[];for(let y=0;y<d;y++)f.push(l[u+y]);return f},pad:l=>l.length<2?`0${l}`:l,readUTF8(l,u,d){let f,y="";for(let I=0;I<d;I++)y+=`%${s.pad(l[u+I].toString(16))}`;try{f=decodeURIComponent(y)}catch{return s.readASCII(l,u,d)}return f}};function e(l,u,d,f){const y=u*d,I=i(f),L=Math.ceil(u*I/8),C=new Uint8Array(4*y),R=new Uint32Array(C.buffer),{ctype:O}=f,{depth:v}=f,x=s.readUshort;if(O==6){const _=y<<2;if(v==8)for(var b=0;b<_;b+=4)C[b]=l[b],C[b+1]=l[b+1],C[b+2]=l[b+2],C[b+3]=l[b+3];if(v==16)for(b=0;b<_;b++)C[b]=l[b<<1]}else if(O==2){const _=f.tabs.tRNS;if(_==null){if(v==8)for(b=0;b<y;b++){var B=3*b;R[b]=255<<24|l[B+2]<<16|l[B+1]<<8|l[B]}if(v==16)for(b=0;b<y;b++)B=6*b,R[b]=255<<24|l[B+4]<<16|l[B+2]<<8|l[B]}else{var m=_[0];const V=_[1],q=_[2];if(v==8)for(b=0;b<y;b++){var g=b<<2;B=3*b,R[b]=255<<24|l[B+2]<<16|l[B+1]<<8|l[B],l[B]==m&&l[B+1]==V&&l[B+2]==q&&(C[g+3]=0)}if(v==16)for(b=0;b<y;b++)g=b<<2,B=6*b,R[b]=255<<24|l[B+4]<<16|l[B+2]<<8|l[B],x(l,B)==m&&x(l,B+2)==V&&x(l,B+4)==q&&(C[g+3]=0)}}else if(O==3){const _=f.tabs.PLTE,V=f.tabs.tRNS,q=V?V.length:0;if(v==1)for(var A=0;A<d;A++){var N=A*L,k=A*u;for(b=0;b<u;b++){g=k+b<<2;var T=3*(E=l[N+(b>>3)]>>7-((7&b)<<0)&1);C[g]=_[T],C[g+1]=_[T+1],C[g+2]=_[T+2],C[g+3]=E<q?V[E]:255}}if(v==2)for(A=0;A<d;A++)for(N=A*L,k=A*u,b=0;b<u;b++)g=k+b<<2,T=3*(E=l[N+(b>>2)]>>6-((3&b)<<1)&3),C[g]=_[T],C[g+1]=_[T+1],C[g+2]=_[T+2],C[g+3]=E<q?V[E]:255;if(v==4)for(A=0;A<d;A++)for(N=A*L,k=A*u,b=0;b<u;b++)g=k+b<<2,T=3*(E=l[N+(b>>1)]>>4-((1&b)<<2)&15),C[g]=_[T],C[g+1]=_[T+1],C[g+2]=_[T+2],C[g+3]=E<q?V[E]:255;if(v==8)for(b=0;b<y;b++){var E;g=b<<2,T=3*(E=l[b]),C[g]=_[T],C[g+1]=_[T+1],C[g+2]=_[T+2],C[g+3]=E<q?V[E]:255}}else if(O==4){if(v==8)for(b=0;b<y;b++){g=b<<2;var U=l[w=b<<1];C[g]=U,C[g+1]=U,C[g+2]=U,C[g+3]=l[w+1]}if(v==16)for(b=0;b<y;b++){var w;g=b<<2,U=l[w=b<<2],C[g]=U,C[g+1]=U,C[g+2]=U,C[g+3]=l[w+2]}}else if(O==0)for(m=f.tabs.tRNS?f.tabs.tRNS:-1,A=0;A<d;A++){const _=A*L,V=A*u;if(v==1)for(var p=0;p<u;p++){var M=(U=255*(l[_+(p>>>3)]>>>7-(7&p)&1))==255*m?0:255;R[V+p]=M<<24|U<<16|U<<8|U}else if(v==2)for(p=0;p<u;p++)M=(U=85*(l[_+(p>>>2)]>>>6-((3&p)<<1)&3))==85*m?0:255,R[V+p]=M<<24|U<<16|U<<8|U;else if(v==4)for(p=0;p<u;p++)M=(U=17*(l[_+(p>>>1)]>>>4-((1&p)<<2)&15))==17*m?0:255,R[V+p]=M<<24|U<<16|U<<8|U;else if(v==8)for(p=0;p<u;p++)M=(U=l[_+p])==m?0:255,R[V+p]=M<<24|U<<16|U<<8|U;else if(v==16)for(p=0;p<u;p++)U=l[_+(p<<1)],M=x(l,_+(p<<1))==m?0:255,R[V+p]=M<<24|U<<16|U<<8|U}return C}function t(l,u,d,f){const y=i(l),I=Math.ceil(d*y/8),L=new Uint8Array((I+1+l.interlace)*f);return u=l.tabs.CgBI?r(u,L):n(u,L),l.interlace==0?u=o(u,l,0,d,f):l.interlace==1&&(u=function(R,O){const v=O.width,x=O.height,b=i(O),B=b>>3,m=Math.ceil(v*b/8),g=new Uint8Array(x*m);let A=0;const N=[0,0,4,0,2,0,1],k=[0,4,0,2,0,1,0],T=[8,8,8,4,4,2,2],E=[8,8,4,4,2,2,1];let U=0;for(;U<7;){const p=T[U],M=E[U];let _=0,V=0,q=N[U];for(;q<x;)q+=p,V++;let W=k[U];for(;W<v;)W+=M,_++;const Z=Math.ceil(_*b/8);o(R,O,A,_,V);let H=0,S=N[U];for(;S<x;){let z=k[U],ce=A+H*Z<<3;for(;z<v;){var w;if(b==1&&(w=(w=R[ce>>3])>>7-(7&ce)&1,g[S*m+(z>>3)]|=w<<7-((7&z)<<0)),b==2&&(w=(w=R[ce>>3])>>6-(7&ce)&3,g[S*m+(z>>2)]|=w<<6-((3&z)<<1)),b==4&&(w=(w=R[ce>>3])>>4-(7&ce)&15,g[S*m+(z>>1)]|=w<<4-((1&z)<<2)),b>=8){const te=S*m+z*B;for(let Q=0;Q<B;Q++)g[te+Q]=R[(ce>>3)+Q]}ce+=b,z+=M}H++,S+=p}_*V!=0&&(A+=V*(1+Z)),U+=1}return g}(u,l)),u}function n(l,u){return r(new Uint8Array(l.buffer,2,l.length-6),u)}var r=function(){const l={H:{}};return l.H.N=function(u,d){const f=Uint8Array;let y,I,L=0,C=0,R=0,O=0,v=0,x=0,b=0,B=0,m=0;if(u[0]==3&&u[1]==0)return d||new f(0);const g=l.H,A=g.b,N=g.e,k=g.R,T=g.n,E=g.A,U=g.Z,w=g.m,p=d==null;for(p&&(d=new f(u.length>>>2<<5));L==0;)if(L=A(u,m,1),C=A(u,m+1,2),m+=3,C!=0){if(p&&(d=l.H.W(d,B+(1<<17))),C==1&&(y=w.J,I=w.h,x=511,b=31),C==2){R=N(u,m,5)+257,O=N(u,m+5,5)+1,v=N(u,m+10,4)+4,m+=14;let _=1;for(var M=0;M<38;M+=2)w.Q[M]=0,w.Q[M+1]=0;for(M=0;M<v;M++){const W=N(u,m+3*M,3);w.Q[1+(w.X[M]<<1)]=W,W>_&&(_=W)}m+=3*v,T(w.Q,_),E(w.Q,_,w.u),y=w.w,I=w.d,m=k(w.u,(1<<_)-1,R+O,u,m,w.v);const V=g.V(w.v,0,R,w.C);x=(1<<V)-1;const q=g.V(w.v,R,O,w.D);b=(1<<q)-1,T(w.C,V),E(w.C,V,y),T(w.D,q),E(w.D,q,I)}for(;;){const _=y[U(u,m)&x];m+=15&_;const V=_>>>4;if(!(V>>>8))d[B++]=V;else{if(V==256)break;{let q=B+V-254;if(V>264){const z=w.q[V-257];q=B+(z>>>3)+N(u,m,7&z),m+=7&z}const W=I[U(u,m)&b];m+=15&W;const Z=W>>>4,H=w.c[Z],S=(H>>>4)+A(u,m,15&H);for(m+=15&H;B<q;)d[B]=d[B++-S],d[B]=d[B++-S],d[B]=d[B++-S],d[B]=d[B++-S];B=q}}}}else{7&m&&(m+=8-(7&m));const _=4+(m>>>3),V=u[_-4]|u[_-3]<<8;p&&(d=l.H.W(d,B+V)),d.set(new f(u.buffer,u.byteOffset+_,V),B),m=_+V<<3,B+=V}return d.length==B?d:d.slice(0,B)},l.H.W=function(u,d){const f=u.length;if(d<=f)return u;const y=new Uint8Array(f<<1);return y.set(u,0),y},l.H.R=function(u,d,f,y,I,L){const C=l.H.e,R=l.H.Z;let O=0;for(;O<f;){const v=u[R(y,I)&d];I+=15&v;const x=v>>>4;if(x<=15)L[O]=x,O++;else{let b=0,B=0;x==16?(B=3+C(y,I,2),I+=2,b=L[O-1]):x==17?(B=3+C(y,I,3),I+=3):x==18&&(B=11+C(y,I,7),I+=7);const m=O+B;for(;O<m;)L[O]=b,O++}}return I},l.H.V=function(u,d,f,y){let I=0,L=0;const C=y.length>>>1;for(;L<f;){const R=u[L+d];y[L<<1]=0,y[1+(L<<1)]=R,R>I&&(I=R),L++}for(;L<C;)y[L<<1]=0,y[1+(L<<1)]=0,L++;return I},l.H.n=function(u,d){const f=l.H.m,y=u.length;let I,L,C,R;const O=f.j;for(var v=0;v<=d;v++)O[v]=0;for(v=1;v<y;v+=2)O[u[v]]++;const x=f.K;for(I=0,O[0]=0,L=1;L<=d;L++)I=I+O[L-1]<<1,x[L]=I;for(C=0;C<y;C+=2)R=u[C+1],R!=0&&(u[C]=x[R],x[R]++)},l.H.A=function(u,d,f){const y=u.length,I=l.H.m.r;for(let L=0;L<y;L+=2)if(u[L+1]!=0){const C=L>>1,R=u[L+1],O=C<<4|R,v=d-R;let x=u[L]<<v;const b=x+(1<<v);for(;x!=b;)f[I[x]>>>15-d]=O,x++}},l.H.l=function(u,d){const f=l.H.m.r,y=15-d;for(let I=0;I<u.length;I+=2){const L=u[I]<<d-u[I+1];u[I]=f[L]>>>y}},l.H.M=function(u,d,f){f<<=7&d;const y=d>>>3;u[y]|=f,u[y+1]|=f>>>8},l.H.I=function(u,d,f){f<<=7&d;const y=d>>>3;u[y]|=f,u[y+1]|=f>>>8,u[y+2]|=f>>>16},l.H.e=function(u,d,f){return(u[d>>>3]|u[1+(d>>>3)]<<8)>>>(7&d)&(1<<f)-1},l.H.b=function(u,d,f){return(u[d>>>3]|u[1+(d>>>3)]<<8|u[2+(d>>>3)]<<16)>>>(7&d)&(1<<f)-1},l.H.Z=function(u,d){return(u[d>>>3]|u[1+(d>>>3)]<<8|u[2+(d>>>3)]<<16)>>>(7&d)},l.H.i=function(u,d){return(u[d>>>3]|u[1+(d>>>3)]<<8|u[2+(d>>>3)]<<16|u[3+(d>>>3)]<<24)>>>(7&d)},l.H.m=function(){const u=Uint16Array,d=Uint32Array;return{K:new u(16),j:new u(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new u(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new d(32),J:new u(512),_:[],h:new u(32),$:[],w:new u(32768),C:[],v:[],d:new u(32768),D:[],u:new u(512),Q:[],r:new u(32768),s:new d(286),Y:new d(30),a:new d(19),t:new d(15e3),k:new u(65536),g:new u(32768)}}(),function(){const u=l.H.m;for(var d=0;d<32768;d++){let y=d;y=(2863311530&y)>>>1|(1431655765&y)<<1,y=(3435973836&y)>>>2|(858993459&y)<<2,y=(4042322160&y)>>>4|(252645135&y)<<4,y=(4278255360&y)>>>8|(16711935&y)<<8,u.r[d]=(y>>>16|y<<16)>>>17}function f(y,I,L){for(;I--!=0;)y.push(0,L)}for(d=0;d<32;d++)u.q[d]=u.S[d]<<3|u.T[d],u.c[d]=u.p[d]<<4|u.z[d];f(u._,144,8),f(u._,112,9),f(u._,24,7),f(u._,8,8),l.H.n(u._,9),l.H.A(u._,9,u.J),l.H.l(u._,9),f(u.$,32,5),l.H.n(u.$,5),l.H.A(u.$,5,u.h),l.H.l(u.$,5),f(u.Q,19,0),f(u.C,286,0),f(u.D,30,0),f(u.v,320,0)}(),l.H.N}();function i(l){return[1,null,3,1,2,null,4][l.ctype]*l.depth}function o(l,u,d,f,y){let I=i(u);const L=Math.ceil(f*I/8);let C,R;I=Math.ceil(I/8);let O=l[d],v=0;if(O>1&&(l[d]=[0,0,1][O-2]),O==3)for(v=I;v<L;v++)l[v+1]=l[v+1]+(l[v+1-I]>>>1)&255;for(let x=0;x<y;x++)if(C=d+x*L,R=C+x+1,O=l[R-1],v=0,O==0)for(;v<L;v++)l[C+v]=l[R+v];else if(O==1){for(;v<I;v++)l[C+v]=l[R+v];for(;v<L;v++)l[C+v]=l[R+v]+l[C+v-I]}else if(O==2)for(;v<L;v++)l[C+v]=l[R+v]+l[C+v-L];else if(O==3){for(;v<I;v++)l[C+v]=l[R+v]+(l[C+v-L]>>>1);for(;v<L;v++)l[C+v]=l[R+v]+(l[C+v-L]+l[C+v-I]>>>1)}else{for(;v<I;v++)l[C+v]=l[R+v]+a(0,l[C+v-L],0);for(;v<L;v++)l[C+v]=l[R+v]+a(l[C+v-I],l[C+v-L],l[C+v-I-L])}return l}function a(l,u,d){const f=l+u-d,y=f-l,I=f-u,L=f-d;return y*y<=I*I&&y*y<=L*L?l:I*I<=L*L?u:d}function c(l,u,d){d.width=s.readUint(l,u),u+=4,d.height=s.readUint(l,u),u+=4,d.depth=l[u],u++,d.ctype=l[u],u++,d.compress=l[u],u++,d.filter=l[u],u++,d.interlace=l[u],u++}function h(l,u,d,f,y,I,L,C,R){const O=Math.min(u,y),v=Math.min(d,I);let x=0,b=0;for(let U=0;U<v;U++)for(let w=0;w<O;w++)if(L>=0&&C>=0?(x=U*u+w<<2,b=(C+U)*y+L+w<<2):(x=(-C+U)*u-L+w<<2,b=U*y+w<<2),R==0)f[b]=l[x],f[b+1]=l[x+1],f[b+2]=l[x+2],f[b+3]=l[x+3];else if(R==1){var B=l[x+3]*.00392156862745098,m=l[x]*B,g=l[x+1]*B,A=l[x+2]*B,N=f[b+3]*(1/255),k=f[b]*N,T=f[b+1]*N,E=f[b+2]*N;const p=1-B,M=B+N*p,_=M==0?0:1/M;f[b+3]=255*M,f[b+0]=(m+k*p)*_,f[b+1]=(g+T*p)*_,f[b+2]=(A+E*p)*_}else if(R==2)B=l[x+3],m=l[x],g=l[x+1],A=l[x+2],N=f[b+3],k=f[b],T=f[b+1],E=f[b+2],B==N&&m==k&&g==T&&A==E?(f[b]=0,f[b+1]=0,f[b+2]=0,f[b+3]=0):(f[b]=m,f[b+1]=g,f[b+2]=A,f[b+3]=B);else if(R==3){if(B=l[x+3],m=l[x],g=l[x+1],A=l[x+2],N=f[b+3],k=f[b],T=f[b+1],E=f[b+2],B==N&&m==k&&g==T&&A==E)continue;if(B<220&&N>20)return!1}return!0}return{decode:function(u){const d=new Uint8Array(u);let f=8;const y=s,I=y.readUshort,L=y.readUint,C={tabs:{},frames:[]},R=new Uint8Array(d.length);let O,v=0,x=0;const b=[137,80,78,71,13,10,26,10];for(var B=0;B<8;B++)if(d[B]!=b[B])throw"The input is not a PNG file!";for(;f<d.length;){const U=y.readUint(d,f);f+=4;const w=y.readASCII(d,f,4);if(f+=4,w=="IHDR")c(d,f,C);else if(w=="iCCP"){for(var m=f;d[m]!=0;)m++;y.readASCII(d,f,m-f),d[m+1];const p=d.slice(m+2,f+U);let M=null;try{M=n(p)}catch{M=r(p)}C.tabs[w]=M}else if(w=="CgBI")C.tabs[w]=d.slice(f,f+4);else if(w=="IDAT"){for(B=0;B<U;B++)R[v+B]=d[f+B];v+=U}else if(w=="acTL")C.tabs[w]={num_frames:L(d,f),num_plays:L(d,f+4)},O=new Uint8Array(d.length);else if(w=="fcTL"){x!=0&&((E=C.frames[C.frames.length-1]).data=t(C,O.slice(0,x),E.rect.width,E.rect.height),x=0);const p={x:L(d,f+12),y:L(d,f+16),width:L(d,f+4),height:L(d,f+8)};let M=I(d,f+22);M=I(d,f+20)/(M==0?100:M);const _={rect:p,delay:Math.round(1e3*M),dispose:d[f+24],blend:d[f+25]};C.frames.push(_)}else if(w=="fdAT"){for(B=0;B<U-4;B++)O[x+B]=d[f+B+4];x+=U-4}else if(w=="pHYs")C.tabs[w]=[y.readUint(d,f),y.readUint(d,f+4),d[f+8]];else if(w=="cHRM")for(C.tabs[w]=[],B=0;B<8;B++)C.tabs[w].push(y.readUint(d,f+4*B));else if(w=="tEXt"||w=="zTXt"){C.tabs[w]==null&&(C.tabs[w]={});var g=y.nextZero(d,f),A=y.readASCII(d,f,g-f),N=f+U-g-1;if(w=="tEXt")T=y.readASCII(d,g+1,N);else{var k=n(d.slice(g+2,g+2+N));T=y.readUTF8(k,0,k.length)}C.tabs[w][A]=T}else if(w=="iTXt"){C.tabs[w]==null&&(C.tabs[w]={}),g=0,m=f,g=y.nextZero(d,m),A=y.readASCII(d,m,g-m);const p=d[m=g+1];var T;d[m+1],m+=2,g=y.nextZero(d,m),y.readASCII(d,m,g-m),m=g+1,g=y.nextZero(d,m),y.readUTF8(d,m,g-m),N=U-((m=g+1)-f),p==0?T=y.readUTF8(d,m,N):(k=n(d.slice(m,m+N)),T=y.readUTF8(k,0,k.length)),C.tabs[w][A]=T}else if(w=="PLTE")C.tabs[w]=y.readBytes(d,f,U);else if(w=="hIST"){const p=C.tabs.PLTE.length/3;for(C.tabs[w]=[],B=0;B<p;B++)C.tabs[w].push(I(d,f+2*B))}else if(w=="tRNS")C.ctype==3?C.tabs[w]=y.readBytes(d,f,U):C.ctype==0?C.tabs[w]=I(d,f):C.ctype==2&&(C.tabs[w]=[I(d,f),I(d,f+2),I(d,f+4)]);else if(w=="gAMA")C.tabs[w]=y.readUint(d,f)/1e5;else if(w=="sRGB")C.tabs[w]=d[f];else if(w=="bKGD")C.ctype==0||C.ctype==4?C.tabs[w]=[I(d,f)]:C.ctype==2||C.ctype==6?C.tabs[w]=[I(d,f),I(d,f+2),I(d,f+4)]:C.ctype==3&&(C.tabs[w]=d[f]);else if(w=="IEND")break;f+=U,y.readUint(d,f),f+=4}var E;return x!=0&&((E=C.frames[C.frames.length-1]).data=t(C,O.slice(0,x),E.rect.width,E.rect.height)),C.data=t(C,R,C.width,C.height),delete C.compress,delete C.interlace,delete C.filter,C},toRGBA8:function(u){const d=u.width,f=u.height;if(u.tabs.acTL==null)return[e(u.data,d,f,u).buffer];const y=[];u.frames[0].data==null&&(u.frames[0].data=u.data);const I=d*f*4,L=new Uint8Array(I),C=new Uint8Array(I),R=new Uint8Array(I);for(let v=0;v<u.frames.length;v++){const x=u.frames[v],b=x.rect.x,B=x.rect.y,m=x.rect.width,g=x.rect.height,A=e(x.data,m,g,u);if(v!=0)for(var O=0;O<I;O++)R[O]=L[O];if(x.blend==0?h(A,m,g,L,d,f,b,B,0):x.blend==1&&h(A,m,g,L,d,f,b,B,1),y.push(L.buffer.slice(0)),x.dispose!=0){if(x.dispose==1)h(C,m,g,L,d,f,b,B,0);else if(x.dispose==2)for(O=0;O<I;O++)L[O]=R[O]}}return y},_paeth:a,_copyTile:h,_bin:s}}();(function(){const{_copyTile:s}=Ye,{_bin:e}=Ye,t=Ye._paeth;var n={table:function(){const m=new Uint32Array(256);for(let g=0;g<256;g++){let A=g;for(let N=0;N<8;N++)1&A?A=3988292384^A>>>1:A>>>=1;m[g]=A}return m}(),update(m,g,A,N){for(let k=0;k<N;k++)m=n.table[255&(m^g[A+k])]^m>>>8;return m},crc:(m,g,A)=>4294967295^n.update(4294967295,m,g,A)};function r(m,g,A,N){g[A]+=m[0]*N>>4,g[A+1]+=m[1]*N>>4,g[A+2]+=m[2]*N>>4,g[A+3]+=m[3]*N>>4}function i(m){return Math.max(0,Math.min(255,m))}function o(m,g){const A=m[0]-g[0],N=m[1]-g[1],k=m[2]-g[2],T=m[3]-g[3];return A*A+N*N+k*k+T*T}function a(m,g,A,N,k,T,E){E==null&&(E=1);const U=N.length,w=[];for(var p=0;p<U;p++){const S=N[p];w.push([S>>>0&255,S>>>8&255,S>>>16&255,S>>>24&255])}for(p=0;p<U;p++){let S=4294967295;for(var M=0,_=0;_<U;_++){var V=o(w[p],w[_]);_!=p&&V<S&&(S=V,M=_)}}const q=new Uint32Array(k.buffer),W=new Int16Array(g*A*4),Z=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(p=0;p<Z.length;p++)Z[p]=255*((Z[p]+.5)/16-.5);for(let S=0;S<A;S++)for(let z=0;z<g;z++){var H;p=4*(S*g+z),E!=2?H=[i(m[p]+W[p]),i(m[p+1]+W[p+1]),i(m[p+2]+W[p+2]),i(m[p+3]+W[p+3])]:(V=Z[4*(3&S)+(3&z)],H=[i(m[p]+V),i(m[p+1]+V),i(m[p+2]+V),i(m[p+3]+V)]),M=0;let ce=16777215;for(_=0;_<U;_++){const ae=o(H,w[_]);ae<ce&&(ce=ae,M=_)}const te=w[M],Q=[H[0]-te[0],H[1]-te[1],H[2]-te[2],H[3]-te[3]];E==1&&(z!=g-1&&r(Q,W,p+4,7),S!=A-1&&(z!=0&&r(Q,W,p+4*g-4,3),r(Q,W,p+4*g,5),z!=g-1&&r(Q,W,p+4*g+4,1))),T[p>>2]=M,q[p>>2]=N[M]}}function c(m,g,A,N,k){k==null&&(k={});const{crc:T}=n,E=e.writeUint,U=e.writeUshort,w=e.writeASCII;let p=8;const M=m.frames.length>1;let _,V=!1,q=33+(M?20:0);if(k.sRGB!=null&&(q+=13),k.pHYs!=null&&(q+=21),k.iCCP!=null&&(_=pako.deflate(k.iCCP),q+=21+_.length+4),m.ctype==3){for(var W=m.plte.length,Z=0;Z<W;Z++)m.plte[Z]>>>24!=255&&(V=!0);q+=8+3*W+4+(V?8+1*W+4:0)}for(var H=0;H<m.frames.length;H++)M&&(q+=38),q+=(te=m.frames[H]).cimg.length+12,H!=0&&(q+=4);q+=12;const S=new Uint8Array(q),z=[137,80,78,71,13,10,26,10];for(Z=0;Z<8;Z++)S[Z]=z[Z];if(E(S,p,13),p+=4,w(S,p,"IHDR"),p+=4,E(S,p,g),p+=4,E(S,p,A),p+=4,S[p]=m.depth,p++,S[p]=m.ctype,p++,S[p]=0,p++,S[p]=0,p++,S[p]=0,p++,E(S,p,T(S,p-17,17)),p+=4,k.sRGB!=null&&(E(S,p,1),p+=4,w(S,p,"sRGB"),p+=4,S[p]=k.sRGB,p++,E(S,p,T(S,p-5,5)),p+=4),k.iCCP!=null){const Q=13+_.length;E(S,p,Q),p+=4,w(S,p,"iCCP"),p+=4,w(S,p,"ICC profile"),p+=11,p+=2,S.set(_,p),p+=_.length,E(S,p,T(S,p-(Q+4),Q+4)),p+=4}if(k.pHYs!=null&&(E(S,p,9),p+=4,w(S,p,"pHYs"),p+=4,E(S,p,k.pHYs[0]),p+=4,E(S,p,k.pHYs[1]),p+=4,S[p]=k.pHYs[2],p++,E(S,p,T(S,p-13,13)),p+=4),M&&(E(S,p,8),p+=4,w(S,p,"acTL"),p+=4,E(S,p,m.frames.length),p+=4,E(S,p,k.loop!=null?k.loop:0),p+=4,E(S,p,T(S,p-12,12)),p+=4),m.ctype==3){for(E(S,p,3*(W=m.plte.length)),p+=4,w(S,p,"PLTE"),p+=4,Z=0;Z<W;Z++){const Q=3*Z,ae=m.plte[Z],me=255&ae,ke=ae>>>8&255,bt=ae>>>16&255;S[p+Q+0]=me,S[p+Q+1]=ke,S[p+Q+2]=bt}if(p+=3*W,E(S,p,T(S,p-3*W-4,3*W+4)),p+=4,V){for(E(S,p,W),p+=4,w(S,p,"tRNS"),p+=4,Z=0;Z<W;Z++)S[p+Z]=m.plte[Z]>>>24&255;p+=W,E(S,p,T(S,p-W-4,W+4)),p+=4}}let ce=0;for(H=0;H<m.frames.length;H++){var te=m.frames[H];M&&(E(S,p,26),p+=4,w(S,p,"fcTL"),p+=4,E(S,p,ce++),p+=4,E(S,p,te.rect.width),p+=4,E(S,p,te.rect.height),p+=4,E(S,p,te.rect.x),p+=4,E(S,p,te.rect.y),p+=4,U(S,p,N[H]),p+=2,U(S,p,1e3),p+=2,S[p]=te.dispose,p++,S[p]=te.blend,p++,E(S,p,T(S,p-30,30)),p+=4);const Q=te.cimg;E(S,p,(W=Q.length)+(H==0?0:4)),p+=4;const ae=p;w(S,p,H==0?"IDAT":"fdAT"),p+=4,H!=0&&(E(S,p,ce++),p+=4),S.set(Q,p),p+=W,E(S,p,T(S,ae,p-ae)),p+=4}return E(S,p,0),p+=4,w(S,p,"IEND"),p+=4,E(S,p,T(S,p-4,4)),p+=4,S.buffer}function h(m,g,A){for(let N=0;N<m.frames.length;N++){const k=m.frames[N];k.rect.width;const T=k.rect.height,E=new Uint8Array(T*k.bpl+T);k.cimg=f(k.img,T,k.bpp,k.bpl,E,g,A)}}function l(m,g,A,N,k){const T=k[0],E=k[1],U=k[2],w=k[3],p=k[4],M=k[5];let _=6,V=8,q=255;for(var W=0;W<m.length;W++){const Le=new Uint8Array(m[W]);for(var Z=Le.length,H=0;H<Z;H+=4)q&=Le[H+3]}const S=q!=255,z=function(de,re,ye,Te,be,Ue){const ge=[];for(var Y=0;Y<de.length;Y++){const Be=new Uint8Array(de[Y]),We=new Uint32Array(Be.buffer);var He;let Me=0,Ve=0,nt=re,ut=ye,qt=Te?1:0;if(Y!=0){const Fn=Ue||Te||Y==1||ge[Y-2].dispose!=0?1:2;let Kt=0,ue=1e9;for(let Xe=0;Xe<Fn;Xe++){var Re=new Uint8Array(de[Y-1-Xe]);const ft=new Uint32Array(de[Y-1-Xe]);let xt=re,_t=ye,zt=-1,rn=-1;for(let Dt=0;Dt<ye;Dt++)for(let Rt=0;Rt<re;Rt++)We[Ne=Dt*re+Rt]!=ft[Ne]&&(Rt<xt&&(xt=Rt),Rt>zt&&(zt=Rt),Dt<_t&&(_t=Dt),Dt>rn&&(rn=Dt));zt==-1&&(xt=_t=zt=rn=0),be&&((1&xt)==1&&xt--,(1&_t)==1&&_t--);const Zr=(zt-xt+1)*(rn-_t+1);Zr<ue&&(ue=Zr,Kt=Xe,Me=xt,Ve=_t,nt=zt-xt+1,ut=rn-_t+1)}Re=new Uint8Array(de[Y-1-Kt]),Kt==1&&(ge[Y-1].dispose=2),He=new Uint8Array(nt*ut*4),s(Re,re,ye,He,nt,ut,-Me,-Ve,0),qt=s(Be,re,ye,He,nt,ut,-Me,-Ve,3)?1:0,qt==1?d(Be,re,ye,He,{x:Me,y:Ve,width:nt,height:ut}):s(Be,re,ye,He,nt,ut,-Me,-Ve,0)}else He=Be.slice(0);ge.push({rect:{x:Me,y:Ve,width:nt,height:ut},img:He,blend:qt,dispose:0})}if(Te)for(Y=0;Y<ge.length;Y++){if((ht=ge[Y]).blend==1)continue;const Be=ht.rect,We=ge[Y-1].rect,Me=Math.min(Be.x,We.x),Ve=Math.min(Be.y,We.y),nt={x:Me,y:Ve,width:Math.max(Be.x+Be.width,We.x+We.width)-Me,height:Math.max(Be.y+Be.height,We.y+We.height)-Ve};ge[Y-1].dispose=1,Y-1!=0&&u(de,re,ye,ge,Y-1,nt,be),u(de,re,ye,ge,Y,nt,be)}let dt=0;if(de.length!=1)for(var Ne=0;Ne<ge.length;Ne++){var ht;dt+=(ht=ge[Ne]).rect.width*ht.rect.height}return ge}(m,g,A,T,E,U),ce={},te=[],Q=[];if(N!=0){const Le=[];for(H=0;H<z.length;H++)Le.push(z[H].img.buffer);const de=function(be){let Ue=0;for(var ge=0;ge<be.length;ge++)Ue+=be[ge].byteLength;const Y=new Uint8Array(Ue);let He=0;for(ge=0;ge<be.length;ge++){const Re=new Uint8Array(be[ge]),dt=Re.length;for(let Ne=0;Ne<dt;Ne+=4){let ht=Re[Ne],Be=Re[Ne+1],We=Re[Ne+2];const Me=Re[Ne+3];Me==0&&(ht=Be=We=0),Y[He+Ne]=ht,Y[He+Ne+1]=Be,Y[He+Ne+2]=We,Y[He+Ne+3]=Me}He+=dt}return Y.buffer}(Le),re=I(de,N);for(H=0;H<re.plte.length;H++)te.push(re.plte[H].est.rgba);let ye=0;for(H=0;H<z.length;H++){const Te=(me=z[H]).img.length;var ae=new Uint8Array(re.inds.buffer,ye>>2,Te>>2);Q.push(ae);const be=new Uint8Array(re.abuf,ye,Te);M&&a(me.img,me.rect.width,me.rect.height,te,be,ae),me.img.set(be),ye+=Te}}else for(W=0;W<z.length;W++){var me=z[W];const Le=new Uint32Array(me.img.buffer);var ke=me.rect.width;for(Z=Le.length,ae=new Uint8Array(Z),Q.push(ae),H=0;H<Z;H++){const de=Le[H];if(H!=0&&de==Le[H-1])ae[H]=ae[H-1];else if(H>ke&&de==Le[H-ke])ae[H]=ae[H-ke];else{let re=ce[de];if(re==null&&(ce[de]=re=te.length,te.push(de),te.length>=300))break;ae[H]=re}}}const bt=te.length;for(bt<=256&&p==0&&(V=bt<=2?1:bt<=4?2:bt<=16?4:8,V=Math.max(V,w)),W=0;W<z.length;W++){(me=z[W]).rect.x,me.rect.y,ke=me.rect.width;const Le=me.rect.height;let de=me.img;new Uint32Array(de.buffer);let re=4*ke,ye=4;if(bt<=256&&p==0){re=Math.ceil(V*ke/8);var ze=new Uint8Array(re*Le);const Te=Q[W];for(let be=0;be<Le;be++){H=be*re;const Ue=be*ke;if(V==8)for(var fe=0;fe<ke;fe++)ze[H+fe]=Te[Ue+fe];else if(V==4)for(fe=0;fe<ke;fe++)ze[H+(fe>>1)]|=Te[Ue+fe]<<4-4*(1&fe);else if(V==2)for(fe=0;fe<ke;fe++)ze[H+(fe>>2)]|=Te[Ue+fe]<<6-2*(3&fe);else if(V==1)for(fe=0;fe<ke;fe++)ze[H+(fe>>3)]|=Te[Ue+fe]<<7-1*(7&fe)}de=ze,_=3,ye=1}else if(S==0&&z.length==1){ze=new Uint8Array(ke*Le*3);const Te=ke*Le;for(H=0;H<Te;H++){const be=3*H,Ue=4*H;ze[be]=de[Ue],ze[be+1]=de[Ue+1],ze[be+2]=de[Ue+2]}de=ze,_=2,ye=3,re=3*ke}me.img=de,me.bpl=re,me.bpp=ye}return{ctype:_,depth:V,plte:te,frames:z}}function u(m,g,A,N,k,T,E){const U=Uint8Array,w=Uint32Array,p=new U(m[k-1]),M=new w(m[k-1]),_=k+1<m.length?new U(m[k+1]):null,V=new U(m[k]),q=new w(V.buffer);let W=g,Z=A,H=-1,S=-1;for(let ce=0;ce<T.height;ce++)for(let te=0;te<T.width;te++){const Q=T.x+te,ae=T.y+ce,me=ae*g+Q,ke=q[me];ke==0||N[k-1].dispose==0&&M[me]==ke&&(_==null||_[4*me+3]!=0)||(Q<W&&(W=Q),Q>H&&(H=Q),ae<Z&&(Z=ae),ae>S&&(S=ae))}H==-1&&(W=Z=H=S=0),E&&((1&W)==1&&W--,(1&Z)==1&&Z--),T={x:W,y:Z,width:H-W+1,height:S-Z+1};const z=N[k];z.rect=T,z.blend=1,z.img=new Uint8Array(T.width*T.height*4),N[k-1].dispose==0?(s(p,g,A,z.img,T.width,T.height,-T.x,-T.y,0),d(V,g,A,z.img,T)):s(V,g,A,z.img,T.width,T.height,-T.x,-T.y,0)}function d(m,g,A,N,k){s(m,g,A,N,k.width,k.height,-k.x,-k.y,2)}function f(m,g,A,N,k,T,E){const U=[];let w,p=[0,1,2,3,4];T!=-1?p=[T]:(g*N>5e5||A==1)&&(p=[0]),E&&(w={level:0});const M=Ts;for(var _=0;_<p.length;_++){for(let W=0;W<g;W++)y(k,m,W,N,A,p[_]);U.push(M.deflate(k,w))}let V,q=1e9;for(_=0;_<U.length;_++)U[_].length<q&&(V=_,q=U[_].length);return U[V]}function y(m,g,A,N,k,T){const E=A*N;let U=E+A;if(m[U]=T,U++,T==0)if(N<500)for(var w=0;w<N;w++)m[U+w]=g[E+w];else m.set(new Uint8Array(g.buffer,E,N),U);else if(T==1){for(w=0;w<k;w++)m[U+w]=g[E+w];for(w=k;w<N;w++)m[U+w]=g[E+w]-g[E+w-k]+256&255}else if(A==0){for(w=0;w<k;w++)m[U+w]=g[E+w];if(T==2)for(w=k;w<N;w++)m[U+w]=g[E+w];if(T==3)for(w=k;w<N;w++)m[U+w]=g[E+w]-(g[E+w-k]>>1)+256&255;if(T==4)for(w=k;w<N;w++)m[U+w]=g[E+w]-t(g[E+w-k],0,0)+256&255}else{if(T==2)for(w=0;w<N;w++)m[U+w]=g[E+w]+256-g[E+w-N]&255;if(T==3){for(w=0;w<k;w++)m[U+w]=g[E+w]+256-(g[E+w-N]>>1)&255;for(w=k;w<N;w++)m[U+w]=g[E+w]+256-(g[E+w-N]+g[E+w-k]>>1)&255}if(T==4){for(w=0;w<k;w++)m[U+w]=g[E+w]+256-t(0,g[E+w-N],0)&255;for(w=k;w<N;w++)m[U+w]=g[E+w]+256-t(g[E+w-k],g[E+w-N],g[E+w-k-N])&255}}}function I(m,g){const A=new Uint8Array(m),N=A.slice(0),k=new Uint32Array(N.buffer),T=L(N,g),E=T[0],U=T[1],w=A.length,p=new Uint8Array(w>>2);let M;if(A.length<2e7)for(var _=0;_<w;_+=4)M=C(E,V=A[_]*(1/255),q=A[_+1]*(1/255),W=A[_+2]*(1/255),Z=A[_+3]*(1/255)),p[_>>2]=M.ind,k[_>>2]=M.est.rgba;else for(_=0;_<w;_+=4){var V=A[_]*.00392156862745098,q=A[_+1]*(1/255),W=A[_+2]*(1/255),Z=A[_+3]*(1/255);for(M=E;M.left;)M=R(M.est,V,q,W,Z)<=0?M.left:M.right;p[_>>2]=M.ind,k[_>>2]=M.est.rgba}return{abuf:N.buffer,inds:p,plte:U}}function L(m,g,A){A==null&&(A=1e-4);const N=new Uint32Array(m.buffer),k={i0:0,i1:m.length,bst:null,est:null,tdst:0,left:null,right:null};k.bst=x(m,k.i0,k.i1),k.est=b(k.bst);const T=[k];for(;T.length<g;){let U=0,w=0;for(var E=0;E<T.length;E++)T[E].est.L>U&&(U=T[E].est.L,w=E);if(U<A)break;const p=T[w],M=O(m,N,p.i0,p.i1,p.est.e,p.est.eMq255);if(p.i0>=M||p.i1<=M){p.est.L=0;continue}const _={i0:p.i0,i1:M,bst:null,est:null,tdst:0,left:null,right:null};_.bst=x(m,_.i0,_.i1),_.est=b(_.bst);const V={i0:M,i1:p.i1,bst:null,est:null,tdst:0,left:null,right:null};for(V.bst={R:[],m:[],N:p.bst.N-_.bst.N},E=0;E<16;E++)V.bst.R[E]=p.bst.R[E]-_.bst.R[E];for(E=0;E<4;E++)V.bst.m[E]=p.bst.m[E]-_.bst.m[E];V.est=b(V.bst),p.left=_,p.right=V,T[w]=_,T.push(V)}for(T.sort((U,w)=>w.bst.N-U.bst.N),E=0;E<T.length;E++)T[E].ind=E;return[k,T]}function C(m,g,A,N,k){if(m.left==null)return m.tdst=function(_,V,q,W,Z){const H=V-_[0],S=q-_[1],z=W-_[2],ce=Z-_[3];return H*H+S*S+z*z+ce*ce}(m.est.q,g,A,N,k),m;const T=R(m.est,g,A,N,k);let E=m.left,U=m.right;T>0&&(E=m.right,U=m.left);const w=C(E,g,A,N,k);if(w.tdst<=T*T)return w;const p=C(U,g,A,N,k);return p.tdst<w.tdst?p:w}function R(m,g,A,N,k){const{e:T}=m;return T[0]*g+T[1]*A+T[2]*N+T[3]*k-m.eMq}function O(m,g,A,N,k,T){for(N-=4;A<N;){for(;v(m,A,k)<=T;)A+=4;for(;v(m,N,k)>T;)N-=4;if(A>=N)break;const E=g[A>>2];g[A>>2]=g[N>>2],g[N>>2]=E,A+=4,N-=4}for(;v(m,A,k)>T;)A-=4;return A+4}function v(m,g,A){return m[g]*A[0]+m[g+1]*A[1]+m[g+2]*A[2]+m[g+3]*A[3]}function x(m,g,A){const N=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],k=[0,0,0,0],T=A-g>>2;for(let E=g;E<A;E+=4){const U=m[E]*.00392156862745098,w=m[E+1]*(1/255),p=m[E+2]*(1/255),M=m[E+3]*(1/255);k[0]+=U,k[1]+=w,k[2]+=p,k[3]+=M,N[0]+=U*U,N[1]+=U*w,N[2]+=U*p,N[3]+=U*M,N[5]+=w*w,N[6]+=w*p,N[7]+=w*M,N[10]+=p*p,N[11]+=p*M,N[15]+=M*M}return N[4]=N[1],N[8]=N[2],N[9]=N[6],N[12]=N[3],N[13]=N[7],N[14]=N[11],{R:N,m:k,N:T}}function b(m){const{R:g}=m,{m:A}=m,{N}=m,k=A[0],T=A[1],E=A[2],U=A[3],w=N==0?0:1/N,p=[g[0]-k*k*w,g[1]-k*T*w,g[2]-k*E*w,g[3]-k*U*w,g[4]-T*k*w,g[5]-T*T*w,g[6]-T*E*w,g[7]-T*U*w,g[8]-E*k*w,g[9]-E*T*w,g[10]-E*E*w,g[11]-E*U*w,g[12]-U*k*w,g[13]-U*T*w,g[14]-U*E*w,g[15]-U*U*w],M=p,_=B;let V=[Math.random(),Math.random(),Math.random(),Math.random()],q=0,W=0;if(N!=0)for(let H=0;H<16&&(V=_.multVec(M,V),W=Math.sqrt(_.dot(V,V)),V=_.sml(1/W,V),!(H!=0&&Math.abs(W-q)<1e-9));H++)q=W;const Z=[k*w,T*w,E*w,U*w];return{Cov:p,q:Z,e:V,L:q,eMq255:_.dot(_.sml(255,Z),V),eMq:_.dot(V,Z),rgba:(Math.round(255*Z[3])<<24|Math.round(255*Z[2])<<16|Math.round(255*Z[1])<<8|Math.round(255*Z[0])<<0)>>>0}}var B={multVec:(m,g)=>[m[0]*g[0]+m[1]*g[1]+m[2]*g[2]+m[3]*g[3],m[4]*g[0]+m[5]*g[1]+m[6]*g[2]+m[7]*g[3],m[8]*g[0]+m[9]*g[1]+m[10]*g[2]+m[11]*g[3],m[12]*g[0]+m[13]*g[1]+m[14]*g[2]+m[15]*g[3]],dot:(m,g)=>m[0]*g[0]+m[1]*g[1]+m[2]*g[2]+m[3]*g[3],sml:(m,g)=>[m*g[0],m*g[1],m*g[2],m*g[3]]};Ye.encode=function(g,A,N,k,T,E,U){k==null&&(k=0),U==null&&(U=!1);const w=l(g,A,N,k,[!1,!1,!1,0,U,!1]);return h(w,-1),c(w,A,N,T,E)},Ye.encodeLL=function(g,A,N,k,T,E,U,w){const p={ctype:0+(k==1?0:2)+(T==0?0:4),depth:E,frames:[]},M=(k+T)*E,_=M*A;for(let V=0;V<g.length;V++)p.frames.push({rect:{x:0,y:0,width:A,height:N},img:new Uint8Array(g[V]),blend:0,dispose:1,bpp:Math.ceil(M/8),bpl:Math.ceil(_/8)});return h(p,0,!0),c(p,A,N,U,w)},Ye.encode.compress=l,Ye.encode.dither=a,Ye.quantize=I,Ye.quantize.getKDtree=L,Ye.quantize.getNearest=C})();const Ur={toArrayBuffer(s,e){const t=s.width,n=s.height,r=t<<2,i=s.getContext("2d").getImageData(0,0,t,n),o=new Uint32Array(i.data.buffer),a=(32*t+31)/32<<2,c=a*n,h=122+c,l=new ArrayBuffer(h),u=new DataView(l),d=1<<20;let f,y,I,L,C=d,R=0,O=0,v=0;function x(m){u.setUint16(O,m,!0),O+=2}function b(m){u.setUint32(O,m,!0),O+=4}function B(m){O+=m}x(19778),b(h),B(4),b(122),b(108),b(t),b(-n>>>0),x(1),x(32),b(3),b(c),b(2835),b(2835),B(8),b(16711680),b(65280),b(255),b(4278190080),b(1466527264),function m(){for(;R<n&&C>0;){for(L=122+R*a,f=0;f<r;)C--,y=o[v++],I=y>>>24,u.setUint32(L+f,y<<8|I),f+=4;R++}v<o.length?(C=d,setTimeout(m,Ur._dly)):e(l)}()},toBlob(s,e){this.toArrayBuffer(s,t=>{e(new Blob([t],{type:"image/bmp"}))})},_dly:9};var $e={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},xs={[$e.CHROME]:16384,[$e.FIREFOX]:11180,[$e.DESKTOP_SAFARI]:16384,[$e.IE]:8192,[$e.IOS]:4096,[$e.ETC]:8192};const Wn=typeof window<"u",Br=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,wn=Wn&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),_s=(Wn||Br)&&(wn&&wn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Or=(Wn||Br)&&(wn&&wn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Pn(s,e,t=Date.now()){return new Promise(n=>{const r=s.split(","),i=r[0].match(/:(.*?);/)[1],o=globalThis.atob(r[1]);let a=o.length;const c=new Uint8Array(a);for(;a--;)c[a]=o.charCodeAt(a);const h=new Blob([c],{type:i});h.name=e,h.lastModified=t,n(h)})}function Sr(s){return new Promise((e,t)=>{const n=new Or;n.onload=()=>e(n.result),n.onerror=r=>t(r),n.readAsDataURL(s)})}function Dr(s){return new Promise((e,t)=>{const n=new Image;n.onload=()=>e(n),n.onerror=r=>t(r),n.src=s})}function Bt(){if(Bt.cachedResult!==void 0)return Bt.cachedResult;let s=$e.ETC;const{userAgent:e}=navigator;return/Chrom(e|ium)/i.test(e)?s=$e.CHROME:/iP(ad|od|hone)/i.test(e)&&/WebKit/i.test(e)?s=$e.IOS:/Safari/i.test(e)?s=$e.DESKTOP_SAFARI:/Firefox/i.test(e)?s=$e.FIREFOX:(/MSIE/i.test(e)||document.documentMode)&&(s=$e.IE),Bt.cachedResult=s,Bt.cachedResult}function Rr(s,e){const t=Bt(),n=xs[t];let r=s,i=e,o=r*i;const a=r>i?i/r:r/i;for(;o>n*n;){const c=(n+r)/2,h=(n+i)/2;c<h?(i=h,r=h*a):(i=c*a,r=c),o=r*i}return{width:r,height:i}}function yn(s,e){let t,n;try{if(t=new OffscreenCanvas(s,e),n=t.getContext("2d"),n===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{t=document.createElement("canvas"),n=t.getContext("2d")}return t.width=s,t.height=e,[t,n]}function Mr(s,e){const{width:t,height:n}=Rr(s.width,s.height),[r,i]=yn(t,n);return e&&/jpe?g/.test(e)&&(i.fillStyle="white",i.fillRect(0,0,r.width,r.height)),i.drawImage(s,0,0,r.width,r.height),r}function bn(){return bn.cachedResult!==void 0||(bn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),bn.cachedResult}function Cn(s,e={}){return new Promise(function(t,n){let r,i;var o=function(){try{return i=Mr(r,e.fileType||s.type),t([r,i])}catch(c){return n(c)}},a=function(c){try{var h=function(l){try{throw l}catch(u){return n(u)}};try{let l;return Sr(s).then(function(u){try{return l=u,Dr(l).then(function(d){try{return r=d,function(){try{return o()}catch(f){return n(f)}}()}catch(f){return h(f)}},h)}catch(d){return h(d)}},h)}catch(l){h(l)}}catch(l){return n(l)}};try{if(bn()||[$e.DESKTOP_SAFARI,$e.MOBILE_SAFARI].includes(Bt()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(s).then(function(c){try{return r=c,o()}catch{return a()}},a)}catch{a()}})}function En(s,e,t,n,r=1){return new Promise(function(i,o){let a;if(e==="image/png"){let h,l,u;return h=s.getContext("2d"),{data:l}=h.getImageData(0,0,s.width,s.height),u=Ye.encode([l.buffer],s.width,s.height,4096*r),a=new Blob([u],{type:e}),a.name=t,a.lastModified=n,c.call(this)}{let h=function(){return c.call(this)};if(e==="image/bmp")return new Promise(l=>Ur.toBlob(s,l)).then((function(l){try{return a=l,a.name=t,a.lastModified=n,h.call(this)}catch(u){return o(u)}}).bind(this),o);{let l=function(){return h.call(this)};if(typeof OffscreenCanvas=="function"&&s instanceof OffscreenCanvas)return s.convertToBlob({type:e,quality:r}).then((function(u){try{return a=u,a.name=t,a.lastModified=n,l.call(this)}catch(d){return o(d)}}).bind(this),o);{let u;return u=s.toDataURL(e,r),Pn(u,t,n).then((function(d){try{return a=d,l.call(this)}catch(f){return o(f)}}).bind(this),o)}}}function c(){return i(a)}})}function st(s){s.width=0,s.height=0}function Vt(){return new Promise(function(s,e){let t,n,r,i;return Vt.cachedResult!==void 0?s(Vt.cachedResult):Pn("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then(function(o){try{return t=o,Cn(t).then(function(a){try{return n=a[1],En(n,t.type,t.name,t.lastModified).then(function(c){try{return r=c,st(n),Cn(r).then(function(h){try{return i=h[0],Vt.cachedResult=i.width===1&&i.height===2,s(Vt.cachedResult)}catch(l){return e(l)}},e)}catch(h){return e(h)}},e)}catch(c){return e(c)}},e)}catch(a){return e(a)}},e)})}function Vr(s){return new Promise((e,t)=>{const n=new Or;n.onload=r=>{const i=new DataView(r.target.result);if(i.getUint16(0,!1)!=65496)return e(-2);const o=i.byteLength;let a=2;for(;a<o;){if(i.getUint16(a+2,!1)<=8)return e(-1);const c=i.getUint16(a,!1);if(a+=2,c==65505){if(i.getUint32(a+=2,!1)!=1165519206)return e(-1);const h=i.getUint16(a+=6,!1)==18761;a+=i.getUint32(a+4,h);const l=i.getUint16(a,h);a+=2;for(let u=0;u<l;u++)if(i.getUint16(a+12*u,h)==274)return e(i.getUint16(a+12*u+8,h))}else{if((65280&c)!=65280)break;a+=i.getUint16(a,!1)}}return e(-1)},n.onerror=r=>t(r),n.readAsArrayBuffer(s)})}function Hr(s,e){const{width:t}=s,{height:n}=s,{maxWidthOrHeight:r}=e;let i,o=s;return isFinite(r)&&(t>r||n>r)&&([o,i]=yn(t,n),t>n?(o.width=r,o.height=n/t*r):(o.width=t/n*r,o.height=r),i.drawImage(s,0,0,o.width,o.height),st(s)),o}function $r(s,e){const{width:t}=s,{height:n}=s,[r,i]=yn(t,n);switch(e>4&&e<9?(r.width=n,r.height=t):(r.width=t,r.height=n),e){case 2:i.transform(-1,0,0,1,t,0);break;case 3:i.transform(-1,0,0,-1,t,n);break;case 4:i.transform(1,0,0,-1,0,n);break;case 5:i.transform(0,1,1,0,0,0);break;case 6:i.transform(0,1,-1,0,n,0);break;case 7:i.transform(0,-1,-1,0,n,t);break;case 8:i.transform(0,-1,1,0,0,t)}return i.drawImage(s,0,0,t,n),st(s),r}function Wr(s,e,t=0){return new Promise(function(n,r){let i,o,a,c,h,l,u,d,f,y,I,L,C,R,O,v,x,b,B,m;function g(N=5){if(e.signal&&e.signal.aborted)throw e.signal.reason;i+=N,e.onProgress(Math.min(i,100))}function A(N){if(e.signal&&e.signal.aborted)throw e.signal.reason;i=Math.min(Math.max(N,i),100),e.onProgress(i)}return i=t,o=e.maxIteration||10,a=1024*e.maxSizeMB*1024,g(),Cn(s,e).then((function(N){try{return[,c]=N,g(),h=Hr(c,e),g(),new Promise(function(k,T){var E;if(!(E=e.exifOrientation))return Vr(s).then((function(w){try{return E=w,U.call(this)}catch(p){return T(p)}}).bind(this),T);function U(){return k(E)}return U.call(this)}).then((function(k){try{return l=k,g(),Vt().then((function(T){try{return u=T?h:$r(h,l),g(),d=e.initialQuality||1,f=e.fileType||s.type,En(u,f,s.name,s.lastModified,d).then((function(E){try{{let w=function(){if(o--&&(O>a||O>C)){let M,_;return M=m?.95*B.width:B.width,_=m?.95*B.height:B.height,[x,b]=yn(M,_),b.drawImage(B,0,0,M,_),d*=f==="image/png"?.85:.95,En(x,f,s.name,s.lastModified,d).then(function(V){try{return v=V,st(B),B=x,O=v.size,A(Math.min(99,Math.floor((R-O)/(R-a)*100))),w}catch(q){return r(q)}},r)}return[1]},p=function(){return st(B),st(x),st(h),st(u),st(c),A(100),n(v)};if(y=E,g(),I=y.size>a,L=y.size>s.size,!I&&!L)return A(100),n(y);var U;return C=s.size,R=y.size,O=R,B=u,m=!e.alwaysKeepResolution&&I,(U=(function(M){for(;M;){if(M.then)return void M.then(U,r);try{if(M.pop){if(M.length)return M.pop()?p.call(this):M;M=w}else M=M.call(this)}catch(_){return r(_)}}}).bind(this))(w)}}catch(w){return r(w)}}).bind(this),r)}catch(E){return r(E)}}).bind(this),r)}catch(T){return r(T)}}).bind(this),r)}catch(k){return r(k)}}).bind(this),r)})}const Us=`
5
+ `)){if(t=="")continue;let[n,...r]=t.split(":");const i=r.join(":").trim();n=n.trim();let o=e[n];typeof o=="string"?e[n]=[o,i]:Array.isArray(o)?o.push(i):e[n]=i}return e}function _i(s){let e={};return s.forEach((t,n)=>{let r=e[n];typeof r=="string"?e[n]=[r,t]:Array.isArray(r)?r.push(t):e[n]=t}),e}function Ui(s){switch(s){case 200:return P.OK;case 400:return P.INVALID_ARGUMENT;case 401:return P.UNAUTHENTICATED;case 403:return P.PERMISSION_DENIED;case 404:return P.NOT_FOUND;case 409:return P.ABORTED;case 412:return P.FAILED_PRECONDITION;case 429:return P.RESOURCE_EXHAUSTED;case 499:return P.CANCELLED;case 500:return P.UNKNOWN;case 501:return P.UNIMPLEMENTED;case 503:return P.UNAVAILABLE;case 504:return P.DEADLINE_EXCEEDED;default:return P.UNKNOWN}}class Bi{constructor(e){this.defaultOptions=e}mergeOptions(e){return Ei(this.defaultOptions,e)}makeUrl(e,t){let n=t.baseUrl;return n.endsWith("/")&&(n=n.substring(0,n.length-1)),`${n}/${e.service.typeName}/${e.name}`}clientStreaming(e){const t=new se("Client streaming is not supported by grpc-web",P[P.UNIMPLEMENTED]);throw t.methodName=e.name,t.serviceName=e.service.typeName,t}duplex(e){const t=new se("Duplex streaming is not supported by grpc-web",P[P.UNIMPLEMENTED]);throw t.methodName=e.name,t.serviceName=e.service.typeName,t}serverStreaming(e,t,n){var r,i,o,a;let c=n,h=(r=c.format)!==null&&r!==void 0?r:"text",l=(i=c.fetchInit)!==null&&i!==void 0?i:{},u=this.makeUrl(e,c),d=e.I.toBinary(t,c.binaryOptions),f=new Ct,y=new Ai,I=!0,L,C=new Ct,R,O=new Ct;return globalThis.fetch(u,Object.assign(Object.assign({},l),{method:"POST",headers:or(new globalThis.Headers,h,c.timeout,c.meta),body:ar(d,h),signal:(o=n.abort)!==null&&o!==void 0?o:null})).then(v=>{let[x,b,B]=Un(v);if(f.resolve(B),x!=null&&x!==P.OK)throw new se(b??P[x],P[x],B);return x!=null&&(L={code:P[x],detail:b??P[x]}),v}).then(v=>{if(!v.body)throw new se("missing response body",P[P.INTERNAL]);return cr(v.body,v.headers.get("content-type"),(x,b)=>{switch(x){case Je.DATA:y.notifyMessage(e.O.fromBinary(b,c.binaryOptions)),I=!1;break;case Je.TRAILER:let B,m;[B,m,R]=lr(b),L={code:P[B],detail:m??P[B]};break}})}).then(()=>{if(!R&&!I)throw new se("missing trailers",P[P.DATA_LOSS]);if(!L)throw new se("missing status",P[P.INTERNAL]);if(L.code!=="OK")throw new se(L.detail,L.code,R);y.notifyComplete(),C.resolve(L),O.resolve(R||{})}).catch(v=>{let x;v instanceof se?x=v:v instanceof Error&&v.name==="AbortError"?x=new se(v.message,P[P.CANCELLED]):x=new se(v instanceof Error?v.message:""+v,P[P.INTERNAL]),x.methodName=e.name,x.serviceName=e.service.typeName,f.rejectPending(x),y.notifyError(x),C.rejectPending(x),O.rejectPending(x)}),new Ni(e,(a=c.meta)!==null&&a!==void 0?a:{},t,f.promise,y,C.promise,O.promise)}unary(e,t,n){var r,i,o,a;let c=n,h=(r=c.format)!==null&&r!==void 0?r:"text",l=(i=c.fetchInit)!==null&&i!==void 0?i:{},u=this.makeUrl(e,c),d=e.I.toBinary(t,c.binaryOptions),f=new Ct,y,I=new Ct,L,C=new Ct,R,O=new Ct;return globalThis.fetch(u,Object.assign(Object.assign({},l),{method:"POST",headers:or(new globalThis.Headers,h,c.timeout,c.meta),body:ar(d,h),signal:(o=n.abort)!==null&&o!==void 0?o:null})).then(v=>{let[x,b,B]=Un(v);if(f.resolve(B),x!=null&&x!==P.OK)throw new se(b??P[x],P[x],B);return x!=null&&(L={code:P[x],detail:b??P[x]}),v}).then(v=>{if(!v.body)throw new se("missing response body",P[P.INTERNAL]);return cr(v.body,v.headers.get("content-type"),(x,b)=>{switch(x){case Je.DATA:if(y)throw new se("unary call received 2nd message",P[P.DATA_LOSS]);y=e.O.fromBinary(b,c.binaryOptions);break;case Je.TRAILER:let B,m;[B,m,R]=lr(b),L={code:P[B],detail:m??P[B]};break}})}).then(()=>{if(!R&&y)throw new se("missing trailers",P[P.DATA_LOSS]);if(!L)throw new se("missing status",P[P.INTERNAL]);if(!y&&L.code==="OK")throw new se("expected error status",P[P.DATA_LOSS]);if(!y)throw new se(L.detail,L.code,R);if(I.resolve(y),L.code!=="OK")throw new se(L.detail,L.code,R);C.resolve(L),O.resolve(R||{})}).catch(v=>{let x;v instanceof se?x=v:v instanceof Error&&v.name==="AbortError"?x=new se(v.message,P[P.CANCELLED]):x=new se(v instanceof Error?v.message:""+v,P[P.INTERNAL]),x.methodName=e.name,x.serviceName=e.service.typeName,f.rejectPending(x),I.rejectPending(x),C.rejectPending(x),O.rejectPending(x)}),new ki(e,(a=c.meta)!==null&&a!==void 0?a:{},t,f.promise,I.promise,C.promise,O.promise)}}var un=(s=>(s[s.IMAGE=0]="IMAGE",s[s.AUDIO=1]="AUDIO",s[s.VIDEO=2]="VIDEO",s[s.ALL=3]="ALL",s[s.FOLDER=4]="FOLDER",s))(un||{});class Oi extends xe{constructor(){super("com.hamropatro.grpc.cms.SearchRequest",[{no:1,name:"search_value",kind:"scalar",T:9},{no:2,name:"cursor",kind:"scalar",T:9},{no:3,name:"limit",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.searchValue="",t.cursor="",t.limit=0,e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.searchValue=e.string();break;case 2:i.cursor=e.string();break;case 3:i.limit=e.int32();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.searchValue!==""&&t.tag(1,j.LengthDelimited).string(e.searchValue),e.cursor!==""&&t.tag(2,j.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(3,j.Varint).int32(e.limit);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const fr=new Oi;class Si extends xe{constructor(){super("com.hamropatro.grpc.cms.SearchResult",[{no:1,name:"items",kind:"message",repeat:1,T:()=>Qe},{no:2,name:"next_page_cursor",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.items=[],t.nextPageCursor="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.items.push(Qe.internalBinaryRead(e,e.uint32(),n));break;case 2:i.nextPageCursor=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){for(let i=0;i<e.items.length;i++)Qe.internalBinaryWrite(e.items[i],t.tag(1,j.LengthDelimited).fork(),n).join();e.nextPageCursor!==""&&t.tag(2,j.LengthDelimited).string(e.nextPageCursor);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Di=new Si;class Ri extends xe{constructor(){super("com.hamropatro.grpc.cms.CreateFileRequest",[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"folder_name",kind:"scalar",T:9},{no:3,name:"nested_folder_name",kind:"scalar",T:9},{no:4,name:"url",kind:"scalar",T:9},{no:5,name:"type",kind:"enum",T:()=>["com.hamropatro.grpc.cms.FileType",un]},{no:6,name:"extension",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.name="",t.folderName="",t.nestedFolderName="",t.url="",t.type=0,t.extension="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.name=e.string();break;case 2:i.folderName=e.string();break;case 3:i.nestedFolderName=e.string();break;case 4:i.url=e.string();break;case 5:i.type=e.int32();break;case 6:i.extension=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.name!==""&&t.tag(1,j.LengthDelimited).string(e.name),e.folderName!==""&&t.tag(2,j.LengthDelimited).string(e.folderName),e.nestedFolderName!==""&&t.tag(3,j.LengthDelimited).string(e.nestedFolderName),e.url!==""&&t.tag(4,j.LengthDelimited).string(e.url),e.type!==0&&t.tag(5,j.Varint).int32(e.type),e.extension!==""&&t.tag(6,j.LengthDelimited).string(e.extension);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const pr=new Ri;class Mi extends xe{constructor(){super("com.hamropatro.grpc.cms.CreateUserFileRequest",[{no:1,name:"url",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:()=>["com.hamropatro.grpc.cms.FileType",un]},{no:3,name:"extension",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.url="",t.type=0,t.extension="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.url=e.string();break;case 2:i.type=e.int32();break;case 3:i.extension=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.url!==""&&t.tag(1,j.LengthDelimited).string(e.url),e.type!==0&&t.tag(2,j.Varint).int32(e.type),e.extension!==""&&t.tag(3,j.LengthDelimited).string(e.extension);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const mr=new Mi;class Vi extends xe{constructor(){super("com.hamropatro.grpc.cms.File",[{no:1,name:"key",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"folder_name",kind:"scalar",T:9},{no:4,name:"nested_folder_name",kind:"scalar",T:9},{no:5,name:"url",kind:"scalar",T:9},{no:6,name:"thumbor_url",kind:"scalar",T:9},{no:7,name:"proxy_url",kind:"scalar",T:9},{no:8,name:"type",kind:"enum",T:()=>["com.hamropatro.grpc.cms.FileType",un]},{no:9,name:"metadata",kind:"message",T:()=>Bn}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",t.name="",t.folderName="",t.nestedFolderName="",t.url="",t.thumborUrl="",t.proxyUrl="",t.type=0,e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.key=e.string();break;case 2:i.name=e.string();break;case 3:i.folderName=e.string();break;case 4:i.nestedFolderName=e.string();break;case 5:i.url=e.string();break;case 6:i.thumborUrl=e.string();break;case 7:i.proxyUrl=e.string();break;case 8:i.type=e.int32();break;case 9:i.metadata=Bn.internalBinaryRead(e,e.uint32(),n,i.metadata);break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key),e.name!==""&&t.tag(2,j.LengthDelimited).string(e.name),e.folderName!==""&&t.tag(3,j.LengthDelimited).string(e.folderName),e.nestedFolderName!==""&&t.tag(4,j.LengthDelimited).string(e.nestedFolderName),e.url!==""&&t.tag(5,j.LengthDelimited).string(e.url),e.thumborUrl!==""&&t.tag(6,j.LengthDelimited).string(e.thumborUrl),e.proxyUrl!==""&&t.tag(7,j.LengthDelimited).string(e.proxyUrl),e.type!==0&&t.tag(8,j.Varint).int32(e.type),e.metadata&&Bn.internalBinaryWrite(e.metadata,t.tag(9,j.LengthDelimited).fork(),n).join();let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Qe=new Vi;class Hi extends xe{constructor(){super("com.hamropatro.grpc.cms.FileMetadata",[{no:1,name:"height",kind:"scalar",T:5},{no:2,name:"width",kind:"scalar",T:5},{no:3,name:"background_color",kind:"scalar",T:9},{no:4,name:"aspect_ratio",kind:"scalar",T:1}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.height=0,t.width=0,t.backgroundColor="",t.aspectRatio=0,e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.height=e.int32();break;case 2:i.width=e.int32();break;case 3:i.backgroundColor=e.string();break;case 4:i.aspectRatio=e.double();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.height!==0&&t.tag(1,j.Varint).int32(e.height),e.width!==0&&t.tag(2,j.Varint).int32(e.width),e.backgroundColor!==""&&t.tag(3,j.LengthDelimited).string(e.backgroundColor),e.aspectRatio!==0&&t.tag(4,j.Bit64).double(e.aspectRatio);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Bn=new Hi;class $i extends xe{constructor(){super("com.hamropatro.grpc.cms.DeleteFileRequest",[{no:1,name:"key",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.key=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const gr=new $i;class Wi extends xe{constructor(){super("com.hamropatro.grpc.cms.DeleteFileResponse",[{no:1,name:"is_deleted",kind:"scalar",T:8}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.isDeleted=!1,e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.isDeleted=e.bool();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.isDeleted!==!1&&t.tag(1,j.Varint).bool(e.isDeleted);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Pi=new Wi;class ji extends xe{constructor(){super("com.hamropatro.grpc.cms.GetFilesByFolderRequest",[{no:1,name:"folder_name",kind:"scalar",T:9},{no:2,name:"cursor",kind:"scalar",T:9},{no:3,name:"limit",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.folderName="",t.cursor="",t.limit=0,e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.folderName=e.string();break;case 2:i.cursor=e.string();break;case 3:i.limit=e.int32();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.folderName!==""&&t.tag(1,j.LengthDelimited).string(e.folderName),e.cursor!==""&&t.tag(2,j.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(3,j.Varint).int32(e.limit);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const wr=new ji;class Zi extends xe{constructor(){super("com.hamropatro.grpc.cms.GetFilesByFolderResponse",[{no:1,name:"files",kind:"message",repeat:1,T:()=>Qe},{no:2,name:"next_cursor",kind:"scalar",T:9},{no:3,name:"has_more",kind:"scalar",T:8}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.files=[],t.nextCursor="",t.hasMore=!1,e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.files.push(Qe.internalBinaryRead(e,e.uint32(),n));break;case 2:i.nextCursor=e.string();break;case 3:i.hasMore=e.bool();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){for(let i=0;i<e.files.length;i++)Qe.internalBinaryWrite(e.files[i],t.tag(1,j.LengthDelimited).fork(),n).join();e.nextCursor!==""&&t.tag(2,j.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,j.Varint).bool(e.hasMore);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const qi=new Zi,On=new _n("com.hamropatro.grpc.cms.FileService",[{name:"createFile",options:{},I:pr,O:Qe},{name:"updateFile",options:{},I:Qe,O:Qe},{name:"deleteFile",options:{},I:gr,O:Pi},{name:"getFilesByFolder",options:{},I:wr,O:qi},{name:"createUserFile",options:{},I:mr,O:Qe},{name:"search",options:{},I:fr,O:Di}]);class Mt{constructor(e){pe(this,"typeName",On.typeName);pe(this,"methods",On.methods);pe(this,"options",On.options);this._transport=e}createFile(e,t){const n=this.methods[0],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}updateFile(e,t){const n=this.methods[1],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}deleteFile(e,t){const n=this.methods[2],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}getFilesByFolder(e,t){const n=this.methods[3],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}createUserFile(e,t){const n=this.methods[4],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}search(e,t){const n=this.methods[5],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}}const Ki=async(s,e,t,n,r,i)=>{var o;try{const a=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,c=new Mt(a),h=pr.create();return h.name=s,h.nestedFolderName=e,h.url=t,h.type=n,h.folderName=r,await c.createFile(h,i)}catch(a){throw a}},zi=async(s,e,t)=>{var n;try{const r=(n=window.ImageSalonSDK)==null?void 0:n.grpcConfig,i=new Mt(r),o=mr.create();return o.url=s,o.type=e,await i.createUserFile(o,t)}catch(r){throw r}},Xi=async(s,e,t,n)=>{var r;try{const i=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=new Mt(i),a=wr.create();return a.folderName=s,a.cursor=e,a.limit=t,await o.getFilesByFolder(a,n)}catch(i){throw i}},Gi=async(s,e,t=20,n)=>{var r;try{const i=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=new Mt(i),a=fr.create();return a.searchValue=s,a.cursor=e,a.limit=t,await o.search(a,n)}catch(i){throw i}},Ji=async(s,e,t,n,r,i,o,a,c)=>{var h;try{const l=(h=window.ImageSalonSDK)==null?void 0:h.grpcConfig,u=new Mt(l),d=Qe.create();return d.key=s,d.name=e,d.nestedFolderName=t,d.url=n,d.thumborUrl=r,d.proxyUrl=i,d.type=o,d.folderName=a,await u.updateFile(d,c)}catch(l){throw l}},Qi=async(s,e)=>{var t;try{const n=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,r=new Mt(n),i=gr.create();return i.key=s,await r.deleteFile(i,e)}catch(n){throw n}};class Yi extends xe{constructor(){super("com.hamropatro.grpc.cms.DeleteFolderRequest",[{no:1,name:"key",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.key=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const yr=new Yi;class es extends xe{constructor(){super("com.hamropatro.grpc.cms.CreateFolderRequest",[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"nested_folder_name",kind:"scalar",T:9},{no:3,name:"created_by",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.name="",t.nestedFolderName="",t.createdBy="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.name=e.string();break;case 2:i.nestedFolderName=e.string();break;case 3:i.createdBy=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.name!==""&&t.tag(1,j.LengthDelimited).string(e.name),e.nestedFolderName!==""&&t.tag(2,j.LengthDelimited).string(e.nestedFolderName),e.createdBy!==""&&t.tag(3,j.LengthDelimited).string(e.createdBy);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const br=new es;class ts extends xe{constructor(){super("com.hamropatro.grpc.cms.GetAllFoldersRequest",[{no:1,name:"cursor",kind:"scalar",T:9},{no:2,name:"limit",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.cursor="",t.limit=0,e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.cursor=e.string();break;case 2:i.limit=e.int32();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.cursor!==""&&t.tag(1,j.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(2,j.Varint).int32(e.limit);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Cr=new ts;class ns extends xe{constructor(){super("com.hamropatro.grpc.cms.GetAllFoldersResponse",[{no:1,name:"folder",kind:"message",repeat:1,T:()=>Et},{no:2,name:"next_cursor",kind:"scalar",T:9},{no:3,name:"has_more",kind:"scalar",T:8}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.folder=[],t.nextCursor="",t.hasMore=!1,e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.folder.push(Et.internalBinaryRead(e,e.uint32(),n));break;case 2:i.nextCursor=e.string();break;case 3:i.hasMore=e.bool();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){for(let i=0;i<e.folder.length;i++)Et.internalBinaryWrite(e.folder[i],t.tag(1,j.LengthDelimited).fork(),n).join();e.nextCursor!==""&&t.tag(2,j.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,j.Varint).bool(e.hasMore);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const rs=new ns;class is extends xe{constructor(){super("com.hamropatro.grpc.cms.Folder",[{no:1,name:"key",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"nested_folder_name",kind:"scalar",T:9},{no:4,name:"created_by",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",t.name="",t.nestedFolderName="",t.createdBy="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.key=e.string();break;case 2:i.name=e.string();break;case 3:i.nestedFolderName=e.string();break;case 4:i.createdBy=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key),e.name!==""&&t.tag(2,j.LengthDelimited).string(e.name),e.nestedFolderName!==""&&t.tag(3,j.LengthDelimited).string(e.nestedFolderName),e.createdBy!==""&&t.tag(4,j.LengthDelimited).string(e.createdBy);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Et=new is,Sn=new _n("com.hamropatro.grpc.cms.FolderService",[{name:"createFolder",options:{},I:br,O:Et},{name:"getFolders",options:{},I:Cr,O:rs},{name:"updateFolder",options:{},I:Et,O:Et},{name:"deleteFolder",options:{},I:yr,O:Et}]);class fn{constructor(e){pe(this,"typeName",Sn.typeName);pe(this,"methods",Sn.methods);pe(this,"options",Sn.options);this._transport=e}createFolder(e,t){const n=this.methods[0],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}getFolders(e,t){const n=this.methods[1],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}updateFolder(e,t){const n=this.methods[2],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}deleteFolder(e,t){const n=this.methods[3],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}}const ss=async(s,e=20,t)=>{var o;const n=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,r=new fn(n),i=Cr.create();try{return i.cursor=s,i.limit=e,await r.getFolders(i,t)}catch(a){throw a}},os=async(s,e,t,n)=>{var r;try{const i=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=new fn(i),a=br.create();return a.name=s,a.nestedFolderName=e,a.createdBy=t,await o.createFolder(a,n)}catch(i){throw i}},as=async(s,e,t,n,r)=>{var i;try{const o=(i=window.ImageSalonSDK)==null?void 0:i.grpcConfig,a=new fn(o),c=Et.create();return c.name=e,c.key=s,c.nestedFolderName=t,c.createdBy=n,await a.updateFolder(c,r)}catch(o){throw o}},ls=async(s,e)=>{var t;try{const n=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,r=new fn(n),i=yr.create();return i.key=s,await r.deleteFolder(i,e)}catch(n){throw n}},Dn=(s,e,t)=>{const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.setAttribute("width",s||"20"),n.setAttribute("height",e||"20"),n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("fill","none"),n.setAttribute("stroke",t||"#ee3f3f"),n.setAttribute("stroke-width","2"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.classList.add("lucide","lucide-circle-alert");const r=document.createElementNS("http://www.w3.org/2000/svg","circle");r.setAttribute("cx","12"),r.setAttribute("cy","12"),r.setAttribute("r","10");const i=document.createElementNS("http://www.w3.org/2000/svg","line");i.setAttribute("x1","12"),i.setAttribute("x2","12"),i.setAttribute("y1","8"),i.setAttribute("y2","12");const o=document.createElementNS("http://www.w3.org/2000/svg","line");return o.setAttribute("x1","12"),o.setAttribute("x2","12.01"),o.setAttribute("y1","16"),o.setAttribute("y2","16"),n.appendChild(r),n.appendChild(i),n.appendChild(o),n};function Er(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("height","24px"),s.setAttribute("width","24px"),s.setAttribute("viewBox","0 -960 960 960"),s.setAttribute("fill","#333");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"),s.appendChild(e),s}function cs(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width","12"),s.setAttribute("height","12"),s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","none"),s.setAttribute("stroke","currentColor"),s.setAttribute("stroke-width","2"),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.classList.add("lucide","lucide-music-4");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M9 18V5l12-2v13");const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d","m9 9 12-2");const n=document.createElementNS("http://www.w3.org/2000/svg","circle");n.setAttribute("cx","6"),n.setAttribute("cy","18"),n.setAttribute("r","3");const r=document.createElementNS("http://www.w3.org/2000/svg","circle");return r.setAttribute("cx","18"),r.setAttribute("cy","16"),r.setAttribute("r","3"),s.appendChild(e),s.appendChild(t),s.appendChild(n),s.appendChild(r),document.body.appendChild(s),s}const Ar=s=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("width","20"),e.setAttribute("height","20"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke",s||"currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.classList.add("lucide","lucide-circle-check-big");const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d","M21.801 10A10 10 0 1 1 17 3.335");const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","m9 11 3 3L22 4"),e.appendChild(t),e.appendChild(n),e};function Rn(s="#333"){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("x","0px"),e.setAttribute("y","0px"),e.setAttribute("width","18"),e.setAttribute("height","18"),e.setAttribute("viewBox","0 0 50 50"),e.setAttribute("fill",s);const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d","M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z"),e.appendChild(t),e}function vr(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width","16"),s.setAttribute("height","16"),s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","none"),s.setAttribute("stroke","#2c96f8"),s.setAttribute("stroke-width","2"),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.classList.add("lucide","lucide-pencil");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z");const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d","m15 5 4 4"),s.appendChild(e),s.appendChild(t),document.body.appendChild(s),s}function Jt(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/folder"),s.setAttribute("x","0px"),s.setAttribute("y","0px"),s.setAttribute("width","24"),s.setAttribute("height","24"),s.setAttribute("viewBox","0 0 48 48");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("fill","#FFA000"),e.setAttribute("d","M40,12H22l-4-4H8c-2.2,0-4,1.8-4,4v8h40v-4C44,13.8,42.2,12,40,12z");const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("fill","#FFCA28"),t.setAttribute("d","M40,12H8c-2.2,0-4,1.8-4,4v20c0,2.2,1.8,4,4,4h32c2.2,0,4-1.8,4-4V16C44,13.8,42.2,12,40,12z"),s.appendChild(e),s.appendChild(t),s}function ds(){const s="http://www.w3.org/2000/svg",e=document.createElementNS(s,"svg");e.setAttribute("width","12"),e.setAttribute("height","12"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","3"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.classList.add("lucide","lucide-image");const t=document.createElementNS(s,"rect");t.setAttribute("width","18"),t.setAttribute("height","18"),t.setAttribute("x","3"),t.setAttribute("y","3"),t.setAttribute("rx","2"),t.setAttribute("ry","2");const n=document.createElementNS(s,"circle");n.setAttribute("cx","9"),n.setAttribute("cy","9"),n.setAttribute("r","2");const r=document.createElementNS(s,"path");return r.setAttribute("d","m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"),e.appendChild(t),e.appendChild(n),e.appendChild(r),document.body.appendChild(e),e}function hs(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("height","24px"),s.setAttribute("viewBox","0 -960 960 960"),s.setAttribute("width","24px"),s.setAttribute("fill","currentColor");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","m488-400-65 65 56 56 161-161-161-161-56 56 65 65H320v80h168ZM160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640v400q0 33-23.5 56.5T800-160H160Zm0-80h640v-400H447l-80-80H160v480Zm0 0v-480 480Z"),s.appendChild(e),s}function kr(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("fill","none"),s.setAttribute("width","20"),s.setAttribute("height","20"),s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("stroke-width","1.5"),s.setAttribute("stroke","currentColor"),s.setAttribute("class","size-2");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.setAttribute("d","M12 4.5v15m7.5-7.5h-15"),s.appendChild(e),s}function us(){const s="http://www.w3.org/2000/svg",e=document.createElementNS(s,"svg");e.setAttribute("width","16"),e.setAttribute("height","16"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.classList.add("lucide","lucide-eye");const t=document.createElementNS(s,"path");t.setAttribute("d","M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"),e.appendChild(t);const n=document.createElementNS(s,"circle");return n.setAttribute("cx","12"),n.setAttribute("cy","12"),n.setAttribute("r","3"),e.appendChild(n),document.body.appendChild(e),e}function fs(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("height","24px"),s.setAttribute("width","24px"),s.setAttribute("viewBox","0 0 30 30"),s.setAttribute("fill","#999");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M 13 3 C 7.4889971 3 3 7.4889971 3 13 C 3 18.511003 7.4889971 23 13 23 C 15.396508 23 17.597385 22.148986 19.322266 20.736328 L 25.292969 26.707031 A 1.0001 1.0001 0 1 0 26.707031 25.292969 L 20.736328 19.322266 C 22.148986 17.597385 23 15.396508 23 13 C 23 7.4889971 18.511003 3 13 3 z M 13 5 C 17.430123 5 21 8.5698774 21 13 C 21 17.430123 17.430123 21 13 21 C 8.5698774 21 5 17.430123 5 13 C 5 8.5698774 8.5698774 5 13 5 z"),s.appendChild(e),s}function Fr(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width","16"),s.setAttribute("height","16"),s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","none"),s.setAttribute("stroke","#f14b4b"),s.setAttribute("stroke-width","2"),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.classList.add("lucide","lucide-trash-2");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M3 6h18");const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d","M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6");const n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("d","M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2");const r=document.createElementNS("http://www.w3.org/2000/svg","line");r.setAttribute("x1","10"),r.setAttribute("x2","10"),r.setAttribute("y1","11"),r.setAttribute("y2","17");const i=document.createElementNS("http://www.w3.org/2000/svg","line");return i.setAttribute("x1","14"),i.setAttribute("x2","14"),i.setAttribute("y1","11"),i.setAttribute("y2","17"),s.appendChild(e),s.appendChild(t),s.appendChild(n),s.appendChild(r),s.appendChild(i),document.body.appendChild(s),s}function Mn(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width","24"),s.setAttribute("height","24"),s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","none"),s.setAttribute("stroke","currentColor"),s.setAttribute("stroke-width","2"),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.classList.add("lucide","lucide-upload");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4");const t=document.createElementNS("http://www.w3.org/2000/svg","polyline");t.setAttribute("points","17 8 12 3 7 8");const n=document.createElementNS("http://www.w3.org/2000/svg","line");return n.setAttribute("x1","12"),n.setAttribute("x2","12"),n.setAttribute("y1","3"),n.setAttribute("y2","15"),s.appendChild(e),s.appendChild(t),s.appendChild(n),s}function ps(){const s="http://www.w3.org/2000/svg",e=document.createElementNS(s,"svg");e.setAttribute("width","12"),e.setAttribute("height","12"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","3"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.classList.add("lucide","lucide-video");const t=document.createElementNS(s,"path");t.setAttribute("d","m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5");const n=document.createElementNS(s,"rect");return n.setAttribute("x","2"),n.setAttribute("y","6"),n.setAttribute("width","14"),n.setAttribute("height","12"),n.setAttribute("rx","2"),e.appendChild(t),e.appendChild(n),document.body.appendChild(e),e}function ee(s,e,t,n,r){let i=document.createElement(s);return e&&(i.className+=e),t&&(i.style.cssText=t),n&&(i.textContent=n),r&&r.appendChild(i),i}class ms{constructor(){X(this,pt);X(this,et);X(this,Ht,"#fff");$(this,pt,document.createElementNS("http://www.w3.org/2000/svg","svg")),F(this,pt).setAttribute("viewBox","25 25 50 50"),F(this,pt).classList.add("loader-svg"),$(this,et,document.createElementNS("http://www.w3.org/2000/svg","circle")),F(this,et).setAttribute("r","20"),F(this,et).setAttribute("cy","50"),F(this,et).setAttribute("cx","50"),F(this,et).setAttribute("stroke",F(this,Ht)),F(this,et).classList.add("loader-circle"),F(this,pt).appendChild(F(this,et))}show(e,t){t&&($(this,Ht,t),F(this,et).setAttribute("stroke",F(this,Ht))),e.appendChild(F(this,pt))}hide(){F(this,pt).remove()}}pt=new WeakMap,et=new WeakMap,Ht=new WeakMap;const Nr=new ms,pn=document.body;class Ir{constructor(){pe(this,"main");pe(this,"dialogContainer");pe(this,"dialog");pe(this,"dialogBackdrop");pe(this,"dialogContent");pe(this,"dialogHeader");pe(this,"dialogBody");pe(this,"dialogFooter");pe(this,"confirmButton");pe(this,"cancelButton");pe(this,"confirmCallback");pe(this,"cancelCallback");this.main=ee("div"),this.dialog=ee("div"),this.confirmCallback=void 0,this.cancelCallback=void 0}_init(e){this.main=ee("div","dialog-presentation","","",pn),this.main.setAttribute("role","presentation"),this.dialogContainer=ee("div","dialog-container","","",this.main),this.dialogBackdrop=ee("div","dialog-backdrop","","",this.dialogContainer),this.dialog=ee("div","dialog","","",this.dialogContainer),this.dialog.setAttribute("tabIndex","-1");const t=document.activeElement;if(t&&t!==document.body&&(t.blur(),this.dialog.focus()),this.dialog.className="dialog",this.dialogContent=ee("div","dialog-content","","",this.dialog),e!=null&&e.dialogContentStyle&&Object.assign(this.dialogContent.style,e.dialogContentStyle),this.confirmButton=ee("button","dialog-btn confirm","","",this.dialogFooter),this.confirmButton.type="button",this.cancelButton=ee("button","dialog-btn cancel","","",this.dialogFooter),this.cancelButton.type="button",e.showCloseBtn){const n=ee("button","dialog-close-btn","","",this.dialogContent);n.appendChild(Rn()),n.onclick=()=>this.hide()}return e.header&&this._setHeader(e),this._setBody(e),this._setFooter(e),this.confirmButton.textContent=e.confirmButtonText||"Upload",this.cancelButton.textContent=e.cancelButtonText||"Cancel",pn.style.overflow="hidden",this.confirmButton.textContent=e.confirmButtonText||"Upload",this.cancelButton.textContent=e.cancelButtonText||"Cancel",pn.classList.add("dialog-visible"),new Promise(n=>{const r=i=>()=>{this.hide(),n(i==="confirm")};this.confirmCallback=e.onConfirm||r("confirm"),this.confirmButton.addEventListener("click",this.confirmCallback),this.cancelCallback=e.onCancel||r("cancel"),this.cancelButton.addEventListener("click",this.cancelCallback)})}_setHeader(e){if(this.dialogHeader=ee("div","dialog-header","","",this.dialogContent),!e.header)this.dialogHeader.innerHTML="";else if(typeof e.header=="string"){const t=ee("h4","dialog-header-text","","",this.dialogHeader);t.textContent=e.header}else this.dialogHeader.innerHTML="",this.dialogHeader.appendChild(e.header)}_setBody(e){this.dialogBody=ee("div","dialog-body","","",this.dialogContent),typeof e.content=="string"?this.dialogBody.innerHTML=e.content:(this.dialogBody.innerHTML="",this.dialogBody.appendChild(e.content))}_setFooter(e){this.dialogFooter=ee("div","dialog-footer","","",this.dialogContent),e.showFooter?this.dialogFooter.append(this.cancelButton,this.confirmButton):(this.dialogFooter.innerHTML="",this.dialogFooter.remove())}show(e){this._init(e),setTimeout(()=>{this.dialogContainer.style.opacity="1",this.dialog.style.transform="scale(1)",this.dialog.style.transition="transform 150ms ease-in",this.dialog.style.opacity="1",this.dialogBackdrop.style.opacity="1"},150)}hide(){this.main||pn.style.removeProperty("overflow"),this.dialog.style.transform="scale(0.8)",this.dialog.style.transition="transform 150ms ease-out",this.dialogBackdrop.style.opacity="0",setTimeout(()=>{this.dialogContainer.style.opacity="0",this.dialog.style.opacity="0",this.dialogContent.style.opacity="0",this.main.remove()},150)}updateUploadBtn(e){e?(Nr.show(this.confirmButton),this.confirmButton.disabled=!0):(Nr.hide(),this.confirmButton.disabled=!1)}}const mn=new Ir,Ee=new Ir;class gs{constructor(){pe(this,"main");pe(this,"dialogBody");this.main=ee("div"),this.dialogBody=ee("div"),this.hide()}show(e){this.main=ee("div","popover","","",e.mainContainer),this.dialogBody=ee("div","popover-body","","",this.main),this.main.id=e.divId,this.dialogBody.append(e.content)}hide(){this.main.remove()}}const Ke=new gs;var it=(s=>(s[s.IMAGE=0]="IMAGE",s[s.AUDIO=1]="AUDIO",s[s.VIDEO=2]="VIDEO",s[s.ALL=3]="ALL",s[s.FOLDER=4]="FOLDER",s))(it||{});const Qt={0:"IMAGE",1:"AUDIO",2:"VIDEO",3:"ALL",4:"FOLDER"};function Lr(s){switch(s){case"image":return Qt[it.IMAGE];case"video":return Qt[it.VIDEO];case"audio":return Qt[it.AUDIO];default:return Qt[it.ALL]}}function ws(s){const e={};s.forEach(r=>{e[r.key]={...r,children:{}}});const t=r=>(Object.values(e).filter(o=>o.nestedFolderName==r.key).forEach(o=>{r.children[o.key]=t(o)}),r);return s.reduce((r,i)=>(i.nestedFolderName||r.push(t(e[i.key])),r),[])}function ys(s,e){const t=n=>{if(n.key===e.nestedFolderName)return n.children[e.key]={...e,children:{}},!0;for(const r in n.children){const i=n.children[r];if(t(i))return!0}return!1};for(const n of s)if(t(n))break;return s}const bs=async(s,e)=>{let t;try{s&&(t={Authorization:s,"app-id":e==="production"?"hamropatro":"hamropatro-android"})}catch(r){if(r)throw r}return{meta:t}};function K(s,e){const t=document.createElement("div");return s&&(t.className=s),e&&(t.id=e),t}function Yt(s,e,t){const n=document.createElement("p");return e&&(n.className=e),t&&(n.id=t),s&&(n.textContent=s),n}function oe(s,e){const t=document.createElement("span");return e&&(t.className=e),s&&(t.textContent=s),t}function Tr(s,e,t,n){const r=document.createElement("img");return e&&(r.className=e),r.src=s,r}function Cs(s,e,t){const n=document.createElement("video"),r=document.createElement("source");return n.className=e,r.src=s,n.appendChild(r),n}function Es(s,e,t){const n=document.createElement("audio"),r=document.createElement("source");return n.className=e,n.controls=!0,r.src=s,n.appendChild(r),n}function Pe(s,e,t,n,r){const i=document.createElement("button");return e&&(i.className=e),t&&(i.id=t),s&&(i.textContent=s),r&&(i.innerHTML=r),i.disabled=n,i}function Vn(s,e,t){const n=document.createElement("input");return n.className=e,n.defaultValue=t,s&&(n.type=s),n}class As extends xe{constructor(){super("com.hamropatro.grpc.cms.ImageUploadRequest",[{no:1,name:"mime_type",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.mimeType="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.mimeType=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.mimeType!==""&&t.tag(1,j.LengthDelimited).string(e.mimeType);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Hn=new As;class vs extends xe{constructor(){super("com.hamropatro.grpc.cms.ImageUploadResponse",[{no:1,name:"key",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",t.url="",e!==void 0&&Fe(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.key=e.string();break;case 2:i.url=e.string();break;default:let h=n.readUnknownField;if(h==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);h!==!1&&(h===!0?G.onRead:h)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key),e.url!==""&&t.tag(2,j.LengthDelimited).string(e.url);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const xr=new vs,$n=new _n("com.hamropatro.grpc.cms.ImageUploadService",[{name:"Upload",options:{},I:Hn,O:xr},{name:"UploadUserImage",options:{},I:Hn,O:xr}]);class ks{constructor(e){pe(this,"typeName",$n.typeName);pe(this,"methods",$n.methods);pe(this,"options",$n.options);this._transport=e}upload(e,t){const n=this.methods[0],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}uploadUserImage(e,t){const n=this.methods[1],r=this._transport.mergeOptions(t);return qe("unary",this._transport,n,r,e)}}const Fs=async(s,e,t=!0)=>{var o;const n=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,r=new ks(n),i=Hn.create();try{return i.mimeType=s,t?await r.upload(i,e):await r.uploadUserImage(i,e)}catch(a){throw a}};function Ns(s,e){return e.forEach(function(t){t&&typeof t!="string"&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if(n!=="default"&&!(n in s)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(s,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(s)}function _r(s,e){return new Promise(function(t,n){let r;return Is(s).then(function(i){try{return r=i,t(new Blob([e.slice(0,2),r,e.slice(2)],{type:"image/jpeg"}))}catch(o){return n(o)}},n)})}const Is=s=>new Promise((e,t)=>{const n=new FileReader;n.addEventListener("load",({target:{result:r}})=>{const i=new DataView(r);let o=0;if(i.getUint16(o)!==65496)return t("not a valid JPEG");for(o+=2;;){const a=i.getUint16(o);if(a===65498)break;const c=i.getUint16(o+2);if(a===65505&&i.getUint32(o+4)===1165519206){const h=o+10;let l;switch(i.getUint16(h)){case 18761:l=!0;break;case 19789:l=!1;break;default:return t("TIFF header contains invalid endian")}if(i.getUint16(h+2,l)!==42)return t("TIFF header contains invalid version");const u=i.getUint32(h+4,l),d=h+u+2+12*i.getUint16(h+u,l);for(let f=h+u+2;f<d;f+=12)if(i.getUint16(f,l)==274){if(i.getUint16(f+2,l)!==3)return t("Orientation data type is invalid");if(i.getUint32(f+4,l)!==1)return t("Orientation data count is invalid");i.setUint16(f+8,1,l);break}return e(r.slice(o,o+2+c))}o+=2+c}return e(new Blob)}),n.readAsArrayBuffer(s)});var gn={},Ls={get exports(){return gn},set exports(s){gn=s}};(function(s){var e,t,n={};Ls.exports=n,n.parse=function(r,i){for(var o=n.bin.readUshort,a=n.bin.readUint,c=0,h={},l=new Uint8Array(r),u=l.length-4;a(l,u)!=101010256;)u--;c=u,c+=4;var d=o(l,c+=4);o(l,c+=2);var f=a(l,c+=2),y=a(l,c+=4);c+=4,c=y;for(var I=0;I<d;I++){a(l,c),c+=4,c+=4,c+=4,a(l,c+=4),f=a(l,c+=4);var L=a(l,c+=4),C=o(l,c+=4),R=o(l,c+2),O=o(l,c+4);c+=6;var v=a(l,c+=8);c+=4,c+=C+R+O,n._readLocal(l,v,h,f,L,i)}return h},n._readLocal=function(r,i,o,a,c,h){var l=n.bin.readUshort,u=n.bin.readUint;u(r,i),l(r,i+=4),l(r,i+=2);var d=l(r,i+=2);u(r,i+=2),u(r,i+=4),i+=4;var f=l(r,i+=8),y=l(r,i+=2);i+=2;var I=n.bin.readUTF8(r,i,f);if(i+=f,i+=y,h)o[I]={size:c,csize:a};else{var L=new Uint8Array(r.buffer,i);if(d==0)o[I]=new Uint8Array(L.buffer.slice(i,i+a));else{if(d!=8)throw"unknown compression method: "+d;var C=new Uint8Array(c);n.inflateRaw(L,C),o[I]=C}}},n.inflateRaw=function(r,i){return n.F.inflate(r,i)},n.inflate=function(r,i){return r[0],r[1],n.inflateRaw(new Uint8Array(r.buffer,r.byteOffset+2,r.length-6),i)},n.deflate=function(r,i){i==null&&(i={level:6});var o=0,a=new Uint8Array(50+Math.floor(1.1*r.length));a[o]=120,a[o+1]=156,o+=2,o=n.F.deflateRaw(r,a,o,i.level);var c=n.adler(r,0,r.length);return a[o+0]=c>>>24&255,a[o+1]=c>>>16&255,a[o+2]=c>>>8&255,a[o+3]=c>>>0&255,new Uint8Array(a.buffer,0,o+4)},n.deflateRaw=function(r,i){i==null&&(i={level:6});var o=new Uint8Array(50+Math.floor(1.1*r.length)),a=n.F.deflateRaw(r,o,a,i.level);return new Uint8Array(o.buffer,0,a)},n.encode=function(r,i){i==null&&(i=!1);var o=0,a=n.bin.writeUint,c=n.bin.writeUshort,h={};for(var l in r){var u=!n._noNeed(l)&&!i,d=r[l],f=n.crc.crc(d,0,d.length);h[l]={cpr:u,usize:d.length,crc:f,file:u?n.deflateRaw(d):d}}for(var l in h)o+=h[l].file.length+30+46+2*n.bin.sizeUTF8(l);o+=22;var y=new Uint8Array(o),I=0,L=[];for(var l in h){var C=h[l];L.push(I),I=n._writeHeader(y,I,l,C,0)}var R=0,O=I;for(var l in h)C=h[l],L.push(I),I=n._writeHeader(y,I,l,C,1,L[R++]);var v=I-O;return a(y,I,101010256),I+=4,c(y,I+=4,R),c(y,I+=2,R),a(y,I+=2,v),a(y,I+=4,O),I+=4,I+=2,y.buffer},n._noNeed=function(r){var i=r.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(i)!=-1},n._writeHeader=function(r,i,o,a,c,h){var l=n.bin.writeUint,u=n.bin.writeUshort,d=a.file;return l(r,i,c==0?67324752:33639248),i+=4,c==1&&(i+=2),u(r,i,20),u(r,i+=2,0),u(r,i+=2,a.cpr?8:0),l(r,i+=2,0),l(r,i+=4,a.crc),l(r,i+=4,d.length),l(r,i+=4,a.usize),u(r,i+=4,n.bin.sizeUTF8(o)),u(r,i+=2,0),i+=2,c==1&&(i+=2,i+=2,l(r,i+=6,h),i+=4),i+=n.bin.writeUTF8(r,i,o),c==0&&(r.set(d,i),i+=d.length),i},n.crc={table:function(){for(var r=new Uint32Array(256),i=0;i<256;i++){for(var o=i,a=0;a<8;a++)1&o?o=3988292384^o>>>1:o>>>=1;r[i]=o}return r}(),update:function(r,i,o,a){for(var c=0;c<a;c++)r=n.crc.table[255&(r^i[o+c])]^r>>>8;return r},crc:function(r,i,o){return 4294967295^n.crc.update(4294967295,r,i,o)}},n.adler=function(r,i,o){for(var a=1,c=0,h=i,l=i+o;h<l;){for(var u=Math.min(h+5552,l);h<u;)c+=a+=r[h++];a%=65521,c%=65521}return c<<16|a},n.bin={readUshort:function(r,i){return r[i]|r[i+1]<<8},writeUshort:function(r,i,o){r[i]=255&o,r[i+1]=o>>8&255},readUint:function(r,i){return 16777216*r[i+3]+(r[i+2]<<16|r[i+1]<<8|r[i])},writeUint:function(r,i,o){r[i]=255&o,r[i+1]=o>>8&255,r[i+2]=o>>16&255,r[i+3]=o>>24&255},readASCII:function(r,i,o){for(var a="",c=0;c<o;c++)a+=String.fromCharCode(r[i+c]);return a},writeASCII:function(r,i,o){for(var a=0;a<o.length;a++)r[i+a]=o.charCodeAt(a)},pad:function(r){return r.length<2?"0"+r:r},readUTF8:function(r,i,o){for(var a,c="",h=0;h<o;h++)c+="%"+n.bin.pad(r[i+h].toString(16));try{a=decodeURIComponent(c)}catch{return n.bin.readASCII(r,i,o)}return a},writeUTF8:function(r,i,o){for(var a=o.length,c=0,h=0;h<a;h++){var l=o.charCodeAt(h);if(!(4294967168&l))r[i+c]=l,c++;else if(!(4294965248&l))r[i+c]=192|l>>6,r[i+c+1]=128|l>>0&63,c+=2;else if(!(4294901760&l))r[i+c]=224|l>>12,r[i+c+1]=128|l>>6&63,r[i+c+2]=128|l>>0&63,c+=3;else{if(4292870144&l)throw"e";r[i+c]=240|l>>18,r[i+c+1]=128|l>>12&63,r[i+c+2]=128|l>>6&63,r[i+c+3]=128|l>>0&63,c+=4}}return c},sizeUTF8:function(r){for(var i=r.length,o=0,a=0;a<i;a++){var c=r.charCodeAt(a);if(!(4294967168&c))o++;else if(!(4294965248&c))o+=2;else if(!(4294901760&c))o+=3;else{if(4292870144&c)throw"e";o+=4}}return o}},n.F={},n.F.deflateRaw=function(r,i,o,a){var c=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][a],h=n.F.U,l=n.F._goodIndex;n.F._hash;var u=n.F._putsE,d=0,f=o<<3,y=0,I=r.length;if(a==0){for(;d<I;)u(i,f,d+(N=Math.min(65535,I-d))==I?1:0),f=n.F._copyExact(r,d,N,i,f+8),d+=N;return f>>>3}var L=h.lits,C=h.strt,R=h.prev,O=0,v=0,x=0,b=0,B=0,m=0;for(I>2&&(C[m=n.F._hash(r,0)]=0),d=0;d<I;d++){if(B=m,d+1<I-2){m=n.F._hash(r,d+1);var g=d+1&32767;R[g]=C[m],C[m]=g}if(y<=d){(O>14e3||v>26697)&&I-d>100&&(y<d&&(L[O]=d-y,O+=2,y=d),f=n.F._writeBlock(d==I-1||y==I?1:0,L,O,b,r,x,d-x,i,f),O=v=b=0,x=d);var A=0;d<I-2&&(A=n.F._bestMatch(r,d,R,B,Math.min(c[2],I-d),c[3]));var N=A>>>16,k=65535&A;if(A!=0){k=65535&A;var T=l(N=A>>>16,h.of0);h.lhst[257+T]++;var E=l(k,h.df0);h.dhst[E]++,b+=h.exb[T]+h.dxb[E],L[O]=N<<23|d-y,L[O+1]=k<<16|T<<8|E,O+=2,y=d+N}else h.lhst[r[d]]++;v++}}for(x==d&&r.length!=0||(y<d&&(L[O]=d-y,O+=2,y=d),f=n.F._writeBlock(1,L,O,b,r,x,d-x,i,f),O=0,v=0,O=v=b=0,x=d);7&f;)f++;return f>>>3},n.F._bestMatch=function(r,i,o,a,c,h){var l=32767&i,u=o[l],d=l-u+32768&32767;if(u==l||a!=n.F._hash(r,i-d))return 0;for(var f=0,y=0,I=Math.min(32767,i);d<=I&&--h!=0&&u!=l;){if(f==0||r[i+f]==r[i+f-d]){var L=n.F._howLong(r,i,d);if(L>f){if(y=d,(f=L)>=c)break;d+2<L&&(L=d+2);for(var C=0,R=0;R<L-2;R++){var O=i-d+R+32768&32767,v=O-o[O]+32768&32767;v>C&&(C=v,u=O)}}}d+=(l=u)-(u=o[l])+32768&32767}return f<<16|y},n.F._howLong=function(r,i,o){if(r[i]!=r[i-o]||r[i+1]!=r[i+1-o]||r[i+2]!=r[i+2-o])return 0;var a=i,c=Math.min(r.length,i+258);for(i+=3;i<c&&r[i]==r[i-o];)i++;return i-a},n.F._hash=function(r,i){return(r[i]<<8|r[i+1])+(r[i+2]<<4)&65535},n.saved=0,n.F._writeBlock=function(r,i,o,a,c,h,l,u,d){var f,y,I,L,C,R,O,v,x,b=n.F.U,B=n.F._putsF,m=n.F._putsE;b.lhst[256]++,y=(f=n.F.getTrees())[0],I=f[1],L=f[2],C=f[3],R=f[4],O=f[5],v=f[6],x=f[7];var g=32+(d+3&7?8-(d+3&7):0)+(l<<3),A=a+n.F.contSize(b.fltree,b.lhst)+n.F.contSize(b.fdtree,b.dhst),N=a+n.F.contSize(b.ltree,b.lhst)+n.F.contSize(b.dtree,b.dhst);N+=14+3*O+n.F.contSize(b.itree,b.ihst)+(2*b.ihst[16]+3*b.ihst[17]+7*b.ihst[18]);for(var k=0;k<286;k++)b.lhst[k]=0;for(k=0;k<30;k++)b.dhst[k]=0;for(k=0;k<19;k++)b.ihst[k]=0;var T=g<A&&g<N?0:A<N?1:2;if(B(u,d,r),B(u,d+1,T),d+=3,T==0){for(;7&d;)d++;d=n.F._copyExact(c,h,l,u,d)}else{var E,U;if(T==1&&(E=b.fltree,U=b.fdtree),T==2){n.F.makeCodes(b.ltree,y),n.F.revCodes(b.ltree,y),n.F.makeCodes(b.dtree,I),n.F.revCodes(b.dtree,I),n.F.makeCodes(b.itree,L),n.F.revCodes(b.itree,L),E=b.ltree,U=b.dtree,m(u,d,C-257),m(u,d+=5,R-1),m(u,d+=5,O-4),d+=4;for(var w=0;w<O;w++)m(u,d+3*w,b.itree[1+(b.ordr[w]<<1)]);d+=3*O,d=n.F._codeTiny(v,b.itree,u,d),d=n.F._codeTiny(x,b.itree,u,d)}for(var p=h,M=0;M<o;M+=2){for(var _=i[M],V=_>>>23,q=p+(8388607&_);p<q;)d=n.F._writeLit(c[p++],E,u,d);if(V!=0){var W=i[M+1],Z=W>>16,H=W>>8&255,S=255&W;m(u,d=n.F._writeLit(257+H,E,u,d),V-b.of0[H]),d+=b.exb[H],B(u,d=n.F._writeLit(S,U,u,d),Z-b.df0[S]),d+=b.dxb[S],p+=V}}d=n.F._writeLit(256,E,u,d)}return d},n.F._copyExact=function(r,i,o,a,c){var h=c>>>3;return a[h]=o,a[h+1]=o>>>8,a[h+2]=255-a[h],a[h+3]=255-a[h+1],h+=4,a.set(new Uint8Array(r.buffer,i,o),h),c+(o+4<<3)},n.F.getTrees=function(){for(var r=n.F.U,i=n.F._hufTree(r.lhst,r.ltree,15),o=n.F._hufTree(r.dhst,r.dtree,15),a=[],c=n.F._lenCodes(r.ltree,a),h=[],l=n.F._lenCodes(r.dtree,h),u=0;u<a.length;u+=2)r.ihst[a[u]]++;for(u=0;u<h.length;u+=2)r.ihst[h[u]]++;for(var d=n.F._hufTree(r.ihst,r.itree,7),f=19;f>4&&r.itree[1+(r.ordr[f-1]<<1)]==0;)f--;return[i,o,d,c,l,f,a,h]},n.F.getSecond=function(r){for(var i=[],o=0;o<r.length;o+=2)i.push(r[o+1]);return i},n.F.nonZero=function(r){for(var i="",o=0;o<r.length;o+=2)r[o+1]!=0&&(i+=(o>>1)+",");return i},n.F.contSize=function(r,i){for(var o=0,a=0;a<i.length;a++)o+=i[a]*r[1+(a<<1)];return o},n.F._codeTiny=function(r,i,o,a){for(var c=0;c<r.length;c+=2){var h=r[c],l=r[c+1];a=n.F._writeLit(h,i,o,a);var u=h==16?2:h==17?3:7;h>15&&(n.F._putsE(o,a,l,u),a+=u)}return a},n.F._lenCodes=function(r,i){for(var o=r.length;o!=2&&r[o-1]==0;)o-=2;for(var a=0;a<o;a+=2){var c=r[a+1],h=a+3<o?r[a+3]:-1,l=a+5<o?r[a+5]:-1,u=a==0?-1:r[a-1];if(c==0&&h==c&&l==c){for(var d=a+5;d+2<o&&r[d+2]==c;)d+=2;(f=Math.min(d+1-a>>>1,138))<11?i.push(17,f-3):i.push(18,f-11),a+=2*f-2}else if(c==u&&h==c&&l==c){for(d=a+5;d+2<o&&r[d+2]==c;)d+=2;var f=Math.min(d+1-a>>>1,6);i.push(16,f-3),a+=2*f-2}else i.push(c,0)}return o>>>1},n.F._hufTree=function(r,i,o){var a=[],c=r.length,h=i.length,l=0;for(l=0;l<h;l+=2)i[l]=0,i[l+1]=0;for(l=0;l<c;l++)r[l]!=0&&a.push({lit:l,f:r[l]});var u=a.length,d=a.slice(0);if(u==0)return 0;if(u==1){var f=a[0].lit;return d=f==0?1:0,i[1+(f<<1)]=1,i[1+(d<<1)]=1,1}a.sort(function(v,x){return v.f-x.f});var y=a[0],I=a[1],L=0,C=1,R=2;for(a[0]={lit:-1,f:y.f+I.f,l:y,r:I,d:0};C!=u-1;)y=L!=C&&(R==u||a[L].f<a[R].f)?a[L++]:a[R++],I=L!=C&&(R==u||a[L].f<a[R].f)?a[L++]:a[R++],a[C++]={lit:-1,f:y.f+I.f,l:y,r:I};var O=n.F.setDepth(a[C-1],0);for(O>o&&(n.F.restrictDepth(d,o,O),O=o),l=0;l<u;l++)i[1+(d[l].lit<<1)]=d[l].d;return O},n.F.setDepth=function(r,i){return r.lit!=-1?(r.d=i,i):Math.max(n.F.setDepth(r.l,i+1),n.F.setDepth(r.r,i+1))},n.F.restrictDepth=function(r,i,o){var a=0,c=1<<o-i,h=0;for(r.sort(function(u,d){return d.d==u.d?u.f-d.f:d.d-u.d}),a=0;a<r.length&&r[a].d>i;a++){var l=r[a].d;r[a].d=i,h+=c-(1<<o-l)}for(h>>>=o-i;h>0;)(l=r[a].d)<i?(r[a].d++,h-=1<<i-l-1):a++;for(;a>=0;a--)r[a].d==i&&h<0&&(r[a].d--,h++);h!=0&&console.log("debt left")},n.F._goodIndex=function(r,i){var o=0;return i[16|o]<=r&&(o|=16),i[8|o]<=r&&(o|=8),i[4|o]<=r&&(o|=4),i[2|o]<=r&&(o|=2),i[1|o]<=r&&(o|=1),o},n.F._writeLit=function(r,i,o,a){return n.F._putsF(o,a,i[r<<1]),a+i[1+(r<<1)]},n.F.inflate=function(r,i){var o=Uint8Array;if(r[0]==3&&r[1]==0)return i||new o(0);var a=n.F,c=a._bitsF,h=a._bitsE,l=a._decodeTiny,u=a.makeCodes,d=a.codes2map,f=a._get17,y=a.U,I=i==null;I&&(i=new o(r.length>>>2<<3));for(var L,C,R=0,O=0,v=0,x=0,b=0,B=0,m=0,g=0,A=0;R==0;)if(R=c(r,A,1),O=c(r,A+1,2),A+=3,O!=0){if(I&&(i=n.F._check(i,g+(1<<17))),O==1&&(L=y.flmap,C=y.fdmap,B=511,m=31),O==2){v=h(r,A,5)+257,x=h(r,A+5,5)+1,b=h(r,A+10,4)+4,A+=14;for(var N=0;N<38;N+=2)y.itree[N]=0,y.itree[N+1]=0;var k=1;for(N=0;N<b;N++){var T=h(r,A+3*N,3);y.itree[1+(y.ordr[N]<<1)]=T,T>k&&(k=T)}A+=3*b,u(y.itree,k),d(y.itree,k,y.imap),L=y.lmap,C=y.dmap,A=l(y.imap,(1<<k)-1,v+x,r,A,y.ttree);var E=a._copyOut(y.ttree,0,v,y.ltree);B=(1<<E)-1;var U=a._copyOut(y.ttree,v,x,y.dtree);m=(1<<U)-1,u(y.ltree,E),d(y.ltree,E,L),u(y.dtree,U),d(y.dtree,U,C)}for(;;){var w=L[f(r,A)&B];A+=15&w;var p=w>>>4;if(!(p>>>8))i[g++]=p;else{if(p==256)break;var M=g+p-254;if(p>264){var _=y.ldef[p-257];M=g+(_>>>3)+h(r,A,7&_),A+=7&_}var V=C[f(r,A)&m];A+=15&V;var q=V>>>4,W=y.ddef[q],Z=(W>>>4)+c(r,A,15&W);for(A+=15&W,I&&(i=n.F._check(i,g+(1<<17)));g<M;)i[g]=i[g++-Z],i[g]=i[g++-Z],i[g]=i[g++-Z],i[g]=i[g++-Z];g=M}}}else{7&A&&(A+=8-(7&A));var H=4+(A>>>3),S=r[H-4]|r[H-3]<<8;I&&(i=n.F._check(i,g+S)),i.set(new o(r.buffer,r.byteOffset+H,S),g),A=H+S<<3,g+=S}return i.length==g?i:i.slice(0,g)},n.F._check=function(r,i){var o=r.length;if(i<=o)return r;var a=new Uint8Array(Math.max(o<<1,i));return a.set(r,0),a},n.F._decodeTiny=function(r,i,o,a,c,h){for(var l=n.F._bitsE,u=n.F._get17,d=0;d<o;){var f=r[u(a,c)&i];c+=15&f;var y=f>>>4;if(y<=15)h[d]=y,d++;else{var I=0,L=0;y==16?(L=3+l(a,c,2),c+=2,I=h[d-1]):y==17?(L=3+l(a,c,3),c+=3):y==18&&(L=11+l(a,c,7),c+=7);for(var C=d+L;d<C;)h[d]=I,d++}}return c},n.F._copyOut=function(r,i,o,a){for(var c=0,h=0,l=a.length>>>1;h<o;){var u=r[h+i];a[h<<1]=0,a[1+(h<<1)]=u,u>c&&(c=u),h++}for(;h<l;)a[h<<1]=0,a[1+(h<<1)]=0,h++;return c},n.F.makeCodes=function(r,i){for(var o,a,c,h,l=n.F.U,u=r.length,d=l.bl_count,f=0;f<=i;f++)d[f]=0;for(f=1;f<u;f+=2)d[r[f]]++;var y=l.next_code;for(o=0,d[0]=0,a=1;a<=i;a++)o=o+d[a-1]<<1,y[a]=o;for(c=0;c<u;c+=2)(h=r[c+1])!=0&&(r[c]=y[h],y[h]++)},n.F.codes2map=function(r,i,o){for(var a=r.length,c=n.F.U.rev15,h=0;h<a;h+=2)if(r[h+1]!=0)for(var l=h>>1,u=r[h+1],d=l<<4|u,f=i-u,y=r[h]<<f,I=y+(1<<f);y!=I;)o[c[y]>>>15-i]=d,y++},n.F.revCodes=function(r,i){for(var o=n.F.U.rev15,a=15-i,c=0;c<r.length;c+=2){var h=r[c]<<i-r[c+1];r[c]=o[h]>>>a}},n.F._putsE=function(r,i,o){o<<=7&i;var a=i>>>3;r[a]|=o,r[a+1]|=o>>>8},n.F._putsF=function(r,i,o){o<<=7&i;var a=i>>>3;r[a]|=o,r[a+1]|=o>>>8,r[a+2]|=o>>>16},n.F._bitsE=function(r,i,o){return(r[i>>>3]|r[1+(i>>>3)]<<8)>>>(7&i)&(1<<o)-1},n.F._bitsF=function(r,i,o){return(r[i>>>3]|r[1+(i>>>3)]<<8|r[2+(i>>>3)]<<16)>>>(7&i)&(1<<o)-1},n.F._get17=function(r,i){return(r[i>>>3]|r[1+(i>>>3)]<<8|r[2+(i>>>3)]<<16)>>>(7&i)},n.F._get25=function(r,i){return(r[i>>>3]|r[1+(i>>>3)]<<8|r[2+(i>>>3)]<<16|r[3+(i>>>3)]<<24)>>>(7&i)},n.F.U=(e=Uint16Array,t=Uint32Array,{next_code:new e(16),bl_count:new e(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new e(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new t(32),flmap:new e(512),fltree:[],fdmap:new e(32),fdtree:[],lmap:new e(32768),ltree:[],ttree:[],dmap:new e(32768),dtree:[],imap:new e(512),itree:[],rev15:new e(32768),lhst:new t(286),dhst:new t(30),ihst:new t(19),lits:new t(15e3),strt:new e(65536),prev:new e(32768)}),function(){for(var r=n.F.U,i=0;i<32768;i++){var o=i;o=(4278255360&(o=(4042322160&(o=(3435973836&(o=(2863311530&o)>>>1|(1431655765&o)<<1))>>>2|(858993459&o)<<2))>>>4|(252645135&o)<<4))>>>8|(16711935&o)<<8,r.rev15[i]=(o>>>16|o<<16)>>>17}function a(c,h,l){for(;h--!=0;)c.push(0,l)}for(i=0;i<32;i++)r.ldef[i]=r.of0[i]<<3|r.exb[i],r.ddef[i]=r.df0[i]<<4|r.dxb[i];a(r.fltree,144,8),a(r.fltree,112,9),a(r.fltree,24,7),a(r.fltree,8,8),n.F.makeCodes(r.fltree,9),n.F.codes2map(r.fltree,9,r.flmap),n.F.revCodes(r.fltree,9),a(r.fdtree,32,5),n.F.makeCodes(r.fdtree,5),n.F.codes2map(r.fdtree,5,r.fdmap),n.F.revCodes(r.fdtree,5),a(r.itree,19,0),a(r.ltree,286,0),a(r.dtree,30,0),a(r.ttree,320,0)}()})();var Ts=Ns({__proto__:null,default:gn},[gn]);const Ye=function(){var s={nextZero(l,u){for(;l[u]!=0;)u++;return u},readUshort:(l,u)=>l[u]<<8|l[u+1],writeUshort(l,u,d){l[u]=d>>8&255,l[u+1]=255&d},readUint:(l,u)=>16777216*l[u]+(l[u+1]<<16|l[u+2]<<8|l[u+3]),writeUint(l,u,d){l[u]=d>>24&255,l[u+1]=d>>16&255,l[u+2]=d>>8&255,l[u+3]=255&d},readASCII(l,u,d){let f="";for(let y=0;y<d;y++)f+=String.fromCharCode(l[u+y]);return f},writeASCII(l,u,d){for(let f=0;f<d.length;f++)l[u+f]=d.charCodeAt(f)},readBytes(l,u,d){const f=[];for(let y=0;y<d;y++)f.push(l[u+y]);return f},pad:l=>l.length<2?`0${l}`:l,readUTF8(l,u,d){let f,y="";for(let I=0;I<d;I++)y+=`%${s.pad(l[u+I].toString(16))}`;try{f=decodeURIComponent(y)}catch{return s.readASCII(l,u,d)}return f}};function e(l,u,d,f){const y=u*d,I=i(f),L=Math.ceil(u*I/8),C=new Uint8Array(4*y),R=new Uint32Array(C.buffer),{ctype:O}=f,{depth:v}=f,x=s.readUshort;if(O==6){const _=y<<2;if(v==8)for(var b=0;b<_;b+=4)C[b]=l[b],C[b+1]=l[b+1],C[b+2]=l[b+2],C[b+3]=l[b+3];if(v==16)for(b=0;b<_;b++)C[b]=l[b<<1]}else if(O==2){const _=f.tabs.tRNS;if(_==null){if(v==8)for(b=0;b<y;b++){var B=3*b;R[b]=255<<24|l[B+2]<<16|l[B+1]<<8|l[B]}if(v==16)for(b=0;b<y;b++)B=6*b,R[b]=255<<24|l[B+4]<<16|l[B+2]<<8|l[B]}else{var m=_[0];const V=_[1],q=_[2];if(v==8)for(b=0;b<y;b++){var g=b<<2;B=3*b,R[b]=255<<24|l[B+2]<<16|l[B+1]<<8|l[B],l[B]==m&&l[B+1]==V&&l[B+2]==q&&(C[g+3]=0)}if(v==16)for(b=0;b<y;b++)g=b<<2,B=6*b,R[b]=255<<24|l[B+4]<<16|l[B+2]<<8|l[B],x(l,B)==m&&x(l,B+2)==V&&x(l,B+4)==q&&(C[g+3]=0)}}else if(O==3){const _=f.tabs.PLTE,V=f.tabs.tRNS,q=V?V.length:0;if(v==1)for(var A=0;A<d;A++){var N=A*L,k=A*u;for(b=0;b<u;b++){g=k+b<<2;var T=3*(E=l[N+(b>>3)]>>7-((7&b)<<0)&1);C[g]=_[T],C[g+1]=_[T+1],C[g+2]=_[T+2],C[g+3]=E<q?V[E]:255}}if(v==2)for(A=0;A<d;A++)for(N=A*L,k=A*u,b=0;b<u;b++)g=k+b<<2,T=3*(E=l[N+(b>>2)]>>6-((3&b)<<1)&3),C[g]=_[T],C[g+1]=_[T+1],C[g+2]=_[T+2],C[g+3]=E<q?V[E]:255;if(v==4)for(A=0;A<d;A++)for(N=A*L,k=A*u,b=0;b<u;b++)g=k+b<<2,T=3*(E=l[N+(b>>1)]>>4-((1&b)<<2)&15),C[g]=_[T],C[g+1]=_[T+1],C[g+2]=_[T+2],C[g+3]=E<q?V[E]:255;if(v==8)for(b=0;b<y;b++){var E;g=b<<2,T=3*(E=l[b]),C[g]=_[T],C[g+1]=_[T+1],C[g+2]=_[T+2],C[g+3]=E<q?V[E]:255}}else if(O==4){if(v==8)for(b=0;b<y;b++){g=b<<2;var U=l[w=b<<1];C[g]=U,C[g+1]=U,C[g+2]=U,C[g+3]=l[w+1]}if(v==16)for(b=0;b<y;b++){var w;g=b<<2,U=l[w=b<<2],C[g]=U,C[g+1]=U,C[g+2]=U,C[g+3]=l[w+2]}}else if(O==0)for(m=f.tabs.tRNS?f.tabs.tRNS:-1,A=0;A<d;A++){const _=A*L,V=A*u;if(v==1)for(var p=0;p<u;p++){var M=(U=255*(l[_+(p>>>3)]>>>7-(7&p)&1))==255*m?0:255;R[V+p]=M<<24|U<<16|U<<8|U}else if(v==2)for(p=0;p<u;p++)M=(U=85*(l[_+(p>>>2)]>>>6-((3&p)<<1)&3))==85*m?0:255,R[V+p]=M<<24|U<<16|U<<8|U;else if(v==4)for(p=0;p<u;p++)M=(U=17*(l[_+(p>>>1)]>>>4-((1&p)<<2)&15))==17*m?0:255,R[V+p]=M<<24|U<<16|U<<8|U;else if(v==8)for(p=0;p<u;p++)M=(U=l[_+p])==m?0:255,R[V+p]=M<<24|U<<16|U<<8|U;else if(v==16)for(p=0;p<u;p++)U=l[_+(p<<1)],M=x(l,_+(p<<1))==m?0:255,R[V+p]=M<<24|U<<16|U<<8|U}return C}function t(l,u,d,f){const y=i(l),I=Math.ceil(d*y/8),L=new Uint8Array((I+1+l.interlace)*f);return u=l.tabs.CgBI?r(u,L):n(u,L),l.interlace==0?u=o(u,l,0,d,f):l.interlace==1&&(u=function(R,O){const v=O.width,x=O.height,b=i(O),B=b>>3,m=Math.ceil(v*b/8),g=new Uint8Array(x*m);let A=0;const N=[0,0,4,0,2,0,1],k=[0,4,0,2,0,1,0],T=[8,8,8,4,4,2,2],E=[8,8,4,4,2,2,1];let U=0;for(;U<7;){const p=T[U],M=E[U];let _=0,V=0,q=N[U];for(;q<x;)q+=p,V++;let W=k[U];for(;W<v;)W+=M,_++;const Z=Math.ceil(_*b/8);o(R,O,A,_,V);let H=0,S=N[U];for(;S<x;){let z=k[U],ce=A+H*Z<<3;for(;z<v;){var w;if(b==1&&(w=(w=R[ce>>3])>>7-(7&ce)&1,g[S*m+(z>>3)]|=w<<7-((7&z)<<0)),b==2&&(w=(w=R[ce>>3])>>6-(7&ce)&3,g[S*m+(z>>2)]|=w<<6-((3&z)<<1)),b==4&&(w=(w=R[ce>>3])>>4-(7&ce)&15,g[S*m+(z>>1)]|=w<<4-((1&z)<<2)),b>=8){const te=S*m+z*B;for(let Q=0;Q<B;Q++)g[te+Q]=R[(ce>>3)+Q]}ce+=b,z+=M}H++,S+=p}_*V!=0&&(A+=V*(1+Z)),U+=1}return g}(u,l)),u}function n(l,u){return r(new Uint8Array(l.buffer,2,l.length-6),u)}var r=function(){const l={H:{}};return l.H.N=function(u,d){const f=Uint8Array;let y,I,L=0,C=0,R=0,O=0,v=0,x=0,b=0,B=0,m=0;if(u[0]==3&&u[1]==0)return d||new f(0);const g=l.H,A=g.b,N=g.e,k=g.R,T=g.n,E=g.A,U=g.Z,w=g.m,p=d==null;for(p&&(d=new f(u.length>>>2<<5));L==0;)if(L=A(u,m,1),C=A(u,m+1,2),m+=3,C!=0){if(p&&(d=l.H.W(d,B+(1<<17))),C==1&&(y=w.J,I=w.h,x=511,b=31),C==2){R=N(u,m,5)+257,O=N(u,m+5,5)+1,v=N(u,m+10,4)+4,m+=14;let _=1;for(var M=0;M<38;M+=2)w.Q[M]=0,w.Q[M+1]=0;for(M=0;M<v;M++){const W=N(u,m+3*M,3);w.Q[1+(w.X[M]<<1)]=W,W>_&&(_=W)}m+=3*v,T(w.Q,_),E(w.Q,_,w.u),y=w.w,I=w.d,m=k(w.u,(1<<_)-1,R+O,u,m,w.v);const V=g.V(w.v,0,R,w.C);x=(1<<V)-1;const q=g.V(w.v,R,O,w.D);b=(1<<q)-1,T(w.C,V),E(w.C,V,y),T(w.D,q),E(w.D,q,I)}for(;;){const _=y[U(u,m)&x];m+=15&_;const V=_>>>4;if(!(V>>>8))d[B++]=V;else{if(V==256)break;{let q=B+V-254;if(V>264){const z=w.q[V-257];q=B+(z>>>3)+N(u,m,7&z),m+=7&z}const W=I[U(u,m)&b];m+=15&W;const Z=W>>>4,H=w.c[Z],S=(H>>>4)+A(u,m,15&H);for(m+=15&H;B<q;)d[B]=d[B++-S],d[B]=d[B++-S],d[B]=d[B++-S],d[B]=d[B++-S];B=q}}}}else{7&m&&(m+=8-(7&m));const _=4+(m>>>3),V=u[_-4]|u[_-3]<<8;p&&(d=l.H.W(d,B+V)),d.set(new f(u.buffer,u.byteOffset+_,V),B),m=_+V<<3,B+=V}return d.length==B?d:d.slice(0,B)},l.H.W=function(u,d){const f=u.length;if(d<=f)return u;const y=new Uint8Array(f<<1);return y.set(u,0),y},l.H.R=function(u,d,f,y,I,L){const C=l.H.e,R=l.H.Z;let O=0;for(;O<f;){const v=u[R(y,I)&d];I+=15&v;const x=v>>>4;if(x<=15)L[O]=x,O++;else{let b=0,B=0;x==16?(B=3+C(y,I,2),I+=2,b=L[O-1]):x==17?(B=3+C(y,I,3),I+=3):x==18&&(B=11+C(y,I,7),I+=7);const m=O+B;for(;O<m;)L[O]=b,O++}}return I},l.H.V=function(u,d,f,y){let I=0,L=0;const C=y.length>>>1;for(;L<f;){const R=u[L+d];y[L<<1]=0,y[1+(L<<1)]=R,R>I&&(I=R),L++}for(;L<C;)y[L<<1]=0,y[1+(L<<1)]=0,L++;return I},l.H.n=function(u,d){const f=l.H.m,y=u.length;let I,L,C,R;const O=f.j;for(var v=0;v<=d;v++)O[v]=0;for(v=1;v<y;v+=2)O[u[v]]++;const x=f.K;for(I=0,O[0]=0,L=1;L<=d;L++)I=I+O[L-1]<<1,x[L]=I;for(C=0;C<y;C+=2)R=u[C+1],R!=0&&(u[C]=x[R],x[R]++)},l.H.A=function(u,d,f){const y=u.length,I=l.H.m.r;for(let L=0;L<y;L+=2)if(u[L+1]!=0){const C=L>>1,R=u[L+1],O=C<<4|R,v=d-R;let x=u[L]<<v;const b=x+(1<<v);for(;x!=b;)f[I[x]>>>15-d]=O,x++}},l.H.l=function(u,d){const f=l.H.m.r,y=15-d;for(let I=0;I<u.length;I+=2){const L=u[I]<<d-u[I+1];u[I]=f[L]>>>y}},l.H.M=function(u,d,f){f<<=7&d;const y=d>>>3;u[y]|=f,u[y+1]|=f>>>8},l.H.I=function(u,d,f){f<<=7&d;const y=d>>>3;u[y]|=f,u[y+1]|=f>>>8,u[y+2]|=f>>>16},l.H.e=function(u,d,f){return(u[d>>>3]|u[1+(d>>>3)]<<8)>>>(7&d)&(1<<f)-1},l.H.b=function(u,d,f){return(u[d>>>3]|u[1+(d>>>3)]<<8|u[2+(d>>>3)]<<16)>>>(7&d)&(1<<f)-1},l.H.Z=function(u,d){return(u[d>>>3]|u[1+(d>>>3)]<<8|u[2+(d>>>3)]<<16)>>>(7&d)},l.H.i=function(u,d){return(u[d>>>3]|u[1+(d>>>3)]<<8|u[2+(d>>>3)]<<16|u[3+(d>>>3)]<<24)>>>(7&d)},l.H.m=function(){const u=Uint16Array,d=Uint32Array;return{K:new u(16),j:new u(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new u(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new d(32),J:new u(512),_:[],h:new u(32),$:[],w:new u(32768),C:[],v:[],d:new u(32768),D:[],u:new u(512),Q:[],r:new u(32768),s:new d(286),Y:new d(30),a:new d(19),t:new d(15e3),k:new u(65536),g:new u(32768)}}(),function(){const u=l.H.m;for(var d=0;d<32768;d++){let y=d;y=(2863311530&y)>>>1|(1431655765&y)<<1,y=(3435973836&y)>>>2|(858993459&y)<<2,y=(4042322160&y)>>>4|(252645135&y)<<4,y=(4278255360&y)>>>8|(16711935&y)<<8,u.r[d]=(y>>>16|y<<16)>>>17}function f(y,I,L){for(;I--!=0;)y.push(0,L)}for(d=0;d<32;d++)u.q[d]=u.S[d]<<3|u.T[d],u.c[d]=u.p[d]<<4|u.z[d];f(u._,144,8),f(u._,112,9),f(u._,24,7),f(u._,8,8),l.H.n(u._,9),l.H.A(u._,9,u.J),l.H.l(u._,9),f(u.$,32,5),l.H.n(u.$,5),l.H.A(u.$,5,u.h),l.H.l(u.$,5),f(u.Q,19,0),f(u.C,286,0),f(u.D,30,0),f(u.v,320,0)}(),l.H.N}();function i(l){return[1,null,3,1,2,null,4][l.ctype]*l.depth}function o(l,u,d,f,y){let I=i(u);const L=Math.ceil(f*I/8);let C,R;I=Math.ceil(I/8);let O=l[d],v=0;if(O>1&&(l[d]=[0,0,1][O-2]),O==3)for(v=I;v<L;v++)l[v+1]=l[v+1]+(l[v+1-I]>>>1)&255;for(let x=0;x<y;x++)if(C=d+x*L,R=C+x+1,O=l[R-1],v=0,O==0)for(;v<L;v++)l[C+v]=l[R+v];else if(O==1){for(;v<I;v++)l[C+v]=l[R+v];for(;v<L;v++)l[C+v]=l[R+v]+l[C+v-I]}else if(O==2)for(;v<L;v++)l[C+v]=l[R+v]+l[C+v-L];else if(O==3){for(;v<I;v++)l[C+v]=l[R+v]+(l[C+v-L]>>>1);for(;v<L;v++)l[C+v]=l[R+v]+(l[C+v-L]+l[C+v-I]>>>1)}else{for(;v<I;v++)l[C+v]=l[R+v]+a(0,l[C+v-L],0);for(;v<L;v++)l[C+v]=l[R+v]+a(l[C+v-I],l[C+v-L],l[C+v-I-L])}return l}function a(l,u,d){const f=l+u-d,y=f-l,I=f-u,L=f-d;return y*y<=I*I&&y*y<=L*L?l:I*I<=L*L?u:d}function c(l,u,d){d.width=s.readUint(l,u),u+=4,d.height=s.readUint(l,u),u+=4,d.depth=l[u],u++,d.ctype=l[u],u++,d.compress=l[u],u++,d.filter=l[u],u++,d.interlace=l[u],u++}function h(l,u,d,f,y,I,L,C,R){const O=Math.min(u,y),v=Math.min(d,I);let x=0,b=0;for(let U=0;U<v;U++)for(let w=0;w<O;w++)if(L>=0&&C>=0?(x=U*u+w<<2,b=(C+U)*y+L+w<<2):(x=(-C+U)*u-L+w<<2,b=U*y+w<<2),R==0)f[b]=l[x],f[b+1]=l[x+1],f[b+2]=l[x+2],f[b+3]=l[x+3];else if(R==1){var B=l[x+3]*.00392156862745098,m=l[x]*B,g=l[x+1]*B,A=l[x+2]*B,N=f[b+3]*(1/255),k=f[b]*N,T=f[b+1]*N,E=f[b+2]*N;const p=1-B,M=B+N*p,_=M==0?0:1/M;f[b+3]=255*M,f[b+0]=(m+k*p)*_,f[b+1]=(g+T*p)*_,f[b+2]=(A+E*p)*_}else if(R==2)B=l[x+3],m=l[x],g=l[x+1],A=l[x+2],N=f[b+3],k=f[b],T=f[b+1],E=f[b+2],B==N&&m==k&&g==T&&A==E?(f[b]=0,f[b+1]=0,f[b+2]=0,f[b+3]=0):(f[b]=m,f[b+1]=g,f[b+2]=A,f[b+3]=B);else if(R==3){if(B=l[x+3],m=l[x],g=l[x+1],A=l[x+2],N=f[b+3],k=f[b],T=f[b+1],E=f[b+2],B==N&&m==k&&g==T&&A==E)continue;if(B<220&&N>20)return!1}return!0}return{decode:function(u){const d=new Uint8Array(u);let f=8;const y=s,I=y.readUshort,L=y.readUint,C={tabs:{},frames:[]},R=new Uint8Array(d.length);let O,v=0,x=0;const b=[137,80,78,71,13,10,26,10];for(var B=0;B<8;B++)if(d[B]!=b[B])throw"The input is not a PNG file!";for(;f<d.length;){const U=y.readUint(d,f);f+=4;const w=y.readASCII(d,f,4);if(f+=4,w=="IHDR")c(d,f,C);else if(w=="iCCP"){for(var m=f;d[m]!=0;)m++;y.readASCII(d,f,m-f),d[m+1];const p=d.slice(m+2,f+U);let M=null;try{M=n(p)}catch{M=r(p)}C.tabs[w]=M}else if(w=="CgBI")C.tabs[w]=d.slice(f,f+4);else if(w=="IDAT"){for(B=0;B<U;B++)R[v+B]=d[f+B];v+=U}else if(w=="acTL")C.tabs[w]={num_frames:L(d,f),num_plays:L(d,f+4)},O=new Uint8Array(d.length);else if(w=="fcTL"){x!=0&&((E=C.frames[C.frames.length-1]).data=t(C,O.slice(0,x),E.rect.width,E.rect.height),x=0);const p={x:L(d,f+12),y:L(d,f+16),width:L(d,f+4),height:L(d,f+8)};let M=I(d,f+22);M=I(d,f+20)/(M==0?100:M);const _={rect:p,delay:Math.round(1e3*M),dispose:d[f+24],blend:d[f+25]};C.frames.push(_)}else if(w=="fdAT"){for(B=0;B<U-4;B++)O[x+B]=d[f+B+4];x+=U-4}else if(w=="pHYs")C.tabs[w]=[y.readUint(d,f),y.readUint(d,f+4),d[f+8]];else if(w=="cHRM")for(C.tabs[w]=[],B=0;B<8;B++)C.tabs[w].push(y.readUint(d,f+4*B));else if(w=="tEXt"||w=="zTXt"){C.tabs[w]==null&&(C.tabs[w]={});var g=y.nextZero(d,f),A=y.readASCII(d,f,g-f),N=f+U-g-1;if(w=="tEXt")T=y.readASCII(d,g+1,N);else{var k=n(d.slice(g+2,g+2+N));T=y.readUTF8(k,0,k.length)}C.tabs[w][A]=T}else if(w=="iTXt"){C.tabs[w]==null&&(C.tabs[w]={}),g=0,m=f,g=y.nextZero(d,m),A=y.readASCII(d,m,g-m);const p=d[m=g+1];var T;d[m+1],m+=2,g=y.nextZero(d,m),y.readASCII(d,m,g-m),m=g+1,g=y.nextZero(d,m),y.readUTF8(d,m,g-m),N=U-((m=g+1)-f),p==0?T=y.readUTF8(d,m,N):(k=n(d.slice(m,m+N)),T=y.readUTF8(k,0,k.length)),C.tabs[w][A]=T}else if(w=="PLTE")C.tabs[w]=y.readBytes(d,f,U);else if(w=="hIST"){const p=C.tabs.PLTE.length/3;for(C.tabs[w]=[],B=0;B<p;B++)C.tabs[w].push(I(d,f+2*B))}else if(w=="tRNS")C.ctype==3?C.tabs[w]=y.readBytes(d,f,U):C.ctype==0?C.tabs[w]=I(d,f):C.ctype==2&&(C.tabs[w]=[I(d,f),I(d,f+2),I(d,f+4)]);else if(w=="gAMA")C.tabs[w]=y.readUint(d,f)/1e5;else if(w=="sRGB")C.tabs[w]=d[f];else if(w=="bKGD")C.ctype==0||C.ctype==4?C.tabs[w]=[I(d,f)]:C.ctype==2||C.ctype==6?C.tabs[w]=[I(d,f),I(d,f+2),I(d,f+4)]:C.ctype==3&&(C.tabs[w]=d[f]);else if(w=="IEND")break;f+=U,y.readUint(d,f),f+=4}var E;return x!=0&&((E=C.frames[C.frames.length-1]).data=t(C,O.slice(0,x),E.rect.width,E.rect.height)),C.data=t(C,R,C.width,C.height),delete C.compress,delete C.interlace,delete C.filter,C},toRGBA8:function(u){const d=u.width,f=u.height;if(u.tabs.acTL==null)return[e(u.data,d,f,u).buffer];const y=[];u.frames[0].data==null&&(u.frames[0].data=u.data);const I=d*f*4,L=new Uint8Array(I),C=new Uint8Array(I),R=new Uint8Array(I);for(let v=0;v<u.frames.length;v++){const x=u.frames[v],b=x.rect.x,B=x.rect.y,m=x.rect.width,g=x.rect.height,A=e(x.data,m,g,u);if(v!=0)for(var O=0;O<I;O++)R[O]=L[O];if(x.blend==0?h(A,m,g,L,d,f,b,B,0):x.blend==1&&h(A,m,g,L,d,f,b,B,1),y.push(L.buffer.slice(0)),x.dispose!=0){if(x.dispose==1)h(C,m,g,L,d,f,b,B,0);else if(x.dispose==2)for(O=0;O<I;O++)L[O]=R[O]}}return y},_paeth:a,_copyTile:h,_bin:s}}();(function(){const{_copyTile:s}=Ye,{_bin:e}=Ye,t=Ye._paeth;var n={table:function(){const m=new Uint32Array(256);for(let g=0;g<256;g++){let A=g;for(let N=0;N<8;N++)1&A?A=3988292384^A>>>1:A>>>=1;m[g]=A}return m}(),update(m,g,A,N){for(let k=0;k<N;k++)m=n.table[255&(m^g[A+k])]^m>>>8;return m},crc:(m,g,A)=>4294967295^n.update(4294967295,m,g,A)};function r(m,g,A,N){g[A]+=m[0]*N>>4,g[A+1]+=m[1]*N>>4,g[A+2]+=m[2]*N>>4,g[A+3]+=m[3]*N>>4}function i(m){return Math.max(0,Math.min(255,m))}function o(m,g){const A=m[0]-g[0],N=m[1]-g[1],k=m[2]-g[2],T=m[3]-g[3];return A*A+N*N+k*k+T*T}function a(m,g,A,N,k,T,E){E==null&&(E=1);const U=N.length,w=[];for(var p=0;p<U;p++){const S=N[p];w.push([S>>>0&255,S>>>8&255,S>>>16&255,S>>>24&255])}for(p=0;p<U;p++){let S=4294967295;for(var M=0,_=0;_<U;_++){var V=o(w[p],w[_]);_!=p&&V<S&&(S=V,M=_)}}const q=new Uint32Array(k.buffer),W=new Int16Array(g*A*4),Z=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(p=0;p<Z.length;p++)Z[p]=255*((Z[p]+.5)/16-.5);for(let S=0;S<A;S++)for(let z=0;z<g;z++){var H;p=4*(S*g+z),E!=2?H=[i(m[p]+W[p]),i(m[p+1]+W[p+1]),i(m[p+2]+W[p+2]),i(m[p+3]+W[p+3])]:(V=Z[4*(3&S)+(3&z)],H=[i(m[p]+V),i(m[p+1]+V),i(m[p+2]+V),i(m[p+3]+V)]),M=0;let ce=16777215;for(_=0;_<U;_++){const ae=o(H,w[_]);ae<ce&&(ce=ae,M=_)}const te=w[M],Q=[H[0]-te[0],H[1]-te[1],H[2]-te[2],H[3]-te[3]];E==1&&(z!=g-1&&r(Q,W,p+4,7),S!=A-1&&(z!=0&&r(Q,W,p+4*g-4,3),r(Q,W,p+4*g,5),z!=g-1&&r(Q,W,p+4*g+4,1))),T[p>>2]=M,q[p>>2]=N[M]}}function c(m,g,A,N,k){k==null&&(k={});const{crc:T}=n,E=e.writeUint,U=e.writeUshort,w=e.writeASCII;let p=8;const M=m.frames.length>1;let _,V=!1,q=33+(M?20:0);if(k.sRGB!=null&&(q+=13),k.pHYs!=null&&(q+=21),k.iCCP!=null&&(_=pako.deflate(k.iCCP),q+=21+_.length+4),m.ctype==3){for(var W=m.plte.length,Z=0;Z<W;Z++)m.plte[Z]>>>24!=255&&(V=!0);q+=8+3*W+4+(V?8+1*W+4:0)}for(var H=0;H<m.frames.length;H++)M&&(q+=38),q+=(te=m.frames[H]).cimg.length+12,H!=0&&(q+=4);q+=12;const S=new Uint8Array(q),z=[137,80,78,71,13,10,26,10];for(Z=0;Z<8;Z++)S[Z]=z[Z];if(E(S,p,13),p+=4,w(S,p,"IHDR"),p+=4,E(S,p,g),p+=4,E(S,p,A),p+=4,S[p]=m.depth,p++,S[p]=m.ctype,p++,S[p]=0,p++,S[p]=0,p++,S[p]=0,p++,E(S,p,T(S,p-17,17)),p+=4,k.sRGB!=null&&(E(S,p,1),p+=4,w(S,p,"sRGB"),p+=4,S[p]=k.sRGB,p++,E(S,p,T(S,p-5,5)),p+=4),k.iCCP!=null){const Q=13+_.length;E(S,p,Q),p+=4,w(S,p,"iCCP"),p+=4,w(S,p,"ICC profile"),p+=11,p+=2,S.set(_,p),p+=_.length,E(S,p,T(S,p-(Q+4),Q+4)),p+=4}if(k.pHYs!=null&&(E(S,p,9),p+=4,w(S,p,"pHYs"),p+=4,E(S,p,k.pHYs[0]),p+=4,E(S,p,k.pHYs[1]),p+=4,S[p]=k.pHYs[2],p++,E(S,p,T(S,p-13,13)),p+=4),M&&(E(S,p,8),p+=4,w(S,p,"acTL"),p+=4,E(S,p,m.frames.length),p+=4,E(S,p,k.loop!=null?k.loop:0),p+=4,E(S,p,T(S,p-12,12)),p+=4),m.ctype==3){for(E(S,p,3*(W=m.plte.length)),p+=4,w(S,p,"PLTE"),p+=4,Z=0;Z<W;Z++){const Q=3*Z,ae=m.plte[Z],me=255&ae,ke=ae>>>8&255,bt=ae>>>16&255;S[p+Q+0]=me,S[p+Q+1]=ke,S[p+Q+2]=bt}if(p+=3*W,E(S,p,T(S,p-3*W-4,3*W+4)),p+=4,V){for(E(S,p,W),p+=4,w(S,p,"tRNS"),p+=4,Z=0;Z<W;Z++)S[p+Z]=m.plte[Z]>>>24&255;p+=W,E(S,p,T(S,p-W-4,W+4)),p+=4}}let ce=0;for(H=0;H<m.frames.length;H++){var te=m.frames[H];M&&(E(S,p,26),p+=4,w(S,p,"fcTL"),p+=4,E(S,p,ce++),p+=4,E(S,p,te.rect.width),p+=4,E(S,p,te.rect.height),p+=4,E(S,p,te.rect.x),p+=4,E(S,p,te.rect.y),p+=4,U(S,p,N[H]),p+=2,U(S,p,1e3),p+=2,S[p]=te.dispose,p++,S[p]=te.blend,p++,E(S,p,T(S,p-30,30)),p+=4);const Q=te.cimg;E(S,p,(W=Q.length)+(H==0?0:4)),p+=4;const ae=p;w(S,p,H==0?"IDAT":"fdAT"),p+=4,H!=0&&(E(S,p,ce++),p+=4),S.set(Q,p),p+=W,E(S,p,T(S,ae,p-ae)),p+=4}return E(S,p,0),p+=4,w(S,p,"IEND"),p+=4,E(S,p,T(S,p-4,4)),p+=4,S.buffer}function h(m,g,A){for(let N=0;N<m.frames.length;N++){const k=m.frames[N];k.rect.width;const T=k.rect.height,E=new Uint8Array(T*k.bpl+T);k.cimg=f(k.img,T,k.bpp,k.bpl,E,g,A)}}function l(m,g,A,N,k){const T=k[0],E=k[1],U=k[2],w=k[3],p=k[4],M=k[5];let _=6,V=8,q=255;for(var W=0;W<m.length;W++){const Le=new Uint8Array(m[W]);for(var Z=Le.length,H=0;H<Z;H+=4)q&=Le[H+3]}const S=q!=255,z=function(de,re,ye,Te,be,Ue){const ge=[];for(var Y=0;Y<de.length;Y++){const Be=new Uint8Array(de[Y]),We=new Uint32Array(Be.buffer);var He;let Me=0,Ve=0,nt=re,ut=ye,Kt=Te?1:0;if(Y!=0){const Fn=Ue||Te||Y==1||ge[Y-2].dispose!=0?1:2;let zt=0,ue=1e9;for(let Xe=0;Xe<Fn;Xe++){var Re=new Uint8Array(de[Y-1-Xe]);const ft=new Uint32Array(de[Y-1-Xe]);let xt=re,_t=ye,Xt=-1,rn=-1;for(let Dt=0;Dt<ye;Dt++)for(let Rt=0;Rt<re;Rt++)We[Ne=Dt*re+Rt]!=ft[Ne]&&(Rt<xt&&(xt=Rt),Rt>Xt&&(Xt=Rt),Dt<_t&&(_t=Dt),Dt>rn&&(rn=Dt));Xt==-1&&(xt=_t=Xt=rn=0),be&&((1&xt)==1&&xt--,(1&_t)==1&&_t--);const Zr=(Xt-xt+1)*(rn-_t+1);Zr<ue&&(ue=Zr,zt=Xe,Me=xt,Ve=_t,nt=Xt-xt+1,ut=rn-_t+1)}Re=new Uint8Array(de[Y-1-zt]),zt==1&&(ge[Y-1].dispose=2),He=new Uint8Array(nt*ut*4),s(Re,re,ye,He,nt,ut,-Me,-Ve,0),Kt=s(Be,re,ye,He,nt,ut,-Me,-Ve,3)?1:0,Kt==1?d(Be,re,ye,He,{x:Me,y:Ve,width:nt,height:ut}):s(Be,re,ye,He,nt,ut,-Me,-Ve,0)}else He=Be.slice(0);ge.push({rect:{x:Me,y:Ve,width:nt,height:ut},img:He,blend:Kt,dispose:0})}if(Te)for(Y=0;Y<ge.length;Y++){if((ht=ge[Y]).blend==1)continue;const Be=ht.rect,We=ge[Y-1].rect,Me=Math.min(Be.x,We.x),Ve=Math.min(Be.y,We.y),nt={x:Me,y:Ve,width:Math.max(Be.x+Be.width,We.x+We.width)-Me,height:Math.max(Be.y+Be.height,We.y+We.height)-Ve};ge[Y-1].dispose=1,Y-1!=0&&u(de,re,ye,ge,Y-1,nt,be),u(de,re,ye,ge,Y,nt,be)}let dt=0;if(de.length!=1)for(var Ne=0;Ne<ge.length;Ne++){var ht;dt+=(ht=ge[Ne]).rect.width*ht.rect.height}return ge}(m,g,A,T,E,U),ce={},te=[],Q=[];if(N!=0){const Le=[];for(H=0;H<z.length;H++)Le.push(z[H].img.buffer);const de=function(be){let Ue=0;for(var ge=0;ge<be.length;ge++)Ue+=be[ge].byteLength;const Y=new Uint8Array(Ue);let He=0;for(ge=0;ge<be.length;ge++){const Re=new Uint8Array(be[ge]),dt=Re.length;for(let Ne=0;Ne<dt;Ne+=4){let ht=Re[Ne],Be=Re[Ne+1],We=Re[Ne+2];const Me=Re[Ne+3];Me==0&&(ht=Be=We=0),Y[He+Ne]=ht,Y[He+Ne+1]=Be,Y[He+Ne+2]=We,Y[He+Ne+3]=Me}He+=dt}return Y.buffer}(Le),re=I(de,N);for(H=0;H<re.plte.length;H++)te.push(re.plte[H].est.rgba);let ye=0;for(H=0;H<z.length;H++){const Te=(me=z[H]).img.length;var ae=new Uint8Array(re.inds.buffer,ye>>2,Te>>2);Q.push(ae);const be=new Uint8Array(re.abuf,ye,Te);M&&a(me.img,me.rect.width,me.rect.height,te,be,ae),me.img.set(be),ye+=Te}}else for(W=0;W<z.length;W++){var me=z[W];const Le=new Uint32Array(me.img.buffer);var ke=me.rect.width;for(Z=Le.length,ae=new Uint8Array(Z),Q.push(ae),H=0;H<Z;H++){const de=Le[H];if(H!=0&&de==Le[H-1])ae[H]=ae[H-1];else if(H>ke&&de==Le[H-ke])ae[H]=ae[H-ke];else{let re=ce[de];if(re==null&&(ce[de]=re=te.length,te.push(de),te.length>=300))break;ae[H]=re}}}const bt=te.length;for(bt<=256&&p==0&&(V=bt<=2?1:bt<=4?2:bt<=16?4:8,V=Math.max(V,w)),W=0;W<z.length;W++){(me=z[W]).rect.x,me.rect.y,ke=me.rect.width;const Le=me.rect.height;let de=me.img;new Uint32Array(de.buffer);let re=4*ke,ye=4;if(bt<=256&&p==0){re=Math.ceil(V*ke/8);var ze=new Uint8Array(re*Le);const Te=Q[W];for(let be=0;be<Le;be++){H=be*re;const Ue=be*ke;if(V==8)for(var fe=0;fe<ke;fe++)ze[H+fe]=Te[Ue+fe];else if(V==4)for(fe=0;fe<ke;fe++)ze[H+(fe>>1)]|=Te[Ue+fe]<<4-4*(1&fe);else if(V==2)for(fe=0;fe<ke;fe++)ze[H+(fe>>2)]|=Te[Ue+fe]<<6-2*(3&fe);else if(V==1)for(fe=0;fe<ke;fe++)ze[H+(fe>>3)]|=Te[Ue+fe]<<7-1*(7&fe)}de=ze,_=3,ye=1}else if(S==0&&z.length==1){ze=new Uint8Array(ke*Le*3);const Te=ke*Le;for(H=0;H<Te;H++){const be=3*H,Ue=4*H;ze[be]=de[Ue],ze[be+1]=de[Ue+1],ze[be+2]=de[Ue+2]}de=ze,_=2,ye=3,re=3*ke}me.img=de,me.bpl=re,me.bpp=ye}return{ctype:_,depth:V,plte:te,frames:z}}function u(m,g,A,N,k,T,E){const U=Uint8Array,w=Uint32Array,p=new U(m[k-1]),M=new w(m[k-1]),_=k+1<m.length?new U(m[k+1]):null,V=new U(m[k]),q=new w(V.buffer);let W=g,Z=A,H=-1,S=-1;for(let ce=0;ce<T.height;ce++)for(let te=0;te<T.width;te++){const Q=T.x+te,ae=T.y+ce,me=ae*g+Q,ke=q[me];ke==0||N[k-1].dispose==0&&M[me]==ke&&(_==null||_[4*me+3]!=0)||(Q<W&&(W=Q),Q>H&&(H=Q),ae<Z&&(Z=ae),ae>S&&(S=ae))}H==-1&&(W=Z=H=S=0),E&&((1&W)==1&&W--,(1&Z)==1&&Z--),T={x:W,y:Z,width:H-W+1,height:S-Z+1};const z=N[k];z.rect=T,z.blend=1,z.img=new Uint8Array(T.width*T.height*4),N[k-1].dispose==0?(s(p,g,A,z.img,T.width,T.height,-T.x,-T.y,0),d(V,g,A,z.img,T)):s(V,g,A,z.img,T.width,T.height,-T.x,-T.y,0)}function d(m,g,A,N,k){s(m,g,A,N,k.width,k.height,-k.x,-k.y,2)}function f(m,g,A,N,k,T,E){const U=[];let w,p=[0,1,2,3,4];T!=-1?p=[T]:(g*N>5e5||A==1)&&(p=[0]),E&&(w={level:0});const M=Ts;for(var _=0;_<p.length;_++){for(let W=0;W<g;W++)y(k,m,W,N,A,p[_]);U.push(M.deflate(k,w))}let V,q=1e9;for(_=0;_<U.length;_++)U[_].length<q&&(V=_,q=U[_].length);return U[V]}function y(m,g,A,N,k,T){const E=A*N;let U=E+A;if(m[U]=T,U++,T==0)if(N<500)for(var w=0;w<N;w++)m[U+w]=g[E+w];else m.set(new Uint8Array(g.buffer,E,N),U);else if(T==1){for(w=0;w<k;w++)m[U+w]=g[E+w];for(w=k;w<N;w++)m[U+w]=g[E+w]-g[E+w-k]+256&255}else if(A==0){for(w=0;w<k;w++)m[U+w]=g[E+w];if(T==2)for(w=k;w<N;w++)m[U+w]=g[E+w];if(T==3)for(w=k;w<N;w++)m[U+w]=g[E+w]-(g[E+w-k]>>1)+256&255;if(T==4)for(w=k;w<N;w++)m[U+w]=g[E+w]-t(g[E+w-k],0,0)+256&255}else{if(T==2)for(w=0;w<N;w++)m[U+w]=g[E+w]+256-g[E+w-N]&255;if(T==3){for(w=0;w<k;w++)m[U+w]=g[E+w]+256-(g[E+w-N]>>1)&255;for(w=k;w<N;w++)m[U+w]=g[E+w]+256-(g[E+w-N]+g[E+w-k]>>1)&255}if(T==4){for(w=0;w<k;w++)m[U+w]=g[E+w]+256-t(0,g[E+w-N],0)&255;for(w=k;w<N;w++)m[U+w]=g[E+w]+256-t(g[E+w-k],g[E+w-N],g[E+w-k-N])&255}}}function I(m,g){const A=new Uint8Array(m),N=A.slice(0),k=new Uint32Array(N.buffer),T=L(N,g),E=T[0],U=T[1],w=A.length,p=new Uint8Array(w>>2);let M;if(A.length<2e7)for(var _=0;_<w;_+=4)M=C(E,V=A[_]*(1/255),q=A[_+1]*(1/255),W=A[_+2]*(1/255),Z=A[_+3]*(1/255)),p[_>>2]=M.ind,k[_>>2]=M.est.rgba;else for(_=0;_<w;_+=4){var V=A[_]*.00392156862745098,q=A[_+1]*(1/255),W=A[_+2]*(1/255),Z=A[_+3]*(1/255);for(M=E;M.left;)M=R(M.est,V,q,W,Z)<=0?M.left:M.right;p[_>>2]=M.ind,k[_>>2]=M.est.rgba}return{abuf:N.buffer,inds:p,plte:U}}function L(m,g,A){A==null&&(A=1e-4);const N=new Uint32Array(m.buffer),k={i0:0,i1:m.length,bst:null,est:null,tdst:0,left:null,right:null};k.bst=x(m,k.i0,k.i1),k.est=b(k.bst);const T=[k];for(;T.length<g;){let U=0,w=0;for(var E=0;E<T.length;E++)T[E].est.L>U&&(U=T[E].est.L,w=E);if(U<A)break;const p=T[w],M=O(m,N,p.i0,p.i1,p.est.e,p.est.eMq255);if(p.i0>=M||p.i1<=M){p.est.L=0;continue}const _={i0:p.i0,i1:M,bst:null,est:null,tdst:0,left:null,right:null};_.bst=x(m,_.i0,_.i1),_.est=b(_.bst);const V={i0:M,i1:p.i1,bst:null,est:null,tdst:0,left:null,right:null};for(V.bst={R:[],m:[],N:p.bst.N-_.bst.N},E=0;E<16;E++)V.bst.R[E]=p.bst.R[E]-_.bst.R[E];for(E=0;E<4;E++)V.bst.m[E]=p.bst.m[E]-_.bst.m[E];V.est=b(V.bst),p.left=_,p.right=V,T[w]=_,T.push(V)}for(T.sort((U,w)=>w.bst.N-U.bst.N),E=0;E<T.length;E++)T[E].ind=E;return[k,T]}function C(m,g,A,N,k){if(m.left==null)return m.tdst=function(_,V,q,W,Z){const H=V-_[0],S=q-_[1],z=W-_[2],ce=Z-_[3];return H*H+S*S+z*z+ce*ce}(m.est.q,g,A,N,k),m;const T=R(m.est,g,A,N,k);let E=m.left,U=m.right;T>0&&(E=m.right,U=m.left);const w=C(E,g,A,N,k);if(w.tdst<=T*T)return w;const p=C(U,g,A,N,k);return p.tdst<w.tdst?p:w}function R(m,g,A,N,k){const{e:T}=m;return T[0]*g+T[1]*A+T[2]*N+T[3]*k-m.eMq}function O(m,g,A,N,k,T){for(N-=4;A<N;){for(;v(m,A,k)<=T;)A+=4;for(;v(m,N,k)>T;)N-=4;if(A>=N)break;const E=g[A>>2];g[A>>2]=g[N>>2],g[N>>2]=E,A+=4,N-=4}for(;v(m,A,k)>T;)A-=4;return A+4}function v(m,g,A){return m[g]*A[0]+m[g+1]*A[1]+m[g+2]*A[2]+m[g+3]*A[3]}function x(m,g,A){const N=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],k=[0,0,0,0],T=A-g>>2;for(let E=g;E<A;E+=4){const U=m[E]*.00392156862745098,w=m[E+1]*(1/255),p=m[E+2]*(1/255),M=m[E+3]*(1/255);k[0]+=U,k[1]+=w,k[2]+=p,k[3]+=M,N[0]+=U*U,N[1]+=U*w,N[2]+=U*p,N[3]+=U*M,N[5]+=w*w,N[6]+=w*p,N[7]+=w*M,N[10]+=p*p,N[11]+=p*M,N[15]+=M*M}return N[4]=N[1],N[8]=N[2],N[9]=N[6],N[12]=N[3],N[13]=N[7],N[14]=N[11],{R:N,m:k,N:T}}function b(m){const{R:g}=m,{m:A}=m,{N}=m,k=A[0],T=A[1],E=A[2],U=A[3],w=N==0?0:1/N,p=[g[0]-k*k*w,g[1]-k*T*w,g[2]-k*E*w,g[3]-k*U*w,g[4]-T*k*w,g[5]-T*T*w,g[6]-T*E*w,g[7]-T*U*w,g[8]-E*k*w,g[9]-E*T*w,g[10]-E*E*w,g[11]-E*U*w,g[12]-U*k*w,g[13]-U*T*w,g[14]-U*E*w,g[15]-U*U*w],M=p,_=B;let V=[Math.random(),Math.random(),Math.random(),Math.random()],q=0,W=0;if(N!=0)for(let H=0;H<16&&(V=_.multVec(M,V),W=Math.sqrt(_.dot(V,V)),V=_.sml(1/W,V),!(H!=0&&Math.abs(W-q)<1e-9));H++)q=W;const Z=[k*w,T*w,E*w,U*w];return{Cov:p,q:Z,e:V,L:q,eMq255:_.dot(_.sml(255,Z),V),eMq:_.dot(V,Z),rgba:(Math.round(255*Z[3])<<24|Math.round(255*Z[2])<<16|Math.round(255*Z[1])<<8|Math.round(255*Z[0])<<0)>>>0}}var B={multVec:(m,g)=>[m[0]*g[0]+m[1]*g[1]+m[2]*g[2]+m[3]*g[3],m[4]*g[0]+m[5]*g[1]+m[6]*g[2]+m[7]*g[3],m[8]*g[0]+m[9]*g[1]+m[10]*g[2]+m[11]*g[3],m[12]*g[0]+m[13]*g[1]+m[14]*g[2]+m[15]*g[3]],dot:(m,g)=>m[0]*g[0]+m[1]*g[1]+m[2]*g[2]+m[3]*g[3],sml:(m,g)=>[m*g[0],m*g[1],m*g[2],m*g[3]]};Ye.encode=function(g,A,N,k,T,E,U){k==null&&(k=0),U==null&&(U=!1);const w=l(g,A,N,k,[!1,!1,!1,0,U,!1]);return h(w,-1),c(w,A,N,T,E)},Ye.encodeLL=function(g,A,N,k,T,E,U,w){const p={ctype:0+(k==1?0:2)+(T==0?0:4),depth:E,frames:[]},M=(k+T)*E,_=M*A;for(let V=0;V<g.length;V++)p.frames.push({rect:{x:0,y:0,width:A,height:N},img:new Uint8Array(g[V]),blend:0,dispose:1,bpp:Math.ceil(M/8),bpl:Math.ceil(_/8)});return h(p,0,!0),c(p,A,N,U,w)},Ye.encode.compress=l,Ye.encode.dither=a,Ye.quantize=I,Ye.quantize.getKDtree=L,Ye.quantize.getNearest=C})();const Ur={toArrayBuffer(s,e){const t=s.width,n=s.height,r=t<<2,i=s.getContext("2d").getImageData(0,0,t,n),o=new Uint32Array(i.data.buffer),a=(32*t+31)/32<<2,c=a*n,h=122+c,l=new ArrayBuffer(h),u=new DataView(l),d=1<<20;let f,y,I,L,C=d,R=0,O=0,v=0;function x(m){u.setUint16(O,m,!0),O+=2}function b(m){u.setUint32(O,m,!0),O+=4}function B(m){O+=m}x(19778),b(h),B(4),b(122),b(108),b(t),b(-n>>>0),x(1),x(32),b(3),b(c),b(2835),b(2835),B(8),b(16711680),b(65280),b(255),b(4278190080),b(1466527264),function m(){for(;R<n&&C>0;){for(L=122+R*a,f=0;f<r;)C--,y=o[v++],I=y>>>24,u.setUint32(L+f,y<<8|I),f+=4;R++}v<o.length?(C=d,setTimeout(m,Ur._dly)):e(l)}()},toBlob(s,e){this.toArrayBuffer(s,t=>{e(new Blob([t],{type:"image/bmp"}))})},_dly:9};var $e={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},xs={[$e.CHROME]:16384,[$e.FIREFOX]:11180,[$e.DESKTOP_SAFARI]:16384,[$e.IE]:8192,[$e.IOS]:4096,[$e.ETC]:8192};const Wn=typeof window<"u",Br=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,wn=Wn&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),_s=(Wn||Br)&&(wn&&wn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Or=(Wn||Br)&&(wn&&wn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Pn(s,e,t=Date.now()){return new Promise(n=>{const r=s.split(","),i=r[0].match(/:(.*?);/)[1],o=globalThis.atob(r[1]);let a=o.length;const c=new Uint8Array(a);for(;a--;)c[a]=o.charCodeAt(a);const h=new Blob([c],{type:i});h.name=e,h.lastModified=t,n(h)})}function Sr(s){return new Promise((e,t)=>{const n=new Or;n.onload=()=>e(n.result),n.onerror=r=>t(r),n.readAsDataURL(s)})}function Dr(s){return new Promise((e,t)=>{const n=new Image;n.onload=()=>e(n),n.onerror=r=>t(r),n.src=s})}function Bt(){if(Bt.cachedResult!==void 0)return Bt.cachedResult;let s=$e.ETC;const{userAgent:e}=navigator;return/Chrom(e|ium)/i.test(e)?s=$e.CHROME:/iP(ad|od|hone)/i.test(e)&&/WebKit/i.test(e)?s=$e.IOS:/Safari/i.test(e)?s=$e.DESKTOP_SAFARI:/Firefox/i.test(e)?s=$e.FIREFOX:(/MSIE/i.test(e)||document.documentMode)&&(s=$e.IE),Bt.cachedResult=s,Bt.cachedResult}function Rr(s,e){const t=Bt(),n=xs[t];let r=s,i=e,o=r*i;const a=r>i?i/r:r/i;for(;o>n*n;){const c=(n+r)/2,h=(n+i)/2;c<h?(i=h,r=h*a):(i=c*a,r=c),o=r*i}return{width:r,height:i}}function yn(s,e){let t,n;try{if(t=new OffscreenCanvas(s,e),n=t.getContext("2d"),n===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{t=document.createElement("canvas"),n=t.getContext("2d")}return t.width=s,t.height=e,[t,n]}function Mr(s,e){const{width:t,height:n}=Rr(s.width,s.height),[r,i]=yn(t,n);return e&&/jpe?g/.test(e)&&(i.fillStyle="white",i.fillRect(0,0,r.width,r.height)),i.drawImage(s,0,0,r.width,r.height),r}function bn(){return bn.cachedResult!==void 0||(bn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),bn.cachedResult}function Cn(s,e={}){return new Promise(function(t,n){let r,i;var o=function(){try{return i=Mr(r,e.fileType||s.type),t([r,i])}catch(c){return n(c)}},a=function(c){try{var h=function(l){try{throw l}catch(u){return n(u)}};try{let l;return Sr(s).then(function(u){try{return l=u,Dr(l).then(function(d){try{return r=d,function(){try{return o()}catch(f){return n(f)}}()}catch(f){return h(f)}},h)}catch(d){return h(d)}},h)}catch(l){h(l)}}catch(l){return n(l)}};try{if(bn()||[$e.DESKTOP_SAFARI,$e.MOBILE_SAFARI].includes(Bt()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(s).then(function(c){try{return r=c,o()}catch{return a()}},a)}catch{a()}})}function En(s,e,t,n,r=1){return new Promise(function(i,o){let a;if(e==="image/png"){let h,l,u;return h=s.getContext("2d"),{data:l}=h.getImageData(0,0,s.width,s.height),u=Ye.encode([l.buffer],s.width,s.height,4096*r),a=new Blob([u],{type:e}),a.name=t,a.lastModified=n,c.call(this)}{let h=function(){return c.call(this)};if(e==="image/bmp")return new Promise(l=>Ur.toBlob(s,l)).then((function(l){try{return a=l,a.name=t,a.lastModified=n,h.call(this)}catch(u){return o(u)}}).bind(this),o);{let l=function(){return h.call(this)};if(typeof OffscreenCanvas=="function"&&s instanceof OffscreenCanvas)return s.convertToBlob({type:e,quality:r}).then((function(u){try{return a=u,a.name=t,a.lastModified=n,l.call(this)}catch(d){return o(d)}}).bind(this),o);{let u;return u=s.toDataURL(e,r),Pn(u,t,n).then((function(d){try{return a=d,l.call(this)}catch(f){return o(f)}}).bind(this),o)}}}function c(){return i(a)}})}function st(s){s.width=0,s.height=0}function Vt(){return new Promise(function(s,e){let t,n,r,i;return Vt.cachedResult!==void 0?s(Vt.cachedResult):Pn("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then(function(o){try{return t=o,Cn(t).then(function(a){try{return n=a[1],En(n,t.type,t.name,t.lastModified).then(function(c){try{return r=c,st(n),Cn(r).then(function(h){try{return i=h[0],Vt.cachedResult=i.width===1&&i.height===2,s(Vt.cachedResult)}catch(l){return e(l)}},e)}catch(h){return e(h)}},e)}catch(c){return e(c)}},e)}catch(a){return e(a)}},e)})}function Vr(s){return new Promise((e,t)=>{const n=new Or;n.onload=r=>{const i=new DataView(r.target.result);if(i.getUint16(0,!1)!=65496)return e(-2);const o=i.byteLength;let a=2;for(;a<o;){if(i.getUint16(a+2,!1)<=8)return e(-1);const c=i.getUint16(a,!1);if(a+=2,c==65505){if(i.getUint32(a+=2,!1)!=1165519206)return e(-1);const h=i.getUint16(a+=6,!1)==18761;a+=i.getUint32(a+4,h);const l=i.getUint16(a,h);a+=2;for(let u=0;u<l;u++)if(i.getUint16(a+12*u,h)==274)return e(i.getUint16(a+12*u+8,h))}else{if((65280&c)!=65280)break;a+=i.getUint16(a,!1)}}return e(-1)},n.onerror=r=>t(r),n.readAsArrayBuffer(s)})}function Hr(s,e){const{width:t}=s,{height:n}=s,{maxWidthOrHeight:r}=e;let i,o=s;return isFinite(r)&&(t>r||n>r)&&([o,i]=yn(t,n),t>n?(o.width=r,o.height=n/t*r):(o.width=t/n*r,o.height=r),i.drawImage(s,0,0,o.width,o.height),st(s)),o}function $r(s,e){const{width:t}=s,{height:n}=s,[r,i]=yn(t,n);switch(e>4&&e<9?(r.width=n,r.height=t):(r.width=t,r.height=n),e){case 2:i.transform(-1,0,0,1,t,0);break;case 3:i.transform(-1,0,0,-1,t,n);break;case 4:i.transform(1,0,0,-1,0,n);break;case 5:i.transform(0,1,1,0,0,0);break;case 6:i.transform(0,1,-1,0,n,0);break;case 7:i.transform(0,-1,-1,0,n,t);break;case 8:i.transform(0,-1,1,0,0,t)}return i.drawImage(s,0,0,t,n),st(s),r}function Wr(s,e,t=0){return new Promise(function(n,r){let i,o,a,c,h,l,u,d,f,y,I,L,C,R,O,v,x,b,B,m;function g(N=5){if(e.signal&&e.signal.aborted)throw e.signal.reason;i+=N,e.onProgress(Math.min(i,100))}function A(N){if(e.signal&&e.signal.aborted)throw e.signal.reason;i=Math.min(Math.max(N,i),100),e.onProgress(i)}return i=t,o=e.maxIteration||10,a=1024*e.maxSizeMB*1024,g(),Cn(s,e).then((function(N){try{return[,c]=N,g(),h=Hr(c,e),g(),new Promise(function(k,T){var E;if(!(E=e.exifOrientation))return Vr(s).then((function(w){try{return E=w,U.call(this)}catch(p){return T(p)}}).bind(this),T);function U(){return k(E)}return U.call(this)}).then((function(k){try{return l=k,g(),Vt().then((function(T){try{return u=T?h:$r(h,l),g(),d=e.initialQuality||1,f=e.fileType||s.type,En(u,f,s.name,s.lastModified,d).then((function(E){try{{let w=function(){if(o--&&(O>a||O>C)){let M,_;return M=m?.95*B.width:B.width,_=m?.95*B.height:B.height,[x,b]=yn(M,_),b.drawImage(B,0,0,M,_),d*=f==="image/png"?.85:.95,En(x,f,s.name,s.lastModified,d).then(function(V){try{return v=V,st(B),B=x,O=v.size,A(Math.min(99,Math.floor((R-O)/(R-a)*100))),w}catch(q){return r(q)}},r)}return[1]},p=function(){return st(B),st(x),st(h),st(u),st(c),A(100),n(v)};if(y=E,g(),I=y.size>a,L=y.size>s.size,!I&&!L)return A(100),n(y);var U;return C=s.size,R=y.size,O=R,B=u,m=!e.alwaysKeepResolution&&I,(U=(function(M){for(;M;){if(M.then)return void M.then(U,r);try{if(M.pop){if(M.length)return M.pop()?p.call(this):M;M=w}else M=M.call(this)}catch(_){return r(_)}}}).bind(this))(w)}}catch(w){return r(w)}}).bind(this),r)}catch(E){return r(E)}}).bind(this),r)}catch(T){return r(T)}}).bind(this),r)}catch(k){return r(k)}}).bind(this),r)})}const Us=`
6
6
  let scriptImported = false
7
7
  self.addEventListener('message', async (e) => {
8
8
  const { file, id, imageCompressionLibUrl, options } = e.data
@@ -21,7 +21,7 @@ self.addEventListener('message', async (e) => {
21
21
  self.postMessage({ error: e.message + '\\n' + e.stack, id })
22
22
  }
23
23
  })
24
- `;let jn;function Bs(s,e){return new Promise((t,n)=>{jn||(jn=function(o){const a=[];return a.push(o),URL.createObjectURL(new Blob(a))}(Us));const r=new Worker(jn);r.addEventListener("message",function(o){if(e.signal&&e.signal.aborted)r.terminate();else if(o.data.progress===void 0){if(o.data.error)return n(new Error(o.data.error)),void r.terminate();t(o.data.file),r.terminate()}else e.onProgress(o.data.progress)}),r.addEventListener("error",n),e.signal&&e.signal.addEventListener("abort",()=>{n(e.signal.reason),r.terminate()}),r.postMessage({file:s,imageCompressionLibUrl:e.libURL,options:{...e,onProgress:void 0,signal:void 0}})})}function Se(s,e){return new Promise(function(t,n){let r,i,o,a,c,h;if(r={...e},o=0,{onProgress:a}=r,r.maxSizeMB=r.maxSizeMB||Number.POSITIVE_INFINITY,c=typeof r.useWebWorker!="boolean"||r.useWebWorker,delete r.useWebWorker,r.onProgress=f=>{o=f,typeof a=="function"&&a(o)},!(s instanceof Blob||s instanceof _s))return n(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(s.type))return n(new Error("The file given is not an image"));if(h=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!c||typeof Worker!="function"||h)return Wr(s,r).then((function(f){try{return i=f,d.call(this)}catch(y){return n(y)}}).bind(this),n);var l=(function(){try{return d.call(this)}catch(f){return n(f)}}).bind(this),u=function(f){try{return Wr(s,r).then(function(y){try{return i=y,l()}catch(I){return n(I)}},n)}catch(y){return n(y)}};try{return r.libURL=r.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Bs(s,r).then(function(f){try{return i=f,l()}catch{return u()}},u)}catch{u()}function d(){try{i.name=s.name,i.lastModified=s.lastModified}catch{}try{r.preserveExif&&s.type==="image/jpeg"&&(!r.fileType||r.fileType&&r.fileType===s.type)&&(i=_r(s,i))}catch{}return t(i)}})}Se.getDataUrlFromFile=Sr,Se.getFilefromDataUrl=Pn,Se.loadImage=Dr,Se.drawImageInCanvas=Mr,Se.drawFileInCanvas=Cn,Se.canvasToFile=En,Se.getExifOrientation=Vr,Se.handleMaxWidthOrHeight=Hr,Se.followExifOrientation=$r,Se.cleanupCanvasMemory=st,Se.isAutoOrientationInBrowser=Vt,Se.approximateBelowMaximumCanvasSizeOfBrowser=Rr,Se.copyExifWithoutOrientation=_r,Se.getBrowserName=Bt,Se.version="2.0.2";const Pr=async(s,e,t,n=!0)=>{try{const r=Os(s,e),o=(await Fs(e==null?void 0:e.type,t,n)).response.url;return await fetch(o,{method:"PUT",headers:{"Content-Type":e==null?void 0:e.type,"x-amz-acl":"public-read"},body:r}),o==null?void 0:o.split("?")[0]}catch(r){throw r}},Os=(s,e)=>{const t=e.type.split("/")[0];let n="";t==="video"?n=s==null?void 0:s.replace(/^data:video\/\w+;base64,/,""):t==="image"?n=s==null?void 0:s.replace(/^data:image\/\w+;base64,/,""):t==="audio"&&(n=s==null?void 0:s.replace(/^data:audio\/\w+;base64,/,""));const r=atob(n),i=new Uint8Array(r.length);for(let o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return i};async function jr(s){const e={maxSizeMB:2,maxWidthOrHeight:1920,useWebWorker:!0};try{return await Se(s,e)}catch(t){throw Error(t)}}class Ss{constructor(e){X(this,At);X(this,Ae);X(this,ve);X(this,mt);X(this,we,[]);X(this,Ie,[]);X(this,ot);X(this,je);X(this,Ot);X(this,vt);X(this,at,[]);X(this,tt);X(this,kt);X(this,$t);X(this,Yt);X(this,Ft);X(this,Nt);X(this,gt);X(this,St);X(this,lt);X(this,ct);X(this,It);X(this,Lt);X(this,wt);X(this,Wt);X(this,en);X(this,De);X(this,yt);X(this,tn,!1);X(this,An);X(this,nn);X(this,_e);X(this,Pt);X(this,Tt);X(this,jt);X(this,vn);X(this,kn);X(this,Zt);$(this,nn,e.isAdmin),$(this,ot,!1),$(this,$t,e.handleUpload.bind(this)),$(this,Yt,e.handleCancel.bind(this)),$(this,en,e.accessToken),$(this,jt,e==null?void 0:e.mode),this._grpcOptionInitializer(),this._init(e).then(()=>{$(this,tn,!0),this._renderView(e),this.updateWindowObject({initialized:!0}),this._initializeGrpcConfig(e.mode,e.endPoint)})}async _init(e){try{const{mode:t}=e;this.updateWindowObject({mode:t})}catch{throw Error("Initialization failed")}}_isAdminOptions(e){return e.isAdmin===!0}_renderView(e){return this._isAdminOptions(e)?($(this,je,!1),$(this,Ot,!1),$(this,Ft,0),$(this,ct,""),$(this,wt,!1),$(this,jt,e.mode),$(this,It,!1),$(this,Tt,""),$(this,yt,null),this._removeToastContainer(),this._renderAdminView(e)):($(this,Pt,""),$(this,vn,e.restrictedFileSize),$(this,kn,e==null?void 0:e.localizedFileRestrictedMessage),$(this,Zt,e==null?void 0:e.localizedErrorMessage),this._removeUserToast(),this._renderUserView(e))}_renderAdminView(e){if(!F(this,tn))return;const{parentContainerId:t}=e;if(e.isAdmin===!0)var{buttonProps:n}=e;$(this,At,document.getElementById(t));const r=document.createElement("button");r.className=n!=null&&n.buttonClass?n==null?void 0:n.buttonClass:"browse-image-button",r.addEventListener("focus",()=>{r.blur()});const i=document.createElement("span");i.textContent=n!=null&&n.buttonText?n==null?void 0:n.buttonText:"Browse Files";const o=document.createElement("span");o.innerHTML=n!=null&&n.buttonIcon?n==null?void 0:n.buttonIcon:"",r.type="button",r.append(i,o),n!=null&&n.buttonStyle&&Object.assign(r.style,n==null?void 0:n.buttonStyle),r.addEventListener("click",()=>{this._selectedImageContainer()}),F(this,At).appendChild(r)}async _grpcOptionInitializer(){$(this,De,await bs(F(this,en),F(this,jt)))}_selectedImageContainer(){var u;$(this,kt,Pe(`Save (${(u=F(this,we))==null?void 0:u.length})`,"dialog-btn confirm")),$(this,Nt,K("folder-container")),$(this,gt,K("folder-list-wrapper")),this._fetchAllFolders();const e=Pe("Cancel","dialog-btn cancel");Pe("","dialog-modal-close-btn","",!1,'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="24" height="24" viewBox="0 0 50 50"> <path d="M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z"></path> </svg>').addEventListener("click",()=>{mn.hide(),$(this,we,[]),$(this,Ie,[])}),$(this,Ae,K("browse-container"));const n=K();n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="space-between",n.style.padding="10px 20px";const r=Qt("Folders","folder-title"),i=Pe("","add-folder-btn");i.append(kr()),this._createUpdateFolderDialog(i,"create"),n.append(r,i),F(this,Nt).append(n,F(this,gt));const o=this._renderSearchField(),a=this._createBrowseMoreContainer(),c=this._createBrowseImageMain(),h=K("footer");e.onclick=()=>{mn.hide(),$(this,Ie,[]),$(this,we,[]),F(this,Yt).call(this)},F(this,kt).onclick=()=>{F(this,$t).call(this),mn.hide(),$(this,we,[]),$(this,Ie,[])},h.append(e,F(this,kt));const l=K("container-right-main");l.append(o,a,c,h),F(this,Ae).append(F(this,Nt),l),mn.show({content:F(this,Ae)})}_renderUserView(e){const{parentContainerId:t,restrictedFileSize:n,imagePreview:r}=e;$(this,At,document.getElementById(t)),$(this,_e,ee("div","user-view-container"));const i=K("user-view-browse-wrapper"),o=ee("span","","","Drag & Drop or "),a=this._renderUserViewBrowseButton(),c=ee("p","","margin-block: 0px; font-size:14px");if(c.append(o,a),n){const h=ee("p","","margin-block: 0px; font-size: 13px; color: #777",`Max File size: ${n}MB`);i.append(Mn(),c,h)}else i.append(Mn(),c);return this._setupDragAndDrop(F(this,_e)),F(this,_e).append(i),r&&this._renderImagePreview(r),F(this,At).appendChild(F(this,_e)),F(this,At)}_setupDragAndDrop(e){if(!e)return;["dragenter","dragover","dragleave","drop"].forEach(n=>{F(this,_e).addEventListener(n,r=>{r.preventDefault(),r.stopPropagation()},!1)}),["dragenter","dragover"].forEach(n=>{F(this,_e).addEventListener(n,()=>{F(this,_e).classList.add("highlight")},!1)}),["dragleave","drop"].forEach(n=>{F(this,_e).addEventListener(n,()=>{F(this,_e).classList.remove("highlight")},!1)}),F(this,_e).addEventListener("drop",n=>{var i;let r=(i=n.dataTransfer)==null?void 0:i.files[0];r&&this._handleDroppedFile(r)},!1)}_renderImagePreview(e,t){var c;const n=document.getElementById("user-image-preview");n&&n.remove();const r=ee("div","user-image-preview");r.id="user-image-preview";const i=ee("img","","max-width: 230px;max-height:250px;object-fit:cover;");i.src=e,i.alt=t||"";const o=ee("div","","width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 4px; position: absolute; top: -10px; right: -10px; background: #c10007; border-radius: 50%;z-index:1"),a=Rn();a.style.fill="#fff",o==null||o.appendChild(a),o.addEventListener("click",()=>{var h;(h=F(this,_e))==null||h.removeChild(r),this._removeUserToast()}),r==null||r.append(i,o),(c=F(this,_e))==null||c.append(r)}_handleDroppedFile(e){this._readFileAsBase64(e)}async _readFileAsBase64(e){$(this,ot,!0);try{const t=await jr(e);this._removeUserToast();const n=new FileReader;n.readAsDataURL(t),n.onload=()=>{this._userViewUploadAndAddSelectedImageList(n.result,e)},n.onerror=()=>{console.error("Error reading file:",n.error)}}catch(t){this._renderUserToast(t,"error")}}_renderUserToast(e,t="success"){const n=ee("div","","display:flex;align-items:center;gap:5px;");n.id="user-toast-container";const r=ee("p","","margin-block:0px;font-size:14px;padding-top:3px");r.textContent=e,r.style.color=t==="success"?"#4caf50":"#ee3f3f";const i=t==="success"?Ar("#4caf50"):Dn();i.style.width="15px",i.style.height="15px",n.append(i,r),F(this,_e).firstChild.appendChild(n)}_removeUserToast(){const e=document.getElementById("user-toast-container");e&&e.remove()}_renderUserViewBrowseButton(){const e=Vn("file");e.style.display="none",e.setAttribute("multiple","true"),e.setAttribute("accept","image/*");const t=ee("a","user-upload-btn","","Click to upload");return t.classList.add("user-upload-btn"),t.role="button",t.addEventListener("click",()=>e.click()),e.addEventListener("change",()=>{const n=e.files[0];n&&this._readFileAsBase64(n),e.value=""}),t}_renderUserUploading(){const e=ee("div","","margin-top:10px;display:flex;flex-direction:column;align-items:center;gap:5px;font-weight:600;font-size:14px");e.id="user-uploading",e.innerHTML="Uploading...";const t=ee("div","linear-loader");e.appendChild(t),F(this,_e).append(e)}_removeUserUploading(){const e=document.getElementById("user-uploading");e&&e.remove()}async _userViewUploadAndAddSelectedImageList(e,t){this._renderUserUploading();try{this._renderImagePreview(e,t.name);const n=await Pr(e,t,F(this,De),!1);await this._uploadForUser(n,t),this._renderUserToast("Successfully Uploaded.","success")}catch{this._renderUserToast(F(this,Zt)?F(this,Zt):"Error uploading. Please try again later.","error")}finally{$(this,ot,!1),this._removeUserUploading()}}async _uploadForUser(e,t){var n;try{const r=await zi(e,it[Lr((n=t.type)==null?void 0:n.split("/")[0])],F(this,De));$(this,Pt,r==null?void 0:r.response),F(this,$t).call(this)}catch(r){throw Error(r)}}_createAllAndSelectedTab(e){const t=K("select-options"),n=Qt("Browse","select"),r=Qt("Selected","select","selected-images-tab");n.classList.add("selected"),[n,r].forEach((o,a)=>{o.addEventListener("click",()=>{var c;$(this,Ft,a),(c=document.querySelector(".select.selected"))==null||c.classList.remove("selected"),o.classList.add("selected"),this._updateSelectedImageListContainerUI()})}),t.append(n,r),e.appendChild(t)}_renderUploadButton(){const e=Vn("file");e.style.display="none",e.setAttribute("multiple","true"),e.setAttribute("accept","image/*,video/*,audio/*,.gif"),$(this,mt,document.createElement("button")),F(this,mt).className="browse-more-btn";const t=document.createElement("span");return t.textContent="Upload",F(this,mt).append(Mn(),t),F(this,mt).type="button",F(this,mt).addEventListener("click",()=>e.click()),e.addEventListener("change",async()=>{const n=e.files[0];try{$(this,ot,!0);const r=await jr(n),i=new FileReader;i.readAsDataURL(r),i.onload=async()=>{await this._uploadAndAddSelectedImageList(i.result,n)}}catch(r){this._renderToastContainer(r,"error",F(this,Ae))}e.value=""}),F(this,mt)}_renderCreateFolderBtn(){const e=document.createElement("button");e.className="create-folder-btn";const t=document.createElement("span");return t.textContent="Create",e.append(kr(),t),this._createUpdateFolderDialog(e,"create"),e}_renderSearchField(){let e;const t=K("search-browse-container"),n=K("search-input-wrapper","search-input-wrapper");$(this,Lt,Vn("search")),F(this,Lt).value="",F(this,Lt).addEventListener("input",i=>{$(this,Ie,[]);const o=i.target;e&&clearTimeout(e),e=setTimeout(()=>{if(!o.value){$(this,ct,""),$(this,It,!1),$(this,wt,!1),this._fetchFilesFromFolder(F(this,vt));return}$(this,wt,!0),$(this,Wt,o.value),this._search(F(this,Wt))},750)}),F(this,Lt).setAttribute("placeholder","Search");const r=fs();return r.style.position="absolute",r.style.top="50%",r.style.left="5%",r.style.transform="translate(-5%, -50%)",n.append(r,F(this,Lt)),t.append(n),t}_createBrowseMoreContainer(){$(this,St,K("browse-more-btn-container")),this._createAllAndSelectedTab(F(this,St));const e=this._renderUploadButton(),t=this._renderCreateFolderBtn(),n=document.createElement("div");return n.style.display="flex",n.style.alignItems="center",n.style.gap="10px",n.append(e,t),F(this,St).appendChild(n),F(this,St)}_createBrowseImageMain(){const e=K("browse-image-main");return $(this,ve,K("selected-image-container")),F(this,ve).addEventListener("scroll",()=>{const t=F(this,ve).clientHeight,n=F(this,ve).scrollTop,r=F(this,ve).scrollHeight;t+n>=r-5&&F(this,It)&&(F(this,wt)?this._search(F(this,Wt)):this._fetchFilesFromFolder(F(this,vt)))}),e.appendChild(F(this,ve)),e}_renderFetchingSkeletonUI(){for(let e=0;e<20;e++){const t=K("skeleton");t.innerHTML="",F(this,ve).append(t)}}_renderEmptyImageContainer(){if(F(this,je)||F(this,ot))return;const e=K(),t=K(),n=document.createElement("p");F(this,wt)&&F(this,Ft)===0?(t.innerHTML=`
24
+ `;let jn;function Bs(s,e){return new Promise((t,n)=>{jn||(jn=function(o){const a=[];return a.push(o),URL.createObjectURL(new Blob(a))}(Us));const r=new Worker(jn);r.addEventListener("message",function(o){if(e.signal&&e.signal.aborted)r.terminate();else if(o.data.progress===void 0){if(o.data.error)return n(new Error(o.data.error)),void r.terminate();t(o.data.file),r.terminate()}else e.onProgress(o.data.progress)}),r.addEventListener("error",n),e.signal&&e.signal.addEventListener("abort",()=>{n(e.signal.reason),r.terminate()}),r.postMessage({file:s,imageCompressionLibUrl:e.libURL,options:{...e,onProgress:void 0,signal:void 0}})})}function Se(s,e){return new Promise(function(t,n){let r,i,o,a,c,h;if(r={...e},o=0,{onProgress:a}=r,r.maxSizeMB=r.maxSizeMB||Number.POSITIVE_INFINITY,c=typeof r.useWebWorker!="boolean"||r.useWebWorker,delete r.useWebWorker,r.onProgress=f=>{o=f,typeof a=="function"&&a(o)},!(s instanceof Blob||s instanceof _s))return n(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(s.type))return n(new Error("The file given is not an image"));if(h=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!c||typeof Worker!="function"||h)return Wr(s,r).then((function(f){try{return i=f,d.call(this)}catch(y){return n(y)}}).bind(this),n);var l=(function(){try{return d.call(this)}catch(f){return n(f)}}).bind(this),u=function(f){try{return Wr(s,r).then(function(y){try{return i=y,l()}catch(I){return n(I)}},n)}catch(y){return n(y)}};try{return r.libURL=r.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Bs(s,r).then(function(f){try{return i=f,l()}catch{return u()}},u)}catch{u()}function d(){try{i.name=s.name,i.lastModified=s.lastModified}catch{}try{r.preserveExif&&s.type==="image/jpeg"&&(!r.fileType||r.fileType&&r.fileType===s.type)&&(i=_r(s,i))}catch{}return t(i)}})}Se.getDataUrlFromFile=Sr,Se.getFilefromDataUrl=Pn,Se.loadImage=Dr,Se.drawImageInCanvas=Mr,Se.drawFileInCanvas=Cn,Se.canvasToFile=En,Se.getExifOrientation=Vr,Se.handleMaxWidthOrHeight=Hr,Se.followExifOrientation=$r,Se.cleanupCanvasMemory=st,Se.isAutoOrientationInBrowser=Vt,Se.approximateBelowMaximumCanvasSizeOfBrowser=Rr,Se.copyExifWithoutOrientation=_r,Se.getBrowserName=Bt,Se.version="2.0.2";const Pr=async(s,e,t,n=!0)=>{try{const r=Os(s,e),o=(await Fs(e==null?void 0:e.type,t,n)).response.url;return await fetch(o,{method:"PUT",headers:{"Content-Type":e==null?void 0:e.type,"x-amz-acl":"public-read"},body:r}),o==null?void 0:o.split("?")[0]}catch(r){throw r}},Os=(s,e)=>{const t=e.type.split("/")[0];let n="";t==="video"?n=s==null?void 0:s.replace(/^data:video\/\w+;base64,/,""):t==="image"?n=s==null?void 0:s.replace(/^data:image\/\w+;base64,/,""):t==="audio"&&(n=s==null?void 0:s.replace(/^data:audio\/\w+;base64,/,""));const r=atob(n),i=new Uint8Array(r.length);for(let o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return i};async function jr(s){const e={maxSizeMB:2,maxWidthOrHeight:1920,useWebWorker:!0};try{return await Se(s,e)}catch(t){throw Error(t)}}class Ss{constructor(e){X(this,At);X(this,Ae);X(this,ve);X(this,mt);X(this,we,[]);X(this,Ie,[]);X(this,ot);X(this,je);X(this,Ot);X(this,vt);X(this,at,[]);X(this,tt);X(this,kt);X(this,$t);X(this,Wt);X(this,Ft);X(this,Nt);X(this,gt);X(this,St);X(this,lt);X(this,ct);X(this,It);X(this,Lt);X(this,wt);X(this,Pt);X(this,en);X(this,De);X(this,yt);X(this,tn,!1);X(this,An);X(this,nn);X(this,_e);X(this,jt);X(this,Tt);X(this,Zt);X(this,vn);X(this,kn);X(this,qt);$(this,nn,e.isAdmin),$(this,ot,!1),$(this,$t,e.handleUpload.bind(this)),$(this,Wt,e.handleCancel.bind(this)),$(this,en,e.accessToken),$(this,Zt,e==null?void 0:e.mode),this._grpcOptionInitializer(),this._init(e).then(()=>{$(this,tn,!0),this._renderView(e),this.updateWindowObject({initialized:!0}),this._initializeGrpcConfig(e.mode,e.endPoint)})}async _init(e){try{const{mode:t}=e;this.updateWindowObject({mode:t})}catch{throw Error("Initialization failed")}}_isAdminOptions(e){return e.isAdmin===!0}_renderView(e){return this._isAdminOptions(e)?($(this,je,!1),$(this,Ot,!1),$(this,Ft,0),$(this,ct,""),$(this,wt,!1),$(this,Zt,e.mode),$(this,It,!1),$(this,Tt,""),$(this,yt,null),this._removeToastContainer(),this._renderAdminView(e)):($(this,jt,""),$(this,vn,e.restrictedFileSize),$(this,kn,e==null?void 0:e.localizedFileRestrictedMessage),$(this,qt,e==null?void 0:e.localizedErrorMessage),this._removeUserToast(),this._renderUserView(e))}_renderAdminView(e){if(!F(this,tn))return;const{parentContainerId:t}=e;if(e.isAdmin===!0)var{buttonProps:n}=e;$(this,At,document.getElementById(t));const r=document.createElement("button");r.className=n!=null&&n.buttonClass?n==null?void 0:n.buttonClass:"browse-image-button",r.addEventListener("focus",()=>{r.blur()});const i=document.createElement("span");i.textContent=n!=null&&n.buttonText?n==null?void 0:n.buttonText:"Browse Files";const o=document.createElement("span");o.innerHTML=n!=null&&n.buttonIcon?n==null?void 0:n.buttonIcon:"",r.type="button",r.append(i,o),n!=null&&n.buttonStyle&&Object.assign(r.style,n==null?void 0:n.buttonStyle),r.addEventListener("click",()=>{this._selectedImageContainer()}),F(this,At).appendChild(r)}async _grpcOptionInitializer(){$(this,De,await bs(F(this,en),F(this,Zt)))}_selectedImageContainer(){var u;$(this,kt,Pe(`Save (${(u=F(this,we))==null?void 0:u.length})`,"dialog-btn confirm")),$(this,Nt,K("folder-container")),$(this,gt,K("folder-list-wrapper")),this._fetchAllFolders();const e=Pe("Cancel","dialog-btn cancel");Pe("","dialog-modal-close-btn","",!1,'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="24" height="24" viewBox="0 0 50 50"> <path d="M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z"></path> </svg>').addEventListener("click",()=>{mn.hide(),$(this,we,[]),$(this,Ie,[])}),$(this,Ae,K("browse-container"));const n=K();n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="space-between",n.style.padding="10px 20px";const r=Yt("Folders","folder-title"),i=Pe("","add-folder-btn");i.append(kr()),this._createUpdateFolderDialog(i,"create"),n.append(r,i),F(this,Nt).append(n,F(this,gt));const o=this._renderSearchField(),a=this._createBrowseMoreContainer(),c=this._createBrowseImageMain(),h=K("footer");e.onclick=()=>{F(this,Wt).call(this),mn.hide(),$(this,Ie,[]),$(this,we,[])},F(this,kt).onclick=()=>{F(this,$t).call(this),mn.hide(),$(this,we,[]),$(this,Ie,[])},h.append(e,F(this,kt));const l=K("container-right-main");l.append(o,a,c,h),F(this,Ae).append(F(this,Nt),l),mn.show({content:F(this,Ae)})}_renderUserView(e){const{parentContainerId:t,restrictedFileSize:n,imagePreview:r}=e;$(this,At,document.getElementById(t)),$(this,_e,ee("div","user-view-container"));const i=K("user-view-browse-wrapper"),o=ee("span","","","Drag & Drop or "),a=this._renderUserViewBrowseButton(),c=ee("p","","margin-block: 0px; font-size:14px");if(c.append(o,a),n){const h=ee("p","","margin-block: 0px; font-size: 13px; color: #777",`Max File size: ${n}MB`);i.append(Mn(),c,h)}else i.append(Mn(),c);return this._setupDragAndDrop(F(this,_e)),F(this,_e).append(i),r&&this._renderImagePreview(r),F(this,At).appendChild(F(this,_e)),F(this,At)}_setupDragAndDrop(e){if(!e)return;["dragenter","dragover","dragleave","drop"].forEach(n=>{F(this,_e).addEventListener(n,r=>{r.preventDefault(),r.stopPropagation()},!1)}),["dragenter","dragover"].forEach(n=>{F(this,_e).addEventListener(n,()=>{F(this,_e).classList.add("highlight")},!1)}),["dragleave","drop"].forEach(n=>{F(this,_e).addEventListener(n,()=>{F(this,_e).classList.remove("highlight")},!1)}),F(this,_e).addEventListener("drop",n=>{var i;let r=(i=n.dataTransfer)==null?void 0:i.files[0];r&&this._handleDroppedFile(r)},!1)}_renderImagePreview(e,t){var c;const n=document.getElementById("user-image-preview");n&&n.remove();const r=ee("div","user-image-preview");r.id="user-image-preview";const i=ee("img","","max-width: 230px;max-height:250px;object-fit:cover;");i.src=e,i.alt=t||"";const o=ee("div","","width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 4px; position: absolute; top: -10px; right: -10px; background: #c10007; border-radius: 50%;z-index:1"),a=Rn();a.style.fill="#fff",o==null||o.appendChild(a),o.addEventListener("click",()=>{var h;(h=F(this,_e))==null||h.removeChild(r),this._removeUserToast(),F(this,Wt).call(this)}),r==null||r.append(i,o),(c=F(this,_e))==null||c.append(r)}_handleDroppedFile(e){this._readFileAsBase64(e)}async _readFileAsBase64(e){$(this,ot,!0);try{const t=await jr(e);this._removeUserToast();const n=new FileReader;n.readAsDataURL(t),n.onload=()=>{this._userViewUploadAndAddSelectedImageList(n.result,e)},n.onerror=()=>{console.error("Error reading file:",n.error)}}catch(t){this._renderUserToast(t,"error")}}_renderUserToast(e,t="success"){const n=ee("div","","display:flex;align-items:center;gap:5px;");n.id="user-toast-container";const r=ee("p","","margin-block:0px;font-size:14px;padding-top:3px");r.textContent=e,r.style.color=t==="success"?"#4caf50":"#ee3f3f";const i=t==="success"?Ar("#4caf50"):Dn();i.style.width="15px",i.style.height="15px",n.append(i,r),F(this,_e).firstChild.appendChild(n)}_removeUserToast(){const e=document.getElementById("user-toast-container");e&&e.remove()}_renderUserViewBrowseButton(){const e=Vn("file");e.style.display="none",e.setAttribute("multiple","true"),e.setAttribute("accept","image/*");const t=ee("a","user-upload-btn","","Click to upload");return t.classList.add("user-upload-btn"),t.role="button",t.addEventListener("click",()=>e.click()),e.addEventListener("change",()=>{const n=e.files[0];n&&this._readFileAsBase64(n),e.value=""}),t}_renderUserUploading(){const e=ee("div","","margin-top:10px;display:flex;flex-direction:column;align-items:center;gap:5px;font-weight:600;font-size:14px");e.id="user-uploading",e.innerHTML="Uploading...";const t=ee("div","linear-loader");e.appendChild(t),F(this,_e).append(e)}_removeUserUploading(){const e=document.getElementById("user-uploading");e&&e.remove()}async _userViewUploadAndAddSelectedImageList(e,t){this._renderUserUploading();try{this._renderImagePreview(e,t.name);const n=await Pr(e,t,F(this,De),!1);await this._uploadForUser(n,t),this._renderUserToast("Successfully Uploaded.","success")}catch{this._renderUserToast(F(this,qt)?F(this,qt):"Error uploading. Please try again later.","error")}finally{$(this,ot,!1),this._removeUserUploading()}}async _uploadForUser(e,t){var n;try{const r=await zi(e,it[Lr((n=t.type)==null?void 0:n.split("/")[0])],F(this,De));$(this,jt,r==null?void 0:r.response),F(this,$t).call(this)}catch(r){throw Error(r)}}_createAllAndSelectedTab(e){const t=K("select-options"),n=Yt("Browse","select"),r=Yt("Selected","select","selected-images-tab");n.classList.add("selected"),[n,r].forEach((o,a)=>{o.addEventListener("click",()=>{var c;$(this,Ft,a),(c=document.querySelector(".select.selected"))==null||c.classList.remove("selected"),o.classList.add("selected"),this._updateSelectedImageListContainerUI()})}),t.append(n,r),e.appendChild(t)}_renderUploadButton(){const e=Vn("file");e.style.display="none",e.setAttribute("multiple","true"),e.setAttribute("accept","image/*,video/*,audio/*,.gif"),$(this,mt,document.createElement("button")),F(this,mt).className="browse-more-btn";const t=document.createElement("span");return t.textContent="Upload",F(this,mt).append(Mn(),t),F(this,mt).type="button",F(this,mt).addEventListener("click",()=>e.click()),e.addEventListener("change",async()=>{const n=e.files[0];try{$(this,ot,!0);const r=await jr(n),i=new FileReader;i.readAsDataURL(r),i.onload=async()=>{await this._uploadAndAddSelectedImageList(i.result,n)}}catch(r){this._renderToastContainer(r,"error",F(this,Ae))}e.value=""}),F(this,mt)}_renderCreateFolderBtn(){const e=document.createElement("button");e.className="create-folder-btn";const t=document.createElement("span");return t.textContent="Create",e.append(kr(),t),this._createUpdateFolderDialog(e,"create"),e}_renderSearchField(){let e;const t=K("search-browse-container"),n=K("search-input-wrapper","search-input-wrapper");$(this,Lt,Vn("search")),F(this,Lt).value="",F(this,Lt).addEventListener("input",i=>{$(this,Ie,[]);const o=i.target;e&&clearTimeout(e),e=setTimeout(()=>{if(!o.value){$(this,ct,""),$(this,It,!1),$(this,wt,!1),this._fetchFilesFromFolder(F(this,vt));return}$(this,wt,!0),$(this,Pt,o.value),this._search(F(this,Pt))},750)}),F(this,Lt).setAttribute("placeholder","Search");const r=fs();return r.style.position="absolute",r.style.top="50%",r.style.left="5%",r.style.transform="translate(-5%, -50%)",n.append(r,F(this,Lt)),t.append(n),t}_createBrowseMoreContainer(){$(this,St,K("browse-more-btn-container")),this._createAllAndSelectedTab(F(this,St));const e=this._renderUploadButton(),t=this._renderCreateFolderBtn(),n=document.createElement("div");return n.style.display="flex",n.style.alignItems="center",n.style.gap="10px",n.append(e,t),F(this,St).appendChild(n),F(this,St)}_createBrowseImageMain(){const e=K("browse-image-main");return $(this,ve,K("selected-image-container")),F(this,ve).addEventListener("scroll",()=>{const t=F(this,ve).clientHeight,n=F(this,ve).scrollTop,r=F(this,ve).scrollHeight;t+n>=r-5&&F(this,It)&&(F(this,wt)?this._search(F(this,Pt)):this._fetchFilesFromFolder(F(this,vt)))}),e.appendChild(F(this,ve)),e}_renderFetchingSkeletonUI(){for(let e=0;e<20;e++){const t=K("skeleton");t.innerHTML="",F(this,ve).append(t)}}_renderEmptyImageContainer(){if(F(this,je)||F(this,ot))return;const e=K(),t=K(),n=document.createElement("p");F(this,wt)&&F(this,Ft)===0?(t.innerHTML=`
25
25
  <svg width="300" height="300" viewBox="0 0 1000 1000" fill="none" xmlns="http://www.w3.org/2000/svg">
26
26
  <g clip-path="url(#clip0_2304_257)">
27
27
  <path d="M564.829 772.4H336.658V948.386H564.829V772.4Z" fill="#EBEBEB"/>
@@ -105,4 +105,4 @@ self.addEventListener('message', async (e) => {
105
105
  </clipPath>
106
106
  </defs>
107
107
  </svg>
108
- `,n.textContent="Looks Empty!"),e.append(t,n),F(this,ve).appendChild(e)}_renderLoadingUI(){const e=K("skeleton");e.innerHTML="",F(this,ve).appendChild(e)}_fileCardBody(e){var ut,qt,Fn,Kt;const t=K("selected-image-content"),n=K("selected-image-top-bar"),r=Pe("","selected-image-btn","",!1,'<svg width="20px" height="20px" viewBox="0 0 20 20" focusable="false" fill="currentColor"><path fill="none" d="M0 0h20v20H0V0z"></path><path d="M10 6c.82 0 1.5-.68 1.5-1.5S10.82 3 10 3s-1.5.67-1.5 1.5S9.18 6 10 6zm0 5.5c.82 0 1.5-.68 1.5-1.5s-.68-1.5-1.5-1.5-1.5.68-1.5 1.5.68 1.5 1.5 1.5zm0 5.5c.82 0 1.5-.67 1.5-1.5 0-.82-.68-1.5-1.5-1.5s-1.5.68-1.5 1.5c0 .83.68 1.5 1.5 1.5z"></path></svg>');let i,o;(e==null?void 0:e.type)===it.IMAGE&&(i=Tr(e==null?void 0:e.url,"selected-image"),o=ds()),(e==null?void 0:e.type)===it.VIDEO&&(i=Cs(e==null?void 0:e.url,"uploaded-video"),o=ps()),(e==null?void 0:e.type)===it.AUDIO&&(i=Es(e==null?void 0:e.url,"uploaded-audio"),o=cs());const a=K("selected-image-wrapper");a.setAttribute("data-key",e==null?void 0:e.key);const c=Qt(e==null?void 0:e.name,"selected-image-name"),h=oe("","selected-image-type");h.append(o),n.append(h,r);const l=K();l.style.marginTop="10px",l.style.display="flex",l.style.justifyContent="space-between",l.style.alignItems="center",l.append(c),t.append(n,i),a.append(t,l);const u=K("action-wrapper"),d=Pe("","action-option preview"),f=oe("Preview",""),y=us();d.append(y,f);const I=Pe("","action-option move"),L=oe("Move",""),C=hs();I.append(C,L);const R=Pe("","action-option rename"),O=oe("Rename",""),v=vr();R.append(v,O);const x=Pe("","action-option delete"),b=oe("Delete",""),B=Fr();x.append(B,b);const m=e.name.split(".")[0],g=e.name.split(".")[1],A=Jt[e.type],N=K("edit-form-wrapper"),k=K("move-form-wrapper"),T=K("preview-details-container"),E=K("preview-details-wrapper"),U=K("preview-option-image-wrapper"),w=K("preview-option-wrapper"),p=K("preview-option-wrapper"),M=K("preview-option-wrapper"),_=K("preview-option-wrapper"),V=K("preview-option-wrapper"),q=K("preview-option-wrapper"),W=K("preview-option-wrapper"),Z=Tr(e.url,"preview-option-image");U.append(Z);const H=oe("File name","preview-title"),S=K("preview-option-name");S.innerHTML=e.name,w.append(H,S);const z=oe("Folder name","preview-title"),ce=oe(e.folderName,"preview-option-name");p.append(z,ce);const te=oe("File Extension","preview-title"),Q=oe(g,"preview-option-name extension");M.append(te,Q);const ae=oe("File type","preview-title"),me=oe(A,"preview-option-name");_.append(ae,me);const ke=oe("Dimension","preview-title"),bt=oe(`${(ut=e==null?void 0:e.metadata)==null?void 0:ut.width} * ${(qt=e==null?void 0:e.metadata)==null?void 0:qt.height}`,"preview-option-name");V.append(ke,bt);const ze=oe("URL","preview-title"),fe=oe(e.url,"preview-option-name url");q.append(ze,fe);const Le=oe("Parent folder","preview-title"),de=oe(e.nestedFolderName,"preview-option-name");W.append(Le,de),E.append(p,w,M,_,((Fn=e==null?void 0:e.metadata)==null?void 0:Fn.width)>0&&((Kt=e==null?void 0:e.metadata)==null?void 0:Kt.height)>0?V:"",q,e.nestedFolderName?W:""),T.append(U,E);const re=K("form-control"),ye=document.createElement("input");re.appendChild(ye),ye.classList.add("input-field"),ye.value=e.name;const Te=K("form-control"),be=oe("Current Folder:","input-label"),Ue=K("folder-field current");Ue.textContent=e.folderName,Ue.prepend(Gt()),Te.append(be,Ue);const ge=K("form-control"),Y=K();Y.style.width="100%",Y.style.display="flex",Y.style.alignItems="center",Y.style.justifyContent="space-between";const He=oe("Suggested Folder List:","input-label"),Re=oe();Re.style.display="flex",Re.style.alignItems="center",Re.style.gap="5px",Re.style.fontSize="14px",Re.textContent="Move the file in selected folder",Re.appendChild(Dn("14px","14px","#333")),Y.append(He,Re);const dt=K();dt.style.width="100%",dt.style.maxHeight="250px",dt.style.overflowY="auto";const Ne=document.createElement("ul");Ne.className="folders",dt.append(Ne),ge.append(Y,dt),F(this,at).forEach(ue=>{const Xe=this._renderEditFolderListContainer(ue);Ne.appendChild(Xe)});const ht=K("form-control"),Be=oe("Destination Folder:","input-label"),We=K("folder-field source","source-folder-wrapper"),Me=document.createElement("span");Me.id="source-folder-name",Me.textContent=F(this,Tt)?F(this,Tt):e.folderName,We.append(Gt(),Me);let Ve="";ht.append(Be,We),ye.onchange=ue=>{Ve=ue.target.value},Ve=Ve!==""?Ve:e.name,N.append(re),k.append(Te,ge,ht),u.append(d,I,R,x),d.onclick=ue=>{ue.stopPropagation(),Ke.hide(),Ee.show({content:T,header:m,dialogContentStyle:{minWidth:"60rem",padding:"10px"},showCloseBtn:!0})},I.onclick=ue=>{ue.stopPropagation(),Ke.hide(),Ee.show({content:k,header:`Move "${e.name}"`,confirmButtonText:"Move",dialogContentStyle:{minWidth:"35rem",padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{Ee.hide()},onConfirm:()=>{this._updateFile(Ve,e)}})},R.onclick=ue=>{ue.stopPropagation(),Ke.hide(),Ee.show({content:N,header:"Rename",confirmButtonText:"Update",dialogContentStyle:{padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{Ee.hide()},onConfirm:()=>{this._updateFile(Ve,e)}})},x.onclick=ue=>{ue.stopPropagation(),Ke.hide(),Ee.show({content:"",dialogContentStyle:{minWidth:"32rem",padding:"10px"},header:`Are you sure you want to delete the file "${e.name}"?`,showFooter:!0,confirmButtonText:"Yes",cancelButtonText:"No",onConfirm:()=>{this._deleteFile(e.key)}})},r.addEventListener("click",ue=>{ue.stopPropagation(),Ke.hide(),Ke.show({content:u,mainContainer:n,divId:e.key}),$(this,yt,e.key)}),i.addEventListener("click",()=>{const ue=F(this,we).findIndex(ft=>(ft==null?void 0:ft.key)===(e==null?void 0:e.key));if(t.classList.contains("checked"))t.classList.remove("checked"),ue!==-1&&(F(this,we).splice(ue,1),F(this,Ft)===1&&a.remove());else{if(F(this,An))F(this,we).push(e);else{const ft=document.querySelector(".selected-image-wrapper .checked");ft==null||ft.classList.remove("checked"),$(this,we,[e])}t.classList.add("checked")}this._updateContent()}),document.addEventListener("click",ue=>{const Xe=document.querySelector(`#${F(this,yt)}`);Xe&&(ue.composedPath().includes(Xe)||Ke.hide())}),F(this,we).findIndex(ue=>(ue==null?void 0:ue.key)===(e==null?void 0:e.key))!==-1?(t.classList.add("checked"),F(this,wt)?F(this,ve).prepend(a):F(this,ve).appendChild(a)):F(this,ve).appendChild(a)}_renderImageCard(e){this._fileCardBody(e)}_renderImageListContainer(){var e,t;((e=F(this,Ie))==null?void 0:e.length)>0&&((t=F(this,Ie))==null||t.forEach(n=>{this._renderImageCard(n)}))}_renderSelectedImageListContainer(){var e;((e=F(this,we))==null?void 0:e.length)>0&&F(this,we).forEach(t=>{this._renderImageCard(t)})}_renderFolderListLoadingUI(){const e=document.createElement("div");e.style.paddingInline="20px";for(let t=0;t<4;t++){const n=K("skeleton");n.className="skeleton folder",n.innerHTML="",e.appendChild(n)}return e}_renderFolderListContainer(e){var o;const t=document.createElement("li");t.className="folder";const n=document.createElement("div");n.style.position="relative",n.style.display="flex",n.style.alignItems="center",n.style.gap="2px";const r=document.createElement("span"),i=document.createElement("span");if(i.className="folder-name",i.textContent=e==null?void 0:e.name,r.appendChild(Gt()),n.append(r,i),t.append(n),e.children&&Object.keys(e.children).length>0){const a=document.createElement("button");a.classList.add("expand-icon"),a.appendChild(Er()),n.prepend(a);const c=document.createElement("ul");c.className="folders nested",t.appendChild(c),a.addEventListener("click",h=>{h.stopPropagation(),t.classList.toggle("active"),c.classList.toggle("visible")}),Object.values(e.children).forEach((h,l)=>{const u=this._renderFolderListContainer(h);c.appendChild(u)})}if(e.nestedFolderName){const a=Pe("","folder-option-btn","moveToInputField.disabled",!1,'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-ellipsis"><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/></svg>'),c=K("action-wrapper"),h=Pe("","action-option edit"),l=oe("Edit",""),u=vr();h.append(u,l);const d=K("edit-form-wrapper"),f=K("name-field-wrapper"),y=oe("Name","input-label"),I=document.createElement("input");I.classList.add("input-field"),I.value=e.name,I.onchange=v=>{v.target.value},f.append(y,I),d.append(f);const L={key:e.key,name:e.name,nestedFolderName:e.nestedFolderName,createdBy:e.createdBy};this._createUpdateFolderDialog(h,"update",L);const C=Pe("","action-option delete"),R=oe("Delete",""),O=Fr();C.append(O,R),c.append(h,C),C.onclick=v=>{v.stopPropagation(),Ke.hide(),Ee.show({content:"",dialogContentStyle:{minWidth:"32rem",padding:"10px"},header:`Are you sure you want to delete the folder "${e==null?void 0:e.name}"?`,showFooter:!0,confirmButtonText:"Yes",cancelButtonText:"No",onConfirm:()=>{this._deleteFolder(e.key)}})},a.addEventListener("click",v=>{v.stopPropagation();const x=document.querySelector(`#${e.key}`);$(this,yt,null),F(this,yt)===e.key&&x!==null?Ke.hide():(Ke.hide(),Ke.show({content:c,mainContainer:n,divId:e.key}),$(this,yt,e.key))}),n.appendChild(a)}return t.addEventListener("click",a=>{var c;a.stopPropagation(),$(this,tt,e),$(this,vt,e==null?void 0:e.name),$(this,we,[]),$(this,Ie,[]),$(this,ct,""),$(this,It,!1),(c=document.querySelector(".folder.selected"))==null||c.classList.remove("selected"),t.classList.add("selected"),this._fetchFilesFromFolder(e.name)}),((o=F(this,tt))==null?void 0:o.key)===(e==null?void 0:e.key)&&t.classList.add("selected"),t}_renderEditFolderListContainer(e){var o;const t=document.createElement("li");t.className="folder-move";const n=document.createElement("div");n.style.position="relative",n.style.display="flex",n.style.alignItems="center",n.style.gap="2px";const r=document.createElement("span"),i=document.createElement("span");if(i.className="folder-name",i.textContent=e==null?void 0:e.name,r.appendChild(Gt()),n.append(r,i),t.append(n),e.children&&Object.keys(e.children).length>0){const a=document.createElement("button");a.classList.add("expand-icon"),a.appendChild(Er()),n.prepend(a);const c=document.createElement("ul");c.className="folders nested",t.appendChild(c),a.addEventListener("click",h=>{h.stopPropagation(),t.classList.toggle("active"),c.classList.toggle("visible")}),Object.values(e.children).forEach(h=>{const l=this._renderEditFolderListContainer(h);c.appendChild(l)})}return t.addEventListener("click",a=>{var h;a.stopPropagation(),$(this,Tt,e==null?void 0:e.name);const c=document.querySelector("#source-folder-name");c.textContent="",c.textContent=e==null?void 0:e.name,(h=document.querySelector(".folder-move.selected"))==null||h.classList.remove("selected"),t.classList.add("selected")}),((o=F(this,tt))==null?void 0:o.key)===(e==null?void 0:e.key)&&t.classList.add("selected"),t}_updateFolderListContainer(){if(F(this,Nt))if(F(this,gt).innerHTML="",F(this,Ot)){const e=this._renderFolderListLoadingUI();F(this,gt).appendChild(e)}else{const e=document.createElement("ul");e.className="folders",F(this,gt).appendChild(e),F(this,at).forEach(t=>{const n=this._renderFolderListContainer(t);e.appendChild(n)}),F(this,Nt).appendChild(F(this,gt))}}_renderToastContainer(e,t,n){this._removeToastContainer(),$(this,lt,document.createElement("div")),F(this,lt).className=`message-container ${t}`;const r=Qt(e,"message"),i=t==="success"?Ar():Dn(),o=Pe("");o.style.cursor="pointer",o.style.border="0",o.style.outline="none",o.style.background="transparent",o.appendChild(Rn(t==="error"?"#ee3f3f":"#4caf50")),o.setAttribute("fill",t==="error"?"#ee3f3f":"#4caf50"),o.onclick=()=>this._removeToastContainer(),F(this,lt).append(i,r,o),n.appendChild(F(this,lt)),setTimeout(()=>{this._removeToastContainer()},5e3)}_removeToastContainer(){F(this,lt)&&(F(this,lt).remove(),$(this,lt,null))}_updateSelectedImageListContainerUI(){var t,n;if(!F(this,ve))return;F(this,ve).innerHTML="",F(this,ot)&&this._renderLoadingUI(),F(this,je)&&this._renderFetchingSkeletonUI();const e=document.getElementById("search-input-wrapper");F(this,Ft)===0?(e&&(e.style.visibility="visible"),((t=F(this,Ie))==null?void 0:t.length)===0&&!F(this,je)?(F(this,ve).classList.add("no-selected-image-container"),this._renderEmptyImageContainer()):(F(this,ve).classList.remove("no-selected-image-container"),this._renderImageListContainer())):(e&&(e.style.visibility="hidden"),((n=F(this,we))==null?void 0:n.length)===0?(F(this,ve).classList.add("no-selected-image-container"),this._renderEmptyImageContainer()):(F(this,ve).classList.remove("no-selected-image-container"),this._renderSelectedImageListContainer())),this._updateContent()}_updateContent(){var t,n,r;const e=document.getElementById("selected-images-tab");e&&(e.textContent=`Selected (${(t=F(this,we))==null?void 0:t.length})`),F(this,kt).textContent=`Save (${(n=F(this,we))==null?void 0:n.length})`,F(this,kt).disabled=((r=F(this,we))==null?void 0:r.length)===0}async _uploadAndAddSelectedImageList(e,t){var n,r;this._updateSelectedImageListContainerUI();try{const i=await Pr(e,t,F(this,De)),o=await Ki(t==null?void 0:t.name,"",i,it[Lr((n=t.type)==null?void 0:n.split("/")[0])],(r=F(this,tt))==null?void 0:r.name,F(this,De));F(this,Ie).unshift(o==null?void 0:o.response),this._renderToastContainer("File Uploaded Successfully","success",F(this,Ae))}catch{this._renderToastContainer("Something went wrong while uploading file. Please try again later.","error",F(this,Ae))}finally{$(this,ot,!1),this._updateSelectedImageListContainerUI()}}async _updateFile(e,t){Ee.updateUploadBtn(!0);try{const n=await Ji(t.key,e,t.nestedFolderName,t.url,t.thumborUrl,t.proxyUrl,t.type,F(this,Tt),F(this,De)),r=F(this,Ie).find(i=>i.key===n.response.key);r.name=e,this._fetchFilesFromFolder(F(this,tt).name),$(this,Ie,[]),$(this,we,[]),this._renderToastContainer("File Updated Successfully","success",F(this,Ae))}catch{this._renderToastContainer("Something went wrong while updating the file. Please try again later.","error",F(this,Ae))}finally{Ee.updateUploadBtn(!1),Ee.hide(),this._updateSelectedImageListContainerUI()}}async _deleteFile(e){Ee.updateUploadBtn(!0);try{await Qi(e,F(this,De)),$(this,Ie,F(this,Ie).filter(t=>e!==t.key)),this._renderToastContainer("File Deleted Successfully","success",F(this,Ae))}catch{this._renderToastContainer("Something went wrong while deleting the file. Please try again later.","error",F(this,Ae))}finally{Ee.updateUploadBtn(!1),Ee.hide(),this._updateSelectedImageListContainerUI()}}async _createFolder(e,t=2){var n;try{const r=await os(e,(n=F(this,tt))==null?void 0:n.name,"",F(this,De));$(this,we,[]),$(this,Ie,[]);const i=ys(F(this,at),r==null?void 0:r.response);$(this,at,i),$(this,vt,e),$(this,tt,{...r==null?void 0:r.response,children:{}}),this._fetchFilesFromFolder(e),this._renderToastContainer(`Folder ${e} created successfully`,"success",F(this,Ae))}catch{if(t>1)this._createFolder(e,--t);else throw this._renderToastContainer(`Error creating folder "${e}". Either folder already exist or failed to create folder`,"error",F(this,Ae)),new Error(`Error creating folder "${e}". Either folder already exist or failed to create folder`)}finally{this._updateFolderListContainer()}}async _upload(){return F(this,nn)?F(this,we):F(this,Pt)}async _fetchFilesFromFolder(e){var t,n,r;$(this,je,!0),this._updateSelectedImageListContainerUI();try{const i=await Xi(e,F(this,ct),20,F(this,De)),o=(t=i.response)==null?void 0:t.files;F(this,Ie).push(...o),$(this,ct,(n=i.response)==null?void 0:n.nextCursor),$(this,It,(r=i.response)==null?void 0:r.hasMore)}catch{throw this._renderToastContainer("Error while fetching files from folder"+e,"error",F(this,Ae)),new Error("Something went wrong. Error while fetching files from folder"+e)}finally{$(this,je,!1),this._updateSelectedImageListContainerUI()}}async _fetchAllFolders(){var e,t;$(this,je,!0),$(this,Ot,!0),this._updateSelectedImageListContainerUI(),this._updateFolderListContainer(),this._removeToastContainer();try{const r=(await ss("",100,F(this,De))).response.folder,i=ws(r);$(this,vt,(e=i[0])==null?void 0:e.name),this._fetchFilesFromFolder((t=i[0])==null?void 0:t.name),$(this,tt,i[0]),$(this,at,i)}catch{$(this,je,!1),this._renderToastContainer("Folder not found. Please create a folder or try again later","error",F(this,Ae))}finally{$(this,Ot,!1),this._updateFolderListContainer()}}async _search(e){var t,n;$(this,je,!0),this._updateSelectedImageListContainerUI(),this._removeToastContainer();try{const r=await Gi(e,F(this,ct),10,F(this,De)),i=(t=r.response)==null?void 0:t.items;F(this,Ie).push(...i),$(this,ct,(n=r.response)==null?void 0:n.nextPageCursor)}catch{this._renderToastContainer("Error while searching files","error",F(this,Ae))}finally{$(this,je,!1),this._updateSelectedImageListContainerUI()}}async _updateFolder(e,t){Ee.updateUploadBtn(!0);try{const n=await as(t.key,e,t.nestedFolderName,t.createdBy,F(this,De))}catch{throw this._renderToastContainer("Something went wrong while updating the folder. Please try again later.","error",F(this,Ae)),new Error("Error updating the folder ")}finally{Ee.updateUploadBtn(!1),Ee.hide(),this._updateFolderListContainer()}}async _deleteFolder(e){Ee.updateUploadBtn(!0);try{await ls(e,F(this,De)),$(this,at,F(this,at).filter(t=>t.key!==e)),this._renderToastContainer("Folder Deleted Successfully","success",F(this,Ae))}catch{throw this._renderToastContainer("Something went wrong while deleting the folder. Please try again later.","error",F(this,Ae)),new Error("Error deleting the folder ")}finally{Ee.updateUploadBtn(!1),Ee.hide(),this._updateFolderListContainer()}}_createUpdateFolderDialog(e,t,n){e.addEventListener("click",r=>{r.stopPropagation(),Ke.hide();let i;const o=K("edit-form-wrapper"),a=K("form-control"),c=oe("Folder Name","input-label"),h=K();h.style.position="relative";const l=document.createElement("input");l.style.paddingLeft="40px";const u=oe();u.appendChild(Gt()),u.style.position="absolute",u.style.top="50%",u.style.left="5%",u.style.transform="translate(-40%, -40%)",l.classList.add("input-field"),h.append(l,u),t==="update"&&(l.value=n.name),l.onchange=d=>{i=d.target.value},a.append(c,h),o.append(a),Ee.show({content:o,header:t==="update"?"Update Folder":"Create Folder",confirmButtonText:t==="create"?"Save":"Update",dialogContentStyle:{minWidth:"35rem",padding:"10px"},showFooter:!0,showCloseBtn:!0,onConfirm:()=>{t==="create"?this._createFolder(i):this._updateFolder(i,n),Ee.hide()}})})}updateWindowObject(e){window.ImageSalonSDK={...window.ImageSalonSDK,...e}}_initializeGrpcConfig(e,t){let n="https://hamro-cms-backend-grpc.hamrostack.com";t&&(e==="production"||e==="development")?n=t:e==="production"&&(n="https://page-api-grpc.hamropatro.com");const r=new Bi({baseUrl:n});this.updateWindowObject({grpcConfig:r})}}return At=new WeakMap,Ae=new WeakMap,ve=new WeakMap,mt=new WeakMap,we=new WeakMap,Ie=new WeakMap,ot=new WeakMap,je=new WeakMap,Ot=new WeakMap,vt=new WeakMap,at=new WeakMap,tt=new WeakMap,kt=new WeakMap,$t=new WeakMap,Yt=new WeakMap,Ft=new WeakMap,Nt=new WeakMap,gt=new WeakMap,St=new WeakMap,lt=new WeakMap,ct=new WeakMap,It=new WeakMap,Lt=new WeakMap,wt=new WeakMap,Wt=new WeakMap,en=new WeakMap,De=new WeakMap,yt=new WeakMap,tn=new WeakMap,An=new WeakMap,nn=new WeakMap,_e=new WeakMap,Pt=new WeakMap,Tt=new WeakMap,jt=new WeakMap,vn=new WeakMap,kn=new WeakMap,Zt=new WeakMap,Ss});
108
+ `,n.textContent="Looks Empty!"),e.append(t,n),F(this,ve).appendChild(e)}_renderLoadingUI(){const e=K("skeleton");e.innerHTML="",F(this,ve).appendChild(e)}_fileCardBody(e){var ut,Kt,Fn,zt;const t=K("selected-image-content"),n=K("selected-image-top-bar"),r=Pe("","selected-image-btn","",!1,'<svg width="20px" height="20px" viewBox="0 0 20 20" focusable="false" fill="currentColor"><path fill="none" d="M0 0h20v20H0V0z"></path><path d="M10 6c.82 0 1.5-.68 1.5-1.5S10.82 3 10 3s-1.5.67-1.5 1.5S9.18 6 10 6zm0 5.5c.82 0 1.5-.68 1.5-1.5s-.68-1.5-1.5-1.5-1.5.68-1.5 1.5.68 1.5 1.5 1.5zm0 5.5c.82 0 1.5-.67 1.5-1.5 0-.82-.68-1.5-1.5-1.5s-1.5.68-1.5 1.5c0 .83.68 1.5 1.5 1.5z"></path></svg>');let i,o;(e==null?void 0:e.type)===it.IMAGE&&(i=Tr(e==null?void 0:e.url,"selected-image"),o=ds()),(e==null?void 0:e.type)===it.VIDEO&&(i=Cs(e==null?void 0:e.url,"uploaded-video"),o=ps()),(e==null?void 0:e.type)===it.AUDIO&&(i=Es(e==null?void 0:e.url,"uploaded-audio"),o=cs());const a=K("selected-image-wrapper");a.setAttribute("data-key",e==null?void 0:e.key);const c=Yt(e==null?void 0:e.name,"selected-image-name"),h=oe("","selected-image-type");h.append(o),n.append(h,r);const l=K();l.style.marginTop="10px",l.style.display="flex",l.style.justifyContent="space-between",l.style.alignItems="center",l.append(c),t.append(n,i),a.append(t,l);const u=K("action-wrapper"),d=Pe("","action-option preview"),f=oe("Preview",""),y=us();d.append(y,f);const I=Pe("","action-option move"),L=oe("Move",""),C=hs();I.append(C,L);const R=Pe("","action-option rename"),O=oe("Rename",""),v=vr();R.append(v,O);const x=Pe("","action-option delete"),b=oe("Delete",""),B=Fr();x.append(B,b);const m=e.name.split(".")[0],g=e.name.split(".")[1],A=Qt[e.type],N=K("edit-form-wrapper"),k=K("move-form-wrapper"),T=K("preview-details-container"),E=K("preview-details-wrapper"),U=K("preview-option-image-wrapper"),w=K("preview-option-wrapper"),p=K("preview-option-wrapper"),M=K("preview-option-wrapper"),_=K("preview-option-wrapper"),V=K("preview-option-wrapper"),q=K("preview-option-wrapper"),W=K("preview-option-wrapper"),Z=Tr(e.url,"preview-option-image");U.append(Z);const H=oe("File name","preview-title"),S=K("preview-option-name");S.innerHTML=e.name,w.append(H,S);const z=oe("Folder name","preview-title"),ce=oe(e.folderName,"preview-option-name");p.append(z,ce);const te=oe("File Extension","preview-title"),Q=oe(g,"preview-option-name extension");M.append(te,Q);const ae=oe("File type","preview-title"),me=oe(A,"preview-option-name");_.append(ae,me);const ke=oe("Dimension","preview-title"),bt=oe(`${(ut=e==null?void 0:e.metadata)==null?void 0:ut.width} * ${(Kt=e==null?void 0:e.metadata)==null?void 0:Kt.height}`,"preview-option-name");V.append(ke,bt);const ze=oe("URL","preview-title"),fe=oe(e.url,"preview-option-name url");q.append(ze,fe);const Le=oe("Parent folder","preview-title"),de=oe(e.nestedFolderName,"preview-option-name");W.append(Le,de),E.append(p,w,M,_,((Fn=e==null?void 0:e.metadata)==null?void 0:Fn.width)>0&&((zt=e==null?void 0:e.metadata)==null?void 0:zt.height)>0?V:"",q,e.nestedFolderName?W:""),T.append(U,E);const re=K("form-control"),ye=document.createElement("input");re.appendChild(ye),ye.classList.add("input-field"),ye.value=e.name;const Te=K("form-control"),be=oe("Current Folder:","input-label"),Ue=K("folder-field current");Ue.textContent=e.folderName,Ue.prepend(Jt()),Te.append(be,Ue);const ge=K("form-control"),Y=K();Y.style.width="100%",Y.style.display="flex",Y.style.alignItems="center",Y.style.justifyContent="space-between";const He=oe("Suggested Folder List:","input-label"),Re=oe();Re.style.display="flex",Re.style.alignItems="center",Re.style.gap="5px",Re.style.fontSize="14px",Re.textContent="Move the file in selected folder",Re.appendChild(Dn("14px","14px","#333")),Y.append(He,Re);const dt=K();dt.style.width="100%",dt.style.maxHeight="250px",dt.style.overflowY="auto";const Ne=document.createElement("ul");Ne.className="folders",dt.append(Ne),ge.append(Y,dt),F(this,at).forEach(ue=>{const Xe=this._renderEditFolderListContainer(ue);Ne.appendChild(Xe)});const ht=K("form-control"),Be=oe("Destination Folder:","input-label"),We=K("folder-field source","source-folder-wrapper"),Me=document.createElement("span");Me.id="source-folder-name",Me.textContent=F(this,Tt)?F(this,Tt):e.folderName,We.append(Jt(),Me);let Ve="";ht.append(Be,We),ye.onchange=ue=>{Ve=ue.target.value},Ve=Ve!==""?Ve:e.name,N.append(re),k.append(Te,ge,ht),u.append(d,I,R,x),d.onclick=ue=>{ue.stopPropagation(),Ke.hide(),Ee.show({content:T,header:m,dialogContentStyle:{minWidth:"60rem",padding:"10px"},showCloseBtn:!0})},I.onclick=ue=>{ue.stopPropagation(),Ke.hide(),Ee.show({content:k,header:`Move "${e.name}"`,confirmButtonText:"Move",dialogContentStyle:{minWidth:"35rem",padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{Ee.hide()},onConfirm:()=>{this._updateFile(Ve,e)}})},R.onclick=ue=>{ue.stopPropagation(),Ke.hide(),Ee.show({content:N,header:"Rename",confirmButtonText:"Update",dialogContentStyle:{padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{Ee.hide()},onConfirm:()=>{this._updateFile(Ve,e)}})},x.onclick=ue=>{ue.stopPropagation(),Ke.hide(),Ee.show({content:"",dialogContentStyle:{minWidth:"32rem",padding:"10px"},header:`Are you sure you want to delete the file "${e.name}"?`,showFooter:!0,confirmButtonText:"Yes",cancelButtonText:"No",onConfirm:()=>{this._deleteFile(e.key)}})},r.addEventListener("click",ue=>{ue.stopPropagation(),Ke.hide(),Ke.show({content:u,mainContainer:n,divId:e.key}),$(this,yt,e.key)}),i.addEventListener("click",()=>{const ue=F(this,we).findIndex(ft=>(ft==null?void 0:ft.key)===(e==null?void 0:e.key));if(t.classList.contains("checked"))t.classList.remove("checked"),ue!==-1&&(F(this,we).splice(ue,1),F(this,Ft)===1&&a.remove());else{if(F(this,An))F(this,we).push(e);else{const ft=document.querySelector(".selected-image-wrapper .checked");ft==null||ft.classList.remove("checked"),$(this,we,[e])}t.classList.add("checked")}this._updateContent()}),document.addEventListener("click",ue=>{const Xe=document.querySelector(`#${F(this,yt)}`);Xe&&(ue.composedPath().includes(Xe)||Ke.hide())}),F(this,we).findIndex(ue=>(ue==null?void 0:ue.key)===(e==null?void 0:e.key))!==-1?(t.classList.add("checked"),F(this,wt)?F(this,ve).prepend(a):F(this,ve).appendChild(a)):F(this,ve).appendChild(a)}_renderImageCard(e){this._fileCardBody(e)}_renderImageListContainer(){var e,t;((e=F(this,Ie))==null?void 0:e.length)>0&&((t=F(this,Ie))==null||t.forEach(n=>{this._renderImageCard(n)}))}_renderSelectedImageListContainer(){var e;((e=F(this,we))==null?void 0:e.length)>0&&F(this,we).forEach(t=>{this._renderImageCard(t)})}_renderFolderListLoadingUI(){const e=document.createElement("div");e.style.paddingInline="20px";for(let t=0;t<4;t++){const n=K("skeleton");n.className="skeleton folder",n.innerHTML="",e.appendChild(n)}return e}_renderFolderListContainer(e){var o;const t=document.createElement("li");t.className="folder";const n=document.createElement("div");n.style.position="relative",n.style.display="flex",n.style.alignItems="center",n.style.gap="2px";const r=document.createElement("span"),i=document.createElement("span");if(i.className="folder-name",i.textContent=e==null?void 0:e.name,r.appendChild(Jt()),n.append(r,i),t.append(n),e.children&&Object.keys(e.children).length>0){const a=document.createElement("button");a.classList.add("expand-icon"),a.appendChild(Er()),n.prepend(a);const c=document.createElement("ul");c.className="folders nested",t.appendChild(c),a.addEventListener("click",h=>{h.stopPropagation(),t.classList.toggle("active"),c.classList.toggle("visible")}),Object.values(e.children).forEach((h,l)=>{const u=this._renderFolderListContainer(h);c.appendChild(u)})}if(e.nestedFolderName){const a=Pe("","folder-option-btn","moveToInputField.disabled",!1,'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-ellipsis"><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/></svg>'),c=K("action-wrapper"),h=Pe("","action-option edit"),l=oe("Edit",""),u=vr();h.append(u,l);const d=K("edit-form-wrapper"),f=K("name-field-wrapper"),y=oe("Name","input-label"),I=document.createElement("input");I.classList.add("input-field"),I.value=e.name,I.onchange=v=>{v.target.value},f.append(y,I),d.append(f);const L={key:e.key,name:e.name,nestedFolderName:e.nestedFolderName,createdBy:e.createdBy};this._createUpdateFolderDialog(h,"update",L);const C=Pe("","action-option delete"),R=oe("Delete",""),O=Fr();C.append(O,R),c.append(h,C),C.onclick=v=>{v.stopPropagation(),Ke.hide(),Ee.show({content:"",dialogContentStyle:{minWidth:"32rem",padding:"10px"},header:`Are you sure you want to delete the folder "${e==null?void 0:e.name}"?`,showFooter:!0,confirmButtonText:"Yes",cancelButtonText:"No",onConfirm:()=>{this._deleteFolder(e.key)}})},a.addEventListener("click",v=>{v.stopPropagation();const x=document.querySelector(`#${e.key}`);$(this,yt,null),F(this,yt)===e.key&&x!==null?Ke.hide():(Ke.hide(),Ke.show({content:c,mainContainer:n,divId:e.key}),$(this,yt,e.key))}),n.appendChild(a)}return t.addEventListener("click",a=>{var c;a.stopPropagation(),$(this,tt,e),$(this,vt,e==null?void 0:e.name),$(this,we,[]),$(this,Ie,[]),$(this,ct,""),$(this,It,!1),(c=document.querySelector(".folder.selected"))==null||c.classList.remove("selected"),t.classList.add("selected"),this._fetchFilesFromFolder(e.name)}),((o=F(this,tt))==null?void 0:o.key)===(e==null?void 0:e.key)&&t.classList.add("selected"),t}_renderEditFolderListContainer(e){var o;const t=document.createElement("li");t.className="folder-move";const n=document.createElement("div");n.style.position="relative",n.style.display="flex",n.style.alignItems="center",n.style.gap="2px";const r=document.createElement("span"),i=document.createElement("span");if(i.className="folder-name",i.textContent=e==null?void 0:e.name,r.appendChild(Jt()),n.append(r,i),t.append(n),e.children&&Object.keys(e.children).length>0){const a=document.createElement("button");a.classList.add("expand-icon"),a.appendChild(Er()),n.prepend(a);const c=document.createElement("ul");c.className="folders nested",t.appendChild(c),a.addEventListener("click",h=>{h.stopPropagation(),t.classList.toggle("active"),c.classList.toggle("visible")}),Object.values(e.children).forEach(h=>{const l=this._renderEditFolderListContainer(h);c.appendChild(l)})}return t.addEventListener("click",a=>{var h;a.stopPropagation(),$(this,Tt,e==null?void 0:e.name);const c=document.querySelector("#source-folder-name");c.textContent="",c.textContent=e==null?void 0:e.name,(h=document.querySelector(".folder-move.selected"))==null||h.classList.remove("selected"),t.classList.add("selected")}),((o=F(this,tt))==null?void 0:o.key)===(e==null?void 0:e.key)&&t.classList.add("selected"),t}_updateFolderListContainer(){if(F(this,Nt))if(F(this,gt).innerHTML="",F(this,Ot)){const e=this._renderFolderListLoadingUI();F(this,gt).appendChild(e)}else{const e=document.createElement("ul");e.className="folders",F(this,gt).appendChild(e),F(this,at).forEach(t=>{const n=this._renderFolderListContainer(t);e.appendChild(n)}),F(this,Nt).appendChild(F(this,gt))}}_renderToastContainer(e,t,n){this._removeToastContainer(),$(this,lt,document.createElement("div")),F(this,lt).className=`message-container ${t}`;const r=Yt(e,"message"),i=t==="success"?Ar():Dn(),o=Pe("");o.style.cursor="pointer",o.style.border="0",o.style.outline="none",o.style.background="transparent",o.appendChild(Rn(t==="error"?"#ee3f3f":"#4caf50")),o.setAttribute("fill",t==="error"?"#ee3f3f":"#4caf50"),o.onclick=()=>this._removeToastContainer(),F(this,lt).append(i,r,o),n.appendChild(F(this,lt)),setTimeout(()=>{this._removeToastContainer()},5e3)}_removeToastContainer(){F(this,lt)&&(F(this,lt).remove(),$(this,lt,null))}_updateSelectedImageListContainerUI(){var t,n;if(!F(this,ve))return;F(this,ve).innerHTML="",F(this,ot)&&this._renderLoadingUI(),F(this,je)&&this._renderFetchingSkeletonUI();const e=document.getElementById("search-input-wrapper");F(this,Ft)===0?(e&&(e.style.visibility="visible"),((t=F(this,Ie))==null?void 0:t.length)===0&&!F(this,je)?(F(this,ve).classList.add("no-selected-image-container"),this._renderEmptyImageContainer()):(F(this,ve).classList.remove("no-selected-image-container"),this._renderImageListContainer())):(e&&(e.style.visibility="hidden"),((n=F(this,we))==null?void 0:n.length)===0?(F(this,ve).classList.add("no-selected-image-container"),this._renderEmptyImageContainer()):(F(this,ve).classList.remove("no-selected-image-container"),this._renderSelectedImageListContainer())),this._updateContent()}_updateContent(){var t,n,r;const e=document.getElementById("selected-images-tab");e&&(e.textContent=`Selected (${(t=F(this,we))==null?void 0:t.length})`),F(this,kt).textContent=`Save (${(n=F(this,we))==null?void 0:n.length})`,F(this,kt).disabled=((r=F(this,we))==null?void 0:r.length)===0}async _uploadAndAddSelectedImageList(e,t){var n,r;this._updateSelectedImageListContainerUI();try{const i=await Pr(e,t,F(this,De)),o=await Ki(t==null?void 0:t.name,"",i,it[Lr((n=t.type)==null?void 0:n.split("/")[0])],(r=F(this,tt))==null?void 0:r.name,F(this,De));F(this,Ie).unshift(o==null?void 0:o.response),this._renderToastContainer("File Uploaded Successfully","success",F(this,Ae))}catch{this._renderToastContainer("Something went wrong while uploading file. Please try again later.","error",F(this,Ae))}finally{$(this,ot,!1),this._updateSelectedImageListContainerUI()}}async _updateFile(e,t){Ee.updateUploadBtn(!0);try{const n=await Ji(t.key,e,t.nestedFolderName,t.url,t.thumborUrl,t.proxyUrl,t.type,F(this,Tt),F(this,De)),r=F(this,Ie).find(i=>i.key===n.response.key);r.name=e,this._fetchFilesFromFolder(F(this,tt).name),$(this,Ie,[]),$(this,we,[]),this._renderToastContainer("File Updated Successfully","success",F(this,Ae))}catch{this._renderToastContainer("Something went wrong while updating the file. Please try again later.","error",F(this,Ae))}finally{Ee.updateUploadBtn(!1),Ee.hide(),this._updateSelectedImageListContainerUI()}}async _deleteFile(e){Ee.updateUploadBtn(!0);try{await Qi(e,F(this,De)),$(this,Ie,F(this,Ie).filter(t=>e!==t.key)),this._renderToastContainer("File Deleted Successfully","success",F(this,Ae))}catch{this._renderToastContainer("Something went wrong while deleting the file. Please try again later.","error",F(this,Ae))}finally{Ee.updateUploadBtn(!1),Ee.hide(),this._updateSelectedImageListContainerUI()}}async _createFolder(e,t=2){var n;try{const r=await os(e,(n=F(this,tt))==null?void 0:n.name,"",F(this,De));$(this,we,[]),$(this,Ie,[]);const i=ys(F(this,at),r==null?void 0:r.response);$(this,at,i),$(this,vt,e),$(this,tt,{...r==null?void 0:r.response,children:{}}),this._fetchFilesFromFolder(e),this._renderToastContainer(`Folder ${e} created successfully`,"success",F(this,Ae))}catch{if(t>1)this._createFolder(e,--t);else throw this._renderToastContainer(`Error creating folder "${e}". Either folder already exist or failed to create folder`,"error",F(this,Ae)),new Error(`Error creating folder "${e}". Either folder already exist or failed to create folder`)}finally{this._updateFolderListContainer()}}async _upload(){return F(this,nn)?F(this,we):F(this,jt)}async _fetchFilesFromFolder(e){var t,n,r;$(this,je,!0),this._updateSelectedImageListContainerUI();try{const i=await Xi(e,F(this,ct),20,F(this,De)),o=(t=i.response)==null?void 0:t.files;F(this,Ie).push(...o),$(this,ct,(n=i.response)==null?void 0:n.nextCursor),$(this,It,(r=i.response)==null?void 0:r.hasMore)}catch{throw this._renderToastContainer("Error while fetching files from folder"+e,"error",F(this,Ae)),new Error("Something went wrong. Error while fetching files from folder"+e)}finally{$(this,je,!1),this._updateSelectedImageListContainerUI()}}async _fetchAllFolders(){var e,t;$(this,je,!0),$(this,Ot,!0),this._updateSelectedImageListContainerUI(),this._updateFolderListContainer(),this._removeToastContainer();try{const r=(await ss("",100,F(this,De))).response.folder,i=ws(r);$(this,vt,(e=i[0])==null?void 0:e.name),this._fetchFilesFromFolder((t=i[0])==null?void 0:t.name),$(this,tt,i[0]),$(this,at,i)}catch{$(this,je,!1),this._renderToastContainer("Folder not found. Please create a folder or try again later","error",F(this,Ae))}finally{$(this,Ot,!1),this._updateFolderListContainer()}}async _search(e){var t,n;$(this,je,!0),this._updateSelectedImageListContainerUI(),this._removeToastContainer();try{const r=await Gi(e,F(this,ct),10,F(this,De)),i=(t=r.response)==null?void 0:t.items;F(this,Ie).push(...i),$(this,ct,(n=r.response)==null?void 0:n.nextPageCursor)}catch{this._renderToastContainer("Error while searching files","error",F(this,Ae))}finally{$(this,je,!1),this._updateSelectedImageListContainerUI()}}async _updateFolder(e,t){Ee.updateUploadBtn(!0);try{const n=await as(t.key,e,t.nestedFolderName,t.createdBy,F(this,De))}catch{throw this._renderToastContainer("Something went wrong while updating the folder. Please try again later.","error",F(this,Ae)),new Error("Error updating the folder ")}finally{Ee.updateUploadBtn(!1),Ee.hide(),this._updateFolderListContainer()}}async _deleteFolder(e){Ee.updateUploadBtn(!0);try{await ls(e,F(this,De)),$(this,at,F(this,at).filter(t=>t.key!==e)),this._renderToastContainer("Folder Deleted Successfully","success",F(this,Ae))}catch{throw this._renderToastContainer("Something went wrong while deleting the folder. Please try again later.","error",F(this,Ae)),new Error("Error deleting the folder ")}finally{Ee.updateUploadBtn(!1),Ee.hide(),this._updateFolderListContainer()}}_createUpdateFolderDialog(e,t,n){e.addEventListener("click",r=>{r.stopPropagation(),Ke.hide();let i;const o=K("edit-form-wrapper"),a=K("form-control"),c=oe("Folder Name","input-label"),h=K();h.style.position="relative";const l=document.createElement("input");l.style.paddingLeft="40px";const u=oe();u.appendChild(Jt()),u.style.position="absolute",u.style.top="50%",u.style.left="5%",u.style.transform="translate(-40%, -40%)",l.classList.add("input-field"),h.append(l,u),t==="update"&&(l.value=n.name),l.onchange=d=>{i=d.target.value},a.append(c,h),o.append(a),Ee.show({content:o,header:t==="update"?"Update Folder":"Create Folder",confirmButtonText:t==="create"?"Save":"Update",dialogContentStyle:{minWidth:"35rem",padding:"10px"},showFooter:!0,showCloseBtn:!0,onConfirm:()=>{t==="create"?this._createFolder(i):this._updateFolder(i,n),Ee.hide()}})})}updateWindowObject(e){window.ImageSalonSDK={...window.ImageSalonSDK,...e}}_initializeGrpcConfig(e,t){let n="https://hamro-cms-backend-grpc.hamrostack.com";t&&(e==="production"||e==="development")?n=t:e==="production"&&(n="https://page-api-grpc.hamropatro.com");const r=new Bi({baseUrl:n});this.updateWindowObject({grpcConfig:r})}}return At=new WeakMap,Ae=new WeakMap,ve=new WeakMap,mt=new WeakMap,we=new WeakMap,Ie=new WeakMap,ot=new WeakMap,je=new WeakMap,Ot=new WeakMap,vt=new WeakMap,at=new WeakMap,tt=new WeakMap,kt=new WeakMap,$t=new WeakMap,Wt=new WeakMap,Ft=new WeakMap,Nt=new WeakMap,gt=new WeakMap,St=new WeakMap,lt=new WeakMap,ct=new WeakMap,It=new WeakMap,Lt=new WeakMap,wt=new WeakMap,Pt=new WeakMap,en=new WeakMap,De=new WeakMap,yt=new WeakMap,tn=new WeakMap,An=new WeakMap,nn=new WeakMap,_e=new WeakMap,jt=new WeakMap,Tt=new WeakMap,Zt=new WeakMap,vn=new WeakMap,kn=new WeakMap,qt=new WeakMap,Ss});