@optona/otofill 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -1
- package/dist/otofill.js +457 -66
- package/dist/otofill.min.js +24 -4
- package/dist/types/io.d.ts +4 -0
- package/dist/types/panel/panel.d.ts +22 -1
- package/dist/types/panel/styles.d.ts +1 -1
- package/dist/types/types.d.ts +2 -0
- package/dist/types/util.d.ts +14 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,6 +11,14 @@ localStorage'ında (`optona-otofill` anahtarı) durur.
|
|
|
11
11
|
<script src="https://cdn.jsdelivr.net/npm/@optona/otofill@0.1.0/dist/otofill.min.js"></script>
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
+
Kodun CDN'de değişmediğinden emin olmak için sabit sürümü bütünlük (SRI) hash'iyle kullanabilirsiniz:
|
|
15
|
+
|
|
16
|
+
```html
|
|
17
|
+
<script src="https://cdn.jsdelivr.net/npm/@optona/otofill@0.1.0/dist/otofill.min.js"
|
|
18
|
+
integrity="sha384-totiI9b2CffK2EH+GtSEQ+xQ6THA0vDEiRqz2Drvc1/D0vQolI5th/ka47cLsNZ9"
|
|
19
|
+
crossorigin="anonymous"></script>
|
|
20
|
+
```
|
|
21
|
+
|
|
14
22
|
- `data-hotkey="ctrl+shift+f"`: kısayolu değiştirir (varsayılan `ctrl+q`).
|
|
15
23
|
- `data-auto="false"`: kendiliğinden başlamaz, `Otofill.init()` ile başlatılır.
|
|
16
24
|
- `data-open="true"`: yüklenince paneli açar (yer imi için).
|
|
@@ -40,7 +48,7 @@ yalnızca ana sürümde yapılır. Kayıtlı veriler kod güncellemesinden etkil
|
|
|
40
48
|
"version": 1,
|
|
41
49
|
"exportedAt": "2026-12-05T20:00:00Z",
|
|
42
50
|
"fields": [
|
|
43
|
-
{ "id": "…", "key": "musteri.tckn", "title": "TC Kimlik No", "pages": ["
|
|
51
|
+
{ "id": "…", "key": "musteri.tckn", "title": "TC Kimlik No", "pages": ["/musteri/*"],
|
|
44
52
|
"kind": "text", "match": { "label": "T.C. Kimlik No", "name": "tckn", "css": "#tcNo" } }
|
|
45
53
|
],
|
|
46
54
|
"datasets": [
|
|
@@ -49,6 +57,8 @@ yalnızca ana sürümde yapılır. Kayıtlı veriler kod güncellemesinden etkil
|
|
|
49
57
|
}
|
|
50
58
|
```
|
|
51
59
|
|
|
60
|
+
`pages` yalnızca yolu içerir (`/musteri/*`, hash router için `/*#/musteri*`); böylece aynı tanım yerel, test ve stage adreslerinde çalışır. Eski sürümlerin `http://sunucu/...` desenleri okunurken sunucu kısmı atılır. Bir veri seti tek başına dışa aktarılınca kullandığı alan tanımları da pakete eklenir (`fieldsPartial: true`); içe aktarırken yalnızca eksik tanımlar eklenir.
|
|
61
|
+
|
|
52
62
|
CSV: `;` ayırıcılı, UTF-8. Başlık satırında anahtarlar bulunur; `_label` (ya da `Etiket`) sütunu satır adıdır.
|
|
53
63
|
|
|
54
64
|
**Değer kuralları:**
|
package/dist/otofill.js
CHANGED
|
@@ -65,29 +65,49 @@ function globToRegExp(pattern) {
|
|
|
65
65
|
const esc = pattern.trim().replace(/[.+^${}()|[\]\\?]/g, "\\$&").replace(/\*/g, ".*");
|
|
66
66
|
return new RegExp("^" + esc + "$", "i");
|
|
67
67
|
}
|
|
68
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Desenden sunucu kısmını atar: "http://localhost:8080/#/login*" → "/#/login*".
|
|
70
|
+
* Böylece aynı tanım uygulamanın her adresinde (yerel, test, stage) çalışır.
|
|
71
|
+
*/
|
|
72
|
+
function stripOrigin(pattern) {
|
|
73
|
+
const p = pattern.trim();
|
|
74
|
+
const m = /^[a-z][a-z0-9+.-]*:\/\/[^/?#]*/i.exec(p);
|
|
75
|
+
if (!m) return p;
|
|
76
|
+
const rest = p.slice(m[0].length);
|
|
77
|
+
if (!rest || rest === "*") return "/*";
|
|
78
|
+
return rest.startsWith("/") ? rest : "/" + rest;
|
|
79
|
+
}
|
|
80
|
+
/** Adresin sunucudan sonraki kısmı: yol + sorgu + hash. */
|
|
81
|
+
function pathOf(url) {
|
|
82
|
+
const m = /^[a-z][a-z0-9+.-]*:\/\/[^/?#]*/i.exec(url);
|
|
83
|
+
const rest = m ? url.slice(m[0].length) : url;
|
|
84
|
+
return rest.startsWith("/") ? rest : "/" + rest;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Alanın sayfa desenlerinden biri adrese uyuyor mu? Boş liste her sayfaya uyar.
|
|
88
|
+
* "/" ile başlayan desen yalnızca yola bakar (sunucudan bağımsız); "*" ile başlayan tüm adrese bakar.
|
|
89
|
+
*/
|
|
69
90
|
function pageMatches(pages, url) {
|
|
70
|
-
const list = (pages ?? []).map((p) => p
|
|
91
|
+
const list = (pages ?? []).map((p) => stripOrigin(p)).filter(Boolean);
|
|
71
92
|
if (list.length === 0) return true;
|
|
93
|
+
const path = pathOf(url);
|
|
72
94
|
return list.some((p) => {
|
|
73
95
|
try {
|
|
74
|
-
return globToRegExp(p).test(url);
|
|
96
|
+
return globToRegExp(p).test(p.startsWith("/") ? path : url);
|
|
75
97
|
} catch {
|
|
76
98
|
return false;
|
|
77
99
|
}
|
|
78
100
|
});
|
|
79
101
|
}
|
|
80
|
-
/** Bulunulan sayfa için önerilen desen: sayısal parçalar * olur. */
|
|
102
|
+
/** Bulunulan sayfa için önerilen desen (sunucusuz): sayısal parçalar * olur. */
|
|
81
103
|
function suggestPagePattern(loc = location) {
|
|
82
104
|
const path = loc.pathname.replace(/\/\d+(?=\/|$)/g, "/*");
|
|
83
|
-
if (loc.hash.startsWith("#/")) {
|
|
84
|
-
|
|
85
|
-
return `${loc.origin}${path}*${hashPath}*`;
|
|
86
|
-
}
|
|
87
|
-
return `${loc.origin}${path}*`;
|
|
105
|
+
if (loc.hash.startsWith("#/")) return `${path}*${loc.hash.split("?")[0].replace(/\/\d+(?=\/|$)/g, "/*")}*`;
|
|
106
|
+
return `${path}*`;
|
|
88
107
|
}
|
|
89
|
-
|
|
90
|
-
|
|
108
|
+
/** Uygulamanın bütün sayfaları. */
|
|
109
|
+
function sitePattern() {
|
|
110
|
+
return "/*";
|
|
91
111
|
}
|
|
92
112
|
/** Framework'lerin her render'da ürettiği kararsız id'ler (el-id-1234-5, :r3:, v-12 ...). */
|
|
93
113
|
function isDynamicId(id) {
|
|
@@ -633,7 +653,10 @@ var selectDriver = {
|
|
|
633
653
|
fire(sel, "change");
|
|
634
654
|
return true;
|
|
635
655
|
},
|
|
636
|
-
read
|
|
656
|
+
read(el) {
|
|
657
|
+
const opt = el.selectedOptions[0];
|
|
658
|
+
return opt && opt.value !== "" ? opt.text.trim() : "";
|
|
659
|
+
}
|
|
637
660
|
};
|
|
638
661
|
var checkboxDriver = {
|
|
639
662
|
name: "native-checkbox",
|
|
@@ -838,7 +861,10 @@ function migrate(raw) {
|
|
|
838
861
|
const r = raw;
|
|
839
862
|
return {
|
|
840
863
|
v: 1,
|
|
841
|
-
fields: Array.isArray(r.fields) ? r.fields
|
|
864
|
+
fields: Array.isArray(r.fields) ? r.fields.map((f) => ({
|
|
865
|
+
...f,
|
|
866
|
+
pages: (f.pages ?? []).map(stripOrigin)
|
|
867
|
+
})) : [],
|
|
842
868
|
datasets: Array.isArray(r.datasets) ? r.datasets : [],
|
|
843
869
|
prefs: {
|
|
844
870
|
...base.prefs,
|
|
@@ -975,7 +1001,7 @@ async function fillRow(row, opts = {}) {
|
|
|
975
1001
|
const key = m.def.key;
|
|
976
1002
|
if (done.has(m.def.id)) continue;
|
|
977
1003
|
const value = row[key];
|
|
978
|
-
if (value === void 0) {
|
|
1004
|
+
if (value === void 0 || value === "") {
|
|
979
1005
|
noValue.add(key);
|
|
980
1006
|
continue;
|
|
981
1007
|
}
|
|
@@ -990,7 +1016,7 @@ async function fillRow(row, opts = {}) {
|
|
|
990
1016
|
opts.onFilled?.(m.fp.el);
|
|
991
1017
|
} else failed.add(key);
|
|
992
1018
|
}
|
|
993
|
-
const missingWithValue = pending.missing.filter((d) => row[d.key]
|
|
1019
|
+
const missingWithValue = pending.missing.filter((d) => !!row[d.key] && !done.has(d.id));
|
|
994
1020
|
if (failed.size === 0 && missingWithValue.length === 0) break;
|
|
995
1021
|
if (round === retries) break;
|
|
996
1022
|
await sleep(delay);
|
|
@@ -1000,7 +1026,7 @@ async function fillRow(row, opts = {}) {
|
|
|
1000
1026
|
const filledDefs = final.defs.filter((d) => done.has(d.id));
|
|
1001
1027
|
return {
|
|
1002
1028
|
filled: filledDefs.map((d) => d.key),
|
|
1003
|
-
notFound: final.missing.filter((d) => !done.has(d.id) && row[d.key]
|
|
1029
|
+
notFound: final.missing.filter((d) => !done.has(d.id) && !!row[d.key]).map((d) => d.key),
|
|
1004
1030
|
failed: [...failed],
|
|
1005
1031
|
noValue: [...noValue].filter((k) => !filledDefs.some((d) => d.key === k))
|
|
1006
1032
|
};
|
|
@@ -1009,8 +1035,9 @@ async function fillRow(row, opts = {}) {
|
|
|
1009
1035
|
function readRow(result = analyze()) {
|
|
1010
1036
|
const row = {};
|
|
1011
1037
|
for (const m of result.matches) {
|
|
1038
|
+
if (m.fp.type === "password") continue;
|
|
1012
1039
|
const v = readElement(m.fp.el);
|
|
1013
|
-
if (v !== void 0) row[m.def.key] = v;
|
|
1040
|
+
if (v !== void 0 && v !== "") row[m.def.key] = v;
|
|
1014
1041
|
}
|
|
1015
1042
|
return row;
|
|
1016
1043
|
}
|
|
@@ -1058,8 +1085,13 @@ function makeBundle(state = load(), opts = {
|
|
|
1058
1085
|
version: 1,
|
|
1059
1086
|
exportedAt: nowIso()
|
|
1060
1087
|
};
|
|
1061
|
-
if (opts.fields) b.fields = state.fields;
|
|
1062
1088
|
if (opts.datasets) b.datasets = Array.isArray(opts.datasets) ? state.datasets.filter((d) => opts.datasets.includes(d.id)) : state.datasets;
|
|
1089
|
+
if (opts.fields) b.fields = state.fields;
|
|
1090
|
+
else if (opts.fields === void 0 && b.datasets) {
|
|
1091
|
+
const keys = new Set(b.datasets.flatMap((d) => datasetKeys(d)));
|
|
1092
|
+
b.fields = state.fields.filter((f) => keys.has(f.key));
|
|
1093
|
+
b.fieldsPartial = true;
|
|
1094
|
+
}
|
|
1063
1095
|
return b;
|
|
1064
1096
|
}
|
|
1065
1097
|
var ImportError = class extends Error {};
|
|
@@ -1085,7 +1117,7 @@ function validateBundle(raw) {
|
|
|
1085
1117
|
id: typeof f.id === "string" && f.id ? f.id : uid(),
|
|
1086
1118
|
key: f.key.trim(),
|
|
1087
1119
|
title: typeof f.title === "string" ? f.title : void 0,
|
|
1088
|
-
pages: Array.isArray(f.pages) ? f.pages.map(String) : [],
|
|
1120
|
+
pages: Array.isArray(f.pages) ? f.pages.map((x) => stripOrigin(String(x))) : [],
|
|
1089
1121
|
kind: typeof f.kind === "string" ? f.kind : void 0,
|
|
1090
1122
|
match: isObj(f.match) ? f.match : {},
|
|
1091
1123
|
updatedAt: typeof f.updatedAt === "string" ? f.updatedAt : void 0
|
|
@@ -1110,6 +1142,7 @@ function validateBundle(raw) {
|
|
|
1110
1142
|
};
|
|
1111
1143
|
});
|
|
1112
1144
|
}
|
|
1145
|
+
if (raw.fieldsPartial === true && out.fields) out.fieldsPartial = true;
|
|
1113
1146
|
if (!out.fields && !out.datasets) throw new ImportError("Dosyada ne alan tanımı ne de veri seti var.");
|
|
1114
1147
|
return out;
|
|
1115
1148
|
}
|
|
@@ -1122,8 +1155,15 @@ function applyBundle(state, b, mode) {
|
|
|
1122
1155
|
datasetsUpdated: 0,
|
|
1123
1156
|
rows: 0
|
|
1124
1157
|
};
|
|
1125
|
-
const fields = b.fields ?? [];
|
|
1126
1158
|
const datasets = b.datasets ?? [];
|
|
1159
|
+
if (b.fieldsPartial && b.fields) {
|
|
1160
|
+
mergeFields(state, b.fields, sum, true);
|
|
1161
|
+
b = {
|
|
1162
|
+
...b,
|
|
1163
|
+
fields: void 0
|
|
1164
|
+
};
|
|
1165
|
+
}
|
|
1166
|
+
const fields = b.fields ?? [];
|
|
1127
1167
|
sum.rows = datasets.reduce((n, d) => n + d.rows.length, 0);
|
|
1128
1168
|
if (mode === "copy") {
|
|
1129
1169
|
fields.forEach((f) => state.fields.push({
|
|
@@ -1138,7 +1178,7 @@ function applyBundle(state, b, mode) {
|
|
|
1138
1178
|
_id: uid()
|
|
1139
1179
|
}))
|
|
1140
1180
|
}));
|
|
1141
|
-
sum.fieldsAdded
|
|
1181
|
+
sum.fieldsAdded += fields.length;
|
|
1142
1182
|
sum.datasetsAdded = datasets.length;
|
|
1143
1183
|
return sum;
|
|
1144
1184
|
}
|
|
@@ -1153,19 +1193,7 @@ function applyBundle(state, b, mode) {
|
|
|
1153
1193
|
}
|
|
1154
1194
|
return sum;
|
|
1155
1195
|
}
|
|
1156
|
-
|
|
1157
|
-
const i = state.fields.findIndex((x) => x.id === f.id || x.key === f.key && x.pages.join("|") === f.pages.join("|"));
|
|
1158
|
-
if (i >= 0) {
|
|
1159
|
-
state.fields[i] = {
|
|
1160
|
-
...f,
|
|
1161
|
-
id: state.fields[i].id
|
|
1162
|
-
};
|
|
1163
|
-
sum.fieldsUpdated++;
|
|
1164
|
-
} else {
|
|
1165
|
-
state.fields.push(f);
|
|
1166
|
-
sum.fieldsAdded++;
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1196
|
+
mergeFields(state, fields, sum);
|
|
1169
1197
|
for (const d of datasets) {
|
|
1170
1198
|
const ex = state.datasets.find((x) => x.id === d.id) ?? state.datasets.find((x) => x.name === d.name);
|
|
1171
1199
|
if (!ex) {
|
|
@@ -1183,6 +1211,22 @@ function applyBundle(state, b, mode) {
|
|
|
1183
1211
|
}
|
|
1184
1212
|
return sum;
|
|
1185
1213
|
}
|
|
1214
|
+
function mergeFields(state, fields, sum, addOnly = false) {
|
|
1215
|
+
for (const f of fields) {
|
|
1216
|
+
const i = state.fields.findIndex((x) => x.id === f.id || x.key === f.key && x.pages.join("|") === f.pages.join("|"));
|
|
1217
|
+
if (i >= 0) {
|
|
1218
|
+
if (addOnly) continue;
|
|
1219
|
+
state.fields[i] = {
|
|
1220
|
+
...f,
|
|
1221
|
+
id: state.fields[i].id
|
|
1222
|
+
};
|
|
1223
|
+
sum.fieldsUpdated++;
|
|
1224
|
+
} else {
|
|
1225
|
+
state.fields.push(f);
|
|
1226
|
+
sum.fieldsAdded++;
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1186
1230
|
/** Excel (Türkçe) ile uyumlu olsun diye ; ayırıcı ve UTF-8 BOM kullanılır. */
|
|
1187
1231
|
function datasetToCsv(ds, keys = datasetKeys(ds)) {
|
|
1188
1232
|
const cell = (v) => {
|
|
@@ -1363,7 +1407,20 @@ var CSS$1 = `
|
|
|
1363
1407
|
position: fixed; top: 16px; right: 16px; width: 380px; max-height: calc(100vh - 32px);
|
|
1364
1408
|
display: flex; flex-direction: column; background: #fff; color: #1f2937; font-size: 13px; line-height: 1.4;
|
|
1365
1409
|
border: 1px solid #d1d5db; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.22); z-index: 2147483646; overflow: hidden;
|
|
1366
|
-
|
|
1410
|
+
resize: both; min-width: 300px; min-height: 160px; max-width: calc(100vw - 16px);
|
|
1411
|
+
}
|
|
1412
|
+
.ico { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
|
|
1413
|
+
.head button .ico { vertical-align: middle; }
|
|
1414
|
+
.mini {
|
|
1415
|
+
position: fixed; z-index: 2147483646; display: flex; align-items: center; gap: 2px; padding: 3px;
|
|
1416
|
+
background: #111827; border-radius: 20px; box-shadow: 0 6px 20px rgba(0,0,0,.3); cursor: move; user-select: none;
|
|
1417
|
+
}
|
|
1418
|
+
.mini button { border: 0; cursor: pointer; color: #fff; font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
|
|
1419
|
+
.mini .mfill { background: #2563eb; border-radius: 16px; padding: 5px 11px; font-weight: 600; }
|
|
1420
|
+
.mini .mfill:hover { background: #1d4ed8; }
|
|
1421
|
+
.mini .mfill.off { background: #4b5563; }
|
|
1422
|
+
.mini .mico { background: transparent; color: #d1d5db; width: 26px; height: 26px; border-radius: 13px; justify-content: center; font-size: 16px; }
|
|
1423
|
+
.mini .mico:hover { background: #374151; color: #fff; }
|
|
1367
1424
|
.head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #111827; color: #fff; cursor: move; user-select: none; }
|
|
1368
1425
|
.head b { font-size: 13px; letter-spacing: .2px; }
|
|
1369
1426
|
.head .sub { color: #9ca3af; font-size: 11px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
@@ -1413,6 +1470,13 @@ label.opt { display: flex; gap: 6px; align-items: flex-start; cursor: pointer; }
|
|
|
1413
1470
|
.pop { position: fixed; width: 300px; background: #fff; border: 1px solid #d1d5db; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); padding: 10px; pointer-events: auto; display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: #1f2937; }
|
|
1414
1471
|
.pop .lbl { font-size: 11px; color: #6b7280; }
|
|
1415
1472
|
.pop input[type=text], .pop select { width: 100%; }
|
|
1473
|
+
.pop .row select { width: auto; flex: 1; min-width: 0; }
|
|
1474
|
+
.pop .sep { border-top: 1px solid #e5e7eb; margin: 2px 0; }
|
|
1475
|
+
.pop .lbl.warn { color: #b45309; }
|
|
1476
|
+
table.edit td { max-width: none; padding: 1px 2px; }
|
|
1477
|
+
table.edit input.cell { width: 100%; min-width: 70px; border: 1px solid transparent; border-radius: 4px; padding: 3px 4px; font-size: 11px; background: transparent; }
|
|
1478
|
+
table.edit input.cell:hover { border-color: #e5e7eb; }
|
|
1479
|
+
table.edit input.cell:focus { border-color: #2563eb; background: #fff; outline: none; }
|
|
1416
1480
|
`;
|
|
1417
1481
|
// src/panel/panel.ts
|
|
1418
1482
|
var KIND_TR = {
|
|
@@ -1425,6 +1489,27 @@ var KIND_TR = {
|
|
|
1425
1489
|
contenteditable: "zengin metin",
|
|
1426
1490
|
other: "diğer"
|
|
1427
1491
|
};
|
|
1492
|
+
var UI_KEY = "optona-otofill:ui";
|
|
1493
|
+
function loadUi() {
|
|
1494
|
+
try {
|
|
1495
|
+
return JSON.parse(localStorage.getItem(UI_KEY) || "{}");
|
|
1496
|
+
} catch {
|
|
1497
|
+
return {};
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
function saveUi(u) {
|
|
1501
|
+
try {
|
|
1502
|
+
localStorage.setItem(UI_KEY, JSON.stringify(u));
|
|
1503
|
+
} catch {}
|
|
1504
|
+
}
|
|
1505
|
+
var ICON_MIN = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"4 14 10 14 10 20\"/><polyline points=\"20 10 14 10 14 4\"/><line x1=\"14\" y1=\"10\" x2=\"21\" y2=\"3\"/><line x1=\"3\" y1=\"21\" x2=\"10\" y2=\"14\"/></svg>";
|
|
1506
|
+
var ICON_FILL = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"currentColor\" stroke=\"none\"><path d=\"M13 2 3 14h9l-1 8 10-12h-9l1-8z\"/></svg>";
|
|
1507
|
+
var icon = (svg) => {
|
|
1508
|
+
const sp = document.createElement("span");
|
|
1509
|
+
sp.className = "ico";
|
|
1510
|
+
sp.innerHTML = svg;
|
|
1511
|
+
return sp;
|
|
1512
|
+
};
|
|
1428
1513
|
var Panel = class {
|
|
1429
1514
|
constructor(opts) {
|
|
1430
1515
|
this.opts = opts;
|
|
@@ -1432,6 +1517,7 @@ var Panel = class {
|
|
|
1432
1517
|
this.view = "fill";
|
|
1433
1518
|
this.result = null;
|
|
1434
1519
|
this.lastFill = null;
|
|
1520
|
+
this.quiet = false;
|
|
1435
1521
|
this.toastMsg = "";
|
|
1436
1522
|
this.toastKind = "ok";
|
|
1437
1523
|
this.toastTimer = 0;
|
|
@@ -1441,7 +1527,13 @@ var Panel = class {
|
|
|
1441
1527
|
this.teaching = false;
|
|
1442
1528
|
this.teachPop = null;
|
|
1443
1529
|
this.freeSel = /* @__PURE__ */ new Map();
|
|
1444
|
-
this.
|
|
1530
|
+
this.teachTarget = {
|
|
1531
|
+
dsId: "__new",
|
|
1532
|
+
rowId: "__new"
|
|
1533
|
+
};
|
|
1534
|
+
this.ui = loadUi();
|
|
1535
|
+
this.minimized = false;
|
|
1536
|
+
this.miniMsg = "";
|
|
1445
1537
|
this.raf = 0;
|
|
1446
1538
|
this.onKey = (e) => {
|
|
1447
1539
|
if (hotkeyMatches(e, this.opts.hotkey)) {
|
|
@@ -1482,19 +1574,40 @@ var Panel = class {
|
|
|
1482
1574
|
const dx = e.clientX - rect.left;
|
|
1483
1575
|
const dy = e.clientY - rect.top;
|
|
1484
1576
|
const move = (ev) => {
|
|
1485
|
-
this.
|
|
1486
|
-
|
|
1487
|
-
top: Math.max(0, Math.min(window.innerHeight - 40, ev.clientY - dy))
|
|
1488
|
-
};
|
|
1577
|
+
this.ui.left = Math.max(0, Math.min(window.innerWidth - 60, ev.clientX - dx));
|
|
1578
|
+
this.ui.top = Math.max(0, Math.min(window.innerHeight - 40, ev.clientY - dy));
|
|
1489
1579
|
Object.assign(this.box.style, {
|
|
1490
|
-
left: `${this.
|
|
1491
|
-
top: `${this.
|
|
1580
|
+
left: `${this.ui.left}px`,
|
|
1581
|
+
top: `${this.ui.top}px`,
|
|
1492
1582
|
right: "auto"
|
|
1493
1583
|
});
|
|
1494
1584
|
};
|
|
1495
1585
|
const up = () => {
|
|
1496
1586
|
window.removeEventListener("mousemove", move, true);
|
|
1497
1587
|
window.removeEventListener("mouseup", up, true);
|
|
1588
|
+
saveUi(this.ui);
|
|
1589
|
+
};
|
|
1590
|
+
window.addEventListener("mousemove", move, true);
|
|
1591
|
+
window.addEventListener("mouseup", up, true);
|
|
1592
|
+
e.preventDefault();
|
|
1593
|
+
};
|
|
1594
|
+
this.startMiniDrag = (e) => {
|
|
1595
|
+
if (e.target.closest("button")) return;
|
|
1596
|
+
const rect = this.mini.getBoundingClientRect();
|
|
1597
|
+
const dx = e.clientX - rect.left;
|
|
1598
|
+
const dy = e.clientY - rect.top;
|
|
1599
|
+
const move = (ev) => {
|
|
1600
|
+
this.ui.miniLeft = Math.max(0, Math.min(window.innerWidth - 140, ev.clientX - dx));
|
|
1601
|
+
this.ui.miniTop = Math.max(0, Math.min(window.innerHeight - 40, ev.clientY - dy));
|
|
1602
|
+
Object.assign(this.mini.style, {
|
|
1603
|
+
left: `${this.ui.miniLeft}px`,
|
|
1604
|
+
top: `${this.ui.miniTop}px`
|
|
1605
|
+
});
|
|
1606
|
+
};
|
|
1607
|
+
const up = () => {
|
|
1608
|
+
window.removeEventListener("mousemove", move, true);
|
|
1609
|
+
window.removeEventListener("mouseup", up, true);
|
|
1610
|
+
saveUi(this.ui);
|
|
1498
1611
|
};
|
|
1499
1612
|
window.addEventListener("mousemove", move, true);
|
|
1500
1613
|
window.addEventListener("mouseup", up, true);
|
|
@@ -1533,8 +1646,29 @@ var Panel = class {
|
|
|
1533
1646
|
class: "panel",
|
|
1534
1647
|
style: { display: "none" }
|
|
1535
1648
|
});
|
|
1536
|
-
this.
|
|
1649
|
+
this.mini = h("div", {
|
|
1650
|
+
class: "mini",
|
|
1651
|
+
style: { display: "none" },
|
|
1652
|
+
onMousedown: this.startMiniDrag
|
|
1653
|
+
});
|
|
1654
|
+
this.root.append(this.layer, this.box, this.mini);
|
|
1537
1655
|
document.documentElement.appendChild(this.host);
|
|
1656
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
1657
|
+
let t = 0;
|
|
1658
|
+
new ResizeObserver(() => {
|
|
1659
|
+
if (!this.visible || !this.box.style.width) return;
|
|
1660
|
+
clearTimeout(t);
|
|
1661
|
+
t = window.setTimeout(() => {
|
|
1662
|
+
this.ui.w = this.box.style.width;
|
|
1663
|
+
this.ui.h = this.box.style.height;
|
|
1664
|
+
saveUi(this.ui);
|
|
1665
|
+
}, 300);
|
|
1666
|
+
}).observe(this.box);
|
|
1667
|
+
}
|
|
1668
|
+
const onNav = () => this.minimized && this.renderMini();
|
|
1669
|
+
window.addEventListener("hashchange", onNav);
|
|
1670
|
+
window.addEventListener("popstate", onNav);
|
|
1671
|
+
if (this.ui.min) setTimeout(() => this.showMini(), 300);
|
|
1538
1672
|
for (const t of [
|
|
1539
1673
|
"keydown",
|
|
1540
1674
|
"keyup",
|
|
@@ -1543,18 +1677,35 @@ var Panel = class {
|
|
|
1543
1677
|
window.addEventListener("keydown", this.onKey, true);
|
|
1544
1678
|
window.addEventListener("scroll", this.onViewport, true);
|
|
1545
1679
|
window.addEventListener("resize", this.onViewport);
|
|
1546
|
-
subscribe(() =>
|
|
1680
|
+
subscribe(() => {
|
|
1681
|
+
if (this.quiet) return;
|
|
1682
|
+
if (this.visible) this.refresh();
|
|
1683
|
+
else if (this.minimized) this.renderMini();
|
|
1684
|
+
});
|
|
1547
1685
|
}
|
|
1548
1686
|
show() {
|
|
1549
1687
|
this.mount();
|
|
1550
1688
|
this.visible = true;
|
|
1689
|
+
this.minimized = false;
|
|
1690
|
+
this.mini.style.display = "none";
|
|
1691
|
+
if (this.ui.min) {
|
|
1692
|
+
this.ui.min = false;
|
|
1693
|
+
saveUi(this.ui);
|
|
1694
|
+
}
|
|
1551
1695
|
this.pattern ||= suggestPagePattern();
|
|
1552
1696
|
this.box.style.display = "flex";
|
|
1697
|
+
this.applyBox();
|
|
1553
1698
|
this.refresh();
|
|
1554
1699
|
}
|
|
1555
1700
|
hide() {
|
|
1556
1701
|
this.visible = false;
|
|
1702
|
+
this.minimized = false;
|
|
1557
1703
|
this.box.style.display = "none";
|
|
1704
|
+
if (this.mini) this.mini.style.display = "none";
|
|
1705
|
+
if (this.ui.min) {
|
|
1706
|
+
this.ui.min = false;
|
|
1707
|
+
saveUi(this.ui);
|
|
1708
|
+
}
|
|
1558
1709
|
this.stopTeach();
|
|
1559
1710
|
this.inspecting = false;
|
|
1560
1711
|
this.drawLayer();
|
|
@@ -1563,6 +1714,104 @@ var Panel = class {
|
|
|
1563
1714
|
if (this.visible) this.hide();
|
|
1564
1715
|
else this.show();
|
|
1565
1716
|
}
|
|
1717
|
+
/** Paneli tek bir küçük düğmeye çevirir (konumu panelin sağ üst köşesi). */
|
|
1718
|
+
minimize() {
|
|
1719
|
+
const r = this.box.getBoundingClientRect();
|
|
1720
|
+
this.ui.miniLeft = Math.round(r.right - 132);
|
|
1721
|
+
this.ui.miniTop = Math.round(r.top);
|
|
1722
|
+
this.stopTeach();
|
|
1723
|
+
this.inspecting = false;
|
|
1724
|
+
this.visible = false;
|
|
1725
|
+
this.box.style.display = "none";
|
|
1726
|
+
this.showMini();
|
|
1727
|
+
this.drawLayer();
|
|
1728
|
+
}
|
|
1729
|
+
showMini() {
|
|
1730
|
+
this.mount();
|
|
1731
|
+
this.minimized = true;
|
|
1732
|
+
this.ui.min = true;
|
|
1733
|
+
saveUi(this.ui);
|
|
1734
|
+
this.mini.style.display = "flex";
|
|
1735
|
+
this.renderMini();
|
|
1736
|
+
}
|
|
1737
|
+
/** Kayıtlı boyut ve konumu panele uygular. */
|
|
1738
|
+
applyBox() {
|
|
1739
|
+
const u = this.ui;
|
|
1740
|
+
if (u.w) this.box.style.width = u.w;
|
|
1741
|
+
if (u.h) this.box.style.height = u.h;
|
|
1742
|
+
if (u.left != null && u.top != null) {
|
|
1743
|
+
const left = Math.max(0, Math.min(window.innerWidth - 80, u.left));
|
|
1744
|
+
const top = Math.max(0, Math.min(window.innerHeight - 40, u.top));
|
|
1745
|
+
Object.assign(this.box.style, {
|
|
1746
|
+
left: `${left}px`,
|
|
1747
|
+
top: `${top}px`,
|
|
1748
|
+
right: "auto"
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
/** Bu sayfa için en uygun veri setinde son kullanılan satır (yoksa ilk satır). */
|
|
1753
|
+
quickTarget() {
|
|
1754
|
+
this.result = analyze();
|
|
1755
|
+
const ds = this.currentDataset();
|
|
1756
|
+
if (!ds || !ds.rows.length) return null;
|
|
1757
|
+
const cur = load().prefs.cursor[ds.id];
|
|
1758
|
+
return {
|
|
1759
|
+
ds,
|
|
1760
|
+
i: cur == null ? 0 : (cur - 1 + ds.rows.length) % ds.rows.length
|
|
1761
|
+
};
|
|
1762
|
+
}
|
|
1763
|
+
renderMini() {
|
|
1764
|
+
if (!this.mini) return;
|
|
1765
|
+
const t = this.quickTarget();
|
|
1766
|
+
const left = Math.max(0, Math.min(window.innerWidth - 140, this.ui.miniLeft ?? window.innerWidth - 148));
|
|
1767
|
+
const top = Math.max(0, Math.min(window.innerHeight - 40, this.ui.miniTop ?? 16));
|
|
1768
|
+
Object.assign(this.mini.style, {
|
|
1769
|
+
left: `${left}px`,
|
|
1770
|
+
top: `${top}px`
|
|
1771
|
+
});
|
|
1772
|
+
const fillBtn = h("button", {
|
|
1773
|
+
class: "mfill" + (t ? "" : " off"),
|
|
1774
|
+
title: t ? `Doldur: ${t.ds.name} › ${rowTitle(t.ds.rows[t.i])}` : "Bu sayfa için uygun veri yok: paneli açar",
|
|
1775
|
+
onClick: () => void this.quickFill()
|
|
1776
|
+
}, icon(ICON_FILL), this.miniMsg || "Doldur");
|
|
1777
|
+
this.mini.replaceChildren(fillBtn, h("button", {
|
|
1778
|
+
class: "mico",
|
|
1779
|
+
title: "Paneli aç (Ctrl+Q)",
|
|
1780
|
+
onClick: () => this.show()
|
|
1781
|
+
}, icon(ICON_MIN)), h("button", {
|
|
1782
|
+
class: "mico",
|
|
1783
|
+
title: "Kapat",
|
|
1784
|
+
onClick: () => this.hide()
|
|
1785
|
+
}, "×"));
|
|
1786
|
+
}
|
|
1787
|
+
/** Küçük düğmeden doldurma: veri yoksa ya da sorun çıkarsa paneli açar. */
|
|
1788
|
+
async quickFill() {
|
|
1789
|
+
const t = this.quickTarget();
|
|
1790
|
+
if (!t) {
|
|
1791
|
+
this.show();
|
|
1792
|
+
return;
|
|
1793
|
+
}
|
|
1794
|
+
const row = t.ds.rows[t.i];
|
|
1795
|
+
update((s) => {
|
|
1796
|
+
s.prefs.lastDatasetId = t.ds.id;
|
|
1797
|
+
s.prefs.cursor[t.ds.id] = (t.i + 1) % t.ds.rows.length;
|
|
1798
|
+
});
|
|
1799
|
+
const res = await fillRow(row, { onFilled: (el) => this.flash(el) });
|
|
1800
|
+
this.lastFill = res;
|
|
1801
|
+
const problems = res.notFound.length + res.failed.length;
|
|
1802
|
+
if (problems) {
|
|
1803
|
+
this.view = "fill";
|
|
1804
|
+
this.show();
|
|
1805
|
+
this.toast(`"${rowTitle(row)}": ${res.filled.length} alan dolduruldu, ${problems} sorunlu`, "err");
|
|
1806
|
+
return;
|
|
1807
|
+
}
|
|
1808
|
+
this.miniMsg = `✓ ${res.filled.length}`;
|
|
1809
|
+
this.renderMini();
|
|
1810
|
+
setTimeout(() => {
|
|
1811
|
+
this.miniMsg = "";
|
|
1812
|
+
if (this.minimized) this.renderMini();
|
|
1813
|
+
}, 1500);
|
|
1814
|
+
}
|
|
1566
1815
|
isOpen() {
|
|
1567
1816
|
return this.visible;
|
|
1568
1817
|
}
|
|
@@ -1623,6 +1872,9 @@ var Panel = class {
|
|
|
1623
1872
|
title: "Yeniden tara",
|
|
1624
1873
|
onClick: () => this.refresh()
|
|
1625
1874
|
}, "⟳"), h("button", {
|
|
1875
|
+
title: "Küçült: tek düğmeye çevirir",
|
|
1876
|
+
onClick: () => this.minimize()
|
|
1877
|
+
}, icon(ICON_MIN)), h("button", {
|
|
1626
1878
|
title: "Kapat (Ctrl+Q)",
|
|
1627
1879
|
onClick: () => this.hide()
|
|
1628
1880
|
}, "×"));
|
|
@@ -1644,11 +1896,6 @@ var Panel = class {
|
|
|
1644
1896
|
const scroll = this.box.querySelector(".body")?.scrollTop ?? 0;
|
|
1645
1897
|
this.box.replaceChildren(header, tabs, body);
|
|
1646
1898
|
body.scrollTop = scroll;
|
|
1647
|
-
if (this.pos) Object.assign(this.box.style, {
|
|
1648
|
-
left: `${this.pos.left}px`,
|
|
1649
|
-
top: `${this.pos.top}px`,
|
|
1650
|
-
right: "auto"
|
|
1651
|
-
});
|
|
1652
1899
|
}
|
|
1653
1900
|
renderFill(body) {
|
|
1654
1901
|
const r = this.result;
|
|
@@ -1858,7 +2105,7 @@ var Panel = class {
|
|
|
1858
2105
|
let target = s.datasets.find((d) => d.id === (this.openDsId ?? s.prefs.lastDatasetId))?.id ?? s.datasets[0]?.id ?? "__new";
|
|
1859
2106
|
let newName = "";
|
|
1860
2107
|
let label = "";
|
|
1861
|
-
body.append(h("div", { class: "sec" }, "
|
|
2108
|
+
body.append(h("div", { class: "sec" }, "Satır ekle"), h("div", { class: "muted" }, keys.length ? `Tanınan ${keys.length} alanın o anki değerleri okunur. Formu elle doldurup buradan kaydedebilirsiniz.` : "Bu sayfada tanımlı alan yok: boş satır eklenir, değerleri aşağıdaki tabloda yazarsınız."), h("div", { class: "row" }, h("select", {
|
|
1862
2109
|
class: "grow",
|
|
1863
2110
|
onChange: (e) => {
|
|
1864
2111
|
target = e.target.value;
|
|
@@ -1888,26 +2135,40 @@ var Panel = class {
|
|
|
1888
2135
|
}
|
|
1889
2136
|
}), h("button", {
|
|
1890
2137
|
class: "btn pri",
|
|
1891
|
-
|
|
2138
|
+
title: keys.length ? "Sayfadaki tanımlı alanların değerlerini yeni satır olarak kaydeder" : "Boş bir satır ekler; değerleri aşağıdaki tabloda yazın",
|
|
1892
2139
|
onClick: () => {
|
|
1893
|
-
const values = readRow(r);
|
|
2140
|
+
const values = keys.length ? readRow(r) : {};
|
|
1894
2141
|
let id = target;
|
|
1895
2142
|
if (target === "__new") id = createDataset(newName.trim() || `Veri ${(/* @__PURE__ */ new Date()).toLocaleDateString("tr-TR")}`).id;
|
|
2143
|
+
const ds = load().datasets.find((d) => d.id === id);
|
|
1896
2144
|
addRow(id, {
|
|
1897
2145
|
...values,
|
|
1898
|
-
|
|
2146
|
+
_label: label.trim() || `Satır ${(ds?.rows.length ?? 0) + 1}`
|
|
1899
2147
|
});
|
|
1900
2148
|
this.openDsId = id;
|
|
1901
|
-
this.toast(`${Object.keys(values).length} değer satır olarak kaydedildi.`);
|
|
2149
|
+
this.toast(keys.length ? `${Object.keys(values).length} değer satır olarak kaydedildi.` : "Satır eklendi; değerleri tabloda yazın.");
|
|
1902
2150
|
}
|
|
1903
|
-
}, "Kaydet")), h("div", { class: "sec" }, `Veri setleri (${s.datasets.length})`));
|
|
2151
|
+
}, keys.length ? "Kaydet" : "Satır ekle")), h("div", { class: "sec" }, `Veri setleri (${s.datasets.length})`));
|
|
1904
2152
|
if (!s.datasets.length) {
|
|
1905
2153
|
body.append(h("div", { class: "muted" }, "Henüz veri seti yok. Yukarıdan kaydedin ya da Aktar sekmesinden içe aktarın."));
|
|
1906
2154
|
return;
|
|
1907
2155
|
}
|
|
1908
2156
|
body.append(h("div", { class: "list" }, s.datasets.map((d) => {
|
|
1909
2157
|
const open = this.openDsId === d.id;
|
|
1910
|
-
const
|
|
2158
|
+
const dk = datasetKeys(d);
|
|
2159
|
+
const cols = [...keys.filter((k) => dk.includes(k)), ...dk.filter((k) => !keys.includes(k))];
|
|
2160
|
+
const extra = [.../* @__PURE__ */ new Set([...keys, ...s.fields.map((f) => f.key)])].filter((k) => !dk.includes(k));
|
|
2161
|
+
const cell = (row, c, placeholder = "") => h("td", {}, h("input", {
|
|
2162
|
+
type: "text",
|
|
2163
|
+
class: "cell",
|
|
2164
|
+
value: row[c] ?? "",
|
|
2165
|
+
placeholder,
|
|
2166
|
+
title: c === "_label" ? "Satır adı" : c,
|
|
2167
|
+
onChange: (e) => this.setCell(d.id, row._id, c, e.target.value),
|
|
2168
|
+
onKeydown: (e) => {
|
|
2169
|
+
if (e.key === "Enter") e.target.blur();
|
|
2170
|
+
}
|
|
2171
|
+
}));
|
|
1911
2172
|
return h("div", {}, h("div", {
|
|
1912
2173
|
class: "item click",
|
|
1913
2174
|
onClick: () => {
|
|
@@ -1916,7 +2177,14 @@ var Panel = class {
|
|
|
1916
2177
|
}
|
|
1917
2178
|
}, h("span", {}, open ? "▾" : "▸"), h("span", { class: "grow" }, d.name), h("span", { class: "muted" }, `${d.rows.length} satır`), h("button", {
|
|
1918
2179
|
class: "btn sm",
|
|
1919
|
-
title: "
|
|
2180
|
+
title: "Veri + kullandığı alan tanımları: başka adreste içe aktarınca alanlar da gelir",
|
|
2181
|
+
onClick: (e) => {
|
|
2182
|
+
e.stopPropagation();
|
|
2183
|
+
exportJson({ datasets: [d.id] }, `otofill-${slug(d.name) || "veri"}.json`);
|
|
2184
|
+
}
|
|
2185
|
+
}, "JSON"), h("button", {
|
|
2186
|
+
class: "btn sm",
|
|
2187
|
+
title: "CSV indir (yalnızca veri, Excel için)",
|
|
1920
2188
|
onClick: (e) => {
|
|
1921
2189
|
e.stopPropagation();
|
|
1922
2190
|
exportCsv(d.id);
|
|
@@ -1930,16 +2198,60 @@ var Panel = class {
|
|
|
1930
2198
|
}, "Sil")), open ? h("div", { style: {
|
|
1931
2199
|
padding: "0 8px 8px",
|
|
1932
2200
|
overflowX: "auto"
|
|
1933
|
-
} }, h("table", {}, h("tr", {}, h("th", {}, "Satır"), cols.map((c) => h("th", { title: c }, c)), h("th", {})), d.rows.map((row) => h("tr", {},
|
|
2201
|
+
} }, h("table", { class: "edit" }, h("tr", {}, h("th", {}, "Satır"), cols.map((c) => h("th", { title: c }, c)), h("th", {})), d.rows.map((row) => h("tr", {}, cell(row, "_label", rowTitle(row)), cols.map((c) => cell(row, c)), h("td", {}, h("button", {
|
|
1934
2202
|
class: "btn sm dng",
|
|
1935
2203
|
title: "Satırı sil",
|
|
1936
2204
|
onClick: () => removeRow(d.id, row._id)
|
|
1937
2205
|
}, "×"))))), h("div", {
|
|
2206
|
+
class: "row",
|
|
2207
|
+
style: { marginTop: "6px" }
|
|
2208
|
+
}, h("button", {
|
|
2209
|
+
class: "btn sm",
|
|
2210
|
+
onClick: () => {
|
|
2211
|
+
addRow(d.id, { _label: `Satır ${d.rows.length + 1}` });
|
|
2212
|
+
}
|
|
2213
|
+
}, "+ Satır"), extra.length ? h("select", {
|
|
2214
|
+
class: "grow",
|
|
2215
|
+
title: "Veri setine sütun (alan) ekle",
|
|
2216
|
+
onChange: (e) => {
|
|
2217
|
+
const k = e.target.value;
|
|
2218
|
+
if (!k) return;
|
|
2219
|
+
update((st) => {
|
|
2220
|
+
const ds = st.datasets.find((x) => x.id === d.id);
|
|
2221
|
+
if (!ds) return;
|
|
2222
|
+
if (!ds.rows.length) ds.rows.push({
|
|
2223
|
+
_id: uid(),
|
|
2224
|
+
_label: "Satır 1"
|
|
2225
|
+
});
|
|
2226
|
+
ds.rows.forEach((rw) => {
|
|
2227
|
+
rw[k] ??= "";
|
|
2228
|
+
});
|
|
2229
|
+
ds.updatedAt = nowIso();
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
}, h("option", { value: "" }, "+ Sütun ekle…"), extra.map((k) => h("option", { value: k }, k))) : ""), h("div", {
|
|
1938
2233
|
class: "muted",
|
|
1939
2234
|
style: { marginTop: "4px" }
|
|
1940
|
-
}, "
|
|
2235
|
+
}, "Hücreye tıklayıp yazın; boş hücre doldurulmaz.")) : null);
|
|
1941
2236
|
})));
|
|
1942
2237
|
}
|
|
2238
|
+
/** Tablodaki tek hücreyi kaydeder; panel yeniden çizilmez, böylece Tab ile sonraki hücreye geçilebilir. */
|
|
2239
|
+
setCell(dsId, rowId, key, value) {
|
|
2240
|
+
this.quiet = true;
|
|
2241
|
+
try {
|
|
2242
|
+
update((st) => {
|
|
2243
|
+
const row = st.datasets.find((x) => x.id === dsId)?.rows.find((x) => x._id === rowId);
|
|
2244
|
+
if (!row) return;
|
|
2245
|
+
const v = value.trim();
|
|
2246
|
+
if (key === "_label" && !v) delete row._label;
|
|
2247
|
+
else row[key] = v;
|
|
2248
|
+
const ds = st.datasets.find((x) => x.id === dsId);
|
|
2249
|
+
ds.updatedAt = nowIso();
|
|
2250
|
+
});
|
|
2251
|
+
} finally {
|
|
2252
|
+
this.quiet = false;
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
1943
2255
|
renderIo(body) {
|
|
1944
2256
|
const s = load();
|
|
1945
2257
|
let csvId = s.datasets[0]?.id;
|
|
@@ -2003,7 +2315,8 @@ var Panel = class {
|
|
|
2003
2315
|
onClick: () => exportJson({ fields: true }, `otofill-alanlar-${location.hostname}.json`)
|
|
2004
2316
|
}, "Alan tanımları"), h("button", {
|
|
2005
2317
|
class: "btn",
|
|
2006
|
-
onClick: () => exportJson({ datasets: true }, "otofill-veri.json")
|
|
2318
|
+
onClick: () => exportJson({ datasets: true }, "otofill-veri.json"),
|
|
2319
|
+
title: "Veri setleri ve kullandıkları alan tanımları"
|
|
2007
2320
|
}, "Veri setleri")), s.datasets.length ? h("div", { class: "row" }, h("select", {
|
|
2008
2321
|
class: "grow",
|
|
2009
2322
|
onChange: (e) => {
|
|
@@ -2012,7 +2325,7 @@ var Panel = class {
|
|
|
2012
2325
|
}, s.datasets.map((d) => h("option", { value: d.id }, d.name))), h("button", {
|
|
2013
2326
|
class: "btn",
|
|
2014
2327
|
onClick: () => csvId && exportCsv(csvId)
|
|
2015
|
-
}, "CSV (Excel)")) : "", h("div", { class: "sec" }, "İçe aktar"), mode("merge", "Birleştir", "aynı kayıtları günceller, yenileri ekler"), mode("replace", "Üzerine yaz", "dosyadaki bölümü tamamen değiştirir"), mode("copy", "Kopya olarak ekle", "hepsini yeni kayıt olarak ekler"), drop, fileInput, h("textarea", {
|
|
2328
|
+
}, "CSV (Excel)")) : "", h("div", { class: "muted" }, "CSV yalnızca veriyi taşır; başka bir adreste alanların da gelmesi için JSON kullanın."), h("div", { class: "sec" }, "İçe aktar"), mode("merge", "Birleştir", "aynı kayıtları günceller, yenileri ekler"), mode("replace", "Üzerine yaz", "dosyadaki bölümü tamamen değiştirir"), mode("copy", "Kopya olarak ekle", "hepsini yeni kayıt olarak ekler"), drop, fileInput, h("textarea", {
|
|
2016
2329
|
placeholder: "ya da JSON / CSV metnini buraya yapıştırın",
|
|
2017
2330
|
onInput: (e) => {
|
|
2018
2331
|
pasted = e.target.value;
|
|
@@ -2020,7 +2333,7 @@ var Panel = class {
|
|
|
2020
2333
|
}), h("div", { class: "row" }, h("button", {
|
|
2021
2334
|
class: "btn grow",
|
|
2022
2335
|
onClick: () => runImport(() => summaryText(importText(pasted, this.importMode, pasted.trimStart().startsWith("{") ? "yapistirilan.json" : `Yapıştırılan ${(/* @__PURE__ */ new Date()).toLocaleString("tr-TR")}.csv`)))
|
|
2023
|
-
}, "Metinden içe aktar")), h("div", { class: "sec" }, "Depolama"), h("div", { class: "muted" }, `Veriler yalnızca bu tarayıcıda, ${location.origin} için saklanır; hiçbir yere gönderilmez. ${s.fields.length} alan tanımı, ${s.datasets.length} veri seti. Sürüm 0.1.
|
|
2336
|
+
}, "Metinden içe aktar")), h("div", { class: "sec" }, "Depolama"), h("div", { class: "muted" }, `Veriler yalnızca bu tarayıcıda, ${location.origin} için saklanır; hiçbir yere gönderilmez. ${s.fields.length} alan tanımı, ${s.datasets.length} veri seti. Sürüm 0.1.2.`), h("div", { class: "row" }, h("button", {
|
|
2024
2337
|
class: "btn dng",
|
|
2025
2338
|
onClick: () => {
|
|
2026
2339
|
if (confirm(`${location.origin} için kayıtlı tüm Otofill alanları ve verileri silinsin mi? Bu işlem geri alınamaz; önce dışa aktarmanız önerilir.`)) {
|
|
@@ -2167,6 +2480,57 @@ var Panel = class {
|
|
|
2167
2480
|
value: pagesOf,
|
|
2168
2481
|
selected: true
|
|
2169
2482
|
}, pagesOf) : null);
|
|
2483
|
+
const isPassword = (el.getAttribute("type") ?? "").toLowerCase() === "password";
|
|
2484
|
+
let dsId = s.datasets.some((d) => d.id === this.teachTarget.dsId) ? this.teachTarget.dsId : (s.datasets.find((d) => d.id === s.prefs.lastDatasetId) ?? s.datasets[0])?.id ?? "__new";
|
|
2485
|
+
let rowId = dsId !== "__new" && s.datasets.find((d) => d.id === dsId)?.rows.some((r) => r._id === this.teachTarget.rowId) ? this.teachTarget.rowId : "__new";
|
|
2486
|
+
const rowOf = () => s.datasets.find((d) => d.id === dsId)?.rows.find((r) => r._id === rowId);
|
|
2487
|
+
const currentValue = () => {
|
|
2488
|
+
const k = keyIn.value.trim();
|
|
2489
|
+
const inRow = k ? rowOf()?.[k] : void 0;
|
|
2490
|
+
if (inRow !== void 0) return inRow;
|
|
2491
|
+
return isPassword ? "" : readElement(el) ?? "";
|
|
2492
|
+
};
|
|
2493
|
+
const choices = el.tagName === "SELECT" ? Array.from(el.options).filter((o) => o.value !== "" && !o.disabled).map((o) => o.text.trim()).filter(Boolean) : fp.kind === "radio" ? radioGroup(el).map((r) => optionLabel(r) || r.value) : fp.kind === "checkbox" ? ["evet", "hayır"] : [];
|
|
2494
|
+
const valIn = h("input", {
|
|
2495
|
+
type: "text",
|
|
2496
|
+
list: choices.length ? "otofill-choices" : void 0,
|
|
2497
|
+
value: currentValue(),
|
|
2498
|
+
placeholder: isPassword ? "test hesabının şifresi (isteğe bağlı)" : "boş bırakılırsa veri yazılmaz"
|
|
2499
|
+
});
|
|
2500
|
+
const dsSel = h("select", { class: "grow" });
|
|
2501
|
+
const rowSel = h("select", { class: "grow" });
|
|
2502
|
+
const fillTargets = () => {
|
|
2503
|
+
dsSel.replaceChildren(...s.datasets.map((d) => h("option", {
|
|
2504
|
+
value: d.id,
|
|
2505
|
+
selected: d.id === dsId ? true : void 0
|
|
2506
|
+
}, d.name)), h("option", {
|
|
2507
|
+
value: "__new",
|
|
2508
|
+
selected: dsId === "__new" ? true : void 0
|
|
2509
|
+
}, "+ Yeni veri seti"));
|
|
2510
|
+
const ds = s.datasets.find((d) => d.id === dsId);
|
|
2511
|
+
rowSel.replaceChildren(...(ds?.rows ?? []).map((r, i) => h("option", {
|
|
2512
|
+
value: r._id,
|
|
2513
|
+
selected: r._id === rowId ? true : void 0
|
|
2514
|
+
}, `${i + 1}. ${rowTitle(r)}`)), h("option", {
|
|
2515
|
+
value: "__new",
|
|
2516
|
+
selected: rowId === "__new" ? true : void 0
|
|
2517
|
+
}, "+ Yeni satır"));
|
|
2518
|
+
};
|
|
2519
|
+
fillTargets();
|
|
2520
|
+
dsSel.addEventListener("change", () => {
|
|
2521
|
+
dsId = dsSel.value;
|
|
2522
|
+
rowId = "__new";
|
|
2523
|
+
fillTargets();
|
|
2524
|
+
valIn.value = currentValue();
|
|
2525
|
+
});
|
|
2526
|
+
rowSel.addEventListener("change", () => {
|
|
2527
|
+
rowId = rowSel.value;
|
|
2528
|
+
valIn.value = currentValue();
|
|
2529
|
+
});
|
|
2530
|
+
keyIn.addEventListener("change", () => {
|
|
2531
|
+
const v = rowOf()?.[keyIn.value.trim()];
|
|
2532
|
+
if (v !== void 0) valIn.value = v;
|
|
2533
|
+
});
|
|
2170
2534
|
const save = () => {
|
|
2171
2535
|
const key = keyIn.value.trim();
|
|
2172
2536
|
if (!key) {
|
|
@@ -2174,17 +2538,44 @@ var Panel = class {
|
|
|
2174
2538
|
return;
|
|
2175
2539
|
}
|
|
2176
2540
|
const def = this.defFrom(fp, key, titleIn.value.trim() || void 0, [pageSel.value], existing?.id);
|
|
2541
|
+
const value = valIn.value;
|
|
2542
|
+
let savedTo = "";
|
|
2177
2543
|
update((st) => {
|
|
2178
2544
|
const i = st.fields.findIndex((f) => f.id === def.id);
|
|
2179
2545
|
if (i >= 0) st.fields[i] = def;
|
|
2180
2546
|
else st.fields.push(def);
|
|
2547
|
+
if (value.trim() === "") return;
|
|
2548
|
+
let ds = st.datasets.find((d) => d.id === dsId);
|
|
2549
|
+
if (!ds) {
|
|
2550
|
+
ds = {
|
|
2551
|
+
id: uid(),
|
|
2552
|
+
name: `Veri ${(/* @__PURE__ */ new Date()).toLocaleDateString("tr-TR")}`,
|
|
2553
|
+
rows: [],
|
|
2554
|
+
updatedAt: nowIso()
|
|
2555
|
+
};
|
|
2556
|
+
st.datasets.push(ds);
|
|
2557
|
+
}
|
|
2558
|
+
let row = ds.rows.find((r) => r._id === rowId);
|
|
2559
|
+
if (!row) {
|
|
2560
|
+
row = { _id: uid() };
|
|
2561
|
+
ds.rows.push(row);
|
|
2562
|
+
}
|
|
2563
|
+
row[key] = value;
|
|
2564
|
+
ds.updatedAt = nowIso();
|
|
2565
|
+
st.prefs.lastDatasetId = ds.id;
|
|
2566
|
+
this.teachTarget = {
|
|
2567
|
+
dsId: ds.id,
|
|
2568
|
+
rowId: row._id
|
|
2569
|
+
};
|
|
2570
|
+
savedTo = `${ds.name} › ${ds.rows.indexOf(row) + 1}. satır`;
|
|
2181
2571
|
});
|
|
2182
2572
|
this.closeTeachPop();
|
|
2183
2573
|
this.flash(el);
|
|
2184
|
-
this.toast(`"${key}" ${existing ? "güncellendi" : "tanımlandı"}.`);
|
|
2574
|
+
this.toast(`"${key}" ${existing ? "güncellendi" : "tanımlandı"}` + (savedTo ? `, değer → ${savedTo}.` : "."));
|
|
2185
2575
|
};
|
|
2186
2576
|
const rect = this.targetRectEl(el).getBoundingClientRect();
|
|
2187
|
-
const
|
|
2577
|
+
const popH = 400;
|
|
2578
|
+
const top = rect.bottom + 8 + popH > window.innerHeight ? Math.max(8, rect.top - popH - 8) : rect.bottom + 8;
|
|
2188
2579
|
const left = Math.min(Math.max(8, rect.left), window.innerWidth - 310);
|
|
2189
2580
|
this.teachPop = h("div", {
|
|
2190
2581
|
class: "pop",
|
|
@@ -2195,7 +2586,7 @@ var Panel = class {
|
|
|
2195
2586
|
onKeydown: (e) => {
|
|
2196
2587
|
if (e.key === "Enter") save();
|
|
2197
2588
|
}
|
|
2198
|
-
}, h("div", {}, h("b", {}, existing ? "Alanı düzenle" : "Alan tanıt"), h("span", { class: "muted" }, ` · ${KIND_TR[fp.kind]}${fp.label ? ` · "${fp.label}"` : ""}`)), h("span", { class: "lbl" }, "Anahtar (veri setindeki sütun adı)"), keyIn, h("datalist", { id: listId }, knownKeys.map((k) => h("option", { value: k }))), h("span", { class: "lbl" }, "Açıklama"), titleIn, h("span", { class: "lbl" }, "Geçerli olduğu yer"), pageSel, h("div", { class: "row" }, existing ? h("button", {
|
|
2589
|
+
}, h("div", {}, h("b", {}, existing ? "Alanı düzenle" : "Alan tanıt"), h("span", { class: "muted" }, ` · ${KIND_TR[fp.kind]}${fp.label ? ` · "${fp.label}"` : ""}`)), h("span", { class: "lbl" }, "Anahtar (veri setindeki sütun adı)"), keyIn, h("datalist", { id: listId }, knownKeys.map((k) => h("option", { value: k }))), h("span", { class: "lbl" }, "Açıklama"), titleIn, h("span", { class: "lbl" }, "Geçerli olduğu yer"), pageSel, h("div", { class: "sep" }), h("span", { class: "lbl" }, "Örnek değer (isteğe bağlı)"), valIn, choices.length ? h("datalist", { id: "otofill-choices" }, choices.map((c) => h("option", { value: c }))) : null, isPassword ? h("span", { class: "lbl warn" }, "Gerçek şifrenizi yazmayın: veriler tarayıcıda düz metin durur ve dışa aktarılınca paylaşılır.") : null, h("span", { class: "lbl" }, "Değerin yazılacağı yer"), h("div", { class: "row" }, dsSel, rowSel), h("div", { class: "row" }, existing ? h("button", {
|
|
2199
2590
|
class: "btn dng",
|
|
2200
2591
|
onClick: () => {
|
|
2201
2592
|
removeField(existing.id);
|
|
@@ -2220,7 +2611,7 @@ var Panel = class {
|
|
|
2220
2611
|
* Ctrl+Q ile açılan form doldurucu. Alanları siz tanıtırsınız, verileri siz girer ya da içe aktarırsınız.
|
|
2221
2612
|
* Kütüphane şirketinize ait hiçbir veri içermez ve hiçbir yere istek atmaz.
|
|
2222
2613
|
*/
|
|
2223
|
-
var version = "0.1.
|
|
2614
|
+
var version = "0.1.2";
|
|
2224
2615
|
var panel = null;
|
|
2225
2616
|
/** Kısayolu dinlemeye başlar. Birden fazla çağrılırsa ilk çağrı geçerlidir. */
|
|
2226
2617
|
function init(opts = {}) {
|
package/dist/otofill.min.js
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
var Otofill=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,n)=>{let r=Object.setPrototypeOf({},null);for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n&1||t(r,Symbol.toStringTag,{value:`Module`}),n&2?r:Object.preventExtensions(r)},r={ı:`i`,ğ:`g`,ü:`u`,ş:`s`,ö:`o`,ç:`c`,â:`a`,î:`i`,û:`u`};function i(e){return e?e.toLocaleLowerCase(`tr`).replace(/[ığüşöçâîû]/g,e=>r[e]??e).normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/[^a-z0-9]+/g,` `).trim():``}function a(e,t){if(e=i(e).replace(/ /g,``),t=i(t).replace(/ /g,``),!e||!t)return 0;if(e===t)return 1;if(e.length<2||t.length<2)return 0;let n=new Map;for(let t=0;t<e.length-1;t++){let r=e.slice(t,t+2);n.set(r,(n.get(r)??0)+1)}let r=0;for(let e=0;e<t.length-1;e++){let i=t.slice(e,e+2),a=n.get(i)??0;a>0&&(n.set(i,a-1),r++)}return 2*r/(e.length+t.length-2)}function o(e){return i(e).replace(/ /g,`_`).slice(0,40)}function s(){let e=globalThis.crypto;return e&&typeof e.randomUUID==`function`?e.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10)+Math.random().toString(36).slice(2,6)}function c(){return new Date().toISOString()}function l(e){let t=e.trim().replace(/[.+^${}()|[\]\\?]/g,`\\$&`).replace(/\*/g,`.*`);return RegExp(`^`+t+`$`,`i`)}function u(e,t){let n=(e??[]).map(e=>e.trim()).filter(Boolean);return n.length===0||n.some(e=>{try{return l(e).test(t)}catch{return!1}})}function d(e=location){let t=e.pathname.replace(/\/\d+(?=\/|$)/g,`/*`);if(e.hash.startsWith(`#/`)){let n=e.hash.split(`?`)[0].replace(/\/\d+(?=\/|$)/g,`/*`);return`${e.origin}${t}*${n}*`}return`${e.origin}${t}*`}function ee(e=location){return`${e.origin}/*`}function f(e){return/\d{3,}/.test(e)||/[0-9a-f]{8,}/i.test(e)||/^(el-id-|v-\d|:r|mui-|pv_id|react-|ember|ext-|ui-id-|__|input-\d|headlessui-|radix-|n-\d)/i.test(e)}function p(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e.replace(/["\\#.:[\]()>+~*^$|=\s]/g,`\\$&`)}function m(e){if(e.id&&!f(e.id))return`#${p(e.id)}`;let t=[],n=e;for(;n&&t.length<6;){if(n!==e&&n.id&&!f(n.id)){t.unshift(`#${p(n.id)}`);break}let r=n.tagName.toLowerCase(),i=n.getAttribute(`name`);n===e&&i&&(r+=`[name="${p(i)}"]`);let a=n.parentElement;if(a){let e=n.tagName,t=Array.from(a.children).filter(t=>t.tagName===e);t.length>1&&(r+=`:nth-of-type(${t.indexOf(n)+1})`)}if(t.unshift(r),n.tagName===`FORM`||n.tagName===`BODY`)break;n=a}return t.join(` > `)}var h=e=>new Promise(t=>setTimeout(t,e)),g=`optona-otofill`,_=`input, textarea, select, [contenteditable=""], [contenteditable="true"]`,te=new Set([`hidden`,`submit`,`button`,`reset`,`image`,`file`]),ne=`.el-form-item, .ant-form-item, .n-form-item, .v-input, .q-field, .p-field, .p-float-label, .field, .form-group, .form-item, .form-field, .mb-3`,re=`label, .el-form-item__label, .ant-form-item-label, .n-form-item-label, .v-label, .q-field__label, legend`,ie=e=>e.tagName.toLowerCase();function v(e){let t=ie(e);if(t===`textarea`)return`textarea`;if(t===`select`)return`select`;if(t===`input`){if(e.closest(`.el-select, .el-cascader`))return`select`;if(e.closest(`.el-date-editor`))return`date`;let t=(e.getAttribute(`type`)??`text`).toLowerCase();return t===`checkbox`?`checkbox`:t===`radio`?`radio`:[`date`,`datetime-local`,`month`,`time`,`week`].includes(t)?`date`:`text`}return e.isContentEditable?`contenteditable`:`other`}function y(e){return!(!e||!e.matches?.(_)||ie(e)===`input`&&te.has((e.getAttribute(`type`)??`text`).toLowerCase()))}function ae(e){if(!e)return null;if(y(e))return e;let t=e.closest(`label`);if(t?.control&&y(t.control))return t.control;let n=e.closest(_);if(n&&y(n))return n;let r=e.closest(`.el-select, .el-input, .el-date-editor, .p-dropdown, .v-field, .ant-select, .n-input, .q-field`)?.querySelector(_);return r&&y(r)?r:null}function b(e){if(!e.getClientRects().length)return!1;let t=getComputedStyle(e);return t.visibility!==`hidden`&&t.display!==`none`}function oe(e){let t=v(e);if(t===`checkbox`||t===`radio`){if(b(e))return!0;let t=e.closest(`label`)??(e.id?e.getRootNode():null)?.querySelector?.(`label[for="${p(e.id)}"]`);return!!(t&&b(t))||!!(e.parentElement&&b(e.parentElement))}return b(e)}function x(e){return(e??``).replace(/\s+/g,` `).replace(/^[*\s]+|[*:\s]+$/g,``).trim().slice(0,80)}function S(e,t){let n=``,r=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),i;for(;i=r.nextNode();){let e=i.parentElement;!e||t.contains(i)||e.closest(`select, option, textarea, script, style, button`)||(n+=` `+i.textContent)}return x(n)}function se(e,t){return e.getRootNode().getElementById?.(t)??e.ownerDocument.getElementById(t)}function ce(e){let t=e;for(let e=0;t&&e<4;e++){let e=t.previousSibling;for(;e;){if(e.nodeType===Node.TEXT_NODE){let t=x(e.textContent);if(t)return t}else if(e.nodeType===Node.ELEMENT_NODE){let t=e;if(t.matches(_)||t.querySelector(_))return``;let n=x(t.textContent);if(n)return n}e=e.previousSibling}if(t=t.parentElement,!t||t.tagName===`FORM`||t.tagName===`BODY`)break}return``}function le(e){let t=e.getAttribute(`aria-labelledby`);if(t){let n=x(t.split(/\s+/).map(t=>se(e,t)?.textContent??``).join(` `));if(n)return n}if(e.id){let t=e.getRootNode().querySelector?.(`label[for="${p(e.id)}"]`);if(t){let n=S(t,e);if(n)return n}}let n=e.closest(`label`);if(n){let t=S(n,e);if(t)return t}let r=x(e.getAttribute(`aria-label`));if(r)return r;let i=e.closest(ne);if(i){let t=i.querySelector(re);if(t&&!t.contains(e)){let n=S(t,e);if(n)return n}}return ce(e)}function C(e){let t=e.getAttribute(`name`);if(!t)return[e];let n=e.closest(`form`)??e.getRootNode();return Array.from(n.querySelectorAll(`input[type="radio"][name="${p(t)}"]`))}function ue(e){if(e.id){let t=e.getRootNode().querySelector?.(`label[for="${p(e.id)}"]`);if(t)return S(t,e)}let t=e.closest(`label`);if(t)return S(t,e);let n=e.nextSibling;for(;n&&n.nodeType===Node.TEXT_NODE&&!x(n.textContent);)n=n.nextSibling;return x(n?.textContent)}function de(e){let t=C(e),n=e.closest(`fieldset`)?.querySelector(`legend`);if(n)return x(n.textContent);let r=e.closest(`[role="radiogroup"]`);if(r){let t=x(r.getAttribute(`aria-label`))||(r.getAttribute(`aria-labelledby`)?x(se(e,r.getAttribute(`aria-labelledby`))?.textContent):``);if(t)return t}let i=e.closest(ne);if(i){let e=Array.from(i.querySelectorAll(re)).find(e=>!t.some(t=>e.contains(t)||t.id&&e.getAttribute(`for`)===t.id));if(e)return x(e.textContent)}let a=e.parentElement;for(;a&&!t.every(e=>a.contains(e));)a=a.parentElement;return a?ce(a):``}function fe(e){let t=C(e),n=e.parentElement;for(;n&&!t.every(e=>n.contains(e));)n=n.parentElement;return n?`${m(n)} input[type="radio"]`:m(e)}function pe(e){let t=e.closest(`form`);if(t)return(t.id&&!f(t.id)?t.id:``)||t.getAttribute(`name`)||void 0}function w(e,t=0){let n=v(e),r=e.getAttribute(`name`)||void 0,i=r&&!f(r)?r:void 0;return{el:e,kind:n,tag:ie(e),type:e.getAttribute(`type`)?.toLowerCase()||void 0,otofill:e.getAttribute(`data-otofill`)||void 0,id:e.id&&!f(e.id)?e.id:void 0,name:i,label:(n===`radio`?de(e):le(e))||void 0,placeholder:e.getAttribute(`placeholder`)||void 0,ariaLabel:e.getAttribute(`aria-label`)||void 0,css:n===`radio`?i?`input[type="radio"][name="${p(i)}"]`:fe(e):m(e),formKey:pe(e),index:t}}function T(e,t){e.querySelectorAll(_).forEach(e=>{y(e)&&!e.disabled&&oe(e)&&t.push(e)}),e.querySelectorAll(`*`).forEach(e=>{if(e.tagName.toLowerCase()===`optona-otofill`)return;let n=e.shadowRoot;if(n&&T(n,t),e.tagName===`IFRAME`)try{let n=e.contentDocument;n&&T(n,t)}catch{}})}function E(e=document){let t=[];T(e,t);let n=new Set,r=[];for(let e of t)if(v(e)===`radio`){let t=C(e);if(n.has(t[0]))continue;n.add(t[0]),r.push(w(t[0],r.length))}else r.push(w(e,r.length));return r}function me(e){let{el:t,kind:n,...r}=e;return r}function D(e,t){e.dispatchEvent(new Event(t,{bubbles:!0}))}function O(e,t){let n={key:t,code:t,bubbles:!0,cancelable:!0};e.dispatchEvent(new KeyboardEvent(`keydown`,n)),e.dispatchEvent(new KeyboardEvent(`keyup`,n))}function k(e,t){let n=Object.getPrototypeOf(e),r;for(;n&&!(r=Object.getOwnPropertyDescriptor(n,`value`));)n=Object.getPrototypeOf(n);r?.set?r.set.call(e,t):e.value=t}function he(e){if(!e||!e.isConnected||!e.getClientRects().length)return!1;let t=getComputedStyle(e);return t.visibility!==`hidden`&&t.display!==`none`}async function A(e,t=800,n=25){let r=Date.now()+t;for(;;){let t=e();if(t)return t;if(Date.now()>r)return null;await h(n)}}function j(e,t,n=e=>e.textContent??``){let r=i(t);if(r)return e.find(e=>i(n(e))===r)??e.find(e=>i(n(e)).startsWith(r))??e.find(e=>a(n(e),t)>=.85)}var ge=e=>e.split(`|`).map(e=>e.trim()).filter(Boolean);function _e(e){let t=e.trim(),n=``,r=``,i=``,a=``,o=t.match(/^(\d{1,2})[./-](\d{1,2})[./-](\d{4})(.*)$/);return o?[,i,r,n,a]=o:(o=t.match(/^(\d{4})[./-](\d{1,2})[./-](\d{1,2})(.*)$/))&&([,n,r,i,a]=o),n?(r=r.padStart(2,`0`),i=i.padStart(2,`0`),a=a.replace(/^T/,` `),[...new Set([`${n}-${r}-${i}${a}`,t,`${i}.${r}.${n}${a}`,`${i}/${r}/${n}${a}`,`${r}/${i}/${n}${a}`,`${n}/${r}/${i}${a}`])]):[t]}function ve(e,t){let n=e=>(e.match(/\d+/g)??[]).map(Number),r=n(e),i=n(t);return i.length>0&&i.every((e,t)=>r[t]===e)}var M=e=>e.tagName===`INPUT`;function ye(e){let t=e.closest(`.el-select`),n=e,r=t.querySelector(`.el-select__wrapper`)??t,i=()=>{let t=n.getAttribute(`aria-controls`);return t?e.ownerDocument.getElementById(t):null};return{root:t,input:n,wrapper:r,listbox:i,isOpen:()=>n.getAttribute(`aria-expanded`)===`true`&&he(i()),items:()=>Array.from(i()?.querySelectorAll(`.el-select-dropdown__item`)??[]).filter(e=>he(e)&&!e.classList.contains(`is-disabled`))}}async function be(e){e.isOpen()&&(O(e.input,`Escape`),await A(()=>!e.isOpen(),300)||(e.wrapper.click(),await A(()=>!e.isOpen(),300)))}var xe={name:`element-plus-select`,detect:e=>M(e)&&!!e.closest(`.el-select`),async fill(e,t){let n=ye(e),r=ge(t);if(!r.length)return!0;if(n.isOpen()||n.wrapper.click(),!await A(()=>n.isOpen(),800))return!1;let i=n.listbox()?.getAttribute(`aria-multiselectable`)===`true`||n.root.querySelector(`.el-select__selection .el-tag`)!=null||r.length>1,a=!n.input.readOnly;if(i)for(let e of n.items().filter(e=>e.classList.contains(`is-selected`)))r.some(t=>j([e],t))||(e.click(),await h(30));let o=!0;for(let e of r){a&&(k(n.input,e),D(n.input,`input`),await h(120));let t=await A(()=>j(n.items(),e),500);if(!t)o=!1;else if(!(i&&t.classList.contains(`is-selected`))){if(t.click(),await h(40),!i)break;n.isOpen()||n.wrapper.click()}}return await be(n),o},read(e){let t=e.closest(`.el-select`),n=Array.from(t.querySelectorAll(`.el-tag .el-select__tags-text`)).map(e=>e.textContent?.trim()??``);return n.length?n.join(` | `):t.querySelector(`.el-select__placeholder:not(.is-transparent)`)?.textContent?.trim()??``}};function N(){let e=Array.from(document.querySelectorAll(`.el-popper .el-cascader-panel`)).filter(he);return e[e.length-1]??null}var Se=[xe,{name:`element-plus-cascader`,detect:e=>M(e)&&!!e.closest(`.el-cascader`),async fill(e,t){let n=e.closest(`.el-cascader`),r=t.split(/\s*[/>]\s*/).map(e=>e.trim()).filter(Boolean);if(!r.length)return!0;let i=N();if(!i&&(n.click(),i=await A(N,800),!i))return!1;for(let t=0;t<r.length;t++){let n=await A(()=>{let e=i.querySelectorAll(`.el-cascader-menu`)[t];return j(Array.from(e?.querySelectorAll(`.el-cascader-node:not(.is-disabled)`)??[]),r[t],e=>e.querySelector(`.el-cascader-node__label`)?.textContent??e.textContent??``)},600);if(!n)return O(e,`Escape`),document.body.click(),!1;n.click(),await h(60)}return N()&&(O(e,`Escape`),await h(50),N()&&document.body.click()),!0},read:e=>e.value},{name:`element-plus-date`,detect:e=>M(e)&&!!e.closest(`.el-date-editor`),async fill(e,t){let n=e;for(let e of _e(t))if(n.focus({preventScroll:!0}),k(n,e),D(n,`input`),D(n,`change`),await h(40),O(n,`Escape`),n.blur(),await h(40),n.value&&ve(n.value,e))return!0;return!1},read:e=>e.value}],Ce=new Set([`1`,`true`,`evet`,`e`,`yes`,`y`,`on`,`x`,`secili`,`checked`]),we=e=>Ce.has(i(e))||e.trim()===`✓`;function Te(e,t){let n=e.trim().match(/^(\d{1,2})[./-](\d{1,2})[./-](\d{4})(?:[ T](\d{1,2}):(\d{2}))?$/);if(!n)return e;let r=`${n[3]}-${n[2].padStart(2,`0`)}-${n[1].padStart(2,`0`)}`;return t===`datetime-local`?`${r}T${(n[4]??`00`).padStart(2,`0`)}:${n[5]??`00`}`:t===`month`?r.slice(0,7):r}var Ee={name:`native-text`,detect:e=>[`text`,`textarea`,`date`].includes(v(e)),fill(e,t){let n=e,r=(n.getAttribute(`type`)??`text`).toLowerCase(),i=v(e)===`date`?Te(t,r):t;return n.focus({preventScroll:!0}),k(n,i),D(n,`input`),D(n,`change`),n.blur(),v(e)!==`date`||n.value!==``||i===``},read:e=>e.value};function De(e,t){let n=Array.from(e.options),r=i(t);return n.find(e=>e.value===t)??n.find(e=>i(e.text)===r)??n.find(e=>r&&i(e.text).startsWith(r))??n.find(e=>a(e.text,t)>=.85)}var Oe={name:`native-select`,detect:e=>e.tagName===`SELECT`,fill(e,t){let n=e,r=De(n,t);return r?(k(n,r.value),D(n,`input`),D(n,`change`),!0):!1},read:e=>e.selectedOptions[0]?.text.trim()},ke={name:`native-checkbox`,detect:e=>v(e)===`checkbox`,fill(e,t){let n=e;return n.checked!==we(t)&&n.click(),!0},read:e=>e.checked?`true`:`false`},Ae={name:`native-radio`,detect:e=>v(e)===`radio`,fill(e,t){let n=C(e),r=i(t),o=n.find(e=>e.value===t)??n.find(e=>i(ue(e))===r)??n.find(e=>i(e.value)===r)??n.find(e=>a(ue(e),t)>=.8);return o?(o.checked||o.click(),!0):!1},read(e){let t=C(e).find(e=>e.checked);return t?ue(t)||t.value:``}},je={name:`contenteditable`,detect:e=>v(e)===`contenteditable`,fill(e,t){let n=e;return n.focus({preventScroll:!0}),n.textContent=t,n.dispatchEvent(new InputEvent(`input`,{bubbles:!0,inputType:`insertText`,data:t})),n.blur(),!0},read:e=>e.textContent??``},Me=[...Se,ke,Ae,Oe,je,Ee],P=[];function Ne(e){let t=P.findIndex(t=>t.name===e.name);t>=0?P[t]=e:P.unshift(e)}function Pe(e){return P.find(t=>t.detect(e))??Me.find(t=>t.detect(e))}async function Fe(e,t){let n=Pe(e);return n?await n.fill(e,t):!1}function Ie(e){return Pe(e)?.read?.(e)}var Le={otofill:100,id:50,name:40,labelExact:35,css:30,labelFuzzy:25,placeholder:15,ariaLabel:15,type:5,index:5,mismatch:-10,wrongTag:-25,wrongKind:-40},Re=30;function ze(e,t){let n=e.match,r=Le;if(n.otofill&&t.otofill)return n.otofill===t.otofill?r.otofill:0;let o=0;if(n.id&&t.id&&(o+=n.id===t.id?r.id:r.mismatch),n.name&&t.name&&(o+=n.name===t.name?r.name:r.mismatch),n.css)try{t.el.matches(n.css)&&(o+=r.css)}catch{}if(n.label&&t.label){let e=i(n.label),s=i(t.label);if(e===s)o+=r.labelExact;else{let t=a(e,s);t>=.6&&(o+=Math.round(r.labelFuzzy*t))}}return n.placeholder&&t.placeholder&&i(n.placeholder)===i(t.placeholder)&&(o+=r.placeholder),n.ariaLabel&&t.ariaLabel&&i(n.ariaLabel)===i(t.ariaLabel)&&(o+=r.ariaLabel),n.type&&t.type&&n.type===t.type&&(o+=r.type),n.index!=null&&n.index===t.index&&n.formKey===t.formKey&&(o+=r.index),n.tag&&t.tag&&n.tag!==t.tag&&(o+=r.wrongTag),e.kind&&e.kind!==t.kind&&(o+=r.wrongKind),o}function Be(e,t,n=location.href){let r=e.filter(e=>u(e.pages,n)),i=[];for(let e of r)for(let n of t){let t=ze(e,n);t>=30&&i.push({def:e,fp:n,score:t})}i.sort((e,t)=>t.score-e.score);let a=new Set,o=new Set,s=[];for(let e of i)a.has(e.def.id)||o.has(e.fp)||(a.add(e.def.id),o.add(e.fp),s.push(e));return s.sort((e,t)=>(e.fp.index??0)-(t.fp.index??0)),{defs:r,matches:s,missing:r.filter(e=>!a.has(e.id)),free:t.filter(e=>!o.has(e))}}var Ve=n({STATE_VERSION:()=>1,STORAGE_KEY:()=>He,addRow:()=>$e,clearAll:()=>Je,createDataset:()=>Xe,datasetKeys:()=>V,load:()=>L,migrate:()=>Ke,removeDataset:()=>Qe,removeField:()=>B,removeRow:()=>et,save:()=>R,subscribe:()=>qe,update:()=>z,upsertDataset:()=>Ze,upsertField:()=>Ye}),He=`optona-otofill`,F=new Set,Ue=null;function I(){return{v:1,fields:[],datasets:[],prefs:{cursor:{},closeAfterFill:!0}}}function We(){try{return localStorage.getItem(He)}catch{return Ue}}function Ge(e){try{localStorage.setItem(He,e)}catch{Ue=e}}function Ke(e){let t=I();if(!e||typeof e!=`object`)return t;let n=e;return{v:1,fields:Array.isArray(n.fields)?n.fields:[],datasets:Array.isArray(n.datasets)?n.datasets:[],prefs:{...t.prefs,...n.prefs??{},cursor:{...n.prefs?.cursor??{}}}}}function L(){let e=We();if(!e)return I();try{return Ke(JSON.parse(e))}catch{return I()}}function R(e){Ge(JSON.stringify(e)),F.forEach(t=>t(e))}function z(e){let t=L();return e(t),R(t),t}function qe(e){return F.add(e),()=>F.delete(e)}typeof window<`u`&&window.addEventListener(`storage`,e=>{if(e.key===`optona-otofill`){let e=L();F.forEach(t=>t(e))}});function Je(){R(I())}function Ye(e){let t={...e,id:e.id??s(),updatedAt:c()};return z(e=>{let n=e.fields.findIndex(e=>e.id===t.id);n>=0?e.fields[n]=t:e.fields.push(t)}),t}function B(e){z(t=>{t.fields=t.fields.filter(t=>t.id!==e)})}function Xe(e,t=[]){let n={id:s(),name:e,rows:t,updatedAt:c()};return z(e=>{e.datasets.push(n)}),n}function Ze(e){z(t=>{let n={...e,updatedAt:c()},r=t.datasets.findIndex(t=>t.id===e.id);r>=0?t.datasets[r]=n:t.datasets.push(n)})}function Qe(e){z(t=>{t.datasets=t.datasets.filter(t=>t.id!==e),delete t.prefs.cursor[e]})}function $e(e,t){let n={...t,_id:t._id??s()};return z(t=>{let r=t.datasets.find(t=>t.id===e);r&&(r.rows.push(n),r.updatedAt=c())}),n}function et(e,t){z(n=>{let r=n.datasets.find(t=>t.id===e);r&&(r.rows=r.rows.filter(e=>e._id!==t))})}function V(e){let t=new Set;return e.rows.forEach(e=>Object.keys(e).forEach(e=>!e.startsWith(`_`)&&t.add(e))),[...t]}function H(e=L().fields,t=location.href){return Be(e,E(document),t)}async function U(e,t={}){let n=t.retries??3,r=t.delay??300,i=new Set,a=new Set,o=H(),s=new Set;for(let c=0;c<=n;c++){a.clear();for(let n of o.matches){let r=n.def.key;if(i.has(n.def.id))continue;let o=e[r];if(o===void 0){s.add(r);continue}let c=!1;try{c=await Fe(n.fp.el,o)}catch(e){console.warn(`[otofill]`,r,e)}c?(i.add(n.def.id),t.onFilled?.(n.fp.el)):a.add(r)}let l=o.missing.filter(t=>e[t.key]!==void 0&&!i.has(t.id));if(a.size===0&&l.length===0||c===n)break;await h(r),o=H()}let c=o,l=c.defs.filter(e=>i.has(e.id));return{filled:l.map(e=>e.key),notFound:c.missing.filter(t=>!i.has(t.id)&&e[t.key]!==void 0).map(e=>e.key),failed:[...a],noValue:[...s].filter(e=>!l.some(t=>t.key===e))}}function tt(e=H()){let t={};for(let n of e.matches){let e=Ie(n.fp.el);e!==void 0&&(t[n.def.key]=e)}return t}function nt(e,t){let n=new Set(t);return e.map(e=>{let t=new Set;return e.rows.forEach(e=>Object.keys(e).forEach(e=>t.add(e))),{ds:e,overlap:[...n].filter(e=>t.has(e)).length}}).sort((e,t)=>t.overlap-e.overlap||e.ds.name.localeCompare(t.ds.name,`tr`))}function W(e,t=[]){return e._label?e._label:(t.length?t:Object.keys(e).filter(e=>!e.startsWith(`_`))).map(t=>e[t]).filter(e=>e&&e!==`true`&&e!==`false`).slice(0,2).join(` · `)||`(adsız satır)`}var G=`optona-otofill`,rt=1,it=n({ImportError:()=>K,applyBundle:()=>st,csvToDataset:()=>ut,datasetToCsv:()=>ct,download:()=>dt,exportCsv:()=>ft,exportJson:()=>J,importFile:()=>mt,importText:()=>pt,makeBundle:()=>at,parseCsv:()=>lt,summaryText:()=>Y,validateBundle:()=>ot});function at(e=L(),t={fields:!0,datasets:!0}){let n={format:G,version:1,exportedAt:c()};return t.fields&&(n.fields=e.fields),t.datasets&&(n.datasets=Array.isArray(t.datasets)?e.datasets.filter(e=>t.datasets.includes(e.id)):e.datasets),n}var K=class extends Error{};function q(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function ot(e){if(!q(e))throw new K(`Dosya bir JSON nesnesi değil.`);if(e.format!==`optona-otofill`)throw new K(`Bu bir Otofill dosyası değil (format: "${String(e.format)}").`);let t=Number(e.version);if(!t||t>1)throw new K(`Dosya sürümü (${String(e.version)}) bu kütüphaneden yeni. Kütüphaneyi güncelleyin.`);let n={format:G,version:1,exportedAt:String(e.exportedAt??c())};if(e.fields!==void 0){if(!Array.isArray(e.fields))throw new K(`"fields" bir dizi olmalı.`);n.fields=e.fields.map((e,t)=>{if(!q(e)||typeof e.key!=`string`||!e.key.trim())throw new K(`fields[${t}]: "key" eksik.`);return{id:typeof e.id==`string`&&e.id?e.id:s(),key:e.key.trim(),title:typeof e.title==`string`?e.title:void 0,pages:Array.isArray(e.pages)?e.pages.map(String):[],kind:typeof e.kind==`string`?e.kind:void 0,match:q(e.match)?e.match:{},updatedAt:typeof e.updatedAt==`string`?e.updatedAt:void 0}})}if(e.datasets!==void 0){if(!Array.isArray(e.datasets))throw new K(`"datasets" bir dizi olmalı.`);n.datasets=e.datasets.map((e,t)=>{if(!q(e)||typeof e.name!=`string`)throw new K(`datasets[${t}]: "name" eksik.`);if(!Array.isArray(e.rows))throw new K(`datasets[${t}]: "rows" bir dizi olmalı.`);return{id:typeof e.id==`string`&&e.id?e.id:s(),name:e.name,updatedAt:typeof e.updatedAt==`string`?e.updatedAt:void 0,rows:e.rows.map((e,n)=>{if(!q(e))throw new K(`datasets[${t}].rows[${n}] bir nesne değil.`);let r={_id:typeof e._id==`string`&&e._id?e._id:s()};for(let[t,n]of Object.entries(e))t!==`_id`&&n!=null&&(r[t]=String(n));return r})}})}if(!n.fields&&!n.datasets)throw new K(`Dosyada ne alan tanımı ne de veri seti var.`);return n}function st(e,t,n){let r={fieldsAdded:0,fieldsUpdated:0,datasetsAdded:0,datasetsUpdated:0,rows:0},i=t.fields??[],a=t.datasets??[];if(r.rows=a.reduce((e,t)=>e+t.rows.length,0),n===`copy`)return i.forEach(t=>e.fields.push({...t,id:s()})),a.forEach(t=>e.datasets.push({...t,id:s(),rows:t.rows.map(e=>({...e,_id:s()}))})),r.fieldsAdded=i.length,r.datasetsAdded=a.length,r;if(n===`replace`)return t.fields&&(e.fields=[...i],r.fieldsAdded=i.length),t.datasets&&(e.datasets=[...a],r.datasetsAdded=a.length),r;for(let t of i){let n=e.fields.findIndex(e=>e.id===t.id||e.key===t.key&&e.pages.join(`|`)===t.pages.join(`|`));n>=0?(e.fields[n]={...t,id:e.fields[n].id},r.fieldsUpdated++):(e.fields.push(t),r.fieldsAdded++)}for(let t of a){let n=e.datasets.find(e=>e.id===t.id)??e.datasets.find(e=>e.name===t.name);if(!n)e.datasets.push(t),r.datasetsAdded++;else{for(let e of t.rows){let t=n.rows.findIndex(t=>t._id===e._id);t>=0?n.rows[t]=e:n.rows.push(e)}n.updatedAt=c(),r.datasetsUpdated++}}return r}function ct(e,t=V(e)){let n=e=>{let t=e??``;return/[;"\r\n]/.test(t)?`"${t.replace(/"/g,`""`)}"`:t},r=[`_label`,...t],i=[r.map(n).join(`;`)];for(let t of e.rows)i.push(r.map(e=>n(t[e])).join(`;`));return``+i.join(`\r
|
|
2
|
-
`)}function
|
|
1
|
+
var Otofill=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,n)=>{let r=Object.setPrototypeOf({},null);for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n&1||t(r,Symbol.toStringTag,{value:`Module`}),n&2?r:Object.preventExtensions(r)},r={ı:`i`,ğ:`g`,ü:`u`,ş:`s`,ö:`o`,ç:`c`,â:`a`,î:`i`,û:`u`};function i(e){return e?e.toLocaleLowerCase(`tr`).replace(/[ığüşöçâîû]/g,e=>r[e]??e).normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/[^a-z0-9]+/g,` `).trim():``}function a(e,t){if(e=i(e).replace(/ /g,``),t=i(t).replace(/ /g,``),!e||!t)return 0;if(e===t)return 1;if(e.length<2||t.length<2)return 0;let n=new Map;for(let t=0;t<e.length-1;t++){let r=e.slice(t,t+2);n.set(r,(n.get(r)??0)+1)}let r=0;for(let e=0;e<t.length-1;e++){let i=t.slice(e,e+2),a=n.get(i)??0;a>0&&(n.set(i,a-1),r++)}return 2*r/(e.length+t.length-2)}function o(e){return i(e).replace(/ /g,`_`).slice(0,40)}function s(){let e=globalThis.crypto;return e&&typeof e.randomUUID==`function`?e.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10)+Math.random().toString(36).slice(2,6)}function c(){return new Date().toISOString()}function l(e){let t=e.trim().replace(/[.+^${}()|[\]\\?]/g,`\\$&`).replace(/\*/g,`.*`);return RegExp(`^`+t+`$`,`i`)}function u(e){let t=e.trim(),n=/^[a-z][a-z0-9+.-]*:\/\/[^/?#]*/i.exec(t);if(!n)return t;let r=t.slice(n[0].length);return!r||r===`*`?`/*`:r.startsWith(`/`)?r:`/`+r}function d(e){let t=/^[a-z][a-z0-9+.-]*:\/\/[^/?#]*/i.exec(e),n=t?e.slice(t[0].length):e;return n.startsWith(`/`)?n:`/`+n}function ee(e,t){let n=(e??[]).map(e=>u(e)).filter(Boolean);if(n.length===0)return!0;let r=d(t);return n.some(e=>{try{return l(e).test(e.startsWith(`/`)?r:t)}catch{return!1}})}function f(e=location){let t=e.pathname.replace(/\/\d+(?=\/|$)/g,`/*`);return e.hash.startsWith(`#/`)?`${t}*${e.hash.split(`?`)[0].replace(/\/\d+(?=\/|$)/g,`/*`)}*`:`${t}*`}function te(){return`/*`}function p(e){return/\d{3,}/.test(e)||/[0-9a-f]{8,}/i.test(e)||/^(el-id-|v-\d|:r|mui-|pv_id|react-|ember|ext-|ui-id-|__|input-\d|headlessui-|radix-|n-\d)/i.test(e)}function m(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e.replace(/["\\#.:[\]()>+~*^$|=\s]/g,`\\$&`)}function h(e){if(e.id&&!p(e.id))return`#${m(e.id)}`;let t=[],n=e;for(;n&&t.length<6;){if(n!==e&&n.id&&!p(n.id)){t.unshift(`#${m(n.id)}`);break}let r=n.tagName.toLowerCase(),i=n.getAttribute(`name`);n===e&&i&&(r+=`[name="${m(i)}"]`);let a=n.parentElement;if(a){let e=n.tagName,t=Array.from(a.children).filter(t=>t.tagName===e);t.length>1&&(r+=`:nth-of-type(${t.indexOf(n)+1})`)}if(t.unshift(r),n.tagName===`FORM`||n.tagName===`BODY`)break;n=a}return t.join(` > `)}var g=e=>new Promise(t=>setTimeout(t,e)),_=`optona-otofill`,v=`input, textarea, select, [contenteditable=""], [contenteditable="true"]`,y=new Set([`hidden`,`submit`,`button`,`reset`,`image`,`file`]),b=`.el-form-item, .ant-form-item, .n-form-item, .v-input, .q-field, .p-field, .p-float-label, .field, .form-group, .form-item, .form-field, .mb-3`,x=`label, .el-form-item__label, .ant-form-item-label, .n-form-item-label, .v-label, .q-field__label, legend`,S=e=>e.tagName.toLowerCase();function C(e){let t=S(e);if(t===`textarea`)return`textarea`;if(t===`select`)return`select`;if(t===`input`){if(e.closest(`.el-select, .el-cascader`))return`select`;if(e.closest(`.el-date-editor`))return`date`;let t=(e.getAttribute(`type`)??`text`).toLowerCase();return t===`checkbox`?`checkbox`:t===`radio`?`radio`:[`date`,`datetime-local`,`month`,`time`,`week`].includes(t)?`date`:`text`}return e.isContentEditable?`contenteditable`:`other`}function w(e){return!(!e||!e.matches?.(v)||S(e)===`input`&&y.has((e.getAttribute(`type`)??`text`).toLowerCase()))}function T(e){if(!e)return null;if(w(e))return e;let t=e.closest(`label`);if(t?.control&&w(t.control))return t.control;let n=e.closest(v);if(n&&w(n))return n;let r=e.closest(`.el-select, .el-input, .el-date-editor, .p-dropdown, .v-field, .ant-select, .n-input, .q-field`)?.querySelector(v);return r&&w(r)?r:null}function E(e){if(!e.getClientRects().length)return!1;let t=getComputedStyle(e);return t.visibility!==`hidden`&&t.display!==`none`}function ne(e){let t=C(e);if(t===`checkbox`||t===`radio`){if(E(e))return!0;let t=e.closest(`label`)??(e.id?e.getRootNode():null)?.querySelector?.(`label[for="${m(e.id)}"]`);return!!(t&&E(t))||!!(e.parentElement&&E(e.parentElement))}return E(e)}function D(e){return(e??``).replace(/\s+/g,` `).replace(/^[*\s]+|[*:\s]+$/g,``).trim().slice(0,80)}function O(e,t){let n=``,r=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),i;for(;i=r.nextNode();){let e=i.parentElement;!e||t.contains(i)||e.closest(`select, option, textarea, script, style, button`)||(n+=` `+i.textContent)}return D(n)}function re(e,t){return e.getRootNode().getElementById?.(t)??e.ownerDocument.getElementById(t)}function ie(e){let t=e;for(let e=0;t&&e<4;e++){let e=t.previousSibling;for(;e;){if(e.nodeType===Node.TEXT_NODE){let t=D(e.textContent);if(t)return t}else if(e.nodeType===Node.ELEMENT_NODE){let t=e;if(t.matches(v)||t.querySelector(v))return``;let n=D(t.textContent);if(n)return n}e=e.previousSibling}if(t=t.parentElement,!t||t.tagName===`FORM`||t.tagName===`BODY`)break}return``}function ae(e){let t=e.getAttribute(`aria-labelledby`);if(t){let n=D(t.split(/\s+/).map(t=>re(e,t)?.textContent??``).join(` `));if(n)return n}if(e.id){let t=e.getRootNode().querySelector?.(`label[for="${m(e.id)}"]`);if(t){let n=O(t,e);if(n)return n}}let n=e.closest(`label`);if(n){let t=O(n,e);if(t)return t}let r=D(e.getAttribute(`aria-label`));if(r)return r;let i=e.closest(b);if(i){let t=i.querySelector(x);if(t&&!t.contains(e)){let n=O(t,e);if(n)return n}}return ie(e)}function k(e){let t=e.getAttribute(`name`);if(!t)return[e];let n=e.closest(`form`)??e.getRootNode();return Array.from(n.querySelectorAll(`input[type="radio"][name="${m(t)}"]`))}function oe(e){if(e.id){let t=e.getRootNode().querySelector?.(`label[for="${m(e.id)}"]`);if(t)return O(t,e)}let t=e.closest(`label`);if(t)return O(t,e);let n=e.nextSibling;for(;n&&n.nodeType===Node.TEXT_NODE&&!D(n.textContent);)n=n.nextSibling;return D(n?.textContent)}function se(e){let t=k(e),n=e.closest(`fieldset`)?.querySelector(`legend`);if(n)return D(n.textContent);let r=e.closest(`[role="radiogroup"]`);if(r){let t=D(r.getAttribute(`aria-label`))||(r.getAttribute(`aria-labelledby`)?D(re(e,r.getAttribute(`aria-labelledby`))?.textContent):``);if(t)return t}let i=e.closest(b);if(i){let e=Array.from(i.querySelectorAll(x)).find(e=>!t.some(t=>e.contains(t)||t.id&&e.getAttribute(`for`)===t.id));if(e)return D(e.textContent)}let a=e.parentElement;for(;a&&!t.every(e=>a.contains(e));)a=a.parentElement;return a?ie(a):``}function ce(e){let t=k(e),n=e.parentElement;for(;n&&!t.every(e=>n.contains(e));)n=n.parentElement;return n?`${h(n)} input[type="radio"]`:h(e)}function le(e){let t=e.closest(`form`);if(t)return(t.id&&!p(t.id)?t.id:``)||t.getAttribute(`name`)||void 0}function ue(e,t=0){let n=C(e),r=e.getAttribute(`name`)||void 0,i=r&&!p(r)?r:void 0;return{el:e,kind:n,tag:S(e),type:e.getAttribute(`type`)?.toLowerCase()||void 0,otofill:e.getAttribute(`data-otofill`)||void 0,id:e.id&&!p(e.id)?e.id:void 0,name:i,label:(n===`radio`?se(e):ae(e))||void 0,placeholder:e.getAttribute(`placeholder`)||void 0,ariaLabel:e.getAttribute(`aria-label`)||void 0,css:n===`radio`?i?`input[type="radio"][name="${m(i)}"]`:ce(e):h(e),formKey:le(e),index:t}}function de(e,t){e.querySelectorAll(v).forEach(e=>{w(e)&&!e.disabled&&ne(e)&&t.push(e)}),e.querySelectorAll(`*`).forEach(e=>{if(e.tagName.toLowerCase()===`optona-otofill`)return;let n=e.shadowRoot;if(n&&de(n,t),e.tagName===`IFRAME`)try{let n=e.contentDocument;n&&de(n,t)}catch{}})}function fe(e=document){let t=[];de(e,t);let n=new Set,r=[];for(let e of t)if(C(e)===`radio`){let t=k(e);if(n.has(t[0]))continue;n.add(t[0]),r.push(ue(t[0],r.length))}else r.push(ue(e,r.length));return r}function pe(e){let{el:t,kind:n,...r}=e;return r}function A(e,t){e.dispatchEvent(new Event(t,{bubbles:!0}))}function j(e,t){let n={key:t,code:t,bubbles:!0,cancelable:!0};e.dispatchEvent(new KeyboardEvent(`keydown`,n)),e.dispatchEvent(new KeyboardEvent(`keyup`,n))}function M(e,t){let n=Object.getPrototypeOf(e),r;for(;n&&!(r=Object.getOwnPropertyDescriptor(n,`value`));)n=Object.getPrototypeOf(n);r?.set?r.set.call(e,t):e.value=t}function me(e){if(!e||!e.isConnected||!e.getClientRects().length)return!1;let t=getComputedStyle(e);return t.visibility!==`hidden`&&t.display!==`none`}async function N(e,t=800,n=25){let r=Date.now()+t;for(;;){let t=e();if(t)return t;if(Date.now()>r)return null;await g(n)}}function he(e,t,n=e=>e.textContent??``){let r=i(t);if(r)return e.find(e=>i(n(e))===r)??e.find(e=>i(n(e)).startsWith(r))??e.find(e=>a(n(e),t)>=.85)}var ge=e=>e.split(`|`).map(e=>e.trim()).filter(Boolean);function _e(e){let t=e.trim(),n=``,r=``,i=``,a=``,o=t.match(/^(\d{1,2})[./-](\d{1,2})[./-](\d{4})(.*)$/);return o?[,i,r,n,a]=o:(o=t.match(/^(\d{4})[./-](\d{1,2})[./-](\d{1,2})(.*)$/))&&([,n,r,i,a]=o),n?(r=r.padStart(2,`0`),i=i.padStart(2,`0`),a=a.replace(/^T/,` `),[...new Set([`${n}-${r}-${i}${a}`,t,`${i}.${r}.${n}${a}`,`${i}/${r}/${n}${a}`,`${r}/${i}/${n}${a}`,`${n}/${r}/${i}${a}`])]):[t]}function ve(e,t){let n=e=>(e.match(/\d+/g)??[]).map(Number),r=n(e),i=n(t);return i.length>0&&i.every((e,t)=>r[t]===e)}var ye=e=>e.tagName===`INPUT`;function be(e){let t=e.closest(`.el-select`),n=e,r=t.querySelector(`.el-select__wrapper`)??t,i=()=>{let t=n.getAttribute(`aria-controls`);return t?e.ownerDocument.getElementById(t):null};return{root:t,input:n,wrapper:r,listbox:i,isOpen:()=>n.getAttribute(`aria-expanded`)===`true`&&me(i()),items:()=>Array.from(i()?.querySelectorAll(`.el-select-dropdown__item`)??[]).filter(e=>me(e)&&!e.classList.contains(`is-disabled`))}}async function xe(e){e.isOpen()&&(j(e.input,`Escape`),await N(()=>!e.isOpen(),300)||(e.wrapper.click(),await N(()=>!e.isOpen(),300)))}var Se={name:`element-plus-select`,detect:e=>ye(e)&&!!e.closest(`.el-select`),async fill(e,t){let n=be(e),r=ge(t);if(!r.length)return!0;if(n.isOpen()||n.wrapper.click(),!await N(()=>n.isOpen(),800))return!1;let i=n.listbox()?.getAttribute(`aria-multiselectable`)===`true`||n.root.querySelector(`.el-select__selection .el-tag`)!=null||r.length>1,a=!n.input.readOnly;if(i)for(let e of n.items().filter(e=>e.classList.contains(`is-selected`)))r.some(t=>he([e],t))||(e.click(),await g(30));let o=!0;for(let e of r){a&&(M(n.input,e),A(n.input,`input`),await g(120));let t=await N(()=>he(n.items(),e),500);if(!t)o=!1;else if(!(i&&t.classList.contains(`is-selected`))){if(t.click(),await g(40),!i)break;n.isOpen()||n.wrapper.click()}}return await xe(n),o},read(e){let t=e.closest(`.el-select`),n=Array.from(t.querySelectorAll(`.el-tag .el-select__tags-text`)).map(e=>e.textContent?.trim()??``);return n.length?n.join(` | `):t.querySelector(`.el-select__placeholder:not(.is-transparent)`)?.textContent?.trim()??``}};function P(){let e=Array.from(document.querySelectorAll(`.el-popper .el-cascader-panel`)).filter(me);return e[e.length-1]??null}var Ce=[Se,{name:`element-plus-cascader`,detect:e=>ye(e)&&!!e.closest(`.el-cascader`),async fill(e,t){let n=e.closest(`.el-cascader`),r=t.split(/\s*[/>]\s*/).map(e=>e.trim()).filter(Boolean);if(!r.length)return!0;let i=P();if(!i&&(n.click(),i=await N(P,800),!i))return!1;for(let t=0;t<r.length;t++){let n=await N(()=>{let e=i.querySelectorAll(`.el-cascader-menu`)[t];return he(Array.from(e?.querySelectorAll(`.el-cascader-node:not(.is-disabled)`)??[]),r[t],e=>e.querySelector(`.el-cascader-node__label`)?.textContent??e.textContent??``)},600);if(!n)return j(e,`Escape`),document.body.click(),!1;n.click(),await g(60)}return P()&&(j(e,`Escape`),await g(50),P()&&document.body.click()),!0},read:e=>e.value},{name:`element-plus-date`,detect:e=>ye(e)&&!!e.closest(`.el-date-editor`),async fill(e,t){let n=e;for(let e of _e(t))if(n.focus({preventScroll:!0}),M(n,e),A(n,`input`),A(n,`change`),await g(40),j(n,`Escape`),n.blur(),await g(40),n.value&&ve(n.value,e))return!0;return!1},read:e=>e.value}],we=new Set([`1`,`true`,`evet`,`e`,`yes`,`y`,`on`,`x`,`secili`,`checked`]),Te=e=>we.has(i(e))||e.trim()===`✓`;function Ee(e,t){let n=e.trim().match(/^(\d{1,2})[./-](\d{1,2})[./-](\d{4})(?:[ T](\d{1,2}):(\d{2}))?$/);if(!n)return e;let r=`${n[3]}-${n[2].padStart(2,`0`)}-${n[1].padStart(2,`0`)}`;return t===`datetime-local`?`${r}T${(n[4]??`00`).padStart(2,`0`)}:${n[5]??`00`}`:t===`month`?r.slice(0,7):r}var De={name:`native-text`,detect:e=>[`text`,`textarea`,`date`].includes(C(e)),fill(e,t){let n=e,r=(n.getAttribute(`type`)??`text`).toLowerCase(),i=C(e)===`date`?Ee(t,r):t;return n.focus({preventScroll:!0}),M(n,i),A(n,`input`),A(n,`change`),n.blur(),C(e)!==`date`||n.value!==``||i===``},read:e=>e.value};function Oe(e,t){let n=Array.from(e.options),r=i(t);return n.find(e=>e.value===t)??n.find(e=>i(e.text)===r)??n.find(e=>r&&i(e.text).startsWith(r))??n.find(e=>a(e.text,t)>=.85)}var ke={name:`native-select`,detect:e=>e.tagName===`SELECT`,fill(e,t){let n=e,r=Oe(n,t);return r?(M(n,r.value),A(n,`input`),A(n,`change`),!0):!1},read(e){let t=e.selectedOptions[0];return t&&t.value!==``?t.text.trim():``}},Ae={name:`native-checkbox`,detect:e=>C(e)===`checkbox`,fill(e,t){let n=e;return n.checked!==Te(t)&&n.click(),!0},read:e=>e.checked?`true`:`false`},je={name:`native-radio`,detect:e=>C(e)===`radio`,fill(e,t){let n=k(e),r=i(t),o=n.find(e=>e.value===t)??n.find(e=>i(oe(e))===r)??n.find(e=>i(e.value)===r)??n.find(e=>a(oe(e),t)>=.8);return o?(o.checked||o.click(),!0):!1},read(e){let t=k(e).find(e=>e.checked);return t?oe(t)||t.value:``}},Me={name:`contenteditable`,detect:e=>C(e)===`contenteditable`,fill(e,t){let n=e;return n.focus({preventScroll:!0}),n.textContent=t,n.dispatchEvent(new InputEvent(`input`,{bubbles:!0,inputType:`insertText`,data:t})),n.blur(),!0},read:e=>e.textContent??``},Ne=[...Ce,Ae,je,ke,Me,De],F=[];function Pe(e){let t=F.findIndex(t=>t.name===e.name);t>=0?F[t]=e:F.unshift(e)}function Fe(e){return F.find(t=>t.detect(e))??Ne.find(t=>t.detect(e))}async function Ie(e,t){let n=Fe(e);return n?await n.fill(e,t):!1}function I(e){return Fe(e)?.read?.(e)}var Le={otofill:100,id:50,name:40,labelExact:35,css:30,labelFuzzy:25,placeholder:15,ariaLabel:15,type:5,index:5,mismatch:-10,wrongTag:-25,wrongKind:-40},Re=30;function ze(e,t){let n=e.match,r=Le;if(n.otofill&&t.otofill)return n.otofill===t.otofill?r.otofill:0;let o=0;if(n.id&&t.id&&(o+=n.id===t.id?r.id:r.mismatch),n.name&&t.name&&(o+=n.name===t.name?r.name:r.mismatch),n.css)try{t.el.matches(n.css)&&(o+=r.css)}catch{}if(n.label&&t.label){let e=i(n.label),s=i(t.label);if(e===s)o+=r.labelExact;else{let t=a(e,s);t>=.6&&(o+=Math.round(r.labelFuzzy*t))}}return n.placeholder&&t.placeholder&&i(n.placeholder)===i(t.placeholder)&&(o+=r.placeholder),n.ariaLabel&&t.ariaLabel&&i(n.ariaLabel)===i(t.ariaLabel)&&(o+=r.ariaLabel),n.type&&t.type&&n.type===t.type&&(o+=r.type),n.index!=null&&n.index===t.index&&n.formKey===t.formKey&&(o+=r.index),n.tag&&t.tag&&n.tag!==t.tag&&(o+=r.wrongTag),e.kind&&e.kind!==t.kind&&(o+=r.wrongKind),o}function Be(e,t,n=location.href){let r=e.filter(e=>ee(e.pages,n)),i=[];for(let e of r)for(let n of t){let t=ze(e,n);t>=30&&i.push({def:e,fp:n,score:t})}i.sort((e,t)=>t.score-e.score);let a=new Set,o=new Set,s=[];for(let e of i)a.has(e.def.id)||o.has(e.fp)||(a.add(e.def.id),o.add(e.fp),s.push(e));return s.sort((e,t)=>(e.fp.index??0)-(t.fp.index??0)),{defs:r,matches:s,missing:r.filter(e=>!a.has(e.id)),free:t.filter(e=>!o.has(e))}}var Ve=n({STATE_VERSION:()=>1,STORAGE_KEY:()=>He,addRow:()=>et,clearAll:()=>Je,createDataset:()=>Ze,datasetKeys:()=>H,load:()=>z,migrate:()=>Ke,removeDataset:()=>$e,removeField:()=>Xe,removeRow:()=>tt,save:()=>B,subscribe:()=>qe,update:()=>V,upsertDataset:()=>Qe,upsertField:()=>Ye}),He=`optona-otofill`,L=new Set,Ue=null;function R(){return{v:1,fields:[],datasets:[],prefs:{cursor:{},closeAfterFill:!0}}}function We(){try{return localStorage.getItem(He)}catch{return Ue}}function Ge(e){try{localStorage.setItem(He,e)}catch{Ue=e}}function Ke(e){let t=R();if(!e||typeof e!=`object`)return t;let n=e;return{v:1,fields:Array.isArray(n.fields)?n.fields.map(e=>({...e,pages:(e.pages??[]).map(u)})):[],datasets:Array.isArray(n.datasets)?n.datasets:[],prefs:{...t.prefs,...n.prefs??{},cursor:{...n.prefs?.cursor??{}}}}}function z(){let e=We();if(!e)return R();try{return Ke(JSON.parse(e))}catch{return R()}}function B(e){Ge(JSON.stringify(e)),L.forEach(t=>t(e))}function V(e){let t=z();return e(t),B(t),t}function qe(e){return L.add(e),()=>L.delete(e)}typeof window<`u`&&window.addEventListener(`storage`,e=>{if(e.key===`optona-otofill`){let e=z();L.forEach(t=>t(e))}});function Je(){B(R())}function Ye(e){let t={...e,id:e.id??s(),updatedAt:c()};return V(e=>{let n=e.fields.findIndex(e=>e.id===t.id);n>=0?e.fields[n]=t:e.fields.push(t)}),t}function Xe(e){V(t=>{t.fields=t.fields.filter(t=>t.id!==e)})}function Ze(e,t=[]){let n={id:s(),name:e,rows:t,updatedAt:c()};return V(e=>{e.datasets.push(n)}),n}function Qe(e){V(t=>{let n={...e,updatedAt:c()},r=t.datasets.findIndex(t=>t.id===e.id);r>=0?t.datasets[r]=n:t.datasets.push(n)})}function $e(e){V(t=>{t.datasets=t.datasets.filter(t=>t.id!==e),delete t.prefs.cursor[e]})}function et(e,t){let n={...t,_id:t._id??s()};return V(t=>{let r=t.datasets.find(t=>t.id===e);r&&(r.rows.push(n),r.updatedAt=c())}),n}function tt(e,t){V(n=>{let r=n.datasets.find(t=>t.id===e);r&&(r.rows=r.rows.filter(e=>e._id!==t))})}function H(e){let t=new Set;return e.rows.forEach(e=>Object.keys(e).forEach(e=>!e.startsWith(`_`)&&t.add(e))),[...t]}function U(e=z().fields,t=location.href){return Be(e,fe(document),t)}async function W(e,t={}){let n=t.retries??3,r=t.delay??300,i=new Set,a=new Set,o=U(),s=new Set;for(let c=0;c<=n;c++){a.clear();for(let n of o.matches){let r=n.def.key;if(i.has(n.def.id))continue;let o=e[r];if(o===void 0||o===``){s.add(r);continue}let c=!1;try{c=await Ie(n.fp.el,o)}catch(e){console.warn(`[otofill]`,r,e)}c?(i.add(n.def.id),t.onFilled?.(n.fp.el)):a.add(r)}let l=o.missing.filter(t=>!!e[t.key]&&!i.has(t.id));if(a.size===0&&l.length===0||c===n)break;await g(r),o=U()}let c=o,l=c.defs.filter(e=>i.has(e.id));return{filled:l.map(e=>e.key),notFound:c.missing.filter(t=>!i.has(t.id)&&!!e[t.key]).map(e=>e.key),failed:[...a],noValue:[...s].filter(e=>!l.some(t=>t.key===e))}}function nt(e=U()){let t={};for(let n of e.matches){if(n.fp.type===`password`)continue;let e=I(n.fp.el);e!==void 0&&e!==``&&(t[n.def.key]=e)}return t}function rt(e,t){let n=new Set(t);return e.map(e=>{let t=new Set;return e.rows.forEach(e=>Object.keys(e).forEach(e=>t.add(e))),{ds:e,overlap:[...n].filter(e=>t.has(e)).length}}).sort((e,t)=>t.overlap-e.overlap||e.ds.name.localeCompare(t.ds.name,`tr`))}function G(e,t=[]){return e._label?e._label:(t.length?t:Object.keys(e).filter(e=>!e.startsWith(`_`))).map(t=>e[t]).filter(e=>e&&e!==`true`&&e!==`false`).slice(0,2).join(` · `)||`(adsız satır)`}var K=`optona-otofill`,it=1,at=n({ImportError:()=>q,applyBundle:()=>ct,csvToDataset:()=>ft,datasetToCsv:()=>ut,download:()=>pt,exportCsv:()=>mt,exportJson:()=>Y,importFile:()=>gt,importText:()=>ht,makeBundle:()=>ot,parseCsv:()=>dt,summaryText:()=>_t,validateBundle:()=>st});function ot(e=z(),t={fields:!0,datasets:!0}){let n={format:K,version:1,exportedAt:c()};if(t.datasets&&(n.datasets=Array.isArray(t.datasets)?e.datasets.filter(e=>t.datasets.includes(e.id)):e.datasets),t.fields)n.fields=e.fields;else if(t.fields===void 0&&n.datasets){let t=new Set(n.datasets.flatMap(e=>H(e)));n.fields=e.fields.filter(e=>t.has(e.key)),n.fieldsPartial=!0}return n}var q=class extends Error{};function J(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function st(e){if(!J(e))throw new q(`Dosya bir JSON nesnesi değil.`);if(e.format!==`optona-otofill`)throw new q(`Bu bir Otofill dosyası değil (format: "${String(e.format)}").`);let t=Number(e.version);if(!t||t>1)throw new q(`Dosya sürümü (${String(e.version)}) bu kütüphaneden yeni. Kütüphaneyi güncelleyin.`);let n={format:K,version:1,exportedAt:String(e.exportedAt??c())};if(e.fields!==void 0){if(!Array.isArray(e.fields))throw new q(`"fields" bir dizi olmalı.`);n.fields=e.fields.map((e,t)=>{if(!J(e)||typeof e.key!=`string`||!e.key.trim())throw new q(`fields[${t}]: "key" eksik.`);return{id:typeof e.id==`string`&&e.id?e.id:s(),key:e.key.trim(),title:typeof e.title==`string`?e.title:void 0,pages:Array.isArray(e.pages)?e.pages.map(e=>u(String(e))):[],kind:typeof e.kind==`string`?e.kind:void 0,match:J(e.match)?e.match:{},updatedAt:typeof e.updatedAt==`string`?e.updatedAt:void 0}})}if(e.datasets!==void 0){if(!Array.isArray(e.datasets))throw new q(`"datasets" bir dizi olmalı.`);n.datasets=e.datasets.map((e,t)=>{if(!J(e)||typeof e.name!=`string`)throw new q(`datasets[${t}]: "name" eksik.`);if(!Array.isArray(e.rows))throw new q(`datasets[${t}]: "rows" bir dizi olmalı.`);return{id:typeof e.id==`string`&&e.id?e.id:s(),name:e.name,updatedAt:typeof e.updatedAt==`string`?e.updatedAt:void 0,rows:e.rows.map((e,n)=>{if(!J(e))throw new q(`datasets[${t}].rows[${n}] bir nesne değil.`);let r={_id:typeof e._id==`string`&&e._id?e._id:s()};for(let[t,n]of Object.entries(e))t!==`_id`&&n!=null&&(r[t]=String(n));return r})}})}if(e.fieldsPartial===!0&&n.fields&&(n.fieldsPartial=!0),!n.fields&&!n.datasets)throw new q(`Dosyada ne alan tanımı ne de veri seti var.`);return n}function ct(e,t,n){let r={fieldsAdded:0,fieldsUpdated:0,datasetsAdded:0,datasetsUpdated:0,rows:0},i=t.datasets??[];t.fieldsPartial&&t.fields&&(lt(e,t.fields,r,!0),t={...t,fields:void 0});let a=t.fields??[];if(r.rows=i.reduce((e,t)=>e+t.rows.length,0),n===`copy`)return a.forEach(t=>e.fields.push({...t,id:s()})),i.forEach(t=>e.datasets.push({...t,id:s(),rows:t.rows.map(e=>({...e,_id:s()}))})),r.fieldsAdded+=a.length,r.datasetsAdded=i.length,r;if(n===`replace`)return t.fields&&(e.fields=[...a],r.fieldsAdded=a.length),t.datasets&&(e.datasets=[...i],r.datasetsAdded=i.length),r;lt(e,a,r);for(let t of i){let n=e.datasets.find(e=>e.id===t.id)??e.datasets.find(e=>e.name===t.name);if(!n)e.datasets.push(t),r.datasetsAdded++;else{for(let e of t.rows){let t=n.rows.findIndex(t=>t._id===e._id);t>=0?n.rows[t]=e:n.rows.push(e)}n.updatedAt=c(),r.datasetsUpdated++}}return r}function lt(e,t,n,r=!1){for(let i of t){let t=e.fields.findIndex(e=>e.id===i.id||e.key===i.key&&e.pages.join(`|`)===i.pages.join(`|`));if(t>=0){if(r)continue;e.fields[t]={...i,id:e.fields[t].id},n.fieldsUpdated++}else e.fields.push(i),n.fieldsAdded++}}function ut(e,t=H(e)){let n=e=>{let t=e??``;return/[;"\r\n]/.test(t)?`"${t.replace(/"/g,`""`)}"`:t},r=[`_label`,...t],i=[r.map(n).join(`;`)];for(let t of e.rows)i.push(r.map(e=>n(t[e])).join(`;`));return``+i.join(`\r
|
|
2
|
+
`)}function dt(e){e=e.replace(/^/,``);let t=e.split(/\r?\n/,1)[0]??``,n=e=>t.split(e).length-1,r=[`;`,`,`,` `].sort((e,t)=>n(t)-n(e))[0],i=[],a=[],o=``,s=!1;for(let t=0;t<e.length;t++){let n=e[t];s?n===`"`&&e[t+1]===`"`?(o+=`"`,t++):n===`"`?s=!1:o+=n:n===`"`?s=!0:n===r?(a.push(o),o=``):n===`
|
|
3
3
|
`||n===`\r`?(n===`\r`&&e[t+1]===`
|
|
4
|
-
`&&t++,a.push(o),i.push(a),a=[],o=``):o+=n}return(o!==``||a.length)&&(a.push(o),i.push(a)),i.filter(e=>e.some(e=>e.trim()!==``))}function
|
|
4
|
+
`&&t++,a.push(o),i.push(a),a=[],o=``):o+=n}return(o!==``||a.length)&&(a.push(o),i.push(a)),i.filter(e=>e.some(e=>e.trim()!==``))}function ft(e,t){let n=dt(e);if(n.length<1)throw new q(`CSV boş.`);let r=n[0].map(e=>e.trim());if(r.filter(e=>e&&!e.startsWith(`_`)).length===0)throw new q(`CSV başlık satırında anahtar yok.`);return{id:s(),name:t,updatedAt:c(),rows:n.slice(1).map(e=>{let t={_id:s()};return r.forEach((n,r)=>{if(!n)return;let i=e[r]??``;n===`_label`||n.toLocaleLowerCase(`tr`)===`etiket`?t._label=i:n===`_id`?t._id=i||t._id:i!==``&&(t[n]=i)}),t})}}function pt(e,t,n=`application/json`){let r=new Blob([t],{type:`${n};charset=utf-8`}),i=document.createElement(`a`);i.href=URL.createObjectURL(r),i.download=e,document.body.appendChild(i),i.click(),setTimeout(()=>{URL.revokeObjectURL(i.href),i.remove()},0)}function Y(e,t){let n=ot(z(),e),r=new Date().toISOString().slice(0,10);pt(t??`otofill-${r}.json`,JSON.stringify(n,null,2))}function mt(e){let t=z().datasets.find(t=>t.id===e);t&&pt(`${t.name.replace(/[\\/:*?"<>|]+/g,`_`)}.csv`,ut(t),`text/csv`)}function ht(e,t,n=`veri.json`){let r,i=e.replace(/^/,``).trimStart();if(/\.csv$/i.test(n)||!(i.startsWith(`{`)||i.startsWith(`[`))){let t=n.replace(/\.[^.]+$/,``)||`CSV verisi`;r={format:K,version:1,exportedAt:c(),datasets:[ft(e,t)]}}else{let e;try{e=JSON.parse(i)}catch(e){throw new q(`JSON okunamadı: `+e.message)}r=st(e)}let a=z(),o=ct(a,r,t);return B(a),o}async function gt(e,t){return ht(await e.text(),t,e.name)}function _t(e){let t=[];return e.fieldsAdded&&t.push(`${e.fieldsAdded} alan eklendi`),e.fieldsUpdated&&t.push(`${e.fieldsUpdated} alan güncellendi`),e.datasetsAdded&&t.push(`${e.datasetsAdded} veri seti eklendi`),e.datasetsUpdated&&t.push(`${e.datasetsUpdated} veri seti güncellendi`),e.rows&&t.push(`${e.rows} satır`),t.join(`, `)||`Değişiklik yok`}function X(e,t={},...n){let r=document.createElement(e);for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&(e.startsWith(`on`)&&typeof n==`function`?r.addEventListener(e.slice(2).toLowerCase(),n):e===`class`?r.className=String(n):e===`value`?r.value=String(n):e===`checked`?r.checked=!!n:e===`style`&&typeof n==`object`?Object.assign(r.style,n):r.setAttribute(e,n===!0?``:String(n)));return vt(r,n),r}function vt(e,t){for(let n of t)n!=null&&n!==!1&&(Array.isArray(n)?vt(e,n):e.appendChild(typeof n==`object`?n:document.createTextNode(String(n))))}function yt(e){let t=e.toLowerCase().split(`+`).map(e=>e.trim()),n=t[t.length-1],r=/^[a-z]$/.test(n)?`Key${n.toUpperCase()}`:/^\d$/.test(n)?`Digit${n}`:n[0].toUpperCase()+n.slice(1);return{ctrl:t.includes(`ctrl`),shift:t.includes(`shift`),alt:t.includes(`alt`),meta:t.includes(`meta`)||t.includes(`cmd`),code:r}}function bt(e,t){return e.code===t.code&&e.ctrlKey===t.ctrl&&e.shiftKey===t.shift&&e.altKey===t.alt&&e.metaKey===t.meta}var xt=`
|
|
5
5
|
:host { all: initial; }
|
|
6
6
|
* { box-sizing: border-box; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
|
|
7
7
|
.panel {
|
|
8
8
|
position: fixed; top: 16px; right: 16px; width: 380px; max-height: calc(100vh - 32px);
|
|
9
9
|
display: flex; flex-direction: column; background: #fff; color: #1f2937; font-size: 13px; line-height: 1.4;
|
|
10
10
|
border: 1px solid #d1d5db; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.22); z-index: 2147483646; overflow: hidden;
|
|
11
|
+
resize: both; min-width: 300px; min-height: 160px; max-width: calc(100vw - 16px);
|
|
11
12
|
}
|
|
13
|
+
.ico { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
|
|
14
|
+
.head button .ico { vertical-align: middle; }
|
|
15
|
+
.mini {
|
|
16
|
+
position: fixed; z-index: 2147483646; display: flex; align-items: center; gap: 2px; padding: 3px;
|
|
17
|
+
background: #111827; border-radius: 20px; box-shadow: 0 6px 20px rgba(0,0,0,.3); cursor: move; user-select: none;
|
|
18
|
+
}
|
|
19
|
+
.mini button { border: 0; cursor: pointer; color: #fff; font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
|
|
20
|
+
.mini .mfill { background: #2563eb; border-radius: 16px; padding: 5px 11px; font-weight: 600; }
|
|
21
|
+
.mini .mfill:hover { background: #1d4ed8; }
|
|
22
|
+
.mini .mfill.off { background: #4b5563; }
|
|
23
|
+
.mini .mico { background: transparent; color: #d1d5db; width: 26px; height: 26px; border-radius: 13px; justify-content: center; font-size: 16px; }
|
|
24
|
+
.mini .mico:hover { background: #374151; color: #fff; }
|
|
12
25
|
.head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #111827; color: #fff; cursor: move; user-select: none; }
|
|
13
26
|
.head b { font-size: 13px; letter-spacing: .2px; }
|
|
14
27
|
.head .sub { color: #9ca3af; font-size: 11px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
@@ -58,4 +71,11 @@ label.opt { display: flex; gap: 6px; align-items: flex-start; cursor: pointer; }
|
|
|
58
71
|
.pop { position: fixed; width: 300px; background: #fff; border: 1px solid #d1d5db; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); padding: 10px; pointer-events: auto; display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: #1f2937; }
|
|
59
72
|
.pop .lbl { font-size: 11px; color: #6b7280; }
|
|
60
73
|
.pop input[type=text], .pop select { width: 100%; }
|
|
61
|
-
`,yt={text:`metin`,textarea:`çok satır`,select:`seçim`,checkbox:`onay kutusu`,radio:`seçenek grubu`,date:`tarih`,contenteditable:`zengin metin`,other:`diğer`},bt=class{constructor(e){this.opts=e,this.visible=!1,this.view=`fill`,this.result=null,this.lastFill=null,this.toastMsg=``,this.toastKind=`ok`,this.toastTimer=0,this.pattern=``,this.importMode=`merge`,this.inspecting=!1,this.teaching=!1,this.teachPop=null,this.freeSel=new Map,this.pos=null,this.raf=0,this.onKey=e=>{if(_t(e,this.opts.hotkey)){e.preventDefault(),e.stopPropagation(),this.toggle();return}if(e.key===`Escape`){this.teachPop?(this.closeTeachPop(),e.preventDefault()):this.teaching&&(this.stopTeach(),e.preventDefault());return}if(!this.visible||this.view!==`fill`||this.teaching)return;let t=this.root.activeElement??document.activeElement;if(t&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)))return;let n=this.currentDataset();if(n){if(/^Digit[1-9]$/.test(e.code)&&!e.ctrlKey&&!e.altKey&&!e.metaKey){let t=Number(e.code.slice(5))-1;n.rows[t]&&(e.preventDefault(),this.fillWith(n,t))}else e.key===`Enter`&&!e.ctrlKey&&(e.preventDefault(),this.fillNext(n))}},this.startDrag=e=>{if(e.target.tagName===`BUTTON`)return;let t=this.box.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=e=>{this.pos={left:Math.max(0,Math.min(window.innerWidth-60,e.clientX-n)),top:Math.max(0,Math.min(window.innerHeight-40,e.clientY-r))},Object.assign(this.box.style,{left:`${this.pos.left}px`,top:`${this.pos.top}px`,right:`auto`})},a=()=>{window.removeEventListener(`mousemove`,i,!0),window.removeEventListener(`mouseup`,a,!0)};window.addEventListener(`mousemove`,i,!0),window.addEventListener(`mouseup`,a,!0),e.preventDefault()},this.hoverEl=null,this.onViewport=()=>{(this.inspecting||this.hoverEl||this.teaching)&&(cancelAnimationFrame(this.raf),this.raf=requestAnimationFrame(()=>this.drawLayer()))},this.onTeachMove=e=>{if(this.fromPanel(e)||this.teachPop)return;let t=ae(e.composedPath()[0]);t!==this.hoverEl&&this.hover(t)},this.onTeachPointer=e=>{if(this.fromPanel(e)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),e.type!==`click`))return;let t=ae(e.composedPath()[0]);t?this.openTeachPop(t):this.teachPop&&this.closeTeachPop()}}mount(){if(!this.host){this.host=document.createElement(g),this.host.setAttribute(`data-otofill-host`,``),this.root=this.host.attachShadow({mode:`open`}),this.root.appendChild(X(`style`,{},vt)),this.layer=X(`div`,{class:`layer`}),this.box=X(`div`,{class:`panel`,style:{display:`none`}}),this.root.append(this.layer,this.box),document.documentElement.appendChild(this.host);for(let e of[`keydown`,`keyup`,`keypress`])this.host.addEventListener(e,e=>e.stopPropagation());window.addEventListener(`keydown`,this.onKey,!0),window.addEventListener(`scroll`,this.onViewport,!0),window.addEventListener(`resize`,this.onViewport),qe(()=>this.visible&&this.refresh())}}show(){this.mount(),this.visible=!0,this.pattern||=d(),this.box.style.display=`flex`,this.refresh()}hide(){this.visible=!1,this.box.style.display=`none`,this.stopTeach(),this.inspecting=!1,this.drawLayer()}toggle(){this.visible?this.hide():this.show()}isOpen(){return this.visible}refresh(){this.result=H(),this.render(),this.drawLayer()}toast(e,t=`ok`){this.toastMsg=e,this.toastKind=t,clearTimeout(this.toastTimer),this.toastTimer=window.setTimeout(()=>{this.toastMsg=``,this.visible&&this.render()},5e3),this.visible&&this.render()}currentDataset(){let e=L(),t=this.pageKeys(),n=nt(e.datasets,t).filter(e=>e.overlap>0),r=this.dsId??e.prefs.lastDatasetId;return n.find(e=>e.ds.id===r)?.ds??n[0]?.ds}pageKeys(){return[...new Set((this.result?.matches??[]).map(e=>e.def.key))]}async fillWith(e,t){let n=e.rows[t];if(!n)return;z(n=>{n.prefs.lastDatasetId=e.id,n.prefs.cursor[e.id]=(t+1)%e.rows.length});let r=await U(n,{onFilled:e=>this.flash(e)});this.lastFill=r;let i=r.notFound.length+r.failed.length;L().prefs.closeAfterFill&&i===0?this.hide():this.toast(`"${W(n)}": ${r.filled.length} alan dolduruldu`+(i?`, ${i} sorunlu`:``),i?`err`:`ok`)}fillNext(e){let t=L().prefs.cursor[e.id]??0;return this.fillWith(e,t<e.rows.length?t:0)}fillRandom(e){return this.fillWith(e,Math.floor(Math.random()*e.rows.length))}render(){let e=this.result,t=X(`div`,{class:`head`,onMousedown:this.startDrag},X(`b`,{},`Otofill`),X(`span`,{class:`sub`},`${e.matches.length}/${e.defs.length} alan · ${location.host}`),X(`button`,{title:`Yeniden tara`,onClick:()=>this.refresh()},`⟳`),X(`button`,{title:`Kapat (Ctrl+Q)`,onClick:()=>this.hide()},`×`)),n=(e,t)=>X(`button`,{class:this.view===e?`on`:``,onClick:()=>{this.view=e,this.render(),this.drawLayer()}},t),r=X(`div`,{class:`tabs`},n(`fill`,`Doldur`),n(`fields`,`Alanlar`),n(`data`,`Veri`),n(`io`,`Aktar`)),i=X(`div`,{class:`body`});this.toastMsg&&i.appendChild(X(`div`,{class:`toast ${this.toastKind}`},this.toastMsg)),this.view===`fill`?this.renderFill(i):this.view===`fields`?this.renderFields(i):this.view===`data`?this.renderData(i):this.renderIo(i);let a=this.box.querySelector(`.body`)?.scrollTop??0;this.box.replaceChildren(t,r,i),i.scrollTop=a,this.pos&&Object.assign(this.box.style,{left:`${this.pos.left}px`,top:`${this.pos.top}px`,right:`auto`})}renderFill(e){let t=this.result,n=L();if(t.defs.length===0){e.append(X(`div`,{class:`empty`},`Bu sayfa için tanımlı alan yok.`,X(`br`),`Önce alanları tanıtın ya da tanımları içe aktarın.`),X(`div`,{class:`row`},X(`button`,{class:`btn pri grow`,onClick:()=>{this.view=`fields`,this.startTeach()}},`Tıklayarak alan tanıt`),X(`button`,{class:`btn grow`,onClick:()=>{this.view=`io`,this.render()}},`İçe aktar`)));return}let r=nt(n.datasets,this.pageKeys()).filter(e=>e.overlap>0);if(r.length===0){e.append(X(`div`,{class:`empty`},`${t.matches.length} alan tanındı ama bu alanlara uyan veri seti yok.`,X(`br`),`Veri sekmesinden sayfadaki değerleri kaydedin ya da veri içe aktarın.`),X(`div`,{class:`row`},X(`button`,{class:`btn grow`,onClick:()=>{this.view=`data`,this.render()}},`Veri sekmesi`)));return}let i=this.currentDataset(),a=this.pageKeys(),o=n.prefs.cursor[i.id]??0;e.append(X(`div`,{class:`row`},X(`select`,{class:`grow`,onChange:e=>{this.dsId=e.target.value,this.render()}},r.map(e=>X(`option`,{value:e.ds.id,selected:e.ds.id===i.id||void 0},`${e.ds.name} (${e.overlap} alan · ${e.ds.rows.length} satır)`)))),i.rows.length===0?X(`div`,{class:`empty`},`Bu veri setinde satır yok.`):X(`div`,{class:`list`},i.rows.map((e,t)=>X(`div`,{class:`item click`+(t===o?` cur`:``),title:`Bu satırla doldur`,onClick:()=>this.fillWith(i,t)},X(`span`,{class:`num`},t<9?String(t+1):`·`),X(`span`,{class:`grow`},W(e,a)),t===o?X(`span`,{class:`muted`},`sıradaki`):null))),X(`div`,{class:`row`},X(`button`,{class:`btn pri grow`,disabled:!i.rows.length||void 0,onClick:()=>this.fillNext(i)},`Sıradaki satır (Enter)`),X(`button`,{class:`btn`,disabled:!i.rows.length||void 0,onClick:()=>this.fillRandom(i)},`Rastgele`)),X(`label`,{class:`opt muted`},X(`input`,{type:`checkbox`,checked:n.prefs.closeAfterFill,onChange:e=>z(t=>{t.prefs.closeAfterFill=e.target.checked})}),`Sorunsuz doldurunca paneli kapat · 1-9: satır seç`));let s=this.lastFill;if(s){let t=(e,t,n)=>n.length?X(`div`,{class:e},`${t}: `,X(`span`,{class:`key`},n.join(`, `))):null;e.append(X(`div`,{},t(`ok`,`Dolduruldu`,s.filled),t(`bad`,`Sayfada bulunamadı`,s.notFound),t(`bad`,`Yazılamadı`,s.failed),t(`muted`,`Satırda değeri yok`,s.noValue)))}t.missing.length&&e.append(X(`div`,{class:`muted`},`Tanımlı ama bulunamayan: ${t.missing.map(e=>e.key).join(`, `)}`))}renderFields(e){let t=this.result,n=ee(),r=d();e.append(X(`div`,{class:`row`},X(`button`,{class:`btn pri grow`,onClick:()=>this.startTeach()},`Tıklayarak tanıt`),X(`button`,{class:`btn`+(this.inspecting?` pri`:``),onClick:()=>{this.inspecting=!this.inspecting,this.render(),this.drawLayer()}},this.inspecting?`Göstermeyi kapat`:`Sayfada göster`)),X(`div`,{class:`muted`},`Yeni tanımların geçerli olacağı adres (* joker):`),X(`div`,{class:`row`},X(`input`,{type:`text`,class:`grow`,value:this.pattern,onChange:e=>{this.pattern=e.target.value.trim()}}),X(`button`,{class:`btn sm`,title:r,onClick:()=>{this.pattern=r,this.render()}},`Bu sayfa`),X(`button`,{class:`btn sm`,title:n,onClick:()=>{this.pattern=n,this.render()}},`Tüm site`)),X(`div`,{class:`sec`},`Bu sayfadaki tanımlar (${t.defs.length})`)),t.defs.length===0?e.append(X(`div`,{class:`muted`},`Henüz yok.`)):e.append(X(`div`,{class:`list`},t.defs.map(e=>{let n=t.matches.find(t=>t.def.id===e.id);return X(`div`,{class:`item`,onMouseenter:()=>n&&this.hover(n.fp.el),onMouseleave:()=>this.hover(null)},X(`span`,{class:n?`ok`:`bad`,title:n?`puan ${n.score}`:`sayfada bulunamadı`},n?`●`:`○`),X(`span`,{class:`grow`},X(`span`,{class:`key`},e.key),e.title?X(`span`,{class:`muted`},` · ${e.title}`):null),X(`span`,{class:`muted`},n?String(n.score):`—`),X(`button`,{class:`btn sm dng`,title:`Tanımı sil`,onClick:()=>{confirm(`"${e.key}" tanımı silinsin mi?`)&&B(e.id)}},`Sil`))})));let i=new Set(t.defs.map(e=>e.key)),a=new Set;for(let e of t.free)if(!this.freeSel.has(e)){let t=o(e.label||e.name||e.placeholder||e.id)||`alan_${(e.index??0)+1}`,n=2,r=t;for(;i.has(t)||a.has(t);)t=`${r}_${n++}`;a.add(t),this.freeSel.set(e,{on:!1,key:t})}e.append(X(`div`,{class:`sec`},`Tanımsız alanlar (${t.free.length})`)),t.free.length===0?e.append(X(`div`,{class:`muted`},`Sayfadaki tüm görünür alanlar tanımlı.`)):e.append(X(`div`,{class:`list`},t.free.map(e=>{let t=this.freeSel.get(e);return X(`div`,{class:`item`,onMouseenter:()=>this.hover(e.el),onMouseleave:()=>this.hover(null)},X(`input`,{type:`checkbox`,checked:t.on,onChange:e=>{t.on=e.target.checked}}),X(`div`,{class:`grow`,style:{display:`flex`,flexDirection:`column`,gap:`2px`,minWidth:`0`}},X(`input`,{type:`text`,value:t.key,onInput:e=>{t.key=e.target.value.trim(),t.on=!0,e.target.parentElement.previousSibling.checked=!0}}),X(`span`,{class:`muted`},`${e.label||e.placeholder||e.name||`(etiketsiz)`} · ${yt[e.kind]}`)))})),X(`div`,{class:`row`},X(`button`,{class:`btn`,onClick:()=>{let e=[...this.freeSel.values()].every(e=>e.on);t.free.forEach(t=>this.freeSel.get(t).on=!e),this.render()}},`Tümünü seç / bırak`),X(`button`,{class:`btn pri grow`,onClick:()=>this.saveFree()},`Seçilenleri kaydet`)))}saveFree(){let e=this.result.free.filter(e=>this.freeSel.get(e)?.on&&this.freeSel.get(e).key);if(!e.length)return this.toast(`Kaydedilecek alan seçilmedi.`,`err`);z(t=>{for(let n of e)t.fields.push(this.defFrom(n,this.freeSel.get(n).key))}),e.forEach(e=>this.freeSel.delete(e)),this.toast(`${e.length} alan tanımlandı.`)}defFrom(e,t,n,r,i){return{id:i??s(),key:t,title:n??e.label,pages:r??[this.pattern||d()],kind:e.kind,match:me(e),updatedAt:c()}}renderData(e){let t=this.result,n=L(),r=this.pageKeys(),i=n.datasets.find(e=>e.id===(this.openDsId??n.prefs.lastDatasetId))?.id??n.datasets[0]?.id??`__new`,a=``,o=``;e.append(X(`div`,{class:`sec`},`Sayfadaki değerleri satır olarak kaydet`),X(`div`,{class:`muted`},r.length?`Tanınan ${r.length} alanın o anki değerleri okunur. Formu elle doldurup buradan kaydedebilirsiniz.`:`Önce bu sayfadaki alanları tanıtın.`),X(`div`,{class:`row`},X(`select`,{class:`grow`,onChange:e=>{i=e.target.value,s.style.display=i===`__new`?``:`none`}},n.datasets.map(e=>X(`option`,{value:e.id,selected:e.id===i||void 0},e.name)),X(`option`,{value:`__new`,selected:i===`__new`||void 0},`+ Yeni veri seti`))));let s=X(`input`,{type:`text`,placeholder:`Yeni veri setinin adı`,style:{display:i===`__new`?``:`none`},onInput:e=>{a=e.target.value}});e.append(s,X(`div`,{class:`row`},X(`input`,{type:`text`,class:`grow`,placeholder:`Satır adı (ör. "Bireysel - İstanbul")`,onInput:e=>{o=e.target.value}}),X(`button`,{class:`btn pri`,disabled:!r.length||void 0,onClick:()=>{let e=tt(t),n=i;i===`__new`&&(n=Xe(a.trim()||`Veri ${new Date().toLocaleDateString(`tr-TR`)}`).id),$e(n,{...e,...o.trim()?{_label:o.trim()}:{}}),this.openDsId=n,this.toast(`${Object.keys(e).length} değer satır olarak kaydedildi.`)}},`Kaydet`)),X(`div`,{class:`sec`},`Veri setleri (${n.datasets.length})`)),n.datasets.length?e.append(X(`div`,{class:`list`},n.datasets.map(e=>{let t=this.openDsId===e.id,n=(r.length?r.filter(t=>V(e).includes(t)):V(e)).slice(0,5);return X(`div`,{},X(`div`,{class:`item click`,onClick:()=>{this.openDsId=t?void 0:e.id,this.render()}},X(`span`,{},t?`▾`:`▸`),X(`span`,{class:`grow`},e.name),X(`span`,{class:`muted`},`${e.rows.length} satır`),X(`button`,{class:`btn sm`,title:`CSV indir`,onClick:t=>{t.stopPropagation(),ft(e.id)}},`CSV`),X(`button`,{class:`btn sm dng`,onClick:t=>{t.stopPropagation(),confirm(`"${e.name}" veri seti silinsin mi?`)&&Qe(e.id)}},`Sil`)),t?X(`div`,{style:{padding:`0 8px 8px`,overflowX:`auto`}},X(`table`,{},X(`tr`,{},X(`th`,{},`Satır`),n.map(e=>X(`th`,{title:e},e)),X(`th`,{})),e.rows.map(t=>X(`tr`,{},X(`td`,{title:W(t)},W(t)),n.map(e=>X(`td`,{title:t[e]??``},t[e]??``)),X(`td`,{},X(`button`,{class:`btn sm dng`,title:`Satırı sil`,onClick:()=>et(e.id,t._id)},`×`))))),X(`div`,{class:`muted`,style:{marginTop:`4px`}},`Ayrıntılı düzenleme için yönetim sayfasını kullanın.`)):null)}))):e.append(X(`div`,{class:`muted`},`Henüz veri seti yok. Yukarıdan kaydedin ya da Aktar sekmesinden içe aktarın.`))}renderIo(e){let t=L(),n=t.datasets[0]?.id,r=``,i=async e=>{try{this.toast(await e())}catch(e){this.toast(e instanceof K?e.message:`İçe aktarılamadı: `+e.message,`err`)}},a=X(`input`,{type:`file`,accept:`.json,.csv,application/json,text/csv`,multiple:!0,style:{display:`none`},onChange:e=>{let t=Array.from(e.target.files??[]);i(async()=>{let e=[];for(let n of t)e.push(`${n.name}: ${Y(await mt(n,this.importMode))}`);return e.join(` · `)})}}),o=X(`div`,{class:`drop`,onClick:()=>a.click(),onDragover:e=>{e.preventDefault(),o.classList.add(`over`)},onDragleave:()=>o.classList.remove(`over`),onDrop:e=>{e.preventDefault(),o.classList.remove(`over`);let t=Array.from(e.dataTransfer?.files??[]);i(async()=>{let e=[];for(let n of t)e.push(`${n.name}: ${Y(await mt(n,this.importMode))}`);return e.join(` · `)})}},`JSON / CSV dosyasını buraya bırakın ya da tıklayıp seçin`),s=(e,t,n)=>X(`label`,{class:`opt`},X(`input`,{type:`radio`,name:`mode`,checked:this.importMode===e,onChange:()=>{this.importMode=e}}),X(`span`,{},X(`b`,{},t),X(`span`,{class:`muted`},` · ${n}`)));e.append(X(`div`,{class:`sec`},`Dışa aktar`),X(`div`,{class:`row`},X(`button`,{class:`btn pri`,onClick:()=>J({fields:!0,datasets:!0})},`Hepsi (JSON)`),X(`button`,{class:`btn`,onClick:()=>J({fields:!0},`otofill-alanlar-${location.hostname}.json`)},`Alan tanımları`),X(`button`,{class:`btn`,onClick:()=>J({datasets:!0},`otofill-veri.json`)},`Veri setleri`)),t.datasets.length?X(`div`,{class:`row`},X(`select`,{class:`grow`,onChange:e=>{n=e.target.value}},t.datasets.map(e=>X(`option`,{value:e.id},e.name))),X(`button`,{class:`btn`,onClick:()=>n&&ft(n)},`CSV (Excel)`)):``,X(`div`,{class:`sec`},`İçe aktar`),s(`merge`,`Birleştir`,`aynı kayıtları günceller, yenileri ekler`),s(`replace`,`Üzerine yaz`,`dosyadaki bölümü tamamen değiştirir`),s(`copy`,`Kopya olarak ekle`,`hepsini yeni kayıt olarak ekler`),o,a,X(`textarea`,{placeholder:`ya da JSON / CSV metnini buraya yapıştırın`,onInput:e=>{r=e.target.value}}),X(`div`,{class:`row`},X(`button`,{class:`btn grow`,onClick:()=>i(()=>Y(pt(r,this.importMode,r.trimStart().startsWith(`{`)?`yapistirilan.json`:`Yapıştırılan ${new Date().toLocaleString(`tr-TR`)}.csv`)))},`Metinden içe aktar`)),X(`div`,{class:`sec`},`Depolama`),X(`div`,{class:`muted`},`Veriler yalnızca bu tarayıcıda, ${location.origin} için saklanır; hiçbir yere gönderilmez. ${t.fields.length} alan tanımı, ${t.datasets.length} veri seti. Sürüm 0.1.0.`),X(`div`,{class:`row`},X(`button`,{class:`btn dng`,onClick:()=>{confirm(`${location.origin} için kayıtlı tüm Otofill alanları ve verileri silinsin mi? Bu işlem geri alınamaz; önce dışa aktarmanız önerilir.`)&&(Je(),this.toast(`Tüm veriler silindi.`))}},`Bu sitedeki tüm verileri sil`)))}targetRectEl(e){return e.getClientRects().length&&e.getBoundingClientRect().width>2?e:e.closest(`label`)??e.parentElement??e}boxFor(e,t){let n=this.targetRectEl(e).getBoundingClientRect();return X(`div`,{class:`hl ${t}`,style:{left:`${n.left-3}px`,top:`${n.top-3}px`,width:`${n.width+6}px`,height:`${n.height+6}px`}})}hover(e){this.hoverEl=e,this.drawLayer()}flash(e){let t=this.boxFor(e,`green`);this.layer.appendChild(t),setTimeout(()=>t.style.opacity=`0`,700),setTimeout(()=>t.remove(),1200)}drawLayer(){let e=[...this.layer.querySelectorAll(`.pop, .teachbar`)];if(this.layer.replaceChildren(...e),!this.visible&&!this.teaching)return;let t=this.result;if(t&&(this.inspecting||this.teaching)){for(let e of t.matches){let t=this.targetRectEl(e.fp.el).getBoundingClientRect();t.bottom<0||t.top>window.innerHeight||this.layer.appendChild(X(`div`,{class:`badge`,style:{left:`${t.left}px`,top:`${t.top}px`}},`${e.def.key} · ${e.score}`))}if(this.inspecting)for(let e of t.free){let t=this.targetRectEl(e.el).getBoundingClientRect();t.bottom<0||t.top>window.innerHeight||this.layer.appendChild(X(`div`,{class:`badge free`,style:{left:`${t.left}px`,top:`${t.top}px`}},`? tanımsız`))}}this.hoverEl?.isConnected&&this.layer.appendChild(this.boxFor(this.hoverEl,``))}startTeach(){if(this.mount(),this.teaching)return;this.teaching=!0,this.pattern||=d(),this.visible||this.show(),this.result=H(),this.render();let e=X(`div`,{class:`teachbar`},X(`span`,{},`Tanıtma modu: bir alana tıklayın`),X(`button`,{onClick:()=>this.stopTeach()},`Bitir (Esc)`));this.layer.appendChild(e);for(let e of[`pointerdown`,`mousedown`,`mouseup`,`click`])document.addEventListener(e,this.onTeachPointer,!0);document.addEventListener(`mousemove`,this.onTeachMove,!0),this.drawLayer()}stopTeach(){if(this.teaching){this.teaching=!1,this.closeTeachPop(),this.layer.querySelector(`.teachbar`)?.remove();for(let e of[`pointerdown`,`mousedown`,`mouseup`,`click`])document.removeEventListener(e,this.onTeachPointer,!0);document.removeEventListener(`mousemove`,this.onTeachMove,!0),this.hoverEl=null,this.visible?this.refresh():this.drawLayer()}}fromPanel(e){return e.composedPath().includes(this.host)}closeTeachPop(){this.teachPop?.remove(),this.teachPop=null}openTeachPop(e){this.closeTeachPop();let t=v(e)===`radio`?C(e)[0]:e,n=E(document).find(e=>e.el===t);if(!n){this.toast(`Bu alan görünür değil ya da devre dışı.`,`err`);return}let r=L(),i=H();this.result=i;let a=i.matches.find(e=>e.fp.el===t)?.def,s=[...new Set([...r.fields.map(e=>e.key),...r.datasets.flatMap(V)])].sort(),c=`otofill-keys`,l=d(),u=ee(),f=a?.pages[0]??(this.pattern||l),p=X(`input`,{type:`text`,list:c,value:a?.key??(o(n.label||n.name||n.placeholder||n.id)||``),placeholder:`ör. musteri.tckn`}),m=X(`input`,{type:`text`,value:a?.title??n.label??``,placeholder:`Açıklama (isteğe bağlı)`}),h=X(`select`,{},X(`option`,{value:l,selected:f===l||void 0},`Bu sayfa`),X(`option`,{value:u,selected:f===u||void 0},`Tüm site`),f!==l&&f!==u?X(`option`,{value:f,selected:!0},f):null),g=()=>{let e=p.value.trim();if(!e){p.focus();return}let r=this.defFrom(n,e,m.value.trim()||void 0,[h.value],a?.id);z(e=>{let t=e.fields.findIndex(e=>e.id===r.id);t>=0?e.fields[t]=r:e.fields.push(r)}),this.closeTeachPop(),this.flash(t),this.toast(`"${e}" ${a?`güncellendi`:`tanımlandı`}.`)},_=this.targetRectEl(t).getBoundingClientRect(),te=_.bottom+8+230>window.innerHeight?Math.max(8,_.top-238):_.bottom+8,ne=Math.min(Math.max(8,_.left),window.innerWidth-310);this.teachPop=X(`div`,{class:`pop`,style:{left:`${ne}px`,top:`${te}px`},onKeydown:e=>{e.key===`Enter`&&g()}},X(`div`,{},X(`b`,{},a?`Alanı düzenle`:`Alan tanıt`),X(`span`,{class:`muted`},` · ${yt[n.kind]}${n.label?` · "${n.label}"`:``}`)),X(`span`,{class:`lbl`},`Anahtar (veri setindeki sütun adı)`),p,X(`datalist`,{id:c},s.map(e=>X(`option`,{value:e}))),X(`span`,{class:`lbl`},`Açıklama`),m,X(`span`,{class:`lbl`},`Geçerli olduğu yer`),h,X(`div`,{class:`row`},a?X(`button`,{class:`btn dng`,onClick:()=>{B(a.id),this.closeTeachPop(),this.toast(`"${a.key}" silindi.`)}},`Sil`):null,X(`span`,{class:`grow`}),X(`button`,{class:`btn`,onClick:()=>this.closeTeachPop()},`İptal`),X(`button`,{class:`btn pri`,onClick:g},`Kaydet`))),this.layer.appendChild(this.teachPop),p.focus(),p.select()}},xt=n({BUNDLE_FORMAT:()=>G,BUNDLE_VERSION:()=>1,THRESHOLD:()=>30,WEIGHTS:()=>Le,analyze:()=>H,close:()=>wt,fill:()=>Dt,fillElement:()=>Fe,fillRow:()=>U,fingerprint:()=>w,init:()=>Q,io:()=>it,labelOf:()=>le,matchFields:()=>Be,open:()=>Ct,readElement:()=>Ie,readRow:()=>tt,registerDriver:()=>Ne,scanPage:()=>E,score:()=>ze,setNativeValue:()=>k,store:()=>Ve,teach:()=>Et,toggle:()=>Tt,version:()=>St}),St=`0.1.0`,Z=null;function Q(e={}){if(Z||typeof document>`u`)return;Z=new bt({hotkey:gt(e.hotkey??`ctrl+q`)});let t=()=>Z.mount();document.body?t():document.addEventListener(`DOMContentLoaded`,t,{once:!0})}function Ct(){Q(),Z.show()}function wt(){Z?.hide()}function Tt(){Q(),Z.toggle()}function Et(){Q(),Z.startTeach()}async function Dt(e,t=0){let n=L().datasets.find(t=>t.id===e||t.name===e);if(!n)throw Error(`Veri seti bulunamadı: ${e}`);let r=typeof t==`number`?n.rows[t]:n.rows.find(e=>e._label===t||e._id===t);if(!r)throw Error(`Satır bulunamadı: ${t}`);return U(r)}var $=globalThis,Ot=document.currentScript;return $.__optonaOtofill?$.__optonaOtofill.open():($.__optonaOtofill=xt,Ot?.dataset.auto!==`false`&&Q({hotkey:Ot?.dataset.hotkey}),Ot?.dataset.open===`true`&&Ct()),e.BUNDLE_FORMAT=G,e.BUNDLE_VERSION=rt,e.THRESHOLD=Re,e.WEIGHTS=Le,e.analyze=H,e.close=wt,e.fill=Dt,e.fillElement=Fe,e.fillRow=U,e.fingerprint=w,e.init=Q,Object.defineProperty(e,"io",{enumerable:!0,get:function(){return it}}),e.labelOf=le,e.matchFields=Be,e.open=Ct,e.readElement=Ie,e.readRow=tt,e.registerDriver=Ne,e.scanPage=E,e.score=ze,e.setNativeValue=k,Object.defineProperty(e,"store",{enumerable:!0,get:function(){return Ve}}),e.teach=Et,e.toggle=Tt,e.version=St,e})({});
|
|
74
|
+
.pop .row select { width: auto; flex: 1; min-width: 0; }
|
|
75
|
+
.pop .sep { border-top: 1px solid #e5e7eb; margin: 2px 0; }
|
|
76
|
+
.pop .lbl.warn { color: #b45309; }
|
|
77
|
+
table.edit td { max-width: none; padding: 1px 2px; }
|
|
78
|
+
table.edit input.cell { width: 100%; min-width: 70px; border: 1px solid transparent; border-radius: 4px; padding: 3px 4px; font-size: 11px; background: transparent; }
|
|
79
|
+
table.edit input.cell:hover { border-color: #e5e7eb; }
|
|
80
|
+
table.edit input.cell:focus { border-color: #2563eb; background: #fff; outline: none; }
|
|
81
|
+
`,St={text:`metin`,textarea:`çok satır`,select:`seçim`,checkbox:`onay kutusu`,radio:`seçenek grubu`,date:`tarih`,contenteditable:`zengin metin`,other:`diğer`},Ct=`optona-otofill:ui`;function wt(){try{return JSON.parse(localStorage.getItem(Ct)||`{}`)}catch{return{}}}function Z(e){try{localStorage.setItem(Ct,JSON.stringify(e))}catch{}}var Tt=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 14 10 14 10 20"/><polyline points="20 10 14 10 14 4"/><line x1="14" y1="10" x2="21" y2="3"/><line x1="3" y1="21" x2="10" y2="14"/></svg>`,Et=`<svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor" stroke="none"><path d="M13 2 3 14h9l-1 8 10-12h-9l1-8z"/></svg>`,Dt=e=>{let t=document.createElement(`span`);return t.className=`ico`,t.innerHTML=e,t},Ot=class{constructor(e){this.opts=e,this.visible=!1,this.view=`fill`,this.result=null,this.lastFill=null,this.quiet=!1,this.toastMsg=``,this.toastKind=`ok`,this.toastTimer=0,this.pattern=``,this.importMode=`merge`,this.inspecting=!1,this.teaching=!1,this.teachPop=null,this.freeSel=new Map,this.teachTarget={dsId:`__new`,rowId:`__new`},this.ui=wt(),this.minimized=!1,this.miniMsg=``,this.raf=0,this.onKey=e=>{if(bt(e,this.opts.hotkey)){e.preventDefault(),e.stopPropagation(),this.toggle();return}if(e.key===`Escape`){this.teachPop?(this.closeTeachPop(),e.preventDefault()):this.teaching&&(this.stopTeach(),e.preventDefault());return}if(!this.visible||this.view!==`fill`||this.teaching)return;let t=this.root.activeElement??document.activeElement;if(t&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)))return;let n=this.currentDataset();if(n){if(/^Digit[1-9]$/.test(e.code)&&!e.ctrlKey&&!e.altKey&&!e.metaKey){let t=Number(e.code.slice(5))-1;n.rows[t]&&(e.preventDefault(),this.fillWith(n,t))}else e.key===`Enter`&&!e.ctrlKey&&(e.preventDefault(),this.fillNext(n))}},this.startDrag=e=>{if(e.target.tagName===`BUTTON`)return;let t=this.box.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=e=>{this.ui.left=Math.max(0,Math.min(window.innerWidth-60,e.clientX-n)),this.ui.top=Math.max(0,Math.min(window.innerHeight-40,e.clientY-r)),Object.assign(this.box.style,{left:`${this.ui.left}px`,top:`${this.ui.top}px`,right:`auto`})},a=()=>{window.removeEventListener(`mousemove`,i,!0),window.removeEventListener(`mouseup`,a,!0),Z(this.ui)};window.addEventListener(`mousemove`,i,!0),window.addEventListener(`mouseup`,a,!0),e.preventDefault()},this.startMiniDrag=e=>{if(e.target.closest(`button`))return;let t=this.mini.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=e=>{this.ui.miniLeft=Math.max(0,Math.min(window.innerWidth-140,e.clientX-n)),this.ui.miniTop=Math.max(0,Math.min(window.innerHeight-40,e.clientY-r)),Object.assign(this.mini.style,{left:`${this.ui.miniLeft}px`,top:`${this.ui.miniTop}px`})},a=()=>{window.removeEventListener(`mousemove`,i,!0),window.removeEventListener(`mouseup`,a,!0),Z(this.ui)};window.addEventListener(`mousemove`,i,!0),window.addEventListener(`mouseup`,a,!0),e.preventDefault()},this.hoverEl=null,this.onViewport=()=>{(this.inspecting||this.hoverEl||this.teaching)&&(cancelAnimationFrame(this.raf),this.raf=requestAnimationFrame(()=>this.drawLayer()))},this.onTeachMove=e=>{if(this.fromPanel(e)||this.teachPop)return;let t=T(e.composedPath()[0]);t!==this.hoverEl&&this.hover(t)},this.onTeachPointer=e=>{if(this.fromPanel(e)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),e.type!==`click`))return;let t=T(e.composedPath()[0]);t?this.openTeachPop(t):this.teachPop&&this.closeTeachPop()}}mount(){if(this.host)return;if(this.host=document.createElement(_),this.host.setAttribute(`data-otofill-host`,``),this.root=this.host.attachShadow({mode:`open`}),this.root.appendChild(X(`style`,{},xt)),this.layer=X(`div`,{class:`layer`}),this.box=X(`div`,{class:`panel`,style:{display:`none`}}),this.mini=X(`div`,{class:`mini`,style:{display:`none`},onMousedown:this.startMiniDrag}),this.root.append(this.layer,this.box,this.mini),document.documentElement.appendChild(this.host),typeof ResizeObserver<`u`){let e=0;new ResizeObserver(()=>{this.visible&&this.box.style.width&&(clearTimeout(e),e=window.setTimeout(()=>{this.ui.w=this.box.style.width,this.ui.h=this.box.style.height,Z(this.ui)},300))}).observe(this.box)}let e=()=>this.minimized&&this.renderMini();window.addEventListener(`hashchange`,e),window.addEventListener(`popstate`,e),this.ui.min&&setTimeout(()=>this.showMini(),300);for(let e of[`keydown`,`keyup`,`keypress`])this.host.addEventListener(e,e=>e.stopPropagation());window.addEventListener(`keydown`,this.onKey,!0),window.addEventListener(`scroll`,this.onViewport,!0),window.addEventListener(`resize`,this.onViewport),qe(()=>{this.quiet||(this.visible?this.refresh():this.minimized&&this.renderMini())})}show(){this.mount(),this.visible=!0,this.minimized=!1,this.mini.style.display=`none`,this.ui.min&&(this.ui.min=!1,Z(this.ui)),this.pattern||=f(),this.box.style.display=`flex`,this.applyBox(),this.refresh()}hide(){this.visible=!1,this.minimized=!1,this.box.style.display=`none`,this.mini&&(this.mini.style.display=`none`),this.ui.min&&(this.ui.min=!1,Z(this.ui)),this.stopTeach(),this.inspecting=!1,this.drawLayer()}toggle(){this.visible?this.hide():this.show()}minimize(){let e=this.box.getBoundingClientRect();this.ui.miniLeft=Math.round(e.right-132),this.ui.miniTop=Math.round(e.top),this.stopTeach(),this.inspecting=!1,this.visible=!1,this.box.style.display=`none`,this.showMini(),this.drawLayer()}showMini(){this.mount(),this.minimized=!0,this.ui.min=!0,Z(this.ui),this.mini.style.display=`flex`,this.renderMini()}applyBox(){let e=this.ui;if(e.w&&(this.box.style.width=e.w),e.h&&(this.box.style.height=e.h),e.left!=null&&e.top!=null){let t=Math.max(0,Math.min(window.innerWidth-80,e.left)),n=Math.max(0,Math.min(window.innerHeight-40,e.top));Object.assign(this.box.style,{left:`${t}px`,top:`${n}px`,right:`auto`})}}quickTarget(){this.result=U();let e=this.currentDataset();if(!e||!e.rows.length)return null;let t=z().prefs.cursor[e.id];return{ds:e,i:t==null?0:(t-1+e.rows.length)%e.rows.length}}renderMini(){if(!this.mini)return;let e=this.quickTarget(),t=Math.max(0,Math.min(window.innerWidth-140,this.ui.miniLeft??window.innerWidth-148)),n=Math.max(0,Math.min(window.innerHeight-40,this.ui.miniTop??16));Object.assign(this.mini.style,{left:`${t}px`,top:`${n}px`});let r=X(`button`,{class:`mfill`+(e?``:` off`),title:e?`Doldur: ${e.ds.name} › ${G(e.ds.rows[e.i])}`:`Bu sayfa için uygun veri yok: paneli açar`,onClick:()=>void this.quickFill()},Dt(Et),this.miniMsg||`Doldur`);this.mini.replaceChildren(r,X(`button`,{class:`mico`,title:`Paneli aç (Ctrl+Q)`,onClick:()=>this.show()},Dt(Tt)),X(`button`,{class:`mico`,title:`Kapat`,onClick:()=>this.hide()},`×`))}async quickFill(){let e=this.quickTarget();if(!e){this.show();return}let t=e.ds.rows[e.i];V(t=>{t.prefs.lastDatasetId=e.ds.id,t.prefs.cursor[e.ds.id]=(e.i+1)%e.ds.rows.length});let n=await W(t,{onFilled:e=>this.flash(e)});this.lastFill=n;let r=n.notFound.length+n.failed.length;r?(this.view=`fill`,this.show(),this.toast(`"${G(t)}": ${n.filled.length} alan dolduruldu, ${r} sorunlu`,`err`)):(this.miniMsg=`✓ ${n.filled.length}`,this.renderMini(),setTimeout(()=>{this.miniMsg=``,this.minimized&&this.renderMini()},1500))}isOpen(){return this.visible}refresh(){this.result=U(),this.render(),this.drawLayer()}toast(e,t=`ok`){this.toastMsg=e,this.toastKind=t,clearTimeout(this.toastTimer),this.toastTimer=window.setTimeout(()=>{this.toastMsg=``,this.visible&&this.render()},5e3),this.visible&&this.render()}currentDataset(){let e=z(),t=this.pageKeys(),n=rt(e.datasets,t).filter(e=>e.overlap>0),r=this.dsId??e.prefs.lastDatasetId;return n.find(e=>e.ds.id===r)?.ds??n[0]?.ds}pageKeys(){return[...new Set((this.result?.matches??[]).map(e=>e.def.key))]}async fillWith(e,t){let n=e.rows[t];if(!n)return;V(n=>{n.prefs.lastDatasetId=e.id,n.prefs.cursor[e.id]=(t+1)%e.rows.length});let r=await W(n,{onFilled:e=>this.flash(e)});this.lastFill=r;let i=r.notFound.length+r.failed.length;z().prefs.closeAfterFill&&i===0?this.hide():this.toast(`"${G(n)}": ${r.filled.length} alan dolduruldu`+(i?`, ${i} sorunlu`:``),i?`err`:`ok`)}fillNext(e){let t=z().prefs.cursor[e.id]??0;return this.fillWith(e,t<e.rows.length?t:0)}fillRandom(e){return this.fillWith(e,Math.floor(Math.random()*e.rows.length))}render(){let e=this.result,t=X(`div`,{class:`head`,onMousedown:this.startDrag},X(`b`,{},`Otofill`),X(`span`,{class:`sub`},`${e.matches.length}/${e.defs.length} alan · ${location.host}`),X(`button`,{title:`Yeniden tara`,onClick:()=>this.refresh()},`⟳`),X(`button`,{title:`Küçült: tek düğmeye çevirir`,onClick:()=>this.minimize()},Dt(Tt)),X(`button`,{title:`Kapat (Ctrl+Q)`,onClick:()=>this.hide()},`×`)),n=(e,t)=>X(`button`,{class:this.view===e?`on`:``,onClick:()=>{this.view=e,this.render(),this.drawLayer()}},t),r=X(`div`,{class:`tabs`},n(`fill`,`Doldur`),n(`fields`,`Alanlar`),n(`data`,`Veri`),n(`io`,`Aktar`)),i=X(`div`,{class:`body`});this.toastMsg&&i.appendChild(X(`div`,{class:`toast ${this.toastKind}`},this.toastMsg)),this.view===`fill`?this.renderFill(i):this.view===`fields`?this.renderFields(i):this.view===`data`?this.renderData(i):this.renderIo(i);let a=this.box.querySelector(`.body`)?.scrollTop??0;this.box.replaceChildren(t,r,i),i.scrollTop=a}renderFill(e){let t=this.result,n=z();if(t.defs.length===0){e.append(X(`div`,{class:`empty`},`Bu sayfa için tanımlı alan yok.`,X(`br`),`Önce alanları tanıtın ya da tanımları içe aktarın.`),X(`div`,{class:`row`},X(`button`,{class:`btn pri grow`,onClick:()=>{this.view=`fields`,this.startTeach()}},`Tıklayarak alan tanıt`),X(`button`,{class:`btn grow`,onClick:()=>{this.view=`io`,this.render()}},`İçe aktar`)));return}let r=rt(n.datasets,this.pageKeys()).filter(e=>e.overlap>0);if(r.length===0){e.append(X(`div`,{class:`empty`},`${t.matches.length} alan tanındı ama bu alanlara uyan veri seti yok.`,X(`br`),`Veri sekmesinden sayfadaki değerleri kaydedin ya da veri içe aktarın.`),X(`div`,{class:`row`},X(`button`,{class:`btn grow`,onClick:()=>{this.view=`data`,this.render()}},`Veri sekmesi`)));return}let i=this.currentDataset(),a=this.pageKeys(),o=n.prefs.cursor[i.id]??0;e.append(X(`div`,{class:`row`},X(`select`,{class:`grow`,onChange:e=>{this.dsId=e.target.value,this.render()}},r.map(e=>X(`option`,{value:e.ds.id,selected:e.ds.id===i.id||void 0},`${e.ds.name} (${e.overlap} alan · ${e.ds.rows.length} satır)`)))),i.rows.length===0?X(`div`,{class:`empty`},`Bu veri setinde satır yok.`):X(`div`,{class:`list`},i.rows.map((e,t)=>X(`div`,{class:`item click`+(t===o?` cur`:``),title:`Bu satırla doldur`,onClick:()=>this.fillWith(i,t)},X(`span`,{class:`num`},t<9?String(t+1):`·`),X(`span`,{class:`grow`},G(e,a)),t===o?X(`span`,{class:`muted`},`sıradaki`):null))),X(`div`,{class:`row`},X(`button`,{class:`btn pri grow`,disabled:!i.rows.length||void 0,onClick:()=>this.fillNext(i)},`Sıradaki satır (Enter)`),X(`button`,{class:`btn`,disabled:!i.rows.length||void 0,onClick:()=>this.fillRandom(i)},`Rastgele`)),X(`label`,{class:`opt muted`},X(`input`,{type:`checkbox`,checked:n.prefs.closeAfterFill,onChange:e=>V(t=>{t.prefs.closeAfterFill=e.target.checked})}),`Sorunsuz doldurunca paneli kapat · 1-9: satır seç`));let s=this.lastFill;if(s){let t=(e,t,n)=>n.length?X(`div`,{class:e},`${t}: `,X(`span`,{class:`key`},n.join(`, `))):null;e.append(X(`div`,{},t(`ok`,`Dolduruldu`,s.filled),t(`bad`,`Sayfada bulunamadı`,s.notFound),t(`bad`,`Yazılamadı`,s.failed),t(`muted`,`Satırda değeri yok`,s.noValue)))}t.missing.length&&e.append(X(`div`,{class:`muted`},`Tanımlı ama bulunamayan: ${t.missing.map(e=>e.key).join(`, `)}`))}renderFields(e){let t=this.result,n=te(),r=f();e.append(X(`div`,{class:`row`},X(`button`,{class:`btn pri grow`,onClick:()=>this.startTeach()},`Tıklayarak tanıt`),X(`button`,{class:`btn`+(this.inspecting?` pri`:``),onClick:()=>{this.inspecting=!this.inspecting,this.render(),this.drawLayer()}},this.inspecting?`Göstermeyi kapat`:`Sayfada göster`)),X(`div`,{class:`muted`},`Yeni tanımların geçerli olacağı adres (* joker):`),X(`div`,{class:`row`},X(`input`,{type:`text`,class:`grow`,value:this.pattern,onChange:e=>{this.pattern=e.target.value.trim()}}),X(`button`,{class:`btn sm`,title:r,onClick:()=>{this.pattern=r,this.render()}},`Bu sayfa`),X(`button`,{class:`btn sm`,title:n,onClick:()=>{this.pattern=n,this.render()}},`Tüm site`)),X(`div`,{class:`sec`},`Bu sayfadaki tanımlar (${t.defs.length})`)),t.defs.length===0?e.append(X(`div`,{class:`muted`},`Henüz yok.`)):e.append(X(`div`,{class:`list`},t.defs.map(e=>{let n=t.matches.find(t=>t.def.id===e.id);return X(`div`,{class:`item`,onMouseenter:()=>n&&this.hover(n.fp.el),onMouseleave:()=>this.hover(null)},X(`span`,{class:n?`ok`:`bad`,title:n?`puan ${n.score}`:`sayfada bulunamadı`},n?`●`:`○`),X(`span`,{class:`grow`},X(`span`,{class:`key`},e.key),e.title?X(`span`,{class:`muted`},` · ${e.title}`):null),X(`span`,{class:`muted`},n?String(n.score):`—`),X(`button`,{class:`btn sm dng`,title:`Tanımı sil`,onClick:()=>{confirm(`"${e.key}" tanımı silinsin mi?`)&&Xe(e.id)}},`Sil`))})));let i=new Set(t.defs.map(e=>e.key)),a=new Set;for(let e of t.free)if(!this.freeSel.has(e)){let t=o(e.label||e.name||e.placeholder||e.id)||`alan_${(e.index??0)+1}`,n=2,r=t;for(;i.has(t)||a.has(t);)t=`${r}_${n++}`;a.add(t),this.freeSel.set(e,{on:!1,key:t})}e.append(X(`div`,{class:`sec`},`Tanımsız alanlar (${t.free.length})`)),t.free.length===0?e.append(X(`div`,{class:`muted`},`Sayfadaki tüm görünür alanlar tanımlı.`)):e.append(X(`div`,{class:`list`},t.free.map(e=>{let t=this.freeSel.get(e);return X(`div`,{class:`item`,onMouseenter:()=>this.hover(e.el),onMouseleave:()=>this.hover(null)},X(`input`,{type:`checkbox`,checked:t.on,onChange:e=>{t.on=e.target.checked}}),X(`div`,{class:`grow`,style:{display:`flex`,flexDirection:`column`,gap:`2px`,minWidth:`0`}},X(`input`,{type:`text`,value:t.key,onInput:e=>{t.key=e.target.value.trim(),t.on=!0,e.target.parentElement.previousSibling.checked=!0}}),X(`span`,{class:`muted`},`${e.label||e.placeholder||e.name||`(etiketsiz)`} · ${St[e.kind]}`)))})),X(`div`,{class:`row`},X(`button`,{class:`btn`,onClick:()=>{let e=[...this.freeSel.values()].every(e=>e.on);t.free.forEach(t=>this.freeSel.get(t).on=!e),this.render()}},`Tümünü seç / bırak`),X(`button`,{class:`btn pri grow`,onClick:()=>this.saveFree()},`Seçilenleri kaydet`)))}saveFree(){let e=this.result.free.filter(e=>this.freeSel.get(e)?.on&&this.freeSel.get(e).key);if(!e.length)return this.toast(`Kaydedilecek alan seçilmedi.`,`err`);V(t=>{for(let n of e)t.fields.push(this.defFrom(n,this.freeSel.get(n).key))}),e.forEach(e=>this.freeSel.delete(e)),this.toast(`${e.length} alan tanımlandı.`)}defFrom(e,t,n,r,i){return{id:i??s(),key:t,title:n??e.label,pages:r??[this.pattern||f()],kind:e.kind,match:pe(e),updatedAt:c()}}renderData(e){let t=this.result,n=z(),r=this.pageKeys(),i=n.datasets.find(e=>e.id===(this.openDsId??n.prefs.lastDatasetId))?.id??n.datasets[0]?.id??`__new`,a=``,l=``;e.append(X(`div`,{class:`sec`},`Satır ekle`),X(`div`,{class:`muted`},r.length?`Tanınan ${r.length} alanın o anki değerleri okunur. Formu elle doldurup buradan kaydedebilirsiniz.`:`Bu sayfada tanımlı alan yok: boş satır eklenir, değerleri aşağıdaki tabloda yazarsınız.`),X(`div`,{class:`row`},X(`select`,{class:`grow`,onChange:e=>{i=e.target.value,u.style.display=i===`__new`?``:`none`}},n.datasets.map(e=>X(`option`,{value:e.id,selected:e.id===i||void 0},e.name)),X(`option`,{value:`__new`,selected:i===`__new`||void 0},`+ Yeni veri seti`))));let u=X(`input`,{type:`text`,placeholder:`Yeni veri setinin adı`,style:{display:i===`__new`?``:`none`},onInput:e=>{a=e.target.value}});e.append(u,X(`div`,{class:`row`},X(`input`,{type:`text`,class:`grow`,placeholder:`Satır adı (ör. "Bireysel - İstanbul")`,onInput:e=>{l=e.target.value}}),X(`button`,{class:`btn pri`,title:r.length?`Sayfadaki tanımlı alanların değerlerini yeni satır olarak kaydeder`:`Boş bir satır ekler; değerleri aşağıdaki tabloda yazın`,onClick:()=>{let e=r.length?nt(t):{},n=i;i===`__new`&&(n=Ze(a.trim()||`Veri ${new Date().toLocaleDateString(`tr-TR`)}`).id);let o=z().datasets.find(e=>e.id===n);et(n,{...e,_label:l.trim()||`Satır ${(o?.rows.length??0)+1}`}),this.openDsId=n,this.toast(r.length?`${Object.keys(e).length} değer satır olarak kaydedildi.`:`Satır eklendi; değerleri tabloda yazın.`)}},r.length?`Kaydet`:`Satır ekle`)),X(`div`,{class:`sec`},`Veri setleri (${n.datasets.length})`)),n.datasets.length?e.append(X(`div`,{class:`list`},n.datasets.map(e=>{let t=this.openDsId===e.id,i=H(e),a=[...r.filter(e=>i.includes(e)),...i.filter(e=>!r.includes(e))],l=[...new Set([...r,...n.fields.map(e=>e.key)])].filter(e=>!i.includes(e)),u=(t,n,r=``)=>X(`td`,{},X(`input`,{type:`text`,class:`cell`,value:t[n]??``,placeholder:r,title:n===`_label`?`Satır adı`:n,onChange:r=>this.setCell(e.id,t._id,n,r.target.value),onKeydown:e=>{e.key===`Enter`&&e.target.blur()}}));return X(`div`,{},X(`div`,{class:`item click`,onClick:()=>{this.openDsId=t?void 0:e.id,this.render()}},X(`span`,{},t?`▾`:`▸`),X(`span`,{class:`grow`},e.name),X(`span`,{class:`muted`},`${e.rows.length} satır`),X(`button`,{class:`btn sm`,title:`Veri + kullandığı alan tanımları: başka adreste içe aktarınca alanlar da gelir`,onClick:t=>{t.stopPropagation(),Y({datasets:[e.id]},`otofill-${o(e.name)||`veri`}.json`)}},`JSON`),X(`button`,{class:`btn sm`,title:`CSV indir (yalnızca veri, Excel için)`,onClick:t=>{t.stopPropagation(),mt(e.id)}},`CSV`),X(`button`,{class:`btn sm dng`,onClick:t=>{t.stopPropagation(),confirm(`"${e.name}" veri seti silinsin mi?`)&&$e(e.id)}},`Sil`)),t?X(`div`,{style:{padding:`0 8px 8px`,overflowX:`auto`}},X(`table`,{class:`edit`},X(`tr`,{},X(`th`,{},`Satır`),a.map(e=>X(`th`,{title:e},e)),X(`th`,{})),e.rows.map(t=>X(`tr`,{},u(t,`_label`,G(t)),a.map(e=>u(t,e)),X(`td`,{},X(`button`,{class:`btn sm dng`,title:`Satırı sil`,onClick:()=>tt(e.id,t._id)},`×`))))),X(`div`,{class:`row`,style:{marginTop:`6px`}},X(`button`,{class:`btn sm`,onClick:()=>{et(e.id,{_label:`Satır ${e.rows.length+1}`})}},`+ Satır`),l.length?X(`select`,{class:`grow`,title:`Veri setine sütun (alan) ekle`,onChange:t=>{let n=t.target.value;n&&V(t=>{let r=t.datasets.find(t=>t.id===e.id);r&&(r.rows.length||r.rows.push({_id:s(),_label:`Satır 1`}),r.rows.forEach(e=>{e[n]??=``}),r.updatedAt=c())})}},X(`option`,{value:``},`+ Sütun ekle…`),l.map(e=>X(`option`,{value:e},e))):``),X(`div`,{class:`muted`,style:{marginTop:`4px`}},`Hücreye tıklayıp yazın; boş hücre doldurulmaz.`)):null)}))):e.append(X(`div`,{class:`muted`},`Henüz veri seti yok. Yukarıdan kaydedin ya da Aktar sekmesinden içe aktarın.`))}setCell(e,t,n,r){this.quiet=!0;try{V(i=>{let a=i.datasets.find(t=>t.id===e)?.rows.find(e=>e._id===t);if(!a)return;let o=r.trim();n===`_label`&&!o?delete a._label:a[n]=o;let s=i.datasets.find(t=>t.id===e);s.updatedAt=c()})}finally{this.quiet=!1}}renderIo(e){let t=z(),n=t.datasets[0]?.id,r=``,i=async e=>{try{this.toast(await e())}catch(e){this.toast(e instanceof q?e.message:`İçe aktarılamadı: `+e.message,`err`)}},a=X(`input`,{type:`file`,accept:`.json,.csv,application/json,text/csv`,multiple:!0,style:{display:`none`},onChange:e=>{let t=Array.from(e.target.files??[]);i(async()=>{let e=[];for(let n of t)e.push(`${n.name}: ${_t(await gt(n,this.importMode))}`);return e.join(` · `)})}}),o=X(`div`,{class:`drop`,onClick:()=>a.click(),onDragover:e=>{e.preventDefault(),o.classList.add(`over`)},onDragleave:()=>o.classList.remove(`over`),onDrop:e=>{e.preventDefault(),o.classList.remove(`over`);let t=Array.from(e.dataTransfer?.files??[]);i(async()=>{let e=[];for(let n of t)e.push(`${n.name}: ${_t(await gt(n,this.importMode))}`);return e.join(` · `)})}},`JSON / CSV dosyasını buraya bırakın ya da tıklayıp seçin`),s=(e,t,n)=>X(`label`,{class:`opt`},X(`input`,{type:`radio`,name:`mode`,checked:this.importMode===e,onChange:()=>{this.importMode=e}}),X(`span`,{},X(`b`,{},t),X(`span`,{class:`muted`},` · ${n}`)));e.append(X(`div`,{class:`sec`},`Dışa aktar`),X(`div`,{class:`row`},X(`button`,{class:`btn pri`,onClick:()=>Y({fields:!0,datasets:!0})},`Hepsi (JSON)`),X(`button`,{class:`btn`,onClick:()=>Y({fields:!0},`otofill-alanlar-${location.hostname}.json`)},`Alan tanımları`),X(`button`,{class:`btn`,onClick:()=>Y({datasets:!0},`otofill-veri.json`),title:`Veri setleri ve kullandıkları alan tanımları`},`Veri setleri`)),t.datasets.length?X(`div`,{class:`row`},X(`select`,{class:`grow`,onChange:e=>{n=e.target.value}},t.datasets.map(e=>X(`option`,{value:e.id},e.name))),X(`button`,{class:`btn`,onClick:()=>n&&mt(n)},`CSV (Excel)`)):``,X(`div`,{class:`muted`},`CSV yalnızca veriyi taşır; başka bir adreste alanların da gelmesi için JSON kullanın.`),X(`div`,{class:`sec`},`İçe aktar`),s(`merge`,`Birleştir`,`aynı kayıtları günceller, yenileri ekler`),s(`replace`,`Üzerine yaz`,`dosyadaki bölümü tamamen değiştirir`),s(`copy`,`Kopya olarak ekle`,`hepsini yeni kayıt olarak ekler`),o,a,X(`textarea`,{placeholder:`ya da JSON / CSV metnini buraya yapıştırın`,onInput:e=>{r=e.target.value}}),X(`div`,{class:`row`},X(`button`,{class:`btn grow`,onClick:()=>i(()=>_t(ht(r,this.importMode,r.trimStart().startsWith(`{`)?`yapistirilan.json`:`Yapıştırılan ${new Date().toLocaleString(`tr-TR`)}.csv`)))},`Metinden içe aktar`)),X(`div`,{class:`sec`},`Depolama`),X(`div`,{class:`muted`},`Veriler yalnızca bu tarayıcıda, ${location.origin} için saklanır; hiçbir yere gönderilmez. ${t.fields.length} alan tanımı, ${t.datasets.length} veri seti. Sürüm 0.1.2.`),X(`div`,{class:`row`},X(`button`,{class:`btn dng`,onClick:()=>{confirm(`${location.origin} için kayıtlı tüm Otofill alanları ve verileri silinsin mi? Bu işlem geri alınamaz; önce dışa aktarmanız önerilir.`)&&(Je(),this.toast(`Tüm veriler silindi.`))}},`Bu sitedeki tüm verileri sil`)))}targetRectEl(e){return e.getClientRects().length&&e.getBoundingClientRect().width>2?e:e.closest(`label`)??e.parentElement??e}boxFor(e,t){let n=this.targetRectEl(e).getBoundingClientRect();return X(`div`,{class:`hl ${t}`,style:{left:`${n.left-3}px`,top:`${n.top-3}px`,width:`${n.width+6}px`,height:`${n.height+6}px`}})}hover(e){this.hoverEl=e,this.drawLayer()}flash(e){let t=this.boxFor(e,`green`);this.layer.appendChild(t),setTimeout(()=>t.style.opacity=`0`,700),setTimeout(()=>t.remove(),1200)}drawLayer(){let e=[...this.layer.querySelectorAll(`.pop, .teachbar`)];if(this.layer.replaceChildren(...e),!this.visible&&!this.teaching)return;let t=this.result;if(t&&(this.inspecting||this.teaching)){for(let e of t.matches){let t=this.targetRectEl(e.fp.el).getBoundingClientRect();t.bottom<0||t.top>window.innerHeight||this.layer.appendChild(X(`div`,{class:`badge`,style:{left:`${t.left}px`,top:`${t.top}px`}},`${e.def.key} · ${e.score}`))}if(this.inspecting)for(let e of t.free){let t=this.targetRectEl(e.el).getBoundingClientRect();t.bottom<0||t.top>window.innerHeight||this.layer.appendChild(X(`div`,{class:`badge free`,style:{left:`${t.left}px`,top:`${t.top}px`}},`? tanımsız`))}}this.hoverEl?.isConnected&&this.layer.appendChild(this.boxFor(this.hoverEl,``))}startTeach(){if(this.mount(),this.teaching)return;this.teaching=!0,this.pattern||=f(),this.visible||this.show(),this.result=U(),this.render();let e=X(`div`,{class:`teachbar`},X(`span`,{},`Tanıtma modu: bir alana tıklayın`),X(`button`,{onClick:()=>this.stopTeach()},`Bitir (Esc)`));this.layer.appendChild(e);for(let e of[`pointerdown`,`mousedown`,`mouseup`,`click`])document.addEventListener(e,this.onTeachPointer,!0);document.addEventListener(`mousemove`,this.onTeachMove,!0),this.drawLayer()}stopTeach(){if(this.teaching){this.teaching=!1,this.closeTeachPop(),this.layer.querySelector(`.teachbar`)?.remove();for(let e of[`pointerdown`,`mousedown`,`mouseup`,`click`])document.removeEventListener(e,this.onTeachPointer,!0);document.removeEventListener(`mousemove`,this.onTeachMove,!0),this.hoverEl=null,this.visible?this.refresh():this.drawLayer()}}fromPanel(e){return e.composedPath().includes(this.host)}closeTeachPop(){this.teachPop?.remove(),this.teachPop=null}openTeachPop(e){this.closeTeachPop();let t=C(e)===`radio`?k(e)[0]:e,n=fe(document).find(e=>e.el===t);if(!n){this.toast(`Bu alan görünür değil ya da devre dışı.`,`err`);return}let r=z(),i=U();this.result=i;let a=i.matches.find(e=>e.fp.el===t)?.def,l=[...new Set([...r.fields.map(e=>e.key),...r.datasets.flatMap(H)])].sort(),u=`otofill-keys`,d=f(),ee=te(),p=a?.pages[0]??(this.pattern||d),m=X(`input`,{type:`text`,list:u,value:a?.key??(o(n.label||n.name||n.placeholder||n.id)||``),placeholder:`ör. musteri.tckn`}),h=X(`input`,{type:`text`,value:a?.title??n.label??``,placeholder:`Açıklama (isteğe bağlı)`}),g=X(`select`,{},X(`option`,{value:d,selected:p===d||void 0},`Bu sayfa`),X(`option`,{value:ee,selected:p===ee||void 0},`Tüm site`),p!==d&&p!==ee?X(`option`,{value:p,selected:!0},p):null),_=(t.getAttribute(`type`)??``).toLowerCase()===`password`,v=r.datasets.some(e=>e.id===this.teachTarget.dsId)?this.teachTarget.dsId:(r.datasets.find(e=>e.id===r.prefs.lastDatasetId)??r.datasets[0])?.id??`__new`,y=v!==`__new`&&r.datasets.find(e=>e.id===v)?.rows.some(e=>e._id===this.teachTarget.rowId)?this.teachTarget.rowId:`__new`,b=()=>r.datasets.find(e=>e.id===v)?.rows.find(e=>e._id===y),x=()=>{let e=m.value.trim(),n=e?b()?.[e]:void 0;return n===void 0?_?``:I(t)??``:n},S=t.tagName===`SELECT`?Array.from(t.options).filter(e=>e.value!==``&&!e.disabled).map(e=>e.text.trim()).filter(Boolean):n.kind===`radio`?k(t).map(e=>oe(e)||e.value):n.kind===`checkbox`?[`evet`,`hayır`]:[],w=X(`input`,{type:`text`,list:S.length?`otofill-choices`:void 0,value:x(),placeholder:_?`test hesabının şifresi (isteğe bağlı)`:`boş bırakılırsa veri yazılmaz`}),T=X(`select`,{class:`grow`}),E=X(`select`,{class:`grow`}),ne=()=>{T.replaceChildren(...r.datasets.map(e=>X(`option`,{value:e.id,selected:e.id===v||void 0},e.name)),X(`option`,{value:`__new`,selected:v===`__new`||void 0},`+ Yeni veri seti`));let e=r.datasets.find(e=>e.id===v);E.replaceChildren(...(e?.rows??[]).map((e,t)=>X(`option`,{value:e._id,selected:e._id===y||void 0},`${t+1}. ${G(e)}`)),X(`option`,{value:`__new`,selected:y===`__new`||void 0},`+ Yeni satır`))};ne(),T.addEventListener(`change`,()=>{v=T.value,y=`__new`,ne(),w.value=x()}),E.addEventListener(`change`,()=>{y=E.value,w.value=x()}),m.addEventListener(`change`,()=>{let e=b()?.[m.value.trim()];e!==void 0&&(w.value=e)});let D=()=>{let e=m.value.trim();if(!e){m.focus();return}let r=this.defFrom(n,e,h.value.trim()||void 0,[g.value],a?.id),i=w.value,o=``;V(t=>{let n=t.fields.findIndex(e=>e.id===r.id);if(n>=0?t.fields[n]=r:t.fields.push(r),i.trim()===``)return;let a=t.datasets.find(e=>e.id===v);a||(a={id:s(),name:`Veri ${new Date().toLocaleDateString(`tr-TR`)}`,rows:[],updatedAt:c()},t.datasets.push(a));let l=a.rows.find(e=>e._id===y);l||(l={_id:s()},a.rows.push(l)),l[e]=i,a.updatedAt=c(),t.prefs.lastDatasetId=a.id,this.teachTarget={dsId:a.id,rowId:l._id},o=`${a.name} › ${a.rows.indexOf(l)+1}. satır`}),this.closeTeachPop(),this.flash(t),this.toast(`"${e}" ${a?`güncellendi`:`tanımlandı`}`+(o?`, değer → ${o}.`:`.`))},O=this.targetRectEl(t).getBoundingClientRect(),re=O.bottom+8+400>window.innerHeight?Math.max(8,O.top-400-8):O.bottom+8,ie=Math.min(Math.max(8,O.left),window.innerWidth-310);this.teachPop=X(`div`,{class:`pop`,style:{left:`${ie}px`,top:`${re}px`},onKeydown:e=>{e.key===`Enter`&&D()}},X(`div`,{},X(`b`,{},a?`Alanı düzenle`:`Alan tanıt`),X(`span`,{class:`muted`},` · ${St[n.kind]}${n.label?` · "${n.label}"`:``}`)),X(`span`,{class:`lbl`},`Anahtar (veri setindeki sütun adı)`),m,X(`datalist`,{id:u},l.map(e=>X(`option`,{value:e}))),X(`span`,{class:`lbl`},`Açıklama`),h,X(`span`,{class:`lbl`},`Geçerli olduğu yer`),g,X(`div`,{class:`sep`}),X(`span`,{class:`lbl`},`Örnek değer (isteğe bağlı)`),w,S.length?X(`datalist`,{id:`otofill-choices`},S.map(e=>X(`option`,{value:e}))):null,_?X(`span`,{class:`lbl warn`},`Gerçek şifrenizi yazmayın: veriler tarayıcıda düz metin durur ve dışa aktarılınca paylaşılır.`):null,X(`span`,{class:`lbl`},`Değerin yazılacağı yer`),X(`div`,{class:`row`},T,E),X(`div`,{class:`row`},a?X(`button`,{class:`btn dng`,onClick:()=>{Xe(a.id),this.closeTeachPop(),this.toast(`"${a.key}" silindi.`)}},`Sil`):null,X(`span`,{class:`grow`}),X(`button`,{class:`btn`,onClick:()=>this.closeTeachPop()},`İptal`),X(`button`,{class:`btn pri`,onClick:D},`Kaydet`))),this.layer.appendChild(this.teachPop),m.focus(),m.select()}},kt=n({BUNDLE_FORMAT:()=>K,BUNDLE_VERSION:()=>1,THRESHOLD:()=>30,WEIGHTS:()=>Le,analyze:()=>U,close:()=>Mt,fill:()=>Ft,fillElement:()=>Ie,fillRow:()=>W,fingerprint:()=>ue,init:()=>$,io:()=>at,labelOf:()=>ae,matchFields:()=>Be,open:()=>jt,readElement:()=>I,readRow:()=>nt,registerDriver:()=>Pe,scanPage:()=>fe,score:()=>ze,setNativeValue:()=>M,store:()=>Ve,teach:()=>Pt,toggle:()=>Nt,version:()=>At}),At=`0.1.2`,Q=null;function $(e={}){if(Q||typeof document>`u`)return;Q=new Ot({hotkey:yt(e.hotkey??`ctrl+q`)});let t=()=>Q.mount();document.body?t():document.addEventListener(`DOMContentLoaded`,t,{once:!0})}function jt(){$(),Q.show()}function Mt(){Q?.hide()}function Nt(){$(),Q.toggle()}function Pt(){$(),Q.startTeach()}async function Ft(e,t=0){let n=z().datasets.find(t=>t.id===e||t.name===e);if(!n)throw Error(`Veri seti bulunamadı: ${e}`);let r=typeof t==`number`?n.rows[t]:n.rows.find(e=>e._label===t||e._id===t);if(!r)throw Error(`Satır bulunamadı: ${t}`);return W(r)}var It=globalThis,Lt=document.currentScript;return It.__optonaOtofill?It.__optonaOtofill.open():(It.__optonaOtofill=kt,Lt?.dataset.auto!==`false`&&$({hotkey:Lt?.dataset.hotkey}),Lt?.dataset.open===`true`&&jt()),e.BUNDLE_FORMAT=K,e.BUNDLE_VERSION=it,e.THRESHOLD=Re,e.WEIGHTS=Le,e.analyze=U,e.close=Mt,e.fill=Ft,e.fillElement=Ie,e.fillRow=W,e.fingerprint=ue,e.init=$,Object.defineProperty(e,"io",{enumerable:!0,get:function(){return at}}),e.labelOf=ae,e.matchFields=Be,e.open=jt,e.readElement=I,e.readRow=nt,e.registerDriver=Pe,e.scanPage=fe,e.score=ze,e.setNativeValue=M,Object.defineProperty(e,"store",{enumerable:!0,get:function(){return Ve}}),e.teach=Pt,e.toggle=Nt,e.version=At,e})({});
|
package/dist/types/io.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { Bundle, DataSet, ImportMode } from './types';
|
|
2
2
|
import type { State } from './store';
|
|
3
3
|
export interface ExportOptions {
|
|
4
|
+
/**
|
|
5
|
+
* true: tüm alan tanımları, false: hiçbiri. Verilmezse ve veri seti aktarılıyorsa
|
|
6
|
+
* yalnızca o veri setlerinin anahtarlarını kullanan tanımlar eklenir (veri başka adreste de dolabilsin).
|
|
7
|
+
*/
|
|
4
8
|
fields?: boolean;
|
|
5
9
|
/** true: hepsi, dizi: yalnızca bu id'ler, false: hiçbiri. */
|
|
6
10
|
datasets?: boolean | string[];
|
|
@@ -13,6 +13,8 @@ export declare class Panel {
|
|
|
13
13
|
private result;
|
|
14
14
|
private lastFill;
|
|
15
15
|
private dsId?;
|
|
16
|
+
/** Tablodaki hücre düzenlemesi kaydedilirken panel yeniden çizilmesin (odak kaybolmasın). */
|
|
17
|
+
private quiet;
|
|
16
18
|
private openDsId?;
|
|
17
19
|
private toastMsg;
|
|
18
20
|
private toastKind;
|
|
@@ -23,13 +25,28 @@ export declare class Panel {
|
|
|
23
25
|
private teaching;
|
|
24
26
|
private teachPop;
|
|
25
27
|
private freeSel;
|
|
26
|
-
|
|
28
|
+
/** Tanıtırken girilen değerlerin yazılacağı veri seti ve satır (sonraki tanıtmalarda hatırlanır). */
|
|
29
|
+
private teachTarget;
|
|
30
|
+
private ui;
|
|
31
|
+
private mini;
|
|
32
|
+
private minimized;
|
|
33
|
+
private miniMsg;
|
|
27
34
|
private raf;
|
|
28
35
|
constructor(opts: PanelOptions);
|
|
29
36
|
mount(): void;
|
|
30
37
|
show(): void;
|
|
31
38
|
hide(): void;
|
|
32
39
|
toggle(): void;
|
|
40
|
+
/** Paneli tek bir küçük düğmeye çevirir (konumu panelin sağ üst köşesi). */
|
|
41
|
+
minimize(): void;
|
|
42
|
+
private showMini;
|
|
43
|
+
/** Kayıtlı boyut ve konumu panele uygular. */
|
|
44
|
+
private applyBox;
|
|
45
|
+
/** Bu sayfa için en uygun veri setinde son kullanılan satır (yoksa ilk satır). */
|
|
46
|
+
private quickTarget;
|
|
47
|
+
private renderMini;
|
|
48
|
+
/** Küçük düğmeden doldurma: veri yoksa ya da sorun çıkarsa paneli açar. */
|
|
49
|
+
private quickFill;
|
|
33
50
|
isOpen(): boolean;
|
|
34
51
|
refresh(): void;
|
|
35
52
|
private toast;
|
|
@@ -45,8 +62,12 @@ export declare class Panel {
|
|
|
45
62
|
private saveFree;
|
|
46
63
|
private defFrom;
|
|
47
64
|
private renderData;
|
|
65
|
+
/** Tablodaki tek hücreyi kaydeder; panel yeniden çizilmez, böylece Tab ile sonraki hücreye geçilebilir. */
|
|
66
|
+
private setCell;
|
|
48
67
|
private renderIo;
|
|
49
68
|
private startDrag;
|
|
69
|
+
/** Küçük düğme de boş kısmından sürüklenebilir. */
|
|
70
|
+
private startMiniDrag;
|
|
50
71
|
private hoverEl;
|
|
51
72
|
private targetRectEl;
|
|
52
73
|
private boxFor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CSS = "\n:host { all: initial; }\n* { box-sizing: border-box; font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif; }\n.panel {\n position: fixed; top: 16px; right: 16px; width: 380px; max-height: calc(100vh - 32px);\n display: flex; flex-direction: column; background: #fff; color: #1f2937; font-size: 13px; line-height: 1.4;\n border: 1px solid #d1d5db; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.22); z-index: 2147483646; overflow: hidden;\n}\n.head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #111827; color: #fff; cursor: move; user-select: none; }\n.head b { font-size: 13px; letter-spacing: .2px; }\n.head .sub { color: #9ca3af; font-size: 11px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.head button { background: transparent; border: 0; color: #d1d5db; font-size: 16px; cursor: pointer; padding: 0 4px; }\n.tabs { display: flex; border-bottom: 1px solid #e5e7eb; background: #f9fafb; }\n.tabs button { flex: 1; border: 0; background: transparent; padding: 8px 4px; cursor: pointer; font-size: 12px; color: #4b5563; border-bottom: 2px solid transparent; }\n.tabs button.on { color: #111827; border-bottom-color: #2563eb; font-weight: 600; }\n.body { overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }\n.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }\n.muted { color: #6b7280; font-size: 12px; }\n.sec { font-weight: 600; font-size: 12px; color: #374151; margin-top: 2px; }\nbutton.btn { border: 1px solid #d1d5db; background: #fff; border-radius: 6px; padding: 5px 9px; cursor: pointer; font-size: 12px; color: #1f2937; }\nbutton.btn:hover { background: #f3f4f6; }\nbutton.pri { background: #2563eb; border-color: #2563eb; color: #fff; }\nbutton.pri:hover { background: #1d4ed8; }\nbutton.dng { color: #b91c1c; border-color: #fca5a5; }\nbutton.sm { padding: 2px 6px; font-size: 11px; }\nbutton:disabled { opacity: .5; cursor: default; }\ninput[type=text], select, textarea { border: 1px solid #d1d5db; border-radius: 6px; padding: 5px 7px; font-size: 12px; color: #111827; background: #fff; min-width: 0; }\ninput[type=text]:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; border-color: #2563eb; }\ntextarea { width: 100%; min-height: 70px; font-family: ui-monospace, Consolas, monospace; font-size: 11px; }\n.grow { flex: 1; }\n.list { display: flex; flex-direction: column; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; }\n.item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-top: 1px solid #f3f4f6; }\n.item:first-child { border-top: 0; }\n.item.click { cursor: pointer; }\n.item.click:hover, .item.cur { background: #eff6ff; }\n.num { min-width: 18px; height: 18px; border-radius: 4px; background: #e5e7eb; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; color: #374151; }\n.key { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: #1e40af; }\n.ok { color: #15803d; } .bad { color: #b91c1c; } .warn { color: #b45309; }\n.toast { padding: 7px 9px; border-radius: 6px; font-size: 12px; }\n.toast.ok { background: #dcfce7; color: #14532d; } .toast.err { background: #fee2e2; color: #7f1d1d; }\n.drop { border: 2px dashed #cbd5e1; border-radius: 8px; padding: 14px; text-align: center; color: #64748b; cursor: pointer; }\n.drop.over { border-color: #2563eb; background: #eff6ff; }\n.empty { padding: 14px; text-align: center; color: #6b7280; }\ntable { border-collapse: collapse; width: 100%; font-size: 11px; }\nth, td { border-bottom: 1px solid #f3f4f6; padding: 3px 4px; text-align: left; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\nth { color: #6b7280; font-weight: 600; }\nlabel.opt { display: flex; gap: 6px; align-items: flex-start; cursor: pointer; }\n.layer { position: fixed; inset: 0; pointer-events: none; z-index: 2147483645; }\n.hl { position: fixed; border: 2px solid #2563eb; background: rgba(37,99,235,.08); border-radius: 4px; transition: opacity .4s; }\n.hl.green { border-color: #16a34a; background: rgba(22,163,74,.12); }\n.badge { position: fixed; transform: translateY(-100%); font: 600 10px/1.6 ui-monospace, Consolas, monospace; padding: 0 5px; border-radius: 4px 4px 4px 0; background: #16a34a; color: #fff; white-space: nowrap; }\n.badge.free { background: #6b7280; }\n.teachbar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: #111827; color: #fff; padding: 8px 14px; border-radius: 20px; font-size: 13px; pointer-events: auto; display: flex; gap: 10px; align-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.3); }\n.teachbar button { background: #374151; color: #fff; border: 0; border-radius: 12px; padding: 3px 10px; cursor: pointer; }\n.pop { position: fixed; width: 300px; background: #fff; border: 1px solid #d1d5db; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); padding: 10px; pointer-events: auto; display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: #1f2937; }\n.pop .lbl { font-size: 11px; color: #6b7280; }\n.pop input[type=text], .pop select { width: 100%; }\n";
|
|
1
|
+
export declare const CSS = "\n:host { all: initial; }\n* { box-sizing: border-box; font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif; }\n.panel {\n position: fixed; top: 16px; right: 16px; width: 380px; max-height: calc(100vh - 32px);\n display: flex; flex-direction: column; background: #fff; color: #1f2937; font-size: 13px; line-height: 1.4;\n border: 1px solid #d1d5db; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.22); z-index: 2147483646; overflow: hidden;\n resize: both; min-width: 300px; min-height: 160px; max-width: calc(100vw - 16px);\n}\n.ico { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }\n.head button .ico { vertical-align: middle; }\n.mini {\n position: fixed; z-index: 2147483646; display: flex; align-items: center; gap: 2px; padding: 3px;\n background: #111827; border-radius: 20px; box-shadow: 0 6px 20px rgba(0,0,0,.3); cursor: move; user-select: none;\n}\n.mini button { border: 0; cursor: pointer; color: #fff; font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }\n.mini .mfill { background: #2563eb; border-radius: 16px; padding: 5px 11px; font-weight: 600; }\n.mini .mfill:hover { background: #1d4ed8; }\n.mini .mfill.off { background: #4b5563; }\n.mini .mico { background: transparent; color: #d1d5db; width: 26px; height: 26px; border-radius: 13px; justify-content: center; font-size: 16px; }\n.mini .mico:hover { background: #374151; color: #fff; }\n.head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #111827; color: #fff; cursor: move; user-select: none; }\n.head b { font-size: 13px; letter-spacing: .2px; }\n.head .sub { color: #9ca3af; font-size: 11px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.head button { background: transparent; border: 0; color: #d1d5db; font-size: 16px; cursor: pointer; padding: 0 4px; }\n.tabs { display: flex; border-bottom: 1px solid #e5e7eb; background: #f9fafb; }\n.tabs button { flex: 1; border: 0; background: transparent; padding: 8px 4px; cursor: pointer; font-size: 12px; color: #4b5563; border-bottom: 2px solid transparent; }\n.tabs button.on { color: #111827; border-bottom-color: #2563eb; font-weight: 600; }\n.body { overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }\n.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }\n.muted { color: #6b7280; font-size: 12px; }\n.sec { font-weight: 600; font-size: 12px; color: #374151; margin-top: 2px; }\nbutton.btn { border: 1px solid #d1d5db; background: #fff; border-radius: 6px; padding: 5px 9px; cursor: pointer; font-size: 12px; color: #1f2937; }\nbutton.btn:hover { background: #f3f4f6; }\nbutton.pri { background: #2563eb; border-color: #2563eb; color: #fff; }\nbutton.pri:hover { background: #1d4ed8; }\nbutton.dng { color: #b91c1c; border-color: #fca5a5; }\nbutton.sm { padding: 2px 6px; font-size: 11px; }\nbutton:disabled { opacity: .5; cursor: default; }\ninput[type=text], select, textarea { border: 1px solid #d1d5db; border-radius: 6px; padding: 5px 7px; font-size: 12px; color: #111827; background: #fff; min-width: 0; }\ninput[type=text]:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; border-color: #2563eb; }\ntextarea { width: 100%; min-height: 70px; font-family: ui-monospace, Consolas, monospace; font-size: 11px; }\n.grow { flex: 1; }\n.list { display: flex; flex-direction: column; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; }\n.item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-top: 1px solid #f3f4f6; }\n.item:first-child { border-top: 0; }\n.item.click { cursor: pointer; }\n.item.click:hover, .item.cur { background: #eff6ff; }\n.num { min-width: 18px; height: 18px; border-radius: 4px; background: #e5e7eb; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; color: #374151; }\n.key { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: #1e40af; }\n.ok { color: #15803d; } .bad { color: #b91c1c; } .warn { color: #b45309; }\n.toast { padding: 7px 9px; border-radius: 6px; font-size: 12px; }\n.toast.ok { background: #dcfce7; color: #14532d; } .toast.err { background: #fee2e2; color: #7f1d1d; }\n.drop { border: 2px dashed #cbd5e1; border-radius: 8px; padding: 14px; text-align: center; color: #64748b; cursor: pointer; }\n.drop.over { border-color: #2563eb; background: #eff6ff; }\n.empty { padding: 14px; text-align: center; color: #6b7280; }\ntable { border-collapse: collapse; width: 100%; font-size: 11px; }\nth, td { border-bottom: 1px solid #f3f4f6; padding: 3px 4px; text-align: left; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\nth { color: #6b7280; font-weight: 600; }\nlabel.opt { display: flex; gap: 6px; align-items: flex-start; cursor: pointer; }\n.layer { position: fixed; inset: 0; pointer-events: none; z-index: 2147483645; }\n.hl { position: fixed; border: 2px solid #2563eb; background: rgba(37,99,235,.08); border-radius: 4px; transition: opacity .4s; }\n.hl.green { border-color: #16a34a; background: rgba(22,163,74,.12); }\n.badge { position: fixed; transform: translateY(-100%); font: 600 10px/1.6 ui-monospace, Consolas, monospace; padding: 0 5px; border-radius: 4px 4px 4px 0; background: #16a34a; color: #fff; white-space: nowrap; }\n.badge.free { background: #6b7280; }\n.teachbar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: #111827; color: #fff; padding: 8px 14px; border-radius: 20px; font-size: 13px; pointer-events: auto; display: flex; gap: 10px; align-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.3); }\n.teachbar button { background: #374151; color: #fff; border: 0; border-radius: 12px; padding: 3px 10px; cursor: pointer; }\n.pop { position: fixed; width: 300px; background: #fff; border: 1px solid #d1d5db; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); padding: 10px; pointer-events: auto; display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: #1f2937; }\n.pop .lbl { font-size: 11px; color: #6b7280; }\n.pop input[type=text], .pop select { width: 100%; }\n.pop .row select { width: auto; flex: 1; min-width: 0; }\n.pop .sep { border-top: 1px solid #e5e7eb; margin: 2px 0; }\n.pop .lbl.warn { color: #b45309; }\ntable.edit td { max-width: none; padding: 1px 2px; }\ntable.edit input.cell { width: 100%; min-width: 70px; border: 1px solid transparent; border-radius: 4px; padding: 3px 4px; font-size: 11px; background: transparent; }\ntable.edit input.cell:hover { border-color: #e5e7eb; }\ntable.edit input.cell:focus { border-color: #2563eb; background: #fff; outline: none; }\n";
|
package/dist/types/types.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ export interface Bundle {
|
|
|
50
50
|
version: number;
|
|
51
51
|
exportedAt: string;
|
|
52
52
|
fields?: FieldDef[];
|
|
53
|
+
/** true: fields yalnızca veri setlerinin kullandığı tanımlar; içe aktarılırken hep birleştirilir. */
|
|
54
|
+
fieldsPartial?: boolean;
|
|
53
55
|
datasets?: DataSet[];
|
|
54
56
|
}
|
|
55
57
|
/** merge: aynı id'liyi güncelle, yeniyi ekle. replace: dosyadaki bölümü tamamen değiştir. copy: hepsini yeni kayıt olarak ekle. */
|
package/dist/types/util.d.ts
CHANGED
|
@@ -7,11 +7,22 @@ export declare function slug(s?: string | null): string;
|
|
|
7
7
|
export declare function uid(): string;
|
|
8
8
|
export declare function nowIso(): string;
|
|
9
9
|
export declare function globToRegExp(pattern: string): RegExp;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Desenden sunucu kısmını atar: "http://localhost:8080/#/login*" → "/#/login*".
|
|
12
|
+
* Böylece aynı tanım uygulamanın her adresinde (yerel, test, stage) çalışır.
|
|
13
|
+
*/
|
|
14
|
+
export declare function stripOrigin(pattern: string): string;
|
|
15
|
+
/** Adresin sunucudan sonraki kısmı: yol + sorgu + hash. */
|
|
16
|
+
export declare function pathOf(url: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Alanın sayfa desenlerinden biri adrese uyuyor mu? Boş liste her sayfaya uyar.
|
|
19
|
+
* "/" ile başlayan desen yalnızca yola bakar (sunucudan bağımsız); "*" ile başlayan tüm adrese bakar.
|
|
20
|
+
*/
|
|
11
21
|
export declare function pageMatches(pages: string[] | undefined, url: string): boolean;
|
|
12
|
-
/** Bulunulan sayfa için önerilen desen: sayısal parçalar * olur. */
|
|
22
|
+
/** Bulunulan sayfa için önerilen desen (sunucusuz): sayısal parçalar * olur. */
|
|
13
23
|
export declare function suggestPagePattern(loc?: Location): string;
|
|
14
|
-
|
|
24
|
+
/** Uygulamanın bütün sayfaları. */
|
|
25
|
+
export declare function sitePattern(): string;
|
|
15
26
|
/** Framework'lerin her render'da ürettiği kararsız id'ler (el-id-1234-5, :r3:, v-12 ...). */
|
|
16
27
|
export declare function isDynamicId(id: string): boolean;
|
|
17
28
|
declare function cssEsc(s: string): string;
|
package/package.json
CHANGED