@optona/otofill 0.1.1 → 0.1.3
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 +26 -6
- package/dist/otofill.js +229 -47
- package/dist/otofill.min.js +11 -4
- package/dist/types/io.d.ts +4 -0
- package/dist/types/panel/panel.d.ts +6 -0
- 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
|
@@ -6,9 +6,24 @@ localStorage'ında (`optona-otofill` anahtarı) durur.
|
|
|
6
6
|
|
|
7
7
|
## Kurulum
|
|
8
8
|
|
|
9
|
+
### Yer imi (bookmarklet) — önerilen
|
|
10
|
+
|
|
11
|
+
Projeye hiçbir şey eklenmez; kod taramalarına (Fortify, Sonar, npm audit) girmez. Tarayıcıda yer imleri çubuğuna
|
|
12
|
+
sağ tık → "Sayfa ekle", ad `Otofill`, URL:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
javascript:(function(){var s=document.createElement('script');s.src='https://cdn.jsdelivr.net/npm/@optona/otofill@0.1/dist/otofill.min.js';s.dataset.open='true';document.head.appendChild(s)})()
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Test edilen sayfada yer imine tıklayın; panel açılır, sonra `Ctrl+Q` ile açılıp kapanır. Sayfa yenilenince yeniden
|
|
19
|
+
tıklamak gerekir (SPA içi geçişlerde gerekmez). `@0.1` her 0.1.x sürümünü kendiliğinden alır. Sitenin CSP'si dış
|
|
20
|
+
script'e izin vermiyorsa çalışmaz.
|
|
21
|
+
|
|
22
|
+
### Script etiketi
|
|
23
|
+
|
|
9
24
|
```html
|
|
10
25
|
<!-- Yalnızca test ortamlarına ekleyin -->
|
|
11
|
-
<script src="https://cdn.jsdelivr.net/npm/@optona/otofill@0.1
|
|
26
|
+
<script src="https://cdn.jsdelivr.net/npm/@optona/otofill@0.1/dist/otofill.min.js"></script>
|
|
12
27
|
```
|
|
13
28
|
|
|
14
29
|
Kodun CDN'de değişmediğinden emin olmak için sabit sürümü bütünlük (SRI) hash'iyle kullanabilirsiniz:
|
|
@@ -23,7 +38,8 @@ Kodun CDN'de değişmediğinden emin olmak için sabit sürümü bütünlük (SR
|
|
|
23
38
|
- `data-auto="false"`: kendiliğinden başlamaz, `Otofill.init()` ile başlatılır.
|
|
24
39
|
- `data-open="true"`: yüklenince paneli açar (yer imi için).
|
|
25
40
|
|
|
26
|
-
npm ile: `npm i -D @optona/otofill`, sonra `
|
|
41
|
+
npm ile: `npm i -D @optona/otofill`, sonra `if (import.meta.env.DEV) import('@optona/otofill').then((m) => m.init())`
|
|
42
|
+
(dinamik import sayesinde prod derlemesine girmez).
|
|
27
43
|
|
|
28
44
|
**Sürümler:** `@0.1.0` sabit sürümdür, siz değiştirene kadar güncelleme gelmez. `@0` ya da `@1` uyumlu
|
|
29
45
|
güncellemeleri kendiliğinden alır; jsDelivr önbelleği yüzünden birkaç gün gecikebilir. Bozucu değişiklikler
|
|
@@ -34,10 +50,12 @@ yalnızca ana sürümde yapılır. Kayıtlı veriler kod güncellemesinden etkil
|
|
|
34
50
|
|
|
35
51
|
1. **Alan tanıt:** Ctrl+Q → Alanlar → "Tıklayarak tanıt" → alana tıkla → anahtar ver (ör. `musteri.tckn`).
|
|
36
52
|
Aynı sekmede "Tanımsız alanlar" listesinden önerilen anahtarlarla topluca da tanıtabilirsiniz.
|
|
37
|
-
2. **Veri gir:** Veri sekmesinde formu elle doldurup "
|
|
38
|
-
|
|
53
|
+
2. **Veri gir:** Veri sekmesinde formu elle doldurup "Kaydet" deyin ya da "Satır ekle" ile boş satır açıp değerleri
|
|
54
|
+
tabloya yazın (hücreler yerinde düzenlenir; satır çoğaltma, sütun ekleme/silme, veri seti adı da oradan).
|
|
55
|
+
Excel'de hazırlayıp CSV olarak da aktarabilirsiniz. Ayrı bir yönetim sayfası yoktur, her şey paneldedir.
|
|
39
56
|
3. **Doldur:** Ctrl+Q → satıra tıklayın. `1`-`9` ile satır seçilir, `Enter` sıradaki satırı doldurur.
|
|
40
|
-
4. **
|
|
57
|
+
4. **Taşı (başka adres/ortam):** Veri seti yanındaki JSON düğmesi veriyi kullandığı alan tanımlarıyla birlikte verir;
|
|
58
|
+
hedefte eksik tanımlar eklenir. Aktar sekmesi: JSON (hepsi, alanlar, veri setleri) ya da CSV (yalnızca veri). İçe aktarırken üç seçenek var:
|
|
41
59
|
Birleştir, Üzerine yaz, Kopya olarak ekle.
|
|
42
60
|
|
|
43
61
|
## Veri biçimi
|
|
@@ -48,7 +66,7 @@ yalnızca ana sürümde yapılır. Kayıtlı veriler kod güncellemesinden etkil
|
|
|
48
66
|
"version": 1,
|
|
49
67
|
"exportedAt": "2026-12-05T20:00:00Z",
|
|
50
68
|
"fields": [
|
|
51
|
-
{ "id": "…", "key": "musteri.tckn", "title": "TC Kimlik No", "pages": ["
|
|
69
|
+
{ "id": "…", "key": "musteri.tckn", "title": "TC Kimlik No", "pages": ["/musteri/*"],
|
|
52
70
|
"kind": "text", "match": { "label": "T.C. Kimlik No", "name": "tckn", "css": "#tcNo" } }
|
|
53
71
|
],
|
|
54
72
|
"datasets": [
|
|
@@ -57,6 +75,8 @@ yalnızca ana sürümde yapılır. Kayıtlı veriler kod güncellemesinden etkil
|
|
|
57
75
|
}
|
|
58
76
|
```
|
|
59
77
|
|
|
78
|
+
`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.
|
|
79
|
+
|
|
60
80
|
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.
|
|
61
81
|
|
|
62
82
|
**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) {
|
|
@@ -841,7 +861,10 @@ function migrate(raw) {
|
|
|
841
861
|
const r = raw;
|
|
842
862
|
return {
|
|
843
863
|
v: 1,
|
|
844
|
-
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
|
+
})) : [],
|
|
845
868
|
datasets: Array.isArray(r.datasets) ? r.datasets : [],
|
|
846
869
|
prefs: {
|
|
847
870
|
...base.prefs,
|
|
@@ -978,7 +1001,7 @@ async function fillRow(row, opts = {}) {
|
|
|
978
1001
|
const key = m.def.key;
|
|
979
1002
|
if (done.has(m.def.id)) continue;
|
|
980
1003
|
const value = row[key];
|
|
981
|
-
if (value === void 0) {
|
|
1004
|
+
if (value === void 0 || value === "") {
|
|
982
1005
|
noValue.add(key);
|
|
983
1006
|
continue;
|
|
984
1007
|
}
|
|
@@ -993,7 +1016,7 @@ async function fillRow(row, opts = {}) {
|
|
|
993
1016
|
opts.onFilled?.(m.fp.el);
|
|
994
1017
|
} else failed.add(key);
|
|
995
1018
|
}
|
|
996
|
-
const missingWithValue = pending.missing.filter((d) => row[d.key]
|
|
1019
|
+
const missingWithValue = pending.missing.filter((d) => !!row[d.key] && !done.has(d.id));
|
|
997
1020
|
if (failed.size === 0 && missingWithValue.length === 0) break;
|
|
998
1021
|
if (round === retries) break;
|
|
999
1022
|
await sleep(delay);
|
|
@@ -1003,7 +1026,7 @@ async function fillRow(row, opts = {}) {
|
|
|
1003
1026
|
const filledDefs = final.defs.filter((d) => done.has(d.id));
|
|
1004
1027
|
return {
|
|
1005
1028
|
filled: filledDefs.map((d) => d.key),
|
|
1006
|
-
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),
|
|
1007
1030
|
failed: [...failed],
|
|
1008
1031
|
noValue: [...noValue].filter((k) => !filledDefs.some((d) => d.key === k))
|
|
1009
1032
|
};
|
|
@@ -1062,8 +1085,13 @@ function makeBundle(state = load(), opts = {
|
|
|
1062
1085
|
version: 1,
|
|
1063
1086
|
exportedAt: nowIso()
|
|
1064
1087
|
};
|
|
1065
|
-
if (opts.fields) b.fields = state.fields;
|
|
1066
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
|
+
}
|
|
1067
1095
|
return b;
|
|
1068
1096
|
}
|
|
1069
1097
|
var ImportError = class extends Error {};
|
|
@@ -1089,7 +1117,7 @@ function validateBundle(raw) {
|
|
|
1089
1117
|
id: typeof f.id === "string" && f.id ? f.id : uid(),
|
|
1090
1118
|
key: f.key.trim(),
|
|
1091
1119
|
title: typeof f.title === "string" ? f.title : void 0,
|
|
1092
|
-
pages: Array.isArray(f.pages) ? f.pages.map(String) : [],
|
|
1120
|
+
pages: Array.isArray(f.pages) ? f.pages.map((x) => stripOrigin(String(x))) : [],
|
|
1093
1121
|
kind: typeof f.kind === "string" ? f.kind : void 0,
|
|
1094
1122
|
match: isObj(f.match) ? f.match : {},
|
|
1095
1123
|
updatedAt: typeof f.updatedAt === "string" ? f.updatedAt : void 0
|
|
@@ -1114,6 +1142,7 @@ function validateBundle(raw) {
|
|
|
1114
1142
|
};
|
|
1115
1143
|
});
|
|
1116
1144
|
}
|
|
1145
|
+
if (raw.fieldsPartial === true && out.fields) out.fieldsPartial = true;
|
|
1117
1146
|
if (!out.fields && !out.datasets) throw new ImportError("Dosyada ne alan tanımı ne de veri seti var.");
|
|
1118
1147
|
return out;
|
|
1119
1148
|
}
|
|
@@ -1126,8 +1155,15 @@ function applyBundle(state, b, mode) {
|
|
|
1126
1155
|
datasetsUpdated: 0,
|
|
1127
1156
|
rows: 0
|
|
1128
1157
|
};
|
|
1129
|
-
const fields = b.fields ?? [];
|
|
1130
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 ?? [];
|
|
1131
1167
|
sum.rows = datasets.reduce((n, d) => n + d.rows.length, 0);
|
|
1132
1168
|
if (mode === "copy") {
|
|
1133
1169
|
fields.forEach((f) => state.fields.push({
|
|
@@ -1142,7 +1178,7 @@ function applyBundle(state, b, mode) {
|
|
|
1142
1178
|
_id: uid()
|
|
1143
1179
|
}))
|
|
1144
1180
|
}));
|
|
1145
|
-
sum.fieldsAdded
|
|
1181
|
+
sum.fieldsAdded += fields.length;
|
|
1146
1182
|
sum.datasetsAdded = datasets.length;
|
|
1147
1183
|
return sum;
|
|
1148
1184
|
}
|
|
@@ -1157,19 +1193,7 @@ function applyBundle(state, b, mode) {
|
|
|
1157
1193
|
}
|
|
1158
1194
|
return sum;
|
|
1159
1195
|
}
|
|
1160
|
-
|
|
1161
|
-
const i = state.fields.findIndex((x) => x.id === f.id || x.key === f.key && x.pages.join("|") === f.pages.join("|"));
|
|
1162
|
-
if (i >= 0) {
|
|
1163
|
-
state.fields[i] = {
|
|
1164
|
-
...f,
|
|
1165
|
-
id: state.fields[i].id
|
|
1166
|
-
};
|
|
1167
|
-
sum.fieldsUpdated++;
|
|
1168
|
-
} else {
|
|
1169
|
-
state.fields.push(f);
|
|
1170
|
-
sum.fieldsAdded++;
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1196
|
+
mergeFields(state, fields, sum);
|
|
1173
1197
|
for (const d of datasets) {
|
|
1174
1198
|
const ex = state.datasets.find((x) => x.id === d.id) ?? state.datasets.find((x) => x.name === d.name);
|
|
1175
1199
|
if (!ex) {
|
|
@@ -1187,6 +1211,22 @@ function applyBundle(state, b, mode) {
|
|
|
1187
1211
|
}
|
|
1188
1212
|
return sum;
|
|
1189
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
|
+
}
|
|
1190
1230
|
/** Excel (Türkçe) ile uyumlu olsun diye ; ayırıcı ve UTF-8 BOM kullanılır. */
|
|
1191
1231
|
function datasetToCsv(ds, keys = datasetKeys(ds)) {
|
|
1192
1232
|
const cell = (v) => {
|
|
@@ -1433,6 +1473,13 @@ label.opt { display: flex; gap: 6px; align-items: flex-start; cursor: pointer; }
|
|
|
1433
1473
|
.pop .row select { width: auto; flex: 1; min-width: 0; }
|
|
1434
1474
|
.pop .sep { border-top: 1px solid #e5e7eb; margin: 2px 0; }
|
|
1435
1475
|
.pop .lbl.warn { color: #b45309; }
|
|
1476
|
+
table.edit td { max-width: none; padding: 1px 2px; }
|
|
1477
|
+
table.edit th { white-space: nowrap; }
|
|
1478
|
+
table.edit th .colx { visibility: hidden; border: 0; background: transparent; color: #b91c1c; cursor: pointer; font-size: 12px; padding: 0 3px; }
|
|
1479
|
+
table.edit th:hover .colx { visibility: visible; }
|
|
1480
|
+
table.edit input.cell { width: 100%; min-width: 70px; border: 1px solid transparent; border-radius: 4px; padding: 3px 4px; font-size: 11px; background: transparent; }
|
|
1481
|
+
table.edit input.cell:hover { border-color: #e5e7eb; }
|
|
1482
|
+
table.edit input.cell:focus { border-color: #2563eb; background: #fff; outline: none; }
|
|
1436
1483
|
`;
|
|
1437
1484
|
// src/panel/panel.ts
|
|
1438
1485
|
var KIND_TR = {
|
|
@@ -1473,6 +1520,7 @@ var Panel = class {
|
|
|
1473
1520
|
this.view = "fill";
|
|
1474
1521
|
this.result = null;
|
|
1475
1522
|
this.lastFill = null;
|
|
1523
|
+
this.quiet = false;
|
|
1476
1524
|
this.toastMsg = "";
|
|
1477
1525
|
this.toastKind = "ok";
|
|
1478
1526
|
this.toastTimer = 0;
|
|
@@ -1632,7 +1680,11 @@ var Panel = class {
|
|
|
1632
1680
|
window.addEventListener("keydown", this.onKey, true);
|
|
1633
1681
|
window.addEventListener("scroll", this.onViewport, true);
|
|
1634
1682
|
window.addEventListener("resize", this.onViewport);
|
|
1635
|
-
subscribe(() =>
|
|
1683
|
+
subscribe(() => {
|
|
1684
|
+
if (this.quiet) return;
|
|
1685
|
+
if (this.visible) this.refresh();
|
|
1686
|
+
else if (this.minimized) this.renderMini();
|
|
1687
|
+
});
|
|
1636
1688
|
}
|
|
1637
1689
|
show() {
|
|
1638
1690
|
this.mount();
|
|
@@ -1963,6 +2015,10 @@ var Panel = class {
|
|
|
1963
2015
|
class: m ? "ok" : "bad",
|
|
1964
2016
|
title: m ? `puan ${m.score}` : "sayfada bulunamadı"
|
|
1965
2017
|
}, m ? "●" : "○"), h("span", { class: "grow" }, h("span", { class: "key" }, def.key), def.title ? h("span", { class: "muted" }, ` · ${def.title}`) : null), h("span", { class: "muted" }, m ? String(m.score) : "—"), h("button", {
|
|
2018
|
+
class: "btn sm",
|
|
2019
|
+
title: "Anahtarı değiştir (veri setlerindeki sütun da değişir)",
|
|
2020
|
+
onClick: () => this.renameKey(def)
|
|
2021
|
+
}, "✎"), h("button", {
|
|
1966
2022
|
class: "btn sm dng",
|
|
1967
2023
|
title: "Tanımı sil",
|
|
1968
2024
|
onClick: () => {
|
|
@@ -2056,7 +2112,7 @@ var Panel = class {
|
|
|
2056
2112
|
let target = s.datasets.find((d) => d.id === (this.openDsId ?? s.prefs.lastDatasetId))?.id ?? s.datasets[0]?.id ?? "__new";
|
|
2057
2113
|
let newName = "";
|
|
2058
2114
|
let label = "";
|
|
2059
|
-
body.append(h("div", { class: "sec" }, "
|
|
2115
|
+
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", {
|
|
2060
2116
|
class: "grow",
|
|
2061
2117
|
onChange: (e) => {
|
|
2062
2118
|
target = e.target.value;
|
|
@@ -2086,26 +2142,40 @@ var Panel = class {
|
|
|
2086
2142
|
}
|
|
2087
2143
|
}), h("button", {
|
|
2088
2144
|
class: "btn pri",
|
|
2089
|
-
|
|
2145
|
+
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",
|
|
2090
2146
|
onClick: () => {
|
|
2091
|
-
const values = readRow(r);
|
|
2147
|
+
const values = keys.length ? readRow(r) : {};
|
|
2092
2148
|
let id = target;
|
|
2093
2149
|
if (target === "__new") id = createDataset(newName.trim() || `Veri ${(/* @__PURE__ */ new Date()).toLocaleDateString("tr-TR")}`).id;
|
|
2150
|
+
const ds = load().datasets.find((d) => d.id === id);
|
|
2094
2151
|
addRow(id, {
|
|
2095
2152
|
...values,
|
|
2096
|
-
|
|
2153
|
+
_label: label.trim() || `Satır ${(ds?.rows.length ?? 0) + 1}`
|
|
2097
2154
|
});
|
|
2098
2155
|
this.openDsId = id;
|
|
2099
|
-
this.toast(`${Object.keys(values).length} değer satır olarak kaydedildi.`);
|
|
2156
|
+
this.toast(keys.length ? `${Object.keys(values).length} değer satır olarak kaydedildi.` : "Satır eklendi; değerleri tabloda yazın.");
|
|
2100
2157
|
}
|
|
2101
|
-
}, "Kaydet")), h("div", { class: "sec" }, `Veri setleri (${s.datasets.length})`));
|
|
2158
|
+
}, keys.length ? "Kaydet" : "Satır ekle")), h("div", { class: "sec" }, `Veri setleri (${s.datasets.length})`));
|
|
2102
2159
|
if (!s.datasets.length) {
|
|
2103
2160
|
body.append(h("div", { class: "muted" }, "Henüz veri seti yok. Yukarıdan kaydedin ya da Aktar sekmesinden içe aktarın."));
|
|
2104
2161
|
return;
|
|
2105
2162
|
}
|
|
2106
2163
|
body.append(h("div", { class: "list" }, s.datasets.map((d) => {
|
|
2107
2164
|
const open = this.openDsId === d.id;
|
|
2108
|
-
const
|
|
2165
|
+
const dk = datasetKeys(d);
|
|
2166
|
+
const cols = [...keys.filter((k) => dk.includes(k)), ...dk.filter((k) => !keys.includes(k))];
|
|
2167
|
+
const extra = [.../* @__PURE__ */ new Set([...keys, ...s.fields.map((f) => f.key)])].filter((k) => !dk.includes(k));
|
|
2168
|
+
const cell = (row, c, placeholder = "") => h("td", {}, h("input", {
|
|
2169
|
+
type: "text",
|
|
2170
|
+
class: "cell",
|
|
2171
|
+
value: row[c] ?? "",
|
|
2172
|
+
placeholder,
|
|
2173
|
+
title: c === "_label" ? "Satır adı" : c,
|
|
2174
|
+
onChange: (e) => this.setCell(d.id, row._id, c, e.target.value),
|
|
2175
|
+
onKeydown: (e) => {
|
|
2176
|
+
if (e.key === "Enter") e.target.blur();
|
|
2177
|
+
}
|
|
2178
|
+
}));
|
|
2109
2179
|
return h("div", {}, h("div", {
|
|
2110
2180
|
class: "item click",
|
|
2111
2181
|
onClick: () => {
|
|
@@ -2114,7 +2184,28 @@ var Panel = class {
|
|
|
2114
2184
|
}
|
|
2115
2185
|
}, h("span", {}, open ? "▾" : "▸"), h("span", { class: "grow" }, d.name), h("span", { class: "muted" }, `${d.rows.length} satır`), h("button", {
|
|
2116
2186
|
class: "btn sm",
|
|
2117
|
-
title: "
|
|
2187
|
+
title: "Veri setinin adını değiştir",
|
|
2188
|
+
onClick: (e) => {
|
|
2189
|
+
e.stopPropagation();
|
|
2190
|
+
const name = prompt("Veri setinin yeni adı", d.name)?.trim();
|
|
2191
|
+
if (name && name !== d.name) update((st) => {
|
|
2192
|
+
const x = st.datasets.find((y) => y.id === d.id);
|
|
2193
|
+
if (x) {
|
|
2194
|
+
x.name = name;
|
|
2195
|
+
x.updatedAt = nowIso();
|
|
2196
|
+
}
|
|
2197
|
+
});
|
|
2198
|
+
}
|
|
2199
|
+
}, "✎"), h("button", {
|
|
2200
|
+
class: "btn sm",
|
|
2201
|
+
title: "Veri + kullandığı alan tanımları: başka adreste içe aktarınca alanlar da gelir",
|
|
2202
|
+
onClick: (e) => {
|
|
2203
|
+
e.stopPropagation();
|
|
2204
|
+
exportJson({ datasets: [d.id] }, `otofill-${slug(d.name) || "veri"}.json`);
|
|
2205
|
+
}
|
|
2206
|
+
}, "JSON"), h("button", {
|
|
2207
|
+
class: "btn sm",
|
|
2208
|
+
title: "CSV indir (yalnızca veri, Excel için)",
|
|
2118
2209
|
onClick: (e) => {
|
|
2119
2210
|
e.stopPropagation();
|
|
2120
2211
|
exportCsv(d.id);
|
|
@@ -2128,16 +2219,106 @@ var Panel = class {
|
|
|
2128
2219
|
}, "Sil")), open ? h("div", { style: {
|
|
2129
2220
|
padding: "0 8px 8px",
|
|
2130
2221
|
overflowX: "auto"
|
|
2131
|
-
} }, h("table", {
|
|
2222
|
+
} }, h("table", { class: "edit" }, h("tr", {}, h("th", {}, "Satır"), cols.map((c) => h("th", { title: c }, c, h("button", {
|
|
2223
|
+
class: "colx",
|
|
2224
|
+
title: `"${c}" sütununu sil`,
|
|
2225
|
+
onClick: () => {
|
|
2226
|
+
if (!confirm(`"${c}" sütunu bu veri setinden silinsin mi? (alan tanımı kalır)`)) return;
|
|
2227
|
+
update((st) => {
|
|
2228
|
+
const x = st.datasets.find((y) => y.id === d.id);
|
|
2229
|
+
if (x) {
|
|
2230
|
+
x.rows.forEach((rw) => delete rw[c]);
|
|
2231
|
+
x.updatedAt = nowIso();
|
|
2232
|
+
}
|
|
2233
|
+
});
|
|
2234
|
+
}
|
|
2235
|
+
}, "×"))), h("th", {})), d.rows.map((row) => h("tr", {}, cell(row, "_label", rowTitle(row)), cols.map((c) => cell(row, c)), h("td", { style: { whiteSpace: "nowrap" } }, h("button", {
|
|
2236
|
+
class: "btn sm",
|
|
2237
|
+
title: "Satırı çoğalt",
|
|
2238
|
+
onClick: () => update((st) => {
|
|
2239
|
+
const x = st.datasets.find((y) => y.id === d.id);
|
|
2240
|
+
const i = x?.rows.findIndex((y) => y._id === row._id) ?? -1;
|
|
2241
|
+
if (!x || i < 0) return;
|
|
2242
|
+
x.rows.splice(i + 1, 0, {
|
|
2243
|
+
...row,
|
|
2244
|
+
_id: uid(),
|
|
2245
|
+
...row._label ? { _label: `${row._label} (kopya)` } : {}
|
|
2246
|
+
});
|
|
2247
|
+
x.updatedAt = nowIso();
|
|
2248
|
+
})
|
|
2249
|
+
}, "⧉"), h("button", {
|
|
2132
2250
|
class: "btn sm dng",
|
|
2133
2251
|
title: "Satırı sil",
|
|
2134
2252
|
onClick: () => removeRow(d.id, row._id)
|
|
2135
2253
|
}, "×"))))), h("div", {
|
|
2254
|
+
class: "row",
|
|
2255
|
+
style: { marginTop: "6px" }
|
|
2256
|
+
}, h("button", {
|
|
2257
|
+
class: "btn sm",
|
|
2258
|
+
onClick: () => {
|
|
2259
|
+
addRow(d.id, { _label: `Satır ${d.rows.length + 1}` });
|
|
2260
|
+
}
|
|
2261
|
+
}, "+ Satır"), extra.length ? h("select", {
|
|
2262
|
+
class: "grow",
|
|
2263
|
+
title: "Veri setine sütun (alan) ekle",
|
|
2264
|
+
onChange: (e) => {
|
|
2265
|
+
const k = e.target.value;
|
|
2266
|
+
if (!k) return;
|
|
2267
|
+
update((st) => {
|
|
2268
|
+
const ds = st.datasets.find((x) => x.id === d.id);
|
|
2269
|
+
if (!ds) return;
|
|
2270
|
+
if (!ds.rows.length) ds.rows.push({
|
|
2271
|
+
_id: uid(),
|
|
2272
|
+
_label: "Satır 1"
|
|
2273
|
+
});
|
|
2274
|
+
ds.rows.forEach((rw) => {
|
|
2275
|
+
rw[k] ??= "";
|
|
2276
|
+
});
|
|
2277
|
+
ds.updatedAt = nowIso();
|
|
2278
|
+
});
|
|
2279
|
+
}
|
|
2280
|
+
}, h("option", { value: "" }, "+ Sütun ekle…"), extra.map((k) => h("option", { value: k }, k))) : ""), h("div", {
|
|
2136
2281
|
class: "muted",
|
|
2137
2282
|
style: { marginTop: "4px" }
|
|
2138
|
-
}, "
|
|
2283
|
+
}, "Hücreye tıklayıp yazın; boş hücre doldurulmaz.")) : null);
|
|
2139
2284
|
})));
|
|
2140
2285
|
}
|
|
2286
|
+
/** Alan anahtarını değiştirir; veri setlerindeki aynı adlı sütun da yeni ada taşınır. */
|
|
2287
|
+
renameKey(def) {
|
|
2288
|
+
const next = prompt("Yeni anahtar (veri setlerindeki sütun adı da değişir)", def.key)?.trim();
|
|
2289
|
+
if (!next || next === def.key) return;
|
|
2290
|
+
const old = def.key;
|
|
2291
|
+
update((st) => {
|
|
2292
|
+
st.fields.forEach((f) => {
|
|
2293
|
+
if (f.key === old) {
|
|
2294
|
+
f.key = next;
|
|
2295
|
+
f.updatedAt = nowIso();
|
|
2296
|
+
}
|
|
2297
|
+
});
|
|
2298
|
+
st.datasets.forEach((d) => d.rows.forEach((rw) => {
|
|
2299
|
+
if (old in rw && !(next in rw)) rw[next] = rw[old];
|
|
2300
|
+
delete rw[old];
|
|
2301
|
+
}));
|
|
2302
|
+
});
|
|
2303
|
+
this.toast(`"${old}" → "${next}"`);
|
|
2304
|
+
}
|
|
2305
|
+
/** Tablodaki tek hücreyi kaydeder; panel yeniden çizilmez, böylece Tab ile sonraki hücreye geçilebilir. */
|
|
2306
|
+
setCell(dsId, rowId, key, value) {
|
|
2307
|
+
this.quiet = true;
|
|
2308
|
+
try {
|
|
2309
|
+
update((st) => {
|
|
2310
|
+
const row = st.datasets.find((x) => x.id === dsId)?.rows.find((x) => x._id === rowId);
|
|
2311
|
+
if (!row) return;
|
|
2312
|
+
const v = value.trim();
|
|
2313
|
+
if (key === "_label" && !v) delete row._label;
|
|
2314
|
+
else row[key] = v;
|
|
2315
|
+
const ds = st.datasets.find((x) => x.id === dsId);
|
|
2316
|
+
ds.updatedAt = nowIso();
|
|
2317
|
+
});
|
|
2318
|
+
} finally {
|
|
2319
|
+
this.quiet = false;
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2141
2322
|
renderIo(body) {
|
|
2142
2323
|
const s = load();
|
|
2143
2324
|
let csvId = s.datasets[0]?.id;
|
|
@@ -2201,7 +2382,8 @@ var Panel = class {
|
|
|
2201
2382
|
onClick: () => exportJson({ fields: true }, `otofill-alanlar-${location.hostname}.json`)
|
|
2202
2383
|
}, "Alan tanımları"), h("button", {
|
|
2203
2384
|
class: "btn",
|
|
2204
|
-
onClick: () => exportJson({ datasets: true }, "otofill-veri.json")
|
|
2385
|
+
onClick: () => exportJson({ datasets: true }, "otofill-veri.json"),
|
|
2386
|
+
title: "Veri setleri ve kullandıkları alan tanımları"
|
|
2205
2387
|
}, "Veri setleri")), s.datasets.length ? h("div", { class: "row" }, h("select", {
|
|
2206
2388
|
class: "grow",
|
|
2207
2389
|
onChange: (e) => {
|
|
@@ -2210,7 +2392,7 @@ var Panel = class {
|
|
|
2210
2392
|
}, s.datasets.map((d) => h("option", { value: d.id }, d.name))), h("button", {
|
|
2211
2393
|
class: "btn",
|
|
2212
2394
|
onClick: () => csvId && exportCsv(csvId)
|
|
2213
|
-
}, "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", {
|
|
2395
|
+
}, "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", {
|
|
2214
2396
|
placeholder: "ya da JSON / CSV metnini buraya yapıştırın",
|
|
2215
2397
|
onInput: (e) => {
|
|
2216
2398
|
pasted = e.target.value;
|
|
@@ -2218,7 +2400,7 @@ var Panel = class {
|
|
|
2218
2400
|
}), h("div", { class: "row" }, h("button", {
|
|
2219
2401
|
class: "btn grow",
|
|
2220
2402
|
onClick: () => runImport(() => summaryText(importText(pasted, this.importMode, pasted.trimStart().startsWith("{") ? "yapistirilan.json" : `Yapıştırılan ${(/* @__PURE__ */ new Date()).toLocaleString("tr-TR")}.csv`)))
|
|
2221
|
-
}, "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.
|
|
2403
|
+
}, "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.3.`), h("div", { class: "row" }, h("button", {
|
|
2222
2404
|
class: "btn dng",
|
|
2223
2405
|
onClick: () => {
|
|
2224
2406
|
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.`)) {
|
|
@@ -2496,7 +2678,7 @@ var Panel = class {
|
|
|
2496
2678
|
* 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.
|
|
2497
2679
|
* Kütüphane şirketinize ait hiçbir veri içermez ve hiçbir yere istek atmaz.
|
|
2498
2680
|
*/
|
|
2499
|
-
var version = "0.1.
|
|
2681
|
+
var version = "0.1.3";
|
|
2500
2682
|
var panel = null;
|
|
2501
2683
|
/** Kısayolu dinlemeye başlar. Birden fazla çağrılırsa ilk çağrı geçerlidir. */
|
|
2502
2684
|
function init(opts = {}) {
|
package/dist/otofill.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 ee(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 u(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 te(e=location){return`${e.origin}/*`}function d(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 f(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e.replace(/["\\#.:[\]()>+~*^$|=\s]/g,`\\$&`)}function p(e){if(e.id&&!d(e.id))return`#${f(e.id)}`;let t=[],n=e;for(;n&&t.length<6;){if(n!==e&&n.id&&!d(n.id)){t.unshift(`#${f(n.id)}`);break}let r=n.tagName.toLowerCase(),i=n.getAttribute(`name`);n===e&&i&&(r+=`[name="${f(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 m=e=>new Promise(t=>setTimeout(t,e)),ne=`optona-otofill`,h=`input, textarea, select, [contenteditable=""], [contenteditable="true"]`,re=new Set([`hidden`,`submit`,`button`,`reset`,`image`,`file`]),g=`.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`,_=`label, .el-form-item__label, .ant-form-item-label, .n-form-item-label, .v-label, .q-field__label, legend`,v=e=>e.tagName.toLowerCase();function y(e){let t=v(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 b(e){return!(!e||!e.matches?.(h)||v(e)===`input`&&re.has((e.getAttribute(`type`)??`text`).toLowerCase()))}function x(e){if(!e)return null;if(b(e))return e;let t=e.closest(`label`);if(t?.control&&b(t.control))return t.control;let n=e.closest(h);if(n&&b(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(h);return r&&b(r)?r:null}function S(e){if(!e.getClientRects().length)return!1;let t=getComputedStyle(e);return t.visibility!==`hidden`&&t.display!==`none`}function C(e){let t=y(e);if(t===`checkbox`||t===`radio`){if(S(e))return!0;let t=e.closest(`label`)??(e.id?e.getRootNode():null)?.querySelector?.(`label[for="${f(e.id)}"]`);return!!(t&&S(t))||!!(e.parentElement&&S(e.parentElement))}return S(e)}function w(e){return(e??``).replace(/\s+/g,` `).replace(/^[*\s]+|[*:\s]+$/g,``).trim().slice(0,80)}function T(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 w(n)}function ie(e,t){return e.getRootNode().getElementById?.(t)??e.ownerDocument.getElementById(t)}function E(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=w(e.textContent);if(t)return t}else if(e.nodeType===Node.ELEMENT_NODE){let t=e;if(t.matches(h)||t.querySelector(h))return``;let n=w(t.textContent);if(n)return n}e=e.previousSibling}if(t=t.parentElement,!t||t.tagName===`FORM`||t.tagName===`BODY`)break}return``}function D(e){let t=e.getAttribute(`aria-labelledby`);if(t){let n=w(t.split(/\s+/).map(t=>ie(e,t)?.textContent??``).join(` `));if(n)return n}if(e.id){let t=e.getRootNode().querySelector?.(`label[for="${f(e.id)}"]`);if(t){let n=T(t,e);if(n)return n}}let n=e.closest(`label`);if(n){let t=T(n,e);if(t)return t}let r=w(e.getAttribute(`aria-label`));if(r)return r;let i=e.closest(g);if(i){let t=i.querySelector(_);if(t&&!t.contains(e)){let n=T(t,e);if(n)return n}}return E(e)}function O(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="${f(t)}"]`))}function k(e){if(e.id){let t=e.getRootNode().querySelector?.(`label[for="${f(e.id)}"]`);if(t)return T(t,e)}let t=e.closest(`label`);if(t)return T(t,e);let n=e.nextSibling;for(;n&&n.nodeType===Node.TEXT_NODE&&!w(n.textContent);)n=n.nextSibling;return w(n?.textContent)}function ae(e){let t=O(e),n=e.closest(`fieldset`)?.querySelector(`legend`);if(n)return w(n.textContent);let r=e.closest(`[role="radiogroup"]`);if(r){let t=w(r.getAttribute(`aria-label`))||(r.getAttribute(`aria-labelledby`)?w(ie(e,r.getAttribute(`aria-labelledby`))?.textContent):``);if(t)return t}let i=e.closest(g);if(i){let e=Array.from(i.querySelectorAll(_)).find(e=>!t.some(t=>e.contains(t)||t.id&&e.getAttribute(`for`)===t.id));if(e)return w(e.textContent)}let a=e.parentElement;for(;a&&!t.every(e=>a.contains(e));)a=a.parentElement;return a?E(a):``}function oe(e){let t=O(e),n=e.parentElement;for(;n&&!t.every(e=>n.contains(e));)n=n.parentElement;return n?`${p(n)} input[type="radio"]`:p(e)}function se(e){let t=e.closest(`form`);if(t)return(t.id&&!d(t.id)?t.id:``)||t.getAttribute(`name`)||void 0}function A(e,t=0){let n=y(e),r=e.getAttribute(`name`)||void 0,i=r&&!d(r)?r:void 0;return{el:e,kind:n,tag:v(e),type:e.getAttribute(`type`)?.toLowerCase()||void 0,otofill:e.getAttribute(`data-otofill`)||void 0,id:e.id&&!d(e.id)?e.id:void 0,name:i,label:(n===`radio`?ae(e):D(e))||void 0,placeholder:e.getAttribute(`placeholder`)||void 0,ariaLabel:e.getAttribute(`aria-label`)||void 0,css:n===`radio`?i?`input[type="radio"][name="${f(i)}"]`:oe(e):p(e),formKey:se(e),index:t}}function ce(e,t){e.querySelectorAll(h).forEach(e=>{b(e)&&!e.disabled&&C(e)&&t.push(e)}),e.querySelectorAll(`*`).forEach(e=>{if(e.tagName.toLowerCase()===`optona-otofill`)return;let n=e.shadowRoot;if(n&&ce(n,t),e.tagName===`IFRAME`)try{let n=e.contentDocument;n&&ce(n,t)}catch{}})}function j(e=document){let t=[];ce(e,t);let n=new Set,r=[];for(let e of t)if(y(e)===`radio`){let t=O(e);if(n.has(t[0]))continue;n.add(t[0]),r.push(A(t[0],r.length))}else r.push(A(e,r.length));return r}function le(e){let{el:t,kind:n,...r}=e;return r}function M(e,t){e.dispatchEvent(new Event(t,{bubbles:!0}))}function N(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 P(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 ue(e){if(!e||!e.isConnected||!e.getClientRects().length)return!1;let t=getComputedStyle(e);return t.visibility!==`hidden`&&t.display!==`none`}async function F(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 m(n)}}function de(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 fe=e=>e.split(`|`).map(e=>e.trim()).filter(Boolean);function pe(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 me(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 he=e=>e.tagName===`INPUT`;function ge(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`&&ue(i()),items:()=>Array.from(i()?.querySelectorAll(`.el-select-dropdown__item`)??[]).filter(e=>ue(e)&&!e.classList.contains(`is-disabled`))}}async function _e(e){e.isOpen()&&(N(e.input,`Escape`),await F(()=>!e.isOpen(),300)||(e.wrapper.click(),await F(()=>!e.isOpen(),300)))}var ve={name:`element-plus-select`,detect:e=>he(e)&&!!e.closest(`.el-select`),async fill(e,t){let n=ge(e),r=fe(t);if(!r.length)return!0;if(n.isOpen()||n.wrapper.click(),!await F(()=>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=>de([e],t))||(e.click(),await m(30));let o=!0;for(let e of r){a&&(P(n.input,e),M(n.input,`input`),await m(120));let t=await F(()=>de(n.items(),e),500);if(!t)o=!1;else if(!(i&&t.classList.contains(`is-selected`))){if(t.click(),await m(40),!i)break;n.isOpen()||n.wrapper.click()}}return await _e(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 I(){let e=Array.from(document.querySelectorAll(`.el-popper .el-cascader-panel`)).filter(ue);return e[e.length-1]??null}var ye=[ve,{name:`element-plus-cascader`,detect:e=>he(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=I();if(!i&&(n.click(),i=await F(I,800),!i))return!1;for(let t=0;t<r.length;t++){let n=await F(()=>{let e=i.querySelectorAll(`.el-cascader-menu`)[t];return de(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 N(e,`Escape`),document.body.click(),!1;n.click(),await m(60)}return I()&&(N(e,`Escape`),await m(50),I()&&document.body.click()),!0},read:e=>e.value},{name:`element-plus-date`,detect:e=>he(e)&&!!e.closest(`.el-date-editor`),async fill(e,t){let n=e;for(let e of pe(t))if(n.focus({preventScroll:!0}),P(n,e),M(n,`input`),M(n,`change`),await m(40),N(n,`Escape`),n.blur(),await m(40),n.value&&me(n.value,e))return!0;return!1},read:e=>e.value}],be=new Set([`1`,`true`,`evet`,`e`,`yes`,`y`,`on`,`x`,`secili`,`checked`]),xe=e=>be.has(i(e))||e.trim()===`✓`;function Se(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 Ce={name:`native-text`,detect:e=>[`text`,`textarea`,`date`].includes(y(e)),fill(e,t){let n=e,r=(n.getAttribute(`type`)??`text`).toLowerCase(),i=y(e)===`date`?Se(t,r):t;return n.focus({preventScroll:!0}),P(n,i),M(n,`input`),M(n,`change`),n.blur(),y(e)!==`date`||n.value!==``||i===``},read:e=>e.value};function we(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 Te={name:`native-select`,detect:e=>e.tagName===`SELECT`,fill(e,t){let n=e,r=we(n,t);return r?(P(n,r.value),M(n,`input`),M(n,`change`),!0):!1},read(e){let t=e.selectedOptions[0];return t&&t.value!==``?t.text.trim():``}},Ee={name:`native-checkbox`,detect:e=>y(e)===`checkbox`,fill(e,t){let n=e;return n.checked!==xe(t)&&n.click(),!0},read:e=>e.checked?`true`:`false`},De={name:`native-radio`,detect:e=>y(e)===`radio`,fill(e,t){let n=O(e),r=i(t),o=n.find(e=>e.value===t)??n.find(e=>i(k(e))===r)??n.find(e=>i(e.value)===r)??n.find(e=>a(k(e),t)>=.8);return o?(o.checked||o.click(),!0):!1},read(e){let t=O(e).find(e=>e.checked);return t?k(t)||t.value:``}},Oe={name:`contenteditable`,detect:e=>y(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??``},ke=[...ye,Ee,De,Te,Oe,Ce],L=[];function Ae(e){let t=L.findIndex(t=>t.name===e.name);t>=0?L[t]=e:L.unshift(e)}function je(e){return L.find(t=>t.detect(e))??ke.find(t=>t.detect(e))}async function Me(e,t){let n=je(e);return n?await n.fill(e,t):!1}function R(e){return je(e)?.read?.(e)}var Ne={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},Pe=30;function Fe(e,t){let n=e.match,r=Ne;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 Ie(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=Fe(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 Le=n({STATE_VERSION:()=>1,STORAGE_KEY:()=>Re,addRow:()=>Ze,clearAll:()=>Ge,createDataset:()=>Je,datasetKeys:()=>U,load:()=>V,migrate:()=>He,removeDataset:()=>Xe,removeField:()=>qe,removeRow:()=>Qe,save:()=>Ue,subscribe:()=>We,update:()=>H,upsertDataset:()=>Ye,upsertField:()=>Ke}),Re=`optona-otofill`,z=new Set,ze=null;function B(){return{v:1,fields:[],datasets:[],prefs:{cursor:{},closeAfterFill:!0}}}function Be(){try{return localStorage.getItem(Re)}catch{return ze}}function Ve(e){try{localStorage.setItem(Re,e)}catch{ze=e}}function He(e){let t=B();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 V(){let e=Be();if(!e)return B();try{return He(JSON.parse(e))}catch{return B()}}function Ue(e){Ve(JSON.stringify(e)),z.forEach(t=>t(e))}function H(e){let t=V();return e(t),Ue(t),t}function We(e){return z.add(e),()=>z.delete(e)}typeof window<`u`&&window.addEventListener(`storage`,e=>{if(e.key===`optona-otofill`){let e=V();z.forEach(t=>t(e))}});function Ge(){Ue(B())}function Ke(e){let t={...e,id:e.id??s(),updatedAt:c()};return H(e=>{let n=e.fields.findIndex(e=>e.id===t.id);n>=0?e.fields[n]=t:e.fields.push(t)}),t}function qe(e){H(t=>{t.fields=t.fields.filter(t=>t.id!==e)})}function Je(e,t=[]){let n={id:s(),name:e,rows:t,updatedAt:c()};return H(e=>{e.datasets.push(n)}),n}function Ye(e){H(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 Xe(e){H(t=>{t.datasets=t.datasets.filter(t=>t.id!==e),delete t.prefs.cursor[e]})}function Ze(e,t){let n={...t,_id:t._id??s()};return H(t=>{let r=t.datasets.find(t=>t.id===e);r&&(r.rows.push(n),r.updatedAt=c())}),n}function Qe(e,t){H(n=>{let r=n.datasets.find(t=>t.id===e);r&&(r.rows=r.rows.filter(e=>e._id!==t))})}function U(e){let t=new Set;return e.rows.forEach(e=>Object.keys(e).forEach(e=>!e.startsWith(`_`)&&t.add(e))),[...t]}function W(e=V().fields,t=location.href){return Ie(e,j(document),t)}async function G(e,t={}){let n=t.retries??3,r=t.delay??300,i=new Set,a=new Set,o=W(),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 Me(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 m(r),o=W()}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 $e(e=W()){let t={};for(let n of e.matches){if(n.fp.type===`password`)continue;let e=R(n.fp.el);e!==void 0&&e!==``&&(t[n.def.key]=e)}return t}function et(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 K(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 q=`optona-otofill`,tt=1,nt=n({ImportError:()=>J,applyBundle:()=>at,csvToDataset:()=>ct,datasetToCsv:()=>ot,download:()=>lt,exportCsv:()=>dt,exportJson:()=>ut,importFile:()=>pt,importText:()=>ft,makeBundle:()=>rt,parseCsv:()=>st,summaryText:()=>mt,validateBundle:()=>it});function rt(e=V(),t={fields:!0,datasets:!0}){let n={format:q,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 J=class extends Error{};function Y(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function it(e){if(!Y(e))throw new J(`Dosya bir JSON nesnesi değil.`);if(e.format!==`optona-otofill`)throw new J(`Bu bir Otofill dosyası değil (format: "${String(e.format)}").`);let t=Number(e.version);if(!t||t>1)throw new J(`Dosya sürümü (${String(e.version)}) bu kütüphaneden yeni. Kütüphaneyi güncelleyin.`);let n={format:q,version:1,exportedAt:String(e.exportedAt??c())};if(e.fields!==void 0){if(!Array.isArray(e.fields))throw new J(`"fields" bir dizi olmalı.`);n.fields=e.fields.map((e,t)=>{if(!Y(e)||typeof e.key!=`string`||!e.key.trim())throw new J(`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:Y(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 J(`"datasets" bir dizi olmalı.`);n.datasets=e.datasets.map((e,t)=>{if(!Y(e)||typeof e.name!=`string`)throw new J(`datasets[${t}]: "name" eksik.`);if(!Array.isArray(e.rows))throw new J(`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(!Y(e))throw new J(`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 J(`Dosyada ne alan tanımı ne de veri seti var.`);return n}function at(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 ot(e,t=U(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 {
|
|
@@ -74,4 +74,11 @@ label.opt { display: flex; gap: 6px; align-items: flex-start; cursor: pointer; }
|
|
|
74
74
|
.pop .row select { width: auto; flex: 1; min-width: 0; }
|
|
75
75
|
.pop .sep { border-top: 1px solid #e5e7eb; margin: 2px 0; }
|
|
76
76
|
.pop .lbl.warn { color: #b45309; }
|
|
77
|
-
`,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=`optona-otofill:ui`;function xt(){try{return JSON.parse(localStorage.getItem(bt)||`{}`)}catch{return{}}}function Z(e){try{localStorage.setItem(bt,JSON.stringify(e))}catch{}}var St=`<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>`,Ct=`<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>`,wt=e=>{let t=document.createElement(`span`);return t.className=`ico`,t.innerHTML=e,t},Tt=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.teachTarget={dsId:`__new`,rowId:`__new`},this.ui=xt(),this.minimized=!1,this.miniMsg=``,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.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=x(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=x(e.composedPath()[0]);t?this.openTeachPop(t):this.teachPop&&this.closeTeachPop()}}mount(){if(this.host)return;if(this.host=document.createElement(ne),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.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),We(()=>this.visible?this.refresh():this.minimized?this.renderMini():void 0)}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||=u(),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=W();let e=this.currentDataset();if(!e||!e.rows.length)return null;let t=V().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} › ${K(e.ds.rows[e.i])}`:`Bu sayfa için uygun veri yok: paneli açar`,onClick:()=>void this.quickFill()},wt(Ct),this.miniMsg||`Doldur`);this.mini.replaceChildren(r,X(`button`,{class:`mico`,title:`Paneli aç (Ctrl+Q)`,onClick:()=>this.show()},wt(St)),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];H(t=>{t.prefs.lastDatasetId=e.ds.id,t.prefs.cursor[e.ds.id]=(e.i+1)%e.ds.rows.length});let n=await G(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(`"${K(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=W(),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=V(),t=this.pageKeys(),n=et(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;H(n=>{n.prefs.lastDatasetId=e.id,n.prefs.cursor[e.id]=(t+1)%e.rows.length});let r=await G(n,{onFilled:e=>this.flash(e)});this.lastFill=r;let i=r.notFound.length+r.failed.length;V().prefs.closeAfterFill&&i===0?this.hide():this.toast(`"${K(n)}": ${r.filled.length} alan dolduruldu`+(i?`, ${i} sorunlu`:``),i?`err`:`ok`)}fillNext(e){let t=V().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()},wt(St)),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=V();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=et(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`},K(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=>H(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=u();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?`)&&qe(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`);H(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||u()],kind:e.kind,match:le(e),updatedAt:c()}}renderData(e){let t=this.result,n=V(),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=$e(t),n=i;i===`__new`&&(n=Je(a.trim()||`Veri ${new Date().toLocaleDateString(`tr-TR`)}`).id),Ze(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=>U(e).includes(t)):U(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(),dt(e.id)}},`CSV`),X(`button`,{class:`btn sm dng`,onClick:t=>{t.stopPropagation(),confirm(`"${e.name}" veri seti silinsin mi?`)&&Xe(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:K(t)},K(t)),n.map(e=>X(`td`,{title:t[e]??``},t[e]??``)),X(`td`,{},X(`button`,{class:`btn sm dng`,title:`Satırı sil`,onClick:()=>Qe(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=V(),n=t.datasets[0]?.id,r=``,i=async e=>{try{this.toast(await e())}catch(e){this.toast(e instanceof J?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}: ${mt(await pt(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}: ${mt(await pt(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:()=>ut({fields:!0,datasets:!0})},`Hepsi (JSON)`),X(`button`,{class:`btn`,onClick:()=>ut({fields:!0},`otofill-alanlar-${location.hostname}.json`)},`Alan tanımları`),X(`button`,{class:`btn`,onClick:()=>ut({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&&dt(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(()=>mt(ft(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.1.`),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.`)&&(Ge(),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||=u(),this.visible||this.show(),this.result=W(),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=y(e)===`radio`?O(e)[0]:e,n=j(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=V(),i=W();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(U)])].sort(),ee=`otofill-keys`,d=u(),f=te(),p=a?.pages[0]??(this.pattern||d),m=X(`input`,{type:`text`,list:ee,value:a?.key??(o(n.label||n.name||n.placeholder||n.id)||``),placeholder:`ör. musteri.tckn`}),ne=X(`input`,{type:`text`,value:a?.title??n.label??``,placeholder:`Açıklama (isteğe bağlı)`}),h=X(`select`,{},X(`option`,{value:d,selected:p===d||void 0},`Bu sayfa`),X(`option`,{value:f,selected:p===f||void 0},`Tüm site`),p!==d&&p!==f?X(`option`,{value:p,selected:!0},p):null),re=(t.getAttribute(`type`)??``).toLowerCase()===`password`,g=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`,_=g!==`__new`&&r.datasets.find(e=>e.id===g)?.rows.some(e=>e._id===this.teachTarget.rowId)?this.teachTarget.rowId:`__new`,v=()=>r.datasets.find(e=>e.id===g)?.rows.find(e=>e._id===_),b=()=>{let e=m.value.trim(),n=e?v()?.[e]:void 0;return n===void 0?re?``:R(t)??``:n},x=t.tagName===`SELECT`?Array.from(t.options).filter(e=>e.value!==``&&!e.disabled).map(e=>e.text.trim()).filter(Boolean):n.kind===`radio`?O(t).map(e=>k(e)||e.value):n.kind===`checkbox`?[`evet`,`hayır`]:[],S=X(`input`,{type:`text`,list:x.length?`otofill-choices`:void 0,value:b(),placeholder:re?`test hesabının şifresi (isteğe bağlı)`:`boş bırakılırsa veri yazılmaz`}),C=X(`select`,{class:`grow`}),w=X(`select`,{class:`grow`}),T=()=>{C.replaceChildren(...r.datasets.map(e=>X(`option`,{value:e.id,selected:e.id===g||void 0},e.name)),X(`option`,{value:`__new`,selected:g===`__new`||void 0},`+ Yeni veri seti`));let e=r.datasets.find(e=>e.id===g);w.replaceChildren(...(e?.rows??[]).map((e,t)=>X(`option`,{value:e._id,selected:e._id===_||void 0},`${t+1}. ${K(e)}`)),X(`option`,{value:`__new`,selected:_===`__new`||void 0},`+ Yeni satır`))};T(),C.addEventListener(`change`,()=>{g=C.value,_=`__new`,T(),S.value=b()}),w.addEventListener(`change`,()=>{_=w.value,S.value=b()}),m.addEventListener(`change`,()=>{let e=v()?.[m.value.trim()];e!==void 0&&(S.value=e)});let ie=()=>{let e=m.value.trim();if(!e){m.focus();return}let r=this.defFrom(n,e,ne.value.trim()||void 0,[h.value],a?.id),i=S.value,o=``;H(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===g);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===_);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}.`:`.`))},E=this.targetRectEl(t).getBoundingClientRect(),D=E.bottom+8+400>window.innerHeight?Math.max(8,E.top-400-8):E.bottom+8,ae=Math.min(Math.max(8,E.left),window.innerWidth-310);this.teachPop=X(`div`,{class:`pop`,style:{left:`${ae}px`,top:`${D}px`},onKeydown:e=>{e.key===`Enter`&&ie()}},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ı)`),m,X(`datalist`,{id:ee},l.map(e=>X(`option`,{value:e}))),X(`span`,{class:`lbl`},`Açıklama`),ne,X(`span`,{class:`lbl`},`Geçerli olduğu yer`),h,X(`div`,{class:`sep`}),X(`span`,{class:`lbl`},`Örnek değer (isteğe bağlı)`),S,x.length?X(`datalist`,{id:`otofill-choices`},x.map(e=>X(`option`,{value:e}))):null,re?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`},C,w),X(`div`,{class:`row`},a?X(`button`,{class:`btn dng`,onClick:()=>{qe(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:ie},`Kaydet`))),this.layer.appendChild(this.teachPop),m.focus(),m.select()}},Et=n({BUNDLE_FORMAT:()=>q,BUNDLE_VERSION:()=>1,THRESHOLD:()=>30,WEIGHTS:()=>Ne,analyze:()=>W,close:()=>kt,fill:()=>Mt,fillElement:()=>Me,fillRow:()=>G,fingerprint:()=>A,init:()=>$,io:()=>nt,labelOf:()=>D,matchFields:()=>Ie,open:()=>Ot,readElement:()=>R,readRow:()=>$e,registerDriver:()=>Ae,scanPage:()=>j,score:()=>Fe,setNativeValue:()=>P,store:()=>Le,teach:()=>jt,toggle:()=>At,version:()=>Dt}),Dt=`0.1.1`,Q=null;function $(e={}){if(Q||typeof document>`u`)return;Q=new Tt({hotkey:gt(e.hotkey??`ctrl+q`)});let t=()=>Q.mount();document.body?t():document.addEventListener(`DOMContentLoaded`,t,{once:!0})}function Ot(){$(),Q.show()}function kt(){Q?.hide()}function At(){$(),Q.toggle()}function jt(){$(),Q.startTeach()}async function Mt(e,t=0){let n=V().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 G(r)}var Nt=globalThis,Pt=document.currentScript;return Nt.__optonaOtofill?Nt.__optonaOtofill.open():(Nt.__optonaOtofill=Et,Pt?.dataset.auto!==`false`&&$({hotkey:Pt?.dataset.hotkey}),Pt?.dataset.open===`true`&&Ot()),e.BUNDLE_FORMAT=q,e.BUNDLE_VERSION=tt,e.THRESHOLD=Pe,e.WEIGHTS=Ne,e.analyze=W,e.close=kt,e.fill=Mt,e.fillElement=Me,e.fillRow=G,e.fingerprint=A,e.init=$,Object.defineProperty(e,"io",{enumerable:!0,get:function(){return nt}}),e.labelOf=D,e.matchFields=Ie,e.open=Ot,e.readElement=R,e.readRow=$e,e.registerDriver=Ae,e.scanPage=j,e.score=Fe,e.setNativeValue=P,Object.defineProperty(e,"store",{enumerable:!0,get:function(){return Le}}),e.teach=jt,e.toggle=At,e.version=Dt,e})({});
|
|
77
|
+
table.edit td { max-width: none; padding: 1px 2px; }
|
|
78
|
+
table.edit th { white-space: nowrap; }
|
|
79
|
+
table.edit th .colx { visibility: hidden; border: 0; background: transparent; color: #b91c1c; cursor: pointer; font-size: 12px; padding: 0 3px; }
|
|
80
|
+
table.edit th:hover .colx { visibility: visible; }
|
|
81
|
+
table.edit input.cell { width: 100%; min-width: 70px; border: 1px solid transparent; border-radius: 4px; padding: 3px 4px; font-size: 11px; background: transparent; }
|
|
82
|
+
table.edit input.cell:hover { border-color: #e5e7eb; }
|
|
83
|
+
table.edit input.cell:focus { border-color: #2563eb; background: #fff; outline: none; }
|
|
84
|
+
`,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`,title:`Anahtarı değiştir (veri setlerindeki sütun da değişir)`,onClick:()=>this.renameKey(e)},`✎`),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 setinin adını değiştir`,onClick:t=>{t.stopPropagation();let n=prompt(`Veri setinin yeni adı`,e.name)?.trim();n&&n!==e.name&&V(t=>{let r=t.datasets.find(t=>t.id===e.id);r&&(r.name=n,r.updatedAt=c())})}},`✎`),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(t=>X(`th`,{title:t},t,X(`button`,{class:`colx`,title:`"${t}" sütununu sil`,onClick:()=>{confirm(`"${t}" sütunu bu veri setinden silinsin mi? (alan tanımı kalır)`)&&V(n=>{let r=n.datasets.find(t=>t.id===e.id);r&&(r.rows.forEach(e=>delete e[t]),r.updatedAt=c())})}},`×`))),X(`th`,{})),e.rows.map(t=>X(`tr`,{},u(t,`_label`,G(t)),a.map(e=>u(t,e)),X(`td`,{style:{whiteSpace:`nowrap`}},X(`button`,{class:`btn sm`,title:`Satırı çoğalt`,onClick:()=>V(n=>{let r=n.datasets.find(t=>t.id===e.id),i=r?.rows.findIndex(e=>e._id===t._id)??-1;!r||i<0||(r.rows.splice(i+1,0,{...t,_id:s(),...t._label?{_label:`${t._label} (kopya)`}:{}}),r.updatedAt=c())})},`⧉`),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.`))}renameKey(e){let t=prompt(`Yeni anahtar (veri setlerindeki sütun adı da değişir)`,e.key)?.trim();if(!t||t===e.key)return;let n=e.key;V(e=>{e.fields.forEach(e=>{e.key===n&&(e.key=t,e.updatedAt=c())}),e.datasets.forEach(e=>e.rows.forEach(e=>{n in e&&!(t in e)&&(e[t]=e[n]),delete e[n]}))}),this.toast(`"${n}" → "${t}"`)}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.3.`),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.3`,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;
|
|
@@ -60,6 +62,10 @@ export declare class Panel {
|
|
|
60
62
|
private saveFree;
|
|
61
63
|
private defFrom;
|
|
62
64
|
private renderData;
|
|
65
|
+
/** Alan anahtarını değiştirir; veri setlerindeki aynı adlı sütun da yeni ada taşınır. */
|
|
66
|
+
private renameKey;
|
|
67
|
+
/** Tablodaki tek hücreyi kaydeder; panel yeniden çizilmez, böylece Tab ile sonraki hücreye geçilebilir. */
|
|
68
|
+
private setCell;
|
|
63
69
|
private renderIo;
|
|
64
70
|
private startDrag;
|
|
65
71
|
/** Küçük düğme de boş kısmından sürüklenebilir. */
|
|
@@ -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 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; }\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 th { white-space: nowrap; }\ntable.edit th .colx { visibility: hidden; border: 0; background: transparent; color: #b91c1c; cursor: pointer; font-size: 12px; padding: 0 3px; }\ntable.edit th:hover .colx { visibility: visible; }\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