ajax ile verileri cekmekte bir problem yok ama simple datatable sorun yasıyorum normal datatable degil ne yazıkı
bundle.js olan simpledatatable kodu ektedir ben bu kodda 10 saniyede bir calısan ajax kodumun tabloda guncelleme yapmasını istiyorum farklı yollar denedim ama hep soruncıktı
api response json/ajax ve get methodu kullanmkatadır yardımcı olacaklara simdiden tesekur ederim
function(t) {
if ("object" == typeof exports && "undefined" != typeof module) module.exports = t();
else if ("function" == typeof define && define.amd) define([], t);
else {
("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).simpleDatatables = t()
}
}((function() {
return function t(e, n, i) {
function r(l, s) {
if (!n[l]) {
if (!e[l]) {
var a = "function" == typeof require && require;
if (!s && a) return a(l, !0);
if (o) return o(l, !0);
var c = new Error("Cannot find module '" + l + "'");
throw c.code = "MODULE_NOT_FOUND", c
}
var u = n[l] = {
exports: {}
};
e[l][0].call(u.exports, (function(t) {
return r(e[l][1][t] || t)
}), u, u.exports, t, e, n, i)
}
return n[l].exports
}
for (var o = "function" == typeof require && require, l = 0; l < i.length; l++) r(i[l]);
return r
}({
1: [function(t, e, n) {
(function(t) {
(function() {
"use strict";
"undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : void 0 !== t || "undefined" != typeof self && self;
var e = {
exports: {}
}.exports = function() {
var t = 6e4,
e = 36e5,
n = "millisecond",
i = "second",
r = "minute",
o = "hour",
l = "day",
s = "week",
a = "month",
c = "quarter",
u = "year",
d = "date",
h = "Invalid Date",
p = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,
f = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,
g = {
name: "en",
weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_")
},
m = function(t, e, n) {
var i = String(t);
return !i || i.length >= e ? t : "" + Array(e + 1 - i.length).join(n) + t
},
v = {
s: m,
z: function(t) {
var e = -t.utcOffset(),
n = Math.abs(e),
i = Math.floor(n / 60),
r = n % 60;
return (e <= 0 ? "+" : "-") + m(i, 2, "0") + ":" + m(r, 2, "0")
},
m: function t(e, n) {
if (e.date() < n.date()) return -t(n, e);
var i = 12 * (n.year() - e.year()) + (n.month() - e.month()),
r = e.clone().add(i, a),
o = n - r < 0,
l = e.clone().add(i + (o ? -1 : 1), a);
return +(-(i + (n - r) / (o ? r - l : l - r)) || 0)
},
a: function(t) {
return t < 0 ? Math.ceil(t) || 0 : Math.floor(t)
},
p: function(t) {
return {
M: a,
y: u,
w: s,
d: l,
D: d,
h: o,
m: r,
s: i,
ms: n,
Q: c
} [t] || String(t || "").toLowerCase().replace(/s$/, "")
},
u: function(t) {
return void 0 === t
}
},
y = "en",
b = {};
b[y] = g;
var _ = function(t) {
return t instanceof S
},
w = function t(e, n, i) {
var r;
if (!e) return y;
if ("string" == typeof e) {
var o = e.toLowerCase();
b[o] && (r = o), n && (b[o] = n, r = o);
var l = e.split("-");
if (!r && l.length > 1) return t(l[0])
} else {
var s = e.name;
b[s] = e, r = s
}
return !i && r && (y = r), r || !i && y
},
x = function(t, e) {
if (_(t)) return t.clone();
var n = "object" == typeof e ? e : {};
return n.date = t, n.args = arguments, new S(n)
},
E = v;
E.l = w, E.i = _, E.w = function(t, e) {
return x(t, {
locale: e.$L,
utc: e.$u,
x: e.$x,
$offset: e.$offset
})
};
var S = function() {
function g(t) {
this.$L = w(t.locale, null, !0), this.parse(t)
}
var m = g.prototype;
return m.parse = function(t) {
this.$d = function(t) {
var e = t.date,
n = t.utc;
if (null === e) return new Date(NaN);
if (E.u(e)) return new Date;
if (e instanceof Date) return new Date(e);
if ("string" == typeof e && !/Z$/i.test(e)) {
var i = e.match(p);
if (i) {
var r = i[2] - 1 || 0,
o = (i[7] || "0").substring(0, 3);
return n ? new Date(Date.UTC(i[1], r, i[3] || 1, i[4] || 0, i[5] || 0, i[6] || 0, o)) : new Date(i[1], r, i[3] || 1, i[4] || 0, i[5] || 0, i[6] || 0, o)
}
}
return new Date(e)
}(t), this.$x = t.x || {}, this.init()
}, m.init = function() {
var t = this.$d;
this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds()
}, m.$utils = function() {
return E
}, m.isValid = function() {
return !(this.$d.toString() === h)
}, m.isSame = function(t, e) {
var n = x(t);
return this.startOf(e) <= n && n <= this.endOf(e)
}, m.isAfter = function(t, e) {
return x(t) < this.startOf(e)
}, m.isBefore = function(t, e) {
return this.endOf(e) < x(t)
}, m.$g = function(t, e, n) {
return E.u(t) ? this[e] : this.set(n, t)
}, m.unix = function() {
return Math.floor(this.valueOf() / 1e3)
}, m.valueOf = function() {
return this.$d.getTime()
}, m.startOf = function(t, e) {
var n = this,
c = !!E.u(e) || e,
h = E.p(t),
p = function(t, e) {
var i = E.w(n.$u ? Date.UTC(n.$y, e, t) : new Date(n.$y, e, t), n);
return c ? i : i.endOf(l)
},
f = function(t, e) {
return E.w(n.toDate()[t].apply(n.toDate("s"), (c ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e)), n)
},
g = this.$W,
m = this.$M,
v = this.$D,
y = "set" + (this.$u ? "UTC" : "");
switch (h) {
case u:
return c ? p(1, 0) : p(31, 11);
case a:
return c ? p(1, m) : p(0, m + 1);
case s:
var b = this.$locale().weekStart || 0,
_ = (g < b ? g + 7 : g) - b;
return p(c ? v - _ : v + (6 - _), m);
case l:
case d:
return f(y + "Hours", 0);
case o:
return f(y + "Minutes", 1);
case r:
return f(y + "Seconds", 2);
case i:
return f(y + "Milliseconds", 3);
default:
return this.clone()
}
}, m.endOf = function(t) {
return this.startOf(t, !1)
}, m.$set = function(t, e) {
var s, c = E.p(t),
h = "set" + (this.$u ? "UTC" : ""),
p = (s = {}, s[l] = h + "Date", s[d] = h + "Date", s[a] = h + "Month", s[u] = h + "FullYear", s[o] = h + "Hours", s[r] = h + "Minutes", s[i] = h + "Seconds", s[n] = h + "Milliseconds", s)[c],
f = c === l ? this.$D + (e - this.$W) : e;
if (c === a || c === u) {
var g = this.clone().set(d, 1);
g.$d[p](f), g.init(), this.$d = g.set(d, Math.min(this.$D, g.daysInMonth())).$d
} else p && this.$d[p](f);
return this.init(), this
}, m.set = function(t, e) {
return this.clone().$set(t, e)
}, m.get = function(t) {
return this[E.p(t)]()
}, m.add = function(n, c) {
var d, h = this;
n = Number(n);
var p = E.p(c),
f = function(t) {
var e = x(h);
return E.w(e.date(e.date() + Math.round(t * n)), h)
};
if (p === a) return this.set(a, this.$M + n);
if (p === u) return this.set(u, this.$y + n);
if (p === l) return f(1);
if (p === s) return f(7);
var g = (d = {}, d[r] = t, d[o] = e, d[i] = 1e3, d)[p] || 1,
m = this.$d.getTime() + n * g;
return E.w(m, this)
}, m.subtract = function(t, e) {
return this.add(-1 * t, e)
}, m.format = function(t) {
var e = this,
n = this.$locale();
if (!this.isValid()) return n.invalidDate || h;
var i = t || "YYYY-MM-DDTHH:mm:ssZ",
r = E.z(this),
o = this.$H,
l = this.$m,
s = this.$M,
a = n.weekdays,
c = n.months,
u = function(t, n, r, o) {
return t && (t[n] || t(e, i)) || r[n].slice(0, o)
},
d = function(t) {
return E.s(o % 12 || 12, t, "0")
},
p = n.meridiem || function(t, e, n) {
var i = t < 12 ? "AM" : "PM";
return n ? i.toLowerCase() : i
},
g = {
YY: String(this.$y).slice(-2),
YYYY: this.$y,
M: s + 1,
MM: E.s(s + 1, 2, "0"),
MMM: u(n.monthsShort, s, c, 3),
MMMM: u(c, s),
D: this.$D,
DD: E.s(this.$D, 2, "0"),
d: String(this.$W),
dd: u(n.weekdaysMin, this.$W, a, 2),
ddd: u(n.weekdaysShort, this.$W, a, 3),
dddd: a[this.$W],
H: String(o),
HH: E.s(o, 2, "0"),
h: d(1),
hh: d(2),
a: p(o, l, !0),
A: p(o, l, !1),
m: String(l),
mm: E.s(l, 2, "0"),
s: String(this.$s),
ss: E.s(this.$s, 2, "0"),
SSS: E.s(this.$ms, 3, "0"),
Z: r
};
return i.replace(f, (function(t, e) {
return e || g[t] || r.replace(":", "")
}))
}, m.utcOffset = function() {
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15)
}, m.diff = function(n, d, h) {
var p, f = E.p(d),
g = x(n),
m = (g.utcOffset() - this.utcOffset()) * t,
v = this - g,
y = E.m(this, g);
return y = (p = {}, p[u] = y / 12, p[a] = y, p[c] = y / 3, p[s] = (v - m) / 6048e5, p[l] = (v - m) / 864e5, p[o] = v / e, p[r] = v / t, p[i] = v / 1e3, p)[f] || v, h ? y : E.a(y)
}, m.daysInMonth = function() {
return this.endOf(a).$D
}, m.$locale = function() {
return b[this.$L]
}, m.locale = function(t, e) {
if (!t) return this.$L;
var n = this.clone(),
i = w(t, e, !0);
return i && (n.$L = i), n
}, m.clone = function() {
return E.w(this.$d, this)
}, m.toDate = function() {
return new Date(this.valueOf())
}, m.toJSON = function() {
return this.isValid() ? this.toISOString() : null
}, m.toISOString = function() {
return this.$d.toISOString()
}, m.toString = function() {
return this.$d.toUTCString()
}, g
}(),
C = S.prototype;
return x.prototype = C, [
["$ms", n],
["$s", i],
["$m", r],
["$H", o],
["$W", l],
["$M", a],
["$y", u],
["$D", d]
].forEach((function(t) {
C[t[1]] = function(e) {
return this.$g(e, t[0], t[1])
}
})), x.extend = function(t, e) {
return t.$i || (t(e, S, x), t.$i = !0), x
}, x.locale = w, x.isDayjs = _, x.unix = function(t) {
return x(1e3 * t)
}, x.en = b[y], x.Ls = b, x.p = {}, x
}(),
i = {
exports: {}
}.exports = function() {
var t = {
LTS: "h:mm:ss A",
LT: "h:mm A",
L: "MM/DD/YYYY",
LL: "MMMM D, YYYY",
LLL: "MMMM D, YYYY h:mm A",
LLLL: "dddd, MMMM D, YYYY h:mm A"
},
e = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,
n = /\d\d/,
i = /\d\d?/,
r = /\d*[^-_:/,()\s\d]+/,
o = {},
l = function(t) {
return (t = +t) + (t > 68 ? 1900 : 2e3)
},
s = function(t) {
return function(e) {
this[t] = +e
}
},
a = [/[+-]\d\d:?(\d\d)?|Z/, function(t) {
(this.zone || (this.zone = {})).offset = function(t) {
if (!t) return 0;
if ("Z" === t) return 0;
var e = t.match(/([+-]|\d\d)/g),
n = 60 * e[1] + (+e[2] || 0);
return 0 === n ? 0 : "+" === e[0] ? -n : n
}(t)
}],
c = function(t) {
var e = o[t];
return e && (e.indexOf ? e : e.s.concat(e.f))
},
u = function(t, e) {
var n, i = o.meridiem;
if (i) {
for (var r = 1; r <= 24; r += 1)
if (t.indexOf(i(r, 0, e)) > -1) {
n = r > 12;
break
}
} else n = t === (e ? "pm" : "PM");
return n
},
d = {
A: [r, function(t) {
this.afternoon = u(t, !1)
}],
a: [r, function(t) {
this.afternoon = u(t, !0)
}],
S: [/\d/, function(t) {
this.milliseconds = 100 * +t
}],
SS: [n, function(t) {
this.milliseconds = 10 * +t
}],
SSS: [/\d{3}/, function(t) {
this.milliseconds = +t
}],
s: [i, s("seconds")],
ss: [i, s("seconds")],
m: [i, s("minutes")],
mm: [i, s("minutes")],
H: [i, s("hours")],
h: [i, s("hours")],
HH: [i, s("hours")],
hh: [i, s("hours")],
D: [i, s("day")],
DD: [n, s("day")],
Do: [r, function(t) {
var e = o.ordinal,
n = t.match(/\d+/);
if (this.day = n[0], e)
for (var i = 1; i <= 31; i += 1) e(i).replace(/\[|\]/g, "") === t && (this.day = i)
}],
M: [i, s("month")],
MM: [n, s("month")],
MMM: [r, function(t) {
var e = c("months"),
n = (c("monthsShort") || e.map((function(t) {
return t.slice(0, 3)
}))).indexOf(t) + 1;
if (n < 1) throw new Error;
this.month = n % 12 || n
}],
MMMM: [r, function(t) {
var e = c("months").indexOf(t) + 1;
if (e < 1) throw new Error;
this.month = e % 12 || e
}],
Y: [/[+-]?\d+/, s("year")],
YY: [n, function(t) {
this.year = l(t)
}],
YYYY: [/\d{4}/, s("year")],
Z: a,
ZZ: a
};
function h(n) {
var i, r;
i = n, r = o && o.formats;
for (var l = (n = i.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(e, n, i) {
var o = i && i.toUpperCase();
return n || r[i] || t[i] || r[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(t, e, n) {
return e || n.slice(1)
}))
}))).match(e), s = l.length, a = 0; a < s; a += 1) {
var c = l[a],
u = d[c],
h = u && u[0],
p = u && u[1];
l[a] = p ? {
regex: h,
parser: p
} : c.replace(/^\[|\]$/g, "")
}
return function(t) {
for (var e = {}, n = 0, i = 0; n < s; n += 1) {
var r = l[n];
if ("string" == typeof r) i += r.length;
else {
var o = r.regex,
a = r.parser,
c = t.slice(i),
u = o.exec(c)[0];
a.call(e, u), t = t.replace(u, "")
}
}
return function(t) {
var e = t.afternoon;
if (void 0 !== e) {
var n = t.hours;
e ? n < 12 && (t.hours += 12) : 12 === n && (t.hours = 0), delete t.afternoon
}
}(e), e
}
}
return function(t, e, n) {
n.p.customParseFormat = !0, t && t.parseTwoDigitYear && (l = t.parseTwoDigitYear);
var i = e.prototype,
r = i.parse;
i.parse = function(t) {
var e = t.date,
i = t.utc,
l = t.args;
this.$u = i;
var s = l[1];
if ("string" == typeof s) {
var a = !0 === l[2],
c = !0 === l[3],
u = a || c,
d = l[2];
c && (d = l[2]), o = this.$locale(), !a && d && (o = n.Ls[d]), this.$d = function(t, e, n) {
try {
if (["x", "X"].indexOf(e) > -1) return new Date(("X" === e ? 1e3 : 1) * t);
var i = h(e)(t),
r = i.year,
o = i.month,
l = i.day,
s = i.hours,
a = i.minutes,
c = i.seconds,
u = i.milliseconds,
d = i.zone,
p = new Date,
f = l || (r || o ? 1 : p.getDate()),
g = r || p.getFullYear(),
m = 0;
r && !o || (m = o > 0 ? o - 1 : p.getMonth());
var v = s || 0,
y = a || 0,
b = c || 0,
_ = u || 0;
return d ? new Date(Date.UTC(g, m, f, v, y, b, _ + 60 * d.offset * 1e3)) : n ? new Date(Date.UTC(g, m, f, v, y, b, _)) : new Date(g, m, f, v, y, b, _)
} catch (t) {
return new Date("")
}
}(e, s, i), this.init(), d && !0 !== d && (this.$L = this.locale(d).$L), u && e != this.format(s) && (this.$d = new Date("")), o = {}
} else if (s instanceof Array)
for (var p = s.length, f = 1; f <= p; f += 1) {
l[1] = s[f - 1];
var g = n.apply(this, l);
if (g.isValid()) {
this.$d = g.$d, this.$L = g.$L, this.init();
break
}
f === p && (this.$d = new Date(""))
} else r.call(this, t)
}
}
}();
e.extend(i), n.parseDate = (t, n) => {
let i = !1;
if (n) switch (n) {
case "ISO_8601":
i = t;
break;
case "RFC_2822":
i = e(t.slice(5), "DD MMM YYYY HH:mm:ss ZZ").unix();
break;
case "MYSQL":
i = e(t, "YYYY-MM-DD hh:mm:ss").unix();
break;
case "UNIX":
i = e(t).unix();
break;
default:
i = e(t, n, !0).valueOf()
}
return i
}
}).call(this)
}).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
}, {}],
2: [function(t, e, n) {
"use strict";
Object.defineProperty(n, "__esModule", {
value: !0
});
const i = t => "[object Object]" === Object.prototype.toString.call(t),
r = (t, e) => {
const n = document.createElement(t);
if (e && "object" == typeof e)
for (const t in e) "html" === t ? n.innerHTML = e[t] : n.setAttribute(t, e[t]);
return n
},
o = t => {
t instanceof NodeList ? t.forEach(t => o(t)) : t.innerHTML = ""
},
l = (t, e, n) => r("li", {
class: t,
html: `<a href="#" data-page="${e}">${n}</a>`
}),
s = (t, e) => {
let n, i;
1 === e ? (n = 0, i = t.length) : -1 === e && (n = t.length - 1, i = -1);
for (let r = !0; r;) {
r = !1;
for (let o = n; o != i; o += e)
if (t[o + e] && t[o].value > t[o + e].value) {
const n = t[o],
i = t[o + e],
l = n;
t[o] = i, t[o + e] = l, r = !0
}
}
return t
};
class a {
constructor(t, e) {
return this.dt = t, this.rows = e, this
}
build(t) {
const e = r("tr");
let n = this.dt.headings;
return n.length || (n = t.map(() => "")), n.forEach((n, i) => {
const o = r("td");
t[i] && t[i].length || (t[i] = ""), o.innerHTML = t[i], o.data = t[i], e.appendChild(o)
}), e
}
render(t) {
return t
}
add(t) {
if (Array.isArray(t)) {
const e = this.dt;
Array.isArray(t[0]) ? t.forEach(t => {
e.data.push(this.build(t))
}) : e.data.push(this.build(t)), e.data.length && (e.hasRows = !0), this.update(), e.columns().rebuild()
}
}
remove(t) {
const e = this.dt;
Array.isArray(t) ? (t.sort((t, e) => e - t), t.forEach(t => {
e.data.splice(t, 1)
})) : "all" == t ? e.data = [] : e.data.splice(t, 1), e.data.length || (e.hasRows = !1), this.update(), e.columns().rebuild()
}
update() {
this.dt.data.forEach((t, e) => {
t.dataIndex = e
})
}
findRowIndex(t, e) {
return this.dt.data.findIndex(n => n.children[t].innerText.toLowerCase().includes(String(e).toLowerCase()))
}
findRow(t, e) {
const n = this.findRowIndex(t, e);
if (n < 0) return {
index: -1,
row: null,
cols: []
};
const i = this.dt.data[n];
return {
index: n,
row: i,
cols: [...i.cells].map(t => t.innerHTML)
}
}
updateRow(t, e) {
const n = this.build(e);
this.dt.data.splice(t, 1, n), this.update(), this.dt.columns().rebuild()
}
}
class c {
constructor(t) {
return this.dt = t, this
}
swap(t) {
if (t.length && 2 === t.length) {
const e = [];
this.dt.headings.forEach((t, n) => {
e.push(n)
});
const n = t[0],
i = t[1],
r = e[i];
e[i] = e[n], e[n] = r, this.order(e)
}
}
order(t) {
let e, n, i, r, o, l, s;
const a = [
[],
[],
[],
[]
],
c = this.dt;
t.forEach((t, i) => {
o = c.headings[t], l = "false" !== o.getAttribute("data-sortable"), e = o.cloneNode(!0), e.originalCellIndex = i, e.sortable = l, a[0].push(e), c.hiddenColumns.includes(t) || (n = o.cloneNode(!0), n.originalCellIndex = i, n.sortable = l, a[1].push(n))
}), c.data.forEach((e, n) => {
i = e.cloneNode(!1), r = e.cloneNode(!1), i.dataIndex = r.dataIndex = n, null !== e.searchIndex && void 0 !== e.searchIndex && (i.searchIndex = r.searchIndex = e.searchIndex), t.forEach(t => {
s = e.cells[t].cloneNode(!0), s.data = e.cells[t].data, i.appendChild(s), c.hiddenColumns.includes(t) || (s = e.cells[t].cloneNode(!0), s.data = e.cells[t].data, r.appendChild(s))
}), a[2].push(i), a[3].push(r)
}), c.headings = a[0], c.activeHeadings = a[1], c.data = a[2], c.activeRows = a[3], c.update()
}
hide(t) {
if (t.length) {
const e = this.dt;
t.forEach(t => {
e.hiddenColumns.includes(t) || e.hiddenColumns.push(t)
}), this.rebuild()
}
}
show(t) {
if (t.length) {
let e;
const n = this.dt;
t.forEach(t => {
e = n.hiddenColumns.indexOf(t), e > -1 && n.hiddenColumns.splice(e, 1)
}), this.rebuild()
}
}
visible(t) {
let e;
const n = this.dt;
return t = t || n.headings.map(t => t.originalCellIndex), isNaN(t) ? Array.isArray(t) && (e = [], t.forEach(t => {
e.push(!n.hiddenColumns.includes(t))
})) : e = !n.hiddenColumns.includes(t), e
}
add(t) {
let e;
const n = document.createElement("th");
if (!this.dt.headings.length) return this.dt.insert({
headings: [t.heading],
data: t.data.map(t => [t])
}), void this.rebuild();
this.dt.hiddenHeader ? n.innerHTML = "" : t.heading.nodeName ? n.appendChild(t.heading) : n.innerHTML = t.heading, this.dt.headings.push(n), this.dt.data.forEach((n, i) => {
t.data[i] && (e = document.createElement("td"), t.data[i].nodeName ? e.appendChild(t.data[i]) : e.innerHTML = t.data[i], e.data = e.innerHTML, t.render && (e.innerHTML = t.render.call(this, e.data, e, n)), n.appendChild(e))
}), t.type && n.setAttribute("data-type", t.type), t.format && n.setAttribute("data-format", t.format), t.hasOwnProperty("sortable") && (n.sortable = t.sortable, n.setAttribute("data-sortable", !0 === t.sortable ? "true" : "false")), this.rebuild(), this.dt.renderHeader()
}
remove(t) {
Array.isArray(t) ? (t.sort((t, e) => e - t), t.forEach(t => this.remove(t))) : (this.dt.headings.splice(t, 1), this.dt.data.forEach(e => {
e.removeChild(e.cells[t])
})), this.rebuild()
}
filter(t, e, n, i) {
const r = this.dt;
if (r.filterState || (r.filterState = {
originalData: r.data
}), !r.filterState[t]) {
const e = [...i, () => !0];
r.filterState[t] = function() {
let t = 0;
return () => e[t++ % e.length]
}()
}
const o = r.filterState[t](),
l = Array.from(r.filterState.originalData).filter(e => {
const n = e.cells[t],
i = n.hasAttribute("data-content") ? n.getAttribute("data-content") : n.innerText;
return "function" == typeof o ? o(i) : i === o
});
r.data = l, r.data.length ? (this.rebuild(), r.update()) : (r.clear(), r.hasRows = !1, r.setMessage(r.options.labels.noRows)), n || r.emit("datatable.sort", t, e)
}
sort(e, n, i) {
const r = this.dt;
if (r.hasHeadings && (e < 0 || e > r.headings.length)) return !1;
const o = r.options.filters && r.options.filters[r.headings[e].textContent];
if (o && 0 !== o.length) return void this.filter(e, n, i, o);
r.sorting = !0, i || r.emit("datatable.sorting", e, n);
let l = r.data;
const a = [],
c = [];
let u = 0,
d = 0;
const h = r.headings[e],
p = [];
if ("date" === h.getAttribute("data-type")) {
let e = !1;
h.hasAttribute("data-format") && (e = h.getAttribute("data-format")), p.push(Promise.resolve().then((function() {
return t("./date-7061ceee.js")
})).then(({
parseDate: t
}) => n => t(n, e)))
}
Promise.all(p).then(t => {
const o = t[0];
let p, f;
Array.from(l).forEach(t => {
const n = t.cells[e],
i = n.hasAttribute("data-content") ? n.getAttribute("data-content") : n.innerText;
let r;
r = o ? o(i) : "string" == typeof i ? i.replace(/(\$|,|\s|%)/g, "") : i, parseFloat(r) == r ? c[d++] = {
value: Number(r),
row: t
} : a[u++] = {
value: "string" == typeof i ? i.toLowerCase() : i,
row: t
}
}), n || (n = h.classList.contains("asc") ? "desc" : "asc"), "desc" == n ? (p = s(a, -1), f = s(c, -1), h.classList.remove("asc"), h.classList.add("desc")) : (p = s(c, 1), f = s(a, 1), h.classList.remove("desc"), h.classList.add("asc")), r.lastTh && h != r.lastTh && (r.lastTh.classList.remove("desc"), r.lastTh.classList.remove("asc")), r.lastTh = h, l = p.concat(f), r.data = [];
const g = [];
l.forEach((t, e) => {
r.data.push(t.row), null !== t.row.searchIndex && void 0 !== t.row.searchIndex && g.push(e)
}), r.searchData = g, this.rebuild(), r.update(), i || r.emit("datatable.sort", e, n)
})
}
rebuild() {
let t, e, n, i;
const r = this.dt,
o = [];
r.activeRows = [], r.activeHeadings = [], r.headings.forEach((t, e) => {
t.originalCellIndex = e, t.sortable = "false" !== t.getAttribute("data-sortable"), r.hiddenColumns.includes(e) || r.activeHeadings.push(t)
}), r.data.forEach((l, s) => {
t = l.cloneNode(!1), e = l.cloneNode(!1), t.dataIndex = e.dataIndex = s, null !== l.searchIndex && void 0 !== l.searchIndex && (t.searchIndex = e.searchIndex = l.searchIndex), Array.from(l.cells).forEach(o => {
n = o.cloneNode(!0), n.data = o.data, t.appendChild(n), r.hiddenColumns.includes(n.cellIndex) || (i = n.cloneNode(!0), i.data = n.data, e.appendChild(i))
}), o.push(t), r.activeRows.push(e)
}), r.data = o, r.update()
}
}
const u = function(t) {
let e = !1,
n = !1;
if ((t = t || this.options.data).headings) {
e = r("thead");
const n = r("tr");
t.headings.forEach(t => {
const e = r("th", {
html: t
});
n.appendChild(e)
}), e.appendChild(n)
}
t.data && t.data.length && (n = r("tbody"), t.data.forEach(e => {
if (t.headings && t.headings.length !== e.length) throw new Error("The number of rows do not match the number of headings.");
const i = r("tr");
e.forEach(t => {
const e = r("td", {
html: t
});
i.appendChild(e)
}), n.appendChild(i)
})), e && (null !== this.dom.tHead && this.dom.removeChild(this.dom.tHead), this.dom.appendChild(e)), n && (this.dom.tBodies.length && this.dom.removeChild(this.dom.tBodies[0]), this.dom.appendChild(n))
},
d = {
sortable: !0,
searchable: !0,
paging: !0,
perPage: 10,
perPageSelect: [5, 10, 15, 20, 25],
nextPrev: !0,
firstLast: !1,
prevText: "‹",
nextText: "›",
firstText: "«",
lastText: "»",
ellipsisText: "…",
ascText: "▴",
descText: "▾",
truncatePager: !0,
pagerDelta: 2,
scrollY: "",
fixedColumns: !0,
fixedHeight: !1,
header: !0,
hiddenHeader: !1,
footer: !1,
labels: {
placeholder: "Arama...",
perPage: "{select} kayıt göster",
noRows: "Trafik Kaynagı Bulunamamaktadır",
noResults: "Böyle bir Trafik Kaynagı Bulunamamaktadır",
info: ""
},
layout: {
top: "{select}{search}",
bottom: "{info}{pager}"
}
};
class h {
constructor(t, e = {}) {
const n = "string" == typeof t ? document.querySelector(t) : t;
if (this.options = {
...d,
...e,
layout: {
...d.layout,
...e.layout
},
labels: {
...d.labels,
...e.labels
}
}, this.initialized = !1, this.initialLayout = n.innerHTML, this.initialSortable = this.options.sortable, this.options.header || (this.options.sortable = !1), null === n.tHead && (!this.options.data || this.options.data && !this.options.data.headings) && (this.options.sortable = !1), n.tBodies.length && !n.tBodies[0].rows.length && this.options.data && !this.options.data.data) throw new Error("You seem to be using the data option, but you've not defined any rows.");
this.dom = n, this.table = this.dom, this.listeners = {
onResize: t => this.onResize(t)
}, this.init()
}
static extend(t, e) {
"function" == typeof e ? h.prototype[t] = e : h[t] = e
}
init(t) {
if (this.initialized || this.dom.classList.contains("dataTable-table")) return !1;
Object.assign(this.options, t || {}), this.currentPage = 1, this.onFirstPage = !0, this.hiddenColumns = [], this.columnRenderers = [], this.selectedColumns = [], this.render(), setTimeout(() => {
this.emit("datatable.init"), this.initialized = !0, this.options.plugins && Object.entries(this.options.plugins).forEach(([t, e]) => {
this[t] && "function" == typeof this[t] && (this[t] = this[t](e, {
createElement: r
}), e.enabled && this[t].init && "function" == typeof this[t].init && this[t].init())
})
}, 10)
}
render(t) {
if (t) {
switch (t) {
case "page":
this.renderPage();
break;
case "pager":
this.renderPager();
break;
case "header":
this.renderHeader()
}
return !1
}
const e = this.options;
let n = "";
if (e.data && u.call(this), this.body = this.dom.tBodies[0], this.head = this.dom.tHead, this.foot = this.dom.tFoot, this.body || (this.body = r("tbody"), this.dom.appendChild(this.body)), this.hasRows = this.body.rows.length > 0, !this.head) {
const t = r("thead"),
n = r("tr");
this.hasRows && (Array.from(this.body.rows[0].cells).forEach(() => {
n.appendChild(r("th"))
}), t.appendChild(n)), this.head = t, this.dom.insertBefore(this.head, this.body), this.hiddenHeader = e.hiddenHeader
}
if (this.headings = [], this.hasHeadings = this.head.rows.length > 0, this.hasHeadings && (this.header = this.head.rows[0], this.headings = [].slice.call(this.header.cells)), e.header || this.head && this.dom.removeChild(this.dom.tHead), e.footer ? this.head && !this.foot && (this.foot = r("tfoot", {
html: this.head.innerHTML
}), this.dom.appendChild(this.foot)) : this.foot && this.dom.removeChild(this.dom.tFoot), this.wrapper = r("div", {
class: "dataTable-wrapper dataTable-loading"
}), n += "<div class='dataTable-top'>", n += e.layout.top, n += "</div>", e.scrollY.length ? n += `<div class='dataTable-container' style='height: ${e.scrollY}; overflow-Y: auto;'></div>` : n += "<div class='dataTable-container'></div>", n += "<div class='dataTable-bottom'>", n += e.layout.bottom, n += "</div>", n = n.replace("{info}", e.paging ? "<div class='dataTable-info'></div>" : ""), e.paging && e.perPageSelect) {
let t = "<div class='dataTable-dropdown'><label>";
t += e.labels.perPage, t += "</label></div>";
const i = r("select", {
class: "dataTable-selector"
});
e.perPageSelect.forEach(t => {
const n = t === e.perPage,
r = new Option(t, t, n, n);
i.add(r)
}), t = t.replace("{select}", i.outerHTML), n = n.replace("{select}", t)
} else n = n.replace("{select}", "");
if (e.searchable) {
const t = `<div class='dataTable-search'><input class='dataTable-input' placeholder='${e.labels.placeholder}' type='text'></div>`;
n = n.replace("{search}", t)
} else n = n.replace("{search}", "");
this.hasHeadings && this.render("header"), this.dom.classList.add("dataTable-table");
const i = r("nav", {
class: "dataTable-pagination"
}),
o = r("ul", {
class: "dataTable-pagination-list"
});
i.appendChild(o), n = n.replace(/\{pager\}/g, i.outerHTML), this.wrapper.innerHTML = n, this.container = this.wrapper.querySelector(".dataTable-container"), this.pagers = this.wrapper.querySelectorAll(".dataTable-pagination-list"), this.label = this.wrapper.querySelector(".dataTable-info"), this.dom.parentNode.replaceChild(this.wrapper, this.dom), this.container.appendChild(this.dom), this.rect = this.dom.getBoundingClientRect(), this.data = Array.from(this.body.rows), this.activeRows = this.data.slice(), this.activeHeadings = this.headings.slice(), this.update(), this.setColumns(), this.fixHeight(), this.fixColumns(), e.header || this.wrapper.classList.add("no-header"), e.footer || this.wrapper.classList.add("no-footer"), e.sortable && this.wrapper.classList.add("sortable"), e.searchable && this.wrapper.classList.add("searchable"), e.fixedHeight && this.wrapper.classList.add("fixed-height"), e.fixedColumns && this.wrapper.classList.add("fixed-columns"), this.bindEvents()
}
renderPage() {
if (this.hasHeadings && (o(this.header), this.activeHeadings.forEach(t => this.header.appendChild(t))), this.hasRows && this.totalPages) {
this.currentPage > this.totalPages && (this.currentPage = 1);
const t = this.currentPage - 1,
e = document.createDocumentFragment();
this.pages[t].forEach(t => e.appendChild(this.rows().render(t))), this.clear(e), this.onFirstPage = 1 === this.currentPage, this.onLastPage = this.currentPage === this.lastPage
} else this.setMessage(this.options.labels.noRows);
let t, e = 0,
n = 0,
i = 0;
if (this.totalPages && (e = this.currentPage - 1, n = e * this.options.perPage, i = n + this.pages[e].length, n += 1, t = this.searching ? this.searchData.length : this.data.length), this.label && this.options.labels.info.length) {
const e = this.options.labels.info.replace("{start}", n).replace("{end}", i).replace("{page}", this.currentPage).replace("{pages}", this.totalPages).replace("{rows}", t);
this.label.innerHTML = t ? e : ""
}
1 == this.currentPage && this.fixHeight()
}
renderPager() {
if (o(this.pagers), this.totalPages > 1) {
const t = "pager",
e = document.createDocumentFragment(),
n = this.onFirstPage ? 1 : this.currentPage - 1,
i = this.onLastPage ? this.totalPages : this.currentPage + 1;
this.options.firstLast && e.appendChild(l(t, 1, this.options.firstText)), this.options.nextPrev && !this.onFirstPage && e.appendChild(l(t, n, this.options.prevText));
let o = this.links;
this.options.truncatePager && (o = ((t, e, n, i, o) => {
let l;
const s = 2 * (i = i || 2);
let a = e - i,
c = e + i;
const u = [],
d = [];
e < 4 - i + s ? c = 3 + s : e > n - (3 - i + s) && (a = n - (2 + s));
for (let e = 1; e <= n; e++)
if (1 == e || e == n || e >= a && e <= c) {
const n = t[e - 1];
n.classList.remove("active"), u.push(n)
} return u.forEach(e => {
const n = e.children[0].getAttribute("data-page");
if (l) {
const e = l.children[0].getAttribute("data-page");
if (n - e == 2) d.push(t[e]);
else if (n - e != 1) {
const t = r("li", {
class: "ellipsis",
html: `<a href="#">${o}</a>`
});
d.push(t)
}
}
d.push(e), l = e
}), d
})(this.links, this.currentPage, this.pages.length, this.options.pagerDelta, this.options.ellipsisText)), this.links[this.currentPage - 1].classList.add("active"), o.forEach(t => {
t.classList.remove("active"), e.appendChild(t)
}), this.links[this.currentPage - 1].classList.add("active"), this.options.nextPrev && !this.onLastPage && e.appendChild(l(t, i, this.options.nextText)), this.options.firstLast && e.appendChild(l(t, this.totalPages, this.options.lastText)), this.pagers.forEach(t => {
t.appendChild(e.cloneNode(!0))
})
}
}
renderHeader() {
this.labels = [], this.headings && this.headings.length && this.headings.forEach((t, e) => {
if (this.labels[e] = t.textContent, t.firstElementChild && t.firstElementChild.classList.contains("dataTable-sorter") && (t.innerHTML = t.firstElementChild.innerHTML), t.sortable = "false" !== t.getAttribute("data-sortable"), t.originalCellIndex = e, this.options.sortable && t.sortable) {
const e = r("a", {
href: "#",
class: "dataTable-sorter",
html: t.innerHTML
});
t.innerHTML = "", t.setAttribute("data-sortable", ""), t.appendChild(e)
}
}), this.fixColumns()
}
bindEvents() {
const t = this.options;
if (t.perPageSelect) {
const e = this.wrapper.querySelector(".dataTable-selector");
e && e.addEventListener("change", () => {
t.perPage = parseInt(e.value, 10), this.update(), this.fixHeight(), this.emit("datatable.perpage", t.perPage)
}, !1)
}
t.searchable && (this.input = this.wrapper.querySelector(".dataTable-input"), this.input && this.input.addEventListener("keyup", () => this.search(this.input.value), !1)), this.wrapper.addEventListener("click", e => {
const n = e.target.closest("a");
n && "a" === n.nodeName.toLowerCase() && (n.hasAttribute("data-page") ? (this.page(n.getAttribute("data-page")), e.preventDefault()) : t.sortable && n.classList.contains("dataTable-sorter") && "false" != n.parentNode.getAttribute("data-sortable") && (this.columns().sort(this.headings.indexOf(n.parentNode)), e.preventDefault()))
}, !1), window.addEventListener("resize", this.listeners.onResize)
}
onResize() {
this.rect = this.container.getBoundingClientRect(), this.rect.width && this.fixColumns()
}
setColumns(t) {
t || this.data.forEach(t => {
Array.from(t.cells).forEach(t => {
t.data = t.innerHTML
})
}), this.options.columns && this.headings.length && this.options.columns.forEach(t => {
Array.isArray(t.select) || (t.select = [t.select]), t.hasOwnProperty("render") && "function" == typeof t.render && (this.selectedColumns = this.selectedColumns.concat(t.select), this.columnRenderers.push({
columns: t.select,
renderer: t.render
})), t.select.forEach(e => {
const n = this.headings[e];
n && (t.type && n.setAttribute("data-type", t.type), t.format && n.setAttribute("data-format", t.format), t.hasOwnProperty("sortable") && n.setAttribute("data-sortable", t.sortable), t.hasOwnProperty("hidden") && !1 !== t.hidden && this.columns().hide([e]), t.hasOwnProperty("sort") && 1 === t.select.length && this.columns().sort(t.select[0], t.sort, !0))
})
}), this.hasRows && (this.data.forEach((t, e) => {
t.dataIndex = e, Array.from(t.cells).forEach(t => {
t.data = t.innerHTML
})
}), this.selectedColumns.length && this.data.forEach(t => {
Array.from(t.cells).forEach((e, n) => {
this.selectedColumns.includes(n) && this.columnRenderers.forEach(i => {
i.columns.includes(n) && (e.innerHTML = i.renderer.call(this, e.data, e, t))
})
})
}), this.columns().rebuild()), this.render("header")
}
destroy() {
this.dom.innerHTML = this.initialLayout, this.dom.classList.remove("dataTable-table"), this.wrapper.parentNode.replaceChild(this.dom, this.wrapper), this.initialized = !1, window.removeEventListener("resize", this.listeners.onResize)
}
update() {
this.wrapper.classList.remove("dataTable-empty"), this.paginate(this), this.render("page"), this.links = [];
let t = this.pages.length;
for (; t--;) {
const e = t + 1;
this.links[t] = l(0 === t ? "active" : "", e, e)
}
this.sorting = !1, this.render("pager"), this.rows().update(), this.emit("datatable.update")
}
paginate() {
const t = this.options.perPage;
let e = this.activeRows;
return this.searching && (e = [], this.searchData.forEach(t => e.push(this.activeRows[t]))), this.options.paging ? this.pages = e.map((n, i) => i % t == 0 ? e.slice(i, i + t) : null).filter(t => t) : this.pages = [e], this.totalPages = this.lastPage = this.pages.length, this.totalPages
}
fixColumns() {
if ((this.options.scrollY.length || this.options.fixedColumns) && this.activeHeadings && this.activeHeadings.length) {
let t, e = !1;
if (this.columnWidths = [], this.dom.tHead) {
this.options.scrollY.length && (e = r("thead"), e.appendChild(r("tr")), e.style.height = "0px", this.headerTable && (this.dom.tHead = this.headerTable.tHead)), this.activeHeadings.forEach(t => {
t.style.width = ""
});
const t = this.activeHeadings.reduce((t, e) => t + e.offsetWidth, 0);
if (this.activeHeadings.forEach((n, i) => {
const o = n.offsetWidth,
l = o / t * 100;
if (n.style.width = l + "%", this.columnWidths[i] = o, this.options.scrollY.length) {
const t = r("th");
e.firstElementChild.appendChild(t), t.style.width = l + "%", t.style.paddingTop = "0", t.style.paddingBottom = "0", t.style.border = "0"
}
}), this.options.scrollY.length) {
const t = this.dom.parentElement;
if (!this.headerTable) {
this.headerTable = r("table", {
class: "dataTable-table"
});
const e = r("div", {
class: "dataTable-headercontainer"
});
e.appendChild(this.headerTable), t.parentElement.insertBefore(e, t)
}
const n = this.dom.tHead;
this.dom.replaceChild(e, n), this.headerTable.tHead = n, this.headerTable.parentElement.style.paddingRight = this.headerTable.clientWidth - this.dom.clientWidth + parseInt(this.headerTable.parentElement.style.paddingRight || "0", 10) + "px", t.scrollHeight > t.clientHeight && (t.style.overflowY = "scroll")
}
} else {
t = [], e = r("thead");
const n = r("tr");
Array.from(this.dom.tBodies[0].rows[0].cells).forEach(() => {
const e = r("th");
n.appendChild(e), t.push(e)
}), e.appendChild(n), this.dom.insertBefore(e, this.body);
const i = [];
t.forEach((t, e) => {
const n = t.offsetWidth,
r = n / this.rect.width * 100;
i.push(r), this.columnWidths[e] = n
}), this.data.forEach(t => {
Array.from(t.cells).forEach((t, e) => {
this.columns(t.cellIndex).visible() && (t.style.width = i[e] + "%")
})
}), this.dom.removeChild(e)
}
}
}
fixHeight() {
this.options.fixedHeight && (this.container.style.height = null, this.rect = this.container.getBoundingClientRect(), this.container.style.height = this.rect.height + "px")
}
search(t) {
return !!this.hasRows && (t = t.toLowerCase(), this.currentPage = 1, this.searching = !0, this.searchData = [], t.length ? (this.clear(), this.data.forEach((e, n) => {
const i = this.searchData.includes(e);
t.split(" ").reduce((t, n) => {
let i = !1,
r = null,
o = null;
for (let t = 0; t < e.cells.length; t++)
if (r = e.cells[t], o = r.hasAttribute("data-content") ? r.getAttribute("data-content") : r.textContent, o.toLowerCase().includes(n) && this.columns(r.cellIndex).visible()) {
i = !0;
break
} return t && i
}, !0) && !i ? (e.searchIndex = n, this.searchData.push(n)) : e.searchIndex = null
}), this.wrapper.classList.add("search-results"), this.searchData.length ? this.update() : (this.wrapper.classList.remove("search-results"), this.setMessage(this.options.labels.noResults)), void this.emit("datatable.search", t, this.searchData)) : (this.searching = !1, this.update(), this.emit("datatable.search", t, this.searchData), this.wrapper.classList.remove("search-results"), !1))
}
page(t) {
return t != this.currentPage && (isNaN(t) || (this.currentPage = parseInt(t, 10)), !(t > this.pages.length || t < 0) && (this.render("page"), this.render("pager"), void this.emit("datatable.page", t)))
}
sortColumn(t, e) {
this.columns().sort(t, e)
}
insert(t) {
let e = [];
if (i(t)) {
if (t.headings && !this.hasHeadings && !this.hasRows) {
const e = r("tr");
t.headings.forEach(t => {
const n = r("th", {
html: t
});
e.appendChild(n)
}), this.head.appendChild(e), this.header = e, this.headings = [].slice.call(e.cells), this.hasHeadings = !0, this.options.sortable = this.initialSortable, this.render("header"), this.activeHeadings = this.headings.slice()
}
t.data && Array.isArray(t.data) && (e = t.data)
} else Array.isArray(t) && t.forEach(t => {
const n = [];
Object.entries(t).forEach(([t, e]) => {
const i = this.labels.indexOf(t);
i > -1 && (n[i] = e)
}), e.push(n)
});
e.length && (this.rows().add(e), this.hasRows = !0), this.update(), this.setColumns(), this.fixColumns()
}
refresh() {
this.options.searchable && (this.input.value = "", this.searching = !1), this.currentPage = 1, this.onFirstPage = !0, this.update(), this.emit("datatable.refresh")
}
clear(t) {
this.body && o(this.body);
let e = this.body;
this.body || (e = this.dom), t && ("string" == typeof t && (document.createDocumentFragment().innerHTML = t), e.appendChild(t))
}
export (t) {
if (!this.hasHeadings && !this.hasRows) return !1;
const e = this.activeHeadings;
let n = [];
const r = [];
let o, l, s, a;
if (!i(t)) return !1;
const c = {
download: !0,
skipColumn: [],
lineDelimiter: "\n",
columnDelimiter: ",",
tableName: "myTable",
replacer: null,
space: 4,
...t
};
if (c.type) {
if ("txt" !== c.type && "csv" !== c.type || (n[0] = this.header), c.selection)
if (isNaN(c.selection)) {
if (Array.isArray(c.selection))
for (o = 0; o < c.selection.length; o++) n = n.concat(this.pages[c.selection[o] - 1])
} else n = n.concat(this.pages[c.selection - 1]);
else n = n.concat(this.activeRows);
if (n.length) {
if ("txt" === c.type || "csv" === c.type) {
for (s = "", o = 0; o < n.length; o++) {
for (l = 0; l < n[o].cells.length; l++)
if (!c.skipColumn.includes(e[l].originalCellIndex) && this.columns(e[l].originalCellIndex).visible()) {
let t = n[o].cells[l].textContent;
t = t.trim(), t = t.replace(/\s{2,}/g, " "), t = t.replace(/\n/g, " "), t = t.replace(/"/g, '""'), t = t.replace(/#/g, "%23"), t.includes(",") && (t = `"${t}"`), s += t + c.columnDelimiter
} s = s.trim().substring(0, s.length - 1), s += c.lineDelimiter
}
s = s.trim().substring(0, s.length - 1), c.download && (s = "data:text/csv;charset=utf-8," + s)
} else if ("sql" === c.type) {
for (s = `INSERT INTO \`${c.tableName}\` (`, o = 0; o < e.length; o++) !c.skipColumn.includes(e[o].originalCellIndex) && this.columns(e[o].originalCellIndex).visible() && (s += `\`${e[o].textContent}\`,`);
for (s = s.trim().substring(0, s.length - 1), s += ") VALUES ", o = 0; o < n.length; o++) {
for (s += "(", l = 0; l < n[o].cells.length; l++) !c.skipColumn.includes(e[l].originalCellIndex) && this.columns(e[l].originalCellIndex).visible() && (s += `"${n[o].cells[l].textContent}",`);
s = s.trim().substring(0, s.length - 1), s += "),"
}
s = s.trim().substring(0, s.length - 1), s += ";", c.download && (s = "data:application/sql;charset=utf-8," + s)
} else if ("json" === c.type) {
for (l = 0; l < n.length; l++)
for (r[l] = r[l] || {}, o = 0; o < e.length; o++) !c.skipColumn.includes(e[o].originalCellIndex) && this.columns(e[o].originalCellIndex).visible() && (r[l][e[o].textContent] = n[l].cells[o].textContent);
s = JSON.stringify(r, c.replacer, c.space), c.download && (s = "data:application/json;charset=utf-8," + s)
}
return c.download && (c.filename = c.filename || "datatable_export", c.filename += "." + c.type, s = encodeURI(s), a = document.createElement("a"), a.href = s, a.download = c.filename, document.body.appendChild(a), a.click(), document.body.removeChild(a)), s
}
}
return !1
}
import(t) {
let e = !1;
if (!i(t)) return !1;
const n = {
lineDelimiter: "\n",
columnDelimiter: ",",
removeDoubleQuotes: !1,
...t
};
if (n.data.length || i(n.data)) {
if ("csv" === n.type) {
e = {
data: []
};
const t = n.data.split(n.lineDelimiter);
t.length && (n.headings && (e.headings = t[0].split(n.columnDelimiter), n.removeDoubleQuotes && (e.headings = e.headings.map(t => t.trim().replace(/(^"|"$)/g, ""))), t.shift()), t.forEach((t, i) => {
e.data[i] = [];
const r = t.split(n.columnDelimiter);
r.length && r.forEach(t => {
n.removeDoubleQuotes && (t = t.trim().replace(/(^"|"$)/g, "")), e.data[i].push(t)
})
}))
} else if ("json" === n.type) {
const t = (t => {
let e = !1;
try {
e = JSON.parse(t)
} catch (t) {
return !1
}
return !(null === e || !Array.isArray(e) && !i(e)) && e
})(n.data);
t && (e = {
headings: [],
data: []
}, t.forEach((t, n) => {
e.data[n] = [], Object.entries(t).forEach(([t, i]) => {
e.headings.includes(t) || e.headings.push(t), e.data[n].push(i)
})
}))
}
i(n.data) && (e = n.data), e && this.insert(e)
}
return !1
}
print() {
const t = this.activeHeadings,
e = this.activeRows,
n = r("table"),
i = r("thead"),
o = r("tbody"),
l = r("tr");
t.forEach(t => {
l.appendChild(r("th", {
html: t.textContent
}))
}), i.appendChild(l), e.forEach(t => {
const e = r("tr");
Array.from(t.cells).forEach(t => {
e.appendChild(r("td", {
html: t.textContent
}))
}), o.appendChild(e)
}), n.appendChild(i), n.appendChild(o);
const s = window.open();
s.document.body.appendChild(n), s.print()
}
setMessage(t) {
let e = 1;
this.hasRows ? e = this.data[0].cells.length : this.activeHeadings.length && (e = this.activeHeadings.length), this.wrapper.classList.add("dataTable-empty"), this.label && (this.label.innerHTML = ""), this.totalPages = 0, this.render("pager"), this.clear(r("tr", {
html: `<td class="dataTables-empty" colspan="${e}">${t}</td>`
}))
}
columns(t) {
return new c(this, t)
}
rows(t) {
return new a(this, t)
}
on(t, e) {
this.events = this.events || {}, this.events[t] = this.events[t] || [], this.events[t].push(e)
}
off(t, e) {
this.events = this.events || {}, t in this.events != 0 && this.events[t].splice(this.events[t].indexOf(e), 1)
}
emit(t) {
if (this.events = this.events || {}, t in this.events != 0)
for (let e = 0; e < this.events[t].length; e++) this.events[t][e].apply(this, Array.prototype.slice.call(arguments, 1))
}
}
n.DataTable = h
}, {
"./date-7061ceee.js": 1
}]
}, {}, [2])(2)
})),