@select-org/select-post-builder 1.1.10 → 1.1.17
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/index.d.ts +1 -0
- package/dist/post-builder.cjs.js +2576 -614
- package/dist/post-builder.js +2568 -606
- package/package.json +2 -1
package/dist/post-builder.js
CHANGED
|
@@ -70,7 +70,7 @@ const isEmptyObject = (val) => {
|
|
|
70
70
|
}
|
|
71
71
|
try {
|
|
72
72
|
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
73
|
-
} catch (
|
|
73
|
+
} catch (e2) {
|
|
74
74
|
return false;
|
|
75
75
|
}
|
|
76
76
|
};
|
|
@@ -91,14 +91,14 @@ function forEach(obj, fn2, { allOwnKeys = false } = {}) {
|
|
|
91
91
|
if (obj === null || typeof obj === "undefined") {
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
let
|
|
95
|
-
let
|
|
94
|
+
let i2;
|
|
95
|
+
let l2;
|
|
96
96
|
if (typeof obj !== "object") {
|
|
97
97
|
obj = [obj];
|
|
98
98
|
}
|
|
99
99
|
if (isArray$1(obj)) {
|
|
100
|
-
for (
|
|
101
|
-
fn2.call(null, obj[
|
|
100
|
+
for (i2 = 0, l2 = obj.length; i2 < l2; i2++) {
|
|
101
|
+
fn2.call(null, obj[i2], i2, obj);
|
|
102
102
|
}
|
|
103
103
|
} else {
|
|
104
104
|
if (isBuffer$1(obj)) {
|
|
@@ -107,8 +107,8 @@ function forEach(obj, fn2, { allOwnKeys = false } = {}) {
|
|
|
107
107
|
const keys2 = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
108
108
|
const len = keys2.length;
|
|
109
109
|
let key;
|
|
110
|
-
for (
|
|
111
|
-
key = keys2[
|
|
110
|
+
for (i2 = 0; i2 < len; i2++) {
|
|
111
|
+
key = keys2[i2];
|
|
112
112
|
fn2.call(null, obj[key], key, obj);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -119,10 +119,10 @@ function findKey(obj, key) {
|
|
|
119
119
|
}
|
|
120
120
|
key = key.toLowerCase();
|
|
121
121
|
const keys2 = Object.keys(obj);
|
|
122
|
-
let
|
|
122
|
+
let i2 = keys2.length;
|
|
123
123
|
let _key;
|
|
124
|
-
while (
|
|
125
|
-
_key = keys2[
|
|
124
|
+
while (i2-- > 0) {
|
|
125
|
+
_key = keys2[i2];
|
|
126
126
|
if (key === _key.toLowerCase()) {
|
|
127
127
|
return _key;
|
|
128
128
|
}
|
|
@@ -149,20 +149,20 @@ function merge() {
|
|
|
149
149
|
result[targetKey] = val;
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
|
-
for (let
|
|
153
|
-
arguments[
|
|
152
|
+
for (let i2 = 0, l2 = arguments.length; i2 < l2; i2++) {
|
|
153
|
+
arguments[i2] && forEach(arguments[i2], assignValue2);
|
|
154
154
|
}
|
|
155
155
|
return result;
|
|
156
156
|
}
|
|
157
|
-
const extend = (
|
|
157
|
+
const extend = (a2, b, thisArg, { allOwnKeys } = {}) => {
|
|
158
158
|
forEach(b, (val, key) => {
|
|
159
159
|
if (thisArg && isFunction$3(val)) {
|
|
160
|
-
|
|
160
|
+
a2[key] = bind$1(val, thisArg);
|
|
161
161
|
} else {
|
|
162
|
-
|
|
162
|
+
a2[key] = val;
|
|
163
163
|
}
|
|
164
164
|
}, { allOwnKeys });
|
|
165
|
-
return
|
|
165
|
+
return a2;
|
|
166
166
|
};
|
|
167
167
|
const stripBOM = (content) => {
|
|
168
168
|
if (content.charCodeAt(0) === 65279) {
|
|
@@ -180,16 +180,16 @@ const inherits = (constructor, superConstructor, props, descriptors2) => {
|
|
|
180
180
|
};
|
|
181
181
|
const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
|
|
182
182
|
let props;
|
|
183
|
-
let
|
|
183
|
+
let i2;
|
|
184
184
|
let prop;
|
|
185
185
|
const merged = {};
|
|
186
186
|
destObj = destObj || {};
|
|
187
187
|
if (sourceObj == null) return destObj;
|
|
188
188
|
do {
|
|
189
189
|
props = Object.getOwnPropertyNames(sourceObj);
|
|
190
|
-
|
|
191
|
-
while (
|
|
192
|
-
prop = props[
|
|
190
|
+
i2 = props.length;
|
|
191
|
+
while (i2-- > 0) {
|
|
192
|
+
prop = props[i2];
|
|
193
193
|
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
194
194
|
destObj[prop] = sourceObj[prop];
|
|
195
195
|
merged[prop] = true;
|
|
@@ -211,11 +211,11 @@ const endsWith = (str, searchString, position) => {
|
|
|
211
211
|
const toArray = (thing) => {
|
|
212
212
|
if (!thing) return null;
|
|
213
213
|
if (isArray$1(thing)) return thing;
|
|
214
|
-
let
|
|
215
|
-
if (!isNumber$2(
|
|
216
|
-
const arr = new Array(
|
|
217
|
-
while (
|
|
218
|
-
arr[
|
|
214
|
+
let i2 = thing.length;
|
|
215
|
+
if (!isNumber$2(i2)) return null;
|
|
216
|
+
const arr = new Array(i2);
|
|
217
|
+
while (i2-- > 0) {
|
|
218
|
+
arr[i2] = thing[i2];
|
|
219
219
|
}
|
|
220
220
|
return arr;
|
|
221
221
|
};
|
|
@@ -302,7 +302,7 @@ function isSpecCompliantForm(thing) {
|
|
|
302
302
|
}
|
|
303
303
|
const toJSONObject = (obj) => {
|
|
304
304
|
const stack = new Array(10);
|
|
305
|
-
const visit = (source,
|
|
305
|
+
const visit = (source, i2) => {
|
|
306
306
|
if (isObject$1(source)) {
|
|
307
307
|
if (stack.indexOf(source) >= 0) {
|
|
308
308
|
return;
|
|
@@ -311,13 +311,13 @@ const toJSONObject = (obj) => {
|
|
|
311
311
|
return source;
|
|
312
312
|
}
|
|
313
313
|
if (!("toJSON" in source)) {
|
|
314
|
-
stack[
|
|
314
|
+
stack[i2] = source;
|
|
315
315
|
const target = isArray$1(source) ? [] : {};
|
|
316
316
|
forEach(source, (value, key) => {
|
|
317
|
-
const reducedValue = visit(value,
|
|
317
|
+
const reducedValue = visit(value, i2 + 1);
|
|
318
318
|
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
319
319
|
});
|
|
320
|
-
stack[
|
|
320
|
+
stack[i2] = void 0;
|
|
321
321
|
return target;
|
|
322
322
|
}
|
|
323
323
|
}
|
|
@@ -493,9 +493,9 @@ function removeBrackets(key) {
|
|
|
493
493
|
}
|
|
494
494
|
function renderKey(path, key, dots) {
|
|
495
495
|
if (!path) return key;
|
|
496
|
-
return path.concat(key).map(function each(token,
|
|
496
|
+
return path.concat(key).map(function each(token, i2) {
|
|
497
497
|
token = removeBrackets(token);
|
|
498
|
-
return !dots &&
|
|
498
|
+
return !dots && i2 ? "[" + token + "]" : token;
|
|
499
499
|
}).join(dots ? "." : "");
|
|
500
500
|
}
|
|
501
501
|
function isFlatArray(arr) {
|
|
@@ -774,11 +774,11 @@ function parsePropPath(name) {
|
|
|
774
774
|
function arrayToObject(arr) {
|
|
775
775
|
const obj = {};
|
|
776
776
|
const keys2 = Object.keys(arr);
|
|
777
|
-
let
|
|
777
|
+
let i2;
|
|
778
778
|
const len = keys2.length;
|
|
779
779
|
let key;
|
|
780
|
-
for (
|
|
781
|
-
key = keys2[
|
|
780
|
+
for (i2 = 0; i2 < len; i2++) {
|
|
781
|
+
key = keys2[i2];
|
|
782
782
|
obj[key] = arr[key];
|
|
783
783
|
}
|
|
784
784
|
return obj;
|
|
@@ -821,9 +821,9 @@ function stringifySafely(rawValue, parser, encoder) {
|
|
|
821
821
|
try {
|
|
822
822
|
(parser || JSON.parse)(rawValue);
|
|
823
823
|
return utils$1.trim(rawValue);
|
|
824
|
-
} catch (
|
|
825
|
-
if (
|
|
826
|
-
throw
|
|
824
|
+
} catch (e2) {
|
|
825
|
+
if (e2.name !== "SyntaxError") {
|
|
826
|
+
throw e2;
|
|
827
827
|
}
|
|
828
828
|
}
|
|
829
829
|
}
|
|
@@ -885,12 +885,12 @@ const defaults = {
|
|
|
885
885
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
886
886
|
try {
|
|
887
887
|
return JSON.parse(data, this.parseReviver);
|
|
888
|
-
} catch (
|
|
888
|
+
} catch (e2) {
|
|
889
889
|
if (strictJSONParsing) {
|
|
890
|
-
if (
|
|
891
|
-
throw AxiosError$1.from(
|
|
890
|
+
if (e2.name === "SyntaxError") {
|
|
891
|
+
throw AxiosError$1.from(e2, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
892
892
|
}
|
|
893
|
-
throw
|
|
893
|
+
throw e2;
|
|
894
894
|
}
|
|
895
895
|
}
|
|
896
896
|
}
|
|
@@ -945,11 +945,11 @@ const parseHeaders = (rawHeaders) => {
|
|
|
945
945
|
const parsed = {};
|
|
946
946
|
let key;
|
|
947
947
|
let val;
|
|
948
|
-
let
|
|
948
|
+
let i2;
|
|
949
949
|
rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
|
|
950
|
-
|
|
951
|
-
key = line.substring(0,
|
|
952
|
-
val = line.substring(
|
|
950
|
+
i2 = line.indexOf(":");
|
|
951
|
+
key = line.substring(0, i2).trim().toLowerCase();
|
|
952
|
+
val = line.substring(i2 + 1).trim();
|
|
953
953
|
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
|
|
954
954
|
return;
|
|
955
955
|
}
|
|
@@ -1103,10 +1103,10 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
1103
1103
|
}
|
|
1104
1104
|
clear(matcher) {
|
|
1105
1105
|
const keys2 = Object.keys(this);
|
|
1106
|
-
let
|
|
1106
|
+
let i2 = keys2.length;
|
|
1107
1107
|
let deleted = false;
|
|
1108
|
-
while (
|
|
1109
|
-
const key = keys2[
|
|
1108
|
+
while (i2--) {
|
|
1109
|
+
const key = keys2[i2];
|
|
1110
1110
|
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
1111
1111
|
delete this[key];
|
|
1112
1112
|
deleted = true;
|
|
@@ -1246,11 +1246,11 @@ function speedometer(samplesCount, min2) {
|
|
|
1246
1246
|
}
|
|
1247
1247
|
bytes[head] = chunkLength;
|
|
1248
1248
|
timestamps[head] = now2;
|
|
1249
|
-
let
|
|
1249
|
+
let i2 = tail;
|
|
1250
1250
|
let bytesCount = 0;
|
|
1251
|
-
while (
|
|
1252
|
-
bytesCount += bytes[
|
|
1253
|
-
|
|
1251
|
+
while (i2 !== head) {
|
|
1252
|
+
bytesCount += bytes[i2++];
|
|
1253
|
+
i2 = i2 % samplesCount;
|
|
1254
1254
|
}
|
|
1255
1255
|
head = (head + 1) % samplesCount;
|
|
1256
1256
|
if (head === tail) {
|
|
@@ -1298,9 +1298,9 @@ function throttle$1(fn2, freq) {
|
|
|
1298
1298
|
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
1299
1299
|
let bytesNotified = 0;
|
|
1300
1300
|
const _speedometer = speedometer(50, 250);
|
|
1301
|
-
return throttle$1((
|
|
1302
|
-
const loaded =
|
|
1303
|
-
const total =
|
|
1301
|
+
return throttle$1((e2) => {
|
|
1302
|
+
const loaded = e2.loaded;
|
|
1303
|
+
const total = e2.lengthComputable ? e2.total : void 0;
|
|
1304
1304
|
const progressBytes = loaded - bytesNotified;
|
|
1305
1305
|
const rate = _speedometer(progressBytes);
|
|
1306
1306
|
const inRange = loaded <= total;
|
|
@@ -1312,7 +1312,7 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
1312
1312
|
bytes: progressBytes,
|
|
1313
1313
|
rate: rate ? rate : void 0,
|
|
1314
1314
|
estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
|
|
1315
|
-
event:
|
|
1315
|
+
event: e2,
|
|
1316
1316
|
lengthComputable: total != null,
|
|
1317
1317
|
[isDownloadStream ? "download" : "upload"]: true
|
|
1318
1318
|
};
|
|
@@ -1393,30 +1393,30 @@ function mergeConfig$1(config1, config2) {
|
|
|
1393
1393
|
}
|
|
1394
1394
|
return source;
|
|
1395
1395
|
}
|
|
1396
|
-
function mergeDeepProperties(
|
|
1396
|
+
function mergeDeepProperties(a2, b, prop, caseless) {
|
|
1397
1397
|
if (!utils$1.isUndefined(b)) {
|
|
1398
|
-
return getMergedValue(
|
|
1399
|
-
} else if (!utils$1.isUndefined(
|
|
1400
|
-
return getMergedValue(void 0,
|
|
1398
|
+
return getMergedValue(a2, b, prop, caseless);
|
|
1399
|
+
} else if (!utils$1.isUndefined(a2)) {
|
|
1400
|
+
return getMergedValue(void 0, a2, prop, caseless);
|
|
1401
1401
|
}
|
|
1402
1402
|
}
|
|
1403
|
-
function valueFromConfig2(
|
|
1403
|
+
function valueFromConfig2(a2, b) {
|
|
1404
1404
|
if (!utils$1.isUndefined(b)) {
|
|
1405
1405
|
return getMergedValue(void 0, b);
|
|
1406
1406
|
}
|
|
1407
1407
|
}
|
|
1408
|
-
function defaultToConfig2(
|
|
1408
|
+
function defaultToConfig2(a2, b) {
|
|
1409
1409
|
if (!utils$1.isUndefined(b)) {
|
|
1410
1410
|
return getMergedValue(void 0, b);
|
|
1411
|
-
} else if (!utils$1.isUndefined(
|
|
1412
|
-
return getMergedValue(void 0,
|
|
1411
|
+
} else if (!utils$1.isUndefined(a2)) {
|
|
1412
|
+
return getMergedValue(void 0, a2);
|
|
1413
1413
|
}
|
|
1414
1414
|
}
|
|
1415
|
-
function mergeDirectKeys(
|
|
1415
|
+
function mergeDirectKeys(a2, b, prop) {
|
|
1416
1416
|
if (prop in config2) {
|
|
1417
|
-
return getMergedValue(
|
|
1417
|
+
return getMergedValue(a2, b);
|
|
1418
1418
|
} else if (prop in config1) {
|
|
1419
|
-
return getMergedValue(void 0,
|
|
1419
|
+
return getMergedValue(void 0, a2);
|
|
1420
1420
|
}
|
|
1421
1421
|
}
|
|
1422
1422
|
const mergeMap = {
|
|
@@ -1448,7 +1448,7 @@ function mergeConfig$1(config1, config2) {
|
|
|
1448
1448
|
socketPath: defaultToConfig2,
|
|
1449
1449
|
responseEncoding: defaultToConfig2,
|
|
1450
1450
|
validateStatus: mergeDirectKeys,
|
|
1451
|
-
headers: (
|
|
1451
|
+
headers: (a2, b, prop) => mergeDeepProperties(headersToObject(a2), headersToObject(b), prop, true)
|
|
1452
1452
|
};
|
|
1453
1453
|
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
1454
1454
|
const merge2 = mergeMap[prop] || mergeDeepProperties;
|
|
@@ -1694,10 +1694,10 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
1694
1694
|
const iterator2 = readBytes(stream, chunkSize);
|
|
1695
1695
|
let bytes = 0;
|
|
1696
1696
|
let done;
|
|
1697
|
-
let _onFinish = (
|
|
1697
|
+
let _onFinish = (e2) => {
|
|
1698
1698
|
if (!done) {
|
|
1699
1699
|
done = true;
|
|
1700
|
-
onFinish && onFinish(
|
|
1700
|
+
onFinish && onFinish(e2);
|
|
1701
1701
|
}
|
|
1702
1702
|
};
|
|
1703
1703
|
return new ReadableStream({
|
|
@@ -1741,7 +1741,7 @@ const {
|
|
|
1741
1741
|
const test = (fn2, ...args) => {
|
|
1742
1742
|
try {
|
|
1743
1743
|
return !!fn2(...args);
|
|
1744
|
-
} catch (
|
|
1744
|
+
} catch (e2) {
|
|
1745
1745
|
return false;
|
|
1746
1746
|
}
|
|
1747
1747
|
};
|
|
@@ -1925,11 +1925,11 @@ const getFetch = (config) => {
|
|
|
1925
1925
|
Response,
|
|
1926
1926
|
fetch2
|
|
1927
1927
|
];
|
|
1928
|
-
let len = seeds.length,
|
|
1929
|
-
while (
|
|
1930
|
-
seed = seeds[
|
|
1928
|
+
let len = seeds.length, i2 = len, seed, target, map = seedCache;
|
|
1929
|
+
while (i2--) {
|
|
1930
|
+
seed = seeds[i2];
|
|
1931
1931
|
target = map.get(seed);
|
|
1932
|
-
target === void 0 && map.set(seed, target =
|
|
1932
|
+
target === void 0 && map.set(seed, target = i2 ? /* @__PURE__ */ new Map() : factory(env));
|
|
1933
1933
|
map = target;
|
|
1934
1934
|
}
|
|
1935
1935
|
return target;
|
|
@@ -1946,7 +1946,7 @@ utils$1.forEach(knownAdapters, (fn2, value) => {
|
|
|
1946
1946
|
if (fn2) {
|
|
1947
1947
|
try {
|
|
1948
1948
|
Object.defineProperty(fn2, "name", { value });
|
|
1949
|
-
} catch (
|
|
1949
|
+
} catch (e2) {
|
|
1950
1950
|
}
|
|
1951
1951
|
Object.defineProperty(fn2, "adapterName", { value });
|
|
1952
1952
|
}
|
|
@@ -1960,8 +1960,8 @@ const adapters = {
|
|
|
1960
1960
|
let nameOrAdapter;
|
|
1961
1961
|
let adapter;
|
|
1962
1962
|
const rejectedReasons = {};
|
|
1963
|
-
for (let
|
|
1964
|
-
nameOrAdapter = adapters2[
|
|
1963
|
+
for (let i2 = 0; i2 < length; i2++) {
|
|
1964
|
+
nameOrAdapter = adapters2[i2];
|
|
1965
1965
|
let id;
|
|
1966
1966
|
adapter = nameOrAdapter;
|
|
1967
1967
|
if (!isResolvedHandle(nameOrAdapter)) {
|
|
@@ -1973,15 +1973,15 @@ const adapters = {
|
|
|
1973
1973
|
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
1974
1974
|
break;
|
|
1975
1975
|
}
|
|
1976
|
-
rejectedReasons[id || "#" +
|
|
1976
|
+
rejectedReasons[id || "#" + i2] = adapter;
|
|
1977
1977
|
}
|
|
1978
1978
|
if (!adapter) {
|
|
1979
1979
|
const reasons = Object.entries(rejectedReasons).map(
|
|
1980
1980
|
([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
|
|
1981
1981
|
);
|
|
1982
|
-
let
|
|
1982
|
+
let s2 = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
|
|
1983
1983
|
throw new AxiosError$1(
|
|
1984
|
-
`There is no suitable adapter to dispatch the request ` +
|
|
1984
|
+
`There is no suitable adapter to dispatch the request ` + s2,
|
|
1985
1985
|
"ERR_NOT_SUPPORT"
|
|
1986
1986
|
);
|
|
1987
1987
|
}
|
|
@@ -2034,9 +2034,9 @@ function dispatchRequest(config) {
|
|
|
2034
2034
|
}
|
|
2035
2035
|
const VERSION$1 = "1.12.2";
|
|
2036
2036
|
const validators$1 = {};
|
|
2037
|
-
["object", "boolean", "number", "function", "string", "symbol"].forEach((type,
|
|
2037
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i2) => {
|
|
2038
2038
|
validators$1[type] = function validator2(thing) {
|
|
2039
|
-
return typeof thing === type || "a" + (
|
|
2039
|
+
return typeof thing === type || "a" + (i2 < 1 ? "n " : " ") + type;
|
|
2040
2040
|
};
|
|
2041
2041
|
});
|
|
2042
2042
|
const deprecatedWarnings = {};
|
|
@@ -2067,9 +2067,9 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
2067
2067
|
throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
2068
2068
|
}
|
|
2069
2069
|
const keys2 = Object.keys(options);
|
|
2070
|
-
let
|
|
2071
|
-
while (
|
|
2072
|
-
const opt = keys2[
|
|
2070
|
+
let i2 = keys2.length;
|
|
2071
|
+
while (i2-- > 0) {
|
|
2072
|
+
const opt = keys2[i2];
|
|
2073
2073
|
const validator2 = schema[opt];
|
|
2074
2074
|
if (validator2) {
|
|
2075
2075
|
const value = options[opt];
|
|
@@ -2119,7 +2119,7 @@ let Axios$1 = class Axios {
|
|
|
2119
2119
|
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
|
|
2120
2120
|
err.stack += "\n" + stack;
|
|
2121
2121
|
}
|
|
2122
|
-
} catch (
|
|
2122
|
+
} catch (e2) {
|
|
2123
2123
|
}
|
|
2124
2124
|
}
|
|
2125
2125
|
throw err;
|
|
@@ -2189,7 +2189,7 @@ let Axios$1 = class Axios {
|
|
|
2189
2189
|
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
2190
2190
|
});
|
|
2191
2191
|
let promise;
|
|
2192
|
-
let
|
|
2192
|
+
let i2 = 0;
|
|
2193
2193
|
let len;
|
|
2194
2194
|
if (!synchronousRequestInterceptors) {
|
|
2195
2195
|
const chain = [dispatchRequest.bind(this), void 0];
|
|
@@ -2197,16 +2197,16 @@ let Axios$1 = class Axios {
|
|
|
2197
2197
|
chain.push(...responseInterceptorChain);
|
|
2198
2198
|
len = chain.length;
|
|
2199
2199
|
promise = Promise.resolve(config);
|
|
2200
|
-
while (
|
|
2201
|
-
promise = promise.then(chain[
|
|
2200
|
+
while (i2 < len) {
|
|
2201
|
+
promise = promise.then(chain[i2++], chain[i2++]);
|
|
2202
2202
|
}
|
|
2203
2203
|
return promise;
|
|
2204
2204
|
}
|
|
2205
2205
|
len = requestInterceptorChain.length;
|
|
2206
2206
|
let newConfig = config;
|
|
2207
|
-
while (
|
|
2208
|
-
const onFulfilled = requestInterceptorChain[
|
|
2209
|
-
const onRejected = requestInterceptorChain[
|
|
2207
|
+
while (i2 < len) {
|
|
2208
|
+
const onFulfilled = requestInterceptorChain[i2++];
|
|
2209
|
+
const onRejected = requestInterceptorChain[i2++];
|
|
2210
2210
|
try {
|
|
2211
2211
|
newConfig = onFulfilled(newConfig);
|
|
2212
2212
|
} catch (error) {
|
|
@@ -2219,10 +2219,10 @@ let Axios$1 = class Axios {
|
|
|
2219
2219
|
} catch (error) {
|
|
2220
2220
|
return Promise.reject(error);
|
|
2221
2221
|
}
|
|
2222
|
-
|
|
2222
|
+
i2 = 0;
|
|
2223
2223
|
len = responseInterceptorChain.length;
|
|
2224
|
-
while (
|
|
2225
|
-
promise = promise.then(responseInterceptorChain[
|
|
2224
|
+
while (i2 < len) {
|
|
2225
|
+
promise = promise.then(responseInterceptorChain[i2++], responseInterceptorChain[i2++]);
|
|
2226
2226
|
}
|
|
2227
2227
|
return promise;
|
|
2228
2228
|
}
|
|
@@ -2269,9 +2269,9 @@ let CancelToken$1 = class CancelToken {
|
|
|
2269
2269
|
const token = this;
|
|
2270
2270
|
this.promise.then((cancel) => {
|
|
2271
2271
|
if (!token._listeners) return;
|
|
2272
|
-
let
|
|
2273
|
-
while (
|
|
2274
|
-
token._listeners[
|
|
2272
|
+
let i2 = token._listeners.length;
|
|
2273
|
+
while (i2-- > 0) {
|
|
2274
|
+
token._listeners[i2](cancel);
|
|
2275
2275
|
}
|
|
2276
2276
|
token._listeners = null;
|
|
2277
2277
|
});
|
|
@@ -2343,8 +2343,8 @@ let CancelToken$1 = class CancelToken {
|
|
|
2343
2343
|
*/
|
|
2344
2344
|
static source() {
|
|
2345
2345
|
let cancel;
|
|
2346
|
-
const token = new CancelToken(function executor(
|
|
2347
|
-
cancel =
|
|
2346
|
+
const token = new CancelToken(function executor(c2) {
|
|
2347
|
+
cancel = c2;
|
|
2348
2348
|
});
|
|
2349
2349
|
return {
|
|
2350
2350
|
token,
|
|
@@ -3031,9 +3031,9 @@ const Loader = ({ visible, className }) => {
|
|
|
3031
3031
|
"data-visible": visible
|
|
3032
3032
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
3033
3033
|
className: "sonner-spinner"
|
|
3034
|
-
}, bars.map((_,
|
|
3034
|
+
}, bars.map((_, i2) => /* @__PURE__ */ React__default.createElement("div", {
|
|
3035
3035
|
className: "sonner-loading-bar",
|
|
3036
|
-
key: `spinner-bar-${
|
|
3036
|
+
key: `spinner-bar-${i2}`
|
|
3037
3037
|
}))));
|
|
3038
3038
|
};
|
|
3039
3039
|
const SuccessIcon = /* @__PURE__ */ React__default.createElement("svg", {
|
|
@@ -3551,7 +3551,7 @@ const Toast = (props) => {
|
|
|
3551
3551
|
]);
|
|
3552
3552
|
React__default.useEffect(() => {
|
|
3553
3553
|
if (toast2.promise && toastType === "loading" || toast2.duration === Infinity || toast2.type === "loading") return;
|
|
3554
|
-
let
|
|
3554
|
+
let timeoutId2;
|
|
3555
3555
|
const pauseTimer = () => {
|
|
3556
3556
|
if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) {
|
|
3557
3557
|
const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - closeTimerStartTimeRef.current;
|
|
@@ -3562,7 +3562,7 @@ const Toast = (props) => {
|
|
|
3562
3562
|
const startTimer = () => {
|
|
3563
3563
|
if (remainingTime.current === Infinity) return;
|
|
3564
3564
|
closeTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
|
|
3565
|
-
|
|
3565
|
+
timeoutId2 = setTimeout(() => {
|
|
3566
3566
|
toast2.onAutoClose == null ? void 0 : toast2.onAutoClose.call(toast2, toast2);
|
|
3567
3567
|
deleteToast();
|
|
3568
3568
|
}, remainingTime.current);
|
|
@@ -3572,7 +3572,7 @@ const Toast = (props) => {
|
|
|
3572
3572
|
} else {
|
|
3573
3573
|
startTimer();
|
|
3574
3574
|
}
|
|
3575
|
-
return () => clearTimeout(
|
|
3575
|
+
return () => clearTimeout(timeoutId2);
|
|
3576
3576
|
}, [
|
|
3577
3577
|
expanded,
|
|
3578
3578
|
interacting,
|
|
@@ -3870,17 +3870,17 @@ const Toaster$1 = /* @__PURE__ */ React__default.forwardRef(function Toaster(pro
|
|
|
3870
3870
|
return ToastState.subscribe((toast2) => {
|
|
3871
3871
|
if (toast2.dismiss) {
|
|
3872
3872
|
requestAnimationFrame(() => {
|
|
3873
|
-
setToasts((toasts2) => toasts2.map((
|
|
3874
|
-
...
|
|
3873
|
+
setToasts((toasts2) => toasts2.map((t2) => t2.id === toast2.id ? {
|
|
3874
|
+
...t2,
|
|
3875
3875
|
delete: true
|
|
3876
|
-
} :
|
|
3876
|
+
} : t2));
|
|
3877
3877
|
});
|
|
3878
3878
|
return;
|
|
3879
3879
|
}
|
|
3880
3880
|
setTimeout(() => {
|
|
3881
3881
|
ReactDOM__default.flushSync(() => {
|
|
3882
3882
|
setToasts((toasts2) => {
|
|
3883
|
-
const indexOfExistingToast = toasts2.findIndex((
|
|
3883
|
+
const indexOfExistingToast = toasts2.findIndex((t2) => t2.id === toast2.id);
|
|
3884
3884
|
if (indexOfExistingToast !== -1) {
|
|
3885
3885
|
return [
|
|
3886
3886
|
...toasts2.slice(0, indexOfExistingToast),
|
|
@@ -3932,7 +3932,7 @@ const Toaster$1 = /* @__PURE__ */ React__default.forwardRef(function Toaster(pro
|
|
|
3932
3932
|
} else {
|
|
3933
3933
|
setActualTheme("light");
|
|
3934
3934
|
}
|
|
3935
|
-
} catch (
|
|
3935
|
+
} catch (e2) {
|
|
3936
3936
|
}
|
|
3937
3937
|
});
|
|
3938
3938
|
}
|
|
@@ -4066,7 +4066,7 @@ const Toaster$1 = /* @__PURE__ */ React__default.forwardRef(function Toaster(pro
|
|
|
4066
4066
|
actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,
|
|
4067
4067
|
closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,
|
|
4068
4068
|
removeToast,
|
|
4069
|
-
toasts: filteredToasts.filter((
|
|
4069
|
+
toasts: filteredToasts.filter((t2) => t2.position == toast2.position),
|
|
4070
4070
|
heights: heights.filter((h) => h.position == toast2.position),
|
|
4071
4071
|
setHeights,
|
|
4072
4072
|
expandByDefault: expand,
|
|
@@ -4080,6 +4080,7 @@ const Toaster$1 = /* @__PURE__ */ React__default.forwardRef(function Toaster(pro
|
|
|
4080
4080
|
});
|
|
4081
4081
|
const API_TIMEOUT = 18e4;
|
|
4082
4082
|
const API_BASE_URL = "http://localhost:3000/api";
|
|
4083
|
+
const errorMessagesToIgnore = ["Oops. Something went wrong. Please try again."];
|
|
4083
4084
|
const getLanguage = () => "en-US";
|
|
4084
4085
|
function createApiClient(options) {
|
|
4085
4086
|
const { token, baseURL = API_BASE_URL, timeout = API_TIMEOUT } = options;
|
|
@@ -4123,7 +4124,7 @@ function createApiClient(options) {
|
|
|
4123
4124
|
options.t,
|
|
4124
4125
|
() => {
|
|
4125
4126
|
},
|
|
4126
|
-
(msg) => toast.error(msg)
|
|
4127
|
+
(msg) => !errorMessagesToIgnore.includes(msg) && toast.error(msg, { id: msg })
|
|
4127
4128
|
);
|
|
4128
4129
|
return Promise.reject(error);
|
|
4129
4130
|
}
|
|
@@ -4370,8 +4371,8 @@ class CoreApi {
|
|
|
4370
4371
|
}
|
|
4371
4372
|
}
|
|
4372
4373
|
const byteToHex = [];
|
|
4373
|
-
for (let
|
|
4374
|
-
byteToHex.push((
|
|
4374
|
+
for (let i2 = 0; i2 < 256; ++i2) {
|
|
4375
|
+
byteToHex.push((i2 + 256).toString(16).slice(1));
|
|
4375
4376
|
}
|
|
4376
4377
|
function unsafeStringify(arr, offset2 = 0) {
|
|
4377
4378
|
return (byteToHex[arr[offset2 + 0]] + byteToHex[arr[offset2 + 1]] + byteToHex[arr[offset2 + 2]] + byteToHex[arr[offset2 + 3]] + "-" + byteToHex[arr[offset2 + 4]] + byteToHex[arr[offset2 + 5]] + "-" + byteToHex[arr[offset2 + 6]] + byteToHex[arr[offset2 + 7]] + "-" + byteToHex[arr[offset2 + 8]] + byteToHex[arr[offset2 + 9]] + "-" + byteToHex[arr[offset2 + 10]] + byteToHex[arr[offset2 + 11]] + byteToHex[arr[offset2 + 12]] + byteToHex[arr[offset2 + 13]] + byteToHex[arr[offset2 + 14]] + byteToHex[arr[offset2 + 15]]).toLowerCase();
|
|
@@ -4696,12 +4697,12 @@ function composeRefs(...refs) {
|
|
|
4696
4697
|
});
|
|
4697
4698
|
if (hasCleanup) {
|
|
4698
4699
|
return () => {
|
|
4699
|
-
for (let
|
|
4700
|
-
const cleanup = cleanups[
|
|
4700
|
+
for (let i2 = 0; i2 < cleanups.length; i2++) {
|
|
4701
|
+
const cleanup = cleanups[i2];
|
|
4701
4702
|
if (typeof cleanup == "function") {
|
|
4702
4703
|
cleanup();
|
|
4703
4704
|
} else {
|
|
4704
|
-
setRef(refs[
|
|
4705
|
+
setRef(refs[i2], null);
|
|
4705
4706
|
}
|
|
4706
4707
|
}
|
|
4707
4708
|
};
|
|
@@ -4853,7 +4854,7 @@ function createCollection(name) {
|
|
|
4853
4854
|
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
4854
4855
|
const items = Array.from(context.itemMap.values());
|
|
4855
4856
|
const orderedItems = items.sort(
|
|
4856
|
-
(
|
|
4857
|
+
(a2, b) => orderedNodes.indexOf(a2.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
4857
4858
|
);
|
|
4858
4859
|
return orderedItems;
|
|
4859
4860
|
}, [context.collectionRef, context.itemMap]);
|
|
@@ -5255,7 +5256,7 @@ function usePresence(present) {
|
|
|
5255
5256
|
}, [present, send]);
|
|
5256
5257
|
useLayoutEffect2(() => {
|
|
5257
5258
|
if (node) {
|
|
5258
|
-
let
|
|
5259
|
+
let timeoutId2;
|
|
5259
5260
|
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
5260
5261
|
const handleAnimationEnd = (event) => {
|
|
5261
5262
|
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
@@ -5265,7 +5266,7 @@ function usePresence(present) {
|
|
|
5265
5266
|
if (!prevPresentRef.current) {
|
|
5266
5267
|
const currentFillMode = node.style.animationFillMode;
|
|
5267
5268
|
node.style.animationFillMode = "forwards";
|
|
5268
|
-
|
|
5269
|
+
timeoutId2 = ownerWindow.setTimeout(() => {
|
|
5269
5270
|
if (node.style.animationFillMode === "forwards") {
|
|
5270
5271
|
node.style.animationFillMode = currentFillMode;
|
|
5271
5272
|
}
|
|
@@ -5282,7 +5283,7 @@ function usePresence(present) {
|
|
|
5282
5283
|
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
5283
5284
|
node.addEventListener("animationend", handleAnimationEnd);
|
|
5284
5285
|
return () => {
|
|
5285
|
-
ownerWindow.clearTimeout(
|
|
5286
|
+
ownerWindow.clearTimeout(timeoutId2);
|
|
5286
5287
|
node.removeEventListener("animationstart", handleAnimationStart);
|
|
5287
5288
|
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
5288
5289
|
node.removeEventListener("animationend", handleAnimationEnd);
|
|
@@ -5509,13 +5510,13 @@ function traverse(node, visitor, options = {}) {
|
|
|
5509
5510
|
}
|
|
5510
5511
|
if (!shouldContinue) return false;
|
|
5511
5512
|
if (current.content && Array.isArray(current.content)) {
|
|
5512
|
-
for (let
|
|
5513
|
-
const child = current.content[
|
|
5513
|
+
for (let i2 = 0; i2 < current.content.length; i2++) {
|
|
5514
|
+
const child = current.content[i2];
|
|
5514
5515
|
if (order2 === "depth-first") {
|
|
5515
|
-
const continueTraversal = visit(child, current,
|
|
5516
|
+
const continueTraversal = visit(child, current, i2, depth + 1);
|
|
5516
5517
|
if (!continueTraversal) return false;
|
|
5517
5518
|
} else {
|
|
5518
|
-
const continueTraversal = visit(child, current,
|
|
5519
|
+
const continueTraversal = visit(child, current, i2, depth + 1);
|
|
5519
5520
|
if (!continueTraversal) return false;
|
|
5520
5521
|
}
|
|
5521
5522
|
}
|
|
@@ -5626,17 +5627,17 @@ function isOnlyContentNode(node, targetType, options = {}) {
|
|
|
5626
5627
|
traverse2(node);
|
|
5627
5628
|
return foundTargetType && !foundOtherContentNode;
|
|
5628
5629
|
}
|
|
5629
|
-
function r(
|
|
5630
|
-
var
|
|
5631
|
-
if ("string" == typeof
|
|
5632
|
-
else if ("object" == typeof
|
|
5633
|
-
var
|
|
5634
|
-
for (
|
|
5635
|
-
} else for (
|
|
5630
|
+
function r$1(e2) {
|
|
5631
|
+
var t2, f2, n = "";
|
|
5632
|
+
if ("string" == typeof e2 || "number" == typeof e2) n += e2;
|
|
5633
|
+
else if ("object" == typeof e2) if (Array.isArray(e2)) {
|
|
5634
|
+
var o2 = e2.length;
|
|
5635
|
+
for (t2 = 0; t2 < o2; t2++) e2[t2] && (f2 = r$1(e2[t2])) && (n && (n += " "), n += f2);
|
|
5636
|
+
} else for (f2 in e2) e2[f2] && (n && (n += " "), n += f2);
|
|
5636
5637
|
return n;
|
|
5637
5638
|
}
|
|
5638
5639
|
function clsx() {
|
|
5639
|
-
for (var
|
|
5640
|
+
for (var e2, t2, f2 = 0, n = "", o2 = arguments.length; f2 < o2; f2++) (e2 = arguments[f2]) && (t2 = r$1(e2)) && (n && (n += " "), n += t2);
|
|
5640
5641
|
return n;
|
|
5641
5642
|
}
|
|
5642
5643
|
const CLASS_PART_SEPARATOR = "-";
|
|
@@ -5935,8 +5936,8 @@ const mergeClassList = (classList, configUtils) => {
|
|
|
5935
5936
|
}
|
|
5936
5937
|
classGroupsInConflict.push(classId);
|
|
5937
5938
|
const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
|
|
5938
|
-
for (let
|
|
5939
|
-
const group = conflictGroups[
|
|
5939
|
+
for (let i2 = 0; i2 < conflictGroups.length; ++i2) {
|
|
5940
|
+
const group = conflictGroups[i2];
|
|
5940
5941
|
classGroupsInConflict.push(modifierId + group);
|
|
5941
5942
|
}
|
|
5942
5943
|
result = originalClassName + (result.length > 0 ? " " + result : result);
|
|
@@ -8911,7 +8912,7 @@ function getRawTag(value) {
|
|
|
8911
8912
|
try {
|
|
8912
8913
|
value[symToStringTag$1] = void 0;
|
|
8913
8914
|
var unmasked = true;
|
|
8914
|
-
} catch (
|
|
8915
|
+
} catch (e2) {
|
|
8915
8916
|
}
|
|
8916
8917
|
var result = nativeObjectToString$1.call(value);
|
|
8917
8918
|
if (unmasked) {
|
|
@@ -9028,11 +9029,11 @@ function toSource(func) {
|
|
|
9028
9029
|
if (func != null) {
|
|
9029
9030
|
try {
|
|
9030
9031
|
return funcToString$2.call(func);
|
|
9031
|
-
} catch (
|
|
9032
|
+
} catch (e2) {
|
|
9032
9033
|
}
|
|
9033
9034
|
try {
|
|
9034
9035
|
return func + "";
|
|
9035
|
-
} catch (
|
|
9036
|
+
} catch (e2) {
|
|
9036
9037
|
}
|
|
9037
9038
|
}
|
|
9038
9039
|
return "";
|
|
@@ -9100,7 +9101,7 @@ var defineProperty = (function() {
|
|
|
9100
9101
|
var func = getNative(Object, "defineProperty");
|
|
9101
9102
|
func({}, "", {});
|
|
9102
9103
|
return func;
|
|
9103
|
-
} catch (
|
|
9104
|
+
} catch (e2) {
|
|
9104
9105
|
}
|
|
9105
9106
|
})();
|
|
9106
9107
|
var baseSetToString = !defineProperty ? identity : function(func, string) {
|
|
@@ -9250,7 +9251,7 @@ var nodeUtil = (function() {
|
|
|
9250
9251
|
return types;
|
|
9251
9252
|
}
|
|
9252
9253
|
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
9253
|
-
} catch (
|
|
9254
|
+
} catch (e2) {
|
|
9254
9255
|
}
|
|
9255
9256
|
})();
|
|
9256
9257
|
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
@@ -9714,14 +9715,14 @@ function getAllKeys(object) {
|
|
|
9714
9715
|
function getAllKeysIn(object) {
|
|
9715
9716
|
return baseGetAllKeys(object, keysIn, getSymbolsIn);
|
|
9716
9717
|
}
|
|
9717
|
-
var DataView = getNative(root, "DataView");
|
|
9718
|
+
var DataView$1 = getNative(root, "DataView");
|
|
9718
9719
|
var Promise$1 = getNative(root, "Promise");
|
|
9719
9720
|
var Set$1 = getNative(root, "Set");
|
|
9720
9721
|
var mapTag$4 = "[object Map]", objectTag$2 = "[object Object]", promiseTag = "[object Promise]", setTag$4 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
|
|
9721
9722
|
var dataViewTag$3 = "[object DataView]";
|
|
9722
|
-
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap$1);
|
|
9723
|
+
var dataViewCtorString = toSource(DataView$1), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap$1);
|
|
9723
9724
|
var getTag = baseGetTag;
|
|
9724
|
-
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$3 || Map$1 && getTag(new Map$1()) != mapTag$4 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$4 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag$1) {
|
|
9725
|
+
if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$3 || Map$1 && getTag(new Map$1()) != mapTag$4 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$4 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag$1) {
|
|
9725
9726
|
getTag = function(value) {
|
|
9726
9727
|
var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
|
|
9727
9728
|
if (ctorString) {
|
|
@@ -10685,7 +10686,7 @@ function useAnalyticsTracking() {
|
|
|
10685
10686
|
}
|
|
10686
10687
|
const editorTypes = enumToOptions(EditorTypes);
|
|
10687
10688
|
const EditorTypeTabs = ({ editorTab, onSwitchEditorTab }) => {
|
|
10688
|
-
const { t } = usePostBuilder();
|
|
10689
|
+
const { t: t2 } = usePostBuilder();
|
|
10689
10690
|
const { trackTabSwitch } = useAnalyticsTracking();
|
|
10690
10691
|
const handleSwitchTab = (newTab) => {
|
|
10691
10692
|
const oldTab = editorTab;
|
|
@@ -10711,7 +10712,7 @@ const EditorTypeTabs = ({ editorTab, onSwitchEditorTab }) => {
|
|
|
10711
10712
|
value: editorTab,
|
|
10712
10713
|
onValueChange: handleSwitchTab,
|
|
10713
10714
|
className: "w-full",
|
|
10714
|
-
children: /* @__PURE__ */ jsx(TabsList, { className: "w-full rounded-none border-b", children: editorTypes.map((data) => /* @__PURE__ */ jsx(TabsTrigger, { value: data.value.toString(), children:
|
|
10715
|
+
children: /* @__PURE__ */ jsx(TabsList, { className: "w-full rounded-none border-b", children: editorTypes.map((data) => /* @__PURE__ */ jsx(TabsTrigger, { value: data.value.toString(), children: t2(translationKeyMapping(data.key), data.value) }, data.value)) })
|
|
10715
10716
|
}
|
|
10716
10717
|
);
|
|
10717
10718
|
};
|
|
@@ -11361,11 +11362,11 @@ const computePosition$1 = async (reference2, floating, config) => {
|
|
|
11361
11362
|
let statefulPlacement = placement;
|
|
11362
11363
|
let middlewareData = {};
|
|
11363
11364
|
let resetCount = 0;
|
|
11364
|
-
for (let
|
|
11365
|
+
for (let i2 = 0; i2 < validMiddleware.length; i2++) {
|
|
11365
11366
|
const {
|
|
11366
11367
|
name,
|
|
11367
11368
|
fn: fn2
|
|
11368
|
-
} = validMiddleware[
|
|
11369
|
+
} = validMiddleware[i2];
|
|
11369
11370
|
const {
|
|
11370
11371
|
x: nextX,
|
|
11371
11372
|
y: nextY,
|
|
@@ -11412,7 +11413,7 @@ const computePosition$1 = async (reference2, floating, config) => {
|
|
|
11412
11413
|
y
|
|
11413
11414
|
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
11414
11415
|
}
|
|
11415
|
-
|
|
11416
|
+
i2 = -1;
|
|
11416
11417
|
}
|
|
11417
11418
|
}
|
|
11418
11419
|
return {
|
|
@@ -11614,7 +11615,7 @@ const flip$4 = function(options) {
|
|
|
11614
11615
|
};
|
|
11615
11616
|
}
|
|
11616
11617
|
}
|
|
11617
|
-
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((
|
|
11618
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a2, b) => a2.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
11618
11619
|
if (!resetPlacement) {
|
|
11619
11620
|
switch (fallbackStrategy) {
|
|
11620
11621
|
case "bestFit": {
|
|
@@ -11627,7 +11628,7 @@ const flip$4 = function(options) {
|
|
|
11627
11628
|
currentSideAxis === "y";
|
|
11628
11629
|
}
|
|
11629
11630
|
return true;
|
|
11630
|
-
}).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((
|
|
11631
|
+
}).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a2, b) => a2[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
11631
11632
|
if (placement2) {
|
|
11632
11633
|
resetPlacement = placement2;
|
|
11633
11634
|
}
|
|
@@ -12586,16 +12587,16 @@ const platform = {
|
|
|
12586
12587
|
isElement: isElement$2,
|
|
12587
12588
|
isRTL
|
|
12588
12589
|
};
|
|
12589
|
-
function rectsAreEqual(
|
|
12590
|
-
return
|
|
12590
|
+
function rectsAreEqual(a2, b) {
|
|
12591
|
+
return a2.x === b.x && a2.y === b.y && a2.width === b.width && a2.height === b.height;
|
|
12591
12592
|
}
|
|
12592
12593
|
function observeMove(element, onMove) {
|
|
12593
12594
|
let io = null;
|
|
12594
|
-
let
|
|
12595
|
+
let timeoutId2;
|
|
12595
12596
|
const root2 = getDocumentElement$1(element);
|
|
12596
12597
|
function cleanup() {
|
|
12597
12598
|
var _io;
|
|
12598
|
-
clearTimeout(
|
|
12599
|
+
clearTimeout(timeoutId2);
|
|
12599
12600
|
(_io = io) == null || _io.disconnect();
|
|
12600
12601
|
io = null;
|
|
12601
12602
|
}
|
|
@@ -12637,7 +12638,7 @@ function observeMove(element, onMove) {
|
|
|
12637
12638
|
return refresh();
|
|
12638
12639
|
}
|
|
12639
12640
|
if (!ratio) {
|
|
12640
|
-
|
|
12641
|
+
timeoutId2 = setTimeout(() => {
|
|
12641
12642
|
refresh(false, 1e-7);
|
|
12642
12643
|
}, 1e3);
|
|
12643
12644
|
} else {
|
|
@@ -12757,52 +12758,52 @@ var isClient = typeof document !== "undefined";
|
|
|
12757
12758
|
var noop = function noop2() {
|
|
12758
12759
|
};
|
|
12759
12760
|
var index = isClient ? useLayoutEffect : noop;
|
|
12760
|
-
function deepEqual(
|
|
12761
|
-
if (
|
|
12761
|
+
function deepEqual(a2, b) {
|
|
12762
|
+
if (a2 === b) {
|
|
12762
12763
|
return true;
|
|
12763
12764
|
}
|
|
12764
|
-
if (typeof
|
|
12765
|
+
if (typeof a2 !== typeof b) {
|
|
12765
12766
|
return false;
|
|
12766
12767
|
}
|
|
12767
|
-
if (typeof
|
|
12768
|
+
if (typeof a2 === "function" && a2.toString() === b.toString()) {
|
|
12768
12769
|
return true;
|
|
12769
12770
|
}
|
|
12770
12771
|
let length;
|
|
12771
|
-
let
|
|
12772
|
+
let i2;
|
|
12772
12773
|
let keys2;
|
|
12773
|
-
if (
|
|
12774
|
-
if (Array.isArray(
|
|
12775
|
-
length =
|
|
12774
|
+
if (a2 && b && typeof a2 === "object") {
|
|
12775
|
+
if (Array.isArray(a2)) {
|
|
12776
|
+
length = a2.length;
|
|
12776
12777
|
if (length !== b.length) return false;
|
|
12777
|
-
for (
|
|
12778
|
-
if (!deepEqual(
|
|
12778
|
+
for (i2 = length; i2-- !== 0; ) {
|
|
12779
|
+
if (!deepEqual(a2[i2], b[i2])) {
|
|
12779
12780
|
return false;
|
|
12780
12781
|
}
|
|
12781
12782
|
}
|
|
12782
12783
|
return true;
|
|
12783
12784
|
}
|
|
12784
|
-
keys2 = Object.keys(
|
|
12785
|
+
keys2 = Object.keys(a2);
|
|
12785
12786
|
length = keys2.length;
|
|
12786
12787
|
if (length !== Object.keys(b).length) {
|
|
12787
12788
|
return false;
|
|
12788
12789
|
}
|
|
12789
|
-
for (
|
|
12790
|
-
if (!{}.hasOwnProperty.call(b, keys2[
|
|
12790
|
+
for (i2 = length; i2-- !== 0; ) {
|
|
12791
|
+
if (!{}.hasOwnProperty.call(b, keys2[i2])) {
|
|
12791
12792
|
return false;
|
|
12792
12793
|
}
|
|
12793
12794
|
}
|
|
12794
|
-
for (
|
|
12795
|
-
const key = keys2[
|
|
12796
|
-
if (key === "_owner" &&
|
|
12795
|
+
for (i2 = length; i2-- !== 0; ) {
|
|
12796
|
+
const key = keys2[i2];
|
|
12797
|
+
if (key === "_owner" && a2.$$typeof) {
|
|
12797
12798
|
continue;
|
|
12798
12799
|
}
|
|
12799
|
-
if (!deepEqual(
|
|
12800
|
+
if (!deepEqual(a2[key], b[key])) {
|
|
12800
12801
|
return false;
|
|
12801
12802
|
}
|
|
12802
12803
|
}
|
|
12803
12804
|
return true;
|
|
12804
12805
|
}
|
|
12805
|
-
return
|
|
12806
|
+
return a2 !== a2 && b !== b;
|
|
12806
12807
|
}
|
|
12807
12808
|
function getDPR(element) {
|
|
12808
12809
|
if (typeof window === "undefined") {
|
|
@@ -13470,7 +13471,7 @@ var applyAttributeToOthers = function(originalTarget, parentNode, markerName, co
|
|
|
13470
13471
|
if (!alreadyHidden) {
|
|
13471
13472
|
node.setAttribute(controlAttribute, "true");
|
|
13472
13473
|
}
|
|
13473
|
-
} catch (
|
|
13474
|
+
} catch (e2) {
|
|
13474
13475
|
}
|
|
13475
13476
|
}
|
|
13476
13477
|
});
|
|
@@ -13518,38 +13519,38 @@ var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
|
13518
13519
|
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
13519
13520
|
};
|
|
13520
13521
|
var __assign$1 = function() {
|
|
13521
|
-
__assign$1 = Object.assign || function __assign2(
|
|
13522
|
-
for (var
|
|
13523
|
-
|
|
13524
|
-
for (var p in
|
|
13522
|
+
__assign$1 = Object.assign || function __assign2(t2) {
|
|
13523
|
+
for (var s2, i2 = 1, n = arguments.length; i2 < n; i2++) {
|
|
13524
|
+
s2 = arguments[i2];
|
|
13525
|
+
for (var p in s2) if (Object.prototype.hasOwnProperty.call(s2, p)) t2[p] = s2[p];
|
|
13525
13526
|
}
|
|
13526
|
-
return
|
|
13527
|
+
return t2;
|
|
13527
13528
|
};
|
|
13528
13529
|
return __assign$1.apply(this, arguments);
|
|
13529
13530
|
};
|
|
13530
|
-
function __rest(
|
|
13531
|
-
var
|
|
13532
|
-
for (var p in
|
|
13533
|
-
|
|
13534
|
-
if (
|
|
13535
|
-
for (var
|
|
13536
|
-
if (
|
|
13537
|
-
|
|
13531
|
+
function __rest(s2, e2) {
|
|
13532
|
+
var t2 = {};
|
|
13533
|
+
for (var p in s2) if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0)
|
|
13534
|
+
t2[p] = s2[p];
|
|
13535
|
+
if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
|
|
13536
|
+
for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) {
|
|
13537
|
+
if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2]))
|
|
13538
|
+
t2[p[i2]] = s2[p[i2]];
|
|
13538
13539
|
}
|
|
13539
|
-
return
|
|
13540
|
+
return t2;
|
|
13540
13541
|
}
|
|
13541
13542
|
function __spreadArray(to, from, pack) {
|
|
13542
|
-
if (pack || arguments.length === 2) for (var
|
|
13543
|
-
if (ar || !(
|
|
13544
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0,
|
|
13545
|
-
ar[
|
|
13543
|
+
if (pack || arguments.length === 2) for (var i2 = 0, l2 = from.length, ar; i2 < l2; i2++) {
|
|
13544
|
+
if (ar || !(i2 in from)) {
|
|
13545
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i2);
|
|
13546
|
+
ar[i2] = from[i2];
|
|
13546
13547
|
}
|
|
13547
13548
|
}
|
|
13548
13549
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
13549
13550
|
}
|
|
13550
13551
|
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
13551
|
-
var
|
|
13552
|
-
return
|
|
13552
|
+
var e2 = new Error(message);
|
|
13553
|
+
return e2.name = "SuppressedError", e2.error = error, e2.suppressed = suppressed, e2;
|
|
13553
13554
|
};
|
|
13554
13555
|
var zeroRightClassName = "right-scroll-bar-position";
|
|
13555
13556
|
var fullWidthClassName = "width-before-scroll-bar";
|
|
@@ -13617,8 +13618,8 @@ function useMergeRefs(refs, defaultValue) {
|
|
|
13617
13618
|
}, [refs]);
|
|
13618
13619
|
return callbackRef;
|
|
13619
13620
|
}
|
|
13620
|
-
function ItoI(
|
|
13621
|
-
return
|
|
13621
|
+
function ItoI(a2) {
|
|
13622
|
+
return a2;
|
|
13622
13623
|
}
|
|
13623
13624
|
function innerCreateMedium(defaults2, middleware) {
|
|
13624
13625
|
if (middleware === void 0) {
|
|
@@ -14088,8 +14089,8 @@ function RemoveScrollSideCar(props) {
|
|
|
14088
14089
|
return;
|
|
14089
14090
|
}
|
|
14090
14091
|
var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
|
|
14091
|
-
var sourceEvent = shouldPreventQueue.current.filter(function(
|
|
14092
|
-
return
|
|
14092
|
+
var sourceEvent = shouldPreventQueue.current.filter(function(e2) {
|
|
14093
|
+
return e2.name === event.type && (e2.target === event.target || event.target === e2.shadowParent) && deltaCompare(e2.delta, delta);
|
|
14093
14094
|
})[0];
|
|
14094
14095
|
if (sourceEvent && sourceEvent.should) {
|
|
14095
14096
|
if (event.cancelable) {
|
|
@@ -14113,8 +14114,8 @@ function RemoveScrollSideCar(props) {
|
|
|
14113
14114
|
var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
|
|
14114
14115
|
shouldPreventQueue.current.push(event);
|
|
14115
14116
|
setTimeout(function() {
|
|
14116
|
-
shouldPreventQueue.current = shouldPreventQueue.current.filter(function(
|
|
14117
|
-
return
|
|
14117
|
+
shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e2) {
|
|
14118
|
+
return e2 !== event;
|
|
14118
14119
|
});
|
|
14119
14120
|
}, 1);
|
|
14120
14121
|
}, []);
|
|
@@ -15633,7 +15634,7 @@ const __iconNode$l = [
|
|
|
15633
15634
|
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
|
|
15634
15635
|
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
|
|
15635
15636
|
];
|
|
15636
|
-
const Image$
|
|
15637
|
+
const Image$2 = createLucideIcon("image", __iconNode$l);
|
|
15637
15638
|
/**
|
|
15638
15639
|
* @license lucide-react v0.544.0 - ISC
|
|
15639
15640
|
*
|
|
@@ -16287,7 +16288,7 @@ function useImageLoadingStatus(src, { referrerPolicy, crossOrigin }) {
|
|
|
16287
16288
|
return loadingStatus;
|
|
16288
16289
|
}
|
|
16289
16290
|
var Root$6 = Avatar$1;
|
|
16290
|
-
var Image = AvatarImage$1;
|
|
16291
|
+
var Image$1 = AvatarImage$1;
|
|
16291
16292
|
var Fallback = AvatarFallback$1;
|
|
16292
16293
|
function Avatar({ className, ...props }) {
|
|
16293
16294
|
return /* @__PURE__ */ jsx(
|
|
@@ -16301,7 +16302,7 @@ function Avatar({ className, ...props }) {
|
|
|
16301
16302
|
}
|
|
16302
16303
|
function AvatarImage({ className, ...props }) {
|
|
16303
16304
|
return /* @__PURE__ */ jsx(
|
|
16304
|
-
Image,
|
|
16305
|
+
Image$1,
|
|
16305
16306
|
{
|
|
16306
16307
|
"data-slot": "avatar-image",
|
|
16307
16308
|
className: cn("aspect-square size-full", className),
|
|
@@ -16897,8 +16898,8 @@ function getPointsFromRect(rect) {
|
|
|
16897
16898
|
function isPointInPolygon$1(point, polygon) {
|
|
16898
16899
|
const { x: x2, y } = point;
|
|
16899
16900
|
let inside = false;
|
|
16900
|
-
for (let
|
|
16901
|
-
const ii = polygon[
|
|
16901
|
+
for (let i2 = 0, j = polygon.length - 1; i2 < polygon.length; j = i2++) {
|
|
16902
|
+
const ii = polygon[i2];
|
|
16902
16903
|
const jj = polygon[j];
|
|
16903
16904
|
const xi = ii.x;
|
|
16904
16905
|
const yi = ii.y;
|
|
@@ -16911,11 +16912,11 @@ function isPointInPolygon$1(point, polygon) {
|
|
|
16911
16912
|
}
|
|
16912
16913
|
function getHull(points) {
|
|
16913
16914
|
const newPoints = points.slice();
|
|
16914
|
-
newPoints.sort((
|
|
16915
|
-
if (
|
|
16916
|
-
else if (
|
|
16917
|
-
else if (
|
|
16918
|
-
else if (
|
|
16915
|
+
newPoints.sort((a2, b) => {
|
|
16916
|
+
if (a2.x < b.x) return -1;
|
|
16917
|
+
else if (a2.x > b.x) return 1;
|
|
16918
|
+
else if (a2.y < b.y) return -1;
|
|
16919
|
+
else if (a2.y > b.y) return 1;
|
|
16919
16920
|
else return 0;
|
|
16920
16921
|
});
|
|
16921
16922
|
return getHullPresorted(newPoints);
|
|
@@ -16923,8 +16924,8 @@ function getHull(points) {
|
|
|
16923
16924
|
function getHullPresorted(points) {
|
|
16924
16925
|
if (points.length <= 1) return points.slice();
|
|
16925
16926
|
const upperHull = [];
|
|
16926
|
-
for (let
|
|
16927
|
-
const p = points[
|
|
16927
|
+
for (let i2 = 0; i2 < points.length; i2++) {
|
|
16928
|
+
const p = points[i2];
|
|
16928
16929
|
while (upperHull.length >= 2) {
|
|
16929
16930
|
const q = upperHull[upperHull.length - 1];
|
|
16930
16931
|
const r2 = upperHull[upperHull.length - 2];
|
|
@@ -16935,8 +16936,8 @@ function getHullPresorted(points) {
|
|
|
16935
16936
|
}
|
|
16936
16937
|
upperHull.pop();
|
|
16937
16938
|
const lowerHull = [];
|
|
16938
|
-
for (let
|
|
16939
|
-
const p = points[
|
|
16939
|
+
for (let i2 = points.length - 1; i2 >= 0; i2--) {
|
|
16940
|
+
const p = points[i2];
|
|
16940
16941
|
while (lowerHull.length >= 2) {
|
|
16941
16942
|
const q = lowerHull[lowerHull.length - 1];
|
|
16942
16943
|
const r2 = lowerHull[lowerHull.length - 2];
|
|
@@ -16990,9 +16991,9 @@ const ToolbarButton = forwardRef(
|
|
|
16990
16991
|
({ id, icon: Icon2, tooltip, active, children, className, onClick, ...buttonProps }, ref) => {
|
|
16991
16992
|
const { editor } = useCurrentEditor();
|
|
16992
16993
|
const { trackFeature } = useAnalyticsTracking();
|
|
16993
|
-
const { t } = usePostBuilder();
|
|
16994
|
-
const handleClick = (
|
|
16995
|
-
onClick?.(
|
|
16994
|
+
const { t: t2 } = usePostBuilder();
|
|
16995
|
+
const handleClick = (e2) => {
|
|
16996
|
+
onClick?.(e2);
|
|
16996
16997
|
if (id) trackFeature(id);
|
|
16997
16998
|
if (!editor) return;
|
|
16998
16999
|
requestAnimationFrame(editor?.chain()?.focus);
|
|
@@ -17016,7 +17017,7 @@ const ToolbarButton = forwardRef(
|
|
|
17016
17017
|
children: children ?? (Icon2 && /* @__PURE__ */ jsx(Icon2, { className: "size-full" }))
|
|
17017
17018
|
}
|
|
17018
17019
|
) }),
|
|
17019
|
-
/* @__PURE__ */ jsx(TooltipContent, { children:
|
|
17020
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: t2(tooltip, tooltip) ?? tooltip })
|
|
17020
17021
|
] }) });
|
|
17021
17022
|
}
|
|
17022
17023
|
);
|
|
@@ -17683,11 +17684,11 @@ const InputGroupAddon = forwardRef(({ className, align = "inline-start", ...prop
|
|
|
17683
17684
|
"data-slot": "input-group-addon",
|
|
17684
17685
|
"data-align": align,
|
|
17685
17686
|
className: cn(inputGroupAddonVariants({ align }), className),
|
|
17686
|
-
onClick: (
|
|
17687
|
-
if (
|
|
17687
|
+
onClick: (e2) => {
|
|
17688
|
+
if (e2.target.closest("button")) {
|
|
17688
17689
|
return;
|
|
17689
17690
|
}
|
|
17690
|
-
|
|
17691
|
+
e2.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
17691
17692
|
},
|
|
17692
17693
|
...props
|
|
17693
17694
|
}
|
|
@@ -17784,11 +17785,11 @@ const Spinner = forwardRef(({ className, ...props }, ref) => {
|
|
|
17784
17785
|
);
|
|
17785
17786
|
});
|
|
17786
17787
|
Spinner.displayName = "Spinner";
|
|
17787
|
-
function findDiffStart(
|
|
17788
|
-
for (let
|
|
17789
|
-
if (
|
|
17790
|
-
return
|
|
17791
|
-
let childA =
|
|
17788
|
+
function findDiffStart(a2, b, pos) {
|
|
17789
|
+
for (let i2 = 0; ; i2++) {
|
|
17790
|
+
if (i2 == a2.childCount || i2 == b.childCount)
|
|
17791
|
+
return a2.childCount == b.childCount ? null : pos;
|
|
17792
|
+
let childA = a2.child(i2), childB = b.child(i2);
|
|
17792
17793
|
if (childA == childB) {
|
|
17793
17794
|
pos += childA.nodeSize;
|
|
17794
17795
|
continue;
|
|
@@ -17808,11 +17809,11 @@ function findDiffStart(a, b, pos) {
|
|
|
17808
17809
|
pos += childA.nodeSize;
|
|
17809
17810
|
}
|
|
17810
17811
|
}
|
|
17811
|
-
function findDiffEnd(
|
|
17812
|
-
for (let iA =
|
|
17812
|
+
function findDiffEnd(a2, b, posA, posB) {
|
|
17813
|
+
for (let iA = a2.childCount, iB = b.childCount; ; ) {
|
|
17813
17814
|
if (iA == 0 || iB == 0)
|
|
17814
17815
|
return iA == iB ? null : { a: posA, b: posB };
|
|
17815
|
-
let childA =
|
|
17816
|
+
let childA = a2.child(--iA), childB = b.child(--iB), size2 = childA.nodeSize;
|
|
17816
17817
|
if (childA == childB) {
|
|
17817
17818
|
posA -= size2;
|
|
17818
17819
|
posB -= size2;
|
|
@@ -17846,20 +17847,20 @@ class Fragment {
|
|
|
17846
17847
|
this.content = content;
|
|
17847
17848
|
this.size = size2 || 0;
|
|
17848
17849
|
if (size2 == null)
|
|
17849
|
-
for (let
|
|
17850
|
-
this.size += content[
|
|
17850
|
+
for (let i2 = 0; i2 < content.length; i2++)
|
|
17851
|
+
this.size += content[i2].nodeSize;
|
|
17851
17852
|
}
|
|
17852
17853
|
/**
|
|
17853
17854
|
Invoke a callback for all descendant nodes between the given two
|
|
17854
17855
|
positions (relative to start of this fragment). Doesn't descend
|
|
17855
17856
|
into a node when the callback returns `false`.
|
|
17856
17857
|
*/
|
|
17857
|
-
nodesBetween(from, to,
|
|
17858
|
-
for (let
|
|
17859
|
-
let child = this.content[
|
|
17860
|
-
if (end2 > from &&
|
|
17858
|
+
nodesBetween(from, to, f2, nodeStart = 0, parent2) {
|
|
17859
|
+
for (let i2 = 0, pos = 0; pos < to; i2++) {
|
|
17860
|
+
let child = this.content[i2], end2 = pos + child.nodeSize;
|
|
17861
|
+
if (end2 > from && f2(child, nodeStart + pos, parent2 || null, i2) !== false && child.content.size) {
|
|
17861
17862
|
let start2 = pos + 1;
|
|
17862
|
-
child.nodesBetween(Math.max(0, from - start2), Math.min(child.content.size, to - start2),
|
|
17863
|
+
child.nodesBetween(Math.max(0, from - start2), Math.min(child.content.size, to - start2), f2, nodeStart + start2);
|
|
17863
17864
|
}
|
|
17864
17865
|
pos = end2;
|
|
17865
17866
|
}
|
|
@@ -17869,8 +17870,8 @@ class Fragment {
|
|
|
17869
17870
|
relative to the start of the fragment. The callback may return
|
|
17870
17871
|
`false` to prevent traversal of a given node's children.
|
|
17871
17872
|
*/
|
|
17872
|
-
descendants(
|
|
17873
|
-
this.nodesBetween(0, this.size,
|
|
17873
|
+
descendants(f2) {
|
|
17874
|
+
this.nodesBetween(0, this.size, f2);
|
|
17874
17875
|
}
|
|
17875
17876
|
/**
|
|
17876
17877
|
Extract the text between `from` and `to`. See the same method on
|
|
@@ -17899,13 +17900,13 @@ class Fragment {
|
|
|
17899
17900
|
return this;
|
|
17900
17901
|
if (!this.size)
|
|
17901
17902
|
return other;
|
|
17902
|
-
let last2 = this.lastChild, first = other.firstChild, content = this.content.slice(),
|
|
17903
|
+
let last2 = this.lastChild, first = other.firstChild, content = this.content.slice(), i2 = 0;
|
|
17903
17904
|
if (last2.isText && last2.sameMarkup(first)) {
|
|
17904
17905
|
content[content.length - 1] = last2.withText(last2.text + first.text);
|
|
17905
|
-
|
|
17906
|
+
i2 = 1;
|
|
17906
17907
|
}
|
|
17907
|
-
for (;
|
|
17908
|
-
content.push(other.content[
|
|
17908
|
+
for (; i2 < other.content.length; i2++)
|
|
17909
|
+
content.push(other.content[i2]);
|
|
17909
17910
|
return new Fragment(content, this.size + other.size);
|
|
17910
17911
|
}
|
|
17911
17912
|
/**
|
|
@@ -17916,8 +17917,8 @@ class Fragment {
|
|
|
17916
17917
|
return this;
|
|
17917
17918
|
let result = [], size2 = 0;
|
|
17918
17919
|
if (to > from)
|
|
17919
|
-
for (let
|
|
17920
|
-
let child = this.content[
|
|
17920
|
+
for (let i2 = 0, pos = 0; pos < to; i2++) {
|
|
17921
|
+
let child = this.content[i2], end2 = pos + child.nodeSize;
|
|
17921
17922
|
if (end2 > from) {
|
|
17922
17923
|
if (pos < from || end2 > to) {
|
|
17923
17924
|
if (child.isText)
|
|
@@ -17975,8 +17976,8 @@ class Fragment {
|
|
|
17975
17976
|
eq(other) {
|
|
17976
17977
|
if (this.content.length != other.content.length)
|
|
17977
17978
|
return false;
|
|
17978
|
-
for (let
|
|
17979
|
-
if (!this.content[
|
|
17979
|
+
for (let i2 = 0; i2 < this.content.length; i2++)
|
|
17980
|
+
if (!this.content[i2].eq(other.content[i2]))
|
|
17980
17981
|
return false;
|
|
17981
17982
|
return true;
|
|
17982
17983
|
}
|
|
@@ -18018,10 +18019,10 @@ class Fragment {
|
|
|
18018
18019
|
Call `f` for every child node, passing the node, its offset
|
|
18019
18020
|
into this parent node, and its index.
|
|
18020
18021
|
*/
|
|
18021
|
-
forEach(
|
|
18022
|
-
for (let
|
|
18023
|
-
let child = this.content[
|
|
18024
|
-
|
|
18022
|
+
forEach(f2) {
|
|
18023
|
+
for (let i2 = 0, p = 0; i2 < this.content.length; i2++) {
|
|
18024
|
+
let child = this.content[i2];
|
|
18025
|
+
f2(child, p, i2);
|
|
18025
18026
|
p += child.nodeSize;
|
|
18026
18027
|
}
|
|
18027
18028
|
}
|
|
@@ -18053,12 +18054,12 @@ class Fragment {
|
|
|
18053
18054
|
return retIndex(this.content.length, pos);
|
|
18054
18055
|
if (pos > this.size || pos < 0)
|
|
18055
18056
|
throw new RangeError(`Position ${pos} outside of fragment (${this})`);
|
|
18056
|
-
for (let
|
|
18057
|
-
let cur = this.child(
|
|
18057
|
+
for (let i2 = 0, curPos = 0; ; i2++) {
|
|
18058
|
+
let cur = this.child(i2), end2 = curPos + cur.nodeSize;
|
|
18058
18059
|
if (end2 >= pos) {
|
|
18059
18060
|
if (end2 == pos)
|
|
18060
|
-
return retIndex(
|
|
18061
|
-
return retIndex(
|
|
18061
|
+
return retIndex(i2 + 1, end2);
|
|
18062
|
+
return retIndex(i2, curPos);
|
|
18062
18063
|
}
|
|
18063
18064
|
curPos = end2;
|
|
18064
18065
|
}
|
|
@@ -18099,12 +18100,12 @@ class Fragment {
|
|
|
18099
18100
|
if (!array.length)
|
|
18100
18101
|
return Fragment.empty;
|
|
18101
18102
|
let joined, size2 = 0;
|
|
18102
|
-
for (let
|
|
18103
|
-
let node = array[
|
|
18103
|
+
for (let i2 = 0; i2 < array.length; i2++) {
|
|
18104
|
+
let node = array[i2];
|
|
18104
18105
|
size2 += node.nodeSize;
|
|
18105
|
-
if (
|
|
18106
|
+
if (i2 && node.isText && array[i2 - 1].sameMarkup(node)) {
|
|
18106
18107
|
if (!joined)
|
|
18107
|
-
joined = array.slice(0,
|
|
18108
|
+
joined = array.slice(0, i2);
|
|
18108
18109
|
joined[joined.length - 1] = node.withText(joined[joined.length - 1].text + node.text);
|
|
18109
18110
|
} else if (joined) {
|
|
18110
18111
|
joined.push(node);
|
|
@@ -18337,8 +18338,26 @@ const getMarkAttrsAtSelection = (state, markName) => {
|
|
|
18337
18338
|
});
|
|
18338
18339
|
return attrs;
|
|
18339
18340
|
};
|
|
18340
|
-
const
|
|
18341
|
-
|
|
18341
|
+
const extractInitialSearchQuery = (editor, maxChars = 100) => {
|
|
18342
|
+
if (!editor) return "";
|
|
18343
|
+
const { selection } = editor.state;
|
|
18344
|
+
if (!selection.empty) {
|
|
18345
|
+
const { $from, $to } = selection;
|
|
18346
|
+
const selectedText = editor.state.doc.textBetween($from.pos, $to.pos);
|
|
18347
|
+
const trimmedSelection = selectedText.trim();
|
|
18348
|
+
if (trimmedSelection) {
|
|
18349
|
+
return trimmedSelection.substring(0, maxChars);
|
|
18350
|
+
}
|
|
18351
|
+
}
|
|
18352
|
+
const text2 = editor.getText();
|
|
18353
|
+
if (!text2) return "";
|
|
18354
|
+
const trimmed = text2.trim();
|
|
18355
|
+
return trimmed.substring(0, maxChars);
|
|
18356
|
+
};
|
|
18357
|
+
const normalizeUrl = (input) => {
|
|
18358
|
+
if (!input) return "";
|
|
18359
|
+
const cleaned = input.trim().replace(/\s+/g, "").replace(/^(https?:\/\/)+/i, "");
|
|
18360
|
+
return `https://${cleaned}`;
|
|
18342
18361
|
};
|
|
18343
18362
|
const isValidUrl = (url) => {
|
|
18344
18363
|
return URL_REGEX.test(url);
|
|
@@ -18466,7 +18485,7 @@ const LinkDecoratorModal = ({
|
|
|
18466
18485
|
}) => {
|
|
18467
18486
|
const { editor } = useCurrentEditor();
|
|
18468
18487
|
const { core } = useApi();
|
|
18469
|
-
const { t } = usePostBuilder();
|
|
18488
|
+
const { t: t2 } = usePostBuilder();
|
|
18470
18489
|
const [uid, setUid] = useState(defaultValues?.uid ?? null);
|
|
18471
18490
|
const [link, setLink] = useState(defaultValues?.link ?? "");
|
|
18472
18491
|
const [text2, setText] = useState(defaultValues?.text || "");
|
|
@@ -18485,14 +18504,14 @@ const LinkDecoratorModal = ({
|
|
|
18485
18504
|
setLink(attrs?.href ?? "");
|
|
18486
18505
|
setText(attrs?.text || attrs?.href || "");
|
|
18487
18506
|
};
|
|
18488
|
-
const handleChangeLink = (
|
|
18489
|
-
const value =
|
|
18507
|
+
const handleChangeLink = (e2) => {
|
|
18508
|
+
const value = e2.target.value;
|
|
18490
18509
|
if (value === "https:/") return;
|
|
18491
18510
|
const url = normalizeUrl(value);
|
|
18492
18511
|
setIsValid(isValidUrl(url));
|
|
18493
18512
|
setLink(url);
|
|
18494
18513
|
};
|
|
18495
|
-
const handleChangeText = (
|
|
18514
|
+
const handleChangeText = (e2) => setText(e2.target.value);
|
|
18496
18515
|
const handleBlurLinkInput = () => {
|
|
18497
18516
|
const isValid2 = isValidUrl(link);
|
|
18498
18517
|
setIsValid(isValid2);
|
|
@@ -18507,10 +18526,10 @@ const LinkDecoratorModal = ({
|
|
|
18507
18526
|
onOpenChange?.(false);
|
|
18508
18527
|
});
|
|
18509
18528
|
};
|
|
18510
|
-
const handleKeyDown = (
|
|
18511
|
-
if (
|
|
18512
|
-
|
|
18513
|
-
const isTextInput = textInputRef.current ===
|
|
18529
|
+
const handleKeyDown = (e2) => {
|
|
18530
|
+
if (e2.key === "Enter") {
|
|
18531
|
+
e2.preventDefault();
|
|
18532
|
+
const isTextInput = textInputRef.current === e2.target;
|
|
18514
18533
|
if (isTextInput || hideTextInput) return handleInsertLink(link, text2, uid ?? void 0);
|
|
18515
18534
|
textInputRef?.current?.focus();
|
|
18516
18535
|
}
|
|
@@ -18527,11 +18546,11 @@ const LinkDecoratorModal = ({
|
|
|
18527
18546
|
return /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange: handleOpenChange, children: [
|
|
18528
18547
|
children ? /* @__PURE__ */ jsx(DialogTrigger, { asChild: true, children }) : null,
|
|
18529
18548
|
/* @__PURE__ */ jsxs(DialogContent, { className: "-translate-1/2", children: [
|
|
18530
|
-
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: isUpdate ?
|
|
18549
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: isUpdate ? t2("updateLinkKey") : t2("insertLinkKey") }) }),
|
|
18531
18550
|
/* @__PURE__ */ jsx(FieldSet, { children: /* @__PURE__ */ jsxs(FieldGroup, { className: "gap-3", children: [
|
|
18532
18551
|
/* @__PURE__ */ jsxs(Field, { className: "gap-1.5", children: [
|
|
18533
18552
|
/* @__PURE__ */ jsxs(FieldLabel, { children: [
|
|
18534
|
-
|
|
18553
|
+
t2("linkInputLabelKey"),
|
|
18535
18554
|
" ",
|
|
18536
18555
|
/* @__PURE__ */ jsx("span", { className: "text-destructive", children: "*" })
|
|
18537
18556
|
] }),
|
|
@@ -18548,10 +18567,10 @@ const LinkDecoratorModal = ({
|
|
|
18548
18567
|
),
|
|
18549
18568
|
/* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(Link, {}) })
|
|
18550
18569
|
] }),
|
|
18551
|
-
!isValid && isValid !== void 0 && /* @__PURE__ */ jsx(FieldError, { errors: [{ message:
|
|
18570
|
+
!isValid && isValid !== void 0 && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: t2("invalidLinkKey") }] })
|
|
18552
18571
|
] }),
|
|
18553
18572
|
!hideTextInput && /* @__PURE__ */ jsxs(Field, { className: "gap-1.5", children: [
|
|
18554
|
-
/* @__PURE__ */ jsx(FieldLabel, { children:
|
|
18573
|
+
/* @__PURE__ */ jsx(FieldLabel, { children: t2("linkTextInputLabelKey") }),
|
|
18555
18574
|
/* @__PURE__ */ jsxs(InputGroup, { children: [
|
|
18556
18575
|
/* @__PURE__ */ jsx(
|
|
18557
18576
|
InputGroupInput,
|
|
@@ -18560,7 +18579,7 @@ const LinkDecoratorModal = ({
|
|
|
18560
18579
|
value: text2,
|
|
18561
18580
|
onChange: handleChangeText,
|
|
18562
18581
|
onKeyDown: handleKeyDown,
|
|
18563
|
-
placeholder:
|
|
18582
|
+
placeholder: t2("linkTextInputLabelKey")
|
|
18564
18583
|
}
|
|
18565
18584
|
),
|
|
18566
18585
|
/* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(TextAlignStart, {}) })
|
|
@@ -18568,7 +18587,7 @@ const LinkDecoratorModal = ({
|
|
|
18568
18587
|
] })
|
|
18569
18588
|
] }) }),
|
|
18570
18589
|
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
18571
|
-
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => onOpenChange?.(false), children:
|
|
18590
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => onOpenChange?.(false), children: t2("cancelKey") }),
|
|
18572
18591
|
/* @__PURE__ */ jsxs(
|
|
18573
18592
|
Button,
|
|
18574
18593
|
{
|
|
@@ -18576,7 +18595,7 @@ const LinkDecoratorModal = ({
|
|
|
18576
18595
|
onClick: () => handleInsertLink(link, text2, uid ?? void 0),
|
|
18577
18596
|
children: [
|
|
18578
18597
|
isLoading && /* @__PURE__ */ jsx(Spinner, {}),
|
|
18579
|
-
isUpdate ?
|
|
18598
|
+
isUpdate ? t2("updateKey") : t2("insertKey")
|
|
18580
18599
|
]
|
|
18581
18600
|
}
|
|
18582
18601
|
)
|
|
@@ -18627,12 +18646,12 @@ function __extends(d, b) {
|
|
|
18627
18646
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
18628
18647
|
}
|
|
18629
18648
|
var __assign = function() {
|
|
18630
|
-
__assign = Object.assign || function __assign2(
|
|
18631
|
-
for (var
|
|
18632
|
-
|
|
18633
|
-
for (var p in
|
|
18649
|
+
__assign = Object.assign || function __assign2(t2) {
|
|
18650
|
+
for (var s2, i2 = 1, n = arguments.length; i2 < n; i2++) {
|
|
18651
|
+
s2 = arguments[i2];
|
|
18652
|
+
for (var p in s2) if (Object.prototype.hasOwnProperty.call(s2, p)) t2[p] = s2[p];
|
|
18634
18653
|
}
|
|
18635
|
-
return
|
|
18654
|
+
return t2;
|
|
18636
18655
|
};
|
|
18637
18656
|
return __assign.apply(this, arguments);
|
|
18638
18657
|
};
|
|
@@ -19022,6 +19041,7 @@ function useMediaSearch(type) {
|
|
|
19022
19041
|
reset
|
|
19023
19042
|
};
|
|
19024
19043
|
}
|
|
19044
|
+
let timeoutId;
|
|
19025
19045
|
const withInitialQuery = {
|
|
19026
19046
|
limit: ITEMS_PER_PAGE,
|
|
19027
19047
|
offset: 0,
|
|
@@ -19032,18 +19052,32 @@ function ImageSearchModal({
|
|
|
19032
19052
|
open,
|
|
19033
19053
|
onOpenChange,
|
|
19034
19054
|
onImageSelect,
|
|
19055
|
+
initialQuery,
|
|
19035
19056
|
children
|
|
19036
19057
|
}) {
|
|
19037
|
-
const { t } = usePostBuilder();
|
|
19058
|
+
const { t: t2 } = usePostBuilder();
|
|
19038
19059
|
const [activeTab, setActiveTab] = useState("gifs");
|
|
19039
|
-
const [searchQuery, setSearchQuery] = useState("");
|
|
19060
|
+
const [searchQuery, setSearchQuery] = useState(initialQuery ?? "");
|
|
19061
|
+
const inputRef = useRef(null);
|
|
19040
19062
|
const imageSearch = useMediaSearch("images");
|
|
19041
19063
|
const gifSearch = useMediaSearch("gifs");
|
|
19042
19064
|
const searchRef = useRef(gifSearch);
|
|
19065
|
+
useEffect(() => {
|
|
19066
|
+
if (initialQuery) {
|
|
19067
|
+
setSearchQuery(initialQuery);
|
|
19068
|
+
timeoutId = setTimeout(() => {
|
|
19069
|
+
inputRef.current?.select();
|
|
19070
|
+
}, 0);
|
|
19071
|
+
}
|
|
19072
|
+
return () => {
|
|
19073
|
+
clearTimeout(timeoutId);
|
|
19074
|
+
};
|
|
19075
|
+
}, [initialQuery]);
|
|
19043
19076
|
useEffect(() => {
|
|
19044
19077
|
searchRef.current = activeTab === "images" ? imageSearch : gifSearch;
|
|
19045
19078
|
}, [activeTab, imageSearch, gifSearch]);
|
|
19046
19079
|
const handleOpenChange = (open2) => {
|
|
19080
|
+
clearTimeout(timeoutId);
|
|
19047
19081
|
onOpenChange?.(open2);
|
|
19048
19082
|
if (!open2) {
|
|
19049
19083
|
imageSearch.reset();
|
|
@@ -19051,8 +19085,19 @@ function ImageSearchModal({
|
|
|
19051
19085
|
setSearchQuery("");
|
|
19052
19086
|
return;
|
|
19053
19087
|
}
|
|
19054
|
-
|
|
19055
|
-
|
|
19088
|
+
const queryToUse = initialQuery ?? "";
|
|
19089
|
+
setSearchQuery(queryToUse);
|
|
19090
|
+
timeoutId = setTimeout(() => {
|
|
19091
|
+
inputRef.current?.select();
|
|
19092
|
+
}, 0);
|
|
19093
|
+
const queryParams = {
|
|
19094
|
+
limit: ITEMS_PER_PAGE,
|
|
19095
|
+
offset: 0,
|
|
19096
|
+
query: queryToUse,
|
|
19097
|
+
reset: true
|
|
19098
|
+
};
|
|
19099
|
+
gifSearch.fetch(queryParams).catch((err) => void 0);
|
|
19100
|
+
imageSearch.fetch(queryParams).catch((err) => void 0);
|
|
19056
19101
|
};
|
|
19057
19102
|
const debouncedSearch = useMemo(
|
|
19058
19103
|
() => debounce$2(async (query) => {
|
|
@@ -19102,7 +19147,7 @@ function ImageSearchModal({
|
|
|
19102
19147
|
return /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange: handleOpenChange, children: [
|
|
19103
19148
|
/* @__PURE__ */ jsx(DialogTrigger, { asChild: true, children: children ?? /* @__PURE__ */ jsx(Button, { children: "Open Search Modal" }) }),
|
|
19104
19149
|
/* @__PURE__ */ jsxs(DialogContent, { className: "max-w-4xl w-full h-[80vh] flex flex-col overflow-hidden px-0 py-0 -translate-1/2", children: [
|
|
19105
|
-
/* @__PURE__ */ jsx(DialogHeader, { className: "p-4 border-b bg-accent", children: /* @__PURE__ */ jsx(DialogTitle, { children:
|
|
19150
|
+
/* @__PURE__ */ jsx(DialogHeader, { className: "p-4 border-b bg-accent", children: /* @__PURE__ */ jsx(DialogTitle, { children: t2("mediaSearchTitleKey") }) }),
|
|
19106
19151
|
/* @__PURE__ */ jsxs(
|
|
19107
19152
|
Tabs,
|
|
19108
19153
|
{
|
|
@@ -19112,15 +19157,16 @@ function ImageSearchModal({
|
|
|
19112
19157
|
className: "flex-1 grow flex flex-col overflow-y-auto",
|
|
19113
19158
|
children: [
|
|
19114
19159
|
/* @__PURE__ */ jsx("div", { className: "px-4", children: /* @__PURE__ */ jsxs(TabsList, { className: "grid w-full grid-cols-2", children: [
|
|
19115
|
-
/* @__PURE__ */ jsx(TabsTrigger, { value: "gifs", children:
|
|
19116
|
-
/* @__PURE__ */ jsx(TabsTrigger, { value: "images", children:
|
|
19160
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "gifs", children: t2("gifSearchKey") }),
|
|
19161
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "images", children: t2("imageSearchKey") })
|
|
19117
19162
|
] }) }),
|
|
19118
19163
|
/* @__PURE__ */ jsx(
|
|
19119
19164
|
SearchBar,
|
|
19120
19165
|
{
|
|
19166
|
+
ref: inputRef,
|
|
19121
19167
|
value: searchQuery,
|
|
19122
19168
|
onChange: handleSearch,
|
|
19123
|
-
placeholder: activeTab === "gifs" ?
|
|
19169
|
+
placeholder: activeTab === "gifs" ? t2("searchGifPlaceholder") : t2("searchIMagePlaceholder")
|
|
19124
19170
|
}
|
|
19125
19171
|
),
|
|
19126
19172
|
/* @__PURE__ */ jsx(TabsContent, { value: "images", className: "flex-1 grow mt-4 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
@@ -19149,21 +19195,25 @@ function ImageSearchModal({
|
|
|
19149
19195
|
] })
|
|
19150
19196
|
] });
|
|
19151
19197
|
}
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
/* @__PURE__ */ jsx(
|
|
19155
|
-
|
|
19156
|
-
|
|
19157
|
-
|
|
19158
|
-
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
|
|
19164
|
-
|
|
19165
|
-
|
|
19166
|
-
|
|
19198
|
+
const SearchBar = React__default.forwardRef(
|
|
19199
|
+
({ value, onChange, placeholder }, ref) => {
|
|
19200
|
+
return /* @__PURE__ */ jsx("div", { className: "mt-2 px-4", children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
19201
|
+
/* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 transform-none h-4 w-4 text-muted-foreground" }),
|
|
19202
|
+
/* @__PURE__ */ jsx(
|
|
19203
|
+
Input,
|
|
19204
|
+
{
|
|
19205
|
+
ref,
|
|
19206
|
+
type: "text",
|
|
19207
|
+
placeholder,
|
|
19208
|
+
value,
|
|
19209
|
+
onChange: (e2) => onChange(e2.target.value),
|
|
19210
|
+
className: "pl-9"
|
|
19211
|
+
}
|
|
19212
|
+
)
|
|
19213
|
+
] }) });
|
|
19214
|
+
}
|
|
19215
|
+
);
|
|
19216
|
+
SearchBar.displayName = "SearchBar";
|
|
19167
19217
|
function MediaGrid({
|
|
19168
19218
|
items,
|
|
19169
19219
|
onItemClick,
|
|
@@ -19942,8 +19992,8 @@ function getNextMatch(values, search, currentMatch) {
|
|
|
19942
19992
|
function isPointInPolygon(point, polygon) {
|
|
19943
19993
|
const { x: x2, y } = point;
|
|
19944
19994
|
let inside = false;
|
|
19945
|
-
for (let
|
|
19946
|
-
const ii = polygon[
|
|
19995
|
+
for (let i2 = 0, j = polygon.length - 1; i2 < polygon.length; j = i2++) {
|
|
19996
|
+
const ii = polygon[i2];
|
|
19947
19997
|
const jj = polygon[j];
|
|
19948
19998
|
const xi = ii.x;
|
|
19949
19999
|
const yi = ii.y;
|
|
@@ -20536,74 +20586,74 @@ const useEditorStateSnapshot = (editor) => {
|
|
|
20536
20586
|
editor,
|
|
20537
20587
|
selector: (ctx) => {
|
|
20538
20588
|
if (!ctx?.editor) return null;
|
|
20539
|
-
const
|
|
20540
|
-
const isCodeBlock =
|
|
20589
|
+
const e2 = ctx.editor;
|
|
20590
|
+
const isCodeBlock = e2.isActive("codeBlock") ?? false;
|
|
20541
20591
|
return {
|
|
20542
20592
|
// Editor States
|
|
20543
|
-
isEmpty:
|
|
20544
|
-
isFocused:
|
|
20593
|
+
isEmpty: e2.isEmpty ?? false,
|
|
20594
|
+
isFocused: e2.isFocused ?? false,
|
|
20545
20595
|
// Marks
|
|
20546
|
-
isBold:
|
|
20547
|
-
canBold: guardedChainRun(
|
|
20548
|
-
isItalic:
|
|
20549
|
-
canItalic: guardedChainRun(
|
|
20550
|
-
isStrike:
|
|
20551
|
-
canStrike: guardedChainRun(
|
|
20552
|
-
isCode:
|
|
20553
|
-
canCode: guardedChainRun(
|
|
20554
|
-
isUnderline:
|
|
20555
|
-
canUnderline: guardedChainRun(
|
|
20596
|
+
isBold: e2.isActive("bold") ?? false,
|
|
20597
|
+
canBold: guardedChainRun(e2, "toggleBold"),
|
|
20598
|
+
isItalic: e2.isActive("italic") ?? false,
|
|
20599
|
+
canItalic: guardedChainRun(e2, "toggleItalic"),
|
|
20600
|
+
isStrike: e2.isActive("strike") ?? false,
|
|
20601
|
+
canStrike: guardedChainRun(e2, "toggleStrike"),
|
|
20602
|
+
isCode: e2.isActive("code") ?? false,
|
|
20603
|
+
canCode: guardedChainRun(e2, "toggleCode"),
|
|
20604
|
+
isUnderline: e2.isActive("underline") ?? false,
|
|
20605
|
+
canUnderline: guardedChainRun(e2, "toggleUnderline"),
|
|
20556
20606
|
// Links
|
|
20557
|
-
isLink:
|
|
20558
|
-
canLink: guardedChainRun(
|
|
20559
|
-
canUnlink: guardedChainRun(
|
|
20607
|
+
isLink: e2.isActive("customLink") ?? false,
|
|
20608
|
+
canLink: guardedChainRun(e2, "toggleLink", { href: "" }),
|
|
20609
|
+
canUnlink: guardedChainRun(e2, "unsetLink"),
|
|
20560
20610
|
// Paragraphs & headings
|
|
20561
|
-
isParagraph:
|
|
20562
|
-
canParagraph: guardedChainRun(
|
|
20563
|
-
isHeading1:
|
|
20564
|
-
canHeading1: guardedChainRun(
|
|
20565
|
-
isHeading2:
|
|
20566
|
-
canHeading2: guardedChainRun(
|
|
20567
|
-
isHeading3:
|
|
20568
|
-
canHeading3: guardedChainRun(
|
|
20569
|
-
isHeading4:
|
|
20570
|
-
canHeading4: guardedChainRun(
|
|
20571
|
-
isHeading5:
|
|
20572
|
-
canHeading5: guardedChainRun(
|
|
20573
|
-
isHeading6:
|
|
20574
|
-
canHeading6: guardedChainRun(
|
|
20611
|
+
isParagraph: e2.isActive("paragraph") ?? false,
|
|
20612
|
+
canParagraph: guardedChainRun(e2, "setParagraph"),
|
|
20613
|
+
isHeading1: e2.isActive("heading", { level: 1 }) ?? false,
|
|
20614
|
+
canHeading1: guardedChainRun(e2, "setHeading", { level: 1 }),
|
|
20615
|
+
isHeading2: e2.isActive("heading", { level: 2 }) ?? false,
|
|
20616
|
+
canHeading2: guardedChainRun(e2, "setHeading", { level: 2 }),
|
|
20617
|
+
isHeading3: e2.isActive("heading", { level: 3 }) ?? false,
|
|
20618
|
+
canHeading3: guardedChainRun(e2, "setHeading", { level: 3 }),
|
|
20619
|
+
isHeading4: e2.isActive("heading", { level: 4 }) ?? false,
|
|
20620
|
+
canHeading4: guardedChainRun(e2, "setHeading", { level: 4 }),
|
|
20621
|
+
isHeading5: e2.isActive("heading", { level: 5 }) ?? false,
|
|
20622
|
+
canHeading5: guardedChainRun(e2, "setHeading", { level: 5 }),
|
|
20623
|
+
isHeading6: e2.isActive("heading", { level: 6 }) ?? false,
|
|
20624
|
+
canHeading6: guardedChainRun(e2, "setHeading", { level: 6 }),
|
|
20575
20625
|
// Lists & blocks
|
|
20576
|
-
isBulletList:
|
|
20577
|
-
canBulletList: guardedChainRun(
|
|
20578
|
-
isOrderedList:
|
|
20579
|
-
canOrderedList: guardedChainRun(
|
|
20580
|
-
isTaskList:
|
|
20581
|
-
canTaskList: guardedChainRun(
|
|
20582
|
-
isBlockquote:
|
|
20583
|
-
canBlockquote: guardedChainRun(
|
|
20626
|
+
isBulletList: e2.isActive("bulletList") ?? false,
|
|
20627
|
+
canBulletList: guardedChainRun(e2, "toggleBulletList"),
|
|
20628
|
+
isOrderedList: e2.isActive("orderedList") ?? false,
|
|
20629
|
+
canOrderedList: guardedChainRun(e2, "toggleOrderedList"),
|
|
20630
|
+
isTaskList: e2.isActive("taskList") ?? false,
|
|
20631
|
+
canTaskList: guardedChainRun(e2, "toggleTaskList"),
|
|
20632
|
+
isBlockquote: e2.isActive("blockquote") ?? false,
|
|
20633
|
+
canBlockquote: guardedChainRun(e2, "toggleBlockquote"),
|
|
20584
20634
|
isCodeBlock,
|
|
20585
|
-
canCodeBlock: guardedChainRun(
|
|
20635
|
+
canCodeBlock: guardedChainRun(e2, "toggleCodeBlock"),
|
|
20586
20636
|
// Text alignment
|
|
20587
|
-
isAlignLeft:
|
|
20588
|
-
canAlignLeft: guardedChainRun(
|
|
20589
|
-
isAlignCenter:
|
|
20590
|
-
canAlignCenter: guardedChainRun(
|
|
20591
|
-
isAlignRight:
|
|
20592
|
-
canAlignRight: guardedChainRun(
|
|
20593
|
-
isAlignJustify:
|
|
20594
|
-
canAlignJustify: guardedChainRun(
|
|
20595
|
-
canUnsetAlign: guardedChainRun(
|
|
20637
|
+
isAlignLeft: e2.isActive({ textAlign: "left" }) ?? false,
|
|
20638
|
+
canAlignLeft: guardedChainRun(e2, "setTextAlign", "left") && !isCodeBlock,
|
|
20639
|
+
isAlignCenter: e2.isActive({ textAlign: "center" }) ?? false,
|
|
20640
|
+
canAlignCenter: guardedChainRun(e2, "setTextAlign", "center") && !isCodeBlock,
|
|
20641
|
+
isAlignRight: e2.isActive({ textAlign: "right" }) ?? false,
|
|
20642
|
+
canAlignRight: guardedChainRun(e2, "setTextAlign", "right") && !isCodeBlock,
|
|
20643
|
+
isAlignJustify: e2.isActive({ textAlign: "justify" }) ?? false,
|
|
20644
|
+
canAlignJustify: guardedChainRun(e2, "setTextAlign", "justify") && !isCodeBlock,
|
|
20645
|
+
canUnsetAlign: guardedChainRun(e2, "unsetTextAlign"),
|
|
20596
20646
|
// Custom nodes / media
|
|
20597
|
-
canInsertImage: guardedChainRun(
|
|
20598
|
-
canInsertVideo: guardedChainRun(
|
|
20599
|
-
canInsertAudio: guardedChainRun(
|
|
20600
|
-
isPoll:
|
|
20601
|
-
canPoll: guardedChainRun(
|
|
20647
|
+
canInsertImage: guardedChainRun(e2, "insertMedia", { type: MediaNodeTypes.Image, src: "" }),
|
|
20648
|
+
canInsertVideo: guardedChainRun(e2, "insertMedia", { type: MediaNodeTypes.Video, src: "" }),
|
|
20649
|
+
canInsertAudio: guardedChainRun(e2, "insertMedia", { type: MediaNodeTypes.Audio, src: "" }),
|
|
20650
|
+
isPoll: e2?.isActive("poll") ?? false,
|
|
20651
|
+
canPoll: guardedChainRun(e2, "insertPoll", { choices: [] }),
|
|
20602
20652
|
// Undo/Redo & clearing
|
|
20603
|
-
canUndo: guardedChainRun(
|
|
20604
|
-
canRedo: guardedChainRun(
|
|
20605
|
-
canClearMarks: guardedChainRun(
|
|
20606
|
-
canClearNodes: guardedChainRun(
|
|
20653
|
+
canUndo: guardedChainRun(e2, "undo"),
|
|
20654
|
+
canRedo: guardedChainRun(e2, "redo"),
|
|
20655
|
+
canClearMarks: guardedChainRun(e2, "unsetAllMarks"),
|
|
20656
|
+
canClearNodes: guardedChainRun(e2, "clearNodes")
|
|
20607
20657
|
};
|
|
20608
20658
|
}
|
|
20609
20659
|
});
|
|
@@ -20708,12 +20758,1760 @@ const useEditorWithMentionTracking = (editor, options) => {
|
|
|
20708
20758
|
}, [editor, stableOptions]);
|
|
20709
20759
|
return { showCrossMentionIndicator };
|
|
20710
20760
|
};
|
|
20761
|
+
function _mergeNamespaces(e2, t2) {
|
|
20762
|
+
return t2.forEach((function(t3) {
|
|
20763
|
+
t3 && "string" != typeof t3 && !Array.isArray(t3) && Object.keys(t3).forEach((function(r2) {
|
|
20764
|
+
if ("default" !== r2 && !(r2 in e2)) {
|
|
20765
|
+
var i2 = Object.getOwnPropertyDescriptor(t3, r2);
|
|
20766
|
+
Object.defineProperty(e2, r2, i2.get ? i2 : { enumerable: true, get: function() {
|
|
20767
|
+
return t3[r2];
|
|
20768
|
+
} });
|
|
20769
|
+
}
|
|
20770
|
+
}));
|
|
20771
|
+
})), Object.freeze(e2);
|
|
20772
|
+
}
|
|
20773
|
+
function copyExifWithoutOrientation(e2, t2) {
|
|
20774
|
+
return new Promise((function(r2, i2) {
|
|
20775
|
+
let o2;
|
|
20776
|
+
return getApp1Segment(e2).then((function(e3) {
|
|
20777
|
+
try {
|
|
20778
|
+
return o2 = e3, r2(new Blob([t2.slice(0, 2), o2, t2.slice(2)], { type: "image/jpeg" }));
|
|
20779
|
+
} catch (e4) {
|
|
20780
|
+
return i2(e4);
|
|
20781
|
+
}
|
|
20782
|
+
}), i2);
|
|
20783
|
+
}));
|
|
20784
|
+
}
|
|
20785
|
+
const getApp1Segment = (e2) => new Promise(((t2, r2) => {
|
|
20786
|
+
const i2 = new FileReader();
|
|
20787
|
+
i2.addEventListener("load", (({ target: { result: e3 } }) => {
|
|
20788
|
+
const i3 = new DataView(e3);
|
|
20789
|
+
let o2 = 0;
|
|
20790
|
+
if (65496 !== i3.getUint16(o2)) return r2("not a valid JPEG");
|
|
20791
|
+
for (o2 += 2; ; ) {
|
|
20792
|
+
const a2 = i3.getUint16(o2);
|
|
20793
|
+
if (65498 === a2) break;
|
|
20794
|
+
const s2 = i3.getUint16(o2 + 2);
|
|
20795
|
+
if (65505 === a2 && 1165519206 === i3.getUint32(o2 + 4)) {
|
|
20796
|
+
const a3 = o2 + 10;
|
|
20797
|
+
let f2;
|
|
20798
|
+
switch (i3.getUint16(a3)) {
|
|
20799
|
+
case 18761:
|
|
20800
|
+
f2 = true;
|
|
20801
|
+
break;
|
|
20802
|
+
case 19789:
|
|
20803
|
+
f2 = false;
|
|
20804
|
+
break;
|
|
20805
|
+
default:
|
|
20806
|
+
return r2("TIFF header contains invalid endian");
|
|
20807
|
+
}
|
|
20808
|
+
if (42 !== i3.getUint16(a3 + 2, f2)) return r2("TIFF header contains invalid version");
|
|
20809
|
+
const l2 = i3.getUint32(a3 + 4, f2), c2 = a3 + l2 + 2 + 12 * i3.getUint16(a3 + l2, f2);
|
|
20810
|
+
for (let e4 = a3 + l2 + 2; e4 < c2; e4 += 12) {
|
|
20811
|
+
if (274 == i3.getUint16(e4, f2)) {
|
|
20812
|
+
if (3 !== i3.getUint16(e4 + 2, f2)) return r2("Orientation data type is invalid");
|
|
20813
|
+
if (1 !== i3.getUint32(e4 + 4, f2)) return r2("Orientation data count is invalid");
|
|
20814
|
+
i3.setUint16(e4 + 8, 1, f2);
|
|
20815
|
+
break;
|
|
20816
|
+
}
|
|
20817
|
+
}
|
|
20818
|
+
return t2(e3.slice(o2, o2 + 2 + s2));
|
|
20819
|
+
}
|
|
20820
|
+
o2 += 2 + s2;
|
|
20821
|
+
}
|
|
20822
|
+
return t2(new Blob());
|
|
20823
|
+
})), i2.readAsArrayBuffer(e2);
|
|
20824
|
+
}));
|
|
20825
|
+
var e = {}, t = { get exports() {
|
|
20826
|
+
return e;
|
|
20827
|
+
}, set exports(t2) {
|
|
20828
|
+
e = t2;
|
|
20829
|
+
} };
|
|
20830
|
+
!(function(e2) {
|
|
20831
|
+
var r2, i2, UZIP2 = {};
|
|
20832
|
+
t.exports = UZIP2, UZIP2.parse = function(e3, t2) {
|
|
20833
|
+
for (var r3 = UZIP2.bin.readUshort, i3 = UZIP2.bin.readUint, o2 = 0, a2 = {}, s2 = new Uint8Array(e3), f2 = s2.length - 4; 101010256 != i3(s2, f2); ) f2--;
|
|
20834
|
+
o2 = f2;
|
|
20835
|
+
o2 += 4;
|
|
20836
|
+
var l2 = r3(s2, o2 += 4);
|
|
20837
|
+
r3(s2, o2 += 2);
|
|
20838
|
+
var c2 = i3(s2, o2 += 2), u = i3(s2, o2 += 4);
|
|
20839
|
+
o2 += 4, o2 = u;
|
|
20840
|
+
for (var h = 0; h < l2; h++) {
|
|
20841
|
+
i3(s2, o2), o2 += 4, o2 += 4, o2 += 4, i3(s2, o2 += 4);
|
|
20842
|
+
c2 = i3(s2, o2 += 4);
|
|
20843
|
+
var d = i3(s2, o2 += 4), A = r3(s2, o2 += 4), g = r3(s2, o2 + 2), p = r3(s2, o2 + 4);
|
|
20844
|
+
o2 += 6;
|
|
20845
|
+
var m = i3(s2, o2 += 8);
|
|
20846
|
+
o2 += 4, o2 += A + g + p, UZIP2._readLocal(s2, m, a2, c2, d, t2);
|
|
20847
|
+
}
|
|
20848
|
+
return a2;
|
|
20849
|
+
}, UZIP2._readLocal = function(e3, t2, r3, i3, o2, a2) {
|
|
20850
|
+
var s2 = UZIP2.bin.readUshort, f2 = UZIP2.bin.readUint;
|
|
20851
|
+
f2(e3, t2), s2(e3, t2 += 4), s2(e3, t2 += 2);
|
|
20852
|
+
var l2 = s2(e3, t2 += 2);
|
|
20853
|
+
f2(e3, t2 += 2), f2(e3, t2 += 4), t2 += 4;
|
|
20854
|
+
var c2 = s2(e3, t2 += 8), u = s2(e3, t2 += 2);
|
|
20855
|
+
t2 += 2;
|
|
20856
|
+
var h = UZIP2.bin.readUTF8(e3, t2, c2);
|
|
20857
|
+
if (t2 += c2, t2 += u, a2) r3[h] = { size: o2, csize: i3 };
|
|
20858
|
+
else {
|
|
20859
|
+
var d = new Uint8Array(e3.buffer, t2);
|
|
20860
|
+
if (0 == l2) r3[h] = new Uint8Array(d.buffer.slice(t2, t2 + i3));
|
|
20861
|
+
else {
|
|
20862
|
+
if (8 != l2) throw "unknown compression method: " + l2;
|
|
20863
|
+
var A = new Uint8Array(o2);
|
|
20864
|
+
UZIP2.inflateRaw(d, A), r3[h] = A;
|
|
20865
|
+
}
|
|
20866
|
+
}
|
|
20867
|
+
}, UZIP2.inflateRaw = function(e3, t2) {
|
|
20868
|
+
return UZIP2.F.inflate(e3, t2);
|
|
20869
|
+
}, UZIP2.inflate = function(e3, t2) {
|
|
20870
|
+
return e3[0], e3[1], UZIP2.inflateRaw(new Uint8Array(e3.buffer, e3.byteOffset + 2, e3.length - 6), t2);
|
|
20871
|
+
}, UZIP2.deflate = function(e3, t2) {
|
|
20872
|
+
null == t2 && (t2 = { level: 6 });
|
|
20873
|
+
var r3 = 0, i3 = new Uint8Array(50 + Math.floor(1.1 * e3.length));
|
|
20874
|
+
i3[r3] = 120, i3[r3 + 1] = 156, r3 += 2, r3 = UZIP2.F.deflateRaw(e3, i3, r3, t2.level);
|
|
20875
|
+
var o2 = UZIP2.adler(e3, 0, e3.length);
|
|
20876
|
+
return i3[r3 + 0] = o2 >>> 24 & 255, i3[r3 + 1] = o2 >>> 16 & 255, i3[r3 + 2] = o2 >>> 8 & 255, i3[r3 + 3] = o2 >>> 0 & 255, new Uint8Array(i3.buffer, 0, r3 + 4);
|
|
20877
|
+
}, UZIP2.deflateRaw = function(e3, t2) {
|
|
20878
|
+
null == t2 && (t2 = { level: 6 });
|
|
20879
|
+
var r3 = new Uint8Array(50 + Math.floor(1.1 * e3.length)), i3 = UZIP2.F.deflateRaw(e3, r3, i3, t2.level);
|
|
20880
|
+
return new Uint8Array(r3.buffer, 0, i3);
|
|
20881
|
+
}, UZIP2.encode = function(e3, t2) {
|
|
20882
|
+
null == t2 && (t2 = false);
|
|
20883
|
+
var r3 = 0, i3 = UZIP2.bin.writeUint, o2 = UZIP2.bin.writeUshort, a2 = {};
|
|
20884
|
+
for (var s2 in e3) {
|
|
20885
|
+
var f2 = !UZIP2._noNeed(s2) && !t2, l2 = e3[s2], c2 = UZIP2.crc.crc(l2, 0, l2.length);
|
|
20886
|
+
a2[s2] = { cpr: f2, usize: l2.length, crc: c2, file: f2 ? UZIP2.deflateRaw(l2) : l2 };
|
|
20887
|
+
}
|
|
20888
|
+
for (var s2 in a2) r3 += a2[s2].file.length + 30 + 46 + 2 * UZIP2.bin.sizeUTF8(s2);
|
|
20889
|
+
r3 += 22;
|
|
20890
|
+
var u = new Uint8Array(r3), h = 0, d = [];
|
|
20891
|
+
for (var s2 in a2) {
|
|
20892
|
+
var A = a2[s2];
|
|
20893
|
+
d.push(h), h = UZIP2._writeHeader(u, h, s2, A, 0);
|
|
20894
|
+
}
|
|
20895
|
+
var g = 0, p = h;
|
|
20896
|
+
for (var s2 in a2) {
|
|
20897
|
+
A = a2[s2];
|
|
20898
|
+
d.push(h), h = UZIP2._writeHeader(u, h, s2, A, 1, d[g++]);
|
|
20899
|
+
}
|
|
20900
|
+
var m = h - p;
|
|
20901
|
+
return i3(u, h, 101010256), h += 4, o2(u, h += 4, g), o2(u, h += 2, g), i3(u, h += 2, m), i3(u, h += 4, p), h += 4, h += 2, u.buffer;
|
|
20902
|
+
}, UZIP2._noNeed = function(e3) {
|
|
20903
|
+
var t2 = e3.split(".").pop().toLowerCase();
|
|
20904
|
+
return -1 != "png,jpg,jpeg,zip".indexOf(t2);
|
|
20905
|
+
}, UZIP2._writeHeader = function(e3, t2, r3, i3, o2, a2) {
|
|
20906
|
+
var s2 = UZIP2.bin.writeUint, f2 = UZIP2.bin.writeUshort, l2 = i3.file;
|
|
20907
|
+
return s2(e3, t2, 0 == o2 ? 67324752 : 33639248), t2 += 4, 1 == o2 && (t2 += 2), f2(e3, t2, 20), f2(e3, t2 += 2, 0), f2(e3, t2 += 2, i3.cpr ? 8 : 0), s2(e3, t2 += 2, 0), s2(e3, t2 += 4, i3.crc), s2(e3, t2 += 4, l2.length), s2(e3, t2 += 4, i3.usize), f2(e3, t2 += 4, UZIP2.bin.sizeUTF8(r3)), f2(e3, t2 += 2, 0), t2 += 2, 1 == o2 && (t2 += 2, t2 += 2, s2(e3, t2 += 6, a2), t2 += 4), t2 += UZIP2.bin.writeUTF8(e3, t2, r3), 0 == o2 && (e3.set(l2, t2), t2 += l2.length), t2;
|
|
20908
|
+
}, UZIP2.crc = { table: (function() {
|
|
20909
|
+
for (var e3 = new Uint32Array(256), t2 = 0; t2 < 256; t2++) {
|
|
20910
|
+
for (var r3 = t2, i3 = 0; i3 < 8; i3++) 1 & r3 ? r3 = 3988292384 ^ r3 >>> 1 : r3 >>>= 1;
|
|
20911
|
+
e3[t2] = r3;
|
|
20912
|
+
}
|
|
20913
|
+
return e3;
|
|
20914
|
+
})(), update: function(e3, t2, r3, i3) {
|
|
20915
|
+
for (var o2 = 0; o2 < i3; o2++) e3 = UZIP2.crc.table[255 & (e3 ^ t2[r3 + o2])] ^ e3 >>> 8;
|
|
20916
|
+
return e3;
|
|
20917
|
+
}, crc: function(e3, t2, r3) {
|
|
20918
|
+
return 4294967295 ^ UZIP2.crc.update(4294967295, e3, t2, r3);
|
|
20919
|
+
} }, UZIP2.adler = function(e3, t2, r3) {
|
|
20920
|
+
for (var i3 = 1, o2 = 0, a2 = t2, s2 = t2 + r3; a2 < s2; ) {
|
|
20921
|
+
for (var f2 = Math.min(a2 + 5552, s2); a2 < f2; ) o2 += i3 += e3[a2++];
|
|
20922
|
+
i3 %= 65521, o2 %= 65521;
|
|
20923
|
+
}
|
|
20924
|
+
return o2 << 16 | i3;
|
|
20925
|
+
}, UZIP2.bin = { readUshort: function(e3, t2) {
|
|
20926
|
+
return e3[t2] | e3[t2 + 1] << 8;
|
|
20927
|
+
}, writeUshort: function(e3, t2, r3) {
|
|
20928
|
+
e3[t2] = 255 & r3, e3[t2 + 1] = r3 >> 8 & 255;
|
|
20929
|
+
}, readUint: function(e3, t2) {
|
|
20930
|
+
return 16777216 * e3[t2 + 3] + (e3[t2 + 2] << 16 | e3[t2 + 1] << 8 | e3[t2]);
|
|
20931
|
+
}, writeUint: function(e3, t2, r3) {
|
|
20932
|
+
e3[t2] = 255 & r3, e3[t2 + 1] = r3 >> 8 & 255, e3[t2 + 2] = r3 >> 16 & 255, e3[t2 + 3] = r3 >> 24 & 255;
|
|
20933
|
+
}, readASCII: function(e3, t2, r3) {
|
|
20934
|
+
for (var i3 = "", o2 = 0; o2 < r3; o2++) i3 += String.fromCharCode(e3[t2 + o2]);
|
|
20935
|
+
return i3;
|
|
20936
|
+
}, writeASCII: function(e3, t2, r3) {
|
|
20937
|
+
for (var i3 = 0; i3 < r3.length; i3++) e3[t2 + i3] = r3.charCodeAt(i3);
|
|
20938
|
+
}, pad: function(e3) {
|
|
20939
|
+
return e3.length < 2 ? "0" + e3 : e3;
|
|
20940
|
+
}, readUTF8: function(e3, t2, r3) {
|
|
20941
|
+
for (var i3, o2 = "", a2 = 0; a2 < r3; a2++) o2 += "%" + UZIP2.bin.pad(e3[t2 + a2].toString(16));
|
|
20942
|
+
try {
|
|
20943
|
+
i3 = decodeURIComponent(o2);
|
|
20944
|
+
} catch (i4) {
|
|
20945
|
+
return UZIP2.bin.readASCII(e3, t2, r3);
|
|
20946
|
+
}
|
|
20947
|
+
return i3;
|
|
20948
|
+
}, writeUTF8: function(e3, t2, r3) {
|
|
20949
|
+
for (var i3 = r3.length, o2 = 0, a2 = 0; a2 < i3; a2++) {
|
|
20950
|
+
var s2 = r3.charCodeAt(a2);
|
|
20951
|
+
if (0 == (4294967168 & s2)) e3[t2 + o2] = s2, o2++;
|
|
20952
|
+
else if (0 == (4294965248 & s2)) e3[t2 + o2] = 192 | s2 >> 6, e3[t2 + o2 + 1] = 128 | s2 >> 0 & 63, o2 += 2;
|
|
20953
|
+
else if (0 == (4294901760 & s2)) e3[t2 + o2] = 224 | s2 >> 12, e3[t2 + o2 + 1] = 128 | s2 >> 6 & 63, e3[t2 + o2 + 2] = 128 | s2 >> 0 & 63, o2 += 3;
|
|
20954
|
+
else {
|
|
20955
|
+
if (0 != (4292870144 & s2)) throw "e";
|
|
20956
|
+
e3[t2 + o2] = 240 | s2 >> 18, e3[t2 + o2 + 1] = 128 | s2 >> 12 & 63, e3[t2 + o2 + 2] = 128 | s2 >> 6 & 63, e3[t2 + o2 + 3] = 128 | s2 >> 0 & 63, o2 += 4;
|
|
20957
|
+
}
|
|
20958
|
+
}
|
|
20959
|
+
return o2;
|
|
20960
|
+
}, sizeUTF8: function(e3) {
|
|
20961
|
+
for (var t2 = e3.length, r3 = 0, i3 = 0; i3 < t2; i3++) {
|
|
20962
|
+
var o2 = e3.charCodeAt(i3);
|
|
20963
|
+
if (0 == (4294967168 & o2)) r3++;
|
|
20964
|
+
else if (0 == (4294965248 & o2)) r3 += 2;
|
|
20965
|
+
else if (0 == (4294901760 & o2)) r3 += 3;
|
|
20966
|
+
else {
|
|
20967
|
+
if (0 != (4292870144 & o2)) throw "e";
|
|
20968
|
+
r3 += 4;
|
|
20969
|
+
}
|
|
20970
|
+
}
|
|
20971
|
+
return r3;
|
|
20972
|
+
} }, UZIP2.F = {}, UZIP2.F.deflateRaw = function(e3, t2, r3, i3) {
|
|
20973
|
+
var o2 = [[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]][i3], a2 = UZIP2.F.U, s2 = UZIP2.F._goodIndex;
|
|
20974
|
+
UZIP2.F._hash;
|
|
20975
|
+
var f2 = UZIP2.F._putsE, l2 = 0, c2 = r3 << 3, u = 0, h = e3.length;
|
|
20976
|
+
if (0 == i3) {
|
|
20977
|
+
for (; l2 < h; ) {
|
|
20978
|
+
f2(t2, c2, l2 + (_ = Math.min(65535, h - l2)) == h ? 1 : 0), c2 = UZIP2.F._copyExact(e3, l2, _, t2, c2 + 8), l2 += _;
|
|
20979
|
+
}
|
|
20980
|
+
return c2 >>> 3;
|
|
20981
|
+
}
|
|
20982
|
+
var d = a2.lits, A = a2.strt, g = a2.prev, p = 0, m = 0, w = 0, v = 0, b = 0, y = 0;
|
|
20983
|
+
for (h > 2 && (A[y = UZIP2.F._hash(e3, 0)] = 0), l2 = 0; l2 < h; l2++) {
|
|
20984
|
+
if (b = y, l2 + 1 < h - 2) {
|
|
20985
|
+
y = UZIP2.F._hash(e3, l2 + 1);
|
|
20986
|
+
var E = l2 + 1 & 32767;
|
|
20987
|
+
g[E] = A[y], A[y] = E;
|
|
20988
|
+
}
|
|
20989
|
+
if (u <= l2) {
|
|
20990
|
+
(p > 14e3 || m > 26697) && h - l2 > 100 && (u < l2 && (d[p] = l2 - u, p += 2, u = l2), c2 = UZIP2.F._writeBlock(l2 == h - 1 || u == h ? 1 : 0, d, p, v, e3, w, l2 - w, t2, c2), p = m = v = 0, w = l2);
|
|
20991
|
+
var F = 0;
|
|
20992
|
+
l2 < h - 2 && (F = UZIP2.F._bestMatch(e3, l2, g, b, Math.min(o2[2], h - l2), o2[3]));
|
|
20993
|
+
var _ = F >>> 16, B = 65535 & F;
|
|
20994
|
+
if (0 != F) {
|
|
20995
|
+
B = 65535 & F;
|
|
20996
|
+
var U2 = s2(_ = F >>> 16, a2.of0);
|
|
20997
|
+
a2.lhst[257 + U2]++;
|
|
20998
|
+
var C = s2(B, a2.df0);
|
|
20999
|
+
a2.dhst[C]++, v += a2.exb[U2] + a2.dxb[C], d[p] = _ << 23 | l2 - u, d[p + 1] = B << 16 | U2 << 8 | C, p += 2, u = l2 + _;
|
|
21000
|
+
} else a2.lhst[e3[l2]]++;
|
|
21001
|
+
m++;
|
|
21002
|
+
}
|
|
21003
|
+
}
|
|
21004
|
+
for (w == l2 && 0 != e3.length || (u < l2 && (d[p] = l2 - u, p += 2, u = l2), c2 = UZIP2.F._writeBlock(1, d, p, v, e3, w, l2 - w, t2, c2), p = 0, m = 0, p = m = v = 0, w = l2); 0 != (7 & c2); ) c2++;
|
|
21005
|
+
return c2 >>> 3;
|
|
21006
|
+
}, UZIP2.F._bestMatch = function(e3, t2, r3, i3, o2, a2) {
|
|
21007
|
+
var s2 = 32767 & t2, f2 = r3[s2], l2 = s2 - f2 + 32768 & 32767;
|
|
21008
|
+
if (f2 == s2 || i3 != UZIP2.F._hash(e3, t2 - l2)) return 0;
|
|
21009
|
+
for (var c2 = 0, u = 0, h = Math.min(32767, t2); l2 <= h && 0 != --a2 && f2 != s2; ) {
|
|
21010
|
+
if (0 == c2 || e3[t2 + c2] == e3[t2 + c2 - l2]) {
|
|
21011
|
+
var d = UZIP2.F._howLong(e3, t2, l2);
|
|
21012
|
+
if (d > c2) {
|
|
21013
|
+
if (u = l2, (c2 = d) >= o2) break;
|
|
21014
|
+
l2 + 2 < d && (d = l2 + 2);
|
|
21015
|
+
for (var A = 0, g = 0; g < d - 2; g++) {
|
|
21016
|
+
var p = t2 - l2 + g + 32768 & 32767, m = p - r3[p] + 32768 & 32767;
|
|
21017
|
+
m > A && (A = m, f2 = p);
|
|
21018
|
+
}
|
|
21019
|
+
}
|
|
21020
|
+
}
|
|
21021
|
+
l2 += (s2 = f2) - (f2 = r3[s2]) + 32768 & 32767;
|
|
21022
|
+
}
|
|
21023
|
+
return c2 << 16 | u;
|
|
21024
|
+
}, UZIP2.F._howLong = function(e3, t2, r3) {
|
|
21025
|
+
if (e3[t2] != e3[t2 - r3] || e3[t2 + 1] != e3[t2 + 1 - r3] || e3[t2 + 2] != e3[t2 + 2 - r3]) return 0;
|
|
21026
|
+
var i3 = t2, o2 = Math.min(e3.length, t2 + 258);
|
|
21027
|
+
for (t2 += 3; t2 < o2 && e3[t2] == e3[t2 - r3]; ) t2++;
|
|
21028
|
+
return t2 - i3;
|
|
21029
|
+
}, UZIP2.F._hash = function(e3, t2) {
|
|
21030
|
+
return (e3[t2] << 8 | e3[t2 + 1]) + (e3[t2 + 2] << 4) & 65535;
|
|
21031
|
+
}, UZIP2.saved = 0, UZIP2.F._writeBlock = function(e3, t2, r3, i3, o2, a2, s2, f2, l2) {
|
|
21032
|
+
var c2, u, h, d, A, g, p, m, w, v = UZIP2.F.U, b = UZIP2.F._putsF, y = UZIP2.F._putsE;
|
|
21033
|
+
v.lhst[256]++, u = (c2 = UZIP2.F.getTrees())[0], h = c2[1], d = c2[2], A = c2[3], g = c2[4], p = c2[5], m = c2[6], w = c2[7];
|
|
21034
|
+
var E = 32 + (0 == (l2 + 3 & 7) ? 0 : 8 - (l2 + 3 & 7)) + (s2 << 3), F = i3 + UZIP2.F.contSize(v.fltree, v.lhst) + UZIP2.F.contSize(v.fdtree, v.dhst), _ = i3 + UZIP2.F.contSize(v.ltree, v.lhst) + UZIP2.F.contSize(v.dtree, v.dhst);
|
|
21035
|
+
_ += 14 + 3 * p + UZIP2.F.contSize(v.itree, v.ihst) + (2 * v.ihst[16] + 3 * v.ihst[17] + 7 * v.ihst[18]);
|
|
21036
|
+
for (var B = 0; B < 286; B++) v.lhst[B] = 0;
|
|
21037
|
+
for (B = 0; B < 30; B++) v.dhst[B] = 0;
|
|
21038
|
+
for (B = 0; B < 19; B++) v.ihst[B] = 0;
|
|
21039
|
+
var U2 = E < F && E < _ ? 0 : F < _ ? 1 : 2;
|
|
21040
|
+
if (b(f2, l2, e3), b(f2, l2 + 1, U2), l2 += 3, 0 == U2) {
|
|
21041
|
+
for (; 0 != (7 & l2); ) l2++;
|
|
21042
|
+
l2 = UZIP2.F._copyExact(o2, a2, s2, f2, l2);
|
|
21043
|
+
} else {
|
|
21044
|
+
var C, I;
|
|
21045
|
+
if (1 == U2 && (C = v.fltree, I = v.fdtree), 2 == U2) {
|
|
21046
|
+
UZIP2.F.makeCodes(v.ltree, u), UZIP2.F.revCodes(v.ltree, u), UZIP2.F.makeCodes(v.dtree, h), UZIP2.F.revCodes(v.dtree, h), UZIP2.F.makeCodes(v.itree, d), UZIP2.F.revCodes(v.itree, d), C = v.ltree, I = v.dtree, y(f2, l2, A - 257), y(f2, l2 += 5, g - 1), y(f2, l2 += 5, p - 4), l2 += 4;
|
|
21047
|
+
for (var Q = 0; Q < p; Q++) y(f2, l2 + 3 * Q, v.itree[1 + (v.ordr[Q] << 1)]);
|
|
21048
|
+
l2 += 3 * p, l2 = UZIP2.F._codeTiny(m, v.itree, f2, l2), l2 = UZIP2.F._codeTiny(w, v.itree, f2, l2);
|
|
21049
|
+
}
|
|
21050
|
+
for (var M2 = a2, x2 = 0; x2 < r3; x2 += 2) {
|
|
21051
|
+
for (var S = t2[x2], R = S >>> 23, T = M2 + (8388607 & S); M2 < T; ) l2 = UZIP2.F._writeLit(o2[M2++], C, f2, l2);
|
|
21052
|
+
if (0 != R) {
|
|
21053
|
+
var O = t2[x2 + 1], P = O >> 16, H = O >> 8 & 255, L = 255 & O;
|
|
21054
|
+
y(f2, l2 = UZIP2.F._writeLit(257 + H, C, f2, l2), R - v.of0[H]), l2 += v.exb[H], b(f2, l2 = UZIP2.F._writeLit(L, I, f2, l2), P - v.df0[L]), l2 += v.dxb[L], M2 += R;
|
|
21055
|
+
}
|
|
21056
|
+
}
|
|
21057
|
+
l2 = UZIP2.F._writeLit(256, C, f2, l2);
|
|
21058
|
+
}
|
|
21059
|
+
return l2;
|
|
21060
|
+
}, UZIP2.F._copyExact = function(e3, t2, r3, i3, o2) {
|
|
21061
|
+
var a2 = o2 >>> 3;
|
|
21062
|
+
return i3[a2] = r3, i3[a2 + 1] = r3 >>> 8, i3[a2 + 2] = 255 - i3[a2], i3[a2 + 3] = 255 - i3[a2 + 1], a2 += 4, i3.set(new Uint8Array(e3.buffer, t2, r3), a2), o2 + (r3 + 4 << 3);
|
|
21063
|
+
}, UZIP2.F.getTrees = function() {
|
|
21064
|
+
for (var e3 = UZIP2.F.U, t2 = UZIP2.F._hufTree(e3.lhst, e3.ltree, 15), r3 = UZIP2.F._hufTree(e3.dhst, e3.dtree, 15), i3 = [], o2 = UZIP2.F._lenCodes(e3.ltree, i3), a2 = [], s2 = UZIP2.F._lenCodes(e3.dtree, a2), f2 = 0; f2 < i3.length; f2 += 2) e3.ihst[i3[f2]]++;
|
|
21065
|
+
for (f2 = 0; f2 < a2.length; f2 += 2) e3.ihst[a2[f2]]++;
|
|
21066
|
+
for (var l2 = UZIP2.F._hufTree(e3.ihst, e3.itree, 7), c2 = 19; c2 > 4 && 0 == e3.itree[1 + (e3.ordr[c2 - 1] << 1)]; ) c2--;
|
|
21067
|
+
return [t2, r3, l2, o2, s2, c2, i3, a2];
|
|
21068
|
+
}, UZIP2.F.getSecond = function(e3) {
|
|
21069
|
+
for (var t2 = [], r3 = 0; r3 < e3.length; r3 += 2) t2.push(e3[r3 + 1]);
|
|
21070
|
+
return t2;
|
|
21071
|
+
}, UZIP2.F.nonZero = function(e3) {
|
|
21072
|
+
for (var t2 = "", r3 = 0; r3 < e3.length; r3 += 2) 0 != e3[r3 + 1] && (t2 += (r3 >> 1) + ",");
|
|
21073
|
+
return t2;
|
|
21074
|
+
}, UZIP2.F.contSize = function(e3, t2) {
|
|
21075
|
+
for (var r3 = 0, i3 = 0; i3 < t2.length; i3++) r3 += t2[i3] * e3[1 + (i3 << 1)];
|
|
21076
|
+
return r3;
|
|
21077
|
+
}, UZIP2.F._codeTiny = function(e3, t2, r3, i3) {
|
|
21078
|
+
for (var o2 = 0; o2 < e3.length; o2 += 2) {
|
|
21079
|
+
var a2 = e3[o2], s2 = e3[o2 + 1];
|
|
21080
|
+
i3 = UZIP2.F._writeLit(a2, t2, r3, i3);
|
|
21081
|
+
var f2 = 16 == a2 ? 2 : 17 == a2 ? 3 : 7;
|
|
21082
|
+
a2 > 15 && (UZIP2.F._putsE(r3, i3, s2, f2), i3 += f2);
|
|
21083
|
+
}
|
|
21084
|
+
return i3;
|
|
21085
|
+
}, UZIP2.F._lenCodes = function(e3, t2) {
|
|
21086
|
+
for (var r3 = e3.length; 2 != r3 && 0 == e3[r3 - 1]; ) r3 -= 2;
|
|
21087
|
+
for (var i3 = 0; i3 < r3; i3 += 2) {
|
|
21088
|
+
var o2 = e3[i3 + 1], a2 = i3 + 3 < r3 ? e3[i3 + 3] : -1, s2 = i3 + 5 < r3 ? e3[i3 + 5] : -1, f2 = 0 == i3 ? -1 : e3[i3 - 1];
|
|
21089
|
+
if (0 == o2 && a2 == o2 && s2 == o2) {
|
|
21090
|
+
for (var l2 = i3 + 5; l2 + 2 < r3 && e3[l2 + 2] == o2; ) l2 += 2;
|
|
21091
|
+
(c2 = Math.min(l2 + 1 - i3 >>> 1, 138)) < 11 ? t2.push(17, c2 - 3) : t2.push(18, c2 - 11), i3 += 2 * c2 - 2;
|
|
21092
|
+
} else if (o2 == f2 && a2 == o2 && s2 == o2) {
|
|
21093
|
+
for (l2 = i3 + 5; l2 + 2 < r3 && e3[l2 + 2] == o2; ) l2 += 2;
|
|
21094
|
+
var c2 = Math.min(l2 + 1 - i3 >>> 1, 6);
|
|
21095
|
+
t2.push(16, c2 - 3), i3 += 2 * c2 - 2;
|
|
21096
|
+
} else t2.push(o2, 0);
|
|
21097
|
+
}
|
|
21098
|
+
return r3 >>> 1;
|
|
21099
|
+
}, UZIP2.F._hufTree = function(e3, t2, r3) {
|
|
21100
|
+
var i3 = [], o2 = e3.length, a2 = t2.length, s2 = 0;
|
|
21101
|
+
for (s2 = 0; s2 < a2; s2 += 2) t2[s2] = 0, t2[s2 + 1] = 0;
|
|
21102
|
+
for (s2 = 0; s2 < o2; s2++) 0 != e3[s2] && i3.push({ lit: s2, f: e3[s2] });
|
|
21103
|
+
var f2 = i3.length, l2 = i3.slice(0);
|
|
21104
|
+
if (0 == f2) return 0;
|
|
21105
|
+
if (1 == f2) {
|
|
21106
|
+
var c2 = i3[0].lit;
|
|
21107
|
+
l2 = 0 == c2 ? 1 : 0;
|
|
21108
|
+
return t2[1 + (c2 << 1)] = 1, t2[1 + (l2 << 1)] = 1, 1;
|
|
21109
|
+
}
|
|
21110
|
+
i3.sort((function(e4, t3) {
|
|
21111
|
+
return e4.f - t3.f;
|
|
21112
|
+
}));
|
|
21113
|
+
var u = i3[0], h = i3[1], d = 0, A = 1, g = 2;
|
|
21114
|
+
for (i3[0] = { lit: -1, f: u.f + h.f, l: u, r: h, d: 0 }; A != f2 - 1; ) u = d != A && (g == f2 || i3[d].f < i3[g].f) ? i3[d++] : i3[g++], h = d != A && (g == f2 || i3[d].f < i3[g].f) ? i3[d++] : i3[g++], i3[A++] = { lit: -1, f: u.f + h.f, l: u, r: h };
|
|
21115
|
+
var p = UZIP2.F.setDepth(i3[A - 1], 0);
|
|
21116
|
+
for (p > r3 && (UZIP2.F.restrictDepth(l2, r3, p), p = r3), s2 = 0; s2 < f2; s2++) t2[1 + (l2[s2].lit << 1)] = l2[s2].d;
|
|
21117
|
+
return p;
|
|
21118
|
+
}, UZIP2.F.setDepth = function(e3, t2) {
|
|
21119
|
+
return -1 != e3.lit ? (e3.d = t2, t2) : Math.max(UZIP2.F.setDepth(e3.l, t2 + 1), UZIP2.F.setDepth(e3.r, t2 + 1));
|
|
21120
|
+
}, UZIP2.F.restrictDepth = function(e3, t2, r3) {
|
|
21121
|
+
var i3 = 0, o2 = 1 << r3 - t2, a2 = 0;
|
|
21122
|
+
for (e3.sort((function(e4, t3) {
|
|
21123
|
+
return t3.d == e4.d ? e4.f - t3.f : t3.d - e4.d;
|
|
21124
|
+
})), i3 = 0; i3 < e3.length && e3[i3].d > t2; i3++) {
|
|
21125
|
+
var s2 = e3[i3].d;
|
|
21126
|
+
e3[i3].d = t2, a2 += o2 - (1 << r3 - s2);
|
|
21127
|
+
}
|
|
21128
|
+
for (a2 >>>= r3 - t2; a2 > 0; ) {
|
|
21129
|
+
(s2 = e3[i3].d) < t2 ? (e3[i3].d++, a2 -= 1 << t2 - s2 - 1) : i3++;
|
|
21130
|
+
}
|
|
21131
|
+
for (; i3 >= 0; i3--) e3[i3].d == t2 && a2 < 0 && (e3[i3].d--, a2++);
|
|
21132
|
+
0 != a2 && void 0;
|
|
21133
|
+
}, UZIP2.F._goodIndex = function(e3, t2) {
|
|
21134
|
+
var r3 = 0;
|
|
21135
|
+
return t2[16 | r3] <= e3 && (r3 |= 16), t2[8 | r3] <= e3 && (r3 |= 8), t2[4 | r3] <= e3 && (r3 |= 4), t2[2 | r3] <= e3 && (r3 |= 2), t2[1 | r3] <= e3 && (r3 |= 1), r3;
|
|
21136
|
+
}, UZIP2.F._writeLit = function(e3, t2, r3, i3) {
|
|
21137
|
+
return UZIP2.F._putsF(r3, i3, t2[e3 << 1]), i3 + t2[1 + (e3 << 1)];
|
|
21138
|
+
}, UZIP2.F.inflate = function(e3, t2) {
|
|
21139
|
+
var r3 = Uint8Array;
|
|
21140
|
+
if (3 == e3[0] && 0 == e3[1]) return t2 || new r3(0);
|
|
21141
|
+
var i3 = UZIP2.F, o2 = i3._bitsF, a2 = i3._bitsE, s2 = i3._decodeTiny, f2 = i3.makeCodes, l2 = i3.codes2map, c2 = i3._get17, u = i3.U, h = null == t2;
|
|
21142
|
+
h && (t2 = new r3(e3.length >>> 2 << 3));
|
|
21143
|
+
for (var d, A, g = 0, p = 0, m = 0, w = 0, v = 0, b = 0, y = 0, E = 0, F = 0; 0 == g; ) if (g = o2(e3, F, 1), p = o2(e3, F + 1, 2), F += 3, 0 != p) {
|
|
21144
|
+
if (h && (t2 = UZIP2.F._check(t2, E + (1 << 17))), 1 == p && (d = u.flmap, A = u.fdmap, b = 511, y = 31), 2 == p) {
|
|
21145
|
+
m = a2(e3, F, 5) + 257, w = a2(e3, F + 5, 5) + 1, v = a2(e3, F + 10, 4) + 4, F += 14;
|
|
21146
|
+
for (var _ = 0; _ < 38; _ += 2) u.itree[_] = 0, u.itree[_ + 1] = 0;
|
|
21147
|
+
var B = 1;
|
|
21148
|
+
for (_ = 0; _ < v; _++) {
|
|
21149
|
+
var U2 = a2(e3, F + 3 * _, 3);
|
|
21150
|
+
u.itree[1 + (u.ordr[_] << 1)] = U2, U2 > B && (B = U2);
|
|
21151
|
+
}
|
|
21152
|
+
F += 3 * v, f2(u.itree, B), l2(u.itree, B, u.imap), d = u.lmap, A = u.dmap, F = s2(u.imap, (1 << B) - 1, m + w, e3, F, u.ttree);
|
|
21153
|
+
var C = i3._copyOut(u.ttree, 0, m, u.ltree);
|
|
21154
|
+
b = (1 << C) - 1;
|
|
21155
|
+
var I = i3._copyOut(u.ttree, m, w, u.dtree);
|
|
21156
|
+
y = (1 << I) - 1, f2(u.ltree, C), l2(u.ltree, C, d), f2(u.dtree, I), l2(u.dtree, I, A);
|
|
21157
|
+
}
|
|
21158
|
+
for (; ; ) {
|
|
21159
|
+
var Q = d[c2(e3, F) & b];
|
|
21160
|
+
F += 15 & Q;
|
|
21161
|
+
var M2 = Q >>> 4;
|
|
21162
|
+
if (M2 >>> 8 == 0) t2[E++] = M2;
|
|
21163
|
+
else {
|
|
21164
|
+
if (256 == M2) break;
|
|
21165
|
+
var x2 = E + M2 - 254;
|
|
21166
|
+
if (M2 > 264) {
|
|
21167
|
+
var S = u.ldef[M2 - 257];
|
|
21168
|
+
x2 = E + (S >>> 3) + a2(e3, F, 7 & S), F += 7 & S;
|
|
21169
|
+
}
|
|
21170
|
+
var R = A[c2(e3, F) & y];
|
|
21171
|
+
F += 15 & R;
|
|
21172
|
+
var T = R >>> 4, O = u.ddef[T], P = (O >>> 4) + o2(e3, F, 15 & O);
|
|
21173
|
+
for (F += 15 & O, h && (t2 = UZIP2.F._check(t2, E + (1 << 17))); E < x2; ) t2[E] = t2[E++ - P], t2[E] = t2[E++ - P], t2[E] = t2[E++ - P], t2[E] = t2[E++ - P];
|
|
21174
|
+
E = x2;
|
|
21175
|
+
}
|
|
21176
|
+
}
|
|
21177
|
+
} else {
|
|
21178
|
+
0 != (7 & F) && (F += 8 - (7 & F));
|
|
21179
|
+
var H = 4 + (F >>> 3), L = e3[H - 4] | e3[H - 3] << 8;
|
|
21180
|
+
h && (t2 = UZIP2.F._check(t2, E + L)), t2.set(new r3(e3.buffer, e3.byteOffset + H, L), E), F = H + L << 3, E += L;
|
|
21181
|
+
}
|
|
21182
|
+
return t2.length == E ? t2 : t2.slice(0, E);
|
|
21183
|
+
}, UZIP2.F._check = function(e3, t2) {
|
|
21184
|
+
var r3 = e3.length;
|
|
21185
|
+
if (t2 <= r3) return e3;
|
|
21186
|
+
var i3 = new Uint8Array(Math.max(r3 << 1, t2));
|
|
21187
|
+
return i3.set(e3, 0), i3;
|
|
21188
|
+
}, UZIP2.F._decodeTiny = function(e3, t2, r3, i3, o2, a2) {
|
|
21189
|
+
for (var s2 = UZIP2.F._bitsE, f2 = UZIP2.F._get17, l2 = 0; l2 < r3; ) {
|
|
21190
|
+
var c2 = e3[f2(i3, o2) & t2];
|
|
21191
|
+
o2 += 15 & c2;
|
|
21192
|
+
var u = c2 >>> 4;
|
|
21193
|
+
if (u <= 15) a2[l2] = u, l2++;
|
|
21194
|
+
else {
|
|
21195
|
+
var h = 0, d = 0;
|
|
21196
|
+
16 == u ? (d = 3 + s2(i3, o2, 2), o2 += 2, h = a2[l2 - 1]) : 17 == u ? (d = 3 + s2(i3, o2, 3), o2 += 3) : 18 == u && (d = 11 + s2(i3, o2, 7), o2 += 7);
|
|
21197
|
+
for (var A = l2 + d; l2 < A; ) a2[l2] = h, l2++;
|
|
21198
|
+
}
|
|
21199
|
+
}
|
|
21200
|
+
return o2;
|
|
21201
|
+
}, UZIP2.F._copyOut = function(e3, t2, r3, i3) {
|
|
21202
|
+
for (var o2 = 0, a2 = 0, s2 = i3.length >>> 1; a2 < r3; ) {
|
|
21203
|
+
var f2 = e3[a2 + t2];
|
|
21204
|
+
i3[a2 << 1] = 0, i3[1 + (a2 << 1)] = f2, f2 > o2 && (o2 = f2), a2++;
|
|
21205
|
+
}
|
|
21206
|
+
for (; a2 < s2; ) i3[a2 << 1] = 0, i3[1 + (a2 << 1)] = 0, a2++;
|
|
21207
|
+
return o2;
|
|
21208
|
+
}, UZIP2.F.makeCodes = function(e3, t2) {
|
|
21209
|
+
for (var r3, i3, o2, a2, s2 = UZIP2.F.U, f2 = e3.length, l2 = s2.bl_count, c2 = 0; c2 <= t2; c2++) l2[c2] = 0;
|
|
21210
|
+
for (c2 = 1; c2 < f2; c2 += 2) l2[e3[c2]]++;
|
|
21211
|
+
var u = s2.next_code;
|
|
21212
|
+
for (r3 = 0, l2[0] = 0, i3 = 1; i3 <= t2; i3++) r3 = r3 + l2[i3 - 1] << 1, u[i3] = r3;
|
|
21213
|
+
for (o2 = 0; o2 < f2; o2 += 2) 0 != (a2 = e3[o2 + 1]) && (e3[o2] = u[a2], u[a2]++);
|
|
21214
|
+
}, UZIP2.F.codes2map = function(e3, t2, r3) {
|
|
21215
|
+
for (var i3 = e3.length, o2 = UZIP2.F.U.rev15, a2 = 0; a2 < i3; a2 += 2) if (0 != e3[a2 + 1]) for (var s2 = a2 >> 1, f2 = e3[a2 + 1], l2 = s2 << 4 | f2, c2 = t2 - f2, u = e3[a2] << c2, h = u + (1 << c2); u != h; ) {
|
|
21216
|
+
r3[o2[u] >>> 15 - t2] = l2, u++;
|
|
21217
|
+
}
|
|
21218
|
+
}, UZIP2.F.revCodes = function(e3, t2) {
|
|
21219
|
+
for (var r3 = UZIP2.F.U.rev15, i3 = 15 - t2, o2 = 0; o2 < e3.length; o2 += 2) {
|
|
21220
|
+
var a2 = e3[o2] << t2 - e3[o2 + 1];
|
|
21221
|
+
e3[o2] = r3[a2] >>> i3;
|
|
21222
|
+
}
|
|
21223
|
+
}, UZIP2.F._putsE = function(e3, t2, r3) {
|
|
21224
|
+
r3 <<= 7 & t2;
|
|
21225
|
+
var i3 = t2 >>> 3;
|
|
21226
|
+
e3[i3] |= r3, e3[i3 + 1] |= r3 >>> 8;
|
|
21227
|
+
}, UZIP2.F._putsF = function(e3, t2, r3) {
|
|
21228
|
+
r3 <<= 7 & t2;
|
|
21229
|
+
var i3 = t2 >>> 3;
|
|
21230
|
+
e3[i3] |= r3, e3[i3 + 1] |= r3 >>> 8, e3[i3 + 2] |= r3 >>> 16;
|
|
21231
|
+
}, UZIP2.F._bitsE = function(e3, t2, r3) {
|
|
21232
|
+
return (e3[t2 >>> 3] | e3[1 + (t2 >>> 3)] << 8) >>> (7 & t2) & (1 << r3) - 1;
|
|
21233
|
+
}, UZIP2.F._bitsF = function(e3, t2, r3) {
|
|
21234
|
+
return (e3[t2 >>> 3] | e3[1 + (t2 >>> 3)] << 8 | e3[2 + (t2 >>> 3)] << 16) >>> (7 & t2) & (1 << r3) - 1;
|
|
21235
|
+
}, UZIP2.F._get17 = function(e3, t2) {
|
|
21236
|
+
return (e3[t2 >>> 3] | e3[1 + (t2 >>> 3)] << 8 | e3[2 + (t2 >>> 3)] << 16) >>> (7 & t2);
|
|
21237
|
+
}, UZIP2.F._get25 = function(e3, t2) {
|
|
21238
|
+
return (e3[t2 >>> 3] | e3[1 + (t2 >>> 3)] << 8 | e3[2 + (t2 >>> 3)] << 16 | e3[3 + (t2 >>> 3)] << 24) >>> (7 & t2);
|
|
21239
|
+
}, UZIP2.F.U = (r2 = Uint16Array, i2 = Uint32Array, { next_code: new r2(16), bl_count: new r2(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 r2(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 i2(32), flmap: new r2(512), fltree: [], fdmap: new r2(32), fdtree: [], lmap: new r2(32768), ltree: [], ttree: [], dmap: new r2(32768), dtree: [], imap: new r2(512), itree: [], rev15: new r2(32768), lhst: new i2(286), dhst: new i2(30), ihst: new i2(19), lits: new i2(15e3), strt: new r2(65536), prev: new r2(32768) }), (function() {
|
|
21240
|
+
for (var e3 = UZIP2.F.U, t2 = 0; t2 < 32768; t2++) {
|
|
21241
|
+
var r3 = t2;
|
|
21242
|
+
r3 = (4278255360 & (r3 = (4042322160 & (r3 = (3435973836 & (r3 = (2863311530 & r3) >>> 1 | (1431655765 & r3) << 1)) >>> 2 | (858993459 & r3) << 2)) >>> 4 | (252645135 & r3) << 4)) >>> 8 | (16711935 & r3) << 8, e3.rev15[t2] = (r3 >>> 16 | r3 << 16) >>> 17;
|
|
21243
|
+
}
|
|
21244
|
+
function pushV(e4, t3, r4) {
|
|
21245
|
+
for (; 0 != t3--; ) e4.push(0, r4);
|
|
21246
|
+
}
|
|
21247
|
+
for (t2 = 0; t2 < 32; t2++) e3.ldef[t2] = e3.of0[t2] << 3 | e3.exb[t2], e3.ddef[t2] = e3.df0[t2] << 4 | e3.dxb[t2];
|
|
21248
|
+
pushV(e3.fltree, 144, 8), pushV(e3.fltree, 112, 9), pushV(e3.fltree, 24, 7), pushV(e3.fltree, 8, 8), UZIP2.F.makeCodes(e3.fltree, 9), UZIP2.F.codes2map(e3.fltree, 9, e3.flmap), UZIP2.F.revCodes(e3.fltree, 9), pushV(e3.fdtree, 32, 5), UZIP2.F.makeCodes(e3.fdtree, 5), UZIP2.F.codes2map(e3.fdtree, 5, e3.fdmap), UZIP2.F.revCodes(e3.fdtree, 5), pushV(e3.itree, 19, 0), pushV(e3.ltree, 286, 0), pushV(e3.dtree, 30, 0), pushV(e3.ttree, 320, 0);
|
|
21249
|
+
})();
|
|
21250
|
+
})();
|
|
21251
|
+
var UZIP = _mergeNamespaces({ __proto__: null, default: e }, [e]);
|
|
21252
|
+
const UPNG = (function() {
|
|
21253
|
+
var e2 = { nextZero(e3, t3) {
|
|
21254
|
+
for (; 0 != e3[t3]; ) t3++;
|
|
21255
|
+
return t3;
|
|
21256
|
+
}, readUshort: (e3, t3) => e3[t3] << 8 | e3[t3 + 1], writeUshort(e3, t3, r2) {
|
|
21257
|
+
e3[t3] = r2 >> 8 & 255, e3[t3 + 1] = 255 & r2;
|
|
21258
|
+
}, readUint: (e3, t3) => 16777216 * e3[t3] + (e3[t3 + 1] << 16 | e3[t3 + 2] << 8 | e3[t3 + 3]), writeUint(e3, t3, r2) {
|
|
21259
|
+
e3[t3] = r2 >> 24 & 255, e3[t3 + 1] = r2 >> 16 & 255, e3[t3 + 2] = r2 >> 8 & 255, e3[t3 + 3] = 255 & r2;
|
|
21260
|
+
}, readASCII(e3, t3, r2) {
|
|
21261
|
+
let i2 = "";
|
|
21262
|
+
for (let o2 = 0; o2 < r2; o2++) i2 += String.fromCharCode(e3[t3 + o2]);
|
|
21263
|
+
return i2;
|
|
21264
|
+
}, writeASCII(e3, t3, r2) {
|
|
21265
|
+
for (let i2 = 0; i2 < r2.length; i2++) e3[t3 + i2] = r2.charCodeAt(i2);
|
|
21266
|
+
}, readBytes(e3, t3, r2) {
|
|
21267
|
+
const i2 = [];
|
|
21268
|
+
for (let o2 = 0; o2 < r2; o2++) i2.push(e3[t3 + o2]);
|
|
21269
|
+
return i2;
|
|
21270
|
+
}, pad: (e3) => e3.length < 2 ? `0${e3}` : e3, readUTF8(t3, r2, i2) {
|
|
21271
|
+
let o2, a2 = "";
|
|
21272
|
+
for (let o3 = 0; o3 < i2; o3++) a2 += `%${e2.pad(t3[r2 + o3].toString(16))}`;
|
|
21273
|
+
try {
|
|
21274
|
+
o2 = decodeURIComponent(a2);
|
|
21275
|
+
} catch (o3) {
|
|
21276
|
+
return e2.readASCII(t3, r2, i2);
|
|
21277
|
+
}
|
|
21278
|
+
return o2;
|
|
21279
|
+
} };
|
|
21280
|
+
function decodeImage(t3, r2, i2, o2) {
|
|
21281
|
+
const a2 = r2 * i2, s2 = _getBPP(o2), f2 = Math.ceil(r2 * s2 / 8), l2 = new Uint8Array(4 * a2), c2 = new Uint32Array(l2.buffer), { ctype: u } = o2, { depth: h } = o2, d = e2.readUshort;
|
|
21282
|
+
if (6 == u) {
|
|
21283
|
+
const e3 = a2 << 2;
|
|
21284
|
+
if (8 == h) for (var A = 0; A < e3; A += 4) l2[A] = t3[A], l2[A + 1] = t3[A + 1], l2[A + 2] = t3[A + 2], l2[A + 3] = t3[A + 3];
|
|
21285
|
+
if (16 == h) for (A = 0; A < e3; A++) l2[A] = t3[A << 1];
|
|
21286
|
+
} else if (2 == u) {
|
|
21287
|
+
const e3 = o2.tabs.tRNS;
|
|
21288
|
+
if (null == e3) {
|
|
21289
|
+
if (8 == h) for (A = 0; A < a2; A++) {
|
|
21290
|
+
var g = 3 * A;
|
|
21291
|
+
c2[A] = 255 << 24 | t3[g + 2] << 16 | t3[g + 1] << 8 | t3[g];
|
|
21292
|
+
}
|
|
21293
|
+
if (16 == h) for (A = 0; A < a2; A++) {
|
|
21294
|
+
g = 6 * A;
|
|
21295
|
+
c2[A] = 255 << 24 | t3[g + 4] << 16 | t3[g + 2] << 8 | t3[g];
|
|
21296
|
+
}
|
|
21297
|
+
} else {
|
|
21298
|
+
var p = e3[0];
|
|
21299
|
+
const r3 = e3[1], i3 = e3[2];
|
|
21300
|
+
if (8 == h) for (A = 0; A < a2; A++) {
|
|
21301
|
+
var m = A << 2;
|
|
21302
|
+
g = 3 * A;
|
|
21303
|
+
c2[A] = 255 << 24 | t3[g + 2] << 16 | t3[g + 1] << 8 | t3[g], t3[g] == p && t3[g + 1] == r3 && t3[g + 2] == i3 && (l2[m + 3] = 0);
|
|
21304
|
+
}
|
|
21305
|
+
if (16 == h) for (A = 0; A < a2; A++) {
|
|
21306
|
+
m = A << 2, g = 6 * A;
|
|
21307
|
+
c2[A] = 255 << 24 | t3[g + 4] << 16 | t3[g + 2] << 8 | t3[g], d(t3, g) == p && d(t3, g + 2) == r3 && d(t3, g + 4) == i3 && (l2[m + 3] = 0);
|
|
21308
|
+
}
|
|
21309
|
+
}
|
|
21310
|
+
} else if (3 == u) {
|
|
21311
|
+
const e3 = o2.tabs.PLTE, s3 = o2.tabs.tRNS, c3 = s3 ? s3.length : 0;
|
|
21312
|
+
if (1 == h) for (var w = 0; w < i2; w++) {
|
|
21313
|
+
var v = w * f2, b = w * r2;
|
|
21314
|
+
for (A = 0; A < r2; A++) {
|
|
21315
|
+
m = b + A << 2;
|
|
21316
|
+
var y = 3 * (E = t3[v + (A >> 3)] >> 7 - ((7 & A) << 0) & 1);
|
|
21317
|
+
l2[m] = e3[y], l2[m + 1] = e3[y + 1], l2[m + 2] = e3[y + 2], l2[m + 3] = E < c3 ? s3[E] : 255;
|
|
21318
|
+
}
|
|
21319
|
+
}
|
|
21320
|
+
if (2 == h) for (w = 0; w < i2; w++) for (v = w * f2, b = w * r2, A = 0; A < r2; A++) {
|
|
21321
|
+
m = b + A << 2, y = 3 * (E = t3[v + (A >> 2)] >> 6 - ((3 & A) << 1) & 3);
|
|
21322
|
+
l2[m] = e3[y], l2[m + 1] = e3[y + 1], l2[m + 2] = e3[y + 2], l2[m + 3] = E < c3 ? s3[E] : 255;
|
|
21323
|
+
}
|
|
21324
|
+
if (4 == h) for (w = 0; w < i2; w++) for (v = w * f2, b = w * r2, A = 0; A < r2; A++) {
|
|
21325
|
+
m = b + A << 2, y = 3 * (E = t3[v + (A >> 1)] >> 4 - ((1 & A) << 2) & 15);
|
|
21326
|
+
l2[m] = e3[y], l2[m + 1] = e3[y + 1], l2[m + 2] = e3[y + 2], l2[m + 3] = E < c3 ? s3[E] : 255;
|
|
21327
|
+
}
|
|
21328
|
+
if (8 == h) for (A = 0; A < a2; A++) {
|
|
21329
|
+
var E;
|
|
21330
|
+
m = A << 2, y = 3 * (E = t3[A]);
|
|
21331
|
+
l2[m] = e3[y], l2[m + 1] = e3[y + 1], l2[m + 2] = e3[y + 2], l2[m + 3] = E < c3 ? s3[E] : 255;
|
|
21332
|
+
}
|
|
21333
|
+
} else if (4 == u) {
|
|
21334
|
+
if (8 == h) for (A = 0; A < a2; A++) {
|
|
21335
|
+
m = A << 2;
|
|
21336
|
+
var F = t3[_ = A << 1];
|
|
21337
|
+
l2[m] = F, l2[m + 1] = F, l2[m + 2] = F, l2[m + 3] = t3[_ + 1];
|
|
21338
|
+
}
|
|
21339
|
+
if (16 == h) for (A = 0; A < a2; A++) {
|
|
21340
|
+
var _;
|
|
21341
|
+
m = A << 2, F = t3[_ = A << 2];
|
|
21342
|
+
l2[m] = F, l2[m + 1] = F, l2[m + 2] = F, l2[m + 3] = t3[_ + 2];
|
|
21343
|
+
}
|
|
21344
|
+
} else if (0 == u) for (p = o2.tabs.tRNS ? o2.tabs.tRNS : -1, w = 0; w < i2; w++) {
|
|
21345
|
+
const e3 = w * f2, i3 = w * r2;
|
|
21346
|
+
if (1 == h) for (var B = 0; B < r2; B++) {
|
|
21347
|
+
var U2 = (F = 255 * (t3[e3 + (B >>> 3)] >>> 7 - (7 & B) & 1)) == 255 * p ? 0 : 255;
|
|
21348
|
+
c2[i3 + B] = U2 << 24 | F << 16 | F << 8 | F;
|
|
21349
|
+
}
|
|
21350
|
+
else if (2 == h) for (B = 0; B < r2; B++) {
|
|
21351
|
+
U2 = (F = 85 * (t3[e3 + (B >>> 2)] >>> 6 - ((3 & B) << 1) & 3)) == 85 * p ? 0 : 255;
|
|
21352
|
+
c2[i3 + B] = U2 << 24 | F << 16 | F << 8 | F;
|
|
21353
|
+
}
|
|
21354
|
+
else if (4 == h) for (B = 0; B < r2; B++) {
|
|
21355
|
+
U2 = (F = 17 * (t3[e3 + (B >>> 1)] >>> 4 - ((1 & B) << 2) & 15)) == 17 * p ? 0 : 255;
|
|
21356
|
+
c2[i3 + B] = U2 << 24 | F << 16 | F << 8 | F;
|
|
21357
|
+
}
|
|
21358
|
+
else if (8 == h) for (B = 0; B < r2; B++) {
|
|
21359
|
+
U2 = (F = t3[e3 + B]) == p ? 0 : 255;
|
|
21360
|
+
c2[i3 + B] = U2 << 24 | F << 16 | F << 8 | F;
|
|
21361
|
+
}
|
|
21362
|
+
else if (16 == h) for (B = 0; B < r2; B++) {
|
|
21363
|
+
F = t3[e3 + (B << 1)], U2 = d(t3, e3 + (B << 1)) == p ? 0 : 255;
|
|
21364
|
+
c2[i3 + B] = U2 << 24 | F << 16 | F << 8 | F;
|
|
21365
|
+
}
|
|
21366
|
+
}
|
|
21367
|
+
return l2;
|
|
21368
|
+
}
|
|
21369
|
+
function _decompress(e3, r2, i2, o2) {
|
|
21370
|
+
const a2 = _getBPP(e3), s2 = Math.ceil(i2 * a2 / 8), f2 = new Uint8Array((s2 + 1 + e3.interlace) * o2);
|
|
21371
|
+
return r2 = e3.tabs.CgBI ? t2(r2, f2) : _inflate(r2, f2), 0 == e3.interlace ? r2 = _filterZero(r2, e3, 0, i2, o2) : 1 == e3.interlace && (r2 = (function _readInterlace(e4, t3) {
|
|
21372
|
+
const r3 = t3.width, i3 = t3.height, o3 = _getBPP(t3), a3 = o3 >> 3, s3 = Math.ceil(r3 * o3 / 8), f3 = new Uint8Array(i3 * s3);
|
|
21373
|
+
let l2 = 0;
|
|
21374
|
+
const c2 = [0, 0, 4, 0, 2, 0, 1], u = [0, 4, 0, 2, 0, 1, 0], h = [8, 8, 8, 4, 4, 2, 2], d = [8, 8, 4, 4, 2, 2, 1];
|
|
21375
|
+
let A = 0;
|
|
21376
|
+
for (; A < 7; ) {
|
|
21377
|
+
const p = h[A], m = d[A];
|
|
21378
|
+
let w = 0, v = 0, b = c2[A];
|
|
21379
|
+
for (; b < i3; ) b += p, v++;
|
|
21380
|
+
let y = u[A];
|
|
21381
|
+
for (; y < r3; ) y += m, w++;
|
|
21382
|
+
const E = Math.ceil(w * o3 / 8);
|
|
21383
|
+
_filterZero(e4, t3, l2, w, v);
|
|
21384
|
+
let F = 0, _ = c2[A];
|
|
21385
|
+
for (; _ < i3; ) {
|
|
21386
|
+
let t4 = u[A], i4 = l2 + F * E << 3;
|
|
21387
|
+
for (; t4 < r3; ) {
|
|
21388
|
+
var g;
|
|
21389
|
+
if (1 == o3) g = (g = e4[i4 >> 3]) >> 7 - (7 & i4) & 1, f3[_ * s3 + (t4 >> 3)] |= g << 7 - ((7 & t4) << 0);
|
|
21390
|
+
if (2 == o3) g = (g = e4[i4 >> 3]) >> 6 - (7 & i4) & 3, f3[_ * s3 + (t4 >> 2)] |= g << 6 - ((3 & t4) << 1);
|
|
21391
|
+
if (4 == o3) g = (g = e4[i4 >> 3]) >> 4 - (7 & i4) & 15, f3[_ * s3 + (t4 >> 1)] |= g << 4 - ((1 & t4) << 2);
|
|
21392
|
+
if (o3 >= 8) {
|
|
21393
|
+
const r4 = _ * s3 + t4 * a3;
|
|
21394
|
+
for (let t5 = 0; t5 < a3; t5++) f3[r4 + t5] = e4[(i4 >> 3) + t5];
|
|
21395
|
+
}
|
|
21396
|
+
i4 += o3, t4 += m;
|
|
21397
|
+
}
|
|
21398
|
+
F++, _ += p;
|
|
21399
|
+
}
|
|
21400
|
+
w * v != 0 && (l2 += v * (1 + E)), A += 1;
|
|
21401
|
+
}
|
|
21402
|
+
return f3;
|
|
21403
|
+
})(r2, e3)), r2;
|
|
21404
|
+
}
|
|
21405
|
+
function _inflate(e3, r2) {
|
|
21406
|
+
return t2(new Uint8Array(e3.buffer, 2, e3.length - 6), r2);
|
|
21407
|
+
}
|
|
21408
|
+
var t2 = (function() {
|
|
21409
|
+
const e3 = { H: {} };
|
|
21410
|
+
return e3.H.N = function(t3, r2) {
|
|
21411
|
+
const i2 = Uint8Array;
|
|
21412
|
+
let o2, a2, s2 = 0, f2 = 0, l2 = 0, c2 = 0, u = 0, h = 0, d = 0, A = 0, g = 0;
|
|
21413
|
+
if (3 == t3[0] && 0 == t3[1]) return r2 || new i2(0);
|
|
21414
|
+
const p = e3.H, m = p.b, w = p.e, v = p.R, b = p.n, y = p.A, E = p.Z, F = p.m, _ = null == r2;
|
|
21415
|
+
for (_ && (r2 = new i2(t3.length >>> 2 << 5)); 0 == s2; ) if (s2 = m(t3, g, 1), f2 = m(t3, g + 1, 2), g += 3, 0 != f2) {
|
|
21416
|
+
if (_ && (r2 = e3.H.W(r2, A + (1 << 17))), 1 == f2 && (o2 = F.J, a2 = F.h, h = 511, d = 31), 2 == f2) {
|
|
21417
|
+
l2 = w(t3, g, 5) + 257, c2 = w(t3, g + 5, 5) + 1, u = w(t3, g + 10, 4) + 4, g += 14;
|
|
21418
|
+
let e4 = 1;
|
|
21419
|
+
for (var B = 0; B < 38; B += 2) F.Q[B] = 0, F.Q[B + 1] = 0;
|
|
21420
|
+
for (B = 0; B < u; B++) {
|
|
21421
|
+
const r4 = w(t3, g + 3 * B, 3);
|
|
21422
|
+
F.Q[1 + (F.X[B] << 1)] = r4, r4 > e4 && (e4 = r4);
|
|
21423
|
+
}
|
|
21424
|
+
g += 3 * u, b(F.Q, e4), y(F.Q, e4, F.u), o2 = F.w, a2 = F.d, g = v(F.u, (1 << e4) - 1, l2 + c2, t3, g, F.v);
|
|
21425
|
+
const r3 = p.V(F.v, 0, l2, F.C);
|
|
21426
|
+
h = (1 << r3) - 1;
|
|
21427
|
+
const i3 = p.V(F.v, l2, c2, F.D);
|
|
21428
|
+
d = (1 << i3) - 1, b(F.C, r3), y(F.C, r3, o2), b(F.D, i3), y(F.D, i3, a2);
|
|
21429
|
+
}
|
|
21430
|
+
for (; ; ) {
|
|
21431
|
+
const e4 = o2[E(t3, g) & h];
|
|
21432
|
+
g += 15 & e4;
|
|
21433
|
+
const i3 = e4 >>> 4;
|
|
21434
|
+
if (i3 >>> 8 == 0) r2[A++] = i3;
|
|
21435
|
+
else {
|
|
21436
|
+
if (256 == i3) break;
|
|
21437
|
+
{
|
|
21438
|
+
let e5 = A + i3 - 254;
|
|
21439
|
+
if (i3 > 264) {
|
|
21440
|
+
const r3 = F.q[i3 - 257];
|
|
21441
|
+
e5 = A + (r3 >>> 3) + w(t3, g, 7 & r3), g += 7 & r3;
|
|
21442
|
+
}
|
|
21443
|
+
const o3 = a2[E(t3, g) & d];
|
|
21444
|
+
g += 15 & o3;
|
|
21445
|
+
const s3 = o3 >>> 4, f3 = F.c[s3], l3 = (f3 >>> 4) + m(t3, g, 15 & f3);
|
|
21446
|
+
for (g += 15 & f3; A < e5; ) r2[A] = r2[A++ - l3], r2[A] = r2[A++ - l3], r2[A] = r2[A++ - l3], r2[A] = r2[A++ - l3];
|
|
21447
|
+
A = e5;
|
|
21448
|
+
}
|
|
21449
|
+
}
|
|
21450
|
+
}
|
|
21451
|
+
} else {
|
|
21452
|
+
0 != (7 & g) && (g += 8 - (7 & g));
|
|
21453
|
+
const o3 = 4 + (g >>> 3), a3 = t3[o3 - 4] | t3[o3 - 3] << 8;
|
|
21454
|
+
_ && (r2 = e3.H.W(r2, A + a3)), r2.set(new i2(t3.buffer, t3.byteOffset + o3, a3), A), g = o3 + a3 << 3, A += a3;
|
|
21455
|
+
}
|
|
21456
|
+
return r2.length == A ? r2 : r2.slice(0, A);
|
|
21457
|
+
}, e3.H.W = function(e4, t3) {
|
|
21458
|
+
const r2 = e4.length;
|
|
21459
|
+
if (t3 <= r2) return e4;
|
|
21460
|
+
const i2 = new Uint8Array(r2 << 1);
|
|
21461
|
+
return i2.set(e4, 0), i2;
|
|
21462
|
+
}, e3.H.R = function(t3, r2, i2, o2, a2, s2) {
|
|
21463
|
+
const f2 = e3.H.e, l2 = e3.H.Z;
|
|
21464
|
+
let c2 = 0;
|
|
21465
|
+
for (; c2 < i2; ) {
|
|
21466
|
+
const e4 = t3[l2(o2, a2) & r2];
|
|
21467
|
+
a2 += 15 & e4;
|
|
21468
|
+
const i3 = e4 >>> 4;
|
|
21469
|
+
if (i3 <= 15) s2[c2] = i3, c2++;
|
|
21470
|
+
else {
|
|
21471
|
+
let e5 = 0, t4 = 0;
|
|
21472
|
+
16 == i3 ? (t4 = 3 + f2(o2, a2, 2), a2 += 2, e5 = s2[c2 - 1]) : 17 == i3 ? (t4 = 3 + f2(o2, a2, 3), a2 += 3) : 18 == i3 && (t4 = 11 + f2(o2, a2, 7), a2 += 7);
|
|
21473
|
+
const r3 = c2 + t4;
|
|
21474
|
+
for (; c2 < r3; ) s2[c2] = e5, c2++;
|
|
21475
|
+
}
|
|
21476
|
+
}
|
|
21477
|
+
return a2;
|
|
21478
|
+
}, e3.H.V = function(e4, t3, r2, i2) {
|
|
21479
|
+
let o2 = 0, a2 = 0;
|
|
21480
|
+
const s2 = i2.length >>> 1;
|
|
21481
|
+
for (; a2 < r2; ) {
|
|
21482
|
+
const r3 = e4[a2 + t3];
|
|
21483
|
+
i2[a2 << 1] = 0, i2[1 + (a2 << 1)] = r3, r3 > o2 && (o2 = r3), a2++;
|
|
21484
|
+
}
|
|
21485
|
+
for (; a2 < s2; ) i2[a2 << 1] = 0, i2[1 + (a2 << 1)] = 0, a2++;
|
|
21486
|
+
return o2;
|
|
21487
|
+
}, e3.H.n = function(t3, r2) {
|
|
21488
|
+
const i2 = e3.H.m, o2 = t3.length;
|
|
21489
|
+
let a2, s2, f2;
|
|
21490
|
+
let l2;
|
|
21491
|
+
const c2 = i2.j;
|
|
21492
|
+
for (var u = 0; u <= r2; u++) c2[u] = 0;
|
|
21493
|
+
for (u = 1; u < o2; u += 2) c2[t3[u]]++;
|
|
21494
|
+
const h = i2.K;
|
|
21495
|
+
for (a2 = 0, c2[0] = 0, s2 = 1; s2 <= r2; s2++) a2 = a2 + c2[s2 - 1] << 1, h[s2] = a2;
|
|
21496
|
+
for (f2 = 0; f2 < o2; f2 += 2) l2 = t3[f2 + 1], 0 != l2 && (t3[f2] = h[l2], h[l2]++);
|
|
21497
|
+
}, e3.H.A = function(t3, r2, i2) {
|
|
21498
|
+
const o2 = t3.length, a2 = e3.H.m.r;
|
|
21499
|
+
for (let e4 = 0; e4 < o2; e4 += 2) if (0 != t3[e4 + 1]) {
|
|
21500
|
+
const o3 = e4 >> 1, s2 = t3[e4 + 1], f2 = o3 << 4 | s2, l2 = r2 - s2;
|
|
21501
|
+
let c2 = t3[e4] << l2;
|
|
21502
|
+
const u = c2 + (1 << l2);
|
|
21503
|
+
for (; c2 != u; ) {
|
|
21504
|
+
i2[a2[c2] >>> 15 - r2] = f2, c2++;
|
|
21505
|
+
}
|
|
21506
|
+
}
|
|
21507
|
+
}, e3.H.l = function(t3, r2) {
|
|
21508
|
+
const i2 = e3.H.m.r, o2 = 15 - r2;
|
|
21509
|
+
for (let e4 = 0; e4 < t3.length; e4 += 2) {
|
|
21510
|
+
const a2 = t3[e4] << r2 - t3[e4 + 1];
|
|
21511
|
+
t3[e4] = i2[a2] >>> o2;
|
|
21512
|
+
}
|
|
21513
|
+
}, e3.H.M = function(e4, t3, r2) {
|
|
21514
|
+
r2 <<= 7 & t3;
|
|
21515
|
+
const i2 = t3 >>> 3;
|
|
21516
|
+
e4[i2] |= r2, e4[i2 + 1] |= r2 >>> 8;
|
|
21517
|
+
}, e3.H.I = function(e4, t3, r2) {
|
|
21518
|
+
r2 <<= 7 & t3;
|
|
21519
|
+
const i2 = t3 >>> 3;
|
|
21520
|
+
e4[i2] |= r2, e4[i2 + 1] |= r2 >>> 8, e4[i2 + 2] |= r2 >>> 16;
|
|
21521
|
+
}, e3.H.e = function(e4, t3, r2) {
|
|
21522
|
+
return (e4[t3 >>> 3] | e4[1 + (t3 >>> 3)] << 8) >>> (7 & t3) & (1 << r2) - 1;
|
|
21523
|
+
}, e3.H.b = function(e4, t3, r2) {
|
|
21524
|
+
return (e4[t3 >>> 3] | e4[1 + (t3 >>> 3)] << 8 | e4[2 + (t3 >>> 3)] << 16) >>> (7 & t3) & (1 << r2) - 1;
|
|
21525
|
+
}, e3.H.Z = function(e4, t3) {
|
|
21526
|
+
return (e4[t3 >>> 3] | e4[1 + (t3 >>> 3)] << 8 | e4[2 + (t3 >>> 3)] << 16) >>> (7 & t3);
|
|
21527
|
+
}, e3.H.i = function(e4, t3) {
|
|
21528
|
+
return (e4[t3 >>> 3] | e4[1 + (t3 >>> 3)] << 8 | e4[2 + (t3 >>> 3)] << 16 | e4[3 + (t3 >>> 3)] << 24) >>> (7 & t3);
|
|
21529
|
+
}, e3.H.m = (function() {
|
|
21530
|
+
const e4 = Uint16Array, t3 = Uint32Array;
|
|
21531
|
+
return { K: new e4(16), j: new e4(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 e4(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 t3(32), J: new e4(512), _: [], h: new e4(32), $: [], w: new e4(32768), C: [], v: [], d: new e4(32768), D: [], u: new e4(512), Q: [], r: new e4(32768), s: new t3(286), Y: new t3(30), a: new t3(19), t: new t3(15e3), k: new e4(65536), g: new e4(32768) };
|
|
21532
|
+
})(), (function() {
|
|
21533
|
+
const t3 = e3.H.m;
|
|
21534
|
+
for (var r2 = 0; r2 < 32768; r2++) {
|
|
21535
|
+
let e4 = r2;
|
|
21536
|
+
e4 = (2863311530 & e4) >>> 1 | (1431655765 & e4) << 1, e4 = (3435973836 & e4) >>> 2 | (858993459 & e4) << 2, e4 = (4042322160 & e4) >>> 4 | (252645135 & e4) << 4, e4 = (4278255360 & e4) >>> 8 | (16711935 & e4) << 8, t3.r[r2] = (e4 >>> 16 | e4 << 16) >>> 17;
|
|
21537
|
+
}
|
|
21538
|
+
function n(e4, t4, r3) {
|
|
21539
|
+
for (; 0 != t4--; ) e4.push(0, r3);
|
|
21540
|
+
}
|
|
21541
|
+
for (r2 = 0; r2 < 32; r2++) t3.q[r2] = t3.S[r2] << 3 | t3.T[r2], t3.c[r2] = t3.p[r2] << 4 | t3.z[r2];
|
|
21542
|
+
n(t3._, 144, 8), n(t3._, 112, 9), n(t3._, 24, 7), n(t3._, 8, 8), e3.H.n(t3._, 9), e3.H.A(t3._, 9, t3.J), e3.H.l(t3._, 9), n(t3.$, 32, 5), e3.H.n(t3.$, 5), e3.H.A(t3.$, 5, t3.h), e3.H.l(t3.$, 5), n(t3.Q, 19, 0), n(t3.C, 286, 0), n(t3.D, 30, 0), n(t3.v, 320, 0);
|
|
21543
|
+
})(), e3.H.N;
|
|
21544
|
+
})();
|
|
21545
|
+
function _getBPP(e3) {
|
|
21546
|
+
return [1, null, 3, 1, 2, null, 4][e3.ctype] * e3.depth;
|
|
21547
|
+
}
|
|
21548
|
+
function _filterZero(e3, t3, r2, i2, o2) {
|
|
21549
|
+
let a2 = _getBPP(t3);
|
|
21550
|
+
const s2 = Math.ceil(i2 * a2 / 8);
|
|
21551
|
+
let f2, l2;
|
|
21552
|
+
a2 = Math.ceil(a2 / 8);
|
|
21553
|
+
let c2 = e3[r2], u = 0;
|
|
21554
|
+
if (c2 > 1 && (e3[r2] = [0, 0, 1][c2 - 2]), 3 == c2) for (u = a2; u < s2; u++) e3[u + 1] = e3[u + 1] + (e3[u + 1 - a2] >>> 1) & 255;
|
|
21555
|
+
for (let t4 = 0; t4 < o2; t4++) if (f2 = r2 + t4 * s2, l2 = f2 + t4 + 1, c2 = e3[l2 - 1], u = 0, 0 == c2) for (; u < s2; u++) e3[f2 + u] = e3[l2 + u];
|
|
21556
|
+
else if (1 == c2) {
|
|
21557
|
+
for (; u < a2; u++) e3[f2 + u] = e3[l2 + u];
|
|
21558
|
+
for (; u < s2; u++) e3[f2 + u] = e3[l2 + u] + e3[f2 + u - a2];
|
|
21559
|
+
} else if (2 == c2) for (; u < s2; u++) e3[f2 + u] = e3[l2 + u] + e3[f2 + u - s2];
|
|
21560
|
+
else if (3 == c2) {
|
|
21561
|
+
for (; u < a2; u++) e3[f2 + u] = e3[l2 + u] + (e3[f2 + u - s2] >>> 1);
|
|
21562
|
+
for (; u < s2; u++) e3[f2 + u] = e3[l2 + u] + (e3[f2 + u - s2] + e3[f2 + u - a2] >>> 1);
|
|
21563
|
+
} else {
|
|
21564
|
+
for (; u < a2; u++) e3[f2 + u] = e3[l2 + u] + _paeth(0, e3[f2 + u - s2], 0);
|
|
21565
|
+
for (; u < s2; u++) e3[f2 + u] = e3[l2 + u] + _paeth(e3[f2 + u - a2], e3[f2 + u - s2], e3[f2 + u - a2 - s2]);
|
|
21566
|
+
}
|
|
21567
|
+
return e3;
|
|
21568
|
+
}
|
|
21569
|
+
function _paeth(e3, t3, r2) {
|
|
21570
|
+
const i2 = e3 + t3 - r2, o2 = i2 - e3, a2 = i2 - t3, s2 = i2 - r2;
|
|
21571
|
+
return o2 * o2 <= a2 * a2 && o2 * o2 <= s2 * s2 ? e3 : a2 * a2 <= s2 * s2 ? t3 : r2;
|
|
21572
|
+
}
|
|
21573
|
+
function _IHDR(t3, r2, i2) {
|
|
21574
|
+
i2.width = e2.readUint(t3, r2), r2 += 4, i2.height = e2.readUint(t3, r2), r2 += 4, i2.depth = t3[r2], r2++, i2.ctype = t3[r2], r2++, i2.compress = t3[r2], r2++, i2.filter = t3[r2], r2++, i2.interlace = t3[r2], r2++;
|
|
21575
|
+
}
|
|
21576
|
+
function _copyTile(e3, t3, r2, i2, o2, a2, s2, f2, l2) {
|
|
21577
|
+
const c2 = Math.min(t3, o2), u = Math.min(r2, a2);
|
|
21578
|
+
let h = 0, d = 0;
|
|
21579
|
+
for (let r3 = 0; r3 < u; r3++) for (let a3 = 0; a3 < c2; a3++) if (s2 >= 0 && f2 >= 0 ? (h = r3 * t3 + a3 << 2, d = (f2 + r3) * o2 + s2 + a3 << 2) : (h = (-f2 + r3) * t3 - s2 + a3 << 2, d = r3 * o2 + a3 << 2), 0 == l2) i2[d] = e3[h], i2[d + 1] = e3[h + 1], i2[d + 2] = e3[h + 2], i2[d + 3] = e3[h + 3];
|
|
21580
|
+
else if (1 == l2) {
|
|
21581
|
+
var A = e3[h + 3] * (1 / 255), g = e3[h] * A, p = e3[h + 1] * A, m = e3[h + 2] * A, w = i2[d + 3] * (1 / 255), v = i2[d] * w, b = i2[d + 1] * w, y = i2[d + 2] * w;
|
|
21582
|
+
const t4 = 1 - A, r4 = A + w * t4, o3 = 0 == r4 ? 0 : 1 / r4;
|
|
21583
|
+
i2[d + 3] = 255 * r4, i2[d + 0] = (g + v * t4) * o3, i2[d + 1] = (p + b * t4) * o3, i2[d + 2] = (m + y * t4) * o3;
|
|
21584
|
+
} else if (2 == l2) {
|
|
21585
|
+
A = e3[h + 3], g = e3[h], p = e3[h + 1], m = e3[h + 2], w = i2[d + 3], v = i2[d], b = i2[d + 1], y = i2[d + 2];
|
|
21586
|
+
A == w && g == v && p == b && m == y ? (i2[d] = 0, i2[d + 1] = 0, i2[d + 2] = 0, i2[d + 3] = 0) : (i2[d] = g, i2[d + 1] = p, i2[d + 2] = m, i2[d + 3] = A);
|
|
21587
|
+
} else if (3 == l2) {
|
|
21588
|
+
A = e3[h + 3], g = e3[h], p = e3[h + 1], m = e3[h + 2], w = i2[d + 3], v = i2[d], b = i2[d + 1], y = i2[d + 2];
|
|
21589
|
+
if (A == w && g == v && p == b && m == y) continue;
|
|
21590
|
+
if (A < 220 && w > 20) return false;
|
|
21591
|
+
}
|
|
21592
|
+
return true;
|
|
21593
|
+
}
|
|
21594
|
+
return { decode: function decode(r2) {
|
|
21595
|
+
const i2 = new Uint8Array(r2);
|
|
21596
|
+
let o2 = 8;
|
|
21597
|
+
const a2 = e2, s2 = a2.readUshort, f2 = a2.readUint, l2 = { tabs: {}, frames: [] }, c2 = new Uint8Array(i2.length);
|
|
21598
|
+
let u, h = 0, d = 0;
|
|
21599
|
+
const A = [137, 80, 78, 71, 13, 10, 26, 10];
|
|
21600
|
+
for (var g = 0; g < 8; g++) if (i2[g] != A[g]) throw "The input is not a PNG file!";
|
|
21601
|
+
for (; o2 < i2.length; ) {
|
|
21602
|
+
const e3 = a2.readUint(i2, o2);
|
|
21603
|
+
o2 += 4;
|
|
21604
|
+
const r3 = a2.readASCII(i2, o2, 4);
|
|
21605
|
+
if (o2 += 4, "IHDR" == r3) _IHDR(i2, o2, l2);
|
|
21606
|
+
else if ("iCCP" == r3) {
|
|
21607
|
+
for (var p = o2; 0 != i2[p]; ) p++;
|
|
21608
|
+
a2.readASCII(i2, o2, p - o2), i2[p + 1];
|
|
21609
|
+
const s3 = i2.slice(p + 2, o2 + e3);
|
|
21610
|
+
let f3 = null;
|
|
21611
|
+
try {
|
|
21612
|
+
f3 = _inflate(s3);
|
|
21613
|
+
} catch (e4) {
|
|
21614
|
+
f3 = t2(s3);
|
|
21615
|
+
}
|
|
21616
|
+
l2.tabs[r3] = f3;
|
|
21617
|
+
} else if ("CgBI" == r3) l2.tabs[r3] = i2.slice(o2, o2 + 4);
|
|
21618
|
+
else if ("IDAT" == r3) {
|
|
21619
|
+
for (g = 0; g < e3; g++) c2[h + g] = i2[o2 + g];
|
|
21620
|
+
h += e3;
|
|
21621
|
+
} else if ("acTL" == r3) l2.tabs[r3] = { num_frames: f2(i2, o2), num_plays: f2(i2, o2 + 4) }, u = new Uint8Array(i2.length);
|
|
21622
|
+
else if ("fcTL" == r3) {
|
|
21623
|
+
if (0 != d) (E = l2.frames[l2.frames.length - 1]).data = _decompress(l2, u.slice(0, d), E.rect.width, E.rect.height), d = 0;
|
|
21624
|
+
const e4 = { x: f2(i2, o2 + 12), y: f2(i2, o2 + 16), width: f2(i2, o2 + 4), height: f2(i2, o2 + 8) };
|
|
21625
|
+
let t3 = s2(i2, o2 + 22);
|
|
21626
|
+
t3 = s2(i2, o2 + 20) / (0 == t3 ? 100 : t3);
|
|
21627
|
+
const r4 = { rect: e4, delay: Math.round(1e3 * t3), dispose: i2[o2 + 24], blend: i2[o2 + 25] };
|
|
21628
|
+
l2.frames.push(r4);
|
|
21629
|
+
} else if ("fdAT" == r3) {
|
|
21630
|
+
for (g = 0; g < e3 - 4; g++) u[d + g] = i2[o2 + g + 4];
|
|
21631
|
+
d += e3 - 4;
|
|
21632
|
+
} else if ("pHYs" == r3) l2.tabs[r3] = [a2.readUint(i2, o2), a2.readUint(i2, o2 + 4), i2[o2 + 8]];
|
|
21633
|
+
else if ("cHRM" == r3) {
|
|
21634
|
+
l2.tabs[r3] = [];
|
|
21635
|
+
for (g = 0; g < 8; g++) l2.tabs[r3].push(a2.readUint(i2, o2 + 4 * g));
|
|
21636
|
+
} else if ("tEXt" == r3 || "zTXt" == r3) {
|
|
21637
|
+
null == l2.tabs[r3] && (l2.tabs[r3] = {});
|
|
21638
|
+
var m = a2.nextZero(i2, o2), w = a2.readASCII(i2, o2, m - o2), v = o2 + e3 - m - 1;
|
|
21639
|
+
if ("tEXt" == r3) y = a2.readASCII(i2, m + 1, v);
|
|
21640
|
+
else {
|
|
21641
|
+
var b = _inflate(i2.slice(m + 2, m + 2 + v));
|
|
21642
|
+
y = a2.readUTF8(b, 0, b.length);
|
|
21643
|
+
}
|
|
21644
|
+
l2.tabs[r3][w] = y;
|
|
21645
|
+
} else if ("iTXt" == r3) {
|
|
21646
|
+
null == l2.tabs[r3] && (l2.tabs[r3] = {});
|
|
21647
|
+
m = 0, p = o2;
|
|
21648
|
+
m = a2.nextZero(i2, p);
|
|
21649
|
+
w = a2.readASCII(i2, p, m - p);
|
|
21650
|
+
const t3 = i2[p = m + 1];
|
|
21651
|
+
var y;
|
|
21652
|
+
i2[p + 1], p += 2, m = a2.nextZero(i2, p), a2.readASCII(i2, p, m - p), p = m + 1, m = a2.nextZero(i2, p), a2.readUTF8(i2, p, m - p);
|
|
21653
|
+
v = e3 - ((p = m + 1) - o2);
|
|
21654
|
+
if (0 == t3) y = a2.readUTF8(i2, p, v);
|
|
21655
|
+
else {
|
|
21656
|
+
b = _inflate(i2.slice(p, p + v));
|
|
21657
|
+
y = a2.readUTF8(b, 0, b.length);
|
|
21658
|
+
}
|
|
21659
|
+
l2.tabs[r3][w] = y;
|
|
21660
|
+
} else if ("PLTE" == r3) l2.tabs[r3] = a2.readBytes(i2, o2, e3);
|
|
21661
|
+
else if ("hIST" == r3) {
|
|
21662
|
+
const e4 = l2.tabs.PLTE.length / 3;
|
|
21663
|
+
l2.tabs[r3] = [];
|
|
21664
|
+
for (g = 0; g < e4; g++) l2.tabs[r3].push(s2(i2, o2 + 2 * g));
|
|
21665
|
+
} else if ("tRNS" == r3) 3 == l2.ctype ? l2.tabs[r3] = a2.readBytes(i2, o2, e3) : 0 == l2.ctype ? l2.tabs[r3] = s2(i2, o2) : 2 == l2.ctype && (l2.tabs[r3] = [s2(i2, o2), s2(i2, o2 + 2), s2(i2, o2 + 4)]);
|
|
21666
|
+
else if ("gAMA" == r3) l2.tabs[r3] = a2.readUint(i2, o2) / 1e5;
|
|
21667
|
+
else if ("sRGB" == r3) l2.tabs[r3] = i2[o2];
|
|
21668
|
+
else if ("bKGD" == r3) 0 == l2.ctype || 4 == l2.ctype ? l2.tabs[r3] = [s2(i2, o2)] : 2 == l2.ctype || 6 == l2.ctype ? l2.tabs[r3] = [s2(i2, o2), s2(i2, o2 + 2), s2(i2, o2 + 4)] : 3 == l2.ctype && (l2.tabs[r3] = i2[o2]);
|
|
21669
|
+
else if ("IEND" == r3) break;
|
|
21670
|
+
o2 += e3, a2.readUint(i2, o2), o2 += 4;
|
|
21671
|
+
}
|
|
21672
|
+
var E;
|
|
21673
|
+
return 0 != d && ((E = l2.frames[l2.frames.length - 1]).data = _decompress(l2, u.slice(0, d), E.rect.width, E.rect.height)), l2.data = _decompress(l2, c2, l2.width, l2.height), delete l2.compress, delete l2.interlace, delete l2.filter, l2;
|
|
21674
|
+
}, toRGBA8: function toRGBA8(e3) {
|
|
21675
|
+
const t3 = e3.width, r2 = e3.height;
|
|
21676
|
+
if (null == e3.tabs.acTL) return [decodeImage(e3.data, t3, r2, e3).buffer];
|
|
21677
|
+
const i2 = [];
|
|
21678
|
+
null == e3.frames[0].data && (e3.frames[0].data = e3.data);
|
|
21679
|
+
const o2 = t3 * r2 * 4, a2 = new Uint8Array(o2), s2 = new Uint8Array(o2), f2 = new Uint8Array(o2);
|
|
21680
|
+
for (let c2 = 0; c2 < e3.frames.length; c2++) {
|
|
21681
|
+
const u = e3.frames[c2], h = u.rect.x, d = u.rect.y, A = u.rect.width, g = u.rect.height, p = decodeImage(u.data, A, g, e3);
|
|
21682
|
+
if (0 != c2) for (var l2 = 0; l2 < o2; l2++) f2[l2] = a2[l2];
|
|
21683
|
+
if (0 == u.blend ? _copyTile(p, A, g, a2, t3, r2, h, d, 0) : 1 == u.blend && _copyTile(p, A, g, a2, t3, r2, h, d, 1), i2.push(a2.buffer.slice(0)), 0 == u.dispose) ;
|
|
21684
|
+
else if (1 == u.dispose) _copyTile(s2, A, g, a2, t3, r2, h, d, 0);
|
|
21685
|
+
else if (2 == u.dispose) for (l2 = 0; l2 < o2; l2++) a2[l2] = f2[l2];
|
|
21686
|
+
}
|
|
21687
|
+
return i2;
|
|
21688
|
+
}, _paeth, _copyTile, _bin: e2 };
|
|
21689
|
+
})();
|
|
21690
|
+
!(function() {
|
|
21691
|
+
const { _copyTile: e2 } = UPNG, { _bin: t2 } = UPNG, r2 = UPNG._paeth;
|
|
21692
|
+
var i2 = { table: (function() {
|
|
21693
|
+
const e3 = new Uint32Array(256);
|
|
21694
|
+
for (let t3 = 0; t3 < 256; t3++) {
|
|
21695
|
+
let r3 = t3;
|
|
21696
|
+
for (let e4 = 0; e4 < 8; e4++) 1 & r3 ? r3 = 3988292384 ^ r3 >>> 1 : r3 >>>= 1;
|
|
21697
|
+
e3[t3] = r3;
|
|
21698
|
+
}
|
|
21699
|
+
return e3;
|
|
21700
|
+
})(), update(e3, t3, r3, o3) {
|
|
21701
|
+
for (let a2 = 0; a2 < o3; a2++) e3 = i2.table[255 & (e3 ^ t3[r3 + a2])] ^ e3 >>> 8;
|
|
21702
|
+
return e3;
|
|
21703
|
+
}, crc: (e3, t3, r3) => 4294967295 ^ i2.update(4294967295, e3, t3, r3) };
|
|
21704
|
+
function addErr(e3, t3, r3, i3) {
|
|
21705
|
+
t3[r3] += e3[0] * i3 >> 4, t3[r3 + 1] += e3[1] * i3 >> 4, t3[r3 + 2] += e3[2] * i3 >> 4, t3[r3 + 3] += e3[3] * i3 >> 4;
|
|
21706
|
+
}
|
|
21707
|
+
function N(e3) {
|
|
21708
|
+
return Math.max(0, Math.min(255, e3));
|
|
21709
|
+
}
|
|
21710
|
+
function D(e3, t3) {
|
|
21711
|
+
const r3 = e3[0] - t3[0], i3 = e3[1] - t3[1], o3 = e3[2] - t3[2], a2 = e3[3] - t3[3];
|
|
21712
|
+
return r3 * r3 + i3 * i3 + o3 * o3 + a2 * a2;
|
|
21713
|
+
}
|
|
21714
|
+
function dither(e3, t3, r3, i3, o3, a2, s2) {
|
|
21715
|
+
null == s2 && (s2 = 1);
|
|
21716
|
+
const f2 = i3.length, l2 = [];
|
|
21717
|
+
for (var c2 = 0; c2 < f2; c2++) {
|
|
21718
|
+
const e4 = i3[c2];
|
|
21719
|
+
l2.push([e4 >>> 0 & 255, e4 >>> 8 & 255, e4 >>> 16 & 255, e4 >>> 24 & 255]);
|
|
21720
|
+
}
|
|
21721
|
+
for (c2 = 0; c2 < f2; c2++) {
|
|
21722
|
+
let e4 = 4294967295;
|
|
21723
|
+
for (var u = 0, h = 0; h < f2; h++) {
|
|
21724
|
+
var d = D(l2[c2], l2[h]);
|
|
21725
|
+
h != c2 && d < e4 && (e4 = d, u = h);
|
|
21726
|
+
}
|
|
21727
|
+
}
|
|
21728
|
+
const A = new Uint32Array(o3.buffer), g = new Int16Array(t3 * r3 * 4), p = [0, 8, 2, 10, 12, 4, 14, 6, 3, 11, 1, 9, 15, 7, 13, 5];
|
|
21729
|
+
for (c2 = 0; c2 < p.length; c2++) p[c2] = 255 * ((p[c2] + 0.5) / 16 - 0.5);
|
|
21730
|
+
for (let o4 = 0; o4 < r3; o4++) for (let w = 0; w < t3; w++) {
|
|
21731
|
+
var m;
|
|
21732
|
+
c2 = 4 * (o4 * t3 + w);
|
|
21733
|
+
if (2 != s2) m = [N(e3[c2] + g[c2]), N(e3[c2 + 1] + g[c2 + 1]), N(e3[c2 + 2] + g[c2 + 2]), N(e3[c2 + 3] + g[c2 + 3])];
|
|
21734
|
+
else {
|
|
21735
|
+
d = p[4 * (3 & o4) + (3 & w)];
|
|
21736
|
+
m = [N(e3[c2] + d), N(e3[c2 + 1] + d), N(e3[c2 + 2] + d), N(e3[c2 + 3] + d)];
|
|
21737
|
+
}
|
|
21738
|
+
u = 0;
|
|
21739
|
+
let v = 16777215;
|
|
21740
|
+
for (h = 0; h < f2; h++) {
|
|
21741
|
+
const e4 = D(m, l2[h]);
|
|
21742
|
+
e4 < v && (v = e4, u = h);
|
|
21743
|
+
}
|
|
21744
|
+
const b = l2[u], y = [m[0] - b[0], m[1] - b[1], m[2] - b[2], m[3] - b[3]];
|
|
21745
|
+
1 == s2 && (w != t3 - 1 && addErr(y, g, c2 + 4, 7), o4 != r3 - 1 && (0 != w && addErr(y, g, c2 + 4 * t3 - 4, 3), addErr(y, g, c2 + 4 * t3, 5), w != t3 - 1 && addErr(y, g, c2 + 4 * t3 + 4, 1))), a2[c2 >> 2] = u, A[c2 >> 2] = i3[u];
|
|
21746
|
+
}
|
|
21747
|
+
}
|
|
21748
|
+
function _main(e3, r3, o3, a2, s2) {
|
|
21749
|
+
null == s2 && (s2 = {});
|
|
21750
|
+
const { crc: f2 } = i2, l2 = t2.writeUint, c2 = t2.writeUshort, u = t2.writeASCII;
|
|
21751
|
+
let h = 8;
|
|
21752
|
+
const d = e3.frames.length > 1;
|
|
21753
|
+
let A, g = false, p = 33 + (d ? 20 : 0);
|
|
21754
|
+
if (null != s2.sRGB && (p += 13), null != s2.pHYs && (p += 21), null != s2.iCCP && (A = pako.deflate(s2.iCCP), p += 21 + A.length + 4), 3 == e3.ctype) {
|
|
21755
|
+
for (var m = e3.plte.length, w = 0; w < m; w++) e3.plte[w] >>> 24 != 255 && (g = true);
|
|
21756
|
+
p += 8 + 3 * m + 4 + (g ? 8 + 1 * m + 4 : 0);
|
|
21757
|
+
}
|
|
21758
|
+
for (var v = 0; v < e3.frames.length; v++) {
|
|
21759
|
+
d && (p += 38), p += (F = e3.frames[v]).cimg.length + 12, 0 != v && (p += 4);
|
|
21760
|
+
}
|
|
21761
|
+
p += 12;
|
|
21762
|
+
const b = new Uint8Array(p), y = [137, 80, 78, 71, 13, 10, 26, 10];
|
|
21763
|
+
for (w = 0; w < 8; w++) b[w] = y[w];
|
|
21764
|
+
if (l2(b, h, 13), h += 4, u(b, h, "IHDR"), h += 4, l2(b, h, r3), h += 4, l2(b, h, o3), h += 4, b[h] = e3.depth, h++, b[h] = e3.ctype, h++, b[h] = 0, h++, b[h] = 0, h++, b[h] = 0, h++, l2(b, h, f2(b, h - 17, 17)), h += 4, null != s2.sRGB && (l2(b, h, 1), h += 4, u(b, h, "sRGB"), h += 4, b[h] = s2.sRGB, h++, l2(b, h, f2(b, h - 5, 5)), h += 4), null != s2.iCCP) {
|
|
21765
|
+
const e4 = 13 + A.length;
|
|
21766
|
+
l2(b, h, e4), h += 4, u(b, h, "iCCP"), h += 4, u(b, h, "ICC profile"), h += 11, h += 2, b.set(A, h), h += A.length, l2(b, h, f2(b, h - (e4 + 4), e4 + 4)), h += 4;
|
|
21767
|
+
}
|
|
21768
|
+
if (null != s2.pHYs && (l2(b, h, 9), h += 4, u(b, h, "pHYs"), h += 4, l2(b, h, s2.pHYs[0]), h += 4, l2(b, h, s2.pHYs[1]), h += 4, b[h] = s2.pHYs[2], h++, l2(b, h, f2(b, h - 13, 13)), h += 4), d && (l2(b, h, 8), h += 4, u(b, h, "acTL"), h += 4, l2(b, h, e3.frames.length), h += 4, l2(b, h, null != s2.loop ? s2.loop : 0), h += 4, l2(b, h, f2(b, h - 12, 12)), h += 4), 3 == e3.ctype) {
|
|
21769
|
+
l2(b, h, 3 * (m = e3.plte.length)), h += 4, u(b, h, "PLTE"), h += 4;
|
|
21770
|
+
for (w = 0; w < m; w++) {
|
|
21771
|
+
const t3 = 3 * w, r4 = e3.plte[w], i3 = 255 & r4, o4 = r4 >>> 8 & 255, a3 = r4 >>> 16 & 255;
|
|
21772
|
+
b[h + t3 + 0] = i3, b[h + t3 + 1] = o4, b[h + t3 + 2] = a3;
|
|
21773
|
+
}
|
|
21774
|
+
if (h += 3 * m, l2(b, h, f2(b, h - 3 * m - 4, 3 * m + 4)), h += 4, g) {
|
|
21775
|
+
l2(b, h, m), h += 4, u(b, h, "tRNS"), h += 4;
|
|
21776
|
+
for (w = 0; w < m; w++) b[h + w] = e3.plte[w] >>> 24 & 255;
|
|
21777
|
+
h += m, l2(b, h, f2(b, h - m - 4, m + 4)), h += 4;
|
|
21778
|
+
}
|
|
21779
|
+
}
|
|
21780
|
+
let E = 0;
|
|
21781
|
+
for (v = 0; v < e3.frames.length; v++) {
|
|
21782
|
+
var F = e3.frames[v];
|
|
21783
|
+
d && (l2(b, h, 26), h += 4, u(b, h, "fcTL"), h += 4, l2(b, h, E++), h += 4, l2(b, h, F.rect.width), h += 4, l2(b, h, F.rect.height), h += 4, l2(b, h, F.rect.x), h += 4, l2(b, h, F.rect.y), h += 4, c2(b, h, a2[v]), h += 2, c2(b, h, 1e3), h += 2, b[h] = F.dispose, h++, b[h] = F.blend, h++, l2(b, h, f2(b, h - 30, 30)), h += 4);
|
|
21784
|
+
const t3 = F.cimg;
|
|
21785
|
+
l2(b, h, (m = t3.length) + (0 == v ? 0 : 4)), h += 4;
|
|
21786
|
+
const r4 = h;
|
|
21787
|
+
u(b, h, 0 == v ? "IDAT" : "fdAT"), h += 4, 0 != v && (l2(b, h, E++), h += 4), b.set(t3, h), h += m, l2(b, h, f2(b, r4, h - r4)), h += 4;
|
|
21788
|
+
}
|
|
21789
|
+
return l2(b, h, 0), h += 4, u(b, h, "IEND"), h += 4, l2(b, h, f2(b, h - 4, 4)), h += 4, b.buffer;
|
|
21790
|
+
}
|
|
21791
|
+
function compressPNG(e3, t3, r3) {
|
|
21792
|
+
for (let i3 = 0; i3 < e3.frames.length; i3++) {
|
|
21793
|
+
const o3 = e3.frames[i3];
|
|
21794
|
+
o3.rect.width;
|
|
21795
|
+
const a2 = o3.rect.height, s2 = new Uint8Array(a2 * o3.bpl + a2);
|
|
21796
|
+
o3.cimg = _filterZero(o3.img, a2, o3.bpp, o3.bpl, s2, t3, r3);
|
|
21797
|
+
}
|
|
21798
|
+
}
|
|
21799
|
+
function compress2(t3, r3, i3, o3, a2) {
|
|
21800
|
+
const s2 = a2[0], f2 = a2[1], l2 = a2[2], c2 = a2[3], u = a2[4], h = a2[5];
|
|
21801
|
+
let d = 6, A = 8, g = 255;
|
|
21802
|
+
for (var p = 0; p < t3.length; p++) {
|
|
21803
|
+
const e3 = new Uint8Array(t3[p]);
|
|
21804
|
+
for (var m = e3.length, w = 0; w < m; w += 4) g &= e3[w + 3];
|
|
21805
|
+
}
|
|
21806
|
+
const v = 255 != g, b = (function framize(t4, r4, i4, o4, a3, s3) {
|
|
21807
|
+
const f3 = [];
|
|
21808
|
+
for (var l3 = 0; l3 < t4.length; l3++) {
|
|
21809
|
+
const h3 = new Uint8Array(t4[l3]), A3 = new Uint32Array(h3.buffer);
|
|
21810
|
+
var c3;
|
|
21811
|
+
let g2 = 0, p2 = 0, m2 = r4, w2 = i4, v2 = o4 ? 1 : 0;
|
|
21812
|
+
if (0 != l3) {
|
|
21813
|
+
const b2 = s3 || o4 || 1 == l3 || 0 != f3[l3 - 2].dispose ? 1 : 2;
|
|
21814
|
+
let y2 = 0, E2 = 1e9;
|
|
21815
|
+
for (let e3 = 0; e3 < b2; e3++) {
|
|
21816
|
+
var u2 = new Uint8Array(t4[l3 - 1 - e3]);
|
|
21817
|
+
const o5 = new Uint32Array(t4[l3 - 1 - e3]);
|
|
21818
|
+
let s4 = r4, f4 = i4, c4 = -1, h4 = -1;
|
|
21819
|
+
for (let e4 = 0; e4 < i4; e4++) for (let t5 = 0; t5 < r4; t5++) {
|
|
21820
|
+
A3[d2 = e4 * r4 + t5] != o5[d2] && (t5 < s4 && (s4 = t5), t5 > c4 && (c4 = t5), e4 < f4 && (f4 = e4), e4 > h4 && (h4 = e4));
|
|
21821
|
+
}
|
|
21822
|
+
-1 == c4 && (s4 = f4 = c4 = h4 = 0), a3 && (1 == (1 & s4) && s4--, 1 == (1 & f4) && f4--);
|
|
21823
|
+
const v3 = (c4 - s4 + 1) * (h4 - f4 + 1);
|
|
21824
|
+
v3 < E2 && (E2 = v3, y2 = e3, g2 = s4, p2 = f4, m2 = c4 - s4 + 1, w2 = h4 - f4 + 1);
|
|
21825
|
+
}
|
|
21826
|
+
u2 = new Uint8Array(t4[l3 - 1 - y2]);
|
|
21827
|
+
1 == y2 && (f3[l3 - 1].dispose = 2), c3 = new Uint8Array(m2 * w2 * 4), e2(u2, r4, i4, c3, m2, w2, -g2, -p2, 0), v2 = e2(h3, r4, i4, c3, m2, w2, -g2, -p2, 3) ? 1 : 0, 1 == v2 ? _prepareDiff(h3, r4, i4, c3, { x: g2, y: p2, width: m2, height: w2 }) : e2(h3, r4, i4, c3, m2, w2, -g2, -p2, 0);
|
|
21828
|
+
} else c3 = h3.slice(0);
|
|
21829
|
+
f3.push({ rect: { x: g2, y: p2, width: m2, height: w2 }, img: c3, blend: v2, dispose: 0 });
|
|
21830
|
+
}
|
|
21831
|
+
if (o4) for (l3 = 0; l3 < f3.length; l3++) {
|
|
21832
|
+
if (1 == (A2 = f3[l3]).blend) continue;
|
|
21833
|
+
const e3 = A2.rect, o5 = f3[l3 - 1].rect, s4 = Math.min(e3.x, o5.x), c4 = Math.min(e3.y, o5.y), u3 = { x: s4, y: c4, width: Math.max(e3.x + e3.width, o5.x + o5.width) - s4, height: Math.max(e3.y + e3.height, o5.y + o5.height) - c4 };
|
|
21834
|
+
f3[l3 - 1].dispose = 1, l3 - 1 != 0 && _updateFrame(t4, r4, i4, f3, l3 - 1, u3, a3), _updateFrame(t4, r4, i4, f3, l3, u3, a3);
|
|
21835
|
+
}
|
|
21836
|
+
let h2 = 0;
|
|
21837
|
+
if (1 != t4.length) for (var d2 = 0; d2 < f3.length; d2++) {
|
|
21838
|
+
var A2;
|
|
21839
|
+
h2 += (A2 = f3[d2]).rect.width * A2.rect.height;
|
|
21840
|
+
}
|
|
21841
|
+
return f3;
|
|
21842
|
+
})(t3, r3, i3, s2, f2, l2), y = {}, E = [], F = [];
|
|
21843
|
+
if (0 != o3) {
|
|
21844
|
+
const e3 = [];
|
|
21845
|
+
for (w = 0; w < b.length; w++) e3.push(b[w].img.buffer);
|
|
21846
|
+
const t4 = (function concatRGBA(e4) {
|
|
21847
|
+
let t5 = 0;
|
|
21848
|
+
for (var r5 = 0; r5 < e4.length; r5++) t5 += e4[r5].byteLength;
|
|
21849
|
+
const i5 = new Uint8Array(t5);
|
|
21850
|
+
let o4 = 0;
|
|
21851
|
+
for (r5 = 0; r5 < e4.length; r5++) {
|
|
21852
|
+
const t6 = new Uint8Array(e4[r5]), a3 = t6.length;
|
|
21853
|
+
for (let e5 = 0; e5 < a3; e5 += 4) {
|
|
21854
|
+
let r6 = t6[e5], a4 = t6[e5 + 1], s3 = t6[e5 + 2];
|
|
21855
|
+
const f3 = t6[e5 + 3];
|
|
21856
|
+
0 == f3 && (r6 = a4 = s3 = 0), i5[o4 + e5] = r6, i5[o4 + e5 + 1] = a4, i5[o4 + e5 + 2] = s3, i5[o4 + e5 + 3] = f3;
|
|
21857
|
+
}
|
|
21858
|
+
o4 += a3;
|
|
21859
|
+
}
|
|
21860
|
+
return i5.buffer;
|
|
21861
|
+
})(e3), r4 = quantize(t4, o3);
|
|
21862
|
+
for (w = 0; w < r4.plte.length; w++) E.push(r4.plte[w].est.rgba);
|
|
21863
|
+
let i4 = 0;
|
|
21864
|
+
for (w = 0; w < b.length; w++) {
|
|
21865
|
+
const e4 = (B = b[w]).img.length;
|
|
21866
|
+
var _ = new Uint8Array(r4.inds.buffer, i4 >> 2, e4 >> 2);
|
|
21867
|
+
F.push(_);
|
|
21868
|
+
const t5 = new Uint8Array(r4.abuf, i4, e4);
|
|
21869
|
+
h && dither(B.img, B.rect.width, B.rect.height, E, t5, _), B.img.set(t5), i4 += e4;
|
|
21870
|
+
}
|
|
21871
|
+
} else for (p = 0; p < b.length; p++) {
|
|
21872
|
+
var B = b[p];
|
|
21873
|
+
const e3 = new Uint32Array(B.img.buffer);
|
|
21874
|
+
var U2 = B.rect.width;
|
|
21875
|
+
m = e3.length, _ = new Uint8Array(m);
|
|
21876
|
+
F.push(_);
|
|
21877
|
+
for (w = 0; w < m; w++) {
|
|
21878
|
+
const t4 = e3[w];
|
|
21879
|
+
if (0 != w && t4 == e3[w - 1]) _[w] = _[w - 1];
|
|
21880
|
+
else if (w > U2 && t4 == e3[w - U2]) _[w] = _[w - U2];
|
|
21881
|
+
else {
|
|
21882
|
+
let e4 = y[t4];
|
|
21883
|
+
if (null == e4 && (y[t4] = e4 = E.length, E.push(t4), E.length >= 300)) break;
|
|
21884
|
+
_[w] = e4;
|
|
21885
|
+
}
|
|
21886
|
+
}
|
|
21887
|
+
}
|
|
21888
|
+
const C = E.length;
|
|
21889
|
+
C <= 256 && 0 == u && (A = C <= 2 ? 1 : C <= 4 ? 2 : C <= 16 ? 4 : 8, A = Math.max(A, c2));
|
|
21890
|
+
for (p = 0; p < b.length; p++) {
|
|
21891
|
+
(B = b[p]).rect.x, B.rect.y;
|
|
21892
|
+
U2 = B.rect.width;
|
|
21893
|
+
const e3 = B.rect.height;
|
|
21894
|
+
let t4 = B.img;
|
|
21895
|
+
new Uint32Array(t4.buffer);
|
|
21896
|
+
let r4 = 4 * U2, i4 = 4;
|
|
21897
|
+
if (C <= 256 && 0 == u) {
|
|
21898
|
+
r4 = Math.ceil(A * U2 / 8);
|
|
21899
|
+
var I = new Uint8Array(r4 * e3);
|
|
21900
|
+
const o4 = F[p];
|
|
21901
|
+
for (let t5 = 0; t5 < e3; t5++) {
|
|
21902
|
+
w = t5 * r4;
|
|
21903
|
+
const e4 = t5 * U2;
|
|
21904
|
+
if (8 == A) for (var Q = 0; Q < U2; Q++) I[w + Q] = o4[e4 + Q];
|
|
21905
|
+
else if (4 == A) for (Q = 0; Q < U2; Q++) I[w + (Q >> 1)] |= o4[e4 + Q] << 4 - 4 * (1 & Q);
|
|
21906
|
+
else if (2 == A) for (Q = 0; Q < U2; Q++) I[w + (Q >> 2)] |= o4[e4 + Q] << 6 - 2 * (3 & Q);
|
|
21907
|
+
else if (1 == A) for (Q = 0; Q < U2; Q++) I[w + (Q >> 3)] |= o4[e4 + Q] << 7 - 1 * (7 & Q);
|
|
21908
|
+
}
|
|
21909
|
+
t4 = I, d = 3, i4 = 1;
|
|
21910
|
+
} else if (0 == v && 1 == b.length) {
|
|
21911
|
+
I = new Uint8Array(U2 * e3 * 3);
|
|
21912
|
+
const o4 = U2 * e3;
|
|
21913
|
+
for (w = 0; w < o4; w++) {
|
|
21914
|
+
const e4 = 3 * w, r5 = 4 * w;
|
|
21915
|
+
I[e4] = t4[r5], I[e4 + 1] = t4[r5 + 1], I[e4 + 2] = t4[r5 + 2];
|
|
21916
|
+
}
|
|
21917
|
+
t4 = I, d = 2, i4 = 3, r4 = 3 * U2;
|
|
21918
|
+
}
|
|
21919
|
+
B.img = t4, B.bpl = r4, B.bpp = i4;
|
|
21920
|
+
}
|
|
21921
|
+
return { ctype: d, depth: A, plte: E, frames: b };
|
|
21922
|
+
}
|
|
21923
|
+
function _updateFrame(t3, r3, i3, o3, a2, s2, f2) {
|
|
21924
|
+
const l2 = Uint8Array, c2 = Uint32Array, u = new l2(t3[a2 - 1]), h = new c2(t3[a2 - 1]), d = a2 + 1 < t3.length ? new l2(t3[a2 + 1]) : null, A = new l2(t3[a2]), g = new c2(A.buffer);
|
|
21925
|
+
let p = r3, m = i3, w = -1, v = -1;
|
|
21926
|
+
for (let e3 = 0; e3 < s2.height; e3++) for (let t4 = 0; t4 < s2.width; t4++) {
|
|
21927
|
+
const i4 = s2.x + t4, f3 = s2.y + e3, l3 = f3 * r3 + i4, c3 = g[l3];
|
|
21928
|
+
0 == c3 || 0 == o3[a2 - 1].dispose && h[l3] == c3 && (null == d || 0 != d[4 * l3 + 3]) || (i4 < p && (p = i4), i4 > w && (w = i4), f3 < m && (m = f3), f3 > v && (v = f3));
|
|
21929
|
+
}
|
|
21930
|
+
-1 == w && (p = m = w = v = 0), f2 && (1 == (1 & p) && p--, 1 == (1 & m) && m--), s2 = { x: p, y: m, width: w - p + 1, height: v - m + 1 };
|
|
21931
|
+
const b = o3[a2];
|
|
21932
|
+
b.rect = s2, b.blend = 1, b.img = new Uint8Array(s2.width * s2.height * 4), 0 == o3[a2 - 1].dispose ? (e2(u, r3, i3, b.img, s2.width, s2.height, -s2.x, -s2.y, 0), _prepareDiff(A, r3, i3, b.img, s2)) : e2(A, r3, i3, b.img, s2.width, s2.height, -s2.x, -s2.y, 0);
|
|
21933
|
+
}
|
|
21934
|
+
function _prepareDiff(t3, r3, i3, o3, a2) {
|
|
21935
|
+
e2(t3, r3, i3, o3, a2.width, a2.height, -a2.x, -a2.y, 2);
|
|
21936
|
+
}
|
|
21937
|
+
function _filterZero(e3, t3, r3, i3, o3, a2, s2) {
|
|
21938
|
+
const f2 = [];
|
|
21939
|
+
let l2, c2 = [0, 1, 2, 3, 4];
|
|
21940
|
+
-1 != a2 ? c2 = [a2] : (t3 * i3 > 5e5 || 1 == r3) && (c2 = [0]), s2 && (l2 = { level: 0 });
|
|
21941
|
+
const u = UZIP;
|
|
21942
|
+
for (var h = 0; h < c2.length; h++) {
|
|
21943
|
+
for (let a3 = 0; a3 < t3; a3++) _filterLine(o3, e3, a3, i3, r3, c2[h]);
|
|
21944
|
+
f2.push(u.deflate(o3, l2));
|
|
21945
|
+
}
|
|
21946
|
+
let d, A = 1e9;
|
|
21947
|
+
for (h = 0; h < f2.length; h++) f2[h].length < A && (d = h, A = f2[h].length);
|
|
21948
|
+
return f2[d];
|
|
21949
|
+
}
|
|
21950
|
+
function _filterLine(e3, t3, i3, o3, a2, s2) {
|
|
21951
|
+
const f2 = i3 * o3;
|
|
21952
|
+
let l2 = f2 + i3;
|
|
21953
|
+
if (e3[l2] = s2, l2++, 0 == s2) if (o3 < 500) for (var c2 = 0; c2 < o3; c2++) e3[l2 + c2] = t3[f2 + c2];
|
|
21954
|
+
else e3.set(new Uint8Array(t3.buffer, f2, o3), l2);
|
|
21955
|
+
else if (1 == s2) {
|
|
21956
|
+
for (c2 = 0; c2 < a2; c2++) e3[l2 + c2] = t3[f2 + c2];
|
|
21957
|
+
for (c2 = a2; c2 < o3; c2++) e3[l2 + c2] = t3[f2 + c2] - t3[f2 + c2 - a2] + 256 & 255;
|
|
21958
|
+
} else if (0 == i3) {
|
|
21959
|
+
for (c2 = 0; c2 < a2; c2++) e3[l2 + c2] = t3[f2 + c2];
|
|
21960
|
+
if (2 == s2) for (c2 = a2; c2 < o3; c2++) e3[l2 + c2] = t3[f2 + c2];
|
|
21961
|
+
if (3 == s2) for (c2 = a2; c2 < o3; c2++) e3[l2 + c2] = t3[f2 + c2] - (t3[f2 + c2 - a2] >> 1) + 256 & 255;
|
|
21962
|
+
if (4 == s2) for (c2 = a2; c2 < o3; c2++) e3[l2 + c2] = t3[f2 + c2] - r2(t3[f2 + c2 - a2], 0, 0) + 256 & 255;
|
|
21963
|
+
} else {
|
|
21964
|
+
if (2 == s2) for (c2 = 0; c2 < o3; c2++) e3[l2 + c2] = t3[f2 + c2] + 256 - t3[f2 + c2 - o3] & 255;
|
|
21965
|
+
if (3 == s2) {
|
|
21966
|
+
for (c2 = 0; c2 < a2; c2++) e3[l2 + c2] = t3[f2 + c2] + 256 - (t3[f2 + c2 - o3] >> 1) & 255;
|
|
21967
|
+
for (c2 = a2; c2 < o3; c2++) e3[l2 + c2] = t3[f2 + c2] + 256 - (t3[f2 + c2 - o3] + t3[f2 + c2 - a2] >> 1) & 255;
|
|
21968
|
+
}
|
|
21969
|
+
if (4 == s2) {
|
|
21970
|
+
for (c2 = 0; c2 < a2; c2++) e3[l2 + c2] = t3[f2 + c2] + 256 - r2(0, t3[f2 + c2 - o3], 0) & 255;
|
|
21971
|
+
for (c2 = a2; c2 < o3; c2++) e3[l2 + c2] = t3[f2 + c2] + 256 - r2(t3[f2 + c2 - a2], t3[f2 + c2 - o3], t3[f2 + c2 - a2 - o3]) & 255;
|
|
21972
|
+
}
|
|
21973
|
+
}
|
|
21974
|
+
}
|
|
21975
|
+
function quantize(e3, t3) {
|
|
21976
|
+
const r3 = new Uint8Array(e3), i3 = r3.slice(0), o3 = new Uint32Array(i3.buffer), a2 = getKDtree(i3, t3), s2 = a2[0], f2 = a2[1], l2 = r3.length, c2 = new Uint8Array(l2 >> 2);
|
|
21977
|
+
let u;
|
|
21978
|
+
if (r3.length < 2e7) for (var h = 0; h < l2; h += 4) {
|
|
21979
|
+
u = getNearest(s2, d = r3[h] * (1 / 255), A = r3[h + 1] * (1 / 255), g = r3[h + 2] * (1 / 255), p = r3[h + 3] * (1 / 255)), c2[h >> 2] = u.ind, o3[h >> 2] = u.est.rgba;
|
|
21980
|
+
}
|
|
21981
|
+
else for (h = 0; h < l2; h += 4) {
|
|
21982
|
+
var d = r3[h] * (1 / 255), A = r3[h + 1] * (1 / 255), g = r3[h + 2] * (1 / 255), p = r3[h + 3] * (1 / 255);
|
|
21983
|
+
for (u = s2; u.left; ) u = planeDst(u.est, d, A, g, p) <= 0 ? u.left : u.right;
|
|
21984
|
+
c2[h >> 2] = u.ind, o3[h >> 2] = u.est.rgba;
|
|
21985
|
+
}
|
|
21986
|
+
return { abuf: i3.buffer, inds: c2, plte: f2 };
|
|
21987
|
+
}
|
|
21988
|
+
function getKDtree(e3, t3, r3) {
|
|
21989
|
+
null == r3 && (r3 = 1e-4);
|
|
21990
|
+
const i3 = new Uint32Array(e3.buffer), o3 = { i0: 0, i1: e3.length, bst: null, est: null, tdst: 0, left: null, right: null };
|
|
21991
|
+
o3.bst = stats(e3, o3.i0, o3.i1), o3.est = estats(o3.bst);
|
|
21992
|
+
const a2 = [o3];
|
|
21993
|
+
for (; a2.length < t3; ) {
|
|
21994
|
+
let t4 = 0, o4 = 0;
|
|
21995
|
+
for (var s2 = 0; s2 < a2.length; s2++) a2[s2].est.L > t4 && (t4 = a2[s2].est.L, o4 = s2);
|
|
21996
|
+
if (t4 < r3) break;
|
|
21997
|
+
const f2 = a2[o4], l2 = splitPixels(e3, i3, f2.i0, f2.i1, f2.est.e, f2.est.eMq255);
|
|
21998
|
+
if (f2.i0 >= l2 || f2.i1 <= l2) {
|
|
21999
|
+
f2.est.L = 0;
|
|
22000
|
+
continue;
|
|
22001
|
+
}
|
|
22002
|
+
const c2 = { i0: f2.i0, i1: l2, bst: null, est: null, tdst: 0, left: null, right: null };
|
|
22003
|
+
c2.bst = stats(e3, c2.i0, c2.i1), c2.est = estats(c2.bst);
|
|
22004
|
+
const u = { i0: l2, i1: f2.i1, bst: null, est: null, tdst: 0, left: null, right: null };
|
|
22005
|
+
u.bst = { R: [], m: [], N: f2.bst.N - c2.bst.N };
|
|
22006
|
+
for (s2 = 0; s2 < 16; s2++) u.bst.R[s2] = f2.bst.R[s2] - c2.bst.R[s2];
|
|
22007
|
+
for (s2 = 0; s2 < 4; s2++) u.bst.m[s2] = f2.bst.m[s2] - c2.bst.m[s2];
|
|
22008
|
+
u.est = estats(u.bst), f2.left = c2, f2.right = u, a2[o4] = c2, a2.push(u);
|
|
22009
|
+
}
|
|
22010
|
+
a2.sort(((e4, t4) => t4.bst.N - e4.bst.N));
|
|
22011
|
+
for (s2 = 0; s2 < a2.length; s2++) a2[s2].ind = s2;
|
|
22012
|
+
return [o3, a2];
|
|
22013
|
+
}
|
|
22014
|
+
function getNearest(e3, t3, r3, i3, o3) {
|
|
22015
|
+
if (null == e3.left) return e3.tdst = (function dist(e4, t4, r4, i4, o4) {
|
|
22016
|
+
const a3 = t4 - e4[0], s3 = r4 - e4[1], f3 = i4 - e4[2], l3 = o4 - e4[3];
|
|
22017
|
+
return a3 * a3 + s3 * s3 + f3 * f3 + l3 * l3;
|
|
22018
|
+
})(e3.est.q, t3, r3, i3, o3), e3;
|
|
22019
|
+
const a2 = planeDst(e3.est, t3, r3, i3, o3);
|
|
22020
|
+
let s2 = e3.left, f2 = e3.right;
|
|
22021
|
+
a2 > 0 && (s2 = e3.right, f2 = e3.left);
|
|
22022
|
+
const l2 = getNearest(s2, t3, r3, i3, o3);
|
|
22023
|
+
if (l2.tdst <= a2 * a2) return l2;
|
|
22024
|
+
const c2 = getNearest(f2, t3, r3, i3, o3);
|
|
22025
|
+
return c2.tdst < l2.tdst ? c2 : l2;
|
|
22026
|
+
}
|
|
22027
|
+
function planeDst(e3, t3, r3, i3, o3) {
|
|
22028
|
+
const { e: a2 } = e3;
|
|
22029
|
+
return a2[0] * t3 + a2[1] * r3 + a2[2] * i3 + a2[3] * o3 - e3.eMq;
|
|
22030
|
+
}
|
|
22031
|
+
function splitPixels(e3, t3, r3, i3, o3, a2) {
|
|
22032
|
+
for (i3 -= 4; r3 < i3; ) {
|
|
22033
|
+
for (; vecDot(e3, r3, o3) <= a2; ) r3 += 4;
|
|
22034
|
+
for (; vecDot(e3, i3, o3) > a2; ) i3 -= 4;
|
|
22035
|
+
if (r3 >= i3) break;
|
|
22036
|
+
const s2 = t3[r3 >> 2];
|
|
22037
|
+
t3[r3 >> 2] = t3[i3 >> 2], t3[i3 >> 2] = s2, r3 += 4, i3 -= 4;
|
|
22038
|
+
}
|
|
22039
|
+
for (; vecDot(e3, r3, o3) > a2; ) r3 -= 4;
|
|
22040
|
+
return r3 + 4;
|
|
22041
|
+
}
|
|
22042
|
+
function vecDot(e3, t3, r3) {
|
|
22043
|
+
return e3[t3] * r3[0] + e3[t3 + 1] * r3[1] + e3[t3 + 2] * r3[2] + e3[t3 + 3] * r3[3];
|
|
22044
|
+
}
|
|
22045
|
+
function stats(e3, t3, r3) {
|
|
22046
|
+
const i3 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], o3 = [0, 0, 0, 0], a2 = r3 - t3 >> 2;
|
|
22047
|
+
for (let a3 = t3; a3 < r3; a3 += 4) {
|
|
22048
|
+
const t4 = e3[a3] * (1 / 255), r4 = e3[a3 + 1] * (1 / 255), s2 = e3[a3 + 2] * (1 / 255), f2 = e3[a3 + 3] * (1 / 255);
|
|
22049
|
+
o3[0] += t4, o3[1] += r4, o3[2] += s2, o3[3] += f2, i3[0] += t4 * t4, i3[1] += t4 * r4, i3[2] += t4 * s2, i3[3] += t4 * f2, i3[5] += r4 * r4, i3[6] += r4 * s2, i3[7] += r4 * f2, i3[10] += s2 * s2, i3[11] += s2 * f2, i3[15] += f2 * f2;
|
|
22050
|
+
}
|
|
22051
|
+
return i3[4] = i3[1], i3[8] = i3[2], i3[9] = i3[6], i3[12] = i3[3], i3[13] = i3[7], i3[14] = i3[11], { R: i3, m: o3, N: a2 };
|
|
22052
|
+
}
|
|
22053
|
+
function estats(e3) {
|
|
22054
|
+
const { R: t3 } = e3, { m: r3 } = e3, { N: i3 } = e3, a2 = r3[0], s2 = r3[1], f2 = r3[2], l2 = r3[3], c2 = 0 == i3 ? 0 : 1 / i3, u = [t3[0] - a2 * a2 * c2, t3[1] - a2 * s2 * c2, t3[2] - a2 * f2 * c2, t3[3] - a2 * l2 * c2, t3[4] - s2 * a2 * c2, t3[5] - s2 * s2 * c2, t3[6] - s2 * f2 * c2, t3[7] - s2 * l2 * c2, t3[8] - f2 * a2 * c2, t3[9] - f2 * s2 * c2, t3[10] - f2 * f2 * c2, t3[11] - f2 * l2 * c2, t3[12] - l2 * a2 * c2, t3[13] - l2 * s2 * c2, t3[14] - l2 * f2 * c2, t3[15] - l2 * l2 * c2], h = u, d = o2;
|
|
22055
|
+
let A = [Math.random(), Math.random(), Math.random(), Math.random()], g = 0, p = 0;
|
|
22056
|
+
if (0 != i3) for (let e4 = 0; e4 < 16 && (A = d.multVec(h, A), p = Math.sqrt(d.dot(A, A)), A = d.sml(1 / p, A), !(0 != e4 && Math.abs(p - g) < 1e-9)); e4++) g = p;
|
|
22057
|
+
const m = [a2 * c2, s2 * c2, f2 * c2, l2 * c2];
|
|
22058
|
+
return { Cov: u, q: m, e: A, L: g, eMq255: d.dot(d.sml(255, m), A), eMq: d.dot(A, m), rgba: (Math.round(255 * m[3]) << 24 | Math.round(255 * m[2]) << 16 | Math.round(255 * m[1]) << 8 | Math.round(255 * m[0]) << 0) >>> 0 };
|
|
22059
|
+
}
|
|
22060
|
+
var o2 = { multVec: (e3, t3) => [e3[0] * t3[0] + e3[1] * t3[1] + e3[2] * t3[2] + e3[3] * t3[3], e3[4] * t3[0] + e3[5] * t3[1] + e3[6] * t3[2] + e3[7] * t3[3], e3[8] * t3[0] + e3[9] * t3[1] + e3[10] * t3[2] + e3[11] * t3[3], e3[12] * t3[0] + e3[13] * t3[1] + e3[14] * t3[2] + e3[15] * t3[3]], dot: (e3, t3) => e3[0] * t3[0] + e3[1] * t3[1] + e3[2] * t3[2] + e3[3] * t3[3], sml: (e3, t3) => [e3 * t3[0], e3 * t3[1], e3 * t3[2], e3 * t3[3]] };
|
|
22061
|
+
UPNG.encode = function encode2(e3, t3, r3, i3, o3, a2, s2) {
|
|
22062
|
+
null == i3 && (i3 = 0), null == s2 && (s2 = false);
|
|
22063
|
+
const f2 = compress2(e3, t3, r3, i3, [false, false, false, 0, s2, false]);
|
|
22064
|
+
return compressPNG(f2, -1), _main(f2, t3, r3, o3, a2);
|
|
22065
|
+
}, UPNG.encodeLL = function encodeLL(e3, t3, r3, i3, o3, a2, s2, f2) {
|
|
22066
|
+
const l2 = { ctype: 0 + (1 == i3 ? 0 : 2) + (0 == o3 ? 0 : 4), depth: a2, frames: [] }, c2 = (i3 + o3) * a2, u = c2 * t3;
|
|
22067
|
+
for (let i4 = 0; i4 < e3.length; i4++) l2.frames.push({ rect: { x: 0, y: 0, width: t3, height: r3 }, img: new Uint8Array(e3[i4]), blend: 0, dispose: 1, bpp: Math.ceil(c2 / 8), bpl: Math.ceil(u / 8) });
|
|
22068
|
+
return compressPNG(l2, 0, true), _main(l2, t3, r3, s2, f2);
|
|
22069
|
+
}, UPNG.encode.compress = compress2, UPNG.encode.dither = dither, UPNG.quantize = quantize, UPNG.quantize.getKDtree = getKDtree, UPNG.quantize.getNearest = getNearest;
|
|
22070
|
+
})();
|
|
22071
|
+
const r = { toArrayBuffer(e2, t2) {
|
|
22072
|
+
const i2 = e2.width, o2 = e2.height, a2 = i2 << 2, s2 = e2.getContext("2d").getImageData(0, 0, i2, o2), f2 = new Uint32Array(s2.data.buffer), l2 = (32 * i2 + 31) / 32 << 2, c2 = l2 * o2, u = 122 + c2, h = new ArrayBuffer(u), d = new DataView(h), A = 1 << 20;
|
|
22073
|
+
let g, p, m, w, v = A, b = 0, y = 0, E = 0;
|
|
22074
|
+
function set16(e3) {
|
|
22075
|
+
d.setUint16(y, e3, true), y += 2;
|
|
22076
|
+
}
|
|
22077
|
+
function set32(e3) {
|
|
22078
|
+
d.setUint32(y, e3, true), y += 4;
|
|
22079
|
+
}
|
|
22080
|
+
function seek(e3) {
|
|
22081
|
+
y += e3;
|
|
22082
|
+
}
|
|
22083
|
+
set16(19778), set32(u), seek(4), set32(122), set32(108), set32(i2), set32(-o2 >>> 0), set16(1), set16(32), set32(3), set32(c2), set32(2835), set32(2835), seek(8), set32(16711680), set32(65280), set32(255), set32(4278190080), set32(1466527264), (function convert() {
|
|
22084
|
+
for (; b < o2 && v > 0; ) {
|
|
22085
|
+
for (w = 122 + b * l2, g = 0; g < a2; ) v--, p = f2[E++], m = p >>> 24, d.setUint32(w + g, p << 8 | m), g += 4;
|
|
22086
|
+
b++;
|
|
22087
|
+
}
|
|
22088
|
+
E < f2.length ? (v = A, setTimeout(convert, r._dly)) : t2(h);
|
|
22089
|
+
})();
|
|
22090
|
+
}, toBlob(e2, t2) {
|
|
22091
|
+
this.toArrayBuffer(e2, ((e3) => {
|
|
22092
|
+
t2(new Blob([e3], { type: "image/bmp" }));
|
|
22093
|
+
}));
|
|
22094
|
+
}, _dly: 9 };
|
|
22095
|
+
var i = { CHROME: "CHROME", FIREFOX: "FIREFOX", DESKTOP_SAFARI: "DESKTOP_SAFARI", IE: "IE", IOS: "IOS", ETC: "ETC" }, o = { [i.CHROME]: 16384, [i.FIREFOX]: 11180, [i.DESKTOP_SAFARI]: 16384, [i.IE]: 8192, [i.IOS]: 4096, [i.ETC]: 8192 };
|
|
22096
|
+
const a = "undefined" != typeof window, s = "undefined" != typeof WorkerGlobalScope && self instanceof WorkerGlobalScope, f = a && window.cordova && window.cordova.require && window.cordova.require("cordova/modulemapper"), CustomFile = (a || s) && (f && f.getOriginalSymbol(window, "File") || "undefined" != typeof File && File), CustomFileReader = (a || s) && (f && f.getOriginalSymbol(window, "FileReader") || "undefined" != typeof FileReader && FileReader);
|
|
22097
|
+
function getFilefromDataUrl(e2, t2, r2 = Date.now()) {
|
|
22098
|
+
return new Promise(((i2) => {
|
|
22099
|
+
const o2 = e2.split(","), a2 = o2[0].match(/:(.*?);/)[1], s2 = globalThis.atob(o2[1]);
|
|
22100
|
+
let f2 = s2.length;
|
|
22101
|
+
const l2 = new Uint8Array(f2);
|
|
22102
|
+
for (; f2--; ) l2[f2] = s2.charCodeAt(f2);
|
|
22103
|
+
const c2 = new Blob([l2], { type: a2 });
|
|
22104
|
+
c2.name = t2, c2.lastModified = r2, i2(c2);
|
|
22105
|
+
}));
|
|
22106
|
+
}
|
|
22107
|
+
function getDataUrlFromFile(e2) {
|
|
22108
|
+
return new Promise(((t2, r2) => {
|
|
22109
|
+
const i2 = new CustomFileReader();
|
|
22110
|
+
i2.onload = () => t2(i2.result), i2.onerror = (e3) => r2(e3), i2.readAsDataURL(e2);
|
|
22111
|
+
}));
|
|
22112
|
+
}
|
|
22113
|
+
function loadImage(e2) {
|
|
22114
|
+
return new Promise(((t2, r2) => {
|
|
22115
|
+
const i2 = new Image();
|
|
22116
|
+
i2.onload = () => t2(i2), i2.onerror = (e3) => r2(e3), i2.src = e2;
|
|
22117
|
+
}));
|
|
22118
|
+
}
|
|
22119
|
+
function getBrowserName() {
|
|
22120
|
+
if (void 0 !== getBrowserName.cachedResult) return getBrowserName.cachedResult;
|
|
22121
|
+
let e2 = i.ETC;
|
|
22122
|
+
const { userAgent: t2 } = navigator;
|
|
22123
|
+
return /Chrom(e|ium)/i.test(t2) ? e2 = i.CHROME : /iP(ad|od|hone)/i.test(t2) && /WebKit/i.test(t2) ? e2 = i.IOS : /Safari/i.test(t2) ? e2 = i.DESKTOP_SAFARI : /Firefox/i.test(t2) ? e2 = i.FIREFOX : (/MSIE/i.test(t2) || true == !!document.documentMode) && (e2 = i.IE), getBrowserName.cachedResult = e2, getBrowserName.cachedResult;
|
|
22124
|
+
}
|
|
22125
|
+
function approximateBelowMaximumCanvasSizeOfBrowser(e2, t2) {
|
|
22126
|
+
const r2 = getBrowserName(), i2 = o[r2];
|
|
22127
|
+
let a2 = e2, s2 = t2, f2 = a2 * s2;
|
|
22128
|
+
const l2 = a2 > s2 ? s2 / a2 : a2 / s2;
|
|
22129
|
+
for (; f2 > i2 * i2; ) {
|
|
22130
|
+
const e3 = (i2 + a2) / 2, t3 = (i2 + s2) / 2;
|
|
22131
|
+
e3 < t3 ? (s2 = t3, a2 = t3 * l2) : (s2 = e3 * l2, a2 = e3), f2 = a2 * s2;
|
|
22132
|
+
}
|
|
22133
|
+
return { width: a2, height: s2 };
|
|
22134
|
+
}
|
|
22135
|
+
function getNewCanvasAndCtx(e2, t2) {
|
|
22136
|
+
let r2, i2;
|
|
22137
|
+
try {
|
|
22138
|
+
if (r2 = new OffscreenCanvas(e2, t2), i2 = r2.getContext("2d"), null === i2) throw new Error("getContext of OffscreenCanvas returns null");
|
|
22139
|
+
} catch (e3) {
|
|
22140
|
+
r2 = document.createElement("canvas"), i2 = r2.getContext("2d");
|
|
22141
|
+
}
|
|
22142
|
+
return r2.width = e2, r2.height = t2, [r2, i2];
|
|
22143
|
+
}
|
|
22144
|
+
function drawImageInCanvas(e2, t2) {
|
|
22145
|
+
const { width: r2, height: i2 } = approximateBelowMaximumCanvasSizeOfBrowser(e2.width, e2.height), [o2, a2] = getNewCanvasAndCtx(r2, i2);
|
|
22146
|
+
return t2 && /jpe?g/.test(t2) && (a2.fillStyle = "white", a2.fillRect(0, 0, o2.width, o2.height)), a2.drawImage(e2, 0, 0, o2.width, o2.height), o2;
|
|
22147
|
+
}
|
|
22148
|
+
function isIOS() {
|
|
22149
|
+
return void 0 !== isIOS.cachedResult || (isIOS.cachedResult = ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "undefined" != typeof document && "ontouchend" in document), isIOS.cachedResult;
|
|
22150
|
+
}
|
|
22151
|
+
function drawFileInCanvas(e2, t2 = {}) {
|
|
22152
|
+
return new Promise((function(r2, o2) {
|
|
22153
|
+
let a2, s2;
|
|
22154
|
+
var $Try_2_Post = function() {
|
|
22155
|
+
try {
|
|
22156
|
+
return s2 = drawImageInCanvas(a2, t2.fileType || e2.type), r2([a2, s2]);
|
|
22157
|
+
} catch (e3) {
|
|
22158
|
+
return o2(e3);
|
|
22159
|
+
}
|
|
22160
|
+
}, $Try_2_Catch = function(t3) {
|
|
22161
|
+
try {
|
|
22162
|
+
0;
|
|
22163
|
+
var $Try_3_Catch = function(e3) {
|
|
22164
|
+
try {
|
|
22165
|
+
throw e3;
|
|
22166
|
+
} catch (e4) {
|
|
22167
|
+
return o2(e4);
|
|
22168
|
+
}
|
|
22169
|
+
};
|
|
22170
|
+
try {
|
|
22171
|
+
let t4;
|
|
22172
|
+
return getDataUrlFromFile(e2).then((function(e3) {
|
|
22173
|
+
try {
|
|
22174
|
+
return t4 = e3, loadImage(t4).then((function(e4) {
|
|
22175
|
+
try {
|
|
22176
|
+
return a2 = e4, (function() {
|
|
22177
|
+
try {
|
|
22178
|
+
return $Try_2_Post();
|
|
22179
|
+
} catch (e5) {
|
|
22180
|
+
return o2(e5);
|
|
22181
|
+
}
|
|
22182
|
+
})();
|
|
22183
|
+
} catch (e5) {
|
|
22184
|
+
return $Try_3_Catch(e5);
|
|
22185
|
+
}
|
|
22186
|
+
}), $Try_3_Catch);
|
|
22187
|
+
} catch (e4) {
|
|
22188
|
+
return $Try_3_Catch(e4);
|
|
22189
|
+
}
|
|
22190
|
+
}), $Try_3_Catch);
|
|
22191
|
+
} catch (e3) {
|
|
22192
|
+
$Try_3_Catch(e3);
|
|
22193
|
+
}
|
|
22194
|
+
} catch (e3) {
|
|
22195
|
+
return o2(e3);
|
|
22196
|
+
}
|
|
22197
|
+
};
|
|
22198
|
+
try {
|
|
22199
|
+
if (isIOS() || [i.DESKTOP_SAFARI, i.MOBILE_SAFARI].includes(getBrowserName())) throw new Error("Skip createImageBitmap on IOS and Safari");
|
|
22200
|
+
return createImageBitmap(e2).then((function(e3) {
|
|
22201
|
+
try {
|
|
22202
|
+
return a2 = e3, $Try_2_Post();
|
|
22203
|
+
} catch (e4) {
|
|
22204
|
+
return $Try_2_Catch();
|
|
22205
|
+
}
|
|
22206
|
+
}), $Try_2_Catch);
|
|
22207
|
+
} catch (e3) {
|
|
22208
|
+
$Try_2_Catch();
|
|
22209
|
+
}
|
|
22210
|
+
}));
|
|
22211
|
+
}
|
|
22212
|
+
function canvasToFile(e2, t2, i2, o2, a2 = 1) {
|
|
22213
|
+
return new Promise((function(s2, f2) {
|
|
22214
|
+
let l2;
|
|
22215
|
+
if ("image/png" === t2) {
|
|
22216
|
+
let c2, u, h;
|
|
22217
|
+
return c2 = e2.getContext("2d"), { data: u } = c2.getImageData(0, 0, e2.width, e2.height), h = UPNG.encode([u.buffer], e2.width, e2.height, 4096 * a2), l2 = new Blob([h], { type: t2 }), l2.name = i2, l2.lastModified = o2, $If_4.call(this);
|
|
22218
|
+
}
|
|
22219
|
+
{
|
|
22220
|
+
let $If_5 = function() {
|
|
22221
|
+
return $If_4.call(this);
|
|
22222
|
+
};
|
|
22223
|
+
if ("image/bmp" === t2) return new Promise(((t3) => r.toBlob(e2, t3))).then((function(e3) {
|
|
22224
|
+
try {
|
|
22225
|
+
return l2 = e3, l2.name = i2, l2.lastModified = o2, $If_5.call(this);
|
|
22226
|
+
} catch (e4) {
|
|
22227
|
+
return f2(e4);
|
|
22228
|
+
}
|
|
22229
|
+
}).bind(this), f2);
|
|
22230
|
+
{
|
|
22231
|
+
let $If_6 = function() {
|
|
22232
|
+
return $If_5.call(this);
|
|
22233
|
+
};
|
|
22234
|
+
if ("function" == typeof OffscreenCanvas && e2 instanceof OffscreenCanvas) return e2.convertToBlob({ type: t2, quality: a2 }).then((function(e3) {
|
|
22235
|
+
try {
|
|
22236
|
+
return l2 = e3, l2.name = i2, l2.lastModified = o2, $If_6.call(this);
|
|
22237
|
+
} catch (e4) {
|
|
22238
|
+
return f2(e4);
|
|
22239
|
+
}
|
|
22240
|
+
}).bind(this), f2);
|
|
22241
|
+
{
|
|
22242
|
+
let d;
|
|
22243
|
+
return d = e2.toDataURL(t2, a2), getFilefromDataUrl(d, i2, o2).then((function(e3) {
|
|
22244
|
+
try {
|
|
22245
|
+
return l2 = e3, $If_6.call(this);
|
|
22246
|
+
} catch (e4) {
|
|
22247
|
+
return f2(e4);
|
|
22248
|
+
}
|
|
22249
|
+
}).bind(this), f2);
|
|
22250
|
+
}
|
|
22251
|
+
}
|
|
22252
|
+
}
|
|
22253
|
+
function $If_4() {
|
|
22254
|
+
return s2(l2);
|
|
22255
|
+
}
|
|
22256
|
+
}));
|
|
22257
|
+
}
|
|
22258
|
+
function cleanupCanvasMemory(e2) {
|
|
22259
|
+
e2.width = 0, e2.height = 0;
|
|
22260
|
+
}
|
|
22261
|
+
function isAutoOrientationInBrowser() {
|
|
22262
|
+
return new Promise((function(e2, t2) {
|
|
22263
|
+
let i2, o2, a2, s2;
|
|
22264
|
+
return void 0 !== isAutoOrientationInBrowser.cachedResult ? e2(isAutoOrientationInBrowser.cachedResult) : getFilefromDataUrl("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==", "test.jpg", Date.now()).then((function(r2) {
|
|
22265
|
+
try {
|
|
22266
|
+
return i2 = r2, drawFileInCanvas(i2).then((function(r3) {
|
|
22267
|
+
try {
|
|
22268
|
+
return o2 = r3[1], canvasToFile(o2, i2.type, i2.name, i2.lastModified).then((function(r4) {
|
|
22269
|
+
try {
|
|
22270
|
+
return a2 = r4, cleanupCanvasMemory(o2), drawFileInCanvas(a2).then((function(r5) {
|
|
22271
|
+
try {
|
|
22272
|
+
return s2 = r5[0], isAutoOrientationInBrowser.cachedResult = 1 === s2.width && 2 === s2.height, e2(isAutoOrientationInBrowser.cachedResult);
|
|
22273
|
+
} catch (e3) {
|
|
22274
|
+
return t2(e3);
|
|
22275
|
+
}
|
|
22276
|
+
}), t2);
|
|
22277
|
+
} catch (e3) {
|
|
22278
|
+
return t2(e3);
|
|
22279
|
+
}
|
|
22280
|
+
}), t2);
|
|
22281
|
+
} catch (e3) {
|
|
22282
|
+
return t2(e3);
|
|
22283
|
+
}
|
|
22284
|
+
}), t2);
|
|
22285
|
+
} catch (e3) {
|
|
22286
|
+
return t2(e3);
|
|
22287
|
+
}
|
|
22288
|
+
}), t2);
|
|
22289
|
+
}));
|
|
22290
|
+
}
|
|
22291
|
+
function getExifOrientation(e2) {
|
|
22292
|
+
return new Promise(((t2, r2) => {
|
|
22293
|
+
const i2 = new CustomFileReader();
|
|
22294
|
+
i2.onload = (e3) => {
|
|
22295
|
+
const r3 = new DataView(e3.target.result);
|
|
22296
|
+
if (65496 != r3.getUint16(0, false)) return t2(-2);
|
|
22297
|
+
const i3 = r3.byteLength;
|
|
22298
|
+
let o2 = 2;
|
|
22299
|
+
for (; o2 < i3; ) {
|
|
22300
|
+
if (r3.getUint16(o2 + 2, false) <= 8) return t2(-1);
|
|
22301
|
+
const e4 = r3.getUint16(o2, false);
|
|
22302
|
+
if (o2 += 2, 65505 == e4) {
|
|
22303
|
+
if (1165519206 != r3.getUint32(o2 += 2, false)) return t2(-1);
|
|
22304
|
+
const e5 = 18761 == r3.getUint16(o2 += 6, false);
|
|
22305
|
+
o2 += r3.getUint32(o2 + 4, e5);
|
|
22306
|
+
const i4 = r3.getUint16(o2, e5);
|
|
22307
|
+
o2 += 2;
|
|
22308
|
+
for (let a2 = 0; a2 < i4; a2++) if (274 == r3.getUint16(o2 + 12 * a2, e5)) return t2(r3.getUint16(o2 + 12 * a2 + 8, e5));
|
|
22309
|
+
} else {
|
|
22310
|
+
if (65280 != (65280 & e4)) break;
|
|
22311
|
+
o2 += r3.getUint16(o2, false);
|
|
22312
|
+
}
|
|
22313
|
+
}
|
|
22314
|
+
return t2(-1);
|
|
22315
|
+
}, i2.onerror = (e3) => r2(e3), i2.readAsArrayBuffer(e2);
|
|
22316
|
+
}));
|
|
22317
|
+
}
|
|
22318
|
+
function handleMaxWidthOrHeight(e2, t2) {
|
|
22319
|
+
const { width: r2 } = e2, { height: i2 } = e2, { maxWidthOrHeight: o2 } = t2;
|
|
22320
|
+
let a2, s2 = e2;
|
|
22321
|
+
return isFinite(o2) && (r2 > o2 || i2 > o2) && ([s2, a2] = getNewCanvasAndCtx(r2, i2), r2 > i2 ? (s2.width = o2, s2.height = i2 / r2 * o2) : (s2.width = r2 / i2 * o2, s2.height = o2), a2.drawImage(e2, 0, 0, s2.width, s2.height), cleanupCanvasMemory(e2)), s2;
|
|
22322
|
+
}
|
|
22323
|
+
function followExifOrientation(e2, t2) {
|
|
22324
|
+
const { width: r2 } = e2, { height: i2 } = e2, [o2, a2] = getNewCanvasAndCtx(r2, i2);
|
|
22325
|
+
switch (t2 > 4 && t2 < 9 ? (o2.width = i2, o2.height = r2) : (o2.width = r2, o2.height = i2), t2) {
|
|
22326
|
+
case 2:
|
|
22327
|
+
a2.transform(-1, 0, 0, 1, r2, 0);
|
|
22328
|
+
break;
|
|
22329
|
+
case 3:
|
|
22330
|
+
a2.transform(-1, 0, 0, -1, r2, i2);
|
|
22331
|
+
break;
|
|
22332
|
+
case 4:
|
|
22333
|
+
a2.transform(1, 0, 0, -1, 0, i2);
|
|
22334
|
+
break;
|
|
22335
|
+
case 5:
|
|
22336
|
+
a2.transform(0, 1, 1, 0, 0, 0);
|
|
22337
|
+
break;
|
|
22338
|
+
case 6:
|
|
22339
|
+
a2.transform(0, 1, -1, 0, i2, 0);
|
|
22340
|
+
break;
|
|
22341
|
+
case 7:
|
|
22342
|
+
a2.transform(0, -1, -1, 0, i2, r2);
|
|
22343
|
+
break;
|
|
22344
|
+
case 8:
|
|
22345
|
+
a2.transform(0, -1, 1, 0, 0, r2);
|
|
22346
|
+
}
|
|
22347
|
+
return a2.drawImage(e2, 0, 0, r2, i2), cleanupCanvasMemory(e2), o2;
|
|
22348
|
+
}
|
|
22349
|
+
function compress(e2, t2, r2 = 0) {
|
|
22350
|
+
return new Promise((function(i2, o2) {
|
|
22351
|
+
let a2, s2, f2, l2, c2, u, h, d, A, g, p, m, w, v, b, y, E, F, _, B;
|
|
22352
|
+
function incProgress(e3 = 5) {
|
|
22353
|
+
if (t2.signal && t2.signal.aborted) throw t2.signal.reason;
|
|
22354
|
+
a2 += e3, t2.onProgress(Math.min(a2, 100));
|
|
22355
|
+
}
|
|
22356
|
+
function setProgress(e3) {
|
|
22357
|
+
if (t2.signal && t2.signal.aborted) throw t2.signal.reason;
|
|
22358
|
+
a2 = Math.min(Math.max(e3, a2), 100), t2.onProgress(a2);
|
|
22359
|
+
}
|
|
22360
|
+
return a2 = r2, s2 = t2.maxIteration || 10, f2 = 1024 * t2.maxSizeMB * 1024, incProgress(), drawFileInCanvas(e2, t2).then((function(r3) {
|
|
22361
|
+
try {
|
|
22362
|
+
return [, l2] = r3, incProgress(), c2 = handleMaxWidthOrHeight(l2, t2), incProgress(), new Promise((function(r4, i3) {
|
|
22363
|
+
var o3;
|
|
22364
|
+
if (!(o3 = t2.exifOrientation)) return getExifOrientation(e2).then((function(e3) {
|
|
22365
|
+
try {
|
|
22366
|
+
return o3 = e3, $If_2.call(this);
|
|
22367
|
+
} catch (e4) {
|
|
22368
|
+
return i3(e4);
|
|
22369
|
+
}
|
|
22370
|
+
}).bind(this), i3);
|
|
22371
|
+
function $If_2() {
|
|
22372
|
+
return r4(o3);
|
|
22373
|
+
}
|
|
22374
|
+
return $If_2.call(this);
|
|
22375
|
+
})).then((function(r4) {
|
|
22376
|
+
try {
|
|
22377
|
+
return u = r4, incProgress(), isAutoOrientationInBrowser().then((function(r5) {
|
|
22378
|
+
try {
|
|
22379
|
+
return h = r5 ? c2 : followExifOrientation(c2, u), incProgress(), d = t2.initialQuality || 1, A = t2.fileType || e2.type, canvasToFile(h, A, e2.name, e2.lastModified, d).then((function(r6) {
|
|
22380
|
+
try {
|
|
22381
|
+
{
|
|
22382
|
+
let $Loop_3 = function() {
|
|
22383
|
+
if (s2-- && (b > f2 || b > w)) {
|
|
22384
|
+
let t3, r7;
|
|
22385
|
+
return t3 = B ? 0.95 * _.width : _.width, r7 = B ? 0.95 * _.height : _.height, [E, F] = getNewCanvasAndCtx(t3, r7), F.drawImage(_, 0, 0, t3, r7), d *= "image/png" === A ? 0.85 : 0.95, canvasToFile(E, A, e2.name, e2.lastModified, d).then((function(e3) {
|
|
22386
|
+
try {
|
|
22387
|
+
return y = e3, cleanupCanvasMemory(_), _ = E, b = y.size, setProgress(Math.min(99, Math.floor((v - b) / (v - f2) * 100))), $Loop_3;
|
|
22388
|
+
} catch (e4) {
|
|
22389
|
+
return o2(e4);
|
|
22390
|
+
}
|
|
22391
|
+
}), o2);
|
|
22392
|
+
}
|
|
22393
|
+
return [1];
|
|
22394
|
+
}, $Loop_3_exit = function() {
|
|
22395
|
+
return cleanupCanvasMemory(_), cleanupCanvasMemory(E), cleanupCanvasMemory(c2), cleanupCanvasMemory(h), cleanupCanvasMemory(l2), setProgress(100), i2(y);
|
|
22396
|
+
};
|
|
22397
|
+
if (g = r6, incProgress(), p = g.size > f2, m = g.size > e2.size, !p && !m) return setProgress(100), i2(g);
|
|
22398
|
+
var a3;
|
|
22399
|
+
return w = e2.size, v = g.size, b = v, _ = h, B = !t2.alwaysKeepResolution && p, (a3 = (function(e3) {
|
|
22400
|
+
for (; e3; ) {
|
|
22401
|
+
if (e3.then) return void e3.then(a3, o2);
|
|
22402
|
+
try {
|
|
22403
|
+
if (e3.pop) {
|
|
22404
|
+
if (e3.length) return e3.pop() ? $Loop_3_exit.call(this) : e3;
|
|
22405
|
+
e3 = $Loop_3;
|
|
22406
|
+
} else e3 = e3.call(this);
|
|
22407
|
+
} catch (e4) {
|
|
22408
|
+
return o2(e4);
|
|
22409
|
+
}
|
|
22410
|
+
}
|
|
22411
|
+
}).bind(this))($Loop_3);
|
|
22412
|
+
}
|
|
22413
|
+
} catch (u2) {
|
|
22414
|
+
return o2(u2);
|
|
22415
|
+
}
|
|
22416
|
+
}).bind(this), o2);
|
|
22417
|
+
} catch (e3) {
|
|
22418
|
+
return o2(e3);
|
|
22419
|
+
}
|
|
22420
|
+
}).bind(this), o2);
|
|
22421
|
+
} catch (e3) {
|
|
22422
|
+
return o2(e3);
|
|
22423
|
+
}
|
|
22424
|
+
}).bind(this), o2);
|
|
22425
|
+
} catch (e3) {
|
|
22426
|
+
return o2(e3);
|
|
22427
|
+
}
|
|
22428
|
+
}).bind(this), o2);
|
|
22429
|
+
}));
|
|
22430
|
+
}
|
|
22431
|
+
const l = "\nlet scriptImported = false\nself.addEventListener('message', async (e) => {\n const { file, id, imageCompressionLibUrl, options } = e.data\n options.onProgress = (progress) => self.postMessage({ progress, id })\n try {\n if (!scriptImported) {\n // console.log('[worker] importScripts', imageCompressionLibUrl)\n self.importScripts(imageCompressionLibUrl)\n scriptImported = true\n }\n // console.log('[worker] self', self)\n const compressedFile = await imageCompression(file, options)\n self.postMessage({ file: compressedFile, id })\n } catch (e) {\n // console.error('[worker] error', e)\n self.postMessage({ error: e.message + '\\n' + e.stack, id })\n }\n})\n";
|
|
22432
|
+
let c;
|
|
22433
|
+
function compressOnWebWorker(e2, t2) {
|
|
22434
|
+
return new Promise(((r2, i2) => {
|
|
22435
|
+
c || (c = (function createWorkerScriptURL(e3) {
|
|
22436
|
+
const t3 = [];
|
|
22437
|
+
return t3.push(e3), URL.createObjectURL(new Blob(t3));
|
|
22438
|
+
})(l));
|
|
22439
|
+
const o2 = new Worker(c);
|
|
22440
|
+
o2.addEventListener("message", (function handler(e3) {
|
|
22441
|
+
if (t2.signal && t2.signal.aborted) o2.terminate();
|
|
22442
|
+
else if (void 0 === e3.data.progress) {
|
|
22443
|
+
if (e3.data.error) return i2(new Error(e3.data.error)), void o2.terminate();
|
|
22444
|
+
r2(e3.data.file), o2.terminate();
|
|
22445
|
+
} else t2.onProgress(e3.data.progress);
|
|
22446
|
+
})), o2.addEventListener("error", i2), t2.signal && t2.signal.addEventListener("abort", (() => {
|
|
22447
|
+
i2(t2.signal.reason), o2.terminate();
|
|
22448
|
+
})), o2.postMessage({ file: e2, imageCompressionLibUrl: t2.libURL, options: { ...t2, onProgress: void 0, signal: void 0 } });
|
|
22449
|
+
}));
|
|
22450
|
+
}
|
|
22451
|
+
function imageCompression(e2, t2) {
|
|
22452
|
+
return new Promise((function(r2, i2) {
|
|
22453
|
+
let o2, a2, s2, f2, l2, c2;
|
|
22454
|
+
if (o2 = { ...t2 }, s2 = 0, { onProgress: f2 } = o2, o2.maxSizeMB = o2.maxSizeMB || Number.POSITIVE_INFINITY, l2 = "boolean" != typeof o2.useWebWorker || o2.useWebWorker, delete o2.useWebWorker, o2.onProgress = (e3) => {
|
|
22455
|
+
s2 = e3, "function" == typeof f2 && f2(s2);
|
|
22456
|
+
}, !(e2 instanceof Blob || e2 instanceof CustomFile)) return i2(new Error("The file given is not an instance of Blob or File"));
|
|
22457
|
+
if (!/^image/.test(e2.type)) return i2(new Error("The file given is not an image"));
|
|
22458
|
+
if (c2 = "undefined" != typeof WorkerGlobalScope && self instanceof WorkerGlobalScope, !l2 || "function" != typeof Worker || c2) return compress(e2, o2).then((function(e3) {
|
|
22459
|
+
try {
|
|
22460
|
+
return a2 = e3, $If_4.call(this);
|
|
22461
|
+
} catch (e4) {
|
|
22462
|
+
return i2(e4);
|
|
22463
|
+
}
|
|
22464
|
+
}).bind(this), i2);
|
|
22465
|
+
var u = (function() {
|
|
22466
|
+
try {
|
|
22467
|
+
return $If_4.call(this);
|
|
22468
|
+
} catch (e3) {
|
|
22469
|
+
return i2(e3);
|
|
22470
|
+
}
|
|
22471
|
+
}).bind(this), $Try_1_Catch = function(t3) {
|
|
22472
|
+
try {
|
|
22473
|
+
return compress(e2, o2).then((function(e3) {
|
|
22474
|
+
try {
|
|
22475
|
+
return a2 = e3, u();
|
|
22476
|
+
} catch (e4) {
|
|
22477
|
+
return i2(e4);
|
|
22478
|
+
}
|
|
22479
|
+
}), i2);
|
|
22480
|
+
} catch (e3) {
|
|
22481
|
+
return i2(e3);
|
|
22482
|
+
}
|
|
22483
|
+
};
|
|
22484
|
+
try {
|
|
22485
|
+
return o2.libURL = o2.libURL || "https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js", compressOnWebWorker(e2, o2).then((function(e3) {
|
|
22486
|
+
try {
|
|
22487
|
+
return a2 = e3, u();
|
|
22488
|
+
} catch (e4) {
|
|
22489
|
+
return $Try_1_Catch();
|
|
22490
|
+
}
|
|
22491
|
+
}), $Try_1_Catch);
|
|
22492
|
+
} catch (e3) {
|
|
22493
|
+
$Try_1_Catch();
|
|
22494
|
+
}
|
|
22495
|
+
function $If_4() {
|
|
22496
|
+
try {
|
|
22497
|
+
a2.name = e2.name, a2.lastModified = e2.lastModified;
|
|
22498
|
+
} catch (e3) {
|
|
22499
|
+
}
|
|
22500
|
+
try {
|
|
22501
|
+
o2.preserveExif && "image/jpeg" === e2.type && (!o2.fileType || o2.fileType && o2.fileType === e2.type) && (a2 = copyExifWithoutOrientation(e2, a2));
|
|
22502
|
+
} catch (e3) {
|
|
22503
|
+
}
|
|
22504
|
+
return r2(a2);
|
|
22505
|
+
}
|
|
22506
|
+
}));
|
|
22507
|
+
}
|
|
22508
|
+
imageCompression.getDataUrlFromFile = getDataUrlFromFile, imageCompression.getFilefromDataUrl = getFilefromDataUrl, imageCompression.loadImage = loadImage, imageCompression.drawImageInCanvas = drawImageInCanvas, imageCompression.drawFileInCanvas = drawFileInCanvas, imageCompression.canvasToFile = canvasToFile, imageCompression.getExifOrientation = getExifOrientation, imageCompression.handleMaxWidthOrHeight = handleMaxWidthOrHeight, imageCompression.followExifOrientation = followExifOrientation, imageCompression.cleanupCanvasMemory = cleanupCanvasMemory, imageCompression.isAutoOrientationInBrowser = isAutoOrientationInBrowser, imageCompression.approximateBelowMaximumCanvasSizeOfBrowser = approximateBelowMaximumCanvasSizeOfBrowser, imageCompression.copyExifWithoutOrientation = copyExifWithoutOrientation, imageCompression.getBrowserName = getBrowserName, imageCompression.version = "2.0.2";
|
|
20711
22509
|
const TOOLBAR_FEATURES = {
|
|
20712
22510
|
[EditorTypes.Blog]: {
|
|
20713
22511
|
showFormatting: true,
|
|
20714
22512
|
showImage: true,
|
|
20715
22513
|
showVideo: true,
|
|
20716
|
-
showAudio:
|
|
22514
|
+
showAudio: false,
|
|
20717
22515
|
showImageSearch: true,
|
|
20718
22516
|
showLink: true
|
|
20719
22517
|
},
|
|
@@ -20746,13 +22544,13 @@ const Toolbar = ({
|
|
|
20746
22544
|
const editorState = useEditorStateSnapshot(editor);
|
|
20747
22545
|
const { showCrossMentionIndicator } = useEditorWithMentionTracking(editor, { debounceMs: 150 });
|
|
20748
22546
|
const { trackFeature } = useAnalyticsTracking();
|
|
20749
|
-
const { t } = usePostBuilder();
|
|
22547
|
+
const { t: t2 } = usePostBuilder();
|
|
20750
22548
|
if (!editor) return null;
|
|
20751
22549
|
const features = TOOLBAR_FEATURES[editorType];
|
|
20752
|
-
const handleClickLink = (
|
|
22550
|
+
const handleClickLink = (e2) => {
|
|
20753
22551
|
if (editorState?.isLink) {
|
|
20754
22552
|
editor.chain().focus().unsetLink().run();
|
|
20755
|
-
|
|
22553
|
+
e2.preventDefault();
|
|
20756
22554
|
}
|
|
20757
22555
|
};
|
|
20758
22556
|
const handleInsertLink = (link, text2, uid, previewPayload) => {
|
|
@@ -20782,29 +22580,42 @@ const Toolbar = ({
|
|
|
20782
22580
|
if (checkUploadLimitHit()) return;
|
|
20783
22581
|
fileInputRef?.current?.click();
|
|
20784
22582
|
};
|
|
20785
|
-
const handleAddMedia = (
|
|
20786
|
-
const
|
|
20787
|
-
if (
|
|
20788
|
-
|
|
20789
|
-
if (files
|
|
20790
|
-
|
|
20791
|
-
|
|
20792
|
-
|
|
20793
|
-
|
|
20794
|
-
|
|
20795
|
-
|
|
20796
|
-
|
|
20797
|
-
|
|
20798
|
-
|
|
20799
|
-
|
|
20800
|
-
|
|
20801
|
-
|
|
22583
|
+
const handleAddMedia = async (e2) => {
|
|
22584
|
+
const fileList = e2.target.files;
|
|
22585
|
+
if (!fileList || !mediaType) return;
|
|
22586
|
+
let files = Array.from(fileList);
|
|
22587
|
+
if (files.length > MAX_FILES) {
|
|
22588
|
+
toast.error(
|
|
22589
|
+
`You can upload up to ${MAX_FILES} files per post. Picking the first ${MAX_FILES} files`
|
|
22590
|
+
);
|
|
22591
|
+
files = files.slice(0, MAX_FILES);
|
|
22592
|
+
}
|
|
22593
|
+
if (mediaType === MediaNodeTypes.Image) {
|
|
22594
|
+
files = await Promise.all(
|
|
22595
|
+
files.map(async (file) => {
|
|
22596
|
+
try {
|
|
22597
|
+
const normalized = await imageCompression(file, {
|
|
22598
|
+
maxSizeMB: 10
|
|
22599
|
+
});
|
|
22600
|
+
return normalized;
|
|
22601
|
+
} catch (error) {
|
|
22602
|
+
return file;
|
|
22603
|
+
}
|
|
22604
|
+
})
|
|
22605
|
+
);
|
|
20802
22606
|
}
|
|
20803
|
-
|
|
22607
|
+
files.forEach((file) => {
|
|
22608
|
+
editor.commands.insertMediaWithUpload({
|
|
22609
|
+
source: file,
|
|
22610
|
+
type: mediaType,
|
|
22611
|
+
mediaType: MediaItemType.MEDIA_ITEM
|
|
22612
|
+
});
|
|
22613
|
+
});
|
|
22614
|
+
e2.target.value = "";
|
|
20804
22615
|
};
|
|
20805
|
-
const handleOpenGifPicker = (
|
|
22616
|
+
const handleOpenGifPicker = (e2) => {
|
|
20806
22617
|
if (checkUploadLimitHit()) {
|
|
20807
|
-
|
|
22618
|
+
e2.preventDefault();
|
|
20808
22619
|
return;
|
|
20809
22620
|
}
|
|
20810
22621
|
};
|
|
@@ -20872,7 +22683,7 @@ const Toolbar = ({
|
|
|
20872
22683
|
children: [
|
|
20873
22684
|
/* @__PURE__ */ jsx(Type, {}),
|
|
20874
22685
|
" ",
|
|
20875
|
-
|
|
22686
|
+
t2("paragraphKey")
|
|
20876
22687
|
]
|
|
20877
22688
|
}
|
|
20878
22689
|
) }),
|
|
@@ -20888,7 +22699,7 @@ const Toolbar = ({
|
|
|
20888
22699
|
children: [
|
|
20889
22700
|
/* @__PURE__ */ jsx(Heading1, {}),
|
|
20890
22701
|
" ",
|
|
20891
|
-
|
|
22702
|
+
t2("heading1Key")
|
|
20892
22703
|
]
|
|
20893
22704
|
}
|
|
20894
22705
|
) }),
|
|
@@ -20904,7 +22715,7 @@ const Toolbar = ({
|
|
|
20904
22715
|
children: [
|
|
20905
22716
|
/* @__PURE__ */ jsx(Heading2, {}),
|
|
20906
22717
|
" ",
|
|
20907
|
-
|
|
22718
|
+
t2("heading2Key")
|
|
20908
22719
|
]
|
|
20909
22720
|
}
|
|
20910
22721
|
) }),
|
|
@@ -20920,7 +22731,7 @@ const Toolbar = ({
|
|
|
20920
22731
|
children: [
|
|
20921
22732
|
/* @__PURE__ */ jsx(Heading3, {}),
|
|
20922
22733
|
" ",
|
|
20923
|
-
|
|
22734
|
+
t2("heading3Key")
|
|
20924
22735
|
]
|
|
20925
22736
|
}
|
|
20926
22737
|
) })
|
|
@@ -21156,6 +22967,7 @@ const Toolbar = ({
|
|
|
21156
22967
|
open: imageSearchModalOpen,
|
|
21157
22968
|
onOpenChange: setImageSearchModalOpen,
|
|
21158
22969
|
onImageSelect: handleImageClick,
|
|
22970
|
+
initialQuery: extractInitialSearchQuery(editor),
|
|
21159
22971
|
children: /* @__PURE__ */ jsx(
|
|
21160
22972
|
ToolbarButton,
|
|
21161
22973
|
{
|
|
@@ -21203,7 +23015,7 @@ const Toolbar = ({
|
|
|
21203
23015
|
}
|
|
21204
23016
|
),
|
|
21205
23017
|
/* @__PURE__ */ jsxs(Label$1, { htmlFor: "send-cross-mention", children: [
|
|
21206
|
-
|
|
23018
|
+
t2("crossPostKey"),
|
|
21207
23019
|
" ",
|
|
21208
23020
|
/* @__PURE__ */ jsx(Forward, {})
|
|
21209
23021
|
] })
|
|
@@ -21218,7 +23030,7 @@ const Toolbar = ({
|
|
|
21218
23030
|
"cursor-pointer bg-primary-send hover:bg-primary-send/85 active:scale-95 w-fit ml-auto"
|
|
21219
23031
|
),
|
|
21220
23032
|
children: [
|
|
21221
|
-
|
|
23033
|
+
t2("postKey"),
|
|
21222
23034
|
" ",
|
|
21223
23035
|
isSubmitting ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsx(SendHorizontal, {})
|
|
21224
23036
|
]
|
|
@@ -21333,8 +23145,8 @@ const useHostAnalyticsBridge = () => {
|
|
|
21333
23145
|
const processedRequestIds = useRef(/* @__PURE__ */ new Set());
|
|
21334
23146
|
useEffect(() => {
|
|
21335
23147
|
if (!sessionId) return;
|
|
21336
|
-
const onPublishSuccess = (
|
|
21337
|
-
const { postId, postType, groupId } =
|
|
23148
|
+
const onPublishSuccess = (e2) => {
|
|
23149
|
+
const { postId, postType, groupId } = e2.detail;
|
|
21338
23150
|
if (!postId || processedRequestIds.current.has(postId)) return;
|
|
21339
23151
|
processedRequestIds.current.add(postId);
|
|
21340
23152
|
trackPublish(sessionId, {
|
|
@@ -21352,8 +23164,8 @@ const useHostAnalyticsBridge = () => {
|
|
|
21352
23164
|
})
|
|
21353
23165
|
);
|
|
21354
23166
|
};
|
|
21355
|
-
const onPublishFailed = (
|
|
21356
|
-
const { postId, postType, groupId, failureReason } =
|
|
23167
|
+
const onPublishFailed = (e2) => {
|
|
23168
|
+
const { postId, postType, groupId, failureReason } = e2.detail;
|
|
21357
23169
|
if (!postId || processedRequestIds.current.has(postId)) return;
|
|
21358
23170
|
processedRequestIds.current.add(postId);
|
|
21359
23171
|
trackPublish(sessionId, {
|
|
@@ -21392,13 +23204,124 @@ const useHostAnalyticsBridge = () => {
|
|
|
21392
23204
|
};
|
|
21393
23205
|
}, [sessionId, editorType, placement, trackPublish, deleteSession, createSession]);
|
|
21394
23206
|
};
|
|
23207
|
+
const extractTextContent = (json) => {
|
|
23208
|
+
if (!json) return "";
|
|
23209
|
+
let text2 = "";
|
|
23210
|
+
const traverse2 = (node) => {
|
|
23211
|
+
if (node.type === "text" && node.text) {
|
|
23212
|
+
text2 += node.text;
|
|
23213
|
+
}
|
|
23214
|
+
if (node.content && Array.isArray(node.content)) {
|
|
23215
|
+
node.content.forEach((child) => traverse2(child));
|
|
23216
|
+
}
|
|
23217
|
+
};
|
|
23218
|
+
traverse2(json);
|
|
23219
|
+
return text2.trim();
|
|
23220
|
+
};
|
|
23221
|
+
const extractPollQuestion = (pollJson) => {
|
|
23222
|
+
if (!pollJson?.content) return "";
|
|
23223
|
+
const paragraphs = pollJson.content.filter((node) => node.type === "paragraph");
|
|
23224
|
+
let text2 = "";
|
|
23225
|
+
paragraphs.forEach((para) => {
|
|
23226
|
+
if (para.content) {
|
|
23227
|
+
para.content.forEach((child) => {
|
|
23228
|
+
if (child.type === "text" && child.text) {
|
|
23229
|
+
text2 += child.text;
|
|
23230
|
+
}
|
|
23231
|
+
});
|
|
23232
|
+
}
|
|
23233
|
+
});
|
|
23234
|
+
return text2.trim();
|
|
23235
|
+
};
|
|
23236
|
+
const isPollEmpty = (pollJson) => {
|
|
23237
|
+
if (!pollJson || !pollJson.content) return true;
|
|
23238
|
+
const questionText = extractPollQuestion(pollJson);
|
|
23239
|
+
if (questionText) {
|
|
23240
|
+
return false;
|
|
23241
|
+
}
|
|
23242
|
+
const pollNode = pollJson.content.find((node) => node.type === "poll");
|
|
23243
|
+
if (pollNode?.attrs?.choices && Array.isArray(pollNode.attrs.choices) && pollNode.attrs.choices.length > 0) {
|
|
23244
|
+
return false;
|
|
23245
|
+
}
|
|
23246
|
+
return true;
|
|
23247
|
+
};
|
|
23248
|
+
const extractParagraphNodes = (json) => {
|
|
23249
|
+
if (!json?.content) return [];
|
|
23250
|
+
return json.content.filter((node) => node.type === "paragraph");
|
|
23251
|
+
};
|
|
23252
|
+
const removeLinksForPollSync = (paragraphs) => {
|
|
23253
|
+
const unsupportedNodeTypes = /* @__PURE__ */ new Set(["linkPreview", "media", "mediaGroup", "embed", "image"]);
|
|
23254
|
+
return paragraphs.map((para) => {
|
|
23255
|
+
if (!para?.content) return para;
|
|
23256
|
+
return {
|
|
23257
|
+
...para,
|
|
23258
|
+
content: para?.content?.map((node) => {
|
|
23259
|
+
if (unsupportedNodeTypes.has(node?.type || "")) {
|
|
23260
|
+
return null;
|
|
23261
|
+
}
|
|
23262
|
+
if (node?.type === "text" && node?.marks) {
|
|
23263
|
+
return {
|
|
23264
|
+
...node,
|
|
23265
|
+
// Filter out all link-related marks (customLink, link)
|
|
23266
|
+
marks: node?.marks?.filter(
|
|
23267
|
+
(mark) => mark?.type !== "customLink" && mark?.type !== "link"
|
|
23268
|
+
)
|
|
23269
|
+
};
|
|
23270
|
+
}
|
|
23271
|
+
return node;
|
|
23272
|
+
})?.filter((node) => node !== null)
|
|
23273
|
+
};
|
|
23274
|
+
});
|
|
23275
|
+
};
|
|
23276
|
+
const createPollContentFromNodes = (paragraphs, existingPollNode) => {
|
|
23277
|
+
const content = [];
|
|
23278
|
+
if (paragraphs.length > 0) {
|
|
23279
|
+
content.push(...paragraphs);
|
|
23280
|
+
}
|
|
23281
|
+
content.push(
|
|
23282
|
+
{
|
|
23283
|
+
type: "poll",
|
|
23284
|
+
attrs: {
|
|
23285
|
+
choices: []
|
|
23286
|
+
}
|
|
23287
|
+
}
|
|
23288
|
+
);
|
|
23289
|
+
return {
|
|
23290
|
+
type: "doc",
|
|
23291
|
+
content
|
|
23292
|
+
};
|
|
23293
|
+
};
|
|
23294
|
+
const syncFromPostToOtherTabs = (postJson) => {
|
|
23295
|
+
if (typeof window === "undefined" || typeof localStorage === "undefined") return;
|
|
23296
|
+
const postText = extractTextContent(postJson);
|
|
23297
|
+
if (!postText) {
|
|
23298
|
+
return;
|
|
23299
|
+
}
|
|
23300
|
+
const blogDraftString = localStorage.getItem(`${EditorTypes.Blog}-draft`);
|
|
23301
|
+
if (!blogDraftString) {
|
|
23302
|
+
localStorage.setItem(`${EditorTypes.Blog}-draft`, JSON.stringify(postJson));
|
|
23303
|
+
}
|
|
23304
|
+
const pollDraftString = localStorage.getItem(`${EditorTypes.Poll}-draft`);
|
|
23305
|
+
if (!pollDraftString) {
|
|
23306
|
+
let postParagraphs = extractParagraphNodes(postJson);
|
|
23307
|
+
postParagraphs = removeLinksForPollSync(postParagraphs);
|
|
23308
|
+
const pollContent = createPollContentFromNodes(postParagraphs);
|
|
23309
|
+
localStorage.setItem(`${EditorTypes.Poll}-draft`, JSON.stringify(pollContent));
|
|
23310
|
+
}
|
|
23311
|
+
};
|
|
21395
23312
|
const usePersistence = () => {
|
|
21396
23313
|
const saveCurrentTabContent = (editorType, editor) => {
|
|
21397
23314
|
if (typeof window === "undefined" || typeof localStorage === "undefined" || !editor) return;
|
|
23315
|
+
const hasContent = !!getTabContent(editorType);
|
|
23316
|
+
const isEditorEmpty = editor?.isEmpty;
|
|
23317
|
+
const shouldSaveContent = hasContent || !isEditorEmpty;
|
|
21398
23318
|
const json = editor?.getJSON();
|
|
21399
23319
|
const filteredJson = filterNodes(json, (node) => !node?.attrs?.uploading);
|
|
21400
|
-
if (filteredJson)
|
|
21401
|
-
|
|
23320
|
+
if (editorType === EditorTypes.Poll && isPollEmpty(filteredJson)) return;
|
|
23321
|
+
if (!shouldSaveContent || !filteredJson) return;
|
|
23322
|
+
localStorage.setItem(`${editorType}-draft`, JSON.stringify(filteredJson));
|
|
23323
|
+
if (editorType === EditorTypes.Media) {
|
|
23324
|
+
syncFromPostToOtherTabs(filteredJson);
|
|
21402
23325
|
}
|
|
21403
23326
|
};
|
|
21404
23327
|
const getTabContent = useCallback((editorType) => {
|
|
@@ -21453,9 +23376,9 @@ const ResizableWrapper = ({
|
|
|
21453
23376
|
const startWidth = useRef(width);
|
|
21454
23377
|
const latestDelta = useRef(0);
|
|
21455
23378
|
const frame = useRef(null);
|
|
21456
|
-
const onMouseDown = (
|
|
21457
|
-
|
|
21458
|
-
startX.current =
|
|
23379
|
+
const onMouseDown = (e2, handle) => {
|
|
23380
|
+
e2.preventDefault();
|
|
23381
|
+
startX.current = e2.clientX;
|
|
21459
23382
|
startWidth.current = currentWidth;
|
|
21460
23383
|
setActiveHandle(handle);
|
|
21461
23384
|
setIsResizing(true);
|
|
@@ -21476,9 +23399,9 @@ const ResizableWrapper = ({
|
|
|
21476
23399
|
onResize?.(newWidth);
|
|
21477
23400
|
frame.current = null;
|
|
21478
23401
|
};
|
|
21479
|
-
const onMouseMove = (
|
|
23402
|
+
const onMouseMove = (e2) => {
|
|
21480
23403
|
if (!isResizing || !activeHandle) return;
|
|
21481
|
-
latestDelta.current =
|
|
23404
|
+
latestDelta.current = e2.clientX - startX.current;
|
|
21482
23405
|
if (!frame.current) frame.current = requestAnimationFrame(updateWidth);
|
|
21483
23406
|
};
|
|
21484
23407
|
const onMouseUp = () => {
|
|
@@ -21510,14 +23433,14 @@ const ResizableWrapper = ({
|
|
|
21510
23433
|
/* @__PURE__ */ jsx(
|
|
21511
23434
|
"div",
|
|
21512
23435
|
{
|
|
21513
|
-
onMouseDown: (
|
|
23436
|
+
onMouseDown: (e2) => onMouseDown(e2, "left"),
|
|
21514
23437
|
className: "absolute left-2 top-1/2 -translate-y-1/2 w-2 h-8 bg-blue-500 rounded-full cursor-col-resize opacity-0 group-hover:opacity-100"
|
|
21515
23438
|
}
|
|
21516
23439
|
),
|
|
21517
23440
|
/* @__PURE__ */ jsx(
|
|
21518
23441
|
"div",
|
|
21519
23442
|
{
|
|
21520
|
-
onMouseDown: (
|
|
23443
|
+
onMouseDown: (e2) => onMouseDown(e2, "right"),
|
|
21521
23444
|
className: "absolute right-2 top-1/2 -translate-y-1/2 w-2 h-8 bg-blue-500 rounded-full cursor-col-resize opacity-0 group-hover:opacity-100"
|
|
21522
23445
|
}
|
|
21523
23446
|
)
|
|
@@ -21749,7 +23672,7 @@ const MediaNodeView = ({
|
|
|
21749
23672
|
className: cn("flex items-center justify-center bg-muted"),
|
|
21750
23673
|
children: /* @__PURE__ */ jsxs("div", { className: "text-center space-y-3", children: [
|
|
21751
23674
|
/* @__PURE__ */ jsxs("div", { className: "flex justify-center", children: [
|
|
21752
|
-
node.attrs.type === MediaNodeTypes.Image && /* @__PURE__ */ jsx(Image$
|
|
23675
|
+
node.attrs.type === MediaNodeTypes.Image && /* @__PURE__ */ jsx(Image$2, { className: "w-12 h-12 text-muted-foreground/50" }),
|
|
21753
23676
|
node.attrs.type === MediaNodeTypes.Video && /* @__PURE__ */ jsx(Video, { className: "w-12 h-12 text-muted-foreground/50" }),
|
|
21754
23677
|
node.attrs.type === MediaNodeTypes.Audio && /* @__PURE__ */ jsx(Music, { className: "w-12 h-12 text-muted-foreground/50" })
|
|
21755
23678
|
] }),
|
|
@@ -22200,8 +24123,8 @@ class StepMap {
|
|
|
22200
24123
|
recover(value) {
|
|
22201
24124
|
let diff = 0, index2 = recoverIndex(value);
|
|
22202
24125
|
if (!this.inverted)
|
|
22203
|
-
for (let
|
|
22204
|
-
diff += this.ranges[
|
|
24126
|
+
for (let i2 = 0; i2 < index2; i2++)
|
|
24127
|
+
diff += this.ranges[i2 * 3 + 2] - this.ranges[i2 * 3 + 1];
|
|
22205
24128
|
return this.ranges[index2 * 3] + diff + recoverOffset(value);
|
|
22206
24129
|
}
|
|
22207
24130
|
mapResult(pos, assoc = 1) {
|
|
@@ -22215,17 +24138,17 @@ class StepMap {
|
|
|
22215
24138
|
*/
|
|
22216
24139
|
_map(pos, assoc, simple) {
|
|
22217
24140
|
let diff = 0, oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
|
|
22218
|
-
for (let
|
|
22219
|
-
let start2 = this.ranges[
|
|
24141
|
+
for (let i2 = 0; i2 < this.ranges.length; i2 += 3) {
|
|
24142
|
+
let start2 = this.ranges[i2] - (this.inverted ? diff : 0);
|
|
22220
24143
|
if (start2 > pos)
|
|
22221
24144
|
break;
|
|
22222
|
-
let oldSize = this.ranges[
|
|
24145
|
+
let oldSize = this.ranges[i2 + oldIndex], newSize = this.ranges[i2 + newIndex], end2 = start2 + oldSize;
|
|
22223
24146
|
if (pos <= end2) {
|
|
22224
24147
|
let side = !oldSize ? assoc : pos == start2 ? -1 : pos == end2 ? 1 : assoc;
|
|
22225
24148
|
let result = start2 + diff + (side < 0 ? 0 : newSize);
|
|
22226
24149
|
if (simple)
|
|
22227
24150
|
return result;
|
|
22228
|
-
let recover = pos == (assoc < 0 ? start2 : end2) ? null : makeRecover(
|
|
24151
|
+
let recover = pos == (assoc < 0 ? start2 : end2) ? null : makeRecover(i2 / 3, pos - start2);
|
|
22229
24152
|
let del = pos == start2 ? DEL_AFTER : pos == end2 ? DEL_BEFORE : DEL_ACROSS;
|
|
22230
24153
|
if (assoc < 0 ? pos != start2 : pos != end2)
|
|
22231
24154
|
del |= DEL_SIDE;
|
|
@@ -22241,14 +24164,14 @@ class StepMap {
|
|
|
22241
24164
|
touches(pos, recover) {
|
|
22242
24165
|
let diff = 0, index2 = recoverIndex(recover);
|
|
22243
24166
|
let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
|
|
22244
|
-
for (let
|
|
22245
|
-
let start2 = this.ranges[
|
|
24167
|
+
for (let i2 = 0; i2 < this.ranges.length; i2 += 3) {
|
|
24168
|
+
let start2 = this.ranges[i2] - (this.inverted ? diff : 0);
|
|
22246
24169
|
if (start2 > pos)
|
|
22247
24170
|
break;
|
|
22248
|
-
let oldSize = this.ranges[
|
|
22249
|
-
if (pos <= end2 &&
|
|
24171
|
+
let oldSize = this.ranges[i2 + oldIndex], end2 = start2 + oldSize;
|
|
24172
|
+
if (pos <= end2 && i2 == index2 * 3)
|
|
22250
24173
|
return true;
|
|
22251
|
-
diff += this.ranges[
|
|
24174
|
+
diff += this.ranges[i2 + newIndex] - oldSize;
|
|
22252
24175
|
}
|
|
22253
24176
|
return false;
|
|
22254
24177
|
}
|
|
@@ -22256,12 +24179,12 @@ class StepMap {
|
|
|
22256
24179
|
Calls the given function on each of the changed ranges included in
|
|
22257
24180
|
this map.
|
|
22258
24181
|
*/
|
|
22259
|
-
forEach(
|
|
24182
|
+
forEach(f2) {
|
|
22260
24183
|
let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
|
|
22261
|
-
for (let
|
|
22262
|
-
let start2 = this.ranges[
|
|
22263
|
-
let oldSize = this.ranges[
|
|
22264
|
-
|
|
24184
|
+
for (let i2 = 0, diff = 0; i2 < this.ranges.length; i2 += 3) {
|
|
24185
|
+
let start2 = this.ranges[i2], oldStart = start2 - (this.inverted ? diff : 0), newStart = start2 + (this.inverted ? 0 : diff);
|
|
24186
|
+
let oldSize = this.ranges[i2 + oldIndex], newSize = this.ranges[i2 + newIndex];
|
|
24187
|
+
f2(oldStart, oldStart + oldSize, newStart, newStart + newSize);
|
|
22265
24188
|
diff += newSize - oldSize;
|
|
22266
24189
|
}
|
|
22267
24190
|
}
|
|
@@ -22360,21 +24283,21 @@ class StepResult {
|
|
|
22360
24283
|
static fromReplace(doc, from, to, slice) {
|
|
22361
24284
|
try {
|
|
22362
24285
|
return StepResult.ok(doc.replace(from, to, slice));
|
|
22363
|
-
} catch (
|
|
22364
|
-
if (
|
|
22365
|
-
return StepResult.fail(
|
|
22366
|
-
throw
|
|
24286
|
+
} catch (e2) {
|
|
24287
|
+
if (e2 instanceof ReplaceError)
|
|
24288
|
+
return StepResult.fail(e2.message);
|
|
24289
|
+
throw e2;
|
|
22367
24290
|
}
|
|
22368
24291
|
}
|
|
22369
24292
|
}
|
|
22370
|
-
function mapFragment(fragment,
|
|
24293
|
+
function mapFragment(fragment, f2, parent2) {
|
|
22371
24294
|
let mapped = [];
|
|
22372
|
-
for (let
|
|
22373
|
-
let child = fragment.child(
|
|
24295
|
+
for (let i2 = 0; i2 < fragment.childCount; i2++) {
|
|
24296
|
+
let child = fragment.child(i2);
|
|
22374
24297
|
if (child.content.size)
|
|
22375
|
-
child = child.copy(mapFragment(child.content,
|
|
24298
|
+
child = child.copy(mapFragment(child.content, f2, child));
|
|
22376
24299
|
if (child.isInline)
|
|
22377
|
-
child =
|
|
24300
|
+
child = f2(child, parent2, i2);
|
|
22378
24301
|
mapped.push(child);
|
|
22379
24302
|
}
|
|
22380
24303
|
return Fragment.fromArray(mapped);
|
|
@@ -22501,9 +24424,9 @@ class AddNodeMarkStep extends Step {
|
|
|
22501
24424
|
if (node) {
|
|
22502
24425
|
let newSet = this.mark.addToSet(node.marks);
|
|
22503
24426
|
if (newSet.length == node.marks.length) {
|
|
22504
|
-
for (let
|
|
22505
|
-
if (!node.marks[
|
|
22506
|
-
return new AddNodeMarkStep(this.pos, node.marks[
|
|
24427
|
+
for (let i2 = 0; i2 < node.marks.length; i2++)
|
|
24428
|
+
if (!node.marks[i2].isInSet(newSet))
|
|
24429
|
+
return new AddNodeMarkStep(this.pos, node.marks[i2]);
|
|
22507
24430
|
return new AddNodeMarkStep(this.pos, this.mark);
|
|
22508
24431
|
}
|
|
22509
24432
|
}
|
|
@@ -22862,8 +24785,8 @@ class Selection {
|
|
|
22862
24785
|
*/
|
|
22863
24786
|
get empty() {
|
|
22864
24787
|
let ranges = this.ranges;
|
|
22865
|
-
for (let
|
|
22866
|
-
if (ranges[
|
|
24788
|
+
for (let i2 = 0; i2 < ranges.length; i2++)
|
|
24789
|
+
if (ranges[i2].$from.pos != ranges[i2].$to.pos)
|
|
22867
24790
|
return false;
|
|
22868
24791
|
return true;
|
|
22869
24792
|
}
|
|
@@ -22879,15 +24802,15 @@ class Selection {
|
|
|
22879
24802
|
*/
|
|
22880
24803
|
replace(tr, content = Slice.empty) {
|
|
22881
24804
|
let lastNode = content.content.lastChild, lastParent = null;
|
|
22882
|
-
for (let
|
|
24805
|
+
for (let i2 = 0; i2 < content.openEnd; i2++) {
|
|
22883
24806
|
lastParent = lastNode;
|
|
22884
24807
|
lastNode = lastNode.lastChild;
|
|
22885
24808
|
}
|
|
22886
24809
|
let mapFrom = tr.steps.length, ranges = this.ranges;
|
|
22887
|
-
for (let
|
|
22888
|
-
let { $from, $to } = ranges[
|
|
22889
|
-
tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos),
|
|
22890
|
-
if (
|
|
24810
|
+
for (let i2 = 0; i2 < ranges.length; i2++) {
|
|
24811
|
+
let { $from, $to } = ranges[i2], mapping = tr.mapping.slice(mapFrom);
|
|
24812
|
+
tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i2 ? Slice.empty : content);
|
|
24813
|
+
if (i2 == 0)
|
|
22891
24814
|
selectionToInsertionEnd(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1);
|
|
22892
24815
|
}
|
|
22893
24816
|
}
|
|
@@ -22897,10 +24820,10 @@ class Selection {
|
|
|
22897
24820
|
*/
|
|
22898
24821
|
replaceWith(tr, node) {
|
|
22899
24822
|
let mapFrom = tr.steps.length, ranges = this.ranges;
|
|
22900
|
-
for (let
|
|
22901
|
-
let { $from, $to } = ranges[
|
|
24823
|
+
for (let i2 = 0; i2 < ranges.length; i2++) {
|
|
24824
|
+
let { $from, $to } = ranges[i2], mapping = tr.mapping.slice(mapFrom);
|
|
22902
24825
|
let from = mapping.map($from.pos), to = mapping.map($to.pos);
|
|
22903
|
-
if (
|
|
24826
|
+
if (i2) {
|
|
22904
24827
|
tr.deleteRange(from, to);
|
|
22905
24828
|
} else {
|
|
22906
24829
|
tr.replaceRangeWith(from, to, node);
|
|
@@ -23220,8 +25143,8 @@ const AllBookmark = {
|
|
|
23220
25143
|
function findSelectionIn(doc, node, pos, index2, dir, text2 = false) {
|
|
23221
25144
|
if (node.inlineContent)
|
|
23222
25145
|
return TextSelection.create(doc, pos);
|
|
23223
|
-
for (let
|
|
23224
|
-
let child = node.child(
|
|
25146
|
+
for (let i2 = index2 - (dir > 0 ? 0 : 1); dir > 0 ? i2 < node.childCount : i2 >= 0; i2 += dir) {
|
|
25147
|
+
let child = node.child(i2);
|
|
23225
25148
|
if (!child.isAtom) {
|
|
23226
25149
|
let inner = findSelectionIn(doc, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text2);
|
|
23227
25150
|
if (inner)
|
|
@@ -23247,8 +25170,8 @@ function selectionToInsertionEnd(tr, startLen, bias) {
|
|
|
23247
25170
|
});
|
|
23248
25171
|
tr.setSelection(Selection.near(tr.doc.resolve(end2), bias));
|
|
23249
25172
|
}
|
|
23250
|
-
function bind(
|
|
23251
|
-
return !self2 || !
|
|
25173
|
+
function bind(f2, self2) {
|
|
25174
|
+
return !self2 || !f2 ? f2 : f2.bind(self2);
|
|
23252
25175
|
}
|
|
23253
25176
|
class FieldDesc {
|
|
23254
25177
|
constructor(name, desc, self2) {
|
|
@@ -23405,24 +25328,24 @@ const TextInputSection = ({
|
|
|
23405
25328
|
onSubmit,
|
|
23406
25329
|
disabled
|
|
23407
25330
|
}) => {
|
|
23408
|
-
const { t } = usePostBuilder();
|
|
23409
|
-
const handleKeyDown = (
|
|
23410
|
-
if (
|
|
23411
|
-
|
|
25331
|
+
const { t: t2 } = usePostBuilder();
|
|
25332
|
+
const handleKeyDown = (e2) => {
|
|
25333
|
+
if (e2.key === "Enter") {
|
|
25334
|
+
e2.preventDefault();
|
|
23412
25335
|
onSubmit();
|
|
23413
25336
|
}
|
|
23414
25337
|
};
|
|
23415
25338
|
const isNearLimit = value.length > POLL_LIMITS.MAX_TEXT_LENGTH * 0.9;
|
|
23416
25339
|
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx("div", { className: "flex items-end gap-2", children: /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-1.5", children: [
|
|
23417
|
-
/* @__PURE__ */ jsx("label", { htmlFor: "poll-text-input", className: "text-sm font-medium text-foreground", children:
|
|
25340
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "poll-text-input", className: "text-sm font-medium text-foreground", children: t2("addTextOptionKey") }),
|
|
23418
25341
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center sm:gap-3 gap-1", children: [
|
|
23419
25342
|
/* @__PURE__ */ jsx(
|
|
23420
25343
|
Input,
|
|
23421
25344
|
{
|
|
23422
25345
|
id: "poll-text-input",
|
|
23423
|
-
placeholder:
|
|
25346
|
+
placeholder: t2("enterTextOptionKey"),
|
|
23424
25347
|
value,
|
|
23425
|
-
onChange: (
|
|
25348
|
+
onChange: (e2) => onChange(e2.target.value),
|
|
23426
25349
|
onKeyDown: handleKeyDown,
|
|
23427
25350
|
maxLength: POLL_LIMITS.MAX_TEXT_LENGTH,
|
|
23428
25351
|
disabled,
|
|
@@ -23438,13 +25361,13 @@ const TextInputSection = ({
|
|
|
23438
25361
|
size: "default",
|
|
23439
25362
|
children: [
|
|
23440
25363
|
/* @__PURE__ */ jsx(Type, { className: "h-4 w-4 sm:mr-2" }),
|
|
23441
|
-
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children:
|
|
25364
|
+
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: t2("addKey") })
|
|
23442
25365
|
]
|
|
23443
25366
|
}
|
|
23444
25367
|
)
|
|
23445
25368
|
] }),
|
|
23446
25369
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
|
|
23447
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
25370
|
+
/* @__PURE__ */ jsx("span", { children: t2("pressEnterToAddKey") }),
|
|
23448
25371
|
/* @__PURE__ */ jsxs(
|
|
23449
25372
|
"span",
|
|
23450
25373
|
{
|
|
@@ -23467,15 +25390,15 @@ const FileInputSection = ({
|
|
|
23467
25390
|
onImageSelect,
|
|
23468
25391
|
disabled
|
|
23469
25392
|
}) => {
|
|
23470
|
-
const { t } = usePostBuilder();
|
|
25393
|
+
const { t: t2 } = usePostBuilder();
|
|
23471
25394
|
const ref = useRef(null);
|
|
23472
25395
|
const [openSearchModal, setOpenSearchModal] = useState(false);
|
|
23473
|
-
const handleFileSelect = (
|
|
23474
|
-
const inputFiles =
|
|
25396
|
+
const handleFileSelect = (e2) => {
|
|
25397
|
+
const inputFiles = e2.target.files;
|
|
23475
25398
|
if (!inputFiles) return;
|
|
23476
25399
|
const files = Array.from(inputFiles);
|
|
23477
25400
|
void onFileSelect(files);
|
|
23478
|
-
|
|
25401
|
+
e2.target.value = "";
|
|
23479
25402
|
};
|
|
23480
25403
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
23481
25404
|
/* @__PURE__ */ jsxs(
|
|
@@ -23487,7 +25410,7 @@ const FileInputSection = ({
|
|
|
23487
25410
|
onClick: () => ref.current?.click(),
|
|
23488
25411
|
children: [
|
|
23489
25412
|
/* @__PURE__ */ jsx(ImagePlus, { className: "h-4 w-4" }),
|
|
23490
|
-
|
|
25413
|
+
t2("uploadKey")
|
|
23491
25414
|
]
|
|
23492
25415
|
}
|
|
23493
25416
|
),
|
|
@@ -23513,7 +25436,7 @@ const FileInputSection = ({
|
|
|
23513
25436
|
children: /* @__PURE__ */ jsxs(Button, { disabled, className: "cursor-pointer flex-1 [&>svg]:size-6", children: [
|
|
23514
25437
|
/* @__PURE__ */ jsx(GifIcon, {}),
|
|
23515
25438
|
" ",
|
|
23516
|
-
|
|
25439
|
+
t2("searchGifOrImagesKey")
|
|
23517
25440
|
] })
|
|
23518
25441
|
}
|
|
23519
25442
|
)
|
|
@@ -23544,35 +25467,35 @@ const EmptySlot = ({
|
|
|
23544
25467
|
}) => {
|
|
23545
25468
|
const ref = useRef(null);
|
|
23546
25469
|
const [isDragging, setIsDragging] = useState(false);
|
|
23547
|
-
const handleDragOver = (
|
|
25470
|
+
const handleDragOver = (e2) => {
|
|
23548
25471
|
if (disabled || isLoading) return;
|
|
23549
|
-
|
|
23550
|
-
|
|
25472
|
+
e2.preventDefault();
|
|
25473
|
+
e2.stopPropagation();
|
|
23551
25474
|
setIsDragging(true);
|
|
23552
25475
|
};
|
|
23553
|
-
const handleDragLeave = (
|
|
23554
|
-
|
|
23555
|
-
|
|
25476
|
+
const handleDragLeave = (e2) => {
|
|
25477
|
+
e2.preventDefault();
|
|
25478
|
+
e2.stopPropagation();
|
|
23556
25479
|
setIsDragging(false);
|
|
23557
25480
|
};
|
|
23558
|
-
const handleDrop = (
|
|
25481
|
+
const handleDrop = (e2) => {
|
|
23559
25482
|
if (disabled || isLoading) return;
|
|
23560
|
-
|
|
23561
|
-
|
|
25483
|
+
e2.preventDefault();
|
|
25484
|
+
e2.stopPropagation();
|
|
23562
25485
|
setIsDragging(false);
|
|
23563
|
-
const files = Array.from(
|
|
25486
|
+
const files = Array.from(e2.dataTransfer.files).filter(
|
|
23564
25487
|
(file) => file.type.startsWith("image/") || file.type.startsWith("video/")
|
|
23565
25488
|
);
|
|
23566
25489
|
if (files.length > 0) {
|
|
23567
25490
|
void onDrop(files);
|
|
23568
25491
|
}
|
|
23569
25492
|
};
|
|
23570
|
-
const handleFileSelect = (
|
|
23571
|
-
const inputFiles =
|
|
25493
|
+
const handleFileSelect = (e2) => {
|
|
25494
|
+
const inputFiles = e2.target.files;
|
|
23572
25495
|
if (!inputFiles) return;
|
|
23573
25496
|
const files = Array.from(inputFiles);
|
|
23574
25497
|
void onDrop(files);
|
|
23575
|
-
|
|
25498
|
+
e2.target.value = "";
|
|
23576
25499
|
};
|
|
23577
25500
|
const handleClick = () => {
|
|
23578
25501
|
if (disabled || isLoading) return;
|
|
@@ -23621,7 +25544,7 @@ const EmptySlot = ({
|
|
|
23621
25544
|
}
|
|
23622
25545
|
),
|
|
23623
25546
|
/* @__PURE__ */ jsx("span", { className: "text-xs pointer-events-none", children: isDragging ? "Drop here" : "Drag & Drop" }),
|
|
23624
|
-
isDragging && /* @__PURE__ */ jsx(Image$
|
|
25547
|
+
isDragging && /* @__PURE__ */ jsx(Image$2, { className: "pointer-events-none h-5 w-5 animate-bounce" })
|
|
23625
25548
|
] })
|
|
23626
25549
|
}
|
|
23627
25550
|
)
|
|
@@ -23700,10 +25623,10 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23700
25623
|
}, [choices]);
|
|
23701
25624
|
const remainingSlots = POLL_LIMITS.MAX - internalChoices.length;
|
|
23702
25625
|
const canAddMore = internalChoices.length < POLL_LIMITS.MAX;
|
|
23703
|
-
const actualChoices = internalChoices.filter((
|
|
25626
|
+
const actualChoices = internalChoices.filter((c2) => !isPlaceholder(c2));
|
|
23704
25627
|
const canRemoveChoices = actualChoices.length >= POLL_LIMITS.MIN;
|
|
23705
25628
|
const syncToParent = (items) => {
|
|
23706
|
-
const actual = items.filter((
|
|
25629
|
+
const actual = items.filter((c2) => !isPlaceholder(c2));
|
|
23707
25630
|
isInternalUpdate.current = true;
|
|
23708
25631
|
onChange(actual);
|
|
23709
25632
|
};
|
|
@@ -23728,9 +25651,9 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23728
25651
|
if (!files || !canAddMore) return;
|
|
23729
25652
|
const filesArray = files.slice(0, remainingSlots);
|
|
23730
25653
|
const startIndex = internalChoices.length;
|
|
23731
|
-
const placeholders = filesArray.map((_,
|
|
25654
|
+
const placeholders = filesArray.map((_, i2) => ({
|
|
23732
25655
|
type: "placeholder",
|
|
23733
|
-
key: `placeholder-${Date.now()}-${
|
|
25656
|
+
key: `placeholder-${Date.now()}-${i2}`
|
|
23734
25657
|
}));
|
|
23735
25658
|
const withPlaceholders = [...internalChoices, ...placeholders];
|
|
23736
25659
|
setInternalChoices(withPlaceholders);
|
|
@@ -23781,7 +25704,7 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23781
25704
|
});
|
|
23782
25705
|
} catch (error) {
|
|
23783
25706
|
setInternalChoices((current) => {
|
|
23784
|
-
const withoutPlaceholders = current.filter((
|
|
25707
|
+
const withoutPlaceholders = current.filter((c2) => !isPlaceholder(c2));
|
|
23785
25708
|
setTimeout(() => {
|
|
23786
25709
|
syncToParent(withoutPlaceholders);
|
|
23787
25710
|
}, 0);
|
|
@@ -23815,7 +25738,7 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23815
25738
|
updated[index2] = choice;
|
|
23816
25739
|
}
|
|
23817
25740
|
trackPollOptionAdded({
|
|
23818
|
-
option_count: updated.filter((
|
|
25741
|
+
option_count: updated.filter((c2) => !isPlaceholder(c2)).length,
|
|
23819
25742
|
option_type: isGif ? "gif" : "image"
|
|
23820
25743
|
});
|
|
23821
25744
|
setTimeout(() => {
|
|
@@ -23832,7 +25755,7 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23832
25755
|
errorType: "server_error"
|
|
23833
25756
|
});
|
|
23834
25757
|
setInternalChoices((current) => {
|
|
23835
|
-
const withoutPlaceholder = current.filter((
|
|
25758
|
+
const withoutPlaceholder = current.filter((c2) => !isPlaceholder(c2));
|
|
23836
25759
|
setTimeout(() => {
|
|
23837
25760
|
syncToParent(withoutPlaceholder);
|
|
23838
25761
|
}, 0);
|
|
@@ -23843,10 +25766,10 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23843
25766
|
const handleRemove = (index2) => {
|
|
23844
25767
|
if (!canRemoveChoices) return;
|
|
23845
25768
|
const choiceToRemove = internalChoices[index2];
|
|
23846
|
-
const updated = internalChoices.filter((_,
|
|
25769
|
+
const updated = internalChoices.filter((_, i2) => i2 !== index2);
|
|
23847
25770
|
if (!isPlaceholder(choiceToRemove)) {
|
|
23848
25771
|
trackPollOptionRemoved({
|
|
23849
|
-
option_count: updated.filter((
|
|
25772
|
+
option_count: updated.filter((c2) => !isPlaceholder(c2)).length,
|
|
23850
25773
|
option_type: PollOptionType[choiceToRemove.type]
|
|
23851
25774
|
});
|
|
23852
25775
|
}
|
|
@@ -23892,15 +25815,15 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23892
25815
|
choice.key
|
|
23893
25816
|
)
|
|
23894
25817
|
),
|
|
23895
|
-
Array.from({ length: remainingSlots }).map((_,
|
|
25818
|
+
Array.from({ length: remainingSlots }).map((_, i2) => /* @__PURE__ */ jsx(
|
|
23896
25819
|
EmptySlot,
|
|
23897
25820
|
{
|
|
23898
25821
|
disabled: !canAddMore,
|
|
23899
25822
|
isLoading: false,
|
|
23900
25823
|
onDrop: handleFileUpload,
|
|
23901
|
-
slotNumber: internalChoices.length +
|
|
25824
|
+
slotNumber: internalChoices.length + i2 + 1
|
|
23902
25825
|
},
|
|
23903
|
-
`empty-${
|
|
25826
|
+
`empty-${i2}`
|
|
23904
25827
|
))
|
|
23905
25828
|
] }),
|
|
23906
25829
|
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
@@ -24005,15 +25928,15 @@ const Poll = Node$1.create({
|
|
|
24005
25928
|
*/
|
|
24006
25929
|
handleDOMEvents: {
|
|
24007
25930
|
mousedown: (view, event) => {
|
|
24008
|
-
const
|
|
24009
|
-
const target =
|
|
25931
|
+
const e2 = event;
|
|
25932
|
+
const target = e2.target;
|
|
24010
25933
|
if (!target) return false;
|
|
24011
25934
|
if (target.closest('input, textarea, button, select, [contenteditable="true"]')) {
|
|
24012
25935
|
return false;
|
|
24013
25936
|
}
|
|
24014
25937
|
const pollWrapper = target.closest('[data-type="poll"]') ?? null;
|
|
24015
25938
|
if (!pollWrapper) return false;
|
|
24016
|
-
|
|
25939
|
+
e2.preventDefault();
|
|
24017
25940
|
const pos = view.posAtDOM(pollWrapper, 0);
|
|
24018
25941
|
if (typeof pos === "number") {
|
|
24019
25942
|
const resolvedPos = view.state.doc.resolve(pos);
|
|
@@ -24389,7 +26312,7 @@ const LinkMarkView = ({ mark, editor }) => {
|
|
|
24389
26312
|
/* @__PURE__ */ jsxs(
|
|
24390
26313
|
PopoverContent,
|
|
24391
26314
|
{
|
|
24392
|
-
onOpenAutoFocus: (
|
|
26315
|
+
onOpenAutoFocus: (e2) => e2.preventDefault(),
|
|
24393
26316
|
side: "top",
|
|
24394
26317
|
align: "center",
|
|
24395
26318
|
className: "flex gap-2 items-center p-1 max-w-fit w-fit",
|
|
@@ -24763,10 +26686,10 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24763
26686
|
}
|
|
24764
26687
|
if (syncTr && uidTr) {
|
|
24765
26688
|
try {
|
|
24766
|
-
uidTr.steps.forEach((step,
|
|
26689
|
+
uidTr.steps.forEach((step, i2) => {
|
|
24767
26690
|
if (step && syncTr) {
|
|
24768
26691
|
syncTr.step(step);
|
|
24769
|
-
const map = uidTr.mapping.maps[
|
|
26692
|
+
const map = uidTr.mapping.maps[i2];
|
|
24770
26693
|
if (map) {
|
|
24771
26694
|
syncTr.mapping.appendMap(map);
|
|
24772
26695
|
}
|
|
@@ -24781,6 +26704,13 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24781
26704
|
}
|
|
24782
26705
|
});
|
|
24783
26706
|
}
|
|
26707
|
+
const hasMediaInEditor = (editor, editorType) => {
|
|
26708
|
+
if (editorType !== EditorTypes.Media) return false;
|
|
26709
|
+
const json = editor?.getJSON();
|
|
26710
|
+
const mediaNodes = json ? findByType(json, "media") : [];
|
|
26711
|
+
const mediaGroupNodes = json ? findByType(json, "mediaGroup") : [];
|
|
26712
|
+
return mediaNodes.length > 0 || mediaGroupNodes.length > 0;
|
|
26713
|
+
};
|
|
24784
26714
|
const CustomLink = Link$1.extend({
|
|
24785
26715
|
name: "customLink",
|
|
24786
26716
|
priority: 990,
|
|
@@ -24845,7 +26775,9 @@ const CustomLink = Link$1.extend({
|
|
|
24845
26775
|
const { href, text: text2 } = attributes;
|
|
24846
26776
|
const existingLinkPreviewId = getExistingLinkPreviewUid(editor);
|
|
24847
26777
|
const uid = this.options.linkMode && existingLinkPreviewId ? existingLinkPreviewId : v4();
|
|
24848
|
-
|
|
26778
|
+
const editorType = editor?.view?.dom?.getAttribute("data-editor-type");
|
|
26779
|
+
const hasMedia = hasMediaInEditor(editor, editorType);
|
|
26780
|
+
const chainCmd = chain().insertContent(
|
|
24849
26781
|
[
|
|
24850
26782
|
{
|
|
24851
26783
|
type: "text",
|
|
@@ -24865,27 +26797,37 @@ const CustomLink = Link$1.extend({
|
|
|
24865
26797
|
},
|
|
24866
26798
|
this.options.linkMode ? { type: "text", text: " " } : null
|
|
24867
26799
|
].filter((item) => item !== null)
|
|
24868
|
-
)
|
|
24869
|
-
|
|
24870
|
-
|
|
24871
|
-
|
|
24872
|
-
|
|
24873
|
-
|
|
26800
|
+
);
|
|
26801
|
+
if (!hasMedia) {
|
|
26802
|
+
chainCmd.setLinkPreview({
|
|
26803
|
+
uid,
|
|
26804
|
+
// Same UID for both!
|
|
26805
|
+
loading: true,
|
|
26806
|
+
href: ""
|
|
26807
|
+
});
|
|
26808
|
+
}
|
|
26809
|
+
chainCmd.run();
|
|
24874
26810
|
const sessionId = editor?.view?.dom?.getAttribute("data-session-id") ?? "";
|
|
24875
|
-
const editorType = editor?.view?.dom?.getAttribute("data-editor-type");
|
|
24876
26811
|
this?.options?.api?.resolveUrl(normalizeUrl(href))?.then((metadata) => {
|
|
24877
26812
|
analytics?.trackLinkAdded(sessionId, { editorType });
|
|
24878
26813
|
if (metadata) {
|
|
24879
26814
|
const previewPayload = convertLinkMetaToPreviewItem(metadata);
|
|
24880
|
-
|
|
24881
|
-
|
|
24882
|
-
|
|
24883
|
-
|
|
24884
|
-
|
|
24885
|
-
|
|
24886
|
-
|
|
24887
|
-
|
|
24888
|
-
|
|
26815
|
+
const currentEditorType = editor?.view?.dom?.getAttribute(
|
|
26816
|
+
"data-editor-type"
|
|
26817
|
+
);
|
|
26818
|
+
const currentHasMedia = hasMediaInEditor(editor, currentEditorType);
|
|
26819
|
+
const chainCmd2 = editor?.chain()?.updateLinkByUid(uid, { href, text: text2, previewPayload });
|
|
26820
|
+
if (!currentHasMedia) {
|
|
26821
|
+
chainCmd2?.updateLinkPreviewByUid(uid, {
|
|
26822
|
+
loading: false,
|
|
26823
|
+
href: metadata.url,
|
|
26824
|
+
title: metadata.title,
|
|
26825
|
+
image: metadata.image?.url ?? null,
|
|
26826
|
+
description: metadata.description,
|
|
26827
|
+
domain: new URL(metadata.url).hostname
|
|
26828
|
+
});
|
|
26829
|
+
}
|
|
26830
|
+
chainCmd2?.run();
|
|
24889
26831
|
return;
|
|
24890
26832
|
}
|
|
24891
26833
|
editor.commands.deleteLinkPreviewByUid(uid);
|
|
@@ -24918,7 +26860,7 @@ const CustomLink = Link$1.extend({
|
|
|
24918
26860
|
}
|
|
24919
26861
|
});
|
|
24920
26862
|
if (found2) {
|
|
24921
|
-
updates.sort((
|
|
26863
|
+
updates.sort((a2, b) => b.from - a2.from);
|
|
24922
26864
|
updates.forEach(({ from, to, mark, oldText }) => {
|
|
24923
26865
|
const newAttrs = {
|
|
24924
26866
|
...mark.attrs,
|
|
@@ -24958,9 +26900,13 @@ const CustomLink = Link$1.extend({
|
|
|
24958
26900
|
domain: new URL(metadata.url).hostname,
|
|
24959
26901
|
loading: false
|
|
24960
26902
|
};
|
|
24961
|
-
|
|
26903
|
+
const currentEditorType = editor?.view?.dom?.getAttribute(
|
|
26904
|
+
"data-editor-type"
|
|
26905
|
+
);
|
|
26906
|
+
const currentHasMedia = hasMediaInEditor(editor, currentEditorType);
|
|
26907
|
+
if (linkPreviewExists && !currentHasMedia) {
|
|
24962
26908
|
editor.commands.updateLinkPreviewByUid(uid, previewData);
|
|
24963
|
-
} else {
|
|
26909
|
+
} else if (!linkPreviewExists && !currentHasMedia) {
|
|
24964
26910
|
editor.commands.setLinkPreview(previewData);
|
|
24965
26911
|
}
|
|
24966
26912
|
} else {
|
|
@@ -25166,14 +27112,14 @@ function addToSet(set, array) {
|
|
|
25166
27112
|
if (setPrototypeOf) {
|
|
25167
27113
|
setPrototypeOf(set, null);
|
|
25168
27114
|
}
|
|
25169
|
-
let
|
|
25170
|
-
while (
|
|
25171
|
-
let element = array[
|
|
27115
|
+
let l2 = array.length;
|
|
27116
|
+
while (l2--) {
|
|
27117
|
+
let element = array[l2];
|
|
25172
27118
|
if (typeof element === "string") {
|
|
25173
27119
|
const lcElement = transformCaseFunc(element);
|
|
25174
27120
|
if (lcElement !== element) {
|
|
25175
27121
|
if (!isFrozen(array)) {
|
|
25176
|
-
array[
|
|
27122
|
+
array[l2] = lcElement;
|
|
25177
27123
|
}
|
|
25178
27124
|
element = lcElement;
|
|
25179
27125
|
}
|
|
@@ -25775,8 +27721,8 @@ function createDOMPurify() {
|
|
|
25775
27721
|
const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
|
|
25776
27722
|
if (childNodes && parentNode) {
|
|
25777
27723
|
const childCount = childNodes.length;
|
|
25778
|
-
for (let
|
|
25779
|
-
const childClone = cloneNode(childNodes[
|
|
27724
|
+
for (let i2 = childCount - 1; i2 >= 0; --i2) {
|
|
27725
|
+
const childClone = cloneNode(childNodes[i2], true);
|
|
25780
27726
|
childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
|
|
25781
27727
|
parentNode.insertBefore(childClone, getNextSibling(currentNode));
|
|
25782
27728
|
}
|
|
@@ -25854,9 +27800,9 @@ function createDOMPurify() {
|
|
|
25854
27800
|
allowedAttributes: ALLOWED_ATTR,
|
|
25855
27801
|
forceKeepAttr: void 0
|
|
25856
27802
|
};
|
|
25857
|
-
let
|
|
25858
|
-
while (
|
|
25859
|
-
const attr = attributes[
|
|
27803
|
+
let l2 = attributes.length;
|
|
27804
|
+
while (l2--) {
|
|
27805
|
+
const attr = attributes[l2];
|
|
25860
27806
|
const {
|
|
25861
27807
|
name,
|
|
25862
27808
|
namespaceURI,
|
|
@@ -26300,7 +28246,7 @@ const handleUrlWithoutSelection = (editor, url, event, autoDetectMedia) => {
|
|
|
26300
28246
|
mediaType: MediaItemType.MEDIA_ITEM
|
|
26301
28247
|
});
|
|
26302
28248
|
}).catch(
|
|
26303
|
-
(
|
|
28249
|
+
(e2) => void 0
|
|
26304
28250
|
);
|
|
26305
28251
|
}
|
|
26306
28252
|
editor.chain().focus().insertLink({ href: normalizedUrl, text: url }).run();
|
|
@@ -27476,8 +29422,8 @@ function computeAutoPlacement(state, options) {
|
|
|
27476
29422
|
})[getBasePlacement$1(placement2)];
|
|
27477
29423
|
return acc;
|
|
27478
29424
|
}, {});
|
|
27479
|
-
return Object.keys(overflows).sort(function(
|
|
27480
|
-
return overflows[
|
|
29425
|
+
return Object.keys(overflows).sort(function(a2, b) {
|
|
29426
|
+
return overflows[a2] - overflows[b];
|
|
27481
29427
|
});
|
|
27482
29428
|
}
|
|
27483
29429
|
function getExpandedFallbackPlacements(placement) {
|
|
@@ -27512,8 +29458,8 @@ function flip(_ref) {
|
|
|
27512
29458
|
var checksMap = /* @__PURE__ */ new Map();
|
|
27513
29459
|
var makeFallbackChecks = true;
|
|
27514
29460
|
var firstFittingPlacement = placements2[0];
|
|
27515
|
-
for (var
|
|
27516
|
-
var placement = placements2[
|
|
29461
|
+
for (var i2 = 0; i2 < placements2.length; i2++) {
|
|
29462
|
+
var placement = placements2[i2];
|
|
27517
29463
|
var _basePlacement = getBasePlacement$1(placement);
|
|
27518
29464
|
var isStartVariation = getVariation(placement) === start;
|
|
27519
29465
|
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
|
|
@@ -28395,7 +30341,7 @@ function getDataAttributeProps(reference2, plugins) {
|
|
|
28395
30341
|
} else {
|
|
28396
30342
|
try {
|
|
28397
30343
|
acc[key] = JSON.parse(valueAsString);
|
|
28398
|
-
} catch (
|
|
30344
|
+
} catch (e2) {
|
|
28399
30345
|
acc[key] = valueAsString;
|
|
28400
30346
|
}
|
|
28401
30347
|
}
|
|
@@ -29241,8 +31187,8 @@ function createTippy(reference2, passedProps) {
|
|
|
29241
31187
|
if (popper2.parentNode) {
|
|
29242
31188
|
popper2.parentNode.removeChild(popper2);
|
|
29243
31189
|
}
|
|
29244
|
-
mountedInstances = mountedInstances.filter(function(
|
|
29245
|
-
return
|
|
31190
|
+
mountedInstances = mountedInstances.filter(function(i2) {
|
|
31191
|
+
return i2 !== instance;
|
|
29246
31192
|
});
|
|
29247
31193
|
instance.state.isMounted = false;
|
|
29248
31194
|
invokeHook("onHidden", [instance]);
|
|
@@ -29370,7 +31316,7 @@ function getSuggestions(options) {
|
|
|
29370
31316
|
}
|
|
29371
31317
|
function getSuggestionFromChar(options, char) {
|
|
29372
31318
|
const suggestions = getSuggestions(options);
|
|
29373
|
-
const suggestion = suggestions.find((
|
|
31319
|
+
const suggestion = suggestions.find((s2) => s2.char === char);
|
|
29374
31320
|
if (suggestion) {
|
|
29375
31321
|
return suggestion;
|
|
29376
31322
|
}
|
|
@@ -30077,13 +32023,13 @@ const rankings = {
|
|
|
30077
32023
|
MATCHES: 1,
|
|
30078
32024
|
NO_MATCH: 0
|
|
30079
32025
|
};
|
|
30080
|
-
const defaultBaseSortFn = (
|
|
32026
|
+
const defaultBaseSortFn = (a2, b) => String(a2.rankedValue).localeCompare(String(b.rankedValue));
|
|
30081
32027
|
function matchSorter(items, value, options = {}) {
|
|
30082
32028
|
const {
|
|
30083
32029
|
keys: keys2,
|
|
30084
32030
|
threshold = rankings.MATCHES,
|
|
30085
32031
|
baseSort = defaultBaseSortFn,
|
|
30086
|
-
sorter = (matchedItems2) => matchedItems2.sort((
|
|
32032
|
+
sorter = (matchedItems2) => matchedItems2.sort((a2, b) => sortRankedValues(a2, b, baseSort))
|
|
30087
32033
|
} = options;
|
|
30088
32034
|
const matchedItems = items.reduce(reduceItemsToRanked, []);
|
|
30089
32035
|
return sorter(matchedItems).map(({
|
|
@@ -30126,7 +32072,7 @@ function getHighestRanking(item, keys2, value, options) {
|
|
|
30126
32072
|
}, {
|
|
30127
32073
|
itemValue,
|
|
30128
32074
|
attributes
|
|
30129
|
-
},
|
|
32075
|
+
}, i2) => {
|
|
30130
32076
|
let newRank = getMatchRanking(itemValue, value, options);
|
|
30131
32077
|
let newRankedValue = rankedValue;
|
|
30132
32078
|
const {
|
|
@@ -30141,7 +32087,7 @@ function getHighestRanking(item, keys2, value, options) {
|
|
|
30141
32087
|
}
|
|
30142
32088
|
if (newRank > rank) {
|
|
30143
32089
|
rank = newRank;
|
|
30144
|
-
keyIndex =
|
|
32090
|
+
keyIndex = i2;
|
|
30145
32091
|
keyThreshold = threshold;
|
|
30146
32092
|
newRankedValue = itemValue;
|
|
30147
32093
|
}
|
|
@@ -30205,8 +32151,8 @@ function getMatchRanking(testString, stringToRank, options) {
|
|
|
30205
32151
|
function getAcronym(string) {
|
|
30206
32152
|
let acronym = "";
|
|
30207
32153
|
let prev = " ";
|
|
30208
|
-
for (let
|
|
30209
|
-
const ch = string.charAt(
|
|
32154
|
+
for (let i2 = 0; i2 < string.length; i2++) {
|
|
32155
|
+
const ch = string.charAt(i2);
|
|
30210
32156
|
const prevWasDelimiter = prev === " " || prev === "-";
|
|
30211
32157
|
const currIsDelimiter = ch === " " || ch === "-";
|
|
30212
32158
|
if (prevWasDelimiter && !currIsDelimiter) {
|
|
@@ -30240,8 +32186,8 @@ function getClosenessRanking(testString, stringToRank) {
|
|
|
30240
32186
|
return rankings.NO_MATCH;
|
|
30241
32187
|
}
|
|
30242
32188
|
charNumber = firstIndex;
|
|
30243
|
-
for (let
|
|
30244
|
-
const matchChar = stringToRank[
|
|
32189
|
+
for (let i2 = 1, I = stringToRank.length; i2 < I; i2++) {
|
|
32190
|
+
const matchChar = stringToRank[i2];
|
|
30245
32191
|
charNumber = findMatchingCharacter(matchChar, testString, charNumber);
|
|
30246
32192
|
const found2 = charNumber > -1;
|
|
30247
32193
|
if (!found2) {
|
|
@@ -30251,13 +32197,13 @@ function getClosenessRanking(testString, stringToRank) {
|
|
|
30251
32197
|
const spread2 = charNumber - firstIndex;
|
|
30252
32198
|
return getRanking(spread2);
|
|
30253
32199
|
}
|
|
30254
|
-
function sortRankedValues(
|
|
32200
|
+
function sortRankedValues(a2, b, baseSort) {
|
|
30255
32201
|
const aFirst = -1;
|
|
30256
32202
|
const bFirst = 1;
|
|
30257
32203
|
const {
|
|
30258
32204
|
rank: aRank,
|
|
30259
32205
|
keyIndex: aKeyIndex
|
|
30260
|
-
} =
|
|
32206
|
+
} = a2;
|
|
30261
32207
|
const {
|
|
30262
32208
|
rank: bRank,
|
|
30263
32209
|
keyIndex: bKeyIndex
|
|
@@ -30265,7 +32211,7 @@ function sortRankedValues(a, b, baseSort) {
|
|
|
30265
32211
|
const same = aRank === bRank;
|
|
30266
32212
|
if (same) {
|
|
30267
32213
|
if (aKeyIndex === bKeyIndex) {
|
|
30268
|
-
return baseSort(
|
|
32214
|
+
return baseSort(a2, b);
|
|
30269
32215
|
} else {
|
|
30270
32216
|
return aKeyIndex < bKeyIndex ? aFirst : bFirst;
|
|
30271
32217
|
}
|
|
@@ -30309,8 +32255,8 @@ function getItemValues(item, key) {
|
|
|
30309
32255
|
function getNestedValues(path, item) {
|
|
30310
32256
|
const keys2 = path.split(".");
|
|
30311
32257
|
let values = [item];
|
|
30312
|
-
for (let
|
|
30313
|
-
const nestedKey = keys2[
|
|
32258
|
+
for (let i2 = 0, I = keys2.length; i2 < I; i2++) {
|
|
32259
|
+
const nestedKey = keys2[i2];
|
|
30314
32260
|
let nestedValues = [];
|
|
30315
32261
|
for (let j = 0, J = values.length; j < J; j++) {
|
|
30316
32262
|
const nestedItem = values[j];
|
|
@@ -30338,9 +32284,9 @@ function getAllValuesToRank(item, keys2) {
|
|
|
30338
32284
|
const key = keys2[j];
|
|
30339
32285
|
const attributes = getKeyAttributes(key);
|
|
30340
32286
|
const itemValues = getItemValues(item, key);
|
|
30341
|
-
for (let
|
|
32287
|
+
for (let i2 = 0, I = itemValues.length; i2 < I; i2++) {
|
|
30342
32288
|
allValues.push({
|
|
30343
|
-
itemValue: itemValues[
|
|
32289
|
+
itemValue: itemValues[i2],
|
|
30344
32290
|
attributes
|
|
30345
32291
|
});
|
|
30346
32292
|
}
|
|
@@ -30666,7 +32612,7 @@ const LinkPreviewCompact = ({
|
|
|
30666
32612
|
domain,
|
|
30667
32613
|
onClickDelete
|
|
30668
32614
|
}) => {
|
|
30669
|
-
const { t } = usePostBuilder();
|
|
32615
|
+
const { t: t2 } = usePostBuilder();
|
|
30670
32616
|
const safeDomain = useMemo(() => {
|
|
30671
32617
|
try {
|
|
30672
32618
|
return domain || new URL(href).hostname;
|
|
@@ -30674,9 +32620,9 @@ const LinkPreviewCompact = ({
|
|
|
30674
32620
|
return "unknown";
|
|
30675
32621
|
}
|
|
30676
32622
|
}, [href, domain]);
|
|
30677
|
-
const handleDelete = (
|
|
30678
|
-
|
|
30679
|
-
|
|
32623
|
+
const handleDelete = (e2) => {
|
|
32624
|
+
e2.preventDefault();
|
|
32625
|
+
e2.stopPropagation();
|
|
30680
32626
|
onClickDelete();
|
|
30681
32627
|
};
|
|
30682
32628
|
return /* @__PURE__ */ jsxs(
|
|
@@ -30697,7 +32643,7 @@ const LinkPreviewCompact = ({
|
|
|
30697
32643
|
{
|
|
30698
32644
|
tooltip: "removeLinkPreviewKey",
|
|
30699
32645
|
onClick: handleDelete,
|
|
30700
|
-
"aria-label":
|
|
32646
|
+
"aria-label": t2("removeLinkPreviewKey"),
|
|
30701
32647
|
type: "button",
|
|
30702
32648
|
size: "icon",
|
|
30703
32649
|
className: "cursor-pointer size-6 shadow-none bg-transparent group-hover:bg-destructive/5 hover:bg-destructive/10 text-destructive hover:text-destructive",
|
|
@@ -30736,7 +32682,7 @@ const LinkPreviewExtended = ({
|
|
|
30736
32682
|
domain,
|
|
30737
32683
|
onClickDelete
|
|
30738
32684
|
}) => {
|
|
30739
|
-
const { t } = usePostBuilder();
|
|
32685
|
+
const { t: t2 } = usePostBuilder();
|
|
30740
32686
|
const safeDomain = useMemo(() => {
|
|
30741
32687
|
try {
|
|
30742
32688
|
return domain || new URL(href).hostname;
|
|
@@ -30744,9 +32690,9 @@ const LinkPreviewExtended = ({
|
|
|
30744
32690
|
return "unknown";
|
|
30745
32691
|
}
|
|
30746
32692
|
}, [href, domain]);
|
|
30747
|
-
const handleDelete = (
|
|
30748
|
-
|
|
30749
|
-
|
|
32693
|
+
const handleDelete = (e2) => {
|
|
32694
|
+
e2.preventDefault();
|
|
32695
|
+
e2.stopPropagation();
|
|
30750
32696
|
onClickDelete();
|
|
30751
32697
|
};
|
|
30752
32698
|
return /* @__PURE__ */ jsxs(
|
|
@@ -30775,7 +32721,7 @@ const LinkPreviewExtended = ({
|
|
|
30775
32721
|
{
|
|
30776
32722
|
tooltip: "removeLinkPreviewKey",
|
|
30777
32723
|
onClick: handleDelete,
|
|
30778
|
-
"aria-label":
|
|
32724
|
+
"aria-label": t2("removeLinkPreviewKey"),
|
|
30779
32725
|
type: "button",
|
|
30780
32726
|
size: "icon",
|
|
30781
32727
|
className: "cursor-pointer backdrop-blur-2xl size-6 shadow-none bg-transparent group-hover:bg-red-50/70 hover:bg-red-50 text-destructive hover:text-destructive",
|
|
@@ -30817,7 +32763,7 @@ function Skeleton({ className, ...props }) {
|
|
|
30817
32763
|
}
|
|
30818
32764
|
const LinkPreviewCard = ({ node, deleteNode, selected }) => {
|
|
30819
32765
|
const { loading, href, domain, variant } = node.attrs;
|
|
30820
|
-
const { t } = usePostBuilder();
|
|
32766
|
+
const { t: t2 } = usePostBuilder();
|
|
30821
32767
|
const safeDomain = useMemo(() => {
|
|
30822
32768
|
try {
|
|
30823
32769
|
return domain || new URL(href).hostname;
|
|
@@ -30826,7 +32772,7 @@ const LinkPreviewCard = ({ node, deleteNode, selected }) => {
|
|
|
30826
32772
|
}
|
|
30827
32773
|
}, [href, domain]);
|
|
30828
32774
|
if (loading)
|
|
30829
|
-
return /* @__PURE__ */ jsx(NodeViewWrapper, { children: /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-24 flex items-center justify-center rounded-lg", children: /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children:
|
|
32775
|
+
return /* @__PURE__ */ jsx(NodeViewWrapper, { children: /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-24 flex items-center justify-center rounded-lg", children: /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: t2("fetchingMetadataKey") }) }) });
|
|
30830
32776
|
if (!href) return null;
|
|
30831
32777
|
return /* @__PURE__ */ jsx(NodeViewWrapper, { contentEditable: false, "data-drag-handle": true, children: variant === LinkPreviewType.Compact ? /* @__PURE__ */ jsx(
|
|
30832
32778
|
LinkPreviewCompact,
|
|
@@ -31077,7 +33023,7 @@ const MediaGroupView = ({ node, editor }) => {
|
|
|
31077
33023
|
),
|
|
31078
33024
|
isUploading ? /* @__PURE__ */ jsxs("div", { className: "size-20 bg-muted rounded-lg border border-border flex items-center justify-center relative overflow-hidden", children: [
|
|
31079
33025
|
/* @__PURE__ */ jsxs("div", { className: "text-center space-y-2", children: [
|
|
31080
|
-
mediaNode.attrs.type === MediaNodeTypes.Image && /* @__PURE__ */ jsx(Image$
|
|
33026
|
+
mediaNode.attrs.type === MediaNodeTypes.Image && /* @__PURE__ */ jsx(Image$2, { className: "w-8 h-8 text-muted-foreground/50 mx-auto" }),
|
|
31081
33027
|
mediaNode.attrs.type === MediaNodeTypes.Video && /* @__PURE__ */ jsx(Video, { className: "w-8 h-8 text-muted-foreground/50 mx-auto" }),
|
|
31082
33028
|
mediaNode.attrs.type === MediaNodeTypes.Audio && /* @__PURE__ */ jsx(Music, { className: "w-8 h-8 text-muted-foreground/50 mx-auto" }),
|
|
31083
33029
|
/* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
@@ -31218,7 +33164,7 @@ const createMediaModePlugin = () => {
|
|
|
31218
33164
|
});
|
|
31219
33165
|
if (mediaGroupPos !== null && mediaGroupNode) {
|
|
31220
33166
|
const existingContentSize = mediaGroupNode.content.size;
|
|
31221
|
-
const sortedMedia = [...updatedTopLevelMedia].sort((
|
|
33167
|
+
const sortedMedia = [...updatedTopLevelMedia].sort((a2, b) => b.pos - a2.pos);
|
|
31222
33168
|
sortedMedia.forEach(({ pos, size: size2 }) => {
|
|
31223
33169
|
tr.delete(pos, pos + size2);
|
|
31224
33170
|
});
|
|
@@ -31241,7 +33187,7 @@ const createMediaModePlugin = () => {
|
|
|
31241
33187
|
return null;
|
|
31242
33188
|
}
|
|
31243
33189
|
const mediaGroup = newState.schema.nodes.mediaGroup.create({}, mediaNodes);
|
|
31244
|
-
const sortedMedia = [...updatedTopLevelMedia].sort((
|
|
33190
|
+
const sortedMedia = [...updatedTopLevelMedia].sort((a2, b) => b.pos - a2.pos);
|
|
31245
33191
|
sortedMedia.forEach(({ pos, size: size2 }) => {
|
|
31246
33192
|
tr.delete(pos, pos + size2);
|
|
31247
33193
|
});
|
|
@@ -31254,7 +33200,7 @@ const createMediaModePlugin = () => {
|
|
|
31254
33200
|
try {
|
|
31255
33201
|
const $pos = tr.doc.resolve(endPos);
|
|
31256
33202
|
tr.setSelection(TextSelection$1.near($pos));
|
|
31257
|
-
} catch (
|
|
33203
|
+
} catch (e2) {
|
|
31258
33204
|
}
|
|
31259
33205
|
}
|
|
31260
33206
|
tr.setMeta("addToHistory", false);
|
|
@@ -31491,7 +33437,7 @@ const usePostBuilderEditor = ({ editorType, groupId, postId, user }) => {
|
|
|
31491
33437
|
const editor = useEditor(
|
|
31492
33438
|
{
|
|
31493
33439
|
extensions: getExtensions({ editorType, api, store, user }),
|
|
31494
|
-
content: "",
|
|
33440
|
+
content: getTabContent(editorType) ?? "",
|
|
31495
33441
|
editorProps: getEditorProps(),
|
|
31496
33442
|
onCreate: ({ editor: editor2 }) => {
|
|
31497
33443
|
store.getState().setEditor(editor2);
|
|
@@ -31499,7 +33445,7 @@ const usePostBuilderEditor = ({ editorType, groupId, postId, user }) => {
|
|
|
31499
33445
|
if (editorType === EditorTypes.Media) editor2?.chain()?.focus()?.run();
|
|
31500
33446
|
if (editorType === EditorTypes.Poll) initializePollEditor(editor2);
|
|
31501
33447
|
},
|
|
31502
|
-
onBlur: ({ editor
|
|
33448
|
+
// onBlur: ({ editor }) => saveCurrentTabContent(editorType, editor),
|
|
31503
33449
|
onUnmount: ({ editor: editor2 }) => saveCurrentTabContent(editorType, editor2),
|
|
31504
33450
|
immediatelyRender: false,
|
|
31505
33451
|
// Important: Only render after mount to avoid SSR issues
|
|
@@ -31509,11 +33455,15 @@ const usePostBuilderEditor = ({ editorType, groupId, postId, user }) => {
|
|
|
31509
33455
|
// Add isMounted to dependencies
|
|
31510
33456
|
);
|
|
31511
33457
|
useEffect(() => {
|
|
31512
|
-
|
|
33458
|
+
let timerId;
|
|
33459
|
+
if (!isMounted || !editor || !editor?.view) return;
|
|
31513
33460
|
const tabContent = getTabContent(editorType);
|
|
31514
33461
|
if (tabContent && editor?.isEditable) {
|
|
31515
|
-
editor.commands.setContent(tabContent);
|
|
33462
|
+
timerId = setTimeout(() => editor.commands.setContent(tabContent), 0);
|
|
31516
33463
|
}
|
|
33464
|
+
return () => {
|
|
33465
|
+
if (timerId) clearTimeout(timerId);
|
|
33466
|
+
};
|
|
31517
33467
|
}, [editor, editorType, getTabContent, isMounted]);
|
|
31518
33468
|
const actions = useMemo(() => {
|
|
31519
33469
|
return editor ? createEditorActions(editor) : null;
|
|
@@ -31527,10 +33477,11 @@ const getEditorData = (editor) => {
|
|
|
31527
33477
|
text: editor?.getText()
|
|
31528
33478
|
};
|
|
31529
33479
|
};
|
|
31530
|
-
const getCommonPayload = () => ({
|
|
33480
|
+
const getCommonPayload = (groupId) => ({
|
|
31531
33481
|
postId: v4(),
|
|
31532
33482
|
timestamp: (/* @__PURE__ */ new Date()).getTime(),
|
|
31533
|
-
specialType: SpecialType.POST
|
|
33483
|
+
specialType: SpecialType.POST,
|
|
33484
|
+
...groupId && { groupId }
|
|
31534
33485
|
});
|
|
31535
33486
|
const getMentionDataPayload = (json) => {
|
|
31536
33487
|
const mentions = findByType(json, "mention");
|
|
@@ -31565,10 +33516,11 @@ const isValidItem = (item) => {
|
|
|
31565
33516
|
};
|
|
31566
33517
|
const generateHtmlPostPayload = ({
|
|
31567
33518
|
editor,
|
|
31568
|
-
sendCrossMention
|
|
33519
|
+
sendCrossMention,
|
|
33520
|
+
groupId
|
|
31569
33521
|
}) => {
|
|
31570
33522
|
const { html: html2, json } = getEditorData(editor);
|
|
31571
|
-
const commons = getCommonPayload();
|
|
33523
|
+
const commons = getCommonPayload(groupId);
|
|
31572
33524
|
const previewItemMedia = findFirstByType(json, "media");
|
|
31573
33525
|
const previewItemEmbed = findFirstByType(json, "iframe");
|
|
31574
33526
|
const firstText = findFirstByType(json, "text");
|
|
@@ -31598,10 +33550,11 @@ const generateHtmlPostPayload = ({
|
|
|
31598
33550
|
};
|
|
31599
33551
|
const generateMediaPostPayload = ({
|
|
31600
33552
|
editor,
|
|
31601
|
-
sendCrossMention
|
|
33553
|
+
sendCrossMention,
|
|
33554
|
+
groupId
|
|
31602
33555
|
}) => {
|
|
31603
33556
|
const { json, text: text2 } = getEditorData(editor);
|
|
31604
|
-
const commons = getCommonPayload();
|
|
33557
|
+
const commons = getCommonPayload(groupId);
|
|
31605
33558
|
const body = text2?.trim() ?? "";
|
|
31606
33559
|
const { mentionData } = getMentionDataPayload(json);
|
|
31607
33560
|
const { items: mediaItems } = getMediaItemsPayload(json);
|
|
@@ -31620,10 +33573,11 @@ const generateMediaPostPayload = ({
|
|
|
31620
33573
|
};
|
|
31621
33574
|
const generatePollPostPayload = ({
|
|
31622
33575
|
editor,
|
|
31623
|
-
sendCrossMention
|
|
33576
|
+
sendCrossMention,
|
|
33577
|
+
groupId
|
|
31624
33578
|
}) => {
|
|
31625
33579
|
const { json, text: text2 } = getEditorData(editor);
|
|
31626
|
-
const commons = getCommonPayload();
|
|
33580
|
+
const commons = getCommonPayload(groupId);
|
|
31627
33581
|
const body = text2;
|
|
31628
33582
|
const { mentionData } = getMentionDataPayload(json);
|
|
31629
33583
|
const { items } = getPollItemsPayload(json);
|
|
@@ -31664,23 +33618,24 @@ const PostBuilderEditorInstance = ({
|
|
|
31664
33618
|
isSubmitting,
|
|
31665
33619
|
clearOnSuccess,
|
|
31666
33620
|
onCreatePost,
|
|
31667
|
-
className
|
|
33621
|
+
className,
|
|
33622
|
+
store
|
|
31668
33623
|
}) => {
|
|
31669
33624
|
const [isDragging, setIsDragging] = useState(false);
|
|
31670
33625
|
const { trackPublish } = useAnalyticsTracking();
|
|
31671
33626
|
const { clearContent } = usePersistence();
|
|
31672
33627
|
useHostAnalyticsBridge();
|
|
31673
33628
|
useEditorTracking({ editor, editorType: editorTab });
|
|
31674
|
-
const handleDragOver = (
|
|
31675
|
-
|
|
33629
|
+
const handleDragOver = (e2) => {
|
|
33630
|
+
e2.preventDefault();
|
|
31676
33631
|
setIsDragging(true);
|
|
31677
33632
|
};
|
|
31678
|
-
const handleDragLeave = (
|
|
31679
|
-
|
|
33633
|
+
const handleDragLeave = (e2) => {
|
|
33634
|
+
e2.preventDefault();
|
|
31680
33635
|
setIsDragging(false);
|
|
31681
33636
|
};
|
|
31682
|
-
const handleDrop = (
|
|
31683
|
-
|
|
33637
|
+
const handleDrop = (e2) => {
|
|
33638
|
+
e2.preventDefault();
|
|
31684
33639
|
setIsDragging(false);
|
|
31685
33640
|
};
|
|
31686
33641
|
const handleSubmit = (sendCrossMention) => {
|
|
@@ -31688,7 +33643,13 @@ const PostBuilderEditorInstance = ({
|
|
|
31688
33643
|
const html2 = editor?.getHTML();
|
|
31689
33644
|
const json = editor?.getJSON();
|
|
31690
33645
|
const text2 = editor?.getText();
|
|
31691
|
-
const
|
|
33646
|
+
const { selectedGroupId, groupId } = store.getState();
|
|
33647
|
+
const groupIdForPayload = selectedGroupId || groupId || void 0;
|
|
33648
|
+
const payload = generateCreatePostPayload(editorTab, {
|
|
33649
|
+
editor,
|
|
33650
|
+
sendCrossMention,
|
|
33651
|
+
groupId: groupIdForPayload
|
|
33652
|
+
});
|
|
31692
33653
|
const isPollType = payload?.type === NewPostType.NEW_POST_POLL;
|
|
31693
33654
|
if (payload?.error) {
|
|
31694
33655
|
toast.error(payload.error);
|
|
@@ -31809,39 +33770,39 @@ const PostBuilderEditorInstanceWithDialog = ({
|
|
|
31809
33770
|
/* @__PURE__ */ jsx(DialogClose, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "outline", size: "icon", children: /* @__PURE__ */ jsx(X, {}) }) })
|
|
31810
33771
|
] })
|
|
31811
33772
|
] }),
|
|
31812
|
-
/* @__PURE__ */ jsx(PostBuilderEditorInstance, { ...rest })
|
|
33773
|
+
/* @__PURE__ */ jsx(PostBuilderEditorInstance, { ...rest, store })
|
|
31813
33774
|
]
|
|
31814
33775
|
}
|
|
31815
33776
|
) });
|
|
31816
33777
|
};
|
|
31817
|
-
var M = (
|
|
33778
|
+
var M = (e2, i2, s2, u, m, a2, l2, h) => {
|
|
31818
33779
|
let d = document.documentElement, w = ["light", "dark"];
|
|
31819
33780
|
function p(n) {
|
|
31820
|
-
(Array.isArray(
|
|
31821
|
-
let k = y === "class", S = k &&
|
|
31822
|
-
k ? (d.classList.remove(...S), d.classList.add(
|
|
33781
|
+
(Array.isArray(e2) ? e2 : [e2]).forEach((y) => {
|
|
33782
|
+
let k = y === "class", S = k && a2 ? m.map((f2) => a2[f2] || f2) : m;
|
|
33783
|
+
k ? (d.classList.remove(...S), d.classList.add(a2 && a2[n] ? a2[n] : n)) : d.setAttribute(y, n);
|
|
31823
33784
|
}), R(n);
|
|
31824
33785
|
}
|
|
31825
33786
|
function R(n) {
|
|
31826
33787
|
h && w.includes(n) && (d.style.colorScheme = n);
|
|
31827
33788
|
}
|
|
31828
|
-
function
|
|
33789
|
+
function c2() {
|
|
31829
33790
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
31830
33791
|
}
|
|
31831
33792
|
if (u) p(u);
|
|
31832
33793
|
else try {
|
|
31833
|
-
let n = localStorage.getItem(
|
|
33794
|
+
let n = localStorage.getItem(i2) || s2, y = l2 && n === "system" ? c2() : n;
|
|
31834
33795
|
p(y);
|
|
31835
33796
|
} catch (n) {
|
|
31836
33797
|
}
|
|
31837
33798
|
};
|
|
31838
|
-
var x = React.createContext(void 0), U = { setTheme: (
|
|
33799
|
+
var x = React.createContext(void 0), U = { setTheme: (e2) => {
|
|
31839
33800
|
}, themes: [] }, z = () => {
|
|
31840
|
-
var
|
|
31841
|
-
return (
|
|
33801
|
+
var e2;
|
|
33802
|
+
return (e2 = React.useContext(x)) != null ? e2 : U;
|
|
31842
33803
|
};
|
|
31843
|
-
React.memo(({ forcedTheme:
|
|
31844
|
-
let p = JSON.stringify([
|
|
33804
|
+
React.memo(({ forcedTheme: e2, storageKey: i2, attribute: s2, enableSystem: u, enableColorScheme: m, defaultTheme: a2, value: l2, themes: h, nonce: d, scriptProps: w }) => {
|
|
33805
|
+
let p = JSON.stringify([s2, i2, a2, e2, h, l2, u, m]).slice(1, -1);
|
|
31845
33806
|
return React.createElement("script", { ...w, suppressHydrationWarning: true, nonce: typeof window == "undefined" ? d : "", dangerouslySetInnerHTML: { __html: `(${M.toString()})(${p})` } });
|
|
31846
33807
|
});
|
|
31847
33808
|
const Toaster2 = ({ ...props }) => {
|
|
@@ -31882,9 +33843,9 @@ const PostBuilderEditor = ({
|
|
|
31882
33843
|
}) => {
|
|
31883
33844
|
const [editorTab, setEditorTab] = useState(EditorTypes.Media);
|
|
31884
33845
|
const [sessionId, setSessionId] = useState("");
|
|
31885
|
-
const createSession = useAnalyticsStore((
|
|
31886
|
-
const deleteSession = useAnalyticsStore((
|
|
31887
|
-
const trackEditorFocus = useAnalyticsStore((
|
|
33846
|
+
const createSession = useAnalyticsStore((s2) => s2.createSession);
|
|
33847
|
+
const deleteSession = useAnalyticsStore((s2) => s2.deleteSession);
|
|
33848
|
+
const trackEditorFocus = useAnalyticsStore((s2) => s2.trackEditorFocus);
|
|
31888
33849
|
const { editor, actions, store, isMounted } = usePostBuilderEditor({
|
|
31889
33850
|
editorType: editorTab,
|
|
31890
33851
|
groupId,
|
|
@@ -31901,9 +33862,9 @@ const PostBuilderEditor = ({
|
|
|
31901
33862
|
};
|
|
31902
33863
|
}, [createSession, deleteSession, openModal, placement]);
|
|
31903
33864
|
useEffect(() => {
|
|
31904
|
-
const handleSessionRotation = (
|
|
33865
|
+
const handleSessionRotation = (e2) => {
|
|
31905
33866
|
if (!editor) return;
|
|
31906
|
-
const { newSessionId } =
|
|
33867
|
+
const { newSessionId } = e2.detail;
|
|
31907
33868
|
setSessionId(newSessionId);
|
|
31908
33869
|
if (!editor.isFocused) return;
|
|
31909
33870
|
trackEditorFocus(newSessionId);
|
|
@@ -31957,6 +33918,7 @@ const PostBuilderEditor = ({
|
|
|
31957
33918
|
actions,
|
|
31958
33919
|
editorTab,
|
|
31959
33920
|
onSwitchEditor: setEditorTab,
|
|
33921
|
+
store,
|
|
31960
33922
|
isSubmitting,
|
|
31961
33923
|
onCreatePost,
|
|
31962
33924
|
clearOnSuccess
|
|
@@ -32115,7 +34077,7 @@ const PostBuilderProvider = ({
|
|
|
32115
34077
|
logEvent
|
|
32116
34078
|
}) => {
|
|
32117
34079
|
const initialize = useAnalyticsStore((state) => state.initialize);
|
|
32118
|
-
const
|
|
34080
|
+
const t2 = useCallback(
|
|
32119
34081
|
(key, fallback) => {
|
|
32120
34082
|
const i18nKeysDerived = { ...defaultTranslationKeyMappings, ...i18nKeys };
|
|
32121
34083
|
const translationKey = i18nKeysDerived[key];
|
|
@@ -32146,12 +34108,12 @@ const PostBuilderProvider = ({
|
|
|
32146
34108
|
const value = useMemo(() => {
|
|
32147
34109
|
return {
|
|
32148
34110
|
authToken,
|
|
32149
|
-
t,
|
|
34111
|
+
t: t2,
|
|
32150
34112
|
i18nKeys,
|
|
32151
34113
|
api,
|
|
32152
34114
|
logEvent
|
|
32153
34115
|
};
|
|
32154
|
-
}, [authToken,
|
|
34116
|
+
}, [authToken, t2, i18nKeys, api, logEvent]);
|
|
32155
34117
|
return /* @__PURE__ */ jsx(PostBuilderContext.Provider, { value, children });
|
|
32156
34118
|
};
|
|
32157
34119
|
export {
|