image-salon-sdk 1.0.77 → 1.0.78
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/image-salon-sdk.js +801 -813
- package/dist/image-salon-sdk.umd.cjs +8 -8
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import './style.css';
|
|
2
|
-
(function(ne,ae){typeof exports=="object"&&typeof module<"u"?module.exports=ae():typeof define=="function"&&define.amd?define(ae):(ne=typeof globalThis<"u"?globalThis:ne||self,ne.ImageSalonSdk=ae())})(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 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 oi(s,e){return Object.assign(Object.assign({},s),e)}var $;(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"})($||($={}));function ai(){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 On(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 Sn(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 li(){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 ci(){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}ci();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():Sn(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"-"+Sn(e.lo,e.hi)}return Sn(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 hi(s)};function di(s){return s?Object.assign(Object.assign({},cr),s):cr}class hi{constructor(e,t){this.varint64=ai,this.uint32=li,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 $.Varint:for(;this.buf[this.pos++]&128;);break;case $.Bit64:this.pos+=4;case $.Bit32:this.pos+=4;break;case $.LengthDelimited:let r=this.uint32();this.pos+=r;break;case $.StartGroup:let n;for(;(n=this.tag()[1])!==$.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 ui=34028234663852886e22,fi=-34028234663852886e22,pi=4294967295,mi=2147483647,gi=-2147483648;function tn(s){if(typeof s!="number")throw new Error("invalid int 32: "+typeof s);if(!Number.isInteger(s)||s>mi||s<gi)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>pi||s<0)throw new Error("invalid uint 32: "+s)}function Rn(s){if(typeof s!="number")throw new Error("invalid float 32: "+typeof s);if(Number.isFinite(s)&&(s>ui||s<fi))throw new Error("invalid float 32: "+s)}const dr={writeUnknownFields:!0,writerFactory:()=>new yi};function wi(s){return s?Object.assign(Object.assign({},dr),s):dr}class yi{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 tn(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){Rn(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){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,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 On(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 On(n,i,this.buf),this}uint64(e){let t=Be.from(e);return On(t.lo,t.hi,this.buf),this}}const hr={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},ur={ignoreUnknownFields:!1};function bi(s){return s?Object.assign(Object.assign({},ur),s):ur}function Ci(s){return s?Object.assign(Object.assign({},hr),s):hr}function Ei(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 Dn(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 ot;(function(s){s[s.BIGINT=0]="BIGINT",s[s.STRING=1]="STRING",s[s.NUMBER=2]="NUMBER"})(ot||(ot={}));var wn;(function(s){s[s.NO=0]="NO",s[s.PACKED=1]="PACKED",s[s.UNPACKED=2]="UNPACKED"})(wn||(wn={}));function vi(s){var e,t,r,n;return s.localName=(e=s.localName)!==null&&e!==void 0?e:Dn(s.name),s.jsonName=(t=s.jsonName)!==null&&t!==void 0?t:Dn(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 Ai(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 ki{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(!Ai(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 ot.BIGINT:return n=="bigint";case ot.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,ot.STRING)}}}function Ge(s,e){switch(e){case ot.BIGINT:return s.toBigInt();case ot.NUMBER:return s.toNumber();default:return s.toString()}}class Ii{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(ae(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,ot.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&&Rn(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):tn(a),a;case D.INT64:case D.SFIXED64:case D.SINT64:if(e===null)return Ge(ve.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return Ge(ve.from(e),r);case D.FIXED64:case D.UINT64:if(e===null)return Ge(Be.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return Ge(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:(tn(t),t);case D.FIXED32:case D.UINT32:return t===0?o?0:void 0:(gn(t),t);case D.FLOAT:Rn(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 Mn(s,e=ot.STRING){switch(s){case D.BOOL:return!1;case D.UINT64:case D.FIXED64:return Ge(Be.ZERO,e);case D.INT64:case D.SFIXED64:case D.SINT64:return Ge(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 N=h[u];if(a==$.LengthDelimited&&d!=D.STRING&&d!=D.BYTES){let C=e.uint32()+e.pos;for(;e.pos<C;)N.push(this.scalar(e,d,f))}else N.push(this.scalar(e,d,f))}else h[u]=this.scalar(e,d,f);break;case"message":if(l){let N=h[u],C=c.T().internalBinaryRead(e,e.uint32(),r);N.push(C)}else h[u]=c.T().internalBinaryRead(e,e.uint32(),r,h[u]);break;case"map":let[y,I]=this.mapEntry(c,e,r);h[u][y]=I;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,ot.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=Mn(e.K);o=e.K==D.BOOL?c.toString():c}if(a===void 0)switch(e.V.kind){case"scalar":a=Mn(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 Ge(e.int64(),r);case D.UINT64:return Ge(e.uint64(),r);case D.FIXED64:return Ge(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 Ge(e.sfixed64(),r);case D.SINT32:return e.sint32();case D.SINT64:return Ge(e.sint64(),r)}}}class Ti{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,$.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,$.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,$.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=$.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=$.LengthDelimited,n="string";break;case D.BOOL:o=t===!1,n="bool";break;case D.UINT32:n="uint32";break;case D.DOUBLE:r=$.Bit64,n="double";break;case D.FLOAT:r=$.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=$.Bit64,n="fixed64";break;case D.BYTES:o=i||!t.byteLength,r=$.LengthDelimited,n="bytes";break;case D.FIXED32:r=$.Bit32,n="fixed32";break;case D.SFIXED32:r=$.Bit32,n="sfixed32";break;case D.SFIXED64:o=i||ve.from(t).isZero(),r=$.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 Li(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]=Mn(t.T,t.L);break;case"enum":e[r]=0;break;case"map":e[r]={};break}}return e}function ye(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 Ui(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 xi=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({}));class Te{constructor(e,t,r){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(vi),this.options=r??{},this.messagePrototype=Object.create(null,Object.assign(Object.assign({},xi),{[fr]:{value:this}})),this.refTypeCheck=new ki(this),this.refJsonReader=new Ii(this),this.refJsonWriter=new Fi(this),this.refBinReader=new Ni(this),this.refBinWriter=new Ti(this)}create(e){let t=Li(this);return e!==void 0&&ye(this,t,e),t}clone(e){let t=this.create();return ye(this,t,e),t}equals(e,t){return Ui(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){ye(this,e,t)}fromBinary(e,t){let r=di(t);return this.internalBinaryRead(r.readerFactory(e),e.byteLength,r)}fromJson(e,t){return this.internalJsonRead(e,bi(t))}fromJsonString(e,t){let r=JSON.parse(e);return this.fromJson(r,t)}toJson(e,t){return this.internalJsonWrite(e,Ci(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=wi(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 _i(s,e){var t,r,n;let i=s;return i.service=e,i.localName=(t=i.localName)!==null&&t!==void 0?t:Dn(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 Vn{constructor(e,t,r){this.typeName=e,this.methods=t.map(n=>_i(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 $i(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 Zi(s){switch(s){case 200:return Z.OK;case 400:return Z.INVALID_ARGUMENT;case 401:return Z.UNAUTHENTICATED;case 403:return Z.PERMISSION_DENIED;case 404:return Z.NOT_FOUND;case 409:return Z.ABORTED;case 412:return Z.FAILED_PRECONDITION;case 429:return Z.RESOURCE_EXHAUSTED;case 499:return Z.CANCELLED;case 500:return Z.UNKNOWN;case 501:return Z.UNIMPLEMENTED;case 503:return Z.UNAVAILABLE;case 504:return Z.DEADLINE_EXCEEDED;default:return Z.UNKNOWN}}class ji{constructor(e){this.defaultOptions=e}mergeOptions(e){return Bi(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",Z[Z.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",Z[Z.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 At,y=new Oi,I=!0,N,C=new At,R,O=new At;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(v=>{let[L,b,B]=Hn(v);if(f.resolve(B),L!=null&&L!==Z.OK)throw new se(b??Z[L],Z[L],B);return L!=null&&(N={code:Z[L],detail:b??Z[L]}),v}).then(v=>{if(!v.body)throw new se("missing response body",Z[Z.INTERNAL]);return Cr(v.body,v.headers.get("content-type"),(L,b)=>{switch(L){case Je.DATA:y.notifyMessage(e.O.fromBinary(b,c.binaryOptions)),I=!1;break;case Je.TRAILER:let B,m;[B,m,R]=br(b),N={code:Z[B],detail:m??Z[B]};break}})}).then(()=>{if(!R&&!I)throw new se("missing trailers",Z[Z.DATA_LOSS]);if(!N)throw new se("missing status",Z[Z.INTERNAL]);if(N.code!=="OK")throw new se(N.detail,N.code,R);y.notifyComplete(),C.resolve(N),O.resolve(R||{})}).catch(v=>{let L;v instanceof se?L=v:v instanceof Error&&v.name==="AbortError"?L=new se(v.message,Z[Z.CANCELLED]):L=new se(v instanceof Error?v.message:""+v,Z[Z.INTERNAL]),L.methodName=e.name,L.serviceName=e.service.typeName,f.rejectPending(L),y.notifyError(L),C.rejectPending(L),O.rejectPending(L)}),new Mi(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 At,y,I=new At,N,C=new At,R,O=new At;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(v=>{let[L,b,B]=Hn(v);if(f.resolve(B),L!=null&&L!==Z.OK)throw new se(b??Z[L],Z[L],B);return L!=null&&(N={code:Z[L],detail:b??Z[L]}),v}).then(v=>{if(!v.body)throw new se("missing response body",Z[Z.INTERNAL]);return Cr(v.body,v.headers.get("content-type"),(L,b)=>{switch(L){case Je.DATA:if(y)throw new se("unary call received 2nd message",Z[Z.DATA_LOSS]);y=e.O.fromBinary(b,c.binaryOptions);break;case Je.TRAILER:let B,m;[B,m,R]=br(b),N={code:Z[B],detail:m??Z[B]};break}})}).then(()=>{if(!R&&y)throw new se("missing trailers",Z[Z.DATA_LOSS]);if(!N)throw new se("missing status",Z[Z.INTERNAL]);if(!y&&N.code==="OK")throw new se("expected error status",Z[Z.DATA_LOSS]);if(!y)throw new se(N.detail,N.code,R);if(I.resolve(y),N.code!=="OK")throw new se(N.detail,N.code,R);C.resolve(N),O.resolve(R||{})}).catch(v=>{let L;v instanceof se?L=v:v instanceof Error&&v.name==="AbortError"?L=new se(v.message,Z[Z.CANCELLED]):L=new se(v instanceof Error?v.message:""+v,Z[Z.INTERNAL]),L.methodName=e.name,L.serviceName=e.service.typeName,f.rejectPending(L),I.rejectPending(L),C.rejectPending(L),O.rejectPending(L)}),new Ri(e,(a=c.meta)!==null&&a!==void 0?a:{},t,f.promise,I.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&&ye(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,$.LengthDelimited).string(e.searchValue),e.cursor!==""&&t.tag(2,$.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(3,$.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:()=>Ye},{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&&ye(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(Ye.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++)Ye.internalBinaryWrite(e.items[i],t.tag(1,$.LengthDelimited).fork(),r).join();e.nextPageCursor!==""&&t.tag(2,$.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 Xi 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&&ye(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,$.LengthDelimited).string(e.name),e.folderName!==""&&t.tag(2,$.LengthDelimited).string(e.folderName),e.nestedFolderName!==""&&t.tag(3,$.LengthDelimited).string(e.nestedFolderName),e.url!==""&&t.tag(4,$.LengthDelimited).string(e.url),e.type!==0&&t.tag(5,$.Varint).int32(e.type),e.extension!==""&&t.tag(6,$.LengthDelimited).string(e.extension);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Ir=new Xi;class Gi 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&&ye(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,$.LengthDelimited).string(e.url),e.type!==0&&t.tag(2,$.Varint).int32(e.type),e.extension!==""&&t.tag(3,$.LengthDelimited).string(e.extension);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Wn=new Gi;class Ji 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:()=>Pn}])}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&&ye(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=Pn.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,$.LengthDelimited).string(e.key),e.name!==""&&t.tag(2,$.LengthDelimited).string(e.name),e.folderName!==""&&t.tag(3,$.LengthDelimited).string(e.folderName),e.nestedFolderName!==""&&t.tag(4,$.LengthDelimited).string(e.nestedFolderName),e.url!==""&&t.tag(5,$.LengthDelimited).string(e.url),e.thumborUrl!==""&&t.tag(6,$.LengthDelimited).string(e.thumborUrl),e.proxyUrl!==""&&t.tag(7,$.LengthDelimited).string(e.proxyUrl),e.type!==0&&t.tag(8,$.Varint).int32(e.type),e.metadata&&Pn.internalBinaryWrite(e.metadata,t.tag(9,$.LengthDelimited).fork(),r).join();let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Ye=new Ji;class Yi 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&&ye(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,$.Varint).int32(e.height),e.width!==0&&t.tag(2,$.Varint).int32(e.width),e.backgroundColor!==""&&t.tag(3,$.LengthDelimited).string(e.backgroundColor),e.aspectRatio!==0&&t.tag(4,$.Bit64).double(e.aspectRatio);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Pn=new Yi;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&&ye(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,$.LengthDelimited).string(e.key);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Fr=new Qi;class es 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&&ye(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,$.Varint).bool(e.isDeleted);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const ts=new es;class ns 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&&ye(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,$.LengthDelimited).string(e.folderName),e.cursor!==""&&t.tag(2,$.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(3,$.Varint).int32(e.limit);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Nr=new ns;class rs extends Te{constructor(){super("com.hamropatro.grpc.common.GetFilesByFolderResponse",[{no:1,name:"files",kind:"message",repeat:1,T:()=>Ye},{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&&ye(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(Ye.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++)Ye.internalBinaryWrite(e.files[i],t.tag(1,$.LengthDelimited).fork(),r).join();e.nextCursor!==""&&t.tag(2,$.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,$.Varint).bool(e.hasMore);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const is=new rs,$n=new Vn("com.hamropatro.grpc.common.FileService",[{name:"createFile",options:{},I:Ir,O:Ye},{name:"updateFile",options:{},I:Ye,O:Ye},{name:"deleteFile",options:{},I:Fr,O:ts},{name:"getFilesByFolder",options:{},I:Nr,O:is},{name:"createUserFile",options:{},I:Wn,O:Ye},{name:"search",options:{},I:kr,O:Ki}]);class Bt{constructor(e){me(this,"typeName",$n.typeName);me(this,"methods",$n.methods);me(this,"options",$n.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 ss=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=Ir.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}},os=async(s,e,t)=>{var r;try{const n=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,i=new Bt(n),o=Wn.create();return o.url=s,o.type=e,await i.createUserFile(o,t)}catch(n){throw n}},as=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=Wn.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}},ls=async(s,e,t,r)=>{var n;try{const i=(n=window.ImageSalonSDK)==null?void 0:n.grpcConfig,o=new Bt(i),a=Nr.create();return a.folderName=s,a.cursor=e,a.limit=t,await o.getFilesByFolder(a,r)}catch(i){throw i}},cs=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}},ds=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=Ye.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}},hs=async(s,e)=>{var t;try{const r=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,n=new Bt(r),i=Fr.create();return i.key=s,await n.deleteFile(i,e)}catch(r){throw r}};class us 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&&ye(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,$.LengthDelimited).string(e.key);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Tr=new us;class fs 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&&ye(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,$.LengthDelimited).string(e.name),e.nestedFolderName!==""&&t.tag(2,$.LengthDelimited).string(e.nestedFolderName),e.createdBy!==""&&t.tag(3,$.LengthDelimited).string(e.createdBy),e.forUser!==!1&&t.tag(4,$.Varint).bool(e.forUser);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Lr=new fs;class ps 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&&ye(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,$.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(2,$.Varint).int32(e.limit);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Zn=new ps;class ms extends Te{constructor(){super("com.hamropatro.grpc.common.GetAllFoldersResponse",[{no:1,name:"folder",kind:"message",repeat:1,T:()=>gt},{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&&ye(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(gt.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++)gt.internalBinaryWrite(e.folder[i],t.tag(1,$.LengthDelimited).fork(),r).join();e.nextCursor!==""&&t.tag(2,$.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,$.Varint).bool(e.hasMore);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const Ur=new ms;class gs extends Te{constructor(){super("com.hamropatro.grpc.common.Empty",[])}create(e){const t=globalThis.Object.create(this.messagePrototype);return e!==void 0&&ye(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 gs;class ws 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&&ye(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,$.LengthDelimited).string(e.key),e.name!==""&&t.tag(2,$.LengthDelimited).string(e.name),e.nestedFolderName!==""&&t.tag(3,$.LengthDelimited).string(e.nestedFolderName),e.createdBy!==""&&t.tag(4,$.LengthDelimited).string(e.createdBy),e.forUser!==!1&&t.tag(5,$.Varint).bool(e.forUser);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const gt=new ws;class ys 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&&ye(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,$.LengthDelimited).string(e.folderKey),e.nestedFolderName!==""&&t.tag(2,$.LengthDelimited).string(e.nestedFolderName);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const bs=new ys,jn=new Vn("com.hamropatro.grpc.common.FolderService",[{name:"createFolder",options:{},I:Lr,O:gt},{name:"getFolders",options:{},I:Zn,O:Ur},{name:"getUserFolders",options:{},I:Zn,O:Ur},{name:"updateFolder",options:{},I:gt,O:gt},{name:"deleteFolder",options:{},I:Tr,O:gt},{name:"ChangeNestedFolderName",options:{},I:bs,O:gt},{name:"setBooleanForUserFolder",options:{},I:xr,O:xr}]);class En{constructor(e){me(this,"typeName",jn.typeName);me(this,"methods",jn.methods);me(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 Cs=async(s,e=20,t)=>{var o;const r=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,n=new En(r),i=Zn.create();try{return i.cursor=s,i.limit=e,await n.getFolders(i,t)}catch(a){throw a}},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=Lr.create();return c.name=s,c.nestedFolderName=e,c.createdBy=t,c.forUser=r,await a.createFolder(c,n)}catch(o){throw o}},vs=async(s,e,t,r,n)=>{var i;try{const o=(i=window.ImageSalonSDK)==null?void 0:i.grpcConfig,a=new En(o),c=gt.create();return c.name=e,c.key=s,c.nestedFolderName=t,c.createdBy=r,await a.updateFolder(c,n)}catch(o){throw o}},As=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 vn(s="24px",e="24px",t="#333"){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("height",e),r.setAttribute("width",s),r.setAttribute("viewBox","0 -960 960 960"),r.setAttribute("fill",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"),r.appendChild(n),r}function ks(){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 _r=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 Br(){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 Is(){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 Or(){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 Ts(){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 Kn(){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 Ls(){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 Y(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 Us{constructor(){K(this,wt);K(this,nt);K(this,Pt,"#fff");H(this,wt,document.createElementNS("http://www.w3.org/2000/svg","svg")),E(this,wt).setAttribute("viewBox","25 25 50 50"),E(this,wt).classList.add("loader-svg"),H(this,nt,document.createElementNS("http://www.w3.org/2000/svg","circle")),E(this,nt).setAttribute("r","20"),E(this,nt).setAttribute("cy","50"),E(this,nt).setAttribute("cx","50"),E(this,nt).setAttribute("stroke",E(this,Pt)),E(this,nt).classList.add("loader-circle"),E(this,wt).appendChild(E(this,nt))}show(e,t){t&&(H(this,Pt,t),E(this,nt).setAttribute("stroke",E(this,Pt))),e.appendChild(E(this,wt))}hide(){E(this,wt).remove()}}wt=new WeakMap,nt=new WeakMap,Pt=new WeakMap;const Rr=new Us,An=document.body;class Dr{constructor(){me(this,"main");me(this,"dialogContainer");me(this,"dialog");me(this,"dialogBackdrop");me(this,"dialogContent");me(this,"dialogHeader");me(this,"dialogBody");me(this,"dialogFooter");me(this,"confirmButton");me(this,"cancelButton");me(this,"confirmCallback");me(this,"cancelCallback");this.main=Y("div"),this.dialog=Y("div"),this.confirmCallback=void 0,this.cancelCallback=void 0}_init(e){this.main=Y("div","dialog-presentation","","",An),this.main.setAttribute("role","presentation"),this.dialogContainer=Y("div","dialog-container","","",this.main),this.dialogBackdrop=Y("div","dialog-backdrop","","",this.dialogContainer),this.dialog=Y("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=Y("div","dialog-content","","",this.dialog),e!=null&&e.dialogContentStyle&&Object.assign(this.dialogContent.style,e.dialogContentStyle),this.confirmButton=Y("button","dialog-btn confirm","","",this.dialogFooter),this.confirmButton.type="button",this.cancelButton=Y("button","dialog-btn cancel","","",this.dialogFooter),this.cancelButton.type="button",e.showCloseBtn){const r=Y("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",An.style.overflow="hidden",this.confirmButton.textContent=e.confirmButtonText||"Upload",this.cancelButton.textContent=e.cancelButtonText||"Cancel",An.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=Y("div","dialog-header","","",this.dialogContent),!e.header)this.dialogHeader.innerHTML="";else if(typeof e.header=="string"){const t=Y("h4","dialog-header-text","","",this.dialogHeader);t.textContent=e.header}else this.dialogHeader.innerHTML="",this.dialogHeader.appendChild(e.header)}_setBody(e){this.dialogBody=Y("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=Y("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||An.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 kn=new Dr,Ae=new Dr;class xs{constructor(){me(this,"main");me(this,"dialogBody");this.main=Y("div"),this.dialogBody=Y("div"),this.hide()}show(e){this.main=Y("div","popover","","",e.mainContainer),this.dialogBody=Y("div","popover-body","","",this.main),this.main.id=e.divId,this.dialogBody.append(e.content)}hide(){this.main.remove()}}const Qe=new xs;var et=(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))(et||{});const rn={0:"IMAGE",1:"AUDIO",2:"VIDEO",3:"ALL",4:"FOLDER"};function Xn(s){switch(s){case"image":return rn[et.IMAGE];case"video":return rn[et.VIDEO];case"audio":return rn[et.AUDIO];default:return rn[et.ALL]}}function _s(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 Bs(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 Os=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 sn(s,e,t){const r=document.createElement("p");return e&&(r.className=e),t&&(r.id=t),s&&(r.textContent=s),r}function le(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 Ss(s,e,t){const r=document.createElement("video"),n=document.createElement("source");return r.className=e,n.src=s,r.appendChild(n),r}function Rs(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 Pe(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 Ds(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 Ms(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 Ms=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 In={},Vs={get exports(){return In},set exports(s){In=s}};(function(s){var e,t,r={};Vs.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 I=0;I<d;I++){a(l,c),c+=4,c+=4,c+=4,a(l,c+=4),f=a(l,c+=4);var N=a(l,c+=4),C=o(l,c+=4),R=o(l,c+2),O=o(l,c+4);c+=6;var v=a(l,c+=8);c+=4,c+=C+R+O,r._readLocal(l,v,h,f,N,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 I=r.bin.readUTF8(n,i,f);if(i+=f,i+=y,h)o[I]={size:c,csize:a};else{var N=new Uint8Array(n.buffer,i);if(d==0)o[I]=new Uint8Array(N.buffer.slice(i,i+a));else{if(d!=8)throw"unknown compression method: "+d;var C=new Uint8Array(c);r.inflateRaw(N,C),o[I]=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),I=0,N=[];for(var l in h){var C=h[l];N.push(I),I=r._writeHeader(y,I,l,C,0)}var R=0,O=I;for(var l in h)C=h[l],N.push(I),I=r._writeHeader(y,I,l,C,1,N[R++]);var v=I-O;return a(y,I,101010256),I+=4,c(y,I+=4,R),c(y,I+=2,R),a(y,I+=2,v),a(y,I+=4,O),I+=4,I+=2,y.buffer},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,I=n.length;if(a==0){for(;d<I;)u(i,f,d+(T=Math.min(65535,I-d))==I?1:0),f=r.F._copyExact(n,d,T,i,f+8),d+=T;return f>>>3}var N=h.lits,C=h.strt,R=h.prev,O=0,v=0,L=0,b=0,B=0,m=0;for(I>2&&(C[m=r.F._hash(n,0)]=0),d=0;d<I;d++){if(B=m,d+1<I-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||v>26697)&&I-d>100&&(y<d&&(N[O]=d-y,O+=2,y=d),f=r.F._writeBlock(d==I-1||y==I?1:0,N,O,b,n,L,d-L,i,f),O=v=b=0,L=d);var k=0;d<I-2&&(k=r.F._bestMatch(n,d,R,B,Math.min(c[2],I-d),c[3]));var T=k>>>16,F=65535&k;if(k!=0){F=65535&k;var U=l(T=k>>>16,h.of0);h.lhst[257+U]++;var A=l(F,h.df0);h.dhst[A]++,b+=h.exb[U]+h.dxb[A],N[O]=T<<23|d-y,N[O+1]=F<<16|U<<8|A,O+=2,y=d+T}else h.lhst[n[d]]++;v++}}for(L==d&&n.length!=0||(y<d&&(N[O]=d-y,O+=2,y=d),f=r.F._writeBlock(1,N,O,b,n,L,d-L,i,f),O=0,v=0,O=v=b=0,L=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,I=Math.min(32767,i);d<=I&&--h!=0&&u!=l;){if(f==0||n[i+f]==n[i+f-d]){var N=r.F._howLong(n,i,d);if(N>f){if(y=d,(f=N)>=c)break;d+2<N&&(N=d+2);for(var C=0,R=0;R<N-2;R++){var O=i-d+R+32768&32767,v=O-o[O]+32768&32767;v>C&&(C=v,u=O)}}}d+=(l=u)-(u=o[l])+32768&32767}return f<<16|y},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,I,N,C,R,O,v,L,b=r.F.U,B=r.F._putsF,m=r.F._putsE;b.lhst[256]++,y=(f=r.F.getTrees())[0],I=f[1],N=f[2],C=f[3],R=f[4],O=f[5],v=f[6],L=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),T=a+r.F.contSize(b.ltree,b.lhst)+r.F.contSize(b.dtree,b.dhst);T+=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 U=g<k&&g<T?0:k<T?1:2;if(B(u,d,n),B(u,d+1,U),d+=3,U==0){for(;7&d;)d++;d=r.F._copyExact(c,h,l,u,d)}else{var A,_;if(U==1&&(A=b.fltree,_=b.fdtree),U==2){r.F.makeCodes(b.ltree,y),r.F.revCodes(b.ltree,y),r.F.makeCodes(b.dtree,I),r.F.revCodes(b.dtree,I),r.F.makeCodes(b.itree,N),r.F.revCodes(b.itree,N),A=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(v,b.itree,u,d),d=r.F._codeTiny(L,b.itree,u,d)}for(var p=h,M=0;M<o;M+=2){for(var x=i[M],V=x>>>23,q=p+(8388607&x);p<q;)d=r.F._writeLit(c[p++],A,u,d);if(V!=0){var P=i[M+1],j=P>>16,W=P>>8&255,S=255&P;m(u,d=r.F._writeLit(257+W,A,u,d),V-b.of0[W]),d+=b.exb[W],B(u,d=r.F._writeLit(S,_,u,d),j-b.df0[S]),d+=b.dxb[S],p+=V}}d=r.F._writeLit(256,A,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(v,L){return v.f-L.f});var y=a[0],I=a[1],N=0,C=1,R=2;for(a[0]={lit:-1,f:y.f+I.f,l:y,r:I,d:0};C!=u-1;)y=N!=C&&(R==u||a[N].f<a[R].f)?a[N++]:a[R++],I=N!=C&&(R==u||a[N].f<a[R].f)?a[N++]:a[R++],a[C++]={lit:-1,f:y.f+I.f,l:y,r:I};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,I=i==null;I&&(i=new o(n.length>>>2<<3));for(var N,C,R=0,O=0,v=0,L=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(I&&(i=r.F._check(i,g+(1<<17))),O==1&&(N=y.flmap,C=y.fdmap,B=511,m=31),O==2){v=h(n,k,5)+257,L=h(n,k+5,5)+1,b=h(n,k+10,4)+4,k+=14;for(var T=0;T<38;T+=2)y.itree[T]=0,y.itree[T+1]=0;var F=1;for(T=0;T<b;T++){var U=h(n,k+3*T,3);y.itree[1+(y.ordr[T]<<1)]=U,U>F&&(F=U)}k+=3*b,u(y.itree,F),d(y.itree,F,y.imap),N=y.lmap,C=y.dmap,k=l(y.imap,(1<<F)-1,v+L,n,k,y.ttree);var A=a._copyOut(y.ttree,0,v,y.ltree);B=(1<<A)-1;var _=a._copyOut(y.ttree,v,L,y.dtree);m=(1<<_)-1,u(y.ltree,A),d(y.ltree,A,N),u(y.dtree,_),d(y.dtree,_,C)}for(;;){var w=N[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 q=V>>>4,P=y.ddef[q],j=(P>>>4)+c(n,k,15&P);for(k+=15&P,I&&(i=r.F._check(i,g+(1<<17)));g<M;)i[g]=i[g++-j],i[g]=i[g++-j],i[g]=i[g++-j],i[g]=i[g++-j];g=M}}}else{7&k&&(k+=8-(7&k));var W=4+(k>>>3),S=n[W-4]|n[W-3]<<8;I&&(i=r.F._check(i,g+S)),i.set(new o(n.buffer,n.byteOffset+W,S),g),k=W+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 I=0,N=0;y==16?(N=3+l(a,c,2),c+=2,I=h[d-1]):y==17?(N=3+l(a,c,3),c+=3):y==18&&(N=11+l(a,c,7),c+=7);for(var C=d+N;d<C;)h[d]=I,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,I=y+(1<<f);y!=I;)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 Hs=Ds({__proto__:null,default:In},[In]);const tt=function(){var s={nextZero(l,u){for(;l[u]!=0;)u++;return u},readUshort:(l,u)=>l[u]<<8|l[u+1],writeUshort(l,u,d){l[u]=d>>8&255,l[u+1]=255&d},readUint:(l,u)=>16777216*l[u]+(l[u+1]<<16|l[u+2]<<8|l[u+3]),writeUint(l,u,d){l[u]=d>>24&255,l[u+1]=d>>16&255,l[u+2]=d>>8&255,l[u+3]=255&d},readASCII(l,u,d){let f="";for(let y=0;y<d;y++)f+=String.fromCharCode(l[u+y]);return f},writeASCII(l,u,d){for(let f=0;f<d.length;f++)l[u+f]=d.charCodeAt(f)},readBytes(l,u,d){const f=[];for(let y=0;y<d;y++)f.push(l[u+y]);return f},pad:l=>l.length<2?`0${l}`:l,readUTF8(l,u,d){let f,y="";for(let I=0;I<d;I++)y+=`%${s.pad(l[u+I].toString(16))}`;try{f=decodeURIComponent(y)}catch{return s.readASCII(l,u,d)}return f}};function e(l,u,d,f){const y=u*d,I=i(f),N=Math.ceil(u*I/8),C=new Uint8Array(4*y),R=new Uint32Array(C.buffer),{ctype:O}=f,{depth:v}=f,L=s.readUshort;if(O==6){const x=y<<2;if(v==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(v==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(v==8)for(b=0;b<y;b++){var B=3*b;R[b]=255<<24|l[B+2]<<16|l[B+1]<<8|l[B]}if(v==16)for(b=0;b<y;b++)B=6*b,R[b]=255<<24|l[B+4]<<16|l[B+2]<<8|l[B]}else{var m=x[0];const V=x[1],q=x[2];if(v==8)for(b=0;b<y;b++){var g=b<<2;B=3*b,R[b]=255<<24|l[B+2]<<16|l[B+1]<<8|l[B],l[B]==m&&l[B+1]==V&&l[B+2]==q&&(C[g+3]=0)}if(v==16)for(b=0;b<y;b++)g=b<<2,B=6*b,R[b]=255<<24|l[B+4]<<16|l[B+2]<<8|l[B],L(l,B)==m&&L(l,B+2)==V&&L(l,B+4)==q&&(C[g+3]=0)}}else if(O==3){const x=f.tabs.PLTE,V=f.tabs.tRNS,q=V?V.length:0;if(v==1)for(var k=0;k<d;k++){var T=k*N,F=k*u;for(b=0;b<u;b++){g=F+b<<2;var U=3*(A=l[T+(b>>3)]>>7-((7&b)<<0)&1);C[g]=x[U],C[g+1]=x[U+1],C[g+2]=x[U+2],C[g+3]=A<q?V[A]:255}}if(v==2)for(k=0;k<d;k++)for(T=k*N,F=k*u,b=0;b<u;b++)g=F+b<<2,U=3*(A=l[T+(b>>2)]>>6-((3&b)<<1)&3),C[g]=x[U],C[g+1]=x[U+1],C[g+2]=x[U+2],C[g+3]=A<q?V[A]:255;if(v==4)for(k=0;k<d;k++)for(T=k*N,F=k*u,b=0;b<u;b++)g=F+b<<2,U=3*(A=l[T+(b>>1)]>>4-((1&b)<<2)&15),C[g]=x[U],C[g+1]=x[U+1],C[g+2]=x[U+2],C[g+3]=A<q?V[A]:255;if(v==8)for(b=0;b<y;b++){var A;g=b<<2,U=3*(A=l[b]),C[g]=x[U],C[g+1]=x[U+1],C[g+2]=x[U+2],C[g+3]=A<q?V[A]:255}}else if(O==4){if(v==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(v==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*N,V=k*u;if(v==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(v==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(v==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(v==8)for(p=0;p<u;p++)M=(_=l[x+p])==m?0:255,R[V+p]=M<<24|_<<16|_<<8|_;else if(v==16)for(p=0;p<u;p++)_=l[x+(p<<1)],M=L(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),I=Math.ceil(d*y/8),N=new Uint8Array((I+1+l.interlace)*f);return u=l.tabs.CgBI?n(u,N):r(u,N),l.interlace==0?u=o(u,l,0,d,f):l.interlace==1&&(u=function(R,O){const v=O.width,L=O.height,b=i(O),B=b>>3,m=Math.ceil(v*b/8),g=new Uint8Array(L*m);let k=0;const T=[0,0,4,0,2,0,1],F=[0,4,0,2,0,1,0],U=[8,8,8,4,4,2,2],A=[8,8,4,4,2,2,1];let _=0;for(;_<7;){const p=U[_],M=A[_];let x=0,V=0,q=T[_];for(;q<L;)q+=p,V++;let P=F[_];for(;P<v;)P+=M,x++;const j=Math.ceil(x*b/8);o(R,O,k,x,V);let W=0,S=T[_];for(;S<L;){let X=F[_],ce=k+W*j<<3;for(;X<v;){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 Q=0;Q<B;Q++)g[te+Q]=R[(ce>>3)+Q]}ce+=b,X+=M}W++,S+=p}x*V!=0&&(k+=V*(1+j)),_+=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,I,N=0,C=0,R=0,O=0,v=0,L=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,T=g.e,F=g.R,U=g.n,A=g.A,_=g.Z,w=g.m,p=d==null;for(p&&(d=new f(u.length>>>2<<5));N==0;)if(N=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,I=w.h,L=511,b=31),C==2){R=T(u,m,5)+257,O=T(u,m+5,5)+1,v=T(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<v;M++){const P=T(u,m+3*M,3);w.Q[1+(w.X[M]<<1)]=P,P>x&&(x=P)}m+=3*v,U(w.Q,x),A(w.Q,x,w.u),y=w.w,I=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);L=(1<<V)-1;const q=g.V(w.v,R,O,w.D);b=(1<<q)-1,U(w.C,V),A(w.C,V,y),U(w.D,q),A(w.D,q,I)}for(;;){const x=y[_(u,m)&L];m+=15&x;const V=x>>>4;if(!(V>>>8))d[B++]=V;else{if(V==256)break;{let q=B+V-254;if(V>264){const X=w.q[V-257];q=B+(X>>>3)+T(u,m,7&X),m+=7&X}const P=I[_(u,m)&b];m+=15&P;const j=P>>>4,W=w.c[j],S=(W>>>4)+k(u,m,15&W);for(m+=15&W;B<q;)d[B]=d[B++-S],d[B]=d[B++-S],d[B]=d[B++-S],d[B]=d[B++-S];B=q}}}}else{7&m&&(m+=8-(7&m));const 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,I,N){const C=l.H.e,R=l.H.Z;let O=0;for(;O<f;){const v=u[R(y,I)&d];I+=15&v;const L=v>>>4;if(L<=15)N[O]=L,O++;else{let b=0,B=0;L==16?(B=3+C(y,I,2),I+=2,b=N[O-1]):L==17?(B=3+C(y,I,3),I+=3):L==18&&(B=11+C(y,I,7),I+=7);const m=O+B;for(;O<m;)N[O]=b,O++}}return I},l.H.V=function(u,d,f,y){let I=0,N=0;const C=y.length>>>1;for(;N<f;){const R=u[N+d];y[N<<1]=0,y[1+(N<<1)]=R,R>I&&(I=R),N++}for(;N<C;)y[N<<1]=0,y[1+(N<<1)]=0,N++;return I},l.H.n=function(u,d){const f=l.H.m,y=u.length;let I,N,C,R;const O=f.j;for(var v=0;v<=d;v++)O[v]=0;for(v=1;v<y;v+=2)O[u[v]]++;const L=f.K;for(I=0,O[0]=0,N=1;N<=d;N++)I=I+O[N-1]<<1,L[N]=I;for(C=0;C<y;C+=2)R=u[C+1],R!=0&&(u[C]=L[R],L[R]++)},l.H.A=function(u,d,f){const y=u.length,I=l.H.m.r;for(let N=0;N<y;N+=2)if(u[N+1]!=0){const C=N>>1,R=u[N+1],O=C<<4|R,v=d-R;let L=u[N]<<v;const b=L+(1<<v);for(;L!=b;)f[I[L]>>>15-d]=O,L++}},l.H.l=function(u,d){const f=l.H.m.r,y=15-d;for(let I=0;I<u.length;I+=2){const N=u[I]<<d-u[I+1];u[I]=f[N]>>>y}},l.H.M=function(u,d,f){f<<=7&d;const y=d>>>3;u[y]|=f,u[y+1]|=f>>>8},l.H.I=function(u,d,f){f<<=7&d;const y=d>>>3;u[y]|=f,u[y+1]|=f>>>8,u[y+2]|=f>>>16},l.H.e=function(u,d,f){return(u[d>>>3]|u[1+(d>>>3)]<<8)>>>(7&d)&(1<<f)-1},l.H.b=function(u,d,f){return(u[d>>>3]|u[1+(d>>>3)]<<8|u[2+(d>>>3)]<<16)>>>(7&d)&(1<<f)-1},l.H.Z=function(u,d){return(u[d>>>3]|u[1+(d>>>3)]<<8|u[2+(d>>>3)]<<16)>>>(7&d)},l.H.i=function(u,d){return(u[d>>>3]|u[1+(d>>>3)]<<8|u[2+(d>>>3)]<<16|u[3+(d>>>3)]<<24)>>>(7&d)},l.H.m=function(){const u=Uint16Array,d=Uint32Array;return{K:new u(16),j:new u(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new u(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new d(32),J:new u(512),_:[],h:new u(32),$:[],w:new u(32768),C:[],v:[],d:new u(32768),D:[],u:new u(512),Q:[],r:new u(32768),s:new d(286),Y:new d(30),a:new d(19),t:new d(15e3),k:new u(65536),g:new u(32768)}}(),function(){const u=l.H.m;for(var d=0;d<32768;d++){let y=d;y=(2863311530&y)>>>1|(1431655765&y)<<1,y=(3435973836&y)>>>2|(858993459&y)<<2,y=(4042322160&y)>>>4|(252645135&y)<<4,y=(4278255360&y)>>>8|(16711935&y)<<8,u.r[d]=(y>>>16|y<<16)>>>17}function f(y,I,N){for(;I--!=0;)y.push(0,N)}for(d=0;d<32;d++)u.q[d]=u.S[d]<<3|u.T[d],u.c[d]=u.p[d]<<4|u.z[d];f(u._,144,8),f(u._,112,9),f(u._,24,7),f(u._,8,8),l.H.n(u._,9),l.H.A(u._,9,u.J),l.H.l(u._,9),f(u.$,32,5),l.H.n(u.$,5),l.H.A(u.$,5,u.h),l.H.l(u.$,5),f(u.Q,19,0),f(u.C,286,0),f(u.D,30,0),f(u.v,320,0)}(),l.H.N}();function i(l){return[1,null,3,1,2,null,4][l.ctype]*l.depth}function o(l,u,d,f,y){let I=i(u);const N=Math.ceil(f*I/8);let C,R;I=Math.ceil(I/8);let O=l[d],v=0;if(O>1&&(l[d]=[0,0,1][O-2]),O==3)for(v=I;v<N;v++)l[v+1]=l[v+1]+(l[v+1-I]>>>1)&255;for(let L=0;L<y;L++)if(C=d+L*N,R=C+L+1,O=l[R-1],v=0,O==0)for(;v<N;v++)l[C+v]=l[R+v];else if(O==1){for(;v<I;v++)l[C+v]=l[R+v];for(;v<N;v++)l[C+v]=l[R+v]+l[C+v-I]}else if(O==2)for(;v<N;v++)l[C+v]=l[R+v]+l[C+v-N];else if(O==3){for(;v<I;v++)l[C+v]=l[R+v]+(l[C+v-N]>>>1);for(;v<N;v++)l[C+v]=l[R+v]+(l[C+v-N]+l[C+v-I]>>>1)}else{for(;v<I;v++)l[C+v]=l[R+v]+a(0,l[C+v-N],0);for(;v<N;v++)l[C+v]=l[R+v]+a(l[C+v-I],l[C+v-N],l[C+v-I-N])}return l}function a(l,u,d){const f=l+u-d,y=f-l,I=f-u,N=f-d;return y*y<=I*I&&y*y<=N*N?l:I*I<=N*N?u:d}function c(l,u,d){d.width=s.readUint(l,u),u+=4,d.height=s.readUint(l,u),u+=4,d.depth=l[u],u++,d.ctype=l[u],u++,d.compress=l[u],u++,d.filter=l[u],u++,d.interlace=l[u],u++}function h(l,u,d,f,y,I,N,C,R){const O=Math.min(u,y),v=Math.min(d,I);let L=0,b=0;for(let _=0;_<v;_++)for(let w=0;w<O;w++)if(N>=0&&C>=0?(L=_*u+w<<2,b=(C+_)*y+N+w<<2):(L=(-C+_)*u-N+w<<2,b=_*y+w<<2),R==0)f[b]=l[L],f[b+1]=l[L+1],f[b+2]=l[L+2],f[b+3]=l[L+3];else if(R==1){var B=l[L+3]*.00392156862745098,m=l[L]*B,g=l[L+1]*B,k=l[L+2]*B,T=f[b+3]*(1/255),F=f[b]*T,U=f[b+1]*T,A=f[b+2]*T;const p=1-B,M=B+T*p,x=M==0?0:1/M;f[b+3]=255*M,f[b+0]=(m+F*p)*x,f[b+1]=(g+U*p)*x,f[b+2]=(k+A*p)*x}else if(R==2)B=l[L+3],m=l[L],g=l[L+1],k=l[L+2],T=f[b+3],F=f[b],U=f[b+1],A=f[b+2],B==T&&m==F&&g==U&&k==A?(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[L+3],m=l[L],g=l[L+1],k=l[L+2],T=f[b+3],F=f[b],U=f[b+1],A=f[b+2],B==T&&m==F&&g==U&&k==A)continue;if(B<220&&T>20)return!1}return!0}return{decode:function(u){const d=new Uint8Array(u);let f=8;const y=s,I=y.readUshort,N=y.readUint,C={tabs:{},frames:[]},R=new Uint8Array(d.length);let O,v=0,L=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[v+B]=d[f+B];v+=_}else if(w=="acTL")C.tabs[w]={num_frames:N(d,f),num_plays:N(d,f+4)},O=new Uint8Array(d.length);else if(w=="fcTL"){L!=0&&((A=C.frames[C.frames.length-1]).data=t(C,O.slice(0,L),A.rect.width,A.rect.height),L=0);const p={x:N(d,f+12),y:N(d,f+16),width:N(d,f+4),height:N(d,f+8)};let M=I(d,f+22);M=I(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[L+B]=d[f+B+4];L+=_-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),T=f+_-g-1;if(w=="tEXt")U=y.readASCII(d,g+1,T);else{var F=r(d.slice(g+2,g+2+T));U=y.readUTF8(F,0,F.length)}C.tabs[w][k]=U}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 U;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),T=_-((m=g+1)-f),p==0?U=y.readUTF8(d,m,T):(F=r(d.slice(m,m+T)),U=y.readUTF8(F,0,F.length)),C.tabs[w][k]=U}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(I(d,f+2*B))}else if(w=="tRNS")C.ctype==3?C.tabs[w]=y.readBytes(d,f,_):C.ctype==0?C.tabs[w]=I(d,f):C.ctype==2&&(C.tabs[w]=[I(d,f),I(d,f+2),I(d,f+4)]);else if(w=="gAMA")C.tabs[w]=y.readUint(d,f)/1e5;else if(w=="sRGB")C.tabs[w]=d[f];else if(w=="bKGD")C.ctype==0||C.ctype==4?C.tabs[w]=[I(d,f)]:C.ctype==2||C.ctype==6?C.tabs[w]=[I(d,f),I(d,f+2),I(d,f+4)]:C.ctype==3&&(C.tabs[w]=d[f]);else if(w=="IEND")break;f+=_,y.readUint(d,f),f+=4}var A;return L!=0&&((A=C.frames[C.frames.length-1]).data=t(C,O.slice(0,L),A.rect.width,A.rect.height)),C.data=t(C,R,C.width,C.height),delete C.compress,delete C.interlace,delete C.filter,C},toRGBA8:function(u){const d=u.width,f=u.height;if(u.tabs.acTL==null)return[e(u.data,d,f,u).buffer];const y=[];u.frames[0].data==null&&(u.frames[0].data=u.data);const I=d*f*4,N=new Uint8Array(I),C=new Uint8Array(I),R=new Uint8Array(I);for(let v=0;v<u.frames.length;v++){const L=u.frames[v],b=L.rect.x,B=L.rect.y,m=L.rect.width,g=L.rect.height,k=e(L.data,m,g,u);if(v!=0)for(var O=0;O<I;O++)R[O]=N[O];if(L.blend==0?h(k,m,g,N,d,f,b,B,0):L.blend==1&&h(k,m,g,N,d,f,b,B,1),y.push(N.buffer.slice(0)),L.dispose!=0){if(L.dispose==1)h(C,m,g,N,d,f,b,B,0);else if(L.dispose==2)for(O=0;O<I;O++)N[O]=R[O]}}return y},_paeth:a,_copyTile:h,_bin:s}}();(function(){const{_copyTile:s}=tt,{_bin:e}=tt,t=tt._paeth;var r={table:function(){const m=new Uint32Array(256);for(let g=0;g<256;g++){let k=g;for(let T=0;T<8;T++)1&k?k=3988292384^k>>>1:k>>>=1;m[g]=k}return m}(),update(m,g,k,T){for(let F=0;F<T;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,T){g[k]+=m[0]*T>>4,g[k+1]+=m[1]*T>>4,g[k+2]+=m[2]*T>>4,g[k+3]+=m[3]*T>>4}function i(m){return Math.max(0,Math.min(255,m))}function o(m,g){const k=m[0]-g[0],T=m[1]-g[1],F=m[2]-g[2],U=m[3]-g[3];return k*k+T*T+F*F+U*U}function a(m,g,k,T,F,U,A){A==null&&(A=1);const _=T.length,w=[];for(var p=0;p<_;p++){const S=T[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 q=new Uint32Array(F.buffer),P=new Int16Array(g*k*4),j=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(p=0;p<j.length;p++)j[p]=255*((j[p]+.5)/16-.5);for(let S=0;S<k;S++)for(let X=0;X<g;X++){var W;p=4*(S*g+X),A!=2?W=[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=j[4*(3&S)+(3&X)],W=[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 oe=o(W,w[x]);oe<ce&&(ce=oe,M=x)}const te=w[M],Q=[W[0]-te[0],W[1]-te[1],W[2]-te[2],W[3]-te[3]];A==1&&(X!=g-1&&n(Q,P,p+4,7),S!=k-1&&(X!=0&&n(Q,P,p+4*g-4,3),n(Q,P,p+4*g,5),X!=g-1&&n(Q,P,p+4*g+4,1))),U[p>>2]=M,q[p>>2]=T[M]}}function c(m,g,k,T,F){F==null&&(F={});const{crc:U}=r,A=e.writeUint,_=e.writeUshort,w=e.writeASCII;let p=8;const M=m.frames.length>1;let x,V=!1,q=33+(M?20:0);if(F.sRGB!=null&&(q+=13),F.pHYs!=null&&(q+=21),F.iCCP!=null&&(x=pako.deflate(F.iCCP),q+=21+x.length+4),m.ctype==3){for(var P=m.plte.length,j=0;j<P;j++)m.plte[j]>>>24!=255&&(V=!0);q+=8+3*P+4+(V?8+1*P+4:0)}for(var W=0;W<m.frames.length;W++)M&&(q+=38),q+=(te=m.frames[W]).cimg.length+12,W!=0&&(q+=4);q+=12;const S=new Uint8Array(q),X=[137,80,78,71,13,10,26,10];for(j=0;j<8;j++)S[j]=X[j];if(A(S,p,13),p+=4,w(S,p,"IHDR"),p+=4,A(S,p,g),p+=4,A(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++,A(S,p,U(S,p-17,17)),p+=4,F.sRGB!=null&&(A(S,p,1),p+=4,w(S,p,"sRGB"),p+=4,S[p]=F.sRGB,p++,A(S,p,U(S,p-5,5)),p+=4),F.iCCP!=null){const Q=13+x.length;A(S,p,Q),p+=4,w(S,p,"iCCP"),p+=4,w(S,p,"ICC profile"),p+=11,p+=2,S.set(x,p),p+=x.length,A(S,p,U(S,p-(Q+4),Q+4)),p+=4}if(F.pHYs!=null&&(A(S,p,9),p+=4,w(S,p,"pHYs"),p+=4,A(S,p,F.pHYs[0]),p+=4,A(S,p,F.pHYs[1]),p+=4,S[p]=F.pHYs[2],p++,A(S,p,U(S,p-13,13)),p+=4),M&&(A(S,p,8),p+=4,w(S,p,"acTL"),p+=4,A(S,p,m.frames.length),p+=4,A(S,p,F.loop!=null?F.loop:0),p+=4,A(S,p,U(S,p-12,12)),p+=4),m.ctype==3){for(A(S,p,3*(P=m.plte.length)),p+=4,w(S,p,"PLTE"),p+=4,j=0;j<P;j++){const Q=3*j,oe=m.plte[j],ge=255&oe,Ie=oe>>>8&255,vt=oe>>>16&255;S[p+Q+0]=ge,S[p+Q+1]=Ie,S[p+Q+2]=vt}if(p+=3*P,A(S,p,U(S,p-3*P-4,3*P+4)),p+=4,V){for(A(S,p,P),p+=4,w(S,p,"tRNS"),p+=4,j=0;j<P;j++)S[p+j]=m.plte[j]>>>24&255;p+=P,A(S,p,U(S,p-P-4,P+4)),p+=4}}let ce=0;for(W=0;W<m.frames.length;W++){var te=m.frames[W];M&&(A(S,p,26),p+=4,w(S,p,"fcTL"),p+=4,A(S,p,ce++),p+=4,A(S,p,te.rect.width),p+=4,A(S,p,te.rect.height),p+=4,A(S,p,te.rect.x),p+=4,A(S,p,te.rect.y),p+=4,_(S,p,T[W]),p+=2,_(S,p,1e3),p+=2,S[p]=te.dispose,p++,S[p]=te.blend,p++,A(S,p,U(S,p-30,30)),p+=4);const Q=te.cimg;A(S,p,(P=Q.length)+(W==0?0:4)),p+=4;const oe=p;w(S,p,W==0?"IDAT":"fdAT"),p+=4,W!=0&&(A(S,p,ce++),p+=4),S.set(Q,p),p+=P,A(S,p,U(S,oe,p-oe)),p+=4}return A(S,p,0),p+=4,w(S,p,"IEND"),p+=4,A(S,p,U(S,p-4,4)),p+=4,S.buffer}function h(m,g,k){for(let T=0;T<m.frames.length;T++){const F=m.frames[T];F.rect.width;const U=F.rect.height,A=new Uint8Array(U*F.bpl+U);F.cimg=f(F.img,U,F.bpp,F.bpl,A,g,k)}}function l(m,g,k,T,F){const U=F[0],A=F[1],_=F[2],w=F[3],p=F[4],M=F[5];let x=6,V=8,q=255;for(var P=0;P<m.length;P++){const Le=new Uint8Array(m[P]);for(var j=Le.length,W=0;W<j;W+=4)q&=Le[W+3]}const S=q!=255,X=function(de,re,Ce,Ue,Ee,xe){const we=[];for(var ee=0;ee<de.length;ee++){const _e=new Uint8Array(de[ee]),Ze=new Uint32Array(_e.buffer);var We;let De=0,Me=0,st=re,pt=Ce,Yt=Ue?1:0;if(ee!=0){const Bn=xe||Ue||ee==1||we[ee-2].dispose!=0?1:2;let Qt=0,ue=1e9;for(let Xe=0;Xe<Bn;Xe++){var Re=new Uint8Array(de[ee-1-Xe]);const mt=new Uint32Array(de[ee-1-Xe]);let Ut=re,xt=Ce,en=-1,un=-1;for(let Vt=0;Vt<Ce;Vt++)for(let Ht=0;Ht<re;Ht++)Ze[Ne=Vt*re+Ht]!=mt[Ne]&&(Ht<Ut&&(Ut=Ht),Ht>en&&(en=Ht),Vt<xt&&(xt=Vt),Vt>un&&(un=Vt));en==-1&&(Ut=xt=en=un=0),Ee&&((1&Ut)==1&&Ut--,(1&xt)==1&&xt--);const ri=(en-Ut+1)*(un-xt+1);ri<ue&&(ue=ri,Qt=Xe,De=Ut,Me=xt,st=en-Ut+1,pt=un-xt+1)}Re=new Uint8Array(de[ee-1-Qt]),Qt==1&&(we[ee-1].dispose=2),We=new Uint8Array(st*pt*4),s(Re,re,Ce,We,st,pt,-De,-Me,0),Yt=s(_e,re,Ce,We,st,pt,-De,-Me,3)?1:0,Yt==1?d(_e,re,Ce,We,{x:De,y:Me,width:st,height:pt}):s(_e,re,Ce,We,st,pt,-De,-Me,0)}else We=_e.slice(0);we.push({rect:{x:De,y:Me,width:st,height:pt},img:We,blend:Yt,dispose:0})}if(Ue)for(ee=0;ee<we.length;ee++){if((ft=we[ee]).blend==1)continue;const _e=ft.rect,Ze=we[ee-1].rect,De=Math.min(_e.x,Ze.x),Me=Math.min(_e.y,Ze.y),st={x:De,y:Me,width:Math.max(_e.x+_e.width,Ze.x+Ze.width)-De,height:Math.max(_e.y+_e.height,Ze.y+Ze.height)-Me};we[ee-1].dispose=1,ee-1!=0&&u(de,re,Ce,we,ee-1,st,Ee),u(de,re,Ce,we,ee,st,Ee)}let ut=0;if(de.length!=1)for(var Ne=0;Ne<we.length;Ne++){var ft;ut+=(ft=we[Ne]).rect.width*ft.rect.height}return we}(m,g,k,U,A,_),ce={},te=[],Q=[];if(T!=0){const Le=[];for(W=0;W<X.length;W++)Le.push(X[W].img.buffer);const de=function(Ee){let xe=0;for(var we=0;we<Ee.length;we++)xe+=Ee[we].byteLength;const ee=new Uint8Array(xe);let We=0;for(we=0;we<Ee.length;we++){const Re=new Uint8Array(Ee[we]),ut=Re.length;for(let Ne=0;Ne<ut;Ne+=4){let ft=Re[Ne],_e=Re[Ne+1],Ze=Re[Ne+2];const De=Re[Ne+3];De==0&&(ft=_e=Ze=0),ee[We+Ne]=ft,ee[We+Ne+1]=_e,ee[We+Ne+2]=Ze,ee[We+Ne+3]=De}We+=ut}return ee.buffer}(Le),re=I(de,T);for(W=0;W<re.plte.length;W++)te.push(re.plte[W].est.rgba);let Ce=0;for(W=0;W<X.length;W++){const Ue=(ge=X[W]).img.length;var oe=new Uint8Array(re.inds.buffer,Ce>>2,Ue>>2);Q.push(oe);const Ee=new Uint8Array(re.abuf,Ce,Ue);M&&a(ge.img,ge.rect.width,ge.rect.height,te,Ee,oe),ge.img.set(Ee),Ce+=Ue}}else for(P=0;P<X.length;P++){var ge=X[P];const Le=new Uint32Array(ge.img.buffer);var Ie=ge.rect.width;for(j=Le.length,oe=new Uint8Array(j),Q.push(oe),W=0;W<j;W++){const de=Le[W];if(W!=0&&de==Le[W-1])oe[W]=oe[W-1];else if(W>Ie&&de==Le[W-Ie])oe[W]=oe[W-Ie];else{let re=ce[de];if(re==null&&(ce[de]=re=te.length,te.push(de),te.length>=300))break;oe[W]=re}}}const vt=te.length;for(vt<=256&&p==0&&(V=vt<=2?1:vt<=4?2:vt<=16?4:8,V=Math.max(V,w)),P=0;P<X.length;P++){(ge=X[P]).rect.x,ge.rect.y,Ie=ge.rect.width;const Le=ge.rect.height;let de=ge.img;new Uint32Array(de.buffer);let re=4*Ie,Ce=4;if(vt<=256&&p==0){re=Math.ceil(V*Ie/8);var Ke=new Uint8Array(re*Le);const Ue=Q[P];for(let Ee=0;Ee<Le;Ee++){W=Ee*re;const xe=Ee*Ie;if(V==8)for(var pe=0;pe<Ie;pe++)Ke[W+pe]=Ue[xe+pe];else if(V==4)for(pe=0;pe<Ie;pe++)Ke[W+(pe>>1)]|=Ue[xe+pe]<<4-4*(1&pe);else if(V==2)for(pe=0;pe<Ie;pe++)Ke[W+(pe>>2)]|=Ue[xe+pe]<<6-2*(3&pe);else if(V==1)for(pe=0;pe<Ie;pe++)Ke[W+(pe>>3)]|=Ue[xe+pe]<<7-1*(7&pe)}de=Ke,x=3,Ce=1}else if(S==0&&X.length==1){Ke=new Uint8Array(Ie*Le*3);const Ue=Ie*Le;for(W=0;W<Ue;W++){const Ee=3*W,xe=4*W;Ke[Ee]=de[xe],Ke[Ee+1]=de[xe+1],Ke[Ee+2]=de[xe+2]}de=Ke,x=2,Ce=3,re=3*Ie}ge.img=de,ge.bpl=re,ge.bpp=Ce}return{ctype:x,depth:V,plte:te,frames:X}}function u(m,g,k,T,F,U,A){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]),q=new w(V.buffer);let P=g,j=k,W=-1,S=-1;for(let ce=0;ce<U.height;ce++)for(let te=0;te<U.width;te++){const Q=U.x+te,oe=U.y+ce,ge=oe*g+Q,Ie=q[ge];Ie==0||T[F-1].dispose==0&&M[ge]==Ie&&(x==null||x[4*ge+3]!=0)||(Q<P&&(P=Q),Q>W&&(W=Q),oe<j&&(j=oe),oe>S&&(S=oe))}W==-1&&(P=j=W=S=0),A&&((1&P)==1&&P--,(1&j)==1&&j--),U={x:P,y:j,width:W-P+1,height:S-j+1};const X=T[F];X.rect=U,X.blend=1,X.img=new Uint8Array(U.width*U.height*4),T[F-1].dispose==0?(s(p,g,k,X.img,U.width,U.height,-U.x,-U.y,0),d(V,g,k,X.img,U)):s(V,g,k,X.img,U.width,U.height,-U.x,-U.y,0)}function d(m,g,k,T,F){s(m,g,k,T,F.width,F.height,-F.x,-F.y,2)}function f(m,g,k,T,F,U,A){const _=[];let w,p=[0,1,2,3,4];U!=-1?p=[U]:(g*T>5e5||k==1)&&(p=[0]),A&&(w={level:0});const M=Hs;for(var x=0;x<p.length;x++){for(let P=0;P<g;P++)y(F,m,P,T,k,p[x]);_.push(M.deflate(F,w))}let V,q=1e9;for(x=0;x<_.length;x++)_[x].length<q&&(V=x,q=_[x].length);return _[V]}function y(m,g,k,T,F,U){const A=k*T;let _=A+k;if(m[_]=U,_++,U==0)if(T<500)for(var w=0;w<T;w++)m[_+w]=g[A+w];else m.set(new Uint8Array(g.buffer,A,T),_);else if(U==1){for(w=0;w<F;w++)m[_+w]=g[A+w];for(w=F;w<T;w++)m[_+w]=g[A+w]-g[A+w-F]+256&255}else if(k==0){for(w=0;w<F;w++)m[_+w]=g[A+w];if(U==2)for(w=F;w<T;w++)m[_+w]=g[A+w];if(U==3)for(w=F;w<T;w++)m[_+w]=g[A+w]-(g[A+w-F]>>1)+256&255;if(U==4)for(w=F;w<T;w++)m[_+w]=g[A+w]-t(g[A+w-F],0,0)+256&255}else{if(U==2)for(w=0;w<T;w++)m[_+w]=g[A+w]+256-g[A+w-T]&255;if(U==3){for(w=0;w<F;w++)m[_+w]=g[A+w]+256-(g[A+w-T]>>1)&255;for(w=F;w<T;w++)m[_+w]=g[A+w]+256-(g[A+w-T]+g[A+w-F]>>1)&255}if(U==4){for(w=0;w<F;w++)m[_+w]=g[A+w]+256-t(0,g[A+w-T],0)&255;for(w=F;w<T;w++)m[_+w]=g[A+w]+256-t(g[A+w-F],g[A+w-T],g[A+w-F-T])&255}}}function I(m,g){const k=new Uint8Array(m),T=k.slice(0),F=new Uint32Array(T.buffer),U=N(T,g),A=U[0],_=U[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(A,V=k[x]*(1/255),q=k[x+1]*(1/255),P=k[x+2]*(1/255),j=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,q=k[x+1]*(1/255),P=k[x+2]*(1/255),j=k[x+3]*(1/255);for(M=A;M.left;)M=R(M.est,V,q,P,j)<=0?M.left:M.right;p[x>>2]=M.ind,F[x>>2]=M.est.rgba}return{abuf:T.buffer,inds:p,plte:_}}function N(m,g,k){k==null&&(k=1e-4);const T=new Uint32Array(m.buffer),F={i0:0,i1:m.length,bst:null,est:null,tdst:0,left:null,right:null};F.bst=L(m,F.i0,F.i1),F.est=b(F.bst);const U=[F];for(;U.length<g;){let _=0,w=0;for(var A=0;A<U.length;A++)U[A].est.L>_&&(_=U[A].est.L,w=A);if(_<k)break;const p=U[w],M=O(m,T,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=L(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},A=0;A<16;A++)V.bst.R[A]=p.bst.R[A]-x.bst.R[A];for(A=0;A<4;A++)V.bst.m[A]=p.bst.m[A]-x.bst.m[A];V.est=b(V.bst),p.left=x,p.right=V,U[w]=x,U.push(V)}for(U.sort((_,w)=>w.bst.N-_.bst.N),A=0;A<U.length;A++)U[A].ind=A;return[F,U]}function C(m,g,k,T,F){if(m.left==null)return m.tdst=function(x,V,q,P,j){const W=V-x[0],S=q-x[1],X=P-x[2],ce=j-x[3];return W*W+S*S+X*X+ce*ce}(m.est.q,g,k,T,F),m;const U=R(m.est,g,k,T,F);let A=m.left,_=m.right;U>0&&(A=m.right,_=m.left);const w=C(A,g,k,T,F);if(w.tdst<=U*U)return w;const p=C(_,g,k,T,F);return p.tdst<w.tdst?p:w}function R(m,g,k,T,F){const{e:U}=m;return U[0]*g+U[1]*k+U[2]*T+U[3]*F-m.eMq}function O(m,g,k,T,F,U){for(T-=4;k<T;){for(;v(m,k,F)<=U;)k+=4;for(;v(m,T,F)>U;)T-=4;if(k>=T)break;const A=g[k>>2];g[k>>2]=g[T>>2],g[T>>2]=A,k+=4,T-=4}for(;v(m,k,F)>U;)k-=4;return k+4}function v(m,g,k){return m[g]*k[0]+m[g+1]*k[1]+m[g+2]*k[2]+m[g+3]*k[3]}function L(m,g,k){const T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],F=[0,0,0,0],U=k-g>>2;for(let A=g;A<k;A+=4){const _=m[A]*.00392156862745098,w=m[A+1]*(1/255),p=m[A+2]*(1/255),M=m[A+3]*(1/255);F[0]+=_,F[1]+=w,F[2]+=p,F[3]+=M,T[0]+=_*_,T[1]+=_*w,T[2]+=_*p,T[3]+=_*M,T[5]+=w*w,T[6]+=w*p,T[7]+=w*M,T[10]+=p*p,T[11]+=p*M,T[15]+=M*M}return T[4]=T[1],T[8]=T[2],T[9]=T[6],T[12]=T[3],T[13]=T[7],T[14]=T[11],{R:T,m:F,N:U}}function b(m){const{R:g}=m,{m:k}=m,{N:T}=m,F=k[0],U=k[1],A=k[2],_=k[3],w=T==0?0:1/T,p=[g[0]-F*F*w,g[1]-F*U*w,g[2]-F*A*w,g[3]-F*_*w,g[4]-U*F*w,g[5]-U*U*w,g[6]-U*A*w,g[7]-U*_*w,g[8]-A*F*w,g[9]-A*U*w,g[10]-A*A*w,g[11]-A*_*w,g[12]-_*F*w,g[13]-_*U*w,g[14]-_*A*w,g[15]-_*_*w],M=p,x=B;let V=[Math.random(),Math.random(),Math.random(),Math.random()],q=0,P=0;if(T!=0)for(let W=0;W<16&&(V=x.multVec(M,V),P=Math.sqrt(x.dot(V,V)),V=x.sml(1/P,V),!(W!=0&&Math.abs(P-q)<1e-9));W++)q=P;const j=[F*w,U*w,A*w,_*w];return{Cov:p,q:j,e:V,L:q,eMq255:x.dot(x.sml(255,j),V),eMq:x.dot(V,j),rgba:(Math.round(255*j[3])<<24|Math.round(255*j[2])<<16|Math.round(255*j[1])<<8|Math.round(255*j[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]]};tt.encode=function(g,k,T,F,U,A,_){F==null&&(F=0),_==null&&(_=!1);const w=l(g,k,T,F,[!1,!1,!1,0,_,!1]);return h(w,-1),c(w,k,T,U,A)},tt.encodeLL=function(g,k,T,F,U,A,_,w){const p={ctype:0+(F==1?0:2)+(U==0?0:4),depth:A,frames:[]},M=(F+U)*A,x=M*k;for(let V=0;V<g.length;V++)p.frames.push({rect:{x:0,y:0,width:k,height:T},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,T,_,w)},tt.encode.compress=l,tt.encode.dither=a,tt.quantize=I,tt.quantize.getKDtree=N,tt.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,I,N,C=d,R=0,O=0,v=0;function L(m){u.setUint16(O,m,!0),O+=2}function b(m){u.setUint32(O,m,!0),O+=4}function B(m){O+=m}L(19778),b(h),B(4),b(122),b(108),b(t),b(-r>>>0),L(1),L(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(N=122+R*a,f=0;f<n;)C--,y=o[v++],I=y>>>24,u.setUint32(N+f,y<<8|I),f+=4;R++}v<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 $e={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Ws={[$e.CHROME]:16384,[$e.FIREFOX]:11180,[$e.DESKTOP_SAFARI]:16384,[$e.IE]:8192,[$e.IOS]:4096,[$e.ETC]:8192};const Jn=typeof window<"u",Wr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Fn=Jn&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Ps=(Jn||Wr)&&(Fn&&Fn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Pr=(Jn||Wr)&&(Fn&&Fn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Yn(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 $r(s){return new Promise((e,t)=>{const r=new Pr;r.onload=()=>e(r.result),r.onerror=n=>t(n),r.readAsDataURL(s)})}function Zr(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=$e.ETC;const{userAgent:e}=navigator;return/Chrom(e|ium)/i.test(e)?s=$e.CHROME:/iP(ad|od|hone)/i.test(e)&&/WebKit/i.test(e)?s=$e.IOS:/Safari/i.test(e)?s=$e.DESKTOP_SAFARI:/Firefox/i.test(e)?s=$e.FIREFOX:(/MSIE/i.test(e)||document.documentMode)&&(s=$e.IE),Ot.cachedResult=s,Ot.cachedResult}function jr(s,e){const t=Ot(),r=Ws[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 qr(s,e){const{width:t,height:r}=jr(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 Tn(){return Tn.cachedResult!==void 0||(Tn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Tn.cachedResult}function Ln(s,e={}){return new Promise(function(t,r){let n,i;var o=function(){try{return i=qr(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 $r(s).then(function(u){try{return l=u,Zr(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(Tn()||[$e.DESKTOP_SAFARI,$e.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 Un(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=tt.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),Yn(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 at(s){s.width=0,s.height=0}function Wt(){return new Promise(function(s,e){let t,r,n,i;return Wt.cachedResult!==void 0?s(Wt.cachedResult):Yn("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then(function(o){try{return t=o,Ln(t).then(function(a){try{return r=a[1],Un(r,t.type,t.name,t.lastModified).then(function(c){try{return n=c,at(r),Ln(n).then(function(h){try{return i=h[0],Wt.cachedResult=i.width===1&&i.height===2,s(Wt.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 zr(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 Kr(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),at(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),at(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,I,N,C,R,O,v,L,b,B,m;function g(T=5){if(e.signal&&e.signal.aborted)throw e.signal.reason;i+=T,e.onProgress(Math.min(i,100))}function k(T){if(e.signal&&e.signal.aborted)throw e.signal.reason;i=Math.min(Math.max(T,i),100),e.onProgress(i)}return i=t,o=e.maxIteration||10,a=1024*e.maxSizeMB*1024,g(),Ln(s,e).then((function(T){try{return[,c]=T,g(),h=Kr(c,e),g(),new Promise(function(F,U){var A;if(!(A=e.exifOrientation))return zr(s).then((function(w){try{return A=w,_.call(this)}catch(p){return U(p)}}).bind(this),U);function _(){return F(A)}return _.call(this)}).then((function(F){try{return l=F,g(),Wt().then((function(U){try{return u=U?h:Xr(h,l),g(),d=e.initialQuality||1,f=e.fileType||s.type,Un(u,f,s.name,s.lastModified,d).then((function(A){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,[L,b]=Nn(M,x),b.drawImage(B,0,0,M,x),d*=f==="image/png"?.85:.95,Un(L,f,s.name,s.lastModified,d).then(function(V){try{return v=V,at(B),B=L,O=v.size,k(Math.min(99,Math.floor((R-O)/(R-a)*100))),w}catch(q){return n(q)}},n)}return[1]},p=function(){return at(B),at(L),at(h),at(u),at(c),k(100),r(v)};if(y=A,g(),I=y.size>a,N=y.size>s.size,!I&&!N)return k(100),r(y);var _;return C=s.size,R=y.size,O=R,B=u,m=!e.alwaysKeepResolution&&I,(_=(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(A){return n(A)}}).bind(this),n)}catch(U){return n(U)}}).bind(this),n)}catch(F){return n(F)}}).bind(this),n)})}const $s=`
|
|
2
|
+
(function(ne,ae){typeof exports=="object"&&typeof module<"u"?module.exports=ae():typeof define=="function"&&define.amd?define(ae):(ne=typeof globalThis<"u"?globalThis:ne||self,ne.ImageSalonSdk=ae())})(this,function(){"use strict";var Qs=Object.defineProperty;var ri=ne=>{throw TypeError(ne)};var Ys=(ne,ae,he)=>ae in ne?Qs(ne,ae,{enumerable:!0,configurable:!0,writable:!0,value:he}):ne[ae]=he;var me=(ne,ae,he)=>Ys(ne,typeof ae!="symbol"?ae+"":ae,he),ii=(ne,ae,he)=>ae.has(ne)||ri("Cannot "+he);var E=(ne,ae,he)=>(ii(ne,ae,"read from private field"),he?he.call(ne):ae.get(ne)),z=(ne,ae,he)=>ae.has(ne)?ri("Cannot add the same private member more than once"):ae instanceof WeakSet?ae.add(ne):ae.set(ne,he),H=(ne,ae,he,_t)=>(ii(ne,ae,"write to private field"),_t?_t.call(ne,he):ae.set(ne,he),he);var wt,nt,Pt,yt,be,ke,bt,fe,Ne,rt,qe,St,kt,lt,He,it,Rt,tr,Ft,Nt,Ct,Dt,ct,Ke,It,Tt,Et,Wt,on,Se,Mt,an,_n,ln,dt,jt,Lt,qt,Zt,Kt,zt,Xt,cn,dn,Gt,ht,Jt,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 ae(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 On(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 Sn(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():Sn(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"-"+Sn(e.lo,e.hi)}return Sn(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 tn(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 Rn(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 tn(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){Rn(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){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,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 On(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 On(n,i,this.buf),this}uint64(e){let t=Be.from(e);return On(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 Dn(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 ot;(function(s){s[s.BIGINT=0]="BIGINT",s[s.STRING=1]="STRING",s[s.NUMBER=2]="NUMBER"})(ot||(ot={}));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:Dn(s.name),s.jsonName=(t=s.jsonName)!==null&&t!==void 0?t:Dn(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 ot.BIGINT:return n=="bigint";case ot.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,ot.STRING)}}}function Ge(s,e){switch(e){case ot.BIGINT:return s.toBigInt();case ot.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(ae(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,ot.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&&Rn(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):tn(a),a;case D.INT64:case D.SFIXED64:case D.SINT64:if(e===null)return Ge(ve.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return Ge(ve.from(e),r);case D.FIXED64:case D.UINT64:if(e===null)return Ge(Be.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return Ge(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:(tn(t),t);case D.FIXED32:case D.UINT32:return t===0?o?0:void 0:(gn(t),t);case D.FLOAT:Rn(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 Mn(s,e=ot.STRING){switch(s){case D.BOOL:return!1;case D.UINT64:case D.FIXED64:return Ge(Be.ZERO,e);case D.INT64:case D.SFIXED64:case D.SINT64:return Ge(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 I=h[u];if(a==W.LengthDelimited&&d!=D.STRING&&d!=D.BYTES){let C=e.uint32()+e.pos;for(;e.pos<C;)I.push(this.scalar(e,d,f))}else I.push(this.scalar(e,d,f))}else h[u]=this.scalar(e,d,f);break;case"message":if(l){let I=h[u],C=c.T().internalBinaryRead(e,e.uint32(),r);I.push(C)}else h[u]=c.T().internalBinaryRead(e,e.uint32(),r,h[u]);break;case"map":let[y,F]=this.mapEntry(c,e,r);h[u][y]=F;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,ot.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=Mn(e.K);o=e.K==D.BOOL?c.toString():c}if(a===void 0)switch(e.V.kind){case"scalar":a=Mn(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 Ge(e.int64(),r);case D.UINT64:return Ge(e.uint64(),r);case D.FIXED64:return Ge(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 Ge(e.sfixed64(),r);case D.SINT32:return e.sint32();case D.SINT64:return Ge(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]=Mn(t.T,t.L);break;case"enum":e[r]=0;break;case"map":e[r]={};break}}return e}function ye(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&&ye(this,t,e),t}clone(e){let t=this.create();return ye(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){ye(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:Dn(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 Vn{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 Ze;(function(s){s[s.PENDING=0]="PENDING",s[s.REJECTED=1]="REJECTED",s[s.RESOLVED=2]="RESOLVED"})(Ze||(Ze={}));class At{constructor(e=!0){this._state=Ze.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!==Ze.PENDING)throw new Error(`cannot resolve ${Ze[this.state].toLowerCase()}`);this._resolve(e),this._state=Ze.RESOLVED}reject(e){if(this.state!==Ze.PENDING)throw new Error(`cannot reject ${Ze[this.state].toLowerCase()}`);this._reject(e),this._state=Ze.REJECTED}resolvePending(e){this._state===Ze.PENDING&&this.resolve(e)}rejectPending(e){this._state===Ze.PENDING&&this.reject(e)}}class 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 At,e.p.promise)}}}pushIt(e){let t=this._itState;if(t)if(t.p){const r=t.p;J(r.state==Ze.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]=Je.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 Hn(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 Hn(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 Je;(function(s){s[s.DATA=0]="DATA",s[s.TRAILER=128]="TRAILER"})(Je||(Je={}));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]===Je.DATA;){let c=0;for(let h=1;h<5;h++)c=(c<<8)+i[h];if(i.length-5>=c)t(Je.DATA,i.subarray(5,5+c)),i=i.subarray(5+c);else break}}if(a.done){if(i.length===0)break;if(i[0]!==Je.TRAILER||i.length<5)throw new se("premature EOF",j[j.DATA_LOSS]);t(Je.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 At,y=new Bi,F=!0,I,C=new At,R,O=new At;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(v=>{let[L,b,B]=Hn(v);if(f.resolve(B),L!=null&&L!==j.OK)throw new se(b??j[L],j[L],B);return L!=null&&(I={code:j[L],detail:b??j[L]}),v}).then(v=>{if(!v.body)throw new se("missing response body",j[j.INTERNAL]);return Cr(v.body,v.headers.get("content-type"),(L,b)=>{switch(L){case Je.DATA:y.notifyMessage(e.O.fromBinary(b,c.binaryOptions)),F=!1;break;case Je.TRAILER:let B,m;[B,m,R]=br(b),I={code:j[B],detail:m??j[B]};break}})}).then(()=>{if(!R&&!F)throw new se("missing trailers",j[j.DATA_LOSS]);if(!I)throw new se("missing status",j[j.INTERNAL]);if(I.code!=="OK")throw new se(I.detail,I.code,R);y.notifyComplete(),C.resolve(I),O.resolve(R||{})}).catch(v=>{let L;v instanceof se?L=v:v instanceof Error&&v.name==="AbortError"?L=new se(v.message,j[j.CANCELLED]):L=new se(v instanceof Error?v.message:""+v,j[j.INTERNAL]),L.methodName=e.name,L.serviceName=e.service.typeName,f.rejectPending(L),y.notifyError(L),C.rejectPending(L),O.rejectPending(L)}),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 At,y,F=new At,I,C=new At,R,O=new At;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(v=>{let[L,b,B]=Hn(v);if(f.resolve(B),L!=null&&L!==j.OK)throw new se(b??j[L],j[L],B);return L!=null&&(I={code:j[L],detail:b??j[L]}),v}).then(v=>{if(!v.body)throw new se("missing response body",j[j.INTERNAL]);return Cr(v.body,v.headers.get("content-type"),(L,b)=>{switch(L){case Je.DATA:if(y)throw new se("unary call received 2nd message",j[j.DATA_LOSS]);y=e.O.fromBinary(b,c.binaryOptions);break;case Je.TRAILER:let B,m;[B,m,R]=br(b),I={code:j[B],detail:m??j[B]};break}})}).then(()=>{if(!R&&y)throw new se("missing trailers",j[j.DATA_LOSS]);if(!I)throw new se("missing status",j[j.INTERNAL]);if(!y&&I.code==="OK")throw new se("expected error status",j[j.DATA_LOSS]);if(!y)throw new se(I.detail,I.code,R);if(F.resolve(y),I.code!=="OK")throw new se(I.detail,I.code,R);C.resolve(I),O.resolve(R||{})}).catch(v=>{let L;v instanceof se?L=v:v instanceof Error&&v.name==="AbortError"?L=new se(v.message,j[j.CANCELLED]):L=new se(v instanceof Error?v.message:""+v,j[j.INTERNAL]),L.methodName=e.name,L.serviceName=e.service.typeName,f.rejectPending(L),F.rejectPending(L),C.rejectPending(L),O.rejectPending(L)}),new Si(e,(a=c.meta)!==null&&a!==void 0?a:{},t,f.promise,F.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&&ye(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:()=>Qe},{no:2,name:"next_page_cursor",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.items=[],t.nextPageCursor="",e!==void 0&&ye(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(Qe.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++)Qe.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&&ye(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&&ye(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 $n=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:()=>Pn}])}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&&ye(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=Pn.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&&Pn.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 Qe=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&&ye(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 Pn=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&&ye(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&&ye(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&&ye(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:()=>Qe},{no:2,name:"next_cursor",kind:"scalar",T:9},{no:3,name:"has_more",kind:"scalar",T:8}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.files=[],t.nextCursor="",t.hasMore=!1,e!==void 0&&ye(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(Qe.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++)Qe.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,Wn=new Vn("com.hamropatro.grpc.common.FileService",[{name:"createFile",options:{},I:Fr,O:Qe},{name:"updateFile",options:{},I:Qe,O:Qe},{name:"deleteFile",options:{},I:Nr,O:es},{name:"getFilesByFolder",options:{},I:Ir,O:rs},{name:"createUserFile",options:{},I:$n,O:Qe},{name:"search",options:{},I:kr,O:Ki}]);class Bt{constructor(e){me(this,"typeName",Wn.typeName);me(this,"methods",Wn.methods);me(this,"options",Wn.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=$n.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=$n.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=Qe.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&&ye(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&&ye(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&&ye(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 jn=new fs;class ps extends Te{constructor(){super("com.hamropatro.grpc.common.GetAllFoldersResponse",[{no:1,name:"folder",kind:"message",repeat:1,T:()=>gt},{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&&ye(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(gt.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++)gt.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&&ye(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&&ye(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 gt=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&&ye(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,qn=new Vn("com.hamropatro.grpc.common.FolderService",[{name:"createFolder",options:{},I:Lr,O:gt},{name:"getFolders",options:{},I:jn,O:Ur},{name:"getUserFolders",options:{},I:jn,O:Ur},{name:"updateFolder",options:{},I:gt,O:gt},{name:"deleteFolder",options:{},I:Tr,O:gt},{name:"ChangeNestedFolderName",options:{},I:ys,O:gt},{name:"setBooleanForUserFolder",options:{},I:xr,O:xr}]);class En{constructor(e){me(this,"typeName",qn.typeName);me(this,"methods",qn.methods);me(this,"options",qn.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=jn.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=gt.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}},Zn=(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 vn(s="24px",e="24px",t="#333"){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("height",e),r.setAttribute("width",s),r.setAttribute("viewBox","0 -960 960 960"),r.setAttribute("fill",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"),r.appendChild(n),r}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 _r=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 Kn(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 Br(){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 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 Or(){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,wt);z(this,nt);z(this,Pt,"#fff");H(this,wt,document.createElementNS("http://www.w3.org/2000/svg","svg")),E(this,wt).setAttribute("viewBox","25 25 50 50"),E(this,wt).classList.add("loader-svg"),H(this,nt,document.createElementNS("http://www.w3.org/2000/svg","circle")),E(this,nt).setAttribute("r","20"),E(this,nt).setAttribute("cy","50"),E(this,nt).setAttribute("cx","50"),E(this,nt).setAttribute("stroke",E(this,Pt)),E(this,nt).classList.add("loader-circle"),E(this,wt).appendChild(E(this,nt))}show(e,t){t&&(H(this,Pt,t),E(this,nt).setAttribute("stroke",E(this,Pt))),e.appendChild(E(this,wt))}hide(){E(this,wt).remove()}}wt=new WeakMap,nt=new WeakMap,Pt=new WeakMap;const Rr=new Ls,An=document.body;class Dr{constructor(){me(this,"main");me(this,"dialogContainer");me(this,"dialog");me(this,"dialogBackdrop");me(this,"dialogContent");me(this,"dialogHeader");me(this,"dialogBody");me(this,"dialogFooter");me(this,"confirmButton");me(this,"cancelButton");me(this,"confirmCallback");me(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","","",An),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(Kn()),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",An.style.overflow="hidden",this.confirmButton.textContent=e.confirmButtonText||"Upload",this.cancelButton.textContent=e.cancelButtonText||"Cancel",An.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||An.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 kn=new Dr,Ae=new Dr;class Us{constructor(){me(this,"main");me(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 Ye=new Us;var et=(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))(et||{});const rn={0:"IMAGE",1:"AUDIO",2:"VIDEO",3:"ALL",4:"FOLDER"};function Xn(s){switch(s){case"image":return rn[et.IMAGE];case"video":return rn[et.VIDEO];case"audio":return rn[et.AUDIO];default:return rn[et.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 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 le(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 Pe(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 Fn={},Ms={get exports(){return Fn},set exports(s){Fn=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 F=0;F<d;F++){a(l,c),c+=4,c+=4,c+=4,a(l,c+=4),f=a(l,c+=4);var I=a(l,c+=4),C=o(l,c+=4),R=o(l,c+2),O=o(l,c+4);c+=6;var v=a(l,c+=8);c+=4,c+=C+R+O,r._readLocal(l,v,h,f,I,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 F=r.bin.readUTF8(n,i,f);if(i+=f,i+=y,h)o[F]={size:c,csize:a};else{var I=new Uint8Array(n.buffer,i);if(d==0)o[F]=new Uint8Array(I.buffer.slice(i,i+a));else{if(d!=8)throw"unknown compression method: "+d;var C=new Uint8Array(c);r.inflateRaw(I,C),o[F]=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),F=0,I=[];for(var l in h){var C=h[l];I.push(F),F=r._writeHeader(y,F,l,C,0)}var R=0,O=F;for(var l in h)C=h[l],I.push(F),F=r._writeHeader(y,F,l,C,1,I[R++]);var v=F-O;return a(y,F,101010256),F+=4,c(y,F+=4,R),c(y,F+=2,R),a(y,F+=2,v),a(y,F+=4,O),F+=4,F+=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,F=n.length;if(a==0){for(;d<F;)u(i,f,d+(T=Math.min(65535,F-d))==F?1:0),f=r.F._copyExact(n,d,T,i,f+8),d+=T;return f>>>3}var I=h.lits,C=h.strt,R=h.prev,O=0,v=0,L=0,b=0,B=0,m=0;for(F>2&&(C[m=r.F._hash(n,0)]=0),d=0;d<F;d++){if(B=m,d+1<F-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||v>26697)&&F-d>100&&(y<d&&(I[O]=d-y,O+=2,y=d),f=r.F._writeBlock(d==F-1||y==F?1:0,I,O,b,n,L,d-L,i,f),O=v=b=0,L=d);var k=0;d<F-2&&(k=r.F._bestMatch(n,d,R,B,Math.min(c[2],F-d),c[3]));var T=k>>>16,N=65535&k;if(k!=0){N=65535&k;var U=l(T=k>>>16,h.of0);h.lhst[257+U]++;var A=l(N,h.df0);h.dhst[A]++,b+=h.exb[U]+h.dxb[A],I[O]=T<<23|d-y,I[O+1]=N<<16|U<<8|A,O+=2,y=d+T}else h.lhst[n[d]]++;v++}}for(L==d&&n.length!=0||(y<d&&(I[O]=d-y,O+=2,y=d),f=r.F._writeBlock(1,I,O,b,n,L,d-L,i,f),O=0,v=0,O=v=b=0,L=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,F=Math.min(32767,i);d<=F&&--h!=0&&u!=l;){if(f==0||n[i+f]==n[i+f-d]){var I=r.F._howLong(n,i,d);if(I>f){if(y=d,(f=I)>=c)break;d+2<I&&(I=d+2);for(var C=0,R=0;R<I-2;R++){var O=i-d+R+32768&32767,v=O-o[O]+32768&32767;v>C&&(C=v,u=O)}}}d+=(l=u)-(u=o[l])+32768&32767}return f<<16|y},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,F,I,C,R,O,v,L,b=r.F.U,B=r.F._putsF,m=r.F._putsE;b.lhst[256]++,y=(f=r.F.getTrees())[0],F=f[1],I=f[2],C=f[3],R=f[4],O=f[5],v=f[6],L=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),T=a+r.F.contSize(b.ltree,b.lhst)+r.F.contSize(b.dtree,b.dhst);T+=14+3*O+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 U=g<k&&g<T?0:k<T?1:2;if(B(u,d,n),B(u,d+1,U),d+=3,U==0){for(;7&d;)d++;d=r.F._copyExact(c,h,l,u,d)}else{var A,_;if(U==1&&(A=b.fltree,_=b.fdtree),U==2){r.F.makeCodes(b.ltree,y),r.F.revCodes(b.ltree,y),r.F.makeCodes(b.dtree,F),r.F.revCodes(b.dtree,F),r.F.makeCodes(b.itree,I),r.F.revCodes(b.itree,I),A=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(v,b.itree,u,d),d=r.F._codeTiny(L,b.itree,u,d)}for(var p=h,M=0;M<o;M+=2){for(var x=i[M],V=x>>>23,Z=p+(8388607&x);p<Z;)d=r.F._writeLit(c[p++],A,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+$,A,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,A,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(v,L){return v.f-L.f});var y=a[0],F=a[1],I=0,C=1,R=2;for(a[0]={lit:-1,f:y.f+F.f,l:y,r:F,d:0};C!=u-1;)y=I!=C&&(R==u||a[I].f<a[R].f)?a[I++]:a[R++],F=I!=C&&(R==u||a[I].f<a[R].f)?a[I++]:a[R++],a[C++]={lit:-1,f:y.f+F.f,l:y,r:F};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,F=i==null;F&&(i=new o(n.length>>>2<<3));for(var I,C,R=0,O=0,v=0,L=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(F&&(i=r.F._check(i,g+(1<<17))),O==1&&(I=y.flmap,C=y.fdmap,B=511,m=31),O==2){v=h(n,k,5)+257,L=h(n,k+5,5)+1,b=h(n,k+10,4)+4,k+=14;for(var T=0;T<38;T+=2)y.itree[T]=0,y.itree[T+1]=0;var N=1;for(T=0;T<b;T++){var U=h(n,k+3*T,3);y.itree[1+(y.ordr[T]<<1)]=U,U>N&&(N=U)}k+=3*b,u(y.itree,N),d(y.itree,N,y.imap),I=y.lmap,C=y.dmap,k=l(y.imap,(1<<N)-1,v+L,n,k,y.ttree);var A=a._copyOut(y.ttree,0,v,y.ltree);B=(1<<A)-1;var _=a._copyOut(y.ttree,v,L,y.dtree);m=(1<<_)-1,u(y.ltree,A),d(y.ltree,A,I),u(y.dtree,_),d(y.dtree,_,C)}for(;;){var w=I[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 Z=V>>>4,P=y.ddef[Z],q=(P>>>4)+c(n,k,15&P);for(k+=15&P,F&&(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;F&&(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 F=0,I=0;y==16?(I=3+l(a,c,2),c+=2,F=h[d-1]):y==17?(I=3+l(a,c,3),c+=3):y==18&&(I=11+l(a,c,7),c+=7);for(var C=d+I;d<C;)h[d]=F,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,F=y+(1<<f);y!=F;)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:Fn},[Fn]);const tt=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 F=0;F<d;F++)y+=`%${s.pad(l[u+F].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,F=i(f),I=Math.ceil(u*F/8),C=new Uint8Array(4*y),R=new Uint32Array(C.buffer),{ctype:O}=f,{depth:v}=f,L=s.readUshort;if(O==6){const x=y<<2;if(v==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(v==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(v==8)for(b=0;b<y;b++){var B=3*b;R[b]=255<<24|l[B+2]<<16|l[B+1]<<8|l[B]}if(v==16)for(b=0;b<y;b++)B=6*b,R[b]=255<<24|l[B+4]<<16|l[B+2]<<8|l[B]}else{var m=x[0];const V=x[1],Z=x[2];if(v==8)for(b=0;b<y;b++){var g=b<<2;B=3*b,R[b]=255<<24|l[B+2]<<16|l[B+1]<<8|l[B],l[B]==m&&l[B+1]==V&&l[B+2]==Z&&(C[g+3]=0)}if(v==16)for(b=0;b<y;b++)g=b<<2,B=6*b,R[b]=255<<24|l[B+4]<<16|l[B+2]<<8|l[B],L(l,B)==m&&L(l,B+2)==V&&L(l,B+4)==Z&&(C[g+3]=0)}}else if(O==3){const x=f.tabs.PLTE,V=f.tabs.tRNS,Z=V?V.length:0;if(v==1)for(var k=0;k<d;k++){var T=k*I,N=k*u;for(b=0;b<u;b++){g=N+b<<2;var U=3*(A=l[T+(b>>3)]>>7-((7&b)<<0)&1);C[g]=x[U],C[g+1]=x[U+1],C[g+2]=x[U+2],C[g+3]=A<Z?V[A]:255}}if(v==2)for(k=0;k<d;k++)for(T=k*I,N=k*u,b=0;b<u;b++)g=N+b<<2,U=3*(A=l[T+(b>>2)]>>6-((3&b)<<1)&3),C[g]=x[U],C[g+1]=x[U+1],C[g+2]=x[U+2],C[g+3]=A<Z?V[A]:255;if(v==4)for(k=0;k<d;k++)for(T=k*I,N=k*u,b=0;b<u;b++)g=N+b<<2,U=3*(A=l[T+(b>>1)]>>4-((1&b)<<2)&15),C[g]=x[U],C[g+1]=x[U+1],C[g+2]=x[U+2],C[g+3]=A<Z?V[A]:255;if(v==8)for(b=0;b<y;b++){var A;g=b<<2,U=3*(A=l[b]),C[g]=x[U],C[g+1]=x[U+1],C[g+2]=x[U+2],C[g+3]=A<Z?V[A]:255}}else if(O==4){if(v==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(v==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*I,V=k*u;if(v==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(v==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(v==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(v==8)for(p=0;p<u;p++)M=(_=l[x+p])==m?0:255,R[V+p]=M<<24|_<<16|_<<8|_;else if(v==16)for(p=0;p<u;p++)_=l[x+(p<<1)],M=L(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),F=Math.ceil(d*y/8),I=new Uint8Array((F+1+l.interlace)*f);return u=l.tabs.CgBI?n(u,I):r(u,I),l.interlace==0?u=o(u,l,0,d,f):l.interlace==1&&(u=function(R,O){const v=O.width,L=O.height,b=i(O),B=b>>3,m=Math.ceil(v*b/8),g=new Uint8Array(L*m);let k=0;const T=[0,0,4,0,2,0,1],N=[0,4,0,2,0,1,0],U=[8,8,8,4,4,2,2],A=[8,8,4,4,2,2,1];let _=0;for(;_<7;){const p=U[_],M=A[_];let x=0,V=0,Z=T[_];for(;Z<L;)Z+=p,V++;let P=N[_];for(;P<v;)P+=M,x++;const q=Math.ceil(x*b/8);o(R,O,k,x,V);let $=0,S=T[_];for(;S<L;){let X=N[_],ce=k+$*q<<3;for(;X<v;){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,F,I=0,C=0,R=0,O=0,v=0,L=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,T=g.e,N=g.R,U=g.n,A=g.A,_=g.Z,w=g.m,p=d==null;for(p&&(d=new f(u.length>>>2<<5));I==0;)if(I=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,F=w.h,L=511,b=31),C==2){R=T(u,m,5)+257,O=T(u,m+5,5)+1,v=T(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<v;M++){const P=T(u,m+3*M,3);w.Q[1+(w.X[M]<<1)]=P,P>x&&(x=P)}m+=3*v,U(w.Q,x),A(w.Q,x,w.u),y=w.w,F=w.d,m=N(w.u,(1<<x)-1,R+O,u,m,w.v);const V=g.V(w.v,0,R,w.C);L=(1<<V)-1;const Z=g.V(w.v,R,O,w.D);b=(1<<Z)-1,U(w.C,V),A(w.C,V,y),U(w.D,Z),A(w.D,Z,F)}for(;;){const x=y[_(u,m)&L];m+=15&x;const V=x>>>4;if(!(V>>>8))d[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)+T(u,m,7&X),m+=7&X}const P=F[_(u,m)&b];m+=15&P;const q=P>>>4,$=w.c[q],S=($>>>4)+k(u,m,15&$);for(m+=15&$;B<Z;)d[B]=d[B++-S],d[B]=d[B++-S],d[B]=d[B++-S],d[B]=d[B++-S];B=Z}}}}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,F,I){const C=l.H.e,R=l.H.Z;let O=0;for(;O<f;){const v=u[R(y,F)&d];F+=15&v;const L=v>>>4;if(L<=15)I[O]=L,O++;else{let b=0,B=0;L==16?(B=3+C(y,F,2),F+=2,b=I[O-1]):L==17?(B=3+C(y,F,3),F+=3):L==18&&(B=11+C(y,F,7),F+=7);const m=O+B;for(;O<m;)I[O]=b,O++}}return F},l.H.V=function(u,d,f,y){let F=0,I=0;const C=y.length>>>1;for(;I<f;){const R=u[I+d];y[I<<1]=0,y[1+(I<<1)]=R,R>F&&(F=R),I++}for(;I<C;)y[I<<1]=0,y[1+(I<<1)]=0,I++;return F},l.H.n=function(u,d){const f=l.H.m,y=u.length;let F,I,C,R;const O=f.j;for(var v=0;v<=d;v++)O[v]=0;for(v=1;v<y;v+=2)O[u[v]]++;const L=f.K;for(F=0,O[0]=0,I=1;I<=d;I++)F=F+O[I-1]<<1,L[I]=F;for(C=0;C<y;C+=2)R=u[C+1],R!=0&&(u[C]=L[R],L[R]++)},l.H.A=function(u,d,f){const y=u.length,F=l.H.m.r;for(let I=0;I<y;I+=2)if(u[I+1]!=0){const C=I>>1,R=u[I+1],O=C<<4|R,v=d-R;let L=u[I]<<v;const b=L+(1<<v);for(;L!=b;)f[F[L]>>>15-d]=O,L++}},l.H.l=function(u,d){const f=l.H.m.r,y=15-d;for(let F=0;F<u.length;F+=2){const I=u[F]<<d-u[F+1];u[F]=f[I]>>>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,F,I){for(;F--!=0;)y.push(0,I)}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 F=i(u);const I=Math.ceil(f*F/8);let C,R;F=Math.ceil(F/8);let O=l[d],v=0;if(O>1&&(l[d]=[0,0,1][O-2]),O==3)for(v=F;v<I;v++)l[v+1]=l[v+1]+(l[v+1-F]>>>1)&255;for(let L=0;L<y;L++)if(C=d+L*I,R=C+L+1,O=l[R-1],v=0,O==0)for(;v<I;v++)l[C+v]=l[R+v];else if(O==1){for(;v<F;v++)l[C+v]=l[R+v];for(;v<I;v++)l[C+v]=l[R+v]+l[C+v-F]}else if(O==2)for(;v<I;v++)l[C+v]=l[R+v]+l[C+v-I];else if(O==3){for(;v<F;v++)l[C+v]=l[R+v]+(l[C+v-I]>>>1);for(;v<I;v++)l[C+v]=l[R+v]+(l[C+v-I]+l[C+v-F]>>>1)}else{for(;v<F;v++)l[C+v]=l[R+v]+a(0,l[C+v-I],0);for(;v<I;v++)l[C+v]=l[R+v]+a(l[C+v-F],l[C+v-I],l[C+v-F-I])}return l}function a(l,u,d){const f=l+u-d,y=f-l,F=f-u,I=f-d;return y*y<=F*F&&y*y<=I*I?l:F*F<=I*I?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,F,I,C,R){const O=Math.min(u,y),v=Math.min(d,F);let L=0,b=0;for(let _=0;_<v;_++)for(let w=0;w<O;w++)if(I>=0&&C>=0?(L=_*u+w<<2,b=(C+_)*y+I+w<<2):(L=(-C+_)*u-I+w<<2,b=_*y+w<<2),R==0)f[b]=l[L],f[b+1]=l[L+1],f[b+2]=l[L+2],f[b+3]=l[L+3];else if(R==1){var B=l[L+3]*.00392156862745098,m=l[L]*B,g=l[L+1]*B,k=l[L+2]*B,T=f[b+3]*(1/255),N=f[b]*T,U=f[b+1]*T,A=f[b+2]*T;const p=1-B,M=B+T*p,x=M==0?0:1/M;f[b+3]=255*M,f[b+0]=(m+N*p)*x,f[b+1]=(g+U*p)*x,f[b+2]=(k+A*p)*x}else if(R==2)B=l[L+3],m=l[L],g=l[L+1],k=l[L+2],T=f[b+3],N=f[b],U=f[b+1],A=f[b+2],B==T&&m==N&&g==U&&k==A?(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[L+3],m=l[L],g=l[L+1],k=l[L+2],T=f[b+3],N=f[b],U=f[b+1],A=f[b+2],B==T&&m==N&&g==U&&k==A)continue;if(B<220&&T>20)return!1}return!0}return{decode:function(u){const d=new Uint8Array(u);let f=8;const y=s,F=y.readUshort,I=y.readUint,C={tabs:{},frames:[]},R=new Uint8Array(d.length);let O,v=0,L=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[v+B]=d[f+B];v+=_}else if(w=="acTL")C.tabs[w]={num_frames:I(d,f),num_plays:I(d,f+4)},O=new Uint8Array(d.length);else if(w=="fcTL"){L!=0&&((A=C.frames[C.frames.length-1]).data=t(C,O.slice(0,L),A.rect.width,A.rect.height),L=0);const p={x:I(d,f+12),y:I(d,f+16),width:I(d,f+4),height:I(d,f+8)};let M=F(d,f+22);M=F(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[L+B]=d[f+B+4];L+=_-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),T=f+_-g-1;if(w=="tEXt")U=y.readASCII(d,g+1,T);else{var N=r(d.slice(g+2,g+2+T));U=y.readUTF8(N,0,N.length)}C.tabs[w][k]=U}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 U;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),T=_-((m=g+1)-f),p==0?U=y.readUTF8(d,m,T):(N=r(d.slice(m,m+T)),U=y.readUTF8(N,0,N.length)),C.tabs[w][k]=U}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(F(d,f+2*B))}else if(w=="tRNS")C.ctype==3?C.tabs[w]=y.readBytes(d,f,_):C.ctype==0?C.tabs[w]=F(d,f):C.ctype==2&&(C.tabs[w]=[F(d,f),F(d,f+2),F(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]=[F(d,f)]:C.ctype==2||C.ctype==6?C.tabs[w]=[F(d,f),F(d,f+2),F(d,f+4)]:C.ctype==3&&(C.tabs[w]=d[f]);else if(w=="IEND")break;f+=_,y.readUint(d,f),f+=4}var A;return L!=0&&((A=C.frames[C.frames.length-1]).data=t(C,O.slice(0,L),A.rect.width,A.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 F=d*f*4,I=new Uint8Array(F),C=new Uint8Array(F),R=new Uint8Array(F);for(let v=0;v<u.frames.length;v++){const L=u.frames[v],b=L.rect.x,B=L.rect.y,m=L.rect.width,g=L.rect.height,k=e(L.data,m,g,u);if(v!=0)for(var O=0;O<F;O++)R[O]=I[O];if(L.blend==0?h(k,m,g,I,d,f,b,B,0):L.blend==1&&h(k,m,g,I,d,f,b,B,1),y.push(I.buffer.slice(0)),L.dispose!=0){if(L.dispose==1)h(C,m,g,I,d,f,b,B,0);else if(L.dispose==2)for(O=0;O<F;O++)I[O]=R[O]}}return y},_paeth:a,_copyTile:h,_bin:s}}();(function(){const{_copyTile:s}=tt,{_bin:e}=tt,t=tt._paeth;var r={table:function(){const m=new Uint32Array(256);for(let g=0;g<256;g++){let k=g;for(let T=0;T<8;T++)1&k?k=3988292384^k>>>1:k>>>=1;m[g]=k}return m}(),update(m,g,k,T){for(let N=0;N<T;N++)m=r.table[255&(m^g[k+N])]^m>>>8;return m},crc:(m,g,k)=>4294967295^r.update(4294967295,m,g,k)};function n(m,g,k,T){g[k]+=m[0]*T>>4,g[k+1]+=m[1]*T>>4,g[k+2]+=m[2]*T>>4,g[k+3]+=m[3]*T>>4}function i(m){return Math.max(0,Math.min(255,m))}function o(m,g){const k=m[0]-g[0],T=m[1]-g[1],N=m[2]-g[2],U=m[3]-g[3];return k*k+T*T+N*N+U*U}function a(m,g,k,T,N,U,A){A==null&&(A=1);const _=T.length,w=[];for(var p=0;p<_;p++){const S=T[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 Z=new Uint32Array(N.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),A!=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 oe=o($,w[x]);oe<ce&&(ce=oe,M=x)}const te=w[M],Y=[$[0]-te[0],$[1]-te[1],$[2]-te[2],$[3]-te[3]];A==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))),U[p>>2]=M,Z[p>>2]=T[M]}}function c(m,g,k,T,N){N==null&&(N={});const{crc:U}=r,A=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 S=new Uint8Array(Z),X=[137,80,78,71,13,10,26,10];for(q=0;q<8;q++)S[q]=X[q];if(A(S,p,13),p+=4,w(S,p,"IHDR"),p+=4,A(S,p,g),p+=4,A(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++,A(S,p,U(S,p-17,17)),p+=4,N.sRGB!=null&&(A(S,p,1),p+=4,w(S,p,"sRGB"),p+=4,S[p]=N.sRGB,p++,A(S,p,U(S,p-5,5)),p+=4),N.iCCP!=null){const Y=13+x.length;A(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,A(S,p,U(S,p-(Y+4),Y+4)),p+=4}if(N.pHYs!=null&&(A(S,p,9),p+=4,w(S,p,"pHYs"),p+=4,A(S,p,N.pHYs[0]),p+=4,A(S,p,N.pHYs[1]),p+=4,S[p]=N.pHYs[2],p++,A(S,p,U(S,p-13,13)),p+=4),M&&(A(S,p,8),p+=4,w(S,p,"acTL"),p+=4,A(S,p,m.frames.length),p+=4,A(S,p,N.loop!=null?N.loop:0),p+=4,A(S,p,U(S,p-12,12)),p+=4),m.ctype==3){for(A(S,p,3*(P=m.plte.length)),p+=4,w(S,p,"PLTE"),p+=4,q=0;q<P;q++){const Y=3*q,oe=m.plte[q],ge=255&oe,Fe=oe>>>8&255,vt=oe>>>16&255;S[p+Y+0]=ge,S[p+Y+1]=Fe,S[p+Y+2]=vt}if(p+=3*P,A(S,p,U(S,p-3*P-4,3*P+4)),p+=4,V){for(A(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,A(S,p,U(S,p-P-4,P+4)),p+=4}}let ce=0;for($=0;$<m.frames.length;$++){var te=m.frames[$];M&&(A(S,p,26),p+=4,w(S,p,"fcTL"),p+=4,A(S,p,ce++),p+=4,A(S,p,te.rect.width),p+=4,A(S,p,te.rect.height),p+=4,A(S,p,te.rect.x),p+=4,A(S,p,te.rect.y),p+=4,_(S,p,T[$]),p+=2,_(S,p,1e3),p+=2,S[p]=te.dispose,p++,S[p]=te.blend,p++,A(S,p,U(S,p-30,30)),p+=4);const Y=te.cimg;A(S,p,(P=Y.length)+($==0?0:4)),p+=4;const oe=p;w(S,p,$==0?"IDAT":"fdAT"),p+=4,$!=0&&(A(S,p,ce++),p+=4),S.set(Y,p),p+=P,A(S,p,U(S,oe,p-oe)),p+=4}return A(S,p,0),p+=4,w(S,p,"IEND"),p+=4,A(S,p,U(S,p-4,4)),p+=4,S.buffer}function h(m,g,k){for(let T=0;T<m.frames.length;T++){const N=m.frames[T];N.rect.width;const U=N.rect.height,A=new Uint8Array(U*N.bpl+U);N.cimg=f(N.img,U,N.bpp,N.bpl,A,g,k)}}function l(m,g,k,T,N){const U=N[0],A=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 S=Z!=255,X=function(de,re,Ce,Ue,Ee,xe){const we=[];for(var ee=0;ee<de.length;ee++){const _e=new Uint8Array(de[ee]),je=new Uint32Array(_e.buffer);var $e;let De=0,Me=0,st=re,pt=Ce,Qt=Ue?1:0;if(ee!=0){const Bn=xe||Ue||ee==1||we[ee-2].dispose!=0?1:2;let Yt=0,ue=1e9;for(let Xe=0;Xe<Bn;Xe++){var Re=new Uint8Array(de[ee-1-Xe]);const mt=new Uint32Array(de[ee-1-Xe]);let Ut=re,xt=Ce,en=-1,un=-1;for(let Vt=0;Vt<Ce;Vt++)for(let Ht=0;Ht<re;Ht++)je[Ie=Vt*re+Ht]!=mt[Ie]&&(Ht<Ut&&(Ut=Ht),Ht>en&&(en=Ht),Vt<xt&&(xt=Vt),Vt>un&&(un=Vt));en==-1&&(Ut=xt=en=un=0),Ee&&((1&Ut)==1&&Ut--,(1&xt)==1&&xt--);const ni=(en-Ut+1)*(un-xt+1);ni<ue&&(ue=ni,Yt=Xe,De=Ut,Me=xt,st=en-Ut+1,pt=un-xt+1)}Re=new Uint8Array(de[ee-1-Yt]),Yt==1&&(we[ee-1].dispose=2),$e=new Uint8Array(st*pt*4),s(Re,re,Ce,$e,st,pt,-De,-Me,0),Qt=s(_e,re,Ce,$e,st,pt,-De,-Me,3)?1:0,Qt==1?d(_e,re,Ce,$e,{x:De,y:Me,width:st,height:pt}):s(_e,re,Ce,$e,st,pt,-De,-Me,0)}else $e=_e.slice(0);we.push({rect:{x:De,y:Me,width:st,height:pt},img:$e,blend:Qt,dispose:0})}if(Ue)for(ee=0;ee<we.length;ee++){if((ft=we[ee]).blend==1)continue;const _e=ft.rect,je=we[ee-1].rect,De=Math.min(_e.x,je.x),Me=Math.min(_e.y,je.y),st={x:De,y:Me,width:Math.max(_e.x+_e.width,je.x+je.width)-De,height:Math.max(_e.y+_e.height,je.y+je.height)-Me};we[ee-1].dispose=1,ee-1!=0&&u(de,re,Ce,we,ee-1,st,Ee),u(de,re,Ce,we,ee,st,Ee)}let ut=0;if(de.length!=1)for(var Ie=0;Ie<we.length;Ie++){var ft;ut+=(ft=we[Ie]).rect.width*ft.rect.height}return we}(m,g,k,U,A,_),ce={},te=[],Y=[];if(T!=0){const Le=[];for($=0;$<X.length;$++)Le.push(X[$].img.buffer);const de=function(Ee){let xe=0;for(var we=0;we<Ee.length;we++)xe+=Ee[we].byteLength;const ee=new Uint8Array(xe);let $e=0;for(we=0;we<Ee.length;we++){const Re=new Uint8Array(Ee[we]),ut=Re.length;for(let Ie=0;Ie<ut;Ie+=4){let ft=Re[Ie],_e=Re[Ie+1],je=Re[Ie+2];const De=Re[Ie+3];De==0&&(ft=_e=je=0),ee[$e+Ie]=ft,ee[$e+Ie+1]=_e,ee[$e+Ie+2]=je,ee[$e+Ie+3]=De}$e+=ut}return ee.buffer}(Le),re=F(de,T);for($=0;$<re.plte.length;$++)te.push(re.plte[$].est.rgba);let Ce=0;for($=0;$<X.length;$++){const Ue=(ge=X[$]).img.length;var oe=new Uint8Array(re.inds.buffer,Ce>>2,Ue>>2);Y.push(oe);const Ee=new Uint8Array(re.abuf,Ce,Ue);M&&a(ge.img,ge.rect.width,ge.rect.height,te,Ee,oe),ge.img.set(Ee),Ce+=Ue}}else for(P=0;P<X.length;P++){var ge=X[P];const Le=new Uint32Array(ge.img.buffer);var Fe=ge.rect.width;for(q=Le.length,oe=new Uint8Array(q),Y.push(oe),$=0;$<q;$++){const de=Le[$];if($!=0&&de==Le[$-1])oe[$]=oe[$-1];else if($>Fe&&de==Le[$-Fe])oe[$]=oe[$-Fe];else{let re=ce[de];if(re==null&&(ce[de]=re=te.length,te.push(de),te.length>=300))break;oe[$]=re}}}const vt=te.length;for(vt<=256&&p==0&&(V=vt<=2?1:vt<=4?2:vt<=16?4:8,V=Math.max(V,w)),P=0;P<X.length;P++){(ge=X[P]).rect.x,ge.rect.y,Fe=ge.rect.width;const Le=ge.rect.height;let de=ge.img;new Uint32Array(de.buffer);let re=4*Fe,Ce=4;if(vt<=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 pe=0;pe<Fe;pe++)ze[$+pe]=Ue[xe+pe];else if(V==4)for(pe=0;pe<Fe;pe++)ze[$+(pe>>1)]|=Ue[xe+pe]<<4-4*(1&pe);else if(V==2)for(pe=0;pe<Fe;pe++)ze[$+(pe>>2)]|=Ue[xe+pe]<<6-2*(3&pe);else if(V==1)for(pe=0;pe<Fe;pe++)ze[$+(pe>>3)]|=Ue[xe+pe]<<7-1*(7&pe)}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}ge.img=de,ge.bpl=re,ge.bpp=Ce}return{ctype:x,depth:V,plte:te,frames:X}}function u(m,g,k,T,N,U,A){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=k,$=-1,S=-1;for(let ce=0;ce<U.height;ce++)for(let te=0;te<U.width;te++){const Y=U.x+te,oe=U.y+ce,ge=oe*g+Y,Fe=Z[ge];Fe==0||T[N-1].dispose==0&&M[ge]==Fe&&(x==null||x[4*ge+3]!=0)||(Y<P&&(P=Y),Y>$&&($=Y),oe<q&&(q=oe),oe>S&&(S=oe))}$==-1&&(P=q=$=S=0),A&&((1&P)==1&&P--,(1&q)==1&&q--),U={x:P,y:q,width:$-P+1,height:S-q+1};const X=T[N];X.rect=U,X.blend=1,X.img=new Uint8Array(U.width*U.height*4),T[N-1].dispose==0?(s(p,g,k,X.img,U.width,U.height,-U.x,-U.y,0),d(V,g,k,X.img,U)):s(V,g,k,X.img,U.width,U.height,-U.x,-U.y,0)}function d(m,g,k,T,N){s(m,g,k,T,N.width,N.height,-N.x,-N.y,2)}function f(m,g,k,T,N,U,A){const _=[];let w,p=[0,1,2,3,4];U!=-1?p=[U]:(g*T>5e5||k==1)&&(p=[0]),A&&(w={level:0});const M=Vs;for(var x=0;x<p.length;x++){for(let P=0;P<g;P++)y(N,m,P,T,k,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,k,T,N,U){const A=k*T;let _=A+k;if(m[_]=U,_++,U==0)if(T<500)for(var w=0;w<T;w++)m[_+w]=g[A+w];else m.set(new Uint8Array(g.buffer,A,T),_);else if(U==1){for(w=0;w<N;w++)m[_+w]=g[A+w];for(w=N;w<T;w++)m[_+w]=g[A+w]-g[A+w-N]+256&255}else if(k==0){for(w=0;w<N;w++)m[_+w]=g[A+w];if(U==2)for(w=N;w<T;w++)m[_+w]=g[A+w];if(U==3)for(w=N;w<T;w++)m[_+w]=g[A+w]-(g[A+w-N]>>1)+256&255;if(U==4)for(w=N;w<T;w++)m[_+w]=g[A+w]-t(g[A+w-N],0,0)+256&255}else{if(U==2)for(w=0;w<T;w++)m[_+w]=g[A+w]+256-g[A+w-T]&255;if(U==3){for(w=0;w<N;w++)m[_+w]=g[A+w]+256-(g[A+w-T]>>1)&255;for(w=N;w<T;w++)m[_+w]=g[A+w]+256-(g[A+w-T]+g[A+w-N]>>1)&255}if(U==4){for(w=0;w<N;w++)m[_+w]=g[A+w]+256-t(0,g[A+w-T],0)&255;for(w=N;w<T;w++)m[_+w]=g[A+w]+256-t(g[A+w-N],g[A+w-T],g[A+w-N-T])&255}}}function F(m,g){const k=new Uint8Array(m),T=k.slice(0),N=new Uint32Array(T.buffer),U=I(T,g),A=U[0],_=U[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(A,V=k[x]*(1/255),Z=k[x+1]*(1/255),P=k[x+2]*(1/255),q=k[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=k[x]*.00392156862745098,Z=k[x+1]*(1/255),P=k[x+2]*(1/255),q=k[x+3]*(1/255);for(M=A;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:T.buffer,inds:p,plte:_}}function I(m,g,k){k==null&&(k=1e-4);const T=new Uint32Array(m.buffer),N={i0:0,i1:m.length,bst:null,est:null,tdst:0,left:null,right:null};N.bst=L(m,N.i0,N.i1),N.est=b(N.bst);const U=[N];for(;U.length<g;){let _=0,w=0;for(var A=0;A<U.length;A++)U[A].est.L>_&&(_=U[A].est.L,w=A);if(_<k)break;const p=U[w],M=O(m,T,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=L(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},A=0;A<16;A++)V.bst.R[A]=p.bst.R[A]-x.bst.R[A];for(A=0;A<4;A++)V.bst.m[A]=p.bst.m[A]-x.bst.m[A];V.est=b(V.bst),p.left=x,p.right=V,U[w]=x,U.push(V)}for(U.sort((_,w)=>w.bst.N-_.bst.N),A=0;A<U.length;A++)U[A].ind=A;return[N,U]}function C(m,g,k,T,N){if(m.left==null)return m.tdst=function(x,V,Z,P,q){const $=V-x[0],S=Z-x[1],X=P-x[2],ce=q-x[3];return $*$+S*S+X*X+ce*ce}(m.est.q,g,k,T,N),m;const U=R(m.est,g,k,T,N);let A=m.left,_=m.right;U>0&&(A=m.right,_=m.left);const w=C(A,g,k,T,N);if(w.tdst<=U*U)return w;const p=C(_,g,k,T,N);return p.tdst<w.tdst?p:w}function R(m,g,k,T,N){const{e:U}=m;return U[0]*g+U[1]*k+U[2]*T+U[3]*N-m.eMq}function O(m,g,k,T,N,U){for(T-=4;k<T;){for(;v(m,k,N)<=U;)k+=4;for(;v(m,T,N)>U;)T-=4;if(k>=T)break;const A=g[k>>2];g[k>>2]=g[T>>2],g[T>>2]=A,k+=4,T-=4}for(;v(m,k,N)>U;)k-=4;return k+4}function v(m,g,k){return m[g]*k[0]+m[g+1]*k[1]+m[g+2]*k[2]+m[g+3]*k[3]}function L(m,g,k){const T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],N=[0,0,0,0],U=k-g>>2;for(let A=g;A<k;A+=4){const _=m[A]*.00392156862745098,w=m[A+1]*(1/255),p=m[A+2]*(1/255),M=m[A+3]*(1/255);N[0]+=_,N[1]+=w,N[2]+=p,N[3]+=M,T[0]+=_*_,T[1]+=_*w,T[2]+=_*p,T[3]+=_*M,T[5]+=w*w,T[6]+=w*p,T[7]+=w*M,T[10]+=p*p,T[11]+=p*M,T[15]+=M*M}return T[4]=T[1],T[8]=T[2],T[9]=T[6],T[12]=T[3],T[13]=T[7],T[14]=T[11],{R:T,m:N,N:U}}function b(m){const{R:g}=m,{m:k}=m,{N:T}=m,N=k[0],U=k[1],A=k[2],_=k[3],w=T==0?0:1/T,p=[g[0]-N*N*w,g[1]-N*U*w,g[2]-N*A*w,g[3]-N*_*w,g[4]-U*N*w,g[5]-U*U*w,g[6]-U*A*w,g[7]-U*_*w,g[8]-A*N*w,g[9]-A*U*w,g[10]-A*A*w,g[11]-A*_*w,g[12]-_*N*w,g[13]-_*U*w,g[14]-_*A*w,g[15]-_*_*w],M=p,x=B;let V=[Math.random(),Math.random(),Math.random(),Math.random()],Z=0,P=0;if(T!=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,U*w,A*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]]};tt.encode=function(g,k,T,N,U,A,_){N==null&&(N=0),_==null&&(_=!1);const w=l(g,k,T,N,[!1,!1,!1,0,_,!1]);return h(w,-1),c(w,k,T,U,A)},tt.encodeLL=function(g,k,T,N,U,A,_,w){const p={ctype:0+(N==1?0:2)+(U==0?0:4),depth:A,frames:[]},M=(N+U)*A,x=M*k;for(let V=0;V<g.length;V++)p.frames.push({rect:{x:0,y:0,width:k,height:T},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,T,_,w)},tt.encode.compress=l,tt.encode.dither=a,tt.quantize=F,tt.quantize.getKDtree=I,tt.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,F,I,C=d,R=0,O=0,v=0;function L(m){u.setUint16(O,m,!0),O+=2}function b(m){u.setUint32(O,m,!0),O+=4}function B(m){O+=m}L(19778),b(h),B(4),b(122),b(108),b(t),b(-r>>>0),L(1),L(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(I=122+R*a,f=0;f<n;)C--,y=o[v++],F=y>>>24,u.setUint32(I+f,y<<8|F),f+=4;R++}v<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 We={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Hs={[We.CHROME]:16384,[We.FIREFOX]:11180,[We.DESKTOP_SAFARI]:16384,[We.IE]:8192,[We.IOS]:4096,[We.ETC]:8192};const Jn=typeof window<"u",$r=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Nn=Jn&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),$s=(Jn||$r)&&(Nn&&Nn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Pr=(Jn||$r)&&(Nn&&Nn.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=We.ETC;const{userAgent:e}=navigator;return/Chrom(e|ium)/i.test(e)?s=We.CHROME:/iP(ad|od|hone)/i.test(e)&&/WebKit/i.test(e)?s=We.IOS:/Safari/i.test(e)?s=We.DESKTOP_SAFARI:/Firefox/i.test(e)?s=We.FIREFOX:(/MSIE/i.test(e)||document.documentMode)&&(s=We.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 In(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]=In(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 Tn(){return Tn.cachedResult!==void 0||(Tn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Tn.cachedResult}function Ln(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(Tn()||[We.DESKTOP_SAFARI,We.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 Un(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=tt.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 at(s){s.width=0,s.height=0}function $t(){return new Promise(function(s,e){let t,r,n,i;return $t.cachedResult!==void 0?s($t.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,Ln(t).then(function(a){try{return r=a[1],Un(r,t.type,t.name,t.lastModified).then(function(c){try{return n=c,at(r),Ln(n).then(function(h){try{return i=h[0],$t.cachedResult=i.width===1&&i.height===2,s($t.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]=In(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),at(s)),o}function Xr(s,e){const{width:t}=s,{height:r}=s,[n,i]=In(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),at(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,F,I,C,R,O,v,L,b,B,m;function g(T=5){if(e.signal&&e.signal.aborted)throw e.signal.reason;i+=T,e.onProgress(Math.min(i,100))}function k(T){if(e.signal&&e.signal.aborted)throw e.signal.reason;i=Math.min(Math.max(T,i),100),e.onProgress(i)}return i=t,o=e.maxIteration||10,a=1024*e.maxSizeMB*1024,g(),Ln(s,e).then((function(T){try{return[,c]=T,g(),h=zr(c,e),g(),new Promise(function(N,U){var A;if(!(A=e.exifOrientation))return Kr(s).then((function(w){try{return A=w,_.call(this)}catch(p){return U(p)}}).bind(this),U);function _(){return N(A)}return _.call(this)}).then((function(N){try{return l=N,g(),$t().then((function(U){try{return u=U?h:Xr(h,l),g(),d=e.initialQuality||1,f=e.fileType||s.type,Un(u,f,s.name,s.lastModified,d).then((function(A){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,[L,b]=In(M,x),b.drawImage(B,0,0,M,x),d*=f==="image/png"?.85:.95,Un(L,f,s.name,s.lastModified,d).then(function(V){try{return v=V,at(B),B=L,O=v.size,k(Math.min(99,Math.floor((R-O)/(R-a)*100))),w}catch(Z){return n(Z)}},n)}return[1]},p=function(){return at(B),at(L),at(h),at(u),at(c),k(100),r(v)};if(y=A,g(),F=y.size>a,I=y.size>s.size,!F&&!I)return k(100),r(y);var _;return C=s.size,R=y.size,O=R,B=u,m=!e.alwaysKeepResolution&&F,(_=(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(A){return n(A)}}).bind(this),n)}catch(U){return n(U)}}).bind(this),n)}catch(N){return n(N)}}).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,19 +21,19 @@ self.addEventListener('message', async (e) => {
|
|
|
21
21
|
self.postMessage({ error: e.message + '\\n' + e.stack, id })
|
|
22
22
|
}
|
|
23
23
|
})
|
|
24
|
-
`;let Qn;function Zs(s,e){return new Promise((t,r)=>{Qn||(Qn=function(o){const a=[];return a.push(o),URL.createObjectURL(new Blob(a))}($s));const n=new Worker(Qn);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 Ps))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(I){return r(I)}},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",Zs(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=$r,Oe.getFilefromDataUrl=Yn,Oe.loadImage=Zr,Oe.drawImageInCanvas=qr,Oe.drawFileInCanvas=Ln,Oe.canvasToFile=Un,Oe.getExifOrientation=zr,Oe.handleMaxWidthOrHeight=Kr,Oe.followExifOrientation=Xr,Oe.cleanupCanvasMemory=at,Oe.isAutoOrientationInBrowser=Wt,Oe.approximateBelowMaximumCanvasSizeOfBrowser=jr,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&&ye(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,$.LengthDelimited).string(e.mimeType);let n=r.writeUnknownFields;return n!==!1&&(n==!0?G.onWrite:n)(this.typeName,e,t),t}}const xn=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&&ye(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,$.LengthDelimited).string(e.key),e.uploadUrl!==""&&t.tag(2,$.LengthDelimited).string(e.uploadUrl),e.accessUrl!==""&&t.tag(3,$.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 Vn("com.hamropatro.grpc.common.ImageUploadService",[{name:"Upload",options:{},I:xn,O:Jr},{name:"UploadUserImage",options:{},I:xn,O:Jr}]);class Yr{constructor(e){me(this,"typeName",er.typeName);me(this,"methods",er.methods);me(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 Yr(r),i=xn.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 Yr(t),i=xn.create();try{return i.mimeType=s,await n.uploadUserImage(i,{meta:{Authorization:e,"app-id":r==="production"?"hamropatro":"hamropatro-android"}})}catch(c){throw c}},Qr=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=Gs(s,t);try{await fetch(e,{method:"PUT",headers:{"Content-Type":t==null?void 0:t.type},body:r})}catch(n){throw n}},Xs=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}},Gs=(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}}function Js(s="24px",e="24px",t="#000"){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("height",e),r.setAttribute("viewBox","0 -960 960 960"),r.setAttribute("width",s),r.setAttribute("fill",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M240-200h120v-240h240v240h120v-360L480-740 240-560v360Zm-80 80v-480l320-240 320 240v480H520v-240h-80v240H160Zm320-350Z"),r.appendChild(n),r}class ni{constructor(e){K(this,yt);K(this,be);K(this,ke);K(this,bt);K(this,fe,[]);K(this,Fe,[]);K(this,rt);K(this,je);K(this,St);K(this,kt);K(this,lt,[]);K(this,He);K(this,it);K(this,Rt);K(this,tr);K(this,It);K(this,Ft);K(this,Ct);K(this,Dt);K(this,ct);K(this,ze);K(this,Nt);K(this,Tt);K(this,Et);K(this,$t);K(this,on);K(this,Se);K(this,Mt);K(this,an,!1);K(this,_n);K(this,ln);K(this,dt);K(this,Zt);K(this,Lt);K(this,jt);K(this,qt);K(this,zt);K(this,Kt);K(this,Xt);K(this,cn);K(this,dn);K(this,Gt);K(this,ht);K(this,Jt);K(this,hn);H(this,ln,e.isAdmin),H(this,rt,!1),H(this,jt,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,It,0),H(this,ze,""),H(this,Et,!1),H(this,jt,e.mode),H(this,Nt,!1),H(this,Lt,""),H(this,Mt,null),H(this,hn,e.enableDialog),this._removeToastContainer(),this._renderAdminView(e)):(H(this,Zt,""),H(this,qt,e==null?void 0:e.restrictedFileSize),H(this,zt,e==null?void 0:e.localizedFileRestrictedMessage),H(this,Xt,e==null?void 0:e.localizedSuccessMessage),H(this,Kt,e==null?void 0:e.localizedErrorMessage),H(this,ht,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;if(H(this,yt,document.getElementById(t)),!E(this,hn))setTimeout(()=>{const n=this._selectedImageContainer();E(this,yt).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,yt).appendChild(n)}}async _grpcOptionInitializer(){H(this,Se,await Os(E(this,on),E(this,jt)))}_commonImageContainer(){var h;H(this,Ft,z("folder-container")),H(this,Ct,z("folder-list-wrapper")),this._fetchAllFolders(),H(this,be,z("browse-container"));const e=z();e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="space-between",e.style.padding="10px 20px";const t=sn("Folders","folder-title"),r=Pe("","add-folder-btn");r.append(Or()),this._createUpdateFolderDialog(r,"create"),e.append(t,r),E(this,Ft).append(e,E(this,Ct));const n=this._renderSearchField(),i=this._createBrowseMoreContainer(),o=this._createBrowseImageMain(),a=z("footer");H(this,it,Pe(`Save (${(h=E(this,fe))==null?void 0:h.length})`,"dialog-btn confirm"));const c=z("container-right-main");return c.append(n,i,o,a),E(this,be).append(E(this,Ft),c),{footer:a,wrapper:c}}_selectedImageContainer(){const{footer:e}=this._commonImageContainer();return E(this,it).onclick=()=>{E(this,Rt).call(this),H(this,fe,[]),H(this,Fe,[])},e.appendChild(E(this,it)),E(this,be)}_selectedImageContainerDialog(){var n;const{footer:e}=this._commonImageContainer();H(this,it,Pe(`Save (${(n=E(this,fe))==null?void 0:n.length})`,"dialog-btn confirm"));const t=Pe("Cancel","dialog-btn cancel");Pe("","dialog-modal-close-btn","",!1,'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="24" height="24" viewBox="0 0 50 50"> <path d="M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z"></path> </svg>').addEventListener("click",()=>{kn.hide(),H(this,fe,[]),H(this,Fe,[])}),t.onclick=()=>{kn.hide(),H(this,ze,""),H(this,Fe,[]),H(this,fe,[])},E(this,it).onclick=()=>{E(this,Rt).call(this),kn.hide(),H(this,ze,""),H(this,fe,[]),H(this,Fe,[])},e.append(t,E(this,it)),kn.show({content:E(this,be)})}_renderUserView(e){const{parentContainerId:t,restrictedFileSize:r,imagePreview:n}=e;H(this,yt,document.getElementById(t)),H(this,dt,Y("div","user-view-container"));const i=z("user-view-browse-wrapper","user-view-browse-wrapper"),o=Y("span","","",""),a=this._renderUserViewBrowseButton(),c=Y("p","","margin-block: 0px; font-size:14px");if(c.append(o,a),r){const h=Y("p","","margin-block: 0px; font-size: 13px; color: #777",`Max File size: ${r}MB`);i.append(Kn(),c,h)}else i.append(Kn(),c);return E(this,dt).append(i),n&&this._renderImagePreview(n,"",i,!0),E(this,yt).appendChild(E(this,dt)),E(this,yt)}_renderImagePreview(e,t,r,n=!1){var N;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=Y("div","user-image-preview");c.id="user-image-preview";const h=this._renderImageLoadingContainer();c.appendChild(h);const l=Y("img","",`max-width: ${E(this,ht)?E(this,ht):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",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=Y("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 I=Y("button","","display:none");I.id="image-preview-hidden-btn",I.addEventListener("click",C=>{var R;C.preventDefault(),C.stopPropagation(),(R=E(this,dt))==null||R.removeChild(c),E(this,dn).call(this),this._removeUserToast(),o&&(o.style.display="flex")}),c==null||c.append(l,f,I),(N=E(this,dt))==null||N.append(c)}_renderImageErrorContainer(){const e=Y("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(F){return r(F)}},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=Ln,Oe.canvasToFile=Un,Oe.getExifOrientation=Kr,Oe.handleMaxWidthOrHeight=zr,Oe.followExifOrientation=Xr,Oe.cleanupCanvasMemory=at,Oe.isAutoOrientationInBrowser=$t,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&&ye(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 xn=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&&ye(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 Vn("com.hamropatro.grpc.common.ImageUploadService",[{name:"Upload",options:{},I:xn,O:Jr},{name:"UploadUserImage",options:{},I:xn,O:Jr}]);class Qr{constructor(e){me(this,"typeName",er.typeName);me(this,"methods",er.methods);me(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=xn.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=xn.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}}function Gs(s="24px",e="24px",t="#000"){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("height",e),r.setAttribute("viewBox","0 -960 960 960"),r.setAttribute("width",s),r.setAttribute("fill",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M240-200h120v-240h240v240h120v-360L480-740 240-560v360Zm-80 80v-480l320-240 320 240v480H520v-240h-80v240H160Zm320-350Z"),r.appendChild(n),r}class Js{constructor(e){z(this,yt);z(this,be);z(this,ke);z(this,bt);z(this,fe,[]);z(this,Ne,[]);z(this,rt);z(this,qe);z(this,St);z(this,kt);z(this,lt,[]);z(this,He);z(this,it);z(this,Rt);z(this,tr);z(this,Ft);z(this,Nt);z(this,Ct);z(this,Dt);z(this,ct);z(this,Ke);z(this,It);z(this,Tt);z(this,Et);z(this,Wt);z(this,on);z(this,Se);z(this,Mt);z(this,an,!1);z(this,_n);z(this,ln);z(this,dt);z(this,jt);z(this,Lt);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,ht);z(this,Jt);z(this,hn);H(this,ln,e.isAdmin),H(this,rt,!1),H(this,qt,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,qe,!1),H(this,St,!1),H(this,Ft,0),H(this,Ke,""),H(this,Et,!1),H(this,qt,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,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,ht,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;if(H(this,yt,document.getElementById(t)),!E(this,hn))setTimeout(()=>{const n=this._selectedImageContainer();E(this,yt).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,yt).appendChild(n)}}async _grpcOptionInitializer(){H(this,Se,await Bs(E(this,on),E(this,qt)))}_commonImageContainer(){var h;H(this,Nt,K("folder-container")),H(this,Ct,K("folder-list-wrapper")),this._fetchAllFolders(),H(this,be,K("browse-container"));const e=K();e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="space-between",e.style.padding="10px 20px";const t=sn("Folders","folder-title"),r=Pe("","add-folder-btn");r.append(Or()),this._createUpdateFolderDialog(r,"create"),e.append(t,r),E(this,Nt).append(e,E(this,Ct));const n=this._renderSearchField(),i=this._createBrowseMoreContainer(),o=this._createBrowseImageMain(),a=K("footer");H(this,it,Pe(`Save (${(h=E(this,fe))==null?void 0:h.length})`,"dialog-btn confirm"));const c=K("container-right-main");return c.append(n,i,o,a),E(this,be).append(E(this,Nt),c),{footer:a,wrapper:c}}_selectedImageContainer(){const{footer:e}=this._commonImageContainer();return E(this,it).onclick=()=>{E(this,Rt).call(this),H(this,fe,[]),H(this,Ne,[])},e.appendChild(E(this,it)),E(this,be)}_selectedImageContainerDialog(){var n;const{footer:e}=this._commonImageContainer();H(this,it,Pe(`Save (${(n=E(this,fe))==null?void 0:n.length})`,"dialog-btn confirm"));const t=Pe("Cancel","dialog-btn cancel");Pe("","dialog-modal-close-btn","",!1,'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="24" height="24" viewBox="0 0 50 50"> <path d="M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z"></path> </svg>').addEventListener("click",()=>{kn.hide(),H(this,fe,[]),H(this,Ne,[])}),t.onclick=()=>{kn.hide(),H(this,Ke,""),H(this,Ne,[]),H(this,fe,[])},E(this,it).onclick=()=>{E(this,Rt).call(this),kn.hide(),H(this,Ke,""),H(this,fe,[]),H(this,Ne,[])},e.append(t,E(this,it)),kn.show({content:E(this,be)})}_renderUserView(e){const{parentContainerId:t,restrictedFileSize:r,imagePreview:n}=e;H(this,yt,document.getElementById(t)),H(this,dt,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 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,dt).append(i),n&&this._renderImagePreview(n,"",i,!0),E(this,yt).appendChild(E(this,dt)),E(this,yt)}_renderImagePreview(e,t,r,n=!1){var I;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,ht)?E(this,ht):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",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=Kn();y.style.fill="#fff",f==null||f.appendChild(y),f.addEventListener("click",()=>{E(this,cn).call(this)});const F=Q("button","","display:none");F.id="image-preview-hidden-btn",F.addEventListener("click",C=>{var R;C.preventDefault(),C.stopPropagation(),(R=E(this,dt))==null||R.removeChild(c),E(this,dn).call(this),this._removeUserToast(),o&&(o.style.display="flex")}),c==null||c.append(l,f,F),(I=E(this,dt))==null||I.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;">
|
|
28
28
|
Retry
|
|
29
29
|
</button>
|
|
30
30
|
</div>
|
|
31
|
-
`,e}_renderImageLoadingContainer(){const e=
|
|
31
|
+
`,e}_renderImageLoadingContainer(){const e=Q("div","image-loader");return e.innerHTML=`
|
|
32
32
|
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%;">
|
|
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,Zt)*1024*1024;if(e.size>t){this._renderUserToast(E(this,Kt)?E(this,Kt):`File size must be less than ${E(this,Zt)}MB.`,"error");return}H(this,rt,!0),E(this,Gt).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"?_r("#4caf50"):Zn();i.style.width="15px",i.style.height="15px",r.append(i,n),E(this,dt).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,ht)?E(this,ht):230}px;max-width:${E(this,ht)?E(this,ht):230}px`);e.appendChild(t),E(this,dt).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,Xt)&&this._renderUserToast(E(this,Xt),"success")}catch{this._renderUserToast(E(this,zt)?E(this,zt):"Error uploading. Please try again later.","error")}finally{H(this,rt,!1),E(this,Gt).call(this,!1),this._removeUserUploading(),this._renderRemovePreviewBtn()}}async _uploadForUser(e,t){var r;try{const n=await ss(e,et[Xn((r=t.type)==null?void 0:r.split("/")[0])],E(this,Se));H(this,jt,n==null?void 0:n.response),E(this,Rt).call(this)}catch(n){throw Error(n)}}_createAllAndSelectedTab(e){const t=K("select-options"),r=sn("Browse","select"),n=sn("Selected","select","selected-images-tab");r.classList.add("selected"),[r,n].forEach((o,a)=>{o.addEventListener("click",()=>{var c;H(this,Ft,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,bt,document.createElement("button")),E(this,bt).className="browse-more-btn";const t=document.createElement("span");return t.textContent="Upload",E(this,bt).append(zn(),t),E(this,bt).type="button",E(this,bt).addEventListener("click",()=>e.click()),e.addEventListener("change",async()=>{const r=e.files[0];try{H(this,rt,!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,be))}e.value=""}),E(this,bt)}_renderCreateFolderBtn(){const e=document.createElement("button");e.className="create-folder-btn";const t=document.createElement("span");return t.textContent="Create",e.append(Or(),t),this._createUpdateFolderDialog(e,"create"),e}_renderSearchField(){let e;const t=K("search-browse-container"),r=K("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,Ke,""),H(this,It,!1),H(this,Et,!1),this._fetchFilesFromFolder(E(this,kt));return}H(this,Et,!0),H(this,Wt,o.value),this._search(E(this,Wt))},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,K("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=K("browse-image-main");return H(this,ke,K("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,Et)?this._search(E(this,Wt)):this._fetchFilesFromFolder(E(this,kt)))}),e.appendChild(E(this,ke)),e}_renderFetchingSkeletonUI(){for(let e=0;e<20;e++){const t=K("skeleton");t.innerHTML="",E(this,ke).append(t)}}_renderEmptyImageContainer(){if(E(this,qe)||E(this,rt))return;const e=K(),t=K(),r=document.createElement("p");E(this,Et)&&E(this,Ft)===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=z("skeleton");e.innerHTML="",E(this,ke).appendChild(e)}_fileCardBody(e){var pt,Yt,Bn,Qt;const t=z("selected-image-content"),r=z("selected-image-top-bar"),n=Pe("","selected-image-btn","",!1,'<svg width="20px" height="20px" viewBox="0 0 20 20" focusable="false" fill="currentColor"><path fill="none" d="M0 0h20v20H0V0z"></path><path d="M10 6c.82 0 1.5-.68 1.5-1.5S10.82 3 10 3s-1.5.67-1.5 1.5S9.18 6 10 6zm0 5.5c.82 0 1.5-.68 1.5-1.5s-.68-1.5-1.5-1.5-1.5.68-1.5 1.5.68 1.5 1.5 1.5zm0 5.5c.82 0 1.5-.67 1.5-1.5 0-.82-.68-1.5-1.5-1.5s-1.5.68-1.5 1.5c0 .83.68 1.5 1.5 1.5z"></path></svg>');let i,o;(e==null?void 0:e.type)===et.IMAGE&&(i=Mr(e==null?void 0:e.url,"selected-image"),o=Is()),(e==null?void 0:e.type)===et.VIDEO&&(i=Ss(e==null?void 0:e.url,"uploaded-video"),o=Ls()),(e==null?void 0:e.type)===et.AUDIO&&(i=Rs(e==null?void 0:e.url,"uploaded-audio"),o=ks());const a=z("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"),h=le("","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=Pe("","action-option preview"),f=le("Preview",""),y=Ns();d.append(y,f);const I=Pe("","action-option move"),N=le("Move",""),C=Fs();I.append(C,N);const R=Pe("","action-option rename"),O=le("Rename",""),v=Br();R.append(v,O);const L=Pe("","action-option delete"),b=le("Delete",""),B=Sr();L.append(B,b);const m=e.name.split(".")[0],g=e.name.split(".")[1],k=rn[e.type],T=z("edit-form-wrapper"),F=z("move-form-wrapper"),U=z("preview-details-container"),A=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"),q=z("preview-option-wrapper"),P=z("preview-option-wrapper"),j=Mr(e.url,"preview-option-image");_.append(j);const W=le("File name","preview-title"),S=z("preview-option-name");S.innerHTML=e.name,w.append(W,S);const X=le("Folder name","preview-title"),ce=le(e.folderName,"preview-option-name");p.append(X,ce);const te=le("File Extension","preview-title"),Q=le(g,"preview-option-name extension");M.append(te,Q);const oe=le("File type","preview-title"),ge=le(k,"preview-option-name");x.append(oe,ge);const Ie=le("Dimension","preview-title"),vt=le(`${(pt=e==null?void 0:e.metadata)==null?void 0:pt.width} * ${(Yt=e==null?void 0:e.metadata)==null?void 0:Yt.height}`,"preview-option-name");V.append(Ie,vt);const Ke=le("URL","preview-title"),pe=le(e.url,"preview-option-name url");q.append(Ke,pe);const Le=le("Parent folder","preview-title"),de=le(e.nestedFolderName,"preview-option-name");P.append(Le,de),A.append(p,w,M,x,((Bn=e==null?void 0:e.metadata)==null?void 0:Bn.width)>0&&((Qt=e==null?void 0:e.metadata)==null?void 0:Qt.height)>0?V:"",q,e.nestedFolderName?P:""),U.append(_,A);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=le("Current Folder:","input-label"),xe=z("folder-field current");xe.textContent=e.folderName,xe.prepend(nn()),Ue.append(Ee,xe);const we=z("form-control"),ee=z();ee.style.width="100%",ee.style.display="flex",ee.style.alignItems="center",ee.style.justifyContent="space-between";const We=le("Suggested Folder List:","input-label"),Re=le();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(We,Re);const ut=z();ut.style.width="100%",ut.style.maxHeight="250px",ut.style.overflowY="auto";const Ne=document.createElement("ul");Ne.className="folders",ut.append(Ne),we.append(ee,ut),E(this,lt).forEach(ue=>{const Xe=this._renderEditFolderListContainer(ue);Ne.appendChild(Xe)});const ft=z("form-control"),_e=le("Destination Folder:","input-label"),Ze=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,Ze.append(nn(),De);let Me="";ft.append(_e,Ze),Ce.onchange=ue=>{Me=ue.target.value},Me=Me!==""?Me:e.name,T.append(re),F.append(Ue,we,ft),u.append(d,I,R,L),d.onclick=ue=>{ue.stopPropagation(),Qe.hide(),Ae.show({content:U,header:m,dialogContentStyle:{minWidth:"60rem",padding:"10px"},showCloseBtn:!0})},I.onclick=ue=>{ue.stopPropagation(),Qe.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(),Qe.hide(),Ae.show({content:T,header:"Rename",confirmButtonText:"Update",dialogContentStyle:{padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{Ae.hide()},onConfirm:()=>{this._updateFile(Me,e)}})},L.onclick=ue=>{ue.stopPropagation(),Qe.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(),Qe.hide(),Qe.show({content:u,mainContainer:r,divId:e.key}),H(this,Mt,e.key)}),i.addEventListener("click",()=>{const ue=E(this,fe).findIndex(mt=>(mt==null?void 0:mt.key)===(e==null?void 0:e.key));if(t.classList.contains("checked"))t.classList.remove("checked"),ue!==-1&&(E(this,fe).splice(ue,1),E(this,It)===1&&a.remove());else{if(E(this,_n))E(this,fe).push(e);else{const mt=document.querySelector(".selected-image-wrapper .checked");mt==null||mt.classList.remove("checked"),H(this,fe,[e])}t.classList.add("checked")}this._updateContent()}),document.addEventListener("click",ue=>{const Xe=document.querySelector(`#${E(this,Mt)}`);Xe&&(ue.composedPath().includes(Xe)||Qe.hide())}),E(this,fe).findIndex(ue=>(ue==null?void 0:ue.key)===(e==null?void 0:e.key))!==-1?(t.classList.add("checked"),E(this,Et)?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,Fe))==null?void 0:e.length)>0&&((t=E(this,Fe))==null||t.forEach(r=>{this._renderImageCard(r)}))}_renderSelectedImageListContainer(){var e;((e=E(this,fe))==null?void 0:e.length)>0&&E(this,fe).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(nn()),r.append(n,i),t.append(r),e.children&&Object.keys(e.children).length>0){const v=document.createElement("button");v.classList.add("expand-icon"),v.appendChild(vn()),r.prepend(v);const L=document.createElement("ul");L.className="folders nested",t.appendChild(L),v.addEventListener("click",b=>{b.stopPropagation(),t.classList.toggle("active"),L.classList.toggle("visible")}),Object.values(e.children).forEach((b,B)=>{const m=this._renderFolderListContainer(b);L.appendChild(m)})}const o=Pe("","folder-option-btn","moveToInputField.disabled",!1,'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-ellipsis"><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/></svg>'),a=z("action-wrapper"),c=Pe("","action-option edit"),h=le("Edit",""),l=Br();c.append(l,h);const u=z("edit-form-wrapper"),d=z("name-field-wrapper"),f=le("Name","input-label"),y=document.createElement("input");y.classList.add("input-field"),y.value=e.name,y.onchange=v=>{v.target.value},d.append(f,y),u.append(d);const I={key:e.key,name:e.name,nestedFolderName:e.nestedFolderName,createdBy:e.createdBy,forUser:!0};this._createUpdateFolderDialog(c,"update",I);const N=Pe("","action-option delete"),C=le("Delete",""),R=Sr();return N.append(R,C),a.append(c,N),N.onclick=v=>{v.stopPropagation(),Qe.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",v=>{v.stopPropagation(),Qe.hide(),Qe.show({content:a,mainContainer:r,divId:e.key}),H(this,Mt,e.key)}),r.appendChild(o),t.addEventListener("click",v=>{var L;v.stopPropagation(),H(this,He,e),H(this,kt,e==null?void 0:e.name),H(this,fe,[]),H(this,Fe,[]),H(this,ze,""),H(this,Nt,!1),(L=document.querySelector(".folder.selected"))==null||L.classList.remove("selected"),t.classList.add("selected"),this._fetchFilesFromFolder(e.name)}),((O=E(this,He))==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(vn()),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,He))==null?void 0:o.key)===(e==null?void 0:e.key)&&t.classList.add("selected"),t}_updateFolderListContainer(){if(E(this,Ft))if(E(this,Ct).innerHTML="",E(this,St)){const e=this._renderFolderListLoadingUI();E(this,Ct).appendChild(e)}else{const e=document.createElement("ul");e.className="folders",E(this,Ct).appendChild(e),E(this,lt).forEach(t=>{const r=this._renderFolderListContainer(t);e.appendChild(r)}),E(this,Ft).appendChild(E(this,Ct))}}_renderToastContainer(e,t,r){this._removeToastContainer(),H(this,ct,document.createElement("div")),E(this,ct).className=`message-container ${t}`;const n=sn(e,"message"),i=t==="success"?_r():qn(),o=Pe("");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,ct).append(i,n,o),r.appendChild(E(this,ct)),setTimeout(()=>{this._removeToastContainer()},5e3)}_removeToastContainer(){E(this,ct)&&(E(this,ct).remove(),H(this,ct,null))}_updateSelectedImageListContainerUI(){var t,r;if(!E(this,ke))return;E(this,ke).innerHTML="",E(this,rt)&&this._renderLoadingUI(),E(this,je)&&this._renderFetchingSkeletonUI();const e=document.getElementById("search-input-wrapper");E(this,It)===0?(e&&(e.style.visibility="visible"),((t=E(this,Fe))==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,fe))==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,fe))==null?void 0:t.length})`),E(this,it).textContent=`Save (${(r=E(this,fe))==null?void 0:r.length})`,E(this,it).disabled=((n=E(this,fe))==null?void 0:n.length)===0}async _uploadAndAddSelectedImageList(e,t){var r,n;this._updateSelectedImageListContainerUI();try{const i=await Qr(e,t,E(this,Se)),o=await ss(t==null?void 0:t.name,"",i,et[Xn((r=t.type)==null?void 0:r.split("/")[0])],(n=E(this,He))==null?void 0:n.name,E(this,Se));E(this,Fe).unshift(o==null?void 0:o.response),this._renderToastContainer("File Uploaded Successfully","success",E(this,be))}catch{this._renderToastContainer("Something went wrong while uploading file. Please try again later.","error",E(this,be))}finally{H(this,rt,!1),this._updateSelectedImageListContainerUI()}}async _updateFile(e,t){Ae.updateUploadBtn(!0);try{const r=await ds(t.key,e,t.nestedFolderName,t.url,t.thumborUrl,t.proxyUrl,t.type,E(this,Lt),E(this,Se)),n=E(this,Fe).find(i=>i.key===r.response.key);n.name=e,this._fetchFilesFromFolder(E(this,He).name),H(this,Fe,[]),H(this,fe,[]),this._renderToastContainer("File Updated Successfully","success",E(this,be))}catch{this._renderToastContainer("Something went wrong while updating the file. Please try again later.","error",E(this,be))}finally{Ae.updateUploadBtn(!1),Ae.hide(),this._updateSelectedImageListContainerUI()}}async _deleteFile(e){Ae.updateUploadBtn(!0);try{await hs(e,E(this,Se)),H(this,Fe,E(this,Fe).filter(t=>e!==t.key)),this._renderToastContainer("File Deleted Successfully","success",E(this,be))}catch{this._renderToastContainer("Something went wrong while deleting the file. Please try again later.","error",E(this,be))}finally{Ae.updateUploadBtn(!1),Ae.hide(),this._updateSelectedImageListContainerUI()}}async _createFolder(e,t=2){var r;try{const n=await Es(e,(r=E(this,He))==null?void 0:r.name,"",!1,E(this,Se));H(this,fe,[]),H(this,Fe,[]);const i=Bs(E(this,lt),n==null?void 0:n.response);H(this,lt,i),H(this,kt,e),H(this,He,{...n==null?void 0:n.response,children:{}}),this._fetchFilesFromFolder(e),this._renderToastContainer(`Folder ${e} created successfully`,"success",E(this,be))}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,be)),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,fe):E(this,Zt)}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 Xs(c.result,n,t),u=await as(l,et[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,rt)}async _fetchFilesFromFolder(e){var t,r,n;H(this,je,!0),this._updateSelectedImageListContainerUI();try{const i=await ls(e,E(this,ze),20,E(this,Se)),o=(t=i.response)==null?void 0:t.files;E(this,Fe).push(...o),H(this,ze,(r=i.response)==null?void 0:r.nextCursor),H(this,Nt,(n=i.response)==null?void 0:n.hasMore)}catch{throw this._renderToastContainer("Error while fetching files from folder"+e,"error",E(this,be)),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 Cs("",1e3,E(this,Se))).response.folder,i=_s(n);H(this,kt,(e=i[0])==null?void 0:e.name),this._fetchFilesFromFolder((t=i[0])==null?void 0:t.name),H(this,He,i[0]),H(this,lt,i)}catch{H(this,je,!1),this._renderToastContainer("Folder not found. Please create a folder or try again later","error",E(this,be))}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 cs(e,E(this,ze),10,E(this,Se)),i=(t=n.response)==null?void 0:t.items;E(this,Fe).push(...i),H(this,ze,(r=n.response)==null?void 0:r.nextPageCursor)}catch{this._renderToastContainer("Error while searching files","error",E(this,be))}finally{H(this,je,!1),this._updateSelectedImageListContainerUI()}}async _updateFolder(e,t){Ae.updateUploadBtn(!0);try{const r=await vs(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,be)),new Error("Error updating the folder ")}finally{Ae.updateUploadBtn(!1),Ae.hide(),this._updateFolderListContainer()}}async _deleteFolder(e){Ae.updateUploadBtn(!0);try{await As(e,E(this,Se)),H(this,lt,E(this,lt).filter(t=>t.key!==e)),this._renderToastContainer("Folder Deleted Successfully","success",E(this,be))}catch{throw this._renderToastContainer("Something went wrong while deleting the folder. Please try again later.","error",E(this,be)),new Error("Error deleting the folder ")}finally{Ae.updateUploadBtn(!1),Ae.hide(),this._updateFolderListContainer()}}_createUpdateFolderDialog(e,t,r){e.addEventListener("click",n=>{var R,O,v,L;n.stopPropagation(),Qe.hide();let i;const o=z("edit-form-wrapper"),a=z("form-control"),c=Y("div","","display:flex;align-items:center;gap:5px;"),h=Js("20px","20px"),l=vn("20px","20px"),u=vn("20px","20px"),d=(R=E(this,He))!=null&&R.nestedFolderName?(O=E(this,He))==null?void 0:O.nestedFolderName:"",f=(v=E(this,He))!=null&&v.name?(L=E(this,He))==null?void 0:L.name:"";d?c.append(h,l,d,u,f):c.append(h,l,f);const y=le("Folder Name","input-label"),I=z();I.style.position="relative";const N=document.createElement("input");N.style.paddingLeft="40px";const C=Y("span","","position:absolute;top:50%;left:5%;transform:translate(-40%,-40%)");C.appendChild(nn()),N.classList.add("input-field"),I.append(N,C),t==="update"&&(N.value=r.name),N.onchange=b=>{i=b.target.value},a.append(c,y,I),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})}}yt=new WeakMap,be=new WeakMap,ke=new WeakMap,bt=new WeakMap,fe=new WeakMap,Fe=new WeakMap,rt=new WeakMap,je=new WeakMap,St=new WeakMap,kt=new WeakMap,lt=new WeakMap,He=new WeakMap,it=new WeakMap,Rt=new WeakMap,tr=new WeakMap,It=new WeakMap,Ft=new WeakMap,Ct=new WeakMap,Dt=new WeakMap,ct=new WeakMap,ze=new WeakMap,Nt=new WeakMap,Tt=new WeakMap,Et=new WeakMap,$t=new WeakMap,on=new WeakMap,Se=new WeakMap,Mt=new WeakMap,an=new WeakMap,_n=new WeakMap,ln=new WeakMap,dt=new WeakMap,Zt=new WeakMap,Lt=new WeakMap,jt=new WeakMap,qt=new WeakMap,zt=new WeakMap,Kt=new WeakMap,Xt=new WeakMap,cn=new WeakMap,dn=new WeakMap,Gt=new WeakMap,ht=new WeakMap,Jt=new WeakMap,hn=new WeakMap;const Ys=new ni({parentContainerId:"app",accessToken:"mBearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJtaW5pLWFwcC1zZXJ2aWNlIiwic3ViIjoiZW5ma0JmQ0tqQ2U4S2t1VGRmZXZoMVV6QW1MMiIsImlhdCI6MTc0NDc3NjU5OSwiZXhwIjoxNzQ0OTQ5Mzk5LCJhcHBJZCI6ImhhbXJvcGF0cm8tYW5kcm9pZCIsIm1pbmlBcHBJZCI6IjNhM2NhYWIwLTJmYzItMTFlZi1iNDQ4LWU2OGRhNmVmOWU4MCIsInByb2ZpbGVJbWFnZSI6Imh0dHBzOi8vbGgzLmdvb2dsZXVzZXJjb250ZW50LmNvbS9hL0FMbTV3dTNuZFpxZEVTcVZiajNmd1FHbV80bkFDTDlubzJJT19tTFA1eFY3PXM5Ni1jIiwiZGlzcGxheU5hbWUiOiJOaXJhaiBMYW1hIiwiZW1haWwiOiJubGFtYUBoYW1yb3BhdHJvLmNvbSIsInBob25lTnVtYmVyIjoiIiwiYWRtaW4iOnRydWUsImJ1c2luZXNzIjpbIjIxNzBlMjEwLTJjOTUtMTFlZi1iNDQ4LWU2OGRhNmVmOWU4MDowIiwiM2EzY2FhYjAtMmZjMi0xMWVmLWI0NDgtZTY4ZGE2ZWY5ZTgwOjEiLCIxYTM1NGY4MC03NDAzLTExZWYtOGU5Ni1iNjk4ZjZiMWJlNzU6MSIsIjg0ZDUzYWU4LTgyYTQtNDJjZi05MzkwLWExYTJiZmY4Yjk5YzoxIl0sInN1c3BlbmRlZCI6ZmFsc2UsInZlcmlmaWVkIjpmYWxzZX0.KZhHP5xUERZg3O3swoQLsdofiJ8P-574_rzLv222-KM",mode:"development",isAdmin:!0,handleUpload:()=>{Qs()},enableDialog:!0}),Qs=()=>{Ys._upload().then(s=>console.log("res",s))};return ni});
|
|
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 pt,Qt,Bn,Yt;const t=K("selected-image-content"),r=K("selected-image-top-bar"),n=Pe("","selected-image-btn","",!1,'<svg width="20px" height="20px" viewBox="0 0 20 20" focusable="false" fill="currentColor"><path fill="none" d="M0 0h20v20H0V0z"></path><path d="M10 6c.82 0 1.5-.68 1.5-1.5S10.82 3 10 3s-1.5.67-1.5 1.5S9.18 6 10 6zm0 5.5c.82 0 1.5-.68 1.5-1.5s-.68-1.5-1.5-1.5-1.5.68-1.5 1.5.68 1.5 1.5 1.5zm0 5.5c.82 0 1.5-.67 1.5-1.5 0-.82-.68-1.5-1.5-1.5s-1.5.68-1.5 1.5c0 .83.68 1.5 1.5 1.5z"></path></svg>');let i,o;(e==null?void 0:e.type)===et.IMAGE&&(i=Mr(e==null?void 0:e.url,"selected-image"),o=ks()),(e==null?void 0:e.type)===et.VIDEO&&(i=Os(e==null?void 0:e.url,"uploaded-video"),o=Ts()),(e==null?void 0:e.type)===et.AUDIO&&(i=Ss(e==null?void 0:e.url,"uploaded-audio"),o=As());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"),h=le("","selected-image-type");h.append(o),r.append(h,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"),d=Pe("","action-option preview"),f=le("Preview",""),y=Ns();d.append(y,f);const F=Pe("","action-option move"),I=le("Move",""),C=Fs();F.append(C,I);const R=Pe("","action-option rename"),O=le("Rename",""),v=Br();R.append(v,O);const L=Pe("","action-option delete"),b=le("Delete",""),B=Sr();L.append(B,b);const m=e.name.split(".")[0],g=e.name.split(".")[1],k=rn[e.type],T=K("edit-form-wrapper"),N=K("move-form-wrapper"),U=K("preview-details-container"),A=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=Mr(e.url,"preview-option-image");_.append(q);const $=le("File name","preview-title"),S=K("preview-option-name");S.innerHTML=e.name,w.append($,S);const X=le("Folder name","preview-title"),ce=le(e.folderName,"preview-option-name");p.append(X,ce);const te=le("File Extension","preview-title"),Y=le(g,"preview-option-name extension");M.append(te,Y);const oe=le("File type","preview-title"),ge=le(k,"preview-option-name");x.append(oe,ge);const Fe=le("Dimension","preview-title"),vt=le(`${(pt=e==null?void 0:e.metadata)==null?void 0:pt.width} * ${(Qt=e==null?void 0:e.metadata)==null?void 0:Qt.height}`,"preview-option-name");V.append(Fe,vt);const ze=le("URL","preview-title"),pe=le(e.url,"preview-option-name url");Z.append(ze,pe);const Le=le("Parent folder","preview-title"),de=le(e.nestedFolderName,"preview-option-name");P.append(Le,de),A.append(p,w,M,x,((Bn=e==null?void 0:e.metadata)==null?void 0:Bn.width)>0&&((Yt=e==null?void 0:e.metadata)==null?void 0:Yt.height)>0?V:"",Z,e.nestedFolderName?P:""),U.append(_,A);const re=K("form-control"),Ce=document.createElement("input");re.appendChild(Ce),Ce.classList.add("input-field"),Ce.value=e.name;const Ue=K("form-control"),Ee=le("Current Folder:","input-label"),xe=K("folder-field current");xe.textContent=e.folderName,xe.prepend(nn()),Ue.append(Ee,xe);const we=K("form-control"),ee=K();ee.style.width="100%",ee.style.display="flex",ee.style.alignItems="center",ee.style.justifyContent="space-between";const $e=le("Suggested Folder List:","input-label"),Re=le();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(Zn("14px","14px","#333")),ee.append($e,Re);const ut=K();ut.style.width="100%",ut.style.maxHeight="250px",ut.style.overflowY="auto";const Ie=document.createElement("ul");Ie.className="folders",ut.append(Ie),we.append(ee,ut),E(this,lt).forEach(ue=>{const Xe=this._renderEditFolderListContainer(ue);Ie.appendChild(Xe)});const ft=K("form-control"),_e=le("Destination Folder:","input-label"),je=K("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,je.append(nn(),De);let Me="";ft.append(_e,je),Ce.onchange=ue=>{Me=ue.target.value},Me=Me!==""?Me:e.name,T.append(re),N.append(Ue,we,ft),u.append(d,F,R,L),d.onclick=ue=>{ue.stopPropagation(),Ye.hide(),Ae.show({content:U,header:m,dialogContentStyle:{minWidth:"60rem",padding:"10px"},showCloseBtn:!0})},F.onclick=ue=>{ue.stopPropagation(),Ye.hide(),Ae.show({content:N,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(),Ye.hide(),Ae.show({content:T,header:"Rename",confirmButtonText:"Update",dialogContentStyle:{padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{Ae.hide()},onConfirm:()=>{this._updateFile(Me,e)}})},L.onclick=ue=>{ue.stopPropagation(),Ye.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(),Ye.hide(),Ye.show({content:u,mainContainer:r,divId:e.key}),H(this,Mt,e.key)}),i.addEventListener("click",()=>{const ue=E(this,fe).findIndex(mt=>(mt==null?void 0:mt.key)===(e==null?void 0:e.key));if(t.classList.contains("checked"))t.classList.remove("checked"),ue!==-1&&(E(this,fe).splice(ue,1),E(this,Ft)===1&&a.remove());else{if(E(this,_n))E(this,fe).push(e);else{const mt=document.querySelector(".selected-image-wrapper .checked");mt==null||mt.classList.remove("checked"),H(this,fe,[e])}t.classList.add("checked")}this._updateContent()}),document.addEventListener("click",ue=>{const Xe=document.querySelector(`#${E(this,Mt)}`);Xe&&(ue.composedPath().includes(Xe)||Ye.hide())}),E(this,fe).findIndex(ue=>(ue==null?void 0:ue.key)===(e==null?void 0:e.key))!==-1?(t.classList.add("checked"),E(this,Et)?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,fe))==null?void 0:e.length)>0&&E(this,fe).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 v=document.createElement("button");v.classList.add("expand-icon"),v.appendChild(vn()),r.prepend(v);const L=document.createElement("ul");L.className="folders nested",t.appendChild(L),v.addEventListener("click",b=>{b.stopPropagation(),t.classList.toggle("active"),L.classList.toggle("visible")}),Object.values(e.children).forEach((b,B)=>{const m=this._renderFolderListContainer(b);L.appendChild(m)})}const o=Pe("","folder-option-btn","moveToInputField.disabled",!1,'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-ellipsis"><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/></svg>'),a=K("action-wrapper"),c=Pe("","action-option edit"),h=le("Edit",""),l=Br();c.append(l,h);const u=K("edit-form-wrapper"),d=K("name-field-wrapper"),f=le("Name","input-label"),y=document.createElement("input");y.classList.add("input-field"),y.value=e.name,y.onchange=v=>{v.target.value},d.append(f,y),u.append(d);const F={key:e.key,name:e.name,nestedFolderName:e.nestedFolderName,createdBy:e.createdBy,forUser:!0};this._createUpdateFolderDialog(c,"update",F);const I=Pe("","action-option delete"),C=le("Delete",""),R=Sr();return I.append(R,C),a.append(c,I),I.onclick=v=>{v.stopPropagation(),Ye.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",v=>{v.stopPropagation(),Ye.hide(),Ye.show({content:a,mainContainer:r,divId:e.key}),H(this,Mt,e.key)}),r.appendChild(o),t.addEventListener("click",v=>{var L;v.stopPropagation(),H(this,He,e),H(this,kt,e==null?void 0:e.name),H(this,fe,[]),H(this,Ne,[]),H(this,Ke,""),H(this,It,!1),(L=document.querySelector(".folder.selected"))==null||L.classList.remove("selected"),t.classList.add("selected"),this._fetchFilesFromFolder(e.name)}),((O=E(this,He))==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(vn()),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,He))==null?void 0:o.key)===(e==null?void 0:e.key)&&t.classList.add("selected"),t}_updateFolderListContainer(){if(E(this,Nt))if(E(this,Ct).innerHTML="",E(this,St)){const e=this._renderFolderListLoadingUI();E(this,Ct).appendChild(e)}else{const e=document.createElement("ul");e.className="folders",E(this,Ct).appendChild(e),E(this,lt).forEach(t=>{const r=this._renderFolderListContainer(t);e.appendChild(r)}),E(this,Nt).appendChild(E(this,Ct))}}_renderToastContainer(e,t,r){this._removeToastContainer(),H(this,ct,document.createElement("div")),E(this,ct).className=`message-container ${t}`;const n=sn(e,"message"),i=t==="success"?_r():Zn(),o=Pe("");o.style.cursor="pointer",o.style.border="0",o.style.outline="none",o.style.background="transparent",o.appendChild(Kn(t==="error"?"#ee3f3f":"#4caf50")),o.setAttribute("fill",t==="error"?"#ee3f3f":"#4caf50"),o.onclick=()=>this._removeToastContainer(),E(this,ct).append(i,n,o),r.appendChild(E(this,ct)),setTimeout(()=>{this._removeToastContainer()},5e3)}_removeToastContainer(){E(this,ct)&&(E(this,ct).remove(),H(this,ct,null))}_updateSelectedImageListContainerUI(){var t,r;if(!E(this,ke))return;E(this,ke).innerHTML="",E(this,rt)&&this._renderLoadingUI(),E(this,qe)&&this._renderFetchingSkeletonUI();const e=document.getElementById("search-input-wrapper");E(this,Ft)===0?(e&&(e.style.visibility="visible"),((t=E(this,Ne))==null?void 0:t.length)===0&&!E(this,qe)?(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,fe))==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,fe))==null?void 0:t.length})`),E(this,it).textContent=`Save (${(r=E(this,fe))==null?void 0:r.length})`,E(this,it).disabled=((n=E(this,fe))==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,et[Xn((r=t.type)==null?void 0:r.split("/")[0])],(n=E(this,He))==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,be))}catch{this._renderToastContainer("Something went wrong while uploading file. Please try again later.","error",E(this,be))}finally{H(this,rt,!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,He).name),H(this,Ne,[]),H(this,fe,[]),this._renderToastContainer("File Updated Successfully","success",E(this,be))}catch{this._renderToastContainer("Something went wrong while updating the file. Please try again later.","error",E(this,be))}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,be))}catch{this._renderToastContainer("Something went wrong while deleting the file. Please try again later.","error",E(this,be))}finally{Ae.updateUploadBtn(!1),Ae.hide(),this._updateSelectedImageListContainerUI()}}async _createFolder(e,t=2){var r;try{const n=await Cs(e,(r=E(this,He))==null?void 0:r.name,"",!1,E(this,Se));H(this,fe,[]),H(this,Ne,[]);const i=_s(E(this,lt),n==null?void 0:n.response);H(this,lt,i),H(this,kt,e),H(this,He,{...n==null?void 0:n.response,children:{}}),this._fetchFilesFromFolder(e),this._renderToastContainer(`Folder ${e} created successfully`,"success",E(this,be))}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,be)),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,fe):E(this,jt)}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,et[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,rt)}async _fetchFilesFromFolder(e){var t,r,n;H(this,qe,!0),this._updateSelectedImageListContainerUI();try{const i=await as(e,E(this,Ke),20,E(this,Se)),o=(t=i.response)==null?void 0:t.files;E(this,Ne).push(...o),H(this,Ke,(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,be)),new Error("Something went wrong. Error while fetching files from folder"+e)}finally{H(this,qe,!1),this._updateSelectedImageListContainerUI()}}async _fetchAllFolders(){var e,t;H(this,qe,!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,kt,(e=i[0])==null?void 0:e.name),this._fetchFilesFromFolder((t=i[0])==null?void 0:t.name),H(this,He,i[0]),H(this,lt,i)}catch{H(this,qe,!1),this._renderToastContainer("Folder not found. Please create a folder or try again later","error",E(this,be))}finally{H(this,St,!1),this._updateFolderListContainer()}}async _search(e){var t,r;H(this,qe,!0),this._updateSelectedImageListContainerUI(),this._removeToastContainer();try{const n=await ls(e,E(this,Ke),10,E(this,Se)),i=(t=n.response)==null?void 0:t.items;E(this,Ne).push(...i),H(this,Ke,(r=n.response)==null?void 0:r.nextPageCursor)}catch{this._renderToastContainer("Error while searching files","error",E(this,be))}finally{H(this,qe,!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,be)),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,lt,E(this,lt).filter(t=>t.key!==e)),this._renderToastContainer("Folder Deleted Successfully","success",E(this,be))}catch{throw this._renderToastContainer("Something went wrong while deleting the folder. Please try again later.","error",E(this,be)),new Error("Error deleting the folder ")}finally{Ae.updateUploadBtn(!1),Ae.hide(),this._updateFolderListContainer()}}_createUpdateFolderDialog(e,t,r){e.addEventListener("click",n=>{var R,O,v,L;n.stopPropagation(),Ye.hide();let i;const o=K("edit-form-wrapper"),a=K("form-control"),c=Q("div","","display:flex;align-items:center;gap:5px;"),h=Gs("20px","20px"),l=vn("20px","20px"),u=vn("20px","20px"),d=(R=E(this,He))!=null&&R.nestedFolderName?(O=E(this,He))==null?void 0:O.nestedFolderName:"",f=(v=E(this,He))!=null&&v.name?(L=E(this,He))==null?void 0:L.name:"";d?c.append(h,l,d,u,f):c.append(h,l,f);const y=le("Folder Name","input-label"),F=K();F.style.position="relative";const I=document.createElement("input");I.style.paddingLeft="40px";const C=Q("span","","position:absolute;top:50%;left:5%;transform:translate(-40%,-40%)");C.appendChild(nn()),I.classList.add("input-field"),F.append(I,C),t==="update"&&(I.value=r.name),I.onchange=b=>{i=b.target.value},a.append(c,y,F),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 yt=new WeakMap,be=new WeakMap,ke=new WeakMap,bt=new WeakMap,fe=new WeakMap,Ne=new WeakMap,rt=new WeakMap,qe=new WeakMap,St=new WeakMap,kt=new WeakMap,lt=new WeakMap,He=new WeakMap,it=new WeakMap,Rt=new WeakMap,tr=new WeakMap,Ft=new WeakMap,Nt=new WeakMap,Ct=new WeakMap,Dt=new WeakMap,ct=new WeakMap,Ke=new WeakMap,It=new WeakMap,Tt=new WeakMap,Et=new WeakMap,Wt=new WeakMap,on=new WeakMap,Se=new WeakMap,Mt=new WeakMap,an=new WeakMap,_n=new WeakMap,ln=new WeakMap,dt=new WeakMap,jt=new WeakMap,Lt=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,ht=new WeakMap,Jt=new WeakMap,hn=new WeakMap,Js});
|