app/assets/build/coco/app.js in coveragebook_components-0.5.2 vs app/assets/build/coco/app.js in coveragebook_components-0.5.3
- old
+ new
@@ -14598,824 +14598,111 @@
return html2canvas2;
});
}
});
- // ../../../node_modules/@rails/activestorage/app/assets/javascripts/activestorage.esm.js
- var sparkMd5 = {
- exports: {}
- };
- (function(module, exports) {
- (function(factory) {
- {
- module.exports = factory();
+ // ../../../package.json
+ var package_default = {
+ name: "coveragebook-components",
+ type: "module",
+ version: "0.5.3",
+ main: "index.js",
+ repository: "git@github.com:coveragebook/coco.git",
+ author: "Mark Perkins <mark@coveragebook.com>",
+ license: "NO LICENSE",
+ browserslist: [
+ "defaults"
+ ],
+ dependencies: {
+ "@alpinejs/collapse": "^3.11.1",
+ "@alpinejs/focus": "^3.11.1",
+ "@alpinejs/intersect": "^3.11.1",
+ "@alpinejs/mask": "^3.12.0",
+ "@alpinejs/morph": "^3.11.1",
+ "@hotwired/turbo-rails": "^7.3.0",
+ "@jaames/iro": "^5.5.2",
+ "@rails/activestorage": "^7.0.5",
+ "@tailwindcss/container-queries": "^0.1.0",
+ "@tailwindcss/forms": "^0.5.3",
+ "alpine-turbo-drive-adapter": "^2.0.0",
+ alpinejs: "^3.11.1",
+ "container-query-polyfill": "^1.0.2",
+ del: "^7.0.0",
+ html2canvas: "^1.4.1",
+ lodash: "^4.17.21",
+ "lucide-static": "^0.258.0",
+ tailwindcss: "^3.3.0",
+ "tippy.js": "^6.3.7"
+ },
+ devDependencies: {
+ "alias-hq": "^6.1.0",
+ "alpinejs-tash": "^1.0.9",
+ autoprefixer: "^10.4.13",
+ esbuild: "^0.17.10",
+ "esbuild-plugin-copy": "^2.0.2",
+ "fast-glob": "^3.2.12",
+ "fast-sort": "^3.2.1",
+ husky: "^8.0.3",
+ jest: "^29.4.3",
+ "jest-environment-jsdom": "^29.4.3",
+ "lint-staged": "^13.1.2",
+ postcss: "^8.4.21",
+ "postcss-cli": "^10.1.0",
+ "postcss-value-parser": "^4.2.0",
+ prettier: "^2.8.4",
+ "release-it": "^15.10.3",
+ svgo: "^3.0.2",
+ vite: "^4.1.4",
+ "vite-plugin-ruby": "^3.1.3"
+ },
+ scripts: {
+ "js:build": "node esbuild.config.js",
+ "js:dev": "node esbuild.config.js --watch",
+ "js:test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
+ "css:build": "postcss ./app/assets/css/{app,book}.css -d ./app/assets/build/coco",
+ "css:dev": "postcss ./app/assets/css/{app,book}.css -d ./app/assets/build/coco --watch --ext .dev.css",
+ build: "npm run js:build && npm run css:build",
+ "lint:fix": "bundle exec standardrb --fix && prettier --write .",
+ prepare: "husky install",
+ release: "release-it"
+ },
+ "lint-staged": {
+ "**/*": [
+ "prettier --write --ignore-unknown"
+ ],
+ "(**/*.(rb|rake))|Gemfile|Rakefile": [
+ "standardrb --fix"
+ ]
+ },
+ prettier: {
+ tabWidth: 2,
+ semi: true,
+ singleQuote: false
+ },
+ "release-it": {
+ github: {
+ release: true
+ },
+ npm: {
+ publish: false
+ },
+ hooks: {
+ "before:init": [
+ "npm install",
+ "bundle install",
+ "bundle exec rake test",
+ "cd lookbook && bundle"
+ ],
+ "after:bump": [
+ "npm run lint:fix",
+ "npm run build"
+ ],
+ "after:version:bump": "./bin/bump-version ${version} && bundle",
+ "after:release": "./bin/build-gem ${version}"
}
- })(function(undefined$1) {
- var hex_chr = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
- function md5cycle(x3, k3) {
- var a3 = x3[0], b3 = x3[1], c3 = x3[2], d3 = x3[3];
- a3 += (b3 & c3 | ~b3 & d3) + k3[0] - 680876936 | 0;
- a3 = (a3 << 7 | a3 >>> 25) + b3 | 0;
- d3 += (a3 & b3 | ~a3 & c3) + k3[1] - 389564586 | 0;
- d3 = (d3 << 12 | d3 >>> 20) + a3 | 0;
- c3 += (d3 & a3 | ~d3 & b3) + k3[2] + 606105819 | 0;
- c3 = (c3 << 17 | c3 >>> 15) + d3 | 0;
- b3 += (c3 & d3 | ~c3 & a3) + k3[3] - 1044525330 | 0;
- b3 = (b3 << 22 | b3 >>> 10) + c3 | 0;
- a3 += (b3 & c3 | ~b3 & d3) + k3[4] - 176418897 | 0;
- a3 = (a3 << 7 | a3 >>> 25) + b3 | 0;
- d3 += (a3 & b3 | ~a3 & c3) + k3[5] + 1200080426 | 0;
- d3 = (d3 << 12 | d3 >>> 20) + a3 | 0;
- c3 += (d3 & a3 | ~d3 & b3) + k3[6] - 1473231341 | 0;
- c3 = (c3 << 17 | c3 >>> 15) + d3 | 0;
- b3 += (c3 & d3 | ~c3 & a3) + k3[7] - 45705983 | 0;
- b3 = (b3 << 22 | b3 >>> 10) + c3 | 0;
- a3 += (b3 & c3 | ~b3 & d3) + k3[8] + 1770035416 | 0;
- a3 = (a3 << 7 | a3 >>> 25) + b3 | 0;
- d3 += (a3 & b3 | ~a3 & c3) + k3[9] - 1958414417 | 0;
- d3 = (d3 << 12 | d3 >>> 20) + a3 | 0;
- c3 += (d3 & a3 | ~d3 & b3) + k3[10] - 42063 | 0;
- c3 = (c3 << 17 | c3 >>> 15) + d3 | 0;
- b3 += (c3 & d3 | ~c3 & a3) + k3[11] - 1990404162 | 0;
- b3 = (b3 << 22 | b3 >>> 10) + c3 | 0;
- a3 += (b3 & c3 | ~b3 & d3) + k3[12] + 1804603682 | 0;
- a3 = (a3 << 7 | a3 >>> 25) + b3 | 0;
- d3 += (a3 & b3 | ~a3 & c3) + k3[13] - 40341101 | 0;
- d3 = (d3 << 12 | d3 >>> 20) + a3 | 0;
- c3 += (d3 & a3 | ~d3 & b3) + k3[14] - 1502002290 | 0;
- c3 = (c3 << 17 | c3 >>> 15) + d3 | 0;
- b3 += (c3 & d3 | ~c3 & a3) + k3[15] + 1236535329 | 0;
- b3 = (b3 << 22 | b3 >>> 10) + c3 | 0;
- a3 += (b3 & d3 | c3 & ~d3) + k3[1] - 165796510 | 0;
- a3 = (a3 << 5 | a3 >>> 27) + b3 | 0;
- d3 += (a3 & c3 | b3 & ~c3) + k3[6] - 1069501632 | 0;
- d3 = (d3 << 9 | d3 >>> 23) + a3 | 0;
- c3 += (d3 & b3 | a3 & ~b3) + k3[11] + 643717713 | 0;
- c3 = (c3 << 14 | c3 >>> 18) + d3 | 0;
- b3 += (c3 & a3 | d3 & ~a3) + k3[0] - 373897302 | 0;
- b3 = (b3 << 20 | b3 >>> 12) + c3 | 0;
- a3 += (b3 & d3 | c3 & ~d3) + k3[5] - 701558691 | 0;
- a3 = (a3 << 5 | a3 >>> 27) + b3 | 0;
- d3 += (a3 & c3 | b3 & ~c3) + k3[10] + 38016083 | 0;
- d3 = (d3 << 9 | d3 >>> 23) + a3 | 0;
- c3 += (d3 & b3 | a3 & ~b3) + k3[15] - 660478335 | 0;
- c3 = (c3 << 14 | c3 >>> 18) + d3 | 0;
- b3 += (c3 & a3 | d3 & ~a3) + k3[4] - 405537848 | 0;
- b3 = (b3 << 20 | b3 >>> 12) + c3 | 0;
- a3 += (b3 & d3 | c3 & ~d3) + k3[9] + 568446438 | 0;
- a3 = (a3 << 5 | a3 >>> 27) + b3 | 0;
- d3 += (a3 & c3 | b3 & ~c3) + k3[14] - 1019803690 | 0;
- d3 = (d3 << 9 | d3 >>> 23) + a3 | 0;
- c3 += (d3 & b3 | a3 & ~b3) + k3[3] - 187363961 | 0;
- c3 = (c3 << 14 | c3 >>> 18) + d3 | 0;
- b3 += (c3 & a3 | d3 & ~a3) + k3[8] + 1163531501 | 0;
- b3 = (b3 << 20 | b3 >>> 12) + c3 | 0;
- a3 += (b3 & d3 | c3 & ~d3) + k3[13] - 1444681467 | 0;
- a3 = (a3 << 5 | a3 >>> 27) + b3 | 0;
- d3 += (a3 & c3 | b3 & ~c3) + k3[2] - 51403784 | 0;
- d3 = (d3 << 9 | d3 >>> 23) + a3 | 0;
- c3 += (d3 & b3 | a3 & ~b3) + k3[7] + 1735328473 | 0;
- c3 = (c3 << 14 | c3 >>> 18) + d3 | 0;
- b3 += (c3 & a3 | d3 & ~a3) + k3[12] - 1926607734 | 0;
- b3 = (b3 << 20 | b3 >>> 12) + c3 | 0;
- a3 += (b3 ^ c3 ^ d3) + k3[5] - 378558 | 0;
- a3 = (a3 << 4 | a3 >>> 28) + b3 | 0;
- d3 += (a3 ^ b3 ^ c3) + k3[8] - 2022574463 | 0;
- d3 = (d3 << 11 | d3 >>> 21) + a3 | 0;
- c3 += (d3 ^ a3 ^ b3) + k3[11] + 1839030562 | 0;
- c3 = (c3 << 16 | c3 >>> 16) + d3 | 0;
- b3 += (c3 ^ d3 ^ a3) + k3[14] - 35309556 | 0;
- b3 = (b3 << 23 | b3 >>> 9) + c3 | 0;
- a3 += (b3 ^ c3 ^ d3) + k3[1] - 1530992060 | 0;
- a3 = (a3 << 4 | a3 >>> 28) + b3 | 0;
- d3 += (a3 ^ b3 ^ c3) + k3[4] + 1272893353 | 0;
- d3 = (d3 << 11 | d3 >>> 21) + a3 | 0;
- c3 += (d3 ^ a3 ^ b3) + k3[7] - 155497632 | 0;
- c3 = (c3 << 16 | c3 >>> 16) + d3 | 0;
- b3 += (c3 ^ d3 ^ a3) + k3[10] - 1094730640 | 0;
- b3 = (b3 << 23 | b3 >>> 9) + c3 | 0;
- a3 += (b3 ^ c3 ^ d3) + k3[13] + 681279174 | 0;
- a3 = (a3 << 4 | a3 >>> 28) + b3 | 0;
- d3 += (a3 ^ b3 ^ c3) + k3[0] - 358537222 | 0;
- d3 = (d3 << 11 | d3 >>> 21) + a3 | 0;
- c3 += (d3 ^ a3 ^ b3) + k3[3] - 722521979 | 0;
- c3 = (c3 << 16 | c3 >>> 16) + d3 | 0;
- b3 += (c3 ^ d3 ^ a3) + k3[6] + 76029189 | 0;
- b3 = (b3 << 23 | b3 >>> 9) + c3 | 0;
- a3 += (b3 ^ c3 ^ d3) + k3[9] - 640364487 | 0;
- a3 = (a3 << 4 | a3 >>> 28) + b3 | 0;
- d3 += (a3 ^ b3 ^ c3) + k3[12] - 421815835 | 0;
- d3 = (d3 << 11 | d3 >>> 21) + a3 | 0;
- c3 += (d3 ^ a3 ^ b3) + k3[15] + 530742520 | 0;
- c3 = (c3 << 16 | c3 >>> 16) + d3 | 0;
- b3 += (c3 ^ d3 ^ a3) + k3[2] - 995338651 | 0;
- b3 = (b3 << 23 | b3 >>> 9) + c3 | 0;
- a3 += (c3 ^ (b3 | ~d3)) + k3[0] - 198630844 | 0;
- a3 = (a3 << 6 | a3 >>> 26) + b3 | 0;
- d3 += (b3 ^ (a3 | ~c3)) + k3[7] + 1126891415 | 0;
- d3 = (d3 << 10 | d3 >>> 22) + a3 | 0;
- c3 += (a3 ^ (d3 | ~b3)) + k3[14] - 1416354905 | 0;
- c3 = (c3 << 15 | c3 >>> 17) + d3 | 0;
- b3 += (d3 ^ (c3 | ~a3)) + k3[5] - 57434055 | 0;
- b3 = (b3 << 21 | b3 >>> 11) + c3 | 0;
- a3 += (c3 ^ (b3 | ~d3)) + k3[12] + 1700485571 | 0;
- a3 = (a3 << 6 | a3 >>> 26) + b3 | 0;
- d3 += (b3 ^ (a3 | ~c3)) + k3[3] - 1894986606 | 0;
- d3 = (d3 << 10 | d3 >>> 22) + a3 | 0;
- c3 += (a3 ^ (d3 | ~b3)) + k3[10] - 1051523 | 0;
- c3 = (c3 << 15 | c3 >>> 17) + d3 | 0;
- b3 += (d3 ^ (c3 | ~a3)) + k3[1] - 2054922799 | 0;
- b3 = (b3 << 21 | b3 >>> 11) + c3 | 0;
- a3 += (c3 ^ (b3 | ~d3)) + k3[8] + 1873313359 | 0;
- a3 = (a3 << 6 | a3 >>> 26) + b3 | 0;
- d3 += (b3 ^ (a3 | ~c3)) + k3[15] - 30611744 | 0;
- d3 = (d3 << 10 | d3 >>> 22) + a3 | 0;
- c3 += (a3 ^ (d3 | ~b3)) + k3[6] - 1560198380 | 0;
- c3 = (c3 << 15 | c3 >>> 17) + d3 | 0;
- b3 += (d3 ^ (c3 | ~a3)) + k3[13] + 1309151649 | 0;
- b3 = (b3 << 21 | b3 >>> 11) + c3 | 0;
- a3 += (c3 ^ (b3 | ~d3)) + k3[4] - 145523070 | 0;
- a3 = (a3 << 6 | a3 >>> 26) + b3 | 0;
- d3 += (b3 ^ (a3 | ~c3)) + k3[11] - 1120210379 | 0;
- d3 = (d3 << 10 | d3 >>> 22) + a3 | 0;
- c3 += (a3 ^ (d3 | ~b3)) + k3[2] + 718787259 | 0;
- c3 = (c3 << 15 | c3 >>> 17) + d3 | 0;
- b3 += (d3 ^ (c3 | ~a3)) + k3[9] - 343485551 | 0;
- b3 = (b3 << 21 | b3 >>> 11) + c3 | 0;
- x3[0] = a3 + x3[0] | 0;
- x3[1] = b3 + x3[1] | 0;
- x3[2] = c3 + x3[2] | 0;
- x3[3] = d3 + x3[3] | 0;
- }
- function md5blk(s3) {
- var md5blks = [], i3;
- for (i3 = 0; i3 < 64; i3 += 4) {
- md5blks[i3 >> 2] = s3.charCodeAt(i3) + (s3.charCodeAt(i3 + 1) << 8) + (s3.charCodeAt(i3 + 2) << 16) + (s3.charCodeAt(i3 + 3) << 24);
- }
- return md5blks;
- }
- function md5blk_array(a3) {
- var md5blks = [], i3;
- for (i3 = 0; i3 < 64; i3 += 4) {
- md5blks[i3 >> 2] = a3[i3] + (a3[i3 + 1] << 8) + (a3[i3 + 2] << 16) + (a3[i3 + 3] << 24);
- }
- return md5blks;
- }
- function md51(s3) {
- var n3 = s3.length, state = [1732584193, -271733879, -1732584194, 271733878], i3, length, tail, tmp, lo, hi;
- for (i3 = 64; i3 <= n3; i3 += 64) {
- md5cycle(state, md5blk(s3.substring(i3 - 64, i3)));
- }
- s3 = s3.substring(i3 - 64);
- length = s3.length;
- tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- for (i3 = 0; i3 < length; i3 += 1) {
- tail[i3 >> 2] |= s3.charCodeAt(i3) << (i3 % 4 << 3);
- }
- tail[i3 >> 2] |= 128 << (i3 % 4 << 3);
- if (i3 > 55) {
- md5cycle(state, tail);
- for (i3 = 0; i3 < 16; i3 += 1) {
- tail[i3] = 0;
- }
- }
- tmp = n3 * 8;
- tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
- lo = parseInt(tmp[2], 16);
- hi = parseInt(tmp[1], 16) || 0;
- tail[14] = lo;
- tail[15] = hi;
- md5cycle(state, tail);
- return state;
- }
- function md51_array(a3) {
- var n3 = a3.length, state = [1732584193, -271733879, -1732584194, 271733878], i3, length, tail, tmp, lo, hi;
- for (i3 = 64; i3 <= n3; i3 += 64) {
- md5cycle(state, md5blk_array(a3.subarray(i3 - 64, i3)));
- }
- a3 = i3 - 64 < n3 ? a3.subarray(i3 - 64) : new Uint8Array(0);
- length = a3.length;
- tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- for (i3 = 0; i3 < length; i3 += 1) {
- tail[i3 >> 2] |= a3[i3] << (i3 % 4 << 3);
- }
- tail[i3 >> 2] |= 128 << (i3 % 4 << 3);
- if (i3 > 55) {
- md5cycle(state, tail);
- for (i3 = 0; i3 < 16; i3 += 1) {
- tail[i3] = 0;
- }
- }
- tmp = n3 * 8;
- tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
- lo = parseInt(tmp[2], 16);
- hi = parseInt(tmp[1], 16) || 0;
- tail[14] = lo;
- tail[15] = hi;
- md5cycle(state, tail);
- return state;
- }
- function rhex(n3) {
- var s3 = "", j3;
- for (j3 = 0; j3 < 4; j3 += 1) {
- s3 += hex_chr[n3 >> j3 * 8 + 4 & 15] + hex_chr[n3 >> j3 * 8 & 15];
- }
- return s3;
- }
- function hex(x3) {
- var i3;
- for (i3 = 0; i3 < x3.length; i3 += 1) {
- x3[i3] = rhex(x3[i3]);
- }
- return x3.join("");
- }
- if (hex(md51("hello")) !== "5d41402abc4b2a76b9719d911017c592")
- ;
- if (typeof ArrayBuffer !== "undefined" && !ArrayBuffer.prototype.slice) {
- (function() {
- function clamp2(val, length) {
- val = val | 0 || 0;
- if (val < 0) {
- return Math.max(val + length, 0);
- }
- return Math.min(val, length);
- }
- ArrayBuffer.prototype.slice = function(from, to) {
- var length = this.byteLength, begin = clamp2(from, length), end2 = length, num, target, targetArray, sourceArray;
- if (to !== undefined$1) {
- end2 = clamp2(to, length);
- }
- if (begin > end2) {
- return new ArrayBuffer(0);
- }
- num = end2 - begin;
- target = new ArrayBuffer(num);
- targetArray = new Uint8Array(target);
- sourceArray = new Uint8Array(this, begin, num);
- targetArray.set(sourceArray);
- return target;
- };
- })();
- }
- function toUtf8(str) {
- if (/[\u0080-\uFFFF]/.test(str)) {
- str = unescape(encodeURIComponent(str));
- }
- return str;
- }
- function utf8Str2ArrayBuffer(str, returnUInt8Array) {
- var length = str.length, buff = new ArrayBuffer(length), arr = new Uint8Array(buff), i3;
- for (i3 = 0; i3 < length; i3 += 1) {
- arr[i3] = str.charCodeAt(i3);
- }
- return returnUInt8Array ? arr : buff;
- }
- function arrayBuffer2Utf8Str(buff) {
- return String.fromCharCode.apply(null, new Uint8Array(buff));
- }
- function concatenateArrayBuffers(first, second, returnUInt8Array) {
- var result = new Uint8Array(first.byteLength + second.byteLength);
- result.set(new Uint8Array(first));
- result.set(new Uint8Array(second), first.byteLength);
- return returnUInt8Array ? result : result.buffer;
- }
- function hexToBinaryString(hex2) {
- var bytes = [], length = hex2.length, x3;
- for (x3 = 0; x3 < length - 1; x3 += 2) {
- bytes.push(parseInt(hex2.substr(x3, 2), 16));
- }
- return String.fromCharCode.apply(String, bytes);
- }
- function SparkMD52() {
- this.reset();
- }
- SparkMD52.prototype.append = function(str) {
- this.appendBinary(toUtf8(str));
- return this;
- };
- SparkMD52.prototype.appendBinary = function(contents) {
- this._buff += contents;
- this._length += contents.length;
- var length = this._buff.length, i3;
- for (i3 = 64; i3 <= length; i3 += 64) {
- md5cycle(this._hash, md5blk(this._buff.substring(i3 - 64, i3)));
- }
- this._buff = this._buff.substring(i3 - 64);
- return this;
- };
- SparkMD52.prototype.end = function(raw2) {
- var buff = this._buff, length = buff.length, i3, tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ret;
- for (i3 = 0; i3 < length; i3 += 1) {
- tail[i3 >> 2] |= buff.charCodeAt(i3) << (i3 % 4 << 3);
- }
- this._finish(tail, length);
- ret = hex(this._hash);
- if (raw2) {
- ret = hexToBinaryString(ret);
- }
- this.reset();
- return ret;
- };
- SparkMD52.prototype.reset = function() {
- this._buff = "";
- this._length = 0;
- this._hash = [1732584193, -271733879, -1732584194, 271733878];
- return this;
- };
- SparkMD52.prototype.getState = function() {
- return {
- buff: this._buff,
- length: this._length,
- hash: this._hash.slice()
- };
- };
- SparkMD52.prototype.setState = function(state) {
- this._buff = state.buff;
- this._length = state.length;
- this._hash = state.hash;
- return this;
- };
- SparkMD52.prototype.destroy = function() {
- delete this._hash;
- delete this._buff;
- delete this._length;
- };
- SparkMD52.prototype._finish = function(tail, length) {
- var i3 = length, tmp, lo, hi;
- tail[i3 >> 2] |= 128 << (i3 % 4 << 3);
- if (i3 > 55) {
- md5cycle(this._hash, tail);
- for (i3 = 0; i3 < 16; i3 += 1) {
- tail[i3] = 0;
- }
- }
- tmp = this._length * 8;
- tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
- lo = parseInt(tmp[2], 16);
- hi = parseInt(tmp[1], 16) || 0;
- tail[14] = lo;
- tail[15] = hi;
- md5cycle(this._hash, tail);
- };
- SparkMD52.hash = function(str, raw2) {
- return SparkMD52.hashBinary(toUtf8(str), raw2);
- };
- SparkMD52.hashBinary = function(content2, raw2) {
- var hash3 = md51(content2), ret = hex(hash3);
- return raw2 ? hexToBinaryString(ret) : ret;
- };
- SparkMD52.ArrayBuffer = function() {
- this.reset();
- };
- SparkMD52.ArrayBuffer.prototype.append = function(arr) {
- var buff = concatenateArrayBuffers(this._buff.buffer, arr, true), length = buff.length, i3;
- this._length += arr.byteLength;
- for (i3 = 64; i3 <= length; i3 += 64) {
- md5cycle(this._hash, md5blk_array(buff.subarray(i3 - 64, i3)));
- }
- this._buff = i3 - 64 < length ? new Uint8Array(buff.buffer.slice(i3 - 64)) : new Uint8Array(0);
- return this;
- };
- SparkMD52.ArrayBuffer.prototype.end = function(raw2) {
- var buff = this._buff, length = buff.length, tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], i3, ret;
- for (i3 = 0; i3 < length; i3 += 1) {
- tail[i3 >> 2] |= buff[i3] << (i3 % 4 << 3);
- }
- this._finish(tail, length);
- ret = hex(this._hash);
- if (raw2) {
- ret = hexToBinaryString(ret);
- }
- this.reset();
- return ret;
- };
- SparkMD52.ArrayBuffer.prototype.reset = function() {
- this._buff = new Uint8Array(0);
- this._length = 0;
- this._hash = [1732584193, -271733879, -1732584194, 271733878];
- return this;
- };
- SparkMD52.ArrayBuffer.prototype.getState = function() {
- var state = SparkMD52.prototype.getState.call(this);
- state.buff = arrayBuffer2Utf8Str(state.buff);
- return state;
- };
- SparkMD52.ArrayBuffer.prototype.setState = function(state) {
- state.buff = utf8Str2ArrayBuffer(state.buff, true);
- return SparkMD52.prototype.setState.call(this, state);
- };
- SparkMD52.ArrayBuffer.prototype.destroy = SparkMD52.prototype.destroy;
- SparkMD52.ArrayBuffer.prototype._finish = SparkMD52.prototype._finish;
- SparkMD52.ArrayBuffer.hash = function(arr, raw2) {
- var hash3 = md51_array(new Uint8Array(arr)), ret = hex(hash3);
- return raw2 ? hexToBinaryString(ret) : ret;
- };
- return SparkMD52;
- });
- })(sparkMd5);
- var SparkMD5 = sparkMd5.exports;
- var fileSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice;
- var FileChecksum = class {
- static create(file, callback) {
- const instance = new FileChecksum(file);
- instance.create(callback);
}
- constructor(file) {
- this.file = file;
- this.chunkSize = 2097152;
- this.chunkCount = Math.ceil(this.file.size / this.chunkSize);
- this.chunkIndex = 0;
- }
- create(callback) {
- this.callback = callback;
- this.md5Buffer = new SparkMD5.ArrayBuffer();
- this.fileReader = new FileReader();
- this.fileReader.addEventListener("load", (event) => this.fileReaderDidLoad(event));
- this.fileReader.addEventListener("error", (event) => this.fileReaderDidError(event));
- this.readNextChunk();
- }
- fileReaderDidLoad(event) {
- this.md5Buffer.append(event.target.result);
- if (!this.readNextChunk()) {
- const binaryDigest = this.md5Buffer.end(true);
- const base64digest = btoa(binaryDigest);
- this.callback(null, base64digest);
- }
- }
- fileReaderDidError(event) {
- this.callback(`Error reading ${this.file.name}`);
- }
- readNextChunk() {
- if (this.chunkIndex < this.chunkCount || this.chunkIndex == 0 && this.chunkCount == 0) {
- const start5 = this.chunkIndex * this.chunkSize;
- const end2 = Math.min(start5 + this.chunkSize, this.file.size);
- const bytes = fileSlice.call(this.file, start5, end2);
- this.fileReader.readAsArrayBuffer(bytes);
- this.chunkIndex++;
- return true;
- } else {
- return false;
- }
- }
};
- function getMetaValue(name) {
- const element = findElement(document.head, `meta[name="${name}"]`);
- if (element) {
- return element.getAttribute("content");
- }
- }
- function findElements(root, selector) {
- if (typeof root == "string") {
- selector = root;
- root = document;
- }
- const elements = root.querySelectorAll(selector);
- return toArray(elements);
- }
- function findElement(root, selector) {
- if (typeof root == "string") {
- selector = root;
- root = document;
- }
- return root.querySelector(selector);
- }
- function dispatchEvent2(element, type, eventInit = {}) {
- const { disabled } = element;
- const { bubbles, cancelable, detail } = eventInit;
- const event = document.createEvent("Event");
- event.initEvent(type, bubbles || true, cancelable || true);
- event.detail = detail || {};
- try {
- element.disabled = false;
- element.dispatchEvent(event);
- } finally {
- element.disabled = disabled;
- }
- return event;
- }
- function toArray(value) {
- if (Array.isArray(value)) {
- return value;
- } else if (Array.from) {
- return Array.from(value);
- } else {
- return [].slice.call(value);
- }
- }
- var BlobRecord = class {
- constructor(file, checksum, url) {
- this.file = file;
- this.attributes = {
- filename: file.name,
- content_type: file.type || "application/octet-stream",
- byte_size: file.size,
- checksum
- };
- this.xhr = new XMLHttpRequest();
- this.xhr.open("POST", url, true);
- this.xhr.responseType = "json";
- this.xhr.setRequestHeader("Content-Type", "application/json");
- this.xhr.setRequestHeader("Accept", "application/json");
- this.xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
- const csrfToken = getMetaValue("csrf-token");
- if (csrfToken != void 0) {
- this.xhr.setRequestHeader("X-CSRF-Token", csrfToken);
- }
- this.xhr.addEventListener("load", (event) => this.requestDidLoad(event));
- this.xhr.addEventListener("error", (event) => this.requestDidError(event));
- }
- get status() {
- return this.xhr.status;
- }
- get response() {
- const { responseType, response } = this.xhr;
- if (responseType == "json") {
- return response;
- } else {
- return JSON.parse(response);
- }
- }
- create(callback) {
- this.callback = callback;
- this.xhr.send(JSON.stringify({
- blob: this.attributes
- }));
- }
- requestDidLoad(event) {
- if (this.status >= 200 && this.status < 300) {
- const { response } = this;
- const { direct_upload } = response;
- delete response.direct_upload;
- this.attributes = response;
- this.directUploadData = direct_upload;
- this.callback(null, this.toJSON());
- } else {
- this.requestDidError(event);
- }
- }
- requestDidError(event) {
- this.callback(`Error creating Blob for "${this.file.name}". Status: ${this.status}`);
- }
- toJSON() {
- const result = {};
- for (const key in this.attributes) {
- result[key] = this.attributes[key];
- }
- return result;
- }
- };
- var BlobUpload = class {
- constructor(blob) {
- this.blob = blob;
- this.file = blob.file;
- const { url, headers } = blob.directUploadData;
- this.xhr = new XMLHttpRequest();
- this.xhr.open("PUT", url, true);
- this.xhr.responseType = "text";
- for (const key in headers) {
- this.xhr.setRequestHeader(key, headers[key]);
- }
- this.xhr.addEventListener("load", (event) => this.requestDidLoad(event));
- this.xhr.addEventListener("error", (event) => this.requestDidError(event));
- }
- create(callback) {
- this.callback = callback;
- this.xhr.send(this.file.slice());
- }
- requestDidLoad(event) {
- const { status, response } = this.xhr;
- if (status >= 200 && status < 300) {
- this.callback(null, response);
- } else {
- this.requestDidError(event);
- }
- }
- requestDidError(event) {
- this.callback(`Error storing "${this.file.name}". Status: ${this.xhr.status}`);
- }
- };
- var id = 0;
- var DirectUpload = class {
- constructor(file, url, delegate) {
- this.id = ++id;
- this.file = file;
- this.url = url;
- this.delegate = delegate;
- }
- create(callback) {
- FileChecksum.create(this.file, (error2, checksum) => {
- if (error2) {
- callback(error2);
- return;
- }
- const blob = new BlobRecord(this.file, checksum, this.url);
- notify(this.delegate, "directUploadWillCreateBlobWithXHR", blob.xhr);
- blob.create((error3) => {
- if (error3) {
- callback(error3);
- } else {
- const upload = new BlobUpload(blob);
- notify(this.delegate, "directUploadWillStoreFileWithXHR", upload.xhr);
- upload.create((error4) => {
- if (error4) {
- callback(error4);
- } else {
- callback(null, blob.toJSON());
- }
- });
- }
- });
- });
- }
- };
- function notify(object, methodName, ...messages) {
- if (object && typeof object[methodName] == "function") {
- return object[methodName](...messages);
- }
- }
- var DirectUploadController = class {
- constructor(input, file) {
- this.input = input;
- this.file = file;
- this.directUpload = new DirectUpload(this.file, this.url, this);
- this.dispatch("initialize");
- }
- start(callback) {
- const hiddenInput = document.createElement("input");
- hiddenInput.type = "hidden";
- hiddenInput.name = this.input.name;
- this.input.insertAdjacentElement("beforebegin", hiddenInput);
- this.dispatch("start");
- this.directUpload.create((error2, attributes) => {
- if (error2) {
- hiddenInput.parentNode.removeChild(hiddenInput);
- this.dispatchError(error2);
- } else {
- hiddenInput.value = attributes.signed_id;
- }
- this.dispatch("end");
- callback(error2);
- });
- }
- uploadRequestDidProgress(event) {
- const progress = event.loaded / event.total * 100;
- if (progress) {
- this.dispatch("progress", {
- progress
- });
- }
- }
- get url() {
- return this.input.getAttribute("data-direct-upload-url");
- }
- dispatch(name, detail = {}) {
- detail.file = this.file;
- detail.id = this.directUpload.id;
- return dispatchEvent2(this.input, `direct-upload:${name}`, {
- detail
- });
- }
- dispatchError(error2) {
- const event = this.dispatch("error", {
- error: error2
- });
- if (!event.defaultPrevented) {
- alert(error2);
- }
- }
- directUploadWillCreateBlobWithXHR(xhr) {
- this.dispatch("before-blob-request", {
- xhr
- });
- }
- directUploadWillStoreFileWithXHR(xhr) {
- this.dispatch("before-storage-request", {
- xhr
- });
- xhr.upload.addEventListener("progress", (event) => this.uploadRequestDidProgress(event));
- }
- };
- var inputSelector = "input[type=file][data-direct-upload-url]:not([disabled])";
- var DirectUploadsController = class {
- constructor(form) {
- this.form = form;
- this.inputs = findElements(form, inputSelector).filter((input) => input.files.length);
- }
- start(callback) {
- const controllers = this.createDirectUploadControllers();
- const startNextController = () => {
- const controller = controllers.shift();
- if (controller) {
- controller.start((error2) => {
- if (error2) {
- callback(error2);
- this.dispatch("end");
- } else {
- startNextController();
- }
- });
- } else {
- callback();
- this.dispatch("end");
- }
- };
- this.dispatch("start");
- startNextController();
- }
- createDirectUploadControllers() {
- const controllers = [];
- this.inputs.forEach((input) => {
- toArray(input.files).forEach((file) => {
- const controller = new DirectUploadController(input, file);
- controllers.push(controller);
- });
- });
- return controllers;
- }
- dispatch(name, detail = {}) {
- return dispatchEvent2(this.form, `direct-uploads:${name}`, {
- detail
- });
- }
- };
- var processingAttribute = "data-direct-uploads-processing";
- var submitButtonsByForm = /* @__PURE__ */ new WeakMap();
- var started = false;
- function start() {
- if (!started) {
- started = true;
- document.addEventListener("click", didClick, true);
- document.addEventListener("submit", didSubmitForm, true);
- document.addEventListener("ajax:before", didSubmitRemoteElement);
- }
- }
- function didClick(event) {
- const { target } = event;
- if ((target.tagName == "INPUT" || target.tagName == "BUTTON") && target.type == "submit" && target.form) {
- submitButtonsByForm.set(target.form, target);
- }
- }
- function didSubmitForm(event) {
- handleFormSubmissionEvent(event);
- }
- function didSubmitRemoteElement(event) {
- if (event.target.tagName == "FORM") {
- handleFormSubmissionEvent(event);
- }
- }
- function handleFormSubmissionEvent(event) {
- const form = event.target;
- if (form.hasAttribute(processingAttribute)) {
- event.preventDefault();
- return;
- }
- const controller = new DirectUploadsController(form);
- const { inputs } = controller;
- if (inputs.length) {
- event.preventDefault();
- form.setAttribute(processingAttribute, "");
- inputs.forEach(disable);
- controller.start((error2) => {
- form.removeAttribute(processingAttribute);
- if (error2) {
- inputs.forEach(enable);
- } else {
- submitForm(form);
- }
- });
- }
- }
- function submitForm(form) {
- let button = submitButtonsByForm.get(form) || findElement(form, "input[type=submit], button[type=submit]");
- if (button) {
- const { disabled } = button;
- button.disabled = false;
- button.focus();
- button.click();
- button.disabled = disabled;
- } else {
- button = document.createElement("input");
- button.type = "submit";
- button.style.display = "none";
- form.appendChild(button);
- button.click();
- form.removeChild(button);
- }
- submitButtonsByForm.delete(form);
- }
- function disable(input) {
- input.disabled = true;
- }
- function enable(input) {
- input.disabled = false;
- }
- function autostart() {
- if (window.ActiveStorage) {
- start();
- }
- }
- setTimeout(autostart, 1);
// ../../../node_modules/container-query-polyfill/dist/container-query-polyfill.modern.js
function e() {
return e = Object.assign ? Object.assign.bind() : function(e3) {
for (var t3 = 1; t3 < arguments.length; t3++) {
@@ -20153,11 +19440,11 @@
}
};
var session = new Session();
var cache = new Cache(session);
var { navigator: navigator$1 } = session;
- function start2() {
+ function start() {
session.start();
}
function registerAdapter(adapter) {
session.registerAdapter(adapter);
}
@@ -20192,11 +19479,11 @@
session,
cache,
PageRenderer,
PageSnapshot,
FrameRenderer,
- start: start2,
+ start,
registerAdapter,
visit,
connectStreamSource,
disconnectStreamSource,
renderStreamMessage,
@@ -20820,11 +20107,11 @@
}
element = element.parentElement;
}
})();
window.Turbo = Turbo;
- start2();
+ start();
// ../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable.js
var consumer;
async function getConsumer() {
return consumer || setConsumer(createConsumer2().then(setConsumer));
@@ -20939,43 +20226,824 @@
}
// ../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/index.js
addEventListener("turbo:before-fetch-request", encodeMethodIntoRequestBody);
- // base/polyfills/request-submit.js
- (function(prototype) {
- if (typeof prototype.requestSubmit == "function")
- return;
- prototype.requestSubmit = function(submitter) {
- if (submitter) {
- validateSubmitter(submitter, this);
- submitter.click();
+ // ../../../node_modules/@rails/activestorage/app/assets/javascripts/activestorage.esm.js
+ var sparkMd5 = {
+ exports: {}
+ };
+ (function(module, exports) {
+ (function(factory) {
+ {
+ module.exports = factory();
+ }
+ })(function(undefined$1) {
+ var hex_chr = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
+ function md5cycle(x3, k3) {
+ var a3 = x3[0], b3 = x3[1], c3 = x3[2], d3 = x3[3];
+ a3 += (b3 & c3 | ~b3 & d3) + k3[0] - 680876936 | 0;
+ a3 = (a3 << 7 | a3 >>> 25) + b3 | 0;
+ d3 += (a3 & b3 | ~a3 & c3) + k3[1] - 389564586 | 0;
+ d3 = (d3 << 12 | d3 >>> 20) + a3 | 0;
+ c3 += (d3 & a3 | ~d3 & b3) + k3[2] + 606105819 | 0;
+ c3 = (c3 << 17 | c3 >>> 15) + d3 | 0;
+ b3 += (c3 & d3 | ~c3 & a3) + k3[3] - 1044525330 | 0;
+ b3 = (b3 << 22 | b3 >>> 10) + c3 | 0;
+ a3 += (b3 & c3 | ~b3 & d3) + k3[4] - 176418897 | 0;
+ a3 = (a3 << 7 | a3 >>> 25) + b3 | 0;
+ d3 += (a3 & b3 | ~a3 & c3) + k3[5] + 1200080426 | 0;
+ d3 = (d3 << 12 | d3 >>> 20) + a3 | 0;
+ c3 += (d3 & a3 | ~d3 & b3) + k3[6] - 1473231341 | 0;
+ c3 = (c3 << 17 | c3 >>> 15) + d3 | 0;
+ b3 += (c3 & d3 | ~c3 & a3) + k3[7] - 45705983 | 0;
+ b3 = (b3 << 22 | b3 >>> 10) + c3 | 0;
+ a3 += (b3 & c3 | ~b3 & d3) + k3[8] + 1770035416 | 0;
+ a3 = (a3 << 7 | a3 >>> 25) + b3 | 0;
+ d3 += (a3 & b3 | ~a3 & c3) + k3[9] - 1958414417 | 0;
+ d3 = (d3 << 12 | d3 >>> 20) + a3 | 0;
+ c3 += (d3 & a3 | ~d3 & b3) + k3[10] - 42063 | 0;
+ c3 = (c3 << 17 | c3 >>> 15) + d3 | 0;
+ b3 += (c3 & d3 | ~c3 & a3) + k3[11] - 1990404162 | 0;
+ b3 = (b3 << 22 | b3 >>> 10) + c3 | 0;
+ a3 += (b3 & c3 | ~b3 & d3) + k3[12] + 1804603682 | 0;
+ a3 = (a3 << 7 | a3 >>> 25) + b3 | 0;
+ d3 += (a3 & b3 | ~a3 & c3) + k3[13] - 40341101 | 0;
+ d3 = (d3 << 12 | d3 >>> 20) + a3 | 0;
+ c3 += (d3 & a3 | ~d3 & b3) + k3[14] - 1502002290 | 0;
+ c3 = (c3 << 17 | c3 >>> 15) + d3 | 0;
+ b3 += (c3 & d3 | ~c3 & a3) + k3[15] + 1236535329 | 0;
+ b3 = (b3 << 22 | b3 >>> 10) + c3 | 0;
+ a3 += (b3 & d3 | c3 & ~d3) + k3[1] - 165796510 | 0;
+ a3 = (a3 << 5 | a3 >>> 27) + b3 | 0;
+ d3 += (a3 & c3 | b3 & ~c3) + k3[6] - 1069501632 | 0;
+ d3 = (d3 << 9 | d3 >>> 23) + a3 | 0;
+ c3 += (d3 & b3 | a3 & ~b3) + k3[11] + 643717713 | 0;
+ c3 = (c3 << 14 | c3 >>> 18) + d3 | 0;
+ b3 += (c3 & a3 | d3 & ~a3) + k3[0] - 373897302 | 0;
+ b3 = (b3 << 20 | b3 >>> 12) + c3 | 0;
+ a3 += (b3 & d3 | c3 & ~d3) + k3[5] - 701558691 | 0;
+ a3 = (a3 << 5 | a3 >>> 27) + b3 | 0;
+ d3 += (a3 & c3 | b3 & ~c3) + k3[10] + 38016083 | 0;
+ d3 = (d3 << 9 | d3 >>> 23) + a3 | 0;
+ c3 += (d3 & b3 | a3 & ~b3) + k3[15] - 660478335 | 0;
+ c3 = (c3 << 14 | c3 >>> 18) + d3 | 0;
+ b3 += (c3 & a3 | d3 & ~a3) + k3[4] - 405537848 | 0;
+ b3 = (b3 << 20 | b3 >>> 12) + c3 | 0;
+ a3 += (b3 & d3 | c3 & ~d3) + k3[9] + 568446438 | 0;
+ a3 = (a3 << 5 | a3 >>> 27) + b3 | 0;
+ d3 += (a3 & c3 | b3 & ~c3) + k3[14] - 1019803690 | 0;
+ d3 = (d3 << 9 | d3 >>> 23) + a3 | 0;
+ c3 += (d3 & b3 | a3 & ~b3) + k3[3] - 187363961 | 0;
+ c3 = (c3 << 14 | c3 >>> 18) + d3 | 0;
+ b3 += (c3 & a3 | d3 & ~a3) + k3[8] + 1163531501 | 0;
+ b3 = (b3 << 20 | b3 >>> 12) + c3 | 0;
+ a3 += (b3 & d3 | c3 & ~d3) + k3[13] - 1444681467 | 0;
+ a3 = (a3 << 5 | a3 >>> 27) + b3 | 0;
+ d3 += (a3 & c3 | b3 & ~c3) + k3[2] - 51403784 | 0;
+ d3 = (d3 << 9 | d3 >>> 23) + a3 | 0;
+ c3 += (d3 & b3 | a3 & ~b3) + k3[7] + 1735328473 | 0;
+ c3 = (c3 << 14 | c3 >>> 18) + d3 | 0;
+ b3 += (c3 & a3 | d3 & ~a3) + k3[12] - 1926607734 | 0;
+ b3 = (b3 << 20 | b3 >>> 12) + c3 | 0;
+ a3 += (b3 ^ c3 ^ d3) + k3[5] - 378558 | 0;
+ a3 = (a3 << 4 | a3 >>> 28) + b3 | 0;
+ d3 += (a3 ^ b3 ^ c3) + k3[8] - 2022574463 | 0;
+ d3 = (d3 << 11 | d3 >>> 21) + a3 | 0;
+ c3 += (d3 ^ a3 ^ b3) + k3[11] + 1839030562 | 0;
+ c3 = (c3 << 16 | c3 >>> 16) + d3 | 0;
+ b3 += (c3 ^ d3 ^ a3) + k3[14] - 35309556 | 0;
+ b3 = (b3 << 23 | b3 >>> 9) + c3 | 0;
+ a3 += (b3 ^ c3 ^ d3) + k3[1] - 1530992060 | 0;
+ a3 = (a3 << 4 | a3 >>> 28) + b3 | 0;
+ d3 += (a3 ^ b3 ^ c3) + k3[4] + 1272893353 | 0;
+ d3 = (d3 << 11 | d3 >>> 21) + a3 | 0;
+ c3 += (d3 ^ a3 ^ b3) + k3[7] - 155497632 | 0;
+ c3 = (c3 << 16 | c3 >>> 16) + d3 | 0;
+ b3 += (c3 ^ d3 ^ a3) + k3[10] - 1094730640 | 0;
+ b3 = (b3 << 23 | b3 >>> 9) + c3 | 0;
+ a3 += (b3 ^ c3 ^ d3) + k3[13] + 681279174 | 0;
+ a3 = (a3 << 4 | a3 >>> 28) + b3 | 0;
+ d3 += (a3 ^ b3 ^ c3) + k3[0] - 358537222 | 0;
+ d3 = (d3 << 11 | d3 >>> 21) + a3 | 0;
+ c3 += (d3 ^ a3 ^ b3) + k3[3] - 722521979 | 0;
+ c3 = (c3 << 16 | c3 >>> 16) + d3 | 0;
+ b3 += (c3 ^ d3 ^ a3) + k3[6] + 76029189 | 0;
+ b3 = (b3 << 23 | b3 >>> 9) + c3 | 0;
+ a3 += (b3 ^ c3 ^ d3) + k3[9] - 640364487 | 0;
+ a3 = (a3 << 4 | a3 >>> 28) + b3 | 0;
+ d3 += (a3 ^ b3 ^ c3) + k3[12] - 421815835 | 0;
+ d3 = (d3 << 11 | d3 >>> 21) + a3 | 0;
+ c3 += (d3 ^ a3 ^ b3) + k3[15] + 530742520 | 0;
+ c3 = (c3 << 16 | c3 >>> 16) + d3 | 0;
+ b3 += (c3 ^ d3 ^ a3) + k3[2] - 995338651 | 0;
+ b3 = (b3 << 23 | b3 >>> 9) + c3 | 0;
+ a3 += (c3 ^ (b3 | ~d3)) + k3[0] - 198630844 | 0;
+ a3 = (a3 << 6 | a3 >>> 26) + b3 | 0;
+ d3 += (b3 ^ (a3 | ~c3)) + k3[7] + 1126891415 | 0;
+ d3 = (d3 << 10 | d3 >>> 22) + a3 | 0;
+ c3 += (a3 ^ (d3 | ~b3)) + k3[14] - 1416354905 | 0;
+ c3 = (c3 << 15 | c3 >>> 17) + d3 | 0;
+ b3 += (d3 ^ (c3 | ~a3)) + k3[5] - 57434055 | 0;
+ b3 = (b3 << 21 | b3 >>> 11) + c3 | 0;
+ a3 += (c3 ^ (b3 | ~d3)) + k3[12] + 1700485571 | 0;
+ a3 = (a3 << 6 | a3 >>> 26) + b3 | 0;
+ d3 += (b3 ^ (a3 | ~c3)) + k3[3] - 1894986606 | 0;
+ d3 = (d3 << 10 | d3 >>> 22) + a3 | 0;
+ c3 += (a3 ^ (d3 | ~b3)) + k3[10] - 1051523 | 0;
+ c3 = (c3 << 15 | c3 >>> 17) + d3 | 0;
+ b3 += (d3 ^ (c3 | ~a3)) + k3[1] - 2054922799 | 0;
+ b3 = (b3 << 21 | b3 >>> 11) + c3 | 0;
+ a3 += (c3 ^ (b3 | ~d3)) + k3[8] + 1873313359 | 0;
+ a3 = (a3 << 6 | a3 >>> 26) + b3 | 0;
+ d3 += (b3 ^ (a3 | ~c3)) + k3[15] - 30611744 | 0;
+ d3 = (d3 << 10 | d3 >>> 22) + a3 | 0;
+ c3 += (a3 ^ (d3 | ~b3)) + k3[6] - 1560198380 | 0;
+ c3 = (c3 << 15 | c3 >>> 17) + d3 | 0;
+ b3 += (d3 ^ (c3 | ~a3)) + k3[13] + 1309151649 | 0;
+ b3 = (b3 << 21 | b3 >>> 11) + c3 | 0;
+ a3 += (c3 ^ (b3 | ~d3)) + k3[4] - 145523070 | 0;
+ a3 = (a3 << 6 | a3 >>> 26) + b3 | 0;
+ d3 += (b3 ^ (a3 | ~c3)) + k3[11] - 1120210379 | 0;
+ d3 = (d3 << 10 | d3 >>> 22) + a3 | 0;
+ c3 += (a3 ^ (d3 | ~b3)) + k3[2] + 718787259 | 0;
+ c3 = (c3 << 15 | c3 >>> 17) + d3 | 0;
+ b3 += (d3 ^ (c3 | ~a3)) + k3[9] - 343485551 | 0;
+ b3 = (b3 << 21 | b3 >>> 11) + c3 | 0;
+ x3[0] = a3 + x3[0] | 0;
+ x3[1] = b3 + x3[1] | 0;
+ x3[2] = c3 + x3[2] | 0;
+ x3[3] = d3 + x3[3] | 0;
+ }
+ function md5blk(s3) {
+ var md5blks = [], i3;
+ for (i3 = 0; i3 < 64; i3 += 4) {
+ md5blks[i3 >> 2] = s3.charCodeAt(i3) + (s3.charCodeAt(i3 + 1) << 8) + (s3.charCodeAt(i3 + 2) << 16) + (s3.charCodeAt(i3 + 3) << 24);
+ }
+ return md5blks;
+ }
+ function md5blk_array(a3) {
+ var md5blks = [], i3;
+ for (i3 = 0; i3 < 64; i3 += 4) {
+ md5blks[i3 >> 2] = a3[i3] + (a3[i3 + 1] << 8) + (a3[i3 + 2] << 16) + (a3[i3 + 3] << 24);
+ }
+ return md5blks;
+ }
+ function md51(s3) {
+ var n3 = s3.length, state = [1732584193, -271733879, -1732584194, 271733878], i3, length, tail, tmp, lo, hi;
+ for (i3 = 64; i3 <= n3; i3 += 64) {
+ md5cycle(state, md5blk(s3.substring(i3 - 64, i3)));
+ }
+ s3 = s3.substring(i3 - 64);
+ length = s3.length;
+ tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
+ for (i3 = 0; i3 < length; i3 += 1) {
+ tail[i3 >> 2] |= s3.charCodeAt(i3) << (i3 % 4 << 3);
+ }
+ tail[i3 >> 2] |= 128 << (i3 % 4 << 3);
+ if (i3 > 55) {
+ md5cycle(state, tail);
+ for (i3 = 0; i3 < 16; i3 += 1) {
+ tail[i3] = 0;
+ }
+ }
+ tmp = n3 * 8;
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
+ lo = parseInt(tmp[2], 16);
+ hi = parseInt(tmp[1], 16) || 0;
+ tail[14] = lo;
+ tail[15] = hi;
+ md5cycle(state, tail);
+ return state;
+ }
+ function md51_array(a3) {
+ var n3 = a3.length, state = [1732584193, -271733879, -1732584194, 271733878], i3, length, tail, tmp, lo, hi;
+ for (i3 = 64; i3 <= n3; i3 += 64) {
+ md5cycle(state, md5blk_array(a3.subarray(i3 - 64, i3)));
+ }
+ a3 = i3 - 64 < n3 ? a3.subarray(i3 - 64) : new Uint8Array(0);
+ length = a3.length;
+ tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
+ for (i3 = 0; i3 < length; i3 += 1) {
+ tail[i3 >> 2] |= a3[i3] << (i3 % 4 << 3);
+ }
+ tail[i3 >> 2] |= 128 << (i3 % 4 << 3);
+ if (i3 > 55) {
+ md5cycle(state, tail);
+ for (i3 = 0; i3 < 16; i3 += 1) {
+ tail[i3] = 0;
+ }
+ }
+ tmp = n3 * 8;
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
+ lo = parseInt(tmp[2], 16);
+ hi = parseInt(tmp[1], 16) || 0;
+ tail[14] = lo;
+ tail[15] = hi;
+ md5cycle(state, tail);
+ return state;
+ }
+ function rhex(n3) {
+ var s3 = "", j3;
+ for (j3 = 0; j3 < 4; j3 += 1) {
+ s3 += hex_chr[n3 >> j3 * 8 + 4 & 15] + hex_chr[n3 >> j3 * 8 & 15];
+ }
+ return s3;
+ }
+ function hex(x3) {
+ var i3;
+ for (i3 = 0; i3 < x3.length; i3 += 1) {
+ x3[i3] = rhex(x3[i3]);
+ }
+ return x3.join("");
+ }
+ if (hex(md51("hello")) !== "5d41402abc4b2a76b9719d911017c592")
+ ;
+ if (typeof ArrayBuffer !== "undefined" && !ArrayBuffer.prototype.slice) {
+ (function() {
+ function clamp2(val, length) {
+ val = val | 0 || 0;
+ if (val < 0) {
+ return Math.max(val + length, 0);
+ }
+ return Math.min(val, length);
+ }
+ ArrayBuffer.prototype.slice = function(from, to) {
+ var length = this.byteLength, begin = clamp2(from, length), end2 = length, num, target, targetArray, sourceArray;
+ if (to !== undefined$1) {
+ end2 = clamp2(to, length);
+ }
+ if (begin > end2) {
+ return new ArrayBuffer(0);
+ }
+ num = end2 - begin;
+ target = new ArrayBuffer(num);
+ targetArray = new Uint8Array(target);
+ sourceArray = new Uint8Array(this, begin, num);
+ targetArray.set(sourceArray);
+ return target;
+ };
+ })();
+ }
+ function toUtf8(str) {
+ if (/[\u0080-\uFFFF]/.test(str)) {
+ str = unescape(encodeURIComponent(str));
+ }
+ return str;
+ }
+ function utf8Str2ArrayBuffer(str, returnUInt8Array) {
+ var length = str.length, buff = new ArrayBuffer(length), arr = new Uint8Array(buff), i3;
+ for (i3 = 0; i3 < length; i3 += 1) {
+ arr[i3] = str.charCodeAt(i3);
+ }
+ return returnUInt8Array ? arr : buff;
+ }
+ function arrayBuffer2Utf8Str(buff) {
+ return String.fromCharCode.apply(null, new Uint8Array(buff));
+ }
+ function concatenateArrayBuffers(first, second, returnUInt8Array) {
+ var result = new Uint8Array(first.byteLength + second.byteLength);
+ result.set(new Uint8Array(first));
+ result.set(new Uint8Array(second), first.byteLength);
+ return returnUInt8Array ? result : result.buffer;
+ }
+ function hexToBinaryString(hex2) {
+ var bytes = [], length = hex2.length, x3;
+ for (x3 = 0; x3 < length - 1; x3 += 2) {
+ bytes.push(parseInt(hex2.substr(x3, 2), 16));
+ }
+ return String.fromCharCode.apply(String, bytes);
+ }
+ function SparkMD52() {
+ this.reset();
+ }
+ SparkMD52.prototype.append = function(str) {
+ this.appendBinary(toUtf8(str));
+ return this;
+ };
+ SparkMD52.prototype.appendBinary = function(contents) {
+ this._buff += contents;
+ this._length += contents.length;
+ var length = this._buff.length, i3;
+ for (i3 = 64; i3 <= length; i3 += 64) {
+ md5cycle(this._hash, md5blk(this._buff.substring(i3 - 64, i3)));
+ }
+ this._buff = this._buff.substring(i3 - 64);
+ return this;
+ };
+ SparkMD52.prototype.end = function(raw2) {
+ var buff = this._buff, length = buff.length, i3, tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ret;
+ for (i3 = 0; i3 < length; i3 += 1) {
+ tail[i3 >> 2] |= buff.charCodeAt(i3) << (i3 % 4 << 3);
+ }
+ this._finish(tail, length);
+ ret = hex(this._hash);
+ if (raw2) {
+ ret = hexToBinaryString(ret);
+ }
+ this.reset();
+ return ret;
+ };
+ SparkMD52.prototype.reset = function() {
+ this._buff = "";
+ this._length = 0;
+ this._hash = [1732584193, -271733879, -1732584194, 271733878];
+ return this;
+ };
+ SparkMD52.prototype.getState = function() {
+ return {
+ buff: this._buff,
+ length: this._length,
+ hash: this._hash.slice()
+ };
+ };
+ SparkMD52.prototype.setState = function(state) {
+ this._buff = state.buff;
+ this._length = state.length;
+ this._hash = state.hash;
+ return this;
+ };
+ SparkMD52.prototype.destroy = function() {
+ delete this._hash;
+ delete this._buff;
+ delete this._length;
+ };
+ SparkMD52.prototype._finish = function(tail, length) {
+ var i3 = length, tmp, lo, hi;
+ tail[i3 >> 2] |= 128 << (i3 % 4 << 3);
+ if (i3 > 55) {
+ md5cycle(this._hash, tail);
+ for (i3 = 0; i3 < 16; i3 += 1) {
+ tail[i3] = 0;
+ }
+ }
+ tmp = this._length * 8;
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
+ lo = parseInt(tmp[2], 16);
+ hi = parseInt(tmp[1], 16) || 0;
+ tail[14] = lo;
+ tail[15] = hi;
+ md5cycle(this._hash, tail);
+ };
+ SparkMD52.hash = function(str, raw2) {
+ return SparkMD52.hashBinary(toUtf8(str), raw2);
+ };
+ SparkMD52.hashBinary = function(content2, raw2) {
+ var hash3 = md51(content2), ret = hex(hash3);
+ return raw2 ? hexToBinaryString(ret) : ret;
+ };
+ SparkMD52.ArrayBuffer = function() {
+ this.reset();
+ };
+ SparkMD52.ArrayBuffer.prototype.append = function(arr) {
+ var buff = concatenateArrayBuffers(this._buff.buffer, arr, true), length = buff.length, i3;
+ this._length += arr.byteLength;
+ for (i3 = 64; i3 <= length; i3 += 64) {
+ md5cycle(this._hash, md5blk_array(buff.subarray(i3 - 64, i3)));
+ }
+ this._buff = i3 - 64 < length ? new Uint8Array(buff.buffer.slice(i3 - 64)) : new Uint8Array(0);
+ return this;
+ };
+ SparkMD52.ArrayBuffer.prototype.end = function(raw2) {
+ var buff = this._buff, length = buff.length, tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], i3, ret;
+ for (i3 = 0; i3 < length; i3 += 1) {
+ tail[i3 >> 2] |= buff[i3] << (i3 % 4 << 3);
+ }
+ this._finish(tail, length);
+ ret = hex(this._hash);
+ if (raw2) {
+ ret = hexToBinaryString(ret);
+ }
+ this.reset();
+ return ret;
+ };
+ SparkMD52.ArrayBuffer.prototype.reset = function() {
+ this._buff = new Uint8Array(0);
+ this._length = 0;
+ this._hash = [1732584193, -271733879, -1732584194, 271733878];
+ return this;
+ };
+ SparkMD52.ArrayBuffer.prototype.getState = function() {
+ var state = SparkMD52.prototype.getState.call(this);
+ state.buff = arrayBuffer2Utf8Str(state.buff);
+ return state;
+ };
+ SparkMD52.ArrayBuffer.prototype.setState = function(state) {
+ state.buff = utf8Str2ArrayBuffer(state.buff, true);
+ return SparkMD52.prototype.setState.call(this, state);
+ };
+ SparkMD52.ArrayBuffer.prototype.destroy = SparkMD52.prototype.destroy;
+ SparkMD52.ArrayBuffer.prototype._finish = SparkMD52.prototype._finish;
+ SparkMD52.ArrayBuffer.hash = function(arr, raw2) {
+ var hash3 = md51_array(new Uint8Array(arr)), ret = hex(hash3);
+ return raw2 ? hexToBinaryString(ret) : ret;
+ };
+ return SparkMD52;
+ });
+ })(sparkMd5);
+ var SparkMD5 = sparkMd5.exports;
+ var fileSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice;
+ var FileChecksum = class {
+ static create(file, callback) {
+ const instance = new FileChecksum(file);
+ instance.create(callback);
+ }
+ constructor(file) {
+ this.file = file;
+ this.chunkSize = 2097152;
+ this.chunkCount = Math.ceil(this.file.size / this.chunkSize);
+ this.chunkIndex = 0;
+ }
+ create(callback) {
+ this.callback = callback;
+ this.md5Buffer = new SparkMD5.ArrayBuffer();
+ this.fileReader = new FileReader();
+ this.fileReader.addEventListener("load", (event) => this.fileReaderDidLoad(event));
+ this.fileReader.addEventListener("error", (event) => this.fileReaderDidError(event));
+ this.readNextChunk();
+ }
+ fileReaderDidLoad(event) {
+ this.md5Buffer.append(event.target.result);
+ if (!this.readNextChunk()) {
+ const binaryDigest = this.md5Buffer.end(true);
+ const base64digest = btoa(binaryDigest);
+ this.callback(null, base64digest);
+ }
+ }
+ fileReaderDidError(event) {
+ this.callback(`Error reading ${this.file.name}`);
+ }
+ readNextChunk() {
+ if (this.chunkIndex < this.chunkCount || this.chunkIndex == 0 && this.chunkCount == 0) {
+ const start5 = this.chunkIndex * this.chunkSize;
+ const end2 = Math.min(start5 + this.chunkSize, this.file.size);
+ const bytes = fileSlice.call(this.file, start5, end2);
+ this.fileReader.readAsArrayBuffer(bytes);
+ this.chunkIndex++;
+ return true;
} else {
- submitter = document.createElement("input");
- submitter.type = "submit";
- submitter.hidden = true;
- this.appendChild(submitter);
- submitter.click();
- this.removeChild(submitter);
+ return false;
}
- };
- function validateSubmitter(submitter, form) {
- submitter instanceof HTMLElement || raise(TypeError, "parameter 1 is not of type 'HTMLElement'");
- submitter.type == "submit" || raise(TypeError, "The specified element is not a submit button");
- submitter.form == form || raise(
- DOMException,
- "The specified element is not owned by this form element",
- "NotFoundError"
- );
}
- function raise(errorConstructor, message2, name) {
- throw new errorConstructor(
- "Failed to execute 'requestSubmit' on 'HTMLFormElement': " + message2 + ".",
- name
- );
+ };
+ function getMetaValue(name) {
+ const element = findElement(document.head, `meta[name="${name}"]`);
+ if (element) {
+ return element.getAttribute("content");
}
- })(HTMLFormElement.prototype);
+ }
+ function findElements(root, selector) {
+ if (typeof root == "string") {
+ selector = root;
+ root = document;
+ }
+ const elements = root.querySelectorAll(selector);
+ return toArray(elements);
+ }
+ function findElement(root, selector) {
+ if (typeof root == "string") {
+ selector = root;
+ root = document;
+ }
+ return root.querySelector(selector);
+ }
+ function dispatchEvent2(element, type, eventInit = {}) {
+ const { disabled } = element;
+ const { bubbles, cancelable, detail } = eventInit;
+ const event = document.createEvent("Event");
+ event.initEvent(type, bubbles || true, cancelable || true);
+ event.detail = detail || {};
+ try {
+ element.disabled = false;
+ element.dispatchEvent(event);
+ } finally {
+ element.disabled = disabled;
+ }
+ return event;
+ }
+ function toArray(value) {
+ if (Array.isArray(value)) {
+ return value;
+ } else if (Array.from) {
+ return Array.from(value);
+ } else {
+ return [].slice.call(value);
+ }
+ }
+ var BlobRecord = class {
+ constructor(file, checksum, url) {
+ this.file = file;
+ this.attributes = {
+ filename: file.name,
+ content_type: file.type || "application/octet-stream",
+ byte_size: file.size,
+ checksum
+ };
+ this.xhr = new XMLHttpRequest();
+ this.xhr.open("POST", url, true);
+ this.xhr.responseType = "json";
+ this.xhr.setRequestHeader("Content-Type", "application/json");
+ this.xhr.setRequestHeader("Accept", "application/json");
+ this.xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+ const csrfToken = getMetaValue("csrf-token");
+ if (csrfToken != void 0) {
+ this.xhr.setRequestHeader("X-CSRF-Token", csrfToken);
+ }
+ this.xhr.addEventListener("load", (event) => this.requestDidLoad(event));
+ this.xhr.addEventListener("error", (event) => this.requestDidError(event));
+ }
+ get status() {
+ return this.xhr.status;
+ }
+ get response() {
+ const { responseType, response } = this.xhr;
+ if (responseType == "json") {
+ return response;
+ } else {
+ return JSON.parse(response);
+ }
+ }
+ create(callback) {
+ this.callback = callback;
+ this.xhr.send(JSON.stringify({
+ blob: this.attributes
+ }));
+ }
+ requestDidLoad(event) {
+ if (this.status >= 200 && this.status < 300) {
+ const { response } = this;
+ const { direct_upload } = response;
+ delete response.direct_upload;
+ this.attributes = response;
+ this.directUploadData = direct_upload;
+ this.callback(null, this.toJSON());
+ } else {
+ this.requestDidError(event);
+ }
+ }
+ requestDidError(event) {
+ this.callback(`Error creating Blob for "${this.file.name}". Status: ${this.status}`);
+ }
+ toJSON() {
+ const result = {};
+ for (const key in this.attributes) {
+ result[key] = this.attributes[key];
+ }
+ return result;
+ }
+ };
+ var BlobUpload = class {
+ constructor(blob) {
+ this.blob = blob;
+ this.file = blob.file;
+ const { url, headers } = blob.directUploadData;
+ this.xhr = new XMLHttpRequest();
+ this.xhr.open("PUT", url, true);
+ this.xhr.responseType = "text";
+ for (const key in headers) {
+ this.xhr.setRequestHeader(key, headers[key]);
+ }
+ this.xhr.addEventListener("load", (event) => this.requestDidLoad(event));
+ this.xhr.addEventListener("error", (event) => this.requestDidError(event));
+ }
+ create(callback) {
+ this.callback = callback;
+ this.xhr.send(this.file.slice());
+ }
+ requestDidLoad(event) {
+ const { status, response } = this.xhr;
+ if (status >= 200 && status < 300) {
+ this.callback(null, response);
+ } else {
+ this.requestDidError(event);
+ }
+ }
+ requestDidError(event) {
+ this.callback(`Error storing "${this.file.name}". Status: ${this.xhr.status}`);
+ }
+ };
+ var id = 0;
+ var DirectUpload = class {
+ constructor(file, url, delegate) {
+ this.id = ++id;
+ this.file = file;
+ this.url = url;
+ this.delegate = delegate;
+ }
+ create(callback) {
+ FileChecksum.create(this.file, (error2, checksum) => {
+ if (error2) {
+ callback(error2);
+ return;
+ }
+ const blob = new BlobRecord(this.file, checksum, this.url);
+ notify(this.delegate, "directUploadWillCreateBlobWithXHR", blob.xhr);
+ blob.create((error3) => {
+ if (error3) {
+ callback(error3);
+ } else {
+ const upload = new BlobUpload(blob);
+ notify(this.delegate, "directUploadWillStoreFileWithXHR", upload.xhr);
+ upload.create((error4) => {
+ if (error4) {
+ callback(error4);
+ } else {
+ callback(null, blob.toJSON());
+ }
+ });
+ }
+ });
+ });
+ }
+ };
+ function notify(object, methodName, ...messages) {
+ if (object && typeof object[methodName] == "function") {
+ return object[methodName](...messages);
+ }
+ }
+ var DirectUploadController = class {
+ constructor(input, file) {
+ this.input = input;
+ this.file = file;
+ this.directUpload = new DirectUpload(this.file, this.url, this);
+ this.dispatch("initialize");
+ }
+ start(callback) {
+ const hiddenInput = document.createElement("input");
+ hiddenInput.type = "hidden";
+ hiddenInput.name = this.input.name;
+ this.input.insertAdjacentElement("beforebegin", hiddenInput);
+ this.dispatch("start");
+ this.directUpload.create((error2, attributes) => {
+ if (error2) {
+ hiddenInput.parentNode.removeChild(hiddenInput);
+ this.dispatchError(error2);
+ } else {
+ hiddenInput.value = attributes.signed_id;
+ }
+ this.dispatch("end");
+ callback(error2);
+ });
+ }
+ uploadRequestDidProgress(event) {
+ const progress = event.loaded / event.total * 100;
+ if (progress) {
+ this.dispatch("progress", {
+ progress
+ });
+ }
+ }
+ get url() {
+ return this.input.getAttribute("data-direct-upload-url");
+ }
+ dispatch(name, detail = {}) {
+ detail.file = this.file;
+ detail.id = this.directUpload.id;
+ return dispatchEvent2(this.input, `direct-upload:${name}`, {
+ detail
+ });
+ }
+ dispatchError(error2) {
+ const event = this.dispatch("error", {
+ error: error2
+ });
+ if (!event.defaultPrevented) {
+ alert(error2);
+ }
+ }
+ directUploadWillCreateBlobWithXHR(xhr) {
+ this.dispatch("before-blob-request", {
+ xhr
+ });
+ }
+ directUploadWillStoreFileWithXHR(xhr) {
+ this.dispatch("before-storage-request", {
+ xhr
+ });
+ xhr.upload.addEventListener("progress", (event) => this.uploadRequestDidProgress(event));
+ }
+ };
+ var inputSelector = "input[type=file][data-direct-upload-url]:not([disabled])";
+ var DirectUploadsController = class {
+ constructor(form) {
+ this.form = form;
+ this.inputs = findElements(form, inputSelector).filter((input) => input.files.length);
+ }
+ start(callback) {
+ const controllers = this.createDirectUploadControllers();
+ const startNextController = () => {
+ const controller = controllers.shift();
+ if (controller) {
+ controller.start((error2) => {
+ if (error2) {
+ callback(error2);
+ this.dispatch("end");
+ } else {
+ startNextController();
+ }
+ });
+ } else {
+ callback();
+ this.dispatch("end");
+ }
+ };
+ this.dispatch("start");
+ startNextController();
+ }
+ createDirectUploadControllers() {
+ const controllers = [];
+ this.inputs.forEach((input) => {
+ toArray(input.files).forEach((file) => {
+ const controller = new DirectUploadController(input, file);
+ controllers.push(controller);
+ });
+ });
+ return controllers;
+ }
+ dispatch(name, detail = {}) {
+ return dispatchEvent2(this.form, `direct-uploads:${name}`, {
+ detail
+ });
+ }
+ };
+ var processingAttribute = "data-direct-uploads-processing";
+ var submitButtonsByForm = /* @__PURE__ */ new WeakMap();
+ var started = false;
+ function start2() {
+ if (!started) {
+ started = true;
+ document.addEventListener("click", didClick, true);
+ document.addEventListener("submit", didSubmitForm, true);
+ document.addEventListener("ajax:before", didSubmitRemoteElement);
+ }
+ }
+ function didClick(event) {
+ const { target } = event;
+ if ((target.tagName == "INPUT" || target.tagName == "BUTTON") && target.type == "submit" && target.form) {
+ submitButtonsByForm.set(target.form, target);
+ }
+ }
+ function didSubmitForm(event) {
+ handleFormSubmissionEvent(event);
+ }
+ function didSubmitRemoteElement(event) {
+ if (event.target.tagName == "FORM") {
+ handleFormSubmissionEvent(event);
+ }
+ }
+ function handleFormSubmissionEvent(event) {
+ const form = event.target;
+ if (form.hasAttribute(processingAttribute)) {
+ event.preventDefault();
+ return;
+ }
+ const controller = new DirectUploadsController(form);
+ const { inputs } = controller;
+ if (inputs.length) {
+ event.preventDefault();
+ form.setAttribute(processingAttribute, "");
+ inputs.forEach(disable);
+ controller.start((error2) => {
+ form.removeAttribute(processingAttribute);
+ if (error2) {
+ inputs.forEach(enable);
+ } else {
+ submitForm(form);
+ }
+ });
+ }
+ }
+ function submitForm(form) {
+ let button = submitButtonsByForm.get(form) || findElement(form, "input[type=submit], button[type=submit]");
+ if (button) {
+ const { disabled } = button;
+ button.disabled = false;
+ button.focus();
+ button.click();
+ button.disabled = disabled;
+ } else {
+ button = document.createElement("input");
+ button.type = "submit";
+ button.style.display = "none";
+ form.appendChild(button);
+ button.click();
+ form.removeChild(button);
+ }
+ submitButtonsByForm.delete(form);
+ }
+ function disable(input) {
+ input.disabled = true;
+ }
+ function enable(input) {
+ input.disabled = false;
+ }
+ function autostart() {
+ if (window.ActiveStorage) {
+ start2();
+ }
+ }
+ setTimeout(autostart, 1);
// ../../../node_modules/alpinejs/dist/module.esm.js
var flushPending = false;
var flushing = false;
var queue = [];
@@ -28937,15 +29005,10 @@
module_default.plugin(dimensions_default);
module_default.plugin(notification_default);
window.Alpine = module_default;
var alpine_default2 = module_default;
- // base/setup.js
- document.addEventListener("DOMContentLoaded", () => {
- alpine_default2.start();
- });
-
// ../../components/coco/base/button/button.js
var button_exports = {};
__export(button_exports, {
default: () => button_default
});
@@ -29584,10 +29647,18 @@
}
function formatHex(str) {
return `#${str.toUpperCase().replace("#", "")}`;
}
+ // helpers/turbo_events.js
+ function wasSuccessful(event) {
+ return getEventDetail(event).success;
+ }
+ function getEventDetail(obj) {
+ return obj instanceof CustomEvent ? obj.detail : obj;
+ }
+
// ../../components/coco/app/blocks/slide_editor/slide_editor.js
var slide_editor_default = CocoComponent("appSlideEditor", (data2) => {
const initialData = {
layout: data2.layout,
title: data2.title,
@@ -29638,46 +29709,58 @@
} else {
event.preventDefault();
}
},
async save() {
- if (this.saving)
- return;
this.clearErrors();
this.saving = true;
if (this.$refs.thumbnail) {
try {
await this._generateThumbnail();
} catch (error2) {
this.thumbnailFile = null;
message = error2.message || "Error generating slide thumbnail";
- this._handleSaveError(message, { error: error2 });
+ this.handleSaveError(message, { error: error2 });
return;
}
}
const form = this.$refs.form && this.$refs.form.querySelector("form");
if (form && form.dataset.submit !== "false") {
- form.requestSubmit();
+ const submitButton = form.querySelector("[type='submit']");
+ if (submitButton) {
+ submitButton.click();
+ } else {
+ this.handleSaveError("Slide form is missing a submit button");
+ }
} else {
this.submitSuccess();
}
},
- submitSuccess() {
+ submitEnd($event) {
+ this[wasSuccessful($event) ? "submitSuccess" : "submitError"]($event);
+ },
+ submitSuccess($event) {
this.history.clear();
this._fields.forEach((name) => this.saved[name] = this[name]);
this.saving = false;
console.info("Slide changes saved");
this.$dispatch("slide:save-end", { success: true });
},
submitError($event) {
- message = "Error saving slide";
- this._handleSaveError(message, { event: $event });
+ const message2 = "Error saving slide - form could not be submitted";
+ this.handleSaveError(message2, { event: $event });
},
directUploadError($event) {
$event.preventDefault();
- this._handleSaveError($event.detail.error, { event: $event });
+ const message2 = $event.detail.error || "Error uploading file to storage";
+ this.handleSaveError(message2, { event: $event });
},
+ handleSaveError(message2 = "Error saving slide", context = {}) {
+ this.errors.push({ message: message2, context });
+ this.saving = false;
+ this.$dispatch("slide:save-end", { success: false });
+ },
clearErrors() {
this.errors.length = 0;
},
syncFileInput(input, file) {
const dataTransfer = new DataTransfer();
@@ -29709,15 +29792,10 @@
console.info(
"Slide thumbnail generated",
`${this.thumbnailFile.size / 1e3}KiB`
);
},
- _handleSaveError(message2 = "Error saving slide", context = {}) {
- this.errors.push({ message: message2, context });
- this.saving = false;
- this.$dispatch("slide:save-end", { success: false });
- },
/* bindings */
slide: {
[":style"]() {
return {
backgroundColor: this.bgColor,
@@ -31951,12 +32029,12 @@
// app/components.js
var components_default3 = registerComponents(__default3);
// app.js
- document.addEventListener("alpine:initialized", () => {
- start();
- });
+ console.info("Initializing Coco JS", package_default.version);
+ start2();
+ alpine_default2.start();
})();
/*! Bundled license information:
lodash/lodash.js:
(**