image-salon-sdk 1.0.72 → 1.0.74
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.
|
@@ -4,7 +4,7 @@ import { RpcOptions } from '@protobuf-ts/runtime-rpc/build/types/rpc-options';
|
|
|
4
4
|
|
|
5
5
|
export declare const createFileReq: (name: string, nestedFolderName: string, url: string, type: FileType, folderName: string, options: RpcOptions) => Promise<any>;
|
|
6
6
|
export declare const createFileReqForUser: (url: string, type: FileType, options: RpcOptions) => Promise<any>;
|
|
7
|
-
export declare const createFileReqForUserV2: (url: string, type: FileType, accessToken: string
|
|
7
|
+
export declare const createFileReqForUserV2: (url: string, type: FileType, accessToken: string) => Promise<any>;
|
|
8
8
|
export declare const getFilesByFolder: (folderName: string, cursor: string, limit: number, options: RpcOptions) => Promise<import('@protobuf-ts/runtime-rpc').FinishedUnaryCall<GetFilesByFolderRequest, import('../grpc/generated/exposed-file-service').GetFilesByFolderResponse>>;
|
|
9
9
|
export declare const searchFiles: (query: string, cursor: string, limit: number, options: RpcOptions) => Promise<import('@protobuf-ts/runtime-rpc').FinishedUnaryCall<SearchRequest, import('../grpc/generated/exposed-file-service').SearchResult>>;
|
|
10
10
|
export declare const updateFileReq: (key: string, name: string, nestedFolderName: string, url: string, thumborUrl: string, proxyUrl: string, type: FileType, folderName: string, options: RpcOptions) => Promise<any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { RpcOptions } from '@protobuf-ts/runtime-rpc/build/types/rpc-options';
|
|
2
2
|
|
|
3
3
|
export declare const imageUploadReq: (mimeType: string, options: RpcOptions, isAdmin?: boolean) => Promise<any>;
|
|
4
|
-
export declare const imageUploadReqUser: (mimeType: string, accessToken: string
|
|
4
|
+
export declare const imageUploadReqUser: (mimeType: string, accessToken: string) => Promise<any>;
|
package/dist/image-salon-sdk.js
CHANGED
|
@@ -3325,7 +3325,7 @@ const ns = new ts(), _n = new Kn("com.hamropatro.grpc.common.FileService", [
|
|
|
3325
3325
|
{ name: "createUserFile", options: {}, I: zn, O: et },
|
|
3326
3326
|
{ name: "search", options: {}, I: Or, O: Zi }
|
|
3327
3327
|
]);
|
|
3328
|
-
class
|
|
3328
|
+
class Rt {
|
|
3329
3329
|
constructor(e) {
|
|
3330
3330
|
he(this, "typeName", _n.typeName);
|
|
3331
3331
|
he(this, "methods", _n.methods);
|
|
@@ -3380,7 +3380,7 @@ class Dt {
|
|
|
3380
3380
|
const rs = async (s, e, t, n, r, i) => {
|
|
3381
3381
|
var o;
|
|
3382
3382
|
try {
|
|
3383
|
-
const a = (o = window.ImageSalonSDK) == null ? void 0 : o.grpcConfig, c = new
|
|
3383
|
+
const a = (o = window.ImageSalonSDK) == null ? void 0 : o.grpcConfig, c = new Rt(a), d = Sr.create();
|
|
3384
3384
|
return d.name = s, d.nestedFolderName = e, d.url = t, d.type = n, d.folderName = r, await c.createFile(
|
|
3385
3385
|
d,
|
|
3386
3386
|
i
|
|
@@ -3391,7 +3391,7 @@ const rs = async (s, e, t, n, r, i) => {
|
|
|
3391
3391
|
}, is = async (s, e, t) => {
|
|
3392
3392
|
var n;
|
|
3393
3393
|
try {
|
|
3394
|
-
const r = (n = window.ImageSalonSDK) == null ? void 0 : n.grpcConfig, i = new
|
|
3394
|
+
const r = (n = window.ImageSalonSDK) == null ? void 0 : n.grpcConfig, i = new Rt(r), o = zn.create();
|
|
3395
3395
|
return o.url = s, o.type = e, await i.createUserFile(
|
|
3396
3396
|
o,
|
|
3397
3397
|
t
|
|
@@ -3399,16 +3399,16 @@ const rs = async (s, e, t, n, r, i) => {
|
|
|
3399
3399
|
} catch (r) {
|
|
3400
3400
|
throw r;
|
|
3401
3401
|
}
|
|
3402
|
-
}, ss = async (s, e, t
|
|
3403
|
-
var r;
|
|
3402
|
+
}, ss = async (s, e, t) => {
|
|
3403
|
+
var n, r;
|
|
3404
3404
|
try {
|
|
3405
|
-
const i = (
|
|
3406
|
-
return
|
|
3407
|
-
|
|
3405
|
+
const i = (n = window.ImageSalonSDK) == null ? void 0 : n.grpcConfig, o = (r = window.ImageSalonSDK) == null ? void 0 : r.mode, a = new Rt(i), c = zn.create();
|
|
3406
|
+
return c.url = s, c.type = e, await a.createUserFile(
|
|
3407
|
+
c,
|
|
3408
3408
|
{
|
|
3409
3409
|
meta: {
|
|
3410
3410
|
Authorization: t,
|
|
3411
|
-
"app-id":
|
|
3411
|
+
"app-id": o === "production" ? "hamropatro" : "hamropatro-android"
|
|
3412
3412
|
}
|
|
3413
3413
|
}
|
|
3414
3414
|
);
|
|
@@ -3418,7 +3418,7 @@ const rs = async (s, e, t, n, r, i) => {
|
|
|
3418
3418
|
}, os = async (s, e, t, n) => {
|
|
3419
3419
|
var r;
|
|
3420
3420
|
try {
|
|
3421
|
-
const i = (r = window.ImageSalonSDK) == null ? void 0 : r.grpcConfig, o = new
|
|
3421
|
+
const i = (r = window.ImageSalonSDK) == null ? void 0 : r.grpcConfig, o = new Rt(i), a = Dr.create();
|
|
3422
3422
|
return a.folderName = s, a.cursor = e, a.limit = t, await o.getFilesByFolder(
|
|
3423
3423
|
a,
|
|
3424
3424
|
n
|
|
@@ -3429,7 +3429,7 @@ const rs = async (s, e, t, n, r, i) => {
|
|
|
3429
3429
|
}, as = async (s, e, t = 20, n) => {
|
|
3430
3430
|
var r;
|
|
3431
3431
|
try {
|
|
3432
|
-
const i = (r = window.ImageSalonSDK) == null ? void 0 : r.grpcConfig, o = new
|
|
3432
|
+
const i = (r = window.ImageSalonSDK) == null ? void 0 : r.grpcConfig, o = new Rt(i), a = Or.create();
|
|
3433
3433
|
return a.searchValue = s, a.cursor = e, a.limit = t, await o.search(
|
|
3434
3434
|
a,
|
|
3435
3435
|
n
|
|
@@ -3440,7 +3440,7 @@ const rs = async (s, e, t, n, r, i) => {
|
|
|
3440
3440
|
}, ls = async (s, e, t, n, r, i, o, a, c) => {
|
|
3441
3441
|
var d;
|
|
3442
3442
|
try {
|
|
3443
|
-
const l = (d = window.ImageSalonSDK) == null ? void 0 : d.grpcConfig, u = new
|
|
3443
|
+
const l = (d = window.ImageSalonSDK) == null ? void 0 : d.grpcConfig, u = new Rt(l), h = et.create();
|
|
3444
3444
|
return h.key = s, h.name = e, h.nestedFolderName = t, h.url = n, h.thumborUrl = r, h.proxyUrl = i, h.type = o, h.folderName = a, await u.updateFile(
|
|
3445
3445
|
h,
|
|
3446
3446
|
c
|
|
@@ -3451,7 +3451,7 @@ const rs = async (s, e, t, n, r, i) => {
|
|
|
3451
3451
|
}, cs = async (s, e) => {
|
|
3452
3452
|
var t;
|
|
3453
3453
|
try {
|
|
3454
|
-
const n = (t = window.ImageSalonSDK) == null ? void 0 : t.grpcConfig, r = new
|
|
3454
|
+
const n = (t = window.ImageSalonSDK) == null ? void 0 : t.grpcConfig, r = new Rt(n), i = Rr.create();
|
|
3455
3455
|
return i.key = s, await r.deleteFile(
|
|
3456
3456
|
i,
|
|
3457
3457
|
e
|
|
@@ -4078,29 +4078,29 @@ function Q(s, e, t, n, r) {
|
|
|
4078
4078
|
let i = document.createElement(s);
|
|
4079
4079
|
return e && (i.className += e), t && (i.style.cssText = t), n && (i.textContent = n), r && r.appendChild(i), i;
|
|
4080
4080
|
}
|
|
4081
|
-
var ft, ze,
|
|
4081
|
+
var ft, ze, $t;
|
|
4082
4082
|
class Ts {
|
|
4083
4083
|
constructor() {
|
|
4084
4084
|
z(this, ft);
|
|
4085
4085
|
z(this, ze);
|
|
4086
4086
|
// Store the circle element as a private property
|
|
4087
|
-
z(this,
|
|
4087
|
+
z(this, $t, "#fff");
|
|
4088
4088
|
H(this, ft, document.createElementNS(
|
|
4089
4089
|
"http://www.w3.org/2000/svg",
|
|
4090
4090
|
"svg"
|
|
4091
4091
|
)), E(this, ft).setAttribute("viewBox", "25 25 50 50"), E(this, ft).classList.add("loader-svg"), H(this, ze, document.createElementNS(
|
|
4092
4092
|
"http://www.w3.org/2000/svg",
|
|
4093
4093
|
"circle"
|
|
4094
|
-
)), E(this, ze).setAttribute("r", "20"), E(this, ze).setAttribute("cy", "50"), E(this, ze).setAttribute("cx", "50"), E(this, ze).setAttribute("stroke", E(this,
|
|
4094
|
+
)), E(this, ze).setAttribute("r", "20"), E(this, ze).setAttribute("cy", "50"), E(this, ze).setAttribute("cx", "50"), E(this, ze).setAttribute("stroke", E(this, $t)), E(this, ze).classList.add("loader-circle"), E(this, ft).appendChild(E(this, ze));
|
|
4095
4095
|
}
|
|
4096
4096
|
show(e, t) {
|
|
4097
|
-
t && (H(this,
|
|
4097
|
+
t && (H(this, $t, t), E(this, ze).setAttribute("stroke", E(this, $t))), e.appendChild(E(this, ft));
|
|
4098
4098
|
}
|
|
4099
4099
|
hide() {
|
|
4100
4100
|
E(this, ft).remove();
|
|
4101
4101
|
}
|
|
4102
4102
|
}
|
|
4103
|
-
ft = new WeakMap(), ze = new WeakMap(),
|
|
4103
|
+
ft = new WeakMap(), ze = new WeakMap(), $t = new WeakMap();
|
|
4104
4104
|
const wr = new Ts(), fn = document.body;
|
|
4105
4105
|
class $r {
|
|
4106
4106
|
constructor() {
|
|
@@ -5331,23 +5331,23 @@ const Ke = function() {
|
|
|
5331
5331
|
for (var ee = 0; ee < le.length; ee++) {
|
|
5332
5332
|
const Le = new Uint8Array(le[ee]), De = new Uint32Array(Le.buffer);
|
|
5333
5333
|
var Re;
|
|
5334
|
-
let xe = 0, _e = 0, Ze = ne, rt = pe,
|
|
5334
|
+
let xe = 0, _e = 0, Ze = ne, rt = pe, Dt = Ne ? 1 : 0;
|
|
5335
5335
|
if (ee != 0) {
|
|
5336
5336
|
const cn = Te || Ne || ee == 1 || fe[ee - 2].dispose != 0 ? 1 : 2;
|
|
5337
|
-
let
|
|
5337
|
+
let Mt = 0, ce = 1e9;
|
|
5338
5338
|
for (let We = 0; We < cn; We++) {
|
|
5339
5339
|
var Ue = new Uint8Array(le[ee - 1 - We]);
|
|
5340
5340
|
const it = new Uint32Array(le[ee - 1 - We]);
|
|
5341
|
-
let Ct = ne, Et = pe,
|
|
5342
|
-
for (let
|
|
5343
|
-
De[Ae =
|
|
5344
|
-
|
|
5345
|
-
const Jn = (
|
|
5346
|
-
Jn < ce && (ce = Jn,
|
|
5341
|
+
let Ct = ne, Et = pe, Vt = -1, Qt = -1;
|
|
5342
|
+
for (let xt = 0; xt < pe; xt++) for (let _t = 0; _t < ne; _t++)
|
|
5343
|
+
De[Ae = xt * ne + _t] != it[Ae] && (_t < Ct && (Ct = _t), _t > Vt && (Vt = _t), xt < Et && (Et = xt), xt > Qt && (Qt = xt));
|
|
5344
|
+
Vt == -1 && (Ct = Et = Vt = Qt = 0), me && ((1 & Ct) == 1 && Ct--, (1 & Et) == 1 && Et--);
|
|
5345
|
+
const Jn = (Vt - Ct + 1) * (Qt - Et + 1);
|
|
5346
|
+
Jn < ce && (ce = Jn, Mt = We, xe = Ct, _e = Et, Ze = Vt - Ct + 1, rt = Qt - Et + 1);
|
|
5347
5347
|
}
|
|
5348
|
-
Ue = new Uint8Array(le[ee - 1 -
|
|
5348
|
+
Ue = new Uint8Array(le[ee - 1 - Mt]), Mt == 1 && (fe[ee - 1].dispose = 2), Re = new Uint8Array(Ze * rt * 4), s(Ue, ne, pe, Re, Ze, rt, -xe, -_e, 0), Dt = s(Le, ne, pe, Re, Ze, rt, -xe, -_e, 3) ? 1 : 0, Dt == 1 ? h(Le, ne, pe, Re, { x: xe, y: _e, width: Ze, height: rt }) : s(Le, ne, pe, Re, Ze, rt, -xe, -_e, 0);
|
|
5349
5349
|
} else Re = Le.slice(0);
|
|
5350
|
-
fe.push({ rect: { x: xe, y: _e, width: Ze, height: rt }, img: Re, blend:
|
|
5350
|
+
fe.push({ rect: { x: xe, y: _e, width: Ze, height: rt }, img: Re, blend: Dt, dispose: 0 });
|
|
5351
5351
|
}
|
|
5352
5352
|
if (Ne) for (ee = 0; ee < fe.length; ee++) {
|
|
5353
5353
|
if ((nt = fe[ee]).blend == 1) continue;
|
|
@@ -5630,14 +5630,14 @@ function Kr(s) {
|
|
|
5630
5630
|
n.onload = () => e(n), n.onerror = (r) => t(r), n.src = s;
|
|
5631
5631
|
});
|
|
5632
5632
|
}
|
|
5633
|
-
function
|
|
5634
|
-
if (
|
|
5633
|
+
function Bt() {
|
|
5634
|
+
if (Bt.cachedResult !== void 0) return Bt.cachedResult;
|
|
5635
5635
|
let s = Me.ETC;
|
|
5636
5636
|
const { userAgent: e } = navigator;
|
|
5637
|
-
return /Chrom(e|ium)/i.test(e) ? s = Me.CHROME : /iP(ad|od|hone)/i.test(e) && /WebKit/i.test(e) ? s = Me.IOS : /Safari/i.test(e) ? s = Me.DESKTOP_SAFARI : /Firefox/i.test(e) ? s = Me.FIREFOX : (/MSIE/i.test(e) || document.documentMode) && (s = Me.IE),
|
|
5637
|
+
return /Chrom(e|ium)/i.test(e) ? s = Me.CHROME : /iP(ad|od|hone)/i.test(e) && /WebKit/i.test(e) ? s = Me.IOS : /Safari/i.test(e) ? s = Me.DESKTOP_SAFARI : /Firefox/i.test(e) ? s = Me.FIREFOX : (/MSIE/i.test(e) || document.documentMode) && (s = Me.IE), Bt.cachedResult = s, Bt.cachedResult;
|
|
5638
5638
|
}
|
|
5639
5639
|
function zr(s, e) {
|
|
5640
|
-
const t =
|
|
5640
|
+
const t = Bt(), n = Vs[t];
|
|
5641
5641
|
let r = s, i = e, o = r * i;
|
|
5642
5642
|
const a = r > i ? i / r : r / i;
|
|
5643
5643
|
for (; o > n * n; ) {
|
|
@@ -5709,7 +5709,7 @@ function vn(s, e = {}) {
|
|
|
5709
5709
|
}
|
|
5710
5710
|
};
|
|
5711
5711
|
try {
|
|
5712
|
-
if (gn() || [Me.DESKTOP_SAFARI, Me.MOBILE_SAFARI].includes(
|
|
5712
|
+
if (gn() || [Me.DESKTOP_SAFARI, Me.MOBILE_SAFARI].includes(Bt())) throw new Error("Skip createImageBitmap on IOS and Safari");
|
|
5713
5713
|
return createImageBitmap(s).then(function(c) {
|
|
5714
5714
|
try {
|
|
5715
5715
|
return r = c, o();
|
|
@@ -5771,10 +5771,10 @@ function An(s, e, t, n, r = 1) {
|
|
|
5771
5771
|
function dt(s) {
|
|
5772
5772
|
s.width = 0, s.height = 0;
|
|
5773
5773
|
}
|
|
5774
|
-
function
|
|
5774
|
+
function Ht() {
|
|
5775
5775
|
return new Promise(function(s, e) {
|
|
5776
5776
|
let t, n, r, i;
|
|
5777
|
-
return
|
|
5777
|
+
return Ht.cachedResult !== void 0 ? s(Ht.cachedResult) : Gn("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==", "test.jpg", Date.now()).then(function(o) {
|
|
5778
5778
|
try {
|
|
5779
5779
|
return t = o, vn(t).then(function(a) {
|
|
5780
5780
|
try {
|
|
@@ -5782,7 +5782,7 @@ function $t() {
|
|
|
5782
5782
|
try {
|
|
5783
5783
|
return r = c, dt(n), vn(r).then(function(d) {
|
|
5784
5784
|
try {
|
|
5785
|
-
return i = d[0],
|
|
5785
|
+
return i = d[0], Ht.cachedResult = i.width === 1 && i.height === 2, s(Ht.cachedResult);
|
|
5786
5786
|
} catch (l) {
|
|
5787
5787
|
return e(l);
|
|
5788
5788
|
}
|
|
@@ -5887,7 +5887,7 @@ function br(s, e, t = 0) {
|
|
|
5887
5887
|
return _.call(this);
|
|
5888
5888
|
}).then((function(N) {
|
|
5889
5889
|
try {
|
|
5890
|
-
return l = N, g(),
|
|
5890
|
+
return l = N, g(), Ht().then((function(L) {
|
|
5891
5891
|
try {
|
|
5892
5892
|
return u = L ? d : Qr(d, l), g(), h = e.initialQuality || 1, f = e.fileType || s.type, An(u, f, s.name, s.lastModified, h).then((function(v) {
|
|
5893
5893
|
try {
|
|
@@ -6037,7 +6037,7 @@ function Be(s, e) {
|
|
|
6037
6037
|
}
|
|
6038
6038
|
});
|
|
6039
6039
|
}
|
|
6040
|
-
Be.getDataUrlFromFile = Zr, Be.getFilefromDataUrl = Gn, Be.loadImage = Kr, Be.drawImageInCanvas = Xr, Be.drawFileInCanvas = vn, Be.canvasToFile = An, Be.getExifOrientation = Gr, Be.handleMaxWidthOrHeight = Jr, Be.followExifOrientation = Qr, Be.cleanupCanvasMemory = dt, Be.isAutoOrientationInBrowser =
|
|
6040
|
+
Be.getDataUrlFromFile = Zr, Be.getFilefromDataUrl = Gn, Be.loadImage = Kr, Be.drawImageInCanvas = Xr, Be.drawFileInCanvas = vn, Be.canvasToFile = An, Be.getExifOrientation = Gr, Be.handleMaxWidthOrHeight = Jr, Be.followExifOrientation = Qr, Be.cleanupCanvasMemory = dt, Be.isAutoOrientationInBrowser = Ht, Be.approximateBelowMaximumCanvasSizeOfBrowser = zr, Be.copyExifWithoutOrientation = Pr, Be.getBrowserName = Bt, Be.version = "2.0.2";
|
|
6041
6041
|
class Ws extends Ie {
|
|
6042
6042
|
constructor() {
|
|
6043
6043
|
super("com.hamropatro.grpc.common.ImageUploadRequest", [
|
|
@@ -6180,18 +6180,19 @@ const qs = async (s, e, t = !0) => {
|
|
|
6180
6180
|
} catch (a) {
|
|
6181
6181
|
throw a;
|
|
6182
6182
|
}
|
|
6183
|
-
}, Zs = async (s, e
|
|
6184
|
-
var a;
|
|
6185
|
-
const
|
|
6183
|
+
}, Zs = async (s, e) => {
|
|
6184
|
+
var o, a;
|
|
6185
|
+
const t = (o = window.ImageSalonSDK) == null ? void 0 : o.grpcConfig, n = (a = window.ImageSalonSDK) == null ? void 0 : a.mode, r = new Yr(t), i = kn.create();
|
|
6186
6186
|
try {
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6187
|
+
return i.mimeType = s, await r.uploadUserImage(
|
|
6188
|
+
i,
|
|
6189
|
+
{
|
|
6190
|
+
meta: {
|
|
6191
|
+
Authorization: e,
|
|
6192
|
+
"app-id": n === "production" ? "hamropatro" : "hamropatro-android"
|
|
6193
|
+
}
|
|
6193
6194
|
}
|
|
6194
|
-
|
|
6195
|
+
);
|
|
6195
6196
|
} catch (c) {
|
|
6196
6197
|
throw c;
|
|
6197
6198
|
}
|
|
@@ -6205,7 +6206,6 @@ const qs = async (s, e, t = !0) => {
|
|
|
6205
6206
|
}
|
|
6206
6207
|
}, ei = async (s, e, t) => {
|
|
6207
6208
|
const n = zs(s, t);
|
|
6208
|
-
console.log("buff 31", n);
|
|
6209
6209
|
try {
|
|
6210
6210
|
await fetch(e, {
|
|
6211
6211
|
method: "PUT",
|
|
@@ -6217,31 +6217,22 @@ const qs = async (s, e, t = !0) => {
|
|
|
6217
6217
|
} catch (r) {
|
|
6218
6218
|
throw r;
|
|
6219
6219
|
}
|
|
6220
|
-
}, Ks = async (s, e, t
|
|
6221
|
-
var
|
|
6220
|
+
}, Ks = async (s, e, t) => {
|
|
6221
|
+
var n, r;
|
|
6222
6222
|
try {
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
n,
|
|
6228
|
-
r
|
|
6229
|
-
);
|
|
6230
|
-
console.log("upload response line 60", a);
|
|
6231
|
-
const c = (i = a.response) == null ? void 0 : i.uploadUrl, d = (o = a == null ? void 0 : a.response) == null ? void 0 : o.accessUrl;
|
|
6232
|
-
return await ei(s, c, e), d;
|
|
6233
|
-
} catch (a) {
|
|
6234
|
-
throw a;
|
|
6223
|
+
const i = await Zs(e == null ? void 0 : e.type, t), o = (n = i.response) == null ? void 0 : n.uploadUrl, a = (r = i == null ? void 0 : i.response) == null ? void 0 : r.accessUrl;
|
|
6224
|
+
return await ei(s, o, e), a;
|
|
6225
|
+
} catch (i) {
|
|
6226
|
+
throw i;
|
|
6235
6227
|
}
|
|
6236
6228
|
}, zs = (s, e) => {
|
|
6237
6229
|
const t = e.type.split("/")[0];
|
|
6238
|
-
console.log("file type", t), console.log("base 64 image", s);
|
|
6239
6230
|
let n = "";
|
|
6240
|
-
t === "video" ? n = s == null ? void 0 : s.replace(/^data:video\/\w+;base64,/, "") : t === "image" ? n = s == null ? void 0 : s.replace(/^data:image\/\w+;base64,/, "") : t === "audio" && (n = s == null ? void 0 : s.replace(/^data:audio\/\w+;base64,/, ""))
|
|
6231
|
+
t === "video" ? n = s == null ? void 0 : s.replace(/^data:video\/\w+;base64,/, "") : t === "image" ? n = s == null ? void 0 : s.replace(/^data:image\/\w+;base64,/, "") : t === "audio" && (n = s == null ? void 0 : s.replace(/^data:audio\/\w+;base64,/, ""));
|
|
6241
6232
|
const r = atob(n), i = new Uint8Array(r.length);
|
|
6242
6233
|
for (let o = 0; o < r.length; o++)
|
|
6243
6234
|
i[o] = r.charCodeAt(o);
|
|
6244
|
-
return
|
|
6235
|
+
return i;
|
|
6245
6236
|
};
|
|
6246
6237
|
async function vr(s) {
|
|
6247
6238
|
const e = {
|
|
@@ -6255,7 +6246,7 @@ async function vr(s) {
|
|
|
6255
6246
|
throw t;
|
|
6256
6247
|
}
|
|
6257
6248
|
}
|
|
6258
|
-
var At, be, Ce, pt, ge, ke, Xe, He,
|
|
6249
|
+
var At, be, Ce, pt, ge, ke, Xe, He, Ot, kt, st, Ge, Ft, Pt, qn, Nt, It, mt, St, ot, at, Tt, Lt, gt, Wt, rn, Oe, wt, sn, Fn, on, lt, jt, Ut, qt, Zt, Kt, zt, Xt, an, ln, Gt, ct, Jt;
|
|
6259
6250
|
class Gs {
|
|
6260
6251
|
constructor(e) {
|
|
6261
6252
|
z(this, At);
|
|
@@ -6266,23 +6257,23 @@ class Gs {
|
|
|
6266
6257
|
z(this, ke, []);
|
|
6267
6258
|
z(this, Xe);
|
|
6268
6259
|
z(this, He);
|
|
6269
|
-
z(this,
|
|
6260
|
+
z(this, Ot);
|
|
6270
6261
|
z(this, kt);
|
|
6271
6262
|
z(this, st, []);
|
|
6272
6263
|
z(this, Ge);
|
|
6273
6264
|
z(this, Ft);
|
|
6274
|
-
z(this,
|
|
6265
|
+
z(this, Pt);
|
|
6275
6266
|
z(this, qn);
|
|
6276
6267
|
z(this, Nt);
|
|
6277
6268
|
z(this, It);
|
|
6278
6269
|
z(this, mt);
|
|
6279
|
-
z(this,
|
|
6270
|
+
z(this, St);
|
|
6280
6271
|
z(this, ot);
|
|
6281
6272
|
z(this, at);
|
|
6282
6273
|
z(this, Tt);
|
|
6283
6274
|
z(this, Lt);
|
|
6284
6275
|
z(this, gt);
|
|
6285
|
-
z(this,
|
|
6276
|
+
z(this, Wt);
|
|
6286
6277
|
z(this, rn);
|
|
6287
6278
|
z(this, Oe);
|
|
6288
6279
|
z(this, wt);
|
|
@@ -6290,9 +6281,9 @@ class Gs {
|
|
|
6290
6281
|
z(this, Fn);
|
|
6291
6282
|
z(this, on);
|
|
6292
6283
|
z(this, lt);
|
|
6293
|
-
z(this,
|
|
6284
|
+
z(this, jt);
|
|
6294
6285
|
z(this, Ut);
|
|
6295
|
-
z(this,
|
|
6286
|
+
z(this, qt);
|
|
6296
6287
|
z(this, Zt);
|
|
6297
6288
|
z(this, Kt);
|
|
6298
6289
|
z(this, zt);
|
|
@@ -6302,7 +6293,7 @@ class Gs {
|
|
|
6302
6293
|
z(this, Gt);
|
|
6303
6294
|
z(this, ct);
|
|
6304
6295
|
z(this, Jt);
|
|
6305
|
-
H(this, on, e.isAdmin), H(this, Xe, !1), H(this,
|
|
6296
|
+
H(this, on, e.isAdmin), H(this, Xe, !1), H(this, qt, e == null ? void 0 : e.mode), e.handleUpload && H(this, Pt, e.handleUpload.bind(this)), e != null && e.accessToken && (H(this, rn, e.accessToken), this._grpcOptionInitializer()), this._init(e).then(() => {
|
|
6306
6297
|
H(this, sn, !0), e != null && e.parentContainerId && this._renderView(e), this.updateWindowObject({ initialized: !0 }), this._initializeGrpcConfig(e.mode, e.endPoint);
|
|
6307
6298
|
});
|
|
6308
6299
|
}
|
|
@@ -6319,7 +6310,7 @@ class Gs {
|
|
|
6319
6310
|
}
|
|
6320
6311
|
_renderView(e) {
|
|
6321
6312
|
var t, n, r;
|
|
6322
|
-
return this._isAdminOptions(e) ? (H(this, He, !1), H(this,
|
|
6313
|
+
return this._isAdminOptions(e) ? (H(this, He, !1), H(this, Ot, !1), H(this, Nt, 0), H(this, at, ""), H(this, gt, !1), H(this, qt, e.mode), H(this, Tt, !1), H(this, Ut, ""), H(this, wt, null), this._removeToastContainer(), this._renderAdminView(e)) : (H(this, jt, ""), H(this, Zt, e == null ? void 0 : e.restrictedFileSize), H(this, Kt, e == null ? void 0 : e.localizedFileRestrictedMessage), H(this, Xt, e == null ? void 0 : e.localizedSuccessMessage), H(this, zt, e == null ? void 0 : e.localizedErrorMessage), H(this, ct, e == null ? void 0 : e.imagePreviewWidth), H(this, Jt, e == null ? void 0 : e.imagePreviewHeight), H(this, an, (t = e == null ? void 0 : e.removeImageConfirm) == null ? void 0 : t.bind(this)), H(this, ln, (n = e == null ? void 0 : e.removeImagePreviewCB) == null ? void 0 : n.bind(this)), H(this, Gt, (r = e == null ? void 0 : e.getUploadingState) == null ? void 0 : r.bind(this)), this._removeUserToast(), this._renderUserView(e));
|
|
6323
6314
|
}
|
|
6324
6315
|
_renderAdminView(e) {
|
|
6325
6316
|
if (!E(this, sn)) return;
|
|
@@ -6341,7 +6332,7 @@ class Gs {
|
|
|
6341
6332
|
async _grpcOptionInitializer() {
|
|
6342
6333
|
H(this, Oe, await _s(
|
|
6343
6334
|
E(this, rn),
|
|
6344
|
-
E(this,
|
|
6335
|
+
E(this, qt)
|
|
6345
6336
|
));
|
|
6346
6337
|
}
|
|
6347
6338
|
_selectedImageContainer() {
|
|
@@ -6368,7 +6359,7 @@ class Gs {
|
|
|
6368
6359
|
e.onclick = () => {
|
|
6369
6360
|
pn.hide(), H(this, ke, []), H(this, ge, []);
|
|
6370
6361
|
}, E(this, Ft).onclick = () => {
|
|
6371
|
-
E(this,
|
|
6362
|
+
E(this, Pt).call(this), pn.hide(), H(this, ge, []), H(this, ke, []);
|
|
6372
6363
|
}, d.append(e, E(this, Ft));
|
|
6373
6364
|
const l = K("container-right-main");
|
|
6374
6365
|
l.append(o, a, c, d), E(this, be).append(E(this, It), l), pn.show({
|
|
@@ -6569,7 +6560,7 @@ class Gs {
|
|
|
6569
6560
|
Je[Rn((n = t.type) == null ? void 0 : n.split("/")[0])],
|
|
6570
6561
|
E(this, Oe)
|
|
6571
6562
|
);
|
|
6572
|
-
H(this,
|
|
6563
|
+
H(this, jt, r == null ? void 0 : r.response), E(this, Pt).call(this);
|
|
6573
6564
|
} catch (r) {
|
|
6574
6565
|
throw Error(r);
|
|
6575
6566
|
}
|
|
@@ -6631,22 +6622,22 @@ class Gs {
|
|
|
6631
6622
|
H(this, at, ""), H(this, Tt, !1), H(this, gt, !1), this._fetchFilesFromFolder(E(this, kt));
|
|
6632
6623
|
return;
|
|
6633
6624
|
}
|
|
6634
|
-
H(this, gt, !0), H(this,
|
|
6625
|
+
H(this, gt, !0), H(this, Wt, o.value), this._search(E(this, Wt));
|
|
6635
6626
|
}, 750);
|
|
6636
6627
|
}), E(this, Lt).setAttribute("placeholder", "Search");
|
|
6637
6628
|
const r = Ns();
|
|
6638
6629
|
return r.style.position = "absolute", r.style.top = "50%", r.style.left = "5%", r.style.transform = "translate(-5%, -50%)", n.append(r, E(this, Lt)), t.append(n), t;
|
|
6639
6630
|
}
|
|
6640
6631
|
_createBrowseMoreContainer() {
|
|
6641
|
-
H(this,
|
|
6632
|
+
H(this, St, K("browse-more-btn-container")), this._createAllAndSelectedTab(E(this, St));
|
|
6642
6633
|
const e = this._renderUploadButton(), t = this._renderCreateFolderBtn(), n = document.createElement("div");
|
|
6643
|
-
return n.style.display = "flex", n.style.alignItems = "center", n.style.gap = "10px", n.append(e, t), E(this,
|
|
6634
|
+
return n.style.display = "flex", n.style.alignItems = "center", n.style.gap = "10px", n.append(e, t), E(this, St).appendChild(n), E(this, St);
|
|
6644
6635
|
}
|
|
6645
6636
|
_createBrowseImageMain() {
|
|
6646
6637
|
const e = K("browse-image-main");
|
|
6647
6638
|
return H(this, Ce, K("selected-image-container")), E(this, Ce).addEventListener("scroll", () => {
|
|
6648
6639
|
const t = E(this, Ce).clientHeight, n = E(this, Ce).scrollTop, r = E(this, Ce).scrollHeight;
|
|
6649
|
-
t + n >= r - 5 && E(this, Tt) && (E(this, gt) ? this._search(E(this,
|
|
6640
|
+
t + n >= r - 5 && E(this, Tt) && (E(this, gt) ? this._search(E(this, Wt)) : this._fetchFilesFromFolder(E(this, kt)));
|
|
6650
6641
|
}), e.appendChild(E(this, Ce)), e;
|
|
6651
6642
|
}
|
|
6652
6643
|
_renderFetchingSkeletonUI() {
|
|
@@ -6749,7 +6740,7 @@ class Gs {
|
|
|
6749
6740
|
e.innerHTML = "", E(this, Ce).appendChild(e);
|
|
6750
6741
|
}
|
|
6751
6742
|
_fileCardBody(e) {
|
|
6752
|
-
var rt,
|
|
6743
|
+
var rt, Dt, cn, Mt;
|
|
6753
6744
|
const t = K("selected-image-content"), n = K("selected-image-top-bar"), r = Ve(
|
|
6754
6745
|
"",
|
|
6755
6746
|
"selected-image-btn",
|
|
@@ -6810,7 +6801,7 @@ class Gs {
|
|
|
6810
6801
|
ue
|
|
6811
6802
|
);
|
|
6812
6803
|
const we = ie("Dimension", "preview-title"), ut = ie(
|
|
6813
|
-
`${(rt = e == null ? void 0 : e.metadata) == null ? void 0 : rt.width} * ${(
|
|
6804
|
+
`${(rt = e == null ? void 0 : e.metadata) == null ? void 0 : rt.width} * ${(Dt = e == null ? void 0 : e.metadata) == null ? void 0 : Dt.height}`,
|
|
6814
6805
|
"preview-option-name"
|
|
6815
6806
|
);
|
|
6816
6807
|
V.append(
|
|
@@ -6840,7 +6831,7 @@ class Gs {
|
|
|
6840
6831
|
w,
|
|
6841
6832
|
M,
|
|
6842
6833
|
x,
|
|
6843
|
-
((cn = e == null ? void 0 : e.metadata) == null ? void 0 : cn.width) > 0 && ((
|
|
6834
|
+
((cn = e == null ? void 0 : e.metadata) == null ? void 0 : cn.width) > 0 && ((Mt = e == null ? void 0 : e.metadata) == null ? void 0 : Mt.height) > 0 ? V : "",
|
|
6844
6835
|
Z,
|
|
6845
6836
|
e.nestedFolderName ? P : ""
|
|
6846
6837
|
), L.append(
|
|
@@ -7097,7 +7088,7 @@ class Gs {
|
|
|
7097
7088
|
}
|
|
7098
7089
|
_updateFolderListContainer() {
|
|
7099
7090
|
if (E(this, It))
|
|
7100
|
-
if (E(this, mt).innerHTML = "", E(this,
|
|
7091
|
+
if (E(this, mt).innerHTML = "", E(this, Ot)) {
|
|
7101
7092
|
const e = this._renderFolderListLoadingUI();
|
|
7102
7093
|
E(this, mt).appendChild(e);
|
|
7103
7094
|
} else {
|
|
@@ -7253,7 +7244,7 @@ class Gs {
|
|
|
7253
7244
|
}
|
|
7254
7245
|
}
|
|
7255
7246
|
async _upload() {
|
|
7256
|
-
return E(this, on) ? E(this, ge) : E(this,
|
|
7247
|
+
return E(this, on) ? E(this, ge) : E(this, jt);
|
|
7257
7248
|
}
|
|
7258
7249
|
async _uploadFromSource(e, t) {
|
|
7259
7250
|
this._removeUserToast();
|
|
@@ -7263,21 +7254,18 @@ class Gs {
|
|
|
7263
7254
|
return await new Promise((o, a) => {
|
|
7264
7255
|
const c = new FileReader();
|
|
7265
7256
|
c.readAsDataURL(r), c.onerror = () => {
|
|
7266
|
-
a(c.error)
|
|
7267
|
-
},
|
|
7257
|
+
a(c.error);
|
|
7258
|
+
}, c.onload = async () => {
|
|
7268
7259
|
var d;
|
|
7269
7260
|
try {
|
|
7270
7261
|
const l = await Ks(
|
|
7271
7262
|
c.result,
|
|
7272
7263
|
r,
|
|
7273
|
-
t
|
|
7274
|
-
!1,
|
|
7275
|
-
E(this, xt)
|
|
7264
|
+
t
|
|
7276
7265
|
), u = await ss(
|
|
7277
7266
|
l,
|
|
7278
7267
|
Je[Rn((d = r.type) == null ? void 0 : d.split("/")[0])],
|
|
7279
|
-
t
|
|
7280
|
-
E(this, xt)
|
|
7268
|
+
t
|
|
7281
7269
|
);
|
|
7282
7270
|
o(u);
|
|
7283
7271
|
} catch (l) {
|
|
@@ -7286,7 +7274,7 @@ class Gs {
|
|
|
7286
7274
|
};
|
|
7287
7275
|
});
|
|
7288
7276
|
} catch (r) {
|
|
7289
|
-
throw
|
|
7277
|
+
throw r;
|
|
7290
7278
|
}
|
|
7291
7279
|
}
|
|
7292
7280
|
_uploadingState() {
|
|
@@ -7317,7 +7305,7 @@ class Gs {
|
|
|
7317
7305
|
}
|
|
7318
7306
|
async _fetchAllFolders() {
|
|
7319
7307
|
var e, t;
|
|
7320
|
-
H(this, He, !0), H(this,
|
|
7308
|
+
H(this, He, !0), H(this, Ot, !0), this._updateSelectedImageListContainerUI(), this._updateFolderListContainer(), this._removeToastContainer();
|
|
7321
7309
|
try {
|
|
7322
7310
|
const r = (await ys("", 200, E(this, Oe))).response.folder, i = Us(r);
|
|
7323
7311
|
H(this, kt, (e = i[0]) == null ? void 0 : e.name), this._fetchFilesFromFolder((t = i[0]) == null ? void 0 : t.name), H(this, Ge, i[0]), H(this, st, i);
|
|
@@ -7328,7 +7316,7 @@ class Gs {
|
|
|
7328
7316
|
E(this, be)
|
|
7329
7317
|
);
|
|
7330
7318
|
} finally {
|
|
7331
|
-
H(this,
|
|
7319
|
+
H(this, Ot, !1), this._updateFolderListContainer();
|
|
7332
7320
|
}
|
|
7333
7321
|
}
|
|
7334
7322
|
async _search(e) {
|
|
@@ -7432,7 +7420,7 @@ class Gs {
|
|
|
7432
7420
|
this.updateWindowObject({ grpcConfig: r });
|
|
7433
7421
|
}
|
|
7434
7422
|
}
|
|
7435
|
-
At = new WeakMap(), be = new WeakMap(), Ce = new WeakMap(), pt = new WeakMap(), ge = new WeakMap(), ke = new WeakMap(), Xe = new WeakMap(), He = new WeakMap(),
|
|
7423
|
+
At = new WeakMap(), be = new WeakMap(), Ce = new WeakMap(), pt = new WeakMap(), ge = new WeakMap(), ke = new WeakMap(), Xe = new WeakMap(), He = new WeakMap(), Ot = new WeakMap(), kt = new WeakMap(), st = new WeakMap(), Ge = new WeakMap(), Ft = new WeakMap(), Pt = new WeakMap(), qn = new WeakMap(), Nt = new WeakMap(), It = new WeakMap(), mt = new WeakMap(), St = new WeakMap(), ot = new WeakMap(), at = new WeakMap(), Tt = new WeakMap(), Lt = new WeakMap(), gt = new WeakMap(), Wt = new WeakMap(), rn = new WeakMap(), Oe = new WeakMap(), wt = new WeakMap(), sn = new WeakMap(), Fn = new WeakMap(), on = new WeakMap(), lt = new WeakMap(), jt = new WeakMap(), Ut = new WeakMap(), qt = new WeakMap(), Zt = new WeakMap(), Kt = new WeakMap(), zt = new WeakMap(), Xt = new WeakMap(), an = new WeakMap(), ln = new WeakMap(), Gt = new WeakMap(), ct = new WeakMap(), Jt = new WeakMap();
|
|
7436
7424
|
export {
|
|
7437
7425
|
Gs as default
|
|
7438
7426
|
};
|