@optona/otofill 0.1.2 → 0.1.4

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 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.0/dist/otofill.min.js"></script>
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 `import { init } from '@optona/otofill'; if (import.meta.env.DEV) init()`.
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 "satır olarak kaydet" deyin ya da yönetim sayfasında tablo
38
- olarak girin. Excel'de hazırlayıp CSV olarak da aktarabilirsiniz.
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. **Taşı:** Aktar sekmesi: JSON (alanlar ve/veya veri setleri) ya da CSV. İçe aktarırken üç seçenek var:
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
package/dist/otofill.js CHANGED
@@ -1407,8 +1407,17 @@ var CSS$1 = `
1407
1407
  position: fixed; top: 16px; right: 16px; width: 380px; max-height: calc(100vh - 32px);
1408
1408
  display: flex; flex-direction: column; background: #fff; color: #1f2937; font-size: 13px; line-height: 1.4;
1409
1409
  border: 1px solid #d1d5db; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.22); z-index: 2147483646; overflow: hidden;
1410
- resize: both; min-width: 300px; min-height: 160px; max-width: calc(100vw - 16px);
1411
- }
1410
+ min-width: 300px; min-height: 160px; max-width: calc(100vw - 16px);
1411
+ }
1412
+ .rz { position: absolute; z-index: 2; }
1413
+ .rz-n, .rz-s { left: 10px; right: 10px; height: 6px; cursor: ns-resize; }
1414
+ .rz-n { top: 0; } .rz-s { bottom: 0; }
1415
+ .rz-e, .rz-w { top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }
1416
+ .rz-e { right: 0; } .rz-w { left: 0; }
1417
+ .rz-nw, .rz-ne, .rz-sw, .rz-se { width: 10px; height: 10px; z-index: 3; }
1418
+ .rz-nw { top: 0; left: 0; cursor: nwse-resize; } .rz-se { bottom: 0; right: 0; cursor: nwse-resize; }
1419
+ .rz-ne { top: 0; right: 0; cursor: nesw-resize; } .rz-sw { bottom: 0; left: 0; cursor: nesw-resize; }
1420
+ .rz-se::after { content: ''; position: absolute; right: 5px; bottom: 5px; width: 7px; height: 7px; border-right: 2px solid #9ca3af; border-bottom: 2px solid #9ca3af; border-radius: 0 0 2px 0; }
1412
1421
  .ico { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
1413
1422
  .head button .ico { vertical-align: middle; }
1414
1423
  .mini {
@@ -1423,6 +1432,7 @@ var CSS$1 = `
1423
1432
  .mini .mico:hover { background: #374151; color: #fff; }
1424
1433
  .head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #111827; color: #fff; cursor: move; user-select: none; }
1425
1434
  .head b { font-size: 13px; letter-spacing: .2px; }
1435
+ .head .ver { font-size: 10px; color: #9ca3af; background: #1f2937; border-radius: 4px; padding: 0 4px; margin-left: -4px; }
1426
1436
  .head .sub { color: #9ca3af; font-size: 11px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1427
1437
  .head button { background: transparent; border: 0; color: #d1d5db; font-size: 16px; cursor: pointer; padding: 0 4px; }
1428
1438
  .tabs { display: flex; border-bottom: 1px solid #e5e7eb; background: #f9fafb; }
@@ -1474,6 +1484,9 @@ label.opt { display: flex; gap: 6px; align-items: flex-start; cursor: pointer; }
1474
1484
  .pop .sep { border-top: 1px solid #e5e7eb; margin: 2px 0; }
1475
1485
  .pop .lbl.warn { color: #b45309; }
1476
1486
  table.edit td { max-width: none; padding: 1px 2px; }
1487
+ table.edit th { white-space: nowrap; }
1488
+ table.edit th .colx { visibility: hidden; border: 0; background: transparent; color: #b91c1c; cursor: pointer; font-size: 12px; padding: 0 3px; }
1489
+ table.edit th:hover .colx { visibility: visible; }
1477
1490
  table.edit input.cell { width: 100%; min-width: 70px; border: 1px solid transparent; border-radius: 4px; padding: 3px 4px; font-size: 11px; background: transparent; }
1478
1491
  table.edit input.cell:hover { border-color: #e5e7eb; }
1479
1492
  table.edit input.cell:focus { border-color: #2563eb; background: #fff; outline: none; }
@@ -1653,18 +1666,6 @@ var Panel = class {
1653
1666
  });
1654
1667
  this.root.append(this.layer, this.box, this.mini);
1655
1668
  document.documentElement.appendChild(this.host);
1656
- if (typeof ResizeObserver !== "undefined") {
1657
- let t = 0;
1658
- new ResizeObserver(() => {
1659
- if (!this.visible || !this.box.style.width) return;
1660
- clearTimeout(t);
1661
- t = window.setTimeout(() => {
1662
- this.ui.w = this.box.style.width;
1663
- this.ui.h = this.box.style.height;
1664
- saveUi(this.ui);
1665
- }, 300);
1666
- }).observe(this.box);
1667
- }
1668
1669
  const onNav = () => this.minimized && this.renderMini();
1669
1670
  window.addEventListener("hashchange", onNav);
1670
1671
  window.addEventListener("popstate", onNav);
@@ -1738,7 +1739,10 @@ var Panel = class {
1738
1739
  applyBox() {
1739
1740
  const u = this.ui;
1740
1741
  if (u.w) this.box.style.width = u.w;
1741
- if (u.h) this.box.style.height = u.h;
1742
+ if (u.h) Object.assign(this.box.style, {
1743
+ height: u.h,
1744
+ maxHeight: "none"
1745
+ });
1742
1746
  if (u.left != null && u.top != null) {
1743
1747
  const left = Math.max(0, Math.min(window.innerWidth - 80, u.left));
1744
1748
  const top = Math.max(0, Math.min(window.innerHeight - 40, u.top));
@@ -1868,7 +1872,10 @@ var Panel = class {
1868
1872
  const header = h("div", {
1869
1873
  class: "head",
1870
1874
  onMousedown: this.startDrag
1871
- }, h("b", {}, "Otofill"), h("span", { class: "sub" }, `${r.matches.length}/${r.defs.length} alan · ${location.host}`), h("button", {
1875
+ }, h("b", {}, "Otofill"), h("span", {
1876
+ class: "ver",
1877
+ title: `@optona/otofill 0.1.4`
1878
+ }, `v0.1.4`), h("span", { class: "sub" }, `${r.matches.length}/${r.defs.length} alan · ${location.host}`), h("button", {
1872
1879
  title: "Yeniden tara",
1873
1880
  onClick: () => this.refresh()
1874
1881
  }, "⟳"), h("button", {
@@ -1894,7 +1901,19 @@ var Panel = class {
1894
1901
  else if (this.view === "data") this.renderData(body);
1895
1902
  else this.renderIo(body);
1896
1903
  const scroll = this.box.querySelector(".body")?.scrollTop ?? 0;
1897
- this.box.replaceChildren(header, tabs, body);
1904
+ this.box.replaceChildren(header, tabs, body, ...[
1905
+ "n",
1906
+ "s",
1907
+ "e",
1908
+ "w",
1909
+ "nw",
1910
+ "ne",
1911
+ "sw",
1912
+ "se"
1913
+ ].map((d) => h("div", {
1914
+ class: `rz rz-${d}`,
1915
+ onMousedown: (e) => this.startResize(d, e)
1916
+ })));
1898
1917
  body.scrollTop = scroll;
1899
1918
  }
1900
1919
  renderFill(body) {
@@ -2012,6 +2031,10 @@ var Panel = class {
2012
2031
  class: m ? "ok" : "bad",
2013
2032
  title: m ? `puan ${m.score}` : "sayfada bulunamadı"
2014
2033
  }, 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", {
2034
+ class: "btn sm",
2035
+ title: "Anahtarı değiştir (veri setlerindeki sütun da değişir)",
2036
+ onClick: () => this.renameKey(def)
2037
+ }, "✎"), h("button", {
2015
2038
  class: "btn sm dng",
2016
2039
  title: "Tanımı sil",
2017
2040
  onClick: () => {
@@ -2176,6 +2199,20 @@ var Panel = class {
2176
2199
  this.render();
2177
2200
  }
2178
2201
  }, h("span", {}, open ? "▾" : "▸"), h("span", { class: "grow" }, d.name), h("span", { class: "muted" }, `${d.rows.length} satır`), h("button", {
2202
+ class: "btn sm",
2203
+ title: "Veri setinin adını değiştir",
2204
+ onClick: (e) => {
2205
+ e.stopPropagation();
2206
+ const name = prompt("Veri setinin yeni adı", d.name)?.trim();
2207
+ if (name && name !== d.name) update((st) => {
2208
+ const x = st.datasets.find((y) => y.id === d.id);
2209
+ if (x) {
2210
+ x.name = name;
2211
+ x.updatedAt = nowIso();
2212
+ }
2213
+ });
2214
+ }
2215
+ }, "✎"), h("button", {
2179
2216
  class: "btn sm",
2180
2217
  title: "Veri + kullandığı alan tanımları: başka adreste içe aktarınca alanlar da gelir",
2181
2218
  onClick: (e) => {
@@ -2198,7 +2235,34 @@ var Panel = class {
2198
2235
  }, "Sil")), open ? h("div", { style: {
2199
2236
  padding: "0 8px 8px",
2200
2237
  overflowX: "auto"
2201
- } }, h("table", { class: "edit" }, h("tr", {}, h("th", {}, "Satır"), cols.map((c) => h("th", { title: c }, c)), h("th", {})), d.rows.map((row) => h("tr", {}, cell(row, "_label", rowTitle(row)), cols.map((c) => cell(row, c)), h("td", {}, h("button", {
2238
+ } }, h("table", { class: "edit" }, h("tr", {}, h("th", {}, "Satır"), cols.map((c) => h("th", { title: c }, c, h("button", {
2239
+ class: "colx",
2240
+ title: `"${c}" sütununu sil`,
2241
+ onClick: () => {
2242
+ if (!confirm(`"${c}" sütunu bu veri setinden silinsin mi? (alan tanımı kalır)`)) return;
2243
+ update((st) => {
2244
+ const x = st.datasets.find((y) => y.id === d.id);
2245
+ if (x) {
2246
+ x.rows.forEach((rw) => delete rw[c]);
2247
+ x.updatedAt = nowIso();
2248
+ }
2249
+ });
2250
+ }
2251
+ }, "×"))), 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", {
2252
+ class: "btn sm",
2253
+ title: "Satırı çoğalt",
2254
+ onClick: () => update((st) => {
2255
+ const x = st.datasets.find((y) => y.id === d.id);
2256
+ const i = x?.rows.findIndex((y) => y._id === row._id) ?? -1;
2257
+ if (!x || i < 0) return;
2258
+ x.rows.splice(i + 1, 0, {
2259
+ ...row,
2260
+ _id: uid(),
2261
+ ...row._label ? { _label: `${row._label} (kopya)` } : {}
2262
+ });
2263
+ x.updatedAt = nowIso();
2264
+ })
2265
+ }, "⧉"), h("button", {
2202
2266
  class: "btn sm dng",
2203
2267
  title: "Satırı sil",
2204
2268
  onClick: () => removeRow(d.id, row._id)
@@ -2235,6 +2299,25 @@ var Panel = class {
2235
2299
  }, "Hücreye tıklayıp yazın; boş hücre doldurulmaz.")) : null);
2236
2300
  })));
2237
2301
  }
2302
+ /** Alan anahtarını değiştirir; veri setlerindeki aynı adlı sütun da yeni ada taşınır. */
2303
+ renameKey(def) {
2304
+ const next = prompt("Yeni anahtar (veri setlerindeki sütun adı da değişir)", def.key)?.trim();
2305
+ if (!next || next === def.key) return;
2306
+ const old = def.key;
2307
+ update((st) => {
2308
+ st.fields.forEach((f) => {
2309
+ if (f.key === old) {
2310
+ f.key = next;
2311
+ f.updatedAt = nowIso();
2312
+ }
2313
+ });
2314
+ st.datasets.forEach((d) => d.rows.forEach((rw) => {
2315
+ if (old in rw && !(next in rw)) rw[next] = rw[old];
2316
+ delete rw[old];
2317
+ }));
2318
+ });
2319
+ this.toast(`"${old}" → "${next}"`);
2320
+ }
2238
2321
  /** Tablodaki tek hücreyi kaydeder; panel yeniden çizilmez, böylece Tab ile sonraki hücreye geçilebilir. */
2239
2322
  setCell(dsId, rowId, key, value) {
2240
2323
  this.quiet = true;
@@ -2333,7 +2416,7 @@ var Panel = class {
2333
2416
  }), h("div", { class: "row" }, h("button", {
2334
2417
  class: "btn grow",
2335
2418
  onClick: () => runImport(() => summaryText(importText(pasted, this.importMode, pasted.trimStart().startsWith("{") ? "yapistirilan.json" : `Yapıştırılan ${(/* @__PURE__ */ new Date()).toLocaleString("tr-TR")}.csv`)))
2336
- }, "Metinden içe aktar")), h("div", { class: "sec" }, "Depolama"), h("div", { class: "muted" }, `Veriler yalnızca bu tarayıcıda, ${location.origin} için saklanır; hiçbir yere gönderilmez. ${s.fields.length} alan tanımı, ${s.datasets.length} veri seti. Sürüm 0.1.2.`), h("div", { class: "row" }, h("button", {
2419
+ }, "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.4.`), h("div", { class: "row" }, h("button", {
2337
2420
  class: "btn dng",
2338
2421
  onClick: () => {
2339
2422
  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.`)) {
@@ -2343,6 +2426,52 @@ var Panel = class {
2343
2426
  }
2344
2427
  }, "Bu sitedeki tüm verileri sil")));
2345
2428
  }
2429
+ /** Kenar ve köşelerden boyutlandırma: n/s/e/w yönleri birleşebilir (nw, se ...). */
2430
+ startResize(dir, e) {
2431
+ e.preventDefault();
2432
+ e.stopPropagation();
2433
+ const r = this.box.getBoundingClientRect();
2434
+ const MIN_W = 300;
2435
+ const MIN_H = 160;
2436
+ const sx = e.clientX;
2437
+ const sy = e.clientY;
2438
+ const move = (ev) => {
2439
+ const dx = ev.clientX - sx;
2440
+ const dy = ev.clientY - sy;
2441
+ let { left, top, width, height } = r;
2442
+ if (dir.includes("e")) width = Math.min(window.innerWidth - left, Math.max(MIN_W, r.width + dx));
2443
+ if (dir.includes("w")) {
2444
+ width = Math.max(MIN_W, Math.min(r.right, r.width - dx));
2445
+ left = r.right - width;
2446
+ }
2447
+ if (dir.includes("s")) height = Math.min(window.innerHeight - top, Math.max(MIN_H, r.height + dy));
2448
+ if (dir.includes("n")) {
2449
+ height = Math.max(MIN_H, Math.min(r.bottom, r.height - dy));
2450
+ top = r.bottom - height;
2451
+ }
2452
+ Object.assign(this.box.style, {
2453
+ left: `${left}px`,
2454
+ top: `${top}px`,
2455
+ right: "auto",
2456
+ width: `${width}px`,
2457
+ height: `${height}px`,
2458
+ maxHeight: "none"
2459
+ });
2460
+ Object.assign(this.ui, {
2461
+ left,
2462
+ top,
2463
+ w: `${width}px`,
2464
+ h: `${height}px`
2465
+ });
2466
+ };
2467
+ const up = () => {
2468
+ window.removeEventListener("mousemove", move, true);
2469
+ window.removeEventListener("mouseup", up, true);
2470
+ saveUi(this.ui);
2471
+ };
2472
+ window.addEventListener("mousemove", move, true);
2473
+ window.addEventListener("mouseup", up, true);
2474
+ }
2346
2475
  targetRectEl(el) {
2347
2476
  if (el.getClientRects().length && el.getBoundingClientRect().width > 2) return el;
2348
2477
  return el.closest("label") ?? el.parentElement ?? el;
@@ -2611,7 +2740,7 @@ var Panel = class {
2611
2740
  * 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.
2612
2741
  * Kütüphane şirketinize ait hiçbir veri içermez ve hiçbir yere istek atmaz.
2613
2742
  */
2614
- var version = "0.1.2";
2743
+ var version = "0.1.4";
2615
2744
  var panel = null;
2616
2745
  /** Kısayolu dinlemeye başlar. Birden fazla çağrılırsa ilk çağrı geçerlidir. */
2617
2746
  function init(opts = {}) {
@@ -8,8 +8,17 @@ var Otofill=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Modu
8
8
  position: fixed; top: 16px; right: 16px; width: 380px; max-height: calc(100vh - 32px);
9
9
  display: flex; flex-direction: column; background: #fff; color: #1f2937; font-size: 13px; line-height: 1.4;
10
10
  border: 1px solid #d1d5db; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.22); z-index: 2147483646; overflow: hidden;
11
- resize: both; min-width: 300px; min-height: 160px; max-width: calc(100vw - 16px);
11
+ min-width: 300px; min-height: 160px; max-width: calc(100vw - 16px);
12
12
  }
13
+ .rz { position: absolute; z-index: 2; }
14
+ .rz-n, .rz-s { left: 10px; right: 10px; height: 6px; cursor: ns-resize; }
15
+ .rz-n { top: 0; } .rz-s { bottom: 0; }
16
+ .rz-e, .rz-w { top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }
17
+ .rz-e { right: 0; } .rz-w { left: 0; }
18
+ .rz-nw, .rz-ne, .rz-sw, .rz-se { width: 10px; height: 10px; z-index: 3; }
19
+ .rz-nw { top: 0; left: 0; cursor: nwse-resize; } .rz-se { bottom: 0; right: 0; cursor: nwse-resize; }
20
+ .rz-ne { top: 0; right: 0; cursor: nesw-resize; } .rz-sw { bottom: 0; left: 0; cursor: nesw-resize; }
21
+ .rz-se::after { content: ''; position: absolute; right: 5px; bottom: 5px; width: 7px; height: 7px; border-right: 2px solid #9ca3af; border-bottom: 2px solid #9ca3af; border-radius: 0 0 2px 0; }
13
22
  .ico { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
14
23
  .head button .ico { vertical-align: middle; }
15
24
  .mini {
@@ -24,6 +33,7 @@ var Otofill=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Modu
24
33
  .mini .mico:hover { background: #374151; color: #fff; }
25
34
  .head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #111827; color: #fff; cursor: move; user-select: none; }
26
35
  .head b { font-size: 13px; letter-spacing: .2px; }
36
+ .head .ver { font-size: 10px; color: #9ca3af; background: #1f2937; border-radius: 4px; padding: 0 4px; margin-left: -4px; }
27
37
  .head .sub { color: #9ca3af; font-size: 11px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
28
38
  .head button { background: transparent; border: 0; color: #d1d5db; font-size: 16px; cursor: pointer; padding: 0 4px; }
29
39
  .tabs { display: flex; border-bottom: 1px solid #e5e7eb; background: #f9fafb; }
@@ -75,7 +85,10 @@ label.opt { display: flex; gap: 6px; align-items: flex-start; cursor: pointer; }
75
85
  .pop .sep { border-top: 1px solid #e5e7eb; margin: 2px 0; }
76
86
  .pop .lbl.warn { color: #b45309; }
77
87
  table.edit td { max-width: none; padding: 1px 2px; }
88
+ table.edit th { white-space: nowrap; }
89
+ table.edit th .colx { visibility: hidden; border: 0; background: transparent; color: #b91c1c; cursor: pointer; font-size: 12px; padding: 0 3px; }
90
+ table.edit th:hover .colx { visibility: visible; }
78
91
  table.edit input.cell { width: 100%; min-width: 70px; border: 1px solid transparent; border-radius: 4px; padding: 3px 4px; font-size: 11px; background: transparent; }
79
92
  table.edit input.cell:hover { border-color: #e5e7eb; }
80
93
  table.edit input.cell:focus { border-color: #2563eb; background: #fff; outline: none; }
81
- `,St={text:`metin`,textarea:`çok satır`,select:`seçim`,checkbox:`onay kutusu`,radio:`seçenek grubu`,date:`tarih`,contenteditable:`zengin metin`,other:`diğer`},Ct=`optona-otofill:ui`;function wt(){try{return JSON.parse(localStorage.getItem(Ct)||`{}`)}catch{return{}}}function Z(e){try{localStorage.setItem(Ct,JSON.stringify(e))}catch{}}var Tt=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 14 10 14 10 20"/><polyline points="20 10 14 10 14 4"/><line x1="14" y1="10" x2="21" y2="3"/><line x1="3" y1="21" x2="10" y2="14"/></svg>`,Et=`<svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor" stroke="none"><path d="M13 2 3 14h9l-1 8 10-12h-9l1-8z"/></svg>`,Dt=e=>{let t=document.createElement(`span`);return t.className=`ico`,t.innerHTML=e,t},Ot=class{constructor(e){this.opts=e,this.visible=!1,this.view=`fill`,this.result=null,this.lastFill=null,this.quiet=!1,this.toastMsg=``,this.toastKind=`ok`,this.toastTimer=0,this.pattern=``,this.importMode=`merge`,this.inspecting=!1,this.teaching=!1,this.teachPop=null,this.freeSel=new Map,this.teachTarget={dsId:`__new`,rowId:`__new`},this.ui=wt(),this.minimized=!1,this.miniMsg=``,this.raf=0,this.onKey=e=>{if(bt(e,this.opts.hotkey)){e.preventDefault(),e.stopPropagation(),this.toggle();return}if(e.key===`Escape`){this.teachPop?(this.closeTeachPop(),e.preventDefault()):this.teaching&&(this.stopTeach(),e.preventDefault());return}if(!this.visible||this.view!==`fill`||this.teaching)return;let t=this.root.activeElement??document.activeElement;if(t&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)))return;let n=this.currentDataset();if(n){if(/^Digit[1-9]$/.test(e.code)&&!e.ctrlKey&&!e.altKey&&!e.metaKey){let t=Number(e.code.slice(5))-1;n.rows[t]&&(e.preventDefault(),this.fillWith(n,t))}else e.key===`Enter`&&!e.ctrlKey&&(e.preventDefault(),this.fillNext(n))}},this.startDrag=e=>{if(e.target.tagName===`BUTTON`)return;let t=this.box.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=e=>{this.ui.left=Math.max(0,Math.min(window.innerWidth-60,e.clientX-n)),this.ui.top=Math.max(0,Math.min(window.innerHeight-40,e.clientY-r)),Object.assign(this.box.style,{left:`${this.ui.left}px`,top:`${this.ui.top}px`,right:`auto`})},a=()=>{window.removeEventListener(`mousemove`,i,!0),window.removeEventListener(`mouseup`,a,!0),Z(this.ui)};window.addEventListener(`mousemove`,i,!0),window.addEventListener(`mouseup`,a,!0),e.preventDefault()},this.startMiniDrag=e=>{if(e.target.closest(`button`))return;let t=this.mini.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=e=>{this.ui.miniLeft=Math.max(0,Math.min(window.innerWidth-140,e.clientX-n)),this.ui.miniTop=Math.max(0,Math.min(window.innerHeight-40,e.clientY-r)),Object.assign(this.mini.style,{left:`${this.ui.miniLeft}px`,top:`${this.ui.miniTop}px`})},a=()=>{window.removeEventListener(`mousemove`,i,!0),window.removeEventListener(`mouseup`,a,!0),Z(this.ui)};window.addEventListener(`mousemove`,i,!0),window.addEventListener(`mouseup`,a,!0),e.preventDefault()},this.hoverEl=null,this.onViewport=()=>{(this.inspecting||this.hoverEl||this.teaching)&&(cancelAnimationFrame(this.raf),this.raf=requestAnimationFrame(()=>this.drawLayer()))},this.onTeachMove=e=>{if(this.fromPanel(e)||this.teachPop)return;let t=T(e.composedPath()[0]);t!==this.hoverEl&&this.hover(t)},this.onTeachPointer=e=>{if(this.fromPanel(e)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),e.type!==`click`))return;let t=T(e.composedPath()[0]);t?this.openTeachPop(t):this.teachPop&&this.closeTeachPop()}}mount(){if(this.host)return;if(this.host=document.createElement(_),this.host.setAttribute(`data-otofill-host`,``),this.root=this.host.attachShadow({mode:`open`}),this.root.appendChild(X(`style`,{},xt)),this.layer=X(`div`,{class:`layer`}),this.box=X(`div`,{class:`panel`,style:{display:`none`}}),this.mini=X(`div`,{class:`mini`,style:{display:`none`},onMousedown:this.startMiniDrag}),this.root.append(this.layer,this.box,this.mini),document.documentElement.appendChild(this.host),typeof ResizeObserver<`u`){let e=0;new ResizeObserver(()=>{this.visible&&this.box.style.width&&(clearTimeout(e),e=window.setTimeout(()=>{this.ui.w=this.box.style.width,this.ui.h=this.box.style.height,Z(this.ui)},300))}).observe(this.box)}let e=()=>this.minimized&&this.renderMini();window.addEventListener(`hashchange`,e),window.addEventListener(`popstate`,e),this.ui.min&&setTimeout(()=>this.showMini(),300);for(let e of[`keydown`,`keyup`,`keypress`])this.host.addEventListener(e,e=>e.stopPropagation());window.addEventListener(`keydown`,this.onKey,!0),window.addEventListener(`scroll`,this.onViewport,!0),window.addEventListener(`resize`,this.onViewport),qe(()=>{this.quiet||(this.visible?this.refresh():this.minimized&&this.renderMini())})}show(){this.mount(),this.visible=!0,this.minimized=!1,this.mini.style.display=`none`,this.ui.min&&(this.ui.min=!1,Z(this.ui)),this.pattern||=f(),this.box.style.display=`flex`,this.applyBox(),this.refresh()}hide(){this.visible=!1,this.minimized=!1,this.box.style.display=`none`,this.mini&&(this.mini.style.display=`none`),this.ui.min&&(this.ui.min=!1,Z(this.ui)),this.stopTeach(),this.inspecting=!1,this.drawLayer()}toggle(){this.visible?this.hide():this.show()}minimize(){let e=this.box.getBoundingClientRect();this.ui.miniLeft=Math.round(e.right-132),this.ui.miniTop=Math.round(e.top),this.stopTeach(),this.inspecting=!1,this.visible=!1,this.box.style.display=`none`,this.showMini(),this.drawLayer()}showMini(){this.mount(),this.minimized=!0,this.ui.min=!0,Z(this.ui),this.mini.style.display=`flex`,this.renderMini()}applyBox(){let e=this.ui;if(e.w&&(this.box.style.width=e.w),e.h&&(this.box.style.height=e.h),e.left!=null&&e.top!=null){let t=Math.max(0,Math.min(window.innerWidth-80,e.left)),n=Math.max(0,Math.min(window.innerHeight-40,e.top));Object.assign(this.box.style,{left:`${t}px`,top:`${n}px`,right:`auto`})}}quickTarget(){this.result=U();let e=this.currentDataset();if(!e||!e.rows.length)return null;let t=z().prefs.cursor[e.id];return{ds:e,i:t==null?0:(t-1+e.rows.length)%e.rows.length}}renderMini(){if(!this.mini)return;let e=this.quickTarget(),t=Math.max(0,Math.min(window.innerWidth-140,this.ui.miniLeft??window.innerWidth-148)),n=Math.max(0,Math.min(window.innerHeight-40,this.ui.miniTop??16));Object.assign(this.mini.style,{left:`${t}px`,top:`${n}px`});let r=X(`button`,{class:`mfill`+(e?``:` off`),title:e?`Doldur: ${e.ds.name} › ${G(e.ds.rows[e.i])}`:`Bu sayfa için uygun veri yok: paneli açar`,onClick:()=>void this.quickFill()},Dt(Et),this.miniMsg||`Doldur`);this.mini.replaceChildren(r,X(`button`,{class:`mico`,title:`Paneli aç (Ctrl+Q)`,onClick:()=>this.show()},Dt(Tt)),X(`button`,{class:`mico`,title:`Kapat`,onClick:()=>this.hide()},`×`))}async quickFill(){let e=this.quickTarget();if(!e){this.show();return}let t=e.ds.rows[e.i];V(t=>{t.prefs.lastDatasetId=e.ds.id,t.prefs.cursor[e.ds.id]=(e.i+1)%e.ds.rows.length});let n=await W(t,{onFilled:e=>this.flash(e)});this.lastFill=n;let r=n.notFound.length+n.failed.length;r?(this.view=`fill`,this.show(),this.toast(`"${G(t)}": ${n.filled.length} alan dolduruldu, ${r} sorunlu`,`err`)):(this.miniMsg=`✓ ${n.filled.length}`,this.renderMini(),setTimeout(()=>{this.miniMsg=``,this.minimized&&this.renderMini()},1500))}isOpen(){return this.visible}refresh(){this.result=U(),this.render(),this.drawLayer()}toast(e,t=`ok`){this.toastMsg=e,this.toastKind=t,clearTimeout(this.toastTimer),this.toastTimer=window.setTimeout(()=>{this.toastMsg=``,this.visible&&this.render()},5e3),this.visible&&this.render()}currentDataset(){let e=z(),t=this.pageKeys(),n=rt(e.datasets,t).filter(e=>e.overlap>0),r=this.dsId??e.prefs.lastDatasetId;return n.find(e=>e.ds.id===r)?.ds??n[0]?.ds}pageKeys(){return[...new Set((this.result?.matches??[]).map(e=>e.def.key))]}async fillWith(e,t){let n=e.rows[t];if(!n)return;V(n=>{n.prefs.lastDatasetId=e.id,n.prefs.cursor[e.id]=(t+1)%e.rows.length});let r=await W(n,{onFilled:e=>this.flash(e)});this.lastFill=r;let i=r.notFound.length+r.failed.length;z().prefs.closeAfterFill&&i===0?this.hide():this.toast(`"${G(n)}": ${r.filled.length} alan dolduruldu`+(i?`, ${i} sorunlu`:``),i?`err`:`ok`)}fillNext(e){let t=z().prefs.cursor[e.id]??0;return this.fillWith(e,t<e.rows.length?t:0)}fillRandom(e){return this.fillWith(e,Math.floor(Math.random()*e.rows.length))}render(){let e=this.result,t=X(`div`,{class:`head`,onMousedown:this.startDrag},X(`b`,{},`Otofill`),X(`span`,{class:`sub`},`${e.matches.length}/${e.defs.length} alan · ${location.host}`),X(`button`,{title:`Yeniden tara`,onClick:()=>this.refresh()},`⟳`),X(`button`,{title:`Küçült: tek düğmeye çevirir`,onClick:()=>this.minimize()},Dt(Tt)),X(`button`,{title:`Kapat (Ctrl+Q)`,onClick:()=>this.hide()},`×`)),n=(e,t)=>X(`button`,{class:this.view===e?`on`:``,onClick:()=>{this.view=e,this.render(),this.drawLayer()}},t),r=X(`div`,{class:`tabs`},n(`fill`,`Doldur`),n(`fields`,`Alanlar`),n(`data`,`Veri`),n(`io`,`Aktar`)),i=X(`div`,{class:`body`});this.toastMsg&&i.appendChild(X(`div`,{class:`toast ${this.toastKind}`},this.toastMsg)),this.view===`fill`?this.renderFill(i):this.view===`fields`?this.renderFields(i):this.view===`data`?this.renderData(i):this.renderIo(i);let a=this.box.querySelector(`.body`)?.scrollTop??0;this.box.replaceChildren(t,r,i),i.scrollTop=a}renderFill(e){let t=this.result,n=z();if(t.defs.length===0){e.append(X(`div`,{class:`empty`},`Bu sayfa için tanımlı alan yok.`,X(`br`),`Önce alanları tanıtın ya da tanımları içe aktarın.`),X(`div`,{class:`row`},X(`button`,{class:`btn pri grow`,onClick:()=>{this.view=`fields`,this.startTeach()}},`Tıklayarak alan tanıt`),X(`button`,{class:`btn grow`,onClick:()=>{this.view=`io`,this.render()}},`İçe aktar`)));return}let r=rt(n.datasets,this.pageKeys()).filter(e=>e.overlap>0);if(r.length===0){e.append(X(`div`,{class:`empty`},`${t.matches.length} alan tanındı ama bu alanlara uyan veri seti yok.`,X(`br`),`Veri sekmesinden sayfadaki değerleri kaydedin ya da veri içe aktarın.`),X(`div`,{class:`row`},X(`button`,{class:`btn grow`,onClick:()=>{this.view=`data`,this.render()}},`Veri sekmesi`)));return}let i=this.currentDataset(),a=this.pageKeys(),o=n.prefs.cursor[i.id]??0;e.append(X(`div`,{class:`row`},X(`select`,{class:`grow`,onChange:e=>{this.dsId=e.target.value,this.render()}},r.map(e=>X(`option`,{value:e.ds.id,selected:e.ds.id===i.id||void 0},`${e.ds.name} (${e.overlap} alan · ${e.ds.rows.length} satır)`)))),i.rows.length===0?X(`div`,{class:`empty`},`Bu veri setinde satır yok.`):X(`div`,{class:`list`},i.rows.map((e,t)=>X(`div`,{class:`item click`+(t===o?` cur`:``),title:`Bu satırla doldur`,onClick:()=>this.fillWith(i,t)},X(`span`,{class:`num`},t<9?String(t+1):`·`),X(`span`,{class:`grow`},G(e,a)),t===o?X(`span`,{class:`muted`},`sıradaki`):null))),X(`div`,{class:`row`},X(`button`,{class:`btn pri grow`,disabled:!i.rows.length||void 0,onClick:()=>this.fillNext(i)},`Sıradaki satır (Enter)`),X(`button`,{class:`btn`,disabled:!i.rows.length||void 0,onClick:()=>this.fillRandom(i)},`Rastgele`)),X(`label`,{class:`opt muted`},X(`input`,{type:`checkbox`,checked:n.prefs.closeAfterFill,onChange:e=>V(t=>{t.prefs.closeAfterFill=e.target.checked})}),`Sorunsuz doldurunca paneli kapat · 1-9: satır seç`));let s=this.lastFill;if(s){let t=(e,t,n)=>n.length?X(`div`,{class:e},`${t}: `,X(`span`,{class:`key`},n.join(`, `))):null;e.append(X(`div`,{},t(`ok`,`Dolduruldu`,s.filled),t(`bad`,`Sayfada bulunamadı`,s.notFound),t(`bad`,`Yazılamadı`,s.failed),t(`muted`,`Satırda değeri yok`,s.noValue)))}t.missing.length&&e.append(X(`div`,{class:`muted`},`Tanımlı ama bulunamayan: ${t.missing.map(e=>e.key).join(`, `)}`))}renderFields(e){let t=this.result,n=te(),r=f();e.append(X(`div`,{class:`row`},X(`button`,{class:`btn pri grow`,onClick:()=>this.startTeach()},`Tıklayarak tanıt`),X(`button`,{class:`btn`+(this.inspecting?` pri`:``),onClick:()=>{this.inspecting=!this.inspecting,this.render(),this.drawLayer()}},this.inspecting?`Göstermeyi kapat`:`Sayfada göster`)),X(`div`,{class:`muted`},`Yeni tanımların geçerli olacağı adres (* joker):`),X(`div`,{class:`row`},X(`input`,{type:`text`,class:`grow`,value:this.pattern,onChange:e=>{this.pattern=e.target.value.trim()}}),X(`button`,{class:`btn sm`,title:r,onClick:()=>{this.pattern=r,this.render()}},`Bu sayfa`),X(`button`,{class:`btn sm`,title:n,onClick:()=>{this.pattern=n,this.render()}},`Tüm site`)),X(`div`,{class:`sec`},`Bu sayfadaki tanımlar (${t.defs.length})`)),t.defs.length===0?e.append(X(`div`,{class:`muted`},`Henüz yok.`)):e.append(X(`div`,{class:`list`},t.defs.map(e=>{let n=t.matches.find(t=>t.def.id===e.id);return X(`div`,{class:`item`,onMouseenter:()=>n&&this.hover(n.fp.el),onMouseleave:()=>this.hover(null)},X(`span`,{class:n?`ok`:`bad`,title:n?`puan ${n.score}`:`sayfada bulunamadı`},n?`●`:`○`),X(`span`,{class:`grow`},X(`span`,{class:`key`},e.key),e.title?X(`span`,{class:`muted`},` · ${e.title}`):null),X(`span`,{class:`muted`},n?String(n.score):`—`),X(`button`,{class:`btn sm dng`,title:`Tanımı sil`,onClick:()=>{confirm(`"${e.key}" tanımı silinsin mi?`)&&Xe(e.id)}},`Sil`))})));let i=new Set(t.defs.map(e=>e.key)),a=new Set;for(let e of t.free)if(!this.freeSel.has(e)){let t=o(e.label||e.name||e.placeholder||e.id)||`alan_${(e.index??0)+1}`,n=2,r=t;for(;i.has(t)||a.has(t);)t=`${r}_${n++}`;a.add(t),this.freeSel.set(e,{on:!1,key:t})}e.append(X(`div`,{class:`sec`},`Tanımsız alanlar (${t.free.length})`)),t.free.length===0?e.append(X(`div`,{class:`muted`},`Sayfadaki tüm görünür alanlar tanımlı.`)):e.append(X(`div`,{class:`list`},t.free.map(e=>{let t=this.freeSel.get(e);return X(`div`,{class:`item`,onMouseenter:()=>this.hover(e.el),onMouseleave:()=>this.hover(null)},X(`input`,{type:`checkbox`,checked:t.on,onChange:e=>{t.on=e.target.checked}}),X(`div`,{class:`grow`,style:{display:`flex`,flexDirection:`column`,gap:`2px`,minWidth:`0`}},X(`input`,{type:`text`,value:t.key,onInput:e=>{t.key=e.target.value.trim(),t.on=!0,e.target.parentElement.previousSibling.checked=!0}}),X(`span`,{class:`muted`},`${e.label||e.placeholder||e.name||`(etiketsiz)`} · ${St[e.kind]}`)))})),X(`div`,{class:`row`},X(`button`,{class:`btn`,onClick:()=>{let e=[...this.freeSel.values()].every(e=>e.on);t.free.forEach(t=>this.freeSel.get(t).on=!e),this.render()}},`Tümünü seç / bırak`),X(`button`,{class:`btn pri grow`,onClick:()=>this.saveFree()},`Seçilenleri kaydet`)))}saveFree(){let e=this.result.free.filter(e=>this.freeSel.get(e)?.on&&this.freeSel.get(e).key);if(!e.length)return this.toast(`Kaydedilecek alan seçilmedi.`,`err`);V(t=>{for(let n of e)t.fields.push(this.defFrom(n,this.freeSel.get(n).key))}),e.forEach(e=>this.freeSel.delete(e)),this.toast(`${e.length} alan tanımlandı.`)}defFrom(e,t,n,r,i){return{id:i??s(),key:t,title:n??e.label,pages:r??[this.pattern||f()],kind:e.kind,match:pe(e),updatedAt:c()}}renderData(e){let t=this.result,n=z(),r=this.pageKeys(),i=n.datasets.find(e=>e.id===(this.openDsId??n.prefs.lastDatasetId))?.id??n.datasets[0]?.id??`__new`,a=``,l=``;e.append(X(`div`,{class:`sec`},`Satır ekle`),X(`div`,{class:`muted`},r.length?`Tanınan ${r.length} alanın o anki değerleri okunur. Formu elle doldurup buradan kaydedebilirsiniz.`:`Bu sayfada tanımlı alan yok: boş satır eklenir, değerleri aşağıdaki tabloda yazarsınız.`),X(`div`,{class:`row`},X(`select`,{class:`grow`,onChange:e=>{i=e.target.value,u.style.display=i===`__new`?``:`none`}},n.datasets.map(e=>X(`option`,{value:e.id,selected:e.id===i||void 0},e.name)),X(`option`,{value:`__new`,selected:i===`__new`||void 0},`+ Yeni veri seti`))));let u=X(`input`,{type:`text`,placeholder:`Yeni veri setinin adı`,style:{display:i===`__new`?``:`none`},onInput:e=>{a=e.target.value}});e.append(u,X(`div`,{class:`row`},X(`input`,{type:`text`,class:`grow`,placeholder:`Satır adı (ör. "Bireysel - İstanbul")`,onInput:e=>{l=e.target.value}}),X(`button`,{class:`btn pri`,title:r.length?`Sayfadaki tanımlı alanların değerlerini yeni satır olarak kaydeder`:`Boş bir satır ekler; değerleri aşağıdaki tabloda yazın`,onClick:()=>{let e=r.length?nt(t):{},n=i;i===`__new`&&(n=Ze(a.trim()||`Veri ${new Date().toLocaleDateString(`tr-TR`)}`).id);let o=z().datasets.find(e=>e.id===n);et(n,{...e,_label:l.trim()||`Satır ${(o?.rows.length??0)+1}`}),this.openDsId=n,this.toast(r.length?`${Object.keys(e).length} değer satır olarak kaydedildi.`:`Satır eklendi; değerleri tabloda yazın.`)}},r.length?`Kaydet`:`Satır ekle`)),X(`div`,{class:`sec`},`Veri setleri (${n.datasets.length})`)),n.datasets.length?e.append(X(`div`,{class:`list`},n.datasets.map(e=>{let t=this.openDsId===e.id,i=H(e),a=[...r.filter(e=>i.includes(e)),...i.filter(e=>!r.includes(e))],l=[...new Set([...r,...n.fields.map(e=>e.key)])].filter(e=>!i.includes(e)),u=(t,n,r=``)=>X(`td`,{},X(`input`,{type:`text`,class:`cell`,value:t[n]??``,placeholder:r,title:n===`_label`?`Satır adı`:n,onChange:r=>this.setCell(e.id,t._id,n,r.target.value),onKeydown:e=>{e.key===`Enter`&&e.target.blur()}}));return X(`div`,{},X(`div`,{class:`item click`,onClick:()=>{this.openDsId=t?void 0:e.id,this.render()}},X(`span`,{},t?`▾`:`▸`),X(`span`,{class:`grow`},e.name),X(`span`,{class:`muted`},`${e.rows.length} satır`),X(`button`,{class:`btn sm`,title:`Veri + kullandığı alan tanımları: başka adreste içe aktarınca alanlar da gelir`,onClick:t=>{t.stopPropagation(),Y({datasets:[e.id]},`otofill-${o(e.name)||`veri`}.json`)}},`JSON`),X(`button`,{class:`btn sm`,title:`CSV indir (yalnızca veri, Excel için)`,onClick:t=>{t.stopPropagation(),mt(e.id)}},`CSV`),X(`button`,{class:`btn sm dng`,onClick:t=>{t.stopPropagation(),confirm(`"${e.name}" veri seti silinsin mi?`)&&$e(e.id)}},`Sil`)),t?X(`div`,{style:{padding:`0 8px 8px`,overflowX:`auto`}},X(`table`,{class:`edit`},X(`tr`,{},X(`th`,{},`Satır`),a.map(e=>X(`th`,{title:e},e)),X(`th`,{})),e.rows.map(t=>X(`tr`,{},u(t,`_label`,G(t)),a.map(e=>u(t,e)),X(`td`,{},X(`button`,{class:`btn sm dng`,title:`Satırı sil`,onClick:()=>tt(e.id,t._id)},`×`))))),X(`div`,{class:`row`,style:{marginTop:`6px`}},X(`button`,{class:`btn sm`,onClick:()=>{et(e.id,{_label:`Satır ${e.rows.length+1}`})}},`+ Satır`),l.length?X(`select`,{class:`grow`,title:`Veri setine sütun (alan) ekle`,onChange:t=>{let n=t.target.value;n&&V(t=>{let r=t.datasets.find(t=>t.id===e.id);r&&(r.rows.length||r.rows.push({_id:s(),_label:`Satır 1`}),r.rows.forEach(e=>{e[n]??=``}),r.updatedAt=c())})}},X(`option`,{value:``},`+ Sütun ekle…`),l.map(e=>X(`option`,{value:e},e))):``),X(`div`,{class:`muted`,style:{marginTop:`4px`}},`Hücreye tıklayıp yazın; boş hücre doldurulmaz.`)):null)}))):e.append(X(`div`,{class:`muted`},`Henüz veri seti yok. Yukarıdan kaydedin ya da Aktar sekmesinden içe aktarın.`))}setCell(e,t,n,r){this.quiet=!0;try{V(i=>{let a=i.datasets.find(t=>t.id===e)?.rows.find(e=>e._id===t);if(!a)return;let o=r.trim();n===`_label`&&!o?delete a._label:a[n]=o;let s=i.datasets.find(t=>t.id===e);s.updatedAt=c()})}finally{this.quiet=!1}}renderIo(e){let t=z(),n=t.datasets[0]?.id,r=``,i=async e=>{try{this.toast(await e())}catch(e){this.toast(e instanceof q?e.message:`İçe aktarılamadı: `+e.message,`err`)}},a=X(`input`,{type:`file`,accept:`.json,.csv,application/json,text/csv`,multiple:!0,style:{display:`none`},onChange:e=>{let t=Array.from(e.target.files??[]);i(async()=>{let e=[];for(let n of t)e.push(`${n.name}: ${_t(await gt(n,this.importMode))}`);return e.join(` · `)})}}),o=X(`div`,{class:`drop`,onClick:()=>a.click(),onDragover:e=>{e.preventDefault(),o.classList.add(`over`)},onDragleave:()=>o.classList.remove(`over`),onDrop:e=>{e.preventDefault(),o.classList.remove(`over`);let t=Array.from(e.dataTransfer?.files??[]);i(async()=>{let e=[];for(let n of t)e.push(`${n.name}: ${_t(await gt(n,this.importMode))}`);return e.join(` · `)})}},`JSON / CSV dosyasını buraya bırakın ya da tıklayıp seçin`),s=(e,t,n)=>X(`label`,{class:`opt`},X(`input`,{type:`radio`,name:`mode`,checked:this.importMode===e,onChange:()=>{this.importMode=e}}),X(`span`,{},X(`b`,{},t),X(`span`,{class:`muted`},` · ${n}`)));e.append(X(`div`,{class:`sec`},`Dışa aktar`),X(`div`,{class:`row`},X(`button`,{class:`btn pri`,onClick:()=>Y({fields:!0,datasets:!0})},`Hepsi (JSON)`),X(`button`,{class:`btn`,onClick:()=>Y({fields:!0},`otofill-alanlar-${location.hostname}.json`)},`Alan tanımları`),X(`button`,{class:`btn`,onClick:()=>Y({datasets:!0},`otofill-veri.json`),title:`Veri setleri ve kullandıkları alan tanımları`},`Veri setleri`)),t.datasets.length?X(`div`,{class:`row`},X(`select`,{class:`grow`,onChange:e=>{n=e.target.value}},t.datasets.map(e=>X(`option`,{value:e.id},e.name))),X(`button`,{class:`btn`,onClick:()=>n&&mt(n)},`CSV (Excel)`)):``,X(`div`,{class:`muted`},`CSV yalnızca veriyi taşır; başka bir adreste alanların da gelmesi için JSON kullanın.`),X(`div`,{class:`sec`},`İçe aktar`),s(`merge`,`Birleştir`,`aynı kayıtları günceller, yenileri ekler`),s(`replace`,`Üzerine yaz`,`dosyadaki bölümü tamamen değiştirir`),s(`copy`,`Kopya olarak ekle`,`hepsini yeni kayıt olarak ekler`),o,a,X(`textarea`,{placeholder:`ya da JSON / CSV metnini buraya yapıştırın`,onInput:e=>{r=e.target.value}}),X(`div`,{class:`row`},X(`button`,{class:`btn grow`,onClick:()=>i(()=>_t(ht(r,this.importMode,r.trimStart().startsWith(`{`)?`yapistirilan.json`:`Yapıştırılan ${new Date().toLocaleString(`tr-TR`)}.csv`)))},`Metinden içe aktar`)),X(`div`,{class:`sec`},`Depolama`),X(`div`,{class:`muted`},`Veriler yalnızca bu tarayıcıda, ${location.origin} için saklanır; hiçbir yere gönderilmez. ${t.fields.length} alan tanımı, ${t.datasets.length} veri seti. Sürüm 0.1.2.`),X(`div`,{class:`row`},X(`button`,{class:`btn dng`,onClick:()=>{confirm(`${location.origin} için kayıtlı tüm Otofill alanları ve verileri silinsin mi? Bu işlem geri alınamaz; önce dışa aktarmanız önerilir.`)&&(Je(),this.toast(`Tüm veriler silindi.`))}},`Bu sitedeki tüm verileri sil`)))}targetRectEl(e){return e.getClientRects().length&&e.getBoundingClientRect().width>2?e:e.closest(`label`)??e.parentElement??e}boxFor(e,t){let n=this.targetRectEl(e).getBoundingClientRect();return X(`div`,{class:`hl ${t}`,style:{left:`${n.left-3}px`,top:`${n.top-3}px`,width:`${n.width+6}px`,height:`${n.height+6}px`}})}hover(e){this.hoverEl=e,this.drawLayer()}flash(e){let t=this.boxFor(e,`green`);this.layer.appendChild(t),setTimeout(()=>t.style.opacity=`0`,700),setTimeout(()=>t.remove(),1200)}drawLayer(){let e=[...this.layer.querySelectorAll(`.pop, .teachbar`)];if(this.layer.replaceChildren(...e),!this.visible&&!this.teaching)return;let t=this.result;if(t&&(this.inspecting||this.teaching)){for(let e of t.matches){let t=this.targetRectEl(e.fp.el).getBoundingClientRect();t.bottom<0||t.top>window.innerHeight||this.layer.appendChild(X(`div`,{class:`badge`,style:{left:`${t.left}px`,top:`${t.top}px`}},`${e.def.key} · ${e.score}`))}if(this.inspecting)for(let e of t.free){let t=this.targetRectEl(e.el).getBoundingClientRect();t.bottom<0||t.top>window.innerHeight||this.layer.appendChild(X(`div`,{class:`badge free`,style:{left:`${t.left}px`,top:`${t.top}px`}},`? tanımsız`))}}this.hoverEl?.isConnected&&this.layer.appendChild(this.boxFor(this.hoverEl,``))}startTeach(){if(this.mount(),this.teaching)return;this.teaching=!0,this.pattern||=f(),this.visible||this.show(),this.result=U(),this.render();let e=X(`div`,{class:`teachbar`},X(`span`,{},`Tanıtma modu: bir alana tıklayın`),X(`button`,{onClick:()=>this.stopTeach()},`Bitir (Esc)`));this.layer.appendChild(e);for(let e of[`pointerdown`,`mousedown`,`mouseup`,`click`])document.addEventListener(e,this.onTeachPointer,!0);document.addEventListener(`mousemove`,this.onTeachMove,!0),this.drawLayer()}stopTeach(){if(this.teaching){this.teaching=!1,this.closeTeachPop(),this.layer.querySelector(`.teachbar`)?.remove();for(let e of[`pointerdown`,`mousedown`,`mouseup`,`click`])document.removeEventListener(e,this.onTeachPointer,!0);document.removeEventListener(`mousemove`,this.onTeachMove,!0),this.hoverEl=null,this.visible?this.refresh():this.drawLayer()}}fromPanel(e){return e.composedPath().includes(this.host)}closeTeachPop(){this.teachPop?.remove(),this.teachPop=null}openTeachPop(e){this.closeTeachPop();let t=C(e)===`radio`?k(e)[0]:e,n=fe(document).find(e=>e.el===t);if(!n){this.toast(`Bu alan görünür değil ya da devre dışı.`,`err`);return}let r=z(),i=U();this.result=i;let a=i.matches.find(e=>e.fp.el===t)?.def,l=[...new Set([...r.fields.map(e=>e.key),...r.datasets.flatMap(H)])].sort(),u=`otofill-keys`,d=f(),ee=te(),p=a?.pages[0]??(this.pattern||d),m=X(`input`,{type:`text`,list:u,value:a?.key??(o(n.label||n.name||n.placeholder||n.id)||``),placeholder:`ör. musteri.tckn`}),h=X(`input`,{type:`text`,value:a?.title??n.label??``,placeholder:`Açıklama (isteğe bağlı)`}),g=X(`select`,{},X(`option`,{value:d,selected:p===d||void 0},`Bu sayfa`),X(`option`,{value:ee,selected:p===ee||void 0},`Tüm site`),p!==d&&p!==ee?X(`option`,{value:p,selected:!0},p):null),_=(t.getAttribute(`type`)??``).toLowerCase()===`password`,v=r.datasets.some(e=>e.id===this.teachTarget.dsId)?this.teachTarget.dsId:(r.datasets.find(e=>e.id===r.prefs.lastDatasetId)??r.datasets[0])?.id??`__new`,y=v!==`__new`&&r.datasets.find(e=>e.id===v)?.rows.some(e=>e._id===this.teachTarget.rowId)?this.teachTarget.rowId:`__new`,b=()=>r.datasets.find(e=>e.id===v)?.rows.find(e=>e._id===y),x=()=>{let e=m.value.trim(),n=e?b()?.[e]:void 0;return n===void 0?_?``:I(t)??``:n},S=t.tagName===`SELECT`?Array.from(t.options).filter(e=>e.value!==``&&!e.disabled).map(e=>e.text.trim()).filter(Boolean):n.kind===`radio`?k(t).map(e=>oe(e)||e.value):n.kind===`checkbox`?[`evet`,`hayır`]:[],w=X(`input`,{type:`text`,list:S.length?`otofill-choices`:void 0,value:x(),placeholder:_?`test hesabının şifresi (isteğe bağlı)`:`boş bırakılırsa veri yazılmaz`}),T=X(`select`,{class:`grow`}),E=X(`select`,{class:`grow`}),ne=()=>{T.replaceChildren(...r.datasets.map(e=>X(`option`,{value:e.id,selected:e.id===v||void 0},e.name)),X(`option`,{value:`__new`,selected:v===`__new`||void 0},`+ Yeni veri seti`));let e=r.datasets.find(e=>e.id===v);E.replaceChildren(...(e?.rows??[]).map((e,t)=>X(`option`,{value:e._id,selected:e._id===y||void 0},`${t+1}. ${G(e)}`)),X(`option`,{value:`__new`,selected:y===`__new`||void 0},`+ Yeni satır`))};ne(),T.addEventListener(`change`,()=>{v=T.value,y=`__new`,ne(),w.value=x()}),E.addEventListener(`change`,()=>{y=E.value,w.value=x()}),m.addEventListener(`change`,()=>{let e=b()?.[m.value.trim()];e!==void 0&&(w.value=e)});let D=()=>{let e=m.value.trim();if(!e){m.focus();return}let r=this.defFrom(n,e,h.value.trim()||void 0,[g.value],a?.id),i=w.value,o=``;V(t=>{let n=t.fields.findIndex(e=>e.id===r.id);if(n>=0?t.fields[n]=r:t.fields.push(r),i.trim()===``)return;let a=t.datasets.find(e=>e.id===v);a||(a={id:s(),name:`Veri ${new Date().toLocaleDateString(`tr-TR`)}`,rows:[],updatedAt:c()},t.datasets.push(a));let l=a.rows.find(e=>e._id===y);l||(l={_id:s()},a.rows.push(l)),l[e]=i,a.updatedAt=c(),t.prefs.lastDatasetId=a.id,this.teachTarget={dsId:a.id,rowId:l._id},o=`${a.name} › ${a.rows.indexOf(l)+1}. satır`}),this.closeTeachPop(),this.flash(t),this.toast(`"${e}" ${a?`güncellendi`:`tanımlandı`}`+(o?`, değer → ${o}.`:`.`))},O=this.targetRectEl(t).getBoundingClientRect(),re=O.bottom+8+400>window.innerHeight?Math.max(8,O.top-400-8):O.bottom+8,ie=Math.min(Math.max(8,O.left),window.innerWidth-310);this.teachPop=X(`div`,{class:`pop`,style:{left:`${ie}px`,top:`${re}px`},onKeydown:e=>{e.key===`Enter`&&D()}},X(`div`,{},X(`b`,{},a?`Alanı düzenle`:`Alan tanıt`),X(`span`,{class:`muted`},` · ${St[n.kind]}${n.label?` · "${n.label}"`:``}`)),X(`span`,{class:`lbl`},`Anahtar (veri setindeki sütun adı)`),m,X(`datalist`,{id:u},l.map(e=>X(`option`,{value:e}))),X(`span`,{class:`lbl`},`Açıklama`),h,X(`span`,{class:`lbl`},`Geçerli olduğu yer`),g,X(`div`,{class:`sep`}),X(`span`,{class:`lbl`},`Örnek değer (isteğe bağlı)`),w,S.length?X(`datalist`,{id:`otofill-choices`},S.map(e=>X(`option`,{value:e}))):null,_?X(`span`,{class:`lbl warn`},`Gerçek şifrenizi yazmayın: veriler tarayıcıda düz metin durur ve dışa aktarılınca paylaşılır.`):null,X(`span`,{class:`lbl`},`Değerin yazılacağı yer`),X(`div`,{class:`row`},T,E),X(`div`,{class:`row`},a?X(`button`,{class:`btn dng`,onClick:()=>{Xe(a.id),this.closeTeachPop(),this.toast(`"${a.key}" silindi.`)}},`Sil`):null,X(`span`,{class:`grow`}),X(`button`,{class:`btn`,onClick:()=>this.closeTeachPop()},`İptal`),X(`button`,{class:`btn pri`,onClick:D},`Kaydet`))),this.layer.appendChild(this.teachPop),m.focus(),m.select()}},kt=n({BUNDLE_FORMAT:()=>K,BUNDLE_VERSION:()=>1,THRESHOLD:()=>30,WEIGHTS:()=>Le,analyze:()=>U,close:()=>Mt,fill:()=>Ft,fillElement:()=>Ie,fillRow:()=>W,fingerprint:()=>ue,init:()=>$,io:()=>at,labelOf:()=>ae,matchFields:()=>Be,open:()=>jt,readElement:()=>I,readRow:()=>nt,registerDriver:()=>Pe,scanPage:()=>fe,score:()=>ze,setNativeValue:()=>M,store:()=>Ve,teach:()=>Pt,toggle:()=>Nt,version:()=>At}),At=`0.1.2`,Q=null;function $(e={}){if(Q||typeof document>`u`)return;Q=new Ot({hotkey:yt(e.hotkey??`ctrl+q`)});let t=()=>Q.mount();document.body?t():document.addEventListener(`DOMContentLoaded`,t,{once:!0})}function jt(){$(),Q.show()}function Mt(){Q?.hide()}function Nt(){$(),Q.toggle()}function Pt(){$(),Q.startTeach()}async function Ft(e,t=0){let n=z().datasets.find(t=>t.id===e||t.name===e);if(!n)throw Error(`Veri seti bulunamadı: ${e}`);let r=typeof t==`number`?n.rows[t]:n.rows.find(e=>e._label===t||e._id===t);if(!r)throw Error(`Satır bulunamadı: ${t}`);return W(r)}var It=globalThis,Lt=document.currentScript;return It.__optonaOtofill?It.__optonaOtofill.open():(It.__optonaOtofill=kt,Lt?.dataset.auto!==`false`&&$({hotkey:Lt?.dataset.hotkey}),Lt?.dataset.open===`true`&&jt()),e.BUNDLE_FORMAT=K,e.BUNDLE_VERSION=it,e.THRESHOLD=Re,e.WEIGHTS=Le,e.analyze=U,e.close=Mt,e.fill=Ft,e.fillElement=Ie,e.fillRow=W,e.fingerprint=ue,e.init=$,Object.defineProperty(e,"io",{enumerable:!0,get:function(){return at}}),e.labelOf=ae,e.matchFields=Be,e.open=jt,e.readElement=I,e.readRow=nt,e.registerDriver=Pe,e.scanPage=fe,e.score=ze,e.setNativeValue=M,Object.defineProperty(e,"store",{enumerable:!0,get:function(){return Ve}}),e.teach=Pt,e.toggle=Nt,e.version=At,e})({});
94
+ `,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;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);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&&Object.assign(this.box.style,{height:e.h,maxHeight:`none`}),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:`ver`,title:`@optona/otofill 0.1.4`},`v0.1.4`),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,...[`n`,`s`,`e`,`w`,`nw`,`ne`,`sw`,`se`].map(e=>X(`div`,{class:`rz rz-${e}`,onMousedown:t=>this.startResize(e,t)}))),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.4.`),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`)))}startResize(e,t){t.preventDefault(),t.stopPropagation();let n=this.box.getBoundingClientRect(),r=t.clientX,i=t.clientY,a=t=>{let a=t.clientX-r,o=t.clientY-i,{left:s,top:c,width:l,height:u}=n;e.includes(`e`)&&(l=Math.min(window.innerWidth-s,Math.max(300,n.width+a))),e.includes(`w`)&&(l=Math.max(300,Math.min(n.right,n.width-a)),s=n.right-l),e.includes(`s`)&&(u=Math.min(window.innerHeight-c,Math.max(160,n.height+o))),e.includes(`n`)&&(u=Math.max(160,Math.min(n.bottom,n.height-o)),c=n.bottom-u),Object.assign(this.box.style,{left:`${s}px`,top:`${c}px`,right:`auto`,width:`${l}px`,height:`${u}px`,maxHeight:`none`}),Object.assign(this.ui,{left:s,top:c,w:`${l}px`,h:`${u}px`})},o=()=>{window.removeEventListener(`mousemove`,a,!0),window.removeEventListener(`mouseup`,o,!0),Z(this.ui)};window.addEventListener(`mousemove`,a,!0),window.addEventListener(`mouseup`,o,!0)}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.4`,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})({});
@@ -62,10 +62,14 @@ export declare class Panel {
62
62
  private saveFree;
63
63
  private defFrom;
64
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;
65
67
  /** Tablodaki tek hücreyi kaydeder; panel yeniden çizilmez, böylece Tab ile sonraki hücreye geçilebilir. */
66
68
  private setCell;
67
69
  private renderIo;
68
70
  private startDrag;
71
+ /** Kenar ve köşelerden boyutlandırma: n/s/e/w yönleri birleşebilir (nw, se ...). */
72
+ private startResize;
69
73
  /** Küçük düğme de boş kısmından sürüklenebilir. */
70
74
  private startMiniDrag;
71
75
  private hoverEl;
@@ -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; }\ntable.edit td { max-width: none; padding: 1px 2px; }\ntable.edit input.cell { width: 100%; min-width: 70px; border: 1px solid transparent; border-radius: 4px; padding: 3px 4px; font-size: 11px; background: transparent; }\ntable.edit input.cell:hover { border-color: #e5e7eb; }\ntable.edit input.cell:focus { border-color: #2563eb; background: #fff; outline: none; }\n";
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 min-width: 300px; min-height: 160px; max-width: calc(100vw - 16px);\n}\n.rz { position: absolute; z-index: 2; }\n.rz-n, .rz-s { left: 10px; right: 10px; height: 6px; cursor: ns-resize; }\n.rz-n { top: 0; } .rz-s { bottom: 0; }\n.rz-e, .rz-w { top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }\n.rz-e { right: 0; } .rz-w { left: 0; }\n.rz-nw, .rz-ne, .rz-sw, .rz-se { width: 10px; height: 10px; z-index: 3; }\n.rz-nw { top: 0; left: 0; cursor: nwse-resize; } .rz-se { bottom: 0; right: 0; cursor: nwse-resize; }\n.rz-ne { top: 0; right: 0; cursor: nesw-resize; } .rz-sw { bottom: 0; left: 0; cursor: nesw-resize; }\n.rz-se::after { content: ''; position: absolute; right: 5px; bottom: 5px; width: 7px; height: 7px; border-right: 2px solid #9ca3af; border-bottom: 2px solid #9ca3af; border-radius: 0 0 2px 0; }\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 .ver { font-size: 10px; color: #9ca3af; background: #1f2937; border-radius: 4px; padding: 0 4px; margin-left: -4px; }\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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optona/otofill",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Ctrl+Q ile açılan, alanları sizin tanıttığınız ve verisini sizin içe aktardığınız form doldurma kütüphanesi.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Optona",