image-salon-sdk 1.0.74 → 1.0.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/folder-service.d.ts +1 -1
- package/dist/grpc/generated/exposed-folder-service.client.d.ts +21 -1
- package/dist/grpc/generated/exposed-folder-service.d.ts +23 -0
- package/dist/image-salon-sdk.js +2523 -2445
- package/dist/image-salon-sdk.umd.cjs +7 -7
- package/dist/image-salon.d.ts +1 -0
- package/dist/types/image-salon-types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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
|
|
3
|
-
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(n){case 0:o=i,n=1;break;case 1:t[r++]=o<<2|(i&48)>>4,o=i,n=2;break;case 2:t[r++]=(o&15)<<4|(i&60)>>2,o=i,n=3;break;case 3:t[r++]=(o&3)<<6|i,n=0;break}}if(n==1)throw Error("invalid base64 string.");return t.subarray(0,r)}function er(s){let e="",t=0,r,n=0;for(let i=0;i<s.length;i++)switch(r=s[i],t){case 0:e+=he[r>>2],n=(r&3)<<4,t=1;break;case 1:e+=he[n|r>>4],n=(r&15)<<2,t=2;break;case 2:e+=he[n|r>>6],e+=he[r&63],t=0;break}return t&&(e+=he[n],e+="=",t==1&&(e+="=")),e}var G;(function(s){s.symbol=Symbol.for("protobuf-ts/unknown"),s.onRead=(t,r,n,i,o)=>{(e(r)?r[s.symbol]:r[s.symbol]=[]).push({no:n,wireType:i,data:o})},s.onWrite=(t,r,n)=>{for(let{no:i,wireType:o,data:a}of s.list(r))n.tag(i,o).raw(a)},s.list=(t,r)=>{if(e(t)){let n=t[s.symbol];return r?n.filter(i=>i.no==r):n}return[]},s.last=(t,r)=>s.list(t,r).slice(-1)[0];const e=t=>t&&Array.isArray(t[s.symbol])})(G||(G={}));function ni(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 ri(){let s=0,e=0;for(let r=0;r<28;r+=7){let n=this.buf[this.pos++];if(s|=(n&127)<<r,!(n&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 r=3;r<=31;r+=7){let n=this.buf[this.pos++];if(e|=(n&127)<<r,!(n&128))return this.assertBounds(),[s,e]}throw new Error("invalid varint")}function _n(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 r=s>>>28&15|(e&7)<<4,n=!!(e>>3);if(t.push((n?r|128:r)&255),!!n){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 un=65536*65536;function tr(s){let e=s[0]=="-";e&&(s=s.slice(1));const t=1e6;let r=0,n=0;function i(o,a){const c=Number(s.slice(o,a));n*=t,r=r*t+c,r>=un&&(n=n+(r/un|0),r=r%un)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),[e,r,n]}function Bn(s,e){if(e>>>0<=2097151)return""+(un*e+(s>>>0));let t=s&16777215,r=(s>>>24|e<<8)>>>0&16777215,n=e>>16&65535,i=t+r*6777216+n*6710656,o=r+n*8147497,a=n*2,c=1e7;i>=c&&(o+=Math.floor(i/c),i%=c),o>=c&&(a+=Math.floor(o/c),o%=c);function d(l,u){let h=l?String(l):"";return u?"0000000".slice(h.length)+h:h}return d(a,0)+d(o,a)+d(i,1)}function nr(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 ii(){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 si(){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}si();function rr(s){if(!s)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}const ir=/^-?[0-9]+$/,fn=4294967296,pn=2147483648;class sr{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*fn+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}}class Be extends sr{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 Be(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(),!ir.test(e))throw new Error("string is no integer");let[t,r,n]=tr(e);if(t)throw new Error("signed value for ulong");return new Be(r,n);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 Be(e,e/fn)}throw new Error("unknown value "+typeof e)}toString(){return ie?this.toBigInt().toString():Bn(this.lo,this.hi)}toBigInt(){return rr(ie),ie.V.setInt32(0,this.lo,!0),ie.V.setInt32(4,this.hi,!0),ie.V.getBigUint64(0,!0)}}Be.ZERO=new Be(0,0);class Ce extends sr{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(),!ir.test(e))throw new Error("string is no integer");let[t,r,n]=tr(e);if(t){if(n>pn||n==pn&&r!=0)throw new Error("signed long too small")}else if(n>=pn)throw new Error("signed long too large");let i=new Ce(r,n);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/fn):new Ce(-e,-e/fn).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return(this.hi&pn)!==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"-"+Bn(e.lo,e.hi)}return Bn(this.lo,this.hi)}toBigInt(){return rr(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 or={readUnknownField:!0,readerFactory:s=>new ai(s)};function oi(s){return s?Object.assign(Object.assign({},or),s):or}class ai{constructor(e,t){this.varint64=ri,this.uint32=ii,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,r=e&7;if(t<=0||r<0||r>5)throw new Error("illegal tag: field no "+t+" wire type "+r);return[t,r]}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 r=this.uint32();this.pos+=r;break;case j.StartGroup:let n;for(;(n=this.tag()[1])!==j.EndGroup;)this.skip(n);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 Be(...this.varint64())}sint64(){let[e,t]=this.varint64(),r=-(e&1);return e=(e>>>1|(t&1)<<31)^r,t=t>>>1^r,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 Be(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 li=34028234663852886e22,ci=-34028234663852886e22,di=4294967295,hi=2147483647,ui=-2147483648;function tn(s){if(typeof s!="number")throw new Error("invalid int 32: "+typeof s);if(!Number.isInteger(s)||s>hi||s<ui)throw new Error("invalid int 32: "+s)}function mn(s){if(typeof s!="number")throw new Error("invalid uint 32: "+typeof s);if(!Number.isInteger(s)||s>di||s<0)throw new Error("invalid uint 32: "+s)}function Sn(s){if(typeof s!="number")throw new Error("invalid float 32: "+typeof s);if(Number.isFinite(s)&&(s>li||s<ci))throw new Error("invalid float 32: "+s)}const ar={writeUnknownFields:!0,writerFactory:()=>new pi};function fi(s){return s?Object.assign(Object.assign({},ar),s):ar}class pi{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 n=0;n<this.chunks.length;n++)e+=this.chunks[n].length;let t=new Uint8Array(e),r=0;for(let n=0;n<this.chunks.length;n++)t.set(this.chunks[n],r),r+=this.chunks[n].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(mn(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return tn(e),nr(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){Sn(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){mn(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){tn(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return tn(e),e=(e<<1^e>>31)>>>0,nr(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),n=Ce.from(e);return r.setInt32(0,n.lo,!0),r.setInt32(4,n.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),n=Be.from(e);return r.setInt32(0,n.lo,!0),r.setInt32(4,n.hi,!0),this.raw(t)}int64(e){let t=Ce.from(e);return _n(t.lo,t.hi,this.buf),this}sint64(e){let t=Ce.from(e),r=t.hi>>31,n=t.lo<<1^r,i=(t.hi<<1|t.lo>>>31)^r;return _n(n,i,this.buf),this}uint64(e){let t=Be.from(e);return _n(t.lo,t.hi,this.buf),this}}const lr={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},cr={ignoreUnknownFields:!1};function mi(s){return s?Object.assign(Object.assign({},cr),s):cr}function gi(s){return s?Object.assign(Object.assign({},lr),s):lr}function wi(s,e){var t,r;let n=Object.assign(Object.assign({},s),e);return n.typeRegistry=[...(t=s==null?void 0:s.typeRegistry)!==null&&t!==void 0?t:[],...(r=e==null?void 0:e.typeRegistry)!==null&&r!==void 0?r:[]],n}const dr=Symbol.for("protobuf-ts/message-type");function On(s){let e=!1;const t=[];for(let r=0;r<s.length;r++){let n=s.charAt(r);n=="_"?e=!0:/\d/.test(n)?(t.push(n),e=!0):e?(t.push(n.toUpperCase()),e=!1):r==0?t.push(n.toLowerCase()):t.push(n)}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 it;(function(s){s[s.BIGINT=0]="BIGINT",s[s.STRING=1]="STRING",s[s.NUMBER=2]="NUMBER"})(it||(it={}));var gn;(function(s){s[s.NO=0]="NO",s[s.PACKED=1]="PACKED",s[s.UNPACKED=2]="UNPACKED"})(gn||(gn={}));function yi(s){var e,t,r,n;return s.localName=(e=s.localName)!==null&&e!==void 0?e:On(s.name),s.jsonName=(t=s.jsonName)!==null&&t!==void 0?t:On(s.name),s.repeat=(r=s.repeat)!==null&&r!==void 0?r:gn.NO,s.opt=(n=s.opt)!==null&&n!==void 0?n:s.repeat||s.oneof?!1:s.kind=="message",s}function bi(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 Ci{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}prepare(){if(this.data)return;const e=[],t=[],r=[];for(let n of this.fields)if(n.oneof)r.includes(n.oneof)||(r.push(n.oneof),e.push(n.oneof),t.push(n.oneof));else switch(t.push(n.localName),n.kind){case"scalar":case"enum":(!n.opt||n.repeat)&&e.push(n.localName);break;case"message":n.repeat&&e.push(n.localName);break;case"map":e.push(n.localName);break}this.data={req:e,known:t,oneofs:Object.values(r)}}is(e,t,r=!1){if(t<0)return!0;if(e==null||typeof e!="object")return!1;this.prepare();let n=Object.keys(e),i=this.data;if(n.length<i.req.length||i.req.some(o=>!n.includes(o))||!r&&n.some(o=>!i.known.includes(o)))return!1;if(t<1)return!0;for(const o of i.oneofs){const a=e[o];if(!bi(a))return!1;if(a.oneofKind===void 0)continue;const c=this.fields.find(d=>d.localName===a.oneofKind);if(!c||!this.field(a[a.oneofKind],c,r,t))return!1}for(const o of this.fields)if(o.oneof===void 0&&!this.field(e[o.localName],o,r,t))return!1;return!0}field(e,t,r,n){let i=t.repeat;switch(t.kind){case"scalar":return e===void 0?t.opt:i?this.scalars(e,t.T,n,t.L):this.scalar(e,t.T,t.L);case"enum":return e===void 0?t.opt:i?this.scalars(e,D.INT32,n):this.scalar(e,D.INT32);case"message":return e===void 0?!0:i?this.messages(e,t.T(),r,n):this.message(e,t.T(),r,n);case"map":if(typeof e!="object"||e===null)return!1;if(n<2)return!0;if(!this.mapKeys(e,t.K,n))return!1;switch(t.V.kind){case"scalar":return this.scalars(Object.values(e),t.V.T,n,t.V.L);case"enum":return this.scalars(Object.values(e),D.INT32,n);case"message":return this.messages(Object.values(e),t.V.T(),r,n)}break}return!0}message(e,t,r,n){return r?t.isAssignable(e,n):t.is(e,n)}messages(e,t,r,n){if(!Array.isArray(e))return!1;if(n<2)return!0;if(r){for(let i=0;i<e.length&&i<n;i++)if(!t.isAssignable(e[i],n-1))return!1}else for(let i=0;i<e.length&&i<n;i++)if(!t.is(e[i],n-1))return!1;return!0}scalar(e,t,r){let n=typeof e;switch(t){case D.UINT64:case D.FIXED64:case D.INT64:case D.SFIXED64:case D.SINT64:switch(r){case it.BIGINT:return n=="bigint";case it.NUMBER:return n=="number"&&!isNaN(e);default:return n=="string"}case D.BOOL:return n=="boolean";case D.STRING:return n=="string";case D.BYTES:return e instanceof Uint8Array;case D.DOUBLE:case D.FLOAT:return n=="number"&&!isNaN(e);default:return n=="number"&&Number.isInteger(e)}}scalars(e,t,r,n){if(!Array.isArray(e))return!1;if(r<2)return!0;if(Array.isArray(e)){for(let i=0;i<e.length&&i<r;i++)if(!this.scalar(e[i],t,n))return!1}return!0}mapKeys(e,t,r){let n=Object.keys(e);switch(t){case D.INT32:case D.FIXED32:case D.SFIXED32:case D.SINT32:case D.UINT32:return this.scalars(n.slice(0,r).map(i=>parseInt(i)),t,r);case D.BOOL:return this.scalars(n.slice(0,r).map(i=>i=="true"?!0:i=="false"?!1:i),t,r);default:return this.scalars(n,t,r,it.STRING)}}}function Xe(s,e){switch(e){case it.BIGINT:return s.toBigInt();case it.NUMBER:return s.toNumber();default:return s.toString()}}class Ei{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 r of t)this.fMap[r.name]=r,this.fMap[r.jsonName]=r,this.fMap[r.localName]=r}}assert(e,t,r){if(!e){let n=ne(r);throw(n=="number"||n=="boolean")&&(n=r.toString()),new Error(`Cannot parse JSON ${n} for ${this.info.typeName}#${t}`)}}read(e,t,r){this.prepare();const n=[];for(const[i,o]of Object.entries(e)){const a=this.fMap[i];if(!a){if(!r.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${i}`);continue}const c=a.localName;let d;if(a.oneof){if(o===null&&(a.kind!=="enum"||a.T()[0]!=="google.protobuf.NullValue"))continue;if(n.includes(a.oneof))throw new Error(`Multiple members of the oneof group "${a.oneof}" of ${this.info.typeName} are present in JSON.`);n.push(a.oneof),d=t[a.oneof]={oneofKind:c}}else d=t;if(a.kind=="map"){if(o===null)continue;this.assert(le(o),a.name,o);const l=d[c];for(const[u,h]of Object.entries(o)){this.assert(h!==null,a.name+" map value",null);let f;switch(a.V.kind){case"message":f=a.V.T().internalJsonRead(h,r);break;case"enum":if(f=this.enum(a.V.T(),h,a.name,r.ignoreUnknownFields),f===!1)continue;break;case"scalar":f=this.scalar(h,a.V.T,a.V.L,a.name);break}this.assert(f!==void 0,a.name+" map value",h);let y=u;a.K==D.BOOL&&(y=y=="true"?!0:y=="false"?!1:y),y=this.scalar(y,a.K,it.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=d[c];for(const u of o){this.assert(u!==null,a.name,null);let h;switch(a.kind){case"message":h=a.T().internalJsonRead(u,r);break;case"enum":if(h=this.enum(a.T(),u,a.name,r.ignoreUnknownFields),h===!1)continue;break;case"scalar":h=this.scalar(u,a.T,a.L,a.name);break}this.assert(h!==void 0,a.name,o),l.push(h)}}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}d[c]=a.T().internalJsonRead(o,r,d[c]);break;case"enum":let l=this.enum(a.T(),o,a.name,r.ignoreUnknownFields);if(l===!1)continue;d[c]=l;break;case"scalar":d[c]=this.scalar(o,a.T,a.L,a.name);break}}}enum(e,t,r,n){if(e[0]=="google.protobuf.NullValue"&&J(t===null||t==="NULL_VALUE",`Unable to parse field ${this.info.typeName}#${r}, 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}#${r}, 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"&&n?!1:(J(typeof o=="number",`Unable to parse field ${this.info.typeName}#${r}, enum ${e[0]} has no value for "${t}".`),o)}J(!1,`Unable to parse field ${this.info.typeName}#${r}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,r,n){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&&Sn(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?mn(a):tn(a),a;case D.INT64:case D.SFIXED64:case D.SINT64:if(e===null)return Xe(Ce.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return Xe(Ce.from(e),r);case D.FIXED64:case D.UINT64:if(e===null)return Xe(Be.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return Xe(Be.from(e),r);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 Yn(e)}}catch(o){i=o.message}this.assert(!1,n+(i?" - "+i:""),e)}}class vi{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}write(e,t){const r={},n=e;for(const i of this.fields){if(!i.oneof){let d=this.field(i,n[i.localName],t);d!==void 0&&(r[t.useProtoFieldName?i.name:i.jsonName]=d);continue}const o=n[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),r[t.useProtoFieldName?i.name:i.jsonName]=c}return r}field(e,t,r){let n;if(e.kind=="map"){J(typeof t=="object"&&t!==null);const i={};switch(e.V.kind){case"scalar":for(const[c,d]of Object.entries(t)){const l=this.scalar(e.V.T,d,e.name,!1,!0);J(l!==void 0),i[c.toString()]=l}break;case"message":const o=e.V.T();for(const[c,d]of Object.entries(t)){const l=this.message(o,d,e.name,r);J(l!==void 0),i[c.toString()]=l}break;case"enum":const a=e.V.T();for(const[c,d]of Object.entries(t)){J(d===void 0||typeof d=="number");const l=this.enum(a,d,e.name,!1,!0,r.enumAsInteger);J(l!==void 0),i[c.toString()]=l}break}(r.emitDefaultValues||Object.keys(i).length>0)&&(n=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 d=this.scalar(e.T,t[c],e.name,e.opt,!0);J(d!==void 0),i.push(d)}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 d=this.enum(o,t[c],e.name,e.opt,!0,r.enumAsInteger);J(d!==void 0),i.push(d)}break;case"message":const a=e.T();for(let c=0;c<t.length;c++){const d=this.message(a,t[c],e.name,r);J(d!==void 0),i.push(d)}break}(r.emitDefaultValues||i.length>0||r.emitDefaultValues)&&(n=i)}else switch(e.kind){case"scalar":n=this.scalar(e.T,t,e.name,e.opt,r.emitDefaultValues);break;case"enum":n=this.enum(e.T(),t,e.name,e.opt,r.emitDefaultValues,r.enumAsInteger);break;case"message":n=this.message(e.T(),t,e.name,r);break}return n}enum(e,t,r,n,i,o){if(e[0]=="google.protobuf.NullValue")return!i&&!n?void 0:null;if(t===void 0){J(n);return}if(!(t===0&&!i&&!n))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,r,n){return t===void 0?n.emitDefaultValues?null:void 0:e.internalJsonWrite(t,n)}scalar(e,t,r,n,i){if(t===void 0){J(n);return}const o=i||n;switch(e){case D.INT32:case D.SFIXED32:case D.SINT32:return t===0?o?0:void 0:(tn(t),t);case D.FIXED32:case D.UINT32:return t===0?o?0:void 0:(mn(t),t);case D.FLOAT:Sn(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=Be.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?er(t):o?"":void 0}}}function Rn(s,e=it.STRING){switch(s){case D.BOOL:return!1;case D.UINT64:case D.FIXED64:return Xe(Be.ZERO,e);case D.INT64:case D.SFIXED64:case D.SINT64:return Xe(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 Ai{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(r=>[r.no,r]))}}read(e,t,r,n){this.prepare();const i=n===void 0?e.len:e.pos+n;for(;e.pos<i;){const[o,a]=e.tag(),c=this.fieldNoToField.get(o);if(!c){let h=r.readUnknownField;if(h=="throw")throw new Error(`Unknown field ${o} (wire type ${a}) for ${this.info.typeName}`);let f=e.skip(a);h!==!1&&(h===!0?G.onRead:h)(this.info.typeName,t,o,a,f);continue}let d=t,l=c.repeat,u=c.localName;switch(c.oneof&&(d=d[c.oneof],d.oneofKind!==u&&(d=t[c.oneof]={oneofKind:u})),c.kind){case"scalar":case"enum":let h=c.kind=="enum"?D.INT32:c.T,f=c.kind=="scalar"?c.L:void 0;if(l){let T=d[u];if(a==j.LengthDelimited&&h!=D.STRING&&h!=D.BYTES){let C=e.uint32()+e.pos;for(;e.pos<C;)T.push(this.scalar(e,h,f))}else T.push(this.scalar(e,h,f))}else d[u]=this.scalar(e,h,f);break;case"message":if(l){let T=d[u],C=c.T().internalBinaryRead(e,e.uint32(),r);T.push(C)}else d[u]=c.T().internalBinaryRead(e,e.uint32(),r,d[u]);break;case"map":let[y,k]=this.mapEntry(c,e,r);d[u][y]=k;break}}}mapEntry(e,t,r){let n=t.uint32(),i=t.pos+n,o,a;for(;t.pos<i;){let[c,d]=t.tag();switch(c){case 1:e.K==D.BOOL?o=t.bool().toString():o=this.scalar(t,e.K,it.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(),r);break}break;default:throw new Error(`Unknown field ${c} (wire type ${d}) in map entry for ${this.info.typeName}#${e.name}`)}}if(o===void 0){let c=Rn(e.K);o=e.K==D.BOOL?c.toString():c}if(a===void 0)switch(e.V.kind){case"scalar":a=Rn(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,r){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 Xe(e.int64(),r);case D.UINT64:return Xe(e.uint64(),r);case D.FIXED64:return Xe(e.fixed64(),r);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 Xe(e.sfixed64(),r);case D.SINT32:return e.sint32();case D.SINT64:return Xe(e.sint64(),r)}}}class ki{constructor(e){this.info=e}prepare(){if(!this.fields){const e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((t,r)=>t.no-r.no)}}write(e,t,r){this.prepare();for(const i of this.fields){let o,a,c=i.repeat,d=i.localName;if(i.oneof){const l=e[i.oneof];if(l.oneofKind!==d)continue;o=l[d],a=!0}else o=e[d],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==gn.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,r,i.T(),i.no,u)}else this.message(t,r,i.T(),i.no,o);break;case"map":J(typeof o=="object"&&o!==null);for(const[u,h]of Object.entries(o))this.mapEntry(t,r,i,u,h);break}}let n=r.writeUnknownFields;n!==!1&&(n===!0?G.onWrite:n)(this.info.typeName,e,t)}mapEntry(e,t,r,n,i){e.tag(r.no,j.LengthDelimited),e.fork();let o=n;switch(r.K){case D.INT32:case D.FIXED32:case D.UINT32:case D.SFIXED32:case D.SINT32:o=Number.parseInt(n);break;case D.BOOL:J(n=="true"||n=="false"),o=n=="true";break}switch(this.scalar(e,r.K,1,o,!0),r.V.kind){case"scalar":this.scalar(e,r.V.T,2,i,!0);break;case"enum":this.scalar(e,D.INT32,2,i,!0);break;case"message":this.message(e,t,r.V.T(),2,i);break}e.join()}message(e,t,r,n,i){i!==void 0&&(r.internalBinaryWrite(i,e.tag(n,j.LengthDelimited).fork(),t),e.join())}scalar(e,t,r,n,i){let[o,a,c]=this.scalarInfo(t,n);(!c||i)&&(e.tag(r,o),e[a](n))}packed(e,t,r,n){if(!n.length)return;J(t!==D.BYTES&&t!==D.STRING),e.tag(r,j.LengthDelimited),e.fork();let[,i]=this.scalarInfo(t);for(let o=0;o<n.length;o++)e[i](n[o]);e.join()}scalarInfo(e,t){let r=j.Varint,n,i=t===void 0,o=t===0;switch(e){case D.INT32:n="int32";break;case D.STRING:o=i||!t.length,r=j.LengthDelimited,n="string";break;case D.BOOL:o=t===!1,n="bool";break;case D.UINT32:n="uint32";break;case D.DOUBLE:r=j.Bit64,n="double";break;case D.FLOAT:r=j.Bit32,n="float";break;case D.INT64:o=i||Ce.from(t).isZero(),n="int64";break;case D.UINT64:o=i||Be.from(t).isZero(),n="uint64";break;case D.FIXED64:o=i||Be.from(t).isZero(),r=j.Bit64,n="fixed64";break;case D.BYTES:o=i||!t.byteLength,r=j.LengthDelimited,n="bytes";break;case D.FIXED32:r=j.Bit32,n="fixed32";break;case D.SFIXED32:r=j.Bit32,n="sfixed32";break;case D.SFIXED64:o=i||Ce.from(t).isZero(),r=j.Bit64,n="sfixed64";break;case D.SINT32:n="sint32";break;case D.SINT64:o=i||Ce.from(t).isZero(),n="sint64";break}return[r,n,i||o]}}function Fi(s){const e=s.messagePrototype?Object.create(s.messagePrototype):Object.defineProperty({},dr,{value:s});for(let t of s.fields){let r=t.localName;if(!t.opt)if(t.oneof)e[t.oneof]={oneofKind:void 0};else if(t.repeat)e[r]=[];else switch(t.kind){case"scalar":e[r]=Rn(t.T,t.L);break;case"enum":e[r]=0;break;case"map":e[r]={};break}}return e}function Ee(s,e,t){let r,n=t,i;for(let o of s.fields){let a=o.localName;if(o.oneof){const c=n[o.oneof];if((c==null?void 0:c.oneofKind)==null)continue;if(r=c[a],i=e[o.oneof],i.oneofKind=c.oneofKind,r==null){delete i[a];continue}}else if(r=n[a],i=e,r==null)continue;switch(o.repeat&&(i[a].length=r.length),o.kind){case"scalar":case"enum":if(o.repeat)for(let d=0;d<r.length;d++)i[a][d]=r[d];else i[a]=r;break;case"message":let c=o.T();if(o.repeat)for(let d=0;d<r.length;d++)i[a][d]=c.create(r[d]);else i[a]===void 0?i[a]=c.create(r):c.mergePartial(i[a],r);break;case"map":switch(o.V.kind){case"scalar":case"enum":Object.assign(i[a],r);break;case"message":let d=o.V.T();for(let l of Object.keys(r))i[a][l]=d.create(r[l]);break}break}}}function Ni(s,e,t){if(e===t)return!0;if(!e||!t)return!1;for(let r of s.fields){let n=r.localName,i=r.oneof?e[r.oneof][n]:e[n],o=r.oneof?t[r.oneof][n]:t[n];switch(r.kind){case"enum":case"scalar":let a=r.kind=="enum"?D.INT32:r.T;if(!(r.repeat?ur(a,i,o):hr(a,i,o)))return!1;break;case"map":if(!(r.V.kind=="message"?fr(r.V.T(),wn(i),wn(o)):ur(r.V.kind=="enum"?D.INT32:r.V.T,wn(i),wn(o))))return!1;break;case"message":let c=r.T();if(!(r.repeat?fr(c,i,o):c.equals(i,o)))return!1;break}}return!0}const wn=Object.values;function hr(s,e,t){if(e===t)return!0;if(s!==D.BYTES)return!1;let r=e,n=t;if(r.length!==n.length)return!1;for(let i=0;i<r.length;i++)if(r[i]!=n[i])return!1;return!0}function ur(s,e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!hr(s,e[r],t[r]))return!1;return!0}function fr(s,e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!s.equals(e[r],t[r]))return!1;return!0}const Ii=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({}));class Te{constructor(e,t,r){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(yi),this.options=r??{},this.messagePrototype=Object.create(null,Object.assign(Object.assign({},Ii),{[dr]:{value:this}})),this.refTypeCheck=new Ci(this),this.refJsonReader=new Ei(this),this.refJsonWriter=new vi(this),this.refBinReader=new Ai(this),this.refBinWriter=new ki(this)}create(e){let t=Fi(this);return e!==void 0&&Ee(this,t,e),t}clone(e){let t=this.create();return Ee(this,t,e),t}equals(e,t){return Ni(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){Ee(this,e,t)}fromBinary(e,t){let r=oi(t);return this.internalBinaryRead(r.readerFactory(e),e.byteLength,r)}fromJson(e,t){return this.internalJsonRead(e,mi(t))}fromJsonString(e,t){let r=JSON.parse(e);return this.fromJson(r,t)}toJson(e,t){return this.internalJsonWrite(e,gi(t))}toJsonString(e,t){var r;let n=this.toJson(e,t);return JSON.stringify(n,null,(r=t==null?void 0:t.prettySpaces)!==null&&r!==void 0?r:0)}toBinary(e,t){let r=fi(t);return this.internalBinaryWrite(e,r.writerFactory(),r).finish()}internalJsonRead(e,t,r){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let n=r??this.create();return this.refJsonReader.read(e,n,t),n}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,r){return this.refBinWriter.write(e,t,r),t}internalBinaryRead(e,t,r,n){let i=n??this.create();return this.refBinReader.read(e,i,r,t),i}}function Ti(s,e){var t,r,n;let i=s;return i.service=e,i.localName=(t=i.localName)!==null&&t!==void 0?t:On(i.name),i.serverStreaming=!!i.serverStreaming,i.clientStreaming=!!i.clientStreaming,i.options=(r=i.options)!==null&&r!==void 0?r:{},i.idempotency=(n=i.idempotency)!==null&&n!==void 0?n:void 0,i}class Dn{constructor(e,t,r){this.typeName=e,this.methods=t.map(n=>Ti(n,this)),this.options=r??{}}}class se extends Error{constructor(e,t="UNKNOWN",r){super(e),this.name="RpcError",Object.setPrototypeOf(this,new.target.prototype),this.code=t,this.meta=r??{}}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[r,n]of t)e.push(` ${r}: ${n}`)}return e.join(`
|
|
4
|
-
`)}}function
|
|
5
|
-
`)){if(t=="")continue;let[r,...n]=t.split(":");const i=n.join(":").trim();r=r.trim();let o=e[r];typeof o=="string"?e[r]=[o,i]:Array.isArray(o)?o.push(i):e[r]=i}return e}function Vi(s){let e={};return s.forEach((t,r)=>{let n=e[r];typeof n=="string"?e[r]=[n,t]:Array.isArray(n)?n.push(t):e[r]=t}),e}function Hi(s){switch(s){case 200:return W.OK;case 400:return W.INVALID_ARGUMENT;case 401:return W.UNAUTHENTICATED;case 403:return W.PERMISSION_DENIED;case 404:return W.NOT_FOUND;case 409:return W.ABORTED;case 412:return W.FAILED_PRECONDITION;case 429:return W.RESOURCE_EXHAUSTED;case 499:return W.CANCELLED;case 500:return W.UNKNOWN;case 501:return W.UNIMPLEMENTED;case 503:return W.UNAVAILABLE;case 504:return W.DEADLINE_EXCEEDED;default:return W.UNKNOWN}}class $i{constructor(e){this.defaultOptions=e}mergeOptions(e){return Li(this.defaultOptions,e)}makeUrl(e,t){let r=t.baseUrl;return r.endsWith("/")&&(r=r.substring(0,r.length-1)),`${r}/${e.service.typeName}/${e.name}`}clientStreaming(e){const t=new se("Client streaming is not supported by grpc-web",W[W.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",W[W.UNIMPLEMENTED]);throw t.methodName=e.name,t.serviceName=e.service.typeName,t}serverStreaming(e,t,r){var n,i,o,a;let c=r,d=(n=c.format)!==null&&n!==void 0?n:"text",l=(i=c.fetchInit)!==null&&i!==void 0?i:{},u=this.makeUrl(e,c),h=e.I.toBinary(t,c.binaryOptions),f=new vt,y=new Ui,k=!0,T,C=new vt,R,S=new vt;return globalThis.fetch(u,Object.assign(Object.assign({},l),{method:"POST",headers:pr(new globalThis.Headers,d,c.timeout,c.meta),body:mr(h,d),signal:(o=r.abort)!==null&&o!==void 0?o:null})).then(F=>{let[U,b,B]=Mn(F);if(f.resolve(B),U!=null&&U!==W.OK)throw new se(b??W[U],W[U],B);return U!=null&&(T={code:W[U],detail:b??W[U]}),F}).then(F=>{if(!F.body)throw new se("missing response body",W[W.INTERNAL]);return wr(F.body,F.headers.get("content-type"),(U,b)=>{switch(U){case Ge.DATA:y.notifyMessage(e.O.fromBinary(b,c.binaryOptions)),k=!1;break;case Ge.TRAILER:let B,m;[B,m,R]=gr(b),T={code:W[B],detail:m??W[B]};break}})}).then(()=>{if(!R&&!k)throw new se("missing trailers",W[W.DATA_LOSS]);if(!T)throw new se("missing status",W[W.INTERNAL]);if(T.code!=="OK")throw new se(T.detail,T.code,R);y.notifyComplete(),C.resolve(T),S.resolve(R||{})}).catch(F=>{let U;F instanceof se?U=F:F instanceof Error&&F.name==="AbortError"?U=new se(F.message,W[W.CANCELLED]):U=new se(F instanceof Error?F.message:""+F,W[W.INTERNAL]),U.methodName=e.name,U.serviceName=e.service.typeName,f.rejectPending(U),y.notifyError(U),C.rejectPending(U),S.rejectPending(U)}),new Si(e,(a=c.meta)!==null&&a!==void 0?a:{},t,f.promise,y,C.promise,S.promise)}unary(e,t,r){var n,i,o,a;let c=r,d=(n=c.format)!==null&&n!==void 0?n:"text",l=(i=c.fetchInit)!==null&&i!==void 0?i:{},u=this.makeUrl(e,c),h=e.I.toBinary(t,c.binaryOptions),f=new vt,y,k=new vt,T,C=new vt,R,S=new vt;return globalThis.fetch(u,Object.assign(Object.assign({},l),{method:"POST",headers:pr(new globalThis.Headers,d,c.timeout,c.meta),body:mr(h,d),signal:(o=r.abort)!==null&&o!==void 0?o:null})).then(F=>{let[U,b,B]=Mn(F);if(f.resolve(B),U!=null&&U!==W.OK)throw new se(b??W[U],W[U],B);return U!=null&&(T={code:W[U],detail:b??W[U]}),F}).then(F=>{if(!F.body)throw new se("missing response body",W[W.INTERNAL]);return wr(F.body,F.headers.get("content-type"),(U,b)=>{switch(U){case Ge.DATA:if(y)throw new se("unary call received 2nd message",W[W.DATA_LOSS]);y=e.O.fromBinary(b,c.binaryOptions);break;case Ge.TRAILER:let B,m;[B,m,R]=gr(b),T={code:W[B],detail:m??W[B]};break}})}).then(()=>{if(!R&&y)throw new se("missing trailers",W[W.DATA_LOSS]);if(!T)throw new se("missing status",W[W.INTERNAL]);if(!y&&T.code==="OK")throw new se("expected error status",W[W.DATA_LOSS]);if(!y)throw new se(T.detail,T.code,R);if(k.resolve(y),T.code!=="OK")throw new se(T.detail,T.code,R);C.resolve(T),S.resolve(R||{})}).catch(F=>{let U;F instanceof se?U=F:F instanceof Error&&F.name==="AbortError"?U=new se(F.message,W[W.CANCELLED]):U=new se(F instanceof Error?F.message:""+F,W[W.INTERNAL]),U.methodName=e.name,U.serviceName=e.service.typeName,f.rejectPending(U),k.rejectPending(U),C.rejectPending(U),S.rejectPending(U)}),new _i(e,(a=c.meta)!==null&&a!==void 0?a:{},t,f.promise,k.promise,C.promise,S.promise)}}var bn=(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))(bn||{});class Pi extends Te{constructor(){super("com.hamropatro.grpc.common.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&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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 d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){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 n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Er=new Pi;class Wi extends Te{constructor(){super("com.hamropatro.grpc.common.SearchResult",[{no:1,name:"items",kind:"message",repeat:1,T:()=>Je},{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&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.items.push(Je.internalBinaryRead(e,e.uint32(),r));break;case 2:i.nextPageCursor=e.string();break;default:let d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){for(let i=0;i<e.items.length;i++)Je.internalBinaryWrite(e.items[i],t.tag(1,j.LengthDelimited).fork(),r).join();e.nextPageCursor!==""&&t.tag(2,j.LengthDelimited).string(e.nextPageCursor);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const ji=new Wi;class qi extends Te{constructor(){super("com.hamropatro.grpc.common.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.common.FileType",bn]},{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&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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 d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){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 n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const vr=new qi;class Zi extends Te{constructor(){super("com.hamropatro.grpc.common.CreateUserFileRequest",[{no:1,name:"url",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:()=>["com.hamropatro.grpc.common.FileType",bn]},{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&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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 d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){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 n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Vn=new Zi;class Ki extends Te{constructor(){super("com.hamropatro.grpc.common.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.common.FileType",bn]},{no:9,name:"metadata",kind:"message",T:()=>Hn}])}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&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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=Hn.internalBinaryRead(e,e.uint32(),r,i.metadata);break;default:let d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){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&&Hn.internalBinaryWrite(e.metadata,t.tag(9,j.LengthDelimited).fork(),r).join();let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Je=new Ki;class zi extends Te{constructor(){super("com.hamropatro.grpc.common.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&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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 d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){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 n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Hn=new zi;class Xi extends Te{constructor(){super("com.hamropatro.grpc.common.DeleteFileRequest",[{no:1,name:"key",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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 d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Ar=new Xi;class Gi extends Te{constructor(){super("com.hamropatro.grpc.common.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&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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 d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){e.isDeleted!==!1&&t.tag(1,j.Varint).bool(e.isDeleted);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Ji=new Gi;class Qi extends Te{constructor(){super("com.hamropatro.grpc.common.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&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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 d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){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 n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const kr=new Qi;class Yi extends Te{constructor(){super("com.hamropatro.grpc.common.GetFilesByFolderResponse",[{no:1,name:"files",kind:"message",repeat:1,T:()=>Je},{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&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.files.push(Je.internalBinaryRead(e,e.uint32(),r));break;case 2:i.nextCursor=e.string();break;case 3:i.hasMore=e.bool();break;default:let d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){for(let i=0;i<e.files.length;i++)Je.internalBinaryWrite(e.files[i],t.tag(1,j.LengthDelimited).fork(),r).join();e.nextCursor!==""&&t.tag(2,j.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,j.Varint).bool(e.hasMore);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const es=new Yi,$n=new Dn("com.hamropatro.grpc.common.FileService",[{name:"createFile",options:{},I:vr,O:Je},{name:"updateFile",options:{},I:Je,O:Je},{name:"deleteFile",options:{},I:Ar,O:Ji},{name:"getFilesByFolder",options:{},I:kr,O:es},{name:"createUserFile",options:{},I:Vn,O:Je},{name:"search",options:{},I:Er,O:ji}]);class St{constructor(e){pe(this,"typeName",$n.typeName);pe(this,"methods",$n.methods);pe(this,"options",$n.options);this._transport=e}createFile(e,t){const r=this.methods[0],n=this._transport.mergeOptions(t);return Pe("unary",this._transport,r,n,e)}updateFile(e,t){const r=this.methods[1],n=this._transport.mergeOptions(t);return Pe("unary",this._transport,r,n,e)}deleteFile(e,t){const r=this.methods[2],n=this._transport.mergeOptions(t);return Pe("unary",this._transport,r,n,e)}getFilesByFolder(e,t){const r=this.methods[3],n=this._transport.mergeOptions(t);return Pe("unary",this._transport,r,n,e)}createUserFile(e,t){const r=this.methods[4],n=this._transport.mergeOptions(t);return Pe("unary",this._transport,r,n,e)}search(e,t){const r=this.methods[5],n=this._transport.mergeOptions(t);return Pe("unary",this._transport,r,n,e)}}const ts=async(s,e,t,r,n,i)=>{var o;try{const a=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,c=new St(a),d=vr.create();return d.name=s,d.nestedFolderName=e,d.url=t,d.type=r,d.folderName=n,await c.createFile(d,i)}catch(a){throw a}},ns=async(s,e,t)=>{var r;try{const n=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,i=new St(n),o=Vn.create();return o.url=s,o.type=e,await i.createUserFile(o,t)}catch(n){throw n}},rs=async(s,e,t)=>{var r,n;try{const i=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=(n=window.ImageSalonSDK)==null?void 0:n.mode,a=new St(i),c=Vn.create();return c.url=s,c.type=e,await a.createUserFile(c,{meta:{Authorization:t,"app-id":o==="production"?"hamropatro":"hamropatro-android"}})}catch(i){throw i}},is=async(s,e,t,r)=>{var n;try{const i=(n=window.ImageSalonSDK)==null?void 0:n.grpcConfig,o=new St(i),a=kr.create();return a.folderName=s,a.cursor=e,a.limit=t,await o.getFilesByFolder(a,r)}catch(i){throw i}},ss=async(s,e,t=20,r)=>{var n;try{const i=(n=window.ImageSalonSDK)==null?void 0:n.grpcConfig,o=new St(i),a=Er.create();return a.searchValue=s,a.cursor=e,a.limit=t,await o.search(a,r)}catch(i){throw i}},os=async(s,e,t,r,n,i,o,a,c)=>{var d;try{const l=(d=window.ImageSalonSDK)==null?void 0:d.grpcConfig,u=new St(l),h=Je.create();return h.key=s,h.name=e,h.nestedFolderName=t,h.url=r,h.thumborUrl=n,h.proxyUrl=i,h.type=o,h.folderName=a,await u.updateFile(h,c)}catch(l){throw l}},as=async(s,e)=>{var t;try{const r=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,n=new St(r),i=Ar.create();return i.key=s,await n.deleteFile(i,e)}catch(r){throw r}};class ls extends Te{constructor(){super("com.hamropatro.grpc.common.DeleteFolderRequest",[{no:1,name:"key",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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 d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Fr=new ls;class cs extends Te{constructor(){super("com.hamropatro.grpc.common.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&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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 d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){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 n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Nr=new cs;class ds extends Te{constructor(){super("com.hamropatro.grpc.common.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&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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 d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){e.cursor!==""&&t.tag(1,j.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(2,j.Varint).int32(e.limit);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Ir=new ds;class hs extends Te{constructor(){super("com.hamropatro.grpc.common.GetAllFoldersResponse",[{no:1,name:"folder",kind:"message",repeat:1,T:()=>mt},{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&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.folder.push(mt.internalBinaryRead(e,e.uint32(),r));break;case 2:i.nextCursor=e.string();break;case 3:i.hasMore=e.bool();break;default:let d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){for(let i=0;i<e.folder.length;i++)mt.internalBinaryWrite(e.folder[i],t.tag(1,j.LengthDelimited).fork(),r).join();e.nextCursor!==""&&t.tag(2,j.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,j.Varint).bool(e.hasMore);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const us=new hs;class fs extends Te{constructor(){super("com.hamropatro.grpc.common.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&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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 d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){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 n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const mt=new fs;class ps extends Te{constructor(){super("com.hamropatro.grpc.common.ChangeNestedFolderRequest",[{no:1,name:"folder_key",kind:"scalar",T:9},{no:2,name:"nested_folder_name",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.folderKey="",t.nestedFolderName="",e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.folderKey=e.string();break;case 2:i.nestedFolderName=e.string();break;default:let d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){e.folderKey!==""&&t.tag(1,j.LengthDelimited).string(e.folderKey),e.nestedFolderName!==""&&t.tag(2,j.LengthDelimited).string(e.nestedFolderName);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const ms=new ps,Pn=new Dn("com.hamropatro.grpc.common.FolderService",[{name:"createFolder",options:{},I:Nr,O:mt},{name:"getFolders",options:{},I:Ir,O:us},{name:"updateFolder",options:{},I:mt,O:mt},{name:"deleteFolder",options:{},I:Fr,O:mt},{name:"ChangeNestedFolderName",options:{},I:ms,O:mt}]);class Cn{constructor(e){pe(this,"typeName",Pn.typeName);pe(this,"methods",Pn.methods);pe(this,"options",Pn.options);this._transport=e}createFolder(e,t){const r=this.methods[0],n=this._transport.mergeOptions(t);return Pe("unary",this._transport,r,n,e)}getFolders(e,t){const r=this.methods[1],n=this._transport.mergeOptions(t);return Pe("unary",this._transport,r,n,e)}updateFolder(e,t){const r=this.methods[2],n=this._transport.mergeOptions(t);return Pe("unary",this._transport,r,n,e)}deleteFolder(e,t){const r=this.methods[3],n=this._transport.mergeOptions(t);return Pe("unary",this._transport,r,n,e)}changeNestedFolderName(e,t){const r=this.methods[4],n=this._transport.mergeOptions(t);return Pe("unary",this._transport,r,n,e)}}const gs=async(s,e=20,t)=>{var o;const r=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,n=new Cn(r),i=Ir.create();try{return i.cursor=s,i.limit=e,await n.getFolders(i,t)}catch(a){throw a}},ws=async(s,e,t,r)=>{var n;try{const i=(n=window.ImageSalonSDK)==null?void 0:n.grpcConfig,o=new Cn(i),a=Nr.create();return a.name=s,a.nestedFolderName=e,a.createdBy=t,await o.createFolder(a,r)}catch(i){throw i}},ys=async(s,e,t,r,n)=>{var i;try{const o=(i=window.ImageSalonSDK)==null?void 0:i.grpcConfig,a=new Cn(o),c=mt.create();return c.name=e,c.key=s,c.nestedFolderName=t,c.createdBy=r,await a.updateFolder(c,n)}catch(o){throw o}},bs=async(s,e)=>{var t;try{const r=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,n=new Cn(r),i=Fr.create();return i.key=s,await n.deleteFolder(i,e)}catch(r){throw r}},Wn=(s,e,t)=>{const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("width",s||"20"),r.setAttribute("height",e||"20"),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("fill","none"),r.setAttribute("stroke",t||"#ee3f3f"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),r.classList.add("lucide","lucide-circle-alert");const n=document.createElementNS("http://www.w3.org/2000/svg","circle");n.setAttribute("cx","12"),n.setAttribute("cy","12"),n.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"),r.appendChild(n),r.appendChild(i),r.appendChild(o),r};function Tr(){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 r=document.createElementNS("http://www.w3.org/2000/svg","circle");r.setAttribute("cx","6"),r.setAttribute("cy","18"),r.setAttribute("r","3");const n=document.createElementNS("http://www.w3.org/2000/svg","circle");return n.setAttribute("cx","18"),n.setAttribute("cy","16"),n.setAttribute("r","3"),s.appendChild(e),s.appendChild(t),s.appendChild(r),s.appendChild(n),document.body.appendChild(s),s}const Lr=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 r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d","m9 11 3 3L22 4"),e.appendChild(t),e.appendChild(r),e};function jn(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 Ur(){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 nn(){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 Es(){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 r=document.createElementNS(s,"circle");r.setAttribute("cx","9"),r.setAttribute("cy","9"),r.setAttribute("r","2");const n=document.createElementNS(s,"path");return n.setAttribute("d","m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"),e.appendChild(t),e.appendChild(r),e.appendChild(n),document.body.appendChild(e),e}function vs(){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 xr(){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 As(){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 r=document.createElementNS(s,"circle");return r.setAttribute("cx","12"),r.setAttribute("cy","12"),r.setAttribute("r","3"),e.appendChild(r),document.body.appendChild(e),e}function ks(){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 _r(){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 r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d","M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2");const n=document.createElementNS("http://www.w3.org/2000/svg","line");n.setAttribute("x1","10"),n.setAttribute("x2","10"),n.setAttribute("y1","11"),n.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(r),s.appendChild(n),s.appendChild(i),document.body.appendChild(s),s}function qn(){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 r=document.createElementNS("http://www.w3.org/2000/svg","line");return r.setAttribute("x1","12"),r.setAttribute("x2","12"),r.setAttribute("y1","3"),r.setAttribute("y2","15"),s.appendChild(e),s.appendChild(t),s.appendChild(r),s}function Fs(){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 r=document.createElementNS(s,"rect");return r.setAttribute("x","2"),r.setAttribute("y","6"),r.setAttribute("width","14"),r.setAttribute("height","12"),r.setAttribute("rx","2"),e.appendChild(t),e.appendChild(r),document.body.appendChild(e),e}function Q(s,e,t,r,n){let i=document.createElement(s);return e&&(i.className+=e),t&&(i.style.cssText=t),r&&(i.textContent=r),n&&n.appendChild(i),i}class Ns{constructor(){z(this,gt);z(this,et);z(this,$t,"#fff");H(this,gt,document.createElementNS("http://www.w3.org/2000/svg","svg")),E(this,gt).setAttribute("viewBox","25 25 50 50"),E(this,gt).classList.add("loader-svg"),H(this,et,document.createElementNS("http://www.w3.org/2000/svg","circle")),E(this,et).setAttribute("r","20"),E(this,et).setAttribute("cy","50"),E(this,et).setAttribute("cx","50"),E(this,et).setAttribute("stroke",E(this,$t)),E(this,et).classList.add("loader-circle"),E(this,gt).appendChild(E(this,et))}show(e,t){t&&(H(this,$t,t),E(this,et).setAttribute("stroke",E(this,$t))),e.appendChild(E(this,gt))}hide(){E(this,gt).remove()}}gt=new WeakMap,et=new WeakMap,$t=new WeakMap;const Br=new Ns,En=document.body;class Sr{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=Q("div"),this.dialog=Q("div"),this.confirmCallback=void 0,this.cancelCallback=void 0}_init(e){this.main=Q("div","dialog-presentation","","",En),this.main.setAttribute("role","presentation"),this.dialogContainer=Q("div","dialog-container","","",this.main),this.dialogBackdrop=Q("div","dialog-backdrop","","",this.dialogContainer),this.dialog=Q("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=Q("div","dialog-content","","",this.dialog),e!=null&&e.dialogContentStyle&&Object.assign(this.dialogContent.style,e.dialogContentStyle),this.confirmButton=Q("button","dialog-btn confirm","","",this.dialogFooter),this.confirmButton.type="button",this.cancelButton=Q("button","dialog-btn cancel","","",this.dialogFooter),this.cancelButton.type="button",e.showCloseBtn){const r=Q("button","dialog-close-btn","","",this.dialogContent);r.appendChild(jn()),r.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",En.style.overflow="hidden",this.confirmButton.textContent=e.confirmButtonText||"Upload",this.cancelButton.textContent=e.cancelButtonText||"Cancel",En.classList.add("dialog-visible"),new Promise(r=>{const n=i=>()=>{this.hide(),r(i==="confirm")};this.confirmCallback=e.onConfirm||n("confirm"),this.confirmButton.addEventListener("click",this.confirmCallback),this.cancelCallback=e.onCancel||n("cancel"),this.cancelButton.addEventListener("click",this.cancelCallback)})}_setHeader(e){if(this.dialogHeader=Q("div","dialog-header","","",this.dialogContent),!e.header)this.dialogHeader.innerHTML="";else if(typeof e.header=="string"){const t=Q("h4","dialog-header-text","","",this.dialogHeader);t.textContent=e.header}else this.dialogHeader.innerHTML="",this.dialogHeader.appendChild(e.header)}_setBody(e){this.dialogBody=Q("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=Q("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||En.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?(Br.show(this.confirmButton),this.confirmButton.disabled=!0):(Br.hide(),this.confirmButton.disabled=!1)}}const vn=new Sr,ve=new Sr;class Is{constructor(){pe(this,"main");pe(this,"dialogBody");this.main=Q("div"),this.dialogBody=Q("div"),this.hide()}show(e){this.main=Q("div","popover","","",e.mainContainer),this.dialogBody=Q("div","popover-body","","",this.main),this.main.id=e.divId,this.dialogBody.append(e.content)}hide(){this.main.remove()}}const Ze=new Is;var Qe=(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))(Qe||{});const rn={0:"IMAGE",1:"AUDIO",2:"VIDEO",3:"ALL",4:"FOLDER"};function Zn(s){switch(s){case"image":return rn[Qe.IMAGE];case"video":return rn[Qe.VIDEO];case"audio":return rn[Qe.AUDIO];default:return rn[Qe.ALL]}}function Ts(s){const e={};s.forEach(n=>{e[n.key]={...n,children:{}}});const t=n=>(Object.values(e).filter(o=>o.nestedFolderName==n.key).forEach(o=>{n.children[o.key]=t(o)}),n);return s.reduce((n,i)=>(i.nestedFolderName||n.push(t(e[i.key])),n),[])}function Ls(s,e){const t=r=>{if(r.key===e.nestedFolderName)return r.children[e.key]={...e,children:{}},!0;for(const n in r.children){const i=r.children[n];if(t(i))return!0}return!1};for(const r of s)if(t(r))break;return s}const Us=async(s,e)=>{let t;try{s&&(t={Authorization:s,"app-id":e==="production"?"hamropatro":"hamropatro-android"})}catch(n){if(n)throw n}return{meta:t}};function K(s,e){const t=document.createElement("div");return s&&(t.className=s),e&&(t.id=e),t}function sn(s,e,t){const r=document.createElement("p");return e&&(r.className=e),t&&(r.id=t),s&&(r.textContent=s),r}function oe(s,e){const t=document.createElement("span");return e&&(t.className=e),s&&(t.textContent=s),t}function Or(s,e,t,r){const n=document.createElement("img");return e&&(n.className=e),n.src=s,n}function xs(s,e,t){const r=document.createElement("video"),n=document.createElement("source");return r.className=e,n.src=s,r.appendChild(n),r}function _s(s,e,t){const r=document.createElement("audio"),n=document.createElement("source");return r.className=e,r.controls=!0,n.src=s,r.appendChild(n),r}function We(s,e,t,r,n){const i=document.createElement("button");return e&&(i.className=e),t&&(i.id=t),s&&(i.textContent=s),n&&(i.innerHTML=n),i.disabled=r,i}function Kn(s,e,t){const r=document.createElement("input");return r.className=e,r.defaultValue=t,s&&(r.type=s),r}function Bs(s,e){return e.forEach(function(t){t&&typeof t!="string"&&!Array.isArray(t)&&Object.keys(t).forEach(function(r){if(r!=="default"&&!(r in s)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})}),Object.freeze(s)}function Rr(s,e){return new Promise(function(t,r){let n;return Ss(s).then(function(i){try{return n=i,t(new Blob([e.slice(0,2),n,e.slice(2)],{type:"image/jpeg"}))}catch(o){return r(o)}},r)})}const Ss=s=>new Promise((e,t)=>{const r=new FileReader;r.addEventListener("load",({target:{result:n}})=>{const i=new DataView(n);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 d=o+10;let l;switch(i.getUint16(d)){case 18761:l=!0;break;case 19789:l=!1;break;default:return t("TIFF header contains invalid endian")}if(i.getUint16(d+2,l)!==42)return t("TIFF header contains invalid version");const u=i.getUint32(d+4,l),h=d+u+2+12*i.getUint16(d+u,l);for(let f=d+u+2;f<h;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(n.slice(o,o+2+c))}o+=2+c}return e(new Blob)}),r.readAsArrayBuffer(s)});var An={},Os={get exports(){return An},set exports(s){An=s}};(function(s){var e,t,r={};Os.exports=r,r.parse=function(n,i){for(var o=r.bin.readUshort,a=r.bin.readUint,c=0,d={},l=new Uint8Array(n),u=l.length-4;a(l,u)!=101010256;)u--;c=u,c+=4;var h=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 k=0;k<h;k++){a(l,c),c+=4,c+=4,c+=4,a(l,c+=4),f=a(l,c+=4);var T=a(l,c+=4),C=o(l,c+=4),R=o(l,c+2),S=o(l,c+4);c+=6;var F=a(l,c+=8);c+=4,c+=C+R+S,r._readLocal(l,F,d,f,T,i)}return d},r._readLocal=function(n,i,o,a,c,d){var l=r.bin.readUshort,u=r.bin.readUint;u(n,i),l(n,i+=4),l(n,i+=2);var h=l(n,i+=2);u(n,i+=2),u(n,i+=4),i+=4;var f=l(n,i+=8),y=l(n,i+=2);i+=2;var k=r.bin.readUTF8(n,i,f);if(i+=f,i+=y,d)o[k]={size:c,csize:a};else{var T=new Uint8Array(n.buffer,i);if(h==0)o[k]=new Uint8Array(T.buffer.slice(i,i+a));else{if(h!=8)throw"unknown compression method: "+h;var C=new Uint8Array(c);r.inflateRaw(T,C),o[k]=C}}},r.inflateRaw=function(n,i){return r.F.inflate(n,i)},r.inflate=function(n,i){return n[0],n[1],r.inflateRaw(new Uint8Array(n.buffer,n.byteOffset+2,n.length-6),i)},r.deflate=function(n,i){i==null&&(i={level:6});var o=0,a=new Uint8Array(50+Math.floor(1.1*n.length));a[o]=120,a[o+1]=156,o+=2,o=r.F.deflateRaw(n,a,o,i.level);var c=r.adler(n,0,n.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)},r.deflateRaw=function(n,i){i==null&&(i={level:6});var o=new Uint8Array(50+Math.floor(1.1*n.length)),a=r.F.deflateRaw(n,o,a,i.level);return new Uint8Array(o.buffer,0,a)},r.encode=function(n,i){i==null&&(i=!1);var o=0,a=r.bin.writeUint,c=r.bin.writeUshort,d={};for(var l in n){var u=!r._noNeed(l)&&!i,h=n[l],f=r.crc.crc(h,0,h.length);d[l]={cpr:u,usize:h.length,crc:f,file:u?r.deflateRaw(h):h}}for(var l in d)o+=d[l].file.length+30+46+2*r.bin.sizeUTF8(l);o+=22;var y=new Uint8Array(o),k=0,T=[];for(var l in d){var C=d[l];T.push(k),k=r._writeHeader(y,k,l,C,0)}var R=0,S=k;for(var l in d)C=d[l],T.push(k),k=r._writeHeader(y,k,l,C,1,T[R++]);var F=k-S;return a(y,k,101010256),k+=4,c(y,k+=4,R),c(y,k+=2,R),a(y,k+=2,F),a(y,k+=4,S),k+=4,k+=2,y.buffer},r._noNeed=function(n){var i=n.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(i)!=-1},r._writeHeader=function(n,i,o,a,c,d){var l=r.bin.writeUint,u=r.bin.writeUshort,h=a.file;return l(n,i,c==0?67324752:33639248),i+=4,c==1&&(i+=2),u(n,i,20),u(n,i+=2,0),u(n,i+=2,a.cpr?8:0),l(n,i+=2,0),l(n,i+=4,a.crc),l(n,i+=4,h.length),l(n,i+=4,a.usize),u(n,i+=4,r.bin.sizeUTF8(o)),u(n,i+=2,0),i+=2,c==1&&(i+=2,i+=2,l(n,i+=6,d),i+=4),i+=r.bin.writeUTF8(n,i,o),c==0&&(n.set(h,i),i+=h.length),i},r.crc={table:function(){for(var n=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;n[i]=o}return n}(),update:function(n,i,o,a){for(var c=0;c<a;c++)n=r.crc.table[255&(n^i[o+c])]^n>>>8;return n},crc:function(n,i,o){return 4294967295^r.crc.update(4294967295,n,i,o)}},r.adler=function(n,i,o){for(var a=1,c=0,d=i,l=i+o;d<l;){for(var u=Math.min(d+5552,l);d<u;)c+=a+=n[d++];a%=65521,c%=65521}return c<<16|a},r.bin={readUshort:function(n,i){return n[i]|n[i+1]<<8},writeUshort:function(n,i,o){n[i]=255&o,n[i+1]=o>>8&255},readUint:function(n,i){return 16777216*n[i+3]+(n[i+2]<<16|n[i+1]<<8|n[i])},writeUint:function(n,i,o){n[i]=255&o,n[i+1]=o>>8&255,n[i+2]=o>>16&255,n[i+3]=o>>24&255},readASCII:function(n,i,o){for(var a="",c=0;c<o;c++)a+=String.fromCharCode(n[i+c]);return a},writeASCII:function(n,i,o){for(var a=0;a<o.length;a++)n[i+a]=o.charCodeAt(a)},pad:function(n){return n.length<2?"0"+n:n},readUTF8:function(n,i,o){for(var a,c="",d=0;d<o;d++)c+="%"+r.bin.pad(n[i+d].toString(16));try{a=decodeURIComponent(c)}catch{return r.bin.readASCII(n,i,o)}return a},writeUTF8:function(n,i,o){for(var a=o.length,c=0,d=0;d<a;d++){var l=o.charCodeAt(d);if(!(4294967168&l))n[i+c]=l,c++;else if(!(4294965248&l))n[i+c]=192|l>>6,n[i+c+1]=128|l>>0&63,c+=2;else if(!(4294901760&l))n[i+c]=224|l>>12,n[i+c+1]=128|l>>6&63,n[i+c+2]=128|l>>0&63,c+=3;else{if(4292870144&l)throw"e";n[i+c]=240|l>>18,n[i+c+1]=128|l>>12&63,n[i+c+2]=128|l>>6&63,n[i+c+3]=128|l>>0&63,c+=4}}return c},sizeUTF8:function(n){for(var i=n.length,o=0,a=0;a<i;a++){var c=n.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}},r.F={},r.F.deflateRaw=function(n,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],d=r.F.U,l=r.F._goodIndex;r.F._hash;var u=r.F._putsE,h=0,f=o<<3,y=0,k=n.length;if(a==0){for(;h<k;)u(i,f,h+(I=Math.min(65535,k-h))==k?1:0),f=r.F._copyExact(n,h,I,i,f+8),h+=I;return f>>>3}var T=d.lits,C=d.strt,R=d.prev,S=0,F=0,U=0,b=0,B=0,m=0;for(k>2&&(C[m=r.F._hash(n,0)]=0),h=0;h<k;h++){if(B=m,h+1<k-2){m=r.F._hash(n,h+1);var g=h+1&32767;R[g]=C[m],C[m]=g}if(y<=h){(S>14e3||F>26697)&&k-h>100&&(y<h&&(T[S]=h-y,S+=2,y=h),f=r.F._writeBlock(h==k-1||y==k?1:0,T,S,b,n,U,h-U,i,f),S=F=b=0,U=h);var A=0;h<k-2&&(A=r.F._bestMatch(n,h,R,B,Math.min(c[2],k-h),c[3]));var I=A>>>16,N=65535&A;if(A!=0){N=65535&A;var L=l(I=A>>>16,d.of0);d.lhst[257+L]++;var v=l(N,d.df0);d.dhst[v]++,b+=d.exb[L]+d.dxb[v],T[S]=I<<23|h-y,T[S+1]=N<<16|L<<8|v,S+=2,y=h+I}else d.lhst[n[h]]++;F++}}for(U==h&&n.length!=0||(y<h&&(T[S]=h-y,S+=2,y=h),f=r.F._writeBlock(1,T,S,b,n,U,h-U,i,f),S=0,F=0,S=F=b=0,U=h);7&f;)f++;return f>>>3},r.F._bestMatch=function(n,i,o,a,c,d){var l=32767&i,u=o[l],h=l-u+32768&32767;if(u==l||a!=r.F._hash(n,i-h))return 0;for(var f=0,y=0,k=Math.min(32767,i);h<=k&&--d!=0&&u!=l;){if(f==0||n[i+f]==n[i+f-h]){var T=r.F._howLong(n,i,h);if(T>f){if(y=h,(f=T)>=c)break;h+2<T&&(T=h+2);for(var C=0,R=0;R<T-2;R++){var S=i-h+R+32768&32767,F=S-o[S]+32768&32767;F>C&&(C=F,u=S)}}}h+=(l=u)-(u=o[l])+32768&32767}return f<<16|y},r.F._howLong=function(n,i,o){if(n[i]!=n[i-o]||n[i+1]!=n[i+1-o]||n[i+2]!=n[i+2-o])return 0;var a=i,c=Math.min(n.length,i+258);for(i+=3;i<c&&n[i]==n[i-o];)i++;return i-a},r.F._hash=function(n,i){return(n[i]<<8|n[i+1])+(n[i+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(n,i,o,a,c,d,l,u,h){var f,y,k,T,C,R,S,F,U,b=r.F.U,B=r.F._putsF,m=r.F._putsE;b.lhst[256]++,y=(f=r.F.getTrees())[0],k=f[1],T=f[2],C=f[3],R=f[4],S=f[5],F=f[6],U=f[7];var g=32+(h+3&7?8-(h+3&7):0)+(l<<3),A=a+r.F.contSize(b.fltree,b.lhst)+r.F.contSize(b.fdtree,b.dhst),I=a+r.F.contSize(b.ltree,b.lhst)+r.F.contSize(b.dtree,b.dhst);I+=14+3*S+r.F.contSize(b.itree,b.ihst)+(2*b.ihst[16]+3*b.ihst[17]+7*b.ihst[18]);for(var N=0;N<286;N++)b.lhst[N]=0;for(N=0;N<30;N++)b.dhst[N]=0;for(N=0;N<19;N++)b.ihst[N]=0;var L=g<A&&g<I?0:A<I?1:2;if(B(u,h,n),B(u,h+1,L),h+=3,L==0){for(;7&h;)h++;h=r.F._copyExact(c,d,l,u,h)}else{var v,_;if(L==1&&(v=b.fltree,_=b.fdtree),L==2){r.F.makeCodes(b.ltree,y),r.F.revCodes(b.ltree,y),r.F.makeCodes(b.dtree,k),r.F.revCodes(b.dtree,k),r.F.makeCodes(b.itree,T),r.F.revCodes(b.itree,T),v=b.ltree,_=b.dtree,m(u,h,C-257),m(u,h+=5,R-1),m(u,h+=5,S-4),h+=4;for(var w=0;w<S;w++)m(u,h+3*w,b.itree[1+(b.ordr[w]<<1)]);h+=3*S,h=r.F._codeTiny(F,b.itree,u,h),h=r.F._codeTiny(U,b.itree,u,h)}for(var p=d,M=0;M<o;M+=2){for(var x=i[M],V=x>>>23,Z=p+(8388607&x);p<Z;)h=r.F._writeLit(c[p++],v,u,h);if(V!=0){var P=i[M+1],q=P>>16,$=P>>8&255,O=255&P;m(u,h=r.F._writeLit(257+$,v,u,h),V-b.of0[$]),h+=b.exb[$],B(u,h=r.F._writeLit(O,_,u,h),q-b.df0[O]),h+=b.dxb[O],p+=V}}h=r.F._writeLit(256,v,u,h)}return h},r.F._copyExact=function(n,i,o,a,c){var d=c>>>3;return a[d]=o,a[d+1]=o>>>8,a[d+2]=255-a[d],a[d+3]=255-a[d+1],d+=4,a.set(new Uint8Array(n.buffer,i,o),d),c+(o+4<<3)},r.F.getTrees=function(){for(var n=r.F.U,i=r.F._hufTree(n.lhst,n.ltree,15),o=r.F._hufTree(n.dhst,n.dtree,15),a=[],c=r.F._lenCodes(n.ltree,a),d=[],l=r.F._lenCodes(n.dtree,d),u=0;u<a.length;u+=2)n.ihst[a[u]]++;for(u=0;u<d.length;u+=2)n.ihst[d[u]]++;for(var h=r.F._hufTree(n.ihst,n.itree,7),f=19;f>4&&n.itree[1+(n.ordr[f-1]<<1)]==0;)f--;return[i,o,h,c,l,f,a,d]},r.F.getSecond=function(n){for(var i=[],o=0;o<n.length;o+=2)i.push(n[o+1]);return i},r.F.nonZero=function(n){for(var i="",o=0;o<n.length;o+=2)n[o+1]!=0&&(i+=(o>>1)+",");return i},r.F.contSize=function(n,i){for(var o=0,a=0;a<i.length;a++)o+=i[a]*n[1+(a<<1)];return o},r.F._codeTiny=function(n,i,o,a){for(var c=0;c<n.length;c+=2){var d=n[c],l=n[c+1];a=r.F._writeLit(d,i,o,a);var u=d==16?2:d==17?3:7;d>15&&(r.F._putsE(o,a,l,u),a+=u)}return a},r.F._lenCodes=function(n,i){for(var o=n.length;o!=2&&n[o-1]==0;)o-=2;for(var a=0;a<o;a+=2){var c=n[a+1],d=a+3<o?n[a+3]:-1,l=a+5<o?n[a+5]:-1,u=a==0?-1:n[a-1];if(c==0&&d==c&&l==c){for(var h=a+5;h+2<o&&n[h+2]==c;)h+=2;(f=Math.min(h+1-a>>>1,138))<11?i.push(17,f-3):i.push(18,f-11),a+=2*f-2}else if(c==u&&d==c&&l==c){for(h=a+5;h+2<o&&n[h+2]==c;)h+=2;var f=Math.min(h+1-a>>>1,6);i.push(16,f-3),a+=2*f-2}else i.push(c,0)}return o>>>1},r.F._hufTree=function(n,i,o){var a=[],c=n.length,d=i.length,l=0;for(l=0;l<d;l+=2)i[l]=0,i[l+1]=0;for(l=0;l<c;l++)n[l]!=0&&a.push({lit:l,f:n[l]});var u=a.length,h=a.slice(0);if(u==0)return 0;if(u==1){var f=a[0].lit;return h=f==0?1:0,i[1+(f<<1)]=1,i[1+(h<<1)]=1,1}a.sort(function(F,U){return F.f-U.f});var y=a[0],k=a[1],T=0,C=1,R=2;for(a[0]={lit:-1,f:y.f+k.f,l:y,r:k,d:0};C!=u-1;)y=T!=C&&(R==u||a[T].f<a[R].f)?a[T++]:a[R++],k=T!=C&&(R==u||a[T].f<a[R].f)?a[T++]:a[R++],a[C++]={lit:-1,f:y.f+k.f,l:y,r:k};var S=r.F.setDepth(a[C-1],0);for(S>o&&(r.F.restrictDepth(h,o,S),S=o),l=0;l<u;l++)i[1+(h[l].lit<<1)]=h[l].d;return S},r.F.setDepth=function(n,i){return n.lit!=-1?(n.d=i,i):Math.max(r.F.setDepth(n.l,i+1),r.F.setDepth(n.r,i+1))},r.F.restrictDepth=function(n,i,o){var a=0,c=1<<o-i,d=0;for(n.sort(function(u,h){return h.d==u.d?u.f-h.f:h.d-u.d}),a=0;a<n.length&&n[a].d>i;a++){var l=n[a].d;n[a].d=i,d+=c-(1<<o-l)}for(d>>>=o-i;d>0;)(l=n[a].d)<i?(n[a].d++,d-=1<<i-l-1):a++;for(;a>=0;a--)n[a].d==i&&d<0&&(n[a].d--,d++);d!=0&&console.log("debt left")},r.F._goodIndex=function(n,i){var o=0;return i[16|o]<=n&&(o|=16),i[8|o]<=n&&(o|=8),i[4|o]<=n&&(o|=4),i[2|o]<=n&&(o|=2),i[1|o]<=n&&(o|=1),o},r.F._writeLit=function(n,i,o,a){return r.F._putsF(o,a,i[n<<1]),a+i[1+(n<<1)]},r.F.inflate=function(n,i){var o=Uint8Array;if(n[0]==3&&n[1]==0)return i||new o(0);var a=r.F,c=a._bitsF,d=a._bitsE,l=a._decodeTiny,u=a.makeCodes,h=a.codes2map,f=a._get17,y=a.U,k=i==null;k&&(i=new o(n.length>>>2<<3));for(var T,C,R=0,S=0,F=0,U=0,b=0,B=0,m=0,g=0,A=0;R==0;)if(R=c(n,A,1),S=c(n,A+1,2),A+=3,S!=0){if(k&&(i=r.F._check(i,g+(1<<17))),S==1&&(T=y.flmap,C=y.fdmap,B=511,m=31),S==2){F=d(n,A,5)+257,U=d(n,A+5,5)+1,b=d(n,A+10,4)+4,A+=14;for(var I=0;I<38;I+=2)y.itree[I]=0,y.itree[I+1]=0;var N=1;for(I=0;I<b;I++){var L=d(n,A+3*I,3);y.itree[1+(y.ordr[I]<<1)]=L,L>N&&(N=L)}A+=3*b,u(y.itree,N),h(y.itree,N,y.imap),T=y.lmap,C=y.dmap,A=l(y.imap,(1<<N)-1,F+U,n,A,y.ttree);var v=a._copyOut(y.ttree,0,F,y.ltree);B=(1<<v)-1;var _=a._copyOut(y.ttree,F,U,y.dtree);m=(1<<_)-1,u(y.ltree,v),h(y.ltree,v,T),u(y.dtree,_),h(y.dtree,_,C)}for(;;){var w=T[f(n,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 x=y.ldef[p-257];M=g+(x>>>3)+d(n,A,7&x),A+=7&x}var V=C[f(n,A)&m];A+=15&V;var Z=V>>>4,P=y.ddef[Z],q=(P>>>4)+c(n,A,15&P);for(A+=15&P,k&&(i=r.F._check(i,g+(1<<17)));g<M;)i[g]=i[g++-q],i[g]=i[g++-q],i[g]=i[g++-q],i[g]=i[g++-q];g=M}}}else{7&A&&(A+=8-(7&A));var $=4+(A>>>3),O=n[$-4]|n[$-3]<<8;k&&(i=r.F._check(i,g+O)),i.set(new o(n.buffer,n.byteOffset+$,O),g),A=$+O<<3,g+=O}return i.length==g?i:i.slice(0,g)},r.F._check=function(n,i){var o=n.length;if(i<=o)return n;var a=new Uint8Array(Math.max(o<<1,i));return a.set(n,0),a},r.F._decodeTiny=function(n,i,o,a,c,d){for(var l=r.F._bitsE,u=r.F._get17,h=0;h<o;){var f=n[u(a,c)&i];c+=15&f;var y=f>>>4;if(y<=15)d[h]=y,h++;else{var k=0,T=0;y==16?(T=3+l(a,c,2),c+=2,k=d[h-1]):y==17?(T=3+l(a,c,3),c+=3):y==18&&(T=11+l(a,c,7),c+=7);for(var C=h+T;h<C;)d[h]=k,h++}}return c},r.F._copyOut=function(n,i,o,a){for(var c=0,d=0,l=a.length>>>1;d<o;){var u=n[d+i];a[d<<1]=0,a[1+(d<<1)]=u,u>c&&(c=u),d++}for(;d<l;)a[d<<1]=0,a[1+(d<<1)]=0,d++;return c},r.F.makeCodes=function(n,i){for(var o,a,c,d,l=r.F.U,u=n.length,h=l.bl_count,f=0;f<=i;f++)h[f]=0;for(f=1;f<u;f+=2)h[n[f]]++;var y=l.next_code;for(o=0,h[0]=0,a=1;a<=i;a++)o=o+h[a-1]<<1,y[a]=o;for(c=0;c<u;c+=2)(d=n[c+1])!=0&&(n[c]=y[d],y[d]++)},r.F.codes2map=function(n,i,o){for(var a=n.length,c=r.F.U.rev15,d=0;d<a;d+=2)if(n[d+1]!=0)for(var l=d>>1,u=n[d+1],h=l<<4|u,f=i-u,y=n[d]<<f,k=y+(1<<f);y!=k;)o[c[y]>>>15-i]=h,y++},r.F.revCodes=function(n,i){for(var o=r.F.U.rev15,a=15-i,c=0;c<n.length;c+=2){var d=n[c]<<i-n[c+1];n[c]=o[d]>>>a}},r.F._putsE=function(n,i,o){o<<=7&i;var a=i>>>3;n[a]|=o,n[a+1]|=o>>>8},r.F._putsF=function(n,i,o){o<<=7&i;var a=i>>>3;n[a]|=o,n[a+1]|=o>>>8,n[a+2]|=o>>>16},r.F._bitsE=function(n,i,o){return(n[i>>>3]|n[1+(i>>>3)]<<8)>>>(7&i)&(1<<o)-1},r.F._bitsF=function(n,i,o){return(n[i>>>3]|n[1+(i>>>3)]<<8|n[2+(i>>>3)]<<16)>>>(7&i)&(1<<o)-1},r.F._get17=function(n,i){return(n[i>>>3]|n[1+(i>>>3)]<<8|n[2+(i>>>3)]<<16)>>>(7&i)},r.F._get25=function(n,i){return(n[i>>>3]|n[1+(i>>>3)]<<8|n[2+(i>>>3)]<<16|n[3+(i>>>3)]<<24)>>>(7&i)},r.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 n=r.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,n.rev15[i]=(o>>>16|o<<16)>>>17}function a(c,d,l){for(;d--!=0;)c.push(0,l)}for(i=0;i<32;i++)n.ldef[i]=n.of0[i]<<3|n.exb[i],n.ddef[i]=n.df0[i]<<4|n.dxb[i];a(n.fltree,144,8),a(n.fltree,112,9),a(n.fltree,24,7),a(n.fltree,8,8),r.F.makeCodes(n.fltree,9),r.F.codes2map(n.fltree,9,n.flmap),r.F.revCodes(n.fltree,9),a(n.fdtree,32,5),r.F.makeCodes(n.fdtree,5),r.F.codes2map(n.fdtree,5,n.fdmap),r.F.revCodes(n.fdtree,5),a(n.itree,19,0),a(n.ltree,286,0),a(n.dtree,30,0),a(n.ttree,320,0)}()})();var Rs=Bs({__proto__:null,default:An},[An]);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,h){l[u]=h>>8&255,l[u+1]=255&h},readUint:(l,u)=>16777216*l[u]+(l[u+1]<<16|l[u+2]<<8|l[u+3]),writeUint(l,u,h){l[u]=h>>24&255,l[u+1]=h>>16&255,l[u+2]=h>>8&255,l[u+3]=255&h},readASCII(l,u,h){let f="";for(let y=0;y<h;y++)f+=String.fromCharCode(l[u+y]);return f},writeASCII(l,u,h){for(let f=0;f<h.length;f++)l[u+f]=h.charCodeAt(f)},readBytes(l,u,h){const f=[];for(let y=0;y<h;y++)f.push(l[u+y]);return f},pad:l=>l.length<2?`0${l}`:l,readUTF8(l,u,h){let f,y="";for(let k=0;k<h;k++)y+=`%${s.pad(l[u+k].toString(16))}`;try{f=decodeURIComponent(y)}catch{return s.readASCII(l,u,h)}return f}};function e(l,u,h,f){const y=u*h,k=i(f),T=Math.ceil(u*k/8),C=new Uint8Array(4*y),R=new Uint32Array(C.buffer),{ctype:S}=f,{depth:F}=f,U=s.readUshort;if(S==6){const x=y<<2;if(F==8)for(var b=0;b<x;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(F==16)for(b=0;b<x;b++)C[b]=l[b<<1]}else if(S==2){const x=f.tabs.tRNS;if(x==null){if(F==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(F==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=x[0];const V=x[1],Z=x[2];if(F==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]==Z&&(C[g+3]=0)}if(F==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],U(l,B)==m&&U(l,B+2)==V&&U(l,B+4)==Z&&(C[g+3]=0)}}else if(S==3){const x=f.tabs.PLTE,V=f.tabs.tRNS,Z=V?V.length:0;if(F==1)for(var A=0;A<h;A++){var I=A*T,N=A*u;for(b=0;b<u;b++){g=N+b<<2;var L=3*(v=l[I+(b>>3)]>>7-((7&b)<<0)&1);C[g]=x[L],C[g+1]=x[L+1],C[g+2]=x[L+2],C[g+3]=v<Z?V[v]:255}}if(F==2)for(A=0;A<h;A++)for(I=A*T,N=A*u,b=0;b<u;b++)g=N+b<<2,L=3*(v=l[I+(b>>2)]>>6-((3&b)<<1)&3),C[g]=x[L],C[g+1]=x[L+1],C[g+2]=x[L+2],C[g+3]=v<Z?V[v]:255;if(F==4)for(A=0;A<h;A++)for(I=A*T,N=A*u,b=0;b<u;b++)g=N+b<<2,L=3*(v=l[I+(b>>1)]>>4-((1&b)<<2)&15),C[g]=x[L],C[g+1]=x[L+1],C[g+2]=x[L+2],C[g+3]=v<Z?V[v]:255;if(F==8)for(b=0;b<y;b++){var v;g=b<<2,L=3*(v=l[b]),C[g]=x[L],C[g+1]=x[L+1],C[g+2]=x[L+2],C[g+3]=v<Z?V[v]:255}}else if(S==4){if(F==8)for(b=0;b<y;b++){g=b<<2;var _=l[w=b<<1];C[g]=_,C[g+1]=_,C[g+2]=_,C[g+3]=l[w+1]}if(F==16)for(b=0;b<y;b++){var w;g=b<<2,_=l[w=b<<2],C[g]=_,C[g+1]=_,C[g+2]=_,C[g+3]=l[w+2]}}else if(S==0)for(m=f.tabs.tRNS?f.tabs.tRNS:-1,A=0;A<h;A++){const x=A*T,V=A*u;if(F==1)for(var p=0;p<u;p++){var M=(_=255*(l[x+(p>>>3)]>>>7-(7&p)&1))==255*m?0:255;R[V+p]=M<<24|_<<16|_<<8|_}else if(F==2)for(p=0;p<u;p++)M=(_=85*(l[x+(p>>>2)]>>>6-((3&p)<<1)&3))==85*m?0:255,R[V+p]=M<<24|_<<16|_<<8|_;else if(F==4)for(p=0;p<u;p++)M=(_=17*(l[x+(p>>>1)]>>>4-((1&p)<<2)&15))==17*m?0:255,R[V+p]=M<<24|_<<16|_<<8|_;else if(F==8)for(p=0;p<u;p++)M=(_=l[x+p])==m?0:255,R[V+p]=M<<24|_<<16|_<<8|_;else if(F==16)for(p=0;p<u;p++)_=l[x+(p<<1)],M=U(l,x+(p<<1))==m?0:255,R[V+p]=M<<24|_<<16|_<<8|_}return C}function t(l,u,h,f){const y=i(l),k=Math.ceil(h*y/8),T=new Uint8Array((k+1+l.interlace)*f);return u=l.tabs.CgBI?n(u,T):r(u,T),l.interlace==0?u=o(u,l,0,h,f):l.interlace==1&&(u=function(R,S){const F=S.width,U=S.height,b=i(S),B=b>>3,m=Math.ceil(F*b/8),g=new Uint8Array(U*m);let A=0;const I=[0,0,4,0,2,0,1],N=[0,4,0,2,0,1,0],L=[8,8,8,4,4,2,2],v=[8,8,4,4,2,2,1];let _=0;for(;_<7;){const p=L[_],M=v[_];let x=0,V=0,Z=I[_];for(;Z<U;)Z+=p,V++;let P=N[_];for(;P<F;)P+=M,x++;const q=Math.ceil(x*b/8);o(R,S,A,x,V);let $=0,O=I[_];for(;O<U;){let X=N[_],ce=A+$*q<<3;for(;X<F;){var w;if(b==1&&(w=(w=R[ce>>3])>>7-(7&ce)&1,g[O*m+(X>>3)]|=w<<7-((7&X)<<0)),b==2&&(w=(w=R[ce>>3])>>6-(7&ce)&3,g[O*m+(X>>2)]|=w<<6-((3&X)<<1)),b==4&&(w=(w=R[ce>>3])>>4-(7&ce)&15,g[O*m+(X>>1)]|=w<<4-((1&X)<<2)),b>=8){const te=O*m+X*B;for(let Y=0;Y<B;Y++)g[te+Y]=R[(ce>>3)+Y]}ce+=b,X+=M}$++,O+=p}x*V!=0&&(A+=V*(1+q)),_+=1}return g}(u,l)),u}function r(l,u){return n(new Uint8Array(l.buffer,2,l.length-6),u)}var n=function(){const l={H:{}};return l.H.N=function(u,h){const f=Uint8Array;let y,k,T=0,C=0,R=0,S=0,F=0,U=0,b=0,B=0,m=0;if(u[0]==3&&u[1]==0)return h||new f(0);const g=l.H,A=g.b,I=g.e,N=g.R,L=g.n,v=g.A,_=g.Z,w=g.m,p=h==null;for(p&&(h=new f(u.length>>>2<<5));T==0;)if(T=A(u,m,1),C=A(u,m+1,2),m+=3,C!=0){if(p&&(h=l.H.W(h,B+(1<<17))),C==1&&(y=w.J,k=w.h,U=511,b=31),C==2){R=I(u,m,5)+257,S=I(u,m+5,5)+1,F=I(u,m+10,4)+4,m+=14;let x=1;for(var M=0;M<38;M+=2)w.Q[M]=0,w.Q[M+1]=0;for(M=0;M<F;M++){const P=I(u,m+3*M,3);w.Q[1+(w.X[M]<<1)]=P,P>x&&(x=P)}m+=3*F,L(w.Q,x),v(w.Q,x,w.u),y=w.w,k=w.d,m=N(w.u,(1<<x)-1,R+S,u,m,w.v);const V=g.V(w.v,0,R,w.C);U=(1<<V)-1;const Z=g.V(w.v,R,S,w.D);b=(1<<Z)-1,L(w.C,V),v(w.C,V,y),L(w.D,Z),v(w.D,Z,k)}for(;;){const x=y[_(u,m)&U];m+=15&x;const V=x>>>4;if(!(V>>>8))h[B++]=V;else{if(V==256)break;{let Z=B+V-254;if(V>264){const X=w.q[V-257];Z=B+(X>>>3)+I(u,m,7&X),m+=7&X}const P=k[_(u,m)&b];m+=15&P;const q=P>>>4,$=w.c[q],O=($>>>4)+A(u,m,15&$);for(m+=15&$;B<Z;)h[B]=h[B++-O],h[B]=h[B++-O],h[B]=h[B++-O],h[B]=h[B++-O];B=Z}}}}else{7&m&&(m+=8-(7&m));const x=4+(m>>>3),V=u[x-4]|u[x-3]<<8;p&&(h=l.H.W(h,B+V)),h.set(new f(u.buffer,u.byteOffset+x,V),B),m=x+V<<3,B+=V}return h.length==B?h:h.slice(0,B)},l.H.W=function(u,h){const f=u.length;if(h<=f)return u;const y=new Uint8Array(f<<1);return y.set(u,0),y},l.H.R=function(u,h,f,y,k,T){const C=l.H.e,R=l.H.Z;let S=0;for(;S<f;){const F=u[R(y,k)&h];k+=15&F;const U=F>>>4;if(U<=15)T[S]=U,S++;else{let b=0,B=0;U==16?(B=3+C(y,k,2),k+=2,b=T[S-1]):U==17?(B=3+C(y,k,3),k+=3):U==18&&(B=11+C(y,k,7),k+=7);const m=S+B;for(;S<m;)T[S]=b,S++}}return k},l.H.V=function(u,h,f,y){let k=0,T=0;const C=y.length>>>1;for(;T<f;){const R=u[T+h];y[T<<1]=0,y[1+(T<<1)]=R,R>k&&(k=R),T++}for(;T<C;)y[T<<1]=0,y[1+(T<<1)]=0,T++;return k},l.H.n=function(u,h){const f=l.H.m,y=u.length;let k,T,C,R;const S=f.j;for(var F=0;F<=h;F++)S[F]=0;for(F=1;F<y;F+=2)S[u[F]]++;const U=f.K;for(k=0,S[0]=0,T=1;T<=h;T++)k=k+S[T-1]<<1,U[T]=k;for(C=0;C<y;C+=2)R=u[C+1],R!=0&&(u[C]=U[R],U[R]++)},l.H.A=function(u,h,f){const y=u.length,k=l.H.m.r;for(let T=0;T<y;T+=2)if(u[T+1]!=0){const C=T>>1,R=u[T+1],S=C<<4|R,F=h-R;let U=u[T]<<F;const b=U+(1<<F);for(;U!=b;)f[k[U]>>>15-h]=S,U++}},l.H.l=function(u,h){const f=l.H.m.r,y=15-h;for(let k=0;k<u.length;k+=2){const T=u[k]<<h-u[k+1];u[k]=f[T]>>>y}},l.H.M=function(u,h,f){f<<=7&h;const y=h>>>3;u[y]|=f,u[y+1]|=f>>>8},l.H.I=function(u,h,f){f<<=7&h;const y=h>>>3;u[y]|=f,u[y+1]|=f>>>8,u[y+2]|=f>>>16},l.H.e=function(u,h,f){return(u[h>>>3]|u[1+(h>>>3)]<<8)>>>(7&h)&(1<<f)-1},l.H.b=function(u,h,f){return(u[h>>>3]|u[1+(h>>>3)]<<8|u[2+(h>>>3)]<<16)>>>(7&h)&(1<<f)-1},l.H.Z=function(u,h){return(u[h>>>3]|u[1+(h>>>3)]<<8|u[2+(h>>>3)]<<16)>>>(7&h)},l.H.i=function(u,h){return(u[h>>>3]|u[1+(h>>>3)]<<8|u[2+(h>>>3)]<<16|u[3+(h>>>3)]<<24)>>>(7&h)},l.H.m=function(){const u=Uint16Array,h=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 h(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 h(286),Y:new h(30),a:new h(19),t:new h(15e3),k:new u(65536),g:new u(32768)}}(),function(){const u=l.H.m;for(var h=0;h<32768;h++){let y=h;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[h]=(y>>>16|y<<16)>>>17}function f(y,k,T){for(;k--!=0;)y.push(0,T)}for(h=0;h<32;h++)u.q[h]=u.S[h]<<3|u.T[h],u.c[h]=u.p[h]<<4|u.z[h];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,h,f,y){let k=i(u);const T=Math.ceil(f*k/8);let C,R;k=Math.ceil(k/8);let S=l[h],F=0;if(S>1&&(l[h]=[0,0,1][S-2]),S==3)for(F=k;F<T;F++)l[F+1]=l[F+1]+(l[F+1-k]>>>1)&255;for(let U=0;U<y;U++)if(C=h+U*T,R=C+U+1,S=l[R-1],F=0,S==0)for(;F<T;F++)l[C+F]=l[R+F];else if(S==1){for(;F<k;F++)l[C+F]=l[R+F];for(;F<T;F++)l[C+F]=l[R+F]+l[C+F-k]}else if(S==2)for(;F<T;F++)l[C+F]=l[R+F]+l[C+F-T];else if(S==3){for(;F<k;F++)l[C+F]=l[R+F]+(l[C+F-T]>>>1);for(;F<T;F++)l[C+F]=l[R+F]+(l[C+F-T]+l[C+F-k]>>>1)}else{for(;F<k;F++)l[C+F]=l[R+F]+a(0,l[C+F-T],0);for(;F<T;F++)l[C+F]=l[R+F]+a(l[C+F-k],l[C+F-T],l[C+F-k-T])}return l}function a(l,u,h){const f=l+u-h,y=f-l,k=f-u,T=f-h;return y*y<=k*k&&y*y<=T*T?l:k*k<=T*T?u:h}function c(l,u,h){h.width=s.readUint(l,u),u+=4,h.height=s.readUint(l,u),u+=4,h.depth=l[u],u++,h.ctype=l[u],u++,h.compress=l[u],u++,h.filter=l[u],u++,h.interlace=l[u],u++}function d(l,u,h,f,y,k,T,C,R){const S=Math.min(u,y),F=Math.min(h,k);let U=0,b=0;for(let _=0;_<F;_++)for(let w=0;w<S;w++)if(T>=0&&C>=0?(U=_*u+w<<2,b=(C+_)*y+T+w<<2):(U=(-C+_)*u-T+w<<2,b=_*y+w<<2),R==0)f[b]=l[U],f[b+1]=l[U+1],f[b+2]=l[U+2],f[b+3]=l[U+3];else if(R==1){var B=l[U+3]*.00392156862745098,m=l[U]*B,g=l[U+1]*B,A=l[U+2]*B,I=f[b+3]*(1/255),N=f[b]*I,L=f[b+1]*I,v=f[b+2]*I;const p=1-B,M=B+I*p,x=M==0?0:1/M;f[b+3]=255*M,f[b+0]=(m+N*p)*x,f[b+1]=(g+L*p)*x,f[b+2]=(A+v*p)*x}else if(R==2)B=l[U+3],m=l[U],g=l[U+1],A=l[U+2],I=f[b+3],N=f[b],L=f[b+1],v=f[b+2],B==I&&m==N&&g==L&&A==v?(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[U+3],m=l[U],g=l[U+1],A=l[U+2],I=f[b+3],N=f[b],L=f[b+1],v=f[b+2],B==I&&m==N&&g==L&&A==v)continue;if(B<220&&I>20)return!1}return!0}return{decode:function(u){const h=new Uint8Array(u);let f=8;const y=s,k=y.readUshort,T=y.readUint,C={tabs:{},frames:[]},R=new Uint8Array(h.length);let S,F=0,U=0;const b=[137,80,78,71,13,10,26,10];for(var B=0;B<8;B++)if(h[B]!=b[B])throw"The input is not a PNG file!";for(;f<h.length;){const _=y.readUint(h,f);f+=4;const w=y.readASCII(h,f,4);if(f+=4,w=="IHDR")c(h,f,C);else if(w=="iCCP"){for(var m=f;h[m]!=0;)m++;y.readASCII(h,f,m-f),h[m+1];const p=h.slice(m+2,f+_);let M=null;try{M=r(p)}catch{M=n(p)}C.tabs[w]=M}else if(w=="CgBI")C.tabs[w]=h.slice(f,f+4);else if(w=="IDAT"){for(B=0;B<_;B++)R[F+B]=h[f+B];F+=_}else if(w=="acTL")C.tabs[w]={num_frames:T(h,f),num_plays:T(h,f+4)},S=new Uint8Array(h.length);else if(w=="fcTL"){U!=0&&((v=C.frames[C.frames.length-1]).data=t(C,S.slice(0,U),v.rect.width,v.rect.height),U=0);const p={x:T(h,f+12),y:T(h,f+16),width:T(h,f+4),height:T(h,f+8)};let M=k(h,f+22);M=k(h,f+20)/(M==0?100:M);const x={rect:p,delay:Math.round(1e3*M),dispose:h[f+24],blend:h[f+25]};C.frames.push(x)}else if(w=="fdAT"){for(B=0;B<_-4;B++)S[U+B]=h[f+B+4];U+=_-4}else if(w=="pHYs")C.tabs[w]=[y.readUint(h,f),y.readUint(h,f+4),h[f+8]];else if(w=="cHRM")for(C.tabs[w]=[],B=0;B<8;B++)C.tabs[w].push(y.readUint(h,f+4*B));else if(w=="tEXt"||w=="zTXt"){C.tabs[w]==null&&(C.tabs[w]={});var g=y.nextZero(h,f),A=y.readASCII(h,f,g-f),I=f+_-g-1;if(w=="tEXt")L=y.readASCII(h,g+1,I);else{var N=r(h.slice(g+2,g+2+I));L=y.readUTF8(N,0,N.length)}C.tabs[w][A]=L}else if(w=="iTXt"){C.tabs[w]==null&&(C.tabs[w]={}),g=0,m=f,g=y.nextZero(h,m),A=y.readASCII(h,m,g-m);const p=h[m=g+1];var L;h[m+1],m+=2,g=y.nextZero(h,m),y.readASCII(h,m,g-m),m=g+1,g=y.nextZero(h,m),y.readUTF8(h,m,g-m),I=_-((m=g+1)-f),p==0?L=y.readUTF8(h,m,I):(N=r(h.slice(m,m+I)),L=y.readUTF8(N,0,N.length)),C.tabs[w][A]=L}else if(w=="PLTE")C.tabs[w]=y.readBytes(h,f,_);else if(w=="hIST"){const p=C.tabs.PLTE.length/3;for(C.tabs[w]=[],B=0;B<p;B++)C.tabs[w].push(k(h,f+2*B))}else if(w=="tRNS")C.ctype==3?C.tabs[w]=y.readBytes(h,f,_):C.ctype==0?C.tabs[w]=k(h,f):C.ctype==2&&(C.tabs[w]=[k(h,f),k(h,f+2),k(h,f+4)]);else if(w=="gAMA")C.tabs[w]=y.readUint(h,f)/1e5;else if(w=="sRGB")C.tabs[w]=h[f];else if(w=="bKGD")C.ctype==0||C.ctype==4?C.tabs[w]=[k(h,f)]:C.ctype==2||C.ctype==6?C.tabs[w]=[k(h,f),k(h,f+2),k(h,f+4)]:C.ctype==3&&(C.tabs[w]=h[f]);else if(w=="IEND")break;f+=_,y.readUint(h,f),f+=4}var v;return U!=0&&((v=C.frames[C.frames.length-1]).data=t(C,S.slice(0,U),v.rect.width,v.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 h=u.width,f=u.height;if(u.tabs.acTL==null)return[e(u.data,h,f,u).buffer];const y=[];u.frames[0].data==null&&(u.frames[0].data=u.data);const k=h*f*4,T=new Uint8Array(k),C=new Uint8Array(k),R=new Uint8Array(k);for(let F=0;F<u.frames.length;F++){const U=u.frames[F],b=U.rect.x,B=U.rect.y,m=U.rect.width,g=U.rect.height,A=e(U.data,m,g,u);if(F!=0)for(var S=0;S<k;S++)R[S]=T[S];if(U.blend==0?d(A,m,g,T,h,f,b,B,0):U.blend==1&&d(A,m,g,T,h,f,b,B,1),y.push(T.buffer.slice(0)),U.dispose!=0){if(U.dispose==1)d(C,m,g,T,h,f,b,B,0);else if(U.dispose==2)for(S=0;S<k;S++)T[S]=R[S]}}return y},_paeth:a,_copyTile:d,_bin:s}}();(function(){const{_copyTile:s}=Ye,{_bin:e}=Ye,t=Ye._paeth;var r={table:function(){const m=new Uint32Array(256);for(let g=0;g<256;g++){let A=g;for(let I=0;I<8;I++)1&A?A=3988292384^A>>>1:A>>>=1;m[g]=A}return m}(),update(m,g,A,I){for(let N=0;N<I;N++)m=r.table[255&(m^g[A+N])]^m>>>8;return m},crc:(m,g,A)=>4294967295^r.update(4294967295,m,g,A)};function n(m,g,A,I){g[A]+=m[0]*I>>4,g[A+1]+=m[1]*I>>4,g[A+2]+=m[2]*I>>4,g[A+3]+=m[3]*I>>4}function i(m){return Math.max(0,Math.min(255,m))}function o(m,g){const A=m[0]-g[0],I=m[1]-g[1],N=m[2]-g[2],L=m[3]-g[3];return A*A+I*I+N*N+L*L}function a(m,g,A,I,N,L,v){v==null&&(v=1);const _=I.length,w=[];for(var p=0;p<_;p++){const O=I[p];w.push([O>>>0&255,O>>>8&255,O>>>16&255,O>>>24&255])}for(p=0;p<_;p++){let O=4294967295;for(var M=0,x=0;x<_;x++){var V=o(w[p],w[x]);x!=p&&V<O&&(O=V,M=x)}}const Z=new Uint32Array(N.buffer),P=new Int16Array(g*A*4),q=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(p=0;p<q.length;p++)q[p]=255*((q[p]+.5)/16-.5);for(let O=0;O<A;O++)for(let X=0;X<g;X++){var $;p=4*(O*g+X),v!=2?$=[i(m[p]+P[p]),i(m[p+1]+P[p+1]),i(m[p+2]+P[p+2]),i(m[p+3]+P[p+3])]:(V=q[4*(3&O)+(3&X)],$=[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(x=0;x<_;x++){const ae=o($,w[x]);ae<ce&&(ce=ae,M=x)}const te=w[M],Y=[$[0]-te[0],$[1]-te[1],$[2]-te[2],$[3]-te[3]];v==1&&(X!=g-1&&n(Y,P,p+4,7),O!=A-1&&(X!=0&&n(Y,P,p+4*g-4,3),n(Y,P,p+4*g,5),X!=g-1&&n(Y,P,p+4*g+4,1))),L[p>>2]=M,Z[p>>2]=I[M]}}function c(m,g,A,I,N){N==null&&(N={});const{crc:L}=r,v=e.writeUint,_=e.writeUshort,w=e.writeASCII;let p=8;const M=m.frames.length>1;let x,V=!1,Z=33+(M?20:0);if(N.sRGB!=null&&(Z+=13),N.pHYs!=null&&(Z+=21),N.iCCP!=null&&(x=pako.deflate(N.iCCP),Z+=21+x.length+4),m.ctype==3){for(var P=m.plte.length,q=0;q<P;q++)m.plte[q]>>>24!=255&&(V=!0);Z+=8+3*P+4+(V?8+1*P+4:0)}for(var $=0;$<m.frames.length;$++)M&&(Z+=38),Z+=(te=m.frames[$]).cimg.length+12,$!=0&&(Z+=4);Z+=12;const O=new Uint8Array(Z),X=[137,80,78,71,13,10,26,10];for(q=0;q<8;q++)O[q]=X[q];if(v(O,p,13),p+=4,w(O,p,"IHDR"),p+=4,v(O,p,g),p+=4,v(O,p,A),p+=4,O[p]=m.depth,p++,O[p]=m.ctype,p++,O[p]=0,p++,O[p]=0,p++,O[p]=0,p++,v(O,p,L(O,p-17,17)),p+=4,N.sRGB!=null&&(v(O,p,1),p+=4,w(O,p,"sRGB"),p+=4,O[p]=N.sRGB,p++,v(O,p,L(O,p-5,5)),p+=4),N.iCCP!=null){const Y=13+x.length;v(O,p,Y),p+=4,w(O,p,"iCCP"),p+=4,w(O,p,"ICC profile"),p+=11,p+=2,O.set(x,p),p+=x.length,v(O,p,L(O,p-(Y+4),Y+4)),p+=4}if(N.pHYs!=null&&(v(O,p,9),p+=4,w(O,p,"pHYs"),p+=4,v(O,p,N.pHYs[0]),p+=4,v(O,p,N.pHYs[1]),p+=4,O[p]=N.pHYs[2],p++,v(O,p,L(O,p-13,13)),p+=4),M&&(v(O,p,8),p+=4,w(O,p,"acTL"),p+=4,v(O,p,m.frames.length),p+=4,v(O,p,N.loop!=null?N.loop:0),p+=4,v(O,p,L(O,p-12,12)),p+=4),m.ctype==3){for(v(O,p,3*(P=m.plte.length)),p+=4,w(O,p,"PLTE"),p+=4,q=0;q<P;q++){const Y=3*q,ae=m.plte[q],me=255&ae,Fe=ae>>>8&255,Et=ae>>>16&255;O[p+Y+0]=me,O[p+Y+1]=Fe,O[p+Y+2]=Et}if(p+=3*P,v(O,p,L(O,p-3*P-4,3*P+4)),p+=4,V){for(v(O,p,P),p+=4,w(O,p,"tRNS"),p+=4,q=0;q<P;q++)O[p+q]=m.plte[q]>>>24&255;p+=P,v(O,p,L(O,p-P-4,P+4)),p+=4}}let ce=0;for($=0;$<m.frames.length;$++){var te=m.frames[$];M&&(v(O,p,26),p+=4,w(O,p,"fcTL"),p+=4,v(O,p,ce++),p+=4,v(O,p,te.rect.width),p+=4,v(O,p,te.rect.height),p+=4,v(O,p,te.rect.x),p+=4,v(O,p,te.rect.y),p+=4,_(O,p,I[$]),p+=2,_(O,p,1e3),p+=2,O[p]=te.dispose,p++,O[p]=te.blend,p++,v(O,p,L(O,p-30,30)),p+=4);const Y=te.cimg;v(O,p,(P=Y.length)+($==0?0:4)),p+=4;const ae=p;w(O,p,$==0?"IDAT":"fdAT"),p+=4,$!=0&&(v(O,p,ce++),p+=4),O.set(Y,p),p+=P,v(O,p,L(O,ae,p-ae)),p+=4}return v(O,p,0),p+=4,w(O,p,"IEND"),p+=4,v(O,p,L(O,p-4,4)),p+=4,O.buffer}function d(m,g,A){for(let I=0;I<m.frames.length;I++){const N=m.frames[I];N.rect.width;const L=N.rect.height,v=new Uint8Array(L*N.bpl+L);N.cimg=f(N.img,L,N.bpp,N.bpl,v,g,A)}}function l(m,g,A,I,N){const L=N[0],v=N[1],_=N[2],w=N[3],p=N[4],M=N[5];let x=6,V=8,Z=255;for(var P=0;P<m.length;P++){const Le=new Uint8Array(m[P]);for(var q=Le.length,$=0;$<q;$+=4)Z&=Le[$+3]}const O=Z!=255,X=function(de,re,ye,Ue,be,xe){const ge=[];for(var ee=0;ee<de.length;ee++){const _e=new Uint8Array(de[ee]),$e=new Uint32Array(_e.buffer);var Ve;let De=0,Me=0,rt=re,ft=ye,Qt=Ue?1:0;if(ee!=0){const xn=xe||Ue||ee==1||ge[ee-2].dispose!=0?1:2;let Yt=0,ue=1e9;for(let ze=0;ze<xn;ze++){var Re=new Uint8Array(de[ee-1-ze]);const pt=new Uint32Array(de[ee-1-ze]);let xt=re,_t=ye,en=-1,hn=-1;for(let Mt=0;Mt<ye;Mt++)for(let Vt=0;Vt<re;Vt++)$e[Ne=Mt*re+Vt]!=pt[Ne]&&(Vt<xt&&(xt=Vt),Vt>en&&(en=Vt),Mt<_t&&(_t=Mt),Mt>hn&&(hn=Mt));en==-1&&(xt=_t=en=hn=0),be&&((1&xt)==1&&xt--,(1&_t)==1&&_t--);const Yr=(en-xt+1)*(hn-_t+1);Yr<ue&&(ue=Yr,Yt=ze,De=xt,Me=_t,rt=en-xt+1,ft=hn-_t+1)}Re=new Uint8Array(de[ee-1-Yt]),Yt==1&&(ge[ee-1].dispose=2),Ve=new Uint8Array(rt*ft*4),s(Re,re,ye,Ve,rt,ft,-De,-Me,0),Qt=s(_e,re,ye,Ve,rt,ft,-De,-Me,3)?1:0,Qt==1?h(_e,re,ye,Ve,{x:De,y:Me,width:rt,height:ft}):s(_e,re,ye,Ve,rt,ft,-De,-Me,0)}else Ve=_e.slice(0);ge.push({rect:{x:De,y:Me,width:rt,height:ft},img:Ve,blend:Qt,dispose:0})}if(Ue)for(ee=0;ee<ge.length;ee++){if((ut=ge[ee]).blend==1)continue;const _e=ut.rect,$e=ge[ee-1].rect,De=Math.min(_e.x,$e.x),Me=Math.min(_e.y,$e.y),rt={x:De,y:Me,width:Math.max(_e.x+_e.width,$e.x+$e.width)-De,height:Math.max(_e.y+_e.height,$e.y+$e.height)-Me};ge[ee-1].dispose=1,ee-1!=0&&u(de,re,ye,ge,ee-1,rt,be),u(de,re,ye,ge,ee,rt,be)}let ht=0;if(de.length!=1)for(var Ne=0;Ne<ge.length;Ne++){var ut;ht+=(ut=ge[Ne]).rect.width*ut.rect.height}return ge}(m,g,A,L,v,_),ce={},te=[],Y=[];if(I!=0){const Le=[];for($=0;$<X.length;$++)Le.push(X[$].img.buffer);const de=function(be){let xe=0;for(var ge=0;ge<be.length;ge++)xe+=be[ge].byteLength;const ee=new Uint8Array(xe);let Ve=0;for(ge=0;ge<be.length;ge++){const Re=new Uint8Array(be[ge]),ht=Re.length;for(let Ne=0;Ne<ht;Ne+=4){let ut=Re[Ne],_e=Re[Ne+1],$e=Re[Ne+2];const De=Re[Ne+3];De==0&&(ut=_e=$e=0),ee[Ve+Ne]=ut,ee[Ve+Ne+1]=_e,ee[Ve+Ne+2]=$e,ee[Ve+Ne+3]=De}Ve+=ht}return ee.buffer}(Le),re=k(de,I);for($=0;$<re.plte.length;$++)te.push(re.plte[$].est.rgba);let ye=0;for($=0;$<X.length;$++){const Ue=(me=X[$]).img.length;var ae=new Uint8Array(re.inds.buffer,ye>>2,Ue>>2);Y.push(ae);const be=new Uint8Array(re.abuf,ye,Ue);M&&a(me.img,me.rect.width,me.rect.height,te,be,ae),me.img.set(be),ye+=Ue}}else for(P=0;P<X.length;P++){var me=X[P];const Le=new Uint32Array(me.img.buffer);var Fe=me.rect.width;for(q=Le.length,ae=new Uint8Array(q),Y.push(ae),$=0;$<q;$++){const de=Le[$];if($!=0&&de==Le[$-1])ae[$]=ae[$-1];else if($>Fe&&de==Le[$-Fe])ae[$]=ae[$-Fe];else{let re=ce[de];if(re==null&&(ce[de]=re=te.length,te.push(de),te.length>=300))break;ae[$]=re}}}const Et=te.length;for(Et<=256&&p==0&&(V=Et<=2?1:Et<=4?2:Et<=16?4:8,V=Math.max(V,w)),P=0;P<X.length;P++){(me=X[P]).rect.x,me.rect.y,Fe=me.rect.width;const Le=me.rect.height;let de=me.img;new Uint32Array(de.buffer);let re=4*Fe,ye=4;if(Et<=256&&p==0){re=Math.ceil(V*Fe/8);var Ke=new Uint8Array(re*Le);const Ue=Y[P];for(let be=0;be<Le;be++){$=be*re;const xe=be*Fe;if(V==8)for(var fe=0;fe<Fe;fe++)Ke[$+fe]=Ue[xe+fe];else if(V==4)for(fe=0;fe<Fe;fe++)Ke[$+(fe>>1)]|=Ue[xe+fe]<<4-4*(1&fe);else if(V==2)for(fe=0;fe<Fe;fe++)Ke[$+(fe>>2)]|=Ue[xe+fe]<<6-2*(3&fe);else if(V==1)for(fe=0;fe<Fe;fe++)Ke[$+(fe>>3)]|=Ue[xe+fe]<<7-1*(7&fe)}de=Ke,x=3,ye=1}else if(O==0&&X.length==1){Ke=new Uint8Array(Fe*Le*3);const Ue=Fe*Le;for($=0;$<Ue;$++){const be=3*$,xe=4*$;Ke[be]=de[xe],Ke[be+1]=de[xe+1],Ke[be+2]=de[xe+2]}de=Ke,x=2,ye=3,re=3*Fe}me.img=de,me.bpl=re,me.bpp=ye}return{ctype:x,depth:V,plte:te,frames:X}}function u(m,g,A,I,N,L,v){const _=Uint8Array,w=Uint32Array,p=new _(m[N-1]),M=new w(m[N-1]),x=N+1<m.length?new _(m[N+1]):null,V=new _(m[N]),Z=new w(V.buffer);let P=g,q=A,$=-1,O=-1;for(let ce=0;ce<L.height;ce++)for(let te=0;te<L.width;te++){const Y=L.x+te,ae=L.y+ce,me=ae*g+Y,Fe=Z[me];Fe==0||I[N-1].dispose==0&&M[me]==Fe&&(x==null||x[4*me+3]!=0)||(Y<P&&(P=Y),Y>$&&($=Y),ae<q&&(q=ae),ae>O&&(O=ae))}$==-1&&(P=q=$=O=0),v&&((1&P)==1&&P--,(1&q)==1&&q--),L={x:P,y:q,width:$-P+1,height:O-q+1};const X=I[N];X.rect=L,X.blend=1,X.img=new Uint8Array(L.width*L.height*4),I[N-1].dispose==0?(s(p,g,A,X.img,L.width,L.height,-L.x,-L.y,0),h(V,g,A,X.img,L)):s(V,g,A,X.img,L.width,L.height,-L.x,-L.y,0)}function h(m,g,A,I,N){s(m,g,A,I,N.width,N.height,-N.x,-N.y,2)}function f(m,g,A,I,N,L,v){const _=[];let w,p=[0,1,2,3,4];L!=-1?p=[L]:(g*I>5e5||A==1)&&(p=[0]),v&&(w={level:0});const M=Rs;for(var x=0;x<p.length;x++){for(let P=0;P<g;P++)y(N,m,P,I,A,p[x]);_.push(M.deflate(N,w))}let V,Z=1e9;for(x=0;x<_.length;x++)_[x].length<Z&&(V=x,Z=_[x].length);return _[V]}function y(m,g,A,I,N,L){const v=A*I;let _=v+A;if(m[_]=L,_++,L==0)if(I<500)for(var w=0;w<I;w++)m[_+w]=g[v+w];else m.set(new Uint8Array(g.buffer,v,I),_);else if(L==1){for(w=0;w<N;w++)m[_+w]=g[v+w];for(w=N;w<I;w++)m[_+w]=g[v+w]-g[v+w-N]+256&255}else if(A==0){for(w=0;w<N;w++)m[_+w]=g[v+w];if(L==2)for(w=N;w<I;w++)m[_+w]=g[v+w];if(L==3)for(w=N;w<I;w++)m[_+w]=g[v+w]-(g[v+w-N]>>1)+256&255;if(L==4)for(w=N;w<I;w++)m[_+w]=g[v+w]-t(g[v+w-N],0,0)+256&255}else{if(L==2)for(w=0;w<I;w++)m[_+w]=g[v+w]+256-g[v+w-I]&255;if(L==3){for(w=0;w<N;w++)m[_+w]=g[v+w]+256-(g[v+w-I]>>1)&255;for(w=N;w<I;w++)m[_+w]=g[v+w]+256-(g[v+w-I]+g[v+w-N]>>1)&255}if(L==4){for(w=0;w<N;w++)m[_+w]=g[v+w]+256-t(0,g[v+w-I],0)&255;for(w=N;w<I;w++)m[_+w]=g[v+w]+256-t(g[v+w-N],g[v+w-I],g[v+w-N-I])&255}}}function k(m,g){const A=new Uint8Array(m),I=A.slice(0),N=new Uint32Array(I.buffer),L=T(I,g),v=L[0],_=L[1],w=A.length,p=new Uint8Array(w>>2);let M;if(A.length<2e7)for(var x=0;x<w;x+=4)M=C(v,V=A[x]*(1/255),Z=A[x+1]*(1/255),P=A[x+2]*(1/255),q=A[x+3]*(1/255)),p[x>>2]=M.ind,N[x>>2]=M.est.rgba;else for(x=0;x<w;x+=4){var V=A[x]*.00392156862745098,Z=A[x+1]*(1/255),P=A[x+2]*(1/255),q=A[x+3]*(1/255);for(M=v;M.left;)M=R(M.est,V,Z,P,q)<=0?M.left:M.right;p[x>>2]=M.ind,N[x>>2]=M.est.rgba}return{abuf:I.buffer,inds:p,plte:_}}function T(m,g,A){A==null&&(A=1e-4);const I=new Uint32Array(m.buffer),N={i0:0,i1:m.length,bst:null,est:null,tdst:0,left:null,right:null};N.bst=U(m,N.i0,N.i1),N.est=b(N.bst);const L=[N];for(;L.length<g;){let _=0,w=0;for(var v=0;v<L.length;v++)L[v].est.L>_&&(_=L[v].est.L,w=v);if(_<A)break;const p=L[w],M=S(m,I,p.i0,p.i1,p.est.e,p.est.eMq255);if(p.i0>=M||p.i1<=M){p.est.L=0;continue}const x={i0:p.i0,i1:M,bst:null,est:null,tdst:0,left:null,right:null};x.bst=U(m,x.i0,x.i1),x.est=b(x.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-x.bst.N},v=0;v<16;v++)V.bst.R[v]=p.bst.R[v]-x.bst.R[v];for(v=0;v<4;v++)V.bst.m[v]=p.bst.m[v]-x.bst.m[v];V.est=b(V.bst),p.left=x,p.right=V,L[w]=x,L.push(V)}for(L.sort((_,w)=>w.bst.N-_.bst.N),v=0;v<L.length;v++)L[v].ind=v;return[N,L]}function C(m,g,A,I,N){if(m.left==null)return m.tdst=function(x,V,Z,P,q){const $=V-x[0],O=Z-x[1],X=P-x[2],ce=q-x[3];return $*$+O*O+X*X+ce*ce}(m.est.q,g,A,I,N),m;const L=R(m.est,g,A,I,N);let v=m.left,_=m.right;L>0&&(v=m.right,_=m.left);const w=C(v,g,A,I,N);if(w.tdst<=L*L)return w;const p=C(_,g,A,I,N);return p.tdst<w.tdst?p:w}function R(m,g,A,I,N){const{e:L}=m;return L[0]*g+L[1]*A+L[2]*I+L[3]*N-m.eMq}function S(m,g,A,I,N,L){for(I-=4;A<I;){for(;F(m,A,N)<=L;)A+=4;for(;F(m,I,N)>L;)I-=4;if(A>=I)break;const v=g[A>>2];g[A>>2]=g[I>>2],g[I>>2]=v,A+=4,I-=4}for(;F(m,A,N)>L;)A-=4;return A+4}function F(m,g,A){return m[g]*A[0]+m[g+1]*A[1]+m[g+2]*A[2]+m[g+3]*A[3]}function U(m,g,A){const I=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],N=[0,0,0,0],L=A-g>>2;for(let v=g;v<A;v+=4){const _=m[v]*.00392156862745098,w=m[v+1]*(1/255),p=m[v+2]*(1/255),M=m[v+3]*(1/255);N[0]+=_,N[1]+=w,N[2]+=p,N[3]+=M,I[0]+=_*_,I[1]+=_*w,I[2]+=_*p,I[3]+=_*M,I[5]+=w*w,I[6]+=w*p,I[7]+=w*M,I[10]+=p*p,I[11]+=p*M,I[15]+=M*M}return I[4]=I[1],I[8]=I[2],I[9]=I[6],I[12]=I[3],I[13]=I[7],I[14]=I[11],{R:I,m:N,N:L}}function b(m){const{R:g}=m,{m:A}=m,{N:I}=m,N=A[0],L=A[1],v=A[2],_=A[3],w=I==0?0:1/I,p=[g[0]-N*N*w,g[1]-N*L*w,g[2]-N*v*w,g[3]-N*_*w,g[4]-L*N*w,g[5]-L*L*w,g[6]-L*v*w,g[7]-L*_*w,g[8]-v*N*w,g[9]-v*L*w,g[10]-v*v*w,g[11]-v*_*w,g[12]-_*N*w,g[13]-_*L*w,g[14]-_*v*w,g[15]-_*_*w],M=p,x=B;let V=[Math.random(),Math.random(),Math.random(),Math.random()],Z=0,P=0;if(I!=0)for(let $=0;$<16&&(V=x.multVec(M,V),P=Math.sqrt(x.dot(V,V)),V=x.sml(1/P,V),!($!=0&&Math.abs(P-Z)<1e-9));$++)Z=P;const q=[N*w,L*w,v*w,_*w];return{Cov:p,q,e:V,L:Z,eMq255:x.dot(x.sml(255,q),V),eMq:x.dot(V,q),rgba:(Math.round(255*q[3])<<24|Math.round(255*q[2])<<16|Math.round(255*q[1])<<8|Math.round(255*q[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,I,N,L,v,_){N==null&&(N=0),_==null&&(_=!1);const w=l(g,A,I,N,[!1,!1,!1,0,_,!1]);return d(w,-1),c(w,A,I,L,v)},Ye.encodeLL=function(g,A,I,N,L,v,_,w){const p={ctype:0+(N==1?0:2)+(L==0?0:4),depth:v,frames:[]},M=(N+L)*v,x=M*A;for(let V=0;V<g.length;V++)p.frames.push({rect:{x:0,y:0,width:A,height:I},img:new Uint8Array(g[V]),blend:0,dispose:1,bpp:Math.ceil(M/8),bpl:Math.ceil(x/8)});return d(p,0,!0),c(p,A,I,_,w)},Ye.encode.compress=l,Ye.encode.dither=a,Ye.quantize=k,Ye.quantize.getKDtree=T,Ye.quantize.getNearest=C})();const Dr={toArrayBuffer(s,e){const t=s.width,r=s.height,n=t<<2,i=s.getContext("2d").getImageData(0,0,t,r),o=new Uint32Array(i.data.buffer),a=(32*t+31)/32<<2,c=a*r,d=122+c,l=new ArrayBuffer(d),u=new DataView(l),h=1<<20;let f,y,k,T,C=h,R=0,S=0,F=0;function U(m){u.setUint16(S,m,!0),S+=2}function b(m){u.setUint32(S,m,!0),S+=4}function B(m){S+=m}U(19778),b(d),B(4),b(122),b(108),b(t),b(-r>>>0),U(1),U(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<r&&C>0;){for(T=122+R*a,f=0;f<n;)C--,y=o[F++],k=y>>>24,u.setUint32(T+f,y<<8|k),f+=4;R++}F<o.length?(C=h,setTimeout(m,Dr._dly)):e(l)}()},toBlob(s,e){this.toArrayBuffer(s,t=>{e(new Blob([t],{type:"image/bmp"}))})},_dly:9};var He={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Ds={[He.CHROME]:16384,[He.FIREFOX]:11180,[He.DESKTOP_SAFARI]:16384,[He.IE]:8192,[He.IOS]:4096,[He.ETC]:8192};const zn=typeof window<"u",Mr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,kn=zn&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Ms=(zn||Mr)&&(kn&&kn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Vr=(zn||Mr)&&(kn&&kn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Xn(s,e,t=Date.now()){return new Promise(r=>{const n=s.split(","),i=n[0].match(/:(.*?);/)[1],o=globalThis.atob(n[1]);let a=o.length;const c=new Uint8Array(a);for(;a--;)c[a]=o.charCodeAt(a);const d=new Blob([c],{type:i});d.name=e,d.lastModified=t,r(d)})}function Hr(s){return new Promise((e,t)=>{const r=new Vr;r.onload=()=>e(r.result),r.onerror=n=>t(n),r.readAsDataURL(s)})}function $r(s){return new Promise((e,t)=>{const r=new Image;r.onload=()=>e(r),r.onerror=n=>t(n),r.src=s})}function Ot(){if(Ot.cachedResult!==void 0)return Ot.cachedResult;let s=He.ETC;const{userAgent:e}=navigator;return/Chrom(e|ium)/i.test(e)?s=He.CHROME:/iP(ad|od|hone)/i.test(e)&&/WebKit/i.test(e)?s=He.IOS:/Safari/i.test(e)?s=He.DESKTOP_SAFARI:/Firefox/i.test(e)?s=He.FIREFOX:(/MSIE/i.test(e)||document.documentMode)&&(s=He.IE),Ot.cachedResult=s,Ot.cachedResult}function Pr(s,e){const t=Ot(),r=Ds[t];let n=s,i=e,o=n*i;const a=n>i?i/n:n/i;for(;o>r*r;){const c=(r+n)/2,d=(r+i)/2;c<d?(i=d,n=d*a):(i=c*a,n=c),o=n*i}return{width:n,height:i}}function Fn(s,e){let t,r;try{if(t=new OffscreenCanvas(s,e),r=t.getContext("2d"),r===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{t=document.createElement("canvas"),r=t.getContext("2d")}return t.width=s,t.height=e,[t,r]}function Wr(s,e){const{width:t,height:r}=Pr(s.width,s.height),[n,i]=Fn(t,r);return e&&/jpe?g/.test(e)&&(i.fillStyle="white",i.fillRect(0,0,n.width,n.height)),i.drawImage(s,0,0,n.width,n.height),n}function Nn(){return Nn.cachedResult!==void 0||(Nn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Nn.cachedResult}function In(s,e={}){return new Promise(function(t,r){let n,i;var o=function(){try{return i=Wr(n,e.fileType||s.type),t([n,i])}catch(c){return r(c)}},a=function(c){try{var d=function(l){try{throw l}catch(u){return r(u)}};try{let l;return Hr(s).then(function(u){try{return l=u,$r(l).then(function(h){try{return n=h,function(){try{return o()}catch(f){return r(f)}}()}catch(f){return d(f)}},d)}catch(h){return d(h)}},d)}catch(l){d(l)}}catch(l){return r(l)}};try{if(Nn()||[He.DESKTOP_SAFARI,He.MOBILE_SAFARI].includes(Ot()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(s).then(function(c){try{return n=c,o()}catch{return a()}},a)}catch{a()}})}function Tn(s,e,t,r,n=1){return new Promise(function(i,o){let a;if(e==="image/png"){let d,l,u;return d=s.getContext("2d"),{data:l}=d.getImageData(0,0,s.width,s.height),u=Ye.encode([l.buffer],s.width,s.height,4096*n),a=new Blob([u],{type:e}),a.name=t,a.lastModified=r,c.call(this)}{let d=function(){return c.call(this)};if(e==="image/bmp")return new Promise(l=>Dr.toBlob(s,l)).then((function(l){try{return a=l,a.name=t,a.lastModified=r,d.call(this)}catch(u){return o(u)}}).bind(this),o);{let l=function(){return d.call(this)};if(typeof OffscreenCanvas=="function"&&s instanceof OffscreenCanvas)return s.convertToBlob({type:e,quality:n}).then((function(u){try{return a=u,a.name=t,a.lastModified=r,l.call(this)}catch(h){return o(h)}}).bind(this),o);{let u;return u=s.toDataURL(e,n),Xn(u,t,r).then((function(h){try{return a=h,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 Ht(){return new Promise(function(s,e){let t,r,n,i;return Ht.cachedResult!==void 0?s(Ht.cachedResult):Xn("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then(function(o){try{return t=o,In(t).then(function(a){try{return r=a[1],Tn(r,t.type,t.name,t.lastModified).then(function(c){try{return n=c,st(r),In(n).then(function(d){try{return i=d[0],Ht.cachedResult=i.width===1&&i.height===2,s(Ht.cachedResult)}catch(l){return e(l)}},e)}catch(d){return e(d)}},e)}catch(c){return e(c)}},e)}catch(a){return e(a)}},e)})}function jr(s){return new Promise((e,t)=>{const r=new Vr;r.onload=n=>{const i=new DataView(n.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 d=i.getUint16(a+=6,!1)==18761;a+=i.getUint32(a+4,d);const l=i.getUint16(a,d);a+=2;for(let u=0;u<l;u++)if(i.getUint16(a+12*u,d)==274)return e(i.getUint16(a+12*u+8,d))}else{if((65280&c)!=65280)break;a+=i.getUint16(a,!1)}}return e(-1)},r.onerror=n=>t(n),r.readAsArrayBuffer(s)})}function qr(s,e){const{width:t}=s,{height:r}=s,{maxWidthOrHeight:n}=e;let i,o=s;return isFinite(n)&&(t>n||r>n)&&([o,i]=Fn(t,r),t>r?(o.width=n,o.height=r/t*n):(o.width=t/r*n,o.height=n),i.drawImage(s,0,0,o.width,o.height),st(s)),o}function Zr(s,e){const{width:t}=s,{height:r}=s,[n,i]=Fn(t,r);switch(e>4&&e<9?(n.width=r,n.height=t):(n.width=t,n.height=r),e){case 2:i.transform(-1,0,0,1,t,0);break;case 3:i.transform(-1,0,0,-1,t,r);break;case 4:i.transform(1,0,0,-1,0,r);break;case 5:i.transform(0,1,1,0,0,0);break;case 6:i.transform(0,1,-1,0,r,0);break;case 7:i.transform(0,-1,-1,0,r,t);break;case 8:i.transform(0,-1,1,0,0,t)}return i.drawImage(s,0,0,t,r),st(s),n}function Kr(s,e,t=0){return new Promise(function(r,n){let i,o,a,c,d,l,u,h,f,y,k,T,C,R,S,F,U,b,B,m;function g(I=5){if(e.signal&&e.signal.aborted)throw e.signal.reason;i+=I,e.onProgress(Math.min(i,100))}function A(I){if(e.signal&&e.signal.aborted)throw e.signal.reason;i=Math.min(Math.max(I,i),100),e.onProgress(i)}return i=t,o=e.maxIteration||10,a=1024*e.maxSizeMB*1024,g(),In(s,e).then((function(I){try{return[,c]=I,g(),d=qr(c,e),g(),new Promise(function(N,L){var v;if(!(v=e.exifOrientation))return jr(s).then((function(w){try{return v=w,_.call(this)}catch(p){return L(p)}}).bind(this),L);function _(){return N(v)}return _.call(this)}).then((function(N){try{return l=N,g(),Ht().then((function(L){try{return u=L?d:Zr(d,l),g(),h=e.initialQuality||1,f=e.fileType||s.type,Tn(u,f,s.name,s.lastModified,h).then((function(v){try{{let w=function(){if(o--&&(S>a||S>C)){let M,x;return M=m?.95*B.width:B.width,x=m?.95*B.height:B.height,[U,b]=Fn(M,x),b.drawImage(B,0,0,M,x),h*=f==="image/png"?.85:.95,Tn(U,f,s.name,s.lastModified,h).then(function(V){try{return F=V,st(B),B=U,S=F.size,A(Math.min(99,Math.floor((R-S)/(R-a)*100))),w}catch(Z){return n(Z)}},n)}return[1]},p=function(){return st(B),st(U),st(d),st(u),st(c),A(100),r(F)};if(y=v,g(),k=y.size>a,T=y.size>s.size,!k&&!T)return A(100),r(y);var _;return C=s.size,R=y.size,S=R,B=u,m=!e.alwaysKeepResolution&&k,(_=(function(M){for(;M;){if(M.then)return void M.then(_,n);try{if(M.pop){if(M.length)return M.pop()?p.call(this):M;M=w}else M=M.call(this)}catch(x){return n(x)}}}).bind(this))(w)}}catch(w){return n(w)}}).bind(this),n)}catch(v){return n(v)}}).bind(this),n)}catch(L){return n(L)}}).bind(this),n)}catch(N){return n(N)}}).bind(this),n)})}const Vs=`
|
|
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 Js=Object.defineProperty;var ri=ne=>{throw TypeError(ne)};var Qs=(ne,le,he)=>le in ne?Js(ne,le,{enumerable:!0,configurable:!0,writable:!0,value:he}):ne[le]=he;var ge=(ne,le,he)=>Qs(ne,typeof le!="symbol"?le+"":le,he),ii=(ne,le,he)=>le.has(ne)||ri("Cannot "+he);var E=(ne,le,he)=>(ii(ne,le,"read from private field"),he?he.call(ne):le.get(ne)),z=(ne,le,he)=>le.has(ne)?ri("Cannot add the same private member more than once"):le instanceof WeakSet?le.add(ne):le.set(ne,he),H=(ne,le,he,_t)=>(ii(ne,le,"write to private field"),_t?_t.call(ne,he):le.set(ne,he),he);var bt,et,Wt,Ct,fe,ke,Et,pe,Ne,tt,je,St,Ft,ct,nt,rt,Rt,tr,Nt,it,st,Dt,dt,ht,It,Tt,vt,jt,on,Se,Mt,an,xn,ln,ut,qt,Lt,Zt,Kt,zt,Xt,Gt,cn,dn,Jt,ft,Qt,hn;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(""),_t=[];for(let s=0;s<he.length;s++)_t[he[s].charCodeAt(0)]=s;_t[45]=he.indexOf("+"),_t[95]=he.indexOf("/");function nr(s){let e=s.length*3/4;s[s.length-2]=="="?e-=2:s[s.length-1]=="="&&(e-=1);let t=new Uint8Array(e),r=0,n=0,i,o=0;for(let a=0;a<s.length;a++){if(i=_t[s.charCodeAt(a)],i===void 0)switch(s[a]){case"=":n=0;case`
|
|
3
|
+
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(n){case 0:o=i,n=1;break;case 1:t[r++]=o<<2|(i&48)>>4,o=i,n=2;break;case 2:t[r++]=(o&15)<<4|(i&60)>>2,o=i,n=3;break;case 3:t[r++]=(o&3)<<6|i,n=0;break}}if(n==1)throw Error("invalid base64 string.");return t.subarray(0,r)}function rr(s){let e="",t=0,r,n=0;for(let i=0;i<s.length;i++)switch(r=s[i],t){case 0:e+=he[r>>2],n=(r&3)<<4,t=1;break;case 1:e+=he[n|r>>4],n=(r&15)<<2,t=2;break;case 2:e+=he[n|r>>6],e+=he[r&63],t=0;break}return t&&(e+=he[n],e+="=",t==1&&(e+="=")),e}var G;(function(s){s.symbol=Symbol.for("protobuf-ts/unknown"),s.onRead=(t,r,n,i,o)=>{(e(r)?r[s.symbol]:r[s.symbol]=[]).push({no:n,wireType:i,data:o})},s.onWrite=(t,r,n)=>{for(let{no:i,wireType:o,data:a}of s.list(r))n.tag(i,o).raw(a)},s.list=(t,r)=>{if(e(t)){let n=t[s.symbol];return r?n.filter(i=>i.no==r):n}return[]},s.last=(t,r)=>s.list(t,r).slice(-1)[0];const e=t=>t&&Array.isArray(t[s.symbol])})(G||(G={}));function si(s,e){return Object.assign(Object.assign({},s),e)}var W;(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"})(W||(W={}));function oi(){let s=0,e=0;for(let r=0;r<28;r+=7){let n=this.buf[this.pos++];if(s|=(n&127)<<r,!(n&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 r=3;r<=31;r+=7){let n=this.buf[this.pos++];if(e|=(n&127)<<r,!(n&128))return this.assertBounds(),[s,e]}throw new Error("invalid varint")}function Bn(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 r=s>>>28&15|(e&7)<<4,n=!!(e>>3);if(t.push((n?r|128:r)&255),!!n){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 fn=65536*65536;function ir(s){let e=s[0]=="-";e&&(s=s.slice(1));const t=1e6;let r=0,n=0;function i(o,a){const c=Number(s.slice(o,a));n*=t,r=r*t+c,r>=fn&&(n=n+(r/fn|0),r=r%fn)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),[e,r,n]}function On(s,e){if(e>>>0<=2097151)return""+(fn*e+(s>>>0));let t=s&16777215,r=(s>>>24|e<<8)>>>0&16777215,n=e>>16&65535,i=t+r*6777216+n*6710656,o=r+n*8147497,a=n*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 sr(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 ai(){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 li(){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}li();function or(s){if(!s)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}const ar=/^-?[0-9]+$/,pn=4294967296,mn=2147483648;class lr{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*pn+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}}class Be extends lr{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 Be(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(),!ar.test(e))throw new Error("string is no integer");let[t,r,n]=ir(e);if(t)throw new Error("signed value for ulong");return new Be(r,n);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 Be(e,e/pn)}throw new Error("unknown value "+typeof e)}toString(){return ie?this.toBigInt().toString():On(this.lo,this.hi)}toBigInt(){return or(ie),ie.V.setInt32(0,this.lo,!0),ie.V.setInt32(4,this.hi,!0),ie.V.getBigUint64(0,!0)}}Be.ZERO=new Be(0,0);class ve extends lr{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 ve(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(),!ar.test(e))throw new Error("string is no integer");let[t,r,n]=ir(e);if(t){if(n>mn||n==mn&&r!=0)throw new Error("signed long too small")}else if(n>=mn)throw new Error("signed long too large");let i=new ve(r,n);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 ve(e,e/pn):new ve(-e,-e/pn).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return(this.hi&mn)!==0}negate(){let e=~this.hi,t=this.lo;return t?t=~t+1:e+=1,new ve(t,e)}toString(){if(ie)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+On(e.lo,e.hi)}return On(this.lo,this.hi)}toBigInt(){return or(ie),ie.V.setInt32(0,this.lo,!0),ie.V.setInt32(4,this.hi,!0),ie.V.getBigInt64(0,!0)}}ve.ZERO=new ve(0,0);const cr={readUnknownField:!0,readerFactory:s=>new di(s)};function ci(s){return s?Object.assign(Object.assign({},cr),s):cr}class di{constructor(e,t){this.varint64=oi,this.uint32=ai,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,r=e&7;if(t<=0||r<0||r>5)throw new Error("illegal tag: field no "+t+" wire type "+r);return[t,r]}skip(e){let t=this.pos;switch(e){case W.Varint:for(;this.buf[this.pos++]&128;);break;case W.Bit64:this.pos+=4;case W.Bit32:this.pos+=4;break;case W.LengthDelimited:let r=this.uint32();this.pos+=r;break;case W.StartGroup:let n;for(;(n=this.tag()[1])!==W.EndGroup;)this.skip(n);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 ve(...this.varint64())}uint64(){return new Be(...this.varint64())}sint64(){let[e,t]=this.varint64(),r=-(e&1);return e=(e>>>1|(t&1)<<31)^r,t=t>>>1^r,new ve(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 Be(this.sfixed32(),this.sfixed32())}sfixed64(){return new ve(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 hi=34028234663852886e22,ui=-34028234663852886e22,fi=4294967295,pi=2147483647,mi=-2147483648;function nn(s){if(typeof s!="number")throw new Error("invalid int 32: "+typeof s);if(!Number.isInteger(s)||s>pi||s<mi)throw new Error("invalid int 32: "+s)}function gn(s){if(typeof s!="number")throw new Error("invalid uint 32: "+typeof s);if(!Number.isInteger(s)||s>fi||s<0)throw new Error("invalid uint 32: "+s)}function Sn(s){if(typeof s!="number")throw new Error("invalid float 32: "+typeof s);if(Number.isFinite(s)&&(s>hi||s<ui))throw new Error("invalid float 32: "+s)}const dr={writeUnknownFields:!0,writerFactory:()=>new wi};function gi(s){return s?Object.assign(Object.assign({},dr),s):dr}class wi{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 n=0;n<this.chunks.length;n++)e+=this.chunks[n].length;let t=new Uint8Array(e),r=0;for(let n=0;n<this.chunks.length;n++)t.set(this.chunks[n],r),r+=this.chunks[n].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(gn(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return nn(e),sr(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){Sn(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){gn(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){nn(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return nn(e),e=(e<<1^e>>31)>>>0,sr(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),n=ve.from(e);return r.setInt32(0,n.lo,!0),r.setInt32(4,n.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),n=Be.from(e);return r.setInt32(0,n.lo,!0),r.setInt32(4,n.hi,!0),this.raw(t)}int64(e){let t=ve.from(e);return Bn(t.lo,t.hi,this.buf),this}sint64(e){let t=ve.from(e),r=t.hi>>31,n=t.lo<<1^r,i=(t.hi<<1|t.lo>>>31)^r;return Bn(n,i,this.buf),this}uint64(e){let t=Be.from(e);return Bn(t.lo,t.hi,this.buf),this}}const hr={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},ur={ignoreUnknownFields:!1};function yi(s){return s?Object.assign(Object.assign({},ur),s):ur}function bi(s){return s?Object.assign(Object.assign({},hr),s):hr}function Ci(s,e){var t,r;let n=Object.assign(Object.assign({},s),e);return n.typeRegistry=[...(t=s==null?void 0:s.typeRegistry)!==null&&t!==void 0?t:[],...(r=e==null?void 0:e.typeRegistry)!==null&&r!==void 0?r:[]],n}const fr=Symbol.for("protobuf-ts/message-type");function Rn(s){let e=!1;const t=[];for(let r=0;r<s.length;r++){let n=s.charAt(r);n=="_"?e=!0:/\d/.test(n)?(t.push(n),e=!0):e?(t.push(n.toUpperCase()),e=!1):r==0?t.push(n.toLowerCase()):t.push(n)}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 at;(function(s){s[s.BIGINT=0]="BIGINT",s[s.STRING=1]="STRING",s[s.NUMBER=2]="NUMBER"})(at||(at={}));var wn;(function(s){s[s.NO=0]="NO",s[s.PACKED=1]="PACKED",s[s.UNPACKED=2]="UNPACKED"})(wn||(wn={}));function Ei(s){var e,t,r,n;return s.localName=(e=s.localName)!==null&&e!==void 0?e:Rn(s.name),s.jsonName=(t=s.jsonName)!==null&&t!==void 0?t:Rn(s.name),s.repeat=(r=s.repeat)!==null&&r!==void 0?r:wn.NO,s.opt=(n=s.opt)!==null&&n!==void 0?n:s.repeat||s.oneof?!1:s.kind=="message",s}function vi(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 Ai{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}prepare(){if(this.data)return;const e=[],t=[],r=[];for(let n of this.fields)if(n.oneof)r.includes(n.oneof)||(r.push(n.oneof),e.push(n.oneof),t.push(n.oneof));else switch(t.push(n.localName),n.kind){case"scalar":case"enum":(!n.opt||n.repeat)&&e.push(n.localName);break;case"message":n.repeat&&e.push(n.localName);break;case"map":e.push(n.localName);break}this.data={req:e,known:t,oneofs:Object.values(r)}}is(e,t,r=!1){if(t<0)return!0;if(e==null||typeof e!="object")return!1;this.prepare();let n=Object.keys(e),i=this.data;if(n.length<i.req.length||i.req.some(o=>!n.includes(o))||!r&&n.some(o=>!i.known.includes(o)))return!1;if(t<1)return!0;for(const o of i.oneofs){const a=e[o];if(!vi(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,r,t))return!1}for(const o of this.fields)if(o.oneof===void 0&&!this.field(e[o.localName],o,r,t))return!1;return!0}field(e,t,r,n){let i=t.repeat;switch(t.kind){case"scalar":return e===void 0?t.opt:i?this.scalars(e,t.T,n,t.L):this.scalar(e,t.T,t.L);case"enum":return e===void 0?t.opt:i?this.scalars(e,D.INT32,n):this.scalar(e,D.INT32);case"message":return e===void 0?!0:i?this.messages(e,t.T(),r,n):this.message(e,t.T(),r,n);case"map":if(typeof e!="object"||e===null)return!1;if(n<2)return!0;if(!this.mapKeys(e,t.K,n))return!1;switch(t.V.kind){case"scalar":return this.scalars(Object.values(e),t.V.T,n,t.V.L);case"enum":return this.scalars(Object.values(e),D.INT32,n);case"message":return this.messages(Object.values(e),t.V.T(),r,n)}break}return!0}message(e,t,r,n){return r?t.isAssignable(e,n):t.is(e,n)}messages(e,t,r,n){if(!Array.isArray(e))return!1;if(n<2)return!0;if(r){for(let i=0;i<e.length&&i<n;i++)if(!t.isAssignable(e[i],n-1))return!1}else for(let i=0;i<e.length&&i<n;i++)if(!t.is(e[i],n-1))return!1;return!0}scalar(e,t,r){let n=typeof e;switch(t){case D.UINT64:case D.FIXED64:case D.INT64:case D.SFIXED64:case D.SINT64:switch(r){case at.BIGINT:return n=="bigint";case at.NUMBER:return n=="number"&&!isNaN(e);default:return n=="string"}case D.BOOL:return n=="boolean";case D.STRING:return n=="string";case D.BYTES:return e instanceof Uint8Array;case D.DOUBLE:case D.FLOAT:return n=="number"&&!isNaN(e);default:return n=="number"&&Number.isInteger(e)}}scalars(e,t,r,n){if(!Array.isArray(e))return!1;if(r<2)return!0;if(Array.isArray(e)){for(let i=0;i<e.length&&i<r;i++)if(!this.scalar(e[i],t,n))return!1}return!0}mapKeys(e,t,r){let n=Object.keys(e);switch(t){case D.INT32:case D.FIXED32:case D.SFIXED32:case D.SINT32:case D.UINT32:return this.scalars(n.slice(0,r).map(i=>parseInt(i)),t,r);case D.BOOL:return this.scalars(n.slice(0,r).map(i=>i=="true"?!0:i=="false"?!1:i),t,r);default:return this.scalars(n,t,r,at.STRING)}}}function ze(s,e){switch(e){case at.BIGINT:return s.toBigInt();case at.NUMBER:return s.toNumber();default:return s.toString()}}class ki{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 r of t)this.fMap[r.name]=r,this.fMap[r.jsonName]=r,this.fMap[r.localName]=r}}assert(e,t,r){if(!e){let n=ne(r);throw(n=="number"||n=="boolean")&&(n=r.toString()),new Error(`Cannot parse JSON ${n} for ${this.info.typeName}#${t}`)}}read(e,t,r){this.prepare();const n=[];for(const[i,o]of Object.entries(e)){const a=this.fMap[i];if(!a){if(!r.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(n.includes(a.oneof))throw new Error(`Multiple members of the oneof group "${a.oneof}" of ${this.info.typeName} are present in JSON.`);n.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,r);break;case"enum":if(f=this.enum(a.V.T(),d,a.name,r.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,at.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,r);break;case"enum":if(d=this.enum(a.T(),u,a.name,r.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,r,h[c]);break;case"enum":let l=this.enum(a.T(),o,a.name,r.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,r,n){if(e[0]=="google.protobuf.NullValue"&&J(t===null||t==="NULL_VALUE",`Unable to parse field ${this.info.typeName}#${r}, 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}#${r}, 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"&&n?!1:(J(typeof o=="number",`Unable to parse field ${this.info.typeName}#${r}, enum ${e[0]} has no value for "${t}".`),o)}J(!1,`Unable to parse field ${this.info.typeName}#${r}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,r,n){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&&Sn(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?gn(a):nn(a),a;case D.INT64:case D.SFIXED64:case D.SINT64:if(e===null)return ze(ve.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return ze(ve.from(e),r);case D.FIXED64:case D.UINT64:if(e===null)return ze(Be.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return ze(Be.from(e),r);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 nr(e)}}catch(o){i=o.message}this.assert(!1,n+(i?" - "+i:""),e)}}class Fi{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}write(e,t){const r={},n=e;for(const i of this.fields){if(!i.oneof){let h=this.field(i,n[i.localName],t);h!==void 0&&(r[t.useProtoFieldName?i.name:i.jsonName]=h);continue}const o=n[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),r[t.useProtoFieldName?i.name:i.jsonName]=c}return r}field(e,t,r){let n;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,r);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,r.enumAsInteger);J(l!==void 0),i[c.toString()]=l}break}(r.emitDefaultValues||Object.keys(i).length>0)&&(n=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,r.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,r);J(h!==void 0),i.push(h)}break}(r.emitDefaultValues||i.length>0||r.emitDefaultValues)&&(n=i)}else switch(e.kind){case"scalar":n=this.scalar(e.T,t,e.name,e.opt,r.emitDefaultValues);break;case"enum":n=this.enum(e.T(),t,e.name,e.opt,r.emitDefaultValues,r.enumAsInteger);break;case"message":n=this.message(e.T(),t,e.name,r);break}return n}enum(e,t,r,n,i,o){if(e[0]=="google.protobuf.NullValue")return!i&&!n?void 0:null;if(t===void 0){J(n);return}if(!(t===0&&!i&&!n))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,r,n){return t===void 0?n.emitDefaultValues?null:void 0:e.internalJsonWrite(t,n)}scalar(e,t,r,n,i){if(t===void 0){J(n);return}const o=i||n;switch(e){case D.INT32:case D.SFIXED32:case D.SINT32:return t===0?o?0:void 0:(nn(t),t);case D.FIXED32:case D.UINT32:return t===0?o?0:void 0:(gn(t),t);case D.FLOAT:Sn(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=Be.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=ve.from(t);return c.isZero()&&!o?void 0:c.toString();case D.BYTES:return J(t instanceof Uint8Array),t.byteLength?rr(t):o?"":void 0}}}function Dn(s,e=at.STRING){switch(s){case D.BOOL:return!1;case D.UINT64:case D.FIXED64:return ze(Be.ZERO,e);case D.INT64:case D.SFIXED64:case D.SINT64:return ze(ve.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 Ni{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(r=>[r.no,r]))}}read(e,t,r,n){this.prepare();const i=n===void 0?e.len:e.pos+n;for(;e.pos<i;){const[o,a]=e.tag(),c=this.fieldNoToField.get(o);if(!c){let d=r.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 T=h[u];if(a==W.LengthDelimited&&d!=D.STRING&&d!=D.BYTES){let C=e.uint32()+e.pos;for(;e.pos<C;)T.push(this.scalar(e,d,f))}else T.push(this.scalar(e,d,f))}else h[u]=this.scalar(e,d,f);break;case"message":if(l){let T=h[u],C=c.T().internalBinaryRead(e,e.uint32(),r);T.push(C)}else h[u]=c.T().internalBinaryRead(e,e.uint32(),r,h[u]);break;case"map":let[y,N]=this.mapEntry(c,e,r);h[u][y]=N;break}}}mapEntry(e,t,r){let n=t.uint32(),i=t.pos+n,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,at.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(),r);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=Dn(e.K);o=e.K==D.BOOL?c.toString():c}if(a===void 0)switch(e.V.kind){case"scalar":a=Dn(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,r){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 ze(e.int64(),r);case D.UINT64:return ze(e.uint64(),r);case D.FIXED64:return ze(e.fixed64(),r);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 ze(e.sfixed64(),r);case D.SINT32:return e.sint32();case D.SINT64:return ze(e.sint64(),r)}}}class Ii{constructor(e){this.info=e}prepare(){if(!this.fields){const e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((t,r)=>t.no-r.no)}}write(e,t,r){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==wn.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,r,i.T(),i.no,u)}else this.message(t,r,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,r,i,u,d);break}}let n=r.writeUnknownFields;n!==!1&&(n===!0?G.onWrite:n)(this.info.typeName,e,t)}mapEntry(e,t,r,n,i){e.tag(r.no,W.LengthDelimited),e.fork();let o=n;switch(r.K){case D.INT32:case D.FIXED32:case D.UINT32:case D.SFIXED32:case D.SINT32:o=Number.parseInt(n);break;case D.BOOL:J(n=="true"||n=="false"),o=n=="true";break}switch(this.scalar(e,r.K,1,o,!0),r.V.kind){case"scalar":this.scalar(e,r.V.T,2,i,!0);break;case"enum":this.scalar(e,D.INT32,2,i,!0);break;case"message":this.message(e,t,r.V.T(),2,i);break}e.join()}message(e,t,r,n,i){i!==void 0&&(r.internalBinaryWrite(i,e.tag(n,W.LengthDelimited).fork(),t),e.join())}scalar(e,t,r,n,i){let[o,a,c]=this.scalarInfo(t,n);(!c||i)&&(e.tag(r,o),e[a](n))}packed(e,t,r,n){if(!n.length)return;J(t!==D.BYTES&&t!==D.STRING),e.tag(r,W.LengthDelimited),e.fork();let[,i]=this.scalarInfo(t);for(let o=0;o<n.length;o++)e[i](n[o]);e.join()}scalarInfo(e,t){let r=W.Varint,n,i=t===void 0,o=t===0;switch(e){case D.INT32:n="int32";break;case D.STRING:o=i||!t.length,r=W.LengthDelimited,n="string";break;case D.BOOL:o=t===!1,n="bool";break;case D.UINT32:n="uint32";break;case D.DOUBLE:r=W.Bit64,n="double";break;case D.FLOAT:r=W.Bit32,n="float";break;case D.INT64:o=i||ve.from(t).isZero(),n="int64";break;case D.UINT64:o=i||Be.from(t).isZero(),n="uint64";break;case D.FIXED64:o=i||Be.from(t).isZero(),r=W.Bit64,n="fixed64";break;case D.BYTES:o=i||!t.byteLength,r=W.LengthDelimited,n="bytes";break;case D.FIXED32:r=W.Bit32,n="fixed32";break;case D.SFIXED32:r=W.Bit32,n="sfixed32";break;case D.SFIXED64:o=i||ve.from(t).isZero(),r=W.Bit64,n="sfixed64";break;case D.SINT32:n="sint32";break;case D.SINT64:o=i||ve.from(t).isZero(),n="sint64";break}return[r,n,i||o]}}function Ti(s){const e=s.messagePrototype?Object.create(s.messagePrototype):Object.defineProperty({},fr,{value:s});for(let t of s.fields){let r=t.localName;if(!t.opt)if(t.oneof)e[t.oneof]={oneofKind:void 0};else if(t.repeat)e[r]=[];else switch(t.kind){case"scalar":e[r]=Dn(t.T,t.L);break;case"enum":e[r]=0;break;case"map":e[r]={};break}}return e}function be(s,e,t){let r,n=t,i;for(let o of s.fields){let a=o.localName;if(o.oneof){const c=n[o.oneof];if((c==null?void 0:c.oneofKind)==null)continue;if(r=c[a],i=e[o.oneof],i.oneofKind=c.oneofKind,r==null){delete i[a];continue}}else if(r=n[a],i=e,r==null)continue;switch(o.repeat&&(i[a].length=r.length),o.kind){case"scalar":case"enum":if(o.repeat)for(let h=0;h<r.length;h++)i[a][h]=r[h];else i[a]=r;break;case"message":let c=o.T();if(o.repeat)for(let h=0;h<r.length;h++)i[a][h]=c.create(r[h]);else i[a]===void 0?i[a]=c.create(r):c.mergePartial(i[a],r);break;case"map":switch(o.V.kind){case"scalar":case"enum":Object.assign(i[a],r);break;case"message":let h=o.V.T();for(let l of Object.keys(r))i[a][l]=h.create(r[l]);break}break}}}function Li(s,e,t){if(e===t)return!0;if(!e||!t)return!1;for(let r of s.fields){let n=r.localName,i=r.oneof?e[r.oneof][n]:e[n],o=r.oneof?t[r.oneof][n]:t[n];switch(r.kind){case"enum":case"scalar":let a=r.kind=="enum"?D.INT32:r.T;if(!(r.repeat?mr(a,i,o):pr(a,i,o)))return!1;break;case"map":if(!(r.V.kind=="message"?gr(r.V.T(),yn(i),yn(o)):mr(r.V.kind=="enum"?D.INT32:r.V.T,yn(i),yn(o))))return!1;break;case"message":let c=r.T();if(!(r.repeat?gr(c,i,o):c.equals(i,o)))return!1;break}}return!0}const yn=Object.values;function pr(s,e,t){if(e===t)return!0;if(s!==D.BYTES)return!1;let r=e,n=t;if(r.length!==n.length)return!1;for(let i=0;i<r.length;i++)if(r[i]!=n[i])return!1;return!0}function mr(s,e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!pr(s,e[r],t[r]))return!1;return!0}function gr(s,e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!s.equals(e[r],t[r]))return!1;return!0}const Ui=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({}));class Te{constructor(e,t,r){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(Ei),this.options=r??{},this.messagePrototype=Object.create(null,Object.assign(Object.assign({},Ui),{[fr]:{value:this}})),this.refTypeCheck=new Ai(this),this.refJsonReader=new ki(this),this.refJsonWriter=new Fi(this),this.refBinReader=new Ni(this),this.refBinWriter=new Ii(this)}create(e){let t=Ti(this);return e!==void 0&&be(this,t,e),t}clone(e){let t=this.create();return be(this,t,e),t}equals(e,t){return Li(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){be(this,e,t)}fromBinary(e,t){let r=ci(t);return this.internalBinaryRead(r.readerFactory(e),e.byteLength,r)}fromJson(e,t){return this.internalJsonRead(e,yi(t))}fromJsonString(e,t){let r=JSON.parse(e);return this.fromJson(r,t)}toJson(e,t){return this.internalJsonWrite(e,bi(t))}toJsonString(e,t){var r;let n=this.toJson(e,t);return JSON.stringify(n,null,(r=t==null?void 0:t.prettySpaces)!==null&&r!==void 0?r:0)}toBinary(e,t){let r=gi(t);return this.internalBinaryWrite(e,r.writerFactory(),r).finish()}internalJsonRead(e,t,r){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let n=r??this.create();return this.refJsonReader.read(e,n,t),n}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,r){return this.refBinWriter.write(e,t,r),t}internalBinaryRead(e,t,r,n){let i=n??this.create();return this.refBinReader.read(e,i,r,t),i}}function xi(s,e){var t,r,n;let i=s;return i.service=e,i.localName=(t=i.localName)!==null&&t!==void 0?t:Rn(i.name),i.serverStreaming=!!i.serverStreaming,i.clientStreaming=!!i.clientStreaming,i.options=(r=i.options)!==null&&r!==void 0?r:{},i.idempotency=(n=i.idempotency)!==null&&n!==void 0?n:void 0,i}class Mn{constructor(e,t,r){this.typeName=e,this.methods=t.map(n=>xi(n,this)),this.options=r??{}}}class se extends Error{constructor(e,t="UNKNOWN",r){super(e),this.name="RpcError",Object.setPrototypeOf(this,new.target.prototype),this.code=t,this.meta=r??{}}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[r,n]of t)e.push(` ${r}: ${n}`)}return e.join(`
|
|
4
|
+
`)}}function _i(s,e){if(!e)return s;let t={};bn(s,t),bn(e,t);for(let r of Object.keys(e)){let n=e[r];switch(r){case"jsonOptions":t.jsonOptions=Ci(s.jsonOptions,t.jsonOptions);break;case"binaryOptions":t.binaryOptions=si(s.binaryOptions,t.binaryOptions);break;case"meta":t.meta={},bn(s.meta,t.meta),bn(e.meta,t.meta);break;case"interceptors":t.interceptors=s.interceptors?s.interceptors.concat(n):n.concat();break}}return t}function bn(s,e){if(!s)return;let t=e;for(let[r,n]of Object.entries(s))n instanceof Date?t[r]=new Date(n.getTime()):Array.isArray(n)?t[r]=n.concat():t[r]=n}var qe;(function(s){s[s.PENDING=0]="PENDING",s[s.REJECTED=1]="REJECTED",s[s.RESOLVED=2]="RESOLVED"})(qe||(qe={}));class kt{constructor(e=!0){this._state=qe.PENDING,this._promise=new Promise((t,r)=>{this._resolve=t,this._reject=r}),e&&this._promise.catch(t=>{})}get state(){return this._state}get promise(){return this._promise}resolve(e){if(this.state!==qe.PENDING)throw new Error(`cannot resolve ${qe[this.state].toLowerCase()}`);this._resolve(e),this._state=qe.RESOLVED}reject(e){if(this.state!==qe.PENDING)throw new Error(`cannot reject ${qe[this.state].toLowerCase()}`);this._reject(e),this._state=qe.REJECTED}resolvePending(e){this._state===qe.PENDING&&this.resolve(e)}rejectPending(e){this._state===qe.PENDING&&this.reject(e)}}class Bi{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 r=t.indexOf(e);r>=0&&t.splice(r,1)}}clearLis(){for(let e of Object.values(this._lis))e.splice(0,e.length)}get closed(){return this._closed!==!1}notifyNext(e,t,r){J((e?1:0)+(t?1:0)+(r?1:0)<=1,"only one emission at a time"),e&&this.notifyMessage(e),t&&this.notifyError(t),r&&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 kt,e.p.promise)}}}pushIt(e){let t=this._itState;if(t)if(t.p){const r=t.p;J(r.state==qe.PENDING,"iterator contract broken"),"value"in e?r.resolve(e):r.reject(e),delete t.p}else t.q.push(e)}}var Oi=function(s,e,t,r){function n(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(r.next(l))}catch(u){o(u)}}function c(l){try{h(r.throw(l))}catch(u){o(u)}}function h(l){l.done?i(l.value):n(l.value).then(a,c)}h((r=r.apply(s,e||[])).next())})};class Si{constructor(e,t,r,n,i,o,a){this.method=e,this.requestHeaders=t,this.request=r,this.headers=n,this.response=i,this.status=o,this.trailers=a}then(e,t){return this.promiseFinished().then(r=>e?Promise.resolve(e(r)):r,r=>t?Promise.resolve(t(r)):Promise.reject(r))}promiseFinished(){return Oi(this,void 0,void 0,function*(){let[e,t,r,n]=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:r,trailers:n}})}}var Ri=function(s,e,t,r){function n(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(r.next(l))}catch(u){o(u)}}function c(l){try{h(r.throw(l))}catch(u){o(u)}}function h(l){l.done?i(l.value):n(l.value).then(a,c)}h((r=r.apply(s,e||[])).next())})};class Di{constructor(e,t,r,n,i,o,a){this.method=e,this.requestHeaders=t,this.request=r,this.headers=n,this.responses=i,this.status=o,this.trailers=a}then(e,t){return this.promiseFinished().then(r=>e?Promise.resolve(e(r)):r,r=>t?Promise.resolve(t(r)):Promise.reject(r))}promiseFinished(){return Ri(this,void 0,void 0,function*(){let[e,t,r]=yield Promise.all([this.headers,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,status:t,trailers:r}})}}function Ve(s,e,t,r,n){var i;{let o=(a,c,h)=>e.unary(a,c,h);for(const a of((i=r.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,n,r)}}var j;(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"})(j||(j={}));var Mi=function(s,e,t,r){function n(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(r.next(l))}catch(u){o(u)}}function c(l){try{h(r.throw(l))}catch(u){o(u)}}function h(l){l.done?i(l.value):n(l.value).then(a,c)}h((r=r.apply(s,e||[])).next())})};function wr(s,e,t,r,n){if(r)for(let[i,o]of Object.entries(r))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`,j[j.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`,j[j.DEADLINE_EXCEEDED]);s.set("grpc-timeout",`${i-o}m`)}return s}function yr(s,e){let t=new Uint8Array(5+s.length);t[0]=Xe.DATA;for(let r=s.length,n=4;n>0;n--)t[n]=r%256,r>>>=8;return t.set(s,5),e==="binary"?t:rr(t)}function Vn(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}`,j[j.UNKNOWN])}return Vn(Pi(c.headers),c.status,c.statusText)}let r=s,n=e>=200&&e<300,i=Ar(r),[o,a]=vr(r);return(o===void 0||o===j.OK)&&!n&&(o=Wi(e),a=t),[o,a,i]}function br(s){let e=$i(s),[t,r]=vr(e),n=Ar(e);return[t??j.OK,r,n]}var Xe;(function(s){s[s.DATA=0]="DATA",s[s.TRAILER=128]="TRAILER"})(Xe||(Xe={}));function Cr(s,e,t){return Mi(this,void 0,void 0,function*(){let r,n="",i=new Uint8Array(0),o=Hi(e);if(Vi(s)){let a=s.getReader();r={next:()=>a.read()}}else r=s[Symbol.asyncIterator]();for(;;){let a=yield r.next();if(a.value!==void 0){if(o==="text"){for(let h=0;h<a.value.length;h++)n+=String.fromCharCode(a.value[h]);let c=n.length-n.length%4;if(c===0)continue;i=Er(i,nr(n.substring(0,c))),n=n.substring(c)}else i=Er(i,a.value);for(;i.length>=5&&i[0]===Xe.DATA;){let c=0;for(let h=1;h<5;h++)c=(c<<8)+i[h];if(i.length-5>=c)t(Xe.DATA,i.subarray(5,5+c)),i=i.subarray(5+c);else break}}if(a.done){if(i.length===0)break;if(i[0]!==Xe.TRAILER||i.length<5)throw new se("premature EOF",j[j.DATA_LOSS]);t(Xe.TRAILER,i.subarray(5));break}}})}const Vi=s=>typeof s.getReader=="function";function Er(s,e){let t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function Hi(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",j[j.INTERNAL]);default:throw new se("unexpected response content type: "+s,j[j.INTERNAL])}}function vr(s){let e,t,r=s["grpc-message"];if(r!==void 0){if(Array.isArray(r))return[j.INTERNAL,"invalid grpc-web message"];t=r}let n=s["grpc-status"];if(n!==void 0){if(Array.isArray(n))return[j.INTERNAL,"invalid grpc-web status"];if(e=parseInt(n,10),j[e]===void 0)return[j.INTERNAL,"invalid grpc-web status"]}return[e,t]}function Ar(s){let e={};for(let[t,r]of Object.entries(s))switch(t){case"grpc-message":case"grpc-status":case"content-type":break;default:e[t]=r}return e}function $i(s){let e={};for(let t of String.fromCharCode.apply(String,s).trim().split(`\r
|
|
5
|
+
`)){if(t=="")continue;let[r,...n]=t.split(":");const i=n.join(":").trim();r=r.trim();let o=e[r];typeof o=="string"?e[r]=[o,i]:Array.isArray(o)?o.push(i):e[r]=i}return e}function Pi(s){let e={};return s.forEach((t,r)=>{let n=e[r];typeof n=="string"?e[r]=[n,t]:Array.isArray(n)?n.push(t):e[r]=t}),e}function Wi(s){switch(s){case 200:return j.OK;case 400:return j.INVALID_ARGUMENT;case 401:return j.UNAUTHENTICATED;case 403:return j.PERMISSION_DENIED;case 404:return j.NOT_FOUND;case 409:return j.ABORTED;case 412:return j.FAILED_PRECONDITION;case 429:return j.RESOURCE_EXHAUSTED;case 499:return j.CANCELLED;case 500:return j.UNKNOWN;case 501:return j.UNIMPLEMENTED;case 503:return j.UNAVAILABLE;case 504:return j.DEADLINE_EXCEEDED;default:return j.UNKNOWN}}class ji{constructor(e){this.defaultOptions=e}mergeOptions(e){return _i(this.defaultOptions,e)}makeUrl(e,t){let r=t.baseUrl;return r.endsWith("/")&&(r=r.substring(0,r.length-1)),`${r}/${e.service.typeName}/${e.name}`}clientStreaming(e){const t=new se("Client streaming is not supported by grpc-web",j[j.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",j[j.UNIMPLEMENTED]);throw t.methodName=e.name,t.serviceName=e.service.typeName,t}serverStreaming(e,t,r){var n,i,o,a;let c=r,h=(n=c.format)!==null&&n!==void 0?n:"text",l=(i=c.fetchInit)!==null&&i!==void 0?i:{},u=this.makeUrl(e,c),d=e.I.toBinary(t,c.binaryOptions),f=new kt,y=new Bi,N=!0,T,C=new kt,R,O=new kt;return globalThis.fetch(u,Object.assign(Object.assign({},l),{method:"POST",headers:wr(new globalThis.Headers,h,c.timeout,c.meta),body:yr(d,h),signal:(o=r.abort)!==null&&o!==void 0?o:null})).then(A=>{let[U,b,B]=Vn(A);if(f.resolve(B),U!=null&&U!==j.OK)throw new se(b??j[U],j[U],B);return U!=null&&(T={code:j[U],detail:b??j[U]}),A}).then(A=>{if(!A.body)throw new se("missing response body",j[j.INTERNAL]);return Cr(A.body,A.headers.get("content-type"),(U,b)=>{switch(U){case Xe.DATA:y.notifyMessage(e.O.fromBinary(b,c.binaryOptions)),N=!1;break;case Xe.TRAILER:let B,m;[B,m,R]=br(b),T={code:j[B],detail:m??j[B]};break}})}).then(()=>{if(!R&&!N)throw new se("missing trailers",j[j.DATA_LOSS]);if(!T)throw new se("missing status",j[j.INTERNAL]);if(T.code!=="OK")throw new se(T.detail,T.code,R);y.notifyComplete(),C.resolve(T),O.resolve(R||{})}).catch(A=>{let U;A instanceof se?U=A:A instanceof Error&&A.name==="AbortError"?U=new se(A.message,j[j.CANCELLED]):U=new se(A instanceof Error?A.message:""+A,j[j.INTERNAL]),U.methodName=e.name,U.serviceName=e.service.typeName,f.rejectPending(U),y.notifyError(U),C.rejectPending(U),O.rejectPending(U)}),new Di(e,(a=c.meta)!==null&&a!==void 0?a:{},t,f.promise,y,C.promise,O.promise)}unary(e,t,r){var n,i,o,a;let c=r,h=(n=c.format)!==null&&n!==void 0?n:"text",l=(i=c.fetchInit)!==null&&i!==void 0?i:{},u=this.makeUrl(e,c),d=e.I.toBinary(t,c.binaryOptions),f=new kt,y,N=new kt,T,C=new kt,R,O=new kt;return globalThis.fetch(u,Object.assign(Object.assign({},l),{method:"POST",headers:wr(new globalThis.Headers,h,c.timeout,c.meta),body:yr(d,h),signal:(o=r.abort)!==null&&o!==void 0?o:null})).then(A=>{let[U,b,B]=Vn(A);if(f.resolve(B),U!=null&&U!==j.OK)throw new se(b??j[U],j[U],B);return U!=null&&(T={code:j[U],detail:b??j[U]}),A}).then(A=>{if(!A.body)throw new se("missing response body",j[j.INTERNAL]);return Cr(A.body,A.headers.get("content-type"),(U,b)=>{switch(U){case Xe.DATA:if(y)throw new se("unary call received 2nd message",j[j.DATA_LOSS]);y=e.O.fromBinary(b,c.binaryOptions);break;case Xe.TRAILER:let B,m;[B,m,R]=br(b),T={code:j[B],detail:m??j[B]};break}})}).then(()=>{if(!R&&y)throw new se("missing trailers",j[j.DATA_LOSS]);if(!T)throw new se("missing status",j[j.INTERNAL]);if(!y&&T.code==="OK")throw new se("expected error status",j[j.DATA_LOSS]);if(!y)throw new se(T.detail,T.code,R);if(N.resolve(y),T.code!=="OK")throw new se(T.detail,T.code,R);C.resolve(T),O.resolve(R||{})}).catch(A=>{let U;A instanceof se?U=A:A instanceof Error&&A.name==="AbortError"?U=new se(A.message,j[j.CANCELLED]):U=new se(A instanceof Error?A.message:""+A,j[j.INTERNAL]),U.methodName=e.name,U.serviceName=e.service.typeName,f.rejectPending(U),N.rejectPending(U),C.rejectPending(U),O.rejectPending(U)}),new Si(e,(a=c.meta)!==null&&a!==void 0?a:{},t,f.promise,N.promise,C.promise,O.promise)}}var Cn=(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))(Cn||{});class qi extends Te{constructor(){super("com.hamropatro.grpc.common.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&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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=r.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,r){e.searchValue!==""&&t.tag(1,W.LengthDelimited).string(e.searchValue),e.cursor!==""&&t.tag(2,W.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(3,W.Varint).int32(e.limit);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const kr=new qi;class Zi extends Te{constructor(){super("com.hamropatro.grpc.common.SearchResult",[{no:1,name:"items",kind:"message",repeat:1,T:()=>Ge},{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&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.items.push(Ge.internalBinaryRead(e,e.uint32(),r));break;case 2:i.nextPageCursor=e.string();break;default:let h=r.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,r){for(let i=0;i<e.items.length;i++)Ge.internalBinaryWrite(e.items[i],t.tag(1,W.LengthDelimited).fork(),r).join();e.nextPageCursor!==""&&t.tag(2,W.LengthDelimited).string(e.nextPageCursor);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Ki=new Zi;class zi extends Te{constructor(){super("com.hamropatro.grpc.common.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.common.FileType",Cn]},{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&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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=r.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,r){e.name!==""&&t.tag(1,W.LengthDelimited).string(e.name),e.folderName!==""&&t.tag(2,W.LengthDelimited).string(e.folderName),e.nestedFolderName!==""&&t.tag(3,W.LengthDelimited).string(e.nestedFolderName),e.url!==""&&t.tag(4,W.LengthDelimited).string(e.url),e.type!==0&&t.tag(5,W.Varint).int32(e.type),e.extension!==""&&t.tag(6,W.LengthDelimited).string(e.extension);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Fr=new zi;class Xi extends Te{constructor(){super("com.hamropatro.grpc.common.CreateUserFileRequest",[{no:1,name:"url",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:()=>["com.hamropatro.grpc.common.FileType",Cn]},{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&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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=r.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,r){e.url!==""&&t.tag(1,W.LengthDelimited).string(e.url),e.type!==0&&t.tag(2,W.Varint).int32(e.type),e.extension!==""&&t.tag(3,W.LengthDelimited).string(e.extension);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Hn=new Xi;class Gi extends Te{constructor(){super("com.hamropatro.grpc.common.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.common.FileType",Cn]},{no:9,name:"metadata",kind:"message",T:()=>$n}])}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&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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=$n.internalBinaryRead(e,e.uint32(),r,i.metadata);break;default:let h=r.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,r){e.key!==""&&t.tag(1,W.LengthDelimited).string(e.key),e.name!==""&&t.tag(2,W.LengthDelimited).string(e.name),e.folderName!==""&&t.tag(3,W.LengthDelimited).string(e.folderName),e.nestedFolderName!==""&&t.tag(4,W.LengthDelimited).string(e.nestedFolderName),e.url!==""&&t.tag(5,W.LengthDelimited).string(e.url),e.thumborUrl!==""&&t.tag(6,W.LengthDelimited).string(e.thumborUrl),e.proxyUrl!==""&&t.tag(7,W.LengthDelimited).string(e.proxyUrl),e.type!==0&&t.tag(8,W.Varint).int32(e.type),e.metadata&&$n.internalBinaryWrite(e.metadata,t.tag(9,W.LengthDelimited).fork(),r).join();let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Ge=new Gi;class Ji extends Te{constructor(){super("com.hamropatro.grpc.common.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&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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=r.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,r){e.height!==0&&t.tag(1,W.Varint).int32(e.height),e.width!==0&&t.tag(2,W.Varint).int32(e.width),e.backgroundColor!==""&&t.tag(3,W.LengthDelimited).string(e.backgroundColor),e.aspectRatio!==0&&t.tag(4,W.Bit64).double(e.aspectRatio);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const $n=new Ji;class Qi extends Te{constructor(){super("com.hamropatro.grpc.common.DeleteFileRequest",[{no:1,name:"key",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",e!==void 0&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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=r.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,r){e.key!==""&&t.tag(1,W.LengthDelimited).string(e.key);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Nr=new Qi;class Yi extends Te{constructor(){super("com.hamropatro.grpc.common.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&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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=r.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,r){e.isDeleted!==!1&&t.tag(1,W.Varint).bool(e.isDeleted);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const es=new Yi;class ts extends Te{constructor(){super("com.hamropatro.grpc.common.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&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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=r.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,r){e.folderName!==""&&t.tag(1,W.LengthDelimited).string(e.folderName),e.cursor!==""&&t.tag(2,W.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(3,W.Varint).int32(e.limit);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Ir=new ts;class ns extends Te{constructor(){super("com.hamropatro.grpc.common.GetFilesByFolderResponse",[{no:1,name:"files",kind:"message",repeat:1,T:()=>Ge},{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&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.files.push(Ge.internalBinaryRead(e,e.uint32(),r));break;case 2:i.nextCursor=e.string();break;case 3:i.hasMore=e.bool();break;default:let h=r.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,r){for(let i=0;i<e.files.length;i++)Ge.internalBinaryWrite(e.files[i],t.tag(1,W.LengthDelimited).fork(),r).join();e.nextCursor!==""&&t.tag(2,W.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,W.Varint).bool(e.hasMore);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const rs=new ns,Pn=new Mn("com.hamropatro.grpc.common.FileService",[{name:"createFile",options:{},I:Fr,O:Ge},{name:"updateFile",options:{},I:Ge,O:Ge},{name:"deleteFile",options:{},I:Nr,O:es},{name:"getFilesByFolder",options:{},I:Ir,O:rs},{name:"createUserFile",options:{},I:Hn,O:Ge},{name:"search",options:{},I:kr,O:Ki}]);class Bt{constructor(e){ge(this,"typeName",Pn.typeName);ge(this,"methods",Pn.methods);ge(this,"options",Pn.options);this._transport=e}createFile(e,t){const r=this.methods[0],n=this._transport.mergeOptions(t);return Ve("unary",this._transport,r,n,e)}updateFile(e,t){const r=this.methods[1],n=this._transport.mergeOptions(t);return Ve("unary",this._transport,r,n,e)}deleteFile(e,t){const r=this.methods[2],n=this._transport.mergeOptions(t);return Ve("unary",this._transport,r,n,e)}getFilesByFolder(e,t){const r=this.methods[3],n=this._transport.mergeOptions(t);return Ve("unary",this._transport,r,n,e)}createUserFile(e,t){const r=this.methods[4],n=this._transport.mergeOptions(t);return Ve("unary",this._transport,r,n,e)}search(e,t){const r=this.methods[5],n=this._transport.mergeOptions(t);return Ve("unary",this._transport,r,n,e)}}const is=async(s,e,t,r,n,i)=>{var o;try{const a=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,c=new Bt(a),h=Fr.create();return h.name=s,h.nestedFolderName=e,h.url=t,h.type=r,h.folderName=n,await c.createFile(h,i)}catch(a){throw a}},ss=async(s,e,t)=>{var r;try{const n=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,i=new Bt(n),o=Hn.create();return o.url=s,o.type=e,await i.createUserFile(o,t)}catch(n){throw n}},os=async(s,e,t)=>{var r,n;try{const i=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=(n=window.ImageSalonSDK)==null?void 0:n.mode,a=new Bt(i),c=Hn.create();return c.url=s,c.type=e,await a.createUserFile(c,{meta:{Authorization:t,"app-id":o==="production"?"hamropatro":"hamropatro-android"}})}catch(i){throw i}},as=async(s,e,t,r)=>{var n;try{const i=(n=window.ImageSalonSDK)==null?void 0:n.grpcConfig,o=new Bt(i),a=Ir.create();return a.folderName=s,a.cursor=e,a.limit=t,await o.getFilesByFolder(a,r)}catch(i){throw i}},ls=async(s,e,t=20,r)=>{var n;try{const i=(n=window.ImageSalonSDK)==null?void 0:n.grpcConfig,o=new Bt(i),a=kr.create();return a.searchValue=s,a.cursor=e,a.limit=t,await o.search(a,r)}catch(i){throw i}},cs=async(s,e,t,r,n,i,o,a,c)=>{var h;try{const l=(h=window.ImageSalonSDK)==null?void 0:h.grpcConfig,u=new Bt(l),d=Ge.create();return d.key=s,d.name=e,d.nestedFolderName=t,d.url=r,d.thumborUrl=n,d.proxyUrl=i,d.type=o,d.folderName=a,await u.updateFile(d,c)}catch(l){throw l}},ds=async(s,e)=>{var t;try{const r=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,n=new Bt(r),i=Nr.create();return i.key=s,await n.deleteFile(i,e)}catch(r){throw r}};class hs extends Te{constructor(){super("com.hamropatro.grpc.common.DeleteFolderRequest",[{no:1,name:"key",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",e!==void 0&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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=r.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,r){e.key!==""&&t.tag(1,W.LengthDelimited).string(e.key);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Tr=new hs;class us extends Te{constructor(){super("com.hamropatro.grpc.common.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},{no:4,name:"for_user",kind:"scalar",T:8}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.name="",t.nestedFolderName="",t.createdBy="",t.forUser=!1,e!==void 0&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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;case 4:i.forUser=e.bool();break;default:let h=r.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,r){e.name!==""&&t.tag(1,W.LengthDelimited).string(e.name),e.nestedFolderName!==""&&t.tag(2,W.LengthDelimited).string(e.nestedFolderName),e.createdBy!==""&&t.tag(3,W.LengthDelimited).string(e.createdBy),e.forUser!==!1&&t.tag(4,W.Varint).bool(e.forUser);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Lr=new us;class fs extends Te{constructor(){super("com.hamropatro.grpc.common.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&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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=r.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,r){e.cursor!==""&&t.tag(1,W.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(2,W.Varint).int32(e.limit);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Wn=new fs;class ps extends Te{constructor(){super("com.hamropatro.grpc.common.GetAllFoldersResponse",[{no:1,name:"folder",kind:"message",repeat:1,T:()=>yt},{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&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.folder.push(yt.internalBinaryRead(e,e.uint32(),r));break;case 2:i.nextCursor=e.string();break;case 3:i.hasMore=e.bool();break;default:let h=r.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,r){for(let i=0;i<e.folder.length;i++)yt.internalBinaryWrite(e.folder[i],t.tag(1,W.LengthDelimited).fork(),r).join();e.nextCursor!==""&&t.tag(2,W.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,W.Varint).bool(e.hasMore);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Ur=new ps;class ms extends Te{constructor(){super("com.hamropatro.grpc.common.Empty",[])}create(e){const t=globalThis.Object.create(this.messagePrototype);return e!==void 0&&be(this,t,e),t}internalBinaryRead(e,t,r,n){return n??this.create()}internalBinaryWrite(e,t,r){let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const xr=new ms;class gs extends Te{constructor(){super("com.hamropatro.grpc.common.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},{no:5,name:"for_user",kind:"scalar",T:8}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",t.name="",t.nestedFolderName="",t.createdBy="",t.forUser=!1,e!==void 0&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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;case 5:i.forUser=e.bool();break;default:let h=r.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,r){e.key!==""&&t.tag(1,W.LengthDelimited).string(e.key),e.name!==""&&t.tag(2,W.LengthDelimited).string(e.name),e.nestedFolderName!==""&&t.tag(3,W.LengthDelimited).string(e.nestedFolderName),e.createdBy!==""&&t.tag(4,W.LengthDelimited).string(e.createdBy),e.forUser!==!1&&t.tag(5,W.Varint).bool(e.forUser);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const yt=new gs;class ws extends Te{constructor(){super("com.hamropatro.grpc.common.ChangeNestedFolderRequest",[{no:1,name:"folder_key",kind:"scalar",T:9},{no:2,name:"nested_folder_name",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.folderKey="",t.nestedFolderName="",e!==void 0&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.folderKey=e.string();break;case 2:i.nestedFolderName=e.string();break;default:let h=r.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,r){e.folderKey!==""&&t.tag(1,W.LengthDelimited).string(e.folderKey),e.nestedFolderName!==""&&t.tag(2,W.LengthDelimited).string(e.nestedFolderName);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const ys=new ws,jn=new Mn("com.hamropatro.grpc.common.FolderService",[{name:"createFolder",options:{},I:Lr,O:yt},{name:"getFolders",options:{},I:Wn,O:Ur},{name:"getUserFolders",options:{},I:Wn,O:Ur},{name:"updateFolder",options:{},I:yt,O:yt},{name:"deleteFolder",options:{},I:Tr,O:yt},{name:"ChangeNestedFolderName",options:{},I:ys,O:yt},{name:"setBooleanForUserFolder",options:{},I:xr,O:xr}]);class En{constructor(e){ge(this,"typeName",jn.typeName);ge(this,"methods",jn.methods);ge(this,"options",jn.options);this._transport=e}createFolder(e,t){const r=this.methods[0],n=this._transport.mergeOptions(t);return Ve("unary",this._transport,r,n,e)}getFolders(e,t){const r=this.methods[1],n=this._transport.mergeOptions(t);return Ve("unary",this._transport,r,n,e)}getUserFolders(e,t){const r=this.methods[2],n=this._transport.mergeOptions(t);return Ve("unary",this._transport,r,n,e)}updateFolder(e,t){const r=this.methods[3],n=this._transport.mergeOptions(t);return Ve("unary",this._transport,r,n,e)}deleteFolder(e,t){const r=this.methods[4],n=this._transport.mergeOptions(t);return Ve("unary",this._transport,r,n,e)}changeNestedFolderName(e,t){const r=this.methods[5],n=this._transport.mergeOptions(t);return Ve("unary",this._transport,r,n,e)}setBooleanForUserFolder(e,t){const r=this.methods[6],n=this._transport.mergeOptions(t);return Ve("unary",this._transport,r,n,e)}}const bs=async(s,e=20,t)=>{var o;const r=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,n=new En(r),i=Wn.create();try{return i.cursor=s,i.limit=e,await n.getFolders(i,t)}catch(a){throw a}},Cs=async(s,e,t,r,n)=>{var i;try{const o=(i=window.ImageSalonSDK)==null?void 0:i.grpcConfig,a=new En(o),c=Lr.create();return c.name=s,c.nestedFolderName=e,c.createdBy=t,c.forUser=r,await a.createFolder(c,n)}catch(o){throw o}},Es=async(s,e,t,r,n)=>{var i;try{const o=(i=window.ImageSalonSDK)==null?void 0:i.grpcConfig,a=new En(o),c=yt.create();return c.name=e,c.key=s,c.nestedFolderName=t,c.createdBy=r,await a.updateFolder(c,n)}catch(o){throw o}},vs=async(s,e)=>{var t;try{const r=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,n=new En(r),i=Tr.create();return i.key=s,await n.deleteFolder(i,e)}catch(r){throw r}},qn=(s,e,t)=>{const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("width",s||"20"),r.setAttribute("height",e||"20"),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("fill","none"),r.setAttribute("stroke",t||"#ee3f3f"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),r.classList.add("lucide","lucide-circle-alert");const n=document.createElementNS("http://www.w3.org/2000/svg","circle");n.setAttribute("cx","12"),n.setAttribute("cy","12"),n.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"),r.appendChild(n),r.appendChild(i),r.appendChild(o),r};function _r(){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 As(){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 r=document.createElementNS("http://www.w3.org/2000/svg","circle");r.setAttribute("cx","6"),r.setAttribute("cy","18"),r.setAttribute("r","3");const n=document.createElementNS("http://www.w3.org/2000/svg","circle");return n.setAttribute("cx","18"),n.setAttribute("cy","16"),n.setAttribute("r","3"),s.appendChild(e),s.appendChild(t),s.appendChild(r),s.appendChild(n),document.body.appendChild(s),s}const Br=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 r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d","m9 11 3 3L22 4"),e.appendChild(t),e.appendChild(r),e};function Zn(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 Or(){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 rn(){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 ks(){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 r=document.createElementNS(s,"circle");r.setAttribute("cx","9"),r.setAttribute("cy","9"),r.setAttribute("r","2");const n=document.createElementNS(s,"path");return n.setAttribute("d","m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"),e.appendChild(t),e.appendChild(r),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("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 Kn(){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 Ns(){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 r=document.createElementNS(s,"circle");return r.setAttribute("cx","12"),r.setAttribute("cy","12"),r.setAttribute("r","3"),e.appendChild(r),document.body.appendChild(e),e}function Is(){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 Sr(){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 r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d","M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2");const n=document.createElementNS("http://www.w3.org/2000/svg","line");n.setAttribute("x1","10"),n.setAttribute("x2","10"),n.setAttribute("y1","11"),n.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(r),s.appendChild(n),s.appendChild(i),document.body.appendChild(s),s}function zn(){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 r=document.createElementNS("http://www.w3.org/2000/svg","line");return r.setAttribute("x1","12"),r.setAttribute("x2","12"),r.setAttribute("y1","3"),r.setAttribute("y2","15"),s.appendChild(e),s.appendChild(t),s.appendChild(r),s}function Ts(){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 r=document.createElementNS(s,"rect");return r.setAttribute("x","2"),r.setAttribute("y","6"),r.setAttribute("width","14"),r.setAttribute("height","12"),r.setAttribute("rx","2"),e.appendChild(t),e.appendChild(r),document.body.appendChild(e),e}function Q(s,e,t,r,n){let i=document.createElement(s);return e&&(i.className+=e),t&&(i.style.cssText=t),r&&(i.textContent=r),n&&n.appendChild(i),i}class Ls{constructor(){z(this,bt);z(this,et);z(this,Wt,"#fff");H(this,bt,document.createElementNS("http://www.w3.org/2000/svg","svg")),E(this,bt).setAttribute("viewBox","25 25 50 50"),E(this,bt).classList.add("loader-svg"),H(this,et,document.createElementNS("http://www.w3.org/2000/svg","circle")),E(this,et).setAttribute("r","20"),E(this,et).setAttribute("cy","50"),E(this,et).setAttribute("cx","50"),E(this,et).setAttribute("stroke",E(this,Wt)),E(this,et).classList.add("loader-circle"),E(this,bt).appendChild(E(this,et))}show(e,t){t&&(H(this,Wt,t),E(this,et).setAttribute("stroke",E(this,Wt))),e.appendChild(E(this,bt))}hide(){E(this,bt).remove()}}bt=new WeakMap,et=new WeakMap,Wt=new WeakMap;const Rr=new Ls,vn=document.body;class Dr{constructor(){ge(this,"main");ge(this,"dialogContainer");ge(this,"dialog");ge(this,"dialogBackdrop");ge(this,"dialogContent");ge(this,"dialogHeader");ge(this,"dialogBody");ge(this,"dialogFooter");ge(this,"confirmButton");ge(this,"cancelButton");ge(this,"confirmCallback");ge(this,"cancelCallback");this.main=Q("div"),this.dialog=Q("div"),this.confirmCallback=void 0,this.cancelCallback=void 0}_init(e){this.main=Q("div","dialog-presentation","","",vn),this.main.setAttribute("role","presentation"),this.dialogContainer=Q("div","dialog-container","","",this.main),this.dialogBackdrop=Q("div","dialog-backdrop","","",this.dialogContainer),this.dialog=Q("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=Q("div","dialog-content","","",this.dialog),e!=null&&e.dialogContentStyle&&Object.assign(this.dialogContent.style,e.dialogContentStyle),this.confirmButton=Q("button","dialog-btn confirm","","",this.dialogFooter),this.confirmButton.type="button",this.cancelButton=Q("button","dialog-btn cancel","","",this.dialogFooter),this.cancelButton.type="button",e.showCloseBtn){const r=Q("button","dialog-close-btn","","",this.dialogContent);r.appendChild(Zn()),r.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",vn.style.overflow="hidden",this.confirmButton.textContent=e.confirmButtonText||"Upload",this.cancelButton.textContent=e.cancelButtonText||"Cancel",vn.classList.add("dialog-visible"),new Promise(r=>{const n=i=>()=>{this.hide(),r(i==="confirm")};this.confirmCallback=e.onConfirm||n("confirm"),this.confirmButton.addEventListener("click",this.confirmCallback),this.cancelCallback=e.onCancel||n("cancel"),this.cancelButton.addEventListener("click",this.cancelCallback)})}_setHeader(e){if(this.dialogHeader=Q("div","dialog-header","","",this.dialogContent),!e.header)this.dialogHeader.innerHTML="";else if(typeof e.header=="string"){const t=Q("h4","dialog-header-text","","",this.dialogHeader);t.textContent=e.header}else this.dialogHeader.innerHTML="",this.dialogHeader.appendChild(e.header)}_setBody(e){this.dialogBody=Q("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=Q("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||vn.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?(Rr.show(this.confirmButton),this.confirmButton.disabled=!0):(Rr.hide(),this.confirmButton.disabled=!1)}}const An=new Dr,Ae=new Dr;class Us{constructor(){ge(this,"main");ge(this,"dialogBody");this.main=Q("div"),this.dialogBody=Q("div"),this.hide()}show(e){this.main=Q("div","popover","","",e.mainContainer),this.dialogBody=Q("div","popover-body","","",this.main),this.main.id=e.divId,this.dialogBody.append(e.content)}hide(){this.main.remove()}}const Je=new Us;var Qe=(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))(Qe||{});const sn={0:"IMAGE",1:"AUDIO",2:"VIDEO",3:"ALL",4:"FOLDER"};function Xn(s){switch(s){case"image":return sn[Qe.IMAGE];case"video":return sn[Qe.VIDEO];case"audio":return sn[Qe.AUDIO];default:return sn[Qe.ALL]}}function xs(s){const e={};s.forEach(n=>{e[n.key]={...n,children:{}}});const t=n=>(Object.values(e).filter(o=>o.nestedFolderName==n.key).forEach(o=>{n.children[o.key]=t(o)}),n);return s.reduce((n,i)=>(i.nestedFolderName||n.push(t(e[i.key])),n),[])}function _s(s,e){const t=r=>{if(r.key===e.nestedFolderName)return r.children[e.key]={...e,children:{}},!0;for(const n in r.children){const i=r.children[n];if(t(i))return!0}return!1};for(const r of s)if(t(r))break;return s}const Bs=async(s,e)=>{let t;try{s&&(t={Authorization:s,"app-id":e==="production"?"hamropatro":"hamropatro-android"})}catch(n){if(n)throw n}return{meta:t}};function Z(s,e){const t=document.createElement("div");return s&&(t.className=s),e&&(t.id=e),t}function $t(s,e,t){const r=document.createElement("p");return e&&(r.className=e),t&&(r.id=t),s&&(r.textContent=s),r}function oe(s,e){const t=document.createElement("span");return e&&(t.className=e),s&&(t.textContent=s),t}function Mr(s,e,t,r){const n=document.createElement("img");return e&&(n.className=e),n.src=s,n}function Os(s,e,t){const r=document.createElement("video"),n=document.createElement("source");return r.className=e,n.src=s,r.appendChild(n),r}function Ss(s,e,t){const r=document.createElement("audio"),n=document.createElement("source");return r.className=e,r.controls=!0,n.src=s,r.appendChild(n),r}function He(s,e,t,r,n){const i=document.createElement("button");return e&&(i.className=e),t&&(i.id=t),s&&(i.textContent=s),n&&(i.innerHTML=n),i.disabled=r,i}function Gn(s,e,t){const r=document.createElement("input");return r.className=e,r.defaultValue=t,s&&(r.type=s),r}function Rs(s,e){return e.forEach(function(t){t&&typeof t!="string"&&!Array.isArray(t)&&Object.keys(t).forEach(function(r){if(r!=="default"&&!(r in s)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})}),Object.freeze(s)}function Vr(s,e){return new Promise(function(t,r){let n;return Ds(s).then(function(i){try{return n=i,t(new Blob([e.slice(0,2),n,e.slice(2)],{type:"image/jpeg"}))}catch(o){return r(o)}},r)})}const Ds=s=>new Promise((e,t)=>{const r=new FileReader;r.addEventListener("load",({target:{result:n}})=>{const i=new DataView(n);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(n.slice(o,o+2+c))}o+=2+c}return e(new Blob)}),r.readAsArrayBuffer(s)});var kn={},Ms={get exports(){return kn},set exports(s){kn=s}};(function(s){var e,t,r={};Ms.exports=r,r.parse=function(n,i){for(var o=r.bin.readUshort,a=r.bin.readUint,c=0,h={},l=new Uint8Array(n),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 N=0;N<d;N++){a(l,c),c+=4,c+=4,c+=4,a(l,c+=4),f=a(l,c+=4);var T=a(l,c+=4),C=o(l,c+=4),R=o(l,c+2),O=o(l,c+4);c+=6;var A=a(l,c+=8);c+=4,c+=C+R+O,r._readLocal(l,A,h,f,T,i)}return h},r._readLocal=function(n,i,o,a,c,h){var l=r.bin.readUshort,u=r.bin.readUint;u(n,i),l(n,i+=4),l(n,i+=2);var d=l(n,i+=2);u(n,i+=2),u(n,i+=4),i+=4;var f=l(n,i+=8),y=l(n,i+=2);i+=2;var N=r.bin.readUTF8(n,i,f);if(i+=f,i+=y,h)o[N]={size:c,csize:a};else{var T=new Uint8Array(n.buffer,i);if(d==0)o[N]=new Uint8Array(T.buffer.slice(i,i+a));else{if(d!=8)throw"unknown compression method: "+d;var C=new Uint8Array(c);r.inflateRaw(T,C),o[N]=C}}},r.inflateRaw=function(n,i){return r.F.inflate(n,i)},r.inflate=function(n,i){return n[0],n[1],r.inflateRaw(new Uint8Array(n.buffer,n.byteOffset+2,n.length-6),i)},r.deflate=function(n,i){i==null&&(i={level:6});var o=0,a=new Uint8Array(50+Math.floor(1.1*n.length));a[o]=120,a[o+1]=156,o+=2,o=r.F.deflateRaw(n,a,o,i.level);var c=r.adler(n,0,n.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)},r.deflateRaw=function(n,i){i==null&&(i={level:6});var o=new Uint8Array(50+Math.floor(1.1*n.length)),a=r.F.deflateRaw(n,o,a,i.level);return new Uint8Array(o.buffer,0,a)},r.encode=function(n,i){i==null&&(i=!1);var o=0,a=r.bin.writeUint,c=r.bin.writeUshort,h={};for(var l in n){var u=!r._noNeed(l)&&!i,d=n[l],f=r.crc.crc(d,0,d.length);h[l]={cpr:u,usize:d.length,crc:f,file:u?r.deflateRaw(d):d}}for(var l in h)o+=h[l].file.length+30+46+2*r.bin.sizeUTF8(l);o+=22;var y=new Uint8Array(o),N=0,T=[];for(var l in h){var C=h[l];T.push(N),N=r._writeHeader(y,N,l,C,0)}var R=0,O=N;for(var l in h)C=h[l],T.push(N),N=r._writeHeader(y,N,l,C,1,T[R++]);var A=N-O;return a(y,N,101010256),N+=4,c(y,N+=4,R),c(y,N+=2,R),a(y,N+=2,A),a(y,N+=4,O),N+=4,N+=2,y.buffer},r._noNeed=function(n){var i=n.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(i)!=-1},r._writeHeader=function(n,i,o,a,c,h){var l=r.bin.writeUint,u=r.bin.writeUshort,d=a.file;return l(n,i,c==0?67324752:33639248),i+=4,c==1&&(i+=2),u(n,i,20),u(n,i+=2,0),u(n,i+=2,a.cpr?8:0),l(n,i+=2,0),l(n,i+=4,a.crc),l(n,i+=4,d.length),l(n,i+=4,a.usize),u(n,i+=4,r.bin.sizeUTF8(o)),u(n,i+=2,0),i+=2,c==1&&(i+=2,i+=2,l(n,i+=6,h),i+=4),i+=r.bin.writeUTF8(n,i,o),c==0&&(n.set(d,i),i+=d.length),i},r.crc={table:function(){for(var n=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;n[i]=o}return n}(),update:function(n,i,o,a){for(var c=0;c<a;c++)n=r.crc.table[255&(n^i[o+c])]^n>>>8;return n},crc:function(n,i,o){return 4294967295^r.crc.update(4294967295,n,i,o)}},r.adler=function(n,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+=n[h++];a%=65521,c%=65521}return c<<16|a},r.bin={readUshort:function(n,i){return n[i]|n[i+1]<<8},writeUshort:function(n,i,o){n[i]=255&o,n[i+1]=o>>8&255},readUint:function(n,i){return 16777216*n[i+3]+(n[i+2]<<16|n[i+1]<<8|n[i])},writeUint:function(n,i,o){n[i]=255&o,n[i+1]=o>>8&255,n[i+2]=o>>16&255,n[i+3]=o>>24&255},readASCII:function(n,i,o){for(var a="",c=0;c<o;c++)a+=String.fromCharCode(n[i+c]);return a},writeASCII:function(n,i,o){for(var a=0;a<o.length;a++)n[i+a]=o.charCodeAt(a)},pad:function(n){return n.length<2?"0"+n:n},readUTF8:function(n,i,o){for(var a,c="",h=0;h<o;h++)c+="%"+r.bin.pad(n[i+h].toString(16));try{a=decodeURIComponent(c)}catch{return r.bin.readASCII(n,i,o)}return a},writeUTF8:function(n,i,o){for(var a=o.length,c=0,h=0;h<a;h++){var l=o.charCodeAt(h);if(!(4294967168&l))n[i+c]=l,c++;else if(!(4294965248&l))n[i+c]=192|l>>6,n[i+c+1]=128|l>>0&63,c+=2;else if(!(4294901760&l))n[i+c]=224|l>>12,n[i+c+1]=128|l>>6&63,n[i+c+2]=128|l>>0&63,c+=3;else{if(4292870144&l)throw"e";n[i+c]=240|l>>18,n[i+c+1]=128|l>>12&63,n[i+c+2]=128|l>>6&63,n[i+c+3]=128|l>>0&63,c+=4}}return c},sizeUTF8:function(n){for(var i=n.length,o=0,a=0;a<i;a++){var c=n.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}},r.F={},r.F.deflateRaw=function(n,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=r.F.U,l=r.F._goodIndex;r.F._hash;var u=r.F._putsE,d=0,f=o<<3,y=0,N=n.length;if(a==0){for(;d<N;)u(i,f,d+(I=Math.min(65535,N-d))==N?1:0),f=r.F._copyExact(n,d,I,i,f+8),d+=I;return f>>>3}var T=h.lits,C=h.strt,R=h.prev,O=0,A=0,U=0,b=0,B=0,m=0;for(N>2&&(C[m=r.F._hash(n,0)]=0),d=0;d<N;d++){if(B=m,d+1<N-2){m=r.F._hash(n,d+1);var g=d+1&32767;R[g]=C[m],C[m]=g}if(y<=d){(O>14e3||A>26697)&&N-d>100&&(y<d&&(T[O]=d-y,O+=2,y=d),f=r.F._writeBlock(d==N-1||y==N?1:0,T,O,b,n,U,d-U,i,f),O=A=b=0,U=d);var k=0;d<N-2&&(k=r.F._bestMatch(n,d,R,B,Math.min(c[2],N-d),c[3]));var I=k>>>16,F=65535&k;if(k!=0){F=65535&k;var L=l(I=k>>>16,h.of0);h.lhst[257+L]++;var v=l(F,h.df0);h.dhst[v]++,b+=h.exb[L]+h.dxb[v],T[O]=I<<23|d-y,T[O+1]=F<<16|L<<8|v,O+=2,y=d+I}else h.lhst[n[d]]++;A++}}for(U==d&&n.length!=0||(y<d&&(T[O]=d-y,O+=2,y=d),f=r.F._writeBlock(1,T,O,b,n,U,d-U,i,f),O=0,A=0,O=A=b=0,U=d);7&f;)f++;return f>>>3},r.F._bestMatch=function(n,i,o,a,c,h){var l=32767&i,u=o[l],d=l-u+32768&32767;if(u==l||a!=r.F._hash(n,i-d))return 0;for(var f=0,y=0,N=Math.min(32767,i);d<=N&&--h!=0&&u!=l;){if(f==0||n[i+f]==n[i+f-d]){var T=r.F._howLong(n,i,d);if(T>f){if(y=d,(f=T)>=c)break;d+2<T&&(T=d+2);for(var C=0,R=0;R<T-2;R++){var O=i-d+R+32768&32767,A=O-o[O]+32768&32767;A>C&&(C=A,u=O)}}}d+=(l=u)-(u=o[l])+32768&32767}return f<<16|y},r.F._howLong=function(n,i,o){if(n[i]!=n[i-o]||n[i+1]!=n[i+1-o]||n[i+2]!=n[i+2-o])return 0;var a=i,c=Math.min(n.length,i+258);for(i+=3;i<c&&n[i]==n[i-o];)i++;return i-a},r.F._hash=function(n,i){return(n[i]<<8|n[i+1])+(n[i+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(n,i,o,a,c,h,l,u,d){var f,y,N,T,C,R,O,A,U,b=r.F.U,B=r.F._putsF,m=r.F._putsE;b.lhst[256]++,y=(f=r.F.getTrees())[0],N=f[1],T=f[2],C=f[3],R=f[4],O=f[5],A=f[6],U=f[7];var g=32+(d+3&7?8-(d+3&7):0)+(l<<3),k=a+r.F.contSize(b.fltree,b.lhst)+r.F.contSize(b.fdtree,b.dhst),I=a+r.F.contSize(b.ltree,b.lhst)+r.F.contSize(b.dtree,b.dhst);I+=14+3*O+r.F.contSize(b.itree,b.ihst)+(2*b.ihst[16]+3*b.ihst[17]+7*b.ihst[18]);for(var F=0;F<286;F++)b.lhst[F]=0;for(F=0;F<30;F++)b.dhst[F]=0;for(F=0;F<19;F++)b.ihst[F]=0;var L=g<k&&g<I?0:k<I?1:2;if(B(u,d,n),B(u,d+1,L),d+=3,L==0){for(;7&d;)d++;d=r.F._copyExact(c,h,l,u,d)}else{var v,_;if(L==1&&(v=b.fltree,_=b.fdtree),L==2){r.F.makeCodes(b.ltree,y),r.F.revCodes(b.ltree,y),r.F.makeCodes(b.dtree,N),r.F.revCodes(b.dtree,N),r.F.makeCodes(b.itree,T),r.F.revCodes(b.itree,T),v=b.ltree,_=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=r.F._codeTiny(A,b.itree,u,d),d=r.F._codeTiny(U,b.itree,u,d)}for(var p=h,M=0;M<o;M+=2){for(var x=i[M],V=x>>>23,K=p+(8388607&x);p<K;)d=r.F._writeLit(c[p++],v,u,d);if(V!=0){var P=i[M+1],q=P>>16,$=P>>8&255,S=255&P;m(u,d=r.F._writeLit(257+$,v,u,d),V-b.of0[$]),d+=b.exb[$],B(u,d=r.F._writeLit(S,_,u,d),q-b.df0[S]),d+=b.dxb[S],p+=V}}d=r.F._writeLit(256,v,u,d)}return d},r.F._copyExact=function(n,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(n.buffer,i,o),h),c+(o+4<<3)},r.F.getTrees=function(){for(var n=r.F.U,i=r.F._hufTree(n.lhst,n.ltree,15),o=r.F._hufTree(n.dhst,n.dtree,15),a=[],c=r.F._lenCodes(n.ltree,a),h=[],l=r.F._lenCodes(n.dtree,h),u=0;u<a.length;u+=2)n.ihst[a[u]]++;for(u=0;u<h.length;u+=2)n.ihst[h[u]]++;for(var d=r.F._hufTree(n.ihst,n.itree,7),f=19;f>4&&n.itree[1+(n.ordr[f-1]<<1)]==0;)f--;return[i,o,d,c,l,f,a,h]},r.F.getSecond=function(n){for(var i=[],o=0;o<n.length;o+=2)i.push(n[o+1]);return i},r.F.nonZero=function(n){for(var i="",o=0;o<n.length;o+=2)n[o+1]!=0&&(i+=(o>>1)+",");return i},r.F.contSize=function(n,i){for(var o=0,a=0;a<i.length;a++)o+=i[a]*n[1+(a<<1)];return o},r.F._codeTiny=function(n,i,o,a){for(var c=0;c<n.length;c+=2){var h=n[c],l=n[c+1];a=r.F._writeLit(h,i,o,a);var u=h==16?2:h==17?3:7;h>15&&(r.F._putsE(o,a,l,u),a+=u)}return a},r.F._lenCodes=function(n,i){for(var o=n.length;o!=2&&n[o-1]==0;)o-=2;for(var a=0;a<o;a+=2){var c=n[a+1],h=a+3<o?n[a+3]:-1,l=a+5<o?n[a+5]:-1,u=a==0?-1:n[a-1];if(c==0&&h==c&&l==c){for(var d=a+5;d+2<o&&n[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&&n[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},r.F._hufTree=function(n,i,o){var a=[],c=n.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++)n[l]!=0&&a.push({lit:l,f:n[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(A,U){return A.f-U.f});var y=a[0],N=a[1],T=0,C=1,R=2;for(a[0]={lit:-1,f:y.f+N.f,l:y,r:N,d:0};C!=u-1;)y=T!=C&&(R==u||a[T].f<a[R].f)?a[T++]:a[R++],N=T!=C&&(R==u||a[T].f<a[R].f)?a[T++]:a[R++],a[C++]={lit:-1,f:y.f+N.f,l:y,r:N};var O=r.F.setDepth(a[C-1],0);for(O>o&&(r.F.restrictDepth(d,o,O),O=o),l=0;l<u;l++)i[1+(d[l].lit<<1)]=d[l].d;return O},r.F.setDepth=function(n,i){return n.lit!=-1?(n.d=i,i):Math.max(r.F.setDepth(n.l,i+1),r.F.setDepth(n.r,i+1))},r.F.restrictDepth=function(n,i,o){var a=0,c=1<<o-i,h=0;for(n.sort(function(u,d){return d.d==u.d?u.f-d.f:d.d-u.d}),a=0;a<n.length&&n[a].d>i;a++){var l=n[a].d;n[a].d=i,h+=c-(1<<o-l)}for(h>>>=o-i;h>0;)(l=n[a].d)<i?(n[a].d++,h-=1<<i-l-1):a++;for(;a>=0;a--)n[a].d==i&&h<0&&(n[a].d--,h++);h!=0&&console.log("debt left")},r.F._goodIndex=function(n,i){var o=0;return i[16|o]<=n&&(o|=16),i[8|o]<=n&&(o|=8),i[4|o]<=n&&(o|=4),i[2|o]<=n&&(o|=2),i[1|o]<=n&&(o|=1),o},r.F._writeLit=function(n,i,o,a){return r.F._putsF(o,a,i[n<<1]),a+i[1+(n<<1)]},r.F.inflate=function(n,i){var o=Uint8Array;if(n[0]==3&&n[1]==0)return i||new o(0);var a=r.F,c=a._bitsF,h=a._bitsE,l=a._decodeTiny,u=a.makeCodes,d=a.codes2map,f=a._get17,y=a.U,N=i==null;N&&(i=new o(n.length>>>2<<3));for(var T,C,R=0,O=0,A=0,U=0,b=0,B=0,m=0,g=0,k=0;R==0;)if(R=c(n,k,1),O=c(n,k+1,2),k+=3,O!=0){if(N&&(i=r.F._check(i,g+(1<<17))),O==1&&(T=y.flmap,C=y.fdmap,B=511,m=31),O==2){A=h(n,k,5)+257,U=h(n,k+5,5)+1,b=h(n,k+10,4)+4,k+=14;for(var I=0;I<38;I+=2)y.itree[I]=0,y.itree[I+1]=0;var F=1;for(I=0;I<b;I++){var L=h(n,k+3*I,3);y.itree[1+(y.ordr[I]<<1)]=L,L>F&&(F=L)}k+=3*b,u(y.itree,F),d(y.itree,F,y.imap),T=y.lmap,C=y.dmap,k=l(y.imap,(1<<F)-1,A+U,n,k,y.ttree);var v=a._copyOut(y.ttree,0,A,y.ltree);B=(1<<v)-1;var _=a._copyOut(y.ttree,A,U,y.dtree);m=(1<<_)-1,u(y.ltree,v),d(y.ltree,v,T),u(y.dtree,_),d(y.dtree,_,C)}for(;;){var w=T[f(n,k)&B];k+=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 x=y.ldef[p-257];M=g+(x>>>3)+h(n,k,7&x),k+=7&x}var V=C[f(n,k)&m];k+=15&V;var K=V>>>4,P=y.ddef[K],q=(P>>>4)+c(n,k,15&P);for(k+=15&P,N&&(i=r.F._check(i,g+(1<<17)));g<M;)i[g]=i[g++-q],i[g]=i[g++-q],i[g]=i[g++-q],i[g]=i[g++-q];g=M}}}else{7&k&&(k+=8-(7&k));var $=4+(k>>>3),S=n[$-4]|n[$-3]<<8;N&&(i=r.F._check(i,g+S)),i.set(new o(n.buffer,n.byteOffset+$,S),g),k=$+S<<3,g+=S}return i.length==g?i:i.slice(0,g)},r.F._check=function(n,i){var o=n.length;if(i<=o)return n;var a=new Uint8Array(Math.max(o<<1,i));return a.set(n,0),a},r.F._decodeTiny=function(n,i,o,a,c,h){for(var l=r.F._bitsE,u=r.F._get17,d=0;d<o;){var f=n[u(a,c)&i];c+=15&f;var y=f>>>4;if(y<=15)h[d]=y,d++;else{var N=0,T=0;y==16?(T=3+l(a,c,2),c+=2,N=h[d-1]):y==17?(T=3+l(a,c,3),c+=3):y==18&&(T=11+l(a,c,7),c+=7);for(var C=d+T;d<C;)h[d]=N,d++}}return c},r.F._copyOut=function(n,i,o,a){for(var c=0,h=0,l=a.length>>>1;h<o;){var u=n[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},r.F.makeCodes=function(n,i){for(var o,a,c,h,l=r.F.U,u=n.length,d=l.bl_count,f=0;f<=i;f++)d[f]=0;for(f=1;f<u;f+=2)d[n[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=n[c+1])!=0&&(n[c]=y[h],y[h]++)},r.F.codes2map=function(n,i,o){for(var a=n.length,c=r.F.U.rev15,h=0;h<a;h+=2)if(n[h+1]!=0)for(var l=h>>1,u=n[h+1],d=l<<4|u,f=i-u,y=n[h]<<f,N=y+(1<<f);y!=N;)o[c[y]>>>15-i]=d,y++},r.F.revCodes=function(n,i){for(var o=r.F.U.rev15,a=15-i,c=0;c<n.length;c+=2){var h=n[c]<<i-n[c+1];n[c]=o[h]>>>a}},r.F._putsE=function(n,i,o){o<<=7&i;var a=i>>>3;n[a]|=o,n[a+1]|=o>>>8},r.F._putsF=function(n,i,o){o<<=7&i;var a=i>>>3;n[a]|=o,n[a+1]|=o>>>8,n[a+2]|=o>>>16},r.F._bitsE=function(n,i,o){return(n[i>>>3]|n[1+(i>>>3)]<<8)>>>(7&i)&(1<<o)-1},r.F._bitsF=function(n,i,o){return(n[i>>>3]|n[1+(i>>>3)]<<8|n[2+(i>>>3)]<<16)>>>(7&i)&(1<<o)-1},r.F._get17=function(n,i){return(n[i>>>3]|n[1+(i>>>3)]<<8|n[2+(i>>>3)]<<16)>>>(7&i)},r.F._get25=function(n,i){return(n[i>>>3]|n[1+(i>>>3)]<<8|n[2+(i>>>3)]<<16|n[3+(i>>>3)]<<24)>>>(7&i)},r.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 n=r.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,n.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++)n.ldef[i]=n.of0[i]<<3|n.exb[i],n.ddef[i]=n.df0[i]<<4|n.dxb[i];a(n.fltree,144,8),a(n.fltree,112,9),a(n.fltree,24,7),a(n.fltree,8,8),r.F.makeCodes(n.fltree,9),r.F.codes2map(n.fltree,9,n.flmap),r.F.revCodes(n.fltree,9),a(n.fdtree,32,5),r.F.makeCodes(n.fdtree,5),r.F.codes2map(n.fdtree,5,n.fdmap),r.F.revCodes(n.fdtree,5),a(n.itree,19,0),a(n.ltree,286,0),a(n.dtree,30,0),a(n.ttree,320,0)}()})();var Vs=Rs({__proto__:null,default:kn},[kn]);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 N=0;N<d;N++)y+=`%${s.pad(l[u+N].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,N=i(f),T=Math.ceil(u*N/8),C=new Uint8Array(4*y),R=new Uint32Array(C.buffer),{ctype:O}=f,{depth:A}=f,U=s.readUshort;if(O==6){const x=y<<2;if(A==8)for(var b=0;b<x;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(A==16)for(b=0;b<x;b++)C[b]=l[b<<1]}else if(O==2){const x=f.tabs.tRNS;if(x==null){if(A==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(A==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=x[0];const V=x[1],K=x[2];if(A==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]==K&&(C[g+3]=0)}if(A==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],U(l,B)==m&&U(l,B+2)==V&&U(l,B+4)==K&&(C[g+3]=0)}}else if(O==3){const x=f.tabs.PLTE,V=f.tabs.tRNS,K=V?V.length:0;if(A==1)for(var k=0;k<d;k++){var I=k*T,F=k*u;for(b=0;b<u;b++){g=F+b<<2;var L=3*(v=l[I+(b>>3)]>>7-((7&b)<<0)&1);C[g]=x[L],C[g+1]=x[L+1],C[g+2]=x[L+2],C[g+3]=v<K?V[v]:255}}if(A==2)for(k=0;k<d;k++)for(I=k*T,F=k*u,b=0;b<u;b++)g=F+b<<2,L=3*(v=l[I+(b>>2)]>>6-((3&b)<<1)&3),C[g]=x[L],C[g+1]=x[L+1],C[g+2]=x[L+2],C[g+3]=v<K?V[v]:255;if(A==4)for(k=0;k<d;k++)for(I=k*T,F=k*u,b=0;b<u;b++)g=F+b<<2,L=3*(v=l[I+(b>>1)]>>4-((1&b)<<2)&15),C[g]=x[L],C[g+1]=x[L+1],C[g+2]=x[L+2],C[g+3]=v<K?V[v]:255;if(A==8)for(b=0;b<y;b++){var v;g=b<<2,L=3*(v=l[b]),C[g]=x[L],C[g+1]=x[L+1],C[g+2]=x[L+2],C[g+3]=v<K?V[v]:255}}else if(O==4){if(A==8)for(b=0;b<y;b++){g=b<<2;var _=l[w=b<<1];C[g]=_,C[g+1]=_,C[g+2]=_,C[g+3]=l[w+1]}if(A==16)for(b=0;b<y;b++){var w;g=b<<2,_=l[w=b<<2],C[g]=_,C[g+1]=_,C[g+2]=_,C[g+3]=l[w+2]}}else if(O==0)for(m=f.tabs.tRNS?f.tabs.tRNS:-1,k=0;k<d;k++){const x=k*T,V=k*u;if(A==1)for(var p=0;p<u;p++){var M=(_=255*(l[x+(p>>>3)]>>>7-(7&p)&1))==255*m?0:255;R[V+p]=M<<24|_<<16|_<<8|_}else if(A==2)for(p=0;p<u;p++)M=(_=85*(l[x+(p>>>2)]>>>6-((3&p)<<1)&3))==85*m?0:255,R[V+p]=M<<24|_<<16|_<<8|_;else if(A==4)for(p=0;p<u;p++)M=(_=17*(l[x+(p>>>1)]>>>4-((1&p)<<2)&15))==17*m?0:255,R[V+p]=M<<24|_<<16|_<<8|_;else if(A==8)for(p=0;p<u;p++)M=(_=l[x+p])==m?0:255,R[V+p]=M<<24|_<<16|_<<8|_;else if(A==16)for(p=0;p<u;p++)_=l[x+(p<<1)],M=U(l,x+(p<<1))==m?0:255,R[V+p]=M<<24|_<<16|_<<8|_}return C}function t(l,u,d,f){const y=i(l),N=Math.ceil(d*y/8),T=new Uint8Array((N+1+l.interlace)*f);return u=l.tabs.CgBI?n(u,T):r(u,T),l.interlace==0?u=o(u,l,0,d,f):l.interlace==1&&(u=function(R,O){const A=O.width,U=O.height,b=i(O),B=b>>3,m=Math.ceil(A*b/8),g=new Uint8Array(U*m);let k=0;const I=[0,0,4,0,2,0,1],F=[0,4,0,2,0,1,0],L=[8,8,8,4,4,2,2],v=[8,8,4,4,2,2,1];let _=0;for(;_<7;){const p=L[_],M=v[_];let x=0,V=0,K=I[_];for(;K<U;)K+=p,V++;let P=F[_];for(;P<A;)P+=M,x++;const q=Math.ceil(x*b/8);o(R,O,k,x,V);let $=0,S=I[_];for(;S<U;){let X=F[_],ce=k+$*q<<3;for(;X<A;){var w;if(b==1&&(w=(w=R[ce>>3])>>7-(7&ce)&1,g[S*m+(X>>3)]|=w<<7-((7&X)<<0)),b==2&&(w=(w=R[ce>>3])>>6-(7&ce)&3,g[S*m+(X>>2)]|=w<<6-((3&X)<<1)),b==4&&(w=(w=R[ce>>3])>>4-(7&ce)&15,g[S*m+(X>>1)]|=w<<4-((1&X)<<2)),b>=8){const te=S*m+X*B;for(let Y=0;Y<B;Y++)g[te+Y]=R[(ce>>3)+Y]}ce+=b,X+=M}$++,S+=p}x*V!=0&&(k+=V*(1+q)),_+=1}return g}(u,l)),u}function r(l,u){return n(new Uint8Array(l.buffer,2,l.length-6),u)}var n=function(){const l={H:{}};return l.H.N=function(u,d){const f=Uint8Array;let y,N,T=0,C=0,R=0,O=0,A=0,U=0,b=0,B=0,m=0;if(u[0]==3&&u[1]==0)return d||new f(0);const g=l.H,k=g.b,I=g.e,F=g.R,L=g.n,v=g.A,_=g.Z,w=g.m,p=d==null;for(p&&(d=new f(u.length>>>2<<5));T==0;)if(T=k(u,m,1),C=k(u,m+1,2),m+=3,C!=0){if(p&&(d=l.H.W(d,B+(1<<17))),C==1&&(y=w.J,N=w.h,U=511,b=31),C==2){R=I(u,m,5)+257,O=I(u,m+5,5)+1,A=I(u,m+10,4)+4,m+=14;let x=1;for(var M=0;M<38;M+=2)w.Q[M]=0,w.Q[M+1]=0;for(M=0;M<A;M++){const P=I(u,m+3*M,3);w.Q[1+(w.X[M]<<1)]=P,P>x&&(x=P)}m+=3*A,L(w.Q,x),v(w.Q,x,w.u),y=w.w,N=w.d,m=F(w.u,(1<<x)-1,R+O,u,m,w.v);const V=g.V(w.v,0,R,w.C);U=(1<<V)-1;const K=g.V(w.v,R,O,w.D);b=(1<<K)-1,L(w.C,V),v(w.C,V,y),L(w.D,K),v(w.D,K,N)}for(;;){const x=y[_(u,m)&U];m+=15&x;const V=x>>>4;if(!(V>>>8))d[B++]=V;else{if(V==256)break;{let K=B+V-254;if(V>264){const X=w.q[V-257];K=B+(X>>>3)+I(u,m,7&X),m+=7&X}const P=N[_(u,m)&b];m+=15&P;const q=P>>>4,$=w.c[q],S=($>>>4)+k(u,m,15&$);for(m+=15&$;B<K;)d[B]=d[B++-S],d[B]=d[B++-S],d[B]=d[B++-S],d[B]=d[B++-S];B=K}}}}else{7&m&&(m+=8-(7&m));const x=4+(m>>>3),V=u[x-4]|u[x-3]<<8;p&&(d=l.H.W(d,B+V)),d.set(new f(u.buffer,u.byteOffset+x,V),B),m=x+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,N,T){const C=l.H.e,R=l.H.Z;let O=0;for(;O<f;){const A=u[R(y,N)&d];N+=15&A;const U=A>>>4;if(U<=15)T[O]=U,O++;else{let b=0,B=0;U==16?(B=3+C(y,N,2),N+=2,b=T[O-1]):U==17?(B=3+C(y,N,3),N+=3):U==18&&(B=11+C(y,N,7),N+=7);const m=O+B;for(;O<m;)T[O]=b,O++}}return N},l.H.V=function(u,d,f,y){let N=0,T=0;const C=y.length>>>1;for(;T<f;){const R=u[T+d];y[T<<1]=0,y[1+(T<<1)]=R,R>N&&(N=R),T++}for(;T<C;)y[T<<1]=0,y[1+(T<<1)]=0,T++;return N},l.H.n=function(u,d){const f=l.H.m,y=u.length;let N,T,C,R;const O=f.j;for(var A=0;A<=d;A++)O[A]=0;for(A=1;A<y;A+=2)O[u[A]]++;const U=f.K;for(N=0,O[0]=0,T=1;T<=d;T++)N=N+O[T-1]<<1,U[T]=N;for(C=0;C<y;C+=2)R=u[C+1],R!=0&&(u[C]=U[R],U[R]++)},l.H.A=function(u,d,f){const y=u.length,N=l.H.m.r;for(let T=0;T<y;T+=2)if(u[T+1]!=0){const C=T>>1,R=u[T+1],O=C<<4|R,A=d-R;let U=u[T]<<A;const b=U+(1<<A);for(;U!=b;)f[N[U]>>>15-d]=O,U++}},l.H.l=function(u,d){const f=l.H.m.r,y=15-d;for(let N=0;N<u.length;N+=2){const T=u[N]<<d-u[N+1];u[N]=f[T]>>>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,N,T){for(;N--!=0;)y.push(0,T)}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 N=i(u);const T=Math.ceil(f*N/8);let C,R;N=Math.ceil(N/8);let O=l[d],A=0;if(O>1&&(l[d]=[0,0,1][O-2]),O==3)for(A=N;A<T;A++)l[A+1]=l[A+1]+(l[A+1-N]>>>1)&255;for(let U=0;U<y;U++)if(C=d+U*T,R=C+U+1,O=l[R-1],A=0,O==0)for(;A<T;A++)l[C+A]=l[R+A];else if(O==1){for(;A<N;A++)l[C+A]=l[R+A];for(;A<T;A++)l[C+A]=l[R+A]+l[C+A-N]}else if(O==2)for(;A<T;A++)l[C+A]=l[R+A]+l[C+A-T];else if(O==3){for(;A<N;A++)l[C+A]=l[R+A]+(l[C+A-T]>>>1);for(;A<T;A++)l[C+A]=l[R+A]+(l[C+A-T]+l[C+A-N]>>>1)}else{for(;A<N;A++)l[C+A]=l[R+A]+a(0,l[C+A-T],0);for(;A<T;A++)l[C+A]=l[R+A]+a(l[C+A-N],l[C+A-T],l[C+A-N-T])}return l}function a(l,u,d){const f=l+u-d,y=f-l,N=f-u,T=f-d;return y*y<=N*N&&y*y<=T*T?l:N*N<=T*T?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,N,T,C,R){const O=Math.min(u,y),A=Math.min(d,N);let U=0,b=0;for(let _=0;_<A;_++)for(let w=0;w<O;w++)if(T>=0&&C>=0?(U=_*u+w<<2,b=(C+_)*y+T+w<<2):(U=(-C+_)*u-T+w<<2,b=_*y+w<<2),R==0)f[b]=l[U],f[b+1]=l[U+1],f[b+2]=l[U+2],f[b+3]=l[U+3];else if(R==1){var B=l[U+3]*.00392156862745098,m=l[U]*B,g=l[U+1]*B,k=l[U+2]*B,I=f[b+3]*(1/255),F=f[b]*I,L=f[b+1]*I,v=f[b+2]*I;const p=1-B,M=B+I*p,x=M==0?0:1/M;f[b+3]=255*M,f[b+0]=(m+F*p)*x,f[b+1]=(g+L*p)*x,f[b+2]=(k+v*p)*x}else if(R==2)B=l[U+3],m=l[U],g=l[U+1],k=l[U+2],I=f[b+3],F=f[b],L=f[b+1],v=f[b+2],B==I&&m==F&&g==L&&k==v?(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]=k,f[b+3]=B);else if(R==3){if(B=l[U+3],m=l[U],g=l[U+1],k=l[U+2],I=f[b+3],F=f[b],L=f[b+1],v=f[b+2],B==I&&m==F&&g==L&&k==v)continue;if(B<220&&I>20)return!1}return!0}return{decode:function(u){const d=new Uint8Array(u);let f=8;const y=s,N=y.readUshort,T=y.readUint,C={tabs:{},frames:[]},R=new Uint8Array(d.length);let O,A=0,U=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 _=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+_);let M=null;try{M=r(p)}catch{M=n(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<_;B++)R[A+B]=d[f+B];A+=_}else if(w=="acTL")C.tabs[w]={num_frames:T(d,f),num_plays:T(d,f+4)},O=new Uint8Array(d.length);else if(w=="fcTL"){U!=0&&((v=C.frames[C.frames.length-1]).data=t(C,O.slice(0,U),v.rect.width,v.rect.height),U=0);const p={x:T(d,f+12),y:T(d,f+16),width:T(d,f+4),height:T(d,f+8)};let M=N(d,f+22);M=N(d,f+20)/(M==0?100:M);const x={rect:p,delay:Math.round(1e3*M),dispose:d[f+24],blend:d[f+25]};C.frames.push(x)}else if(w=="fdAT"){for(B=0;B<_-4;B++)O[U+B]=d[f+B+4];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),k=y.readASCII(d,f,g-f),I=f+_-g-1;if(w=="tEXt")L=y.readASCII(d,g+1,I);else{var F=r(d.slice(g+2,g+2+I));L=y.readUTF8(F,0,F.length)}C.tabs[w][k]=L}else if(w=="iTXt"){C.tabs[w]==null&&(C.tabs[w]={}),g=0,m=f,g=y.nextZero(d,m),k=y.readASCII(d,m,g-m);const p=d[m=g+1];var L;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),I=_-((m=g+1)-f),p==0?L=y.readUTF8(d,m,I):(F=r(d.slice(m,m+I)),L=y.readUTF8(F,0,F.length)),C.tabs[w][k]=L}else if(w=="PLTE")C.tabs[w]=y.readBytes(d,f,_);else if(w=="hIST"){const p=C.tabs.PLTE.length/3;for(C.tabs[w]=[],B=0;B<p;B++)C.tabs[w].push(N(d,f+2*B))}else if(w=="tRNS")C.ctype==3?C.tabs[w]=y.readBytes(d,f,_):C.ctype==0?C.tabs[w]=N(d,f):C.ctype==2&&(C.tabs[w]=[N(d,f),N(d,f+2),N(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]=[N(d,f)]:C.ctype==2||C.ctype==6?C.tabs[w]=[N(d,f),N(d,f+2),N(d,f+4)]:C.ctype==3&&(C.tabs[w]=d[f]);else if(w=="IEND")break;f+=_,y.readUint(d,f),f+=4}var v;return U!=0&&((v=C.frames[C.frames.length-1]).data=t(C,O.slice(0,U),v.rect.width,v.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 N=d*f*4,T=new Uint8Array(N),C=new Uint8Array(N),R=new Uint8Array(N);for(let A=0;A<u.frames.length;A++){const U=u.frames[A],b=U.rect.x,B=U.rect.y,m=U.rect.width,g=U.rect.height,k=e(U.data,m,g,u);if(A!=0)for(var O=0;O<N;O++)R[O]=T[O];if(U.blend==0?h(k,m,g,T,d,f,b,B,0):U.blend==1&&h(k,m,g,T,d,f,b,B,1),y.push(T.buffer.slice(0)),U.dispose!=0){if(U.dispose==1)h(C,m,g,T,d,f,b,B,0);else if(U.dispose==2)for(O=0;O<N;O++)T[O]=R[O]}}return y},_paeth:a,_copyTile:h,_bin:s}}();(function(){const{_copyTile:s}=Ye,{_bin:e}=Ye,t=Ye._paeth;var r={table:function(){const m=new Uint32Array(256);for(let g=0;g<256;g++){let k=g;for(let I=0;I<8;I++)1&k?k=3988292384^k>>>1:k>>>=1;m[g]=k}return m}(),update(m,g,k,I){for(let F=0;F<I;F++)m=r.table[255&(m^g[k+F])]^m>>>8;return m},crc:(m,g,k)=>4294967295^r.update(4294967295,m,g,k)};function n(m,g,k,I){g[k]+=m[0]*I>>4,g[k+1]+=m[1]*I>>4,g[k+2]+=m[2]*I>>4,g[k+3]+=m[3]*I>>4}function i(m){return Math.max(0,Math.min(255,m))}function o(m,g){const k=m[0]-g[0],I=m[1]-g[1],F=m[2]-g[2],L=m[3]-g[3];return k*k+I*I+F*F+L*L}function a(m,g,k,I,F,L,v){v==null&&(v=1);const _=I.length,w=[];for(var p=0;p<_;p++){const S=I[p];w.push([S>>>0&255,S>>>8&255,S>>>16&255,S>>>24&255])}for(p=0;p<_;p++){let S=4294967295;for(var M=0,x=0;x<_;x++){var V=o(w[p],w[x]);x!=p&&V<S&&(S=V,M=x)}}const K=new Uint32Array(F.buffer),P=new Int16Array(g*k*4),q=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(p=0;p<q.length;p++)q[p]=255*((q[p]+.5)/16-.5);for(let S=0;S<k;S++)for(let X=0;X<g;X++){var $;p=4*(S*g+X),v!=2?$=[i(m[p]+P[p]),i(m[p+1]+P[p+1]),i(m[p+2]+P[p+2]),i(m[p+3]+P[p+3])]:(V=q[4*(3&S)+(3&X)],$=[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(x=0;x<_;x++){const ae=o($,w[x]);ae<ce&&(ce=ae,M=x)}const te=w[M],Y=[$[0]-te[0],$[1]-te[1],$[2]-te[2],$[3]-te[3]];v==1&&(X!=g-1&&n(Y,P,p+4,7),S!=k-1&&(X!=0&&n(Y,P,p+4*g-4,3),n(Y,P,p+4*g,5),X!=g-1&&n(Y,P,p+4*g+4,1))),L[p>>2]=M,K[p>>2]=I[M]}}function c(m,g,k,I,F){F==null&&(F={});const{crc:L}=r,v=e.writeUint,_=e.writeUshort,w=e.writeASCII;let p=8;const M=m.frames.length>1;let x,V=!1,K=33+(M?20:0);if(F.sRGB!=null&&(K+=13),F.pHYs!=null&&(K+=21),F.iCCP!=null&&(x=pako.deflate(F.iCCP),K+=21+x.length+4),m.ctype==3){for(var P=m.plte.length,q=0;q<P;q++)m.plte[q]>>>24!=255&&(V=!0);K+=8+3*P+4+(V?8+1*P+4:0)}for(var $=0;$<m.frames.length;$++)M&&(K+=38),K+=(te=m.frames[$]).cimg.length+12,$!=0&&(K+=4);K+=12;const S=new Uint8Array(K),X=[137,80,78,71,13,10,26,10];for(q=0;q<8;q++)S[q]=X[q];if(v(S,p,13),p+=4,w(S,p,"IHDR"),p+=4,v(S,p,g),p+=4,v(S,p,k),p+=4,S[p]=m.depth,p++,S[p]=m.ctype,p++,S[p]=0,p++,S[p]=0,p++,S[p]=0,p++,v(S,p,L(S,p-17,17)),p+=4,F.sRGB!=null&&(v(S,p,1),p+=4,w(S,p,"sRGB"),p+=4,S[p]=F.sRGB,p++,v(S,p,L(S,p-5,5)),p+=4),F.iCCP!=null){const Y=13+x.length;v(S,p,Y),p+=4,w(S,p,"iCCP"),p+=4,w(S,p,"ICC profile"),p+=11,p+=2,S.set(x,p),p+=x.length,v(S,p,L(S,p-(Y+4),Y+4)),p+=4}if(F.pHYs!=null&&(v(S,p,9),p+=4,w(S,p,"pHYs"),p+=4,v(S,p,F.pHYs[0]),p+=4,v(S,p,F.pHYs[1]),p+=4,S[p]=F.pHYs[2],p++,v(S,p,L(S,p-13,13)),p+=4),M&&(v(S,p,8),p+=4,w(S,p,"acTL"),p+=4,v(S,p,m.frames.length),p+=4,v(S,p,F.loop!=null?F.loop:0),p+=4,v(S,p,L(S,p-12,12)),p+=4),m.ctype==3){for(v(S,p,3*(P=m.plte.length)),p+=4,w(S,p,"PLTE"),p+=4,q=0;q<P;q++){const Y=3*q,ae=m.plte[q],we=255&ae,Fe=ae>>>8&255,At=ae>>>16&255;S[p+Y+0]=we,S[p+Y+1]=Fe,S[p+Y+2]=At}if(p+=3*P,v(S,p,L(S,p-3*P-4,3*P+4)),p+=4,V){for(v(S,p,P),p+=4,w(S,p,"tRNS"),p+=4,q=0;q<P;q++)S[p+q]=m.plte[q]>>>24&255;p+=P,v(S,p,L(S,p-P-4,P+4)),p+=4}}let ce=0;for($=0;$<m.frames.length;$++){var te=m.frames[$];M&&(v(S,p,26),p+=4,w(S,p,"fcTL"),p+=4,v(S,p,ce++),p+=4,v(S,p,te.rect.width),p+=4,v(S,p,te.rect.height),p+=4,v(S,p,te.rect.x),p+=4,v(S,p,te.rect.y),p+=4,_(S,p,I[$]),p+=2,_(S,p,1e3),p+=2,S[p]=te.dispose,p++,S[p]=te.blend,p++,v(S,p,L(S,p-30,30)),p+=4);const Y=te.cimg;v(S,p,(P=Y.length)+($==0?0:4)),p+=4;const ae=p;w(S,p,$==0?"IDAT":"fdAT"),p+=4,$!=0&&(v(S,p,ce++),p+=4),S.set(Y,p),p+=P,v(S,p,L(S,ae,p-ae)),p+=4}return v(S,p,0),p+=4,w(S,p,"IEND"),p+=4,v(S,p,L(S,p-4,4)),p+=4,S.buffer}function h(m,g,k){for(let I=0;I<m.frames.length;I++){const F=m.frames[I];F.rect.width;const L=F.rect.height,v=new Uint8Array(L*F.bpl+L);F.cimg=f(F.img,L,F.bpp,F.bpl,v,g,k)}}function l(m,g,k,I,F){const L=F[0],v=F[1],_=F[2],w=F[3],p=F[4],M=F[5];let x=6,V=8,K=255;for(var P=0;P<m.length;P++){const Le=new Uint8Array(m[P]);for(var q=Le.length,$=0;$<q;$+=4)K&=Le[$+3]}const S=K!=255,X=function(de,re,Ce,Ue,Ee,xe){const ye=[];for(var ee=0;ee<de.length;ee++){const _e=new Uint8Array(de[ee]),We=new Uint32Array(_e.buffer);var $e;let De=0,Me=0,ot=re,gt=Ce,Yt=Ue?1:0;if(ee!=0){const _n=xe||Ue||ee==1||ye[ee-2].dispose!=0?1:2;let en=0,ue=1e9;for(let Ke=0;Ke<_n;Ke++){var Re=new Uint8Array(de[ee-1-Ke]);const wt=new Uint32Array(de[ee-1-Ke]);let Ut=re,xt=Ce,tn=-1,un=-1;for(let Vt=0;Vt<Ce;Vt++)for(let Ht=0;Ht<re;Ht++)We[Ie=Vt*re+Ht]!=wt[Ie]&&(Ht<Ut&&(Ut=Ht),Ht>tn&&(tn=Ht),Vt<xt&&(xt=Vt),Vt>un&&(un=Vt));tn==-1&&(Ut=xt=tn=un=0),Ee&&((1&Ut)==1&&Ut--,(1&xt)==1&&xt--);const ni=(tn-Ut+1)*(un-xt+1);ni<ue&&(ue=ni,en=Ke,De=Ut,Me=xt,ot=tn-Ut+1,gt=un-xt+1)}Re=new Uint8Array(de[ee-1-en]),en==1&&(ye[ee-1].dispose=2),$e=new Uint8Array(ot*gt*4),s(Re,re,Ce,$e,ot,gt,-De,-Me,0),Yt=s(_e,re,Ce,$e,ot,gt,-De,-Me,3)?1:0,Yt==1?d(_e,re,Ce,$e,{x:De,y:Me,width:ot,height:gt}):s(_e,re,Ce,$e,ot,gt,-De,-Me,0)}else $e=_e.slice(0);ye.push({rect:{x:De,y:Me,width:ot,height:gt},img:$e,blend:Yt,dispose:0})}if(Ue)for(ee=0;ee<ye.length;ee++){if((mt=ye[ee]).blend==1)continue;const _e=mt.rect,We=ye[ee-1].rect,De=Math.min(_e.x,We.x),Me=Math.min(_e.y,We.y),ot={x:De,y:Me,width:Math.max(_e.x+_e.width,We.x+We.width)-De,height:Math.max(_e.y+_e.height,We.y+We.height)-Me};ye[ee-1].dispose=1,ee-1!=0&&u(de,re,Ce,ye,ee-1,ot,Ee),u(de,re,Ce,ye,ee,ot,Ee)}let pt=0;if(de.length!=1)for(var Ie=0;Ie<ye.length;Ie++){var mt;pt+=(mt=ye[Ie]).rect.width*mt.rect.height}return ye}(m,g,k,L,v,_),ce={},te=[],Y=[];if(I!=0){const Le=[];for($=0;$<X.length;$++)Le.push(X[$].img.buffer);const de=function(Ee){let xe=0;for(var ye=0;ye<Ee.length;ye++)xe+=Ee[ye].byteLength;const ee=new Uint8Array(xe);let $e=0;for(ye=0;ye<Ee.length;ye++){const Re=new Uint8Array(Ee[ye]),pt=Re.length;for(let Ie=0;Ie<pt;Ie+=4){let mt=Re[Ie],_e=Re[Ie+1],We=Re[Ie+2];const De=Re[Ie+3];De==0&&(mt=_e=We=0),ee[$e+Ie]=mt,ee[$e+Ie+1]=_e,ee[$e+Ie+2]=We,ee[$e+Ie+3]=De}$e+=pt}return ee.buffer}(Le),re=N(de,I);for($=0;$<re.plte.length;$++)te.push(re.plte[$].est.rgba);let Ce=0;for($=0;$<X.length;$++){const Ue=(we=X[$]).img.length;var ae=new Uint8Array(re.inds.buffer,Ce>>2,Ue>>2);Y.push(ae);const Ee=new Uint8Array(re.abuf,Ce,Ue);M&&a(we.img,we.rect.width,we.rect.height,te,Ee,ae),we.img.set(Ee),Ce+=Ue}}else for(P=0;P<X.length;P++){var we=X[P];const Le=new Uint32Array(we.img.buffer);var Fe=we.rect.width;for(q=Le.length,ae=new Uint8Array(q),Y.push(ae),$=0;$<q;$++){const de=Le[$];if($!=0&&de==Le[$-1])ae[$]=ae[$-1];else if($>Fe&&de==Le[$-Fe])ae[$]=ae[$-Fe];else{let re=ce[de];if(re==null&&(ce[de]=re=te.length,te.push(de),te.length>=300))break;ae[$]=re}}}const At=te.length;for(At<=256&&p==0&&(V=At<=2?1:At<=4?2:At<=16?4:8,V=Math.max(V,w)),P=0;P<X.length;P++){(we=X[P]).rect.x,we.rect.y,Fe=we.rect.width;const Le=we.rect.height;let de=we.img;new Uint32Array(de.buffer);let re=4*Fe,Ce=4;if(At<=256&&p==0){re=Math.ceil(V*Fe/8);var Ze=new Uint8Array(re*Le);const Ue=Y[P];for(let Ee=0;Ee<Le;Ee++){$=Ee*re;const xe=Ee*Fe;if(V==8)for(var me=0;me<Fe;me++)Ze[$+me]=Ue[xe+me];else if(V==4)for(me=0;me<Fe;me++)Ze[$+(me>>1)]|=Ue[xe+me]<<4-4*(1&me);else if(V==2)for(me=0;me<Fe;me++)Ze[$+(me>>2)]|=Ue[xe+me]<<6-2*(3&me);else if(V==1)for(me=0;me<Fe;me++)Ze[$+(me>>3)]|=Ue[xe+me]<<7-1*(7&me)}de=Ze,x=3,Ce=1}else if(S==0&&X.length==1){Ze=new Uint8Array(Fe*Le*3);const Ue=Fe*Le;for($=0;$<Ue;$++){const Ee=3*$,xe=4*$;Ze[Ee]=de[xe],Ze[Ee+1]=de[xe+1],Ze[Ee+2]=de[xe+2]}de=Ze,x=2,Ce=3,re=3*Fe}we.img=de,we.bpl=re,we.bpp=Ce}return{ctype:x,depth:V,plte:te,frames:X}}function u(m,g,k,I,F,L,v){const _=Uint8Array,w=Uint32Array,p=new _(m[F-1]),M=new w(m[F-1]),x=F+1<m.length?new _(m[F+1]):null,V=new _(m[F]),K=new w(V.buffer);let P=g,q=k,$=-1,S=-1;for(let ce=0;ce<L.height;ce++)for(let te=0;te<L.width;te++){const Y=L.x+te,ae=L.y+ce,we=ae*g+Y,Fe=K[we];Fe==0||I[F-1].dispose==0&&M[we]==Fe&&(x==null||x[4*we+3]!=0)||(Y<P&&(P=Y),Y>$&&($=Y),ae<q&&(q=ae),ae>S&&(S=ae))}$==-1&&(P=q=$=S=0),v&&((1&P)==1&&P--,(1&q)==1&&q--),L={x:P,y:q,width:$-P+1,height:S-q+1};const X=I[F];X.rect=L,X.blend=1,X.img=new Uint8Array(L.width*L.height*4),I[F-1].dispose==0?(s(p,g,k,X.img,L.width,L.height,-L.x,-L.y,0),d(V,g,k,X.img,L)):s(V,g,k,X.img,L.width,L.height,-L.x,-L.y,0)}function d(m,g,k,I,F){s(m,g,k,I,F.width,F.height,-F.x,-F.y,2)}function f(m,g,k,I,F,L,v){const _=[];let w,p=[0,1,2,3,4];L!=-1?p=[L]:(g*I>5e5||k==1)&&(p=[0]),v&&(w={level:0});const M=Vs;for(var x=0;x<p.length;x++){for(let P=0;P<g;P++)y(F,m,P,I,k,p[x]);_.push(M.deflate(F,w))}let V,K=1e9;for(x=0;x<_.length;x++)_[x].length<K&&(V=x,K=_[x].length);return _[V]}function y(m,g,k,I,F,L){const v=k*I;let _=v+k;if(m[_]=L,_++,L==0)if(I<500)for(var w=0;w<I;w++)m[_+w]=g[v+w];else m.set(new Uint8Array(g.buffer,v,I),_);else if(L==1){for(w=0;w<F;w++)m[_+w]=g[v+w];for(w=F;w<I;w++)m[_+w]=g[v+w]-g[v+w-F]+256&255}else if(k==0){for(w=0;w<F;w++)m[_+w]=g[v+w];if(L==2)for(w=F;w<I;w++)m[_+w]=g[v+w];if(L==3)for(w=F;w<I;w++)m[_+w]=g[v+w]-(g[v+w-F]>>1)+256&255;if(L==4)for(w=F;w<I;w++)m[_+w]=g[v+w]-t(g[v+w-F],0,0)+256&255}else{if(L==2)for(w=0;w<I;w++)m[_+w]=g[v+w]+256-g[v+w-I]&255;if(L==3){for(w=0;w<F;w++)m[_+w]=g[v+w]+256-(g[v+w-I]>>1)&255;for(w=F;w<I;w++)m[_+w]=g[v+w]+256-(g[v+w-I]+g[v+w-F]>>1)&255}if(L==4){for(w=0;w<F;w++)m[_+w]=g[v+w]+256-t(0,g[v+w-I],0)&255;for(w=F;w<I;w++)m[_+w]=g[v+w]+256-t(g[v+w-F],g[v+w-I],g[v+w-F-I])&255}}}function N(m,g){const k=new Uint8Array(m),I=k.slice(0),F=new Uint32Array(I.buffer),L=T(I,g),v=L[0],_=L[1],w=k.length,p=new Uint8Array(w>>2);let M;if(k.length<2e7)for(var x=0;x<w;x+=4)M=C(v,V=k[x]*(1/255),K=k[x+1]*(1/255),P=k[x+2]*(1/255),q=k[x+3]*(1/255)),p[x>>2]=M.ind,F[x>>2]=M.est.rgba;else for(x=0;x<w;x+=4){var V=k[x]*.00392156862745098,K=k[x+1]*(1/255),P=k[x+2]*(1/255),q=k[x+3]*(1/255);for(M=v;M.left;)M=R(M.est,V,K,P,q)<=0?M.left:M.right;p[x>>2]=M.ind,F[x>>2]=M.est.rgba}return{abuf:I.buffer,inds:p,plte:_}}function T(m,g,k){k==null&&(k=1e-4);const I=new Uint32Array(m.buffer),F={i0:0,i1:m.length,bst:null,est:null,tdst:0,left:null,right:null};F.bst=U(m,F.i0,F.i1),F.est=b(F.bst);const L=[F];for(;L.length<g;){let _=0,w=0;for(var v=0;v<L.length;v++)L[v].est.L>_&&(_=L[v].est.L,w=v);if(_<k)break;const p=L[w],M=O(m,I,p.i0,p.i1,p.est.e,p.est.eMq255);if(p.i0>=M||p.i1<=M){p.est.L=0;continue}const x={i0:p.i0,i1:M,bst:null,est:null,tdst:0,left:null,right:null};x.bst=U(m,x.i0,x.i1),x.est=b(x.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-x.bst.N},v=0;v<16;v++)V.bst.R[v]=p.bst.R[v]-x.bst.R[v];for(v=0;v<4;v++)V.bst.m[v]=p.bst.m[v]-x.bst.m[v];V.est=b(V.bst),p.left=x,p.right=V,L[w]=x,L.push(V)}for(L.sort((_,w)=>w.bst.N-_.bst.N),v=0;v<L.length;v++)L[v].ind=v;return[F,L]}function C(m,g,k,I,F){if(m.left==null)return m.tdst=function(x,V,K,P,q){const $=V-x[0],S=K-x[1],X=P-x[2],ce=q-x[3];return $*$+S*S+X*X+ce*ce}(m.est.q,g,k,I,F),m;const L=R(m.est,g,k,I,F);let v=m.left,_=m.right;L>0&&(v=m.right,_=m.left);const w=C(v,g,k,I,F);if(w.tdst<=L*L)return w;const p=C(_,g,k,I,F);return p.tdst<w.tdst?p:w}function R(m,g,k,I,F){const{e:L}=m;return L[0]*g+L[1]*k+L[2]*I+L[3]*F-m.eMq}function O(m,g,k,I,F,L){for(I-=4;k<I;){for(;A(m,k,F)<=L;)k+=4;for(;A(m,I,F)>L;)I-=4;if(k>=I)break;const v=g[k>>2];g[k>>2]=g[I>>2],g[I>>2]=v,k+=4,I-=4}for(;A(m,k,F)>L;)k-=4;return k+4}function A(m,g,k){return m[g]*k[0]+m[g+1]*k[1]+m[g+2]*k[2]+m[g+3]*k[3]}function U(m,g,k){const I=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],F=[0,0,0,0],L=k-g>>2;for(let v=g;v<k;v+=4){const _=m[v]*.00392156862745098,w=m[v+1]*(1/255),p=m[v+2]*(1/255),M=m[v+3]*(1/255);F[0]+=_,F[1]+=w,F[2]+=p,F[3]+=M,I[0]+=_*_,I[1]+=_*w,I[2]+=_*p,I[3]+=_*M,I[5]+=w*w,I[6]+=w*p,I[7]+=w*M,I[10]+=p*p,I[11]+=p*M,I[15]+=M*M}return I[4]=I[1],I[8]=I[2],I[9]=I[6],I[12]=I[3],I[13]=I[7],I[14]=I[11],{R:I,m:F,N:L}}function b(m){const{R:g}=m,{m:k}=m,{N:I}=m,F=k[0],L=k[1],v=k[2],_=k[3],w=I==0?0:1/I,p=[g[0]-F*F*w,g[1]-F*L*w,g[2]-F*v*w,g[3]-F*_*w,g[4]-L*F*w,g[5]-L*L*w,g[6]-L*v*w,g[7]-L*_*w,g[8]-v*F*w,g[9]-v*L*w,g[10]-v*v*w,g[11]-v*_*w,g[12]-_*F*w,g[13]-_*L*w,g[14]-_*v*w,g[15]-_*_*w],M=p,x=B;let V=[Math.random(),Math.random(),Math.random(),Math.random()],K=0,P=0;if(I!=0)for(let $=0;$<16&&(V=x.multVec(M,V),P=Math.sqrt(x.dot(V,V)),V=x.sml(1/P,V),!($!=0&&Math.abs(P-K)<1e-9));$++)K=P;const q=[F*w,L*w,v*w,_*w];return{Cov:p,q,e:V,L:K,eMq255:x.dot(x.sml(255,q),V),eMq:x.dot(V,q),rgba:(Math.round(255*q[3])<<24|Math.round(255*q[2])<<16|Math.round(255*q[1])<<8|Math.round(255*q[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,k,I,F,L,v,_){F==null&&(F=0),_==null&&(_=!1);const w=l(g,k,I,F,[!1,!1,!1,0,_,!1]);return h(w,-1),c(w,k,I,L,v)},Ye.encodeLL=function(g,k,I,F,L,v,_,w){const p={ctype:0+(F==1?0:2)+(L==0?0:4),depth:v,frames:[]},M=(F+L)*v,x=M*k;for(let V=0;V<g.length;V++)p.frames.push({rect:{x:0,y:0,width:k,height:I},img:new Uint8Array(g[V]),blend:0,dispose:1,bpp:Math.ceil(M/8),bpl:Math.ceil(x/8)});return h(p,0,!0),c(p,k,I,_,w)},Ye.encode.compress=l,Ye.encode.dither=a,Ye.quantize=N,Ye.quantize.getKDtree=T,Ye.quantize.getNearest=C})();const Hr={toArrayBuffer(s,e){const t=s.width,r=s.height,n=t<<2,i=s.getContext("2d").getImageData(0,0,t,r),o=new Uint32Array(i.data.buffer),a=(32*t+31)/32<<2,c=a*r,h=122+c,l=new ArrayBuffer(h),u=new DataView(l),d=1<<20;let f,y,N,T,C=d,R=0,O=0,A=0;function U(m){u.setUint16(O,m,!0),O+=2}function b(m){u.setUint32(O,m,!0),O+=4}function B(m){O+=m}U(19778),b(h),B(4),b(122),b(108),b(t),b(-r>>>0),U(1),U(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<r&&C>0;){for(T=122+R*a,f=0;f<n;)C--,y=o[A++],N=y>>>24,u.setUint32(T+f,y<<8|N),f+=4;R++}A<o.length?(C=d,setTimeout(m,Hr._dly)):e(l)}()},toBlob(s,e){this.toArrayBuffer(s,t=>{e(new Blob([t],{type:"image/bmp"}))})},_dly:9};var Pe={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Hs={[Pe.CHROME]:16384,[Pe.FIREFOX]:11180,[Pe.DESKTOP_SAFARI]:16384,[Pe.IE]:8192,[Pe.IOS]:4096,[Pe.ETC]:8192};const Jn=typeof window<"u",$r=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Fn=Jn&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),$s=(Jn||$r)&&(Fn&&Fn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Pr=(Jn||$r)&&(Fn&&Fn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Qn(s,e,t=Date.now()){return new Promise(r=>{const n=s.split(","),i=n[0].match(/:(.*?);/)[1],o=globalThis.atob(n[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,r(h)})}function Wr(s){return new Promise((e,t)=>{const r=new Pr;r.onload=()=>e(r.result),r.onerror=n=>t(n),r.readAsDataURL(s)})}function jr(s){return new Promise((e,t)=>{const r=new Image;r.onload=()=>e(r),r.onerror=n=>t(n),r.src=s})}function Ot(){if(Ot.cachedResult!==void 0)return Ot.cachedResult;let s=Pe.ETC;const{userAgent:e}=navigator;return/Chrom(e|ium)/i.test(e)?s=Pe.CHROME:/iP(ad|od|hone)/i.test(e)&&/WebKit/i.test(e)?s=Pe.IOS:/Safari/i.test(e)?s=Pe.DESKTOP_SAFARI:/Firefox/i.test(e)?s=Pe.FIREFOX:(/MSIE/i.test(e)||document.documentMode)&&(s=Pe.IE),Ot.cachedResult=s,Ot.cachedResult}function qr(s,e){const t=Ot(),r=Hs[t];let n=s,i=e,o=n*i;const a=n>i?i/n:n/i;for(;o>r*r;){const c=(r+n)/2,h=(r+i)/2;c<h?(i=h,n=h*a):(i=c*a,n=c),o=n*i}return{width:n,height:i}}function Nn(s,e){let t,r;try{if(t=new OffscreenCanvas(s,e),r=t.getContext("2d"),r===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{t=document.createElement("canvas"),r=t.getContext("2d")}return t.width=s,t.height=e,[t,r]}function Zr(s,e){const{width:t,height:r}=qr(s.width,s.height),[n,i]=Nn(t,r);return e&&/jpe?g/.test(e)&&(i.fillStyle="white",i.fillRect(0,0,n.width,n.height)),i.drawImage(s,0,0,n.width,n.height),n}function In(){return In.cachedResult!==void 0||(In.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),In.cachedResult}function Tn(s,e={}){return new Promise(function(t,r){let n,i;var o=function(){try{return i=Zr(n,e.fileType||s.type),t([n,i])}catch(c){return r(c)}},a=function(c){try{var h=function(l){try{throw l}catch(u){return r(u)}};try{let l;return Wr(s).then(function(u){try{return l=u,jr(l).then(function(d){try{return n=d,function(){try{return o()}catch(f){return r(f)}}()}catch(f){return h(f)}},h)}catch(d){return h(d)}},h)}catch(l){h(l)}}catch(l){return r(l)}};try{if(In()||[Pe.DESKTOP_SAFARI,Pe.MOBILE_SAFARI].includes(Ot()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(s).then(function(c){try{return n=c,o()}catch{return a()}},a)}catch{a()}})}function Ln(s,e,t,r,n=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*n),a=new Blob([u],{type:e}),a.name=t,a.lastModified=r,c.call(this)}{let h=function(){return c.call(this)};if(e==="image/bmp")return new Promise(l=>Hr.toBlob(s,l)).then((function(l){try{return a=l,a.name=t,a.lastModified=r,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:n}).then((function(u){try{return a=u,a.name=t,a.lastModified=r,l.call(this)}catch(d){return o(d)}}).bind(this),o);{let u;return u=s.toDataURL(e,n),Qn(u,t,r).then((function(d){try{return a=d,l.call(this)}catch(f){return o(f)}}).bind(this),o)}}}function c(){return i(a)}})}function lt(s){s.width=0,s.height=0}function Pt(){return new Promise(function(s,e){let t,r,n,i;return Pt.cachedResult!==void 0?s(Pt.cachedResult):Qn("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then(function(o){try{return t=o,Tn(t).then(function(a){try{return r=a[1],Ln(r,t.type,t.name,t.lastModified).then(function(c){try{return n=c,lt(r),Tn(n).then(function(h){try{return i=h[0],Pt.cachedResult=i.width===1&&i.height===2,s(Pt.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 Kr(s){return new Promise((e,t)=>{const r=new Pr;r.onload=n=>{const i=new DataView(n.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)},r.onerror=n=>t(n),r.readAsArrayBuffer(s)})}function zr(s,e){const{width:t}=s,{height:r}=s,{maxWidthOrHeight:n}=e;let i,o=s;return isFinite(n)&&(t>n||r>n)&&([o,i]=Nn(t,r),t>r?(o.width=n,o.height=r/t*n):(o.width=t/r*n,o.height=n),i.drawImage(s,0,0,o.width,o.height),lt(s)),o}function Xr(s,e){const{width:t}=s,{height:r}=s,[n,i]=Nn(t,r);switch(e>4&&e<9?(n.width=r,n.height=t):(n.width=t,n.height=r),e){case 2:i.transform(-1,0,0,1,t,0);break;case 3:i.transform(-1,0,0,-1,t,r);break;case 4:i.transform(1,0,0,-1,0,r);break;case 5:i.transform(0,1,1,0,0,0);break;case 6:i.transform(0,1,-1,0,r,0);break;case 7:i.transform(0,-1,-1,0,r,t);break;case 8:i.transform(0,-1,1,0,0,t)}return i.drawImage(s,0,0,t,r),lt(s),n}function Gr(s,e,t=0){return new Promise(function(r,n){let i,o,a,c,h,l,u,d,f,y,N,T,C,R,O,A,U,b,B,m;function g(I=5){if(e.signal&&e.signal.aborted)throw e.signal.reason;i+=I,e.onProgress(Math.min(i,100))}function k(I){if(e.signal&&e.signal.aborted)throw e.signal.reason;i=Math.min(Math.max(I,i),100),e.onProgress(i)}return i=t,o=e.maxIteration||10,a=1024*e.maxSizeMB*1024,g(),Tn(s,e).then((function(I){try{return[,c]=I,g(),h=zr(c,e),g(),new Promise(function(F,L){var v;if(!(v=e.exifOrientation))return Kr(s).then((function(w){try{return v=w,_.call(this)}catch(p){return L(p)}}).bind(this),L);function _(){return F(v)}return _.call(this)}).then((function(F){try{return l=F,g(),Pt().then((function(L){try{return u=L?h:Xr(h,l),g(),d=e.initialQuality||1,f=e.fileType||s.type,Ln(u,f,s.name,s.lastModified,d).then((function(v){try{{let w=function(){if(o--&&(O>a||O>C)){let M,x;return M=m?.95*B.width:B.width,x=m?.95*B.height:B.height,[U,b]=Nn(M,x),b.drawImage(B,0,0,M,x),d*=f==="image/png"?.85:.95,Ln(U,f,s.name,s.lastModified,d).then(function(V){try{return A=V,lt(B),B=U,O=A.size,k(Math.min(99,Math.floor((R-O)/(R-a)*100))),w}catch(K){return n(K)}},n)}return[1]},p=function(){return lt(B),lt(U),lt(h),lt(u),lt(c),k(100),r(A)};if(y=v,g(),N=y.size>a,T=y.size>s.size,!N&&!T)return k(100),r(y);var _;return C=s.size,R=y.size,O=R,B=u,m=!e.alwaysKeepResolution&&N,(_=(function(M){for(;M;){if(M.then)return void M.then(_,n);try{if(M.pop){if(M.length)return M.pop()?p.call(this):M;M=w}else M=M.call(this)}catch(x){return n(x)}}}).bind(this))(w)}}catch(w){return n(w)}}).bind(this),n)}catch(v){return n(v)}}).bind(this),n)}catch(L){return n(L)}}).bind(this),n)}catch(F){return n(F)}}).bind(this),n)})}const Ps=`
|
|
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 Gn;function Hs(s,e){return new Promise((t,r)=>{Gn||(Gn=function(o){const a=[];return a.push(o),URL.createObjectURL(new Blob(a))}(Vs));const n=new Worker(Gn);n.addEventListener("message",function(o){if(e.signal&&e.signal.aborted)n.terminate();else if(o.data.progress===void 0){if(o.data.error)return r(new Error(o.data.error)),void n.terminate();t(o.data.file),n.terminate()}else e.onProgress(o.data.progress)}),n.addEventListener("error",r),e.signal&&e.signal.addEventListener("abort",()=>{r(e.signal.reason),n.terminate()}),n.postMessage({file:s,imageCompressionLibUrl:e.libURL,options:{...e,onProgress:void 0,signal:void 0}})})}function Se(s,e){return new Promise(function(t,r){let n,i,o,a,c,d;if(n={...e},o=0,{onProgress:a}=n,n.maxSizeMB=n.maxSizeMB||Number.POSITIVE_INFINITY,c=typeof n.useWebWorker!="boolean"||n.useWebWorker,delete n.useWebWorker,n.onProgress=f=>{o=f,typeof a=="function"&&a(o)},!(s instanceof Blob||s instanceof Ms))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(s.type))return r(new Error("The file given is not an image"));if(d=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!c||typeof Worker!="function"||d)return Kr(s,n).then((function(f){try{return i=f,h.call(this)}catch(y){return r(y)}}).bind(this),r);var l=(function(){try{return h.call(this)}catch(f){return r(f)}}).bind(this),u=function(f){try{return Kr(s,n).then(function(y){try{return i=y,l()}catch(k){return r(k)}},r)}catch(y){return r(y)}};try{return n.libURL=n.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Hs(s,n).then(function(f){try{return i=f,l()}catch{return u()}},u)}catch{u()}function h(){try{i.name=s.name,i.lastModified=s.lastModified}catch{}try{n.preserveExif&&s.type==="image/jpeg"&&(!n.fileType||n.fileType&&n.fileType===s.type)&&(i=Rr(s,i))}catch{}return t(i)}})}Se.getDataUrlFromFile=Hr,Se.getFilefromDataUrl=Xn,Se.loadImage=$r,Se.drawImageInCanvas=Wr,Se.drawFileInCanvas=In,Se.canvasToFile=Tn,Se.getExifOrientation=jr,Se.handleMaxWidthOrHeight=qr,Se.followExifOrientation=Zr,Se.cleanupCanvasMemory=st,Se.isAutoOrientationInBrowser=Ht,Se.approximateBelowMaximumCanvasSizeOfBrowser=Pr,Se.copyExifWithoutOrientation=Rr,Se.getBrowserName=Ot,Se.version="2.0.2";class $s extends Te{constructor(){super("com.hamropatro.grpc.common.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&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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 d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){e.mimeType!==""&&t.tag(1,j.LengthDelimited).string(e.mimeType);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Ln=new $s;class Ps extends Te{constructor(){super("com.hamropatro.grpc.common.ImageUploadResponse",[{no:1,name:"key",kind:"scalar",T:9},{no:2,name:"uploadUrl",kind:"scalar",T:9},{no:3,name:"access_url",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",t.uploadUrl="",t.accessUrl="",e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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.uploadUrl=e.string();break;case 3:i.accessUrl=e.string();break;default:let d=r.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,r){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key),e.uploadUrl!==""&&t.tag(2,j.LengthDelimited).string(e.uploadUrl),e.accessUrl!==""&&t.tag(3,j.LengthDelimited).string(e.accessUrl);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const zr=new Ps,Jn=new Dn("com.hamropatro.grpc.common.ImageUploadService",[{name:"Upload",options:{},I:Ln,O:zr},{name:"UploadUserImage",options:{},I:Ln,O:zr}]);class Xr{constructor(e){pe(this,"typeName",Jn.typeName);pe(this,"methods",Jn.methods);pe(this,"options",Jn.options);this._transport=e}upload(e,t){const r=this.methods[0],n=this._transport.mergeOptions(t);return Pe("unary",this._transport,r,n,e)}uploadUserImage(e,t){const r=this.methods[1],n=this._transport.mergeOptions(t);return Pe("unary",this._transport,r,n,e)}}const Ws=async(s,e,t=!0)=>{var o;const r=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,n=new Xr(r),i=Ln.create();try{return i.mimeType=s,t?await n.upload(i,e):await n.uploadUserImage(i,e)}catch(a){throw a}},js=async(s,e)=>{var o,a;const t=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,r=(a=window.ImageSalonSDK)==null?void 0:a.mode,n=new Xr(t),i=Ln.create();try{return i.mimeType=s,await n.uploadUserImage(i,{meta:{Authorization:e,"app-id":r==="production"?"hamropatro":"hamropatro-android"}})}catch(c){throw c}},Gr=async(s,e,t,r=!0)=>{var n,i;try{const o=await Ws(e==null?void 0:e.type,t,r),a=(n=o.response)==null?void 0:n.uploadUrl,c=(i=o==null?void 0:o.response)==null?void 0:i.accessUrl;return await Jr(s,a,e),c}catch(o){throw o}},Jr=async(s,e,t)=>{const r=Zs(s,t);try{await fetch(e,{method:"PUT",headers:{"Content-Type":t==null?void 0:t.type},body:r})}catch(n){throw n}},qs=async(s,e,t)=>{var r,n;try{const i=await js(e==null?void 0:e.type,t),o=(r=i.response)==null?void 0:r.uploadUrl,a=(n=i==null?void 0:i.response)==null?void 0:n.accessUrl;return await Jr(s,o,e),a}catch(i){throw i}},Zs=(s,e)=>{const t=e.type.split("/")[0];let r="";t==="video"?r=s==null?void 0:s.replace(/^data:video\/\w+;base64,/,""):t==="image"?r=s==null?void 0:s.replace(/^data:image\/\w+;base64,/,""):t==="audio"&&(r=s==null?void 0:s.replace(/^data:audio\/\w+;base64,/,""));const n=atob(r),i=new Uint8Array(n.length);for(let o=0;o<n.length;o++)i[o]=n.charCodeAt(o);return i};async function Qr(s){const e={maxSizeMB:2,useWebWorker:!1,alwaysKeepResolution:!0};try{return await Se(s,e)}catch(t){throw t}}class Ks{constructor(e){z(this,At);z(this,Ae);z(this,ke);z(this,wt);z(this,we,[]);z(this,Ie,[]);z(this,tt);z(this,je);z(this,Rt);z(this,kt);z(this,ot,[]);z(this,nt);z(this,Ft);z(this,Pt);z(this,Qn);z(this,Nt);z(this,It);z(this,yt);z(this,Dt);z(this,at);z(this,lt);z(this,Tt);z(this,Lt);z(this,bt);z(this,Wt);z(this,on);z(this,Oe);z(this,Ct);z(this,an,!1);z(this,Un);z(this,ln);z(this,ct);z(this,jt);z(this,Ut);z(this,qt);z(this,Zt);z(this,Kt);z(this,zt);z(this,Xt);z(this,cn);z(this,dn);z(this,Gt);z(this,dt);z(this,Jt);H(this,ln,e.isAdmin),H(this,tt,!1),H(this,qt,e==null?void 0:e.mode),e.handleUpload&&H(this,Pt,e.handleUpload.bind(this)),e!=null&&e.accessToken&&(H(this,on,e.accessToken),this._grpcOptionInitializer()),this._init(e).then(()=>{H(this,an,!0),e!=null&&e.parentContainerId&&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){var t,r,n;return this._isAdminOptions(e)?(H(this,je,!1),H(this,Rt,!1),H(this,Nt,0),H(this,lt,""),H(this,bt,!1),H(this,qt,e.mode),H(this,Tt,!1),H(this,Ut,""),H(this,Ct,null),this._removeToastContainer(),this._renderAdminView(e)):(H(this,jt,""),H(this,Zt,e==null?void 0:e.restrictedFileSize),H(this,Kt,e==null?void 0:e.localizedFileRestrictedMessage),H(this,Xt,e==null?void 0:e.localizedSuccessMessage),H(this,zt,e==null?void 0:e.localizedErrorMessage),H(this,dt,e==null?void 0:e.imagePreviewWidth),H(this,Jt,e==null?void 0:e.imagePreviewHeight),H(this,cn,(t=e==null?void 0:e.removeImageConfirm)==null?void 0:t.bind(this)),H(this,dn,(r=e==null?void 0:e.removeImagePreviewCB)==null?void 0:r.bind(this)),H(this,Gt,(n=e==null?void 0:e.getUploadingState)==null?void 0:n.bind(this)),this._removeUserToast(),this._renderUserView(e))}_renderAdminView(e){if(!E(this,an))return;const{parentContainerId:t}=e;if(e.isAdmin===!0)var{buttonProps:r}=e;H(this,At,document.getElementById(t));const n=document.createElement("button");n.className=r!=null&&r.buttonClass?r==null?void 0:r.buttonClass:"browse-image-button",n.addEventListener("focus",()=>{n.blur()});const i=document.createElement("span");i.textContent=r!=null&&r.buttonText?r==null?void 0:r.buttonText:"Browse Files";const o=document.createElement("span");o.innerHTML=r!=null&&r.buttonIcon?r==null?void 0:r.buttonIcon:"",n.type="button",n.append(i,o),r!=null&&r.buttonStyle&&Object.assign(n.style,r==null?void 0:r.buttonStyle),n.addEventListener("click",()=>{this._selectedImageContainer()}),E(this,At).appendChild(n)}async _grpcOptionInitializer(){H(this,Oe,await Us(E(this,on),E(this,qt)))}_selectedImageContainer(){var u;H(this,Ft,We(`Save (${(u=E(this,we))==null?void 0:u.length})`,"dialog-btn confirm")),H(this,It,K("folder-container")),H(this,yt,K("folder-list-wrapper")),this._fetchAllFolders();const e=We("Cancel","dialog-btn cancel");We("","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",()=>{vn.hide(),H(this,we,[]),H(this,Ie,[])}),H(this,Ae,K("browse-container"));const r=K();r.style.display="flex",r.style.alignItems="center",r.style.justifyContent="space-between",r.style.padding="10px 20px";const n=sn("Folders","folder-title"),i=We("","add-folder-btn");i.append(xr()),this._createUpdateFolderDialog(i,"create"),r.append(n,i),E(this,It).append(r,E(this,yt));const o=this._renderSearchField(),a=this._createBrowseMoreContainer(),c=this._createBrowseImageMain(),d=K("footer");e.onclick=()=>{vn.hide(),H(this,Ie,[]),H(this,we,[])},E(this,Ft).onclick=()=>{E(this,Pt).call(this),vn.hide(),H(this,we,[]),H(this,Ie,[])},d.append(e,E(this,Ft));const l=K("container-right-main");l.append(o,a,c,d),E(this,Ae).append(E(this,It),l),vn.show({content:E(this,Ae)})}_renderUserView(e){const{parentContainerId:t,restrictedFileSize:r,imagePreview:n}=e;H(this,At,document.getElementById(t)),H(this,ct,Q("div","user-view-container"));const i=K("user-view-browse-wrapper","user-view-browse-wrapper"),o=Q("span","","",""),a=this._renderUserViewBrowseButton(),c=Q("p","","margin-block: 0px; font-size:14px");if(c.append(o,a),r){const d=Q("p","","margin-block: 0px; font-size: 13px; color: #777",`Max File size: ${r}MB`);i.append(qn(),c,d)}else i.append(qn(),c);return E(this,ct).append(i),n&&this._renderImagePreview(n,"",i,!0),E(this,At).appendChild(E(this,ct)),E(this,At)}_renderImagePreview(e,t,r,n=!1){var T;const i=document.getElementById("user-view-browse-wrapper"),o=i||r;o&&(o.style.display="none");const a=document.getElementById("user-image-preview");a&&a.remove();const c=Q("div","user-image-preview");c.id="user-image-preview";const d=this._renderImageLoadingContainer();c.appendChild(d);const l=Q("img","",`max-width: ${E(this,dt)?E(this,dt):230}px;max-height:${E(this,Jt)?E(this,Jt):250}px;object-fit:cover;`);l.src=e,l.alt=t||"";const u=this._renderImageErrorContainer();c.appendChild(u),l.onload=()=>{f.style.display="none",d.style.display="none",d.remove(),u.style.display="none",u.remove(),l.style.display="block",f.style.display=n?"flex":"none"},l.onerror=C=>{d.style.display="none",d.remove(),u.style.display="flex",l.style.display="none",f.style.display="none"};const h=u.querySelector("#retry-image-btn");h==null||h.addEventListener("click",()=>{d.style.display="flex",u.style.display="none",f.style.display="none",l.src=e});const f=Q("div","","width: 18px; height: 18px; display:none; cursor:pointer; align-items: center; justify-content: center; padding: 4px; position: absolute; top: -5px; right: -5px; background: #c10007; border-radius: 50%;z-index:1");f.id="remove-preview-btn";const y=jn();y.style.fill="#fff",f==null||f.appendChild(y),f.addEventListener("click",()=>{E(this,cn).call(this)});const k=Q("button","","display:none");k.id="image-preview-hidden-btn",k.addEventListener("click",C=>{var R;C.preventDefault(),C.stopPropagation(),(R=E(this,ct))==null||R.removeChild(c),E(this,dn).call(this),this._removeUserToast(),o&&(o.style.display="flex")}),c==null||c.append(l,f,k),(T=E(this,ct))==null||T.append(c)}_renderImageErrorContainer(){const e=Q("div","","display: none; text-align: center;");return e.innerHTML=`
|
|
24
|
+
`;let Yn;function Ws(s,e){return new Promise((t,r)=>{Yn||(Yn=function(o){const a=[];return a.push(o),URL.createObjectURL(new Blob(a))}(Ps));const n=new Worker(Yn);n.addEventListener("message",function(o){if(e.signal&&e.signal.aborted)n.terminate();else if(o.data.progress===void 0){if(o.data.error)return r(new Error(o.data.error)),void n.terminate();t(o.data.file),n.terminate()}else e.onProgress(o.data.progress)}),n.addEventListener("error",r),e.signal&&e.signal.addEventListener("abort",()=>{r(e.signal.reason),n.terminate()}),n.postMessage({file:s,imageCompressionLibUrl:e.libURL,options:{...e,onProgress:void 0,signal:void 0}})})}function Oe(s,e){return new Promise(function(t,r){let n,i,o,a,c,h;if(n={...e},o=0,{onProgress:a}=n,n.maxSizeMB=n.maxSizeMB||Number.POSITIVE_INFINITY,c=typeof n.useWebWorker!="boolean"||n.useWebWorker,delete n.useWebWorker,n.onProgress=f=>{o=f,typeof a=="function"&&a(o)},!(s instanceof Blob||s instanceof $s))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(s.type))return r(new Error("The file given is not an image"));if(h=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!c||typeof Worker!="function"||h)return Gr(s,n).then((function(f){try{return i=f,d.call(this)}catch(y){return r(y)}}).bind(this),r);var l=(function(){try{return d.call(this)}catch(f){return r(f)}}).bind(this),u=function(f){try{return Gr(s,n).then(function(y){try{return i=y,l()}catch(N){return r(N)}},r)}catch(y){return r(y)}};try{return n.libURL=n.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Ws(s,n).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{n.preserveExif&&s.type==="image/jpeg"&&(!n.fileType||n.fileType&&n.fileType===s.type)&&(i=Vr(s,i))}catch{}return t(i)}})}Oe.getDataUrlFromFile=Wr,Oe.getFilefromDataUrl=Qn,Oe.loadImage=jr,Oe.drawImageInCanvas=Zr,Oe.drawFileInCanvas=Tn,Oe.canvasToFile=Ln,Oe.getExifOrientation=Kr,Oe.handleMaxWidthOrHeight=zr,Oe.followExifOrientation=Xr,Oe.cleanupCanvasMemory=lt,Oe.isAutoOrientationInBrowser=Pt,Oe.approximateBelowMaximumCanvasSizeOfBrowser=qr,Oe.copyExifWithoutOrientation=Vr,Oe.getBrowserName=Ot,Oe.version="2.0.2";class js extends Te{constructor(){super("com.hamropatro.grpc.common.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&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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=r.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,r){e.mimeType!==""&&t.tag(1,W.LengthDelimited).string(e.mimeType);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Un=new js;class qs extends Te{constructor(){super("com.hamropatro.grpc.common.ImageUploadResponse",[{no:1,name:"key",kind:"scalar",T:9},{no:2,name:"uploadUrl",kind:"scalar",T:9},{no:3,name:"access_url",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",t.uploadUrl="",t.accessUrl="",e!==void 0&&be(this,t,e),t}internalBinaryRead(e,t,r,n){let i=n??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.uploadUrl=e.string();break;case 3:i.accessUrl=e.string();break;default:let h=r.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,r){e.key!==""&&t.tag(1,W.LengthDelimited).string(e.key),e.uploadUrl!==""&&t.tag(2,W.LengthDelimited).string(e.uploadUrl),e.accessUrl!==""&&t.tag(3,W.LengthDelimited).string(e.accessUrl);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Jr=new qs,er=new Mn("com.hamropatro.grpc.common.ImageUploadService",[{name:"Upload",options:{},I:Un,O:Jr},{name:"UploadUserImage",options:{},I:Un,O:Jr}]);class Qr{constructor(e){ge(this,"typeName",er.typeName);ge(this,"methods",er.methods);ge(this,"options",er.options);this._transport=e}upload(e,t){const r=this.methods[0],n=this._transport.mergeOptions(t);return Ve("unary",this._transport,r,n,e)}uploadUserImage(e,t){const r=this.methods[1],n=this._transport.mergeOptions(t);return Ve("unary",this._transport,r,n,e)}}const Zs=async(s,e,t=!0)=>{var o;const r=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,n=new Qr(r),i=Un.create();try{return i.mimeType=s,t?await n.upload(i,e):await n.uploadUserImage(i,e)}catch(a){throw a}},Ks=async(s,e)=>{var o,a;const t=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,r=(a=window.ImageSalonSDK)==null?void 0:a.mode,n=new Qr(t),i=Un.create();try{return i.mimeType=s,await n.uploadUserImage(i,{meta:{Authorization:e,"app-id":r==="production"?"hamropatro":"hamropatro-android"}})}catch(c){throw c}},Yr=async(s,e,t,r=!0)=>{var n,i;try{const o=await Zs(e==null?void 0:e.type,t,r),a=(n=o.response)==null?void 0:n.uploadUrl,c=(i=o==null?void 0:o.response)==null?void 0:i.accessUrl;return await ei(s,a,e),c}catch(o){throw o}},ei=async(s,e,t)=>{const r=Xs(s,t);try{await fetch(e,{method:"PUT",headers:{"Content-Type":t==null?void 0:t.type},body:r})}catch(n){throw n}},zs=async(s,e,t)=>{var r,n;try{const i=await Ks(e==null?void 0:e.type,t),o=(r=i.response)==null?void 0:r.uploadUrl,a=(n=i==null?void 0:i.response)==null?void 0:n.accessUrl;return await ei(s,o,e),a}catch(i){throw i}},Xs=(s,e)=>{const t=e.type.split("/")[0];let r="";t==="video"?r=s==null?void 0:s.replace(/^data:video\/\w+;base64,/,""):t==="image"?r=s==null?void 0:s.replace(/^data:image\/\w+;base64,/,""):t==="audio"&&(r=s==null?void 0:s.replace(/^data:audio\/\w+;base64,/,""));const n=atob(r),i=new Uint8Array(n.length);for(let o=0;o<n.length;o++)i[o]=n.charCodeAt(o);return i};async function ti(s){const e={maxSizeMB:2,useWebWorker:!1,alwaysKeepResolution:!0};try{return await Oe(s,e)}catch(t){throw t}}class Gs{constructor(e){z(this,Ct);z(this,fe);z(this,ke);z(this,Et);z(this,pe,[]);z(this,Ne,[]);z(this,tt);z(this,je);z(this,St);z(this,Ft);z(this,ct,[]);z(this,nt);z(this,rt);z(this,Rt);z(this,tr);z(this,Nt);z(this,it);z(this,st);z(this,Dt);z(this,dt);z(this,ht);z(this,It);z(this,Tt);z(this,vt);z(this,jt);z(this,on);z(this,Se);z(this,Mt);z(this,an,!1);z(this,xn);z(this,ln);z(this,ut);z(this,qt);z(this,Lt);z(this,Zt);z(this,Kt);z(this,zt);z(this,Xt);z(this,Gt);z(this,cn);z(this,dn);z(this,Jt);z(this,ft);z(this,Qt);z(this,hn);H(this,ln,e.isAdmin),H(this,tt,!1),H(this,Zt,e==null?void 0:e.mode),e.handleUpload&&H(this,Rt,e.handleUpload.bind(this)),e!=null&&e.accessToken&&(H(this,on,e.accessToken),this._grpcOptionInitializer()),this._init(e).then(()=>{H(this,an,!0),e!=null&&e.parentContainerId&&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){var t,r,n;return this._isAdminOptions(e)?(H(this,je,!1),H(this,St,!1),H(this,Nt,0),H(this,ht,""),H(this,vt,!1),H(this,Zt,e.mode),H(this,It,!1),H(this,Lt,""),H(this,Mt,null),H(this,hn,e.enableDialog),this._removeToastContainer(),this._renderAdminView(e)):(H(this,qt,""),H(this,Kt,e==null?void 0:e.restrictedFileSize),H(this,zt,e==null?void 0:e.localizedFileRestrictedMessage),H(this,Gt,e==null?void 0:e.localizedSuccessMessage),H(this,Xt,e==null?void 0:e.localizedErrorMessage),H(this,ft,e==null?void 0:e.imagePreviewWidth),H(this,Qt,e==null?void 0:e.imagePreviewHeight),H(this,cn,(t=e==null?void 0:e.removeImageConfirm)==null?void 0:t.bind(this)),H(this,dn,(r=e==null?void 0:e.removeImagePreviewCB)==null?void 0:r.bind(this)),H(this,Jt,(n=e==null?void 0:e.getUploadingState)==null?void 0:n.bind(this)),this._removeUserToast(),this._renderUserView(e))}_renderAdminView(e){if(!E(this,an))return;const{parentContainerId:t}=e;if(e.isAdmin===!0)var{buttonProps:r}=e;if(H(this,Ct,document.getElementById(t)),!E(this,hn))setTimeout(()=>{const n=this._selectedImageContainer();E(this,Ct).appendChild(n)},0);else{const n=document.createElement("button");n.className=r!=null&&r.buttonClass?r==null?void 0:r.buttonClass:"browse-image-button",n.addEventListener("focus",()=>{n.blur()});const i=document.createElement("span");i.textContent=r!=null&&r.buttonText?r==null?void 0:r.buttonText:"Browse Files";const o=document.createElement("span");o.innerHTML=r!=null&&r.buttonIcon?r==null?void 0:r.buttonIcon:"",n.type="button",n.append(i,o),r!=null&&r.buttonStyle&&Object.assign(n.style,r==null?void 0:r.buttonStyle),n.addEventListener("click",()=>{this._selectedImageContainerDialog()}),E(this,Ct).appendChild(n)}}async _grpcOptionInitializer(){H(this,Se,await Bs(E(this,on),E(this,Zt)))}_selectedImageContainer(){var h;H(this,it,Z("folder-container")),H(this,st,Z("folder-list-wrapper")),this._fetchAllFolders(),H(this,fe,Z("browse-container")),H(this,rt,He(`Save (${(h=E(this,pe))==null?void 0:h.length})`,"dialog-btn confirm"));const e=Z();e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="space-between",e.style.padding="10px 20px";const t=$t("Folders","folder-title"),r=He("","add-folder-btn");r.append(Kn()),this._createUpdateFolderDialog(r,"create"),e.append(t,r),E(this,it).append(e,E(this,st));const n=this._renderSearchField(),i=this._createBrowseMoreContainer(),o=this._createBrowseImageMain(),a=Z("footer");a.appendChild(E(this,rt)),E(this,rt).onclick=()=>{E(this,Rt).call(this),H(this,pe,[]),H(this,Ne,[])};const c=Z("container-right-main");return c.append(n,i,o,a),E(this,fe).append(E(this,it),c),E(this,fe)}_selectedImageContainerDialog(){var u;H(this,rt,He(`Save (${(u=E(this,pe))==null?void 0:u.length})`,"dialog-btn confirm")),H(this,it,Z("folder-container")),H(this,st,Z("folder-list-wrapper")),this._fetchAllFolders();const e=He("Cancel","dialog-btn cancel");He("","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",()=>{An.hide(),H(this,pe,[]),H(this,Ne,[])}),H(this,fe,Z("browse-container"));const r=Z();r.style.display="flex",r.style.alignItems="center",r.style.justifyContent="space-between",r.style.padding="10px 20px";const n=$t("Folders","folder-title"),i=He("","add-folder-btn");i.append(Kn()),this._createUpdateFolderDialog(i,"create"),r.append(n,i),E(this,it).append(r,E(this,st));const o=this._renderSearchField(),a=this._createBrowseMoreContainer(),c=this._createBrowseImageMain(),h=Z("footer");e.onclick=()=>{An.hide(),H(this,Ne,[]),H(this,pe,[])},E(this,rt).onclick=()=>{E(this,Rt).call(this),An.hide(),H(this,pe,[]),H(this,Ne,[])},h.append(e,E(this,rt));const l=Z("container-right-main");l.append(o,a,c,h),E(this,fe).append(E(this,it),l),An.show({content:E(this,fe)})}_renderUserView(e){const{parentContainerId:t,restrictedFileSize:r,imagePreview:n}=e;H(this,Ct,document.getElementById(t)),H(this,ut,Q("div","user-view-container"));const i=Z("user-view-browse-wrapper","user-view-browse-wrapper"),o=Q("span","","",""),a=this._renderUserViewBrowseButton(),c=Q("p","","margin-block: 0px; font-size:14px");if(c.append(o,a),r){const h=Q("p","","margin-block: 0px; font-size: 13px; color: #777",`Max File size: ${r}MB`);i.append(zn(),c,h)}else i.append(zn(),c);return E(this,ut).append(i),n&&this._renderImagePreview(n,"",i,!0),E(this,Ct).appendChild(E(this,ut)),E(this,Ct)}_renderImagePreview(e,t,r,n=!1){var T;const i=document.getElementById("user-view-browse-wrapper"),o=i||r;o&&(o.style.display="none");const a=document.getElementById("user-image-preview");a&&a.remove();const c=Q("div","user-image-preview");c.id="user-image-preview";const h=this._renderImageLoadingContainer();c.appendChild(h);const l=Q("img","",`max-width: ${E(this,ft)?E(this,ft):230}px;max-height:${E(this,Qt)?E(this,Qt):250}px;object-fit:cover;`);l.src=e,l.alt=t||"";const u=this._renderImageErrorContainer();c.appendChild(u),l.onload=()=>{f.style.display="none",h.style.display="none",h.remove(),u.style.display="none",u.remove(),l.style.display="block",f.style.display=n?"flex":"none"},l.onerror=C=>{h.style.display="none",h.remove(),u.style.display="flex",l.style.display="none",f.style.display="none"};const d=u.querySelector("#retry-image-btn");d==null||d.addEventListener("click",()=>{h.style.display="flex",u.style.display="none",f.style.display="none",l.src=e});const f=Q("div","","width: 18px; height: 18px; display:none; cursor:pointer; align-items: center; justify-content: center; padding: 4px; position: absolute; top: -5px; right: -5px; background: #c10007; border-radius: 50%;z-index:1");f.id="remove-preview-btn";const y=Zn();y.style.fill="#fff",f==null||f.appendChild(y),f.addEventListener("click",()=>{E(this,cn).call(this)});const N=Q("button","","display:none");N.id="image-preview-hidden-btn",N.addEventListener("click",C=>{var R;C.preventDefault(),C.stopPropagation(),(R=E(this,ut))==null||R.removeChild(c),E(this,dn).call(this),this._removeUserToast(),o&&(o.style.display="flex")}),c==null||c.append(l,f,N),(T=E(this,ut))==null||T.append(c)}_renderImageErrorContainer(){const e=Q("div","","display: none; text-align: center;");return e.innerHTML=`
|
|
25
25
|
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%;">
|
|
26
26
|
<p style="color: #c10007;margin-block:0px;">Failed to load image</p>
|
|
27
27
|
<button type="button" id="retry-image-btn" style="margin-top: 10px; padding: 5px 10px; background: #3498db; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
@@ -33,7 +33,7 @@ self.addEventListener('message', async (e) => {
|
|
|
33
33
|
<div style="width: 20px; height: 20px; border: 3px solid #f3f3f3; border-top: 3px solid #3498db; border-radius: 50%; animation: spin 1s linear infinite;"></div>
|
|
34
34
|
<p style="margin-top: 10px;">Loading...</p>
|
|
35
35
|
</div>
|
|
36
|
-
`,e}_renderRemovePreviewBtn(){const e=document.getElementById("remove-preview-btn");e&&(e.style.display="flex")}async _readFileAsBase64(e){const t=E(this,
|
|
36
|
+
`,e}_renderRemovePreviewBtn(){const e=document.getElementById("remove-preview-btn");e&&(e.style.display="flex")}async _readFileAsBase64(e){const t=E(this,Kt)*1024*1024;if(e.size>t){this._renderUserToast(E(this,zt)?E(this,zt):`File size must be less than ${E(this,Kt)}MB.`,"error");return}H(this,tt,!0),E(this,Jt).call(this,!0);try{const r=await ti(e);this._removeUserToast();const n=new FileReader;n.readAsDataURL(r),n.onload=()=>{this._userViewUploadAndAddSelectedImageList(n.result,e)},n.onerror=()=>{console.error("Error reading file:",n.error)}}catch(r){this._renderUserToast(r==null?void 0:r.message,"error")}}_renderUserToast(e,t="success"){const r=Q("div","","display:flex;align-items:center;gap:5px;margin-top:5px;");r.id="user-toast-container";const n=Q("p","","margin-block:0px;font-size:14px;padding-top:3px");n.textContent=e,n.style.color=t==="success"?"#4caf50":"#ee3f3f";const i=t==="success"?Br("#4caf50"):qn();i.style.width="15px",i.style.height="15px",r.append(i,n),E(this,ut).appendChild(r)}_removeUserToast(){const e=document.getElementById("user-toast-container");e&&e.remove()}_renderUserViewBrowseButton(){const e=Gn("file");e.style.display="none",e.setAttribute("multiple","true"),e.setAttribute("accept","image/*");const t=Q("a","user-upload-btn","","Click to upload");return t.classList.add("user-upload-btn"),t.role="button",t.addEventListener("click",()=>{this._removeUserToast(),e.click()}),e.addEventListener("change",()=>{const r=e.files[0];r&&this._readFileAsBase64(r),e.value=""}),t}_renderUserUploading(){const e=Q("div","","margin-top:5px;margin-bottom:8px;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=Q("div","linear-loader",`width:${E(this,ft)?E(this,ft):230}px;max-width:${E(this,ft)?E(this,ft):230}px`);e.appendChild(t),E(this,ut).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 r=await Yr(e,t,E(this,Se),!1);await this._uploadForUser(r,t),E(this,Gt)&&this._renderUserToast(E(this,Gt),"success")}catch{this._renderUserToast(E(this,Xt)?E(this,Xt):"Error uploading. Please try again later.","error")}finally{H(this,tt,!1),E(this,Jt).call(this,!1),this._removeUserUploading(),this._renderRemovePreviewBtn()}}async _uploadForUser(e,t){var r;try{const n=await ss(e,Qe[Xn((r=t.type)==null?void 0:r.split("/")[0])],E(this,Se));H(this,qt,n==null?void 0:n.response),E(this,Rt).call(this)}catch(n){throw Error(n)}}_createAllAndSelectedTab(e){const t=Z("select-options"),r=$t("Browse","select"),n=$t("Selected","select","selected-images-tab");r.classList.add("selected"),[r,n].forEach((o,a)=>{o.addEventListener("click",()=>{var c;H(this,Nt,a),(c=document.querySelector(".select.selected"))==null||c.classList.remove("selected"),o.classList.add("selected"),this._updateSelectedImageListContainerUI()})}),t.append(r,n),e.appendChild(t)}_renderUploadButton(){const e=Gn("file");e.style.display="none",e.setAttribute("multiple","true"),e.setAttribute("accept","image/*,video/*,audio/*,.gif"),H(this,Et,document.createElement("button")),E(this,Et).className="browse-more-btn";const t=document.createElement("span");return t.textContent="Upload",E(this,Et).append(zn(),t),E(this,Et).type="button",E(this,Et).addEventListener("click",()=>e.click()),e.addEventListener("change",async()=>{const r=e.files[0];try{H(this,tt,!0);const n=new FileReader;n.readAsDataURL(r),n.onload=async()=>{await this._uploadAndAddSelectedImageList(n.result,r)}}catch(n){this._renderToastContainer(n,"error",E(this,fe))}e.value=""}),E(this,Et)}_renderCreateFolderBtn(){const e=document.createElement("button");e.className="create-folder-btn";const t=document.createElement("span");return t.textContent="Create",e.append(Kn(),t),this._createUpdateFolderDialog(e,"create"),e}_renderSearchField(){let e;const t=Z("search-browse-container"),r=Z("search-input-wrapper","search-input-wrapper");H(this,Tt,Gn("search")),E(this,Tt).value="",E(this,Tt).addEventListener("input",i=>{H(this,Ne,[]);const o=i.target;e&&clearTimeout(e),e=setTimeout(()=>{if(!o.value){H(this,ht,""),H(this,It,!1),H(this,vt,!1),this._fetchFilesFromFolder(E(this,Ft));return}H(this,vt,!0),H(this,jt,o.value),this._search(E(this,jt))},750)}),E(this,Tt).setAttribute("placeholder","Search");const n=Is();return n.style.position="absolute",n.style.top="50%",n.style.left="5%",n.style.transform="translate(-5%, -50%)",r.append(n,E(this,Tt)),t.append(r),t}_createBrowseMoreContainer(){H(this,Dt,Z("browse-more-btn-container")),this._createAllAndSelectedTab(E(this,Dt));const e=this._renderUploadButton(),t=this._renderCreateFolderBtn(),r=document.createElement("div");return r.style.display="flex",r.style.alignItems="center",r.style.gap="10px",r.append(e,t),E(this,Dt).appendChild(r),E(this,Dt)}_createBrowseImageMain(){const e=Z("browse-image-main");return H(this,ke,Z("selected-image-container")),E(this,ke).addEventListener("scroll",()=>{const t=E(this,ke).clientHeight,r=E(this,ke).scrollTop,n=E(this,ke).scrollHeight;t+r>=n-5&&E(this,It)&&(E(this,vt)?this._search(E(this,jt)):this._fetchFilesFromFolder(E(this,Ft)))}),e.appendChild(E(this,ke)),e}_renderFetchingSkeletonUI(){for(let e=0;e<20;e++){const t=Z("skeleton");t.innerHTML="",E(this,ke).append(t)}}_renderEmptyImageContainer(){if(E(this,je)||E(this,tt))return;const e=Z(),t=Z(),r=document.createElement("p");E(this,vt)&&E(this,Nt)===0?(t.innerHTML=`
|
|
37
37
|
<svg width="300" height="300" viewBox="0 0 1000 1000" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
38
38
|
<g clip-path="url(#clip0_2304_257)">
|
|
39
39
|
<path d="M564.829 772.4H336.658V948.386H564.829V772.4Z" fill="#EBEBEB"/>
|
|
@@ -117,4 +117,4 @@ self.addEventListener('message', async (e) => {
|
|
|
117
117
|
</clipPath>
|
|
118
118
|
</defs>
|
|
119
119
|
</svg>
|
|
120
|
-
`,r.textContent="Looks Empty!"),e.append(t,r),E(this,ke).appendChild(e)}_renderLoadingUI(){const e=K("skeleton");e.innerHTML="",E(this,ke).appendChild(e)}_fileCardBody(e){var ft,Qt,xn,Yt;const t=K("selected-image-content"),r=K("selected-image-top-bar"),n=We("","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)===Qe.IMAGE&&(i=Or(e==null?void 0:e.url,"selected-image"),o=Es()),(e==null?void 0:e.type)===Qe.VIDEO&&(i=xs(e==null?void 0:e.url,"uploaded-video"),o=Fs()),(e==null?void 0:e.type)===Qe.AUDIO&&(i=_s(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=sn(e==null?void 0:e.name,"selected-image-name"),d=oe("","selected-image-type");d.append(o),r.append(d,n);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(r,i),a.append(t,l);const u=K("action-wrapper"),h=We("","action-option preview"),f=oe("Preview",""),y=As();h.append(y,f);const k=We("","action-option move"),T=oe("Move",""),C=vs();k.append(C,T);const R=We("","action-option rename"),S=oe("Rename",""),F=Ur();R.append(F,S);const U=We("","action-option delete"),b=oe("Delete",""),B=_r();U.append(B,b);const m=e.name.split(".")[0],g=e.name.split(".")[1],A=rn[e.type],I=K("edit-form-wrapper"),N=K("move-form-wrapper"),L=K("preview-details-container"),v=K("preview-details-wrapper"),_=K("preview-option-image-wrapper"),w=K("preview-option-wrapper"),p=K("preview-option-wrapper"),M=K("preview-option-wrapper"),x=K("preview-option-wrapper"),V=K("preview-option-wrapper"),Z=K("preview-option-wrapper"),P=K("preview-option-wrapper"),q=Or(e.url,"preview-option-image");_.append(q);const $=oe("File name","preview-title"),O=K("preview-option-name");O.innerHTML=e.name,w.append($,O);const X=oe("Folder name","preview-title"),ce=oe(e.folderName,"preview-option-name");p.append(X,ce);const te=oe("File Extension","preview-title"),Y=oe(g,"preview-option-name extension");M.append(te,Y);const ae=oe("File type","preview-title"),me=oe(A,"preview-option-name");x.append(ae,me);const Fe=oe("Dimension","preview-title"),Et=oe(`${(ft=e==null?void 0:e.metadata)==null?void 0:ft.width} * ${(Qt=e==null?void 0:e.metadata)==null?void 0:Qt.height}`,"preview-option-name");V.append(Fe,Et);const Ke=oe("URL","preview-title"),fe=oe(e.url,"preview-option-name url");Z.append(Ke,fe);const Le=oe("Parent folder","preview-title"),de=oe(e.nestedFolderName,"preview-option-name");P.append(Le,de),v.append(p,w,M,x,((xn=e==null?void 0:e.metadata)==null?void 0:xn.width)>0&&((Yt=e==null?void 0:e.metadata)==null?void 0:Yt.height)>0?V:"",Z,e.nestedFolderName?P:""),L.append(_,v);const re=K("form-control"),ye=document.createElement("input");re.appendChild(ye),ye.classList.add("input-field"),ye.value=e.name;const Ue=K("form-control"),be=oe("Current Folder:","input-label"),xe=K("folder-field current");xe.textContent=e.folderName,xe.prepend(nn()),Ue.append(be,xe);const ge=K("form-control"),ee=K();ee.style.width="100%",ee.style.display="flex",ee.style.alignItems="center",ee.style.justifyContent="space-between";const Ve=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(Wn("14px","14px","#333")),ee.append(Ve,Re);const ht=K();ht.style.width="100%",ht.style.maxHeight="250px",ht.style.overflowY="auto";const Ne=document.createElement("ul");Ne.className="folders",ht.append(Ne),ge.append(ee,ht),E(this,ot).forEach(ue=>{const ze=this._renderEditFolderListContainer(ue);Ne.appendChild(ze)});const ut=K("form-control"),_e=oe("Destination Folder:","input-label"),$e=K("folder-field source","source-folder-wrapper"),De=document.createElement("span");De.id="source-folder-name",De.textContent=E(this,Ut)?E(this,Ut):e.folderName,$e.append(nn(),De);let Me="";ut.append(_e,$e),ye.onchange=ue=>{Me=ue.target.value},Me=Me!==""?Me:e.name,I.append(re),N.append(Ue,ge,ut),u.append(h,k,R,U),h.onclick=ue=>{ue.stopPropagation(),Ze.hide(),ve.show({content:L,header:m,dialogContentStyle:{minWidth:"60rem",padding:"10px"},showCloseBtn:!0})},k.onclick=ue=>{ue.stopPropagation(),Ze.hide(),ve.show({content:N,header:`Move "${e.name}"`,confirmButtonText:"Move",dialogContentStyle:{minWidth:"35rem",padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{ve.hide()},onConfirm:()=>{this._updateFile(Me,e)}})},R.onclick=ue=>{ue.stopPropagation(),Ze.hide(),ve.show({content:I,header:"Rename",confirmButtonText:"Update",dialogContentStyle:{padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{ve.hide()},onConfirm:()=>{this._updateFile(Me,e)}})},U.onclick=ue=>{ue.stopPropagation(),Ze.hide(),ve.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)}})},n.addEventListener("click",ue=>{ue.stopPropagation(),Ze.hide(),Ze.show({content:u,mainContainer:r,divId:e.key}),H(this,Ct,e.key)}),i.addEventListener("click",()=>{const ue=E(this,we).findIndex(pt=>(pt==null?void 0:pt.key)===(e==null?void 0:e.key));if(t.classList.contains("checked"))t.classList.remove("checked"),ue!==-1&&(E(this,we).splice(ue,1),E(this,Nt)===1&&a.remove());else{if(E(this,Un))E(this,we).push(e);else{const pt=document.querySelector(".selected-image-wrapper .checked");pt==null||pt.classList.remove("checked"),H(this,we,[e])}t.classList.add("checked")}this._updateContent()}),document.addEventListener("click",ue=>{const ze=document.querySelector(`#${E(this,Ct)}`);ze&&(ue.composedPath().includes(ze)||Ze.hide())}),E(this,we).findIndex(ue=>(ue==null?void 0:ue.key)===(e==null?void 0:e.key))!==-1?(t.classList.add("checked"),E(this,bt)?E(this,ke).prepend(a):E(this,ke).appendChild(a)):E(this,ke).appendChild(a)}_renderImageCard(e){this._fileCardBody(e)}_renderImageListContainer(){var e,t;((e=E(this,Ie))==null?void 0:e.length)>0&&((t=E(this,Ie))==null||t.forEach(r=>{this._renderImageCard(r)}))}_renderSelectedImageListContainer(){var e;((e=E(this,we))==null?void 0:e.length)>0&&E(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 r=K("skeleton");r.className="skeleton folder",r.innerHTML="",e.appendChild(r)}return e}_renderFolderListContainer(e){var o;const t=document.createElement("li");t.className="folder";const r=document.createElement("div");r.style.position="relative",r.style.display="flex",r.style.alignItems="center",r.style.gap="2px";const n=document.createElement("span"),i=document.createElement("span");if(i.className="folder-name",i.textContent=e==null?void 0:e.name,n.appendChild(nn()),r.append(n,i),t.append(r),e.children&&Object.keys(e.children).length>0){const a=document.createElement("button");a.classList.add("expand-icon"),a.appendChild(Tr()),r.prepend(a);const c=document.createElement("ul");c.className="folders nested",t.appendChild(c),a.addEventListener("click",d=>{d.stopPropagation(),t.classList.toggle("active"),c.classList.toggle("visible")}),Object.values(e.children).forEach((d,l)=>{const u=this._renderFolderListContainer(d);c.appendChild(u)})}if(e.nestedFolderName){const a=We("","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"),d=We("","action-option edit"),l=oe("Edit",""),u=Ur();d.append(u,l);const h=K("edit-form-wrapper"),f=K("name-field-wrapper"),y=oe("Name","input-label"),k=document.createElement("input");k.classList.add("input-field"),k.value=e.name,k.onchange=F=>{F.target.value},f.append(y,k),h.append(f);const T={key:e.key,name:e.name,nestedFolderName:e.nestedFolderName,createdBy:e.createdBy};this._createUpdateFolderDialog(d,"update",T);const C=We("","action-option delete"),R=oe("Delete",""),S=_r();C.append(S,R),c.append(d,C),C.onclick=F=>{F.stopPropagation(),Ze.hide(),ve.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",F=>{F.stopPropagation();const U=document.querySelector(`#${e.key}`);H(this,Ct,null),E(this,Ct)===e.key&&U!==null?Ze.hide():(Ze.hide(),Ze.show({content:c,mainContainer:r,divId:e.key}),H(this,Ct,e.key))}),r.appendChild(a)}return t.addEventListener("click",a=>{var c;a.stopPropagation(),H(this,nt,e),H(this,kt,e==null?void 0:e.name),H(this,we,[]),H(this,Ie,[]),H(this,lt,""),H(this,Tt,!1),(c=document.querySelector(".folder.selected"))==null||c.classList.remove("selected"),t.classList.add("selected"),this._fetchFilesFromFolder(e.name)}),((o=E(this,nt))==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 r=document.createElement("div");r.style.position="relative",r.style.display="flex",r.style.alignItems="center",r.style.gap="2px";const n=document.createElement("span"),i=document.createElement("span");if(i.className="folder-name",i.textContent=e==null?void 0:e.name,n.appendChild(nn()),r.append(n,i),t.append(r),e.children&&Object.keys(e.children).length>0){const a=document.createElement("button");a.classList.add("expand-icon"),a.appendChild(Tr()),r.prepend(a);const c=document.createElement("ul");c.className="folders nested",t.appendChild(c),a.addEventListener("click",d=>{d.stopPropagation(),t.classList.toggle("active"),c.classList.toggle("visible")}),Object.values(e.children).forEach(d=>{const l=this._renderEditFolderListContainer(d);c.appendChild(l)})}return t.addEventListener("click",a=>{var d;a.stopPropagation(),H(this,Ut,e==null?void 0:e.name);const c=document.querySelector("#source-folder-name");c.textContent="",c.textContent=e==null?void 0:e.name,(d=document.querySelector(".folder-move.selected"))==null||d.classList.remove("selected"),t.classList.add("selected")}),((o=E(this,nt))==null?void 0:o.key)===(e==null?void 0:e.key)&&t.classList.add("selected"),t}_updateFolderListContainer(){if(E(this,It))if(E(this,yt).innerHTML="",E(this,Rt)){const e=this._renderFolderListLoadingUI();E(this,yt).appendChild(e)}else{const e=document.createElement("ul");e.className="folders",E(this,yt).appendChild(e),E(this,ot).forEach(t=>{const r=this._renderFolderListContainer(t);e.appendChild(r)}),E(this,It).appendChild(E(this,yt))}}_renderToastContainer(e,t,r){this._removeToastContainer(),H(this,at,document.createElement("div")),E(this,at).className=`message-container ${t}`;const n=sn(e,"message"),i=t==="success"?Lr():Wn(),o=We("");o.style.cursor="pointer",o.style.border="0",o.style.outline="none",o.style.background="transparent",o.appendChild(jn(t==="error"?"#ee3f3f":"#4caf50")),o.setAttribute("fill",t==="error"?"#ee3f3f":"#4caf50"),o.onclick=()=>this._removeToastContainer(),E(this,at).append(i,n,o),r.appendChild(E(this,at)),setTimeout(()=>{this._removeToastContainer()},5e3)}_removeToastContainer(){E(this,at)&&(E(this,at).remove(),H(this,at,null))}_updateSelectedImageListContainerUI(){var t,r;if(!E(this,ke))return;E(this,ke).innerHTML="",E(this,tt)&&this._renderLoadingUI(),E(this,je)&&this._renderFetchingSkeletonUI();const e=document.getElementById("search-input-wrapper");E(this,Nt)===0?(e&&(e.style.visibility="visible"),((t=E(this,Ie))==null?void 0:t.length)===0&&!E(this,je)?(E(this,ke).classList.add("no-selected-image-container"),this._renderEmptyImageContainer()):(E(this,ke).classList.remove("no-selected-image-container"),this._renderImageListContainer())):(e&&(e.style.visibility="hidden"),((r=E(this,we))==null?void 0:r.length)===0?(E(this,ke).classList.add("no-selected-image-container"),this._renderEmptyImageContainer()):(E(this,ke).classList.remove("no-selected-image-container"),this._renderSelectedImageListContainer())),this._updateContent()}_updateContent(){var t,r,n;const e=document.getElementById("selected-images-tab");e&&(e.textContent=`Selected (${(t=E(this,we))==null?void 0:t.length})`),E(this,Ft).textContent=`Save (${(r=E(this,we))==null?void 0:r.length})`,E(this,Ft).disabled=((n=E(this,we))==null?void 0:n.length)===0}async _uploadAndAddSelectedImageList(e,t){var r,n;this._updateSelectedImageListContainerUI();try{const i=await Gr(e,t,E(this,Oe)),o=await ts(t==null?void 0:t.name,"",i,Qe[Zn((r=t.type)==null?void 0:r.split("/")[0])],(n=E(this,nt))==null?void 0:n.name,E(this,Oe));E(this,Ie).unshift(o==null?void 0:o.response),this._renderToastContainer("File Uploaded Successfully","success",E(this,Ae))}catch{this._renderToastContainer("Something went wrong while uploading file. Please try again later.","error",E(this,Ae))}finally{H(this,tt,!1),this._updateSelectedImageListContainerUI()}}async _updateFile(e,t){ve.updateUploadBtn(!0);try{const r=await os(t.key,e,t.nestedFolderName,t.url,t.thumborUrl,t.proxyUrl,t.type,E(this,Ut),E(this,Oe)),n=E(this,Ie).find(i=>i.key===r.response.key);n.name=e,this._fetchFilesFromFolder(E(this,nt).name),H(this,Ie,[]),H(this,we,[]),this._renderToastContainer("File Updated Successfully","success",E(this,Ae))}catch{this._renderToastContainer("Something went wrong while updating the file. Please try again later.","error",E(this,Ae))}finally{ve.updateUploadBtn(!1),ve.hide(),this._updateSelectedImageListContainerUI()}}async _deleteFile(e){ve.updateUploadBtn(!0);try{await as(e,E(this,Oe)),H(this,Ie,E(this,Ie).filter(t=>e!==t.key)),this._renderToastContainer("File Deleted Successfully","success",E(this,Ae))}catch{this._renderToastContainer("Something went wrong while deleting the file. Please try again later.","error",E(this,Ae))}finally{ve.updateUploadBtn(!1),ve.hide(),this._updateSelectedImageListContainerUI()}}async _createFolder(e,t=2){var r;try{const n=await ws(e,(r=E(this,nt))==null?void 0:r.name,"",E(this,Oe));H(this,we,[]),H(this,Ie,[]);const i=Ls(E(this,ot),n==null?void 0:n.response);H(this,ot,i),H(this,kt,e),H(this,nt,{...n==null?void 0:n.response,children:{}}),this._fetchFilesFromFolder(e),this._renderToastContainer(`Folder ${e} created successfully`,"success",E(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",E(this,Ae)),new Error(`Error creating folder "${e}". Either folder already exist or failed to create folder`)}finally{this._updateFolderListContainer()}}async _upload(){return E(this,ln)?E(this,we):E(this,jt)}async _uploadFromSource(e,t){this._removeUserToast();const r=200*1024;try{const n=e.size>r?await Qr(e):e;return await new Promise((o,a)=>{const c=new FileReader;c.readAsDataURL(n),c.onerror=()=>{a(c.error)},c.onload=async()=>{var d;try{const l=await qs(c.result,n,t),u=await rs(l,Qe[Zn((d=n.type)==null?void 0:d.split("/")[0])],t);o(u)}catch(l){a(l)}}})}catch(n){throw n}}_uploadingState(){return E(this,tt)}async _fetchFilesFromFolder(e){var t,r,n;H(this,je,!0),this._updateSelectedImageListContainerUI();try{const i=await is(e,E(this,lt),20,E(this,Oe)),o=(t=i.response)==null?void 0:t.files;E(this,Ie).push(...o),H(this,lt,(r=i.response)==null?void 0:r.nextCursor),H(this,Tt,(n=i.response)==null?void 0:n.hasMore)}catch{throw this._renderToastContainer("Error while fetching files from folder"+e,"error",E(this,Ae)),new Error("Something went wrong. Error while fetching files from folder"+e)}finally{H(this,je,!1),this._updateSelectedImageListContainerUI()}}async _fetchAllFolders(){var e,t;H(this,je,!0),H(this,Rt,!0),this._updateSelectedImageListContainerUI(),this._updateFolderListContainer(),this._removeToastContainer();try{const n=(await gs("",200,E(this,Oe))).response.folder,i=Ts(n);H(this,kt,(e=i[0])==null?void 0:e.name),this._fetchFilesFromFolder((t=i[0])==null?void 0:t.name),H(this,nt,i[0]),H(this,ot,i)}catch{H(this,je,!1),this._renderToastContainer("Folder not found. Please create a folder or try again later","error",E(this,Ae))}finally{H(this,Rt,!1),this._updateFolderListContainer()}}async _search(e){var t,r;H(this,je,!0),this._updateSelectedImageListContainerUI(),this._removeToastContainer();try{const n=await ss(e,E(this,lt),10,E(this,Oe)),i=(t=n.response)==null?void 0:t.items;E(this,Ie).push(...i),H(this,lt,(r=n.response)==null?void 0:r.nextPageCursor)}catch{this._renderToastContainer("Error while searching files","error",E(this,Ae))}finally{H(this,je,!1),this._updateSelectedImageListContainerUI()}}async _updateFolder(e,t){ve.updateUploadBtn(!0);try{const r=await ys(t.key,e,t.nestedFolderName,t.createdBy,E(this,Oe))}catch{throw this._renderToastContainer("Something went wrong while updating the folder. Please try again later.","error",E(this,Ae)),new Error("Error updating the folder ")}finally{ve.updateUploadBtn(!1),ve.hide(),this._updateFolderListContainer()}}async _deleteFolder(e){ve.updateUploadBtn(!0);try{await bs(e,E(this,Oe)),H(this,ot,E(this,ot).filter(t=>t.key!==e)),this._renderToastContainer("Folder Deleted Successfully","success",E(this,Ae))}catch{throw this._renderToastContainer("Something went wrong while deleting the folder. Please try again later.","error",E(this,Ae)),new Error("Error deleting the folder ")}finally{ve.updateUploadBtn(!1),ve.hide(),this._updateFolderListContainer()}}_createUpdateFolderDialog(e,t,r){e.addEventListener("click",n=>{n.stopPropagation(),Ze.hide();let i;const o=K("edit-form-wrapper"),a=K("form-control"),c=oe("Folder Name","input-label"),d=K();d.style.position="relative";const l=document.createElement("input");l.style.paddingLeft="40px";const u=oe();u.appendChild(nn()),u.style.position="absolute",u.style.top="50%",u.style.left="5%",u.style.transform="translate(-40%, -40%)",l.classList.add("input-field"),d.append(l,u),t==="update"&&(l.value=r.name),l.onchange=h=>{i=h.target.value},a.append(c,d),o.append(a),ve.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,r),ve.hide()}})})}updateWindowObject(e){window.ImageSalonSDK={...window.ImageSalonSDK,...e}}_initializeGrpcConfig(e,t){let r="https://hamro-cms-backend-grpc.hamrostack.com";t&&(e==="production"||e==="development")?r=t:e==="production"&&(r="https://page-api-grpc.hamropatro.com");const n=new $i({baseUrl:r});this.updateWindowObject({grpcConfig:n})}}return At=new WeakMap,Ae=new WeakMap,ke=new WeakMap,wt=new WeakMap,we=new WeakMap,Ie=new WeakMap,tt=new WeakMap,je=new WeakMap,Rt=new WeakMap,kt=new WeakMap,ot=new WeakMap,nt=new WeakMap,Ft=new WeakMap,Pt=new WeakMap,Qn=new WeakMap,Nt=new WeakMap,It=new WeakMap,yt=new WeakMap,Dt=new WeakMap,at=new WeakMap,lt=new WeakMap,Tt=new WeakMap,Lt=new WeakMap,bt=new WeakMap,Wt=new WeakMap,on=new WeakMap,Oe=new WeakMap,Ct=new WeakMap,an=new WeakMap,Un=new WeakMap,ln=new WeakMap,ct=new WeakMap,jt=new WeakMap,Ut=new WeakMap,qt=new WeakMap,Zt=new WeakMap,Kt=new WeakMap,zt=new WeakMap,Xt=new WeakMap,cn=new WeakMap,dn=new WeakMap,Gt=new WeakMap,dt=new WeakMap,Jt=new WeakMap,Ks});
|
|
120
|
+
`,r.textContent="Looks Empty!"),e.append(t,r),E(this,ke).appendChild(e)}_renderLoadingUI(){const e=Z("skeleton");e.innerHTML="",E(this,ke).appendChild(e)}_fileCardBody(e){var gt,Yt,_n,en;const t=Z("selected-image-content"),r=Z("selected-image-top-bar"),n=He("","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)===Qe.IMAGE&&(i=Mr(e==null?void 0:e.url,"selected-image"),o=ks()),(e==null?void 0:e.type)===Qe.VIDEO&&(i=Os(e==null?void 0:e.url,"uploaded-video"),o=Ts()),(e==null?void 0:e.type)===Qe.AUDIO&&(i=Ss(e==null?void 0:e.url,"uploaded-audio"),o=As());const a=Z("selected-image-wrapper");a.setAttribute("data-key",e==null?void 0:e.key);const c=$t(e==null?void 0:e.name,"selected-image-name"),h=oe("","selected-image-type");h.append(o),r.append(h,n);const l=Z();l.style.marginTop="10px",l.style.display="flex",l.style.justifyContent="space-between",l.style.alignItems="center",l.append(c),t.append(r,i),a.append(t,l);const u=Z("action-wrapper"),d=He("","action-option preview"),f=oe("Preview",""),y=Ns();d.append(y,f);const N=He("","action-option move"),T=oe("Move",""),C=Fs();N.append(C,T);const R=He("","action-option rename"),O=oe("Rename",""),A=Or();R.append(A,O);const U=He("","action-option delete"),b=oe("Delete",""),B=Sr();U.append(B,b);const m=e.name.split(".")[0],g=e.name.split(".")[1],k=sn[e.type],I=Z("edit-form-wrapper"),F=Z("move-form-wrapper"),L=Z("preview-details-container"),v=Z("preview-details-wrapper"),_=Z("preview-option-image-wrapper"),w=Z("preview-option-wrapper"),p=Z("preview-option-wrapper"),M=Z("preview-option-wrapper"),x=Z("preview-option-wrapper"),V=Z("preview-option-wrapper"),K=Z("preview-option-wrapper"),P=Z("preview-option-wrapper"),q=Mr(e.url,"preview-option-image");_.append(q);const $=oe("File name","preview-title"),S=Z("preview-option-name");S.innerHTML=e.name,w.append($,S);const X=oe("Folder name","preview-title"),ce=oe(e.folderName,"preview-option-name");p.append(X,ce);const te=oe("File Extension","preview-title"),Y=oe(g,"preview-option-name extension");M.append(te,Y);const ae=oe("File type","preview-title"),we=oe(k,"preview-option-name");x.append(ae,we);const Fe=oe("Dimension","preview-title"),At=oe(`${(gt=e==null?void 0:e.metadata)==null?void 0:gt.width} * ${(Yt=e==null?void 0:e.metadata)==null?void 0:Yt.height}`,"preview-option-name");V.append(Fe,At);const Ze=oe("URL","preview-title"),me=oe(e.url,"preview-option-name url");K.append(Ze,me);const Le=oe("Parent folder","preview-title"),de=oe(e.nestedFolderName,"preview-option-name");P.append(Le,de),v.append(p,w,M,x,((_n=e==null?void 0:e.metadata)==null?void 0:_n.width)>0&&((en=e==null?void 0:e.metadata)==null?void 0:en.height)>0?V:"",K,e.nestedFolderName?P:""),L.append(_,v);const re=Z("form-control"),Ce=document.createElement("input");re.appendChild(Ce),Ce.classList.add("input-field"),Ce.value=e.name;const Ue=Z("form-control"),Ee=oe("Current Folder:","input-label"),xe=Z("folder-field current");xe.textContent=e.folderName,xe.prepend(rn()),Ue.append(Ee,xe);const ye=Z("form-control"),ee=Z();ee.style.width="100%",ee.style.display="flex",ee.style.alignItems="center",ee.style.justifyContent="space-between";const $e=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(qn("14px","14px","#333")),ee.append($e,Re);const pt=Z();pt.style.width="100%",pt.style.maxHeight="250px",pt.style.overflowY="auto";const Ie=document.createElement("ul");Ie.className="folders",pt.append(Ie),ye.append(ee,pt),E(this,ct).forEach(ue=>{const Ke=this._renderEditFolderListContainer(ue);Ie.appendChild(Ke)});const mt=Z("form-control"),_e=oe("Destination Folder:","input-label"),We=Z("folder-field source","source-folder-wrapper"),De=document.createElement("span");De.id="source-folder-name",De.textContent=E(this,Lt)?E(this,Lt):e.folderName,We.append(rn(),De);let Me="";mt.append(_e,We),Ce.onchange=ue=>{Me=ue.target.value},Me=Me!==""?Me:e.name,I.append(re),F.append(Ue,ye,mt),u.append(d,N,R,U),d.onclick=ue=>{ue.stopPropagation(),Je.hide(),Ae.show({content:L,header:m,dialogContentStyle:{minWidth:"60rem",padding:"10px"},showCloseBtn:!0})},N.onclick=ue=>{ue.stopPropagation(),Je.hide(),Ae.show({content:F,header:`Move "${e.name}"`,confirmButtonText:"Move",dialogContentStyle:{minWidth:"35rem",padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{Ae.hide()},onConfirm:()=>{this._updateFile(Me,e)}})},R.onclick=ue=>{ue.stopPropagation(),Je.hide(),Ae.show({content:I,header:"Rename",confirmButtonText:"Update",dialogContentStyle:{padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{Ae.hide()},onConfirm:()=>{this._updateFile(Me,e)}})},U.onclick=ue=>{ue.stopPropagation(),Je.hide(),Ae.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)}})},n.addEventListener("click",ue=>{ue.stopPropagation(),Je.hide(),Je.show({content:u,mainContainer:r,divId:e.key}),H(this,Mt,e.key)}),i.addEventListener("click",()=>{const ue=E(this,pe).findIndex(wt=>(wt==null?void 0:wt.key)===(e==null?void 0:e.key));if(t.classList.contains("checked"))t.classList.remove("checked"),ue!==-1&&(E(this,pe).splice(ue,1),E(this,Nt)===1&&a.remove());else{if(E(this,xn))E(this,pe).push(e);else{const wt=document.querySelector(".selected-image-wrapper .checked");wt==null||wt.classList.remove("checked"),H(this,pe,[e])}t.classList.add("checked")}this._updateContent()}),document.addEventListener("click",ue=>{const Ke=document.querySelector(`#${E(this,Mt)}`);Ke&&(ue.composedPath().includes(Ke)||Je.hide())}),E(this,pe).findIndex(ue=>(ue==null?void 0:ue.key)===(e==null?void 0:e.key))!==-1?(t.classList.add("checked"),E(this,vt)?E(this,ke).prepend(a):E(this,ke).appendChild(a)):E(this,ke).appendChild(a)}_renderImageCard(e){this._fileCardBody(e)}_renderImageListContainer(){var e,t;((e=E(this,Ne))==null?void 0:e.length)>0&&((t=E(this,Ne))==null||t.forEach(r=>{this._renderImageCard(r)}))}_renderSelectedImageListContainer(){var e;((e=E(this,pe))==null?void 0:e.length)>0&&E(this,pe).forEach(t=>{this._renderImageCard(t)})}_renderFolderListLoadingUI(){const e=document.createElement("div");e.style.paddingInline="20px";for(let t=0;t<4;t++){const r=Z("skeleton");r.className="skeleton folder",r.innerHTML="",e.appendChild(r)}return e}_renderFolderListContainer(e){var O;const t=document.createElement("li");t.className="folder";const r=document.createElement("div");r.style.position="relative",r.style.display="flex",r.style.alignItems="center",r.style.gap="2px";const n=document.createElement("span"),i=document.createElement("span");if(i.className="folder-name",i.textContent=e==null?void 0:e.name,n.appendChild(rn()),r.append(n,i),t.append(r),e.children&&Object.keys(e.children).length>0){const A=document.createElement("button");A.classList.add("expand-icon"),A.appendChild(_r()),r.prepend(A);const U=document.createElement("ul");U.className="folders nested",t.appendChild(U),A.addEventListener("click",b=>{b.stopPropagation(),t.classList.toggle("active"),U.classList.toggle("visible")}),Object.values(e.children).forEach((b,B)=>{const m=this._renderFolderListContainer(b);U.appendChild(m)})}const o=He("","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>'),a=Z("action-wrapper"),c=He("","action-option edit"),h=oe("Edit",""),l=Or();c.append(l,h);const u=Z("edit-form-wrapper"),d=Z("name-field-wrapper"),f=oe("Name","input-label"),y=document.createElement("input");y.classList.add("input-field"),y.value=e.name,y.onchange=A=>{A.target.value},d.append(f,y),u.append(d);const N={key:e.key,name:e.name,nestedFolderName:e.nestedFolderName,createdBy:e.createdBy,forUser:!0};this._createUpdateFolderDialog(c,"update",N);const T=He("","action-option delete"),C=oe("Delete",""),R=Sr();return T.append(R,C),a.append(c,T),T.onclick=A=>{A.stopPropagation(),Je.hide(),Ae.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)}})},o.addEventListener("click",A=>{A.stopPropagation(),Je.hide(),Je.show({content:a,mainContainer:r,divId:e.key}),H(this,Mt,e.key)}),r.appendChild(o),t.addEventListener("click",A=>{var U;A.stopPropagation(),H(this,nt,e),H(this,Ft,e==null?void 0:e.name),H(this,pe,[]),H(this,Ne,[]),H(this,ht,""),H(this,It,!1),(U=document.querySelector(".folder.selected"))==null||U.classList.remove("selected"),t.classList.add("selected"),this._fetchFilesFromFolder(e.name)}),((O=E(this,nt))==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 r=document.createElement("div");r.style.position="relative",r.style.display="flex",r.style.alignItems="center",r.style.gap="2px";const n=document.createElement("span"),i=document.createElement("span");if(i.className="folder-name",i.textContent=e==null?void 0:e.name,n.appendChild(rn()),r.append(n,i),t.append(r),e.children&&Object.keys(e.children).length>0){const a=document.createElement("button");a.classList.add("expand-icon"),a.appendChild(_r()),r.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(),H(this,Lt,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=E(this,nt))==null?void 0:o.key)===(e==null?void 0:e.key)&&t.classList.add("selected"),t}_updateFolderListContainer(){if(E(this,it))if(E(this,st).innerHTML="",E(this,St)){const e=this._renderFolderListLoadingUI();E(this,st).appendChild(e)}else{const e=document.createElement("ul");e.className="folders",E(this,st).appendChild(e),E(this,ct).forEach(t=>{const r=this._renderFolderListContainer(t);e.appendChild(r)}),E(this,it).appendChild(E(this,st))}}_renderToastContainer(e,t,r){this._removeToastContainer(),H(this,dt,document.createElement("div")),E(this,dt).className=`message-container ${t}`;const n=$t(e,"message"),i=t==="success"?Br():qn(),o=He("");o.style.cursor="pointer",o.style.border="0",o.style.outline="none",o.style.background="transparent",o.appendChild(Zn(t==="error"?"#ee3f3f":"#4caf50")),o.setAttribute("fill",t==="error"?"#ee3f3f":"#4caf50"),o.onclick=()=>this._removeToastContainer(),E(this,dt).append(i,n,o),r.appendChild(E(this,dt)),setTimeout(()=>{this._removeToastContainer()},5e3)}_removeToastContainer(){E(this,dt)&&(E(this,dt).remove(),H(this,dt,null))}_updateSelectedImageListContainerUI(){var t,r;if(!E(this,ke))return;E(this,ke).innerHTML="",E(this,tt)&&this._renderLoadingUI(),E(this,je)&&this._renderFetchingSkeletonUI();const e=document.getElementById("search-input-wrapper");E(this,Nt)===0?(e&&(e.style.visibility="visible"),((t=E(this,Ne))==null?void 0:t.length)===0&&!E(this,je)?(E(this,ke).classList.add("no-selected-image-container"),this._renderEmptyImageContainer()):(E(this,ke).classList.remove("no-selected-image-container"),this._renderImageListContainer())):(e&&(e.style.visibility="hidden"),((r=E(this,pe))==null?void 0:r.length)===0?(E(this,ke).classList.add("no-selected-image-container"),this._renderEmptyImageContainer()):(E(this,ke).classList.remove("no-selected-image-container"),this._renderSelectedImageListContainer())),this._updateContent()}_updateContent(){var t,r,n;const e=document.getElementById("selected-images-tab");e&&(e.textContent=`Selected (${(t=E(this,pe))==null?void 0:t.length})`),E(this,rt).textContent=`Save (${(r=E(this,pe))==null?void 0:r.length})`,E(this,rt).disabled=((n=E(this,pe))==null?void 0:n.length)===0}async _uploadAndAddSelectedImageList(e,t){var r,n;this._updateSelectedImageListContainerUI();try{const i=await Yr(e,t,E(this,Se)),o=await is(t==null?void 0:t.name,"",i,Qe[Xn((r=t.type)==null?void 0:r.split("/")[0])],(n=E(this,nt))==null?void 0:n.name,E(this,Se));E(this,Ne).unshift(o==null?void 0:o.response),this._renderToastContainer("File Uploaded Successfully","success",E(this,fe))}catch{this._renderToastContainer("Something went wrong while uploading file. Please try again later.","error",E(this,fe))}finally{H(this,tt,!1),this._updateSelectedImageListContainerUI()}}async _updateFile(e,t){Ae.updateUploadBtn(!0);try{const r=await cs(t.key,e,t.nestedFolderName,t.url,t.thumborUrl,t.proxyUrl,t.type,E(this,Lt),E(this,Se)),n=E(this,Ne).find(i=>i.key===r.response.key);n.name=e,this._fetchFilesFromFolder(E(this,nt).name),H(this,Ne,[]),H(this,pe,[]),this._renderToastContainer("File Updated Successfully","success",E(this,fe))}catch{this._renderToastContainer("Something went wrong while updating the file. Please try again later.","error",E(this,fe))}finally{Ae.updateUploadBtn(!1),Ae.hide(),this._updateSelectedImageListContainerUI()}}async _deleteFile(e){Ae.updateUploadBtn(!0);try{await ds(e,E(this,Se)),H(this,Ne,E(this,Ne).filter(t=>e!==t.key)),this._renderToastContainer("File Deleted Successfully","success",E(this,fe))}catch{this._renderToastContainer("Something went wrong while deleting the file. Please try again later.","error",E(this,fe))}finally{Ae.updateUploadBtn(!1),Ae.hide(),this._updateSelectedImageListContainerUI()}}async _createFolder(e,t=2){var r;try{const n=await Cs(e,(r=E(this,nt))==null?void 0:r.name,"",!1,E(this,Se));H(this,pe,[]),H(this,Ne,[]);const i=_s(E(this,ct),n==null?void 0:n.response);H(this,ct,i),H(this,Ft,e),H(this,nt,{...n==null?void 0:n.response,children:{}}),this._fetchFilesFromFolder(e),this._renderToastContainer(`Folder ${e} created successfully`,"success",E(this,fe))}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",E(this,fe)),new Error(`Error creating folder "${e}". Either folder already exist or failed to create folder`)}finally{this._updateFolderListContainer()}}async _upload(){return E(this,ln)?E(this,pe):E(this,qt)}async _uploadFromSource(e,t){this._removeUserToast();const r=200*1024;try{const n=e.size>r?await ti(e):e;return await new Promise((o,a)=>{const c=new FileReader;c.readAsDataURL(n),c.onerror=()=>{a(c.error)},c.onload=async()=>{var h;try{const l=await zs(c.result,n,t),u=await os(l,Qe[Xn((h=n.type)==null?void 0:h.split("/")[0])],t);o(u)}catch(l){a(l)}}})}catch(n){throw n}}_uploadingState(){return E(this,tt)}async _fetchFilesFromFolder(e){var t,r,n;H(this,je,!0),this._updateSelectedImageListContainerUI();try{const i=await as(e,E(this,ht),20,E(this,Se)),o=(t=i.response)==null?void 0:t.files;E(this,Ne).push(...o),H(this,ht,(r=i.response)==null?void 0:r.nextCursor),H(this,It,(n=i.response)==null?void 0:n.hasMore)}catch{throw this._renderToastContainer("Error while fetching files from folder"+e,"error",E(this,fe)),new Error("Something went wrong. Error while fetching files from folder"+e)}finally{H(this,je,!1),this._updateSelectedImageListContainerUI()}}async _fetchAllFolders(){var e,t;H(this,je,!0),H(this,St,!0),this._updateSelectedImageListContainerUI(),this._updateFolderListContainer(),this._removeToastContainer();try{const n=(await bs("",1e3,E(this,Se))).response.folder,i=xs(n);H(this,Ft,(e=i[0])==null?void 0:e.name),this._fetchFilesFromFolder((t=i[0])==null?void 0:t.name),H(this,nt,i[0]),H(this,ct,i)}catch{H(this,je,!1),this._renderToastContainer("Folder not found. Please create a folder or try again later","error",E(this,fe))}finally{H(this,St,!1),this._updateFolderListContainer()}}async _search(e){var t,r;H(this,je,!0),this._updateSelectedImageListContainerUI(),this._removeToastContainer();try{const n=await ls(e,E(this,ht),10,E(this,Se)),i=(t=n.response)==null?void 0:t.items;E(this,Ne).push(...i),H(this,ht,(r=n.response)==null?void 0:r.nextPageCursor)}catch{this._renderToastContainer("Error while searching files","error",E(this,fe))}finally{H(this,je,!1),this._updateSelectedImageListContainerUI()}}async _updateFolder(e,t){Ae.updateUploadBtn(!0);try{const r=await Es(t.key,e,t.nestedFolderName,t.createdBy,E(this,Se))}catch{throw this._renderToastContainer("Something went wrong while updating the folder. Please try again later.","error",E(this,fe)),new Error("Error updating the folder ")}finally{Ae.updateUploadBtn(!1),Ae.hide(),this._updateFolderListContainer()}}async _deleteFolder(e){Ae.updateUploadBtn(!0);try{await vs(e,E(this,Se)),H(this,ct,E(this,ct).filter(t=>t.key!==e)),this._renderToastContainer("Folder Deleted Successfully","success",E(this,fe))}catch{throw this._renderToastContainer("Something went wrong while deleting the folder. Please try again later.","error",E(this,fe)),new Error("Error deleting the folder ")}finally{Ae.updateUploadBtn(!1),Ae.hide(),this._updateFolderListContainer()}}_createUpdateFolderDialog(e,t,r){e.addEventListener("click",n=>{n.stopPropagation(),Je.hide();let i;const o=Z("edit-form-wrapper"),a=Z("form-control"),c=oe("Folder Name","input-label"),h=Z();h.style.position="relative";const l=document.createElement("input");l.style.paddingLeft="40px";const u=oe();u.appendChild(rn()),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=r.name),l.onchange=d=>{i=d.target.value},a.append(c,h),o.append(a),Ae.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,r),Ae.hide()}})})}updateWindowObject(e){window.ImageSalonSDK={...window.ImageSalonSDK,...e}}_initializeGrpcConfig(e,t){let r="https://hamro-cms-backend-grpc.hamrostack.com";t&&(e==="production"||e==="development")?r=t:e==="production"&&(r="https://page-api-grpc.hamropatro.com");const n=new ji({baseUrl:r});this.updateWindowObject({grpcConfig:n})}}return Ct=new WeakMap,fe=new WeakMap,ke=new WeakMap,Et=new WeakMap,pe=new WeakMap,Ne=new WeakMap,tt=new WeakMap,je=new WeakMap,St=new WeakMap,Ft=new WeakMap,ct=new WeakMap,nt=new WeakMap,rt=new WeakMap,Rt=new WeakMap,tr=new WeakMap,Nt=new WeakMap,it=new WeakMap,st=new WeakMap,Dt=new WeakMap,dt=new WeakMap,ht=new WeakMap,It=new WeakMap,Tt=new WeakMap,vt=new WeakMap,jt=new WeakMap,on=new WeakMap,Se=new WeakMap,Mt=new WeakMap,an=new WeakMap,xn=new WeakMap,ln=new WeakMap,ut=new WeakMap,qt=new WeakMap,Lt=new WeakMap,Zt=new WeakMap,Kt=new WeakMap,zt=new WeakMap,Xt=new WeakMap,Gt=new WeakMap,cn=new WeakMap,dn=new WeakMap,Jt=new WeakMap,ft=new WeakMap,Qt=new WeakMap,hn=new WeakMap,Gs});
|