@pan-stack/test 0.0.7 → 0.0.9

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.
Files changed (3) hide show
  1. package/bin/pan-test-doc.js +1330 -234
  2. package/bin/pan-test.js +1525 -433
  3. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __panCreateRequire } from 'node:module'; const require = __panCreateRequire(import.meta.url);
3
- var hg=Object.create;var zs=Object.defineProperty;var fg=Object.getOwnPropertyDescriptor;var mg=Object.getOwnPropertyNames;var gg=Object.getPrototypeOf,bg=Object.prototype.hasOwnProperty;var Hr=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ze=(e,t)=>()=>(e&&(t=e(e=0)),t);var B=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),xc=(e,t)=>{for(var n in t)zs(e,n,{get:t[n],enumerable:!0})},vg=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of mg(t))!bg.call(e,i)&&i!==n&&zs(e,i,{get:()=>t[i],enumerable:!(r=fg(t,i))||r.enumerable});return e};var wg=(e,t,n)=>(n=e!=null?hg(gg(e)):{},vg(t||!e||!e.__esModule?zs(n,"default",{value:e,enumerable:!0}):n,e));var L,E=ze(()=>{L={"index.html":`<!doctype html>
3
+ var nb=Object.create;var pa=Object.defineProperty;var rb=Object.getOwnPropertyDescriptor;var ib=Object.getOwnPropertyNames;var sb=Object.getPrototypeOf,ab=Object.prototype.hasOwnProperty;var ri=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Se=(e,t)=>()=>(e&&(t=e(e=0)),t);var B=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ii=(e,t)=>{for(var n in t)pa(e,n,{get:t[n],enumerable:!0})},ob=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ib(t))!ab.call(e,i)&&i!==n&&pa(e,i,{get:()=>t[i],enumerable:!(r=rb(t,i))||r.enumerable});return e};var lb=(e,t,n)=>(n=e!=null?nb(sb(e)):{},ob(t||!e||!e.__esModule?pa(n,"default",{value:e,enumerable:!0}):n,e));var R,S=Se(()=>{R={"index.html":`<!doctype html>
4
4
  <html lang="vi" data-theme="system">
5
5
  <head>
6
6
  <meta charset="utf-8">
@@ -291,6 +291,14 @@ var hg=Object.create;var zs=Object.defineProperty;var fg=Object.getOwnPropertyDe
291
291
  .ptx-findings { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
292
292
  .ptx-common { background: var(--pb-surface-2); }
293
293
  .ptx-word { width: 100%; height: calc(100vh - 220px); min-height: 480px; border: 1px solid var(--pb-border); border-radius: var(--pb-radius); background: #e9ecef; }
294
+ .ptx-run { max-width: 820px; padding: 20px 22px; outline: none; }
295
+ .ptx-run:focus-visible { box-shadow: 0 0 0 3px var(--pb-primary-soft); }
296
+ .ptx-run__head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
297
+ .ptx-run__title { margin: 4px 0 12px; font-size: 18px; font-weight: 600; }
298
+ .ptx-run__block { margin: 0 0 12px; }
299
+ .ptx-run__text { white-space: pre-wrap; font-size: 15px; line-height: 1.6; }
300
+ .ptx-run__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
301
+ .ptx-run__btn { gap: 8px; }
294
302
  .ptx-check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
295
303
  </style>
296
304
  <script src="ui/i18n.js"></script>
@@ -2438,7 +2446,8 @@ tr.pb-flash > td { animation: pb-flash 1.2s ease-out 1 both; }
2438
2446
  { id: 'giong-doc', label: 'Gi\u1ECDng \u0111\u1ECDc', desc: 'L\u1ED3ng ti\u1EBFng, k\u1ECBch b\u1EA3n \u0111\u1ECDc', ico: 'mic' },
2439
2447
  { id: 'ban-giao', label: 'B\xE0n giao', desc: 'T\xE0i li\u1EC7u b\xE0n giao, b\xECnh lu\u1EADn', ico: 'package' },
2440
2448
  { id: 'tai-lieu-ba', label: 'T\xE0i li\u1EC7u BA', desc: '\u0110\u1EB7c t\u1EA3, tham chi\u1EBFu, xu\u1EA5t DOCX/PDF', ico: 'file-text' },
2441
- { id: 'tai-lieu-kiem-thu', label: 'T\xE0i li\u1EC7u ki\u1EC3m th\u1EED', desc: 'K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED, k\u1EBFt qu\u1EA3, xu\u1EA5t b\xE0n giao', ico: 'check' },
2449
+ { id: 'test-docs', label: 'T\xE0i li\u1EC7u ki\u1EC3m th\u1EED', desc: 'K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED, k\u1EBFt qu\u1EA3, xu\u1EA5t b\xE0n giao', ico: 'check' },
2450
+ { id: 'handover-docs', label: 'T\xE0i li\u1EC7u b\xE0n giao', desc: 'H\u01B0\u1EDBng d\u1EABn c\xE0i \u0111\u1EB7t, v\u1EADn h\xE0nh, s\u1EED d\u1EE5ng \u2014 xu\u1EA5t Word', ico: 'package' },
2442
2451
  ];
2443
2452
  var ROLE_LABEL = { ba: 'BA', 'ba-lead': 'BA Lead', designer: 'Designer' };
2444
2453
  var refs = {};
@@ -2493,7 +2502,7 @@ tr.pb-flash > td { animation: pb-flash 1.2s ease-out 1 both; }
2493
2502
  if (cur) return;
2494
2503
  // Nh\xFAng trong Pan Studio Desktop (?host=desktop): \xABStudio thi\u1EBFt k\u1EBF\xBB l\xE0 workspace Thi\u1EBFt k\u1EBF c\u1EE7a Desktop \u2014 b\xE1o c\u1EEDa s\u1ED5 cha chuy\u1EC3n.
2495
2504
  var host = (W.location.search.match(/[?&]host=([a-z]+)/) || [])[1];
2496
- if (host === 'desktop' && W.parent !== W && (w.id === 'studio' || w.id === 'tai-lieu-ba' || w.id === 'tai-lieu-kiem-thu')) { W.parent.postMessage({ panBa: 'workspace', id: w.id }, '*'); return; }
2505
+ if (host === 'desktop' && W.parent !== W && (w.id === 'studio' || w.id === 'tai-lieu-ba' || w.id === 'test-docs' || w.id === 'handover-docs')) { W.parent.postMessage({ panBa: 'workspace', id: w.id }, '*'); return; }
2497
2506
  toast('\xAB' + w.label + '\xBB l\xE0 workspace c\u1EE7a Pan Studio \u2014 m\u1EDF tr\xEAn Pan Studio Desktop ho\u1EB7c studio.dev.pro.vn.', { kind: 'info' });
2498
2507
  });
2499
2508
  grid.appendChild(b);
@@ -3432,6 +3441,12 @@ tr.pb-flash > td { animation: pb-flash 1.2s ease-out 1 both; }
3432
3441
  '\u0110\xF3ng panel': 'Close panel', 'M\u1EDF panel': 'Open panel', 'Kh\xF4ng c\xF3 th\xF4ng b\xE1o m\u1EDBi': 'No new notifications', '\u0110\xE1nh d\u1EA5u \u0111\xE3 \u0111\u1ECDc': 'Mark as read',
3433
3442
  'G\xF5 m\xE3, t\xEAn ho\u1EB7c s\u1ED1 m\u1EE5c': 'Type a code, name or section number', 'Kh\xF4ng th\u1EA5y k\u1EBFt qu\u1EA3': 'No results',
3434
3443
  };
3444
+ // nh\xE3n workspace (b\u1ED9 ch\u1ECDn workspace trong trang)
3445
+ Object.assign(EN, {"T\xE0i li\u1EC7u ki\u1EC3m th\u1EED": "Test documents", "K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED, k\u1EBFt qu\u1EA3, xu\u1EA5t b\xE0n giao": "Test scenarios, results, handover export", "T\xE0i li\u1EC7u b\xE0n giao": "Handover documents", "H\u01B0\u1EDBng d\u1EABn c\xE0i \u0111\u1EB7t, v\u1EADn h\xE0nh, s\u1EED d\u1EE5ng \u2014 xu\u1EA5t Word": "Installation, operation and user guides \u2014 Word export"});
3446
+ // Pan Test (app t\xE0i li\u1EC7u ki\u1EC3m th\u1EED) \u2014 ch\u1EEF ri\xEAng c\u1EE7a app.browser.js
3447
+ Object.assign(EN, {"Tr\u1EE3 l\xFD AI": "AI assistant", "AI l\xE0m vi\u1EC7c ngay trong repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED: th\xEAm / s\u1EEDa k\u1ECBch b\u1EA3n v\xE0 t\xECnh hu\u1ED1ng b\u1EB1ng l\u1EC7nh pan test (m\xE3 kh\xF4ng tr\xF9ng, k\u1EBFt qu\u1EA3 gi\u1EEF nguy\xEAn), t\u1EF1 ch\u1EA1y pan test check, kh\xF4ng commit. Xong b\u1EA1n xem thay \u0111\u1ED5i r\u1ED3i Gi\u1EEF ho\u1EB7c Ho\xE0n t\xE1c.": "The AI works right in this test document repo: it adds / edits suites and cases with pan test commands (unique codes, results kept), runs pan test check itself and never commits. Then review the changes and Keep or Undo.", "Ng\u1EEF c\u1EA3nh:": "Context:", "ph\xE2n h\u1EC7 {m}": "module {m}", "B\u1ED5 sung t\xECnh hu\u1ED1ng": "Add missing cases", "Vi\u1EBFt t\xECnh hu\u1ED1ng": "Write test cases", "R\xE0 so\xE1t": "Review", "K\u1ECBch b\u1EA3n c\xF2n thi\u1EBFu": "Missing suites", "S\u1EEDa l\u1ED7i ki\u1EC3m tra": "Fix check issues", "B\u1ED5 sung t\xECnh hu\u1ED1ng c\xF2n thi\u1EBFu cho k\u1ECBch b\u1EA3n {c} \xAB{t}\xBB (\u0111\u1ED1i chi\u1EBFu t\xE0i li\u1EC7u BA{v}).": "Add the missing test cases to suite {c} \xAB{t}\xBB (compare with the BA document{v}).", "Vi\u1EBFt c\xE1c t\xECnh hu\u1ED1ng ki\u1EC3m th\u1EED cho k\u1ECBch b\u1EA3n {c} \xAB{t}\xBB theo t\xE0i li\u1EC7u BA{v}.": "Write the test cases for suite {c} \xAB{t}\xBB from the BA document{v}.", "R\xE0 so\xE1t k\u1ECBch b\u1EA3n {c} \xAB{t}\xBB: b\u01B0\u1EDBc m\u01A1 h\u1ED3, k\u1EBFt qu\u1EA3 mong \u0111\u1EE3i kh\xF4ng ki\u1EC3m \u0111\u01B0\u1EE3c, tr\xF9ng l\u1EB7p \u2014 s\u1EEDa b\u1EB1ng l\u1EC7nh v\xE0 b\xE1o l\u1EA1i.": "Review suite {c} \xAB{t}\xBB: vague steps, unverifiable expected results, duplicates \u2014 fix with commands and report back.", "\u0110\u1ED1i chi\u1EBFu t\xE0i li\u1EC7u BA: ch\u1EE9c n\u0103ng n\xE0o c\u1EE7a ph\xE2n h\u1EC7 {m} ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n? T\u1EA1o k\u1ECBch b\u1EA3n + t\xECnh hu\u1ED1ng cho c\xE1c ch\u1EE9c n\u0103ng \u0111\xF3.": "Compare with the BA document: which functions of module {m} have no suite? Create suites + cases for them.", "Ch\u1EA1y pan test check r\u1ED3i s\u1EEDa c\xE1c l\u1ED7i / c\u1EA3nh b\xE1o.": "Run pan test check, then fix the errors / warnings."});
3448
+ Object.assign(EN, {"Studio": "Studio", "\u0110ang ki\u1EC3m tra Pan Studio\u2026": "Checking Pan Studio\u2026", "C\u1EA7n Pan CLI \u0111\u1EC3 ph\xE1t h\xE0nh l\xEAn Pan Studio.": "Pan CLI is needed to publish to Pan Studio.", "M\xE1y n\xE0y ch\u01B0a \u0111\u0103ng nh\u1EADp Pan Studio. \u0110\u0103ng nh\u1EADp trong Pan Studio Desktop (g\xF3c ph\u1EA3i tr\xEAn) ho\u1EB7c ch\u1EA1y \xABpan login\xBB, r\u1ED3i m\u1EDF l\u1EA1i h\u1ED9p n\xE0y.": "This machine is not signed in to Pan Studio. Sign in from Pan Studio Desktop (top right) or run \xABpan login\xBB, then reopen this dialog.", "M\u1EDF tr\xEAn Pan Studio": "Open on Pan Studio", "\u0110\xE3 ph\xE1t h\xE0nh: \xAB{t}\xBB \u2014 b\u1EA3n {r}.": "Published: \xAB{t}\xBB \u2014 revision {r}.", "Ch\u01B0a ph\xE1t h\xE0nh l\xEAn Pan Studio. Ph\xE1t h\xE0nh xong, t\xE0i li\u1EC7u hi\u1EC7n \u1EDF workspace \xABT\xE0i li\u1EC7u ki\u1EC3m th\u1EED\xBB tr\xEAn web: th\xE0nh vi\xEAn d\u1EF1 \xE1n xem, b\xECnh lu\u1EADn theo t\u1EEBng k\u1ECBch b\u1EA3n.": "Not published to Pan Studio yet. Once published, the document appears in the \xABTest documents\xBB workspace on the web: project members read it and comment per test suite.", "Ch\u01B0a g\u1EAFn d\u1EF1 \xE1n Studio (repo t\xE0i li\u1EC7u BA li\xEAn k\u1EBFt ch\u01B0a khai d\u1EF1 \xE1n) \u2014 t\xE0i li\u1EC7u ch\u1EC9 b\u1EA1n v\xE0 ng\u01B0\u1EDDi \u0111\u01B0\u1EE3c m\u1EDDi th\u1EA5y.": "Not linked to a Studio project (the linked BA repo has no project) \u2014 only you and invited people see it.", "Ph\xE1t h\xE0nh l\u1EA1i s\u1EBD GHI \u0110\xC8 b\u1EA3n tr\xEAn Studio b\u1EB1ng n\u1ED9i dung hi\u1EC7n t\u1EA1i c\u1EE7a repo (k\u1EC3 c\u1EA3 k\u1EBFt qu\u1EA3 test).": "Publishing again OVERWRITES the Studio copy with the current repo content (results included).", "Pan Studio": "Pan Studio", "G\u1EE1 kh\u1ECFi Studio": "Remove from Studio", "Ph\xE1t h\xE0nh": "Publish", "\u0110ang g\u1EE1\u2026": "Removing\u2026", "\u0110\xE3 g\u1EE1 kh\u1ECFi Pan Studio.": "Removed from Pan Studio.", "\u0110ang ph\xE1t h\xE0nh\u2026": "Publishing\u2026", "\u0110\xE3 ph\xE1t h\xE0nh b\u1EA3n {r} ({n} b\xE0i, t\u1EA3i l\xEAn {u} t\u1EC7p).": "Published revision {r} ({n} lessons, {u} files uploaded)."});
3449
+ Object.assign(EN, { "B\u1EA3n b\xE0n giao \u2014 \u0111\xFAng m\u1EABu: T\xECnh hu\u1ED1ng | C\xE1c b\u01B0\u1EDBc | K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i": "Handover copy \u2014 template columns: Test case | Steps | Expected result", "B\u1EA5m \xABTh\xEAm k\u1ECBch b\u1EA3n\xBB \u2014 m\u1ED7i k\u1ECBch b\u1EA3n \u1EE9ng v\u1EDBi m\u1ED9t ch\u1EE9c n\u0103ng / UC.": "Click \xABAdd test suite\xBB \u2014 one suite per function / use case.", "B\u1EA5m \xABTh\xEAm ph\xE2n h\u1EC7\xBB \u0111\u1EC3 b\u1EAFt \u0111\u1EA7u.": "Click \xABAdd module\xBB to start.", "B\u1EA5m \xABTh\xEAm ph\xE2n h\u1EC7\xBB \u0111\u1EC3 t\u1EA1o nh\xF3m ch\u1EE9c n\u0103ng \u0111\u1EA7u ti\xEAn.": "Click \xABAdd module\xBB to create the first function group.", "B\u1ECB ch\u1EB7n": "Blocked", "Cao": "High", "Ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n": "No test suites yet", "Ch\u01B0a c\xF3 ph\xE2n h\u1EC7": "No modules yet", "Ch\u01B0a c\xF3 t\xECnh hu\u1ED1ng \u2014 b\u1EA5m \xABTh\xEAm t\xECnh hu\u1ED1ng\xBB.": "No test cases yet \u2014 click \xABAdd test case\xBB.", "Ch\u01B0a c\xF3 \u2014 b\u01B0\u1EDBc chu\u1EA9n b\u1ECB d\xF9ng chung cho m\u1ECDi k\u1ECBch b\u1EA3n c\u1EE7a ph\xE2n h\u1EC7 (\u0111\u0103ng nh\u1EADp, m\u1EDF c\xF4ng c\u1EE5\u2026).": "None yet \u2014 preparation shared by every suite of the module (sign in, open the tool\u2026).", "Ch\u01B0a ghi ch\u1EE9c n\u0103ng \u0111\u01B0\u1EE3c ki\u1EC3m": "No function linked yet", "Ch\u01B0a li\xEAn k\u1EBFt repo t\xE0i li\u1EC7u BA (kho\xE1 \xABba\xBB trong .pantest.yaml) \u2014 ch\u01B0a ki\u1EC3m \u0111\u01B0\u1EE3c \u0111\u1ED9 ph\u1EE7 ch\u1EE9c n\u0103ng.": "No BA document repo linked (\xABba\xBB in .pantest.yaml) \u2014 function coverage cannot be checked.", "Ch\u01B0a test": "Not run", "Ch\u1EA1y test": "Run tests", "Ch\u1ECDn k\u1EBFt qu\u1EA3 test": "Choose the test result", "Ch\u1ECDn m\u1ED9t k\u1ECBch b\u1EA3n \u0111\u1EC3 xem v\xE0 s\u1EEDa thu\u1ED9c t\xEDnh.": "Select a test suite to view and edit its properties.", "Ch\u1ECDn \xEDt nh\u1EA5t m\u1ED9t \u0111\u1ECBnh d\u1EA1ng.": "Choose at least one format.", "C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n": "Steps", "C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n chung": "Common steps", "C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n chung \u2014 {m}": "Common steps \u2014 {m}", "D\xF9ng g\u1EA1ch \u0111\u1EA7u d\xF2ng \xAB- \xBB cho t\u1EEBng b\u01B0\u1EDBc.": "Use a \xAB- \xBB bullet for each step.", "Ghi k\u1EBFt qu\u1EA3 {t} t\xECnh hu\u1ED1ng: \u0111\u1EA1t {p}, kh\xF4ng \u0111\u1EA1t {f}.": "Recorded {t} test case results: {p} passed, {f} failed.", "G\xF5 m\xE3 ho\u1EB7c t\xEAn ch\u1EE9c n\u0103ng\u2026": "Type a function code or name\u2026", "Hi\u1EC7n m\xE3 t\xECnh hu\u1ED1ng (TC-\u2026)": "Show test case codes (TC-\u2026)", "H\u1EC7 th\u1ED1ng b\xE1o l\u1ED7i \u2026 / m\xE0n kh\xF4ng hi\u1EC7n \u2026": "The system shows error \u2026 / the screen does not open \u2026", "H\u1EC7 th\u1ED1ng \u2026": "The system \u2026", "Kh\xF4ng c\xF2n t\xECnh hu\u1ED1ng n\xE0o \u1EDF \u0111\xE2y.": "No test cases left here.", "Kh\xF4ng c\xF3 l\u1ED7i hay c\u1EA3nh b\xE1o.": "No errors or warnings.", "Kh\xF4ng c\xF3 t\xECnh hu\u1ED1ng \u1EDF tr\u1EA1ng th\xE1i n\xE0y.": "No test cases with this result.", "Kh\xF4ng ki\u1EC3m \u0111\u01B0\u1EE3c": "Could not run the checks", "Kh\xF4ng m\u1EDF \u0111\u01B0\u1EE3c t\xE0i li\u1EC7u ki\u1EC3m th\u1EED": "Could not open the test documents", "Kh\xF4ng th\xEAm \u0111\u01B0\u1EE3c": "Could not add", "Kh\xF4ng th\u1EA5y repo BA \xAB{p}\xBB \u2014 b\u1ECF qua ki\u1EC3m tham chi\u1EBFu v\xE0 \u0111\u1ED9 ph\u1EE7.": "BA repo \xAB{p}\xBB not found \u2014 reference and coverage checks skipped.", "Kh\xF4ng t\u1EA1o \u0111\u01B0\u1EE3c": "Could not create", "Kh\xF4ng \u0111\u1EA1t": "Failed", "Kh\xF4ng \u0111\u1EA1t: c\u1EA7n ghi k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF.": "Failed: enter the actual result.", "Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED": "Could not read the test document repo", "Ki\u1EC3m tra t\xE0i li\u1EC7u ki\u1EC3m th\u1EED": "Check the test documents", "Ki\u1EC3u t\xE0i li\u1EC7u": "Document type", "K\xE8m k\u1EBFt qu\u1EA3 test": "With test results", "K\xE8m k\u1EBFt qu\u1EA3 test \u2014 th\xEAm c\u1ED9t K\u1EBFt qu\u1EA3, Ng\u01B0\u1EDDi test / ng\xE0y v\xE0 ph\u1EE5 l\u1EE5c t\u1ED5ng h\u1EE3p": "With test results \u2014 adds Result and Tester / date columns and a summary appendix", "K\u1EBFt qu\u1EA3 ch\u1EA1y t\u1EF1 \u0111\u1ED9ng (results.json)\u2026": "Automated run results (results.json)\u2026", "K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i": "Expected result", "K\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF": "Actual result", "K\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF (b\u1EAFt bu\u1ED9c khi Kh\xF4ng \u0111\u1EA1t)": "Actual result (required when Failed)", "K\u1ECBch b\u1EA3n": "Test suite", "K\u1ECBch b\u1EA3n .feature (pan-test)\u2026": ".feature scenarios (pan-test)\u2026", "K\u1ECBch b\u1EA3n c\u1EA7n t\xEAn.": "The test suite needs a name.", "K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED": "Test scenario", "K\u1ECBch b\u1EA3n v\xE0 m\u1ECDi t\xECnh hu\u1ED1ng \u1EA9n kh\u1ECFi t\xE0i li\u1EC7u; t\u1EC7p v\xE0 m\xE3 gi\u1EEF l\u1EA1i.": "The suite and its test cases are hidden from the document; the file and codes are kept.", "Link l\u1ED7i": "Bug link", "L\u01B0u k\u1EBFt qu\u1EA3": "Save result", "L\u01B0u thu\u1ED9c t\xEDnh": "Save properties", "L\u1ECDc t\xECnh hu\u1ED1ng theo k\u1EBFt qu\u1EA3": "Filter test cases by result", "M\xE3 ch\u1EE9c n\u0103ng, c\xE1ch nhau b\u1EB1ng d\u1EA5u ph\u1EA9y": "Function codes, comma separated", "M\xE3 ph\xE2n h\u1EC7 (ch\u1EEF hoa / s\u1ED1, 2\u201312 k\xFD t\u1EF1)": "Module code (capitals / digits, 2\u201312 characters)", "M\xF4 t\u1EA3 / ghi ch\xFA": "Description / notes", "M\xF4 t\u1EA3 t\xECnh hu\u1ED1ng\u2026": "Describe the test case\u2026", "M\xF4i tr\u01B0\u1EDDng": "Environment", "M\u1ECDi ph\xE2n h\u1EC7": "All modules", "M\u1ECDi t\xECnh hu\u1ED1ng": "All test cases", "Ng\u01B0\u1EDDi t\u1EA1o": "Created by", "Phi ch\u1EE9c n\u0103ng": "Non-functional", "Ph\xE2n h\u1EC7 ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n": "This module has no test suites yet", "Ph\xE2n h\u1EC7 \u0111ang ch\u1ECDn": "Current module", "Ph\u1EE7 ch\u1EE9c n\u0103ng (t\xE0i li\u1EC7u BA)": "Covered functions (BA documents)", "Ph\u1EE7:": "Covers:", "So\u1EA1n xong": "Done", "S\u1EEDa thu\u1ED9c t\xEDnh": "Edit properties", "Th\xEAm k\u1ECBch b\u1EA3n": "Add test suite", "Th\xEAm k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED": "Add a test suite", "Th\xEAm k\u1ECBch b\u1EA3n sau": "Add a test suite after", "Th\xEAm ph\xE2n h\u1EC7": "Add module", "Th\xEAm thao t\xE1c": "More actions", "Th\xEAm t\xECnh hu\u1ED1ng": "Add test case", "Th\u1EA5p": "Low", "Th\u1EF1c t\u1EBF:": "Actual:", "Trung b\xECnh": "Medium", "Tr\u01B0\u1EDBc": "Previous", "T\xE0i li\u1EC7u ki\u1EC3m th\u1EED": "Test documents", "T\xEAn ch\u1EE9c n\u0103ng / UC \u0111\u01B0\u1EE3c ki\u1EC3m": "Function / use case under test", "T\xEAn k\u1ECBch b\u1EA3n": "Suite name", "T\xEAn ph\xE2n h\u1EC7 / nh\xF3m ch\u1EE9c n\u0103ng": "Module / function group name", "T\xECnh hu\u1ED1ng": "Test case", "T\xECnh hu\u1ED1ng m\u1EDBi": "New test case", "T\xECnh hu\u1ED1ng \u1EA9n kh\u1ECFi t\xE0i li\u1EC7u; m\xE3 gi\u1EEF l\u1EA1i trong t\u1EC7p \u0111\u1EC3 kh\xF4ng b\u1ECB d\xF9ng l\u1EA1i.": "The test case is hidden from the document; its code stays in the file so it is never reused.", "T\u1EA1o": "Create", "T\u1ED5ng": "Total", "T\u1ED5ng h\u1EE3p": "Summary", "T\u1ED5ng h\u1EE3p k\u1EBFt qu\u1EA3 ki\u1EC3m th\u1EED": "Test results summary", "T\u1EF7 l\u1EC7 \u0111\u1EA1t": "Pass rate", "Xo\xE1": "Delete", "Xo\xE1 k\u1ECBch b\u1EA3n": "Delete test suite", "Xo\xE1 k\u1ECBch b\u1EA3n {code}?": "Delete test suite {code}?", "Xo\xE1 t\xECnh hu\u1ED1ng": "Delete test case", "Xo\xE1 t\xECnh hu\u1ED1ng {code}?": "Delete test case {code}?", "Xu\u1EA5t t\xE0i li\u1EC7u ki\u1EC3m th\u1EED": "Export the test documents", "Y\xEAu c\u1EA7u": "Requirement", "{m} t\xECnh hu\u1ED1ng kh\xF4ng c\xF2n trong t\u1EC7p \u2014 gi\u1EEF nguy\xEAn, xem l\u1EA1i.": "{m} test case(s) no longer in the file \u2014 kept, please review.", "{n} kh\xF4ng \u0111\u1EA1t": "{n} failed", "{n} tag ch\u01B0a c\xF3 trong t\xE0i li\u1EC7u.": "{n} tag(s) not in the documents yet.", "{p}/{t} \u0111\u1EA1t": "{p}/{t} passed", "{t} \xB7 \u0111\u1EA1t {p} \xB7 kh\xF4ng \u0111\u1EA1t {f} \xB7 ch\u01B0a test {n}": "{t} \xB7 {p} passed \xB7 {f} failed \xB7 {n} not run", "\u0110ang xu\u1EA5t\u2026": "Exporting\u2026", "\u0110i\u1EC1u ki\u1EC7n ti\xEAn quy\u1EBFt": "Preconditions", "\u0110i\u1EC1u ki\u1EC7n ti\xEAn quy\u1EBFt:": "Preconditions:", "\u0110\xE1nh d\u1EA5u so\u1EA1n xong": "Mark as done", "\u0110\xE1nh d\u1EA5u \u0111ang so\u1EA1n": "Mark as drafting", "\u0110\xE3 nh\u1EADp {f} t\u1EC7p: th\xEAm {a}, c\u1EADp nh\u1EADt {u} t\xECnh hu\u1ED1ng.": "Imported {f} file(s): {a} added, {u} updated test case(s).", "\u0110\xE3 test {d}/{t}": "Tested {d}/{t}", "\u0110\xE3 xu\u1EA5t:": "Exported:", "\u0110\u1EA1t": "Passed", "\u0110\u1EA1t / t\u1ED5ng t\xECnh hu\u1ED1ng": "Passed / total test cases", "\u0110\u1ED3ng b\u1ED9 d\u1EEF li\u1EC7u, Qu\u1EA3n tr\u1ECB\u2026": "Data sync, Administration\u2026", "\u0110\u1ED5i b\u1ED9 l\u1ECDc \u0111\u1EC3 xem l\u1EA1i c\xE1c t\xECnh hu\u1ED1ng kh\xE1c.": "Change the filter to see other test cases.", "\u0110\u1ED9 ph\u1EE7 ch\u1EE9c n\u0103ng t\xE0i li\u1EC7u BA: {c}/{f} ch\u1EE9c n\u0103ng c\xF3 k\u1ECBch b\u1EA3n.": "BA function coverage: {c}/{f} functions have test suites.", "\u01AFu ti\xEAn": "Priority", "\u01AFu ti\xEAn:": "Priority:", "B\u1ECF qua": "Skipped", "Sau": "Next", "K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED, k\u1EBFt qu\u1EA3, xu\u1EA5t b\xE0n giao": "Test scenarios, results, handover export", "K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED UAT": "UAT test scenarios" });
3435
3450
  var PATTERNS = [
3436
3451
  [/^(\\d{2}) \xB7 Kh\xF4ng gian ph\xE2n h\u1EC7$/, '$1 \xB7 Module workspace'], [/^(\\d{2}) \xB7 Ki\u1EC3m tra$/, '$1 \xB7 Checks'],
3437
3452
  [/^D\u1EF1 \xE1n (.+), d\u1EF1 \xE1n con (.+)\\. \u0110\u1ED5i d\u1EF1 \xE1n con$/, 'Project $1, product $2. Switch product'], [/^Ph\xE2n h\u1EC7: (.+)\\. \u0110\u1ED5i ph\xE2n h\u1EC7$/, 'Module: $1. Switch module'],
@@ -3478,6 +3493,8 @@ tr.pb-flash > td { animation: pb-flash 1.2s ease-out 1 both; }
3478
3493
  // quen tay: c\xE2y m\u1EE5c l\u1EE5c b\xEAn tr\xE1i, th\u1EBB k\u1ECBch b\u1EA3n \u1EDF gi\u1EEFa, panel Chi ti\u1EBFt b\xEAn ph\u1EA3i, l\u0103ng k\xEDnh T\xE0i li\u1EC7u / T\u1ED5ng h\u1EE3p / Ki\u1EC3m tra.
3479
3494
  // M\u1ECDi thay \u0111\u1ED5i ghi qua API c\u1EE5c b\u1ED9 (src/doc/server.ts) \u2014 server ghi t\u1EC7p, app \u0111\u1ECDc l\u1EA1i.
3480
3495
 
3496
+ import { initAssist, mountAi, renderCtx, askAi } from './assist.js';
3497
+
3481
3498
  const P = window.PanBA;
3482
3499
  const h = P.h;
3483
3500
  const T = (s, o) => window.PanBAi18n.T(s, o);
@@ -3485,7 +3502,7 @@ const TOKEN = (document.querySelector('meta[name="pantest-token"]') || {}).conte
3485
3502
 
3486
3503
  /** D\u1EEF li\u1EC7u t\u1EEB /api/index: { root, me, config, modules, suites, ba, summary, readErrors }. */
3487
3504
  let D = null;
3488
- const ST = { mod: null, sel: null, lens: 'tai-lieu', filter: 'all' };
3505
+ const ST = { mod: null, sel: null, lens: 'document', filter: 'all' };
3489
3506
 
3490
3507
  const STATUS = {
3491
3508
  'not-run': { label: T('Ch\u01B0a test'), tone: 'neutral', ico: 'clock' },
@@ -3556,7 +3573,7 @@ const baTitle = (code) => { const it = (D.ba.items || []).find((i) => i.code ===
3556
3573
  async function boot() {
3557
3574
  await load();
3558
3575
  window.PANBA_UI = {
3559
- root: D.root, me: D.me, workspace: T('T\xE0i li\u1EC7u ki\u1EC3m th\u1EED'), wsId: 'tai-lieu-kiem-thu', brand: 'Pan Test',
3576
+ root: D.root, me: D.me, workspace: T('T\xE0i li\u1EC7u ki\u1EC3m th\u1EED'), wsId: 'test-docs', brand: 'Pan Test',
3560
3577
  screens: [{ id: '02', file: './' + location.search, label: T('K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED'), ico: 'layers' }],
3561
3578
  };
3562
3579
  ST.mod = (D.modules[0] || {}).code || null;
@@ -3568,10 +3585,11 @@ async function boot() {
3568
3585
 
3569
3586
  let UI = null; let lensTabs = null; const lensPanels = {};
3570
3587
  const LENSES = [
3571
- { id: 'tai-lieu', label: T('T\xE0i li\u1EC7u'), icon: 'file-text', testid: 'lens-tai-lieu' },
3572
- { id: 'doc', label: T('Xem nh\u01B0 Word'), icon: 'book', testid: 'lens-doc' },
3573
- { id: 'tong-hop', label: T('T\u1ED5ng h\u1EE3p'), icon: 'table', testid: 'lens-tong-hop' },
3574
- { id: 'kiem-tra', label: T('Ki\u1EC3m tra'), icon: 'shield', testid: 'lens-kiem-tra' },
3588
+ { id: 'document', label: T('T\xE0i li\u1EC7u'), icon: 'file-text', testid: 'lens-document' },
3589
+ { id: 'run', label: T('Ch\u1EA1y test'), icon: 'play', testid: 'lens-run' },
3590
+ { id: 'word', label: T('Xem nh\u01B0 Word'), icon: 'book', testid: 'lens-word' },
3591
+ { id: 'summary', label: T('T\u1ED5ng h\u1EE3p'), icon: 'table', testid: 'lens-summary' },
3592
+ { id: 'check', label: T('Ki\u1EC3m tra'), icon: 'shield', testid: 'lens-check' },
3575
3593
  ];
3576
3594
 
3577
3595
  function mountUi() {
@@ -3579,14 +3597,21 @@ function mountUi() {
3579
3597
  id: '02', title: T('T\xE0i li\u1EC7u ki\u1EC3m th\u1EED'), module: ST.mod,
3580
3598
  crumbs: [{ label: 'Pan Studio' }, { label: T('T\xE0i li\u1EC7u ki\u1EC3m th\u1EED') }, { label: D.config.title }],
3581
3599
  actions: [
3582
- { id: 'them-kb', label: T('Th\xEAm k\u1ECBch b\u1EA3n'), icon: 'plus', kind: 'secondary', testid: 'them-kich-ban', onClick: () => newSuiteDialog() },
3583
- { id: 'them-ph', label: T('Th\xEAm ph\xE2n h\u1EC7'), icon: 'layers', kind: 'secondary', testid: 'them-phan-he', onClick: () => newModuleDialog() },
3584
- { id: 'xuat', label: T('Xu\u1EA5t'), icon: 'download', kind: 'secondary', testid: 'xuat', onClick: () => exportDialog() },
3585
- { id: 'tai-lai', label: T('T\u1EA3i l\u1EA1i'), icon: 'refresh', kind: 'secondary', testid: 'tai-lai', onClick: () => reload() },
3600
+ { id: 'add-suite', label: T('Th\xEAm k\u1ECBch b\u1EA3n'), icon: 'plus', kind: 'secondary', testid: 'add-suite', onClick: () => newSuiteDialog() },
3601
+ { id: 'add-module', label: T('Th\xEAm ph\xE2n h\u1EC7'), icon: 'layers', kind: 'secondary', testid: 'add-module', onClick: () => newModuleDialog() },
3602
+ { id: 'import', label: T('Nh\u1EADp'), icon: 'upload', kind: 'secondary', testid: 'import', onClick: (e) => importMenu(e && e.currentTarget) },
3603
+ { id: 'export', label: T('Xu\u1EA5t'), icon: 'download', kind: 'secondary', testid: 'export', onClick: () => exportDialog() },
3604
+ { id: 'studio', label: T('Studio'), icon: 'upload', kind: 'secondary', testid: 'studio', onClick: () => studioDialog() },
3605
+ { id: 'reload', label: T('T\u1EA3i l\u1EA1i'), icon: 'refresh', kind: 'secondary', testid: 'reload', onClick: () => reload() },
3586
3606
  ],
3587
3607
  left: true, stickyHead: true,
3588
- right: { title: T('Chi ti\u1EBFt'), tabs: [{ id: 'thuoc-tinh', label: T('Thu\u1ED9c t\xEDnh') }] },
3608
+ right: { title: T('Chi ti\u1EBFt'), tabs: [{ id: 'properties', label: T('Thu\u1ED9c t\xEDnh') }, { id: 'tro-ly', label: T('Tr\u1EE3 l\xFD AI'), testid: 'rtab-tro-ly' }] },
3589
3609
  });
3610
+ // Tr\u1EE3 l\xFD AI: khung ch\xE9p nguy\xEAn t\u1EEB Pan BA (assist.js) \u2014 l\xF5i ch\u1EA1y qua \`pan ai-host\`, l\u1EDDi d\u1EB7n ri\xEAng Pan Test \u1EDF server
3611
+ initAssist({ P, h, D: () => D, M: () => ({ item: () => null, personName: () => '', rows: () => [] }), ST, PRODUCT: '', reload, select: (code) => goTo(code), rightTabs: UI.rightTabs, panel: UI.panel,
3612
+ aiHint: T('AI l\xE0m vi\u1EC7c ngay trong repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED: th\xEAm / s\u1EEDa k\u1ECBch b\u1EA3n v\xE0 t\xECnh hu\u1ED1ng b\u1EB1ng l\u1EC7nh pan test (m\xE3 kh\xF4ng tr\xF9ng, k\u1EBFt qu\u1EA3 gi\u1EEF nguy\xEAn), t\u1EF1 ch\u1EA1y pan test check, kh\xF4ng commit. Xong b\u1EA1n xem thay \u0111\u1ED5i r\u1ED3i Gi\u1EEF ho\u1EB7c Ho\xE0n t\xE1c.'),
3613
+ ctxView: aiContext });
3614
+ mountAi(UI.rightTabs.panels['tro-ly']).catch((e) => UI.rightTabs.panels['tro-ly'].appendChild(h('p', { class: 'pb-muted' }, String(e.message || e))));
3590
3615
  LENSES.forEach((l, i) => { lensPanels[l.id] = h('div', { class: 'pb-tabpanel', 'data-testid': 'lp-' + l.id, hidden: i > 0 || null }); });
3591
3616
  lensTabs = P.tabs(LENSES, { panels: lensPanels, label: T('L\u0103ng k\xEDnh'), onChange: (id) => { ST.lens = id; renderMain(); } });
3592
3617
  const head = UI.headExtra || UI.main;
@@ -3597,7 +3622,7 @@ function mountUi() {
3597
3622
  }
3598
3623
 
3599
3624
  function filterSelect() {
3600
- const sel = h('select', { class: 'pb-select ptx-filter', 'aria-label': T('L\u1ECDc t\xECnh hu\u1ED1ng theo k\u1EBFt qu\u1EA3'), 'data-testid': 'loc-ket-qua' },
3625
+ const sel = h('select', { class: 'pb-select ptx-filter', 'aria-label': T('L\u1ECDc t\xECnh hu\u1ED1ng theo k\u1EBFt qu\u1EA3'), 'data-testid': 'result-filter' },
3601
3626
  h('option', { value: 'all' }, T('M\u1ECDi t\xECnh hu\u1ED1ng')),
3602
3627
  STATUS_ORDER.map((k) => h('option', { value: k }, STATUS[k].label)));
3603
3628
  sel.addEventListener('change', () => { ST.filter = sel.value; renderMain(); });
@@ -3605,7 +3630,7 @@ function filterSelect() {
3605
3630
  return h('span', { class: 'ptx-filterbox' }, sel);
3606
3631
  }
3607
3632
 
3608
- function renderAll() { renderTree(); renderMain(); renderRight(); }
3633
+ function renderAll() { renderTree(); renderMain(); renderRight(); renderCtx(); }
3609
3634
 
3610
3635
  function fromHash() {
3611
3636
  const code = decodeURIComponent(location.hash.slice(1));
@@ -3614,9 +3639,9 @@ function fromHash() {
3614
3639
  if (!s) return;
3615
3640
  if (s.module !== ST.mod) { ST.mod = s.module; P.module(s.module); }
3616
3641
  ST.sel = s.code;
3617
- if (ST.lens !== 'tai-lieu') lensTabs.select('tai-lieu');
3642
+ if (ST.lens !== 'document') lensTabs.select('document');
3618
3643
  renderAll();
3619
- requestAnimationFrame(() => { const el = document.getElementById(code === s.code ? 'item-' + s.code : 'case-' + code); if (el) el.scrollIntoView({ block: 'start' }); });
3644
+ requestAnimationFrame(() => { lazy.now(document.getElementById('item-' + s.code)); const el = document.getElementById(code === s.code ? 'item-' + s.code : 'case-' + code); if (el) el.scrollIntoView({ block: 'start' }); });
3620
3645
  }
3621
3646
 
3622
3647
  function select(code) {
@@ -3624,13 +3649,13 @@ function select(code) {
3624
3649
  UI.left.querySelectorAll('.pbx-node').forEach((b) => b.setAttribute('aria-current', String(b.dataset.code === code)));
3625
3650
  document.querySelectorAll('.pbx-item.is-selected').forEach((c) => c.classList.remove('is-selected'));
3626
3651
  const card = document.getElementById('item-' + code); if (card) card.classList.add('is-selected');
3627
- renderRight();
3652
+ renderRight(); renderCtx();
3628
3653
  }
3629
3654
  function goTo(code) {
3630
3655
  select(code);
3631
- if (ST.lens !== 'tai-lieu') { lensTabs.select('tai-lieu'); }
3656
+ if (ST.lens !== 'document') { lensTabs.select('document'); }
3632
3657
  const el = document.getElementById('item-' + code);
3633
- if (el) el.scrollIntoView({ block: 'start', behavior: 'smooth' });
3658
+ if (el) { lazy.now(el); el.scrollIntoView({ block: 'start' }); }
3634
3659
  }
3635
3660
 
3636
3661
  // ---------------------------------------------------------------- c\xE2y b\xEAn tr\xE1i
@@ -3669,12 +3694,13 @@ function renderTree() {
3669
3694
  // ---------------------------------------------------------------- v\xF9ng gi\u1EEFa
3670
3695
  function renderMain() {
3671
3696
  const el = lensPanels[ST.lens]; if (!el) return;
3672
- const f = document.querySelector('.ptx-filterbox'); if (f) f.hidden = ST.lens !== 'tai-lieu';
3697
+ const f = document.querySelector('.ptx-filterbox'); if (f) f.hidden = ST.lens !== 'document';
3673
3698
  el.replaceChildren();
3674
- if (ST.lens === 'tai-lieu') renderWork(el);
3675
- else if (ST.lens === 'doc') renderRead(el);
3676
- else if (ST.lens === 'tong-hop') renderSummary(el);
3677
- else if (ST.lens === 'kiem-tra') renderCheck(el).catch((e) => el.appendChild(h('p', { class: 'pb-muted' }, String(e.message || e))));
3699
+ if (ST.lens === 'document') renderWork(el);
3700
+ else if (ST.lens === 'word') renderRead(el);
3701
+ else if (ST.lens === 'run') renderRun(el);
3702
+ else if (ST.lens === 'summary') renderSummary(el);
3703
+ else if (ST.lens === 'check') renderCheck(el).catch((e) => el.appendChild(h('p', { class: 'pb-muted' }, String(e.message || e))));
3678
3704
  }
3679
3705
 
3680
3706
  /** \u0110o\u1EA1n v\u0103n Markdown \u0111\u01A1n gi\u1EA3n: \u0111o\u1EA1n, g\u1EA1ch \u0111\u1EA7u d\xF2ng, \u0111\xE1nh s\u1ED1. */
@@ -3694,28 +3720,55 @@ function prose(text, testid) {
3694
3720
  function renderWork(el) {
3695
3721
  const m = D.modules.find((x) => x.code === ST.mod);
3696
3722
  if (!m) { el.appendChild(h('div', { class: 'pb-empty' }, h('div', { class: 'pb-empty__title' }, T('Ch\u01B0a c\xF3 ph\xE2n h\u1EC7')), h('p', { class: 'pb-muted' }, T('B\u1EA5m \xABTh\xEAm ph\xE2n h\u1EC7\xBB \u0111\u1EC3 b\u1EAFt \u0111\u1EA7u.')))); return; }
3697
- const editCommon = h('button', { type: 'button', class: 'pb-btn pb-btn--ghost', 'data-testid': 'sua-buoc-chung', html: P.icon('edit', { size: 16 }) + ' ' + T('S\u1EEDa') });
3723
+ const editCommon = h('button', { type: 'button', class: 'pb-btn pb-btn--ghost', 'data-testid': 'edit-common-steps', html: P.icon('edit', { size: 16 }) + ' ' + T('S\u1EEDa') });
3698
3724
  editCommon.addEventListener('click', () => commonStepsDialog(m));
3699
3725
  el.appendChild(h('h2', { class: 'pbx-ch', 'data-testid': 'module-title' }, modIndex(m.code) + '. ' + m.title));
3700
- el.appendChild(h('section', { class: 'pb-card pbx-item ptx-common', 'data-testid': 'buoc-chung' },
3726
+ el.appendChild(h('section', { class: 'pb-card pbx-item ptx-common', 'data-testid': 'common-steps' },
3701
3727
  h('div', { class: 'pbx-item__head' }, h('b', null, T('C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n chung')), editCommon),
3702
- prose(m.commonSteps, 'buoc-chung-noi-dung') || h('p', { class: 'pb-muted' }, T('Ch\u01B0a c\xF3 \u2014 b\u01B0\u1EDBc chu\u1EA9n b\u1ECB d\xF9ng chung cho m\u1ECDi k\u1ECBch b\u1EA3n c\u1EE7a ph\xE2n h\u1EC7 (\u0111\u0103ng nh\u1EADp, m\u1EDF c\xF4ng c\u1EE5\u2026).'))));
3728
+ prose(m.commonSteps, 'common-steps-body') || h('p', { class: 'pb-muted' }, T('Ch\u01B0a c\xF3 \u2014 b\u01B0\u1EDBc chu\u1EA9n b\u1ECB d\xF9ng chung cho m\u1ECDi k\u1ECBch b\u1EA3n c\u1EE7a ph\xE2n h\u1EC7 (\u0111\u0103ng nh\u1EADp, m\u1EDF c\xF4ng c\u1EE5\u2026).'))));
3703
3729
  const suites = modSuites(m.code);
3704
- if (!suites.length) el.appendChild(h('div', { class: 'pb-empty', 'data-testid': 'chua-co-kich-ban' }, h('div', { class: 'pb-empty__title' }, T('Ph\xE2n h\u1EC7 ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n')), h('p', { class: 'pb-muted' }, T('B\u1EA5m \xABTh\xEAm k\u1ECBch b\u1EA3n\xBB \u2014 m\u1ED7i k\u1ECBch b\u1EA3n \u1EE9ng v\u1EDBi m\u1ED9t ch\u1EE9c n\u0103ng / UC.'))));
3705
- for (const s of suites) el.appendChild(suiteCard(s));
3730
+ if (!suites.length) el.appendChild(h('div', { class: 'pb-empty', 'data-testid': 'no-suites' }, h('div', { class: 'pb-empty__title' }, T('Ph\xE2n h\u1EC7 ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n')), h('p', { class: 'pb-muted' }, T('B\u1EA5m \xABTh\xEAm k\u1ECBch b\u1EA3n\xBB \u2014 m\u1ED7i k\u1ECBch b\u1EA3n \u1EE9ng v\u1EDBi m\u1ED9t ch\u1EE9c n\u0103ng / UC.'))));
3731
+ lazy.reset(el);
3732
+ for (const s of suites) el.appendChild(lazy.add(suiteCard(s, true), s));
3733
+ lazy.start();
3706
3734
  }
3707
3735
 
3736
+ /** B\u1EA3ng t\xECnh hu\u1ED1ng d\u1EF1ng khi th\u1EBB s\u1EAFp v\xE0o khung nh\xECn (\xB1 1500 px), g\u1EE1 khi ra xa (\u2265 6000 px) \u2014 gi\u1EEF chi\u1EC1u cao \u0111\u1EC3 thanh cu\u1ED9n
3737
+ * kh\xF4ng nh\u1EA3y; th\u1EBB \u0111ang c\xF3 con tr\u1ECF kh\xF4ng b\u1ECB g\u1EE1. Ph\xE2n h\u1EC7 ngh\xECn t\xECnh hu\u1ED1ng kh\xF4ng d\u1EF1ng h\xE0ng ngh\xECn \xF4 s\u1EEDa m\u1ED9t l\xFAc. */
3738
+ const lazy = (() => {
3739
+ let near = null; let far = null; let cards = []; let host = null;
3740
+ const scrollerOf = (el) => { for (let e = el && el.parentElement; e && e !== document.body; e = e.parentElement) { const oy = getComputedStyle(e).overflowY; if (oy === 'auto' || oy === 'scroll') return e; } return null; };
3741
+ const fill = (card) => { if (card._filled || !card._fill) return; card._fill(); card._filled = true; card.style.minHeight = ''; };
3742
+ const empty = (card) => {
3743
+ if (!card._filled || card.contains(document.activeElement)) return;
3744
+ const hgt = card.getBoundingClientRect().height;
3745
+ card._unfill(); card._filled = false; card.style.minHeight = hgt + 'px';
3746
+ };
3747
+ return {
3748
+ reset(el) { if (near) near.disconnect(); if (far) far.disconnect(); cards = []; host = el; },
3749
+ add(card, s) { card.style.minHeight = (160 + liveCases(s).length * 120) + 'px'; cards.push(card); return card; },
3750
+ start() {
3751
+ if (!('IntersectionObserver' in window)) { cards.forEach(fill); return; }
3752
+ const root = scrollerOf(host);
3753
+ near = new IntersectionObserver((es) => es.forEach((e) => { if (e.isIntersecting) fill(e.target); }), { root, rootMargin: '1500px 0px' });
3754
+ far = new IntersectionObserver((es) => es.forEach((e) => { if (!e.isIntersecting) empty(e.target); }), { root, rootMargin: '6000px 0px' });
3755
+ cards.forEach((c) => { near.observe(c); far.observe(c); });
3756
+ },
3757
+ now(card) { if (card) fill(card); },
3758
+ };
3759
+ })();
3760
+
3708
3761
  function statusBadge(st, extra) {
3709
3762
  const s = STATUS[st] || STATUS['not-run'];
3710
3763
  return h('span', Object.assign({ class: 'pb-badge', 'data-tone': s.tone, 'data-status': st }, extra || {}), P.iconEl(s.ico, { size: 14, stroke: 2 }), s.label);
3711
3764
  }
3712
3765
 
3713
- function suiteCard(s) {
3766
+ function suiteCard(s, deferBody) {
3714
3767
  const cases = liveCases(s);
3715
3768
  const c = countOf(cases);
3716
3769
  const codeBtn = h('button', { type: 'button', class: 'pb-code pbx-item__code', 'data-testid': 'copy-code-' + s.code, title: T('B\u1EA5m \u0111\u1EC3 ch\xE9p m\xE3') }, s.code);
3717
3770
  codeBtn.addEventListener('click', (e) => { e.stopPropagation(); void copyText(s.code, T('\u0110\xE3 ch\xE9p m\xE3 {code}.', { code: s.code })); });
3718
- const add = h('button', { type: 'button', class: 'pb-btn pb-btn--ghost', 'data-testid': 'them-th-' + s.code, html: P.icon('plus', { size: 16 }) + ' ' + T('Th\xEAm t\xECnh hu\u1ED1ng') });
3771
+ const add = h('button', { type: 'button', class: 'pb-btn pb-btn--ghost', 'data-testid': 'add-case-' + s.code, html: P.icon('plus', { size: 16 }) + ' ' + T('Th\xEAm t\xECnh hu\u1ED1ng') });
3719
3772
  add.addEventListener('click', (e) => { e.stopPropagation(); void addCase(s); });
3720
3773
  const more = h('button', { type: 'button', class: 'pb-btn pb-btn--ghost pb-btn--icon', 'aria-label': T('Th\xEAm thao t\xE1c'), 'data-testid': 'menu-' + s.code, html: P.icon('more', { size: 16 }) });
3721
3774
  more.addEventListener('click', (e) => { e.stopPropagation(); P.menu(more, [
@@ -3725,10 +3778,10 @@ function suiteCard(s) {
3725
3778
  { label: s.status === 'done' ? T('\u0110\xE1nh d\u1EA5u \u0111ang so\u1EA1n') : T('\u0110\xE1nh d\u1EA5u so\u1EA1n xong'), icon: 'check', testid: 'm-done', run: () => void saveSuite(s.code, { status: s.status === 'done' ? 'drafting' : 'done' }) },
3726
3779
  { label: T('Xo\xE1 k\u1ECBch b\u1EA3n'), icon: 'trash', testid: 'm-delete', run: () => confirmDelete(s) },
3727
3780
  ], { placement: 'bottom-end', testid: 'card-menu' }); });
3728
- const prog = h('span', { class: 'ptx-prog', 'data-testid': 'tien-do-' + s.code, title: T('\u0110\u1EA1t / t\u1ED5ng t\xECnh hu\u1ED1ng') }, T('{p}/{t} \u0111\u1EA1t', { p: c.passed, t: c.total }), c.failed ? h('span', { class: 'ptx-prog__bad' }, ' \xB7 ' + T('{n} kh\xF4ng \u0111\u1EA1t', { n: c.failed })) : null);
3781
+ const prog = h('span', { class: 'ptx-prog', 'data-testid': 'progress-' + s.code, title: T('\u0110\u1EA1t / t\u1ED5ng t\xECnh hu\u1ED1ng') }, T('{p}/{t} \u0111\u1EA1t', { p: c.passed, t: c.total }), c.failed ? h('span', { class: 'ptx-prog__bad' }, ' \xB7 ' + T('{n} kh\xF4ng \u0111\u1EA1t', { n: c.failed })) : null);
3729
3782
  const meta = h('div', { class: 'ptx-meta' },
3730
3783
  s.kind === 'non-functional' ? h('span', { class: 'pb-badge', 'data-tone': 'violet' }, KIND['non-functional']) : null,
3731
- s.covers.length ? h('span', { class: 'ptx-meta__item', 'data-testid': 'phu-' + s.code }, T('Ph\u1EE7:') + ' ', s.covers.map((x) => h('span', { class: 'pb-code', title: baTitle(x) || null }, x))) : (s.kind === 'functional' ? h('span', { class: 'ptx-meta__warn' }, T('Ch\u01B0a ghi ch\u1EE9c n\u0103ng \u0111\u01B0\u1EE3c ki\u1EC3m')) : null),
3784
+ s.covers.length ? h('span', { class: 'ptx-meta__item', 'data-testid': 'covers-' + s.code }, T('Ph\u1EE7:') + ' ', s.covers.map((x) => h('span', { class: 'pb-code', title: baTitle(x) || null }, x))) : (s.kind === 'functional' ? h('span', { class: 'ptx-meta__warn' }, T('Ch\u01B0a ghi ch\u1EE9c n\u0103ng \u0111\u01B0\u1EE3c ki\u1EC3m')) : null),
3732
3785
  s.useCases.length ? h('span', { class: 'ptx-meta__item' }, 'UC: ' + s.useCases.join(', ')) : null,
3733
3786
  s.priority ? h('span', { class: 'ptx-meta__item' }, T('\u01AFu ti\xEAn:') + ' ' + PRIORITY[s.priority]) : null,
3734
3787
  s.status === 'done' ? h('span', { class: 'pb-badge', 'data-tone': 'ok' }, T('So\u1EA1n xong')) : null);
@@ -3736,8 +3789,11 @@ function suiteCard(s) {
3736
3789
  h('div', { class: 'pbx-item__head' }, h('span', { class: 'pbx-item__num' }, suiteNum(s)), codeBtn, h('b', null, s.title), prog, h('span', { class: 'pbx-grow' }), add, more),
3737
3790
  meta,
3738
3791
  s.preconditions ? h('p', { class: 'ptx-pre' }, h('b', null, T('\u0110i\u1EC1u ki\u1EC7n ti\xEAn quy\u1EBFt:') + ' '), s.preconditions) : null,
3739
- prose(s.description, 'mo-ta-' + s.code),
3740
- casesTable(s));
3792
+ h('div', { class: 'ptx-suite-body' }));
3793
+ const bodyHost = card.lastChild;
3794
+ card._fill = () => { bodyHost.replaceChildren(...[prose(s.description, 'description-' + s.code), casesTable(s)].filter(Boolean)); };
3795
+ card._unfill = () => bodyHost.replaceChildren();
3796
+ if (!deferBody) { card._fill(); card._filled = true; }
3741
3797
  card.addEventListener('click', (e) => { if (!e.target.closest('a,button,input,textarea,select')) select(s.code); });
3742
3798
  return card;
3743
3799
  }
@@ -3745,7 +3801,7 @@ function suiteCard(s) {
3745
3801
  function casesTable(s) {
3746
3802
  const nf = s.kind === 'non-functional';
3747
3803
  const shown = liveCases(s).filter((c) => ST.filter === 'all' || statusOf(c) === ST.filter);
3748
- if (!liveCases(s).length) return h('p', { class: 'pb-muted', 'data-testid': 'chua-co-th-' + s.code }, T('Ch\u01B0a c\xF3 t\xECnh hu\u1ED1ng \u2014 b\u1EA5m \xABTh\xEAm t\xECnh hu\u1ED1ng\xBB.'));
3804
+ if (!liveCases(s).length) return h('p', { class: 'pb-muted', 'data-testid': 'no-cases-' + s.code }, T('Ch\u01B0a c\xF3 t\xECnh hu\u1ED1ng \u2014 b\u1EA5m \xABTh\xEAm t\xECnh hu\u1ED1ng\xBB.'));
3749
3805
  if (!shown.length) return h('p', { class: 'pb-muted' }, T('Kh\xF4ng c\xF3 t\xECnh hu\u1ED1ng \u1EDF tr\u1EA1ng th\xE1i n\xE0y.'));
3750
3806
  const cols = nf ? [T('Y\xEAu c\u1EA7u'), T('K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED'), T('K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i')] : [T('T\xECnh hu\u1ED1ng'), T('C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n'), T('K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i')];
3751
3807
  const fields = nf ? ['requirement', 'steps', 'expected'] : ['case', 'steps', 'expected'];
@@ -3758,7 +3814,7 @@ function casesTable(s) {
3758
3814
  h('td', { class: 'ptx-result' }, resultCell(c)));
3759
3815
  return row;
3760
3816
  }));
3761
- return h('div', { class: 'pb-grid-wrap' }, h('table', { class: 'pb-grid ptx-cases', 'data-testid': 'bang-th-' + s.code },
3817
+ return h('div', { class: 'pb-grid-wrap' }, h('table', { class: 'pb-grid ptx-cases', 'data-testid': 'cases-table-' + s.code },
3762
3818
  h('colgroup', null, h('col', { style: { width: '56px' } }), h('col', { style: { width: '27%' } }), h('col', { style: { width: '33%' } }), h('col', { style: { width: '27%' } }), h('col', { style: { width: '150px' } })),
3763
3819
  h('thead', null, h('tr', null, h('th', null, '#'), cols.map((x) => h('th', null, x)), h('th', null, T('K\u1EBFt qu\u1EA3')))), body));
3764
3820
  }
@@ -3793,21 +3849,21 @@ function caseTools(s, c, i, n) {
3793
3849
  const code = h('button', { type: 'button', class: 'ptx-code', 'data-testid': 'copy-case-' + c.code, title: T('B\u1EA5m \u0111\u1EC3 ch\xE9p m\xE3') + ' ' + c.code }, c.code.slice(-6));
3794
3850
  code.addEventListener('click', (e) => { e.stopPropagation(); void copyText(c.code, T('\u0110\xE3 ch\xE9p m\xE3 {code}.', { code: c.code })); });
3795
3851
  return h('div', { class: 'ptx-tools' }, code,
3796
- btn('chevron-up', T('D\u1EDDi l\xEAn'), 'len-' + c.code, () => void moveCase(c, -1), i === 0),
3797
- btn('chevron-down', T('D\u1EDDi xu\u1ED1ng'), 'xuong-' + c.code, () => void moveCase(c, 1), i === n - 1),
3798
- btn('trash', T('Xo\xE1 t\xECnh hu\u1ED1ng'), 'xoa-' + c.code, () => deleteCase(c)));
3852
+ btn('chevron-up', T('D\u1EDDi l\xEAn'), 'up-' + c.code, () => void moveCase(c, -1), i === 0),
3853
+ btn('chevron-down', T('D\u1EDDi xu\u1ED1ng'), 'down-' + c.code, () => void moveCase(c, 1), i === n - 1),
3854
+ btn('trash', T('Xo\xE1 t\xECnh hu\u1ED1ng'), 'delete-' + c.code, () => deleteCase(c)));
3799
3855
  }
3800
3856
 
3801
3857
  function resultCell(c) {
3802
3858
  const st = statusOf(c);
3803
- const btn = h('button', { type: 'button', class: 'ptx-status', 'data-testid': 'kq-' + c.code, 'aria-haspopup': 'menu', title: T('Ch\u1ECDn k\u1EBFt qu\u1EA3 test') }, statusBadge(st), P.iconEl('chevron-down', { size: 14 }));
3859
+ const btn = h('button', { type: 'button', class: 'ptx-status', 'data-testid': 'result-' + c.code, 'aria-haspopup': 'menu', title: T('Ch\u1ECDn k\u1EBFt qu\u1EA3 test') }, statusBadge(st), P.iconEl('chevron-down', { size: 14 }));
3804
3860
  btn.addEventListener('click', (e) => {
3805
3861
  e.stopPropagation();
3806
- P.menu(btn, STATUS_ORDER.map((k) => ({ label: STATUS[k].label, checked: k === st, testid: 'kq-chon-' + k, run: () => void chooseResult(c, k) })), { placement: 'bottom-end', testid: 'kq-menu' });
3862
+ P.menu(btn, STATUS_ORDER.map((k) => ({ label: STATUS[k].label, checked: k === st, testid: 'result-pick-' + k, run: () => void chooseResult(c, k) })), { placement: 'bottom-end', testid: 'result-menu' });
3807
3863
  });
3808
3864
  const r = c.result || {};
3809
3865
  const info = r.by ? h('div', { class: 'ptx-by pb-small pb-muted' }, (r.by || '') + (r.at ? ' \xB7 ' + r.at : '') + (r.env ? ' \xB7 ' + r.env : '')) : null;
3810
- const actual = r.actual ? h('div', { class: 'ptx-actual pb-small', 'data-testid': 'thuc-te-' + c.code }, h('b', null, T('Th\u1EF1c t\u1EBF:') + ' '), r.actual) : null;
3866
+ const actual = r.actual ? h('div', { class: 'ptx-actual pb-small', 'data-testid': 'actual-' + c.code }, h('b', null, T('Th\u1EF1c t\u1EBF:') + ' '), r.actual) : null;
3811
3867
  const bug = r.bug ? h('a', { class: 'pb-small', href: r.bug, target: '_blank', rel: 'noopener noreferrer' }, T('L\u1ED7i')) : null;
3812
3868
  return h('div', null, btn, info, actual, bug);
3813
3869
  }
@@ -3820,20 +3876,20 @@ async function chooseResult(c, status) {
3820
3876
 
3821
3877
  function resultDialog(c, status) {
3822
3878
  const r = c.result || {};
3823
- const actual = h('textarea', { class: 'pb-textarea', rows: '3', 'data-testid': 'kq-thuc-te', placeholder: T('H\u1EC7 th\u1ED1ng b\xE1o l\u1ED7i \u2026 / m\xE0n kh\xF4ng hi\u1EC7n \u2026') });
3879
+ const actual = h('textarea', { class: 'pb-textarea', rows: '3', 'data-testid': 'result-actual', placeholder: T('H\u1EC7 th\u1ED1ng b\xE1o l\u1ED7i \u2026 / m\xE0n kh\xF4ng hi\u1EC7n \u2026') });
3824
3880
  actual.value = r.actual || '';
3825
- const env = h('input', { class: 'pb-input', 'data-testid': 'kq-moi-truong', placeholder: 'UAT, SIT\u2026', value: r.env || '' });
3826
- const bug = h('input', { class: 'pb-input', 'data-testid': 'kq-loi', placeholder: 'https://\u2026', value: r.bug || '' });
3827
- const err = h('p', { class: 'pb-small', style: { color: 'var(--pb-broken)' }, 'data-testid': 'kq-loi-nhap' });
3881
+ const env = h('input', { class: 'pb-input', 'data-testid': 'result-env', placeholder: 'UAT, SIT\u2026', value: r.env || '' });
3882
+ const bug = h('input', { class: 'pb-input', 'data-testid': 'result-bug', placeholder: 'https://\u2026', value: r.bug || '' });
3883
+ const err = h('p', { class: 'pb-small', style: { color: 'var(--pb-broken)' }, 'data-testid': 'result-error' });
3828
3884
  P.dialog({
3829
- title: STATUS[status].label + ' \xB7 ' + c.code, size: 'sm', testid: 'kq-dialog',
3885
+ title: STATUS[status].label + ' \xB7 ' + c.code, size: 'sm', testid: 'result-dialog',
3830
3886
  body: h('div', { class: 'pb-stack' },
3831
3887
  h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('K\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF') + (status === 'failed' ? ' *' : '')), actual),
3832
3888
  h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('M\xF4i tr\u01B0\u1EDDng')), env),
3833
3889
  h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('Link l\u1ED7i')), bug), err),
3834
3890
  actions: [
3835
3891
  { label: T('Hu\u1EF7'), kind: 'ghost' },
3836
- { label: T('L\u01B0u k\u1EBFt qu\u1EA3'), kind: 'primary', testid: 'kq-luu', onClick: (_e, dlg) => {
3892
+ { label: T('L\u01B0u k\u1EBFt qu\u1EA3'), kind: 'primary', testid: 'result-save', onClick: (_e, dlg) => {
3837
3893
  if (status === 'failed' && !actual.value.trim()) { err.textContent = T('Kh\xF4ng \u0111\u1EA1t: c\u1EA7n ghi k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF.'); actual.focus(); return false; }
3838
3894
  void write('api/result', { code: c.code, status, actual: actual.value, env: env.value, bug: bug.value }).then((x) => { if (x) { patchCase(c, x); dlg.close(); } });
3839
3895
  return false;
@@ -3851,7 +3907,7 @@ function patchCase(c, fresh) {
3851
3907
  }
3852
3908
  function redrawSuite(s) {
3853
3909
  const old = document.getElementById('item-' + s.code);
3854
- if (old && ST.lens === 'tai-lieu') old.replaceWith(suiteCard(s));
3910
+ if (old && ST.lens === 'document') old.replaceWith(suiteCard(s));
3855
3911
  const cnt = UI.left.querySelector('[data-testid="tree-count-' + CSS.escape(s.code) + '"]');
3856
3912
  if (cnt) { const c = countOf(liveCases(s)); cnt.textContent = ' ' + c.passed + '/' + c.total; }
3857
3913
  if (ST.sel === s.code) renderRight();
@@ -3872,16 +3928,16 @@ async function moveCase(c, dir) {
3872
3928
  }
3873
3929
  function deleteCase(c) {
3874
3930
  P.dialog({
3875
- title: T('Xo\xE1 t\xECnh hu\u1ED1ng {code}?', { code: c.code }), size: 'sm', testid: 'xoa-th-dialog',
3931
+ title: T('Xo\xE1 t\xECnh hu\u1ED1ng {code}?', { code: c.code }), size: 'sm', testid: 'delete-case-dialog',
3876
3932
  body: h('p', null, T('T\xECnh hu\u1ED1ng \u1EA9n kh\u1ECFi t\xE0i li\u1EC7u; m\xE3 gi\u1EEF l\u1EA1i trong t\u1EC7p \u0111\u1EC3 kh\xF4ng b\u1ECB d\xF9ng l\u1EA1i.')),
3877
- actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('Xo\xE1'), kind: 'danger', testid: 'xoa-th-ok', onClick: () => { void write('api/case/delete', { code: c.code }).then((r) => { if (r) void reloadKeep(); }); } }],
3933
+ actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('Xo\xE1'), kind: 'danger', testid: 'delete-case-ok', onClick: () => { void write('api/case/delete', { code: c.code }).then((r) => { if (r) void reloadKeep(); }); } }],
3878
3934
  });
3879
3935
  }
3880
3936
  function confirmDelete(s) {
3881
3937
  P.dialog({
3882
- title: T('Xo\xE1 k\u1ECBch b\u1EA3n {code}?', { code: s.code }), size: 'sm', testid: 'xoa-kb-dialog',
3938
+ title: T('Xo\xE1 k\u1ECBch b\u1EA3n {code}?', { code: s.code }), size: 'sm', testid: 'delete-suite-dialog',
3883
3939
  body: h('p', null, T('K\u1ECBch b\u1EA3n v\xE0 m\u1ECDi t\xECnh hu\u1ED1ng \u1EA9n kh\u1ECFi t\xE0i li\u1EC7u; t\u1EC7p v\xE0 m\xE3 gi\u1EEF l\u1EA1i.')),
3884
- actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('Xo\xE1'), kind: 'danger', testid: 'xoa-kb-ok', onClick: () => { void saveSuite(s.code, { status: 'deleted' }).then(() => reloadKeep()); } }],
3940
+ actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('Xo\xE1'), kind: 'danger', testid: 'delete-suite-ok', onClick: () => { void saveSuite(s.code, { status: 'deleted' }).then(() => reloadKeep()); } }],
3885
3941
  });
3886
3942
  }
3887
3943
  async function saveSuite(code, patch) {
@@ -3904,16 +3960,16 @@ async function reloadKeep() {
3904
3960
 
3905
3961
  // ---------------------------------------------------------------- h\u1ED9p tho\u1EA1i t\u1EA1o
3906
3962
  function newModuleDialog() {
3907
- const code = h('input', { class: 'pb-input', 'data-testid': 'ph-ma', placeholder: 'VD: DB, QT, BC', maxlength: '12', autofocus: true });
3908
- const title = h('input', { class: 'pb-input', 'data-testid': 'ph-ten', placeholder: T('\u0110\u1ED3ng b\u1ED9 d\u1EEF li\u1EC7u, Qu\u1EA3n tr\u1ECB\u2026') });
3963
+ const code = h('input', { class: 'pb-input', 'data-testid': 'module-code', placeholder: 'VD: DB, QT, BC', maxlength: '12', autofocus: true });
3964
+ const title = h('input', { class: 'pb-input', 'data-testid': 'module-name', placeholder: T('\u0110\u1ED3ng b\u1ED9 d\u1EEF li\u1EC7u, Qu\u1EA3n tr\u1ECB\u2026') });
3909
3965
  const err = h('p', { class: 'pb-small', style: { color: 'var(--pb-broken)' } });
3910
3966
  code.addEventListener('input', () => { code.value = code.value.toUpperCase().replace(/[^A-Z0-9]/g, ''); });
3911
3967
  P.dialog({
3912
- title: T('Th\xEAm ph\xE2n h\u1EC7'), size: 'sm', testid: 'ph-dialog',
3968
+ title: T('Th\xEAm ph\xE2n h\u1EC7'), size: 'sm', testid: 'module-dialog',
3913
3969
  body: h('div', { class: 'pb-stack' },
3914
3970
  h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('M\xE3 ph\xE2n h\u1EC7 (ch\u1EEF hoa / s\u1ED1, 2\u201312 k\xFD t\u1EF1)')), code),
3915
3971
  h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('T\xEAn ph\xE2n h\u1EC7 / nh\xF3m ch\u1EE9c n\u0103ng')), title), err),
3916
- actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('Th\xEAm'), kind: 'primary', testid: 'ph-ok', onClick: (_e, dlg) => {
3972
+ actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('Th\xEAm'), kind: 'primary', testid: 'module-ok', onClick: (_e, dlg) => {
3917
3973
  void api('api/module/new', { code: code.value, title: title.value }).then(async (r) => {
3918
3974
  if (!r.ok) { err.textContent = r.json.error || T('Kh\xF4ng th\xEAm \u0111\u01B0\u1EE3c'); return; }
3919
3975
  dlg.close(); ST.mod = r.json.code; await reload(); P.module(r.json.code);
@@ -3925,17 +3981,17 @@ function newModuleDialog() {
3925
3981
 
3926
3982
  function newSuiteDialog(after) {
3927
3983
  if (!ST.mod) { newModuleDialog(); return; }
3928
- const title = h('input', { class: 'pb-input', 'data-testid': 'kb-ten', placeholder: T('T\xEAn ch\u1EE9c n\u0103ng / UC \u0111\u01B0\u1EE3c ki\u1EC3m'), autofocus: true });
3929
- const kind = h('select', { class: 'pb-select', 'data-testid': 'kb-loai' }, Object.keys(KIND).map((k) => h('option', { value: k }, KIND[k])));
3984
+ const title = h('input', { class: 'pb-input', 'data-testid': 'suite-title', placeholder: T('T\xEAn ch\u1EE9c n\u0103ng / UC \u0111\u01B0\u1EE3c ki\u1EC3m'), autofocus: true });
3985
+ const kind = h('select', { class: 'pb-select', 'data-testid': 'suite-kind' }, Object.keys(KIND).map((k) => h('option', { value: k }, KIND[k])));
3930
3986
  const covers = coversPicker([]);
3931
3987
  const err = h('p', { class: 'pb-small', style: { color: 'var(--pb-broken)' } });
3932
3988
  P.dialog({
3933
- title: T('Th\xEAm k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED'), size: 'md', testid: 'kb-dialog',
3989
+ title: T('Th\xEAm k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED'), size: 'md', testid: 'suite-dialog',
3934
3990
  body: h('div', { class: 'pb-stack' },
3935
3991
  h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('T\xEAn k\u1ECBch b\u1EA3n')), title),
3936
3992
  h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('Lo\u1EA1i')), kind),
3937
3993
  h('div', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('Ph\u1EE7 ch\u1EE9c n\u0103ng (t\xE0i li\u1EC7u BA)')), covers.el), err),
3938
- actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('T\u1EA1o'), kind: 'primary', testid: 'kb-ok', onClick: (_e, dlg) => {
3994
+ actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('T\u1EA1o'), kind: 'primary', testid: 'suite-ok', onClick: (_e, dlg) => {
3939
3995
  if (!title.value.trim()) { err.textContent = T('K\u1ECBch b\u1EA3n c\u1EA7n t\xEAn.'); title.focus(); return false; }
3940
3996
  void api('api/suite/new', { module: ST.mod, title: title.value, kind: kind.value, covers: covers.get(), after }).then(async (r) => {
3941
3997
  if (!r.ok) { err.textContent = r.json.error || T('Kh\xF4ng t\u1EA1o \u0111\u01B0\u1EE3c'); return; }
@@ -3948,12 +4004,12 @@ function newSuiteDialog(after) {
3948
4004
  }
3949
4005
 
3950
4006
  function commonStepsDialog(m) {
3951
- const ta = h('textarea', { class: 'pb-textarea', rows: '10', 'data-testid': 'buoc-chung-input', placeholder: '- B\u01B0\u1EDBc 1: \u2026\\n- B\u01B0\u1EDBc 2: \u2026' });
4007
+ const ta = h('textarea', { class: 'pb-textarea', rows: '10', 'data-testid': 'common-steps-input', placeholder: '- B\u01B0\u1EDBc 1: \u2026\\n- B\u01B0\u1EDBc 2: \u2026' });
3952
4008
  ta.value = m.commonSteps || '';
3953
4009
  P.dialog({
3954
- title: T('C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n chung \u2014 {m}', { m: m.title }), size: 'md', testid: 'buoc-chung-dialog',
4010
+ title: T('C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n chung \u2014 {m}', { m: m.title }), size: 'md', testid: 'common-steps-dialog',
3955
4011
  body: h('div', { class: 'pb-stack' }, ta, h('p', { class: 'pb-small pb-muted' }, T('D\xF9ng g\u1EA1ch \u0111\u1EA7u d\xF2ng \xAB- \xBB cho t\u1EEBng b\u01B0\u1EDBc.'))),
3956
- actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('L\u01B0u'), kind: 'primary', testid: 'buoc-chung-luu', onClick: () => {
4012
+ actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('L\u01B0u'), kind: 'primary', testid: 'common-steps-save', onClick: () => {
3957
4013
  void write('api/module', { code: m.code, commonSteps: ta.value }).then((r) => { if (r) { Object.assign(m, r); renderMain(); } });
3958
4014
  } }],
3959
4015
  });
@@ -3962,8 +4018,8 @@ function commonStepsDialog(m) {
3962
4018
  /** Ch\u1ECDn m\xE3 ch\u1EE9c n\u0103ng / m\xE0n c\u1EE7a repo BA (g\xF5 \u0111\u1EC3 l\u1ECDc); repo BA ch\u01B0a li\xEAn k\u1EBFt th\xEC g\xF5 m\xE3 t\u1EF1 do, c\xE1ch nhau b\u1EB1ng d\u1EA5u ph\u1EA9y. */
3963
4019
  function coversPicker(initial) {
3964
4020
  let cur = initial.slice();
3965
- const chips = h('div', { class: 'ptx-chips', 'data-testid': 'phu-chips' });
3966
- const input = h('input', { class: 'pb-input', 'data-testid': 'phu-input', placeholder: D.ba.linked ? T('G\xF5 m\xE3 ho\u1EB7c t\xEAn ch\u1EE9c n\u0103ng\u2026') : T('M\xE3 ch\u1EE9c n\u0103ng, c\xE1ch nhau b\u1EB1ng d\u1EA5u ph\u1EA9y') });
4021
+ const chips = h('div', { class: 'ptx-chips', 'data-testid': 'covers-chips' });
4022
+ const input = h('input', { class: 'pb-input', 'data-testid': 'covers-input', placeholder: D.ba.linked ? T('G\xF5 m\xE3 ho\u1EB7c t\xEAn ch\u1EE9c n\u0103ng\u2026') : T('M\xE3 ch\u1EE9c n\u0103ng, c\xE1ch nhau b\u1EB1ng d\u1EA5u ph\u1EA9y') });
3967
4023
  const draw = () => chips.replaceChildren(...cur.map((code) => {
3968
4024
  const x = h('button', { type: 'button', class: 'pb-btn pb-btn--ghost pb-btn--icon', 'aria-label': T('B\u1ECF') + ' ' + code, html: P.icon('x', { size: 12 }) });
3969
4025
  x.addEventListener('click', () => { cur = cur.filter((c) => c !== code); draw(); });
@@ -3983,21 +4039,41 @@ function coversPicker(initial) {
3983
4039
  return { el: h('div', { class: 'pb-stack' }, chips, input), get: () => { if (input.value.trim()) { input.value.split(',').forEach(addCode); input.value = ''; } return cur.slice(); } };
3984
4040
  }
3985
4041
 
4042
+ // ---------------------------------------------------------------- Tr\u1EE3 l\xFD AI: ng\u1EEF c\u1EA3nh + vi\u1EC7c nhanh (m\xF3c ctxView c\u1EE7a khung Pan BA)
4043
+ function aiContext(ctxEl, quickEl, x) {
4044
+ const s = ST.sel && suiteBy(ST.sel);
4045
+ const m = D.modules.find((y) => y.code === ST.mod);
4046
+ ctxEl.replaceChildren(h('span', { class: 'pb-small pb-muted' }, T('Ng\u1EEF c\u1EA3nh:')), ' ',
4047
+ h('span', { class: 'pb-small', 'data-testid': 'ai-ctx-suite' }, s ? s.code + ' \xB7 ' + s.title : m ? T('ph\xE2n h\u1EC7 {m}', { m: m.code + ' \xB7 ' + m.title }) : '\u2014'));
4048
+ const ask = (text) => askAi('tu-do', { text });
4049
+ const q = [];
4050
+ if (s) {
4051
+ const n = liveCases(s).length;
4052
+ q.push(x.btn(n ? T('B\u1ED5 sung t\xECnh hu\u1ED1ng') : T('Vi\u1EBFt t\xECnh hu\u1ED1ng'), { kind: 'secondary', small: true, testid: 'ai-q-cases', onClick: () => ask(n
4053
+ ? T('B\u1ED5 sung t\xECnh hu\u1ED1ng c\xF2n thi\u1EBFu cho k\u1ECBch b\u1EA3n {c} \xAB{t}\xBB (\u0111\u1ED1i chi\u1EBFu t\xE0i li\u1EC7u BA{v}).', { c: s.code, t: s.title, v: s.covers.length ? ' ' + s.covers.join(', ') : '' })
4054
+ : T('Vi\u1EBFt c\xE1c t\xECnh hu\u1ED1ng ki\u1EC3m th\u1EED cho k\u1ECBch b\u1EA3n {c} \xAB{t}\xBB theo t\xE0i li\u1EC7u BA{v}.', { c: s.code, t: s.title, v: s.covers.length ? ' ' + s.covers.join(', ') : '' })) }));
4055
+ if (n) q.push(x.btn(T('R\xE0 so\xE1t'), { kind: 'ghost', small: true, testid: 'ai-q-review', onClick: () => ask(T('R\xE0 so\xE1t k\u1ECBch b\u1EA3n {c} \xAB{t}\xBB: b\u01B0\u1EDBc m\u01A1 h\u1ED3, k\u1EBFt qu\u1EA3 mong \u0111\u1EE3i kh\xF4ng ki\u1EC3m \u0111\u01B0\u1EE3c, tr\xF9ng l\u1EB7p \u2014 s\u1EEDa b\u1EB1ng l\u1EC7nh v\xE0 b\xE1o l\u1EA1i.', { c: s.code, t: s.title })) }));
4056
+ }
4057
+ if (m && D.ba && D.ba.linked) q.push(x.btn(T('K\u1ECBch b\u1EA3n c\xF2n thi\u1EBFu'), { kind: 'ghost', small: true, testid: 'ai-q-missing', onClick: () => ask(T('\u0110\u1ED1i chi\u1EBFu t\xE0i li\u1EC7u BA: ch\u1EE9c n\u0103ng n\xE0o c\u1EE7a ph\xE2n h\u1EC7 {m} ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n? T\u1EA1o k\u1ECBch b\u1EA3n + t\xECnh hu\u1ED1ng cho c\xE1c ch\u1EE9c n\u0103ng \u0111\xF3.', { m: m.code })) }));
4058
+ q.push(x.btn(T('S\u1EEDa l\u1ED7i ki\u1EC3m tra'), { kind: 'ghost', small: true, testid: 'ai-q-check', onClick: () => ask(T('Ch\u1EA1y pan test check r\u1ED3i s\u1EEDa c\xE1c l\u1ED7i / c\u1EA3nh b\xE1o.')) }));
4059
+ quickEl.replaceChildren(...q);
4060
+ }
4061
+
3986
4062
  // ---------------------------------------------------------------- panel ph\u1EA3i: thu\u1ED9c t\xEDnh k\u1ECBch b\u1EA3n
3987
4063
  function renderRight() {
3988
- const el = UI.rightTabs && UI.rightTabs.panels['thuoc-tinh']; if (!el) return;
4064
+ const el = UI.rightTabs && UI.rightTabs.panels['properties']; if (!el) return;
3989
4065
  el.replaceChildren();
3990
4066
  const s = ST.sel && suiteBy(ST.sel);
3991
4067
  if (!s) { el.appendChild(h('p', { class: 'pb-muted' }, T('Ch\u1ECDn m\u1ED9t k\u1ECBch b\u1EA3n \u0111\u1EC3 xem v\xE0 s\u1EEDa thu\u1ED9c t\xEDnh.'))); return; }
3992
4068
  const c = countOf(liveCases(s));
3993
- const title = h('input', { class: 'pb-input', 'data-testid': 'tt-ten', value: s.title });
3994
- const kind = h('select', { class: 'pb-select', 'data-testid': 'tt-loai' }, Object.keys(KIND).map((k) => h('option', { value: k, selected: k === s.kind || null }, KIND[k])));
3995
- const pr = h('select', { class: 'pb-select', 'data-testid': 'tt-uu-tien' }, h('option', { value: '' }, '\u2014'), Object.keys(PRIORITY).map((k) => h('option', { value: k, selected: k === s.priority || null }, PRIORITY[k])));
3996
- const uc = h('input', { class: 'pb-input', 'data-testid': 'tt-uc', value: s.useCases.join(', '), placeholder: 'UC_F_3, \u2026' });
3997
- const pre = h('textarea', { class: 'pb-textarea', rows: '3', 'data-testid': 'tt-tien-quyet' }); pre.value = s.preconditions || '';
3998
- const desc = h('textarea', { class: 'pb-textarea', rows: '3', 'data-testid': 'tt-mo-ta' }); desc.value = s.description || '';
4069
+ const title = h('input', { class: 'pb-input', 'data-testid': 'prop-title', value: s.title });
4070
+ const kind = h('select', { class: 'pb-select', 'data-testid': 'prop-kind' }, Object.keys(KIND).map((k) => h('option', { value: k, selected: k === s.kind || null }, KIND[k])));
4071
+ const pr = h('select', { class: 'pb-select', 'data-testid': 'prop-priority' }, h('option', { value: '' }, '\u2014'), Object.keys(PRIORITY).map((k) => h('option', { value: k, selected: k === s.priority || null }, PRIORITY[k])));
4072
+ const uc = h('input', { class: 'pb-input', 'data-testid': 'prop-use-cases', value: s.useCases.join(', '), placeholder: 'UC_F_3, \u2026' });
4073
+ const pre = h('textarea', { class: 'pb-textarea', rows: '3', 'data-testid': 'prop-preconditions' }); pre.value = s.preconditions || '';
4074
+ const desc = h('textarea', { class: 'pb-textarea', rows: '3', 'data-testid': 'prop-description' }); desc.value = s.description || '';
3999
4075
  const covers = coversPicker(s.covers);
4000
- const save = h('button', { type: 'button', class: 'pb-btn pb-btn--primary', 'data-testid': 'tt-luu' }, T('L\u01B0u thu\u1ED9c t\xEDnh'));
4076
+ const save = h('button', { type: 'button', class: 'pb-btn pb-btn--primary', 'data-testid': 'prop-save' }, T('L\u01B0u thu\u1ED9c t\xEDnh'));
4001
4077
  save.addEventListener('click', () => void saveSuite(s.code, {
4002
4078
  title: title.value, kind: kind.value, priority: pr.value, useCases: uc.value.split(',').map((x) => x.trim()).filter(Boolean),
4003
4079
  preconditions: pre.value, description: desc.value, covers: covers.get(),
@@ -4008,7 +4084,7 @@ function renderRight() {
4008
4084
  h('div', null, h('span', { class: 'pb-code' }, s.code), h('div', { class: 'pb-h3', style: { marginTop: '4px' } }, s.title)),
4009
4085
  h('dl', { class: 'pb-dl' },
4010
4086
  h('dt', null, T('S\u1ED1 m\u1EE5c')), h('dd', null, suiteNum(s)),
4011
- h('dt', null, T('T\xECnh hu\u1ED1ng')), h('dd', { 'data-testid': 'tt-tong' }, T('{t} \xB7 \u0111\u1EA1t {p} \xB7 kh\xF4ng \u0111\u1EA1t {f} \xB7 ch\u01B0a test {n}', { t: c.total, p: c.passed, f: c.failed, n: c['not-run'] })),
4087
+ h('dt', null, T('T\xECnh hu\u1ED1ng')), h('dd', { 'data-testid': 'prop-total' }, T('{t} \xB7 \u0111\u1EA1t {p} \xB7 kh\xF4ng \u0111\u1EA1t {f} \xB7 ch\u01B0a test {n}', { t: c.total, p: c.passed, f: c.failed, n: c['not-run'] })),
4012
4088
  h('dt', null, T('Ng\u01B0\u1EDDi t\u1EA1o')), h('dd', null, (s.created && s.created.by) || s.owner || '\u2014'),
4013
4089
  h('dt', null, T('T\u1EC7p')), h('dd', { class: 'pb-small' }, s.file)),
4014
4090
  field(T('T\xEAn k\u1ECBch b\u1EA3n'), title), field(T('Lo\u1EA1i'), kind), field(T('\u01AFu ti\xEAn'), pr),
@@ -4016,12 +4092,119 @@ function renderRight() {
4016
4092
  field('Use case', uc), field(T('\u0110i\u1EC1u ki\u1EC7n ti\xEAn quy\u1EBFt'), pre), field(T('M\xF4 t\u1EA3 / ghi ch\xFA'), desc), save));
4017
4093
  }
4018
4094
 
4095
+ // ---------------------------------------------------------------- Ch\u1EA1y test: \u0111i l\u1EA7n l\u01B0\u1EE3t t\u1EEBng t\xECnh hu\u1ED1ng nh\u01B0 checklist
4096
+ const RUN = { scope: 'mod', status: 'not-run', i: 0 };
4097
+ function runList() {
4098
+ const suites = RUN.scope === 'mod' ? modSuites(ST.mod) : D.modules.flatMap((m) => modSuites(m.code));
4099
+ const out = [];
4100
+ for (const s of suites) for (const c of liveCases(s)) if (RUN.status === 'all' || statusOf(c) === RUN.status) out.push({ s, c });
4101
+ return out;
4102
+ }
4103
+ function renderRun(el) {
4104
+ el.replaceChildren();
4105
+ const list = runList();
4106
+ if (RUN.i >= list.length) RUN.i = Math.max(0, list.length - 1);
4107
+ const sel = (testid, value, opts, on) => { const x = h('select', { class: 'pb-select', 'data-testid': testid }, opts.map(([v, l]) => h('option', { value: v, selected: v === value || null }, l))); x.addEventListener('change', () => { on(x.value); RUN.i = 0; renderRun(el); }); return h('span', { class: 'ptx-filterbox' }, x); };
4108
+ const allCases = (RUN.scope === 'mod' ? modSuites(ST.mod) : D.suites.filter((s) => s.status !== 'deleted')).flatMap(liveCases);
4109
+ const done = allCases.filter((c) => statusOf(c) !== 'not-run').length;
4110
+ el.appendChild(h('div', { class: 'pbx-bar' },
4111
+ h('div', { class: 'pbx-bar', style: { justifyContent: 'flex-start', marginBottom: '0' } },
4112
+ sel('run-scope', RUN.scope, [['mod', T('Ph\xE2n h\u1EC7 \u0111ang ch\u1ECDn')], ['all', T('M\u1ECDi ph\xE2n h\u1EC7')]], (v) => { RUN.scope = v; }),
4113
+ sel('run-filter', RUN.status, [['not-run', T('Ch\u01B0a test')], ['failed', T('Kh\xF4ng \u0111\u1EA1t')], ['blocked', T('B\u1ECB ch\u1EB7n')], ['all', T('M\u1ECDi t\xECnh hu\u1ED1ng')]], (v) => { RUN.status = v; })),
4114
+ h('span', { class: 'pb-small pb-muted', 'data-testid': 'run-progress' }, T('\u0110\xE3 test {d}/{t}', { d: done, t: allCases.length }))));
4115
+ if (!list.length) { el.appendChild(h('div', { class: 'pb-empty', 'data-testid': 'run-empty' }, h('div', { class: 'pb-empty__title' }, T('Kh\xF4ng c\xF2n t\xECnh hu\u1ED1ng n\xE0o \u1EDF \u0111\xE2y.')), h('p', { class: 'pb-muted' }, T('\u0110\u1ED5i b\u1ED9 l\u1ECDc \u0111\u1EC3 xem l\u1EA1i c\xE1c t\xECnh hu\u1ED1ng kh\xE1c.')))); return; }
4116
+ const { s, c } = list[RUN.i];
4117
+ const block = (label, text, testid) => h('div', { class: 'ptx-run__block' }, h('div', { class: 'pb-label' }, label), h('div', { class: 'ptx-run__text', 'data-testid': testid }, text || '\u2014'));
4118
+ const actual = h('textarea', { class: 'pb-textarea', rows: '3', 'data-testid': 'run-actual', placeholder: T('K\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF (b\u1EAFt bu\u1ED9c khi Kh\xF4ng \u0111\u1EA1t)') });
4119
+ actual.value = (c.result && c.result.actual) || '';
4120
+ const err = h('p', { class: 'pb-small', style: { color: 'var(--pb-broken)' }, 'data-testid': 'run-error' });
4121
+ const record = async (status) => {
4122
+ if (status === 'failed' && !actual.value.trim()) { err.textContent = T('Kh\xF4ng \u0111\u1EA1t: c\u1EA7n ghi k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF.'); actual.focus(); return; }
4123
+ const r = await write('api/result', { code: c.code, status, ...(status === 'failed' || status === 'blocked' ? { actual: actual.value } : {}) });
4124
+ if (!r) return;
4125
+ patchCaseQuiet(c, r);
4126
+ // l\u1ECDc \xABCh\u01B0a test\xBB: t\xECnh hu\u1ED1ng v\u1EEBa ghi r\u1EDDi danh s\xE1ch \u21D2 gi\u1EEF nguy\xEAn ch\u1EC9 s\u1ED1 (sang t\xECnh hu\u1ED1ng k\u1EBF); l\u1ECDc kh\xE1c \u21D2 ti\u1EBFn m\u1ED9t
4127
+ if (RUN.status === 'all' || RUN.status === status) RUN.i += 1;
4128
+ renderRun(el);
4129
+ };
4130
+ const btn = (status, key) => { const b = h('button', { type: 'button', class: 'pb-btn ptx-run__btn', 'data-status': status, 'data-testid': 'run-' + status }, statusBadge(status), h('kbd', { class: 'pb-kbd' }, key)); b.addEventListener('click', () => void record(status)); return b; };
4131
+ const nav = (label, d, testid) => { const b = h('button', { type: 'button', class: 'pb-btn pb-btn--ghost', 'data-testid': testid, disabled: (d < 0 ? RUN.i === 0 : RUN.i >= list.length - 1) || null }, label); b.addEventListener('click', () => { RUN.i += d; renderRun(el); }); return b; };
4132
+ const card = h('section', { class: 'pb-card ptx-run', 'data-testid': 'run-card', tabindex: '0' },
4133
+ h('div', { class: 'ptx-run__head' },
4134
+ h('span', { class: 'pb-small pb-muted' }, (RUN.i + 1) + ' / ' + list.length + ' \xB7 ' + suiteNum(s) + ' ' + s.title),
4135
+ h('span', { class: 'pb-code' }, c.code), statusBadge(statusOf(c))),
4136
+ h('h3', { class: 'ptx-run__title', 'data-testid': 'run-case' }, s.kind === 'non-functional' ? (c.requirement || c.case) : c.case),
4137
+ s.preconditions ? block(T('\u0110i\u1EC1u ki\u1EC7n ti\xEAn quy\u1EBFt'), s.preconditions) : null,
4138
+ block(s.kind === 'non-functional' ? T('K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED') : T('C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n'), c.steps, 'run-steps'),
4139
+ block(T('K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i'), c.expected, 'run-expected'),
4140
+ actual, err,
4141
+ h('div', { class: 'ptx-run__actions' }, btn('passed', '1'), btn('failed', '2'), btn('blocked', '3'), btn('skipped', '4')),
4142
+ h('div', { class: 'pbx-bar', style: { marginTop: '8px', marginBottom: '0' } }, nav('\u2190 ' + T('Tr\u01B0\u1EDBc'), -1, 'run-prev'), nav(T('Sau') + ' \u2192', 1, 'run-next')));
4143
+ // ph\xEDm t\u1EAFt 1\u20134 khi con tr\u1ECF kh\xF4ng \u1EDF trong \xF4 ch\u1EEF
4144
+ card.addEventListener('keydown', (e) => {
4145
+ if (e.target.closest('textarea,input,select')) return;
4146
+ const k = { 1: 'passed', 2: 'failed', 3: 'blocked', 4: 'skipped' }[e.key];
4147
+ if (k) { e.preventDefault(); void record(k); }
4148
+ if (e.key === 'ArrowRight' && RUN.i < list.length - 1) { RUN.i += 1; renderRun(el); }
4149
+ if (e.key === 'ArrowLeft' && RUN.i > 0) { RUN.i -= 1; renderRun(el); }
4150
+ });
4151
+ el.appendChild(card);
4152
+ requestAnimationFrame(() => { if (!el.contains(document.activeElement)) card.focus({ preventScroll: true }); });
4153
+ }
4154
+ /** C\u1EADp nh\u1EADt d\u1EEF li\u1EC7u m\u1ED9t t\xECnh hu\u1ED1ng m\xE0 kh\xF4ng v\u1EBD l\u1EA1i l\u0103ng k\xEDnh T\xE0i li\u1EC7u (\u0111ang \u1EDF Ch\u1EA1y test); c\xE2y tr\xE1i v\u1EABn c\u1EADp nh\u1EADt s\u1ED1. */
4155
+ function patchCaseQuiet(c, fresh) {
4156
+ Object.keys(c).forEach((k) => { delete c[k]; });
4157
+ Object.assign(c, fresh);
4158
+ const s = D.suites.find((x) => x.cases.includes(c));
4159
+ if (!s) return;
4160
+ const cnt = UI.left.querySelector('[data-testid="tree-count-' + CSS.escape(s.code) + '"]');
4161
+ if (cnt) { const n = countOf(liveCases(s)); cnt.textContent = ' ' + n.passed + '/' + n.total; }
4162
+ }
4163
+
4164
+ // ---------------------------------------------------------------- Nh\u1EADp: .feature (pan-test) v\xE0 k\u1EBFt qu\u1EA3 ch\u1EA1y t\u1EF1 \u0111\u1ED9ng
4165
+ function pickFiles(accept, multiple) {
4166
+ return new Promise((resolve) => {
4167
+ const input = h('input', { type: 'file', accept, multiple: multiple || null, style: { display: 'none' }, 'data-testid': 'import-file' });
4168
+ input.addEventListener('change', async () => {
4169
+ const files = await Promise.all(Array.from(input.files || []).map(async (f) => ({ name: f.name, content: await f.text() })));
4170
+ input.remove(); resolve(files);
4171
+ });
4172
+ document.body.appendChild(input); input.click();
4173
+ });
4174
+ }
4175
+ function importMenu(anchor) {
4176
+ P.menu(anchor || document.querySelector('[data-testid="import"]'), [
4177
+ { label: T('K\u1ECBch b\u1EA3n .feature (pan-test)\u2026'), icon: 'file-text', testid: 'import-feature', run: () => void importFeatures() },
4178
+ { label: T('K\u1EBFt qu\u1EA3 ch\u1EA1y t\u1EF1 \u0111\u1ED9ng (results.json)\u2026'), icon: 'check', testid: 'import-results', run: () => void importResults() },
4179
+ ], { placement: 'bottom-end', testid: 'import-menu' });
4180
+ }
4181
+ async function importFeatures() {
4182
+ if (!ST.mod) { newModuleDialog(); return; }
4183
+ const files = await pickFiles('.feature', true);
4184
+ if (!files.length) return;
4185
+ const r = await write('api/import/feature', { module: ST.mod, files });
4186
+ if (!r) return;
4187
+ await reload();
4188
+ const add = r.reports.reduce((n, x) => n + x.added.length, 0); const upd = r.reports.reduce((n, x) => n + x.updated.length, 0);
4189
+ const miss = r.reports.reduce((n, x) => n + x.missing.length, 0);
4190
+ P.toast(T('\u0110\xE3 nh\u1EADp {f} t\u1EC7p: th\xEAm {a}, c\u1EADp nh\u1EADt {u} t\xECnh hu\u1ED1ng.', { f: r.reports.length, a: add, u: upd }) + (miss ? ' ' + T('{m} t\xECnh hu\u1ED1ng kh\xF4ng c\xF2n trong t\u1EC7p \u2014 gi\u1EEF nguy\xEAn, xem l\u1EA1i.', { m: miss }) : ''), { kind: 'success' });
4191
+ }
4192
+ async function importResults() {
4193
+ const files = await pickFiles('.json,application/json', false);
4194
+ if (!files.length) return;
4195
+ const r = await write('api/results', { content: files[0].content });
4196
+ if (!r) return;
4197
+ await reload();
4198
+ const n = (st) => r.applied.filter((x) => x.status === st).length;
4199
+ P.toast(T('Ghi k\u1EBFt qu\u1EA3 {t} t\xECnh hu\u1ED1ng: \u0111\u1EA1t {p}, kh\xF4ng \u0111\u1EA1t {f}.', { t: r.applied.length, p: n('passed'), f: n('failed') }) + (r.unknownTags.length ? ' ' + T('{n} tag ch\u01B0a c\xF3 trong t\xE0i li\u1EC7u.', { n: r.unknownTags.length }) : ''), { kind: r.applied.length ? 'success' : 'warn' });
4200
+ }
4201
+
4019
4202
  // ---------------------------------------------------------------- Xem nh\u01B0 Word + Xu\u1EA5t
4020
4203
  let readResults = false;
4021
4204
  function renderRead(el) {
4022
4205
  const src = () => 'view/doc' + (readResults ? '?results=1' : '');
4023
4206
  const frame = h('iframe', { class: 'ptx-word', src: src(), title: T('Xem nh\u01B0 Word'), 'data-testid': 'word-frame' });
4024
- const toggle = h('label', { class: 'ptx-check' }, h('input', { type: 'checkbox', 'data-testid': 'word-ket-qua', checked: readResults || null }), ' ' + T('K\xE8m k\u1EBFt qu\u1EA3 test'));
4207
+ const toggle = h('label', { class: 'ptx-check' }, h('input', { type: 'checkbox', 'data-testid': 'word-results', checked: readResults || null }), ' ' + T('K\xE8m k\u1EBFt qu\u1EA3 test'));
4025
4208
  toggle.querySelector('input').addEventListener('change', (e) => { readResults = e.target.checked; frame.src = src(); });
4026
4209
  const full = h('a', { class: 'pb-btn pb-btn--secondary', href: src(), target: '_blank', rel: 'noopener', 'data-testid': 'word-open' }, P.iconEl('external-link', { size: 16 }), ' ' + T('M\u1EDF to\xE0n trang'));
4027
4210
  el.append(h('div', { class: 'pbx-bar' }, toggle, full), frame);
@@ -4029,28 +4212,28 @@ function renderRead(el) {
4029
4212
 
4030
4213
  function exportDialog() {
4031
4214
  const cb = (testid, label, on) => { const i = h('input', { type: 'checkbox', 'data-testid': testid, checked: on || null }); return { i, el: h('label', { class: 'ptx-check' }, i, ' ' + label) }; };
4032
- const docx = cb('xuat-docx', 'Word (.docx)', true); const html = cb('xuat-html', 'HTML', false);
4215
+ const docx = cb('export-docx', 'Word (.docx)', true); const html = cb('export-html', 'HTML', false);
4033
4216
  const kind = h('div', { class: 'pb-stack', role: 'radiogroup' },
4034
- h('label', { class: 'ptx-check' }, h('input', { type: 'radio', name: 'xuat-kieu', value: 'ban-giao', checked: true, 'data-testid': 'xuat-ban-giao' }), ' ' + T('B\u1EA3n b\xE0n giao \u2014 \u0111\xFAng m\u1EABu: T\xECnh hu\u1ED1ng | C\xE1c b\u01B0\u1EDBc | K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i')),
4035
- h('label', { class: 'ptx-check' }, h('input', { type: 'radio', name: 'xuat-kieu', value: 'ket-qua', 'data-testid': 'xuat-ket-qua' }), ' ' + T('K\xE8m k\u1EBFt qu\u1EA3 test \u2014 th\xEAm c\u1ED9t K\u1EBFt qu\u1EA3, Ng\u01B0\u1EDDi test / ng\xE0y v\xE0 ph\u1EE5 l\u1EE5c t\u1ED5ng h\u1EE3p')));
4036
- const codes = cb('xuat-ma', T('Hi\u1EC7n m\xE3 t\xECnh hu\u1ED1ng (TC-\u2026)'), false);
4037
- const status = h('div', { 'data-testid': 'xuat-trang-thai', 'aria-live': 'polite' });
4217
+ h('label', { class: 'ptx-check' }, h('input', { type: 'radio', name: 'export-kind', value: 'handover', checked: true, 'data-testid': 'export-handover' }), ' ' + T('B\u1EA3n b\xE0n giao \u2014 \u0111\xFAng m\u1EABu: T\xECnh hu\u1ED1ng | C\xE1c b\u01B0\u1EDBc | K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i')),
4218
+ h('label', { class: 'ptx-check' }, h('input', { type: 'radio', name: 'export-kind', value: 'results', 'data-testid': 'export-results' }), ' ' + T('K\xE8m k\u1EBFt qu\u1EA3 test \u2014 th\xEAm c\u1ED9t K\u1EBFt qu\u1EA3, Ng\u01B0\u1EDDi test / ng\xE0y v\xE0 ph\u1EE5 l\u1EE5c t\u1ED5ng h\u1EE3p')));
4219
+ const codes = cb('export-codes', T('Hi\u1EC7n m\xE3 t\xECnh hu\u1ED1ng (TC-\u2026)'), false);
4220
+ const status = h('div', { 'data-testid': 'export-status', 'aria-live': 'polite' });
4038
4221
  P.dialog({
4039
- title: T('Xu\u1EA5t t\xE0i li\u1EC7u ki\u1EC3m th\u1EED'), size: 'md', testid: 'xuat-dialog',
4222
+ title: T('Xu\u1EA5t t\xE0i li\u1EC7u ki\u1EC3m th\u1EED'), size: 'md', testid: 'export-dialog',
4040
4223
  body: h('div', { class: 'pb-stack' }, h('div', { class: 'pb-label' }, T('Ki\u1EC3u t\xE0i li\u1EC7u')), kind,
4041
4224
  h('div', { class: 'pb-label' }, T('\u0110\u1ECBnh d\u1EA1ng')), h('div', { class: 'pbx-bar', style: { justifyContent: 'flex-start' } }, docx.el, html.el), codes.el, status),
4042
4225
  actions: [
4043
4226
  { label: T('\u0110\xF3ng'), kind: 'ghost' },
4044
- { label: T('Xu\u1EA5t'), kind: 'primary', testid: 'xuat-ok', onClick: () => {
4227
+ { label: T('Xu\u1EA5t'), kind: 'primary', testid: 'export-ok', onClick: () => {
4045
4228
  const formats = [docx.i.checked && 'docx', html.i.checked && 'html'].filter(Boolean);
4046
4229
  if (!formats.length) { status.textContent = T('Ch\u1ECDn \xEDt nh\u1EA5t m\u1ED9t \u0111\u1ECBnh d\u1EA1ng.'); return false; }
4047
- const results = kind.querySelector('input:checked').value === 'ket-qua';
4230
+ const results = kind.querySelector('input:checked').value === 'results';
4048
4231
  status.replaceChildren(h('p', { class: 'pb-muted' }, T('\u0110ang xu\u1EA5t\u2026')));
4049
4232
  void write('api/export', { formats, results, codes: codes.i.checked }).then((r) => {
4050
4233
  if (!r) { status.textContent = ''; return; }
4051
- const open = h('button', { type: 'button', class: 'pb-btn pb-btn--secondary', 'data-testid': 'xuat-mo-thu-muc' }, P.iconEl('folder', { size: 16 }), ' ' + T('M\u1EDF th\u01B0 m\u1EE5c'));
4234
+ const open = h('button', { type: 'button', class: 'pb-btn pb-btn--secondary', 'data-testid': 'export-open-folder' }, P.iconEl('folder', { size: 16 }), ' ' + T('M\u1EDF th\u01B0 m\u1EE5c'));
4052
4235
  open.addEventListener('click', () => void write('api/open', {}));
4053
- status.replaceChildren(h('p', null, T('\u0110\xE3 xu\u1EA5t:')), h('ul', { 'data-testid': 'xuat-tep' }, r.files.map((f) => h('li', { class: 'pb-small' }, f))), open);
4236
+ status.replaceChildren(h('p', null, T('\u0110\xE3 xu\u1EA5t:')), h('ul', { 'data-testid': 'export-files' }, r.files.map((f) => h('li', { class: 'pb-small' }, f))), open);
4054
4237
  });
4055
4238
  return false;
4056
4239
  } },
@@ -4072,14 +4255,14 @@ function renderSummary(el) {
4072
4255
  const all = countOf(D.suites.filter((s) => s.status !== 'deleted').flatMap(liveCases));
4073
4256
  const pct = (c) => (c.total ? Math.round(100 * (c.passed) / c.total) : 0) + '%';
4074
4257
  el.appendChild(h('h2', { class: 'pbx-ch' }, T('T\u1ED5ng h\u1EE3p k\u1EBFt qu\u1EA3 ki\u1EC3m th\u1EED')));
4075
- el.appendChild(h('div', { class: 'ptx-kpis', 'data-testid': 'tong-hop-kpi' },
4258
+ el.appendChild(h('div', { class: 'ptx-kpis', 'data-testid': 'summary-kpi' },
4076
4259
  [['total', T('T\xECnh hu\u1ED1ng')], ['passed', T('\u0110\u1EA1t')], ['failed', T('Kh\xF4ng \u0111\u1EA1t')], ['blocked', T('B\u1ECB ch\u1EB7n')], ['not-run', T('Ch\u01B0a test')]].map(([k, label]) =>
4077
4260
  h('div', { class: 'pb-card ptx-kpi', 'data-testid': 'kpi-' + k }, h('div', { class: 'ptx-kpi__n' }, String(all[k])), h('div', { class: 'pb-small pb-muted' }, label)))));
4078
- if (D.summary.coverage) el.appendChild(h('p', { 'data-testid': 'do-phu' }, T('\u0110\u1ED9 ph\u1EE7 ch\u1EE9c n\u0103ng t\xE0i li\u1EC7u BA: {c}/{f} ch\u1EE9c n\u0103ng c\xF3 k\u1ECBch b\u1EA3n.', { c: D.summary.coverage.covered, f: D.summary.coverage.functions })));
4079
- el.appendChild(h('div', { class: 'pb-grid-wrap' }, h('table', { class: 'pb-grid ptx-sum', 'data-testid': 'bang-tong-hop' },
4261
+ if (D.summary.coverage) el.appendChild(h('p', { 'data-testid': 'coverage' }, T('\u0110\u1ED9 ph\u1EE7 ch\u1EE9c n\u0103ng t\xE0i li\u1EC7u BA: {c}/{f} ch\u1EE9c n\u0103ng c\xF3 k\u1ECBch b\u1EA3n.', { c: D.summary.coverage.covered, f: D.summary.coverage.functions })));
4262
+ el.appendChild(h('div', { class: 'pb-grid-wrap' }, h('table', { class: 'pb-grid ptx-sum', 'data-testid': 'summary-table' },
4080
4263
  h('thead', null, h('tr', null, [T('Ph\xE2n h\u1EC7'), T('K\u1ECBch b\u1EA3n'), T('T\xECnh hu\u1ED1ng'), T('\u0110\u1EA1t'), T('Kh\xF4ng \u0111\u1EA1t'), T('B\u1ECB ch\u1EB7n'), T('B\u1ECF qua'), T('Ch\u01B0a test'), T('T\u1EF7 l\u1EC7 \u0111\u1EA1t')].map((x) => h('th', null, x)))),
4081
- h('tbody', null, rows.map(({ m, suites, c }) => h('tr', { 'data-testid': 'th-row-' + m.code },
4082
- h('td', null, h('a', { href: '#', onclick: (e) => { e.preventDefault(); ST.mod = m.code; P.module(m.code); lensTabs.select('tai-lieu'); } }, modIndex(m.code) + '. ' + m.title)),
4264
+ h('tbody', null, rows.map(({ m, suites, c }) => h('tr', { 'data-testid': 'summary-row-' + m.code },
4265
+ h('td', null, h('a', { href: '#', onclick: (e) => { e.preventDefault(); ST.mod = m.code; P.module(m.code); lensTabs.select('document'); } }, modIndex(m.code) + '. ' + m.title)),
4083
4266
  h('td', null, String(suites)), h('td', null, String(c.total)), h('td', null, String(c.passed)), h('td', null, String(c.failed)), h('td', null, String(c.blocked)), h('td', null, String(c.skipped)), h('td', null, String(c['not-run'])),
4084
4267
  h('td', { class: 'ptx-rate' }, pct(c), bar(c))))),
4085
4268
  h('tfoot', null, h('tr', null, h('th', null, T('T\u1ED5ng')), h('th', null, String(D.suites.filter((s) => s.status !== 'deleted').length)), h('th', null, String(all.total)), h('th', null, String(all.passed)), h('th', null, String(all.failed)), h('th', null, String(all.blocked)), h('th', null, String(all.skipped)), h('th', null, String(all['not-run'])), h('th', { class: 'ptx-rate' }, pct(all), bar(all)))))));
@@ -4091,10 +4274,10 @@ async function renderCheck(el) {
4091
4274
  const r = await api('api/check');
4092
4275
  if (!r.ok) { el.appendChild(h('p', { class: 'pb-muted' }, r.json.error || T('Kh\xF4ng ki\u1EC3m \u0111\u01B0\u1EE3c'))); return; }
4093
4276
  const list = r.json.findings || [];
4094
- if (!D.ba.linked) el.appendChild(h('p', { class: 'pb-small pb-muted', 'data-testid': 'chua-lien-ket-ba' }, D.ba.path ? T('Kh\xF4ng th\u1EA5y repo BA \xAB{p}\xBB \u2014 b\u1ECF qua ki\u1EC3m tham chi\u1EBFu v\xE0 \u0111\u1ED9 ph\u1EE7.', { p: D.ba.path }) : T('Ch\u01B0a li\xEAn k\u1EBFt repo t\xE0i li\u1EC7u BA (kho\xE1 \xABba\xBB trong .pantest.yaml) \u2014 ch\u01B0a ki\u1EC3m \u0111\u01B0\u1EE3c \u0111\u1ED9 ph\u1EE7 ch\u1EE9c n\u0103ng.')));
4095
- if (!list.length) { el.appendChild(h('div', { class: 'pb-empty', 'data-testid': 'kiem-tra-sach' }, h('div', { class: 'pb-empty__title' }, T('Kh\xF4ng c\xF3 l\u1ED7i hay c\u1EA3nh b\xE1o.')))); return; }
4277
+ if (!D.ba.linked) el.appendChild(h('p', { class: 'pb-small pb-muted', 'data-testid': 'ba-not-linked' }, D.ba.path ? T('Kh\xF4ng th\u1EA5y repo BA \xAB{p}\xBB \u2014 b\u1ECF qua ki\u1EC3m tham chi\u1EBFu v\xE0 \u0111\u1ED9 ph\u1EE7.', { p: D.ba.path }) : T('Ch\u01B0a li\xEAn k\u1EBFt repo t\xE0i li\u1EC7u BA (kho\xE1 \xABba\xBB trong .pantest.yaml) \u2014 ch\u01B0a ki\u1EC3m \u0111\u01B0\u1EE3c \u0111\u1ED9 ph\u1EE7 ch\u1EE9c n\u0103ng.')));
4278
+ if (!list.length) { el.appendChild(h('div', { class: 'pb-empty', 'data-testid': 'check-clean' }, h('div', { class: 'pb-empty__title' }, T('Kh\xF4ng c\xF3 l\u1ED7i hay c\u1EA3nh b\xE1o.')))); return; }
4096
4279
  const tone = { error: 'error', warn: 'warn', info: 'info' };
4097
- el.appendChild(h('ul', { class: 'ptx-findings', 'data-testid': 'kiem-tra-ds' }, list.map((f) => {
4280
+ el.appendChild(h('ul', { class: 'ptx-findings', 'data-testid': 'check-list' }, list.map((f) => {
4098
4281
  const go = f.code && (suiteBy(f.code) || D.suites.some((s) => s.cases.some((c) => c.code === f.code)));
4099
4282
  return h('li', { 'data-rule': f.rule }, h('span', { class: 'pb-badge', 'data-tone': tone[f.severity] }, f.rule), ' ',
4100
4283
  go ? h('a', { href: '#' + f.code }, f.message) : f.message);
@@ -4102,6 +4285,48 @@ async function renderCheck(el) {
4102
4285
  }
4103
4286
 
4104
4287
  // ---------------------------------------------------------------- ti\u1EC7n \xEDch
4288
+ // ---------------------------------------------------------------- Pan Studio: ph\xE1t h\xE0nh (ghi \u0111\xE8) / g\u1EE1 \u2014 qua \`pan test publish\`
4289
+ function studioDialog() {
4290
+ const body = h('div', { class: 'pb-stack', 'data-testid': 'studio-body' }, h('p', { class: 'pb-muted' }, T('\u0110ang ki\u1EC3m tra Pan Studio\u2026')));
4291
+ const status = h('div', { 'aria-live': 'polite', 'data-testid': 'studio-status' });
4292
+ let st = null;
4293
+ const draw = () => {
4294
+ if (st.cli === false) { body.replaceChildren(h('p', { 'data-testid': 'studio-cli' }, st.error || T('C\u1EA7n Pan CLI \u0111\u1EC3 ph\xE1t h\xE0nh l\xEAn Pan Studio.'))); return; }
4295
+ if (!st.login) { body.replaceChildren(h('p', { 'data-testid': 'studio-login' }, T('M\xE1y n\xE0y ch\u01B0a \u0111\u0103ng nh\u1EADp Pan Studio. \u0110\u0103ng nh\u1EADp trong Pan Studio Desktop (g\xF3c ph\u1EA3i tr\xEAn) ho\u1EB7c ch\u1EA1y \xABpan login\xBB, r\u1ED3i m\u1EDF l\u1EA1i h\u1ED9p n\xE0y.'))); return; }
4296
+ const link = st.web ? h('a', { href: st.web, target: '_blank', rel: 'noopener', 'data-testid': 'studio-web' }, T('M\u1EDF tr\xEAn Pan Studio')) : null;
4297
+ body.replaceChildren(
4298
+ st.doc ? h('p', { 'data-testid': 'studio-doc' }, T('\u0110\xE3 ph\xE1t h\xE0nh: \xAB{t}\xBB \u2014 b\u1EA3n {r}.', { t: st.doc.title, r: st.doc.revision }), ' ', link)
4299
+ : h('p', { 'data-testid': 'studio-none' }, T('Ch\u01B0a ph\xE1t h\xE0nh l\xEAn Pan Studio. Ph\xE1t h\xE0nh xong, t\xE0i li\u1EC7u hi\u1EC7n \u1EDF workspace \xABT\xE0i li\u1EC7u ki\u1EC3m th\u1EED\xBB tr\xEAn web: th\xE0nh vi\xEAn d\u1EF1 \xE1n xem, b\xECnh lu\u1EADn theo t\u1EEBng k\u1ECBch b\u1EA3n.')),
4300
+ st.project ? null : h('p', { class: 'pb-small pb-muted' }, T('Ch\u01B0a g\u1EAFn d\u1EF1 \xE1n Studio (repo t\xE0i li\u1EC7u BA li\xEAn k\u1EBFt ch\u01B0a khai d\u1EF1 \xE1n) \u2014 t\xE0i li\u1EC7u ch\u1EC9 b\u1EA1n v\xE0 ng\u01B0\u1EDDi \u0111\u01B0\u1EE3c m\u1EDDi th\u1EA5y.')),
4301
+ st.error ? h('p', { class: 'pb-small', style: { color: 'var(--pb-broken)' } }, st.error) : null,
4302
+ h('p', { class: 'pb-small pb-muted' }, T('Ph\xE1t h\xE0nh l\u1EA1i s\u1EBD GHI \u0110\xC8 b\u1EA3n tr\xEAn Studio b\u1EB1ng n\u1ED9i dung hi\u1EC7n t\u1EA1i c\u1EE7a repo (k\u1EC3 c\u1EA3 k\u1EBFt qu\u1EA3 test).')));
4303
+ };
4304
+ P.dialog({
4305
+ title: T('Pan Studio'), size: 'md', testid: 'studio-dialog', body: h('div', { class: 'pb-stack' }, body, status),
4306
+ actions: [
4307
+ { label: T('\u0110\xF3ng'), kind: 'ghost' },
4308
+ { label: T('G\u1EE1 kh\u1ECFi Studio'), kind: 'ghost', testid: 'studio-remove', onClick: () => {
4309
+ if (!st || !st.doc) return false;
4310
+ status.textContent = T('\u0110ang g\u1EE1\u2026');
4311
+ void write('api/studio/remove', {}).then(async (r) => { status.textContent = r ? T('\u0110\xE3 g\u1EE1 kh\u1ECFi Pan Studio.') : ''; await refresh(); });
4312
+ return false;
4313
+ } },
4314
+ { label: T('Ph\xE1t h\xE0nh'), kind: 'primary', testid: 'studio-publish', onClick: () => {
4315
+ if (!st || !st.login) return false;
4316
+ status.replaceChildren(h('p', { class: 'pb-muted' }, P.iconEl('loader', { size: 16 }), ' ' + T('\u0110ang ph\xE1t h\xE0nh\u2026')));
4317
+ void write('api/studio/publish', {}).then(async (r) => {
4318
+ if (!r) { status.textContent = ''; return; }
4319
+ status.replaceChildren(h('p', { 'data-testid': 'studio-done' }, T('\u0110\xE3 ph\xE1t h\xE0nh b\u1EA3n {r} ({n} b\xE0i, t\u1EA3i l\xEAn {u} t\u1EC7p).', { r: r.revision, n: r.lessons, u: r.uploaded }), ' ', h('a', { href: r.web, target: '_blank', rel: 'noopener' }, T('M\u1EDF tr\xEAn Pan Studio'))));
4320
+ await refresh();
4321
+ });
4322
+ return false;
4323
+ } },
4324
+ ],
4325
+ });
4326
+ const refresh = async () => { const r = await api('api/studio'); st = r.json || { login: false }; draw(); };
4327
+ void refresh();
4328
+ }
4329
+
4105
4330
  async function copyText(text, done) {
4106
4331
  try { await navigator.clipboard.writeText(text); P.toast(done, { kind: 'success' }); return; } catch { /* th\u1EED c\xE1ch c\u0169 */ }
4107
4332
  const ta = h('textarea', { style: { position: 'fixed', top: '0', left: '0', opacity: '0' } }); ta.value = text;
@@ -4114,171 +4339,1002 @@ async function copyText(text, done) {
4114
4339
  boot().catch((e) => {
4115
4340
  document.body.replaceChildren(h('div', { class: 'pb-empty', style: { padding: '40px' } }, h('div', { class: 'pb-empty__title' }, T('Kh\xF4ng m\u1EDF \u0111\u01B0\u1EE3c t\xE0i li\u1EC7u ki\u1EC3m th\u1EED')), h('p', null, String(e.message || e))));
4116
4341
  });
4117
- `}});var yt,kc,Tc,rn,Ur=ze(()=>{"use strict";E();yt=["not-run","passed","failed","blocked","skipped"],kc=["functional","non-functional"],Tc=["drafting","done","deleted"],rn=["high","medium","low"]});function xg(){let e=globalThis.crypto;return e?.getRandomValues?e.getRandomValues(new Uint32Array(1))[0]/2**32:Math.random()}function Vs(e,t,n,r=xg){for(;;){let i="";for(let a=0;a<6;a++)i+=Sc[Math.floor(r()*Sc.length)];if(!/[A-Z]/.test(i))continue;let s=`${e}-${t}-${i}`;if(!n.has(s))return s}}var Sc,qr,Wr,jr,An=ze(()=>{"use strict";E();Sc="ABCDEFGHJKMNPQRSTUVWXYZ23456789",qr=/^[A-Z][A-Z0-9]{1,11}$/,Wr=/^KB-([A-Z][A-Z0-9]{1,11})-([A-Z0-9]{6})$/,jr=/^TC-([A-Z][A-Z0-9]{1,11})-([A-Z0-9]{6})$/});var q=B(ye=>{"use strict";E();var Xs=Symbol.for("yaml.alias"),Ec=Symbol.for("yaml.document"),Kr=Symbol.for("yaml.map"),Cc=Symbol.for("yaml.pair"),Ys=Symbol.for("yaml.scalar"),Gr=Symbol.for("yaml.seq"),st=Symbol.for("yaml.node.type"),kg=e=>!!e&&typeof e=="object"&&e[st]===Xs,Tg=e=>!!e&&typeof e=="object"&&e[st]===Ec,Sg=e=>!!e&&typeof e=="object"&&e[st]===Kr,Eg=e=>!!e&&typeof e=="object"&&e[st]===Cc,_c=e=>!!e&&typeof e=="object"&&e[st]===Ys,Cg=e=>!!e&&typeof e=="object"&&e[st]===Gr;function Ac(e){if(e&&typeof e=="object")switch(e[st]){case Kr:case Gr:return!0}return!1}function _g(e){if(e&&typeof e=="object")switch(e[st]){case Xs:case Kr:case Ys:case Gr:return!0}return!1}var Ag=e=>(_c(e)||Ac(e))&&!!e.anchor;ye.ALIAS=Xs;ye.DOC=Ec;ye.MAP=Kr;ye.NODE_TYPE=st;ye.PAIR=Cc;ye.SCALAR=Ys;ye.SEQ=Gr;ye.hasAnchor=Ag;ye.isAlias=kg;ye.isCollection=Ac;ye.isDocument=Tg;ye.isMap=Sg;ye.isNode=_g;ye.isPair=Eg;ye.isScalar=_c;ye.isSeq=Cg});var Nn=B(Js=>{"use strict";E();var ue=q(),_e=Symbol("break visit"),Nc=Symbol("skip children"),Ve=Symbol("remove node");function zr(e,t){let n=Ic(t);ue.isDocument(e)?sn(null,e.contents,n,Object.freeze([e]))===Ve&&(e.contents=null):sn(null,e,n,Object.freeze([]))}zr.BREAK=_e;zr.SKIP=Nc;zr.REMOVE=Ve;function sn(e,t,n,r){let i=Pc(e,t,n,r);if(ue.isNode(i)||ue.isPair(i))return Oc(e,r,i),sn(e,i,n,r);if(typeof i!="symbol"){if(ue.isCollection(t)){r=Object.freeze(r.concat(t));for(let s=0;s<t.items.length;++s){let a=sn(s,t.items[s],n,r);if(typeof a=="number")s=a-1;else{if(a===_e)return _e;a===Ve&&(t.items.splice(s,1),s-=1)}}}else if(ue.isPair(t)){r=Object.freeze(r.concat(t));let s=sn("key",t.key,n,r);if(s===_e)return _e;s===Ve&&(t.key=null);let a=sn("value",t.value,n,r);if(a===_e)return _e;a===Ve&&(t.value=null)}}return i}async function Vr(e,t){let n=Ic(t);ue.isDocument(e)?await an(null,e.contents,n,Object.freeze([e]))===Ve&&(e.contents=null):await an(null,e,n,Object.freeze([]))}Vr.BREAK=_e;Vr.SKIP=Nc;Vr.REMOVE=Ve;async function an(e,t,n,r){let i=await Pc(e,t,n,r);if(ue.isNode(i)||ue.isPair(i))return Oc(e,r,i),an(e,i,n,r);if(typeof i!="symbol"){if(ue.isCollection(t)){r=Object.freeze(r.concat(t));for(let s=0;s<t.items.length;++s){let a=await an(s,t.items[s],n,r);if(typeof a=="number")s=a-1;else{if(a===_e)return _e;a===Ve&&(t.items.splice(s,1),s-=1)}}}else if(ue.isPair(t)){r=Object.freeze(r.concat(t));let s=await an("key",t.key,n,r);if(s===_e)return _e;s===Ve&&(t.key=null);let a=await an("value",t.value,n,r);if(a===_e)return _e;a===Ve&&(t.value=null)}}return i}function Ic(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Pc(e,t,n,r){if(typeof n=="function")return n(e,t,r);if(ue.isMap(t))return n.Map?.(e,t,r);if(ue.isSeq(t))return n.Seq?.(e,t,r);if(ue.isPair(t))return n.Pair?.(e,t,r);if(ue.isScalar(t))return n.Scalar?.(e,t,r);if(ue.isAlias(t))return n.Alias?.(e,t,r)}function Oc(e,t,n){let r=t[t.length-1];if(ue.isCollection(r))r.items[e]=n;else if(ue.isPair(r))e==="key"?r.key=n:r.value=n;else if(ue.isDocument(r))r.contents=n;else{let i=ue.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}Js.visit=zr;Js.visitAsync=Vr});var Qs=B(Rc=>{"use strict";E();var Lc=q(),Ng=Nn(),Ig={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Pg=e=>e.replace(/[!,[\]{}]/g,t=>Ig[t]),In=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[s,a]=r;return this.tags[s]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let a=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,a),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let a=t.slice(2,-1);return a==="!"||a==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),a)}let[,r,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);let s=this.tags[r];if(s)try{return s+decodeURIComponent(i)}catch(a){return n(String(a)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+Pg(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(t&&r.length>0&&Lc.isNode(t.contents)){let s={};Ng.visit(t.contents,(a,o)=>{Lc.isNode(o)&&o.tag&&(s[o.tag]=!0)}),i=Object.keys(s)}else i=[];for(let[s,a]of r)s==="!!"&&a==="tag:yaml.org,2002:"||(!t||i.some(o=>o.startsWith(a)))&&n.push(`%TAG ${s} ${a}`);return n.join(`
4118
- `)}};In.defaultYaml={explicit:!1,version:"1.2"};In.defaultTags={"!!":"tag:yaml.org,2002:"};Rc.Directives=In});var Xr=B(Pn=>{"use strict";E();var Mc=q(),Og=Nn();function Lg(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function Dc(e){let t=new Set;return Og.visit(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function Bc(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function Rg(e,t){let n=[],r=new Map,i=null;return{onAnchor:s=>{n.push(s),i??(i=Dc(e));let a=Bc(t,i);return i.add(a),a},setAnchors:()=>{for(let s of n){let a=r.get(s);if(typeof a=="object"&&a.anchor&&(Mc.isScalar(a.node)||Mc.isCollection(a.node)))a.node.anchor=a.anchor;else{let o=new Error("Failed to resolve repeated object (this should not happen)");throw o.source=s,o}}},sourceObjects:r}}Pn.anchorIsValid=Lg;Pn.anchorNames=Dc;Pn.createNodeAnchors=Rg;Pn.findNewAnchor=Bc});var Zs=B($c=>{"use strict";E();function On(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,s=r.length;i<s;++i){let a=r[i],o=On(e,r,String(i),a);o===void 0?delete r[i]:o!==a&&(r[i]=o)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let s=r.get(i),a=On(e,r,i,s);a===void 0?r.delete(i):a!==s&&r.set(i,a)}else if(r instanceof Set)for(let i of Array.from(r)){let s=On(e,r,i,i);s===void 0?r.delete(i):s!==i&&(r.delete(i),r.add(s))}else for(let[i,s]of Object.entries(r)){let a=On(e,r,i,s);a===void 0?delete r[i]:a!==s&&(r[i]=a)}return e.call(t,n,r)}$c.applyReviver=On});var xt=B(Hc=>{"use strict";E();var Mg=q();function Fc(e,t,n){if(Array.isArray(e))return e.map((r,i)=>Fc(r,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!Mg.hasAnchor(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=s=>{r.res=s,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e=="bigint"&&!n?.keep?Number(e):e}Hc.toJS=Fc});var Yr=B(qc=>{"use strict";E();var Dg=Zs(),Uc=q(),Bg=xt(),ea=class{constructor(t){Object.defineProperty(this,Uc.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:s}={}){if(!Uc.isDocument(t))throw new TypeError("A document argument is required");let a={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},o=Bg.toJS(this,"",a);if(typeof i=="function")for(let{count:l,res:c}of a.anchors.values())i(c,l);return typeof s=="function"?Dg.applyReviver(s,{"":o},"",o):o}};qc.NodeBase=ea});var Ln=B(Wc=>{"use strict";E();var $g=Xr(),Fg=Nn(),on=q(),Hg=Yr(),Ug=xt(),ta=class extends Hg.NodeBase{constructor(t){super(on.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],Fg.visit(t,{Node:(s,a)=>{(on.isAlias(a)||on.hasAnchor(a))&&r.push(a)}}),n&&(n.aliasResolveCache=r));let i;for(let s of r){if(s===this)break;s.anchor===this.source&&(i=s)}return i}toJSON(t,n){if(!n)return{source:this.source};let{anchors:r,doc:i,maxAliasCount:s}=n,a=this.resolve(i,n);if(!a){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let o=r.get(a);if(o||(Ug.toJS(a,null,n),o=r.get(a)),o?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(s>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=Jr(i,a,r)),o.count*o.aliasCount>s)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return o.res}toString(t,n,r){let i=`*${this.source}`;if(t){if($g.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(t.implicitKey)return`${i} `}return i}};function Jr(e,t,n){if(on.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(on.isCollection(t)){let r=0;for(let i of t.items){let s=Jr(e,i,n);s>r&&(r=s)}return r}else if(on.isPair(t)){let r=Jr(e,t.key,n),i=Jr(e,t.value,n);return Math.max(r,i)}return 1}Wc.Alias=ta});var ce=B(na=>{"use strict";E();var qg=q(),Wg=Yr(),jg=xt(),Kg=e=>!e||typeof e!="function"&&typeof e!="object",kt=class extends Wg.NodeBase{constructor(t){super(qg.SCALAR),this.value=t}toJSON(t,n){return n?.keep?this.value:jg.toJS(this.value,t,n)}toString(){return String(this.value)}};kt.BLOCK_FOLDED="BLOCK_FOLDED";kt.BLOCK_LITERAL="BLOCK_LITERAL";kt.PLAIN="PLAIN";kt.QUOTE_DOUBLE="QUOTE_DOUBLE";kt.QUOTE_SINGLE="QUOTE_SINGLE";na.Scalar=kt;na.isScalarValue=Kg});var Rn=B(Kc=>{"use strict";E();var Gg=Ln(),Ft=q(),jc=ce(),zg="tag:yaml.org,2002:";function Vg(e,t,n){if(t){let r=n.filter(s=>s.tag===t),i=r.find(s=>!s.format)??r[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(r=>r.identify?.(e)&&!r.format)}function Xg(e,t,n){if(Ft.isDocument(e)&&(e=e.contents),Ft.isNode(e))return e;if(Ft.isPair(e)){let p=n.schema[Ft.MAP].createNode?.(n.schema,null,n);return p.items.push(e),p}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:s,schema:a,sourceObjects:o}=n,l;if(r&&e&&typeof e=="object"){if(l=o.get(e),l)return l.anchor??(l.anchor=i(e)),new Gg.Alias(l.anchor);l={anchor:null,node:null},o.set(e,l)}t?.startsWith("!!")&&(t=zg+t.slice(2));let c=Vg(e,t,a.tags);if(!c){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let p=new jc.Scalar(e);return l&&(l.node=p),p}c=e instanceof Map?a[Ft.MAP]:Symbol.iterator in Object(e)?a[Ft.SEQ]:a[Ft.MAP]}s&&(s(c),delete n.onTagObj);let d=c?.createNode?c.createNode(n.schema,e,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,e,n):new jc.Scalar(e);return t?d.tag=t:c.default||(d.tag=c.tag),l&&(l.node=d),d}Kc.createNode=Xg});var Zr=B(Qr=>{"use strict";E();var Yg=Rn(),Xe=q(),Jg=Yr();function ra(e,t,n){let r=n;for(let i=t.length-1;i>=0;--i){let s=t[i];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let a=[];a[s]=r,r=a}else r=new Map([[s,r]])}return Yg.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var Gc=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,ia=class extends Jg.NodeBase{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(r=>Xe.isNode(r)||Xe.isPair(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Gc(t))this.add(n);else{let[r,...i]=t,s=this.get(r,!0);if(Xe.isCollection(s))s.addIn(i,n);else if(s===void 0&&this.schema)this.set(r,ra(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(t){let[n,...r]=t;if(r.length===0)return this.delete(n);let i=this.get(n,!0);if(Xe.isCollection(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){let[r,...i]=t,s=this.get(r,!0);return i.length===0?!n&&Xe.isScalar(s)?s.value:s:Xe.isCollection(s)?s.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Xe.isPair(n))return!1;let r=n.value;return r==null||t&&Xe.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){let[n,...r]=t;if(r.length===0)return this.has(n);let i=this.get(n,!0);return Xe.isCollection(i)?i.hasIn(r):!1}setIn(t,n){let[r,...i]=t;if(i.length===0)this.set(r,n);else{let s=this.get(r,!0);if(Xe.isCollection(s))s.setIn(i,n);else if(s===void 0&&this.schema)this.set(r,ra(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};Qr.Collection=ia;Qr.collectionFromPath=ra;Qr.isEmptyPath=Gc});var Mn=B(ei=>{"use strict";E();var Qg=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function sa(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Zg=(e,t,n)=>e.endsWith(`
4119
- `)?sa(n,t):n.includes(`
4342
+ `,"assist.js":`// CH\xC9P NGUY\xCAN t\u1EEB Pan BA UI (@pan-stack/cli: tools/pan-ba/ui/assist.browser.js) \u0111\u1EC3 Tr\u1EE3 l\xFD AI c\u1EE7a Pan Test c\xF9ng UX v\u1EDBi Pan BA.
4343
+ // S\u1EEDa \u1EDF Pan BA r\u1ED3i ch\xE9p l\u1EA1i; \u0111\u1EEBng s\u1EEDa ri\xEAng \u1EDF \u0111\xE2y.
4344
+ // Pan BA UI \u2014 Tr\u1EE3 l\xFD AI + B\xECnh lu\u1EADn (07/11/2026). D\xF9ng chung cho \`pan ba ui\`, Pan Studio Desktop v\xE0 VS Code (c\xF9ng server).
4345
+ // \u2022 Tr\u1EE3 l\xFD AI: giao vi\u1EC7c BA cho CLI AI c\xF3 s\u1EB5n tr\xEAn m\xE1y (Claude Code / Codex / Cursor \u2014 t\xE0i kho\u1EA3n ng\u01B0\u1EDDi d\xF9ng, kh\xF4ng API key).
4346
+ // Vi\u1EC7c theo lu\u1ED3ng c\u1EE7a Pan BA (vi\u1EBFt \u0111\u1EB7c t\u1EA3, r\xE0 so\xE1t, s\u1EEDa l\u1ED7i ki\u1EC3m tra, m\u1EE5c ch\u1EDD, g\xF3p \xFD, b\xECnh lu\u1EADn, m\xE0n c\xF2n thi\u1EBFu) ho\u1EB7c nh\u1EAFn t\u1EF1
4347
+ // do; xem AI l\xE0m t\u1EEBng b\u01B0\u1EDBc; xong th\xEC xem thay \u0111\u1ED5i / Ho\xE0n t\xE1c / Gi\u1EEF. Nh\u1EAFn ti\u1EBFp l\xE0 c\xF9ng phi\xEAn (AI nh\u1EDB).
4348
+ // \u2022 B\xECnh lu\u1EADn: nh\u01B0 comment c\u1EE7a Word \u2014 ch\u1ECDn ch\u1EEF trong \xABXem nh\u01B0 Word\xBB \u2192 B\xECnh lu\u1EADn; tr\u1EA3 l\u1EDDi, \u0111\xF3ng lu\u1ED3ng; l\u01B0u trong repo;
4349
+ // \u0111\u1ED3ng b\u1ED9 v\u1EDBi ng\u01B0\u1EDDi xem tr\xEAn Pan Studio.
4350
+ import { api } from './edit.js';
4351
+
4352
+ const T = (s, o) => window.PanBAi18n.T(s, o);
4353
+ let C = null; // { P, h, D(), M(), ST, PRODUCT, reload(), select(code), rightTabs, panel }
4354
+ export function initAssist(ctx) { C = ctx; }
4355
+
4356
+ const anchorOf = (code) => 'R_' + String(code).replace(/[^A-Za-z0-9]/g, '_');
4357
+ function store(key, v) { try { if (v === undefined) return JSON.parse(localStorage.getItem(key) || 'null'); localStorage.setItem(key, JSON.stringify(v)); } catch { /* ch\u1EB7n localStorage */ } return null; }
4358
+ function btn(label, o) {
4359
+ const h = C.h; o = o || {};
4360
+ const b = h('button', { type: 'button', class: 'pb-btn pb-btn--' + (o.kind || 'secondary') + (o.icon && !label ? ' pb-btn--icon' : '') + (o.small ? ' pbx-btn-sm' : ''), title: o.title || null, 'aria-label': o.title || null, 'data-testid': o.testid || null, disabled: o.disabled || null },
4361
+ o.icon ? h('span', { html: C.P.icon(o.icon, { size: 16 }) }) : null, label || null);
4362
+ if (o.onClick) b.addEventListener('click', (e) => { e.stopPropagation(); o.onClick(e, b); });
4363
+ return b;
4364
+ }
4365
+ function failToast(r) { C.P.toast(r.json.error || T('Kh\xF4ng l\u01B0u \u0111\u01B0\u1EE3c ({s}).', { s: r.status }), { kind: 'error' }); }
4366
+ function openTab(id) {
4367
+ C.rightTabs.select(id);
4368
+ try { C.panel.toggle('right', true); } catch { /* khung kh\xF4ng c\xF3 panel ph\u1EA3i */ }
4369
+ }
4370
+
4371
+ // ================================================================ TR\u1EE2 L\xDD AI
4372
+ // Nhi\u1EC1u CU\u1ED8C tr\xF2 chuy\u1EC7n ch\u1EA1y SONG SONG (18/11/2026, c\xF9ng c\xE1ch v\u1EDBi Pan Studio Desktop): m\u1ED7i cu\u1ED9c m\u1ED9t tab, m\u1ED9t phi\xEAn CLI
4373
+ // (nh\u1EAFn ti\u1EBFp = resume), m\u1ED9t lu\u1ED3ng SSE; cu\u1ED9c \u0111ang ch\u1EA1y v\u1EABn ch\u1EA1y khi xem cu\u1ED9c kh\xE1c, xong th\xEC b\xE1o. G\u1EEDi khi cu\u1ED9c \u0111ang xem c\xF2n
4374
+ // ch\u1EA1y \u21D2 t\u1EF1 m\u1EDF cu\u1ED9c m\u1EDBi. Agent con (Claude tool Agent / Cursor task) hi\u1EC7n th\xE0nh th\u1EBB trong b\u1EA3n ghi; b\u1EA5m xem vi\u1EC7c \u0111\u01B0\u1EE3c giao,
4375
+ // c\xE1c b\u01B0\u1EDBc, k\u1EBFt qu\u1EA3. T\u1EA3i l\u1EA1i trang \u21D2 d\u1EF1ng l\u1EA1i tab cho c\xE1c l\u01B0\u1EE3t c\xF2n ch\u1EA1y (server gi\u1EEF l\u01B0\u1EE3t).
4376
+ const S = { engines: [], engine: '', model: '', effort: '', max: 4 };
4377
+ let el = null; // c\xE1c ph\u1EA7n t\u1EED c\u1EE7a panel
4378
+ let CONVS = [];
4379
+ let active = null;
4380
+ let seq = 0;
4381
+ const TOOL = { Read: '\u0110\u1ECDc', Edit: 'S\u1EEDa', MultiEdit: 'S\u1EEDa', Write: 'Ghi', Bash: 'Ch\u1EA1y', PowerShell: 'Ch\u1EA1y', Glob: 'T\xECm t\u1EC7p', Grep: 'T\xECm ch\u1EEF', TodoWrite: 'L\u1EADp vi\u1EC7c', edit: 'S\u1EEDa', read: '\u0110\u1ECDc', write: 'Ghi', shell: 'Ch\u1EA1y', glob: 'T\xECm t\u1EC7p', grep: 'T\xECm ch\u1EEF', ls: 'Xem th\u01B0 m\u1EE5c' };
4382
+ /** Bi\u1EC3u t\u01B0\u1EE3ng theo lo\u1EA1i c\xF4ng c\u1EE5 (Claude vi\u1EBFt hoa, Codex/Cursor vi\u1EBFt th\u01B0\u1EDDng). */
4383
+ function toolIcon(name) {
4384
+ const n = String(name || '').toLowerCase();
4385
+ return n === 'bash' || n === 'shell' || n === 'powershell' ? 'terminal' : n === 'read' || n === 'ls' ? 'eye' : n === 'glob' || n === 'grep' ? 'search' : 'edit';
4386
+ }
4387
+ const shortText = (s, n) => { const t = String(s || '').replace(/\\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1) + '\u2026' : t; };
4388
+
4389
+ function taskLabel(task, x) {
4390
+ const code = x.item || (C.ST.sel || '');
4391
+ if (task === 'viet-dac-ta') return T('Vi\u1EBFt \u0111\u1EB7c t\u1EA3 {c}', { c: code });
4392
+ if (task === 'ra-soat') return T('R\xE0 so\xE1t {c}', { c: code });
4393
+ if (task === 'sua-loi') return x.item ? T('S\u1EEDa l\u1ED7i ki\u1EC3m tra c\u1EE7a {c}', { c: x.item }) : T('S\u1EEDa l\u1ED7i ki\u1EC3m tra c\u1EE7a c\u1EA3 d\u1EF1 \xE1n con');
4394
+ if (task === 'muc-cho') return T('G\u1EE3i \xFD tr\u1EA3 l\u1EDDi m\u1EE5c ch\u1EDD {c}', { c: x.tbd });
4395
+ if (task === 'gop-y') return T('\u0110\xE1nh gi\xE1 g\xF3p \xFD {c}', { c: (x.feedback || {}).id });
4396
+ if (task === 'binh-luan') return T('X\u1EED l\xFD b\xECnh lu\u1EADn tr\xEAn {c}', { c: (x.comment || {}).item });
4397
+ if (task === 'man-con-thieu') return T('T\xECm m\xE0n c\xF2n thi\u1EBFu c\u1EE7a ph\xE2n h\u1EC7 {c}', { c: x.module || C.ST.mod });
4398
+ return x.text || '';
4399
+ }
4400
+
4401
+ /** Panel \u0111ang d\xF2 CLI AI (l\u1EA7n \u0111\u1EA7u v\xE0i gi\xE2y) \u2014 \xABNh\u1EDD AI\xBB b\u1EA5m s\u1EDBm th\xEC \u0111\u1EE3i ch\u1EE9 kh\xF4ng b\xE1o nh\u1EA7m \xABch\u01B0a c\xF3 CLI AI\xBB. */
4402
+ let aiReady = Promise.resolve();
4403
+ export function mountAi(panel) { aiReady = initAi(panel); return aiReady; }
4404
+ async function initAi(panel) {
4405
+ const h = C.h;
4406
+ el = {
4407
+ pick: h('div', { class: 'pbx-ai-pick' }), ctx: h('div', { class: 'pbx-ai-ctx', 'data-testid': 'ai-ctx' }), quick: h('div', { class: 'pbx-ai-quick' }),
4408
+ tabs: h('div', { class: 'pbx-ai-tabs', role: 'tablist', 'aria-label': T('C\xE1c cu\u1ED9c tr\xF2 chuy\u1EC7n AI'), 'data-testid': 'ai-tabs' }),
4409
+ logBox: h('div', { class: 'pbx-ai-logbox' }),
4410
+ input: h('textarea', { class: 'pb-textarea pbx-ai-input', rows: '3', 'data-testid': 'ai-input', placeholder: T('Nh\u1EAFn AI\u2026 (Ctrl+Enter \u0111\u1EC3 g\u1EEDi)') }),
4411
+ };
4412
+ el.send = btn(T('G\u1EEDi'), { kind: 'primary', icon: 'sparkles', testid: 'ai-send', onClick: () => sendFree() });
4413
+ el.stop = btn(T('D\u1EEBng'), { kind: 'danger', icon: 'x', testid: 'ai-stop', onClick: () => stop() });
4414
+ el.stop.hidden = true;
4415
+ el.fresh = btn(T('Cu\u1ED9c m\u1EDBi'), { kind: 'ghost', icon: 'plus', testid: 'ai-new', title: T('M\u1EDF cu\u1ED9c tr\xF2 chuy\u1EC7n m\u1EDBi \u2014 c\xE1c cu\u1ED9c \u0111ang ch\u1EA1y v\u1EABn ch\u1EA1y song song'), onClick: () => { const c = active && !active.run && !active.used ? active : newConv(); show(c); el.input.focus(); } });
4416
+ el.input.addEventListener('keydown', (e) => { if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) { e.preventDefault(); sendFree(); } });
4417
+ el.pick.appendChild(h('span', { class: 'pb-small pb-muted', 'data-testid': 'ai-detecting' }, T('\u0110ang t\xECm Claude Code / Codex / Cursor tr\xEAn m\xE1y\u2026')));
4418
+ panel.replaceChildren(h('div', { class: 'pbx-ai', 'data-testid': 'ai-panel' }, el.pick, el.ctx, el.quick, el.tabs, el.logBox,
4419
+ h('div', { class: 'pbx-ai-compose' }, el.input, h('div', { class: 'pb-row' }, el.fresh, h('span', { class: 'pbx-grow' }), el.stop, el.send))));
4420
+ const r = await api('api/ai');
4421
+ S.engines = r.json.engines || [];
4422
+ S.max = r.json.max || 4;
4423
+ const saved = store('panba.ai') || {};
4424
+ const eng = S.engines.find((e) => e.id === saved.engine) || S.engines[0];
4425
+ if (!eng) {
4426
+ el.pick.replaceChildren(h('div', { class: 'pb-empty', 'data-testid': 'ai-none' }, h('div', { class: 'pb-empty__title' }, T('M\xE1y ch\u01B0a c\xF3 CLI AI')),
4427
+ h('p', { class: 'pb-empty__text' }, T('C\xE0i v\xE0 \u0111\u0103ng nh\u1EADp m\u1ED9t trong: Claude Code (claude), Codex (codex), Cursor (cursor-agent). Kh\xF4ng c\u1EA7n API key \u2014 d\xF9ng t\xE0i kho\u1EA3n c\u1EE7a b\u1EA1n.')),
4428
+ h('p', { class: 'pb-empty__text' }, T('\u0110\xE3 c\xE0i m\xE0 v\u1EABn kh\xF4ng th\u1EA5y? Ch\xE9p nh\u1EADt k\xFD g\u1EEDi \u0111\u1ED9i ph\xE1t tri\u1EC3n:')), logButton()));
4429
+ el.send.disabled = true; el.input.disabled = true;
4430
+ return;
4431
+ }
4432
+ S.engine = eng.id;
4433
+ const m = eng.models.find((x) => x.id === saved.model);
4434
+ S.model = m ? m.id : eng.model;
4435
+ S.effort = saved.effort && effortsOf().includes(saved.effort) ? saved.effort : (effortsOf().includes(eng.effort) ? eng.effort : (effortsOf()[0] || ''));
4436
+ renderPick(); renderCtx();
4437
+ // D\u1EF1ng l\u1EA1i c\xE1c cu\u1ED9c (l\u1ECBch s\u1EED l\u01B0u tr\xEAn m\xE1y + l\u01B0\u1EE3t c\xF2n ch\u1EA1y): m\u1ED7i cu\u1ED9c m\u1ED9t tab, c\xE1c l\u01B0\u1EE3t theo th\u1EE9 t\u1EF1; l\u01B0\u1EE3t c\xF2n ch\u1EA1y th\xEC nghe
4438
+ // ti\u1EBFp. Nh\u1EAFn ti\u1EBFp v\xE0o cu\u1ED9c c\u0169 \u21D2 c\xF9ng m\xE3 cu\u1ED9c (c\xF9ng th\u01B0 m\u1EE5c l\u1ECBch s\u1EED) v\xE0 n\u1ED1i ti\u1EBFp phi\xEAn AI c\u0169.
4439
+ const groups = new Map();
4440
+ for (const x of (r.json.runs || []).slice().reverse()) { const k = x.conv || x.id; if (!groups.has(k)) groups.set(k, []); groups.get(k).push(x); }
4441
+ for (const [k, list] of groups) {
4442
+ const c = newConv(shortText(list[0].label, 40));
4443
+ c.id = k; c.used = true;
4444
+ for (const x of list) {
4445
+ bubble(c, 'user', x.say || x.label);
4446
+ Object.assign(c, { run: x.id, task: x.task, extra: {}, count: 0, cur: null, engine: x.engine, session: x.session || c.session, sessionEngine: x.engine });
4447
+ if (x.status === 'running') { c.status = 'running'; listen(c, x.id, 0); continue; }
4448
+ for (const e of x.events || []) { onEvent(c, e); c.count++; }
4449
+ finish(c, x.end || { t: 'end', status: x.status, files: [] }, { quiet: true });
4450
+ }
4451
+ }
4452
+ show(CONVS[CONVS.length - 1] || newConv());
4453
+ }
4454
+ const engineOf = () => S.engines.find((e) => e.id === S.engine) || {};
4455
+ function effortsOf() { const e = engineOf(); const m = (e.models || []).find((x) => x.id === S.model); return (m && m.efforts && m.efforts.length ? m.efforts : e.efforts) || []; }
4456
+ function renderPick() {
4457
+ const h = C.h; const e = engineOf();
4458
+ const sel = (opts, value, testid, label, on) => {
4459
+ const s = h('select', { class: 'pb-select pbx-ai-sel', 'data-testid': testid, 'aria-label': label }, opts.map(([v, l]) => h('option', { value: v, selected: v === value || null }, l)));
4460
+ s.addEventListener('change', () => on(s.value)); return s;
4461
+ };
4462
+ const save = () => store('panba.ai', { engine: S.engine, model: S.model, effort: S.effort });
4463
+ const efforts = effortsOf();
4464
+ // C\xF4ng c\u1EE5 kh\xF4ng c\xF3 m\u1EE9c suy ngh\u0129 (Cursor) \u21D2 b\u1ECF h\u1EB3n \xF4 th\u1EE9 ba; replaceChildren(null) s\u1EBD in ch\u1EEF \xABnull\xBB.
4465
+ el.pick.replaceChildren(...[
4466
+ sel(S.engines.map((x) => [x.id, x.label]), S.engine, 'ai-engine', T('C\xF4ng c\u1EE5 AI'), (v) => { S.engine = v; const ne = engineOf(); S.model = ne.model; S.effort = ne.effort; save(); renderPick(); }),
4467
+ sel((e.models || []).map((x) => [x.id, x.label]).concat((e.models || []).some((x) => x.id === S.model) || !S.model ? [] : [[S.model, S.model]]), S.model, 'ai-model', T('Model'), (v) => { S.model = v; if (!effortsOf().includes(S.effort)) S.effort = effortsOf().includes('medium') ? 'medium' : (effortsOf()[0] || ''); save(); renderPick(); }),
4468
+ efforts.length ? sel(efforts.map((x) => [x, x]), S.effort, 'ai-effort', T('M\u1EE9c suy ngh\u0129'), (v) => { S.effort = v; save(); }) : null,
4469
+ ].filter(Boolean));
4470
+ }
4471
+ /** Ng\u1EEF c\u1EA3nh + vi\u1EC7c nhanh theo m\u1EE5c / ph\xE2n h\u1EC7 \u0111ang ch\u1ECDn \u2014 g\u1ECDi l\u1EA1i m\u1ED7i khi ch\u1ECDn m\u1EE5c kh\xE1c. */
4472
+ export function renderCtx() {
4473
+ if (!el) return;
4474
+ // C\xF4ng c\u1EE5 kh\xE1c d\xF9ng l\u1EA1i khung n\xE0y (t\xE0i li\u1EC7u b\xE0n giao, Pan Test): ng\u1EEF c\u1EA3nh + vi\u1EC7c nhanh c\u1EE7a ri\xEAng n\xF3
4475
+ if (C.ctxView) { C.ctxView(el.ctx, el.quick, { btn, ask }); return; }
4476
+ const h = C.h; const M = C.M(); const code = C.ST.sel; const it = code ? M.item(code) : null;
4477
+ const mod = (C.D().modules || []).find((m) => m.ma === C.ST.mod);
4478
+ el.ctx.replaceChildren(h('span', { class: 'pb-small pb-muted' }, T('Ng\u1EEF c\u1EA3nh:')), ' ',
4479
+ it ? C.P.chip(code, { docId: C.ST.doc, size: 'sm' }) : h('span', { class: 'pb-small' }, mod ? T('ph\xE2n h\u1EC7 {m}', { m: mod.ma + ' \xB7 ' + mod.ten }) : '\u2014'));
4480
+ const q = [];
4481
+ if (it) {
4482
+ q.push(btn(it.trangThai === 'du-kien' || it.trangThai === 'dang-viet' ? T('Vi\u1EBFt \u0111\u1EB7c t\u1EA3') : T('Vi\u1EBFt ti\u1EBFp \u0111\u1EB7c t\u1EA3'), { kind: 'secondary', small: true, testid: 'ai-q-viet', onClick: () => ask('viet-dac-ta', { item: code }) }));
4483
+ q.push(btn(T('R\xE0 so\xE1t'), { kind: 'ghost', small: true, testid: 'ai-q-rasoat', onClick: () => ask('ra-soat', { item: code }) }));
4484
+ q.push(btn(T('S\u1EEDa l\u1ED7i ki\u1EC3m tra'), { kind: 'ghost', small: true, testid: 'ai-q-sualoi', onClick: () => ask('sua-loi', { item: code }) }));
4485
+ }
4486
+ if (mod) q.push(btn(T('M\xE0n c\xF2n thi\u1EBFu'), { kind: 'ghost', small: true, testid: 'ai-q-man', onClick: () => ask('man-con-thieu', { module: mod.ma, item: null }) }));
4487
+ el.quick.replaceChildren(...q);
4488
+ }
4489
+
4490
+ // ---------------------------------------------------------------- cu\u1ED9c tr\xF2 chuy\u1EC7n (tab)
4491
+ function newConv(title) {
4492
+ const h = C.h;
4493
+ seq += 1;
4494
+ // m\xE3 cu\u1ED9c NG\u1EAAU NHI\xCAN: l\u1ECBch s\u1EED l\u01B0u theo cu\u1ED9c, m\u1EDF l\u1EA1i app kh\xF4ng tr\xF9ng m\xE3 cu\u1ED9c c\u0169
4495
+ const conv = { id: 'c' + Date.now().toString(36) + Math.random().toString(36).slice(2, 6), title: title || T('Cu\u1ED9c {n}', { n: seq }), used: false, engine: '', session: null, sessionEngine: '', run: null, task: null, extra: null, count: 0, cur: null, es: null, status: 'idle', agents: new Map(),
4496
+ log: h('div', { class: 'pbx-ai-log', 'data-testid': 'ai-log', 'aria-live': 'polite' }) };
4497
+ CONVS.push(conv);
4498
+ return conv;
4499
+ }
4500
+ function show(conv) {
4501
+ active = conv;
4502
+ if (!conv.log.children.length) hint(conv);
4503
+ el.logBox.replaceChildren(conv.log);
4504
+ conv.log.scrollTop = conv.log.scrollHeight;
4505
+ renderTabs(); running(!!conv.run);
4506
+ }
4507
+ function closeConv(conv) {
4508
+ if (conv.run) return;
4509
+ if (conv.es) conv.es.close();
4510
+ CONVS = CONVS.filter((c) => c !== conv);
4511
+ if (active === conv) show(CONVS[CONVS.length - 1] || newConv());
4512
+ else renderTabs();
4513
+ }
4514
+ const statusDot = (status) => C.h('span', { class: 'pbx-ai-dot', 'data-status': status, 'aria-hidden': 'true' });
4515
+ function renderTabs() {
4516
+ const h = C.h;
4517
+ el.tabs.hidden = CONVS.length < 2;
4518
+ el.tabs.replaceChildren(...CONVS.map((c) => {
4519
+ const tab = h('button', { type: 'button', role: 'tab', class: 'pbx-ai-tab' + (c === active ? ' is-on' : ''), 'aria-selected': String(c === active), 'data-testid': 'ai-tab', 'data-status': c.status, title: c.title }, statusDot(c.status), h('span', { class: 'pbx-ai-tab__t' }, c.title));
4520
+ tab.addEventListener('click', () => show(c));
4521
+ if (c.run) return tab;
4522
+ const x = h('button', { type: 'button', class: 'pbx-ai-tab__x', 'aria-label': T('\u0110\xF3ng cu\u1ED9c n\xE0y'), title: T('\u0110\xF3ng cu\u1ED9c n\xE0y'), html: C.P.icon('x', { size: 12 }) });
4523
+ x.addEventListener('click', (e) => { e.stopPropagation(); closeConv(c); });
4524
+ return h('span', { class: 'pbx-ai-tabwrap' }, tab, x);
4525
+ }));
4526
+ }
4527
+ function hint(conv) {
4528
+ if (conv.log.children.length) return;
4529
+ conv.log.appendChild(C.h('p', { class: 'pb-small pb-muted', 'data-testid': 'ai-hint' }, C.aiHint || T('AI l\xE0m vi\u1EC7c ngay trong repo BA theo lu\u1EADt c\u1EE7a Pan BA: t\u1EF1 ki\u1EC3m tra b\u1EB1ng pan ba check, kh\xF4ng commit. Xong b\u1EA1n xem thay \u0111\u1ED5i r\u1ED3i Gi\u1EEF ho\u1EB7c Ho\xE0n t\xE1c.')));
4530
+ }
4531
+ function bubble(conv, kind, text) {
4532
+ const h = C.h;
4533
+ const b = h('div', { class: 'pbx-ai-msg pbx-ai-msg--' + kind, 'data-testid': 'ai-msg-' + kind }, text || '');
4534
+ if (kind === 'error') b.appendChild(h('div', { class: 'pb-row' }, logButton())); // l\u1ED7i \u21D2 ch\xE9p nh\u1EADt k\xFD g\u1EEDi \u0111\u1ED9i ph\xE1t tri\u1EC3n
4535
+ const hintEl = conv.log.querySelector('[data-testid="ai-hint"]'); if (hintEl) hintEl.remove();
4536
+ conv.log.appendChild(b); scrollDown(conv);
4537
+ return b;
4538
+ }
4539
+ /** \xABAI \u0111ang nh\u1EADn vi\u1EC7c\u2026\xBB (ba ch\u1EA5m) t\u1EEB l\xFAc b\u1EA5m G\u1EEDi t\u1EDBi s\u1EF1 ki\u1EC7n \u0111\u1EA7u ti\xEAn c\u1EE7a l\u01B0\u1EE3t. */
4540
+ function typing(conv, on) {
4541
+ const old = conv.log.querySelector('[data-testid="ai-typing"]');
4542
+ if (!on) { if (old) old.remove(); return; }
4543
+ if (old) return;
4544
+ conv.log.appendChild(C.h('div', { class: 'pbx-ai-typing', 'data-testid': 'ai-typing', role: 'status' }, C.h('span', { class: 'pbx-dots', 'aria-hidden': 'true' }, C.h('i'), C.h('i'), C.h('i')), T('AI \u0111ang nh\u1EADn vi\u1EC7c\u2026')));
4545
+ scrollDown(conv);
4546
+ }
4547
+ function scrollDown(conv) { if (conv === active) conv.log.scrollTop = conv.log.scrollHeight; }
4548
+ function running(on) {
4549
+ el.stop.hidden = !on;
4550
+ if (!on || !el.stop.disabled) return;
4551
+ el.stop.disabled = false; el.stop.replaceChildren(C.h('span', { html: C.P.icon('x', { size: 16 }) }), T('D\u1EEBng'));
4552
+ }
4553
+
4554
+ /** Giao vi\u1EC7c cho AI t\u1EEB b\u1EA5t k\u1EF3 \u0111\xE2u trong UI (th\u1EBB m\u1EE5c, Ki\u1EC3m tra, m\u1EE5c ch\u1EDD, g\xF3p \xFD, b\xECnh lu\u1EADn). */
4555
+ /** N\xFAt \xABCh\xE9p nh\u1EADt k\xFD\xBB: ph\u1EA7n cu\u1ED1i ~/.pan/logs/pan-ba-ai.log (l\u1EC7nh th\u1EADt \u0111\xE3 g\u1ECDi, m\xE3 tho\xE1t, stderr) \u2014 d\xE1n g\u1EEDi \u0111\u1ED9i ph\xE1t tri\u1EC3n. */
4556
+ function logButton() {
4557
+ return btn(T('Ch\xE9p nh\u1EADt k\xFD'), { kind: 'ghost', small: true, icon: 'copy', testid: 'ai-log-copy', onClick: async () => {
4558
+ const r = await api('api/ai/log');
4559
+ const text = r.ok && r.json ? \`# \${r.json.file}\\n\${r.json.text}\` : '';
4560
+ if (!text.trim()) { C.P.toast(T('Ch\u01B0a c\xF3 nh\u1EADt k\xFD.'), { kind: 'info' }); return; }
4561
+ try { await navigator.clipboard.writeText(text); C.P.toast(T('\u0110\xE3 ch\xE9p nh\u1EADt k\xFD ({p}) \u2014 d\xE1n g\u1EEDi \u0111\u1ED9i ph\xE1t tri\u1EC3n.', { p: r.json.file }), { kind: 'success' }); }
4562
+ catch { C.P.dialog({ title: T('Nh\u1EADt k\xFD Tr\u1EE3 l\xFD AI'), size: 'lg', body: C.h('textarea', { class: 'pb-input', rows: 16, readonly: 'readonly', 'data-testid': 'ai-log-text' }, text), actions: [{ label: T('\u0110\xF3ng'), kind: 'ghost' }] }); }
4563
+ } });
4564
+ }
4565
+ export function askAi(task, extra) { return ask(task, extra || {}); }
4566
+ async function ask(task, extra) {
4567
+ openTab('tro-ly');
4568
+ await aiReady.catch(() => {});
4569
+ if (!S.engine) { C.P.toast(T('M\xE1y ch\u01B0a c\xF3 CLI AI'), { kind: 'warn' }); return; }
4570
+ // Cu\u1ED9c \u0111ang xem c\xF2n ch\u1EA1y (ho\u1EB7c \u0111ang ch\u1EDD m\xE1y ch\u1EE7 nh\u1EADn l\u01B0\u1EE3t \u2014 b\u1EA5m G\u1EEDi hai l\u1EA7n li\u1EC1n) \u21D2 m\u1EDF cu\u1ED9c m\u1EDBi ch\u1EA1y SONG SONG.
4571
+ const conv = active && !active.run && !active.pending ? active : newConv();
4572
+ conv.pending = true;
4573
+ const body = Object.assign({ task, engine: S.engine, model: S.model, effort: S.effort, doc: C.ST.doc, module: C.ST.mod, item: C.ST.sel || undefined }, extra);
4574
+ if (body.item === null) delete body.item;
4575
+ if (conv.session && conv.sessionEngine === S.engine) body.resume = conv.session;
4576
+ // l\u1EC7nh BA \u0111\xE3 \xABCho ph\xE9p\xBB trong cu\u1ED9c n\xE0y \u0111i k\xE8m m\u1ECDi l\u01B0\u1EE3t sau c\u1EE7a cu\u1ED9c
4577
+ const allow = [...new Set([...(conv.allow || []), ...(body.allow || [])])];
4578
+ if (allow.length) body.allow = allow; else delete body.allow;
4579
+ // Hi\u1EC7n c\xE2u c\u1EE7a ng\u01B0\u1EDDi d\xF9ng + \xABAI \u0111ang nh\u1EADn vi\u1EC7c\u2026\xBB NGAY khi b\u1EA5m G\u1EEDi (tr\u01B0\u1EDBc \u0111\xE2y ch\u1EDD m\xE1y ch\u1EE7 tr\u1EA3 l\u1EDDi 3\u20134 s m\u1EDBi hi\u1EC7n).
4580
+ const label = taskLabel(task, body);
4581
+ const say = label + (task !== 'tu-do' && body.text ? ' \u2014 ' + body.text : '');
4582
+ Object.assign(body, { conv: conv.id, say });
4583
+ const wasUsed = conv.used;
4584
+ if (!conv.used) conv.title = shortText(label, 40) || conv.title;
4585
+ conv.used = true;
4586
+ show(conv);
4587
+ bubble(conv, 'user', say);
4588
+ typing(conv, true);
4589
+ renderTabs(); running(true);
4590
+ const r = await api('api/ai/run', body).finally(() => { conv.pending = false; });
4591
+ if (!r.ok) {
4592
+ typing(conv, false);
4593
+ bubble(conv, 'error', (r.json && r.json.error) || T('Kh\xF4ng g\u1EEDi \u0111\u01B0\u1EE3c ({s}).', { s: r.status }));
4594
+ if (conv === active) running(false);
4595
+ if (!wasUsed) conv.used = true;
4596
+ return;
4597
+ }
4598
+ Object.assign(conv, { run: r.json.run, task, extra: body, count: 0, cur: null, status: 'running', engine: S.engine });
4599
+ renderTabs(); if (conv === active) running(true);
4600
+ listen(conv, conv.run, 0);
4601
+ if (conv.stopAsked) { conv.stopAsked = false; api('api/ai/stop', { run: conv.run }); } // b\u1EA5m D\u1EEBng l\xFAc m\xE1y ch\u1EE7 ch\u01B0a nh\u1EADn l\u01B0\u1EE3t
4602
+ }
4603
+ function sendFree() {
4604
+ const text = el.input.value.trim();
4605
+ if (!text) { el.input.focus(); return; }
4606
+ el.input.value = '';
4607
+ ask('tu-do', { text });
4608
+ }
4609
+ function listen(conv, id, since) {
4610
+ if (conv.es) conv.es.close();
4611
+ const es = new EventSource('api/ai/events?run=' + encodeURIComponent(id) + '&since=' + since);
4612
+ conv.es = es;
4613
+ es.onmessage = (m) => {
4614
+ const e = JSON.parse(m.data);
4615
+ if (e.t !== 'end') conv.count++;
4616
+ onEvent(conv, e);
4617
+ if (e.t === 'end') { es.close(); conv.es = null; }
4618
+ };
4619
+ es.onerror = () => { es.close(); conv.es = null; if (conv.run === id) setTimeout(() => { if (conv.run === id) listen(conv, id, conv.count); }, 1500); };
4620
+ }
4621
+ function toolRow(e) {
4622
+ const h = C.h;
4623
+ // nh\xE3n + bi\u1EC3u t\u01B0\u1EE3ng kh\xF4ng bao gi\u1EDD co (t\u1EEBng xu\u1ED1ng d\xF2ng t\u1EEBng ch\u1EEF \xAB\u0110 / \u1ECD / c\xBB); ch\u1EC9 ph\u1EA7n \u0111\u01B0\u1EDDng d\u1EABn c\u1EAFt \xAB\u2026\xBB, di chu\u1ED9t xem \u0111\u1EE7
4624
+ return h('div', { class: 'pbx-ai-tool', 'data-testid': 'ai-tool', title: e.detail || null },
4625
+ h('span', { class: 'pbx-ai-tool__ico', html: C.P.icon(toolIcon(e.name), { size: 14 }) }),
4626
+ h('b', { class: 'pbx-ai-tool__n' }, T(TOOL[e.name] || e.name)), h('span', { class: 'pbx-ai-tool__d' }, e.detail || ''));
4627
+ }
4628
+ function onEvent(conv, e) {
4629
+ typing(conv, false);
4630
+ if (e.t === 'session') { conv.session = e.id; conv.sessionEngine = conv.engine || S.engine; return; }
4631
+ if (e.t === 'agent-start') { agentStart(conv, e); return; }
4632
+ if (e.t === 'agent-progress' || e.t === 'agent-end') { agentUpdate(conv, e); return; }
4633
+ // Ch\u1EEF / b\u01B0\u1EDBc c\u1EE7a AGENT CON: v\xE0o b\u1EA3n ghi c\u1EE7a agent \u0111\xF3 (xem \u1EDF h\u1ED9p chi ti\u1EBFt), kh\xF4ng l\u1EABn v\xE0o b\u1EA3n ghi ch\xEDnh.
4634
+ if ((e.t === 'text' || e.t === 'tool') && e.agent) { agentStep(conv, e); return; }
4635
+ if (e.t === 'text') { if (!conv.cur) conv.cur = conv.lastAi = bubble(conv, 'ai', ''); conv.cur.textContent += e.text; scrollDown(conv); return; }
4636
+ if (e.t === 'tool') { conv.cur = null; conv.log.appendChild(toolRow(e)); scrollDown(conv); return; }
4637
+ if (e.t === 'error') { conv.cur = null; bubble(conv, 'error', e.message); return; }
4638
+ if (e.t === 'choices') { conv.cur = null; conv.log.appendChild(choiceCard(conv, e.question, e.options)); scrollDown(conv); return; }
4639
+ if (e.t === 'denied') { conv.cur = null; conv.log.appendChild(deniedCard(conv, e)); scrollDown(conv); return; }
4640
+ if (e.t === 'done') { if (!conv.cur && e.text) conv.lastAi = bubble(conv, 'ai', e.text); conv.cur = null; return; }
4641
+ if (e.t === 'end') finish(conv, e);
4642
+ }
4643
+
4644
+ // AI h\u1ECFi BA ch\u1ECDn: kh\u1ED1i \`\`\`pan-choices \u1EDF cu\u1ED1i c\xE2u tr\u1EA3 l\u1EDDi (m\u1ECDi CLI \u2014 lu\u1EADt trong system prompt) ho\u1EB7c AskUserQuestion c\u1EE7a Claude
4645
+ // Code (s\u1EF1 ki\u1EC7n \`choices\`). Hi\u1EC7n th\xE0nh n\xFAt; b\u1EA5m \u21D2 l\u01B0\u1EE3t sau c\u1EE7a cu\u1ED9c g\u1EEDi \u0111\xFAng l\u1EF1a ch\u1ECDn \u0111\xF3 (nh\u1EAFn ti\u1EBFp c\xF9ng phi\xEAn AI).
4646
+ export function parseChoices(text) {
4647
+ const m = /\`\`\`pan-choices[^\\n]*\\n([\\s\\S]*?)(?:\`\`\`|$)\\s*$/.exec(String(text || ''));
4648
+ if (!m) return null;
4649
+ let question = ''; const options = [];
4650
+ for (const raw of m[1].split('\\n')) {
4651
+ const l = raw.trim();
4652
+ if (l.startsWith('?')) question = l.slice(1).trim();
4653
+ else if (/^([-*\u2022]|\\d+[.)])\\s+/.test(l)) options.push(l.replace(/^([-*\u2022]|\\d+[.)])\\s+/, '').trim());
4654
+ }
4655
+ return options.length ? { text: String(text).slice(0, m.index).trimEnd(), question, options: options.slice(0, 8) } : null;
4656
+ }
4657
+ async function afterRun(conv) { if (conv.run) await new Promise((r) => (conv.waiters = conv.waiters || []).push(r)); }
4658
+ function choiceCard(conv, question, options) {
4659
+ const h = C.h;
4660
+ const card = h('div', { class: 'pbx-ai-result pbx-ai-choices', 'data-testid': 'ai-choices' }, question ? h('b', null, question) : null);
4661
+ const acts = h('div', { class: 'pbx-ai-choices__opts' });
4662
+ for (const opt of options) {
4663
+ acts.appendChild(btn(opt, { kind: 'secondary', small: true, testid: 'ai-choice', onClick: async () => {
4664
+ acts.replaceChildren(h('span', { class: 'pb-small pb-muted' }, T('\u0110\xE3 ch\u1ECDn: {o}', { o: opt })));
4665
+ await afterRun(conv);
4666
+ show(conv);
4667
+ await ask('tu-do', { text: opt });
4668
+ } }));
4669
+ }
4670
+ card.appendChild(acts);
4671
+ return card;
4672
+ }
4673
+
4674
+ // AI b\u1ECB ch\u1EB7n quy\u1EC1n (Claude Code ch\u1EA1y kh\xF4ng c\xF3 ai b\u1EA5m duy\u1EC7t): hi\u1EC7n l\u1EC7nh b\u1ECB ch\u1EB7n + n\xFAt cho ph\xE9p NGAY trong cu\u1ED9c. Ch\u1EC9 l\u1EC7nh shell
4675
+ // (\u0111\xFAng t\u1EEBng l\u1EC7nh) m\u1EDBi cho ph\xE9p \u0111\u01B0\u1EE3c; thao t\xE1c kh\xE1c (ghi ngo\xE0i repo, t\u1EC7p c\u1EA5u h\xECnh) Pan BA kh\xF4ng m\u1EDF cho AI.
4676
+ function deniedCard(conv, e) {
4677
+ const h = C.h;
4678
+ const tools = e.tools || [];
4679
+ const rules = [...new Set(tools.map((x) => x.rule).filter(Boolean))];
4680
+ const card = h('div', { class: 'pbx-ai-result pbx-ai-denied', 'data-testid': 'ai-denied' },
4681
+ h('b', null, T('AI c\u1EA7n quy\u1EC1n:')),
4682
+ h('ul', { class: 'pbx-ai-files' }, tools.map((x) => h('li', null, h('b', null, T(TOOL[x.name] || x.name)), ' ', h('code', { class: 'pbx-lintfile' }, x.detail || '')))));
4683
+ if (!rules.length) {
4684
+ card.appendChild(h('p', { class: 'pb-small pb-muted' }, T('Pan BA kh\xF4ng cho AI l\xE0m thao t\xE1c n\xE0y (ngo\xE0i repo ho\u1EB7c t\u1EC7p c\u1EA5u h\xECnh) \u2014 t\u1EF1 l\xE0m, ho\u1EB7c \u0111\u1ED5i y\xEAu c\u1EA7u.')));
4685
+ return card;
4686
+ }
4687
+ const acts = h('div', { class: 'pb-row' });
4688
+ const go = (always) => async () => {
4689
+ acts.replaceChildren(h('span', { class: 'pb-small pb-muted' }, always ? T('\u0110\xE3 lu\xF4n cho ph\xE9p (m\xE1y n\xE0y, repo n\xE0y) \u2014 AI l\xE0m ti\u1EBFp.') : T('\u0110\xE3 cho ph\xE9p trong cu\u1ED9c n\xE0y \u2014 AI l\xE0m ti\u1EBFp.')));
4690
+ conv.allow = [...new Set([...(conv.allow || []), ...rules])];
4691
+ await afterRun(conv); // l\u01B0\u1EE3t b\u1ECB ch\u1EB7n ch\u01B0a \u0111\xF3ng h\u1EB3n
4692
+ show(conv);
4693
+ const cmds = tools.filter((x) => x.rule).map((x) => x.detail).join('; ');
4694
+ await ask('tu-do', { text: T('\u0110\xE3 cho ph\xE9p: {c}. Ch\u1EA1y l\u1EA1i \u0111\xFAng l\u1EC7nh \u0111\xF3 r\u1ED3i l\xE0m ti\u1EBFp vi\u1EC7c \u0111ang d\u1EDF.', { c: cmds }), allow: rules, ...(always ? { allowAlways: true } : {}) });
4695
+ };
4696
+ acts.appendChild(btn(T('Cho ph\xE9p v\xE0 l\xE0m ti\u1EBFp'), { kind: 'primary', small: true, icon: 'check', testid: 'ai-allow', onClick: go(false) }));
4697
+ acts.appendChild(btn(T('Lu\xF4n cho ph\xE9p'), { kind: 'secondary', small: true, testid: 'ai-allow-always', onClick: go(true) }));
4698
+ card.appendChild(acts);
4699
+ card.appendChild(h('p', { class: 'pb-small pb-muted' }, T('\xABLu\xF4n cho ph\xE9p\xBB nh\u1EDB \u0111\xFAng c\xE1c l\u1EC7nh n\xE0y cho repo, ch\u1EC9 tr\xEAn m\xE1y n\xE0y.')));
4700
+ return card;
4701
+ }
4702
+
4703
+ // ---------------------------------------------------------------- agent con
4704
+ function agentStart(conv, e) {
4705
+ const h = C.h;
4706
+ conv.cur = null;
4707
+ const a = { id: e.agent, parent: e.parent, label: e.label || '', kind: e.kind || '', prompt: e.prompt || '', model: e.model || '', status: 'running', steps: [], tools: 0, tokens: 0, ms: 0, activity: '', summary: '', card: null };
4708
+ const card = h('button', { type: 'button', class: 'pbx-ai-agent', 'data-testid': 'ai-agent', 'data-status': 'running' });
4709
+ card.addEventListener('click', () => agentDialog(conv, a.id));
4710
+ a.card = card;
4711
+ conv.agents.set(a.id, a);
4712
+ const parent = conv.agents.get(e.parent);
4713
+ if (parent) { parent.steps.push({ agent: a.id }); paintAgent(parent); }
4714
+ else { conv.log.appendChild(card); scrollDown(conv); }
4715
+ paintAgent(a);
4716
+ }
4717
+ function agentUpdate(conv, e) {
4718
+ const a = conv.agents.get(e.agent);
4719
+ if (!a) return;
4720
+ if (e.t === 'agent-progress') { if (e.activity) a.activity = e.activity; if (e.tokens) a.tokens = e.tokens; if (e.ms) a.ms = e.ms; }
4721
+ else { a.status = e.status === 'error' ? 'error' : 'done'; if (e.summary) a.summary = e.summary; if (e.ms) a.ms = e.ms; a.activity = ''; }
4722
+ paintAgent(a);
4723
+ }
4724
+ function agentStep(conv, e) {
4725
+ const a = conv.agents.get(e.agent);
4726
+ if (!a) return;
4727
+ if (e.t === 'tool') { a.steps.push({ tool: e.name, detail: e.detail }); a.tools += 1; }
4728
+ else { const last = a.steps[a.steps.length - 1]; if (last && typeof last.text === 'string') last.text += e.text; else a.steps.push({ text: e.text }); }
4729
+ paintAgent(a);
4730
+ }
4731
+ const secs = (ms) => (ms ? (ms < 60000 ? Math.max(1, Math.round(ms / 1000)) + 's' : Math.floor(ms / 60000) + 'm' + String(Math.round((ms % 60000) / 1000)).padStart(2, '0') + 's') : '');
4732
+ function agentMeta(a) {
4733
+ return [secs(a.ms), a.tools ? T('{n} b\u01B0\u1EDBc', { n: a.tools }) : '', a.tokens ? T('{n} token', { n: a.tokens.toLocaleString() }) : ''].filter(Boolean).join(' \xB7 ');
4734
+ }
4735
+ function paintAgent(a) {
4736
+ const h = C.h;
4737
+ if (!a.card) return;
4738
+ a.card.setAttribute('data-status', a.status);
4739
+ // Khung Tr\u1EE3 l\xFD h\u1EB9p \u21D2 ba d\xF2ng: \xABAgent con \xB7 lo\u1EA1i\xBB / vi\u1EC7c \u0111\u01B0\u1EE3c giao (\u2264 2 d\xF2ng) / th\u1EDDi gian \xB7 b\u01B0\u1EDBc \xB7 token (+ \u0111ang l\xE0m g\xEC).
4740
+ // replaceChildren(null) in ch\u1EEF \xABnull\xBB \u21D2 l\u1ECDc ph\u1EA7n tr\u1ED1ng.
4741
+ const meta = [agentMeta(a), a.status === 'running' ? a.activity : ''].filter(Boolean).join(' \xB7 ');
4742
+ a.card.replaceChildren(...[
4743
+ h('span', { class: 'pbx-ai-agent__row' }, statusDot(a.status), h('b', null, T('Agent con')), a.kind ? h('span', { class: 'pb-badge' }, a.kind) : null),
4744
+ a.label ? h('span', { class: 'pbx-ai-agent__l' }, a.label) : null,
4745
+ meta ? h('span', { class: 'pb-small pb-muted pbx-ai-agent__act' }, meta) : null,
4746
+ ].filter(Boolean));
4747
+ }
4748
+ function agentDialog(conv, id) {
4749
+ const h = C.h;
4750
+ const a = conv.agents.get(id);
4751
+ if (!a) return;
4752
+ const steps = h('div', { class: 'pbx-ai-agent__steps' }, a.steps.map((s) => {
4753
+ if (s.tool) return toolRow({ name: s.tool, detail: s.detail });
4754
+ if (s.agent) { const sub = conv.agents.get(s.agent); return sub ? h('div', { class: 'pb-small' }, statusDot(sub.status), ' ', T('Agent con'), ' \xB7 ', sub.kind, ' \xAB', sub.label, '\xBB') : null; }
4755
+ return h('div', { class: 'pbx-ai-msg pbx-ai-msg--ai' }, s.text);
4756
+ }).filter(Boolean));
4757
+ const body = h('div', { class: 'pb-stack', 'data-testid': 'ai-agent-body' },
4758
+ h('p', { class: 'pb-small pb-muted' }, [a.label, a.model, agentMeta(a)].filter(Boolean).join(' \xB7 ')),
4759
+ a.prompt ? h('div', null, h('b', null, T('Vi\u1EC7c \u0111\u01B0\u1EE3c giao')), h('div', { class: 'pbx-ai-msg pbx-ai-msg--user pbx-ai-agent__prompt' }, a.prompt)) : null,
4760
+ a.steps.length ? h('div', null, h('b', null, T('C\xE1c b\u01B0\u1EDBc')), steps) : null,
4761
+ a.summary ? h('div', null, h('b', null, T('K\u1EBFt qu\u1EA3')), h('div', { class: 'pbx-ai-msg pbx-ai-msg--ai' }, a.summary)) : null);
4762
+ C.P.dialog({ title: T('Agent con') + (a.kind ? ' \xB7 ' + a.kind : ''), size: 'lg', testid: 'ai-agent-dialog', body, actions: [{ label: T('\u0110\xF3ng') }] });
4763
+ }
4764
+
4765
+ function finish(conv, e, o = {}) {
4766
+ const h = C.h; const id = conv.run; const task = conv.task; const extra = conv.extra || {};
4767
+ conv.run = null; conv.cur = null; conv.status = e.status || 'done';
4768
+ const waiters = conv.waiters || []; conv.waiters = [];
4769
+ // c\xE2u tr\u1EA3 l\u1EDDi k\u1EBFt th\xFAc b\u1EB1ng kh\u1ED1i l\u1EF1a ch\u1ECDn \u21D2 b\u1ECF kh\u1ED1i kh\u1ECFi bong b\xF3ng, hi\u1EC7n n\xFAt (c\u1EA3 khi d\u1EF1ng l\u1EA1i l\u1ECBch s\u1EED)
4770
+ const aiEl = conv.lastAi; conv.lastAi = null;
4771
+ const pick = aiEl ? parseChoices(aiEl.textContent) : null;
4772
+ if (pick) { if (pick.text) aiEl.textContent = pick.text; else aiEl.remove(); }
4773
+ for (const a of conv.agents.values()) if (a.status === 'running') { a.status = e.status === 'done' ? 'done' : 'error'; paintAgent(a); }
4774
+ renderTabs();
4775
+ if (conv === active) running(false);
4776
+ else if (!o.quiet) C.P.toast(e.status === 'error' ? T('Cu\u1ED9c \xAB{t}\xBB g\u1EB7p l\u1ED7i.', { t: conv.title }) : T('Cu\u1ED9c \xAB{t}\xBB \u0111\xE3 xong.', { t: conv.title }), { kind: e.status === 'error' ? 'error' : 'success' });
4777
+ const files = e.files || [];
4778
+ const card = h('div', { class: 'pbx-ai-result', 'data-testid': 'ai-result', 'data-status': e.status });
4779
+ const head = e.status === 'stopped' ? T('\u0110\xE3 d\u1EEBng.') : e.status === 'error' ? T('AI g\u1EB7p l\u1ED7i.') : files.length ? T('\u0110\xE3 \u0111\u1ED5i {n} t\u1EC7p.', { n: files.length }) : T('Xong \u2014 kh\xF4ng \u0111\u1ED5i t\u1EC7p n\xE0o.');
4780
+ const lint = e.lint ? h('span', { class: 'pb-badge', 'data-tone': e.lint.errors ? 'error' : e.lint.warns ? 'warn' : 'ok', 'data-testid': 'ai-lint' }, e.lint.errors ? T('{n} l\u1ED7i', { n: e.lint.errors }) : e.lint.warns ? T('{n} c\u1EA3nh b\xE1o', { n: e.lint.warns }) : T('Ki\u1EC3m tra s\u1EA1ch')) : null;
4781
+ card.appendChild(h('div', { class: 'pb-row' }, h('b', null, head), lint));
4782
+ if (files.length) {
4783
+ card.appendChild(h('ul', { class: 'pbx-ai-files' }, files.map((f) => h('li', null, h('span', { class: 'pbx-lintfile' }, f)))));
4784
+ }
4785
+ // l\u01B0\u1EE3t t\u1EEB tr\u01B0\u1EDBc khi m\u1EDF l\u1EA1i app: kh\xF4ng c\xF2n b\u1EA3n ch\u1EE5p \u21D2 kh\xF4ng c\xF3 Xem thay \u0111\u1ED5i / Ho\xE0n t\xE1c (d\xF9ng git)
4786
+ if (files.length && e.restored) card.appendChild(h('p', { class: 'pb-small pb-muted' }, T('L\u01B0\u1EE3t tr\u01B0\u1EDBc khi m\u1EDF l\u1EA1i app \u2014 xem / tr\u1EA3 l\u1EA1i thay \u0111\u1ED5i b\u1EB1ng git.')));
4787
+ if (files.length && !e.restored) {
4788
+ const acts = h('div', { class: 'pb-row' });
4789
+ acts.appendChild(btn(T('Xem thay \u0111\u1ED5i'), { kind: 'secondary', small: true, icon: 'eye', testid: 'ai-diff', onClick: () => showDiff(id, files) }));
4790
+ const undo = btn(T('Ho\xE0n t\xE1c'), { kind: 'ghost', small: true, icon: 'history', testid: 'ai-undo', onClick: async (_ev, b) => {
4791
+ b.disabled = true;
4792
+ const r = await api('api/ai/undo', { run: id });
4793
+ if (!r.ok) { failToast(r); b.disabled = false; return; }
4794
+ const skipped = r.json.skipped || [];
4795
+ C.P.toast(T('\u0110\xE3 ho\xE0n t\xE1c {n} t\u1EC7p.', { n: r.json.files.length }), { kind: 'success' });
4796
+ if (skipped.length) C.P.toast(T('Kh\xF4ng ho\xE0n t\xE1c (t\u1EC7p \u0111\xE3 b\u1ECB s\u1EEDa ti\u1EBFp): {f}', { f: skipped.join(', ') }), { kind: 'warn' });
4797
+ acts.replaceChildren(h('span', { class: 'pb-small pb-muted' }, T('\u0110\xE3 ho\xE0n t\xE1c.')));
4798
+ await C.reload();
4799
+ } });
4800
+ acts.appendChild(undo);
4801
+ acts.appendChild(btn(T('Gi\u1EEF'), { kind: 'primary', small: true, icon: 'check', testid: 'ai-keep', onClick: () => { acts.replaceChildren(h('span', { class: 'pb-small pb-muted' }, T('\u0110\xE3 gi\u1EEF \u2014 nh\u1EDB commit \u1EDF thanh git.'))); } }));
4802
+ card.appendChild(acts);
4803
+ }
4804
+ if (e.answer && (task === 'binh-luan' || task === 'gop-y' || task === 'muc-cho')) {
4805
+ const row = h('div', { class: 'pb-row' });
4806
+ if (task === 'binh-luan' && extra.comment) row.appendChild(btn(T('\u0110\u0103ng l\xE0m tr\u1EA3 l\u1EDDi'), { kind: 'secondary', small: true, icon: 'message', testid: 'ai-post-reply', onClick: () => replyDialog(extra.comment, e.answer) }));
4807
+ row.appendChild(btn(T('Ch\xE9p c\xE2u tr\u1EA3 l\u1EDDi'), { kind: 'ghost', small: true, testid: 'ai-copy', onClick: () => { try { navigator.clipboard.writeText(e.answer); C.P.toast(T('\u0110\xE3 ch\xE9p.'), { kind: 'success' }); } catch { /* b\u1ECF qua */ } } }));
4808
+ card.appendChild(row);
4809
+ }
4810
+ conv.log.appendChild(card);
4811
+ if (pick) conv.log.appendChild(choiceCard(conv, pick.question, pick.options));
4812
+ scrollDown(conv);
4813
+ if (files.length) C.reload();
4814
+ for (const w of waiters) w(); // b\u1EA5m \xABCho ph\xE9p\xBB l\xFAc l\u01B0\u1EE3t ch\u01B0a \u0111\xF3ng \u21D2 g\u1EEDi l\u01B0\u1EE3t ti\u1EBFp khi \u0111\xE3 \u0111\xF3ng
4815
+ }
4816
+ // D\u1EEBng: n\xFAt \u0111\u1ED5i \xAB\u0110ang d\u1EEBng\u2026\xBB NGAY; m\xE1y ch\u1EE7 gi\u1EBFt c\u1EA3 c\xE2y ti\u1EBFn tr\xECnh v\xE0 \xE9p k\u1EBFt th\xFAc l\u01B0\u1EE3t n\u1EBFu CLI kh\xF4ng t\u1EF1 \u0111\xF3ng. L\u01B0\u1EE3t \u0111\xE3 xong tr\xEAn m\xE1y
4817
+ // ch\u1EE7 (404) \u21D2 k\u1EBFt th\xFAc t\u1EA1i ch\u1ED7, kh\xF4ng \u0111\u1EC3 n\xFAt treo.
4818
+ async function stop() {
4819
+ const conv = active; if (!conv) return;
4820
+ el.stop.disabled = true; el.stop.textContent = T('\u0110ang d\u1EEBng\u2026');
4821
+ if (!conv.run) { if (conv.pending) conv.stopAsked = true; return; } // m\xE1y ch\u1EE7 ch\u01B0a tr\u1EA3 m\xE3 l\u01B0\u1EE3t \u21D2 d\u1EEBng ngay khi c\xF3
4822
+ const r = await api('api/ai/stop', { run: conv.run });
4823
+ if (!r.ok && conv.run) { if (conv.es) { conv.es.close(); conv.es = null; } typing(conv, false); finish(conv, { t: 'end', status: 'stopped', files: [] }); }
4824
+ }
4825
+ async function showDiff(id, files) {
4826
+ const h = C.h;
4827
+ const body = h('div', { class: 'pb-stack', 'data-testid': 'ai-diff-body' });
4828
+ C.P.dialog({ title: T('Thay \u0111\u1ED5i c\u1EE7a AI'), size: 'lg', testid: 'ai-diff-dialog', body, actions: [{ label: T('\u0110\xF3ng') }] });
4829
+ for (const f of files) {
4830
+ const r = await api('api/ai/diff?run=' + encodeURIComponent(id) + '&file=' + encodeURIComponent(f));
4831
+ const pre = h('pre', { class: 'pbx-diff' });
4832
+ for (const line of String((r.json && r.json.diff) || T('(kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c diff)')).split('\\n')) {
4833
+ pre.appendChild(h('span', { class: line.startsWith('+') && !line.startsWith('+++') ? 'pbx-diff-add' : line.startsWith('-') && !line.startsWith('---') ? 'pbx-diff-del' : line.startsWith('@@') ? 'pbx-diff-hunk' : null }, line + '\\n'));
4834
+ }
4835
+ body.appendChild(h('div', null, h('div', { class: 'pbx-lintfile' }, f), pre));
4836
+ }
4837
+ }
4838
+
4839
+ // ================================================================ B\xCCNH LU\u1EACN
4840
+ const CM = { threads: [], counts: {}, studio: false, scope: 'item', filter: 'open', pending: null };
4841
+ let cel = null;
4842
+ export async function loadComments() {
4843
+ const r = await api('api/comments?product=' + encodeURIComponent(C.PRODUCT));
4844
+ CM.threads = r.json.threads || []; CM.counts = r.json.counts || {}; CM.studio = !!r.json.studio;
4845
+ const open = Object.values(CM.counts).reduce((a, b) => a + b, 0);
4846
+ if (open) C.rightTabs.setCount('binh-luan', open);
4847
+ else { const c = document.querySelector('[data-testid="rtab-binh-luan"] .pb-tab__count'); if (c) c.remove(); }
4848
+ return CM;
4849
+ }
4850
+ export const commentCount = (code) => CM.counts[code] || 0;
4851
+ export function mountComments(panel) {
4852
+ cel = panel; renderComments();
4853
+ try { C.rightTabs.querySelector('[data-testid="rtab-binh-luan"]').addEventListener('click', () => autoSync()); } catch { /* khung kh\xE1c */ }
4854
+ }
4855
+ let lastSync = 0;
4856
+ /** B\xECnh lu\u1EADn ng\u01B0\u1EDDi xem vi\u1EBFt tr\xEAn Studio v\u1EC1 t\u1EF1 \u0111\u1ED9ng khi m\u1EDF tab B\xECnh lu\u1EADn (t\u1ED1i \u0111a 2 ph\xFAt m\u1ED9t l\u1EA7n; l\u1ED7i th\xEC im l\u1EB7ng). */
4857
+ async function autoSync() {
4858
+ if (!CM.studio || Date.now() - lastSync < 120000) return;
4859
+ lastSync = Date.now();
4860
+ const r = await api('api/comments/sync', {});
4861
+ if (!r.ok) return;
4862
+ const x = r.json.report;
4863
+ if (x.pulled || x.statuses) { C.P.toast(T('Studio: c\xF3 {a} b\xECnh lu\u1EADn / tr\u1EA3 l\u1EDDi m\u1EDBi.', { a: x.pulled + x.statuses }), { kind: 'info' }); await refreshAll(); }
4864
+ }
4865
+ /** M\u1EDF tab B\xECnh lu\u1EADn cho m\u1ED9t m\u1EE5c (t\u1EEB huy hi\u1EC7u tr\xEAn th\u1EBB m\u1EE5c / l\u1EC1 Word). */
4866
+ export function openComments(code, pending) {
4867
+ if (code && code !== C.ST.sel) C.select(code, false);
4868
+ CM.scope = 'item';
4869
+ if (pending) CM.pending = pending;
4870
+ openTab('binh-luan');
4871
+ renderComments();
4872
+ const ta = cel && cel.querySelector('[data-testid="cm-text"]'); if (ta) ta.focus();
4873
+ }
4874
+ const who = (id, name) => name || C.M().personName(id) || id;
4875
+ export function renderComments() {
4876
+ if (!cel) return;
4877
+ const h = C.h; const code = C.ST.sel;
4878
+ const seg = (opts, cur, on, testid) => h('div', { class: 'pb-seg', role: 'radiogroup', 'data-testid': testid }, opts.map(([v, l]) => {
4879
+ const b = h('button', { type: 'button', role: 'radio', 'aria-checked': String(cur === v), 'data-testid': testid + '-' + v }, l);
4880
+ b.addEventListener('click', () => { on(v); renderComments(); }); return b;
4881
+ }));
4882
+ const sync = CM.studio ? btn(T('\u0110\u1ED3ng b\u1ED9 Studio'), { kind: 'ghost', small: true, icon: 'refresh', testid: 'cm-sync', onClick: (_e, b) => syncStudio(b) }) : null;
4883
+ const top = h('div', { class: 'pbx-cm-top' },
4884
+ seg([['item', T('M\u1EE5c n\xE0y')], ['all', T('C\u1EA3 d\u1EF1 \xE1n con')]], CM.scope, (v) => { CM.scope = v; }, 'cm-scope'),
4885
+ seg([['open', T('\u0110ang m\u1EDF')], ['all', T('T\u1EA5t c\u1EA3')]], CM.filter, (v) => { CM.filter = v; }, 'cm-filter'), sync);
4886
+ const parts = [top];
4887
+ if (code && CM.scope === 'item') parts.push(composer(code));
4888
+ else if (CM.scope === 'item') parts.push(h('p', { class: 'pb-muted pb-small' }, T('Ch\u1ECDn m\u1ED9t m\u1EE5c \u0111\u1EC3 b\xECnh lu\u1EADn \u2014 ho\u1EB7c b\xF4i ch\u1EEF trong \xABXem nh\u01B0 Word\xBB r\u1ED3i b\u1EA5m B\xECnh lu\u1EADn.')));
4889
+ const list = CM.threads.filter((t) => (CM.scope === 'all' || t.item === code) && (CM.filter === 'all' || t.status === 'open'));
4890
+ if (!list.length) parts.push(h('p', { class: 'pb-muted pb-small', 'data-testid': 'cm-empty' }, CM.filter === 'open' ? T('Kh\xF4ng c\xF3 b\xECnh lu\u1EADn \u0111ang m\u1EDF.') : T('Ch\u01B0a c\xF3 b\xECnh lu\u1EADn.')));
4891
+ for (const t of list) parts.push(threadCard(t));
4892
+ cel.replaceChildren(...parts);
4893
+ }
4894
+ function composer(code) {
4895
+ const h = C.h; const p = CM.pending && CM.pending.item === code ? CM.pending : null;
4896
+ const rows = [];
4897
+ for (const k of ['truong', 'thao-tac', 'quy-tac', 'buoc', 'tham-so']) for (const r of C.M().rows(code, k, 'current')) if (r.ma && !r.nhom) rows.push([r.ma, r.ma + ' \xB7 ' + (r.ten || r.noiDung || r.chuThich || '').slice(0, 40)]);
4898
+ const rowSel = h('select', { class: 'pb-select', 'data-testid': 'cm-row', 'aria-label': T('D\xF2ng') }, [['', T('C\u1EA3 m\u1EE5c')]].concat(rows).map(([v, l]) => h('option', { value: v, selected: (p && p.row === v) || null }, l)));
4899
+ const ta = h('textarea', { class: 'pb-textarea', rows: '3', 'data-testid': 'cm-text', placeholder: T('B\xECnh lu\u1EADn v\u1EC1 {c}\u2026 (Ctrl+Enter \u0111\u1EC3 g\u1EEDi)', { c: code }) });
4900
+ const quote = p && p.quote ? h('div', { class: 'pbx-cm-quote', 'data-testid': 'cm-quote' }, '\xAB' + p.quote + '\xBB', ' ', btn('', { kind: 'ghost', small: true, icon: 'x', title: T('B\u1ECF \u0111o\u1EA1n tr\xEDch'), onClick: () => { CM.pending = null; renderComments(); } })) : null;
4901
+ const send = async (b) => {
4902
+ const text = ta.value.trim(); if (!text) { ta.focus(); return; }
4903
+ b.disabled = true;
4904
+ const r = await api('api/comments/add', { item: code, row: rowSel.value || undefined, quote: p ? p.quote : undefined, text });
4905
+ b.disabled = false;
4906
+ if (!r.ok) { failToast(r); return; }
4907
+ CM.pending = null; ta.value = '';
4908
+ await refreshAll();
4909
+ };
4910
+ const go = btn(T('B\xECnh lu\u1EADn'), { kind: 'primary', small: true, icon: 'message', testid: 'cm-send', onClick: (_e, b) => send(b) });
4911
+ ta.addEventListener('keydown', (e) => { if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) { e.preventDefault(); send(go); } });
4912
+ return h('div', { class: 'pbx-cm-new', 'data-testid': 'cm-new' }, quote, rows.length ? rowSel : null, ta, h('div', { class: 'pb-row' }, h('span', { class: 'pbx-grow' }), go));
4913
+ }
4914
+ function threadCard(t) {
4915
+ const h = C.h; const me = C.me && C.me();
4916
+ const head = (a, name, at, extra) => h('div', { class: 'pbx-cm-head' }, C.P.avatar(a.startsWith('studio:') ? (name || a) : a, { size: 20 }), h('b', null, who(a, name)), h('span', { class: 'pb-small pb-muted' }, C.P.fmt.date(at)), extra || null);
4917
+ const studio = t.source === 'studio' || t.studio ? h('span', { class: 'pb-badge', 'data-tone': 'info', title: T('\u0110\u1ED3ng b\u1ED9 v\u1EDBi Pan Studio') }, 'Studio') : null;
4918
+ const card = h('div', { class: 'pbx-cm', 'data-testid': 'cm-' + t.id, 'data-status': t.status },
4919
+ head(t.author, t.author_name, t.at, studio),
4920
+ CM.scope === 'all' || t.row || t.quote ? h('div', { class: 'pb-row pbx-cm-where' }, CM.scope === 'all' ? C.P.chip(t.item, { docId: C.ST.doc, size: 'sm' }) : null, t.row ? h('span', { class: 'pb-code' }, t.row) : null, t.quote ? h('span', { class: 'pbx-cm-quote' }, '\xAB' + t.quote + '\xBB') : null) : null,
4921
+ h('div', { class: 'pbx-cm-text' }, t.text),
4922
+ ...(t.replies || []).map((r) => h('div', { class: 'pbx-cm-reply', 'data-testid': 'cm-reply' }, head(r.author, r.author_name, r.at), h('div', { class: 'pbx-cm-text' }, r.text))));
4923
+ const replyBox = h('div', { class: 'pbx-cm-replybox', hidden: true });
4924
+ const ta = h('textarea', { class: 'pb-textarea', rows: '2', 'data-testid': 'cm-reply-text', placeholder: T('Tr\u1EA3 l\u1EDDi\u2026') });
4925
+ const sendReply = async (b) => {
4926
+ const text = ta.value.trim(); if (!text) { ta.focus(); return; }
4927
+ b.disabled = true;
4928
+ const r = await api('api/comments/reply', { item: t.item, id: t.id, text });
4929
+ b.disabled = false;
4930
+ if (!r.ok) { failToast(r); return; }
4931
+ await refreshAll();
4932
+ };
4933
+ const sendBtn = btn(T('G\u1EEDi'), { kind: 'primary', small: true, testid: 'cm-reply-send', onClick: (_e, b) => sendReply(b) });
4934
+ ta.addEventListener('keydown', (e) => { if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) { e.preventDefault(); sendReply(sendBtn); } });
4935
+ replyBox.append(ta, h('div', { class: 'pb-row' }, h('span', { class: 'pbx-grow' }), sendBtn));
4936
+ const status = async (s) => { const r = await api('api/comments/status', { item: t.item, id: t.id, status: s }); if (!r.ok) failToast(r); else await refreshAll(); };
4937
+ const acts = h('div', { class: 'pb-row pbx-cm-acts' },
4938
+ btn(T('Tr\u1EA3 l\u1EDDi'), { kind: 'ghost', small: true, icon: 'corner-down-left', testid: 'cm-reply-open', onClick: () => { replyBox.hidden = !replyBox.hidden; if (!replyBox.hidden) ta.focus(); } }),
4939
+ t.status === 'open' ? btn(T('\u0110\xF3ng lu\u1ED3ng'), { kind: 'ghost', small: true, icon: 'check', testid: 'cm-resolve', onClick: () => status('resolved') }) : btn(T('M\u1EDF l\u1EA1i'), { kind: 'ghost', small: true, icon: 'refresh', testid: 'cm-reopen', onClick: () => status('open') }),
4940
+ btn(T('Nh\u1EDD AI'), { kind: 'ghost', small: true, icon: 'sparkles', testid: 'cm-ai', onClick: () => askAi('binh-luan', { comment: { item: t.item, id: t.id }, item: t.item }) }),
4941
+ t.author === me && !t.studio ? btn('', { kind: 'ghost', small: true, icon: 'trash', title: T('Xo\xE1 b\xECnh lu\u1EADn'), testid: 'cm-delete', onClick: async () => { const r = await api('api/comments/delete', { item: t.item, id: t.id }); if (!r.ok) failToast(r); else await refreshAll(); } }) : null);
4942
+ card.append(acts, replyBox);
4943
+ if (t.status === 'resolved') card.appendChild(h('div', { class: 'pb-small pb-muted' }, T('\u0110\xE3 \u0111\xF3ng b\u1EDFi {p}', { p: who(t.resolved_by || '', '') })));
4944
+ return card;
4945
+ }
4946
+ function replyDialog(comment, text) {
4947
+ const h = C.h;
4948
+ const ta = h('textarea', { class: 'pb-textarea', rows: '5', 'data-testid': 'ai-reply-text' }); ta.value = text;
4949
+ C.P.dialog({ title: T('\u0110\u0103ng l\xE0m tr\u1EA3 l\u1EDDi'), size: 'sm', testid: 'ai-reply-dialog', body: ta, actions: [{ label: T('Hu\u1EF7') }, { label: T('\u0110\u0103ng'), kind: 'primary', testid: 'ai-reply-ok', close: false, onClick: async (_e, d) => {
4950
+ const r = await api('api/comments/reply', { item: comment.item, id: comment.id, text: ta.value });
4951
+ if (!r.ok) { failToast(r); return false; }
4952
+ d.close(); await refreshAll(); return false;
4953
+ } }] });
4954
+ }
4955
+ async function syncStudio(b) {
4956
+ b.disabled = true;
4957
+ const r = await api('api/comments/sync', {});
4958
+ b.disabled = false;
4959
+ if (!r.ok) { failToast(r); return; }
4960
+ const x = r.json.report;
4961
+ C.P.toast(T('Studio: k\xE9o v\u1EC1 {a}, \u0111\u1EA9y l\xEAn {b} b\xECnh lu\u1EADn, {c} tr\u1EA3 l\u1EDDi, {d} tr\u1EA1ng th\xE1i.', { a: x.pulled, b: x.pushed, c: x.replies, d: x.statuses }), { kind: 'success' });
4962
+ await refreshAll();
4963
+ }
4964
+ async function refreshAll() {
4965
+ await loadComments();
4966
+ renderComments();
4967
+ if (C.onComments) C.onComments();
4968
+ }
4969
+
4970
+ // ---------------------------------------------------------------- l\u1EC1 \xABXem nh\u01B0 Word\xBB: d\u1EA5u b\xECnh lu\u1EADn + b\xF4i ch\u1EEF \u0111\u1EC3 b\xECnh lu\u1EADn
4971
+ /** Trang Word \u1EDF khung c\xF9ng origin (CSP c\u1EE7a khung kh\xF4ng cho script ch\u1EA1y B\xCAN TRONG \u2014 m\xE3 n\xE0y ch\u1EA1y \u1EDF trang cha, ch\u1EC9 g\u1EAFn DOM). */
4972
+ export function decorateWord(frame) {
4973
+ const doc = frame && frame.contentDocument; if (!doc || !doc.body) return;
4974
+ const M = C.M();
4975
+ doc.querySelectorAll('.pbx-cm-mark,.pbx-cm-float').forEach((x) => x.remove());
4976
+ doc.querySelectorAll('.pbx-cm-row').forEach((x) => x.classList.remove('pbx-cm-row'));
4977
+ if (!doc.getElementById('pbx-cm-style')) {
4978
+ const st = doc.createElement('style'); st.id = 'pbx-cm-style';
4979
+ st.textContent = '.pbx-cm-mark{position:absolute;right:-64px;margin-top:-2px;display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:999px;border:1px solid #f0c36d;background:#fff6db;color:#7a4b00;font:600 12px/1.6 system-ui,sans-serif;cursor:pointer}'
4980
+ + '.pbx-cm-host{position:relative}.pbx-cm-row td{background:#fff6db!important}'
4981
+ + '.pbx-cm-float{position:absolute;z-index:10;padding:6px 12px;border-radius:8px;border:0;background:#1f6feb;color:#fff;font:600 13px/1.4 system-ui,sans-serif;box-shadow:0 4px 14px rgba(0,0,0,.2);cursor:pointer}'
4982
+ + '@media screen and (max-width:900px){.pbx-cm-mark{right:0;top:-22px}}';
4983
+ doc.head.appendChild(st);
4984
+ }
4985
+ for (const [code, n] of Object.entries(CM.counts)) {
4986
+ const hd = doc.getElementById(anchorOf(code)); if (!hd) continue;
4987
+ hd.classList.add('pbx-cm-host');
4988
+ const b = doc.createElement('button'); b.type = 'button'; b.className = 'pbx-cm-mark'; b.dataset.testid = 'word-cm-' + code;
4989
+ b.textContent = T('{n} b\xECnh lu\u1EADn', { n });
4990
+ b.addEventListener('click', (e) => { e.preventDefault(); openComments(code); });
4991
+ hd.appendChild(b);
4992
+ }
4993
+ for (const t of CM.threads) if (t.status === 'open' && t.row) { const tr = doc.getElementById(anchorOf(t.item + '_' + t.row)); if (tr) tr.classList.add('pbx-cm-row'); }
4994
+ if (frame.dataset.cmBound) return;
4995
+ frame.dataset.cmBound = '1';
4996
+ const byAnchor = new Map((C.D().items || []).map((it) => [anchorOf(it.ma), it.ma]));
4997
+ doc.addEventListener('mouseup', () => setTimeout(() => {
4998
+ doc.querySelectorAll('.pbx-cm-float').forEach((x) => x.remove());
4999
+ const sel = doc.getSelection(); const text = sel ? sel.toString().replace(/\\s+/g, ' ').trim() : '';
5000
+ if (!text || !sel.rangeCount) return;
5001
+ const range = sel.getRangeAt(0);
5002
+ // m\u1EE5c: ti\xEAu \u0111\u1EC1 c\xF3 id R_<m\xE3> g\u1EA7n nh\u1EA5t ph\xEDa tr\u01B0\u1EDBc; d\xF2ng: <tr id> ch\u1EE9a ch\u1ED7 ch\u1ECDn
5003
+ let code = null;
5004
+ for (const hd of doc.querySelectorAll('h1[id^="R_"],h2[id^="R_"],h3[id^="R_"],h4[id^="R_"],h5[id^="R_"],h6[id^="R_"]')) {
5005
+ if (!byAnchor.has(hd.id)) continue;
5006
+ if (hd.compareDocumentPosition(range.startContainer) & 4 /* FOLLOWING */ || hd.contains(range.startContainer)) code = byAnchor.get(hd.id); else break;
5007
+ }
5008
+ if (!code) return;
5009
+ const start = range.startContainer.nodeType === 1 ? range.startContainer : range.startContainer.parentElement;
5010
+ const tr = start && start.closest('tr[id^="R_"]');
5011
+ const pre = anchorOf(code) + '_';
5012
+ const row = tr && tr.id.startsWith(pre) ? tr.id.slice(pre.length) : undefined;
5013
+ const rect = range.getBoundingClientRect();
5014
+ const b = doc.createElement('button'); b.type = 'button'; b.className = 'pbx-cm-float'; b.dataset.testid = 'word-cm-add';
5015
+ b.textContent = T('B\xECnh lu\u1EADn');
5016
+ b.style.top = (rect.bottom + doc.defaultView.scrollY + 6) + 'px'; b.style.left = (rect.left + doc.defaultView.scrollX) + 'px';
5017
+ b.addEventListener('mousedown', (e) => e.preventDefault());
5018
+ b.addEventListener('click', (e) => { e.preventDefault(); b.remove(); openComments(code, { item: code, row, quote: text.slice(0, 300) }); });
5019
+ doc.body.appendChild(b);
5020
+ }, 0));
5021
+ }
5022
+
5023
+ // ================================================================ PH\xC1T H\xC0NH L\xCAN STUDIO
5024
+ // C\u1EA3 h\u1ED3 s\u01A1 ho\u1EB7c t\u1EEBng ph\xE2n h\u1EC7; ph\xE1t h\xE0nh l\u1EA1i = ghi \u0111\xE8 \u0111\xFAng t\xE0i li\u1EC7u (m\u1ED7i h\u1ED3 s\u01A1 m\u1ED9t th\u01B0 m\u1EE5c kho tr\xEAn Studio); g\u1EE1 = xo\xE1 c\u1EA3 th\u01B0 m\u1EE5c.
5025
+ const fmtBytes = (n) => (n >= 1048576 ? (n / 1048576).toFixed(1) + ' MB' : Math.max(1, Math.round(n / 1024)) + ' KB');
5026
+ export async function studioDialog() {
5027
+ const h = C.h;
5028
+ const body = h('div', { class: 'pb-stack pbx-st', 'data-testid': 'studio-body' }, C.P.skeleton(3));
5029
+ const dlg = C.P.dialog({ title: T('Ph\xE1t h\xE0nh l\xEAn Pan Studio'), size: 'lg', testid: 'studio-dialog', body, actions: [{ label: T('\u0110\xF3ng') }] });
5030
+ const load = async () => {
5031
+ const r = await api('api/studio?product=' + encodeURIComponent(C.PRODUCT));
5032
+ if (!r.ok) { body.replaceChildren(h('p', { class: 'pb-muted' }, r.json.error || T('Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c tr\u1EA1ng th\xE1i Studio.'))); return; }
5033
+ render(r.json);
5034
+ };
5035
+ const render = (s) => {
5036
+ const head = h('div', { class: 'pbx-st-head' },
5037
+ h('p', { class: 'pb-small pb-muted', style: { margin: 0 } }, T('Ph\xE1t h\xE0nh l\u1EA1i l\xE0 GHI \u0110\xC8 \u0111\xFAng t\xE0i li\u1EC7u c\u0169 tr\xEAn Studio; m\u1ED7i h\u1ED3 s\u01A1 m\u1ED9t th\u01B0 m\u1EE5c kho ri\xEAng \u2014 g\u1EE1 l\xE0 xo\xE1 c\u1EA3 th\u01B0 m\u1EE5c. Ng\u01B0\u1EDDi xem \u0111\u1ECDc v\xE0 b\xECnh lu\u1EADn tr\xEAn studio.dev.pro.vn; b\xECnh lu\u1EADn \u0111\u1ED3ng b\u1ED9 v\u1EC1 \u0111\xE2y.')),
5038
+ h('div', { class: 'pb-row' },
5039
+ h('span', { class: 'pb-badge', 'data-tone': s.login ? 'ok' : 'warn', 'data-testid': 'studio-login' }, s.login ? T('\u0110\xE3 \u0111\u0103ng nh\u1EADp {u}', { u: String(s.apiUrl || '').replace(/^https?:\\/\\//, '') }) : T('Ch\u01B0a \u0111\u0103ng nh\u1EADp Pan Studio')),
5040
+ h('span', { class: 'pb-badge', 'data-tone': s.project ? 'info' : 'neutral', 'data-testid': 'studio-project' }, s.project ? T('G\u1EAFn d\u1EF1 \xE1n thi\u1EBFt k\u1EBF {p}', { p: String(s.project.id).slice(0, 8) }) : T('Ch\u01B0a g\u1EAFn d\u1EF1 \xE1n thi\u1EBFt k\u1EBF \u2014 t\xE0i li\u1EC7u r\u1EDDi'))));
5041
+ const parts = [head];
5042
+ if (!s.login) parts.push(h('p', { class: 'pb-small' }, T('\u0110\u0103ng nh\u1EADp tr\u01B0\u1EDBc: Pan Studio Desktop (g\xF3c tr\xEAn b\xEAn ph\u1EA3i) ho\u1EB7c \xABpan login\xBB. Kh\xF4ng g\u1EEDi g\xEC ra ngo\xE0i khi ch\u01B0a \u0111\u0103ng nh\u1EADp.')));
5043
+ if (s.error) parts.push(h('p', { class: 'pb-small pbx-overdue' }, s.error));
5044
+ if (!s.gate.ok) {
5045
+ const on = btn(T('B\u1EADt ph\xE1t h\xE0nh l\xEAn Studio cho d\u1EF1 \xE1n con n\xE0y'), { kind: 'secondary', icon: 'check', testid: 'studio-enable', onClick: () => {
5046
+ C.P.dialog({ title: T('B\u1EADt ph\xE1t h\xE0nh l\xEAn Studio?'), size: 'sm', testid: 'studio-enable-dialog',
5047
+ body: h('p', null, T('Ghi v\xE0o .panba.yaml (policy.studio: service v\xE0 studio c\u1EE7a d\u1EF1 \xE1n con) \u2014 \u0111\xE2y l\xE0 quy\u1EBFt \u0111\u1ECBnh c\u1EE7a BA Lead. Nh\u1EDB commit thay \u0111\u1ED5i n\xE0y.')),
5048
+ actions: [{ label: T('Hu\u1EF7') }, { label: T('B\u1EADt'), kind: 'primary', testid: 'studio-enable-ok', onClick: async () => { const r = await api('api/studio/enable', {}); if (!r.ok) failToast(r); else { C.P.toast(T('\u0110\xE3 b\u1EADt ph\xE1t h\xE0nh l\xEAn Studio.'), { kind: 'success' }); await load(); } } }] });
5049
+ } });
5050
+ parts.push(h('div', { class: 'pbx-aibanner', 'data-testid': 'studio-gate' }, h('span', null, s.gate.message), on));
5051
+ }
5052
+ for (const d of s.docs) parts.push(docCard(d, s));
5053
+ body.replaceChildren(...parts);
5054
+ };
5055
+ // K\u1EBFt qu\u1EA3 ph\xE1t h\xE0nh g\u1EA7n nh\u1EA5t theo h\u1ED3 s\u01A1: gi\u1EEF qua l\u1EA7n d\u1EF1ng l\u1EA1i th\u1EBB sau load() (tr\u01B0\u1EDBc \u0111\xE2y d\xF2ng \xAB\u0110\xE3 ph\xE1t h\xE0nh\u2026\xBB m\u1EA5t ngay khi t\u1EA3i l\u1EA1i tr\u1EA1ng th\xE1i).
5056
+ const results = new Map();
5057
+ const docCard = (d, s) => {
5058
+ const st = d.studio;
5059
+ const info = st
5060
+ ? h('div', { class: 'pb-row pb-small', 'data-testid': 'studio-info-' + d.doc },
5061
+ h('span', { class: 'pb-badge', 'data-tone': 'ok' }, T('B\u1EA3n {r}', { r: st.revision })), h('span', null, T('{n} t\u1EC7p \xB7 {b}', { n: st.files, b: fmtBytes(st.bytes || 0) })),
5062
+ h('span', { class: 'pb-muted' }, T('c\u1EADp nh\u1EADt {w}', { w: C.P.fmt.date(st.updatedAt) }) + (st.syncedBy ? ' \xB7 ' + st.syncedBy : '')),
5063
+ st.openComments ? h('span', { class: 'pb-badge', 'data-tone': 'warn' }, T('{n} b\xECnh lu\u1EADn m\u1EDF', { n: st.openComments })) : null)
5064
+ : h('p', { class: 'pb-small pb-muted', 'data-testid': 'studio-info-' + d.doc }, T('Ch\u01B0a ph\xE1t h\xE0nh'));
5065
+ const scope = { all: true, modules: new Set() };
5066
+ const radios = h('div', { class: 'pb-seg', role: 'radiogroup', 'data-testid': 'studio-scope-' + d.doc });
5067
+ const modBox = h('div', { class: 'pbx-st-mods', hidden: true });
5068
+ const pdf = h('input', { type: 'checkbox', checked: true, 'data-testid': 'studio-pdf-' + d.doc });
5069
+ const pdfRow = h('label', { class: 'pb-row pb-small' }, pdf, T('K\xE8m b\u1EA3n PDF c\u1EE7a c\u1EA3 h\u1ED3 s\u01A1 (c\u1EA7n Chrome/Edge tr\xEAn m\xE1y)'));
5070
+ const setAll = (v) => {
5071
+ scope.all = v; modBox.hidden = v; pdfRow.hidden = !v;
5072
+ radios.querySelectorAll('button').forEach((b) => b.setAttribute('aria-checked', String((b.dataset.v === 'all') === v)));
5073
+ };
5074
+ for (const [v, l] of [['all', T('C\u1EA3 h\u1ED3 s\u01A1')], ['mods', T('Ch\u1ECDn ph\xE2n h\u1EC7')]]) {
5075
+ const b = h('button', { type: 'button', role: 'radio', 'aria-checked': String(v === 'all'), 'data-v': v, 'data-testid': 'studio-scope-' + d.doc + '-' + v }, l);
5076
+ b.addEventListener('click', () => setAll(v === 'all'));
5077
+ radios.appendChild(b);
5078
+ }
5079
+ for (const m of d.modules) {
5080
+ const cb = h('input', { type: 'checkbox', 'data-testid': 'studio-mod-' + d.doc + '-' + m.code });
5081
+ cb.addEventListener('change', () => { if (cb.checked) scope.modules.add(m.code); else scope.modules.delete(m.code); });
5082
+ modBox.appendChild(h('label', { class: 'pb-row pb-small' }, cb, h('span', { class: 'pb-code' }, m.code), m.name));
5083
+ }
5084
+ const result = results.get(d.doc) || h('div', { class: 'pb-small', 'data-testid': 'studio-result-' + d.doc });
5085
+ results.set(d.doc, result);
5086
+ const go = btn(T('Ph\xE1t h\xE0nh'), { kind: 'primary', icon: 'upload', testid: 'studio-publish-' + d.doc, disabled: !s.login || !s.gate.ok, onClick: async (_e, b) => {
5087
+ const modules = scope.all ? [] : [...scope.modules];
5088
+ if (!scope.all && !modules.length) { C.P.toast(T('Ch\u1ECDn \xEDt nh\u1EA5t m\u1ED9t ph\xE2n h\u1EC7.'), { kind: 'warn' }); return; }
5089
+ b.disabled = true;
5090
+ result.replaceChildren(h('span', { class: 'pb-muted' }, T('\u0110ang ph\xE1t h\xE0nh\u2026 (l\u1EA7n \u0111\u1EA7u t\u1EA3i l\xEAn h\u1EBFt; c\xE1c l\u1EA7n sau ch\u1EC9 t\u1EA3i t\u1EC7p \u0111\u1ED5i)')));
5091
+ const r = await api('api/studio/publish', { doc: d.doc, modules, pdf: scope.all && pdf.checked });
5092
+ b.disabled = false;
5093
+ if (!r.ok) { result.replaceChildren(h('span', { class: 'pbx-overdue' }, r.json.error || T('Kh\xF4ng ph\xE1t h\xE0nh \u0111\u01B0\u1EE3c.'))); return; }
5094
+ const x = r.json.result;
5095
+ result.replaceChildren(h('span', null, T('\u0110\xE3 ph\xE1t h\xE0nh b\u1EA3n {r}: t\u1EA3i l\xEAn {u} t\u1EC7p, gi\u1EEF {k} t\u1EC7p kh\xF4ng \u0111\u1ED5i.', { r: x.revision, u: x.uploaded, k: x.unchanged }) + (Array.isArray(x.scope) ? ' ' + T('Ph\xE2n h\u1EC7 {m}; gi\u1EEF {n} b\xE0i c\u1EE7a ph\xE2n h\u1EC7 kh\xE1c nh\u01B0 tr\xEAn Studio.', { m: x.scope.join(', '), n: x.kept }) : '')), ' ',
5096
+ h('a', { href: r.json.web, target: '_blank', rel: 'noopener', 'data-testid': 'studio-open-' + d.doc }, T('M\u1EDF tr\xEAn Studio')));
5097
+ C.P.toast(T('\u0110\xE3 ph\xE1t h\xE0nh {d} l\xEAn Studio.', { d: d.doc }), { kind: 'success' });
5098
+ await loadComments().catch(() => {}); renderComments();
5099
+ await load();
5100
+ } });
5101
+ const remove = st ? btn(T('G\u1EE1 kh\u1ECFi Studio'), { kind: 'ghost', icon: 'trash', testid: 'studio-remove-' + d.doc, onClick: () => {
5102
+ C.P.dialog({ title: T('G\u1EE1 {d} kh\u1ECFi Studio?', { d: d.doc }), size: 'sm', testid: 'studio-remove-dialog',
5103
+ body: h('p', null, T('Xo\xE1 t\xE0i li\u1EC7u tr\xEAn Studio c\xF9ng c\u1EA3 th\u01B0 m\u1EE5c kho c\u1EE7a n\xF3. B\xECnh lu\u1EADn tr\xEAn Studio m\u1EA5t theo \u2014 \u0111\u1ED3ng b\u1ED9 b\xECnh lu\u1EADn v\u1EC1 repo tr\u01B0\u1EDBc n\u1EBFu c\u1EA7n. Repo kh\xF4ng \u0111\u1ED5i.')),
5104
+ actions: [{ label: T('Hu\u1EF7') }, { label: T('G\u1EE1'), kind: 'danger', testid: 'studio-remove-ok', onClick: async () => { const r = await api('api/studio/remove', { doc: d.doc }); if (!r.ok) failToast(r); else { C.P.toast(T('\u0110\xE3 g\u1EE1 {d} ({n} t\u1EC7p).', { d: d.doc, n: r.json.result.objects }), { kind: 'success' }); await load(); } } }] });
5105
+ } }) : null;
5106
+ const open = d.web ? h('a', { class: 'pb-btn pb-btn--ghost', href: d.web, target: '_blank', rel: 'noopener', 'data-testid': 'studio-web-' + d.doc }, T('M\u1EDF tr\xEAn Studio')) : null;
5107
+ return h('section', { class: 'pb-card pbx-item', 'data-testid': 'studio-doc-' + d.doc },
5108
+ h('div', { class: 'pbx-item__head' }, h('span', { class: 'pb-code' }, d.doc), h('b', null, d.title), h('span', { class: 'pbx-grow' }), open, remove),
5109
+ info, h('div', { class: 'pb-row' }, radios), modBox, pdfRow, h('div', { class: 'pb-row' }, go), result);
5110
+ };
5111
+ await load();
5112
+ return dlg;
5113
+ }
5114
+
5115
+ // ================================================================ NH\u1EACP T\xC0I LI\u1EC6U WORD C\u0168 (kh\xF4ng c\u1EA7n d\xF2ng l\u1EC7nh)
5116
+ function fileB64(f) { return new Promise((ok, no) => { const r = new FileReader(); r.onload = () => ok(String(r.result).split(',')[1] || ''); r.onerror = () => no(r.error); r.readAsDataURL(f); }); }
5117
+ export function importDialog() {
5118
+ const h = C.h; const D = C.D();
5119
+ const file = h('input', { type: 'file', accept: '.docx', 'data-testid': 'imp-file' });
5120
+ const mods = (D.modules || []).filter((m) => m.ma !== 'CHUNG');
5121
+ const modSel = h('select', { class: 'pb-select', 'data-testid': 'imp-module' }, [h('option', { value: '' }, T('\u2014 Ch\u1ECDn ph\xE2n h\u1EC7 \u2014'))].concat(mods.map((m) => h('option', { value: m.ma, selected: m.ma === C.ST.mod || null }, m.ma + ' \xB7 ' + m.ten)), [h('option', { value: '__new' }, T('Ph\xE2n h\u1EC7 m\u1EDBi\u2026'))]));
5122
+ const newCode = h('input', { class: 'pb-input', placeholder: T('M\xE3 ph\xE2n h\u1EC7 (ch\u1EEF hoa, vd QLTS)'), 'data-testid': 'imp-new-code' });
5123
+ const newName = h('input', { class: 'pb-input', placeholder: T('T\xEAn ph\xE2n h\u1EC7'), 'data-testid': 'imp-new-name' });
5124
+ const newBox = h('div', { class: 'pb-row', hidden: true }, newCode, newName);
5125
+ modSel.addEventListener('change', () => { newBox.hidden = modSel.value !== '__new'; });
5126
+ const docSel = h('select', { class: 'pb-select', 'data-testid': 'imp-doc' }, [h('option', { value: '' }, T('Kh\xF4ng g\u1EAFn h\u1ED3 s\u01A1'))].concat((D.docs || []).map((d) => h('option', { value: d.ma, selected: d.ma === C.ST.doc || null }, d.ma))));
5127
+ const out = h('div', { class: 'pb-stack', 'data-testid': 'imp-report' });
5128
+ let last = null;
5129
+ const body = h('div', { class: 'pb-stack' },
5130
+ h('p', { class: 'pb-small pb-muted', style: { margin: 0 } }, T('\u0110\u1ECDc t\u1EC7p .docx (Word c\u0169 th\xEC L\u01B0u th\xE0nh .docx tr\u01B0\u1EDBc): nh\u1EADn d\u1EA1ng m\xE0n, ch\u1EE9c n\u0103ng, quy tr\xECnh, danh m\u1EE5c theo khu\xF4n; c\u1EA5p m\xE3 m\u1EDBi; \u0111\u1ED5i \xABm\u1EE5c x.y.z\xBB th\xE0nh [[M\xC3]]; comment Word th\xE0nh m\u1EE5c ch\u1EDD. M\u1ECDi m\u1EE5c \u1EDF tr\u1EA1ng th\xE1i \xABNh\u1EADp t\u1EEB Word\xBB \u0111\u1EC3 BA r\xE0 t\u1EEBng m\u1EE5c.')),
5131
+ h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('T\u1EC7p Word')), file),
5132
+ h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('V\xE0o ph\xE2n h\u1EC7')), modSel), newBox,
5133
+ h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('G\u1EAFn v\xE0o h\u1ED3 s\u01A1 (\u0111\u1EC3 s\u1ED1 m\u1EE5c c\u0169 tra \u0111\u01B0\u1EE3c)')), docSel), out);
5134
+ const payload = async (dryRun) => {
5135
+ const f = file.files && file.files[0];
5136
+ if (!f) { C.P.toast(T('Ch\u1ECDn t\u1EC7p .docx.'), { kind: 'warn' }); return null; }
5137
+ const isNew = modSel.value === '__new';
5138
+ const module = isNew ? newCode.value.trim().toUpperCase() : modSel.value;
5139
+ if (!module) { C.P.toast(T('Ch\u1ECDn ph\xE2n h\u1EC7.'), { kind: 'warn' }); return null; }
5140
+ return { name: f.name, data: await fileB64(f), module, moduleName: isNew ? newName.value.trim() : undefined, doc: docSel.value || undefined, dryRun };
5141
+ };
5142
+ const show = (r) => {
5143
+ const x = r.report;
5144
+ const items = Object.entries(x.items || {}).map(([k, n]) => n + ' ' + k).join(', ') || '0';
5145
+ out.replaceChildren(
5146
+ h('div', { class: 'pbx-aibanner' }, h('span', null, (r.dryRun ? T('Xem tr\u01B0\u1EDBc: ') : T('\u0110\xE3 nh\u1EADp: ')) + T('{i} m\u1EE5c; tham chi\u1EBFu kh\u1EDBp {ok}, kh\xF4ng kh\u1EDBp {bad}; {c} comment \u2192 m\u1EE5c ch\u1EDD.', { i: items, ok: x.refs.matched, bad: x.refs.unmatched.length, c: x.comments || 0 }))),
5147
+ x.refs.unmatched.length ? h('div', { class: 'pb-small pb-muted' }, T('Kh\xF4ng kh\u1EDBp (r\xE0 \u1EDF Ki\u1EC3m tra W03): ') + x.refs.unmatched.slice(0, 8).join('; ')) : null,
5148
+ x.skipped && x.skipped.length ? h('div', { class: 'pb-small pb-muted' }, T('B\u1ECF qua: ') + x.skipped.slice(0, 6).join('; ')) : null,
5149
+ x.unscoped ? h('div', { class: 'pb-small pbx-overdue' }, T('Ph\xE2n h\u1EC7 ch\u01B0a thu\u1ED9c h\u1ED3 s\u01A1 n\xE0o \u2014 ch\u1ECDn h\u1ED3 s\u01A1 \u0111\u1EC3 m\u1EE5c c\xF3 s\u1ED1.')) : null);
5150
+ };
5151
+ C.P.dialog({ title: T('Nh\u1EADp t\xE0i li\u1EC7u Word c\u0169'), size: 'md', testid: 'import-dialog', body, actions: [
5152
+ { label: T('\u0110\xF3ng') },
5153
+ { label: T('Xem tr\u01B0\u1EDBc'), testid: 'imp-preview', close: false, onClick: async () => { const p = await payload(true); if (!p) return false; const r = await api('api/import', p); if (!r.ok) { failToast(r); return false; } last = p; show(r.json); return false; } },
5154
+ { label: T('Nh\u1EADp'), kind: 'primary', testid: 'imp-run', close: false, onClick: async (_e, d) => {
5155
+ const p = await payload(false); if (!p) return false;
5156
+ if (!last) { const pre = await api('api/import', Object.assign({}, p, { dryRun: true })); if (!pre.ok) { failToast(pre); return false; } show(pre.json); last = p; return false; }
5157
+ const r = await api('api/import', p);
5158
+ if (!r.ok) { failToast(r); return false; }
5159
+ show(r.json); C.P.toast(T('\u0110\xE3 nh\u1EADp {n} t\u1EC7p \u2014 r\xE0 t\u1EEBng m\u1EE5c r\u1ED3i commit \u1EDF thanh git.', { n: r.json.files.length }), { kind: 'success' });
5160
+ await C.reload(); d.close(); return false;
5161
+ } },
5162
+ ] });
5163
+ }
5164
+ `,"edit.js":`// Pan Test \u2014 \`api\` cho khung Tr\u1EE3 l\xFD ch\xE9p t\u1EEB Pan BA (assist.js import { api } from './edit.js'): token phi\xEAn c\u1EE7a Pan Test.
5165
+ const TOKEN = (document.querySelector('meta[name="pantest-token"]') || {}).content || '';
5166
+ export async function api(path, body) {
5167
+ const res = await fetch(path, body === undefined ? { headers: { accept: 'application/json' } }
5168
+ : { method: 'POST', headers: { 'content-type': 'application/json', 'x-pan-test-token': TOKEN }, body: JSON.stringify(body) });
5169
+ let json = {};
5170
+ try { json = await res.json(); } catch { /* kh\xF4ng ph\u1EA3i JSON */ }
5171
+ return { status: res.status, ok: res.ok && json.ok !== false, json };
5172
+ }
5173
+ `}});function un(e,t={}){Wc&&!t.pin||(Kc=e==="en"?"en":"vi",t.pin&&(Wc=!0))}var Kc,Wc,U,qn=Se(()=>{"use strict";S();Kc="vi",Wc=!1;U=(e,t)=>Kc==="en"?t:e});var et,Gc,zc,hn,si=Se(()=>{"use strict";S();et=["not-run","passed","failed","blocked","skipped"],Gc=["functional","non-functional"],zc=["drafting","done","deleted"],hn=["high","medium","low"]});function db(){let e=globalThis.crypto;return e?.getRandomValues?e.getRandomValues(new Uint32Array(1))[0]/2**32:Math.random()}function mn(e,t,n,r=db){for(;;){let i="";for(let a=0;a<6;a++)i+=Vc[Math.floor(r()*Vc.length)];if(!/[A-Z]/.test(i))continue;let s=`${e}-${t}-${i}`;if(!n.has(s))return s}}var Vc,ai,oi,li,fn=Se(()=>{"use strict";S();Vc="ABCDEFGHJKMNPQRSTUVWXYZ23456789",ai=/^[A-Z][A-Z0-9]{1,11}$/,oi=/^KB-([A-Z][A-Z0-9]{1,11})-([A-Z0-9]{6})$/,li=/^TC-([A-Z][A-Z0-9]{1,11})-([A-Z0-9]{6})$/});var X=B(xe=>{"use strict";S();var ua=Symbol.for("yaml.alias"),Xc=Symbol.for("yaml.document"),ci=Symbol.for("yaml.map"),Yc=Symbol.for("yaml.pair"),ha=Symbol.for("yaml.scalar"),di=Symbol.for("yaml.seq"),ht=Symbol.for("yaml.node.type"),pb=e=>!!e&&typeof e=="object"&&e[ht]===ua,ub=e=>!!e&&typeof e=="object"&&e[ht]===Xc,hb=e=>!!e&&typeof e=="object"&&e[ht]===ci,mb=e=>!!e&&typeof e=="object"&&e[ht]===Yc,Jc=e=>!!e&&typeof e=="object"&&e[ht]===ha,fb=e=>!!e&&typeof e=="object"&&e[ht]===di;function Qc(e){if(e&&typeof e=="object")switch(e[ht]){case ci:case di:return!0}return!1}function gb(e){if(e&&typeof e=="object")switch(e[ht]){case ua:case ci:case ha:case di:return!0}return!1}var bb=e=>(Jc(e)||Qc(e))&&!!e.anchor;xe.ALIAS=ua;xe.DOC=Xc;xe.MAP=ci;xe.NODE_TYPE=ht;xe.PAIR=Yc;xe.SCALAR=ha;xe.SEQ=di;xe.hasAnchor=bb;xe.isAlias=pb;xe.isCollection=Qc;xe.isDocument=ub;xe.isMap=hb;xe.isNode=gb;xe.isPair=mb;xe.isScalar=Jc;xe.isSeq=fb});var Hn=B(ma=>{"use strict";S();var me=X(),Ne=Symbol("break visit"),Zc=Symbol("skip children"),tt=Symbol("remove node");function pi(e,t){let n=ed(t);me.isDocument(e)?gn(null,e.contents,n,Object.freeze([e]))===tt&&(e.contents=null):gn(null,e,n,Object.freeze([]))}pi.BREAK=Ne;pi.SKIP=Zc;pi.REMOVE=tt;function gn(e,t,n,r){let i=td(e,t,n,r);if(me.isNode(i)||me.isPair(i))return nd(e,r,i),gn(e,i,n,r);if(typeof i!="symbol"){if(me.isCollection(t)){r=Object.freeze(r.concat(t));for(let s=0;s<t.items.length;++s){let a=gn(s,t.items[s],n,r);if(typeof a=="number")s=a-1;else{if(a===Ne)return Ne;a===tt&&(t.items.splice(s,1),s-=1)}}}else if(me.isPair(t)){r=Object.freeze(r.concat(t));let s=gn("key",t.key,n,r);if(s===Ne)return Ne;s===tt&&(t.key=null);let a=gn("value",t.value,n,r);if(a===Ne)return Ne;a===tt&&(t.value=null)}}return i}async function ui(e,t){let n=ed(t);me.isDocument(e)?await bn(null,e.contents,n,Object.freeze([e]))===tt&&(e.contents=null):await bn(null,e,n,Object.freeze([]))}ui.BREAK=Ne;ui.SKIP=Zc;ui.REMOVE=tt;async function bn(e,t,n,r){let i=await td(e,t,n,r);if(me.isNode(i)||me.isPair(i))return nd(e,r,i),bn(e,i,n,r);if(typeof i!="symbol"){if(me.isCollection(t)){r=Object.freeze(r.concat(t));for(let s=0;s<t.items.length;++s){let a=await bn(s,t.items[s],n,r);if(typeof a=="number")s=a-1;else{if(a===Ne)return Ne;a===tt&&(t.items.splice(s,1),s-=1)}}}else if(me.isPair(t)){r=Object.freeze(r.concat(t));let s=await bn("key",t.key,n,r);if(s===Ne)return Ne;s===tt&&(t.key=null);let a=await bn("value",t.value,n,r);if(a===Ne)return Ne;a===tt&&(t.value=null)}}return i}function ed(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function td(e,t,n,r){if(typeof n=="function")return n(e,t,r);if(me.isMap(t))return n.Map?.(e,t,r);if(me.isSeq(t))return n.Seq?.(e,t,r);if(me.isPair(t))return n.Pair?.(e,t,r);if(me.isScalar(t))return n.Scalar?.(e,t,r);if(me.isAlias(t))return n.Alias?.(e,t,r)}function nd(e,t,n){let r=t[t.length-1];if(me.isCollection(r))r.items[e]=n;else if(me.isPair(r))e==="key"?r.key=n:r.value=n;else if(me.isDocument(r))r.contents=n;else{let i=me.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}ma.visit=pi;ma.visitAsync=ui});var fa=B(id=>{"use strict";S();var rd=X(),vb=Hn(),wb={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},yb=e=>e.replace(/[!,[\]{}]/g,t=>wb[t]),Un=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[s,a]=r;return this.tags[s]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let a=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,a),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let a=t.slice(2,-1);return a==="!"||a==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),a)}let[,r,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);let s=this.tags[r];if(s)try{return s+decodeURIComponent(i)}catch(a){return n(String(a)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+yb(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(t&&r.length>0&&rd.isNode(t.contents)){let s={};vb.visit(t.contents,(a,o)=>{rd.isNode(o)&&o.tag&&(s[o.tag]=!0)}),i=Object.keys(s)}else i=[];for(let[s,a]of r)s==="!!"&&a==="tag:yaml.org,2002:"||(!t||i.some(o=>o.startsWith(a)))&&n.push(`%TAG ${s} ${a}`);return n.join(`
5174
+ `)}};Un.defaultYaml={explicit:!1,version:"1.2"};Un.defaultTags={"!!":"tag:yaml.org,2002:"};id.Directives=Un});var hi=B(jn=>{"use strict";S();var sd=X(),xb=Hn();function kb(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function ad(e){let t=new Set;return xb.visit(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function od(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function Tb(e,t){let n=[],r=new Map,i=null;return{onAnchor:s=>{n.push(s),i??(i=ad(e));let a=od(t,i);return i.add(a),a},setAnchors:()=>{for(let s of n){let a=r.get(s);if(typeof a=="object"&&a.anchor&&(sd.isScalar(a.node)||sd.isCollection(a.node)))a.node.anchor=a.anchor;else{let o=new Error("Failed to resolve repeated object (this should not happen)");throw o.source=s,o}}},sourceObjects:r}}jn.anchorIsValid=kb;jn.anchorNames=ad;jn.createNodeAnchors=Tb;jn.findNewAnchor=od});var ga=B(ld=>{"use strict";S();function Wn(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,s=r.length;i<s;++i){let a=r[i],o=Wn(e,r,String(i),a);o===void 0?delete r[i]:o!==a&&(r[i]=o)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let s=r.get(i),a=Wn(e,r,i,s);a===void 0?r.delete(i):a!==s&&r.set(i,a)}else if(r instanceof Set)for(let i of Array.from(r)){let s=Wn(e,r,i,i);s===void 0?r.delete(i):s!==i&&(r.delete(i),r.add(s))}else for(let[i,s]of Object.entries(r)){let a=Wn(e,r,i,s);a===void 0?delete r[i]:a!==s&&(r[i]=a)}return e.call(t,n,r)}ld.applyReviver=Wn});var Nt=B(dd=>{"use strict";S();var Sb=X();function cd(e,t,n){if(Array.isArray(e))return e.map((r,i)=>cd(r,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!Sb.hasAnchor(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=s=>{r.res=s,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e=="bigint"&&!n?.keep?Number(e):e}dd.toJS=cd});var mi=B(ud=>{"use strict";S();var Cb=ga(),pd=X(),Eb=Nt(),ba=class{constructor(t){Object.defineProperty(this,pd.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:s}={}){if(!pd.isDocument(t))throw new TypeError("A document argument is required");let a={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},o=Eb.toJS(this,"",a);if(typeof i=="function")for(let{count:c,res:l}of a.anchors.values())i(l,c);return typeof s=="function"?Cb.applyReviver(s,{"":o},"",o):o}};ud.NodeBase=ba});var Kn=B(hd=>{"use strict";S();var Ab=hi(),_b=Hn(),vn=X(),Nb=mi(),Pb=Nt(),va=class extends Nb.NodeBase{constructor(t){super(vn.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],_b.visit(t,{Node:(s,a)=>{(vn.isAlias(a)||vn.hasAnchor(a))&&r.push(a)}}),n&&(n.aliasResolveCache=r));let i;for(let s of r){if(s===this)break;s.anchor===this.source&&(i=s)}return i}toJSON(t,n){if(!n)return{source:this.source};let{anchors:r,doc:i,maxAliasCount:s}=n,a=this.resolve(i,n);if(!a){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let o=r.get(a);if(o||(Pb.toJS(a,null,n),o=r.get(a)),o?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=fi(i,a,r)),o.count*o.aliasCount>s)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return o.res}toString(t,n,r){let i=`*${this.source}`;if(t){if(Ab.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(t.implicitKey)return`${i} `}return i}};function fi(e,t,n){if(vn.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(vn.isCollection(t)){let r=0;for(let i of t.items){let s=fi(e,i,n);s>r&&(r=s)}return r}else if(vn.isPair(t)){let r=fi(e,t.key,n),i=fi(e,t.value,n);return Math.max(r,i)}return 1}hd.Alias=va});var pe=B(wa=>{"use strict";S();var Ib=X(),Ob=mi(),Rb=Nt(),Lb=e=>!e||typeof e!="function"&&typeof e!="object",Pt=class extends Ob.NodeBase{constructor(t){super(Ib.SCALAR),this.value=t}toJSON(t,n){return n?.keep?this.value:Rb.toJS(this.value,t,n)}toString(){return String(this.value)}};Pt.BLOCK_FOLDED="BLOCK_FOLDED";Pt.BLOCK_LITERAL="BLOCK_LITERAL";Pt.PLAIN="PLAIN";Pt.QUOTE_DOUBLE="QUOTE_DOUBLE";Pt.QUOTE_SINGLE="QUOTE_SINGLE";wa.Scalar=Pt;wa.isScalarValue=Lb});var Gn=B(fd=>{"use strict";S();var Mb=Kn(),Gt=X(),md=pe(),Db="tag:yaml.org,2002:";function Bb(e,t,n){if(t){let r=n.filter(s=>s.tag===t),i=r.find(s=>!s.format)??r[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(r=>r.identify?.(e)&&!r.format)}function $b(e,t,n){if(Gt.isDocument(e)&&(e=e.contents),Gt.isNode(e))return e;if(Gt.isPair(e)){let d=n.schema[Gt.MAP].createNode?.(n.schema,null,n);return d.items.push(e),d}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:s,schema:a,sourceObjects:o}=n,c;if(r&&e&&typeof e=="object"){if(c=o.get(e),c)return c.anchor??(c.anchor=i(e)),new Mb.Alias(c.anchor);c={anchor:null,node:null},o.set(e,c)}t?.startsWith("!!")&&(t=Db+t.slice(2));let l=Bb(e,t,a.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let d=new md.Scalar(e);return c&&(c.node=d),d}l=e instanceof Map?a[Gt.MAP]:Symbol.iterator in Object(e)?a[Gt.SEQ]:a[Gt.MAP]}s&&(s(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,e,n):new md.Scalar(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}fd.createNode=$b});var bi=B(gi=>{"use strict";S();var Fb=Gn(),nt=X(),qb=mi();function ya(e,t,n){let r=n;for(let i=t.length-1;i>=0;--i){let s=t[i];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let a=[];a[s]=r,r=a}else r=new Map([[s,r]])}return Fb.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var gd=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,xa=class extends qb.NodeBase{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(r=>nt.isNode(r)||nt.isPair(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(gd(t))this.add(n);else{let[r,...i]=t,s=this.get(r,!0);if(nt.isCollection(s))s.addIn(i,n);else if(s===void 0&&this.schema)this.set(r,ya(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(t){let[n,...r]=t;if(r.length===0)return this.delete(n);let i=this.get(n,!0);if(nt.isCollection(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){let[r,...i]=t,s=this.get(r,!0);return i.length===0?!n&&nt.isScalar(s)?s.value:s:nt.isCollection(s)?s.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!nt.isPair(n))return!1;let r=n.value;return r==null||t&&nt.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){let[n,...r]=t;if(r.length===0)return this.has(n);let i=this.get(n,!0);return nt.isCollection(i)?i.hasIn(r):!1}setIn(t,n){let[r,...i]=t;if(i.length===0)this.set(r,n);else{let s=this.get(r,!0);if(nt.isCollection(s))s.setIn(i,n);else if(s===void 0&&this.schema)this.set(r,ya(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};gi.Collection=xa;gi.collectionFromPath=ya;gi.isEmptyPath=gd});var zn=B(vi=>{"use strict";S();var Hb=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function ka(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Ub=(e,t,n)=>e.endsWith(`
5175
+ `)?ka(n,t):n.includes(`
4120
5176
  `)?`
4121
- `+sa(n,t):(e.endsWith(" ")?"":" ")+n;ei.indentComment=sa;ei.lineComment=Zg;ei.stringifyComment=Qg});var Vc=B(Dn=>{"use strict";E();var eb="flow",aa="block",ti="quoted";function tb(e,t,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:s=20,onFold:a,onOverflow:o}={}){if(!i||i<0)return e;i<s&&(s=0);let l=Math.max(1+s,1+i-t.length);if(e.length<=l)return e;let c=[],d={},p=i-t.length;typeof r=="number"&&(r>i-Math.max(2,s)?c.push(0):p=i-r);let u,f,m=!1,h=-1,g=-1,v=-1;n===aa&&(h=zc(e,h,t.length),h!==-1&&(p=h+l));for(let b;b=e[h+=1];){if(n===ti&&b==="\\"){switch(g=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}v=h}if(b===`
4122
- `)n===aa&&(h=zc(e,h,t.length)),p=h+t.length+l,u=void 0;else{if(b===" "&&f&&f!==" "&&f!==`
4123
- `&&f!==" "){let C=e[h+1];C&&C!==" "&&C!==`
4124
- `&&C!==" "&&(u=h)}if(h>=p)if(u)c.push(u),p=u+l,u=void 0;else if(n===ti){for(;f===" "||f===" ";)f=b,b=e[h+=1],m=!0;let C=h>v+1?h-2:g-1;if(d[C])return e;c.push(C),d[C]=!0,p=C+l,u=void 0}else m=!0}f=b}if(m&&o&&o(),c.length===0)return e;a&&a();let w=e.slice(0,c[0]);for(let b=0;b<c.length;++b){let C=c[b],A=c[b+1]||e.length;C===0?w=`
4125
- ${t}${e.slice(0,A)}`:(n===ti&&d[C]&&(w+=`${e[C]}\\`),w+=`
4126
- ${t}${e.slice(C+1,A)}`)}return w}function zc(e,t,n){let r=t,i=t+1,s=e[i];for(;s===" "||s===" ";)if(t<i+n)s=e[++t];else{do s=e[++t];while(s&&s!==`
4127
- `);r=t,i=t+1,s=e[i]}return r}Dn.FOLD_BLOCK=aa;Dn.FOLD_FLOW=eb;Dn.FOLD_QUOTED=ti;Dn.foldFlowLines=tb});var $n=B(Xc=>{"use strict";E();var Ue=ce(),Tt=Vc(),ri=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),ii=e=>/^(%|---|\.\.\.)/m.test(e);function nb(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let s=0,a=0;s<i;++s)if(e[s]===`
4128
- `){if(s-a>r)return!0;if(a=s+1,i-a<=r)return!1}return!0}function Bn(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,s=t.indent||(ii(e)?" ":""),a="",o=0;for(let l=0,c=n[l];c;c=n[++l])if(c===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(a+=n.slice(o,l)+"\\ ",l+=1,o=l,c="\\"),c==="\\")switch(n[l+1]){case"u":{a+=n.slice(o,l);let d=n.substr(l+2,4);switch(d){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:d.substr(0,2)==="00"?a+="\\x"+d.substr(2):a+=n.substr(l,6)}l+=5,o=l+1}break;case"n":if(r||n[l+2]==='"'||n.length<i)l+=1;else{for(a+=n.slice(o,l)+`
4129
-
4130
- `;n[l+2]==="\\"&&n[l+3]==="n"&&n[l+4]!=='"';)a+=`
4131
- `,l+=2;a+=s,n[l+2]===" "&&(a+="\\"),l+=1,o=l+1}break;default:l+=1}return a=o?a+n.slice(o):n,r?a:Tt.foldFlowLines(a,s,Tt.FOLD_QUOTED,ri(t,!1))}function oa(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
4132
- `)||/[ \t]\n|\n[ \t]/.test(e))return Bn(e,t);let n=t.indent||(ii(e)?" ":""),r="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
4133
- ${n}`)+"'";return t.implicitKey?r:Tt.foldFlowLines(r,n,Tt.FOLD_FLOW,ri(t,!1))}function ln(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=Bn;else{let i=e.includes('"'),s=e.includes("'");i&&!s?r=oa:s&&!i?r=Bn:r=n?oa:Bn}return r(e,t)}var la;try{la=new RegExp(`(^|(?<!
5177
+ `+ka(n,t):(e.endsWith(" ")?"":" ")+n;vi.indentComment=ka;vi.lineComment=Ub;vi.stringifyComment=Hb});var vd=B(Vn=>{"use strict";S();var jb="flow",Ta="block",wi="quoted";function Wb(e,t,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:s=20,onFold:a,onOverflow:o}={}){if(!i||i<0)return e;i<s&&(s=0);let c=Math.max(1+s,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r=="number"&&(r>i-Math.max(2,s)?l.push(0):d=i-r);let p,h,f=!1,m=-1,g=-1,y=-1;n===Ta&&(m=bd(e,m,t.length),m!==-1&&(d=m+c));for(let b;b=e[m+=1];){if(n===wi&&b==="\\"){switch(g=m,e[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}y=m}if(b===`
5178
+ `)n===Ta&&(m=bd(e,m,t.length)),d=m+t.length+c,p=void 0;else{if(b===" "&&h&&h!==" "&&h!==`
5179
+ `&&h!==" "){let C=e[m+1];C&&C!==" "&&C!==`
5180
+ `&&C!==" "&&(p=m)}if(m>=d)if(p)l.push(p),d=p+c,p=void 0;else if(n===wi){for(;h===" "||h===" ";)h=b,b=e[m+=1],f=!0;let C=m>y+1?m-2:g-1;if(u[C])return e;l.push(C),u[C]=!0,d=C+c,p=void 0}else f=!0}h=b}if(f&&o&&o(),l.length===0)return e;a&&a();let T=e.slice(0,l[0]);for(let b=0;b<l.length;++b){let C=l[b],_=l[b+1]||e.length;C===0?T=`
5181
+ ${t}${e.slice(0,_)}`:(n===wi&&u[C]&&(T+=`${e[C]}\\`),T+=`
5182
+ ${t}${e.slice(C+1,_)}`)}return T}function bd(e,t,n){let r=t,i=t+1,s=e[i];for(;s===" "||s===" ";)if(t<i+n)s=e[++t];else{do s=e[++t];while(s&&s!==`
5183
+ `);r=t,i=t+1,s=e[i]}return r}Vn.FOLD_BLOCK=Ta;Vn.FOLD_FLOW=jb;Vn.FOLD_QUOTED=wi;Vn.foldFlowLines=Wb});var Yn=B(wd=>{"use strict";S();var We=pe(),It=vd(),xi=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),ki=e=>/^(%|---|\.\.\.)/m.test(e);function Kb(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let s=0,a=0;s<i;++s)if(e[s]===`
5184
+ `){if(s-a>r)return!0;if(a=s+1,i-a<=r)return!1}return!0}function Xn(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,s=t.indent||(ki(e)?" ":""),a="",o=0;for(let c=0,l=n[c];l;l=n[++c])if(l===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(a+=n.slice(o,c)+"\\ ",c+=1,o=c,l="\\"),l==="\\")switch(n[c+1]){case"u":{a+=n.slice(o,c);let u=n.substr(c+2,4);switch(u){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:u.substr(0,2)==="00"?a+="\\x"+u.substr(2):a+=n.substr(c,6)}c+=5,o=c+1}break;case"n":if(r||n[c+2]==='"'||n.length<i)c+=1;else{for(a+=n.slice(o,c)+`
5185
+
5186
+ `;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)a+=`
5187
+ `,c+=2;a+=s,n[c+2]===" "&&(a+="\\"),c+=1,o=c+1}break;default:c+=1}return a=o?a+n.slice(o):n,r?a:It.foldFlowLines(a,s,It.FOLD_QUOTED,xi(t,!1))}function Sa(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
5188
+ `)||/[ \t]\n|\n[ \t]/.test(e))return Xn(e,t);let n=t.indent||(ki(e)?" ":""),r="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
5189
+ ${n}`)+"'";return t.implicitKey?r:It.foldFlowLines(r,n,It.FOLD_FLOW,xi(t,!1))}function wn(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=Xn;else{let i=e.includes('"'),s=e.includes("'");i&&!s?r=Sa:s&&!i?r=Xn:r=n?Sa:Xn}return r(e,t)}var Ca;try{Ca=new RegExp(`(^|(?<!
4134
5190
  ))
4135
5191
  +(?!
4136
- |$)`,"g")}catch{la=/\n+(?!\n|$)/g}function ni({comment:e,type:t,value:n},r,i,s){let{blockQuote:a,commentString:o,lineWidth:l}=r.options;if(!a||/\n[\t ]+$/.test(n))return ln(n,r);let c=r.indent||(r.forceBlockIndent||ii(n)?" ":""),d=a==="literal"?!0:a==="folded"||t===Ue.Scalar.BLOCK_FOLDED?!1:t===Ue.Scalar.BLOCK_LITERAL?!0:!nb(n,l,c.length);if(!n)return d?`|
5192
+ |$)`,"g")}catch{Ca=/\n+(?!\n|$)/g}function yi({comment:e,type:t,value:n},r,i,s){let{blockQuote:a,commentString:o,lineWidth:c}=r.options;if(!a||/\n[\t ]+$/.test(n))return wn(n,r);let l=r.indent||(r.forceBlockIndent||ki(n)?" ":""),u=a==="literal"?!0:a==="folded"||t===We.Scalar.BLOCK_FOLDED?!1:t===We.Scalar.BLOCK_LITERAL?!0:!Kb(n,c,l.length);if(!n)return u?`|
4137
5193
  `:`>
4138
- `;let p,u;for(u=n.length;u>0;--u){let A=n[u-1];if(A!==`
4139
- `&&A!==" "&&A!==" ")break}let f=n.substring(u),m=f.indexOf(`
4140
- `);m===-1?p="-":n===f||m!==f.length-1?(p="+",s&&s()):p="",f&&(n=n.slice(0,-f.length),f[f.length-1]===`
4141
- `&&(f=f.slice(0,-1)),f=f.replace(la,`$&${c}`));let h=!1,g,v=-1;for(g=0;g<n.length;++g){let A=n[g];if(A===" ")h=!0;else if(A===`
4142
- `)v=g;else break}let w=n.substring(0,v<g?v+1:g);w&&(n=n.substring(w.length),w=w.replace(/\n+/g,`$&${c}`));let C=(h?c?"2":"1":"")+p;if(e&&(C+=" "+o(e.replace(/ ?[\r\n]+/g," ")),i&&i()),!d){let A=n.replace(/\n+/g,`
4143
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),y=!1,T=ri(r,!0);a!=="folded"&&t!==Ue.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{y=!0});let x=Tt.foldFlowLines(`${w}${A}${f}`,c,Tt.FOLD_BLOCK,T);if(!y)return`>${C}
4144
- ${c}${x}`}return n=n.replace(/\n+/g,`$&${c}`),`|${C}
4145
- ${c}${w}${n}${f}`}function rb(e,t,n,r){let{type:i,value:s}=e,{actualString:a,implicitKey:o,indent:l,indentStep:c,inFlow:d}=t;if(o&&s.includes(`
4146
- `)||d&&/[[\]{},]/.test(s))return ln(s,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return o||d||!s.includes(`
4147
- `)?ln(s,t):ni(e,t,n,r);if(!o&&!d&&i!==Ue.Scalar.PLAIN&&s.includes(`
4148
- `))return ni(e,t,n,r);if(ii(s)){if(l==="")return t.forceBlockIndent=!0,ni(e,t,n,r);if(o&&l===c)return ln(s,t)}let p=s.replace(/\n+/g,`$&
4149
- ${l}`);if(a){let u=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(p),{compat:f,tags:m}=t.doc.schema;if(m.some(u)||f?.some(u))return ln(s,t)}return o?p:Tt.foldFlowLines(p,l,Tt.FOLD_FLOW,ri(t,!1))}function ib(e,t,n,r){let{implicitKey:i,inFlow:s}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:o}=e;o!==Ue.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(o=Ue.Scalar.QUOTE_DOUBLE);let l=d=>{switch(d){case Ue.Scalar.BLOCK_FOLDED:case Ue.Scalar.BLOCK_LITERAL:return i||s?ln(a.value,t):ni(a,t,n,r);case Ue.Scalar.QUOTE_DOUBLE:return Bn(a.value,t);case Ue.Scalar.QUOTE_SINGLE:return oa(a.value,t);case Ue.Scalar.PLAIN:return rb(a,t,n,r);default:return null}},c=l(o);if(c===null){let{defaultKeyType:d,defaultStringType:p}=t.options,u=i&&d||p;if(c=l(u),c===null)throw new Error(`Unsupported default string type ${u}`)}return c}Xc.stringifyString=ib});var Fn=B(ca=>{"use strict";E();var sb=Xr(),St=q(),ab=Mn(),ob=$n();function lb(e,t){let n=Object.assign({blockQuote:!0,commentString:ab.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function cb(e,t){if(t.tag){let i=e.filter(s=>s.tag===t.tag);if(i.length>0)return i.find(s=>s.format===t.format)??i[0]}let n,r;if(St.isScalar(t)){r=t.value;let i=e.filter(s=>s.identify?.(r));if(i.length>1){let s=i.filter(a=>a.test);s.length>0&&(i=s)}n=i.find(s=>s.format===t.format)??i.find(s=>!s.format)}else r=t,n=e.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function db(e,t,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],s=(St.isScalar(e)||St.isCollection(e))&&e.anchor;s&&sb.anchorIsValid(s)&&(n.add(s),i.push(`&${s}`));let a=e.tag??(t.default?null:t.tag);return a&&i.push(r.directives.tagString(a)),i.join(" ")}function pb(e,t,n,r){if(St.isPair(e))return e.toString(t,n,r);if(St.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,s=St.isNode(e)?e:t.doc.createNode(e,{onTagObj:l=>i=l});i??(i=cb(t.doc.schema.tags,s));let a=db(s,i,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);let o=typeof i.stringify=="function"?i.stringify(s,t,n,r):St.isScalar(s)?ob.stringifyString(s,t,n,r):s.toString(t,n,r);return a?St.isScalar(s)||o[0]==="{"||o[0]==="["?`${a} ${o}`:`${a}
4150
- ${t.indent}${o}`:o}ca.createStringifyContext=lb;ca.stringify=pb});var Zc=B(Qc=>{"use strict";E();var at=q(),Yc=ce(),Jc=Fn(),Hn=Mn();function ub({key:e,value:t},n,r,i){let{allNullValues:s,doc:a,indent:o,indentStep:l,options:{commentString:c,indentSeq:d,simpleKeys:p}}=n,u=at.isNode(e)&&e.comment||null;if(p){if(u)throw new Error("With simple keys, key nodes cannot have comments");if(at.isCollection(e)||!at.isNode(e)&&typeof e=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let f=!p&&(!e||u&&t==null&&!n.inFlow||at.isCollection(e)||(at.isScalar(e)?e.type===Yc.Scalar.BLOCK_FOLDED||e.type===Yc.Scalar.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!f&&(p||!s),indent:o+l});let m=!1,h=!1,g=Jc.stringify(e,n,()=>m=!0,()=>h=!0);if(!f&&!n.inFlow&&g.length>1024){if(p)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");f=!0}if(n.inFlow){if(s||t==null)return m&&r&&r(),g===""?"?":f?`? ${g}`:g}else if(s&&!p||t==null&&f)return g=`? ${g}`,u&&!m?g+=Hn.lineComment(g,n.indent,c(u)):h&&i&&i(),g;m&&(u=null),f?(u&&(g+=Hn.lineComment(g,n.indent,c(u))),g=`? ${g}
4151
- ${o}:`):(g=`${g}:`,u&&(g+=Hn.lineComment(g,n.indent,c(u))));let v,w,b;at.isNode(t)?(v=!!t.spaceBefore,w=t.commentBefore,b=t.comment):(v=!1,w=null,b=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!f&&!u&&at.isScalar(t)&&(n.indentAtStart=g.length+1),h=!1,!d&&l.length>=2&&!n.inFlow&&!f&&at.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let C=!1,A=Jc.stringify(t,n,()=>C=!0,()=>h=!0),y=" ";if(u||v||w){if(y=v?`
4152
- `:"",w){let T=c(w);y+=`
4153
- ${Hn.indentComment(T,n.indent)}`}A===""&&!n.inFlow?y===`
4154
- `&&b&&(y=`
4155
-
4156
- `):y+=`
4157
- ${n.indent}`}else if(!f&&at.isCollection(t)){let T=A[0],x=A.indexOf(`
4158
- `),_=x!==-1,N=n.inFlow??t.flow??t.items.length===0;if(_||!N){let M=!1;if(_&&(T==="&"||T==="!")){let D=A.indexOf(" ");T==="&"&&D!==-1&&D<x&&A[D+1]==="!"&&(D=A.indexOf(" ",D+1)),(D===-1||x<D)&&(M=!0)}M||(y=`
4159
- ${n.indent}`)}}else(A===""||A[0]===`
4160
- `)&&(y="");return g+=y+A,n.inFlow?C&&r&&r():b&&!C?g+=Hn.lineComment(g,n.indent,c(b)):h&&i&&i(),g}Qc.stringifyPair=ub});var pa=B(da=>{"use strict";E();var ed=Hr("process");function hb(e,...t){e==="debug"&&console.log(...t)}function fb(e,t){(e==="debug"||e==="warn")&&(typeof ed.emitWarning=="function"?ed.emitWarning(t):console.warn(t))}da.debug=hb;da.warn=fb});var ci=B(li=>{"use strict";E();var oi=q(),td=ce(),si="<<",ai={identify:e=>e===si||typeof e=="symbol"&&e.description===si,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new td.Scalar(Symbol(si)),{addToJSMap:nd}),stringify:()=>si},mb=(e,t)=>(ai.identify(t)||oi.isScalar(t)&&(!t.type||t.type===td.Scalar.PLAIN)&&ai.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===ai.tag&&n.default);function nd(e,t,n){let r=rd(e,n);if(oi.isSeq(r))for(let i of r.items)ua(e,t,i);else if(Array.isArray(r))for(let i of r)ua(e,t,i);else ua(e,t,r)}function ua(e,t,n){let r=rd(e,n);if(!oi.isMap(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,e,Map);for(let[s,a]of i)t instanceof Map?t.has(s)||t.set(s,a):t instanceof Set?t.add(s):Object.prototype.hasOwnProperty.call(t,s)||Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function rd(e,t){return e&&oi.isAlias(t)?t.resolve(e.doc,e):t}li.addMergeToJSMap=nd;li.isMergeKey=mb;li.merge=ai});var fa=B(ad=>{"use strict";E();var gb=pa(),id=ci(),bb=Fn(),sd=q(),ha=xt();function vb(e,t,{key:n,value:r}){if(sd.isNode(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(id.isMergeKey(e,n))id.addMergeToJSMap(e,t,r);else{let i=ha.toJS(n,"",e);if(t instanceof Map)t.set(i,ha.toJS(r,i,e));else if(t instanceof Set)t.add(i);else{let s=wb(n,i,e),a=ha.toJS(r,s,e);s in t?Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[s]=a}}return t}function wb(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(sd.isNode(e)&&n?.doc){let r=bb.createStringifyContext(n.doc,{});r.anchors=new Set;for(let s of n.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=e.toString(r);if(!n.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),gb.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}ad.addPairToJSMap=vb});var Et=B(ma=>{"use strict";E();var od=Rn(),yb=Zc(),xb=fa(),di=q();function kb(e,t,n){let r=od.createNode(e,void 0,n),i=od.createNode(t,void 0,n);return new pi(r,i)}var pi=class e{constructor(t,n=null){Object.defineProperty(this,di.NODE_TYPE,{value:di.PAIR}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return di.isNode(n)&&(n=n.clone(t)),di.isNode(r)&&(r=r.clone(t)),new e(n,r)}toJSON(t,n){let r=n?.mapAsMap?new Map:{};return xb.addPairToJSMap(n,r,this)}toString(t,n,r){return t?.doc?yb.stringifyPair(this,t,n,r):JSON.stringify(this)}};ma.Pair=pi;ma.createPair=kb});var ga=B(cd=>{"use strict";E();var Ht=q(),ld=Fn(),ui=Mn();function Tb(e,t,n){return(t.inFlow??e.flow?Eb:Sb)(e,t,n)}function Sb({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:s,onChompKeep:a,onComment:o}){let{indent:l,options:{commentString:c}}=n,d=Object.assign({},n,{indent:s,type:null}),p=!1,u=[];for(let m=0;m<t.length;++m){let h=t[m],g=null;if(Ht.isNode(h))!p&&h.spaceBefore&&u.push(""),hi(n,u,h.commentBefore,p),h.comment&&(g=h.comment);else if(Ht.isPair(h)){let w=Ht.isNode(h.key)?h.key:null;w&&(!p&&w.spaceBefore&&u.push(""),hi(n,u,w.commentBefore,p))}p=!1;let v=ld.stringify(h,d,()=>g=null,()=>p=!0);g&&(v+=ui.lineComment(v,s,c(g))),p&&g&&(p=!1),u.push(r+v)}let f;if(u.length===0)f=i.start+i.end;else{f=u[0];for(let m=1;m<u.length;++m){let h=u[m];f+=h?`
4161
- ${l}${h}`:`
4162
- `}}return e?(f+=`
4163
- `+ui.indentComment(c(e),l),o&&o()):p&&a&&a(),f}function Eb({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:s,flowCollectionPadding:a,options:{commentString:o}}=t;r+=s;let l=Object.assign({},t,{indent:r,inFlow:!0,type:null}),c=!1,d=0,p=[];for(let m=0;m<e.length;++m){let h=e[m],g=null;if(Ht.isNode(h))h.spaceBefore&&p.push(""),hi(t,p,h.commentBefore,!1),h.comment&&(g=h.comment);else if(Ht.isPair(h)){let w=Ht.isNode(h.key)?h.key:null;w&&(w.spaceBefore&&p.push(""),hi(t,p,w.commentBefore,!1),w.comment&&(c=!0));let b=Ht.isNode(h.value)?h.value:null;b?(b.comment&&(g=b.comment),b.commentBefore&&(c=!0)):h.value==null&&w?.comment&&(g=w.comment)}g&&(c=!0);let v=ld.stringify(h,l,()=>g=null);c||(c=p.length>d||v.includes(`
4164
- `)),m<e.length-1?v+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(c||(c=p.reduce((w,b)=>w+b.length+2,2)+(v.length+2)>t.options.lineWidth)),c&&(v+=",")),g&&(v+=ui.lineComment(v,r,o(g))),p.push(v),d=p.length}let{start:u,end:f}=n;if(p.length===0)return u+f;if(!c){let m=p.reduce((h,g)=>h+g.length+2,2);c=t.options.lineWidth>0&&m>t.options.lineWidth}if(c){let m=u;for(let h of p)m+=h?`
4165
- ${s}${i}${h}`:`
4166
- `;return`${m}
4167
- ${i}${f}`}else return`${u}${a}${p.join(" ")}${a}${f}`}function hi({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let s=ui.indentComment(t(r),e);n.push(s.trimStart())}}cd.stringifyCollection=Tb});var _t=B(va=>{"use strict";E();var Cb=ga(),_b=fa(),Ab=Zr(),Ct=q(),fi=Et(),Nb=ce();function Un(e,t){let n=Ct.isScalar(t)?t.value:t;for(let r of e)if(Ct.isPair(r)&&(r.key===t||r.key===n||Ct.isScalar(r.key)&&r.key.value===n))return r}var ba=class extends Ab.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Ct.MAP,t),this.items=[]}static from(t,n,r){let{keepUndefined:i,replacer:s}=r,a=new this(t),o=(l,c)=>{if(typeof s=="function")c=s.call(n,l,c);else if(Array.isArray(s)&&!s.includes(l))return;(c!==void 0||i)&&a.items.push(fi.createPair(l,c,r))};if(n instanceof Map)for(let[l,c]of n)o(l,c);else if(n&&typeof n=="object")for(let l of Object.keys(n))o(l,n[l]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){let r;Ct.isPair(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new fi.Pair(t,t?.value):r=new fi.Pair(t.key,t.value);let i=Un(this.items,r.key),s=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);Ct.isScalar(i.value)&&Nb.isScalarValue(r.value)?i.value.value=r.value:i.value=r.value}else if(s){let a=this.items.findIndex(o=>s(r,o)<0);a===-1?this.items.push(r):this.items.splice(a,0,r)}else this.items.push(r)}delete(t){let n=Un(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){let i=Un(this.items,t)?.value;return(!n&&Ct.isScalar(i)?i.value:i)??void 0}has(t){return!!Un(this.items,t)}set(t,n){this.add(new fi.Pair(t,n),!0)}toJSON(t,n,r){let i=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let s of this.items)_b.addPairToJSMap(n,i,s);return i}toString(t,n,r){if(!t)return JSON.stringify(this);for(let i of this.items)if(!Ct.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),Cb.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}};va.YAMLMap=ba;va.findPair=Un});var cn=B(pd=>{"use strict";E();var Ib=q(),dd=_t(),Pb={collection:"map",default:!0,nodeClass:dd.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return Ib.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>dd.YAMLMap.from(e,t,n)};pd.map=Pb});var At=B(ud=>{"use strict";E();var Ob=Rn(),Lb=ga(),Rb=Zr(),gi=q(),Mb=ce(),Db=xt(),wa=class extends Rb.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(gi.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let n=mi(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){let r=mi(t);if(typeof r!="number")return;let i=this.items[r];return!n&&gi.isScalar(i)?i.value:i}has(t){let n=mi(t);return typeof n=="number"&&n<this.items.length}set(t,n){let r=mi(t);if(typeof r!="number")throw new Error(`Expected a valid index, not ${t}.`);let i=this.items[r];gi.isScalar(i)&&Mb.isScalarValue(n)?i.value=n:this.items[r]=n}toJSON(t,n){let r=[];n?.onCreate&&n.onCreate(r);let i=0;for(let s of this.items)r.push(Db.toJS(s,String(i++),n));return r}toString(t,n,r){return t?Lb.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(t,n,r){let{replacer:i}=r,s=new this(t);if(n&&Symbol.iterator in Object(n)){let a=0;for(let o of n){if(typeof i=="function"){let l=n instanceof Set?o:String(a++);o=i.call(n,l,o)}s.items.push(Ob.createNode(o,void 0,r))}}return s}};function mi(e){let t=gi.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}ud.YAMLSeq=wa});var dn=B(fd=>{"use strict";E();var Bb=q(),hd=At(),$b={collection:"seq",default:!0,nodeClass:hd.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Bb.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>hd.YAMLSeq.from(e,t,n)};fd.seq=$b});var qn=B(md=>{"use strict";E();var Fb=$n(),Hb={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),Fb.stringifyString(e,t,n,r)}};md.string=Hb});var bi=B(vd=>{"use strict";E();var gd=ce(),bd={identify:e=>e==null,createNode:()=>new gd.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new gd.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&bd.test.test(e)?e:t.options.nullStr};vd.nullTag=bd});var ya=B(yd=>{"use strict";E();var Ub=ce(),wd={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Ub.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&wd.test.test(e)){let r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?n.options.trueStr:n.options.falseStr}};yd.boolTag=wd});var pn=B(xd=>{"use strict";E();function qb({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let s=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let a=s.indexOf(".");a<0&&(a=s.length,s+=".");let o=t-(s.length-a-1);for(;o-- >0;)s+="0"}return s}xd.stringifyNumber=qb});var ka=B(vi=>{"use strict";E();var Wb=ce(),xa=pn(),jb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:xa.stringifyNumber},Kb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():xa.stringifyNumber(e)}},Gb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Wb.Scalar(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:xa.stringifyNumber};vi.float=Gb;vi.floatExp=Kb;vi.floatNaN=jb});var Sa=B(yi=>{"use strict";E();var kd=pn(),wi=e=>typeof e=="bigint"||Number.isInteger(e),Ta=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function Td(e,t,n){let{value:r}=e;return wi(r)&&r>=0?n+r.toString(t):kd.stringifyNumber(e)}var zb={identify:e=>wi(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>Ta(e,2,8,n),stringify:e=>Td(e,8,"0o")},Vb={identify:wi,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Ta(e,0,10,n),stringify:kd.stringifyNumber},Xb={identify:e=>wi(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Ta(e,2,16,n),stringify:e=>Td(e,16,"0x")};yi.int=Vb;yi.intHex=Xb;yi.intOct=zb});var Ed=B(Sd=>{"use strict";E();var Yb=cn(),Jb=bi(),Qb=dn(),Zb=qn(),ev=ya(),Ea=ka(),Ca=Sa(),tv=[Yb.map,Qb.seq,Zb.string,Jb.nullTag,ev.boolTag,Ca.intOct,Ca.int,Ca.intHex,Ea.floatNaN,Ea.floatExp,Ea.float];Sd.schema=tv});var Ad=B(_d=>{"use strict";E();var nv=ce(),rv=cn(),iv=dn();function Cd(e){return typeof e=="bigint"||Number.isInteger(e)}var xi=({value:e})=>JSON.stringify(e),sv=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:xi},{identify:e=>e==null,createNode:()=>new nv.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:xi},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:xi},{identify:Cd,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Cd(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:xi}],av={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},ov=[rv.map,iv.seq].concat(sv,av);_d.schema=ov});var Aa=B(Nd=>{"use strict";E();var Wn=Hr("buffer"),_a=ce(),lv=$n(),cv={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof Wn.Buffer=="function")return Wn.Buffer.from(e,"base64");if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},r,i,s){if(!n)return"";let a=n,o;if(typeof Wn.Buffer=="function")o=a instanceof Wn.Buffer?a.toString("base64"):Wn.Buffer.from(a.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let c=0;c<a.length;++c)l+=String.fromCharCode(a[c]);o=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=_a.Scalar.BLOCK_LITERAL),t!==_a.Scalar.QUOTE_DOUBLE){let l=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),c=Math.ceil(o.length/l),d=new Array(c);for(let p=0,u=0;p<c;++p,u+=l)d[p]=o.substr(u,l);o=d.join(t===_a.Scalar.BLOCK_LITERAL?`
4168
- `:" ")}return lv.stringifyString({comment:e,type:t,value:o},r,i,s)}};Nd.binary=cv});var Si=B(Ti=>{"use strict";E();var ki=q(),Na=Et(),dv=ce(),pv=At();function Id(e,t){if(ki.isSeq(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!ki.isPair(r)){if(ki.isMap(r)){r.items.length>1&&t("Each pair must have its own sequence indicator");let i=r.items[0]||new Na.Pair(new dv.Scalar(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
5194
+ `;let d,p;for(p=n.length;p>0;--p){let _=n[p-1];if(_!==`
5195
+ `&&_!==" "&&_!==" ")break}let h=n.substring(p),f=h.indexOf(`
5196
+ `);f===-1?d="-":n===h||f!==h.length-1?(d="+",s&&s()):d="",h&&(n=n.slice(0,-h.length),h[h.length-1]===`
5197
+ `&&(h=h.slice(0,-1)),h=h.replace(Ca,`$&${l}`));let m=!1,g,y=-1;for(g=0;g<n.length;++g){let _=n[g];if(_===" ")m=!0;else if(_===`
5198
+ `)y=g;else break}let T=n.substring(0,y<g?y+1:g);T&&(n=n.substring(T.length),T=T.replace(/\n+/g,`$&${l}`));let C=(m?l?"2":"1":"")+d;if(e&&(C+=" "+o(e.replace(/ ?[\r\n]+/g," ")),i&&i()),!u){let _=n.replace(/\n+/g,`
5199
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),w=!1,x=xi(r,!0);a!=="folded"&&t!==We.Scalar.BLOCK_FOLDED&&(x.onOverflow=()=>{w=!0});let v=It.foldFlowLines(`${T}${_}${h}`,l,It.FOLD_BLOCK,x);if(!w)return`>${C}
5200
+ ${l}${v}`}return n=n.replace(/\n+/g,`$&${l}`),`|${C}
5201
+ ${l}${T}${n}${h}`}function Gb(e,t,n,r){let{type:i,value:s}=e,{actualString:a,implicitKey:o,indent:c,indentStep:l,inFlow:u}=t;if(o&&s.includes(`
5202
+ `)||u&&/[[\]{},]/.test(s))return wn(s,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return o||u||!s.includes(`
5203
+ `)?wn(s,t):yi(e,t,n,r);if(!o&&!u&&i!==We.Scalar.PLAIN&&s.includes(`
5204
+ `))return yi(e,t,n,r);if(ki(s)){if(c==="")return t.forceBlockIndent=!0,yi(e,t,n,r);if(o&&c===l)return wn(s,t)}let d=s.replace(/\n+/g,`$&
5205
+ ${c}`);if(a){let p=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(d),{compat:h,tags:f}=t.doc.schema;if(f.some(p)||h?.some(p))return wn(s,t)}return o?d:It.foldFlowLines(d,c,It.FOLD_FLOW,xi(t,!1))}function zb(e,t,n,r){let{implicitKey:i,inFlow:s}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:o}=e;o!==We.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(o=We.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case We.Scalar.BLOCK_FOLDED:case We.Scalar.BLOCK_LITERAL:return i||s?wn(a.value,t):yi(a,t,n,r);case We.Scalar.QUOTE_DOUBLE:return Xn(a.value,t);case We.Scalar.QUOTE_SINGLE:return Sa(a.value,t);case We.Scalar.PLAIN:return Gb(a,t,n,r);default:return null}},l=c(o);if(l===null){let{defaultKeyType:u,defaultStringType:d}=t.options,p=i&&u||d;if(l=c(p),l===null)throw new Error(`Unsupported default string type ${p}`)}return l}wd.stringifyString=zb});var Jn=B(Ea=>{"use strict";S();var Vb=hi(),Ot=X(),Xb=zn(),Yb=Yn();function Jb(e,t){let n=Object.assign({blockQuote:!0,commentString:Xb.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Qb(e,t){if(t.tag){let i=e.filter(s=>s.tag===t.tag);if(i.length>0)return i.find(s=>s.format===t.format)??i[0]}let n,r;if(Ot.isScalar(t)){r=t.value;let i=e.filter(s=>s.identify?.(r));if(i.length>1){let s=i.filter(a=>a.test);s.length>0&&(i=s)}n=i.find(s=>s.format===t.format)??i.find(s=>!s.format)}else r=t,n=e.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function Zb(e,t,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],s=(Ot.isScalar(e)||Ot.isCollection(e))&&e.anchor;s&&Vb.anchorIsValid(s)&&(n.add(s),i.push(`&${s}`));let a=e.tag??(t.default?null:t.tag);return a&&i.push(r.directives.tagString(a)),i.join(" ")}function ev(e,t,n,r){if(Ot.isPair(e))return e.toString(t,n,r);if(Ot.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,s=Ot.isNode(e)?e:t.doc.createNode(e,{onTagObj:c=>i=c});i??(i=Qb(t.doc.schema.tags,s));let a=Zb(s,i,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);let o=typeof i.stringify=="function"?i.stringify(s,t,n,r):Ot.isScalar(s)?Yb.stringifyString(s,t,n,r):s.toString(t,n,r);return a?Ot.isScalar(s)||o[0]==="{"||o[0]==="["?`${a} ${o}`:`${a}
5206
+ ${t.indent}${o}`:o}Ea.createStringifyContext=Jb;Ea.stringify=ev});var Td=B(kd=>{"use strict";S();var mt=X(),yd=pe(),xd=Jn(),Qn=zn();function tv({key:e,value:t},n,r,i){let{allNullValues:s,doc:a,indent:o,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,p=mt.isNode(e)&&e.comment||null;if(d){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(mt.isCollection(e)||!mt.isNode(e)&&typeof e=="object"){let x="With simple keys, collection cannot be used as a key value";throw new Error(x)}}let h=!d&&(!e||p&&t==null&&!n.inFlow||mt.isCollection(e)||(mt.isScalar(e)?e.type===yd.Scalar.BLOCK_FOLDED||e.type===yd.Scalar.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(d||!s),indent:o+c});let f=!1,m=!1,g=xd.stringify(e,n,()=>f=!0,()=>m=!0);if(!h&&!n.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(s||t==null)return f&&r&&r(),g===""?"?":h?`? ${g}`:g}else if(s&&!d||t==null&&h)return g=`? ${g}`,p&&!f?g+=Qn.lineComment(g,n.indent,l(p)):m&&i&&i(),g;f&&(p=null),h?(p&&(g+=Qn.lineComment(g,n.indent,l(p))),g=`? ${g}
5207
+ ${o}:`):(g=`${g}:`,p&&(g+=Qn.lineComment(g,n.indent,l(p))));let y,T,b;mt.isNode(t)?(y=!!t.spaceBefore,T=t.commentBefore,b=t.comment):(y=!1,T=null,b=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!h&&!p&&mt.isScalar(t)&&(n.indentAtStart=g.length+1),m=!1,!u&&c.length>=2&&!n.inFlow&&!h&&mt.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let C=!1,_=xd.stringify(t,n,()=>C=!0,()=>m=!0),w=" ";if(p||y||T){if(w=y?`
5208
+ `:"",T){let x=l(T);w+=`
5209
+ ${Qn.indentComment(x,n.indent)}`}_===""&&!n.inFlow?w===`
5210
+ `&&b&&(w=`
5211
+
5212
+ `):w+=`
5213
+ ${n.indent}`}else if(!h&&mt.isCollection(t)){let x=_[0],v=_.indexOf(`
5214
+ `),A=v!==-1,N=n.inFlow??t.flow??t.items.length===0;if(A||!N){let M=!1;if(A&&(x==="&"||x==="!")){let O=_.indexOf(" ");x==="&"&&O!==-1&&O<v&&_[O+1]==="!"&&(O=_.indexOf(" ",O+1)),(O===-1||v<O)&&(M=!0)}M||(w=`
5215
+ ${n.indent}`)}}else(_===""||_[0]===`
5216
+ `)&&(w="");return g+=w+_,n.inFlow?C&&r&&r():b&&!C?g+=Qn.lineComment(g,n.indent,l(b)):m&&i&&i(),g}kd.stringifyPair=tv});var _a=B(Aa=>{"use strict";S();var Sd=ri("process");function nv(e,...t){e==="debug"&&console.log(...t)}function rv(e,t){(e==="debug"||e==="warn")&&(typeof Sd.emitWarning=="function"?Sd.emitWarning(t):console.warn(t))}Aa.debug=nv;Aa.warn=rv});var Ai=B(Ei=>{"use strict";S();var Ci=X(),Cd=pe(),Ti="<<",Si={identify:e=>e===Ti||typeof e=="symbol"&&e.description===Ti,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Cd.Scalar(Symbol(Ti)),{addToJSMap:Ed}),stringify:()=>Ti},iv=(e,t)=>(Si.identify(t)||Ci.isScalar(t)&&(!t.type||t.type===Cd.Scalar.PLAIN)&&Si.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===Si.tag&&n.default);function Ed(e,t,n){let r=Ad(e,n);if(Ci.isSeq(r))for(let i of r.items)Na(e,t,i);else if(Array.isArray(r))for(let i of r)Na(e,t,i);else Na(e,t,r)}function Na(e,t,n){let r=Ad(e,n);if(!Ci.isMap(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,e,Map);for(let[s,a]of i)t instanceof Map?t.has(s)||t.set(s,a):t instanceof Set?t.add(s):Object.prototype.hasOwnProperty.call(t,s)||Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function Ad(e,t){return e&&Ci.isAlias(t)?t.resolve(e.doc,e):t}Ei.addMergeToJSMap=Ed;Ei.isMergeKey=iv;Ei.merge=Si});var Ia=B(Pd=>{"use strict";S();var sv=_a(),_d=Ai(),av=Jn(),Nd=X(),Pa=Nt();function ov(e,t,{key:n,value:r}){if(Nd.isNode(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(_d.isMergeKey(e,n))_d.addMergeToJSMap(e,t,r);else{let i=Pa.toJS(n,"",e);if(t instanceof Map)t.set(i,Pa.toJS(r,i,e));else if(t instanceof Set)t.add(i);else{let s=lv(n,i,e),a=Pa.toJS(r,s,e);s in t?Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[s]=a}}return t}function lv(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(Nd.isNode(e)&&n?.doc){let r=av.createStringifyContext(n.doc,{});r.anchors=new Set;for(let s of n.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=e.toString(r);if(!n.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),sv.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}Pd.addPairToJSMap=ov});var Rt=B(Oa=>{"use strict";S();var Id=Gn(),cv=Td(),dv=Ia(),_i=X();function pv(e,t,n){let r=Id.createNode(e,void 0,n),i=Id.createNode(t,void 0,n);return new Ni(r,i)}var Ni=class e{constructor(t,n=null){Object.defineProperty(this,_i.NODE_TYPE,{value:_i.PAIR}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return _i.isNode(n)&&(n=n.clone(t)),_i.isNode(r)&&(r=r.clone(t)),new e(n,r)}toJSON(t,n){let r=n?.mapAsMap?new Map:{};return dv.addPairToJSMap(n,r,this)}toString(t,n,r){return t?.doc?cv.stringifyPair(this,t,n,r):JSON.stringify(this)}};Oa.Pair=Ni;Oa.createPair=pv});var Ra=B(Rd=>{"use strict";S();var zt=X(),Od=Jn(),Pi=zn();function uv(e,t,n){return(t.inFlow??e.flow?mv:hv)(e,t,n)}function hv({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:s,onChompKeep:a,onComment:o}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:s,type:null}),d=!1,p=[];for(let f=0;f<t.length;++f){let m=t[f],g=null;if(zt.isNode(m))!d&&m.spaceBefore&&p.push(""),Ii(n,p,m.commentBefore,d),m.comment&&(g=m.comment);else if(zt.isPair(m)){let T=zt.isNode(m.key)?m.key:null;T&&(!d&&T.spaceBefore&&p.push(""),Ii(n,p,T.commentBefore,d))}d=!1;let y=Od.stringify(m,u,()=>g=null,()=>d=!0);g&&(y+=Pi.lineComment(y,s,l(g))),d&&g&&(d=!1),p.push(r+y)}let h;if(p.length===0)h=i.start+i.end;else{h=p[0];for(let f=1;f<p.length;++f){let m=p[f];h+=m?`
5217
+ ${c}${m}`:`
5218
+ `}}return e?(h+=`
5219
+ `+Pi.indentComment(l(e),c),o&&o()):d&&a&&a(),h}function mv({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:s,flowCollectionPadding:a,options:{commentString:o}}=t;r+=s;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let f=0;f<e.length;++f){let m=e[f],g=null;if(zt.isNode(m))m.spaceBefore&&d.push(""),Ii(t,d,m.commentBefore,!1),m.comment&&(g=m.comment);else if(zt.isPair(m)){let T=zt.isNode(m.key)?m.key:null;T&&(T.spaceBefore&&d.push(""),Ii(t,d,T.commentBefore,!1),T.comment&&(l=!0));let b=zt.isNode(m.value)?m.value:null;b?(b.comment&&(g=b.comment),b.commentBefore&&(l=!0)):m.value==null&&T?.comment&&(g=T.comment)}g&&(l=!0);let y=Od.stringify(m,c,()=>g=null);l||(l=d.length>u||y.includes(`
5220
+ `)),f<e.length-1?y+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=d.reduce((T,b)=>T+b.length+2,2)+(y.length+2)>t.options.lineWidth)),l&&(y+=",")),g&&(y+=Pi.lineComment(y,r,o(g))),d.push(y),u=d.length}let{start:p,end:h}=n;if(d.length===0)return p+h;if(!l){let f=d.reduce((m,g)=>m+g.length+2,2);l=t.options.lineWidth>0&&f>t.options.lineWidth}if(l){let f=p;for(let m of d)f+=m?`
5221
+ ${s}${i}${m}`:`
5222
+ `;return`${f}
5223
+ ${i}${h}`}else return`${p}${a}${d.join(" ")}${a}${h}`}function Ii({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let s=Pi.indentComment(t(r),e);n.push(s.trimStart())}}Rd.stringifyCollection=uv});var Mt=B(Ma=>{"use strict";S();var fv=Ra(),gv=Ia(),bv=bi(),Lt=X(),Oi=Rt(),vv=pe();function Zn(e,t){let n=Lt.isScalar(t)?t.value:t;for(let r of e)if(Lt.isPair(r)&&(r.key===t||r.key===n||Lt.isScalar(r.key)&&r.key.value===n))return r}var La=class extends bv.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Lt.MAP,t),this.items=[]}static from(t,n,r){let{keepUndefined:i,replacer:s}=r,a=new this(t),o=(c,l)=>{if(typeof s=="function")l=s.call(n,c,l);else if(Array.isArray(s)&&!s.includes(c))return;(l!==void 0||i)&&a.items.push(Oi.createPair(c,l,r))};if(n instanceof Map)for(let[c,l]of n)o(c,l);else if(n&&typeof n=="object")for(let c of Object.keys(n))o(c,n[c]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){let r;Lt.isPair(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new Oi.Pair(t,t?.value):r=new Oi.Pair(t.key,t.value);let i=Zn(this.items,r.key),s=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);Lt.isScalar(i.value)&&vv.isScalarValue(r.value)?i.value.value=r.value:i.value=r.value}else if(s){let a=this.items.findIndex(o=>s(r,o)<0);a===-1?this.items.push(r):this.items.splice(a,0,r)}else this.items.push(r)}delete(t){let n=Zn(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){let i=Zn(this.items,t)?.value;return(!n&&Lt.isScalar(i)?i.value:i)??void 0}has(t){return!!Zn(this.items,t)}set(t,n){this.add(new Oi.Pair(t,n),!0)}toJSON(t,n,r){let i=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let s of this.items)gv.addPairToJSMap(n,i,s);return i}toString(t,n,r){if(!t)return JSON.stringify(this);for(let i of this.items)if(!Lt.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),fv.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}};Ma.YAMLMap=La;Ma.findPair=Zn});var yn=B(Md=>{"use strict";S();var wv=X(),Ld=Mt(),yv={collection:"map",default:!0,nodeClass:Ld.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return wv.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Ld.YAMLMap.from(e,t,n)};Md.map=yv});var Dt=B(Dd=>{"use strict";S();var xv=Gn(),kv=Ra(),Tv=bi(),Li=X(),Sv=pe(),Cv=Nt(),Da=class extends Tv.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Li.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let n=Ri(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){let r=Ri(t);if(typeof r!="number")return;let i=this.items[r];return!n&&Li.isScalar(i)?i.value:i}has(t){let n=Ri(t);return typeof n=="number"&&n<this.items.length}set(t,n){let r=Ri(t);if(typeof r!="number")throw new Error(`Expected a valid index, not ${t}.`);let i=this.items[r];Li.isScalar(i)&&Sv.isScalarValue(n)?i.value=n:this.items[r]=n}toJSON(t,n){let r=[];n?.onCreate&&n.onCreate(r);let i=0;for(let s of this.items)r.push(Cv.toJS(s,String(i++),n));return r}toString(t,n,r){return t?kv.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(t,n,r){let{replacer:i}=r,s=new this(t);if(n&&Symbol.iterator in Object(n)){let a=0;for(let o of n){if(typeof i=="function"){let c=n instanceof Set?o:String(a++);o=i.call(n,c,o)}s.items.push(xv.createNode(o,void 0,r))}}return s}};function Ri(e){let t=Li.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}Dd.YAMLSeq=Da});var xn=B($d=>{"use strict";S();var Ev=X(),Bd=Dt(),Av={collection:"seq",default:!0,nodeClass:Bd.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Ev.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Bd.YAMLSeq.from(e,t,n)};$d.seq=Av});var er=B(Fd=>{"use strict";S();var _v=Yn(),Nv={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),_v.stringifyString(e,t,n,r)}};Fd.string=Nv});var Mi=B(Ud=>{"use strict";S();var qd=pe(),Hd={identify:e=>e==null,createNode:()=>new qd.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new qd.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&Hd.test.test(e)?e:t.options.nullStr};Ud.nullTag=Hd});var Ba=B(Wd=>{"use strict";S();var Pv=pe(),jd={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Pv.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&jd.test.test(e)){let r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?n.options.trueStr:n.options.falseStr}};Wd.boolTag=jd});var kn=B(Kd=>{"use strict";S();function Iv({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let s=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let a=s.indexOf(".");a<0&&(a=s.length,s+=".");let o=t-(s.length-a-1);for(;o-- >0;)s+="0"}return s}Kd.stringifyNumber=Iv});var Fa=B(Di=>{"use strict";S();var Ov=pe(),$a=kn(),Rv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:$a.stringifyNumber},Lv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():$a.stringifyNumber(e)}},Mv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Ov.Scalar(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:$a.stringifyNumber};Di.float=Mv;Di.floatExp=Lv;Di.floatNaN=Rv});var Ha=B($i=>{"use strict";S();var Gd=kn(),Bi=e=>typeof e=="bigint"||Number.isInteger(e),qa=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function zd(e,t,n){let{value:r}=e;return Bi(r)&&r>=0?n+r.toString(t):Gd.stringifyNumber(e)}var Dv={identify:e=>Bi(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>qa(e,2,8,n),stringify:e=>zd(e,8,"0o")},Bv={identify:Bi,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>qa(e,0,10,n),stringify:Gd.stringifyNumber},$v={identify:e=>Bi(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>qa(e,2,16,n),stringify:e=>zd(e,16,"0x")};$i.int=Bv;$i.intHex=$v;$i.intOct=Dv});var Xd=B(Vd=>{"use strict";S();var Fv=yn(),qv=Mi(),Hv=xn(),Uv=er(),jv=Ba(),Ua=Fa(),ja=Ha(),Wv=[Fv.map,Hv.seq,Uv.string,qv.nullTag,jv.boolTag,ja.intOct,ja.int,ja.intHex,Ua.floatNaN,Ua.floatExp,Ua.float];Vd.schema=Wv});var Qd=B(Jd=>{"use strict";S();var Kv=pe(),Gv=yn(),zv=xn();function Yd(e){return typeof e=="bigint"||Number.isInteger(e)}var Fi=({value:e})=>JSON.stringify(e),Vv=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Fi},{identify:e=>e==null,createNode:()=>new Kv.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Fi},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:Fi},{identify:Yd,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Yd(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Fi}],Xv={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Yv=[Gv.map,zv.seq].concat(Vv,Xv);Jd.schema=Yv});var Ka=B(Zd=>{"use strict";S();var tr=ri("buffer"),Wa=pe(),Jv=Yn(),Qv={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof tr.Buffer=="function")return tr.Buffer.from(e,"base64");if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},r,i,s){if(!n)return"";let a=n,o;if(typeof tr.Buffer=="function")o=a instanceof tr.Buffer?a.toString("base64"):tr.Buffer.from(a.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<a.length;++l)c+=String.fromCharCode(a[l]);o=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Wa.Scalar.BLOCK_LITERAL),t!==Wa.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(o.length/c),u=new Array(l);for(let d=0,p=0;d<l;++d,p+=c)u[d]=o.substr(p,c);o=u.join(t===Wa.Scalar.BLOCK_LITERAL?`
5224
+ `:" ")}return Jv.stringifyString({comment:e,type:t,value:o},r,i,s)}};Zd.binary=Qv});var Ui=B(Hi=>{"use strict";S();var qi=X(),Ga=Rt(),Zv=pe(),ew=Dt();function ep(e,t){if(qi.isSeq(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!qi.isPair(r)){if(qi.isMap(r)){r.items.length>1&&t("Each pair must have its own sequence indicator");let i=r.items[0]||new Ga.Pair(new Zv.Scalar(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
4169
5225
  ${i.key.commentBefore}`:r.commentBefore),r.comment){let s=i.value??i.key;s.comment=s.comment?`${r.comment}
4170
- ${s.comment}`:r.comment}r=i}e.items[n]=ki.isPair(r)?r:new Na.Pair(r)}}else t("Expected a sequence for this tag");return e}function Pd(e,t,n){let{replacer:r}=n,i=new pv.YAMLSeq(e);i.tag="tag:yaml.org,2002:pairs";let s=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof r=="function"&&(a=r.call(t,String(s++),a));let o,l;if(Array.isArray(a))if(a.length===2)o=a[0],l=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){let c=Object.keys(a);if(c.length===1)o=c[0],l=a[o];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else o=a;i.items.push(Na.createPair(o,l,n))}return i}var uv={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Id,createNode:Pd};Ti.createPairs=Pd;Ti.pairs=uv;Ti.resolvePairs=Id});var Oa=B(Pa=>{"use strict";E();var Od=q(),Ia=xt(),jn=_t(),hv=At(),Ld=Si(),Ut=class e extends hv.YAMLSeq{constructor(){super(),this.add=jn.YAMLMap.prototype.add.bind(this),this.delete=jn.YAMLMap.prototype.delete.bind(this),this.get=jn.YAMLMap.prototype.get.bind(this),this.has=jn.YAMLMap.prototype.has.bind(this),this.set=jn.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let s,a;if(Od.isPair(i)?(s=Ia.toJS(i.key,"",n),a=Ia.toJS(i.value,s,n)):s=Ia.toJS(i,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,a)}return r}static from(t,n,r){let i=Ld.createPairs(t,n,r),s=new this;return s.items=i.items,s}};Ut.tag="tag:yaml.org,2002:omap";var fv={collection:"seq",identify:e=>e instanceof Map,nodeClass:Ut,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=Ld.resolvePairs(e,t),r=[];for(let{key:i}of n.items)Od.isScalar(i)&&(r.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new Ut,n)},createNode:(e,t,n)=>Ut.from(e,t,n)};Pa.YAMLOMap=Ut;Pa.omap=fv});var $d=B(La=>{"use strict";E();var Rd=ce();function Md({value:e,source:t},n){return t&&(e?Dd:Bd).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Dd={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Rd.Scalar(!0),stringify:Md},Bd={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Rd.Scalar(!1),stringify:Md};La.falseTag=Bd;La.trueTag=Dd});var Fd=B(Ei=>{"use strict";E();var mv=ce(),Ra=pn(),gv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ra.stringifyNumber},bv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Ra.stringifyNumber(e)}},vv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new mv.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let r=e.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:Ra.stringifyNumber};Ei.float=vv;Ei.floatExp=bv;Ei.floatNaN=gv});var Ud=B(Gn=>{"use strict";E();var Hd=pn(),Kn=e=>typeof e=="bigint"||Number.isInteger(e);function Ci(e,t,n,{intAsBigInt:r}){let i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let a=BigInt(e);return i==="-"?BigInt(-1)*a:a}let s=parseInt(e,n);return i==="-"?-1*s:s}function Ma(e,t,n){let{value:r}=e;if(Kn(r)){let i=r.toString(t);return r<0?"-"+n+i.substr(1):n+i}return Hd.stringifyNumber(e)}var wv={identify:Kn,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Ci(e,2,2,n),stringify:e=>Ma(e,2,"0b")},yv={identify:Kn,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Ci(e,1,8,n),stringify:e=>Ma(e,8,"0")},xv={identify:Kn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Ci(e,0,10,n),stringify:Hd.stringifyNumber},kv={identify:Kn,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Ci(e,2,16,n),stringify:e=>Ma(e,16,"0x")};Gn.int=xv;Gn.intBin=wv;Gn.intHex=kv;Gn.intOct=yv});var Ba=B(Da=>{"use strict";E();var Ni=q(),_i=Et(),Ai=_t(),qt=class e extends Ai.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;Ni.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new _i.Pair(t.key,null):n=new _i.Pair(t,null),Ai.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let r=Ai.findPair(this.items,t);return!n&&Ni.isPair(r)?Ni.isScalar(r.key)?r.key.value:r.key:r}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=Ai.findPair(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new _i.Pair(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(t,n,r){let{replacer:i}=r,s=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof i=="function"&&(a=i.call(n,a,a)),s.items.push(_i.createPair(a,null,r));return s}};qt.tag="tag:yaml.org,2002:set";var Tv={collection:"map",identify:e=>e instanceof Set,nodeClass:qt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>qt.from(e,t,n),resolve(e,t){if(Ni.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new qt,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Da.YAMLSet=qt;Da.set=Tv});var Fa=B(Ii=>{"use strict";E();var Sv=pn();function $a(e,t){let n=e[0],r=n==="-"||n==="+"?e.substring(1):e,i=a=>t?BigInt(a):Number(a),s=r.replace(/_/g,"").split(":").reduce((a,o)=>a*i(60)+i(o),i(0));return n==="-"?i(-1)*s:s}function qd(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return Sv.stringifyNumber(e);let r="";t<0&&(r="-",t*=n(-1));let i=n(60),s=[t%i];return t<60?s.unshift(0):(t=(t-s[0])/i,s.unshift(t%i),t>=60&&(t=(t-s[0])/i,s.unshift(t))),r+s.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Ev={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>$a(e,n),stringify:qd},Cv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>$a(e,!1),stringify:qd},Wd={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(Wd.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,s,a,o]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0,c=Date.UTC(n,r-1,i,s||0,a||0,o||0,l),d=t[8];if(d&&d!=="Z"){let p=$a(d,!1);Math.abs(p)<30&&(p*=60),c-=6e4*p}return new Date(c)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Ii.floatTime=Cv;Ii.intTime=Ev;Ii.timestamp=Wd});var Gd=B(Kd=>{"use strict";E();var _v=cn(),Av=bi(),Nv=dn(),Iv=qn(),Pv=Aa(),jd=$d(),Ha=Fd(),Pi=Ud(),Ov=ci(),Lv=Oa(),Rv=Si(),Mv=Ba(),Ua=Fa(),Dv=[_v.map,Nv.seq,Iv.string,Av.nullTag,jd.trueTag,jd.falseTag,Pi.intBin,Pi.intOct,Pi.int,Pi.intHex,Ha.floatNaN,Ha.floatExp,Ha.float,Pv.binary,Ov.merge,Lv.omap,Rv.pairs,Mv.set,Ua.intTime,Ua.floatTime,Ua.timestamp];Kd.schema=Dv});var np=B(ja=>{"use strict";E();var Yd=cn(),Bv=bi(),Jd=dn(),$v=qn(),Fv=ya(),qa=ka(),Wa=Sa(),Hv=Ed(),Uv=Ad(),Qd=Aa(),zn=ci(),Zd=Oa(),ep=Si(),zd=Gd(),tp=Ba(),Oi=Fa(),Vd=new Map([["core",Hv.schema],["failsafe",[Yd.map,Jd.seq,$v.string]],["json",Uv.schema],["yaml11",zd.schema],["yaml-1.1",zd.schema]]),Xd={binary:Qd.binary,bool:Fv.boolTag,float:qa.float,floatExp:qa.floatExp,floatNaN:qa.floatNaN,floatTime:Oi.floatTime,int:Wa.int,intHex:Wa.intHex,intOct:Wa.intOct,intTime:Oi.intTime,map:Yd.map,merge:zn.merge,null:Bv.nullTag,omap:Zd.omap,pairs:ep.pairs,seq:Jd.seq,set:tp.set,timestamp:Oi.timestamp},qv={"tag:yaml.org,2002:binary":Qd.binary,"tag:yaml.org,2002:merge":zn.merge,"tag:yaml.org,2002:omap":Zd.omap,"tag:yaml.org,2002:pairs":ep.pairs,"tag:yaml.org,2002:set":tp.set,"tag:yaml.org,2002:timestamp":Oi.timestamp};function Wv(e,t,n){let r=Vd.get(t);if(r&&!e)return n&&!r.includes(zn.merge)?r.concat(zn.merge):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{let s=Array.from(Vd.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${s} or define customTags array`)}if(Array.isArray(e))for(let s of e)i=i.concat(s);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(zn.merge)),i.reduce((s,a)=>{let o=typeof a=="string"?Xd[a]:a;if(!o){let l=JSON.stringify(a),c=Object.keys(Xd).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return s.includes(o)||s.push(o),s},[])}ja.coreKnownTags=qv;ja.getTags=Wv});var za=B(rp=>{"use strict";E();var Ka=q(),jv=cn(),Kv=dn(),Gv=qn(),Li=np(),zv=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,Ga=class e{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:i,schema:s,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(t)?Li.getTags(t,"compat"):t?Li.getTags(null,t):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?Li.coreKnownTags:{},this.tags=Li.getTags(n,this.name,r),this.toStringOptions=o??null,Object.defineProperty(this,Ka.MAP,{value:jv.map}),Object.defineProperty(this,Ka.SCALAR,{value:Gv.string}),Object.defineProperty(this,Ka.SEQ,{value:Kv.seq}),this.sortMapEntries=typeof a=="function"?a:a===!0?zv:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};rp.Schema=Ga});var sp=B(ip=>{"use strict";E();var Vv=q(),Va=Fn(),Vn=Mn();function Xv(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let l=e.directives.toString(e);l?(n.push(l),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");let i=Va.createStringifyContext(e,t),{commentString:s}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");let l=s(e.commentBefore);n.unshift(Vn.indentComment(l,""))}let a=!1,o=null;if(e.contents){if(Vv.isNode(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){let d=s(e.contents.commentBefore);n.push(Vn.indentComment(d,""))}i.forceBlockIndent=!!e.comment,o=e.contents.comment}let l=o?void 0:()=>a=!0,c=Va.stringify(e.contents,i,()=>o=null,l);o&&(c+=Vn.lineComment(c,"",s(o))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Va.stringify(e.contents,i));if(e.directives?.docEnd)if(e.comment){let l=s(e.comment);l.includes(`
4171
- `)?(n.push("..."),n.push(Vn.indentComment(l,""))):n.push(`... ${l}`)}else n.push("...");else{let l=e.comment;l&&a&&(l=l.replace(/^\n+/,"")),l&&((!a||o)&&n[n.length-1]!==""&&n.push(""),n.push(Vn.indentComment(s(l),"")))}return n.join(`
5226
+ ${s.comment}`:r.comment}r=i}e.items[n]=qi.isPair(r)?r:new Ga.Pair(r)}}else t("Expected a sequence for this tag");return e}function tp(e,t,n){let{replacer:r}=n,i=new ew.YAMLSeq(e);i.tag="tag:yaml.org,2002:pairs";let s=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof r=="function"&&(a=r.call(t,String(s++),a));let o,c;if(Array.isArray(a))if(a.length===2)o=a[0],c=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){let l=Object.keys(a);if(l.length===1)o=l[0],c=a[o];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else o=a;i.items.push(Ga.createPair(o,c,n))}return i}var tw={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:ep,createNode:tp};Hi.createPairs=tp;Hi.pairs=tw;Hi.resolvePairs=ep});var Xa=B(Va=>{"use strict";S();var np=X(),za=Nt(),nr=Mt(),nw=Dt(),rp=Ui(),Vt=class e extends nw.YAMLSeq{constructor(){super(),this.add=nr.YAMLMap.prototype.add.bind(this),this.delete=nr.YAMLMap.prototype.delete.bind(this),this.get=nr.YAMLMap.prototype.get.bind(this),this.has=nr.YAMLMap.prototype.has.bind(this),this.set=nr.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let s,a;if(np.isPair(i)?(s=za.toJS(i.key,"",n),a=za.toJS(i.value,s,n)):s=za.toJS(i,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,a)}return r}static from(t,n,r){let i=rp.createPairs(t,n,r),s=new this;return s.items=i.items,s}};Vt.tag="tag:yaml.org,2002:omap";var rw={collection:"seq",identify:e=>e instanceof Map,nodeClass:Vt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=rp.resolvePairs(e,t),r=[];for(let{key:i}of n.items)np.isScalar(i)&&(r.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new Vt,n)},createNode:(e,t,n)=>Vt.from(e,t,n)};Va.YAMLOMap=Vt;Va.omap=rw});var lp=B(Ya=>{"use strict";S();var ip=pe();function sp({value:e,source:t},n){return t&&(e?ap:op).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var ap={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new ip.Scalar(!0),stringify:sp},op={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new ip.Scalar(!1),stringify:sp};Ya.falseTag=op;Ya.trueTag=ap});var cp=B(ji=>{"use strict";S();var iw=pe(),Ja=kn(),sw={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ja.stringifyNumber},aw={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Ja.stringifyNumber(e)}},ow={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new iw.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let r=e.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:Ja.stringifyNumber};ji.float=ow;ji.floatExp=aw;ji.floatNaN=sw});var pp=B(ir=>{"use strict";S();var dp=kn(),rr=e=>typeof e=="bigint"||Number.isInteger(e);function Wi(e,t,n,{intAsBigInt:r}){let i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let a=BigInt(e);return i==="-"?BigInt(-1)*a:a}let s=parseInt(e,n);return i==="-"?-1*s:s}function Qa(e,t,n){let{value:r}=e;if(rr(r)){let i=r.toString(t);return r<0?"-"+n+i.substr(1):n+i}return dp.stringifyNumber(e)}var lw={identify:rr,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Wi(e,2,2,n),stringify:e=>Qa(e,2,"0b")},cw={identify:rr,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Wi(e,1,8,n),stringify:e=>Qa(e,8,"0")},dw={identify:rr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Wi(e,0,10,n),stringify:dp.stringifyNumber},pw={identify:rr,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Wi(e,2,16,n),stringify:e=>Qa(e,16,"0x")};ir.int=dw;ir.intBin=lw;ir.intHex=pw;ir.intOct=cw});var eo=B(Za=>{"use strict";S();var zi=X(),Ki=Rt(),Gi=Mt(),Xt=class e extends Gi.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;zi.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Ki.Pair(t.key,null):n=new Ki.Pair(t,null),Gi.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let r=Gi.findPair(this.items,t);return!n&&zi.isPair(r)?zi.isScalar(r.key)?r.key.value:r.key:r}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=Gi.findPair(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new Ki.Pair(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(t,n,r){let{replacer:i}=r,s=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof i=="function"&&(a=i.call(n,a,a)),s.items.push(Ki.createPair(a,null,r));return s}};Xt.tag="tag:yaml.org,2002:set";var uw={collection:"map",identify:e=>e instanceof Set,nodeClass:Xt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Xt.from(e,t,n),resolve(e,t){if(zi.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Xt,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Za.YAMLSet=Xt;Za.set=uw});var no=B(Vi=>{"use strict";S();var hw=kn();function to(e,t){let n=e[0],r=n==="-"||n==="+"?e.substring(1):e,i=a=>t?BigInt(a):Number(a),s=r.replace(/_/g,"").split(":").reduce((a,o)=>a*i(60)+i(o),i(0));return n==="-"?i(-1)*s:s}function up(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return hw.stringifyNumber(e);let r="";t<0&&(r="-",t*=n(-1));let i=n(60),s=[t%i];return t<60?s.unshift(0):(t=(t-s[0])/i,s.unshift(t%i),t>=60&&(t=(t-s[0])/i,s.unshift(t))),r+s.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var mw={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>to(e,n),stringify:up},fw={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>to(e,!1),stringify:up},hp={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(hp.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,s,a,o]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(n,r-1,i,s||0,a||0,o||0,c),u=t[8];if(u&&u!=="Z"){let d=to(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Vi.floatTime=fw;Vi.intTime=mw;Vi.timestamp=hp});var gp=B(fp=>{"use strict";S();var gw=yn(),bw=Mi(),vw=xn(),ww=er(),yw=Ka(),mp=lp(),ro=cp(),Xi=pp(),xw=Ai(),kw=Xa(),Tw=Ui(),Sw=eo(),io=no(),Cw=[gw.map,vw.seq,ww.string,bw.nullTag,mp.trueTag,mp.falseTag,Xi.intBin,Xi.intOct,Xi.int,Xi.intHex,ro.floatNaN,ro.floatExp,ro.float,yw.binary,xw.merge,kw.omap,Tw.pairs,Sw.set,io.intTime,io.floatTime,io.timestamp];fp.schema=Cw});var Ep=B(oo=>{"use strict";S();var yp=yn(),Ew=Mi(),xp=xn(),Aw=er(),_w=Ba(),so=Fa(),ao=Ha(),Nw=Xd(),Pw=Qd(),kp=Ka(),sr=Ai(),Tp=Xa(),Sp=Ui(),bp=gp(),Cp=eo(),Yi=no(),vp=new Map([["core",Nw.schema],["failsafe",[yp.map,xp.seq,Aw.string]],["json",Pw.schema],["yaml11",bp.schema],["yaml-1.1",bp.schema]]),wp={binary:kp.binary,bool:_w.boolTag,float:so.float,floatExp:so.floatExp,floatNaN:so.floatNaN,floatTime:Yi.floatTime,int:ao.int,intHex:ao.intHex,intOct:ao.intOct,intTime:Yi.intTime,map:yp.map,merge:sr.merge,null:Ew.nullTag,omap:Tp.omap,pairs:Sp.pairs,seq:xp.seq,set:Cp.set,timestamp:Yi.timestamp},Iw={"tag:yaml.org,2002:binary":kp.binary,"tag:yaml.org,2002:merge":sr.merge,"tag:yaml.org,2002:omap":Tp.omap,"tag:yaml.org,2002:pairs":Sp.pairs,"tag:yaml.org,2002:set":Cp.set,"tag:yaml.org,2002:timestamp":Yi.timestamp};function Ow(e,t,n){let r=vp.get(t);if(r&&!e)return n&&!r.includes(sr.merge)?r.concat(sr.merge):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{let s=Array.from(vp.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${s} or define customTags array`)}if(Array.isArray(e))for(let s of e)i=i.concat(s);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(sr.merge)),i.reduce((s,a)=>{let o=typeof a=="string"?wp[a]:a;if(!o){let c=JSON.stringify(a),l=Object.keys(wp).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return s.includes(o)||s.push(o),s},[])}oo.coreKnownTags=Iw;oo.getTags=Ow});var po=B(Ap=>{"use strict";S();var lo=X(),Rw=yn(),Lw=xn(),Mw=er(),Ji=Ep(),Dw=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,co=class e{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:i,schema:s,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(t)?Ji.getTags(t,"compat"):t?Ji.getTags(null,t):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?Ji.coreKnownTags:{},this.tags=Ji.getTags(n,this.name,r),this.toStringOptions=o??null,Object.defineProperty(this,lo.MAP,{value:Rw.map}),Object.defineProperty(this,lo.SCALAR,{value:Mw.string}),Object.defineProperty(this,lo.SEQ,{value:Lw.seq}),this.sortMapEntries=typeof a=="function"?a:a===!0?Dw:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};Ap.Schema=co});var Np=B(_p=>{"use strict";S();var Bw=X(),uo=Jn(),ar=zn();function $w(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(n.push(c),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");let i=uo.createStringifyContext(e,t),{commentString:s}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");let c=s(e.commentBefore);n.unshift(ar.indentComment(c,""))}let a=!1,o=null;if(e.contents){if(Bw.isNode(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){let u=s(e.contents.commentBefore);n.push(ar.indentComment(u,""))}i.forceBlockIndent=!!e.comment,o=e.contents.comment}let c=o?void 0:()=>a=!0,l=uo.stringify(e.contents,i,()=>o=null,c);o&&(l+=ar.lineComment(l,"",s(o))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(uo.stringify(e.contents,i));if(e.directives?.docEnd)if(e.comment){let c=s(e.comment);c.includes(`
5227
+ `)?(n.push("..."),n.push(ar.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=e.comment;c&&a&&(c=c.replace(/^\n+/,"")),c&&((!a||o)&&n[n.length-1]!==""&&n.push(""),n.push(ar.indentComment(s(c),"")))}return n.join(`
4172
5228
  `)+`
4173
- `}ip.stringifyDocument=Xv});var Xn=B(ap=>{"use strict";E();var Yv=Ln(),un=Zr(),Le=q(),Jv=Et(),Qv=xt(),Zv=za(),ew=sp(),Xa=Xr(),tw=Zs(),nw=Rn(),Ya=Qs(),Ja=class e{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Le.NODE_TYPE,{value:Le.DOC});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:a}=s;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Ya.Directives({version:a}),this.setSchema(a,r),this.contents=t===void 0?null:this.createNode(t,i,r)}clone(){let t=Object.create(e.prototype,{[Le.NODE_TYPE]:{value:Le.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Le.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){hn(this.contents)&&this.contents.add(t)}addIn(t,n){hn(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let r=Xa.anchorNames(this);t.anchor=!n||r.has(n)?Xa.findNewAnchor(n||"a",r):n}return new Yv.Alias(t.anchor)}createNode(t,n,r){let i;if(typeof n=="function")t=n.call({"":t},"",t),i=n;else if(Array.isArray(n)){let g=w=>typeof w=="number"||w instanceof String||w instanceof Number,v=n.filter(g).map(String);v.length>0&&(n=n.concat(v)),i=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:a,flow:o,keepUndefined:l,onTagObj:c,tag:d}=r??{},{onAnchor:p,setAnchors:u,sourceObjects:f}=Xa.createNodeAnchors(this,a||"a"),m={aliasDuplicateObjects:s??!0,keepUndefined:l??!1,onAnchor:p,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:f},h=nw.createNode(t,d,m);return o&&Le.isCollection(h)&&(h.flow=!0),u(),h}createPair(t,n,r={}){let i=this.createNode(t,null,r),s=this.createNode(n,null,r);return new Jv.Pair(i,s)}delete(t){return hn(this.contents)?this.contents.delete(t):!1}deleteIn(t){return un.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):hn(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Le.isCollection(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return un.isEmptyPath(t)?!n&&Le.isScalar(this.contents)?this.contents.value:this.contents:Le.isCollection(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Le.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return un.isEmptyPath(t)?this.contents!==void 0:Le.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=un.collectionFromPath(this.schema,[t],n):hn(this.contents)&&this.contents.set(t,n)}setIn(t,n){un.isEmptyPath(t)?this.contents=n:this.contents==null?this.contents=un.collectionFromPath(this.schema,Array.from(t),n):hn(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Ya.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Ya.Directives({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new Zv.Schema(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:s,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=Qv.toJS(this.contents,n??"",o);if(typeof s=="function")for(let{count:c,res:d}of o.anchors.values())s(d,c);return typeof a=="function"?tw.applyReviver(a,{"":l},"",l):l}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return ew.stringifyDocument(this,t)}};function hn(e){if(Le.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}ap.Document=Ja});var Qn=B(Jn=>{"use strict";E();var Yn=class extends Error{constructor(t,n,r,i){super(),this.name=t,this.code=r,this.message=i,this.pos=n}},Qa=class extends Yn{constructor(t,n,r){super("YAMLParseError",t,n,r)}},Za=class extends Yn{constructor(t,n,r){super("YAMLWarning",t,n,r)}},rw=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(o=>t.linePos(o));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let s=i-1,a=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(s>=60&&a.length>80){let o=Math.min(s-39,a.length-79);a="\u2026"+a.substring(o),s-=o-1}if(a.length>80&&(a=a.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(a.substring(0,s))){let o=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);o.length>80&&(o=o.substring(0,79)+`\u2026
4174
- `),a=o+a}if(/[^ ]/.test(a)){let o=1,l=n.linePos[1];l?.line===r&&l.col>i&&(o=Math.max(1,Math.min(l.col-i,80-s)));let c=" ".repeat(s)+"^".repeat(o);n.message+=`:
5229
+ `}_p.stringifyDocument=$w});var or=B(Pp=>{"use strict";S();var Fw=Kn(),Tn=bi(),De=X(),qw=Rt(),Hw=Nt(),Uw=po(),jw=Np(),ho=hi(),Ww=ga(),Kw=Gn(),mo=fa(),fo=class e{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,De.NODE_TYPE,{value:De.DOC});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:a}=s;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new mo.Directives({version:a}),this.setSchema(a,r),this.contents=t===void 0?null:this.createNode(t,i,r)}clone(){let t=Object.create(e.prototype,{[De.NODE_TYPE]:{value:De.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=De.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Sn(this.contents)&&this.contents.add(t)}addIn(t,n){Sn(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let r=ho.anchorNames(this);t.anchor=!n||r.has(n)?ho.findNewAnchor(n||"a",r):n}return new Fw.Alias(t.anchor)}createNode(t,n,r){let i;if(typeof n=="function")t=n.call({"":t},"",t),i=n;else if(Array.isArray(n)){let g=T=>typeof T=="number"||T instanceof String||T instanceof Number,y=n.filter(g).map(String);y.length>0&&(n=n.concat(y)),i=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:a,flow:o,keepUndefined:c,onTagObj:l,tag:u}=r??{},{onAnchor:d,setAnchors:p,sourceObjects:h}=ho.createNodeAnchors(this,a||"a"),f={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:h},m=Kw.createNode(t,u,f);return o&&De.isCollection(m)&&(m.flow=!0),p(),m}createPair(t,n,r={}){let i=this.createNode(t,null,r),s=this.createNode(n,null,r);return new qw.Pair(i,s)}delete(t){return Sn(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Tn.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):Sn(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return De.isCollection(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Tn.isEmptyPath(t)?!n&&De.isScalar(this.contents)?this.contents.value:this.contents:De.isCollection(this.contents)?this.contents.getIn(t,n):void 0}has(t){return De.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return Tn.isEmptyPath(t)?this.contents!==void 0:De.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=Tn.collectionFromPath(this.schema,[t],n):Sn(this.contents)&&this.contents.set(t,n)}setIn(t,n){Tn.isEmptyPath(t)?this.contents=n:this.contents==null?this.contents=Tn.collectionFromPath(this.schema,Array.from(t),n):Sn(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new mo.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new mo.Directives({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new Uw.Schema(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:s,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Hw.toJS(this.contents,n??"",o);if(typeof s=="function")for(let{count:l,res:u}of o.anchors.values())s(u,l);return typeof a=="function"?Ww.applyReviver(a,{"":c},"",c):c}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return jw.stringifyDocument(this,t)}};function Sn(e){if(De.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}Pp.Document=fo});var dr=B(cr=>{"use strict";S();var lr=class extends Error{constructor(t,n,r,i){super(),this.name=t,this.code=r,this.message=i,this.pos=n}},go=class extends lr{constructor(t,n,r){super("YAMLParseError",t,n,r)}},bo=class extends lr{constructor(t,n,r){super("YAMLWarning",t,n,r)}},Gw=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(o=>t.linePos(o));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let s=i-1,a=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(s>=60&&a.length>80){let o=Math.min(s-39,a.length-79);a="\u2026"+a.substring(o),s-=o-1}if(a.length>80&&(a=a.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(a.substring(0,s))){let o=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);o.length>80&&(o=o.substring(0,79)+`\u2026
5230
+ `),a=o+a}if(/[^ ]/.test(a)){let o=1,c=n.linePos[1];c?.line===r&&c.col>i&&(o=Math.max(1,Math.min(c.col-i,80-s)));let l=" ".repeat(s)+"^".repeat(o);n.message+=`:
4175
5231
 
4176
5232
  ${a}
4177
- ${c}
4178
- `}};Jn.YAMLError=Yn;Jn.YAMLParseError=Qa;Jn.YAMLWarning=Za;Jn.prettifyError=rw});var Zn=B(op=>{"use strict";E();function iw(e,{flow:t,indicator:n,next:r,offset:i,onError:s,parentIndent:a,startOnNewline:o}){let l=!1,c=o,d=o,p="",u="",f=!1,m=!1,h=null,g=null,v=null,w=null,b=null,C=null,A=null;for(let x of e)switch(m&&(x.type!=="space"&&x.type!=="newline"&&x.type!=="comma"&&s(x.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(c&&x.type!=="comment"&&x.type!=="newline"&&s(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),x.type){case"space":!t&&(n!=="doc-start"||r?.type!=="flow-collection")&&x.source.includes(" ")&&(h=x),d=!0;break;case"comment":{d||s(x,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let _=x.source.substring(1)||" ";p?p+=u+_:p=_,u="",c=!1;break}case"newline":c?p?p+=x.source:(!C||n!=="seq-item-ind")&&(l=!0):u+=x.source,c=!0,f=!0,(g||v)&&(w=x),d=!0;break;case"anchor":g&&s(x,"MULTIPLE_ANCHORS","A node can have at most one anchor"),x.source.endsWith(":")&&s(x.offset+x.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=x,A??(A=x.offset),c=!1,d=!1,m=!0;break;case"tag":{v&&s(x,"MULTIPLE_TAGS","A node can have at most one tag"),v=x,A??(A=x.offset),c=!1,d=!1,m=!0;break}case n:(g||v)&&s(x,"BAD_PROP_ORDER",`Anchors and tags must be after the ${x.source} indicator`),C&&s(x,"UNEXPECTED_TOKEN",`Unexpected ${x.source} in ${t??"collection"}`),C=x,c=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){b&&s(x,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=x,c=!1,d=!1;break}default:s(x,"UNEXPECTED_TOKEN",`Unexpected ${x.type} token`),c=!1,d=!1}let y=e[e.length-1],T=y?y.offset+y.source.length:i;return m&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&s(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(c&&h.indent<=a||r?.type==="block-map"||r?.type==="block-seq")&&s(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:C,spaceBefore:l,comment:p,hasNewline:f,anchor:g,tag:v,newlineAfterProp:w,end:T,start:A??T}}op.resolveProps=iw});var Ri=B(lp=>{"use strict";E();function eo(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
4179
- `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(eo(t.key)||eo(t.value))return!0}return!1;default:return!0}}lp.containsNewline=eo});var to=B(cp=>{"use strict";E();var sw=Ri();function aw(e,t,n){if(t?.type==="flow-collection"){let r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&sw.containsNewline(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}cp.flowIndentCheck=aw});var no=B(pp=>{"use strict";E();var dp=q();function ow(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r=="function"?r:(s,a)=>s===a||dp.isScalar(s)&&dp.isScalar(a)&&s.value===a.value;return t.some(s=>i(s.key,n))}pp.mapIncludes=ow});var bp=B(gp=>{"use strict";E();var up=Et(),lw=_t(),hp=Zn(),cw=Ri(),fp=to(),dw=no(),mp="All mapping items must start at the same column";function pw({composeNode:e,composeEmptyNode:t},n,r,i,s){let a=s?.nodeClass??lw.YAMLMap,o=new a(n.schema);n.atRoot&&(n.atRoot=!1);let l=r.offset,c=null;for(let d of r.items){let{start:p,key:u,sep:f,value:m}=d,h=hp.resolveProps(p,{indicator:"explicit-key-ind",next:u??f?.[0],offset:l,onError:i,parentIndent:r.indent,startOnNewline:!0}),g=!h.found;if(g){if(u&&(u.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in u&&u.indent!==r.indent&&i(l,"BAD_INDENT",mp)),!h.anchor&&!h.tag&&!f){c=h.end,h.comment&&(o.comment?o.comment+=`
4180
- `+h.comment:o.comment=h.comment);continue}(h.newlineAfterProp||cw.containsNewline(u))&&i(u??p[p.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==r.indent&&i(l,"BAD_INDENT",mp);n.atKey=!0;let v=h.end,w=u?e(n,u,h,i):t(n,v,p,null,h,i);n.schema.compat&&fp.flowIndentCheck(r.indent,u,i),n.atKey=!1,dw.mapIncludes(n,o.items,w)&&i(v,"DUPLICATE_KEY","Map keys must be unique");let b=hp.resolveProps(f??[],{indicator:"map-value-ind",next:m,offset:w.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type==="block-scalar"});if(l=b.end,b.found){g&&(m?.type==="block-map"&&!b.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&h.start<b.found.offset-1024&&i(w.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=m?e(n,m,b,i):t(n,l,f,null,b,i);n.schema.compat&&fp.flowIndentCheck(r.indent,m,i),l=C.range[2];let A=new up.Pair(w,C);n.options.keepSourceTokens&&(A.srcToken=d),o.items.push(A)}else{g&&i(w.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(w.comment?w.comment+=`
4181
- `+b.comment:w.comment=b.comment);let C=new up.Pair(w);n.options.keepSourceTokens&&(C.srcToken=d),o.items.push(C)}}return c&&c<l&&i(c,"IMPOSSIBLE","Map comment with trailing content"),o.range=[r.offset,l,c??l],o}gp.resolveBlockMap=pw});var wp=B(vp=>{"use strict";E();var uw=At(),hw=Zn(),fw=to();function mw({composeNode:e,composeEmptyNode:t},n,r,i,s){let a=s?.nodeClass??uw.YAMLSeq,o=new a(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=r.offset,c=null;for(let{start:d,value:p}of r.items){let u=hw.resolveProps(d,{indicator:"seq-item-ind",next:p,offset:l,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||p)p?.type==="block-seq"?i(u.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=u.end,u.comment&&(o.comment=u.comment);continue}let f=p?e(n,p,u,i):t(n,u.end,d,null,u,i);n.schema.compat&&fw.flowIndentCheck(r.indent,p,i),l=f.range[2],o.items.push(f)}return o.range=[r.offset,l,c??l],o}vp.resolveBlockSeq=mw});var fn=B(yp=>{"use strict";E();function gw(e,t,n,r){let i="";if(e){let s=!1,a="";for(let o of e){let{source:l,type:c}=o;switch(c){case"space":s=!0;break;case"comment":{n&&!s&&r(o,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=l.substring(1)||" ";i?i+=a+d:i=d,a="";break}case"newline":i&&(a+=l),s=!0;break;default:r(o,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}t+=l.length}}return{comment:i,offset:t}}yp.resolveEnd=gw});var Sp=B(Tp=>{"use strict";E();var bw=q(),vw=Et(),xp=_t(),ww=At(),yw=fn(),kp=Zn(),xw=Ri(),kw=no(),ro="Block collections are not allowed within flow collections",io=e=>e&&(e.type==="block-map"||e.type==="block-seq");function Tw({composeNode:e,composeEmptyNode:t},n,r,i,s){let a=r.start.source==="{",o=a?"flow map":"flow sequence",l=s?.nodeClass??(a?xp.YAMLMap:ww.YAMLSeq),c=new l(n.schema);c.flow=!0;let d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let p=r.offset+r.start.source.length;for(let g=0;g<r.items.length;++g){let v=r.items[g],{start:w,key:b,sep:C,value:A}=v,y=kp.resolveProps(w,{flow:o,indicator:"explicit-key-ind",next:b??C?.[0],offset:p,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!y.found){if(!y.anchor&&!y.tag&&!C&&!A){g===0&&y.comma?i(y.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`):g<r.items.length-1&&i(y.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${o}`),y.comment&&(c.comment?c.comment+=`
4182
- `+y.comment:c.comment=y.comment),p=y.end;continue}!a&&n.options.strict&&xw.containsNewline(b)&&i(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)y.comma&&i(y.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`);else if(y.comma||i(y.start,"MISSING_CHAR",`Missing , between ${o} items`),y.comment){let T="";e:for(let x of w)switch(x.type){case"comma":case"space":break;case"comment":T=x.source.substring(1);break e;default:break e}if(T){let x=c.items[c.items.length-1];bw.isPair(x)&&(x=x.value??x.key),x.comment?x.comment+=`
4183
- `+T:x.comment=T,y.comment=y.comment.substring(T.length+1)}}if(!a&&!C&&!y.found){let T=A?e(n,A,y,i):t(n,y.end,C,null,y,i);c.items.push(T),p=T.range[2],io(A)&&i(T.range,"BLOCK_IN_FLOW",ro)}else{n.atKey=!0;let T=y.end,x=b?e(n,b,y,i):t(n,T,w,null,y,i);io(b)&&i(x.range,"BLOCK_IN_FLOW",ro),n.atKey=!1;let _=kp.resolveProps(C??[],{flow:o,indicator:"map-value-ind",next:A,offset:x.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!a&&!y.found&&n.options.strict){if(C)for(let D of C){if(D===_.found)break;if(D.type==="newline"){i(D,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}y.start<_.found.offset-1024&&i(_.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else A&&("source"in A&&A.source?.[0]===":"?i(A,"MISSING_CHAR",`Missing space after : in ${o}`):i(_.start,"MISSING_CHAR",`Missing , or : between ${o} items`));let N=A?e(n,A,_,i):_.found?t(n,_.end,C,null,_,i):null;N?io(A)&&i(N.range,"BLOCK_IN_FLOW",ro):_.comment&&(x.comment?x.comment+=`
4184
- `+_.comment:x.comment=_.comment);let M=new vw.Pair(x,N);if(n.options.keepSourceTokens&&(M.srcToken=v),a){let D=c;kw.mapIncludes(n,D.items,x)&&i(T,"DUPLICATE_KEY","Map keys must be unique"),D.items.push(M)}else{let D=new xp.YAMLMap(n.schema);D.flow=!0,D.items.push(M);let V=(N??x).range;D.range=[x.range[0],V[1],V[2]],c.items.push(D)}p=N?N.range[2]:_.end}}let u=a?"}":"]",[f,...m]=r.end,h=p;if(f?.source===u)h=f.offset+f.source.length;else{let g=o[0].toUpperCase()+o.substring(1),v=d?`${g} must end with a ${u}`:`${g} in block collection must be sufficiently indented and end with a ${u}`;i(p,d?"MISSING_CHAR":"BAD_INDENT",v),f&&f.source.length!==1&&m.unshift(f)}if(m.length>0){let g=yw.resolveEnd(m,h,n.options.strict,i);g.comment&&(c.comment?c.comment+=`
4185
- `+g.comment:c.comment=g.comment),c.range=[r.offset,h,g.offset]}else c.range=[r.offset,h,h];return c}Tp.resolveFlowCollection=Tw});var Cp=B(Ep=>{"use strict";E();var Sw=q(),Ew=ce(),Cw=_t(),_w=At(),Aw=bp(),Nw=wp(),Iw=Sp();function so(e,t,n,r,i,s){let a=n.type==="block-map"?Aw.resolveBlockMap(e,t,n,r,s):n.type==="block-seq"?Nw.resolveBlockSeq(e,t,n,r,s):Iw.resolveFlowCollection(e,t,n,r,s),o=a.constructor;return i==="!"||i===o.tagName?(a.tag=o.tagName,a):(i&&(a.tag=i),a)}function Pw(e,t,n,r,i){let s=r.tag,a=s?t.directives.tagName(s.source,u=>i(s,"TAG_RESOLVE_FAILED",u)):null;if(n.type==="block-seq"){let{anchor:u,newlineAfterProp:f}=r,m=u&&s?u.offset>s.offset?u:s:u??s;m&&(!f||f.offset<m.offset)&&i(m,"MISSING_CHAR","Missing newline after block sequence props")}let o=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!s||!a||a==="!"||a===Cw.YAMLMap.tagName&&o==="map"||a===_w.YAMLSeq.tagName&&o==="seq")return so(e,t,n,i,a);let l=t.schema.tags.find(u=>u.tag===a&&u.collection===o);if(!l){let u=t.schema.knownTags[a];if(u?.collection===o)t.schema.tags.push(Object.assign({},u,{default:!1})),l=u;else return u?i(s,"BAD_COLLECTION_TYPE",`${u.tag} used for ${o} collection, but expects ${u.collection??"scalar"}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),so(e,t,n,i,a)}let c=so(e,t,n,i,a,l),d=l.resolve?.(c,u=>i(s,"TAG_RESOLVE_FAILED",u),t.options)??c,p=Sw.isNode(d)?d:new Ew.Scalar(d);return p.range=c.range,p.tag=a,l?.format&&(p.format=l.format),p}Ep.composeCollection=Pw});var oo=B(_p=>{"use strict";E();var ao=ce();function Ow(e,t,n){let r=t.offset,i=Lw(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let s=i.mode===">"?ao.Scalar.BLOCK_FOLDED:ao.Scalar.BLOCK_LITERAL,a=t.source?Rw(t.source):[],o=a.length;for(let h=a.length-1;h>=0;--h){let g=a[h][1];if(g===""||g==="\r")o=h;else break}if(o===0){let h=i.chomp==="+"&&a.length>0?`
4186
- `.repeat(Math.max(1,a.length-1)):"",g=r+i.length;return t.source&&(g+=t.source.length),{value:h,type:s,comment:i.comment,range:[r,g,g]}}let l=t.indent+i.indent,c=t.offset+i.length,d=0;for(let h=0;h<o;++h){let[g,v]=a[h];if(v===""||v==="\r")i.indent===0&&g.length>l&&(l=g.length);else{g.length<l&&n(c+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(l=g.length),d=h,l===0&&!e.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=g.length+v.length+1}for(let h=a.length-1;h>=o;--h)a[h][0].length>l&&(o=h+1);let p="",u="",f=!1;for(let h=0;h<d;++h)p+=a[h][0].slice(l)+`
4187
- `;for(let h=d;h<o;++h){let[g,v]=a[h];c+=g.length+v.length+1;let w=v[v.length-1]==="\r";if(w&&(v=v.slice(0,-1)),v&&g.length<l){let C=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(c-v.length-(w?2:1),"BAD_INDENT",C),g=""}s===ao.Scalar.BLOCK_LITERAL?(p+=u+g.slice(l)+v,u=`
4188
- `):g.length>l||v[0]===" "?(u===" "?u=`
4189
- `:!f&&u===`
4190
- `&&(u=`
4191
-
4192
- `),p+=u+g.slice(l)+v,u=`
4193
- `,f=!0):v===""?u===`
4194
- `?p+=`
4195
- `:u=`
4196
- `:(p+=u+v,u=" ",f=!1)}switch(i.chomp){case"-":break;case"+":for(let h=o;h<a.length;++h)p+=`
4197
- `+a[h][0].slice(l);p[p.length-1]!==`
4198
- `&&(p+=`
4199
- `);break;default:p+=`
4200
- `}let m=r+i.length+t.source.length;return{value:p,type:s,comment:i.comment,range:[r,m,m]}}function Lw({offset:e,props:t},n,r){if(t[0].type!=="block-scalar-header")return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=t[0],s=i[0],a=0,o="",l=-1;for(let u=1;u<i.length;++u){let f=i[u];if(!o&&(f==="-"||f==="+"))o=f;else{let m=Number(f);!a&&m?a=m:l===-1&&(l=e+u)}}l!==-1&&r(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,d="",p=i.length;for(let u=1;u<t.length;++u){let f=t[u];switch(f.type){case"space":c=!0;case"newline":p+=f.source.length;break;case"comment":n&&!c&&r(f,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),p+=f.source.length,d=f.source.substring(1);break;case"error":r(f,"UNEXPECTED_TOKEN",f.message),p+=f.source.length;break;default:{let m=`Unexpected token in block scalar header: ${f.type}`;r(f,"UNEXPECTED_TOKEN",m);let h=f.source;h&&typeof h=="string"&&(p+=h.length)}}}return{mode:s,indent:a,chomp:o,comment:d,length:p}}function Rw(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),s=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let a=1;a<t.length;a+=2)s.push([t[a],t[a+1]]);return s}_p.resolveBlockScalar=Ow});var co=B(Np=>{"use strict";E();var lo=ce(),Mw=fn();function Dw(e,t,n){let{offset:r,type:i,source:s,end:a}=e,o,l,c=(u,f,m)=>n(r+u,f,m);switch(i){case"scalar":o=lo.Scalar.PLAIN,l=Bw(s,c);break;case"single-quoted-scalar":o=lo.Scalar.QUOTE_SINGLE,l=$w(s,c);break;case"double-quoted-scalar":o=lo.Scalar.QUOTE_DOUBLE,l=Fw(s,c);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}let d=r+s.length,p=Mw.resolveEnd(a,d,t,n);return{value:l,type:o,comment:p.comment,range:[r,d,p.offset]}}function Bw(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Ap(e)}function $w(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Ap(e.slice(1,-1)).replace(/''/g,"'")}function Ap(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
5233
+ ${l}
5234
+ `}};cr.YAMLError=lr;cr.YAMLParseError=go;cr.YAMLWarning=bo;cr.prettifyError=Gw});var pr=B(Ip=>{"use strict";S();function zw(e,{flow:t,indicator:n,next:r,offset:i,onError:s,parentIndent:a,startOnNewline:o}){let c=!1,l=o,u=o,d="",p="",h=!1,f=!1,m=null,g=null,y=null,T=null,b=null,C=null,_=null;for(let v of e)switch(f&&(v.type!=="space"&&v.type!=="newline"&&v.type!=="comma"&&s(v.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),f=!1),m&&(l&&v.type!=="comment"&&v.type!=="newline"&&s(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),v.type){case"space":!t&&(n!=="doc-start"||r?.type!=="flow-collection")&&v.source.includes(" ")&&(m=v),u=!0;break;case"comment":{u||s(v,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let A=v.source.substring(1)||" ";d?d+=p+A:d=A,p="",l=!1;break}case"newline":l?d?d+=v.source:(!C||n!=="seq-item-ind")&&(c=!0):p+=v.source,l=!0,h=!0,(g||y)&&(T=v),u=!0;break;case"anchor":g&&s(v,"MULTIPLE_ANCHORS","A node can have at most one anchor"),v.source.endsWith(":")&&s(v.offset+v.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=v,_??(_=v.offset),l=!1,u=!1,f=!0;break;case"tag":{y&&s(v,"MULTIPLE_TAGS","A node can have at most one tag"),y=v,_??(_=v.offset),l=!1,u=!1,f=!0;break}case n:(g||y)&&s(v,"BAD_PROP_ORDER",`Anchors and tags must be after the ${v.source} indicator`),C&&s(v,"UNEXPECTED_TOKEN",`Unexpected ${v.source} in ${t??"collection"}`),C=v,l=n==="seq-item-ind"||n==="explicit-key-ind",u=!1;break;case"comma":if(t){b&&s(v,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=v,l=!1,u=!1;break}default:s(v,"UNEXPECTED_TOKEN",`Unexpected ${v.type} token`),l=!1,u=!1}let w=e[e.length-1],x=w?w.offset+w.source.length:i;return f&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&s(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(l&&m.indent<=a||r?.type==="block-map"||r?.type==="block-seq")&&s(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:C,spaceBefore:c,comment:d,hasNewline:h,anchor:g,tag:y,newlineAfterProp:T,end:x,start:_??x}}Ip.resolveProps=zw});var Qi=B(Op=>{"use strict";S();function vo(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
5235
+ `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(vo(t.key)||vo(t.value))return!0}return!1;default:return!0}}Op.containsNewline=vo});var wo=B(Rp=>{"use strict";S();var Vw=Qi();function Xw(e,t,n){if(t?.type==="flow-collection"){let r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&Vw.containsNewline(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Rp.flowIndentCheck=Xw});var yo=B(Mp=>{"use strict";S();var Lp=X();function Yw(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r=="function"?r:(s,a)=>s===a||Lp.isScalar(s)&&Lp.isScalar(a)&&s.value===a.value;return t.some(s=>i(s.key,n))}Mp.mapIncludes=Yw});var Hp=B(qp=>{"use strict";S();var Dp=Rt(),Jw=Mt(),Bp=pr(),Qw=Qi(),$p=wo(),Zw=yo(),Fp="All mapping items must start at the same column";function e0({composeNode:e,composeEmptyNode:t},n,r,i,s){let a=s?.nodeClass??Jw.YAMLMap,o=new a(n.schema);n.atRoot&&(n.atRoot=!1);let c=r.offset,l=null;for(let u of r.items){let{start:d,key:p,sep:h,value:f}=u,m=Bp.resolveProps(d,{indicator:"explicit-key-ind",next:p??h?.[0],offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0}),g=!m.found;if(g){if(p&&(p.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==r.indent&&i(c,"BAD_INDENT",Fp)),!m.anchor&&!m.tag&&!h){l=m.end,m.comment&&(o.comment?o.comment+=`
5236
+ `+m.comment:o.comment=m.comment);continue}(m.newlineAfterProp||Qw.containsNewline(p))&&i(p??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==r.indent&&i(c,"BAD_INDENT",Fp);n.atKey=!0;let y=m.end,T=p?e(n,p,m,i):t(n,y,d,null,m,i);n.schema.compat&&$p.flowIndentCheck(r.indent,p,i),n.atKey=!1,Zw.mapIncludes(n,o.items,T)&&i(y,"DUPLICATE_KEY","Map keys must be unique");let b=Bp.resolveProps(h??[],{indicator:"map-value-ind",next:f,offset:T.range[2],onError:i,parentIndent:r.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=b.end,b.found){g&&(f?.type==="block-map"&&!b.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&m.start<b.found.offset-1024&&i(T.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=f?e(n,f,b,i):t(n,c,h,null,b,i);n.schema.compat&&$p.flowIndentCheck(r.indent,f,i),c=C.range[2];let _=new Dp.Pair(T,C);n.options.keepSourceTokens&&(_.srcToken=u),o.items.push(_)}else{g&&i(T.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(T.comment?T.comment+=`
5237
+ `+b.comment:T.comment=b.comment);let C=new Dp.Pair(T);n.options.keepSourceTokens&&(C.srcToken=u),o.items.push(C)}}return l&&l<c&&i(l,"IMPOSSIBLE","Map comment with trailing content"),o.range=[r.offset,c,l??c],o}qp.resolveBlockMap=e0});var jp=B(Up=>{"use strict";S();var t0=Dt(),n0=pr(),r0=wo();function i0({composeNode:e,composeEmptyNode:t},n,r,i,s){let a=s?.nodeClass??t0.YAMLSeq,o=new a(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=r.offset,l=null;for(let{start:u,value:d}of r.items){let p=n0.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||d)d?.type==="block-seq"?i(p.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=p.end,p.comment&&(o.comment=p.comment);continue}let h=d?e(n,d,p,i):t(n,p.end,u,null,p,i);n.schema.compat&&r0.flowIndentCheck(r.indent,d,i),c=h.range[2],o.items.push(h)}return o.range=[r.offset,c,l??c],o}Up.resolveBlockSeq=i0});var Cn=B(Wp=>{"use strict";S();function s0(e,t,n,r){let i="";if(e){let s=!1,a="";for(let o of e){let{source:c,type:l}=o;switch(l){case"space":s=!0;break;case"comment":{n&&!s&&r(o,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=a+u:i=u,a="";break}case"newline":i&&(a+=c),s=!0;break;default:r(o,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=c.length}}return{comment:i,offset:t}}Wp.resolveEnd=s0});var Vp=B(zp=>{"use strict";S();var a0=X(),o0=Rt(),Kp=Mt(),l0=Dt(),c0=Cn(),Gp=pr(),d0=Qi(),p0=yo(),xo="Block collections are not allowed within flow collections",ko=e=>e&&(e.type==="block-map"||e.type==="block-seq");function u0({composeNode:e,composeEmptyNode:t},n,r,i,s){let a=r.start.source==="{",o=a?"flow map":"flow sequence",c=s?.nodeClass??(a?Kp.YAMLMap:l0.YAMLSeq),l=new c(n.schema);l.flow=!0;let u=n.atRoot;u&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let d=r.offset+r.start.source.length;for(let g=0;g<r.items.length;++g){let y=r.items[g],{start:T,key:b,sep:C,value:_}=y,w=Gp.resolveProps(T,{flow:o,indicator:"explicit-key-ind",next:b??C?.[0],offset:d,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!w.found){if(!w.anchor&&!w.tag&&!C&&!_){g===0&&w.comma?i(w.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`):g<r.items.length-1&&i(w.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${o}`),w.comment&&(l.comment?l.comment+=`
5238
+ `+w.comment:l.comment=w.comment),d=w.end;continue}!a&&n.options.strict&&d0.containsNewline(b)&&i(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)w.comma&&i(w.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`);else if(w.comma||i(w.start,"MISSING_CHAR",`Missing , between ${o} items`),w.comment){let x="";e:for(let v of T)switch(v.type){case"comma":case"space":break;case"comment":x=v.source.substring(1);break e;default:break e}if(x){let v=l.items[l.items.length-1];a0.isPair(v)&&(v=v.value??v.key),v.comment?v.comment+=`
5239
+ `+x:v.comment=x,w.comment=w.comment.substring(x.length+1)}}if(!a&&!C&&!w.found){let x=_?e(n,_,w,i):t(n,w.end,C,null,w,i);l.items.push(x),d=x.range[2],ko(_)&&i(x.range,"BLOCK_IN_FLOW",xo)}else{n.atKey=!0;let x=w.end,v=b?e(n,b,w,i):t(n,x,T,null,w,i);ko(b)&&i(v.range,"BLOCK_IN_FLOW",xo),n.atKey=!1;let A=Gp.resolveProps(C??[],{flow:o,indicator:"map-value-ind",next:_,offset:v.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(A.found){if(!a&&!w.found&&n.options.strict){if(C)for(let O of C){if(O===A.found)break;if(O.type==="newline"){i(O,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}w.start<A.found.offset-1024&&i(A.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else _&&("source"in _&&_.source?.[0]===":"?i(_,"MISSING_CHAR",`Missing space after : in ${o}`):i(A.start,"MISSING_CHAR",`Missing , or : between ${o} items`));let N=_?e(n,_,A,i):A.found?t(n,A.end,C,null,A,i):null;N?ko(_)&&i(N.range,"BLOCK_IN_FLOW",xo):A.comment&&(v.comment?v.comment+=`
5240
+ `+A.comment:v.comment=A.comment);let M=new o0.Pair(v,N);if(n.options.keepSourceTokens&&(M.srcToken=y),a){let O=l;p0.mapIncludes(n,O.items,v)&&i(x,"DUPLICATE_KEY","Map keys must be unique"),O.items.push(M)}else{let O=new Kp.YAMLMap(n.schema);O.flow=!0,O.items.push(M);let F=(N??v).range;O.range=[v.range[0],F[1],F[2]],l.items.push(O)}d=N?N.range[2]:A.end}}let p=a?"}":"]",[h,...f]=r.end,m=d;if(h?.source===p)m=h.offset+h.source.length;else{let g=o[0].toUpperCase()+o.substring(1),y=u?`${g} must end with a ${p}`:`${g} in block collection must be sufficiently indented and end with a ${p}`;i(d,u?"MISSING_CHAR":"BAD_INDENT",y),h&&h.source.length!==1&&f.unshift(h)}if(f.length>0){let g=c0.resolveEnd(f,m,n.options.strict,i);g.comment&&(l.comment?l.comment+=`
5241
+ `+g.comment:l.comment=g.comment),l.range=[r.offset,m,g.offset]}else l.range=[r.offset,m,m];return l}zp.resolveFlowCollection=u0});var Yp=B(Xp=>{"use strict";S();var h0=X(),m0=pe(),f0=Mt(),g0=Dt(),b0=Hp(),v0=jp(),w0=Vp();function To(e,t,n,r,i,s){let a=n.type==="block-map"?b0.resolveBlockMap(e,t,n,r,s):n.type==="block-seq"?v0.resolveBlockSeq(e,t,n,r,s):w0.resolveFlowCollection(e,t,n,r,s),o=a.constructor;return i==="!"||i===o.tagName?(a.tag=o.tagName,a):(i&&(a.tag=i),a)}function y0(e,t,n,r,i){let s=r.tag,a=s?t.directives.tagName(s.source,p=>i(s,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){let{anchor:p,newlineAfterProp:h}=r,f=p&&s?p.offset>s.offset?p:s:p??s;f&&(!h||h.offset<f.offset)&&i(f,"MISSING_CHAR","Missing newline after block sequence props")}let o=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!s||!a||a==="!"||a===f0.YAMLMap.tagName&&o==="map"||a===g0.YAMLSeq.tagName&&o==="seq")return To(e,t,n,i,a);let c=t.schema.tags.find(p=>p.tag===a&&p.collection===o);if(!c){let p=t.schema.knownTags[a];if(p?.collection===o)t.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?i(s,"BAD_COLLECTION_TYPE",`${p.tag} used for ${o} collection, but expects ${p.collection??"scalar"}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),To(e,t,n,i,a)}let l=To(e,t,n,i,a,c),u=c.resolve?.(l,p=>i(s,"TAG_RESOLVE_FAILED",p),t.options)??l,d=h0.isNode(u)?u:new m0.Scalar(u);return d.range=l.range,d.tag=a,c?.format&&(d.format=c.format),d}Xp.composeCollection=y0});var Co=B(Jp=>{"use strict";S();var So=pe();function x0(e,t,n){let r=t.offset,i=k0(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let s=i.mode===">"?So.Scalar.BLOCK_FOLDED:So.Scalar.BLOCK_LITERAL,a=t.source?T0(t.source):[],o=a.length;for(let m=a.length-1;m>=0;--m){let g=a[m][1];if(g===""||g==="\r")o=m;else break}if(o===0){let m=i.chomp==="+"&&a.length>0?`
5242
+ `.repeat(Math.max(1,a.length-1)):"",g=r+i.length;return t.source&&(g+=t.source.length),{value:m,type:s,comment:i.comment,range:[r,g,g]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let m=0;m<o;++m){let[g,y]=a[m];if(y===""||y==="\r")i.indent===0&&g.length>c&&(c=g.length);else{g.length<c&&n(l+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(c=g.length),u=m,c===0&&!e.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=g.length+y.length+1}for(let m=a.length-1;m>=o;--m)a[m][0].length>c&&(o=m+1);let d="",p="",h=!1;for(let m=0;m<u;++m)d+=a[m][0].slice(c)+`
5243
+ `;for(let m=u;m<o;++m){let[g,y]=a[m];l+=g.length+y.length+1;let T=y[y.length-1]==="\r";if(T&&(y=y.slice(0,-1)),y&&g.length<c){let C=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(l-y.length-(T?2:1),"BAD_INDENT",C),g=""}s===So.Scalar.BLOCK_LITERAL?(d+=p+g.slice(c)+y,p=`
5244
+ `):g.length>c||y[0]===" "?(p===" "?p=`
5245
+ `:!h&&p===`
5246
+ `&&(p=`
5247
+
5248
+ `),d+=p+g.slice(c)+y,p=`
5249
+ `,h=!0):y===""?p===`
5250
+ `?d+=`
5251
+ `:p=`
5252
+ `:(d+=p+y,p=" ",h=!1)}switch(i.chomp){case"-":break;case"+":for(let m=o;m<a.length;++m)d+=`
5253
+ `+a[m][0].slice(c);d[d.length-1]!==`
5254
+ `&&(d+=`
5255
+ `);break;default:d+=`
5256
+ `}let f=r+i.length+t.source.length;return{value:d,type:s,comment:i.comment,range:[r,f,f]}}function k0({offset:e,props:t},n,r){if(t[0].type!=="block-scalar-header")return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=t[0],s=i[0],a=0,o="",c=-1;for(let p=1;p<i.length;++p){let h=i[p];if(!o&&(h==="-"||h==="+"))o=h;else{let f=Number(h);!a&&f?a=f:c===-1&&(c=e+p)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,u="",d=i.length;for(let p=1;p<t.length;++p){let h=t[p];switch(h.type){case"space":l=!0;case"newline":d+=h.source.length;break;case"comment":n&&!l&&r(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=h.source.length,u=h.source.substring(1);break;case"error":r(h,"UNEXPECTED_TOKEN",h.message),d+=h.source.length;break;default:{let f=`Unexpected token in block scalar header: ${h.type}`;r(h,"UNEXPECTED_TOKEN",f);let m=h.source;m&&typeof m=="string"&&(d+=m.length)}}}return{mode:s,indent:a,chomp:o,comment:u,length:d}}function T0(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),s=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let a=1;a<t.length;a+=2)s.push([t[a],t[a+1]]);return s}Jp.resolveBlockScalar=x0});var Ao=B(Zp=>{"use strict";S();var Eo=pe(),S0=Cn();function C0(e,t,n){let{offset:r,type:i,source:s,end:a}=e,o,c,l=(p,h,f)=>n(r+p,h,f);switch(i){case"scalar":o=Eo.Scalar.PLAIN,c=E0(s,l);break;case"single-quoted-scalar":o=Eo.Scalar.QUOTE_SINGLE,c=A0(s,l);break;case"double-quoted-scalar":o=Eo.Scalar.QUOTE_DOUBLE,c=_0(s,l);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}let u=r+s.length,d=S0.resolveEnd(a,u,t,n);return{value:c,type:o,comment:d.comment,range:[r,u,d.offset]}}function E0(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Qp(e)}function A0(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Qp(e.slice(1,-1)).replace(/''/g,"'")}function Qp(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
4201
5257
  `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
4202
5258
  `,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=t.exec(e);if(!r)return e;let i=r[1],s=" ",a=t.lastIndex;for(n.lastIndex=a;r=n.exec(e);)r[1]===""?s===`
4203
5259
  `?i+=s:s=`
4204
- `:(i+=s+r[1],s=" "),a=n.lastIndex;let o=/[ \t]*(.*)/sy;return o.lastIndex=a,r=o.exec(e),i+s+(r?.[1]??"")}function Fw(e,t){let n="";for(let r=1;r<e.length-1;++r){let i=e[r];if(!(i==="\r"&&e[r+1]===`
5260
+ `:(i+=s+r[1],s=" "),a=n.lastIndex;let o=/[ \t]*(.*)/sy;return o.lastIndex=a,r=o.exec(e),i+s+(r?.[1]??"")}function _0(e,t){let n="";for(let r=1;r<e.length-1;++r){let i=e[r];if(!(i==="\r"&&e[r+1]===`
4205
5261
  `))if(i===`
4206
- `){let{fold:s,offset:a}=Hw(e,r);n+=s,r=a}else if(i==="\\"){let s=e[++r],a=Uw[s];if(a)n+=a;else if(s===`
5262
+ `){let{fold:s,offset:a}=N0(e,r);n+=s,r=a}else if(i==="\\"){let s=e[++r],a=P0[s];if(a)n+=a;else if(s===`
4207
5263
  `)for(s=e[r+1];s===" "||s===" ";)s=e[++r+1];else if(s==="\r"&&e[r+1]===`
4208
- `)for(s=e[++r+1];s===" "||s===" ";)s=e[++r+1];else if(s==="x"||s==="u"||s==="U"){let o=s==="x"?2:s==="u"?4:8;n+=qw(e,r+1,o,t),r+=o}else{let o=e.substr(r-1,2);t(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${o}`),n+=o}}else if(i===" "||i===" "){let s=r,a=e[r+1];for(;a===" "||a===" ";)a=e[++r+1];a!==`
5264
+ `)for(s=e[++r+1];s===" "||s===" ";)s=e[++r+1];else if(s==="x"||s==="u"||s==="U"){let o=s==="x"?2:s==="u"?4:8;n+=I0(e,r+1,o,t),r+=o}else{let o=e.substr(r-1,2);t(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${o}`),n+=o}}else if(i===" "||i===" "){let s=r,a=e[r+1];for(;a===" "||a===" ";)a=e[++r+1];a!==`
4209
5265
  `&&!(a==="\r"&&e[r+2]===`
4210
- `)&&(n+=r>s?e.slice(s,r+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function Hw(e,t){let n="",r=e[t+1];for(;(r===" "||r===" "||r===`
5266
+ `)&&(n+=r>s?e.slice(s,r+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function N0(e,t){let n="",r=e[t+1];for(;(r===" "||r===" "||r===`
4211
5267
  `||r==="\r")&&!(r==="\r"&&e[t+2]!==`
4212
5268
  `);)r===`
4213
5269
  `&&(n+=`
4214
- `),t+=1,r=e[t+1];return n||(n=" "),{fold:n,offset:t}}var Uw={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
4215
- `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function qw(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let o=e.substr(t-2,n+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${o}`),o}}Np.resolveFlowScalar=Dw});var Op=B(Pp=>{"use strict";E();var Wt=q(),Ip=ce(),Ww=oo(),jw=co();function Kw(e,t,n,r){let{value:i,type:s,comment:a,range:o}=t.type==="block-scalar"?Ww.resolveBlockScalar(e,t,r):jw.resolveFlowScalar(t,e.options.strict,r),l=n?e.directives.tagName(n.source,p=>r(n,"TAG_RESOLVE_FAILED",p)):null,c;e.options.stringKeys&&e.atKey?c=e.schema[Wt.SCALAR]:l?c=Gw(e.schema,i,l,n,r):t.type==="scalar"?c=zw(e,i,t,r):c=e.schema[Wt.SCALAR];let d;try{let p=c.resolve(i,u=>r(n??t,"TAG_RESOLVE_FAILED",u),e.options);d=Wt.isScalar(p)?p:new Ip.Scalar(p)}catch(p){let u=p instanceof Error?p.message:String(p);r(n??t,"TAG_RESOLVE_FAILED",u),d=new Ip.Scalar(i)}return d.range=o,d.source=i,s&&(d.type=s),l&&(d.tag=l),c.format&&(d.format=c.format),a&&(d.comment=a),d}function Gw(e,t,n,r,i){if(n==="!")return e[Wt.SCALAR];let s=[];for(let o of e.tags)if(!o.collection&&o.tag===n)if(o.default&&o.test)s.push(o);else return o;for(let o of s)if(o.test?.test(t))return o;let a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Wt.SCALAR])}function zw({atKey:e,directives:t,schema:n},r,i,s){let a=n.tags.find(o=>(o.default===!0||e&&o.default==="key")&&o.test?.test(r))||n[Wt.SCALAR];if(n.compat){let o=n.compat.find(l=>l.default&&l.test?.test(r))??n[Wt.SCALAR];if(a.tag!==o.tag){let l=t.tagString(a.tag),c=t.tagString(o.tag),d=`Value may be parsed as either ${l} or ${c}`;s(i,"TAG_RESOLVE_FAILED",d,!0)}}return a}Pp.composeScalar=Kw});var Rp=B(Lp=>{"use strict";E();function Vw(e,t,n){if(t){n??(n=t.length);for(let r=n-1;r>=0;--r){let i=t[r];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}for(i=t[++r];i?.type==="space";)e+=i.source.length,i=t[++r];break}}return e}Lp.emptyScalarPosition=Vw});var Bp=B(uo=>{"use strict";E();var Xw=Ln(),Yw=q(),Jw=Cp(),Mp=Op(),Qw=fn(),Zw=Rp(),e0={composeNode:Dp,composeEmptyNode:po};function Dp(e,t,n,r){let i=e.atKey,{spaceBefore:s,comment:a,anchor:o,tag:l}=n,c,d=!0;switch(t.type){case"alias":c=t0(e,t,r),(o||l)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=Mp.composeScalar(e,t,l,r),o&&(c.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=Jw.composeCollection(e0,e,t,n,r),o&&(c.anchor=o.source.substring(1))}catch(p){let u=p instanceof Error?p.message:String(p);r(t,"RESOURCE_EXHAUSTION",u)}break;default:{let p=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",p),d=!1}}return c??(c=po(e,t.offset,void 0,null,n,r)),o&&c.anchor===""&&r(o,"BAD_ALIAS","Anchor cannot be an empty string"),i&&e.options.stringKeys&&(!Yw.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&r(l??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(c.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?c.comment=a:c.commentBefore=a),e.options.keepSourceTokens&&d&&(c.srcToken=t),c}function po(e,t,n,r,{spaceBefore:i,comment:s,anchor:a,tag:o,end:l},c){let d={type:"scalar",offset:Zw.emptyScalarPosition(t,n,r),indent:-1,source:""},p=Mp.composeScalar(e,d,o,c);return a&&(p.anchor=a.source.substring(1),p.anchor===""&&c(a,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(p.spaceBefore=!0),s&&(p.comment=s,p.range[2]=l),p}function t0({options:e},{offset:t,source:n,end:r},i){let s=new Xw.Alias(n.substring(1));s.source===""&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let a=t+n.length,o=Qw.resolveEnd(r,a,e.strict,i);return s.range=[t,a,o.offset],o.comment&&(s.comment=o.comment),s}uo.composeEmptyNode=po;uo.composeNode=Dp});var Hp=B(Fp=>{"use strict";E();var n0=Xn(),$p=Bp(),r0=fn(),i0=Zn();function s0(e,t,{offset:n,start:r,value:i,end:s},a){let o=Object.assign({_directives:t},e),l=new n0.Document(void 0,o),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},d=i0.resolveProps(r,{indicator:"doc-start",next:i??s?.[0],offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?$p.composeNode(c,i,d,a):$p.composeEmptyNode(c,d.end,r,null,d,a);let p=l.contents.range[2],u=r0.resolveEnd(s,p,!1,a);return u.comment&&(l.comment=u.comment),l.range=[n,p,u.offset],l}Fp.composeDoc=s0});var fo=B(Wp=>{"use strict";E();var a0=Hr("process"),o0=Qs(),l0=Xn(),er=Qn(),Up=q(),c0=Hp(),d0=fn();function tr(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function qp(e){let t="",n=!1,r=!1;for(let i=0;i<e.length;++i){let s=e[i];switch(s[0]){case"#":t+=(t===""?"":r?`
5270
+ `),t+=1,r=e[t+1];return n||(n=" "),{fold:n,offset:t}}var P0={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
5271
+ `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function I0(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let o=e.substr(t-2,n+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${o}`),o}}Zp.resolveFlowScalar=C0});var nu=B(tu=>{"use strict";S();var Yt=X(),eu=pe(),O0=Co(),R0=Ao();function L0(e,t,n,r){let{value:i,type:s,comment:a,range:o}=t.type==="block-scalar"?O0.resolveBlockScalar(e,t,r):R0.resolveFlowScalar(t,e.options.strict,r),c=n?e.directives.tagName(n.source,d=>r(n,"TAG_RESOLVE_FAILED",d)):null,l;e.options.stringKeys&&e.atKey?l=e.schema[Yt.SCALAR]:c?l=M0(e.schema,i,c,n,r):t.type==="scalar"?l=D0(e,i,t,r):l=e.schema[Yt.SCALAR];let u;try{let d=l.resolve(i,p=>r(n??t,"TAG_RESOLVE_FAILED",p),e.options);u=Yt.isScalar(d)?d:new eu.Scalar(d)}catch(d){let p=d instanceof Error?d.message:String(d);r(n??t,"TAG_RESOLVE_FAILED",p),u=new eu.Scalar(i)}return u.range=o,u.source=i,s&&(u.type=s),c&&(u.tag=c),l.format&&(u.format=l.format),a&&(u.comment=a),u}function M0(e,t,n,r,i){if(n==="!")return e[Yt.SCALAR];let s=[];for(let o of e.tags)if(!o.collection&&o.tag===n)if(o.default&&o.test)s.push(o);else return o;for(let o of s)if(o.test?.test(t))return o;let a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Yt.SCALAR])}function D0({atKey:e,directives:t,schema:n},r,i,s){let a=n.tags.find(o=>(o.default===!0||e&&o.default==="key")&&o.test?.test(r))||n[Yt.SCALAR];if(n.compat){let o=n.compat.find(c=>c.default&&c.test?.test(r))??n[Yt.SCALAR];if(a.tag!==o.tag){let c=t.tagString(a.tag),l=t.tagString(o.tag),u=`Value may be parsed as either ${c} or ${l}`;s(i,"TAG_RESOLVE_FAILED",u,!0)}}return a}tu.composeScalar=L0});var iu=B(ru=>{"use strict";S();function B0(e,t,n){if(t){n??(n=t.length);for(let r=n-1;r>=0;--r){let i=t[r];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}for(i=t[++r];i?.type==="space";)e+=i.source.length,i=t[++r];break}}return e}ru.emptyScalarPosition=B0});var ou=B(No=>{"use strict";S();var $0=Kn(),F0=X(),q0=Yp(),su=nu(),H0=Cn(),U0=iu(),j0={composeNode:au,composeEmptyNode:_o};function au(e,t,n,r){let i=e.atKey,{spaceBefore:s,comment:a,anchor:o,tag:c}=n,l,u=!0;switch(t.type){case"alias":l=W0(e,t,r),(o||c)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=su.composeScalar(e,t,c,r),o&&(l.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=q0.composeCollection(j0,e,t,n,r),o&&(l.anchor=o.source.substring(1))}catch(d){let p=d instanceof Error?d.message:String(d);r(t,"RESOURCE_EXHAUSTION",p)}break;default:{let d=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=_o(e,t.offset,void 0,null,n,r)),o&&l.anchor===""&&r(o,"BAD_ALIAS","Anchor cannot be an empty string"),i&&e.options.stringKeys&&(!F0.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(l.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?l.comment=a:l.commentBefore=a),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function _o(e,t,n,r,{spaceBefore:i,comment:s,anchor:a,tag:o,end:c},l){let u={type:"scalar",offset:U0.emptyScalarPosition(t,n,r),indent:-1,source:""},d=su.composeScalar(e,u,o,l);return a&&(d.anchor=a.source.substring(1),d.anchor===""&&l(a,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),s&&(d.comment=s,d.range[2]=c),d}function W0({options:e},{offset:t,source:n,end:r},i){let s=new $0.Alias(n.substring(1));s.source===""&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let a=t+n.length,o=H0.resolveEnd(r,a,e.strict,i);return s.range=[t,a,o.offset],o.comment&&(s.comment=o.comment),s}No.composeEmptyNode=_o;No.composeNode=au});var du=B(cu=>{"use strict";S();var K0=or(),lu=ou(),G0=Cn(),z0=pr();function V0(e,t,{offset:n,start:r,value:i,end:s},a){let o=Object.assign({_directives:t},e),c=new K0.Document(void 0,o),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=z0.resolveProps(r,{indicator:"doc-start",next:i??s?.[0],offset:n,onError:a,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&a(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?lu.composeNode(l,i,u,a):lu.composeEmptyNode(l,u.end,r,null,u,a);let d=c.contents.range[2],p=G0.resolveEnd(s,d,!1,a);return p.comment&&(c.comment=p.comment),c.range=[n,d,p.offset],c}cu.composeDoc=V0});var Io=B(hu=>{"use strict";S();var X0=ri("process"),Y0=fa(),J0=or(),ur=dr(),pu=X(),Q0=du(),Z0=Cn();function hr(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function uu(e){let t="",n=!1,r=!1;for(let i=0;i<e.length;++i){let s=e[i];switch(s[0]){case"#":t+=(t===""?"":r?`
4216
5272
 
4217
5273
  `:`
4218
- `)+(s.substring(1)||" "),n=!0,r=!1;break;case"%":e[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var ho=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,s)=>{let a=tr(n);s?this.warnings.push(new er.YAMLWarning(a,r,i)):this.errors.push(new er.YAMLParseError(a,r,i))},this.directives=new o0.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,n){let{comment:r,afterEmptyLine:i}=qp(this.prelude);if(r){let s=t.contents;if(n)t.comment=t.comment?`${t.comment}
4219
- ${r}`:r;else if(i||t.directives.docStart||!s)t.commentBefore=r;else if(Up.isCollection(s)&&!s.flow&&s.items.length>0){let a=s.items[0];Up.isPair(a)&&(a=a.key);let o=a.commentBefore;a.commentBefore=o?`${r}
5274
+ `)+(s.substring(1)||" "),n=!0,r=!1;break;case"%":e[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var Po=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,s)=>{let a=hr(n);s?this.warnings.push(new ur.YAMLWarning(a,r,i)):this.errors.push(new ur.YAMLParseError(a,r,i))},this.directives=new Y0.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,n){let{comment:r,afterEmptyLine:i}=uu(this.prelude);if(r){let s=t.contents;if(n)t.comment=t.comment?`${t.comment}
5275
+ ${r}`:r;else if(i||t.directives.docStart||!s)t.commentBefore=r;else if(pu.isCollection(s)&&!s.flow&&s.items.length>0){let a=s.items[0];pu.isPair(a)&&(a=a.key);let o=a.commentBefore;a.commentBefore=o?`${r}
4220
5276
  ${o}`:r}else{let a=s.commentBefore;s.commentBefore=a?`${r}
4221
- ${a}`:r}}if(n){for(let s=0;s<this.errors.length;++s)t.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)t.warnings.push(this.warnings[s])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:qp(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,r=-1){for(let i of t)yield*this.next(i);yield*this.end(n,r)}*next(t){switch(a0.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(n,r,i)=>{let s=tr(t);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",r,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let n=c0.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new er.YAMLParseError(tr(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new er.YAMLParseError(tr(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=d0.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
4222
- ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new er.YAMLParseError(tr(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let r=Object.assign({_directives:this.directives},this.options),i=new l0.Document(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};Wp.Composer=ho});var Gp=B(Mi=>{"use strict";E();var p0=oo(),u0=co(),h0=Qn(),jp=$n();function f0(e,t=!0,n){if(e){let r=(i,s,a)=>{let o=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(o,s,a);else throw new h0.YAMLParseError([o,o+1],s,a)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return u0.resolveFlowScalar(e,t,r);case"block-scalar":return p0.resolveBlockScalar({options:{strict:t}},e,r)}}return null}function m0(e,t){let{implicitKey:n=!1,indent:r,inFlow:i=!1,offset:s=-1,type:a="PLAIN"}=t,o=jp.stringifyString({type:a,value:e},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:"newline",offset:-1,indent:r,source:`
4223
- `}];switch(o[0]){case"|":case">":{let c=o.indexOf(`
4224
- `),d=o.substring(0,c),p=o.substring(c+1)+`
4225
- `,u=[{type:"block-scalar-header",offset:s,indent:r,source:d}];return Kp(u,l)||u.push({type:"newline",offset:-1,indent:r,source:`
4226
- `}),{type:"block-scalar",offset:s,indent:r,props:u,source:p}}case'"':return{type:"double-quoted-scalar",offset:s,indent:r,source:o,end:l};case"'":return{type:"single-quoted-scalar",offset:s,indent:r,source:o,end:l};default:return{type:"scalar",offset:s,indent:r,source:o,end:l}}}function g0(e,t,n={}){let{afterKey:r=!1,implicitKey:i=!1,inFlow:s=!1,type:a}=n,o="indent"in e?e.indent:null;if(r&&typeof o=="number"&&(o+=2),!a)switch(e.type){case"single-quoted-scalar":a="QUOTE_SINGLE";break;case"double-quoted-scalar":a="QUOTE_DOUBLE";break;case"block-scalar":{let c=e.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:a="PLAIN"}let l=jp.stringifyString({type:a,value:t},{implicitKey:i||o===null,indent:o!==null&&o>0?" ".repeat(o):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":b0(e,l);break;case'"':mo(e,l,"double-quoted-scalar");break;case"'":mo(e,l,"single-quoted-scalar");break;default:mo(e,l,"scalar")}}function b0(e,t){let n=t.indexOf(`
5277
+ ${a}`:r}}if(n){for(let s=0;s<this.errors.length;++s)t.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)t.warnings.push(this.warnings[s])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:uu(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,r=-1){for(let i of t)yield*this.next(i);yield*this.end(n,r)}*next(t){switch(X0.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(n,r,i)=>{let s=hr(t);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",r,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let n=Q0.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new ur.YAMLParseError(hr(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new ur.YAMLParseError(hr(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=Z0.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
5278
+ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new ur.YAMLParseError(hr(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let r=Object.assign({_directives:this.directives},this.options),i=new J0.Document(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};hu.Composer=Po});var gu=B(Zi=>{"use strict";S();var ey=Co(),ty=Ao(),ny=dr(),mu=Yn();function ry(e,t=!0,n){if(e){let r=(i,s,a)=>{let o=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(o,s,a);else throw new ny.YAMLParseError([o,o+1],s,a)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return ty.resolveFlowScalar(e,t,r);case"block-scalar":return ey.resolveBlockScalar({options:{strict:t}},e,r)}}return null}function iy(e,t){let{implicitKey:n=!1,indent:r,inFlow:i=!1,offset:s=-1,type:a="PLAIN"}=t,o=mu.stringifyString({type:a,value:e},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:r,source:`
5279
+ `}];switch(o[0]){case"|":case">":{let l=o.indexOf(`
5280
+ `),u=o.substring(0,l),d=o.substring(l+1)+`
5281
+ `,p=[{type:"block-scalar-header",offset:s,indent:r,source:u}];return fu(p,c)||p.push({type:"newline",offset:-1,indent:r,source:`
5282
+ `}),{type:"block-scalar",offset:s,indent:r,props:p,source:d}}case'"':return{type:"double-quoted-scalar",offset:s,indent:r,source:o,end:c};case"'":return{type:"single-quoted-scalar",offset:s,indent:r,source:o,end:c};default:return{type:"scalar",offset:s,indent:r,source:o,end:c}}}function sy(e,t,n={}){let{afterKey:r=!1,implicitKey:i=!1,inFlow:s=!1,type:a}=n,o="indent"in e?e.indent:null;if(r&&typeof o=="number"&&(o+=2),!a)switch(e.type){case"single-quoted-scalar":a="QUOTE_SINGLE";break;case"double-quoted-scalar":a="QUOTE_DOUBLE";break;case"block-scalar":{let l=e.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:a="PLAIN"}let c=mu.stringifyString({type:a,value:t},{implicitKey:i||o===null,indent:o!==null&&o>0?" ".repeat(o):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":ay(e,c);break;case'"':Oo(e,c,"double-quoted-scalar");break;case"'":Oo(e,c,"single-quoted-scalar");break;default:Oo(e,c,"scalar")}}function ay(e,t){let n=t.indexOf(`
4227
5283
  `),r=t.substring(0,n),i=t.substring(n+1)+`
4228
- `;if(e.type==="block-scalar"){let s=e.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=r,e.source=i}else{let{offset:s}=e,a="indent"in e?e.indent:-1,o=[{type:"block-scalar-header",offset:s,indent:a,source:r}];Kp(o,"end"in e?e.end:void 0)||o.push({type:"newline",offset:-1,indent:a,source:`
4229
- `});for(let l of Object.keys(e))l!=="type"&&l!=="offset"&&delete e[l];Object.assign(e,{type:"block-scalar",indent:a,props:o,source:i})}}function Kp(e,t){if(t)for(let n of t)switch(n.type){case"space":case"comment":e.push(n);break;case"newline":return e.push(n),!0}return!1}function mo(e,t,n){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=n,e.source=t;break;case"block-scalar":{let r=e.props.slice(1),i=t.length;e.props[0].type==="block-scalar-header"&&(i-=e.props[0].source.length);for(let s of r)s.offset+=i;delete e.props,Object.assign(e,{type:n,source:t,end:r});break}case"block-map":case"block-seq":{let i={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
4230
- `};delete e.items,Object.assign(e,{type:n,source:t,end:[i]});break}default:{let r="indent"in e?e.indent:-1,i="end"in e&&Array.isArray(e.end)?e.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(e))s!=="type"&&s!=="offset"&&delete e[s];Object.assign(e,{type:n,indent:r,source:t,end:i})}}}Mi.createScalarToken=m0;Mi.resolveAsScalar=f0;Mi.setScalarValue=g0});var Vp=B(zp=>{"use strict";E();var v0=e=>"type"in e?Bi(e):Di(e);function Bi(e){switch(e.type){case"block-scalar":{let t="";for(let n of e.props)t+=Bi(n);return t+e.source}case"block-map":case"block-seq":{let t="";for(let n of e.items)t+=Di(n);return t}case"flow-collection":{let t=e.start.source;for(let n of e.items)t+=Di(n);for(let n of e.end)t+=n.source;return t}case"document":{let t=Di(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function Di({start:e,key:t,sep:n,value:r}){let i="";for(let s of e)i+=s.source;if(t&&(i+=Bi(t)),n)for(let s of n)i+=s.source;return r&&(i+=Bi(r)),i}zp.stringify=v0});var Qp=B(Jp=>{"use strict";E();var go=Symbol("break visit"),w0=Symbol("skip children"),Xp=Symbol("remove item");function jt(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),Yp(Object.freeze([]),e,t)}jt.BREAK=go;jt.SKIP=w0;jt.REMOVE=Xp;jt.itemAtPath=(e,t)=>{let n=e;for(let[r,i]of t){let s=n?.[r];if(s&&"items"in s)n=s.items[i];else return}return n};jt.parentCollection=(e,t)=>{let n=jt.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Yp(e,t,n){let r=n(t,e);if(typeof r=="symbol")return r;for(let i of["key","value"]){let s=t[i];if(s&&"items"in s){for(let a=0;a<s.items.length;++a){let o=Yp(Object.freeze(e.concat([[i,a]])),s.items[a],n);if(typeof o=="number")a=o-1;else{if(o===go)return go;o===Xp&&(s.items.splice(a,1),a-=1)}}typeof r=="function"&&i==="key"&&(r=r(t,e))}}return typeof r=="function"?r(t,e):r}Jp.visit=jt});var $i=B(Ae=>{"use strict";E();var bo=Gp(),y0=Vp(),x0=Qp(),vo="\uFEFF",wo="",yo="",xo="",k0=e=>!!e&&"items"in e,T0=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function S0(e){switch(e){case vo:return"<BOM>";case wo:return"<DOC>";case yo:return"<FLOW_END>";case xo:return"<SCALAR>";default:return JSON.stringify(e)}}function E0(e){switch(e){case vo:return"byte-order-mark";case wo:return"doc-mode";case yo:return"flow-error-end";case xo:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
5284
+ `;if(e.type==="block-scalar"){let s=e.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=r,e.source=i}else{let{offset:s}=e,a="indent"in e?e.indent:-1,o=[{type:"block-scalar-header",offset:s,indent:a,source:r}];fu(o,"end"in e?e.end:void 0)||o.push({type:"newline",offset:-1,indent:a,source:`
5285
+ `});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:a,props:o,source:i})}}function fu(e,t){if(t)for(let n of t)switch(n.type){case"space":case"comment":e.push(n);break;case"newline":return e.push(n),!0}return!1}function Oo(e,t,n){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=n,e.source=t;break;case"block-scalar":{let r=e.props.slice(1),i=t.length;e.props[0].type==="block-scalar-header"&&(i-=e.props[0].source.length);for(let s of r)s.offset+=i;delete e.props,Object.assign(e,{type:n,source:t,end:r});break}case"block-map":case"block-seq":{let i={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
5286
+ `};delete e.items,Object.assign(e,{type:n,source:t,end:[i]});break}default:{let r="indent"in e?e.indent:-1,i="end"in e&&Array.isArray(e.end)?e.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(e))s!=="type"&&s!=="offset"&&delete e[s];Object.assign(e,{type:n,indent:r,source:t,end:i})}}}Zi.createScalarToken=iy;Zi.resolveAsScalar=ry;Zi.setScalarValue=sy});var vu=B(bu=>{"use strict";S();var oy=e=>"type"in e?ts(e):es(e);function ts(e){switch(e.type){case"block-scalar":{let t="";for(let n of e.props)t+=ts(n);return t+e.source}case"block-map":case"block-seq":{let t="";for(let n of e.items)t+=es(n);return t}case"flow-collection":{let t=e.start.source;for(let n of e.items)t+=es(n);for(let n of e.end)t+=n.source;return t}case"document":{let t=es(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function es({start:e,key:t,sep:n,value:r}){let i="";for(let s of e)i+=s.source;if(t&&(i+=ts(t)),n)for(let s of n)i+=s.source;return r&&(i+=ts(r)),i}bu.stringify=oy});var ku=B(xu=>{"use strict";S();var Ro=Symbol("break visit"),ly=Symbol("skip children"),wu=Symbol("remove item");function Jt(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),yu(Object.freeze([]),e,t)}Jt.BREAK=Ro;Jt.SKIP=ly;Jt.REMOVE=wu;Jt.itemAtPath=(e,t)=>{let n=e;for(let[r,i]of t){let s=n?.[r];if(s&&"items"in s)n=s.items[i];else return}return n};Jt.parentCollection=(e,t)=>{let n=Jt.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function yu(e,t,n){let r=n(t,e);if(typeof r=="symbol")return r;for(let i of["key","value"]){let s=t[i];if(s&&"items"in s){for(let a=0;a<s.items.length;++a){let o=yu(Object.freeze(e.concat([[i,a]])),s.items[a],n);if(typeof o=="number")a=o-1;else{if(o===Ro)return Ro;o===wu&&(s.items.splice(a,1),a-=1)}}typeof r=="function"&&i==="key"&&(r=r(t,e))}}return typeof r=="function"?r(t,e):r}xu.visit=Jt});var ns=B(Pe=>{"use strict";S();var Lo=gu(),cy=vu(),dy=ku(),Mo="\uFEFF",Do="",Bo="",$o="",py=e=>!!e&&"items"in e,uy=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function hy(e){switch(e){case Mo:return"<BOM>";case Do:return"<DOC>";case Bo:return"<FLOW_END>";case $o:return"<SCALAR>";default:return JSON.stringify(e)}}function my(e){switch(e){case Mo:return"byte-order-mark";case Do:return"doc-mode";case Bo:return"flow-error-end";case $o:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
4231
5287
  `:case`\r
4232
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Ae.createScalarToken=bo.createScalarToken;Ae.resolveAsScalar=bo.resolveAsScalar;Ae.setScalarValue=bo.setScalarValue;Ae.stringify=y0.stringify;Ae.visit=x0.visit;Ae.BOM=vo;Ae.DOCUMENT=wo;Ae.FLOW_END=yo;Ae.SCALAR=xo;Ae.isCollection=k0;Ae.isScalar=T0;Ae.prettyToken=S0;Ae.tokenType=E0});var So=B(eu=>{"use strict";E();var nr=$i();function qe(e){switch(e){case void 0:case" ":case`
4233
- `:case"\r":case" ":return!0;default:return!1}}var Zp=new Set("0123456789ABCDEFabcdef"),C0=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Fi=new Set(",[]{}"),_0=new Set(` ,[]{}
4234
- \r `),ko=e=>!e||_0.has(e),To=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
5288
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Pe.createScalarToken=Lo.createScalarToken;Pe.resolveAsScalar=Lo.resolveAsScalar;Pe.setScalarValue=Lo.setScalarValue;Pe.stringify=cy.stringify;Pe.visit=dy.visit;Pe.BOM=Mo;Pe.DOCUMENT=Do;Pe.FLOW_END=Bo;Pe.SCALAR=$o;Pe.isCollection=py;Pe.isScalar=uy;Pe.prettyToken=hy;Pe.tokenType=my});var Ho=B(Su=>{"use strict";S();var mr=ns();function Ke(e){switch(e){case void 0:case" ":case`
5289
+ `:case"\r":case" ":return!0;default:return!1}}var Tu=new Set("0123456789ABCDEFabcdef"),fy=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),rs=new Set(",[]{}"),gy=new Set(` ,[]{}
5290
+ \r `),Fo=e=>!e||gy.has(e),qo=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
4235
5291
  `?!0:n==="\r"?this.buffer[t+1]===`
4236
5292
  `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+t];if(n==="\r"){let i=this.buffer[r+t+1];if(i===`
4237
5293
  `||!i&&!this.atEnd)return t+r+1}return n===`
4238
- `||r>=this.indentNext||!n&&!this.atEnd?t+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&qe(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
4239
- `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===nr.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,r=t.indexOf("#");for(;r!==-1;){let s=t[r-1];if(s===" "||s===" "){n=r-1;break}else r=t.indexOf("#",r+1)}for(;;){let s=t[n-1];if(s===" "||s===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield nr.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&qe(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!qe(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&qe(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(ko),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,r=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&qe(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield nr.FLOW_END,yield*this.parseLineStart();let s=0;for(;i[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),i[s]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(ko),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let a=this.charAt(1);if(this.flowKey||qe(a)||a===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let s=0;for(;this.buffer[n-1-s]==="\\";)s+=1;if(s%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),i=r.indexOf(`
5294
+ `||r>=this.indentNext||!n&&!this.atEnd?t+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&Ke(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
5295
+ `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===mr.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,r=t.indexOf("#");for(;r!==-1;){let s=t[r-1];if(s===" "||s===" "){n=r-1;break}else r=t.indexOf("#",r+1)}for(;;){let s=t[n-1];if(s===" "||s===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield mr.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&Ke(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Ke(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&Ke(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Fo),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,r=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&Ke(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield mr.FLOW_END,yield*this.parseLineStart();let s=0;for(;i[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),i[s]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Fo),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let a=this.charAt(1);if(this.flowKey||Ke(a)||a===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let s=0;for(;this.buffer[n-1-s]==="\\";)s+=1;if(s%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),i=r.indexOf(`
4240
5296
  `,this.pos);if(i!==-1){for(;i!==-1;){let s=this.continueScalar(i+1);if(s===-1)break;i=r.indexOf(`
4241
- `,s)}i!==-1&&(n=i-(r[i-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>qe(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,r;e:for(let s=this.pos;r=this.buffer[s];++s)switch(r){case" ":n+=1;break;case`
5297
+ `,s)}i!==-1&&(n=i-(r[i-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>Ke(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,r;e:for(let s=this.pos;r=this.buffer[s];++s)switch(r){case" ":n+=1;break;case`
4242
5298
  `:t=s,n=0;break;case"\r":{let a=this.buffer[s+1];if(!a&&!this.atEnd)return this.setNext("block-scalar");if(a===`
4243
5299
  `)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(t+1);if(s===-1)break;t=this.buffer.indexOf(`
4244
5300
  `,s)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let i=t+1;for(r=this.buffer[i];r===" ";)r=this.buffer[++i];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
4245
5301
  `;)r=this.buffer[++i];t=i-1}else if(!this.blockScalarKeep)do{let s=t-1,a=this.buffer[s];a==="\r"&&(a=this.buffer[--s]);let o=s;for(;a===" ";)a=this.buffer[--s];if(a===`
4246
- `&&s>=this.pos&&s+1+n>o)t=s;else break}while(!0);return yield nr.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let s=this.buffer[r+1];if(qe(s)||t&&Fi.has(s))break;n=r}else if(qe(i)){let s=this.buffer[r+1];if(i==="\r"&&(s===`
5302
+ `&&s>=this.pos&&s+1+n>o)t=s;else break}while(!0);return yield mr.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let s=this.buffer[r+1];if(Ke(s)||t&&rs.has(s))break;n=r}else if(Ke(i)){let s=this.buffer[r+1];if(i==="\r"&&(s===`
4247
5303
  `?(r+=1,i=`
4248
- `,s=this.buffer[r+1]):n=r),s==="#"||t&&Fi.has(s))break;if(i===`
4249
- `){let a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&Fi.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield nr.SCALAR,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){let r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(ko),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(qe(r)||n&&Fi.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!qe(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(C0.has(n))n=this.buffer[++t];else if(n==="%"&&Zp.has(this.buffer[t+1])&&Zp.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
5304
+ `,s=this.buffer[r+1]):n=r),s==="#"||t&&rs.has(s))break;if(i===`
5305
+ `){let a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&rs.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield mr.SCALAR,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){let r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Fo),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(Ke(r)||n&&rs.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!Ke(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(fy.has(n))n=this.buffer[++t];else if(n==="%"&&Tu.has(this.buffer[t+1])&&Tu.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
4250
5306
  `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
4251
- `?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||t&&r===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};eu.Lexer=To});var Co=B(tu=>{"use strict";E();var Eo=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,r=this.lineStarts.length;for(;n<r;){let s=n+r>>1;this.lineStarts[s]<t?n=s+1:r=s}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};let i=this.lineStarts[n-1];return{line:n,col:t-i+1}}}};tu.LineCounter=Eo});var Ao=B(au=>{"use strict";E();var A0=Hr("process"),nu=$i(),N0=So();function Nt(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function ru(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function su(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Hi(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function mn(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Ui(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function iu(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Nt(t.start,"explicit-key-ind")&&!Nt(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,su(t.value)?t.value.end?Ui(t.value.end,t.sep):t.value.end=t.sep:Ui(t.start,t.sep),delete t.sep)}var _o=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new N0.Lexer,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(t,n))yield*this.next(r);n||(yield*this.end())}*next(t){if(this.source=t,A0.env.LOG_TOKENS&&console.log("|",nu.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let n=nu.tokenType(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let r=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&iu(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&ru(i.start)===-1&&(n.indent===0||i.start.every(s=>s.type!=="comment"||s.indent<n.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{ru(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let n=this.startBlockValue(t);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let n=Hi(this.peek(2)),r=mn(n),i;t.end?(i=t.end,i.push(this.sourceToken),delete t.end):i=[this.sourceToken];let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
5307
+ `?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||t&&r===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};Su.Lexer=qo});var jo=B(Cu=>{"use strict";S();var Uo=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,r=this.lineStarts.length;for(;n<r;){let s=n+r>>1;this.lineStarts[s]<t?n=s+1:r=s}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};let i=this.lineStarts[n-1];return{line:n,col:t-i+1}}}};Cu.LineCounter=Uo});var Ko=B(Pu=>{"use strict";S();var by=ri("process"),Eu=ns(),vy=Ho();function Bt(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function Au(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function Nu(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function is(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function En(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function ss(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function _u(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Bt(t.start,"explicit-key-ind")&&!Bt(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,Nu(t.value)?t.value.end?ss(t.value.end,t.sep):t.value.end=t.sep:ss(t.start,t.sep),delete t.sep)}var Wo=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new vy.Lexer,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(t,n))yield*this.next(r);n||(yield*this.end())}*next(t){if(this.source=t,by.env.LOG_TOKENS&&console.log("|",Eu.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let n=Eu.tokenType(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let r=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&_u(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Au(i.start)===-1&&(n.indent===0||i.start.every(s=>s.type!=="comment"||s.indent<n.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{Au(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let n=this.startBlockValue(t);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let n=is(this.peek(2)),r=En(n),i;t.end?(i=t.end,i.push(this.sourceToken),delete t.end):i=[this.sourceToken];let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
4252
5308
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
4253
- `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let i=t.items[t.items.length-2]?.value?.end;if(Array.isArray(i)){Ui(i,n.start),i.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let r=!this.onKeyLine&&this.indent===t.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",s=[];if(i&&n.sep&&!n.value){let a=[];for(let o=0;o<n.sep.length;++o){let l=n.sep[o];switch(l.type){case"newline":a.push(o);break;case"space":break;case"comment":l.indent>t.indent&&(a.length=0);break;default:a.length=0}}a.length>=2&&(s=n.sep.splice(a[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(s.push(this.sourceToken),t.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(s.push(this.sourceToken),t.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Nt(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(su(n.key)&&!Nt(n.sep,"newline")){let a=mn(n.start),o=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:o,sep:l}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(Nt(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let a=mn(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?t.items.push({start:s,key:null,sep:[this.sourceToken]}):Nt(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let a=this.flowScalar(this.type);i||n.value?(t.items.push({start:s,key:a,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(a):(Object.assign(n,{key:a,sep:[]}),this.onKeyLine=!0);return}default:{let a=this.startBlockValue(t);if(a){if(a.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Nt(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&t.items.push({start:s});this.stack.push(a);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){let i=t.items[t.items.length-2]?.value?.end;if(Array.isArray(i)){Ui(i,n.start),i.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||Nt(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){let r=this.startBlockValue(t);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=Hi(r),s=mn(i);iu(t);let a=t.end.splice(1,t.end.length);a.push(this.sourceToken);let o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
5309
+ `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let i=t.items[t.items.length-2]?.value?.end;if(Array.isArray(i)){ss(i,n.start),i.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let r=!this.onKeyLine&&this.indent===t.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",s=[];if(i&&n.sep&&!n.value){let a=[];for(let o=0;o<n.sep.length;++o){let c=n.sep[o];switch(c.type){case"newline":a.push(o);break;case"space":break;case"comment":c.indent>t.indent&&(a.length=0);break;default:a.length=0}}a.length>=2&&(s=n.sep.splice(a[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(s.push(this.sourceToken),t.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(s.push(this.sourceToken),t.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Bt(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(Nu(n.key)&&!Bt(n.sep,"newline")){let a=En(n.start),o=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:o,sep:c}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(Bt(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let a=En(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?t.items.push({start:s,key:null,sep:[this.sourceToken]}):Bt(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let a=this.flowScalar(this.type);i||n.value?(t.items.push({start:s,key:a,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(a):(Object.assign(n,{key:a,sep:[]}),this.onKeyLine=!0);return}default:{let a=this.startBlockValue(t);if(a){if(a.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Bt(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&t.items.push({start:s});this.stack.push(a);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){let i=t.items[t.items.length-2]?.value?.end;if(Array.isArray(i)){ss(i,n.start),i.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||Bt(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){let r=this.startBlockValue(t);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=is(r),s=En(i);_u(t);let a=t.end.splice(1,t.end.length);a.push(this.sourceToken);let o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
4254
5310
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
4255
- `,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=Hi(t),r=mn(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Hi(t),r=mn(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};au.Parser=_o});var pu=B(ir=>{"use strict";E();var ou=fo(),I0=Xn(),rr=Qn(),P0=pa(),O0=q(),L0=Co(),lu=Ao();function cu(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new L0.LineCounter||null,prettyErrors:t}}function R0(e,t={}){let{lineCounter:n,prettyErrors:r}=cu(t),i=new lu.Parser(n?.addNewLine),s=new ou.Composer(t),a=Array.from(s.compose(i.parse(e)));if(r&&n)for(let o of a)o.errors.forEach(rr.prettifyError(e,n)),o.warnings.forEach(rr.prettifyError(e,n));return a.length>0?a:Object.assign([],{empty:!0},s.streamInfo())}function du(e,t={}){let{lineCounter:n,prettyErrors:r}=cu(t),i=new lu.Parser(n?.addNewLine),s=new ou.Composer(t),a=null;for(let o of s.compose(i.parse(e),!0,e.length))if(!a)a=o;else if(a.options.logLevel!=="silent"){a.errors.push(new rr.YAMLParseError(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach(rr.prettifyError(e,n)),a.warnings.forEach(rr.prettifyError(e,n))),a}function M0(e,t,n){let r;typeof t=="function"?r=t:n===void 0&&t&&typeof t=="object"&&(n=t);let i=du(e,n);if(!i)return null;if(i.warnings.forEach(s=>P0.warn(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function D0(e,t,n){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(e===void 0){let{keepUndefined:i}=n??t??{};if(!i)return}return O0.isDocument(e)&&!r?e.toString(n):new I0.Document(e,r,n).toString(n)}ir.parse=M0;ir.parseAllDocuments=R0;ir.parseDocument=du;ir.stringify=D0});var hu=B(G=>{"use strict";E();var B0=fo(),$0=Xn(),F0=za(),No=Qn(),H0=Ln(),It=q(),U0=Et(),q0=ce(),W0=_t(),j0=At(),K0=$i(),G0=So(),z0=Co(),V0=Ao(),qi=pu(),uu=Nn();G.Composer=B0.Composer;G.Document=$0.Document;G.Schema=F0.Schema;G.YAMLError=No.YAMLError;G.YAMLParseError=No.YAMLParseError;G.YAMLWarning=No.YAMLWarning;G.Alias=H0.Alias;G.isAlias=It.isAlias;G.isCollection=It.isCollection;G.isDocument=It.isDocument;G.isMap=It.isMap;G.isNode=It.isNode;G.isPair=It.isPair;G.isScalar=It.isScalar;G.isSeq=It.isSeq;G.Pair=U0.Pair;G.Scalar=q0.Scalar;G.YAMLMap=W0.YAMLMap;G.YAMLSeq=j0.YAMLSeq;G.CST=K0;G.Lexer=G0.Lexer;G.LineCounter=z0.LineCounter;G.Parser=V0.Parser;G.parse=qi.parse;G.parseAllDocuments=qi.parseAllDocuments;G.parseDocument=qi.parseDocument;G.stringify=qi.stringify;G.visit=uu.visit;G.visitAsync=uu.visitAsync});import ot from"node:fs";import Ne from"node:path";function ji(e){let t=Ne.resolve(e);for(;;){if(ot.existsSync(Ne.join(t,bn)))return t;let n=Ne.dirname(t);if(n===t)return null;t=n}}function Ki(e){let t=e.replace(/^/,"").replace(/\r\n/g,`
4256
- `),n=/^---\n([\s\S]*?)\n---\n?/.exec(t);if(!n)return{front:{},body:t};let r=(0,gn.parse)(n[1]);if(r!==null&&(typeof r!="object"||Array.isArray(r)))throw new Error("frontmatter kh\xF4ng ph\u1EA3i b\u1EA3ng kho\xE1");return{front:r??{},body:t.slice(n[0].length)}}function Wi(e){return(0,gn.stringify)(e,X0)}function lt(e){let t={};for(let[n,r]of Object.entries(e))r==null||r===""||Array.isArray(r)&&r.length===0||typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===0||(t[n]=r);return t}function Oo(e,t,n){return t.includes(e)?e:n}function mu(e,t){return t.includes(e)?e:void 0}function gu(e){if(!e||typeof e!="object")return;let t=e;return{by:W(t.by),at:W(t.at)}}function Y0(e){let t=(0,gn.parse)(e)??{},n=Array.isArray(t.members)?t.members.map(s=>({id:W(s.id),name:W(s.name)||W(s.id),...s.role?{role:W(s.role)}:{}})):[],r=t.overview&&typeof t.overview=="object"?t.overview:null,i=r?lt({purpose:W(r.purpose).trimEnd(),scope:W(r.scope).trimEnd(),environment:W(r.environment).trimEnd(),references:W(r.references).trimEnd(),terms:Array.isArray(r.terms)?r.terms.map(s=>({term:W(s.term),desc:W(s.desc)})).filter(s=>s.term):void 0,owner:W(r.owner),contractor:W(r.contractor),docVersion:W(r.doc_version),place:W(r.place)}):void 0;return{version:Number(t.version??1),title:W(t.title),language:t.language==="en"?"en":"vi",...t.ba?{ba:W(t.ba)}:{},members:n,...i&&Object.keys(i).length?{overview:i}:{}}}function J0(e){let t="# T\xE0i li\u1EC7u k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED (Pan Test). `ba`: repo t\xE0i li\u1EC7u BA \u0111\u1EC3 tham chi\u1EBFu [[CN-\u2026]] v\xE0 ki\u1EC3m \u0111\u1ED9 ph\u1EE7.\n",n=e.overview,r=n?lt({purpose:n.purpose,scope:n.scope,environment:n.environment,references:n.references,terms:n.terms,owner:n.owner,contractor:n.contractor,doc_version:n.docVersion,place:n.place}):void 0;return t+Wi(lt({version:e.version,title:e.title,language:e.language,ba:e.ba,members:e.members.map(i=>lt({...i})),overview:r}))}function Q0(e,t){let{front:n,body:r}=Ki(e),i=W(n.code);if(!qr.test(i))throw new Error(`m\xE3 ph\xE2n h\u1EC7 \xAB${i}\xBB sai m\u1EABu`);return{code:i,title:W(n.title),order:Number(n.order??0),suites:Po(n.suites),commonSteps:r.trim(),file:t}}function Z0(e){return`---
4257
- ${Wi(lt({code:e.code,title:e.title,order:e.order,suites:e.suites}))}---
5311
+ `,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=is(t),r=En(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=is(t),r=En(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Pu.Parser=Wo});var Mu=B(gr=>{"use strict";S();var Iu=Io(),wy=or(),fr=dr(),yy=_a(),xy=X(),ky=jo(),Ou=Ko();function Ru(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new ky.LineCounter||null,prettyErrors:t}}function Ty(e,t={}){let{lineCounter:n,prettyErrors:r}=Ru(t),i=new Ou.Parser(n?.addNewLine),s=new Iu.Composer(t),a=Array.from(s.compose(i.parse(e)));if(r&&n)for(let o of a)o.errors.forEach(fr.prettifyError(e,n)),o.warnings.forEach(fr.prettifyError(e,n));return a.length>0?a:Object.assign([],{empty:!0},s.streamInfo())}function Lu(e,t={}){let{lineCounter:n,prettyErrors:r}=Ru(t),i=new Ou.Parser(n?.addNewLine),s=new Iu.Composer(t),a=null;for(let o of s.compose(i.parse(e),!0,e.length))if(!a)a=o;else if(a.options.logLevel!=="silent"){a.errors.push(new fr.YAMLParseError(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach(fr.prettifyError(e,n)),a.warnings.forEach(fr.prettifyError(e,n))),a}function Sy(e,t,n){let r;typeof t=="function"?r=t:n===void 0&&t&&typeof t=="object"&&(n=t);let i=Lu(e,n);if(!i)return null;if(i.warnings.forEach(s=>yy.warn(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function Cy(e,t,n){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(e===void 0){let{keepUndefined:i}=n??t??{};if(!i)return}return xy.isDocument(e)&&!r?e.toString(n):new wy.Document(e,r,n).toString(n)}gr.parse=Sy;gr.parseAllDocuments=Ty;gr.parseDocument=Lu;gr.stringify=Cy});var Bu=B(J=>{"use strict";S();var Ey=Io(),Ay=or(),_y=po(),Go=dr(),Ny=Kn(),$t=X(),Py=Rt(),Iy=pe(),Oy=Mt(),Ry=Dt(),Ly=ns(),My=Ho(),Dy=jo(),By=Ko(),as=Mu(),Du=Hn();J.Composer=Ey.Composer;J.Document=Ay.Document;J.Schema=_y.Schema;J.YAMLError=Go.YAMLError;J.YAMLParseError=Go.YAMLParseError;J.YAMLWarning=Go.YAMLWarning;J.Alias=Ny.Alias;J.isAlias=$t.isAlias;J.isCollection=$t.isCollection;J.isDocument=$t.isDocument;J.isMap=$t.isMap;J.isNode=$t.isNode;J.isPair=$t.isPair;J.isScalar=$t.isScalar;J.isSeq=$t.isSeq;J.Pair=Py.Pair;J.Scalar=Iy.Scalar;J.YAMLMap=Oy.YAMLMap;J.YAMLSeq=Ry.YAMLSeq;J.CST=Ly;J.Lexer=My.Lexer;J.LineCounter=Dy.LineCounter;J.Parser=By.Parser;J.parse=as.parse;J.parseAllDocuments=as.parseAllDocuments;J.parseDocument=as.parseDocument;J.stringify=as.stringify;J.visit=Du.visit;J.visitAsync=Du.visitAsync});import ft from"node:fs";import Ie from"node:path";function ls(e){let t=Ie.resolve(e);for(;;){if(ft.existsSync(Ie.join(t,Zt)))return t;let n=Ie.dirname(t);if(n===t)return null;t=n}}function cs(e){let t=e.replace(/^/,"").replace(/\r\n/g,`
5312
+ `),n=/^---\n([\s\S]*?)\n---\n?/.exec(t);if(!n)return{front:{},body:t};let r=(0,An.parse)(n[1]);if(r!==null&&(typeof r!="object"||Array.isArray(r)))throw new Error("frontmatter kh\xF4ng ph\u1EA3i b\u1EA3ng kho\xE1");return{front:r??{},body:t.slice(n[0].length)}}function os(e){return(0,An.stringify)(e,$y)}function gt(e){let t={};for(let[n,r]of Object.entries(e))r==null||r===""||Array.isArray(r)&&r.length===0||typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===0||(t[n]=r);return t}function Xo(e,t,n){return t.includes(e)?e:n}function Fu(e,t){return t.includes(e)?e:void 0}function qu(e){if(!e||typeof e!="object")return;let t=e;return{by:z(t.by),at:z(t.at)}}function Fy(e){let t=(0,An.parse)(e)??{},n=Array.isArray(t.members)?t.members.map(s=>({id:z(s.id),name:z(s.name)||z(s.id),...s.role?{role:z(s.role)}:{}})):[],r=t.overview&&typeof t.overview=="object"?t.overview:null,i=r?gt({purpose:z(r.purpose).trimEnd(),scope:z(r.scope).trimEnd(),environment:z(r.environment).trimEnd(),references:z(r.references).trimEnd(),terms:Array.isArray(r.terms)?r.terms.map(s=>({term:z(s.term),desc:z(s.desc)})).filter(s=>s.term):void 0,owner:z(r.owner),contractor:z(r.contractor),docVersion:z(r.doc_version),place:z(r.place)}):void 0;return{version:Number(t.version??1),title:z(t.title),language:t.language==="en"?"en":"vi",...t.ba?{ba:z(t.ba)}:{},members:n,...i&&Object.keys(i).length?{overview:i}:{}}}function qy(e){let t="# T\xE0i li\u1EC7u k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED (Pan Test). `ba`: repo t\xE0i li\u1EC7u BA \u0111\u1EC3 tham chi\u1EBFu [[CN-\u2026]] v\xE0 ki\u1EC3m \u0111\u1ED9 ph\u1EE7.\n",n=e.overview,r=n?gt({purpose:n.purpose,scope:n.scope,environment:n.environment,references:n.references,terms:n.terms,owner:n.owner,contractor:n.contractor,doc_version:n.docVersion,place:n.place}):void 0;return t+os(gt({version:e.version,title:e.title,language:e.language,ba:e.ba,members:e.members.map(i=>gt({...i})),overview:r}))}function Hy(e,t){let{front:n,body:r}=cs(e),i=z(n.code);if(!ai.test(i))throw new Error(`m\xE3 ph\xE2n h\u1EC7 \xAB${i}\xBB sai m\u1EABu`);return{code:i,title:z(n.title),order:Number(n.order??0),suites:Vo(n.suites),commonSteps:r.trim(),file:t}}function Uy(e){return`---
5313
+ ${os(gt({code:e.code,title:e.title,order:e.order,suites:e.suites}))}---
4258
5314
  ${e.commonSteps.trim()?e.commonSteps.trim()+`
4259
- `:""}`}function ey(e){if(!e||typeof e!="object")return;let t=e;return{status:Oo(t.status,yt,"not-run"),...t.actual?{actual:W(t.actual)}:{},...t.by?{by:W(t.by)}:{},...t.at?{at:W(t.at)}:{},...t.env?{env:W(t.env)}:{},...t.bug?{bug:W(t.bug)}:{}}}function ty(e){let t=gu(e.deleted),n=ey(e.result),r=mu(e.priority,rn);return{code:W(e.code),case:W(e.case).trimEnd(),...e.requirement?{requirement:W(e.requirement).trimEnd()}:{},steps:W(e.steps).trimEnd(),expected:W(e.expected).trimEnd(),...r?{priority:r}:{},...e.tag?{tag:W(e.tag)}:{},...n?{result:n}:{},...t?{deleted:{...t,...e.deleted.reason?{reason:W(e.deleted.reason)}:{}}}:{}}}function ny(e,t){let{front:n,body:r}=Ki(e),i=/^#\s+(\S+)\s*(?:·\s*(.*))?$/m.exec(r),s=i?.[1]??"",a=Wr.exec(s);if(!a)throw new Error(`thi\u1EBFu ti\xEAu \u0111\u1EC1 \xAB# KB-<PH>-XXXXXX \xB7 T\xEAn\xBB ho\u1EB7c m\xE3 sai m\u1EABu (\xAB${s}\xBB)`);let o=r.slice((i?.index??0)+(i?.[0].length??0)),l=[],c=o.indexOf(Io);if(c>=0){let u=c+Io.length,f=o.indexOf("\n```",u);if(f<0)throw new Error("kh\u1ED1i ```yaml pt:cases``` kh\xF4ng c\xF3 d\u1EA5u \u0111\xF3ng");let m=(0,gn.parse)(o.slice(u,f));if(m!==null&&!Array.isArray(m))throw new Error("kh\u1ED1i pt:cases ph\u1EA3i l\xE0 danh s\xE1ch");l=(m??[]).map(h=>ty(h??{})),o=o.slice(0,c)+o.slice(f+4)}let d=mu(n.priority,rn),p=gu(n.created);return{code:s,module:a[1],title:(i?.[2]??"").trim(),kind:Oo(n.kind,kc,"functional"),status:Oo(n.status,Tc,"drafting"),covers:Po(n.covers),useCases:Po(n.use_cases),...d?{priority:d}:{},...n.preconditions?{preconditions:W(n.preconditions).trimEnd()}:{},...n.owner?{owner:W(n.owner)}:{},...p?{created:p}:{},description:o.trim(),cases:l,file:t}}function ry(e){return lt({code:e.code,case:e.case,requirement:e.requirement,steps:e.steps,expected:e.expected,priority:e.priority,tag:e.tag,result:e.result?lt({...e.result}):void 0,deleted:e.deleted?lt({...e.deleted}):void 0})}function iy(e){let n=[`---
4260
- ${Wi(lt({kind:e.kind,status:e.status,covers:e.covers,use_cases:e.useCases,priority:e.priority,preconditions:e.preconditions,owner:e.owner,created:e.created}))}---
5315
+ `:""}`}function jy(e){if(!e||typeof e!="object")return;let t=e;return{status:Xo(t.status,et,"not-run"),...t.actual?{actual:z(t.actual)}:{},...t.by?{by:z(t.by)}:{},...t.at?{at:z(t.at)}:{},...t.env?{env:z(t.env)}:{},...t.bug?{bug:z(t.bug)}:{}}}function Wy(e){let t=qu(e.deleted),n=jy(e.result),r=Fu(e.priority,hn);return{code:z(e.code),case:z(e.case).trimEnd(),...e.requirement?{requirement:z(e.requirement).trimEnd()}:{},steps:z(e.steps).trimEnd(),expected:z(e.expected).trimEnd(),...r?{priority:r}:{},...e.tag?{tag:z(e.tag)}:{},...n?{result:n}:{},...t?{deleted:{...t,...e.deleted.reason?{reason:z(e.deleted.reason)}:{}}}:{}}}function Ky(e,t){let{front:n,body:r}=cs(e),i=/^#\s+(\S+)\s*(?:·\s*(.*))?$/m.exec(r),s=i?.[1]??"",a=oi.exec(s);if(!a)throw new Error(`thi\u1EBFu ti\xEAu \u0111\u1EC1 \xAB# KB-<PH>-XXXXXX \xB7 T\xEAn\xBB ho\u1EB7c m\xE3 sai m\u1EABu (\xAB${s}\xBB)`);let o=r.slice((i?.index??0)+(i?.[0].length??0)),c=[],l=o.indexOf(zo);if(l>=0){let p=l+zo.length,h=o.indexOf("\n```",p);if(h<0)throw new Error("kh\u1ED1i ```yaml pt:cases``` kh\xF4ng c\xF3 d\u1EA5u \u0111\xF3ng");let f=(0,An.parse)(o.slice(p,h));if(f!==null&&!Array.isArray(f))throw new Error("kh\u1ED1i pt:cases ph\u1EA3i l\xE0 danh s\xE1ch");c=(f??[]).map(m=>Wy(m??{})),o=o.slice(0,l)+o.slice(h+4)}let u=Fu(n.priority,hn),d=qu(n.created);return{code:s,module:a[1],title:(i?.[2]??"").trim(),kind:Xo(n.kind,Gc,"functional"),status:Xo(n.status,zc,"drafting"),covers:Vo(n.covers),useCases:Vo(n.use_cases),...u?{priority:u}:{},...n.preconditions?{preconditions:z(n.preconditions).trimEnd()}:{},...n.owner?{owner:z(n.owner)}:{},...d?{created:d}:{},...n.source?{source:z(n.source)}:{},description:o.trim(),cases:c,file:t}}function Gy(e){return gt({code:e.code,case:e.case,requirement:e.requirement,steps:e.steps,expected:e.expected,priority:e.priority,tag:e.tag,result:e.result?gt({...e.result}):void 0,deleted:e.deleted?gt({...e.deleted}):void 0})}function zy(e){let n=[`---
5316
+ ${os(gt({kind:e.kind,status:e.status,covers:e.covers,use_cases:e.useCases,priority:e.priority,preconditions:e.preconditions,owner:e.owner,created:e.created,source:e.source}))}---
4261
5317
  # ${e.code} \xB7 ${e.title}
4262
5318
  `];return e.description.trim()&&n.push(`
4263
5319
  ${e.description.trim()}
4264
5320
  `),n.push(`
4265
- ${Io}
4266
- ${e.cases.length?Wi(e.cases.map(ry)):`[]
5321
+ ${zo}
5322
+ ${e.cases.length?os(e.cases.map(Gy)):`[]
4267
5323
  `}\`\`\`
4268
- `),n.join("")}function sy(e){return Ne.posix.join(Kt,e.module,`${e.code}.md`)}function ay(e){return Ne.posix.join(Kt,e,fu)}function ct(e){let t=Y0(ot.readFileSync(Ne.join(e,bn),"utf8")),n=[],r=[],i=[],s=Ne.join(e,Kt),a=ot.existsSync(s)?ot.readdirSync(s,{withFileTypes:!0}).filter(o=>o.isDirectory()).map(o=>o.name).sort():[];for(let o of a)for(let l of ot.readdirSync(Ne.join(s,o)).sort()){if(!l.endsWith(".md"))continue;let c=Ne.posix.join(Kt,o,l);try{let d=ot.readFileSync(Ne.join(e,c),"utf8");l===fu?n.push(Q0(d,c)):r.push(ny(d,c))}catch(d){i.push({file:c,message:d.message})}}return n.sort((o,l)=>o.order-l.order||o.code.localeCompare(l.code)),{root:e,config:t,modules:n,suites:r,readErrors:i}}function Lo(e,t){ot.mkdirSync(Ne.dirname(e),{recursive:!0});let n=`${e}.${process.pid}.tmp`;ot.writeFileSync(n,t),ot.renameSync(n,e)}function Pt(e,t){t.file=sy(t),Lo(Ne.join(e,t.file),iy(t))}function Ro(e,t){t.file=ay(t.code),Lo(Ne.join(e,t.file),Z0(t))}function bu(e,t){Lo(Ne.join(e,bn),J0(t))}var gn,bn,Kt,fu,Io,X0,W,Po,sr=ze(()=>{"use strict";E();gn=wg(hu(),1);An();Ur();bn=".pantest.yaml",Kt="modules",fu="_module.md",Io="```yaml pt:cases";X0={lineWidth:0,blockQuote:"literal"};W=e=>e==null?"":String(e),Po=e=>Array.isArray(e)?e.map(t=>String(t)):e?[String(e)]:[]});import Mo from"node:fs";import Gi from"node:path";function wu(e,t,n=0){if(n>8)return;let r;try{r=Mo.readdirSync(e,{withFileTypes:!0})}catch{return}for(let i of r)i.isDirectory()?!oy.has(i.name)&&!i.name.startsWith(".")&&wu(Gi.join(e,i.name),t,n+1):vu.test(i.name)&&t.push(Gi.join(e,i.name))}function Gt(e){let t=new Map,n=[];wu(e,n);for(let r of n){let i=vu.exec(Gi.basename(r))[1];try{let{front:s,body:a}=Ki(Mo.readFileSync(r,"utf8")),o=/^#\s+(\S+)\s*(?:·\s*(.*))?$/m.exec(a);if(o?.[1]!==i)continue;t.set(i,{code:i,title:(o[2]??"").trim(),type:String(s.type??""),deleted:s.status==="deleted"})}catch{}}return t}function zt(e,t){if(!t)return null;let n=Gi.resolve(e,t);return Mo.existsSync(n)?n:null}var vu,oy,zi=ze(()=>{"use strict";E();sr();vu=/^([A-Z][A-Z0-9]*-[A-Z0-9]+-[A-Z0-9]+)\.md$/,oy=new Set([".git","node_modules",".pan-ba","dist","build"])});import{execFileSync as Do}from"node:child_process";import ar from"node:fs";import Vi from"node:path";function Vt(e){let t=process.env.PAN_TEST_ME?.trim();if(t)return t;try{let n=Do("git",["-C",e,"config","user.name"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(n)return n}catch{}return process.env.USER??process.env.USERNAME??"unknown"}function xu(e,t=[]){let n=new Set(t);for(let r of e.suites){n.add(r.code);for(let i of r.cases)n.add(i.code)}return n}function vn(e){let t=new Set;try{let n=Do("git",["-C",e,"for-each-ref","--format=%(refname)","refs/heads","refs/remotes"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).split(`
4269
- `).filter(Boolean);for(let r of n){let i=Do("git",["-C",e,"grep","-h","-o","-E","(KB|TC)-[A-Z][A-Z0-9]{1,11}-[A-Z0-9]{6}",r,"--",Kt],{encoding:"utf8",stdio:["ignore","pipe","ignore"],maxBuffer:67108864});for(let s of i.split(`
4270
- `)){let a=s.slice(s.lastIndexOf(":")+1).trim();a&&t.add(a)}}}catch{}return t}function ku(e,t){let n=Vi.resolve(e);if(ar.existsSync(Vi.join(n,bn)))throw new z(`${n} \u0111\xE3 l\xE0 repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED (${bn})`);let r={version:1,title:t.title,language:t.language??"vi",...t.ba?{ba:t.ba}:{},members:t.me?[{id:t.me.id,name:t.me.name,role:"Tester"}]:[]};bu(n,r),ar.mkdirSync(Vi.join(n,Kt),{recursive:!0});let i=Vi.join(n,".gitignore"),s=ar.existsSync(i)?ar.readFileSync(i,"utf8"):"";return/^\/?exports\/?$/m.test(s)||ar.writeFileSync(i,s+(s&&!s.endsWith(`
5324
+ `),n.join("")}function Vy(e){return Ie.posix.join(Qt,e.module,`${e.code}.md`)}function Xy(e){return Ie.posix.join(Qt,e,$u)}function Ge(e){let t=Fy(ft.readFileSync(Ie.join(e,Zt),"utf8")),n=[],r=[],i=[],s=Ie.join(e,Qt),a=ft.existsSync(s)?ft.readdirSync(s,{withFileTypes:!0}).filter(o=>o.isDirectory()).map(o=>o.name).sort():[];for(let o of a)for(let c of ft.readdirSync(Ie.join(s,o)).sort()){if(!c.endsWith(".md"))continue;let l=Ie.posix.join(Qt,o,c);try{let u=ft.readFileSync(Ie.join(e,l),"utf8");c===$u?n.push(Hy(u,l)):r.push(Ky(u,l))}catch(u){i.push({file:l,message:u.message})}}return n.sort((o,c)=>o.order-c.order||o.code.localeCompare(c.code)),{root:e,config:t,modules:n,suites:r,readErrors:i}}function Yo(e,t){ft.mkdirSync(Ie.dirname(e),{recursive:!0});let n=`${e}.${process.pid}.tmp`;ft.writeFileSync(n,t),ft.renameSync(n,e)}function ze(e,t){t.file=Vy(t),Yo(Ie.join(e,t.file),zy(t))}function Jo(e,t){t.file=Xy(t.code),Yo(Ie.join(e,t.file),Uy(t))}function Hu(e,t){Yo(Ie.join(e,Zt),qy(t))}var An,Zt,Qt,$u,zo,$y,z,Vo,_n=Se(()=>{"use strict";S();An=lb(Bu(),1);fn();si();Zt=".pantest.yaml",Qt="modules",$u="_module.md",zo="```yaml pt:cases";$y={lineWidth:0,blockQuote:"literal"};z=e=>e==null?"":String(e),Vo=e=>Array.isArray(e)?e.map(t=>String(t)):e?[String(e)]:[]});import Qo from"node:fs";import ds from"node:path";function ju(e,t,n=0){if(n>8)return;let r;try{r=Qo.readdirSync(e,{withFileTypes:!0})}catch{return}for(let i of r)i.isDirectory()?!Yy.has(i.name)&&!i.name.startsWith(".")&&ju(ds.join(e,i.name),t,n+1):Uu.test(i.name)&&t.push(ds.join(e,i.name))}function bt(e){let t=new Map,n=[];ju(e,n);for(let r of n){let i=Uu.exec(ds.basename(r))[1];try{let{front:s,body:a}=cs(Qo.readFileSync(r,"utf8")),o=/^#\s+(\S+)\s*(?:·\s*(.*))?$/m.exec(a);if(o?.[1]!==i)continue;t.set(i,{code:i,title:(o[2]??"").trim(),type:String(s.type??""),deleted:s.status==="deleted"})}catch{}}return t}function Ve(e,t){if(!t)return null;let n=ds.resolve(e,t);return Qo.existsSync(n)?n:null}var Uu,Yy,Nn=Se(()=>{"use strict";S();_n();Uu=/^([A-Z][A-Z0-9]*-[A-Z0-9]+-[A-Z0-9]+)\.md$/,Yy=new Set([".git","node_modules",".pan-ba","dist","build"])});import{execFileSync as Zo}from"node:child_process";import br from"node:fs";import ps from"node:path";function vt(e){let t=process.env.PAN_TEST_ME?.trim();if(t)return t;try{let n=Zo("git",["-C",e,"config","user.name"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(n)return n}catch{}return process.env.USER??process.env.USERNAME??"unknown"}function us(e,t=[]){let n=new Set(t);for(let r of e.suites){n.add(r.code);for(let i of r.cases)n.add(i.code)}return n}function Ft(e){let t=new Set;try{let n=Zo("git",["-C",e,"for-each-ref","--format=%(refname)","refs/heads","refs/remotes"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).split(`
5325
+ `).filter(Boolean);for(let r of n){let i=Zo("git",["-C",e,"grep","-h","-o","-E","(KB|TC)-[A-Z][A-Z0-9]{1,11}-[A-Z0-9]{6}",r,"--",Qt],{encoding:"utf8",stdio:["ignore","pipe","ignore"],maxBuffer:67108864});for(let s of i.split(`
5326
+ `)){let a=s.slice(s.lastIndexOf(":")+1).trim();a&&t.add(a)}}}catch{}return t}function Ku(e,t){let n=ps.resolve(e);if(br.existsSync(ps.join(n,Zt)))throw new K(U(`${n} \u0111\xE3 l\xE0 repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED (${Zt})`,`${n} is already a test document repo (${Zt})`));let r={version:1,title:t.title,language:t.language??"vi",...t.ba?{ba:t.ba}:{},members:t.me?[{id:t.me.id,name:t.me.name,role:"Tester"}]:[]};Hu(n,r),br.mkdirSync(ps.join(n,Qt),{recursive:!0});let i=ps.join(n,".gitignore"),s=br.existsSync(i)?br.readFileSync(i,"utf8"):"";return/^\/?exports\/?$/m.test(s)||br.writeFileSync(i,s+(s&&!s.endsWith(`
4271
5327
  `)?`
4272
5328
  `:"")+`exports/
4273
- `),r}function Xi(e,t,n){if(!qr.test(t))throw new z(`M\xE3 ph\xE2n h\u1EC7 \xAB${t}\xBB ph\u1EA3i l\xE0 ch\u1EEF hoa / s\u1ED1, 2\u201312 k\xFD t\u1EF1, b\u1EAFt \u0111\u1EA7u b\u1EB1ng ch\u1EEF.`);if(e.modules.some(i=>i.code===t))throw new z(`\u0110\xE3 c\xF3 ph\xE2n h\u1EC7 ${t}.`);let r={code:t,title:n,order:Math.max(0,...e.modules.map(i=>i.order))+1,suites:[],commonSteps:"",file:""};return Ro(e.root,r),e.modules.push(r),r}function Bo(e,t,n){let r=Tu(e,t);return Object.assign(r,n),Ro(e.root,r),r}function Tu(e,t){let n=e.modules.find(r=>r.code===t);if(!n)throw new z(`Kh\xF4ng c\xF3 ph\xE2n h\u1EC7 ${t}.`);return n}function or(e,t,{withDeleted:n=!1}={}){let r=e.modules.find(s=>s.code===t),i=new Map((r?.suites??[]).map((s,a)=>[s,a]));return e.suites.filter(s=>s.module===t&&(n||s.status!=="deleted")).sort((s,a)=>(i.get(s.code)??1e9)-(i.get(a.code)??1e9)||s.code.localeCompare(a.code))}function Yi(e,t){let n=Tu(e,t.module);if(!t.title.trim())throw new z("K\u1ECBch b\u1EA3n c\u1EA7n t\xEAn.");let r=t.by??Vt(e.root),i={code:Vs("KB",n.code,xu(e,t.avoid)),module:n.code,title:t.title.trim(),kind:t.kind??"functional",status:"drafting",covers:t.covers??[],useCases:t.useCases??[],...t.priority?{priority:t.priority}:{},...t.preconditions?{preconditions:t.preconditions}:{},owner:r,created:{by:r,at:yu()},description:"",cases:[],file:""};Pt(e.root,i),e.suites.push(i);let s=or(e,n.code).map(o=>o.code).filter(o=>o!==i.code),a=t.after?s.indexOf(t.after):-1;return s.splice(a>=0?a+1:s.length,0,i.code),Bo(e,n.code,{suites:s}),i}function Su(e,t){let n=e.suites.find(r=>r.code===t);if(!n)throw new z(`Kh\xF4ng c\xF3 k\u1ECBch b\u1EA3n ${t}.`);return n}function Eu(e,t,n){let r=Su(e,t);for(let[i,s]of Object.entries(n))s!==void 0&&(s===""&&(i==="priority"||i==="preconditions"||i==="owner")?delete r[i]:r[i]=s);return Pt(e.root,r),r}function Ji(e,t,n,r={}){let i=Su(e,t);if(!n.case.trim())throw new z("T\xECnh hu\u1ED1ng c\u1EA7n m\xF4 t\u1EA3.");let s={code:Vs("TC",i.module,xu(e,r.avoid)),case:n.case.trim(),...n.requirement?{requirement:n.requirement.trim()}:{},steps:(n.steps??"").trim(),expected:(n.expected??"").trim(),...n.priority?{priority:n.priority}:{},...n.tag?{tag:n.tag.trim()}:{}},a=r.after?i.cases.findIndex(o=>o.code===r.after):-1;return i.cases.splice(a>=0?a+1:i.cases.length,0,s),Pt(e.root,i),s}function Qi(e,t){if(!jr.test(t))throw new z(`M\xE3 t\xECnh hu\u1ED1ng \xAB${t}\xBB sai m\u1EABu (TC-<PH>-XXXXXX).`);for(let n of e.suites){let r=n.cases.find(i=>i.code===t);if(r)return{suite:n,tc:r}}throw new z(`Kh\xF4ng c\xF3 t\xECnh hu\u1ED1ng ${t}.`)}function Zi(e,t,n){let{suite:r,tc:i}=Qi(e,t);for(let[s,a]of Object.entries(n)){if(a===void 0)continue;let o=typeof a=="string"?a.trim():a;o===""&&(s==="requirement"||s==="priority"||s==="tag")?delete i[s]:i[s]=o}return Pt(e.root,r),i}function Cu(e,t,n){let{suite:r,tc:i}=Qi(e,t),s=r.cases.indexOf(i),a=s+n;return a<0||a>=r.cases.length||([r.cases[s],r.cases[a]]=[r.cases[a],r.cases[s]],Pt(e.root,r)),i}function es(e,t,n="",r){let{suite:i,tc:s}=Qi(e,t);return s.deleted={by:r??Vt(e.root),at:yu(),...n?{reason:n}:{}},Pt(e.root,i),s}function ts(e,t,n){if(!yt.includes(n.status))throw new z(`Tr\u1EA1ng th\xE1i \xAB${n.status}\xBB kh\xF4ng h\u1EE3p l\u1EC7 (${yt.join(" | ")}).`);let{suite:r,tc:i}=Qi(e,t);if(n.status==="failed"&&!(n.actual??"").trim())throw new z("Kh\xF4ng \u0111\u1EA1t: c\u1EA7n ghi k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF.");if(n.status==="not-run")delete i.result;else{let s={status:n.status,by:n.by??Vt(e.root),at:n.at??dy()};n.actual?.trim()&&(s.actual=n.actual.trim()),n.env?.trim()&&(s.env=n.env.trim()),n.bug?.trim()&&(s.bug=n.bug.trim()),i.result=s}return Pt(e.root,r),i}var z,dy,yu,ns=ze(()=>{"use strict";E();An();sr();Ur();z=class extends Error{},dy=()=>new Date().toISOString().slice(0,10),yu=()=>new Date().toISOString().replace(/\.\d{3}Z$/,"Z")});function rs(e,t){let n=[];for(let l of e.readErrors)n.push({rule:"E03",severity:"error",file:l.file,message:`Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c t\u1EC7p: ${l.message}`});let r=new Map,i=(l,c)=>{let d=r.get(l);d?n.push({rule:"E01",severity:"error",code:l,file:c,message:`Tr\xF9ng m\xE3 ${l} (\u0111\xE3 c\xF3 \u1EDF ${d}) \u2014 \u0111\u1ED5i m\xE3 m\u1ED9t b\xEAn (th\u01B0\u1EDDng do hai nh\xE1nh git c\xF9ng sinh).`}):r.set(l,c)},s=new Set(e.modules.map(l=>l.code)),a=new Set;for(let l of e.suites){i(l.code,l.file),Wr.exec(l.code)||n.push({rule:"E02",severity:"error",code:l.code,file:l.file,message:`M\xE3 k\u1ECBch b\u1EA3n \xAB${l.code}\xBB sai m\u1EABu.`}),s.has(l.module)||n.push({rule:"E04",severity:"error",code:l.code,file:l.file,message:`K\u1ECBch b\u1EA3n thu\u1ED9c ph\xE2n h\u1EC7 ${l.module} nh\u01B0ng ch\u01B0a c\xF3 modules/${l.module}/_module.md.`});for(let p of l.cases){i(p.code,l.file);let u=jr.exec(p.code);u?u[1]!==l.module&&!p.deleted&&n.push({rule:"E02",severity:"error",code:p.code,file:l.file,message:`T\xECnh hu\u1ED1ng ${p.code} mang m\xE3 ph\xE2n h\u1EC7 ${u[1]} nh\u01B0ng n\u1EB1m trong k\u1ECBch b\u1EA3n ${l.code}.`}):n.push({rule:"E02",severity:"error",code:p.code,file:l.file,message:`M\xE3 t\xECnh hu\u1ED1ng \xAB${p.code}\xBB sai m\u1EABu (TC-<PH>-XXXXXX).`})}if(l.status==="deleted")continue;for(let p of l.covers)a.add(p);let d=l.cases.filter(p=>!p.deleted);if(d.length===0&&n.push({rule:"T06",severity:"warn",code:l.code,file:l.file,message:`K\u1ECBch b\u1EA3n ${l.code} ch\u01B0a c\xF3 t\xECnh hu\u1ED1ng.`}),l.kind==="functional"&&l.covers.length===0&&n.push({rule:"T01",severity:"warn",code:l.code,file:l.file,message:`K\u1ECBch b\u1EA3n ${l.code} ch\u01B0a ghi ch\u1EE9c n\u0103ng n\xE0o \u0111\u01B0\u1EE3c ki\u1EC3m (covers).`}),t)for(let p of l.covers){let u=t.get(p);u?u.deleted&&n.push({rule:"T05",severity:"warn",code:l.code,file:l.file,message:`${l.code} ph\u1EE7 ${p} \u2014 m\u1EE5c n\xE0y \u0111\xE3 b\u1ECB xo\xE1 trong repo BA.`}):n.push({rule:"T05",severity:"warn",code:l.code,file:l.file,message:`${l.code} ph\u1EE7 ${p} nh\u01B0ng repo BA kh\xF4ng c\xF3 m\u1EE5c n\xE0y.`})}for(let p of d){let u=[!p.steps.trim()&&"c\xE1c b\u01B0\u1EDBc",!p.expected.trim()&&"k\u1EBFt qu\u1EA3 mong \u0111\u1EE3i"].filter(Boolean);u.length&&n.push({rule:"T03",severity:"warn",code:p.code,file:l.file,message:`T\xECnh hu\u1ED1ng ${p.code} thi\u1EBFu ${u.join(" v\xE0 ")}.`}),p.result?.status==="failed"&&!p.result.actual?.trim()&&n.push({rule:"T04",severity:"warn",code:p.code,file:l.file,message:`T\xECnh hu\u1ED1ng ${p.code} Kh\xF4ng \u0111\u1EA1t nh\u01B0ng ch\u01B0a ghi k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF.`})}}if(t)for(let l of t.values())l.deleted||l.type!=="function"||a.has(l.code)||n.push({rule:"T02",severity:"info",code:l.code,message:`Ch\u1EE9c n\u0103ng ${l.code}${l.title?" \xAB"+l.title+"\xBB":""} ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED.`});let o={error:0,warn:1,info:2};return n.sort((l,c)=>o[l.severity]-o[c.severity]||l.rule.localeCompare(c.rule))}function lr(){return{total:0,"not-run":0,passed:0,failed:0,blocked:0,skipped:0}}function $o(e,t=lr()){for(let n of e.cases)n.deleted||(t.total++,t[n.result?.status??"not-run"]++);return t}function is(e,t){let n=lr(),r=e.modules.map(s=>{let a=e.suites.filter(l=>l.module===s.code&&l.status!=="deleted"),o=lr();for(let l of a)$o(l,o);for(let l of Object.keys(n))n[l]+=o[l];return{code:s.code,title:s.title,suites:a.length,count:o}}),i=null;if(t){let s=new Set(e.suites.filter(o=>o.status!=="deleted").flatMap(o=>o.covers)),a=[...t.values()].filter(o=>o.type==="function"&&!o.deleted);i={functions:a.length,covered:a.filter(o=>s.has(o.code)).length}}return{all:n,modules:r,coverage:i}}var ss=ze(()=>{"use strict";E();An()});function kr(e){"@babel/helpers - typeof";return kr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kr(e)}function uy(e,t){if(kr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(kr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hy(e){var t=uy(e,"string");return kr(t)=="symbol"?t:t+""}function S(e,t,n){return(t=hy(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_u(Object(n),!0).forEach(function(r){S(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_u(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function my(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function Dl(e,t){if(e==null)return{};var n,r,i=my(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function XS(e,t){return VS(e,t||{},0,0)}function YS(e,t){return WS(e,{i:2},t&&t.out,t&&t.dictionary)}function sh(e,t){if(t){for(var n=new ae(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(ih)return ih.encode(e);for(var i=e.length,s=new ae(e.length+(e.length>>1)),a=0,o=function(d){s[a++]=d},r=0;r<i;++r){if(a+5>s.length){var l=new ae(a+8+(i-r<<1));l.set(s),s=l}var c=e.charCodeAt(r);c<128||t?o(c):c<2048?(o(192|c>>6),o(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|e.charCodeAt(++r)&1023,o(240|c>>18),o(128|c>>12&63),o(128|c>>6&63),o(128|c&63)):(o(224|c>>12),o(128|c>>6&63),o(128|c&63))}return Mr(s,0,a)}function QS(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else{if(Sl)return Sl.decode(e);var i=JS(e),s=i.s,n=i.r;return n.length&&Se(8),s}}function r2(e,t){t||(t={});var n={},r=[];fm(e,"",n,t);var i=0,s=0;for(var a in n){var o=n[a],l=o[0],c=o[1],d=c.level==0?0:8,p=sh(a),u=p.length,f=c.comment,m=f&&sh(f),h=m&&m.length,g=El(c.extra);u>65535&&Se(11);var v=d?XS(l,c):l,w=v.length,b=zS();b.p(l),r.push(hm(c,{size:l.length,crc:b.d(),c:v,f:p,m,u:u!=a.length||m&&f.length!=h,o:i,compression:d})),i+=30+u+g+w,s+=76+2*(u+g)+(h||0)+w}for(var C=new ae(s+22),A=i,y=s-i,T=0;T<r.length;++T){var p=r[T];ah(C,p.o,p,p.f,p.u,p.c.length);var x=30+p.f.length+El(p.extra);C.set(p.c,p.o+x),ah(C,i,p,p.f,p.u,p.c.length,p.o,p.m),i+=16+x+(p.m?p.m.length:0)}return n2(C,i,r.length,y,A),C}function i2(e,t){for(var n={},r=e.length-22;Re(e,r)!=101010256;--r)(!r||e.length-r>65558)&&Se(13);var i=Qe(e,r+8);if(!i)return{};var s=Re(e,r+16),a=Re(e,r-20)==117853008;if(a){var o=Re(e,r-12);a=Re(e,o)==101075792,a&&(i=Re(e,o+32),s=Re(e,o+48))}for(var l=t&&t.filter,c=0;c<i;++c){var d=e2(e,s,a),p=d[0],u=d[1],f=d[2],m=d[3],h=d[4],g=d[5],v=ZS(e,g);s=h,(!l||l({name:m,size:u,originalSize:f,compression:p}))&&(p?p==8?n[m]=YS(e.subarray(v,v+u),{out:new ae(f)}):Se(14,"unknown compression type "+p):n[m]=Mr(e,v,v+u))}return n}function dh(e,t,n,r,i,s,a){try{var o=e[s](a),l=o.value}catch(c){n(c);return}o.done?t(l):Promise.resolve(l).then(r,i)}function Bt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var s=e.apply(t,n);function a(l){dh(s,r,i,a,o,"next",l)}function o(l){dh(s,r,i,a,o,"throw",l)}a(void 0)})}}var py,Ir,Ah,As,fy,I,mt,H,Nh,Ce,gy,by,vy,Ih,us,wy,yy,Pr,xy,Ph,ys,ky,Fo,Oh,Lh,U,Rh,Mh,Ty,Bl,Sy,Ey,Cy,Dh,oe,Ns,Bh,Au,$l,_y,Ot,$h,Fh,Ze,Ay,be,Ny,Hh,Iy,Py,Oy,P,Ho,Uh,et,cr,br,Xt,O,de,qh,Fl,Wh,jh,Kh,Hl,Ly,Ry,My,Nu,Dy,Iu,By,$y,Fy,Hy,Pu,Uy,qy,Wy,Ul,jy,ql,Or,pe,Lr,Ky,Gy,zy,Vy,Is,Wl,mr,Gh,Xy,zh,Yy,Jt,Qt,Lt,Rt,Jy,Qy,Zy,ex,Ps,tx,$e,nx,rx,ix,sx,ax,ox,lx,cx,dx,px,Ye,LN,ux,hx,fx,Ou,We,En,mx,gx,bx,RN,vx,Vh,wx,yx,Cn,dr,Xh,xx,kx,Tx,Sx,Ex,Cx,Uo,Yh,_x,Ax,Jh,Nx,Zt,Ix,Px,Tr,as,Ox,Be,Ie,jl,Lx,Qh,Rx,Mx,Dx,Bx,$x,Fx,Hx,Kl,Zh,ef,Ux,qx,Wx,jx,Kx,tf,Gx,Sr,nf,zx,Vx,rf,sf,Xx,af,of,lf,Gl,Yx,Jx,nt,rt,Ke,Me,zl,Qx,cf,Zx,e1,t1,df,n1,r1,pf,uf,fl,Vl,hf,i1,ff,s1,a1,o1,l1,c1,d1,p1,u1,h1,f1,Xl,m1,ml,g1,b1,qo,Lu,Os,mf,v1,w1,Rr,y1,ge,x1,k1,Ru,T1,S1,E1,C1,_1,A1,N1,I1,P1,O1,L1,Ls,R1,M1,bf,D1,Tn,B1,Rs,gr,Mu,$1,F1,H1,os,U1,q1,Yl,W1,Jl,vf,j1,K1,G1,wf,xf,kf,z1,V1,X1,Y1,Tf,xs,ls,J1,Q1,Z1,ek,Sf,tk,nk,Wo,rk,ik,Sn,Du,J,sk,MN,Cf,ak,ok,kn,Bu,jo,lk,_f,ck,dk,$u,pk,uk,hk,fk,ks,mk,gk,bk,vk,Je,hs,gl,wk,Nf,De,Er,fs,If,Ql,yk,xk,Fu,kk,ms,Tk,Sk,Ek,Ck,_k,Ak,Nk,Ik,Pf,Pk,Ok,Lk,Rk,Mk,Of,Dk,Hu,Bk,$k,Lf,Fk,Cr,bl,wn,Hk,Rf,Ko,Uk,qk,Wk,jk,Mf,Kk,Gk,zk,Zl,Vk,Xk,Df,Yk,Ts,vr,Jk,Ms,Bf,Qk,Zk,eT,dt,me,tT,vl,Ds,nT,rT,Uu,iT,sT,aT,oT,lT,cT,dT,pT,uT,hT,fT,mT,Ff,gT,Hf,qu,Go,bT,Uf,vT,qf,Wf,wT,yT,xT,kT,TT,ST,jf,Wu,zo,ET,Kf,CT,_T,AT,NT,IT,Gf,pt,PT,OT,LT,RT,MT,DT,BT,$T,FT,HT,UT,Vo,qT,WT,ju,jT,KT,GT,zT,zf,Vf,VT,XT,Ku,Gu,YT,JT,zu,QT,ZT,eS,Vu,Xu,tS,nS,rS,Xf,iS,sS,aS,ec,gt,en,Dt,oS,lS,cS,dS,pS,uS,hS,fS,mS,gS,bS,Yf,Yu,ut,Jf,Qf,Zf,em,tm,nm,vS,wS,yS,wr,tc,Ju,Qu,wl,xS,kS,Xo,TS,SS,ES,CS,_S,AS,nc,Zu,rm,NS,Yo,IS,PS,eh,OS,im,gs,Jo,Qo,Zo,LS,RS,MS,Ge,sm,am,tn,rc,DS,ae,Oe,ic,Bs,$s,yl,om,lm,cm,xl,dm,BS,th,kl,ht,K,tt,Mt,K,K,K,K,_r,K,$S,FS,HS,US,el,je,tl,sc,Mr,qS,Se,WS,ft,pr,nl,Tl,nh,ur,pm,rh,jS,um,KS,GS,zS,VS,hm,Qe,Re,rl,xe,fm,ih,Sl,JS,ZS,e2,t2,El,ah,n2,s2,Ss,a2,oh,mm,il,bs,lh,Cl,o2,l2,c2,Ar,Dr,_l,yr,d2,p2,u2,h2,f2,m2,g2,gm,b2,v2,w2,bm,hr,sl,y2,x2,nn,vm,wm,k2,ym,T2,S2,al,E2,ac,C2,_2,ch,A2,N2,ph,uh,oc,xm,km,I2,P2,Fs,it,Tm,Sm,ke,Em,yn,O2,L2,R2,lc,Al,Nr,hh,M2,fh,mh,Nl,D2,gh,bh,B2,$2,F2,H2,U2,Il,cc,q2,Es,Cm,W2,j2,Te,K2,Hs,_m,vh,G2,z2,Pl,Ol,V2,X2,Y2,J2,Q2,Z2,eE,tE,Am,nE,cs,rE,iE,ds,Nm,sE,wh,aE,oE,ps,lE,cE,yh,dE,pE,uE,xh,hE,Ll,ol,fE,mE,gE,Im,vs,bE,vE,Pm,Cs,Br,wE,Om,yE,xE,kE,fr,Lm,ll,kh,Rm,dc,cl,TE,Th,SE,pc,EE,CE,_E,AE,NE,Rl,IE,PE,Mm,OE,dl,Sh,Yt,Dm,LE,RE,Bm,ME,DE,BE,pl,$E,xr,Ml,ws,Eh,FE,HE,UE,qE,WE,jE,KE,GE,$m,zE,VE,XE,YE,Fm,JE,QE,_s,ZE,Hm,eC,tC,Um,qm,nC,Wm,Ch,rC,iC,sC,_h,DN,aC,BN,ul,oC,jm=ze(()=>{E();py=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports);Ir=class{constructor(e){S(this,"rootKey",void 0),this.rootKey=e}get writtenAs(){}},Ah=e=>e instanceof Ir||typeof e=="object"&&e!==null&&typeof e.prepForXml=="function",As=e=>Ah(e)?e.rootKey:void 0,fy=Object.seal({}),I=class extends Ir{constructor(e){super(e),S(this,"root",void 0),this.root=new Array}prepForXml(e){var t;e.stack.push(this);let n=this.root.flatMap(r=>{if(Ah(r)){let i=r.writtenAs;return i?i.map(s=>s.prepForXml(e)):r.prepForXml(e)}return r}).filter(r=>r!==void 0);return e.stack.pop(),{[this.rootKey]:n.length?n.length===1&&(!((t=n[0])===null||t===void 0)&&t._attr)?n[0]:n:fy}}addChildElement(e){return this.root.push(e),this}},mt=class extends I{constructor(e,t){super(e),S(this,"includeIfEmpty",void 0),this.includeIfEmpty=t}prepForXml(e){let t=super.prepForXml(e);return this.includeIfEmpty||t&&(typeof t[this.rootKey]!="object"||Object.keys(t[this.rootKey]).length)?t:void 0}};H=class extends Ir{constructor(e){super("_attr"),S(this,"root",void 0),S(this,"xmlKeys",void 0),this.root=e}prepForXml(e){let t={};return Object.entries(this.root).forEach(([n,r])=>{if(r!==void 0){let i=this.xmlKeys&&this.xmlKeys[n]||n;t[i]=r}}),{_attr:t}}},Nh=class extends Ir{constructor(e){super("_attr"),S(this,"root",void 0),this.root=e}prepForXml(e){return{_attr:Object.values(this.root).filter(({value:t})=>t!==void 0).reduce((t,{key:n,value:r})=>k(k({},t),{},{[n]:r}),{})}}},Ce=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{val:"w:val",color:"w:color",fill:"w:fill",space:"w:space",sz:"w:sz",type:"w:type",rsidR:"w:rsidR",rsidRPr:"w:rsidRPr",rsidSect:"w:rsidSect",w:"w:w",h:"w:h",top:"w:top",right:"w:right",bottom:"w:bottom",left:"w:left",header:"w:header",footer:"w:footer",gutter:"w:gutter",linePitch:"w:linePitch",pos:"w:pos"})}};gy=["elements"],by=new Map([["amp","&"],["lt","<"],["gt",">"],["quot",'"'],["apos","'"]]),vy=/&([^;]*);?/g,Ih=e=>e.indexOf("&")===-1?e:e.replace(vy,(t,n)=>{if(!t.endsWith(";"))throw new Error(`Invalid XML: "&" that starts no entity, in "${e}"`);let r=by.get(n);if(r!==void 0)return r;let i=/^#x[0-9a-f]+$/i.test(n)?parseInt(n.slice(2),16):/^#[0-9]+$/.test(n)?parseInt(n.slice(1),10):NaN;if(!(i>0&&i<=1114111))throw new Error(`Invalid XML: unknown entity "${t}"`);return String.fromCodePoint(i)}),us=e=>e===" "||e===`
4274
- `||e===" "||e==="\r",wy=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,yy=e=>Object.fromEntries([...e.matchAll(wy)].map(([,t,n,r])=>[t,n??r])),Pr=(e,{keepWhitespaceText:t=!1}={})=>{let n={},r=[],i=e.charCodeAt(0)===65279?1:0;for(;i<e.length&&us(e[i]);)i++;let s=p=>{var u;let f=r.length===0?n:r[r.length-1];((u=f.elements)!==null&&u!==void 0?u:f.elements=[]).push(p)},a=p=>{if(p.trim()===""){p!==""&&t&&s({type:"text",text:p});return}if(r.length===0)throw new Error(`Invalid XML: text outside of the root element, "${p.trim()}"`);s({type:"text",text:Ih(p)})},o=(p,u,f)=>{let m=e.indexOf(p,u);if(m===-1)throw new Error(`Invalid XML: ${f} that isn't closed`);return m};for(;i<e.length;){let p=e.indexOf("<",i);if(a(e.slice(i,p===-1?e.length:p)),p===-1)break;if(e.startsWith("<?",p)){let u=o("?>",p+2,"processing instruction"),f=e.slice(p+2,u),m=f.search(/\s/),h=m===-1?f:f.slice(0,m),g=m===-1?"":f.slice(m).trimStart();if(h.toLowerCase()==="xml"){let v=yy(g);n.declaration=Object.keys(v).length>0?{attributes:v}:{}}else s({type:"instruction",name:h,instruction:g});i=u+2}else if(e.startsWith("<!--",p)){let u=o("-->",p+4,"comment"),f=e.slice(p+4,u);f!==""&&s({type:"comment",comment:f}),i=u+3}else if(e.startsWith("<![CDATA[",p)){let u=o("]]>",p+9,"CDATA section"),f=e.slice(p+9,u);f!==""&&s({type:"cdata",cdata:f}),i=u+3}else if(e.startsWith("<!DOCTYPE",p)){let u=p+9,f,m=!1;for(;u<e.length;u++){let h=e[u];if(f!==void 0)f=h===f?void 0:f;else if(h==='"'||h==="'")f=h;else if(h==="[")m=!0;else if(h==="]")m=!1;else if(h===">"&&!m)break}if(u===e.length)throw new Error("Invalid XML: DOCTYPE that isn't closed");s({type:"doctype",doctype:e.slice(p+9,u).replace(/^ /,"")}),i=u+1}else if(e.startsWith("</",p)){let u=o(">",p+2,"closing tag"),f=e.slice(p+2,u).trimEnd(),m=r.pop();if(m?.name!==f){var l;throw new Error(`Invalid XML: closing tag </${f}> doesn't match <${(l=m?.name)!==null&&l!==void 0?l:""}>`)}i=u+1}else i=xy(e,p+1,(u,f)=>{s(u),f||r.push(u)})}if(r.length>0)throw new Error(`Invalid XML: <${r[r.length-1].name}> isn't closed`);let{elements:c}=n,d=Dl(n,gy);return c===void 0?d:k(k({},d),{},{elements:c})},xy=(e,t,n)=>{let r=t;for(;r<e.length&&!us(e[r])&&e[r]!=="/"&&e[r]!==">";)r++;let i=e.slice(t,r);if(i==="")throw new Error("Invalid XML: tag without a name");let s=[],a=r;for(;;){for(;a<e.length&&us(e[a]);)a++;if(a>=e.length)throw new Error(`Invalid XML: <${i}> that isn't closed`);if(e[a]===">"||e.startsWith("/>",a)){let u=e[a]==="/";return n(k({type:"element",name:i},s.length>0?{attributes:Object.fromEntries(s)}:{}),u),a+(u?2:1)}let o=e.indexOf("=",a),l=e.slice(a,o===-1?e.length:o).trimEnd();if(o===-1||l===""||/[\s/>]/.test(l))throw new Error(`Invalid XML: attribute of <${i}> without a value`);let c=o+1;for(;c<e.length&&us(e[c]);)c++;let d=e[c];if(d!=='"'&&d!=="'")throw new Error(`Invalid XML: value of ${l} on <${i}> isn't quoted`);let p=e.indexOf(d,c+1);if(p===-1)throw new Error(`Invalid XML: value of ${l} on <${i}> isn't closed`);s.some(([u])=>u===l)||s.push([l,Ih(e.slice(c+1,p))]),a=p+1}},Ph=new Map([["&","&amp;"],['"',"&quot;"],["'","&apos;"],["<","&lt;"],[">","&gt;"]]),ys=e=>e.replace(/[&"'<>\x00-\x08\x0B\x0C\x0E-\x1F]/g,t=>{var n;return(n=Ph.get(t))!==null&&n!==void 0?n:""}),ky=e=>e.replace(/[&<>\x00-\x08\x0B\x0C\x0E-\x1F]/g,t=>{var n;return(n=Ph.get(t))!==null&&n!==void 0?n:""}),Fo=e=>typeof e=="string"?ys(e):e,Oh=(e,t,n)=>{let r=Object.keys(e)[0],i=r===void 0?void 0:e[r],s=[],a=[],o=l=>{for(let[c,d]of Object.entries(l))s.push(`${c}="${String(Fo(d))}"`)};if(typeof i=="object"){if(i!==null){let{_attr:l,_cdata:c}=i;if(l&&o(l),c&&a.push(`<![CDATA[${c.replace(/\]\]>/g,"]]]]><![CDATA[>")}]]>`),Array.isArray(i)){let d=!1;a.push("");for(let p of i)typeof p=="object"?Object.keys(p)[0]==="_attr"?o(p._attr):a.push(Oh(p,t,n+1)):(a.pop(),d=!0,a.push(Fo(p)));d||a.push("")}}}else a.push(Fo(i));return{name:r,attributes:s,content:a,indents:n>1?t.repeat(n-1):""}},Lh=(e,t,n)=>{if(typeof e!="object")return String(e);let{name:r,attributes:i,content:s,indents:a}=e,{length:o}=s,l=a+(r?`<${r}`:"")+(i.length>0?` ${i.join(" ")}`:"")+(o>0?r?">":"":"/>")+(t&&o>1?`
4275
- `:"");return o===0?l+(t?`
4276
- `:""):l+s.map(c=>c===void 0?"":Lh(c,t,!1)).join("")+(o>1?a:"")+(r?`</${r}>`:"")+(t&&!n?`
4277
- `:"")},U=(e,{indent:t="",declaration:n}={})=>{let r=Array.isArray(e)?e:[e],i=t?1:0,s=n?.standalone?` standalone="${ys(n.standalone)}"`:"";return(n===void 0?"":`<?xml version="1.0" encoding="${ys(n.encoding||"UTF-8")}"${s}?>${t?`
4278
- `:""}`)+r.map((a,o)=>Lh(Oh(a,t,i),t,o===r.length-1)).join("")},Rh=e=>Object.entries(e??{}).flatMap(([t,n])=>n==null?[]:[` ${t}="${ys(String(n))}"`]).join(""),Mh=e=>{switch(e.type){case"element":{var t,n;let r=(t=e.elements)!==null&&t!==void 0?t:[],i=`<${e.name}${Rh(e.attributes)}`;return r.length>0||((n=e.attributes)===null||n===void 0?void 0:n["xml:space"])==="preserve"?`${i}>${r.map(Mh).join("")}</${e.name}>`:`${i}/>`}case"text":return ky(String(e.text));case"cdata":return`<![CDATA[${String(e.cdata).replace(/\]\]>/g,"]]]]><![CDATA[>")}]]>`;case"comment":return`<!--${e.comment}-->`;case"doctype":return`<!DOCTYPE ${e.doctype}>`;case"instruction":return`<?${e.name}${e.instruction?` ${e.instruction}`:""}?>`;default:return""}},Ty=e=>{var t;return(e.declaration?`<?xml${Rh(e.declaration.attributes)}?>`:"")+((t=e.elements)!==null&&t!==void 0?t:[]).map(Mh).join("")},Bl=e=>{switch(e.type){case void 0:case"element":let t=new Ey(e.name,e.attributes),n=e.elements||[];for(let r of n){let i=Bl(r);i!==void 0&&t.push(i)}return t;case"text":return e.text;default:return}},Sy=class extends H{},Ey=class extends I{static fromXmlString(e){return Bl(Pr(e))}constructor(e,t){super(e),t&&this.root.push(new Sy(t))}push(e){this.root.push(e)}get writtenAs(){return this.rootKey===void 0?this.root.filter(e=>typeof e!="string"):void 0}prepForXml(e){let t=this.writtenAs;return t?.length===1?t[0].prepForXml(e):super.prepForXml(e)}},Cy=class extends I{constructor(e){super(""),S(this,"_attr",void 0),this._attr=e}prepForXml(e){return{_attr:this._attr}}},Dh=class extends I{constructor(e,t){super(e),t&&(this.root=t.root)}},oe=e=>{if(!Number.isFinite(e))throw new Error(`Invalid value '${e}' specified. Must be an integer.`);return Math.floor(e)},Ns=e=>{let t=oe(e);if(t<0)throw new Error(`Invalid value '${e}' specified. Must be a positive integer.`);return t},Bh=(e,t)=>{let n=t*2;if(e.length!==n||isNaN(+`0x${e}`))throw new Error(`Invalid hex value '${e}'. Expected ${n} digit hex value`);return e},Au=e=>Bh(e,1),$l=e=>{let t=e.slice(-2),n=e.substring(0,e.length-2);return`${Number(n)}${t}`},_y={in:1440,cm:1440/2.54,mm:1440/25.4,pt:20,pc:240,pi:240},Ot=e=>{if(typeof e=="number")return e;let t=e.slice(-2),n=Number(e.substring(0,e.length-2)),r=_y[t];if(r===void 0||Number.isNaN(n))throw new Error(`Invalid universal measure '${e}'. Expected a number followed by mm, cm, in, pt, pc or pi.`);return n*r},$h=e=>{let t=$l(e);if(parseFloat(t)<0)throw new Error(`Invalid value '${t}' specified. Expected a positive number.`);return t},Fh=e=>e==="auto"?e:Bh(e.charAt(0)==="#"?e.substring(1):e,3),Ze=e=>typeof e=="string"?$l(e):oe(e),Ay=e=>typeof e=="string"?$h(e):Ns(e),be=e=>typeof e=="string"?$h(e):Ns(e),Ny=e=>{let t=e.substring(0,e.length-1);return`${Number(t)}%`},Hh=e=>typeof e=="number"?oe(e):e.slice(-1)==="%"?Ny(e):$l(e),Iy=Ns,Py=Ns,Oy=e=>e.toISOString(),P=class extends I{constructor(e,t=!0){super(e),t!==!0&&this.root.push(new Ce({val:t}))}},Ho=class extends I{constructor(e,t){super(e),this.root.push(new Ce({val:Ay(t)}))}},Uh=class extends I{},et=class extends I{constructor(e,t){super(e),this.root.push(new Ce({val:t}))}},cr=(e,t)=>new O({name:e,attributes:{value:{key:"w:val",value:t}}}),br=class extends I{constructor(e,t){super(e),this.root.push(new Ce({val:t}))}},Xt=class extends I{constructor(e,t){super(e),this.root.push(t)}},O=class extends I{constructor({name:e,attributes:t,children:n}){super(e),t&&this.root.push(new Nh(t)),n&&this.root.push(...n)}},de={START:"start",CENTER:"center",END:"end",BOTH:"both",MEDIUM_KASHIDA:"mediumKashida",DISTRIBUTE:"distribute",NUM_TAB:"numTab",HIGH_KASHIDA:"highKashida",LOW_KASHIDA:"lowKashida",THAI_DISTRIBUTE:"thaiDistribute",LEFT:"left",RIGHT:"right",JUSTIFIED:"both"},qh=e=>new O({name:"w:jc",attributes:{val:{key:"w:val",value:e}}}),Fl={dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hyperlink:"hlink",followedHyperlink:"folHlink"},Wh={dark2:"44546A",light2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hyperlink:"0563C1",followedHyperlink:"954F72"},jh={dark1:{value:"windowText",lastColor:"000000"},light1:{value:"window",lastColor:"FFFFFF"}},Kh=(e,t)=>{if(t==="auto")throw new Error(`Invalid theme color ${e} 'auto'. Expected 6 digit hex value`);return Fh(t)},Hl=(e={})=>Object.fromEntries(Object.keys(Fl).map(t=>{let n=e[t],r=t==="dark1"||t==="light1"?jh[t].lastColor:Wh[t];return[t,n===void 0?r:Kh(t,n)]})),Ly=(e,t)=>new O({name:"a:srgbClr",attributes:{value:{key:"val",value:Kh(e,t)}}}),Ry=(e,t)=>{let n=t[e],r=e==="dark1"||e==="light1"?jh[e]:void 0;return new O({name:`a:${Fl[e]}`,children:[n===void 0&&r?new O({name:"a:sysClr",attributes:{value:{key:"val",value:r.value},lastColor:{key:"lastClr",value:r.lastColor}}}):Ly(e,n??Wh[e])]})},My=(e,t={})=>new O({name:"a:clrScheme",attributes:{name:{key:"name",value:e}},children:Object.keys(Fl).map(n=>Ry(n,t))}),Nu=new Set(["dark1","light1","dark2","light2","accent1","accent2","accent3","accent4","accent5","accent6","hyperlink","followedHyperlink"]),Dy=new Map([["dk1","dark1"],["lt1","light1"],["dk2","dark2"],["lt2","light2"],["hlink","hyperlink"],["folHlink","followedHyperlink"],["text1","dark1"],["background1","light1"],["text2","dark2"],["background2","light2"]]),Iu=(e,t)=>{if(!(e>=0&&e<=100))throw new Error(`Invalid ${t} ${e}. Expected a number from 0 to 100`);return Math.round(255*(1-e/100))},By=({theme:e,lighter:t,darker:n})=>{if(!Nu.has(e)){let s=Dy.get(e);throw new Error(`Invalid theme color "${e}". ${s?`Did you mean "${s}"?`:`Expected one of ${[...Nu].join(", ")}`}`)}if(t!==void 0&&n!==void 0)throw new Error("Invalid theme color. Expected lighter or darker, not both");let r=t===void 0?void 0:Iu(t,"lighter"),i=n===void 0?void 0:Iu(n,"darker");return{tint:r===255?void 0:r,shade:i===255?void 0:i}},$y=e=>{let[t,n,r]=[0,2,4].map(l=>parseInt(e.slice(l,l+2),16)/255),i=Math.max(t,n,r),s=Math.min(t,n,r),a=(i+s)/2,o=i-s;return o===0?{hue:0,saturation:0,lightness:a}:{hue:(i===t?((n-r)/o+6)%6:i===n?(r-t)/o+2:(t-n)/o+4)*60,saturation:o/(1-Math.abs(2*a-1)),lightness:a}},Fy=({hue:e,saturation:t,lightness:n})=>{let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),[s,a,o]=e<60?[r,i,0]:e<120?[i,r,0]:e<180?[0,r,i]:e<240?[0,i,r]:e<300?[i,0,r]:[r,0,i],l=n-r/2;return[s,a,o].map(c=>Math.floor((c+l)*255+1e-9).toString(16).padStart(2,"0")).join("").toUpperCase()},Hy=(e,{tint:t,shade:n})=>{if(t===void 0&&n===void 0)return e;let r=$y(e),i=t===void 0?r.lightness*n/255:r.lightness*t/255+(1-t/255);return Fy(k(k({},r),{},{lightness:i}))},Pu=e=>e===void 0?void 0:e.toString(16).padStart(2,"0").toUpperCase(),Uy=e=>typeof e=="string"?{type:"hex",value:Fh(e)}:{type:"theme",color:e,change:By(e)},qy=(e,t)=>e.type==="hex"?{color:e.value}:{color:Hy(t[e.color.theme],e.change),theme:e.color.theme,tint:Pu(e.change.tint),shade:Pu(e.change.shade)},Wy=Hl(),Ul=class extends Ir{constructor(e){super("_attr"),S(this,"attributes",void 0),this.attributes=e.map(t=>"keys"in t?{keys:t.keys,color:t.color===void 0?void 0:Uy(t.color)}:t)}prepForXml(e){var t,n;let r=(t=(n=e.file)===null||n===void 0||(n=n.Theme)===null||n===void 0?void 0:n.Colors)!==null&&t!==void 0?t:Wy,i=this.attributes.flatMap(s=>{if(!("keys"in s))return[[s.key,s.value]];if(s.color===void 0)return[];let{keys:a}=s,o=qy(s.color,r);return[[a.color,o.color],[a.theme,o.theme],[a.tint,o.tint],[a.shade,o.shade]]});return{_attr:Object.fromEntries(i.filter(([,s])=>s!==void 0))}}},jy=class extends I{constructor(e,t){super(e),this.root.push(new Ul(t))}},ql=(e,t)=>new jy(e,t),Or={color:"w:color",theme:"w:themeColor",tint:"w:themeTint",shade:"w:themeShade"},pe=(e,{color:t,size:n,space:r,style:i})=>ql(e,[{key:"w:val",value:i},{keys:Or,color:t},{key:"w:sz",value:n===void 0?void 0:Iy(n)},{key:"w:space",value:r===void 0?void 0:Py(r)}]),Lr={SINGLE:"single",DASH_DOT_STROKED:"dashDotStroked",DASHED:"dashed",DASH_SMALL_GAP:"dashSmallGap",DOT_DASH:"dotDash",DOT_DOT_DASH:"dotDotDash",DOTTED:"dotted",DOUBLE:"double",DOUBLE_WAVE:"doubleWave",INSET:"inset",NIL:"nil",NONE:"none",OUTSET:"outset",THICK:"thick",THICK_THIN_LARGE_GAP:"thickThinLargeGap",THICK_THIN_MEDIUM_GAP:"thickThinMediumGap",THICK_THIN_SMALL_GAP:"thickThinSmallGap",THIN_THICK_LARGE_GAP:"thinThickLargeGap",THIN_THICK_MEDIUM_GAP:"thinThickMediumGap",THIN_THICK_SMALL_GAP:"thinThickSmallGap",THIN_THICK_THIN_LARGE_GAP:"thinThickThinLargeGap",THIN_THICK_THIN_MEDIUM_GAP:"thinThickThinMediumGap",THIN_THICK_THIN_SMALL_GAP:"thinThickThinSmallGap",THREE_D_EMBOSS:"threeDEmboss",THREE_D_ENGRAVE:"threeDEngrave",TRIPLE:"triple",WAVE:"wave"},Ky=class extends mt{constructor(e){super("w:pBdr"),e.top&&this.root.push(pe("w:top",e.top)),e.left&&this.root.push(pe("w:left",e.left)),e.bottom&&this.root.push(pe("w:bottom",e.bottom)),e.right&&this.root.push(pe("w:right",e.right)),e.between&&this.root.push(pe("w:between",e.between))}},Gy=class extends I{constructor(){super("w:pBdr");let e=pe("w:bottom",{color:"auto",space:1,style:Lr.SINGLE,size:6});this.root.push(e)}},zy=({start:e,end:t,left:n,right:r,hanging:i,firstLine:s,firstLineChars:a})=>new O({name:"w:ind",attributes:{start:{key:"w:start",value:e===void 0?void 0:Ze(e)},end:{key:"w:end",value:t===void 0?void 0:Ze(t)},left:{key:"w:left",value:n===void 0?void 0:Ze(n)},right:{key:"w:right",value:r===void 0?void 0:Ze(r)},hanging:{key:"w:hanging",value:i===void 0?void 0:be(i)},firstLine:{key:"w:firstLine",value:s===void 0?void 0:be(s)},firstLineChars:{key:"w:firstLineChars",value:a===void 0?void 0:oe(a)}}}),Vy=()=>new O({name:"w:br"}),Is={BEGIN:"begin",END:"end",SEPARATE:"separate"},Wl=(e,t,n)=>new O({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:e},dirty:{key:"w:dirty",value:t},locked:{key:"w:fldLock",value:n}}}),mr=(e,t)=>Wl(Is.BEGIN,e,t),Gh=new WeakSet,Xy=class extends O{constructor(){super({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:Is.BEGIN},dirty:{key:"w:dirty",value:!0}}})}prepForXml(e){let t=super.prepForXml(e);return Gh.add(t),t}},zh=()=>new Xy,Yy=e=>typeof e=="object"&&e!==null&&Gh.has(e),Jt=e=>Wl(Is.SEPARATE,e),Qt=e=>Wl(Is.END,e),Lt={DEFAULT:"default",PRESERVE:"preserve"},Rt=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{space:"xml:space"})}},Jy=class extends I{constructor(){super("w:instrText"),this.root.push(new Rt({space:Lt.PRESERVE})),this.root.push("PAGE")}},Qy=class extends I{constructor(){super("w:instrText"),this.root.push(new Rt({space:Lt.PRESERVE})),this.root.push("NUMPAGES")}},Zy=class extends I{constructor(){super("w:instrText"),this.root.push(new Rt({space:Lt.PRESERVE})),this.root.push("SECTIONPAGES")}},ex=class extends I{constructor(){super("w:instrText"),this.root.push(new Rt({space:Lt.PRESERVE})),this.root.push("SECTION")}},Ps=({fill:e,color:t,type:n})=>ql("w:shd",[{keys:{color:"w:fill",theme:"w:themeFill",tint:"w:themeFillTint",shade:"w:themeFillShade"},color:e},{keys:Or,color:t},{key:"w:val",value:n??tx.CLEAR}]),tx={CLEAR:"clear",DIAGONAL_CROSS:"diagCross",DIAGONAL_STRIPE:"diagStripe",HORIZONTAL_CROSS:"horzCross",HORIZONTAL_STRIPE:"horzStripe",NIL:"nil",PERCENT_5:"pct5",PERCENT_10:"pct10",PERCENT_12:"pct12",PERCENT_15:"pct15",PERCENT_20:"pct20",PERCENT_25:"pct25",PERCENT_30:"pct30",PERCENT_35:"pct35",PERCENT_37:"pct37",PERCENT_40:"pct40",PERCENT_45:"pct45",PERCENT_50:"pct50",PERCENT_55:"pct55",PERCENT_60:"pct60",PERCENT_62:"pct62",PERCENT_65:"pct65",PERCENT_70:"pct70",PERCENT_75:"pct75",PERCENT_80:"pct80",PERCENT_85:"pct85",PERCENT_87:"pct87",PERCENT_90:"pct90",PERCENT_95:"pct95",REVERSE_DIAGONAL_STRIPE:"reverseDiagStripe",SOLID:"solid",THIN_DIAGONAL_CROSS:"thinDiagCross",THIN_DIAGONAL_STRIPE:"thinDiagStripe",THIN_HORIZONTAL_CROSS:"thinHorzCross",THIN_REVERSE_DIAGONAL_STRIPE:"thinReverseDiagStripe",THIN_VERTICAL_STRIPE:"thinVertStripe",VERTICAL_STRIPE:"vertStripe"},$e=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date"})}},nx=class extends I{constructor(e){super("w:del"),this.root.push(new $e({id:e.id,author:e.author,date:e.date}))}},rx=class extends I{constructor(e){super("w:ins"),this.root.push(new $e({id:e.id,author:e.author,date:e.date}))}},ix=({twoLinesInOne:e,brackets:t,horizontalInVertical:n,fitToLine:r,group:i})=>new O({name:"w:eastAsianLayout",attributes:{id:{key:"w:id",value:i===void 0?void 0:oe(i)},combine:{key:"w:combine",value:e},combineBrackets:{key:"w:combineBrackets",value:t},vert:{key:"w:vert",value:n},vertCompress:{key:"w:vertCompress",value:r}}}),sx={DOT:"dot"},ax=(e=sx.DOT)=>new O({name:"w:em",attributes:{val:{key:"w:val",value:e}}}),ox="57X6y3wQZNzYjJB2L_10pxbackgroundhimselfUTF-8DEMOGRAPHICSVqvt4KW9",lx=(e,t=21)=>(n=t)=>{let r="",i=n|0;for(;i-- >0;)r+=e[Math.random()*e.length|0];return r},cx=(e=21)=>{let t="",n=e|0;for(;n-- >0;)t+=ox[Math.random()*64|0];return t},dx=e=>{let t=new Int32Array(Math.ceil((e.length+9)/64)*16);for(let n=0;n<e.length;n++)t[n>>2]|=e[n]<<24-(n&3)*8;return t[e.length>>2]|=128<<24-(e.length&3)*8,t[t.length-2]=Math.floor(e.length/536870912),t[t.length-1]=e.length*8,t},px=e=>{let t=new Uint8Array(e.length*4);for(let n=0;n<t.length;n++)t[n]=e[n>>2]>>>24-(n&3)*8;return t},Ye=(e,t)=>e>>>t|e<<32-t,LN=Int32Array.of(1518500249,1859775393,2400959708,3395469782),ux=Int32Array.of(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),hx=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],fx=new Int32Array(64),Ou=e=>{let t=dx(e),n=fx,[r,i,s,a,o,l,c,d]=hx;for(let p=0;p<t.length;p+=16){n.set(t.subarray(p,p+16));for(let C=16;C<64;C++){let A=n[C-15],y=n[C-2];n[C]=n[C-16]+(Ye(A,7)^Ye(A,18)^A>>>3)+n[C-7]+(Ye(y,17)^Ye(y,19)^y>>>10)}let[u,f,m,h,g,v,w,b]=[r,i,s,a,o,l,c,d];for(let C=0;C<64;C++){let A=b+(Ye(g,6)^Ye(g,11)^Ye(g,25))+(g&v^~g&w)+ux[C]+n[C]|0,y=(Ye(u,2)^Ye(u,13)^Ye(u,22))+(u&f^u&m^f&m)|0;b=w,w=v,v=g,g=h+A|0,h=m,m=f,f=u,u=A+y|0}[r,i,s,a,o,l,c,d]=[r+u|0,i+f|0,s+m|0,a+h|0,o+g|0,l+v|0,c+w|0,d+b|0]}return px([r,i,s,a,o,l,c,d])},We=e=>Math.floor(e*72*20),En=(e=0)=>{let t=e;return()=>++t},mx=()=>En(),gx=()=>En(1),bx=()=>En(),RN=bx(),vx=()=>En(),Vh=vx(),wx=En(),yx=()=>-wx(),Cn=()=>cx().toLowerCase(),dr=e=>lx("1234567890abcdef",e)(),Xh=()=>`${dr(8)}-${dr(4)}-${dr(4)}-${dr(4)}-${dr(12)}`,xx=e=>new Uint8Array(new TextEncoder().encode(e)),kx=({width:e,group:t})=>new O({name:"w:fitText",attributes:{val:{key:"w:val",value:Math.round(Ot(be(e)))},id:{key:"w:id",value:t===void 0?yx():oe(t)}}}),Tx=class extends I{constructor(e){super("w:spacing"),this.root.push(new Ce({val:Ze(e)}))}},Sx=class extends I{constructor(e){super("w:color"),this.root.push(new Ul([{keys:k(k({},Or),{},{color:"w:val"}),color:e}]))}},Ex=class extends I{constructor(e){super("w:highlight"),this.root.push(new Ce({val:e}))}},Cx=e=>new O({name:"w:lang",attributes:{value:{key:"w:val",value:e.value},eastAsia:{key:"w:eastAsia",value:e.eastAsia},bidirectional:{key:"w:bidi",value:e.bidirectional}}}),Uo=(e,t)=>{if(typeof e=="string"){let r=e;return new O({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:r},cs:{key:"w:cs",value:r},eastAsia:{key:"w:eastAsia",value:r},hAnsi:{key:"w:hAnsi",value:r},hint:{key:"w:hint",value:t}}})}if("theme"in e){let r=e.theme==="headings"?"major":"minor";return new O({name:"w:rFonts",attributes:{ascii:{key:"w:asciiTheme",value:`${r}HAnsi`},eastAsia:{key:"w:eastAsiaTheme",value:`${r}EastAsia`},hAnsi:{key:"w:hAnsiTheme",value:`${r}HAnsi`},cs:{key:"w:cstheme",value:`${r}Bidi`}}})}let n=e;return new O({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:n.ascii},cs:{key:"w:cs",value:n.cs},eastAsia:{key:"w:eastAsia",value:n.eastAsia},hAnsi:{key:"w:hAnsi",value:n.hAnsi},hint:{key:"w:hint",value:n.hint}}})},Yh=e=>new O({name:"w:vertAlign",attributes:{val:{key:"w:val",value:e}}}),_x=()=>Yh("superscript"),Ax=()=>Yh("subscript"),Jh={SINGLE:"single",WORDS:"words",DOUBLE:"double",THICK:"thick",DOTTED:"dotted",DOTTEDHEAVY:"dottedHeavy",DASH:"dash",DASHEDHEAVY:"dashedHeavy",DASHLONG:"dashLong",DASHLONGHEAVY:"dashLongHeavy",DOTDASH:"dotDash",DASHDOTHEAVY:"dashDotHeavy",DOTDOTDASH:"dotDotDash",DASHDOTDOTHEAVY:"dashDotDotHeavy",WAVE:"wave",WAVYHEAVY:"wavyHeavy",WAVYDOUBLE:"wavyDouble",NONE:"none"},Nx=(e=Jh.SINGLE,t)=>ql("w:u",[{key:"w:val",value:e},{keys:Or,color:t}]),Zt=class extends mt{constructor(e){if(super("w:rPr"),!e)return;if(e.style&&this.push(new et("w:rStyle",e.style)),e.font&&(typeof e.font=="string"?this.push(Uo(e.font)):"name"in e.font?this.push(Uo(e.font.name,e.font.hint)):this.push(Uo(e.font))),e.bold!==void 0&&this.push(new P("w:b",e.bold)),e.boldComplexScript===void 0&&e.bold!==void 0||e.boldComplexScript){var t;this.push(new P("w:bCs",(t=e.boldComplexScript)!==null&&t!==void 0?t:e.bold))}if(e.italics!==void 0&&this.push(new P("w:i",e.italics)),e.italicsComplexScript===void 0&&e.italics!==void 0||e.italicsComplexScript){var n;this.push(new P("w:iCs",(n=e.italicsComplexScript)!==null&&n!==void 0?n:e.italics))}e.smallCaps!==void 0?this.push(new P("w:smallCaps",e.smallCaps)):e.allCaps!==void 0&&this.push(new P("w:caps",e.allCaps)),e.strike!==void 0&&this.push(new P("w:strike",e.strike)),e.doubleStrike!==void 0&&this.push(new P("w:dstrike",e.doubleStrike)),e.emboss!==void 0&&this.push(new P("w:emboss",e.emboss)),e.imprint!==void 0&&this.push(new P("w:imprint",e.imprint)),e.noProof!==void 0&&this.push(new P("w:noProof",e.noProof)),e.snapToGrid!==void 0&&this.push(new P("w:snapToGrid",e.snapToGrid)),e.vanish!==void 0&&this.push(new P("w:vanish",e.vanish)),e.color&&this.push(new Sx(e.color)),e.characterSpacing&&this.push(new Tx(e.characterSpacing)),e.scale!==void 0&&this.push(new br("w:w",e.scale)),e.kern&&this.push(new Ho("w:kern",e.kern)),e.position&&this.push(new et("w:position",e.position)),e.size!==void 0&&this.push(new Ho("w:sz",e.size));let r=e.sizeComplexScript===void 0||e.sizeComplexScript===!0?e.size:e.sizeComplexScript;r&&this.push(new Ho("w:szCs",r)),e.highlight&&this.push(new Ex(e.highlight)),e.underline&&this.push(Nx(e.underline.type,e.underline.color)),e.effect&&this.push(new et("w:effect",e.effect)),e.border&&this.push(pe("w:bdr",e.border)),e.shading&&this.push(Ps(e.shading)),e.fitText&&this.push(kx(e.fitText)),e.subScript&&this.push(Ax()),e.superScript&&this.push(_x()),e.rightToLeft!==void 0&&this.push(new P("w:rtl",e.rightToLeft)),e.emphasisMark&&this.push(ax(e.emphasisMark.type)),e.language&&this.push(Cx(e.language)),e.eastAsianLayout&&this.push(ix(e.eastAsianLayout)),e.specVanish!==void 0&&this.push(new P("w:specVanish",e.specVanish)),e.math!==void 0&&this.push(new P("w:oMath",e.math)),e.revision&&this.push(new Px(e.revision))}push(e){this.root.push(e)}},Ix=class extends Zt{constructor(e){super(e),e?.insertion&&this.push(new rx(e.insertion)),e?.deletion&&this.push(new nx(e.deletion))}},Px=class extends I{constructor(e){super("w:rPrChange"),this.root.push(new $e({id:e.id,author:e.author,date:e.date})),this.addChildElement(new Zt(e))}},Tr=class extends I{constructor(e){if(super("w:t"),typeof e=="string")this.root.push(new Rt({space:Lt.PRESERVE})),this.root.push(e);else{var t;this.root.push(new Rt({space:(t=e.space)!==null&&t!==void 0?t:Lt.DEFAULT})),this.root.push(e.text)}}},as={CURRENT:"CURRENT",TOTAL_PAGES:"TOTAL_PAGES",TOTAL_PAGES_IN_SECTION:"TOTAL_PAGES_IN_SECTION",CURRENT_SECTION:"SECTION"},Ox=e=>{switch(e){case as.CURRENT:return[mr(),new Jy,Jt(),Qt()];case as.TOTAL_PAGES:return[mr(),new Qy,Jt(),Qt()];case as.TOTAL_PAGES_IN_SECTION:return[mr(),new Zy,Jt(),Qt()];case as.CURRENT_SECTION:return[mr(),new ex,Jt(),Qt()];default:return}},Be=class hl extends I{constructor(t){if(super("w:r"),S(this,"properties",void 0),S(this,"following",[]),this.properties=new Zt(t),this.root.push(this.properties),t.break)for(let n=0;n<t.break;n++)this.root.push(Vy());if(t.children)for(let[n,r]of t.children.entries()){if(As(r)==="w:r"){let i=t.children.slice(n+1);this.following=[r,...i.length>0?[new hl(k(k({},t),{},{break:void 0,children:i}))]:[]];break}if(typeof r=="string"){let i=Ox(r);if(i){let s=t.children.slice(n+1),a=c=>new hl(k(k({},t),{},{break:void 0,children:c})),o=this.root.length===1;o&&this.root.push(i[0]);let l=o?i.slice(1):i;this.following=[...l.map(c=>a([c])),...s.length>0?[a(s)]:[]];break}this.root.push(new Tr(r));continue}this.root.push(r)}else t.text!==void 0&&this.root.push(new Tr(t.text))}get writtenAs(){return this.following.length>0?[this,...this.following.flatMap(t=>{var n;return(n=t.writtenAs)!==null&&n!==void 0?n:t})]:void 0}},Ie=class extends Be{constructor(e){super(typeof e=="string"?{text:e}:e)}},jl={EXTERNAL:"External"},Lx=(e,t,n,r)=>new O({name:"Relationship",attributes:{id:{key:"Id",value:e},type:{key:"Type",value:t},target:{key:"Target",value:n},targetMode:{key:"TargetMode",value:r}}}),Qh=(e,t)=>new O({name:"a:hlinkClick",attributes:k(k({},t?{xmlns:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"}}:{}),{},{id:{key:"r:id",value:`rId${e}`}})}),Rx=class{constructor(e){S(this,"link",void 0),S(this,"linkId",Cn()),S(this,"addedTo",new WeakSet),this.link=e}createClick(e){return Qh(this.linkId,e)}addRelationship(e){let t=e.viewWrapper.Relationships;this.addedTo.has(t)||(this.addedTo.add(t),t.addRelationship(this.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",this.link,jl.EXTERNAL))}},Mx=32767,Dx=780,Bx=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],$x=e=>e<=Mx?Bx.reduce(({rest:t,text:n},[r,i])=>({rest:t%r,text:n+i.repeat(Math.floor(t/r))}),{rest:e,text:""}).text:void 0,Fx=e=>e===0?"":e<=Dx?String.fromCharCode(65+(e-1)%26).repeat(Math.ceil(e/26)):void 0,Hx=e=>{var t;return`${e}${e%100>=11&&e%100<=13?"th":(t=["th","st","nd","rd"][e%10])!==null&&t!==void 0?t:"th"}`},Kl=e=>{let t=e.charAt(0)!==e.charAt(0).toUpperCase(),n=r=>i=>{var s;return t?(s=r(i))===null||s===void 0?void 0:s.toLowerCase():r(i)};switch(e.toLowerCase()){case"arabic":return String;case"roman":return n($x);case"alphabetic":return n(Fx);case"ordinal":return r=>r>0?Hx(r):void 0;case"arabicdash":return r=>`- ${r} -`;default:return}},Zh=new Set(["mergeformat","charformat","mergeformatinet"]),ef=new Set(["upper","lower","firstcap","caps"]),Ux=e=>/^[#0,]*[#0][#0,]*$/.test(e),qx=(e,t)=>{let n=[...t].filter(s=>s==="0").length,r=n+[...t].filter(s=>s==="#").length,i=String(e).padStart(n,"0");if(!(i.length<r||n===0&&e===0))return t.includes(",")?i.replace(/\B(?=(\d{3})+$)/g,","):i},Wx=(e,t)=>{switch(t){case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();case"firstcap":return e.charAt(0).toUpperCase()+e.slice(1);default:return e}},jx=e=>{var t;let n=new RegExp("^\\s*(PAGEREF|NUMPAGES|SECTIONPAGES)\\b(.*)$","is").exec(e),r=n?.[1].toUpperCase()==="PAGEREF"?new RegExp('^\\s*("?)([^\\s"\\\\]+)\\1(.*)$',"s").exec(n[2]):void 0;if(!n||n[1].toUpperCase()==="PAGEREF"&&!r)return;let i=(t=(r?r[3]:n[2]).match(/"[^"]*"|\S+/g))!==null&&t!==void 0?t:[],s,a,o=[],l=!1,c=!0;for(let f=0;f<i.length;f++){let m=i[f],h=()=>{var g;return(m.length>2?m.slice(2):(g=i[++f])!==null&&g!==void 0?g:"").replace(/^"(.*)"$/,"$1")};if(/^\\p$/i.test(m))l=!0;else if(m.startsWith("\\#")){var d;let g=h();c&&(c=a===void 0&&Ux(g)),(d=a)!==null&&d!==void 0||(a=g)}else if(m.startsWith("\\*")){let g=h(),v=g.toLowerCase();if(ef.has(v))o.push(v);else if(g!==""&&!Zh.has(v)){var p;c&&(c=s===void 0&&Kl(g)!==void 0),(p=s)!==null&&p!==void 0||(s=g)}}}let u=k(k(k(k({},s===void 0?{}:{numberFormat:s}),a===void 0?{}:{picture:a}),o.length===0?{}:{capitals:o[0]}),{},{written:c&&o.length<=1&&o[0]!=="caps"&&(s===void 0||a===void 0)});return k(r?{type:"pageReference",bookmark:r[2],relative:l}:{type:"pageCount",scope:n[1].toUpperCase()==="NUMPAGES"?"document":"section"},u)},Kx=e=>new RegExp("^\\s*TOC\\b.*\\\\s\\b","is").test(e),tf=(e,{enclosing:t,within:n,inTextBox:r},{estimate:i,sectionPageCount:s,blank:a,relativeTo:o})=>{let l=jx(e);if(l===void 0)return;let{bookmarks:c,pageCount:d,bookmarkPageNumbers:p}=i,{numberFormat:u,picture:f,capitals:m,written:h}=l,g=u!==void 0||f!==void 0,v=C=>C===void 0?void 0:f===void 0?Kl(u??"arabic")(C):qx(C,f),w=l.type==="pageReference"&&l.relative&&n==="counted"&&!r?o?.(l.bookmark):void 0,b;return h?l.type==="pageCount"?b=v(l.scope==="document"?d:s):t.some(Kx)?b=void 0:g?b=v(p?.get(l.bookmark)):b=l.relative?w:c.get(l.bookmark):b=void 0,b===void 0?a?"":void 0:Wx(b,m)},Gx=(e,t)=>e==="mc:Fallback"||t==="fallback"?"fallback":e==="w:del"||e==="w:moveFrom"?"deleted":t,Sr=(e,t,n,r,i="counted",s=!1)=>{for(let c=0;c<t.length;c++){let d=t[c],p=e.nameOf(d);if(p===void 0)continue;let u=n[n.length-1];if(p==="w:fldChar"){let f=e.attributeOf(d,"w:fldCharType");f==="begin"?n.push({begin:d,instruction:"",inResult:!1}):f==="separate"&&u?(e.writeClean(u.begin,u.instruction),u.inResult=!0,u.result=r.resultOf(u.instruction,{within:i,enclosing:n.slice(0,-1).map(m=>m.instruction),inTextBox:s}),u.result!==void 0&&(t.splice(c+1,0,e.textElement(u.result)),c++)):f==="end"&&n.pop()}else if(p==="w:instrText"&&u&&!u.inResult)u.instruction+=e.textOf(d);else if((p==="w:t"||p==="w:tab"||p==="w:br"||p==="w:cr")&&u?.result!==void 0)t.splice(c,1),c--;else if(p==="w:fldSimple"){let f=r.resultOf(String(e.attributeOf(d,"w:instr")),{within:i,enclosing:n.map(m=>m.instruction),inTextBox:s});if(f===void 0){var a;Sr(e,(a=e.contentOf(d))!==null&&a!==void 0?a:[],[],r,i,s)}else e.setSimpleFieldResult(d,f)}else{var o;if(p==="w:p"){var l;(l=r.beforeParagraph)===null||l===void 0||l.call(r,d)}Sr(e,(o=e.contentOf(d))!==null&&o!==void 0?o:[],n,r,Gx(p,i),s||p==="w:txbxContent"),p==="w:p"&&r.afterParagraph(d)}}},nf=(e,t)=>t.flatMap(n=>{var r;let i=e.nameOf(n);return i===void 0?[]:i==="w:sectPr"?[n]:nf(e,(r=e.contentOf(n))!==null&&r!==void 0?r:[])}),zx=(e,t)=>{var n;return((n=e.contentOf(t))!==null&&n!==void 0?n:[]).some(r=>{var i;return e.nameOf(r)==="w:pPr"&&((i=e.contentOf(r))!==null&&i!==void 0?i:[]).some(s=>e.nameOf(s)==="w:sectPr")})},Vx=(e,t,n)=>{let r=nf(e,[t]).reduce((i,s)=>{var a,o;let l=((a=e.contentOf(s))!==null&&a!==void 0?a:[]).flatMap(c=>{let d=e.nameOf(c);return d==="w:headerReference"||d==="w:footerReference"?[[`${d} ${String(e.attributeOf(c,"w:type"))}`,String(e.attributeOf(c,"r:id"))]]:[]});return[...i,new Map([...(o=i[i.length-1])!==null&&o!==void 0?o:[],...l])]},[]).reduce((i,s,a)=>{for(let l of s.values()){var o;i.set(l,[...(o=i.get(l))!==null&&o!==void 0?o:[],n[a]])}return i},new Map);return new Map([...r].flatMap(([i,[s,...a]])=>s!==void 0&&a.every(o=>o===s)?[[i,s]]:[]))},rf=(e,t,n,{blank:r})=>{let{sectionPageCounts:i=[],relativePositions:s}=n,a=0,o=new Map,l=c=>{var d,p;let u=(d=o.get(c))!==null&&d!==void 0?d:0;return o.set(c,u+1),s==null||(p=s.get(c))===null||p===void 0?void 0:p[u]};return Sr(e,[t],[],{resultOf:(c,d)=>tf(c,d,{estimate:n,sectionPageCount:i[a],blank:r,relativeTo:l}),afterParagraph:c=>{a+=zx(e,c)?1:0}}),Vx(e,t,i)},sf=(e,t,n,{blank:r,sectionPageCount:i,notes:s=!1})=>{let a=o=>{let l=n.bookmarks.get(o);return l===void 0?void 0:`on page ${l}`};Sr(e,[t],[],{resultOf:(o,l)=>tf(o,l,k({estimate:n,sectionPageCount:i,blank:r},s?{relativeTo:a}:{})),afterParagraph:()=>{}})},Xx=(e,t,{beforeParagraph:n,resultOf:r})=>Sr(e,[t],[],{resultOf:(i,{within:s})=>r(i,s),beforeParagraph:n,afterParagraph:()=>{}}),af=class extends I{constructor(e={}){super("w:instrText"),S(this,"properties",void 0),this.properties=e,this.root.push(new Rt({space:Lt.PRESERVE}));let t="TOC";if(this.properties.captionLabel&&(t=`${t} \\a "${this.properties.captionLabel}"`),this.properties.entriesFromBookmark&&(t=`${t} \\b "${this.properties.entriesFromBookmark}"`),this.properties.captionLabelIncludingNumbers&&(t=`${t} \\c "${this.properties.captionLabelIncludingNumbers}"`),this.properties.sequenceAndPageNumbersSeparator&&(t=`${t} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`),this.properties.tcFieldIdentifier&&(t=`${t} \\f "${this.properties.tcFieldIdentifier}"`),this.properties.hyperlink&&(t=`${t} \\h`),this.properties.tcFieldLevelRange&&(t=`${t} \\l "${this.properties.tcFieldLevelRange}"`),this.properties.pageNumbersEntryLevelsRange&&(t=`${t} \\n "${this.properties.pageNumbersEntryLevelsRange}"`),this.properties.headingStyleRange&&(t=`${t} \\o "${this.properties.headingStyleRange}"`),this.properties.entryAndPageNumberSeparator&&(t=`${t} \\p "${this.properties.entryAndPageNumberSeparator}"`),this.properties.seqFieldIdentifierForPrefix&&(t=`${t} \\s "${this.properties.seqFieldIdentifierForPrefix}"`),this.properties.stylesWithLevels&&this.properties.stylesWithLevels.length){let n=this.properties.stylesWithLevels.map(r=>`${r.styleName},${r.level}`).join(",");t=`${t} \\t "${n}"`}this.properties.useAppliedParagraphOutlineLevel&&(t=`${t} \\u`),this.properties.preserveTabInEntries&&(t=`${t} \\w`),this.properties.preserveNewLineInEntries&&(t=`${t} \\x`),this.properties.hideTabAndPageNumbersInWebView&&(t=`${t} \\z`),this.root.push(t)}},of=class extends I{constructor(){super("w:sdtContent")}},lf=e=>e===void 0?zh():mr(e),Gl=new WeakMap,Yx=(e,t)=>{Gl.set(e,t)},Jx=class{constructor(){S(this,"ids",[])}get(e){var t,n;return(n=(t=this.ids)[e])!==null&&n!==void 0||(t[e]=Vh()),this.ids[e]}},nt=e=>typeof e=="object"&&e!==null?Object.keys(e)[0]:void 0,rt=e=>{let t=nt(e),n=t===void 0?void 0:e[t];return Array.isArray(n)?n:n===void 0?[]:[n]},Ke=(e,t)=>rt(e).find(n=>nt(n)===t),Me=(e,t)=>{var n;return(n=Ke(e,"_attr"))===null||n===void 0||(n=n._attr)===null||n===void 0?void 0:n[t]},zl=(e,t)=>{let n=Me(e,t);return n===void 0?void 0:Number(n)},Qx=new Set(["w:tbl","w:tr","w:tc","w:sdt","w:sdtContent","w:customXml"]),cf=e=>e.flatMap(t=>{let n=nt(t);return n==="w:p"||Gl.has(t)?[t]:n!==void 0&&Qx.has(n)?cf(rt(t)):[]}),Zx=new Set(["w:r","w:hyperlink","w:ins","w:moveTo","w:smartTag","w:customXml","w:sdt","w:sdtContent","w:fldSimple","w:dir","w:bdo"]),e1=e=>{switch(nt(e)){case"w:t":return rt(e).filter(t=>typeof t=="string").join("");case"w:tab":return" ";case"w:br":return[void 0,"textWrapping"].includes(Me(e,"w:type"))?`
5329
+ `),r}function hs(e,t,n){if(!ai.test(t))throw new K(U(`M\xE3 ph\xE2n h\u1EC7 \xAB${t}\xBB ph\u1EA3i l\xE0 ch\u1EEF hoa / s\u1ED1, 2\u201312 k\xFD t\u1EF1, b\u1EAFt \u0111\u1EA7u b\u1EB1ng ch\u1EEF.`,`Module code \xAB${t}\xBB must be 2\u201312 capitals / digits starting with a letter.`));if(e.modules.some(i=>i.code===t))throw new K(U(`\u0110\xE3 c\xF3 ph\xE2n h\u1EC7 ${t}.`,`Module ${t} already exists.`));let r={code:t,title:n,order:Math.max(0,...e.modules.map(i=>i.order))+1,suites:[],commonSteps:"",file:""};return Jo(e.root,r),e.modules.push(r),r}function vr(e,t,n){let r=ms(e,t);return Object.assign(r,n),Jo(e.root,r),r}function ms(e,t){let n=e.modules.find(r=>r.code===t);if(!n)throw new K(U(`Kh\xF4ng c\xF3 ph\xE2n h\u1EC7 ${t}.`,`No module ${t}.`));return n}function en(e,t,{withDeleted:n=!1}={}){let r=e.modules.find(s=>s.code===t),i=new Map((r?.suites??[]).map((s,a)=>[s,a]));return e.suites.filter(s=>s.module===t&&(n||s.status!=="deleted")).sort((s,a)=>(i.get(s.code)??1e9)-(i.get(a.code)??1e9)||s.code.localeCompare(a.code))}function fs(e,t){let n=ms(e,t.module);if(!t.title.trim())throw new K(U("K\u1ECBch b\u1EA3n c\u1EA7n t\xEAn.","The test suite needs a name."));let r=t.by??vt(e.root),i={code:mn("KB",n.code,us(e,t.avoid)),module:n.code,title:t.title.trim(),kind:t.kind??"functional",status:"drafting",covers:t.covers??[],useCases:t.useCases??[],...t.priority?{priority:t.priority}:{},...t.preconditions?{preconditions:t.preconditions}:{},owner:r,created:{by:r,at:Wu()},description:"",cases:[],file:""};ze(e.root,i),e.suites.push(i);let s=en(e,n.code).map(o=>o.code).filter(o=>o!==i.code),a=t.after?s.indexOf(t.after):-1;return s.splice(a>=0?a+1:s.length,0,i.code),vr(e,n.code,{suites:s}),i}function Gu(e,t){let n=e.suites.find(r=>r.code===t);if(!n)throw new K(U(`Kh\xF4ng c\xF3 k\u1ECBch b\u1EA3n ${t}.`,`No test suite ${t}.`));return n}function zu(e,t,n){let r=Gu(e,t);for(let[i,s]of Object.entries(n))s!==void 0&&(s===""&&(i==="priority"||i==="preconditions"||i==="owner")?delete r[i]:r[i]=s);return ze(e.root,r),r}function gs(e,t,n,r={}){let i=Gu(e,t);if(!n.case.trim())throw new K(U("T\xECnh hu\u1ED1ng c\u1EA7n m\xF4 t\u1EA3.","The test case needs a description."));let s={code:mn("TC",i.module,us(e,r.avoid)),case:n.case.trim(),...n.requirement?{requirement:n.requirement.trim()}:{},steps:(n.steps??"").trim(),expected:(n.expected??"").trim(),...n.priority?{priority:n.priority}:{},...n.tag?{tag:n.tag.trim()}:{}},a=r.after?i.cases.findIndex(o=>o.code===r.after):-1;return i.cases.splice(a>=0?a+1:i.cases.length,0,s),ze(e.root,i),s}function bs(e,t){if(!li.test(t))throw new K(U(`M\xE3 t\xECnh hu\u1ED1ng \xAB${t}\xBB sai m\u1EABu (TC-<PH>-XXXXXX).`,`Test case code \xAB${t}\xBB has the wrong format (TC-<MODULE>-XXXXXX).`));for(let n of e.suites){let r=n.cases.find(i=>i.code===t);if(r)return{suite:n,tc:r}}throw new K(U(`Kh\xF4ng c\xF3 t\xECnh hu\u1ED1ng ${t}.`,`No test case ${t}.`))}function vs(e,t,n){let{suite:r,tc:i}=bs(e,t);for(let[s,a]of Object.entries(n)){if(a===void 0)continue;let o=typeof a=="string"?a.trim():a;o===""&&(s==="requirement"||s==="priority"||s==="tag")?delete i[s]:i[s]=o}return ze(e.root,r),i}function Vu(e,t,n){let{suite:r,tc:i}=bs(e,t),s=r.cases.indexOf(i),a=s+n;return a<0||a>=r.cases.length||([r.cases[s],r.cases[a]]=[r.cases[a],r.cases[s]],ze(e.root,r)),i}function ws(e,t,n="",r){let{suite:i,tc:s}=bs(e,t);return s.deleted={by:r??vt(e.root),at:Wu(),...n?{reason:n}:{}},ze(e.root,i),s}function ys(e,t,n){if(!et.includes(n.status))throw new K(U(`Tr\u1EA1ng th\xE1i \xAB${n.status}\xBB kh\xF4ng h\u1EE3p l\u1EC7 (${et.join(" | ")}).`,`Invalid status \xAB${n.status}\xBB (${et.join(" | ")}).`));let{suite:r,tc:i}=bs(e,t);if(n.status==="failed"&&!(n.actual??"").trim())throw new K(U("Kh\xF4ng \u0111\u1EA1t: c\u1EA7n ghi k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF.","Failed: enter the actual result."));if(n.status==="not-run")delete i.result;else{let s={status:n.status,by:n.by??vt(e.root),at:n.at??Jy()};n.actual?.trim()&&(s.actual=n.actual.trim()),n.env?.trim()&&(s.env=n.env.trim()),n.bug?.trim()&&(s.bug=n.bug.trim()),i.result=s}return ze(e.root,r),i}var K,Jy,Wu,wr=Se(()=>{"use strict";S();qn();fn();_n();si();K=class extends Error{},Jy=()=>new Date().toISOString().slice(0,10),Wu=()=>new Date().toISOString().replace(/\.\d{3}Z$/,"Z")});function xs(e,t){let n=[],r=Qy[e.config.language==="en"?"en":"vi"];for(let l of e.readErrors)n.push({rule:"E03",severity:"error",file:l.file,message:r.E03(l.message)});let i=new Map,s=(l,u)=>{let d=i.get(l);d?n.push({rule:"E01",severity:"error",code:l,file:u,message:r.E01(l,d)}):i.set(l,u)},a=new Set(e.modules.map(l=>l.code)),o=new Set;for(let l of e.suites){s(l.code,l.file),oi.exec(l.code)||n.push({rule:"E02",severity:"error",code:l.code,file:l.file,message:r.E02suite(l.code)}),a.has(l.module)||n.push({rule:"E04",severity:"error",code:l.code,file:l.file,message:r.E04(l.module)});for(let p of l.cases){s(p.code,l.file);let h=li.exec(p.code);h?h[1]!==l.module&&!p.deleted&&n.push({rule:"E02",severity:"error",code:p.code,file:l.file,message:r.E02mod(p.code,h[1],l.code)}):n.push({rule:"E02",severity:"error",code:p.code,file:l.file,message:r.E02case(p.code)})}if(l.status==="deleted")continue;for(let p of l.covers)o.add(p);let d=l.cases.filter(p=>!p.deleted);if(d.length===0&&n.push({rule:"T06",severity:"warn",code:l.code,file:l.file,message:r.T06(l.code)}),l.kind==="functional"&&l.covers.length===0&&n.push({rule:"T01",severity:"warn",code:l.code,file:l.file,message:r.T01(l.code)}),t)for(let p of l.covers){let h=t.get(p);h?h.deleted&&n.push({rule:"T05",severity:"warn",code:l.code,file:l.file,message:r.T05del(l.code,p)}):n.push({rule:"T05",severity:"warn",code:l.code,file:l.file,message:r.T05none(l.code,p)})}for(let p of d){let h=[!p.steps.trim()&&r.steps,!p.expected.trim()&&r.expected].filter(Boolean);h.length&&n.push({rule:"T03",severity:"warn",code:p.code,file:l.file,message:r.T03(p.code,h.join(r.and))}),p.result?.status==="failed"&&!p.result.actual?.trim()&&n.push({rule:"T04",severity:"warn",code:p.code,file:l.file,message:r.T04(p.code)})}}if(t)for(let l of t.values())l.deleted||l.type!=="function"||o.has(l.code)||n.push({rule:"T02",severity:"info",code:l.code,message:r.T02(l.code,l.title)});let c={error:0,warn:1,info:2};return n.sort((l,u)=>c[l.severity]-c[u.severity]||l.rule.localeCompare(u.rule))}function tn(){return{total:0,"not-run":0,passed:0,failed:0,blocked:0,skipped:0}}function yr(e,t=tn()){for(let n of e.cases)n.deleted||(t.total++,t[n.result?.status??"not-run"]++);return t}function Pn(e,t){let n=tn(),r=e.modules.map(s=>{let a=e.suites.filter(c=>c.module===s.code&&c.status!=="deleted"),o=tn();for(let c of a)yr(c,o);for(let c of Object.keys(n))n[c]+=o[c];return{code:s.code,title:s.title,suites:a.length,count:o}}),i=null;if(t){let s=new Set(e.suites.filter(o=>o.status!=="deleted").flatMap(o=>o.covers)),a=[...t.values()].filter(o=>o.type==="function"&&!o.deleted);i={functions:a.length,covered:a.filter(o=>s.has(o.code)).length}}return{all:n,modules:r,coverage:i}}var Qy,xr=Se(()=>{"use strict";S();fn();Qy={vi:{E03:e=>`Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c t\u1EC7p: ${e}`,E01:(e,t)=>`Tr\xF9ng m\xE3 ${e} (\u0111\xE3 c\xF3 \u1EDF ${t}) \u2014 \u0111\u1ED5i m\xE3 m\u1ED9t b\xEAn (th\u01B0\u1EDDng do hai nh\xE1nh git c\xF9ng sinh).`,E02suite:e=>`M\xE3 k\u1ECBch b\u1EA3n \xAB${e}\xBB sai m\u1EABu.`,E04:e=>`K\u1ECBch b\u1EA3n thu\u1ED9c ph\xE2n h\u1EC7 ${e} nh\u01B0ng ch\u01B0a c\xF3 modules/${e}/_module.md.`,E02case:e=>`M\xE3 t\xECnh hu\u1ED1ng \xAB${e}\xBB sai m\u1EABu (TC-<PH>-XXXXXX).`,E02mod:(e,t,n)=>`T\xECnh hu\u1ED1ng ${e} mang m\xE3 ph\xE2n h\u1EC7 ${t} nh\u01B0ng n\u1EB1m trong k\u1ECBch b\u1EA3n ${n}.`,T06:e=>`K\u1ECBch b\u1EA3n ${e} ch\u01B0a c\xF3 t\xECnh hu\u1ED1ng.`,T01:e=>`K\u1ECBch b\u1EA3n ${e} ch\u01B0a ghi ch\u1EE9c n\u0103ng n\xE0o \u0111\u01B0\u1EE3c ki\u1EC3m (covers).`,T05none:(e,t)=>`${e} ph\u1EE7 ${t} nh\u01B0ng repo BA kh\xF4ng c\xF3 m\u1EE5c n\xE0y.`,T05del:(e,t)=>`${e} ph\u1EE7 ${t} \u2014 m\u1EE5c n\xE0y \u0111\xE3 b\u1ECB xo\xE1 trong repo BA.`,steps:"c\xE1c b\u01B0\u1EDBc",expected:"k\u1EBFt qu\u1EA3 mong \u0111\u1EE3i",and:" v\xE0 ",T03:(e,t)=>`T\xECnh hu\u1ED1ng ${e} thi\u1EBFu ${t}.`,T04:e=>`T\xECnh hu\u1ED1ng ${e} Kh\xF4ng \u0111\u1EA1t nh\u01B0ng ch\u01B0a ghi k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF.`,T02:(e,t)=>`Ch\u1EE9c n\u0103ng ${e}${t?" \xAB"+t+"\xBB":""} ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED.`},en:{E03:e=>`Cannot read the file: ${e}`,E01:(e,t)=>`Duplicate code ${e} (already in ${t}) \u2014 change one of them (usually two git branches generated the same code).`,E02suite:e=>`Test suite code \xAB${e}\xBB has the wrong format.`,E04:e=>`The test suite belongs to module ${e}, but modules/${e}/_module.md does not exist.`,E02case:e=>`Test case code \xAB${e}\xBB has the wrong format (TC-<MODULE>-XXXXXX).`,E02mod:(e,t,n)=>`Test case ${e} has module code ${t} but is in test suite ${n}.`,T06:e=>`Test suite ${e} has no test cases yet.`,T01:e=>`Test suite ${e} does not name any function under test (covers).`,T05none:(e,t)=>`${e} covers ${t}, but the BA repo has no such item.`,T05del:(e,t)=>`${e} covers ${t} \u2014 that item was deleted in the BA repo.`,steps:"steps",expected:"expected result",and:" and ",T03:(e,t)=>`Test case ${e} has no ${t}.`,T04:e=>`Test case ${e} failed but has no actual result.`,T02:(e,t)=>`Function ${e}${t?" \xAB"+t+"\xBB":""} has no test suite yet.`}}});function Mr(e){"@babel/helpers - typeof";return Mr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mr(e)}function ex(e,t){if(Mr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Mr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tx(e){var t=ex(e,"string");return Mr(t)=="symbol"?t:t+""}function E(e,t,n){return(t=tx(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xu(Object(n),!0).forEach(function(r){E(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rx(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function Zl(e,t){if(e==null)return{};var n,r,i=rx(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function BC(e,t){return DC(e,t||{},0,0)}function $C(e,t){return IC(e,{i:2},t&&t.out,t&&t.dictionary)}function Ah(e,t){if(t){for(var n=new oe(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(Eh)return Eh.encode(e);for(var i=e.length,s=new oe(e.length+(e.length>>1)),a=0,o=function(u){s[a++]=u},r=0;r<i;++r){if(a+5>s.length){var c=new oe(a+8+(i-r<<1));c.set(s),s=c}var l=e.charCodeAt(r);l<128||t?o(l):l<2048?(o(192|l>>6),o(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|e.charCodeAt(++r)&1023,o(240|l>>18),o(128|l>>12&63),o(128|l>>6&63),o(128|l&63)):(o(224|l>>12),o(128|l>>6&63),o(128|l&63))}return Vr(s,0,a)}function qC(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else{if(Hl)return Hl.decode(e);var i=FC(e),s=i.s,n=i.r;return n.length&&Ee(8),s}}function KC(e,t){t||(t={});var n={},r=[];Df(e,"",n,t);var i=0,s=0;for(var a in n){var o=n[a],c=o[0],l=o[1],u=l.level==0?0:8,d=Ah(a),p=d.length,h=l.comment,f=h&&Ah(h),m=f&&f.length,g=Ul(l.extra);p>65535&&Ee(11);var y=u?BC(c,l):c,T=y.length,b=MC();b.p(c),r.push(Mf(l,{size:c.length,crc:b.d(),c:y,f:d,m:f,u:p!=a.length||f&&h.length!=m,o:i,compression:u})),i+=30+p+g+T,s+=76+2*(p+g)+(m||0)+T}for(var C=new oe(s+22),_=i,w=s-i,x=0;x<r.length;++x){var d=r[x];_h(C,d.o,d,d.f,d.u,d.c.length);var v=30+d.f.length+Ul(d.extra);C.set(d.c,d.o+v),_h(C,i,d,d.f,d.u,d.c.length,d.o,d.m),i+=16+v+(d.m?d.m.length:0)}return WC(C,i,r.length,w,_),C}function GC(e,t){for(var n={},r=e.length-22;Be(e,r)!=101010256;--r)(!r||e.length-r>65558)&&Ee(13);var i=st(e,r+8);if(!i)return{};var s=Be(e,r+16),a=Be(e,r-20)==117853008;if(a){var o=Be(e,r-12);a=Be(e,o)==101075792,a&&(i=Be(e,o+32),s=Be(e,o+48))}for(var c=t&&t.filter,l=0;l<i;++l){var u=UC(e,s,a),d=u[0],p=u[1],h=u[2],f=u[3],m=u[4],g=u[5],y=HC(e,g);s=m,(!c||c({name:f,size:p,originalSize:h,compression:d}))&&(d?d==8?n[f]=$C(e.subarray(y,y+p),{out:new oe(h)}):Ee(14,"unknown compression type "+d):n[f]=Vr(e,y,y+p))}return n}function Oh(e,t,n,r,i,s,a){try{var o=e[s](a),c=o.value}catch(l){n(l);return}o.done?t(c):Promise.resolve(c).then(r,i)}function Kt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var s=e.apply(t,n);function a(c){Oh(s,r,i,a,o,"next",c)}function o(c){Oh(s,r,i,a,o,"throw",c)}a(void 0)})}}var Zy,jr,Yh,Ws,nx,P,St,H,Jh,_e,ix,sx,ax,Qh,_s,ox,lx,Wr,cx,Zh,Ds,dx,nl,em,tm,j,nm,rm,px,ec,ux,hx,mx,im,le,Ks,sm,Yu,tc,fx,qt,am,om,at,gx,ve,bx,lm,vx,wx,yx,I,rl,cm,ot,kr,Pr,nn,L,ue,dm,nc,pm,um,hm,rc,xx,kx,Tx,Ju,Sx,Qu,Cx,Ex,Ax,_x,Zu,Nx,Px,Ix,ic,Ox,sc,Kr,he,Gr,Rx,Lx,Mx,Dx,Gs,ac,_r,mm,Bx,fm,$x,sn,an,Ht,Ut,Fx,qx,Hx,Ux,zs,jx,He,Wx,Kx,Gx,zx,Vx,Xx,Yx,Jx,Qx,Zx,rt,JP,ek,tk,nk,eh,Xe,Bn,rk,ik,sk,QP,ak,gm,ok,lk,$n,Tr,bm,ck,dk,pk,uk,hk,mk,il,vm,fk,gk,wm,bk,on,vk,wk,Dr,ks,yk,qe,Oe,oc,xk,ym,kk,Tk,Sk,Ck,Ek,Ak,_k,lc,xm,km,Nk,Pk,Ik,Ok,Rk,Tm,Lk,Br,Sm,Mk,Dk,Cm,Em,Bk,Am,_m,Nm,cc,$k,Fk,ct,dt,Je,$e,dc,qk,Pm,Hk,Uk,jk,Im,Wk,Kk,Om,Rm,Il,pc,Lm,Gk,Mm,zk,Vk,Xk,Yk,Jk,Qk,Zk,e1,t1,n1,uc,r1,Ol,i1,s1,sl,th,Vs,Dm,a1,o1,zr,l1,be,c1,d1,nh,p1,u1,h1,m1,f1,g1,b1,v1,w1,y1,x1,Xs,k1,T1,$m,S1,Mn,C1,Ys,Nr,rh,E1,A1,_1,Ts,N1,P1,hc,I1,mc,Fm,O1,R1,L1,qm,Um,jm,M1,D1,B1,$1,Wm,Bs,Ss,F1,q1,H1,U1,Km,j1,W1,al,K1,G1,Dn,ih,ne,z1,ZP,zm,V1,X1,Ln,sh,ol,Y1,Vm,J1,Q1,ah,Z1,eT,tT,nT,$s,rT,iT,sT,aT,it,Ns,Rl,oT,Ym,Fe,$r,Ps,Jm,fc,lT,cT,oh,dT,Is,pT,uT,hT,mT,fT,gT,bT,vT,Qm,wT,yT,xT,kT,TT,Zm,ST,lh,CT,ET,ef,AT,Fr,Ll,In,_T,tf,ll,NT,PT,IT,OT,nf,RT,LT,MT,gc,DT,BT,rf,$T,Fs,Ir,FT,Js,sf,qT,HT,UT,wt,ge,jT,Ml,Qs,WT,KT,ch,GT,zT,VT,XT,YT,JT,QT,ZT,eS,tS,nS,rS,of,iS,lf,dh,cl,sS,cf,aS,df,pf,oS,lS,cS,dS,pS,uS,uf,ph,dl,hS,hf,mS,fS,gS,bS,vS,mf,yt,wS,yS,xS,kS,TS,SS,CS,ES,AS,_S,NS,pl,PS,IS,uh,OS,RS,LS,MS,ff,gf,DS,BS,hh,mh,$S,FS,fh,qS,HS,US,gh,bh,jS,WS,KS,bf,GS,zS,VS,bc,Ct,ln,Wt,XS,YS,JS,QS,ZS,eC,tC,nC,rC,iC,sC,vf,vh,xt,wf,yf,xf,kf,Tf,Sf,aC,oC,lC,Or,vc,wh,yh,Dl,cC,dC,ul,pC,uC,hC,mC,fC,gC,wc,xh,Cf,bC,hl,vC,wC,kh,yC,Ef,Os,ml,fl,gl,xC,kC,TC,Qe,Af,_f,cn,yc,SC,oe,Le,xc,Zs,ea,Bl,Nf,Pf,If,$l,Of,CC,Th,Fl,kt,Y,lt,jt,Y,Y,Y,Y,qr,Y,EC,AC,_C,NC,bl,Ye,vl,kc,Vr,PC,Ee,IC,Tt,Sr,wl,ql,Sh,Cr,Rf,Ch,OC,Lf,RC,LC,MC,DC,Mf,st,Be,yl,ke,Df,Eh,Hl,FC,HC,UC,jC,Ul,_h,WC,zC,qs,VC,Nh,Bf,xl,Rs,Ph,jl,XC,YC,JC,Hr,Xr,Wl,Rr,QC,ZC,eE,tE,nE,rE,iE,$f,sE,aE,oE,Ff,Er,kl,lE,cE,dn,qf,Hf,dE,Uf,pE,uE,Tl,hE,Tc,mE,fE,Ih,gE,bE,Rh,Lh,Sc,jf,Wf,vE,wE,ta,pt,Kf,Gf,Te,zf,On,yE,xE,kE,Cc,Kl,Ur,Mh,TE,Dh,Bh,Gl,SE,$h,Fh,CE,EE,AE,_E,NE,zl,Ec,PE,Hs,Vf,IE,OE,Ce,RE,na,Xf,qh,LE,ME,Vl,Xl,DE,BE,$E,FE,qE,HE,UE,jE,Yf,WE,Cs,KE,GE,Es,Jf,zE,Hh,VE,XE,As,YE,JE,Uh,QE,ZE,e2,jh,t2,Yl,Sl,n2,r2,i2,Qf,Ls,s2,a2,Zf,Us,Yr,o2,eg,l2,c2,d2,Ar,tg,Cl,Wh,ng,Ac,El,p2,Kh,u2,_c,h2,m2,f2,g2,b2,Jl,v2,w2,rg,y2,Al,Gh,rn,ig,x2,k2,sg,T2,S2,C2,_l,E2,Lr,Ql,Ms,zh,A2,_2,N2,P2,I2,O2,R2,L2,ag,M2,D2,B2,$2,og,F2,q2,js,H2,lg,U2,j2,cg,dg,W2,pg,Vh,K2,G2,z2,Xh,eI,V2,tI,Nl,X2,ug=Se(()=>{S();Zy=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports);jr=class{constructor(e){E(this,"rootKey",void 0),this.rootKey=e}get writtenAs(){}},Yh=e=>e instanceof jr||typeof e=="object"&&e!==null&&typeof e.prepForXml=="function",Ws=e=>Yh(e)?e.rootKey:void 0,nx=Object.seal({}),P=class extends jr{constructor(e){super(e),E(this,"root",void 0),this.root=new Array}prepForXml(e){var t;e.stack.push(this);let n=this.root.flatMap(r=>{if(Yh(r)){let i=r.writtenAs;return i?i.map(s=>s.prepForXml(e)):r.prepForXml(e)}return r}).filter(r=>r!==void 0);return e.stack.pop(),{[this.rootKey]:n.length?n.length===1&&(!((t=n[0])===null||t===void 0)&&t._attr)?n[0]:n:nx}}addChildElement(e){return this.root.push(e),this}},St=class extends P{constructor(e,t){super(e),E(this,"includeIfEmpty",void 0),this.includeIfEmpty=t}prepForXml(e){let t=super.prepForXml(e);return this.includeIfEmpty||t&&(typeof t[this.rootKey]!="object"||Object.keys(t[this.rootKey]).length)?t:void 0}};H=class extends jr{constructor(e){super("_attr"),E(this,"root",void 0),E(this,"xmlKeys",void 0),this.root=e}prepForXml(e){let t={};return Object.entries(this.root).forEach(([n,r])=>{if(r!==void 0){let i=this.xmlKeys&&this.xmlKeys[n]||n;t[i]=r}}),{_attr:t}}},Jh=class extends jr{constructor(e){super("_attr"),E(this,"root",void 0),this.root=e}prepForXml(e){return{_attr:Object.values(this.root).filter(({value:t})=>t!==void 0).reduce((t,{key:n,value:r})=>k(k({},t),{},{[n]:r}),{})}}},_e=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{val:"w:val",color:"w:color",fill:"w:fill",space:"w:space",sz:"w:sz",type:"w:type",rsidR:"w:rsidR",rsidRPr:"w:rsidRPr",rsidSect:"w:rsidSect",w:"w:w",h:"w:h",top:"w:top",right:"w:right",bottom:"w:bottom",left:"w:left",header:"w:header",footer:"w:footer",gutter:"w:gutter",linePitch:"w:linePitch",pos:"w:pos"})}};ix=["elements"],sx=new Map([["amp","&"],["lt","<"],["gt",">"],["quot",'"'],["apos","'"]]),ax=/&([^;]*);?/g,Qh=e=>e.indexOf("&")===-1?e:e.replace(ax,(t,n)=>{if(!t.endsWith(";"))throw new Error(`Invalid XML: "&" that starts no entity, in "${e}"`);let r=sx.get(n);if(r!==void 0)return r;let i=/^#x[0-9a-f]+$/i.test(n)?parseInt(n.slice(2),16):/^#[0-9]+$/.test(n)?parseInt(n.slice(1),10):NaN;if(!(i>0&&i<=1114111))throw new Error(`Invalid XML: unknown entity "${t}"`);return String.fromCodePoint(i)}),_s=e=>e===" "||e===`
5330
+ `||e===" "||e==="\r",ox=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,lx=e=>Object.fromEntries([...e.matchAll(ox)].map(([,t,n,r])=>[t,n??r])),Wr=(e,{keepWhitespaceText:t=!1}={})=>{let n={},r=[],i=e.charCodeAt(0)===65279?1:0;for(;i<e.length&&_s(e[i]);)i++;let s=d=>{var p;let h=r.length===0?n:r[r.length-1];((p=h.elements)!==null&&p!==void 0?p:h.elements=[]).push(d)},a=d=>{if(d.trim()===""){d!==""&&t&&s({type:"text",text:d});return}if(r.length===0)throw new Error(`Invalid XML: text outside of the root element, "${d.trim()}"`);s({type:"text",text:Qh(d)})},o=(d,p,h)=>{let f=e.indexOf(d,p);if(f===-1)throw new Error(`Invalid XML: ${h} that isn't closed`);return f};for(;i<e.length;){let d=e.indexOf("<",i);if(a(e.slice(i,d===-1?e.length:d)),d===-1)break;if(e.startsWith("<?",d)){let p=o("?>",d+2,"processing instruction"),h=e.slice(d+2,p),f=h.search(/\s/),m=f===-1?h:h.slice(0,f),g=f===-1?"":h.slice(f).trimStart();if(m.toLowerCase()==="xml"){let y=lx(g);n.declaration=Object.keys(y).length>0?{attributes:y}:{}}else s({type:"instruction",name:m,instruction:g});i=p+2}else if(e.startsWith("<!--",d)){let p=o("-->",d+4,"comment"),h=e.slice(d+4,p);h!==""&&s({type:"comment",comment:h}),i=p+3}else if(e.startsWith("<![CDATA[",d)){let p=o("]]>",d+9,"CDATA section"),h=e.slice(d+9,p);h!==""&&s({type:"cdata",cdata:h}),i=p+3}else if(e.startsWith("<!DOCTYPE",d)){let p=d+9,h,f=!1;for(;p<e.length;p++){let m=e[p];if(h!==void 0)h=m===h?void 0:h;else if(m==='"'||m==="'")h=m;else if(m==="[")f=!0;else if(m==="]")f=!1;else if(m===">"&&!f)break}if(p===e.length)throw new Error("Invalid XML: DOCTYPE that isn't closed");s({type:"doctype",doctype:e.slice(d+9,p).replace(/^ /,"")}),i=p+1}else if(e.startsWith("</",d)){let p=o(">",d+2,"closing tag"),h=e.slice(d+2,p).trimEnd(),f=r.pop();if(f?.name!==h){var c;throw new Error(`Invalid XML: closing tag </${h}> doesn't match <${(c=f?.name)!==null&&c!==void 0?c:""}>`)}i=p+1}else i=cx(e,d+1,(p,h)=>{s(p),h||r.push(p)})}if(r.length>0)throw new Error(`Invalid XML: <${r[r.length-1].name}> isn't closed`);let{elements:l}=n,u=Zl(n,ix);return l===void 0?u:k(k({},u),{},{elements:l})},cx=(e,t,n)=>{let r=t;for(;r<e.length&&!_s(e[r])&&e[r]!=="/"&&e[r]!==">";)r++;let i=e.slice(t,r);if(i==="")throw new Error("Invalid XML: tag without a name");let s=[],a=r;for(;;){for(;a<e.length&&_s(e[a]);)a++;if(a>=e.length)throw new Error(`Invalid XML: <${i}> that isn't closed`);if(e[a]===">"||e.startsWith("/>",a)){let p=e[a]==="/";return n(k({type:"element",name:i},s.length>0?{attributes:Object.fromEntries(s)}:{}),p),a+(p?2:1)}let o=e.indexOf("=",a),c=e.slice(a,o===-1?e.length:o).trimEnd();if(o===-1||c===""||/[\s/>]/.test(c))throw new Error(`Invalid XML: attribute of <${i}> without a value`);let l=o+1;for(;l<e.length&&_s(e[l]);)l++;let u=e[l];if(u!=='"'&&u!=="'")throw new Error(`Invalid XML: value of ${c} on <${i}> isn't quoted`);let d=e.indexOf(u,l+1);if(d===-1)throw new Error(`Invalid XML: value of ${c} on <${i}> isn't closed`);s.some(([p])=>p===c)||s.push([c,Qh(e.slice(l+1,d))]),a=d+1}},Zh=new Map([["&","&amp;"],['"',"&quot;"],["'","&apos;"],["<","&lt;"],[">","&gt;"]]),Ds=e=>e.replace(/[&"'<>\x00-\x08\x0B\x0C\x0E-\x1F]/g,t=>{var n;return(n=Zh.get(t))!==null&&n!==void 0?n:""}),dx=e=>e.replace(/[&<>\x00-\x08\x0B\x0C\x0E-\x1F]/g,t=>{var n;return(n=Zh.get(t))!==null&&n!==void 0?n:""}),nl=e=>typeof e=="string"?Ds(e):e,em=(e,t,n)=>{let r=Object.keys(e)[0],i=r===void 0?void 0:e[r],s=[],a=[],o=c=>{for(let[l,u]of Object.entries(c))s.push(`${l}="${String(nl(u))}"`)};if(typeof i=="object"){if(i!==null){let{_attr:c,_cdata:l}=i;if(c&&o(c),l&&a.push(`<![CDATA[${l.replace(/\]\]>/g,"]]]]><![CDATA[>")}]]>`),Array.isArray(i)){let u=!1;a.push("");for(let d of i)typeof d=="object"?Object.keys(d)[0]==="_attr"?o(d._attr):a.push(em(d,t,n+1)):(a.pop(),u=!0,a.push(nl(d)));u||a.push("")}}}else a.push(nl(i));return{name:r,attributes:s,content:a,indents:n>1?t.repeat(n-1):""}},tm=(e,t,n)=>{if(typeof e!="object")return String(e);let{name:r,attributes:i,content:s,indents:a}=e,{length:o}=s,c=a+(r?`<${r}`:"")+(i.length>0?` ${i.join(" ")}`:"")+(o>0?r?">":"":"/>")+(t&&o>1?`
5331
+ `:"");return o===0?c+(t?`
5332
+ `:""):c+s.map(l=>l===void 0?"":tm(l,t,!1)).join("")+(o>1?a:"")+(r?`</${r}>`:"")+(t&&!n?`
5333
+ `:"")},j=(e,{indent:t="",declaration:n}={})=>{let r=Array.isArray(e)?e:[e],i=t?1:0,s=n?.standalone?` standalone="${Ds(n.standalone)}"`:"";return(n===void 0?"":`<?xml version="1.0" encoding="${Ds(n.encoding||"UTF-8")}"${s}?>${t?`
5334
+ `:""}`)+r.map((a,o)=>tm(em(a,t,i),t,o===r.length-1)).join("")},nm=e=>Object.entries(e??{}).flatMap(([t,n])=>n==null?[]:[` ${t}="${Ds(String(n))}"`]).join(""),rm=e=>{switch(e.type){case"element":{var t,n;let r=(t=e.elements)!==null&&t!==void 0?t:[],i=`<${e.name}${nm(e.attributes)}`;return r.length>0||((n=e.attributes)===null||n===void 0?void 0:n["xml:space"])==="preserve"?`${i}>${r.map(rm).join("")}</${e.name}>`:`${i}/>`}case"text":return dx(String(e.text));case"cdata":return`<![CDATA[${String(e.cdata).replace(/\]\]>/g,"]]]]><![CDATA[>")}]]>`;case"comment":return`<!--${e.comment}-->`;case"doctype":return`<!DOCTYPE ${e.doctype}>`;case"instruction":return`<?${e.name}${e.instruction?` ${e.instruction}`:""}?>`;default:return""}},px=e=>{var t;return(e.declaration?`<?xml${nm(e.declaration.attributes)}?>`:"")+((t=e.elements)!==null&&t!==void 0?t:[]).map(rm).join("")},ec=e=>{switch(e.type){case void 0:case"element":let t=new hx(e.name,e.attributes),n=e.elements||[];for(let r of n){let i=ec(r);i!==void 0&&t.push(i)}return t;case"text":return e.text;default:return}},ux=class extends H{},hx=class extends P{static fromXmlString(e){return ec(Wr(e))}constructor(e,t){super(e),t&&this.root.push(new ux(t))}push(e){this.root.push(e)}get writtenAs(){return this.rootKey===void 0?this.root.filter(e=>typeof e!="string"):void 0}prepForXml(e){let t=this.writtenAs;return t?.length===1?t[0].prepForXml(e):super.prepForXml(e)}},mx=class extends P{constructor(e){super(""),E(this,"_attr",void 0),this._attr=e}prepForXml(e){return{_attr:this._attr}}},im=class extends P{constructor(e,t){super(e),t&&(this.root=t.root)}},le=e=>{if(!Number.isFinite(e))throw new Error(`Invalid value '${e}' specified. Must be an integer.`);return Math.floor(e)},Ks=e=>{let t=le(e);if(t<0)throw new Error(`Invalid value '${e}' specified. Must be a positive integer.`);return t},sm=(e,t)=>{let n=t*2;if(e.length!==n||isNaN(+`0x${e}`))throw new Error(`Invalid hex value '${e}'. Expected ${n} digit hex value`);return e},Yu=e=>sm(e,1),tc=e=>{let t=e.slice(-2),n=e.substring(0,e.length-2);return`${Number(n)}${t}`},fx={in:1440,cm:1440/2.54,mm:1440/25.4,pt:20,pc:240,pi:240},qt=e=>{if(typeof e=="number")return e;let t=e.slice(-2),n=Number(e.substring(0,e.length-2)),r=fx[t];if(r===void 0||Number.isNaN(n))throw new Error(`Invalid universal measure '${e}'. Expected a number followed by mm, cm, in, pt, pc or pi.`);return n*r},am=e=>{let t=tc(e);if(parseFloat(t)<0)throw new Error(`Invalid value '${t}' specified. Expected a positive number.`);return t},om=e=>e==="auto"?e:sm(e.charAt(0)==="#"?e.substring(1):e,3),at=e=>typeof e=="string"?tc(e):le(e),gx=e=>typeof e=="string"?am(e):Ks(e),ve=e=>typeof e=="string"?am(e):Ks(e),bx=e=>{let t=e.substring(0,e.length-1);return`${Number(t)}%`},lm=e=>typeof e=="number"?le(e):e.slice(-1)==="%"?bx(e):tc(e),vx=Ks,wx=Ks,yx=e=>e.toISOString(),I=class extends P{constructor(e,t=!0){super(e),t!==!0&&this.root.push(new _e({val:t}))}},rl=class extends P{constructor(e,t){super(e),this.root.push(new _e({val:gx(t)}))}},cm=class extends P{},ot=class extends P{constructor(e,t){super(e),this.root.push(new _e({val:t}))}},kr=(e,t)=>new L({name:e,attributes:{value:{key:"w:val",value:t}}}),Pr=class extends P{constructor(e,t){super(e),this.root.push(new _e({val:t}))}},nn=class extends P{constructor(e,t){super(e),this.root.push(t)}},L=class extends P{constructor({name:e,attributes:t,children:n}){super(e),t&&this.root.push(new Jh(t)),n&&this.root.push(...n)}},ue={START:"start",CENTER:"center",END:"end",BOTH:"both",MEDIUM_KASHIDA:"mediumKashida",DISTRIBUTE:"distribute",NUM_TAB:"numTab",HIGH_KASHIDA:"highKashida",LOW_KASHIDA:"lowKashida",THAI_DISTRIBUTE:"thaiDistribute",LEFT:"left",RIGHT:"right",JUSTIFIED:"both"},dm=e=>new L({name:"w:jc",attributes:{val:{key:"w:val",value:e}}}),nc={dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hyperlink:"hlink",followedHyperlink:"folHlink"},pm={dark2:"44546A",light2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hyperlink:"0563C1",followedHyperlink:"954F72"},um={dark1:{value:"windowText",lastColor:"000000"},light1:{value:"window",lastColor:"FFFFFF"}},hm=(e,t)=>{if(t==="auto")throw new Error(`Invalid theme color ${e} 'auto'. Expected 6 digit hex value`);return om(t)},rc=(e={})=>Object.fromEntries(Object.keys(nc).map(t=>{let n=e[t],r=t==="dark1"||t==="light1"?um[t].lastColor:pm[t];return[t,n===void 0?r:hm(t,n)]})),xx=(e,t)=>new L({name:"a:srgbClr",attributes:{value:{key:"val",value:hm(e,t)}}}),kx=(e,t)=>{let n=t[e],r=e==="dark1"||e==="light1"?um[e]:void 0;return new L({name:`a:${nc[e]}`,children:[n===void 0&&r?new L({name:"a:sysClr",attributes:{value:{key:"val",value:r.value},lastColor:{key:"lastClr",value:r.lastColor}}}):xx(e,n??pm[e])]})},Tx=(e,t={})=>new L({name:"a:clrScheme",attributes:{name:{key:"name",value:e}},children:Object.keys(nc).map(n=>kx(n,t))}),Ju=new Set(["dark1","light1","dark2","light2","accent1","accent2","accent3","accent4","accent5","accent6","hyperlink","followedHyperlink"]),Sx=new Map([["dk1","dark1"],["lt1","light1"],["dk2","dark2"],["lt2","light2"],["hlink","hyperlink"],["folHlink","followedHyperlink"],["text1","dark1"],["background1","light1"],["text2","dark2"],["background2","light2"]]),Qu=(e,t)=>{if(!(e>=0&&e<=100))throw new Error(`Invalid ${t} ${e}. Expected a number from 0 to 100`);return Math.round(255*(1-e/100))},Cx=({theme:e,lighter:t,darker:n})=>{if(!Ju.has(e)){let s=Sx.get(e);throw new Error(`Invalid theme color "${e}". ${s?`Did you mean "${s}"?`:`Expected one of ${[...Ju].join(", ")}`}`)}if(t!==void 0&&n!==void 0)throw new Error("Invalid theme color. Expected lighter or darker, not both");let r=t===void 0?void 0:Qu(t,"lighter"),i=n===void 0?void 0:Qu(n,"darker");return{tint:r===255?void 0:r,shade:i===255?void 0:i}},Ex=e=>{let[t,n,r]=[0,2,4].map(c=>parseInt(e.slice(c,c+2),16)/255),i=Math.max(t,n,r),s=Math.min(t,n,r),a=(i+s)/2,o=i-s;return o===0?{hue:0,saturation:0,lightness:a}:{hue:(i===t?((n-r)/o+6)%6:i===n?(r-t)/o+2:(t-n)/o+4)*60,saturation:o/(1-Math.abs(2*a-1)),lightness:a}},Ax=({hue:e,saturation:t,lightness:n})=>{let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),[s,a,o]=e<60?[r,i,0]:e<120?[i,r,0]:e<180?[0,r,i]:e<240?[0,i,r]:e<300?[i,0,r]:[r,0,i],c=n-r/2;return[s,a,o].map(l=>Math.floor((l+c)*255+1e-9).toString(16).padStart(2,"0")).join("").toUpperCase()},_x=(e,{tint:t,shade:n})=>{if(t===void 0&&n===void 0)return e;let r=Ex(e),i=t===void 0?r.lightness*n/255:r.lightness*t/255+(1-t/255);return Ax(k(k({},r),{},{lightness:i}))},Zu=e=>e===void 0?void 0:e.toString(16).padStart(2,"0").toUpperCase(),Nx=e=>typeof e=="string"?{type:"hex",value:om(e)}:{type:"theme",color:e,change:Cx(e)},Px=(e,t)=>e.type==="hex"?{color:e.value}:{color:_x(t[e.color.theme],e.change),theme:e.color.theme,tint:Zu(e.change.tint),shade:Zu(e.change.shade)},Ix=rc(),ic=class extends jr{constructor(e){super("_attr"),E(this,"attributes",void 0),this.attributes=e.map(t=>"keys"in t?{keys:t.keys,color:t.color===void 0?void 0:Nx(t.color)}:t)}prepForXml(e){var t,n;let r=(t=(n=e.file)===null||n===void 0||(n=n.Theme)===null||n===void 0?void 0:n.Colors)!==null&&t!==void 0?t:Ix,i=this.attributes.flatMap(s=>{if(!("keys"in s))return[[s.key,s.value]];if(s.color===void 0)return[];let{keys:a}=s,o=Px(s.color,r);return[[a.color,o.color],[a.theme,o.theme],[a.tint,o.tint],[a.shade,o.shade]]});return{_attr:Object.fromEntries(i.filter(([,s])=>s!==void 0))}}},Ox=class extends P{constructor(e,t){super(e),this.root.push(new ic(t))}},sc=(e,t)=>new Ox(e,t),Kr={color:"w:color",theme:"w:themeColor",tint:"w:themeTint",shade:"w:themeShade"},he=(e,{color:t,size:n,space:r,style:i})=>sc(e,[{key:"w:val",value:i},{keys:Kr,color:t},{key:"w:sz",value:n===void 0?void 0:vx(n)},{key:"w:space",value:r===void 0?void 0:wx(r)}]),Gr={SINGLE:"single",DASH_DOT_STROKED:"dashDotStroked",DASHED:"dashed",DASH_SMALL_GAP:"dashSmallGap",DOT_DASH:"dotDash",DOT_DOT_DASH:"dotDotDash",DOTTED:"dotted",DOUBLE:"double",DOUBLE_WAVE:"doubleWave",INSET:"inset",NIL:"nil",NONE:"none",OUTSET:"outset",THICK:"thick",THICK_THIN_LARGE_GAP:"thickThinLargeGap",THICK_THIN_MEDIUM_GAP:"thickThinMediumGap",THICK_THIN_SMALL_GAP:"thickThinSmallGap",THIN_THICK_LARGE_GAP:"thinThickLargeGap",THIN_THICK_MEDIUM_GAP:"thinThickMediumGap",THIN_THICK_SMALL_GAP:"thinThickSmallGap",THIN_THICK_THIN_LARGE_GAP:"thinThickThinLargeGap",THIN_THICK_THIN_MEDIUM_GAP:"thinThickThinMediumGap",THIN_THICK_THIN_SMALL_GAP:"thinThickThinSmallGap",THREE_D_EMBOSS:"threeDEmboss",THREE_D_ENGRAVE:"threeDEngrave",TRIPLE:"triple",WAVE:"wave"},Rx=class extends St{constructor(e){super("w:pBdr"),e.top&&this.root.push(he("w:top",e.top)),e.left&&this.root.push(he("w:left",e.left)),e.bottom&&this.root.push(he("w:bottom",e.bottom)),e.right&&this.root.push(he("w:right",e.right)),e.between&&this.root.push(he("w:between",e.between))}},Lx=class extends P{constructor(){super("w:pBdr");let e=he("w:bottom",{color:"auto",space:1,style:Gr.SINGLE,size:6});this.root.push(e)}},Mx=({start:e,end:t,left:n,right:r,hanging:i,firstLine:s,firstLineChars:a})=>new L({name:"w:ind",attributes:{start:{key:"w:start",value:e===void 0?void 0:at(e)},end:{key:"w:end",value:t===void 0?void 0:at(t)},left:{key:"w:left",value:n===void 0?void 0:at(n)},right:{key:"w:right",value:r===void 0?void 0:at(r)},hanging:{key:"w:hanging",value:i===void 0?void 0:ve(i)},firstLine:{key:"w:firstLine",value:s===void 0?void 0:ve(s)},firstLineChars:{key:"w:firstLineChars",value:a===void 0?void 0:le(a)}}}),Dx=()=>new L({name:"w:br"}),Gs={BEGIN:"begin",END:"end",SEPARATE:"separate"},ac=(e,t,n)=>new L({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:e},dirty:{key:"w:dirty",value:t},locked:{key:"w:fldLock",value:n}}}),_r=(e,t)=>ac(Gs.BEGIN,e,t),mm=new WeakSet,Bx=class extends L{constructor(){super({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:Gs.BEGIN},dirty:{key:"w:dirty",value:!0}}})}prepForXml(e){let t=super.prepForXml(e);return mm.add(t),t}},fm=()=>new Bx,$x=e=>typeof e=="object"&&e!==null&&mm.has(e),sn=e=>ac(Gs.SEPARATE,e),an=e=>ac(Gs.END,e),Ht={DEFAULT:"default",PRESERVE:"preserve"},Ut=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{space:"xml:space"})}},Fx=class extends P{constructor(){super("w:instrText"),this.root.push(new Ut({space:Ht.PRESERVE})),this.root.push("PAGE")}},qx=class extends P{constructor(){super("w:instrText"),this.root.push(new Ut({space:Ht.PRESERVE})),this.root.push("NUMPAGES")}},Hx=class extends P{constructor(){super("w:instrText"),this.root.push(new Ut({space:Ht.PRESERVE})),this.root.push("SECTIONPAGES")}},Ux=class extends P{constructor(){super("w:instrText"),this.root.push(new Ut({space:Ht.PRESERVE})),this.root.push("SECTION")}},zs=({fill:e,color:t,type:n})=>sc("w:shd",[{keys:{color:"w:fill",theme:"w:themeFill",tint:"w:themeFillTint",shade:"w:themeFillShade"},color:e},{keys:Kr,color:t},{key:"w:val",value:n??jx.CLEAR}]),jx={CLEAR:"clear",DIAGONAL_CROSS:"diagCross",DIAGONAL_STRIPE:"diagStripe",HORIZONTAL_CROSS:"horzCross",HORIZONTAL_STRIPE:"horzStripe",NIL:"nil",PERCENT_5:"pct5",PERCENT_10:"pct10",PERCENT_12:"pct12",PERCENT_15:"pct15",PERCENT_20:"pct20",PERCENT_25:"pct25",PERCENT_30:"pct30",PERCENT_35:"pct35",PERCENT_37:"pct37",PERCENT_40:"pct40",PERCENT_45:"pct45",PERCENT_50:"pct50",PERCENT_55:"pct55",PERCENT_60:"pct60",PERCENT_62:"pct62",PERCENT_65:"pct65",PERCENT_70:"pct70",PERCENT_75:"pct75",PERCENT_80:"pct80",PERCENT_85:"pct85",PERCENT_87:"pct87",PERCENT_90:"pct90",PERCENT_95:"pct95",REVERSE_DIAGONAL_STRIPE:"reverseDiagStripe",SOLID:"solid",THIN_DIAGONAL_CROSS:"thinDiagCross",THIN_DIAGONAL_STRIPE:"thinDiagStripe",THIN_HORIZONTAL_CROSS:"thinHorzCross",THIN_REVERSE_DIAGONAL_STRIPE:"thinReverseDiagStripe",THIN_VERTICAL_STRIPE:"thinVertStripe",VERTICAL_STRIPE:"vertStripe"},He=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date"})}},Wx=class extends P{constructor(e){super("w:del"),this.root.push(new He({id:e.id,author:e.author,date:e.date}))}},Kx=class extends P{constructor(e){super("w:ins"),this.root.push(new He({id:e.id,author:e.author,date:e.date}))}},Gx=({twoLinesInOne:e,brackets:t,horizontalInVertical:n,fitToLine:r,group:i})=>new L({name:"w:eastAsianLayout",attributes:{id:{key:"w:id",value:i===void 0?void 0:le(i)},combine:{key:"w:combine",value:e},combineBrackets:{key:"w:combineBrackets",value:t},vert:{key:"w:vert",value:n},vertCompress:{key:"w:vertCompress",value:r}}}),zx={DOT:"dot"},Vx=(e=zx.DOT)=>new L({name:"w:em",attributes:{val:{key:"w:val",value:e}}}),Xx="57X6y3wQZNzYjJB2L_10pxbackgroundhimselfUTF-8DEMOGRAPHICSVqvt4KW9",Yx=(e,t=21)=>(n=t)=>{let r="",i=n|0;for(;i-- >0;)r+=e[Math.random()*e.length|0];return r},Jx=(e=21)=>{let t="",n=e|0;for(;n-- >0;)t+=Xx[Math.random()*64|0];return t},Qx=e=>{let t=new Int32Array(Math.ceil((e.length+9)/64)*16);for(let n=0;n<e.length;n++)t[n>>2]|=e[n]<<24-(n&3)*8;return t[e.length>>2]|=128<<24-(e.length&3)*8,t[t.length-2]=Math.floor(e.length/536870912),t[t.length-1]=e.length*8,t},Zx=e=>{let t=new Uint8Array(e.length*4);for(let n=0;n<t.length;n++)t[n]=e[n>>2]>>>24-(n&3)*8;return t},rt=(e,t)=>e>>>t|e<<32-t,JP=Int32Array.of(1518500249,1859775393,2400959708,3395469782),ek=Int32Array.of(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),tk=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],nk=new Int32Array(64),eh=e=>{let t=Qx(e),n=nk,[r,i,s,a,o,c,l,u]=tk;for(let d=0;d<t.length;d+=16){n.set(t.subarray(d,d+16));for(let C=16;C<64;C++){let _=n[C-15],w=n[C-2];n[C]=n[C-16]+(rt(_,7)^rt(_,18)^_>>>3)+n[C-7]+(rt(w,17)^rt(w,19)^w>>>10)}let[p,h,f,m,g,y,T,b]=[r,i,s,a,o,c,l,u];for(let C=0;C<64;C++){let _=b+(rt(g,6)^rt(g,11)^rt(g,25))+(g&y^~g&T)+ek[C]+n[C]|0,w=(rt(p,2)^rt(p,13)^rt(p,22))+(p&h^p&f^h&f)|0;b=T,T=y,y=g,g=m+_|0,m=f,f=h,h=p,p=_+w|0}[r,i,s,a,o,c,l,u]=[r+p|0,i+h|0,s+f|0,a+m|0,o+g|0,c+y|0,l+T|0,u+b|0]}return Zx([r,i,s,a,o,c,l,u])},Xe=e=>Math.floor(e*72*20),Bn=(e=0)=>{let t=e;return()=>++t},rk=()=>Bn(),ik=()=>Bn(1),sk=()=>Bn(),QP=sk(),ak=()=>Bn(),gm=ak(),ok=Bn(),lk=()=>-ok(),$n=()=>Jx().toLowerCase(),Tr=e=>Yx("1234567890abcdef",e)(),bm=()=>`${Tr(8)}-${Tr(4)}-${Tr(4)}-${Tr(4)}-${Tr(12)}`,ck=e=>new Uint8Array(new TextEncoder().encode(e)),dk=({width:e,group:t})=>new L({name:"w:fitText",attributes:{val:{key:"w:val",value:Math.round(qt(ve(e)))},id:{key:"w:id",value:t===void 0?lk():le(t)}}}),pk=class extends P{constructor(e){super("w:spacing"),this.root.push(new _e({val:at(e)}))}},uk=class extends P{constructor(e){super("w:color"),this.root.push(new ic([{keys:k(k({},Kr),{},{color:"w:val"}),color:e}]))}},hk=class extends P{constructor(e){super("w:highlight"),this.root.push(new _e({val:e}))}},mk=e=>new L({name:"w:lang",attributes:{value:{key:"w:val",value:e.value},eastAsia:{key:"w:eastAsia",value:e.eastAsia},bidirectional:{key:"w:bidi",value:e.bidirectional}}}),il=(e,t)=>{if(typeof e=="string"){let r=e;return new L({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:r},cs:{key:"w:cs",value:r},eastAsia:{key:"w:eastAsia",value:r},hAnsi:{key:"w:hAnsi",value:r},hint:{key:"w:hint",value:t}}})}if("theme"in e){let r=e.theme==="headings"?"major":"minor";return new L({name:"w:rFonts",attributes:{ascii:{key:"w:asciiTheme",value:`${r}HAnsi`},eastAsia:{key:"w:eastAsiaTheme",value:`${r}EastAsia`},hAnsi:{key:"w:hAnsiTheme",value:`${r}HAnsi`},cs:{key:"w:cstheme",value:`${r}Bidi`}}})}let n=e;return new L({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:n.ascii},cs:{key:"w:cs",value:n.cs},eastAsia:{key:"w:eastAsia",value:n.eastAsia},hAnsi:{key:"w:hAnsi",value:n.hAnsi},hint:{key:"w:hint",value:n.hint}}})},vm=e=>new L({name:"w:vertAlign",attributes:{val:{key:"w:val",value:e}}}),fk=()=>vm("superscript"),gk=()=>vm("subscript"),wm={SINGLE:"single",WORDS:"words",DOUBLE:"double",THICK:"thick",DOTTED:"dotted",DOTTEDHEAVY:"dottedHeavy",DASH:"dash",DASHEDHEAVY:"dashedHeavy",DASHLONG:"dashLong",DASHLONGHEAVY:"dashLongHeavy",DOTDASH:"dotDash",DASHDOTHEAVY:"dashDotHeavy",DOTDOTDASH:"dotDotDash",DASHDOTDOTHEAVY:"dashDotDotHeavy",WAVE:"wave",WAVYHEAVY:"wavyHeavy",WAVYDOUBLE:"wavyDouble",NONE:"none"},bk=(e=wm.SINGLE,t)=>sc("w:u",[{key:"w:val",value:e},{keys:Kr,color:t}]),on=class extends St{constructor(e){if(super("w:rPr"),!e)return;if(e.style&&this.push(new ot("w:rStyle",e.style)),e.font&&(typeof e.font=="string"?this.push(il(e.font)):"name"in e.font?this.push(il(e.font.name,e.font.hint)):this.push(il(e.font))),e.bold!==void 0&&this.push(new I("w:b",e.bold)),e.boldComplexScript===void 0&&e.bold!==void 0||e.boldComplexScript){var t;this.push(new I("w:bCs",(t=e.boldComplexScript)!==null&&t!==void 0?t:e.bold))}if(e.italics!==void 0&&this.push(new I("w:i",e.italics)),e.italicsComplexScript===void 0&&e.italics!==void 0||e.italicsComplexScript){var n;this.push(new I("w:iCs",(n=e.italicsComplexScript)!==null&&n!==void 0?n:e.italics))}e.smallCaps!==void 0?this.push(new I("w:smallCaps",e.smallCaps)):e.allCaps!==void 0&&this.push(new I("w:caps",e.allCaps)),e.strike!==void 0&&this.push(new I("w:strike",e.strike)),e.doubleStrike!==void 0&&this.push(new I("w:dstrike",e.doubleStrike)),e.emboss!==void 0&&this.push(new I("w:emboss",e.emboss)),e.imprint!==void 0&&this.push(new I("w:imprint",e.imprint)),e.noProof!==void 0&&this.push(new I("w:noProof",e.noProof)),e.snapToGrid!==void 0&&this.push(new I("w:snapToGrid",e.snapToGrid)),e.vanish!==void 0&&this.push(new I("w:vanish",e.vanish)),e.color&&this.push(new uk(e.color)),e.characterSpacing&&this.push(new pk(e.characterSpacing)),e.scale!==void 0&&this.push(new Pr("w:w",e.scale)),e.kern&&this.push(new rl("w:kern",e.kern)),e.position&&this.push(new ot("w:position",e.position)),e.size!==void 0&&this.push(new rl("w:sz",e.size));let r=e.sizeComplexScript===void 0||e.sizeComplexScript===!0?e.size:e.sizeComplexScript;r&&this.push(new rl("w:szCs",r)),e.highlight&&this.push(new hk(e.highlight)),e.underline&&this.push(bk(e.underline.type,e.underline.color)),e.effect&&this.push(new ot("w:effect",e.effect)),e.border&&this.push(he("w:bdr",e.border)),e.shading&&this.push(zs(e.shading)),e.fitText&&this.push(dk(e.fitText)),e.subScript&&this.push(gk()),e.superScript&&this.push(fk()),e.rightToLeft!==void 0&&this.push(new I("w:rtl",e.rightToLeft)),e.emphasisMark&&this.push(Vx(e.emphasisMark.type)),e.language&&this.push(mk(e.language)),e.eastAsianLayout&&this.push(Gx(e.eastAsianLayout)),e.specVanish!==void 0&&this.push(new I("w:specVanish",e.specVanish)),e.math!==void 0&&this.push(new I("w:oMath",e.math)),e.revision&&this.push(new wk(e.revision))}push(e){this.root.push(e)}},vk=class extends on{constructor(e){super(e),e?.insertion&&this.push(new Kx(e.insertion)),e?.deletion&&this.push(new Wx(e.deletion))}},wk=class extends P{constructor(e){super("w:rPrChange"),this.root.push(new He({id:e.id,author:e.author,date:e.date})),this.addChildElement(new on(e))}},Dr=class extends P{constructor(e){if(super("w:t"),typeof e=="string")this.root.push(new Ut({space:Ht.PRESERVE})),this.root.push(e);else{var t;this.root.push(new Ut({space:(t=e.space)!==null&&t!==void 0?t:Ht.DEFAULT})),this.root.push(e.text)}}},ks={CURRENT:"CURRENT",TOTAL_PAGES:"TOTAL_PAGES",TOTAL_PAGES_IN_SECTION:"TOTAL_PAGES_IN_SECTION",CURRENT_SECTION:"SECTION"},yk=e=>{switch(e){case ks.CURRENT:return[_r(),new Fx,sn(),an()];case ks.TOTAL_PAGES:return[_r(),new qx,sn(),an()];case ks.TOTAL_PAGES_IN_SECTION:return[_r(),new Hx,sn(),an()];case ks.CURRENT_SECTION:return[_r(),new Ux,sn(),an()];default:return}},qe=class Pl extends P{constructor(t){if(super("w:r"),E(this,"properties",void 0),E(this,"following",[]),this.properties=new on(t),this.root.push(this.properties),t.break)for(let n=0;n<t.break;n++)this.root.push(Dx());if(t.children)for(let[n,r]of t.children.entries()){if(Ws(r)==="w:r"){let i=t.children.slice(n+1);this.following=[r,...i.length>0?[new Pl(k(k({},t),{},{break:void 0,children:i}))]:[]];break}if(typeof r=="string"){let i=yk(r);if(i){let s=t.children.slice(n+1),a=l=>new Pl(k(k({},t),{},{break:void 0,children:l})),o=this.root.length===1;o&&this.root.push(i[0]);let c=o?i.slice(1):i;this.following=[...c.map(l=>a([l])),...s.length>0?[a(s)]:[]];break}this.root.push(new Dr(r));continue}this.root.push(r)}else t.text!==void 0&&this.root.push(new Dr(t.text))}get writtenAs(){return this.following.length>0?[this,...this.following.flatMap(t=>{var n;return(n=t.writtenAs)!==null&&n!==void 0?n:t})]:void 0}},Oe=class extends qe{constructor(e){super(typeof e=="string"?{text:e}:e)}},oc={EXTERNAL:"External"},xk=(e,t,n,r)=>new L({name:"Relationship",attributes:{id:{key:"Id",value:e},type:{key:"Type",value:t},target:{key:"Target",value:n},targetMode:{key:"TargetMode",value:r}}}),ym=(e,t)=>new L({name:"a:hlinkClick",attributes:k(k({},t?{xmlns:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"}}:{}),{},{id:{key:"r:id",value:`rId${e}`}})}),kk=class{constructor(e){E(this,"link",void 0),E(this,"linkId",$n()),E(this,"addedTo",new WeakSet),this.link=e}createClick(e){return ym(this.linkId,e)}addRelationship(e){let t=e.viewWrapper.Relationships;this.addedTo.has(t)||(this.addedTo.add(t),t.addRelationship(this.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",this.link,oc.EXTERNAL))}},Tk=32767,Sk=780,Ck=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],Ek=e=>e<=Tk?Ck.reduce(({rest:t,text:n},[r,i])=>({rest:t%r,text:n+i.repeat(Math.floor(t/r))}),{rest:e,text:""}).text:void 0,Ak=e=>e===0?"":e<=Sk?String.fromCharCode(65+(e-1)%26).repeat(Math.ceil(e/26)):void 0,_k=e=>{var t;return`${e}${e%100>=11&&e%100<=13?"th":(t=["th","st","nd","rd"][e%10])!==null&&t!==void 0?t:"th"}`},lc=e=>{let t=e.charAt(0)!==e.charAt(0).toUpperCase(),n=r=>i=>{var s;return t?(s=r(i))===null||s===void 0?void 0:s.toLowerCase():r(i)};switch(e.toLowerCase()){case"arabic":return String;case"roman":return n(Ek);case"alphabetic":return n(Ak);case"ordinal":return r=>r>0?_k(r):void 0;case"arabicdash":return r=>`- ${r} -`;default:return}},xm=new Set(["mergeformat","charformat","mergeformatinet"]),km=new Set(["upper","lower","firstcap","caps"]),Nk=e=>/^[#0,]*[#0][#0,]*$/.test(e),Pk=(e,t)=>{let n=[...t].filter(s=>s==="0").length,r=n+[...t].filter(s=>s==="#").length,i=String(e).padStart(n,"0");if(!(i.length<r||n===0&&e===0))return t.includes(",")?i.replace(/\B(?=(\d{3})+$)/g,","):i},Ik=(e,t)=>{switch(t){case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();case"firstcap":return e.charAt(0).toUpperCase()+e.slice(1);default:return e}},Ok=e=>{var t;let n=new RegExp("^\\s*(PAGEREF|NUMPAGES|SECTIONPAGES)\\b(.*)$","is").exec(e),r=n?.[1].toUpperCase()==="PAGEREF"?new RegExp('^\\s*("?)([^\\s"\\\\]+)\\1(.*)$',"s").exec(n[2]):void 0;if(!n||n[1].toUpperCase()==="PAGEREF"&&!r)return;let i=(t=(r?r[3]:n[2]).match(/"[^"]*"|\S+/g))!==null&&t!==void 0?t:[],s,a,o=[],c=!1,l=!0;for(let h=0;h<i.length;h++){let f=i[h],m=()=>{var g;return(f.length>2?f.slice(2):(g=i[++h])!==null&&g!==void 0?g:"").replace(/^"(.*)"$/,"$1")};if(/^\\p$/i.test(f))c=!0;else if(f.startsWith("\\#")){var u;let g=m();l&&(l=a===void 0&&Nk(g)),(u=a)!==null&&u!==void 0||(a=g)}else if(f.startsWith("\\*")){let g=m(),y=g.toLowerCase();if(km.has(y))o.push(y);else if(g!==""&&!xm.has(y)){var d;l&&(l=s===void 0&&lc(g)!==void 0),(d=s)!==null&&d!==void 0||(s=g)}}}let p=k(k(k(k({},s===void 0?{}:{numberFormat:s}),a===void 0?{}:{picture:a}),o.length===0?{}:{capitals:o[0]}),{},{written:l&&o.length<=1&&o[0]!=="caps"&&(s===void 0||a===void 0)});return k(r?{type:"pageReference",bookmark:r[2],relative:c}:{type:"pageCount",scope:n[1].toUpperCase()==="NUMPAGES"?"document":"section"},p)},Rk=e=>new RegExp("^\\s*TOC\\b.*\\\\s\\b","is").test(e),Tm=(e,{enclosing:t,within:n,inTextBox:r},{estimate:i,sectionPageCount:s,blank:a,relativeTo:o})=>{let c=Ok(e);if(c===void 0)return;let{bookmarks:l,pageCount:u,bookmarkPageNumbers:d}=i,{numberFormat:p,picture:h,capitals:f,written:m}=c,g=p!==void 0||h!==void 0,y=C=>C===void 0?void 0:h===void 0?lc(p??"arabic")(C):Pk(C,h),T=c.type==="pageReference"&&c.relative&&n==="counted"&&!r?o?.(c.bookmark):void 0,b;return m?c.type==="pageCount"?b=y(c.scope==="document"?u:s):t.some(Rk)?b=void 0:g?b=y(d?.get(c.bookmark)):b=c.relative?T:l.get(c.bookmark):b=void 0,b===void 0?a?"":void 0:Ik(b,f)},Lk=(e,t)=>e==="mc:Fallback"||t==="fallback"?"fallback":e==="w:del"||e==="w:moveFrom"?"deleted":t,Br=(e,t,n,r,i="counted",s=!1)=>{for(let l=0;l<t.length;l++){let u=t[l],d=e.nameOf(u);if(d===void 0)continue;let p=n[n.length-1];if(d==="w:fldChar"){let h=e.attributeOf(u,"w:fldCharType");h==="begin"?n.push({begin:u,instruction:"",inResult:!1}):h==="separate"&&p?(e.writeClean(p.begin,p.instruction),p.inResult=!0,p.result=r.resultOf(p.instruction,{within:i,enclosing:n.slice(0,-1).map(f=>f.instruction),inTextBox:s}),p.result!==void 0&&(t.splice(l+1,0,e.textElement(p.result)),l++)):h==="end"&&n.pop()}else if(d==="w:instrText"&&p&&!p.inResult)p.instruction+=e.textOf(u);else if((d==="w:t"||d==="w:tab"||d==="w:br"||d==="w:cr")&&p?.result!==void 0)t.splice(l,1),l--;else if(d==="w:fldSimple"){let h=r.resultOf(String(e.attributeOf(u,"w:instr")),{within:i,enclosing:n.map(f=>f.instruction),inTextBox:s});if(h===void 0){var a;Br(e,(a=e.contentOf(u))!==null&&a!==void 0?a:[],[],r,i,s)}else e.setSimpleFieldResult(u,h)}else{var o;if(d==="w:p"){var c;(c=r.beforeParagraph)===null||c===void 0||c.call(r,u)}Br(e,(o=e.contentOf(u))!==null&&o!==void 0?o:[],n,r,Lk(d,i),s||d==="w:txbxContent"),d==="w:p"&&r.afterParagraph(u)}}},Sm=(e,t)=>t.flatMap(n=>{var r;let i=e.nameOf(n);return i===void 0?[]:i==="w:sectPr"?[n]:Sm(e,(r=e.contentOf(n))!==null&&r!==void 0?r:[])}),Mk=(e,t)=>{var n;return((n=e.contentOf(t))!==null&&n!==void 0?n:[]).some(r=>{var i;return e.nameOf(r)==="w:pPr"&&((i=e.contentOf(r))!==null&&i!==void 0?i:[]).some(s=>e.nameOf(s)==="w:sectPr")})},Dk=(e,t,n)=>{let r=Sm(e,[t]).reduce((i,s)=>{var a,o;let c=((a=e.contentOf(s))!==null&&a!==void 0?a:[]).flatMap(l=>{let u=e.nameOf(l);return u==="w:headerReference"||u==="w:footerReference"?[[`${u} ${String(e.attributeOf(l,"w:type"))}`,String(e.attributeOf(l,"r:id"))]]:[]});return[...i,new Map([...(o=i[i.length-1])!==null&&o!==void 0?o:[],...c])]},[]).reduce((i,s,a)=>{for(let c of s.values()){var o;i.set(c,[...(o=i.get(c))!==null&&o!==void 0?o:[],n[a]])}return i},new Map);return new Map([...r].flatMap(([i,[s,...a]])=>s!==void 0&&a.every(o=>o===s)?[[i,s]]:[]))},Cm=(e,t,n,{blank:r})=>{let{sectionPageCounts:i=[],relativePositions:s}=n,a=0,o=new Map,c=l=>{var u,d;let p=(u=o.get(l))!==null&&u!==void 0?u:0;return o.set(l,p+1),s==null||(d=s.get(l))===null||d===void 0?void 0:d[p]};return Br(e,[t],[],{resultOf:(l,u)=>Tm(l,u,{estimate:n,sectionPageCount:i[a],blank:r,relativeTo:c}),afterParagraph:l=>{a+=Mk(e,l)?1:0}}),Dk(e,t,i)},Em=(e,t,n,{blank:r,sectionPageCount:i,notes:s=!1})=>{let a=o=>{let c=n.bookmarks.get(o);return c===void 0?void 0:`on page ${c}`};Br(e,[t],[],{resultOf:(o,c)=>Tm(o,c,k({estimate:n,sectionPageCount:i,blank:r},s?{relativeTo:a}:{})),afterParagraph:()=>{}})},Bk=(e,t,{beforeParagraph:n,resultOf:r})=>Br(e,[t],[],{resultOf:(i,{within:s})=>r(i,s),beforeParagraph:n,afterParagraph:()=>{}}),Am=class extends P{constructor(e={}){super("w:instrText"),E(this,"properties",void 0),this.properties=e,this.root.push(new Ut({space:Ht.PRESERVE}));let t="TOC";if(this.properties.captionLabel&&(t=`${t} \\a "${this.properties.captionLabel}"`),this.properties.entriesFromBookmark&&(t=`${t} \\b "${this.properties.entriesFromBookmark}"`),this.properties.captionLabelIncludingNumbers&&(t=`${t} \\c "${this.properties.captionLabelIncludingNumbers}"`),this.properties.sequenceAndPageNumbersSeparator&&(t=`${t} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`),this.properties.tcFieldIdentifier&&(t=`${t} \\f "${this.properties.tcFieldIdentifier}"`),this.properties.hyperlink&&(t=`${t} \\h`),this.properties.tcFieldLevelRange&&(t=`${t} \\l "${this.properties.tcFieldLevelRange}"`),this.properties.pageNumbersEntryLevelsRange&&(t=`${t} \\n "${this.properties.pageNumbersEntryLevelsRange}"`),this.properties.headingStyleRange&&(t=`${t} \\o "${this.properties.headingStyleRange}"`),this.properties.entryAndPageNumberSeparator&&(t=`${t} \\p "${this.properties.entryAndPageNumberSeparator}"`),this.properties.seqFieldIdentifierForPrefix&&(t=`${t} \\s "${this.properties.seqFieldIdentifierForPrefix}"`),this.properties.stylesWithLevels&&this.properties.stylesWithLevels.length){let n=this.properties.stylesWithLevels.map(r=>`${r.styleName},${r.level}`).join(",");t=`${t} \\t "${n}"`}this.properties.useAppliedParagraphOutlineLevel&&(t=`${t} \\u`),this.properties.preserveTabInEntries&&(t=`${t} \\w`),this.properties.preserveNewLineInEntries&&(t=`${t} \\x`),this.properties.hideTabAndPageNumbersInWebView&&(t=`${t} \\z`),this.root.push(t)}},_m=class extends P{constructor(){super("w:sdtContent")}},Nm=e=>e===void 0?fm():_r(e),cc=new WeakMap,$k=(e,t)=>{cc.set(e,t)},Fk=class{constructor(){E(this,"ids",[])}get(e){var t,n;return(n=(t=this.ids)[e])!==null&&n!==void 0||(t[e]=gm()),this.ids[e]}},ct=e=>typeof e=="object"&&e!==null?Object.keys(e)[0]:void 0,dt=e=>{let t=ct(e),n=t===void 0?void 0:e[t];return Array.isArray(n)?n:n===void 0?[]:[n]},Je=(e,t)=>dt(e).find(n=>ct(n)===t),$e=(e,t)=>{var n;return(n=Je(e,"_attr"))===null||n===void 0||(n=n._attr)===null||n===void 0?void 0:n[t]},dc=(e,t)=>{let n=$e(e,t);return n===void 0?void 0:Number(n)},qk=new Set(["w:tbl","w:tr","w:tc","w:sdt","w:sdtContent","w:customXml"]),Pm=e=>e.flatMap(t=>{let n=ct(t);return n==="w:p"||cc.has(t)?[t]:n!==void 0&&qk.has(n)?Pm(dt(t)):[]}),Hk=new Set(["w:r","w:hyperlink","w:ins","w:moveTo","w:smartTag","w:customXml","w:sdt","w:sdtContent","w:fldSimple","w:dir","w:bdo"]),Uk=e=>{switch(ct(e)){case"w:t":return dt(e).filter(t=>typeof t=="string").join("");case"w:tab":return" ";case"w:br":return[void 0,"textWrapping"].includes($e(e,"w:type"))?`
4279
5335
  `:"";case"w:cr":return`
4280
- `;case"w:noBreakHyphen":return"-";default:return""}},t1=e=>{let t=[],n=r=>{let i=nt(r);if(i!==void 0&&Zx.has(i))return rt(r).map(n).join("");if(i==="w:fldChar"){let s=Me(r,"w:fldCharType");return s==="begin"?t.push(!1):s==="separate"?t[t.length-1]=!0:t.pop(),""}return t.every(Boolean)?e1(r):""};return rt(e).map(n).join("")},df=e=>{let t=nt(e);return t==="w:bookmarkStart"?[{start:!0,id:Me(e,"w:id"),name:Me(e,"w:name")}]:t==="w:bookmarkEnd"?[{start:!1,id:Me(e,"w:id")}]:t===void 0||t==="_attr"?[]:rt(e).flatMap(df)},n1=e=>{let t=new Map;return e.map(n=>{let r=df(n),i=new Set([...t.values(),...r.flatMap(s=>s.start?[s.name]:[])]);for(let s of r)s.start?t.set(s.id,s.name):t.delete(s.id);return i})},r1=(e,t)=>{let n=t?n1(e):[];return e.map((r,i)=>{var s;let a=Ke(r,"w:pPr");return{element:r,styleId:Me(Ke(a,"w:pStyle"),"w:val"),outlineLevel:zl(Ke(a,"w:outlineLvl"),"w:val"),text:t1(r),bookmarks:(s=n[i])!==null&&s!==void 0?s:new Set}})},pf=e=>{var t;let n=(t=e.file)===null||t===void 0||(t=t.Styles)===null||t===void 0?void 0:t.prepForXml(e);return new Map(rt(n).filter(r=>nt(r)==="w:style"&&["paragraph",void 0].includes(Me(r,"w:type"))).map(r=>[Me(r,"w:styleId"),{name:Me(Ke(r,"w:name"),"w:val"),basedOn:Me(Ke(r,"w:basedOn"),"w:val"),outlineLevel:zl(Ke(Ke(r,"w:pPr"),"w:outlineLvl"),"w:val")}]))},uf=e=>{let t=/^\s*(\d+)\s*-\s*(\d+)\s*$/.exec(e);return t?[Number(t[1]),Number(t[2])]:void 0},fl=(e,[t,n])=>e>=t&&e<=n,Vl=(e,t)=>{var n,r;if(e===void 0)return;let i=/^heading ?([1-9])$/i.exec((n=(r=t.get(e))===null||r===void 0?void 0:r.name)!==null&&n!==void 0?n:e);return i?Number(i[1]):void 0},hf=(e,t,n=0)=>{var r;if(e===void 0||n>t.size)return;let i=t.get(e),s=Vl(e,t);return(r=i?.outlineLevel)!==null&&r!==void 0?r:s===void 0?hf(i?.basedOn,t,n+1):s-1},i1=e=>{let t=pf(e);return n=>{let r=Ke(n,"w:pPr"),i=Me(Ke(r,"w:pStyle"),"w:val"),s=Vl(i,t),a=ff({styleId:i,outlineLevel:zl(Ke(r,"w:outlineLvl"),"w:val")},t),o=a===void 0||a>=9?void 0:a+1;return s!==void 0&&(o===void 0||o===s)?s:o===void 0?void 0:"unclear"}},ff=(e,t)=>{var n;return(n=e.outlineLevel)!==null&&n!==void 0?n:hf(e.styleId,t)},s1=(e,t,n)=>{var r;let{entriesFromBookmark:i,headingStyleRange:s,stylesWithLevels:a=[],useAppliedParagraphOutlineLevel:o}=e;if(t.text.trim()===""||i&&!t.bookmarks.has(i))return;let l=[t.styleId,t.styleId===void 0||(r=n.get(t.styleId))===null||r===void 0?void 0:r.name].filter(m=>m!==void 0).map(m=>m.toLowerCase()),c=a.find(m=>l.includes(m.styleName.toLowerCase()));if(c)return c.level;let d=!!s||a.length>0||!!o||!!e.tcFieldIdentifier||!!e.tcFieldLevelRange||!!e.captionLabel||!!e.captionLabelIncludingNumbers,p=s?uf(s):d?void 0:[1,9],u=Vl(t.styleId,n);if(p&&u!==void 0&&fl(u,p))return u;let f=o?ff(t,n):void 0;return f!==void 0&&fl(f+1,p??[1,9])?f+1:void 0},a1=(e,t)=>{let n=t.preserveTabInEntries?e:e.replace(/\t/g," ");return(t.preserveNewLineInEntries?n.split(`
4281
- `):[n.replace(/\n/g," ")]).map((r,i)=>new Ie({break:i>0?1:void 0,children:r.split(" ").flatMap((s,a)=>[...a>0?[new Ls]:[],...s===""?[]:[s]])}))},o1=({text:e,separator:t})=>t==="tab"?[new Ie(e),new Ie({children:[new Ls]})]:[new Ie(`${e} `)],l1=(e,t)=>{let n=240*(e-1)+t+240;return n<=1920?Math.ceil(n/240)*240:Math.round(n)},c1=(e,t)=>{var n,r;return(n=(r=[...t].find(([,i])=>{var s;return((s=i.name)===null||s===void 0?void 0:s.toLowerCase())===`toc ${e}`}))===null||r===void 0?void 0:r[0])!==null&&n!==void 0?n:`TOC${e}`},d1=({properties:e,beginDirty:t,textWidth:n,tabLeader:r},i,s,a)=>{var o;let l=e.pageNumbersEntryLevelsRange?(o=uf(e.pageNumbersEntryLevelsRange))!==null&&o!==void 0?o:[1,9]:void 0,c=new of;return i.forEach((d,p)=>{var u;let f=l===void 0||!fl(d.level,l),m=[...d.listNumber?o1(d.listNumber):[],...a1(d.title,e),...f?[new Ie({children:[e.entryAndPageNumberSeparator||new Ls]}),new X1(d.bookmark,{hyperlink:e.hyperlink})]:[]];c.addChildElement(new J({style:c1(d.level,s),tabStops:[...((u=d.listNumber)===null||u===void 0?void 0:u.separator)==="tab"?[{type:"left",position:l1(d.level,d.listNumber.width)}]:[],{type:"right",position:n,leader:r}],children:[...p===0?[new Be({children:[lf(t),new af(e),Jt()]})]:[],...e.hyperlink?[new vf({anchor:d.bookmark,children:m})]:m]}))}),c.addChildElement(new J({children:[new Be({children:[Qt()]})]})),c.prepForXml(a)},p1=(e,t,n,r)=>{let i=rt(e),s=i.findIndex(a=>nt(a)==="w:pPr")+1;e["w:p"]=[...i.slice(0,s),new xf(t,n).prepForXml(r),...i.slice(s),new kf(n).prepForXml(r)]},u1=(e,t,n,r)=>{let i=cf(rt(e)),s=i.flatMap(d=>{let p=Gl.get(d);return p?[[d,p]]:[]});if(s.length===0)return;let a=pf(t),o=s.some(([,{properties:d}])=>!!d.entriesFromBookmark),l=r1(i.filter(d=>nt(d)==="w:p"),o).map(d=>({paragraph:d,levels:s.map(([,{properties:p}])=>s1(p,d,a))})).filter(({levels:d})=>d.some(p=>p!==void 0)).map((d,p)=>k(k({},d),{},{id:n.get(p)}));for(let{paragraph:d,id:p}of l)p1(d.element,`_Toc${p}`,p,t);let c=l.length>0?r?.(e):void 0;s.forEach(([d,p],u)=>{let f=l.flatMap(({paragraph:m,levels:h,id:g})=>{let v=h[u],w=c?.get(`_Toc${g}`);return v===void 0?[]:[k({title:m.text,level:v,bookmark:`_Toc${g}`},w?{listNumber:w}:{})]});f.length!==0&&(d["w:sdt"]=rt(d).map(m=>nt(m)==="w:sdtContent"?d1(p,f,a,t):m))})},h1=new RegExp("^\\p{L}[\\p{L}\\p{N}_]*$","u"),f1=e=>{var t,n;let r,i=!1,s,a=!1,o=!1;for(let p=0;p<e.length;p++){var l,c;let u=e[p],f=(l=e[p+1])!==null&&l!==void 0?l:"",m;if(p===0&&!u.startsWith("\\"))m={type:"bookmark"};else if(u==="\\c"||u==="\\n")m={type:u==="\\c"?"repeat":"next"};else if((u==="\\r"||u==="\\s")&&/^\d+$/.test(f))p++,m=u==="\\r"?{type:"reset",to:Number(f)}:{type:"heading",level:Number(f)};else if(u==="\\h")i=!0;else if(u==="\\#"&&p+1<e.length)p++,o=!0;else if(u==="\\*"&&p+1<e.length){let h=e[++p];if(ef.has(h.toLowerCase()))a=!0;else if(!Zh.has(h.toLowerCase())){if(s!==void 0)return;s=h}}else return;if(m&&r)return;r=(c=m)!==null&&c!==void 0?c:r}if(r?.type==="bookmark"&&e.length>1)return;let d=!o&&!(a&&s!==void 0&&s.toLowerCase()!=="arabic");return{step:(t=r)!==null&&t!==void 0?t:{type:"next"},hidden:i&&s===void 0,format:d?(n=s)!==null&&n!==void 0?n:"ARABIC":""}},Xl=e=>{var t;let n=new RegExp("^\\s*SEQ\\b(.*)$","is").exec(e);if(!n)return;let[r,...i]=(t=n[1].match(/"[^"]*"|\S+/g))!==null&&t!==void 0?t:[];if(r===void 0)return{};let s=r.replace(/^"(.*)"$/,"$1");return h1.test(s)?{identifier:s,sequence:f1(i)}:{identifier:s}},m1=e=>Xl(e)!==void 0,ml=e=>typeof e!="object"||e===null?[]:Array.isArray(e)?e.flatMap(ml):Object.entries(e).flatMap(([t,n])=>[...(t==="w:instrText"&&Array.isArray(n)?n:t==="_attr"?[n["w:instr"]]:[]).flatMap(r=>{let i=typeof r=="string"?Xl(r):void 0;return i?.identifier===void 0?[]:[i.identifier.toLowerCase()]}),...ml(n)]),g1=e=>{var t;let n=(t=e.file)===null||t===void 0?void 0:t.Comments;if(!n)return new Set;let r={View:n,Relationships:n.Relationships};return new Set(ml(n.prepForXml(k(k({},e),{},{viewWrapper:r,stack:[]}))))},b1=e=>{let t=i1(e),n=new Map,r=new Map,i=[],s=-1,a=-1,o,l=(c,d)=>{var p;let u=Math.max(-1,...i.slice(1,d+1).filter(h=>h!==void 0)),f=((p=r.get(c))!==null&&p!==void 0?p:[]).filter(h=>h.paragraph>=u),m=f.every(({step:h})=>h?.type==="next"||h?.type==="heading"&&h.level===d);return s>u||!m?void 0:f.length+1};return{startParagraph:c=>{a++;let d=t(c);d==="unclear"?s=a:d!==void 0&&(i[d]=a)},numberOf:(c,d)=>{var p,u,f;let{identifier:m,sequence:h}=Xl(c);if(m===void 0||d==="fallback")return;(p=o)!==null&&p!==void 0||(o=g1(e));let g=m.toLowerCase();if(h?.step.type==="bookmark"&&d==="counted"&&!o.has(g))return;let v=n.has(g)?n.get(g):0,w=o.has(g)||d==="deleted"?void 0:h?.step,b=w?.type==="reset"?w.to:w?.type==="repeat"?v:w?.type==="heading"?l(g,w.level):w?.type==="next"&&v!==void 0?v+1:void 0;return n.set(g,b),r.set(g,[...(u=r.get(g))!==null&&u!==void 0?u:[],k({paragraph:a},b===void 0?{}:{step:w})]),b===void 0||h===void 0?void 0:h.hidden?"":(f=Kl(h.format))===null||f===void 0?void 0:f(b)}}},qo=e=>{let t=typeof e=="object"&&e!==null&&!Array.isArray(e)?Object.keys(e)[0]:void 0;return t==="_attr"?void 0:t},Lu=e=>({"w:t":[{_attr:{"xml:space":"preserve"}},e]}),Os={nameOf:qo,contentOf:e=>{let t=e[qo(e)];return Array.isArray(t)?t:void 0},attributeOf:(e,t)=>{var n;let r=e[qo(e)],i=Array.isArray(r)?r.find(s=>typeof s=="object"&&s!==null&&"_attr"in s):r;return i==null||(n=i._attr)===null||n===void 0?void 0:n[t]},textOf:e=>Os.contentOf(e).filter(t=>typeof t=="string").join(""),textElement:Lu,writeClean:e=>{if(Yy(e)){let t=e["w:fldChar"]._attr;e["w:fldChar"]={_attr:Object.fromEntries(Object.entries(t).filter(([n])=>n!=="w:dirty"))}}},setSimpleFieldResult:(e,t)=>{let n=e["w:fldSimple"];e["w:fldSimple"]=[...(Array.isArray(n)?n:[n]).filter(r=>typeof r=="object"&&r!==null&&"_attr"in r),{"w:r":[Lu(t)]}]}},mf=new WeakMap,v1=(e,t)=>{let{startParagraph:n,numberOf:r}=b1(t);Xx(Os,e,{beforeParagraph:i=>n(i),resultOf:(i,s)=>m1(i)?r(i,s):void 0})},w1=(e,t,n)=>{let r=n(e,t),i=rf(Os,e,r,{blank:!1});t.file&&mf.set(t.file,{estimate:r,partPageCounts:i})},Rr=(e,t,n)=>{let r=t.file&&mf.get(t.file);if(!e||!r)return;let i=n===void 0?void 0:r.partPageCounts.get(`rId${n}`),s="w:footnotes"in e||"w:endnotes"in e;sf(Os,e,r.estimate,{blank:!1,sectionPageCount:i,notes:s})},y1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{xmlns:"xmlns"})}},ge=class gf extends I{constructor(){super("Relationships"),this.root.push(new y1({xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}))}addRelationship(t,n,r,i){this.root.push(Lx(`rId${t}`,n,r,i))}static copy(t){let n=new gf;return n.root.push(...t.root.slice(1)),n}get RelationshipCount(){return this.root.length-1}},x1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{id:"w:id",initials:"w:initials",author:"w:author",date:"w:date"})}},k1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:cx":"xmlns:cx","xmlns:cx1":"xmlns:cx1","xmlns:cx2":"xmlns:cx2","xmlns:cx3":"xmlns:cx3","xmlns:cx4":"xmlns:cx4","xmlns:cx5":"xmlns:cx5","xmlns:cx6":"xmlns:cx6","xmlns:cx7":"xmlns:cx7","xmlns:cx8":"xmlns:cx8","xmlns:mc":"xmlns:mc","xmlns:aink":"xmlns:aink","xmlns:am3d":"xmlns:am3d","xmlns:o":"xmlns:o","xmlns:r":"xmlns:r","xmlns:m":"xmlns:m","xmlns:v":"xmlns:v","xmlns:wp14":"xmlns:wp14","xmlns:wp":"xmlns:wp","xmlns:w10":"xmlns:w10","xmlns:w":"xmlns:w","xmlns:w14":"xmlns:w14","xmlns:w15":"xmlns:w15","xmlns:w16cex":"xmlns:w16cex","xmlns:w16cid":"xmlns:w16cid","xmlns:w16":"xmlns:w16","xmlns:w16sdtdh":"xmlns:w16sdtdh","xmlns:w16se":"xmlns:w16se","xmlns:wpg":"xmlns:wpg","xmlns:wpi":"xmlns:wpi","xmlns:wne":"xmlns:wne","xmlns:wps":"xmlns:wps","mc:Ignorable":"mc:Ignorable"})}},Ru=class extends I{constructor({id:e,initials:t,author:n,date:r=new Date,children:i},s){super("w:comment"),S(this,"paraId",void 0),this.paraId=s,this.root.push(new x1({id:e,initials:t,author:n,date:r.toISOString()}));for(let a of i)this.root.push(a)}prepForXml(e){let t=super.prepForXml(e);if(!t||!this.paraId)return t;let n=t["w:comment"];if(!Array.isArray(n))return t;for(let r=n.length-1;r>=0;r--){let i=n[r];if(i&&typeof i=="object"&&"w:p"in i){let s=i["w:p"];Array.isArray(s)&&s.unshift({_attr:{"w14:paraId":this.paraId,"w14:textId":this.paraId}});break}}return t}},T1=e=>(e+1).toString(16).toUpperCase().padStart(8,"0"),S1=class extends I{constructor({children:e}){super("w:comments"),S(this,"relationships",void 0),S(this,"threadData",void 0),S(this,"commentIdsData",void 0),S(this,"isEmpty",void 0),this.isEmpty=e.length===0,this.root.push(new k1({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 wp14"}));let t=e.some(r=>r.parentId!==void 0),n=e.some(r=>r.durableId!==void 0);if(t||n){let r=new Map(e.map(i=>[i.id,T1(i.id)]));for(let i of e)this.root.push(new Ru(i,r.get(i.id)));t&&(this.threadData=e.map(i=>({paraId:r.get(i.id),parentParaId:i.parentId!==void 0?r.get(i.parentId):void 0,done:i.resolved}))),n&&(this.commentIdsData=e.map(i=>{var s;return{paraId:r.get(i.id),durableId:(s=i.durableId)!==null&&s!==void 0?s:r.get(i.id)}}))}else for(let r of e)this.root.push(new Ru(r));this.relationships=new ge}get Relationships(){return this.relationships}get ThreadData(){return this.threadData}get CommentIdsData(){return this.commentIdsData}get IsEmpty(){return this.isEmpty}prepForXml(e){let t=super.prepForXml(e);return Rr(t,e),t}},E1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:mc":"xmlns:mc","xmlns:w15":"xmlns:w15","mc:Ignorable":"mc:Ignorable"})}},C1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{paraId:"w15:paraId",paraIdParent:"w15:paraIdParent",done:"w15:done"})}},_1=class extends I{constructor(e){super("w15:commentEx"),this.root.push(new C1({paraId:e.paraId,paraIdParent:e.parentParaId,done:e.done!==void 0?e.done?"1":"0":void 0}))}},A1=class extends I{constructor(e){super("w15:commentsEx"),this.root.push(new E1({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","mc:Ignorable":"w15"}));for(let t of e)this.root.push(new _1(t))}},N1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{paraId:"w16cid:paraId",durableId:"w16cid:durableId"})}},I1=class extends I{constructor(e){super("w16cid:commentId"),this.root.push(new N1({paraId:e.paraId,durableId:e.durableId}))}},P1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{"xmlns:w16cid":"xmlns:w16cid","xmlns:mc":"xmlns:mc","mc:Ignorable":"mc:Ignorable"})}},O1=class extends I{constructor(e){super("w16cid:commentsIds"),this.root.push(new P1({"xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","mc:Ignorable":"w16cid"}));for(let t of e)this.root.push(new I1(t))}},L1=class extends Uh{constructor(){super("w:endnoteRef")}},Ls=class extends Uh{constructor(){super("w:tab")}},R1={COLUMN:"column",PAGE:"page"},M1=class extends I{constructor(e){super("w:br"),this.root.push(new Ce({type:e}))}},bf=class extends Be{constructor(){super({}),this.root.push(new M1(R1.PAGE))}},D1=class extends I{constructor(){super("w:pageBreakBefore")}},Tn={AT_LEAST:"atLeast",EXACTLY:"exactly",EXACT:"exact",AUTO:"auto"},B1=({after:e,before:t,line:n,lineRule:r,beforeAutoSpacing:i,afterAutoSpacing:s})=>new O({name:"w:spacing",attributes:{after:{key:"w:after",value:e},before:{key:"w:before",value:t},line:{key:"w:line",value:n},lineRule:{key:"w:lineRule",value:r},beforeAutoSpacing:{key:"w:beforeAutospacing",value:i},afterAutoSpacing:{key:"w:afterAutospacing",value:s}}}),Rs={HEADING_1:"Heading1",HEADING_2:"Heading2",HEADING_3:"Heading3",HEADING_4:"Heading4",HEADING_5:"Heading5",HEADING_6:"Heading6",TITLE:"Title"},gr=e=>new O({name:"w:pStyle",attributes:{val:{key:"w:val",value:e}}}),Mu={LEFT:"left",RIGHT:"right",CENTER:"center",BAR:"bar",CLEAR:"clear",DECIMAL:"decimal",END:"end",NUM:"num",START:"start"},$1={DOT:"dot",HYPHEN:"hyphen",MIDDLE_DOT:"middleDot",NONE:"none",UNDERSCORE:"underscore"},F1=({type:e,position:t,leader:n})=>new O({name:"w:tab",attributes:{val:{key:"w:val",value:e},pos:{key:"w:pos",value:Ze(t)},leader:{key:"w:leader",value:n}}}),H1=e=>new O({name:"w:tabs",children:e.map(t=>F1(t))}),os=class extends I{constructor(e,t){super("w:numPr"),this.root.push(new U1(t)),this.root.push(new q1(e))}},U1=class extends I{constructor(e){if(super("w:ilvl"),e>9)throw new Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new Ce({val:e}))}},q1=class extends I{constructor(e){super("w:numId"),this.root.push(new Ce({val:typeof e=="string"?`{${e}}`:e}))}},Yl=class extends I{constructor(...e){super(...e),S(this,"fileChild",Symbol())}},W1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{id:"r:id",history:"w:history",anchor:"w:anchor"})}},Jl=class extends I{constructor(e,t,n,r){super("w:hyperlink"),S(this,"linkId",void 0),S(this,"drawingLink",void 0),this.linkId=t,this.drawingLink=n&&r!==void 0?new Rx(r):void 0;let i=new W1({history:1,anchor:n||void 0,id:!n||r!==void 0?`rId${this.linkId}`:void 0});this.root.push(i),e.forEach(s=>{this.root.push(s)})}createDrawingClick(e,t){return this.drawingLink?(this.drawingLink.addRelationship(e),this.drawingLink.createClick(t)):Qh(this.linkId,t)}},vf=class extends Jl{constructor(e){super(e.children,Cn(),e.anchor)}},j1=class extends I{constructor(e){super("w:externalHyperlink"),S(this,"options",void 0),this.options=e}},K1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{id:"w:id",name:"w:name"})}},G1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{id:"w:id"})}},wf=class yf{constructor(t){S(this,"start",void 0),S(this,"children",void 0),S(this,"end",void 0);let n=Vh();this.start=new xf(t.id,n),this.children=t.children,this.end=new kf(n)}get writtenAs(){return[this.start,...this.children.flatMap(t=>t instanceof yf?t.writtenAs:[t]),this.end]}},xf=class extends I{constructor(e,t){super("w:bookmarkStart");let n=new K1({name:e,id:t});this.root.push(n)}},kf=class extends I{constructor(e){super("w:bookmarkEnd");let t=new G1({id:e});this.root.push(t)}},z1=e=>new O({name:"w:outlineLvl",attributes:{val:{key:"w:val",value:e}}}),V1=class extends I{constructor(e,t={}){super("w:instrText"),this.root.push(new Rt({space:Lt.PRESERVE}));let n=`PAGEREF ${e}`;t.hyperlink&&(n=`${n} \\h`),t.useRelativePosition&&(n=`${n} \\p`),this.root.push(n)}},X1=class extends Be{constructor(e,t={}){super({children:[zh(),new V1(e,t),Jt(),Qt()]})}},Y1=255,Tf=e=>{let t=e.indexOf("#"),n=e.length-t-1;return t>0&&n>0&&n<=Y1?{target:e.slice(0,t),anchor:e.slice(t+1)}:{target:e}},xs=(e,t,n)=>n===void 0?`${e}-${t}`:`${e}-restart ${n}`,ls=({id:e,fontKey:t,subsetted:n},r)=>new O({name:r,attributes:k({id:{key:"r:id",value:e}},t?{fontKey:{key:"w:fontKey",value:`{${t.toUpperCase()}}`}}:{}),children:[...n?[new P("w:subsetted",n)]:[]]}),J1=({name:e,altName:t,panose1:n,charset:r,family:i,notTrueType:s,pitch:a,sig:o,embedRegular:l,embedBold:c,embedItalic:d,embedBoldItalic:p})=>new O({name:"w:font",attributes:{name:{key:"w:name",value:e}},children:[...t?[cr("w:altName",t)]:[],...n?[cr("w:panose1",n)]:[],...r?[cr("w:charset",r)]:[],...i?[cr("w:family",i)]:[],...s?[new P("w:notTrueType",s)]:[],...a?[cr("w:pitch",a)]:[],...o?[new O({name:"w:sig",attributes:{usb0:{key:"w:usb0",value:o.usb0},usb1:{key:"w:usb1",value:o.usb1},usb2:{key:"w:usb2",value:o.usb2},usb3:{key:"w:usb3",value:o.usb3},csb0:{key:"w:csb0",value:o.csb0},csb1:{key:"w:csb1",value:o.csb1}}})]:[],...l?[ls(l,"w:embedRegular")]:[],...c?[ls(c,"w:embedBold")]:[],...d?[ls(d,"w:embedItalic")]:[],...p?[ls(p,"w:embedBoldItalic")]:[]]}),Q1=({name:e,characterSet:t,embedRegular:n,embedBold:r,embedItalic:i,embedBoldItalic:s})=>J1({name:e,sig:{usb0:"E0002AFF",usb1:"C000247B",usb2:"00000009",usb3:"00000000",csb0:"000001FF",csb1:"00000000"},charset:t,family:"auto",pitch:"variable",embedRegular:n,embedBold:r,embedItalic:i,embedBoldItalic:s}),Z1=e=>new O({name:"w:fonts",attributes:{mc:{key:"xmlns:mc",value:"http://schemas.openxmlformats.org/markup-compatibility/2006"},r:{key:"xmlns:r",value:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"},w:{key:"xmlns:w",value:"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},w14:{key:"xmlns:w14",value:"http://schemas.microsoft.com/office/word/2010/wordml"},w15:{key:"xmlns:w15",value:"http://schemas.microsoft.com/office/word/2012/wordml"},w16cex:{key:"xmlns:w16cex",value:"http://schemas.microsoft.com/office/word/2018/wordml/cex"},w16cid:{key:"xmlns:w16cid",value:"http://schemas.microsoft.com/office/word/2016/wordml/cid"},w16:{key:"xmlns:w16",value:"http://schemas.microsoft.com/office/word/2018/wordml"},w16sdtdh:{key:"xmlns:w16sdtdh",value:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash"},w16se:{key:"xmlns:w16se",value:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ignorable:{key:"mc:Ignorable",value:"w14 w15 w16se w16cid w16 w16cex w16sdtdh"}},children:e.map(Q1)}),ek=[{option:"data",element:"embedRegular",bold:!1,italic:!1},{option:"bold",element:"embedBold",bold:!0,italic:!1},{option:"italic",element:"embedItalic",bold:!1,italic:!0},{option:"boldItalic",element:"embedBoldItalic",bold:!0,italic:!0}],Sf=class{constructor(e){S(this,"options",void 0),S(this,"fontTable",void 0),S(this,"relationships",void 0),S(this,"fontOptionsWithKey",[]),S(this,"files",[]),this.options=e;let t=e.map(n=>ek.flatMap(({option:r,element:i,bold:s,italic:a})=>{let o=n[r];return o?[{element:i,file:{name:n.name,data:o,bold:s,italic:a,fontKey:Xh()}}]:[]}));this.files=t.flatMap(n=>n.map(({file:r})=>r)),this.fontOptionsWithKey=e.map((n,r)=>k(k({},n),{},{fontKey:t[r][0].file.fontKey})),this.fontTable=Z1(e.map((n,r)=>k({name:n.name,characterSet:n.characterSet},Object.fromEntries(t[r].map(({element:i,file:s})=>[i,{id:`rId${this.files.indexOf(s)+1}`,fontKey:s.fontKey}]))))),this.relationships=new ge;for(let n=0;n<this.files.length;n++)this.relationships.addRelationship(n+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",`fonts/font${n+1}.odttf`)}get View(){return this.fontTable}get Relationships(){return this.relationships}},tk=()=>new O({name:"w:wordWrap",attributes:{val:{key:"w:val",value:0}}}),nk=e=>{var t,n;return new O({name:"w:framePr",attributes:{anchorLock:{key:"w:anchorLock",value:e.anchorLock},dropCap:{key:"w:dropCap",value:e.dropCap},width:{key:"w:w",value:e.width},height:{key:"w:h",value:e.height},x:{key:"w:x",value:e.position?e.position.x:void 0},y:{key:"w:y",value:e.position?e.position.y:void 0},anchorHorizontal:{key:"w:hAnchor",value:e.anchor.horizontal},anchorVertical:{key:"w:vAnchor",value:e.anchor.vertical},spaceHorizontal:{key:"w:hSpace",value:(t=e.space)===null||t===void 0?void 0:t.horizontal},spaceVertical:{key:"w:vSpace",value:(n=e.space)===null||n===void 0?void 0:n.vertical},rule:{key:"w:hRule",value:e.rule},alignmentX:{key:"w:xAlign",value:e.alignment?e.alignment.x:void 0},alignmentY:{key:"w:yAlign",value:e.alignment?e.alignment.y:void 0},lines:{key:"w:lines",value:e.lines},wrap:{key:"w:wrap",value:e.wrap}}})},Wo=new WeakMap,rk=En(),ik={left:"right",right:"left"},Sn=class extends mt{constructor(e,{implicitListParagraphStyle:t=!0,inListOrder:n=!0}={}){if(super("w:pPr",e?.includeIfEmpty),S(this,"numbering",void 0),S(this,"numberProperties",void 0),!e)return this;if(e.heading&&this.push(gr(e.heading)),t&&(e.bullet&&this.push(gr("ListParagraph")),e.numbering&&!e.numbering.custom&&!e.style&&!e.heading&&this.push(gr("ListParagraph"))),e.style&&this.push(gr(e.style)),e.keepNext!==void 0&&this.push(new P("w:keepNext",e.keepNext)),e.keepLines!==void 0&&this.push(new P("w:keepLines",e.keepLines)),e.pageBreakBefore&&this.push(new D1),e.frame&&this.push(nk(e.frame)),e.widowControl!==void 0&&this.push(new P("w:widowControl",e.widowControl)),e.bullet&&this.push(new os(1,e.bullet.level)),e.numbering){let{reference:i,instance:s,level:a,restart:o}=e.numbering,l=typeof i=="string"?i:i.reference,c=new os(xs(l,s??0),a);this.numbering={reference:l,level:a,instance:s,restartedListId:o&&n&&s===void 0?rk():void 0,definition:typeof i=="string"?void 0:i},this.numberProperties=c,this.push(c)}else e.numbering===!1&&this.push(new os(0,0));e.border&&this.push(new Ky(e.border)),e.thematicBreak&&this.push(new Gy),e.shading&&this.push(Ps(e.shading)),e.wordWrap&&this.push(tk()),e.overflowPunctuation&&this.push(new P("w:overflowPunct",e.overflowPunctuation));let r=[...e.rightTabStop!==void 0?[{type:Mu.RIGHT,position:e.rightTabStop}]:[],...e.tabStops?e.tabStops:[],...e.leftTabStop!==void 0?[{type:Mu.LEFT,position:e.leftTabStop}]:[]];r.length>0&&this.push(H1(r)),e.bidirectional!==void 0&&this.push(new P("w:bidi",e.bidirectional)),e.spacing&&this.push(B1(e.spacing)),e.indent&&this.push(zy(e.indent)),e.contextualSpacing!==void 0&&this.push(new P("w:contextualSpacing",e.contextualSpacing)),e.alignment&&this.push(qh(e.bidirectional&&ik[e.alignment]||e.alignment)),e.outlineLevel!==void 0&&this.push(z1(e.outlineLevel)),e.suppressLineNumbers!==void 0&&this.push(new P("w:suppressLineNumbers",e.suppressLineNumbers)),e.autoSpaceEastAsianText!==void 0&&this.push(new P("w:autoSpaceDN",e.autoSpaceEastAsianText)),e.run&&this.push(new Ix(e.run)),e.revision&&this.push(new Du(e.revision))}push(e){this.root.push(e)}addSectionProperties(e){let t=this.root.findIndex(n=>n instanceof Du);if(t===-1){this.root.push(e);return}this.root.splice(t,0,e)}removeSectionProperties(e){let t=this.root.indexOf(e);t!==-1&&this.root.splice(t,1)}prepForXml(e){var t;if(this.numbering){var n,r;let{reference:a,level:o,instance:l=0,definition:c}=this.numbering,d=this.numbering.instance===void 0?(n=this.numbering.restartedListId)!==null&&n!==void 0?n:(r=Wo.get(e))===null||r===void 0?void 0:r.get(a):void 0;e.viewWrapper instanceof Sf||e.file.Numbering.createConcreteNumberingInstance(a,l,c,d);let p=new os(xs(a,l,d),o);this.root.splice(this.root.indexOf(this.numberProperties),1,p),this.numberProperties=p}let i=super.prepForXml(e);if(((t=this.numbering)===null||t===void 0?void 0:t.restartedListId)!==void 0){var s;Wo.set(e,new Map([...(s=Wo.get(e))!==null&&s!==void 0?s:[],[this.numbering.reference,this.numbering.restartedListId]]))}return i}},Du=class extends I{constructor(e){super("w:pPrChange"),this.root.push(new $e({id:e.id,author:e.author,date:e.date})),this.root.push(new Sn(k(k({},e),{},{includeIfEmpty:!0}),{inListOrder:!1}))}},J=class Ef extends Yl{constructor(t){if(super("w:p"),S(this,"options",void 0),S(this,"properties",void 0),S(this,"alignment",void 0),this.options=typeof t=="string"?{text:t}:t,typeof t=="string")return this.alignment={},this.properties=new Sn({}),this.root.push(this.properties),this.root.push(new Ie(t)),this;if(this.alignment={alignment:t.alignment,bidirectional:t.bidirectional},this.properties=new Sn(t),this.root.push(this.properties),t.text&&this.root.push(new Ie(t.text)),t.children)for(let n of t.children){if(n instanceof wf){this.root.push(...n.writtenAs);continue}this.root.push(n)}}prepForXml(t){for(let n of this.root)if(As(n)==="w:externalHyperlink"){let r=this.root.indexOf(n),{options:i}=n,{target:s,anchor:a}=Tf(i.link),o=new Jl(i.children,Cn(),a,i.link);t.viewWrapper.Relationships.addRelationship(o.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",s,jl.EXTERNAL),this.root[r]=o}return super.prepForXml(t)}addSectionProperties(t){this.properties.addSectionProperties(t)}removeSectionProperties(t){this.properties.removeSectionProperties(t)}get Alignment(){return this.alignment}with(t){return new Ef(k(k({},this.options),t))}addRunToFront(t){return this.root.splice(1,0,t),this}},sk={TOP:"top",CENTER:"center",BOTTOM:"bottom"},MN=k(k({},sk),{},{BOTH:"both"}),Cf=e=>new O({name:"w:vAlign",attributes:{verticalAlign:{key:"w:val",value:e}}}),ak=({space:e,count:t,separate:n,equalWidth:r,children:i})=>new O({name:"w:cols",attributes:{space:{key:"w:space",value:e===void 0?void 0:be(e)},count:{key:"w:num",value:t===void 0?void 0:oe(t)},separate:{key:"w:sep",value:n},equalWidth:{key:"w:equalWidth",value:r}},children:!r&&i?i:void 0}),ok=({type:e,linePitch:t,charSpace:n})=>new O({name:"w:docGrid",attributes:{type:{key:"w:type",value:e},linePitch:{key:"w:linePitch",value:oe(t)},charSpace:{key:"w:charSpace",value:n?oe(n):void 0}}}),kn={DEFAULT:"default",FIRST:"first",EVEN:"even"},Bu={HEADER:"w:headerReference",FOOTER:"w:footerReference"},jo=(e,t)=>new O({name:e,attributes:{type:{key:"w:type",value:t.type||kn.DEFAULT},id:{key:"r:id",value:`rId${t.id}`}}}),lk=({countBy:e,start:t,restart:n,distance:r})=>new O({name:"w:lnNumType",attributes:{countBy:{key:"w:countBy",value:e===void 0?void 0:oe(e)},start:{key:"w:start",value:t===void 0?void 0:oe(t)},restart:{key:"w:restart",value:n},distance:{key:"w:distance",value:r===void 0?void 0:be(r)}}}),_f=({name:e,position:t,numberFormat:n,start:r,restart:i})=>new O({name:e,children:[...t===void 0?[]:[new O({name:"w:pos",attributes:{val:{key:"w:val",value:t}}})],...n?[new O({name:"w:numFmt",attributes:{val:{key:"w:val",value:n.type},format:{key:"w:format",value:n.format}}})]:[],...r===void 0?[]:[new O({name:"w:numStart",attributes:{val:{key:"w:val",value:oe(r)}}})],...i===void 0?[]:[new O({name:"w:numRestart",attributes:{val:{key:"w:val",value:i}}})]]}),ck=e=>_f(k({name:"w:footnotePr"},e)),dk=e=>_f(k({name:"w:endnotePr"},e)),$u=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{display:"w:display",offsetFrom:"w:offsetFrom",zOrder:"w:zOrder"})}},pk=class extends mt{constructor(e){if(super("w:pgBorders"),!e)return this;e.pageBorders?this.root.push(new $u({display:e.pageBorders.display,offsetFrom:e.pageBorders.offsetFrom,zOrder:e.pageBorders.zOrder})):this.root.push(new $u({})),e.pageBorderTop&&this.root.push(pe("w:top",e.pageBorderTop)),e.pageBorderLeft&&this.root.push(pe("w:left",e.pageBorderLeft)),e.pageBorderBottom&&this.root.push(pe("w:bottom",e.pageBorderBottom)),e.pageBorderRight&&this.root.push(pe("w:right",e.pageBorderRight))}},uk=(e,t,n,r,i,s,a)=>new O({name:"w:pgMar",attributes:{top:{key:"w:top",value:Ze(e)},right:{key:"w:right",value:be(t)},bottom:{key:"w:bottom",value:Ze(n)},left:{key:"w:left",value:be(r)},header:{key:"w:header",value:be(i)},footer:{key:"w:footer",value:be(s)},gutter:{key:"w:gutter",value:be(a)}}}),hk={HYPHEN:"hyphen",PERIOD:"period",COLON:"colon",EM_DASH:"emDash",EN_DASH:"endash"},fk=({start:e,formatType:t,separator:n,chapterHeadingLevel:r})=>new O({name:"w:pgNumType",attributes:{start:{key:"w:start",value:e===void 0?void 0:oe(e)},formatType:{key:"w:fmt",value:t},separator:{key:"w:chapSep",value:n===hk.EN_DASH?"enDash":n},chapterHeadingLevel:{key:"w:chapStyle",value:r===void 0?void 0:oe(r)}}}),ks={PORTRAIT:"portrait",LANDSCAPE:"landscape"},mk=({width:e,height:t,orientation:n,code:r})=>{let i=be(e),s=be(t);return new O({name:"w:pgSz",attributes:{width:{key:"w:w",value:n===ks.LANDSCAPE?s:i},height:{key:"w:h",value:n===ks.LANDSCAPE?i:s},orientation:{key:"w:orient",value:n},code:{key:"w:code",value:r}}})},gk=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{val:"w:val"})}},bk=class extends I{constructor(e){super("w:textDirection"),this.root.push(new gk({val:e}))}},vk=e=>new O({name:"w:type",attributes:{val:{key:"w:val",value:e}}}),Je={TOP:1440,RIGHT:1440,BOTTOM:1440,LEFT:1440,HEADER:708,FOOTER:708,GUTTER:0},hs={WIDTH:11906,HEIGHT:16838,ORIENTATION:ks.PORTRAIT},gl=class Af extends I{constructor({page:{size:{width:t=hs.WIDTH,height:n=hs.HEIGHT,orientation:r=hs.ORIENTATION,code:i}={},margin:{top:s=Je.TOP,right:a=Je.RIGHT,bottom:o=Je.BOTTOM,left:l=Je.LEFT,header:c=Je.HEADER,footer:d=Je.FOOTER,gutter:p=Je.GUTTER}={},pageNumbers:u={},borders:f,textDirection:m}={},grid:{linePitch:h=360,charSpace:g,type:v}={},headerWrapperGroup:w={},footerWrapperGroup:b={},lineNumbers:C,titlePage:A,verticalAlign:y,column:T,type:x,footnoteProperties:_,endnoteProperties:N,revision:M}={}){super("w:sectPr"),S(this,"availableTextWidth",void 0),this.availableTextWidth=Af.calculateAvailableTextWidth({pageWidth:r===ks.LANDSCAPE?n:t,left:l,right:a,gutter:p,column:T}),this.addHeaderFooterGroup(Bu.HEADER,w),this.addHeaderFooterGroup(Bu.FOOTER,b),_&&this.root.push(ck(_)),N&&this.root.push(dk(N)),x&&this.root.push(vk(x)),this.root.push(mk({width:t,height:n,orientation:r,code:i})),this.root.push(uk(s,a,o,l,c,d,p)),f&&this.root.push(new pk(f)),C&&this.root.push(lk(C)),this.root.push(fk(u)),T&&this.root.push(ak(T)),y&&this.root.push(Cf(y)),A!==void 0&&this.root.push(new P("w:titlePg",A)),m&&this.root.push(new bk(m)),this.root.push(ok({linePitch:h,charSpace:g,type:v})),M&&this.root.push(new wk(M))}get AvailableTextWidth(){return this.availableTextWidth}static calculateAvailableTextWidth({pageWidth:t,left:n,right:r,gutter:i,column:s}){var a,o;let l=Ot(t)-Ot(n)-Ot(r)-Ot(i),c=(a=s?.count)!==null&&a!==void 0?a:1;return c<=1?l:(l-Ot((o=s?.space)!==null&&o!==void 0?o:720)*(c-1))/c}addHeaderFooterGroup(t,n){n.default&&this.root.push(jo(t,{type:kn.DEFAULT,id:n.default.View.ReferenceId})),n.first&&this.root.push(jo(t,{type:kn.FIRST,id:n.first.View.ReferenceId})),n.even&&this.root.push(jo(t,{type:kn.EVEN,id:n.even.View.ReferenceId}))}},wk=class extends I{constructor(e){super("w:sectPrChange"),this.root.push(new $e({id:e.id,author:e.author,date:e.date})),this.root.push(new gl(e))}},Nf=class extends I{constructor({pageNumbers:e}={}){super("w:body"),S(this,"sections",[]),S(this,"sectionParagraphs",new Map),S(this,"headingBookmarkIds",new Jx),S(this,"pageNumbers",void 0),this.pageNumbers=e}getSectionPropertiesFor(e){let t=e?Math.max(this.root.indexOf(e),0):0;for(let n=t;n<this.root.length;n++){let r=this.root[n];if(r instanceof gl)return r;let i=this.sectionParagraphs.get(r);if(i)return i}return this.sections[this.sections.length-1]}addSection(e){let t=this.sections.pop(),n=this.lastParagraphOfSection();if(t&&n)this.sectionParagraphs.set(n,t);else{let r=this.createSectionParagraph();this.root.push(r),t&&this.sectionParagraphs.set(r,t)}this.sections.push(new gl(e))}prepForXml(e){var t;this.sections.length===1&&(this.root.splice(0,1),this.root.push(this.sections.pop()));for(let[i,s]of this.sectionParagraphs)i.addSectionProperties(s);let n;try{n=super.prepForXml(e)}finally{for(let[i,s]of this.sectionParagraphs)i.removeSectionProperties(s)}let r=(t=this.pageNumbers)===null||t===void 0?void 0:t.listNumbers;return u1(n,e,this.headingBookmarkIds,r&&(i=>r(i,e))),this.pageNumbers&&(v1(n,e),w1(n,e,this.pageNumbers)),n}push(e){let t=e instanceof J?this.sectionParagraphs.get(e):void 0;if(t){let n=this.createSectionParagraph();this.root.splice(this.root.indexOf(e)+1,0,n),this.sectionParagraphs.delete(e),this.sectionParagraphs.set(n,t)}this.root.push(e)}lastParagraphOfSection(){let e=this.root[this.root.length-1];return e instanceof J&&e!==this.root[0]&&!this.sectionParagraphs.has(e)&&this.root.indexOf(e)===this.root.length-1?e:void 0}createSectionParagraph(){return new J({})}},De={AUTO:"auto",DXA:"dxa",NIL:"nil",PERCENTAGE:"pct"},Er=(e,{type:t=De.AUTO,size:n})=>{let r=n;return t===De.PERCENTAGE&&typeof n=="number"&&(r=Math.round(n*50)),new O({name:e,attributes:{type:{key:"w:type",value:t},size:{key:"w:w",value:Hh(r)}}})},fs=hs.WIDTH-Je.LEFT-Je.RIGHT-Je.GUTTER,If=e=>e.options.columnSpan||1,Ql=(e,t)=>{if(!e)return;let{type:n=De.AUTO,size:r}=e;if(n!==De.PERCENTAGE&&n!==De.DXA)return;let i=typeof r=="number"?n===De.PERCENTAGE?r/100*t:r:r.endsWith("%")?Number(r.slice(0,-1))/100*t:Ot(r);return i>0?i:void 0},yk=(e,t)=>{var n;return(n=Ql(e,t))!==null&&n!==void 0?n:t},xk=e=>Math.max(0,...e.map(t=>t.cells.reduce((n,r)=>n+If(r),0))),Fu=({rows:e,width:t,availableWidth:n})=>{let r=xk(e);if(r===0)return[];let i=yk(t,n),s=Array.from({length:r},()=>{}),a=[];for(let d of e){let p=0;for(let u of d.cells){let f=If(u),m=Ql(u.options.width,i);if(m!==void 0)if(f===1){var o,l;(l=s[o=p])!==null&&l!==void 0||(s[o]=m)}else a.push({start:p,span:f,width:m});p+=f}}for(let{start:d,span:p,width:u}of a){let f=Array.from({length:p},(g,v)=>d+v).filter(g=>g<r),m=f.filter(g=>s[g]===void 0),h=u-f.reduce((g,v)=>{var w;return g+((w=s[v])!==null&&w!==void 0?w:0)},0);if(m.length>0&&h>0)for(let g of m)s[g]=h/m.length}let c=s.flatMap((d,p)=>d===void 0?[p]:[]);if(c.length>0){let d=i-s.reduce((u,f)=>u+(f??0),0),p=d>0?d/c.length:i/r;for(let u of c)s[u]=p}return s.map(d=>Math.round(d))},kk=e=>new O({name:"w:gridCol",attributes:e!==void 0?{width:{key:"w:w",value:be(e)}}:void 0}),ms=class extends I{constructor(e,t){super("w:tblGrid");for(let n of e)this.root.push(kk(n));t&&this.root.push(new Sk(t))}},Tk=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{id:"w:id"})}},Sk=class extends I{constructor(e){super("w:tblGridChange"),this.root.push(new Tk({id:e.id})),this.root.push(new ms(e.columnWidths))}},Ek=class extends I{constructor(e){super("w:ins"),this.root.push(new $e({id:e.id,author:e.author,date:e.date}))}},Ck=class extends I{constructor(e){super("w:del"),this.root.push(new $e({id:e.id,author:e.author,date:e.date}))}},_k=class extends I{constructor(e){super("w:cellIns"),this.root.push(new $e({id:e.id,author:e.author,date:e.date}))}},Ak=class extends I{constructor(e){super("w:cellDel"),this.root.push(new $e({id:e.id,author:e.author,date:e.date}))}},Nk=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date",verticalMerge:"w:vMerge",verticalMergeOriginal:"w:vMergeOrig"})}},Ik=class extends I{constructor(e){super("w:cellMerge"),this.root.push(new Nk(e))}},Pf=({marginUnitType:e=De.DXA,top:t,left:n,bottom:r,right:i})=>[{name:"w:top",size:t},{name:"w:left",size:n},{name:"w:bottom",size:r},{name:"w:right",size:i}].filter(s=>s.size!==void 0).map(({name:s,size:a})=>Er(s,{type:e,size:a})),Pk=e=>{let t=Pf(e);if(t.length!==0)return new O({name:"w:tblCellMar",children:t})},Ok=e=>{let t=Pf(e);if(t.length!==0)return new O({name:"w:tcMar",children:t})},Lk=class extends mt{constructor(e){super("w:tcBorders"),e.top&&this.root.push(pe("w:top",e.top)),e.start&&this.root.push(pe("w:start",e.start)),e.left&&this.root.push(pe("w:left",e.left)),e.bottom&&this.root.push(pe("w:bottom",e.bottom)),e.end&&this.root.push(pe("w:end",e.end)),e.right&&this.root.push(pe("w:right",e.right)),e.diagonalDown&&this.root.push(pe("w:tl2br",e.diagonalDown)),e.diagonalUp&&this.root.push(pe("w:tr2bl",e.diagonalUp))}},Rk=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{val:"w:val"})}},Mk=class extends I{constructor(e){super("w:gridSpan"),this.root.push(new Rk({val:oe(e)}))}},Of={CONTINUE:"continue",RESTART:"restart"},Dk=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{val:"w:val"})}},Hu=class extends I{constructor(e){super("w:vMerge"),this.root.push(new Dk({val:e}))}},Bk=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{val:"w:val"})}},$k=class extends I{constructor(e){super("w:textDirection"),this.root.push(new Bk({val:e}))}},Lf=class extends mt{constructor(e){if(super("w:tcPr",e.includeIfEmpty),S(this,"hasWidth",void 0),S(this,"hasColumnWidth",!1),this.hasWidth=e.width!==void 0,e.width&&this.root.push(Er("w:tcW",e.width)),e.columnSpan&&this.root.push(new Mk(e.columnSpan)),e.verticalMerge?this.root.push(new Hu(e.verticalMerge)):e.rowSpan&&e.rowSpan>1&&this.root.push(new Hu(Of.RESTART)),e.borders&&this.root.push(new Lk(e.borders)),e.shading&&this.root.push(Ps(e.shading)),e.margins){let t=Ok(e.margins);t&&this.root.push(t)}e.textDirection&&this.root.push(new $k(e.textDirection)),e.verticalAlign&&this.root.push(Cf(e.verticalAlign)),e.insertion&&this.root.push(new _k(e.insertion)),e.deletion&&this.root.push(new Ak(e.deletion)),e.cellMerge&&this.root.push(new Ik(e.cellMerge)),e.revision&&this.root.push(new Fk(e.revision))}setColumnWidth(e){this.hasWidth||(this.root.splice(0,this.hasColumnWidth?1:0,Er("w:tcW",{size:e,type:De.DXA})),this.hasColumnWidth=!0)}},Fk=class extends I{constructor(e){super("w:tcPrChange"),this.root.push(new $e({id:e.id,author:e.author,date:e.date})),this.root.push(new Lf(k(k({},e),{},{includeIfEmpty:!0})))}},Cr=class extends I{constructor(e){super("w:tc"),S(this,"options",void 0),S(this,"properties",void 0),this.options=e,this.properties=new Lf(e),this.root.push(this.properties);for(let t of e.children)this.root.push(t)}setColumnWidth(e){this.properties.setColumnWidth(e)}prepForXml(e){return As(this.root[this.root.length-1])!=="w:p"&&this.root.push(new J({})),super.prepForXml(e)}},bl=(e,t)=>t?new P(e):new et(e,"off"),wn={style:Lr.NONE,size:0,color:"auto"},Hk={style:Lr.SINGLE,size:4,color:"auto"},Rf=class extends mt{constructor(e,{fillMissingSides:t=!0}={}){super("w:tblBorders");let n=[["w:top",e.top],["w:left",e.left],["w:bottom",e.bottom],["w:right",e.right],["w:insideH",e.insideHorizontal],["w:insideV",e.insideVertical]];for(let[r,i]of n){let s=i??(t?Hk:void 0);s&&this.root.push(pe(r,s))}}};S(Rf,"NONE",{top:wn,bottom:wn,left:wn,right:wn,insideHorizontal:wn,insideVertical:wn});Ko={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},Uk={CENTER:"center",INSIDE:"inside",BOTTOM:"bottom",OUTSIDE:"outside",INLINE:"inline",TOP:"top"},qk=({horizontalAnchor:e,verticalAnchor:t,absoluteHorizontalPosition:n,relativeHorizontalPosition:r,absoluteVerticalPosition:i,relativeVerticalPosition:s,bottomFromText:a,topFromText:o,leftFromText:l,rightFromText:c})=>new O({name:"w:tblpPr",attributes:{leftFromText:{key:"w:leftFromText",value:l===void 0?void 0:be(l)},rightFromText:{key:"w:rightFromText",value:c===void 0?void 0:be(c)},topFromText:{key:"w:topFromText",value:o===void 0?void 0:be(o)},bottomFromText:{key:"w:bottomFromText",value:a===void 0?void 0:be(a)},absoluteHorizontalPosition:{key:"w:tblpX",value:n===void 0?void 0:Ze(n)},absoluteVerticalPosition:{key:"w:tblpY",value:i===void 0?void 0:Ze(i)},horizontalAnchor:{key:"w:horzAnchor",value:e},relativeHorizontalPosition:{key:"w:tblpXSpec",value:r},relativeVerticalPosition:{key:"w:tblpYSpec",value:s},verticalAnchor:{key:"w:vertAnchor",value:t}}}),Wk=e=>new O({name:"w:tblLayout",attributes:{type:{key:"w:type",value:e}}}),jk={DXA:"dxa",NIL:"nil"},Mf=({type:e=jk.DXA,value:t})=>new O({name:"w:tblCellSpacing",attributes:{type:{key:"w:type",value:e},value:{key:"w:w",value:Hh(t)}}}),Kk=({firstRow:e,lastRow:t,firstColumn:n,lastColumn:r,noHBand:i,noVBand:s})=>new O({name:"w:tblLook",attributes:{firstRow:{key:"w:firstRow",value:e},lastRow:{key:"w:lastRow",value:t},firstColumn:{key:"w:firstColumn",value:n},lastColumn:{key:"w:lastColumn",value:r},noHBand:{key:"w:noHBand",value:i},noVBand:{key:"w:noVBand",value:s}}}),Gk=e=>new O({name:"w:tblOverlap",attributes:{val:{key:"w:val",value:e}}}),zk={[Ko.LEFT]:de.LEFT,[Ko.CENTER]:de.CENTER,[Ko.RIGHT]:de.RIGHT},Zl=class extends mt{constructor(e){var t,n,r;super("w:tblPr",e.includeIfEmpty),e.style&&this.root.push(new et("w:tblStyle",e.style));let i=((t=e.float)===null||t===void 0?void 0:t.relativeVerticalPosition)===Uk.INLINE,s=i?void 0:e.float;s&&this.root.push(qk(s)),s?.overlap&&this.root.push(Gk(s.overlap)),e.visuallyRightToLeft!==void 0&&this.root.push(bl("w:bidiVisual",e.visuallyRightToLeft)),e.width&&this.root.push(Er("w:tblW",e.width));let a=(n=e.alignment)!==null&&n!==void 0?n:i&&(!((r=e.float)===null||r===void 0)&&r.relativeHorizontalPosition)?zk[e.float.relativeHorizontalPosition]:void 0;if(a&&this.root.push(qh(a)),e.cellSpacing&&this.root.push(Mf(e.cellSpacing)),e.indent&&this.root.push(Er("w:tblInd",e.indent)),e.borders&&this.root.push(new Rf(e.borders,{fillMissingSides:!e.style})),e.shading&&this.root.push(Ps(e.shading)),e.layout&&this.root.push(Wk(e.layout)),e.cellMargin){let o=Pk(e.cellMargin);o&&this.root.push(o)}e.tableLook&&this.root.push(Kk(e.tableLook)),e.revision&&this.root.push(new Vk(e.revision))}},Vk=class extends I{constructor(e){super("w:tblPrChange"),this.root.push(new $e({id:e.id,author:e.author,date:e.date})),this.root.push(new Zl(k(k({},e),{},{includeIfEmpty:!0})))}},Xk=(e,t)=>new O({name:"w:trHeight",attributes:{value:{key:"w:val",value:be(e)},rule:{key:"w:hRule",value:t}}}),Df=class extends mt{constructor(e){super("w:trPr",e.includeIfEmpty),e.cantSplit!==void 0&&this.root.push(bl("w:cantSplit",e.cantSplit)),e.tableHeader!==void 0&&this.root.push(bl("w:tblHeader",e.tableHeader)),e.height&&this.root.push(Xk(e.height.value,e.height.rule)),e.cellSpacing&&this.root.push(Mf(e.cellSpacing)),e.insertion&&this.root.push(new Ek(e.insertion)),e.deletion&&this.root.push(new Ck(e.deletion)),e.revision&&this.root.push(new Yk(e.revision))}},Yk=class extends I{constructor(e){super("w:trPrChange"),this.root.push(new $e({id:e.id,author:e.author,date:e.date})),this.root.push(new Df(k(k({},e),{},{includeIfEmpty:!0})))}},Ts=(e,t)=>{let n=e[t];return Array.isArray(n)?n:[]},vr=e=>Object.keys(e)[0],Jk=(e,t)=>{let n=Ts(e,"w:p"),r=n.find(o=>vr(o)==="w:pPr");if(!r)return{"w:p":[{"w:pPr":[t]},...n]};let i=Ts(r,"w:pPr");if(i.some(o=>vr(o)==="w:keepNext"))return e;let s=i.filter(o=>vr(o)==="w:pStyle").length,a={"w:pPr":[...i.slice(0,s),t,...i.slice(s)]};return{"w:p":n.map(o=>o===r?a:o)}},Ms=class extends I{constructor(e){super("w:tr"),S(this,"options",void 0),this.options=e,this.root.push(new Df(e));for(let t of e.children)this.root.push(t)}prepForXml(e){if(this.cells.length===0)return;let t=super.prepForXml(e);if(!t||this.options.keepNext===void 0)return t;let n=new P("w:keepNext",this.options.keepNext).prepForXml(e);return{"w:tr":Ts(t,"w:tr").map(r=>vr(r)==="w:tc"?{"w:tc":Ts(r,"w:tc").map(i=>vr(i)==="w:p"?Jk(i,n):i)}:r)}}get CellCount(){return this.options.children.length}get cells(){return this.root.filter(e=>As(e)==="w:tc")}addCellToIndex(e,t){this.root.splice(t+1,0,e)}addCellToColumnIndex(e,t){let n=this.columnIndexToRootIndex(t,!0);this.addCellToIndex(e,n-1)}rootIndexToColumnIndex(e){if(e<1||e>=this.root.length)throw new Error(`cell 'rootIndex' should between 1 to ${this.root.length-1}`);let t=0;for(let n=1;n<e;n++){let r=this.root[n];t+=r.options.columnSpan||1}return t}columnIndexToRootIndex(e,t=!1){if(e<0)throw new Error("cell 'columnIndex' should not less than zero");let n=0,r=1;for(;n<=e;){if(r>=this.root.length){if(t)return this.root.length;throw new Error(`cell 'columnIndex' should not great than ${n-1}`)}let i=this.root[r];r+=1,n+=i&&i.options.columnSpan||1}return r-1}},Bf=class $f extends Yl{constructor({rows:t,width:n,columnWidths:r,columnWidthsRevision:i,margins:s,indent:a,float:o,layout:l,style:c,borders:d,alignment:p,visuallyRightToLeft:u,tableLook:f,cellSpacing:m,revision:h}){super("w:tbl"),S(this,"rows",void 0),S(this,"width",void 0),S(this,"columnWidths",void 0),S(this,"columnWidthsRevision",void 0),S(this,"resolvedColumnWidths",void 0),this.rows=t,this.width=n??{size:100},this.columnWidths=r,this.columnWidthsRevision=i,t.forEach((g,v)=>{if(v===t.length-1)return;let w=0;g.cells.forEach(b=>{if(b.options.rowSpan&&b.options.rowSpan>1){let C=b.options.children[b.options.children.length-1],A=new Cr({rowSpan:b.options.rowSpan-1,columnSpan:b.options.columnSpan,width:b.options.width,borders:b.options.borders,shading:b.options.shading,margins:b.options.margins,textDirection:b.options.textDirection,verticalAlign:b.options.verticalAlign,children:C instanceof J?[new J(C.Alignment)]:[],verticalMerge:Of.CONTINUE});t[v+1].addCellToColumnIndex(A,w)}w+=b.options.columnSpan||1})}),this.setCellWidths(fs),this.resolvedColumnWidths=r??Fu({rows:t,width:this.width,availableWidth:fs}),this.root.push(new Zl({borders:c?d:d??{},width:this.width,indent:a,float:o,layout:l,style:c,alignment:p,cellMargin:s,visuallyRightToLeft:u,tableLook:f,cellSpacing:m,revision:h})),this.root.push(new ms(this.resolvedColumnWidths,i));for(let g of t)this.root.push(g)}get ColumnWidths(){return this.resolvedColumnWidths}getCellWidth(t,n){let{cells:r}=t,i=r.indexOf(n);if(i===-1)return;let s=r.slice(0,i).reduce((o,l)=>o+(l.options.columnSpan||1),0),a=this.resolvedColumnWidths.slice(s,s+(n.options.columnSpan||1));return a.length===0?void 0:a.reduce((o,l)=>o+l,0)}prepForXml(t){if(this.setCellWidths(this.resolveAvailableWidth(t)),this.columnWidths===void 0){this.resolvedColumnWidths=Fu({rows:this.rows,width:this.width,availableWidth:this.resolveAvailableWidth(t)});let n=this.root.findIndex(r=>r instanceof ms);this.root[n]=new ms(this.resolvedColumnWidths,this.columnWidthsRevision)}return super.prepForXml(t)}setCellWidths(t){var n;if(this.columnWidths===void 0)return;let r=this.columnWidths.reduce((a,o)=>a+o,0),i=(n=Ql(this.width,t))!==null&&n!==void 0?n:0,s=r>0&&i>r?i/r:1;for(let a of this.rows){let o=0;for(let l of a.cells){let c=l.options.columnSpan||1,d=this.columnWidths.slice(o,o+c),p=Math.round(d.reduce((u,f)=>u+f,0)*s);d.length===c&&p>0&&l.setColumnWidth(p),o+=c}}}resolveAvailableWidth(t){var n,r,i;let{stack:s}=t,a=s[s.length-1],o=s[s.length-2],l=s[s.length-3];if(a instanceof Cr&&o instanceof Ms&&l instanceof $f){let u=l.getCellWidth(o,a);if(u!==void 0)return u}let c=s.findIndex(u=>u instanceof Nf),d=(n=t.file)===null||n===void 0||(n=n.Document)===null||n===void 0?void 0:n.View.Body,p=c>=0?s[c].getSectionPropertiesFor((r=s[c+1])!==null&&r!==void 0?r:this):d?.getSectionPropertiesFor();return(i=p?.AvailableTextWidth)!==null&&i!==void 0?i:fs}},Qk=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},Zk=class extends I{constructor(){super("Properties"),this.root.push(new Qk({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}))}},eT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{xmlns:"xmlns"})}},dt=(e,t)=>new O({name:"Default",attributes:{contentType:{key:"ContentType",value:e},extension:{key:"Extension",value:t}}}),me=(e,t)=>new O({name:"Override",attributes:{contentType:{key:"ContentType",value:e},partName:{key:"PartName",value:t}}}),tT=class extends I{constructor({macros:e=!1}={}){super("Types"),this.root.push(new eT({xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"})),this.root.push(dt("image/png","png")),this.root.push(dt("image/jpeg","jpeg")),this.root.push(dt("image/jpeg","jpg")),this.root.push(dt("image/bmp","bmp")),this.root.push(dt("image/gif","gif")),this.root.push(dt("image/svg+xml","svg")),this.root.push(dt("application/vnd.openxmlformats-package.relationships+xml","rels")),this.root.push(dt("application/xml","xml")),this.root.push(dt("application/vnd.openxmlformats-officedocument.obfuscatedFont","odttf")),this.root.push(me(e?"application/vnd.ms-word.document.macroEnabled.main+xml":"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","/word/document.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml","/word/styles.xml")),this.root.push(me("application/vnd.openxmlformats-package.core-properties+xml","/docProps/core.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.custom-properties+xml","/docProps/custom.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.extended-properties+xml","/docProps/app.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml","/word/numbering.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","/word/footnotes.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml","/word/endnotes.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml","/word/settings.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml","/word/fontTable.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.theme+xml","/word/theme/theme1.xml")),e&&this.root.push(me("application/vnd.ms-office.vbaProject","/word/vbaProject.bin"))}addComments(){this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml","/word/comments.xml"))}addCommentsExtended(){this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml","/word/commentsExtended.xml"))}addCommentsIds(){this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml","/word/commentsIds.xml"))}addFooter(e){this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",`/word/footer${e}.xml`))}addOverride(e,t){this.root.push(me(e,t))}addHeader(e){this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",`/word/header${e}.xml`))}},vl={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",aink:"http://schemas.microsoft.com/office/drawing/2016/ink",am3d:"http://schemas.microsoft.com/office/drawing/2017/model3d",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ds=class extends H{constructor(e,t){super(k({Ignorable:t},Object.fromEntries(e.map(n=>[n,vl[n]])))),S(this,"xmlKeys",k({Ignorable:"mc:Ignorable"},Object.fromEntries(Object.keys(vl).map(n=>[n,`xmlns:${n}`]))))}},nT=class extends I{constructor(e){super("cp:coreProperties"),this.root.push(new Ds(["cp","dc","dcterms","dcmitype","xsi"])),e.title&&this.root.push(new Xt("dc:title",e.title)),e.subject&&this.root.push(new Xt("dc:subject",e.subject)),e.creator&&this.root.push(new Xt("dc:creator",e.creator)),e.keywords&&this.root.push(new Xt("cp:keywords",e.keywords)),e.description&&this.root.push(new Xt("dc:description",e.description)),e.lastModifiedBy&&this.root.push(new Xt("cp:lastModifiedBy",e.lastModifiedBy)),e.revision&&this.root.push(new Xt("cp:revision",String(e.revision))),this.root.push(new Uu("dcterms:created")),this.root.push(new Uu("dcterms:modified"))}},rT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{type:"xsi:type"})}},Uu=class extends I{constructor(e){super(e),this.root.push(new rT({type:"dcterms:W3CDTF"})),this.root.push(Oy(new Date))}},iT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},sT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{formatId:"fmtid",pid:"pid",name:"name"})}},aT=class extends I{constructor(e,t){super("property"),this.root.push(new sT({formatId:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:e.toString(),name:t.name})),this.root.push(new oT(t.value))}},oT=class extends I{constructor(e){super("vt:lpwstr"),this.root.push(e)}},lT=class extends I{constructor(e){super("Properties"),S(this,"nextId",void 0),S(this,"properties",[]),this.root.push(new iT({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"})),this.nextId=2;for(let t of e)this.addCustomProperty(t)}prepForXml(e){return this.root.splice(1,this.root.length-1,...this.properties),super.prepForXml(e)}addCustomProperty(e){this.properties.push(new aT(this.nextId++,e))}},cT=e=>new O({name:"ds:datastoreItem",attributes:{itemId:{key:"ds:itemID",value:e},namespace:{key:"xmlns:ds",value:"http://schemas.openxmlformats.org/officeDocument/2006/customXml"}},children:[new O({name:"ds:schemaRefs",children:[new O({name:"ds:schemaRef",attributes:{uri:{key:"ds:uri",value:"http://schemas.openxmlformats.org/officeDocument/2006/bibliography"}}})]})]}),dT={new:"wne:eventDocNew",open:"wne:eventDocOpen",close:"wne:eventDocClose",sync:"wne:eventDocSync",xmlAfterInsert:"wne:eventDocXmlAfterInsert",xmlBeforeDelete:"wne:eventDocXmlBeforeDelete",contentControlAfterAdd:"wne:eventDocContentControlAfterInsert",contentControlBeforeDelete:"wne:eventDocContentControlBeforeDelete",contentControlOnExit:"wne:eventDocContentControlOnExit",contentControlOnEnter:"wne:eventDocContentControlOnEnter",contentControlBeforeStoreUpdate:"wne:eventDocStoreUpdate",contentControlBeforeContentUpdate:"wne:eventDocContentControlContentUpdate",buildingBlockInsert:"wne:eventDocBuildingBlockAfterInsert"},pT=e=>new O({name:"wne:vbaSuppData",attributes:{namespace:{key:"xmlns:wne",value:"http://schemas.microsoft.com/office/word/2006/wordml"}},children:[new O({name:"wne:docEvents",children:Object.entries(dT).filter(([t])=>e.includes(t)).map(([,t])=>new O({name:t}))})]}),uT=class extends I{constructor({color:e,themeColor:t,themeShade:n,themeTint:r}){if(super("w:background"),typeof e=="object"&&(t!==void 0||n!==void 0||r!==void 0))throw new Error("Invalid background. Expected a theme color in color, or themeColor, themeShade and themeTint, not both");this.root.push(new Ul([{keys:Or,color:e},{key:"w:themeColor",value:t},{key:"w:themeShade",value:n===void 0?void 0:Au(n)},{key:"w:themeTint",value:r===void 0?void 0:Au(r)}]))}},hT=class extends I{constructor(e){super("w:document"),S(this,"body",void 0),this.root.push(new Ds(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps","cx","cx1","cx2","cx3","cx4","cx5","cx6","cx7","cx8","aink","am3d","w16cex","w16cid","w16","w16sdtdh","w16se"],"w14 w15 wp14")),this.body=new Nf({pageNumbers:e.pageNumbers}),e.background&&this.root.push(new uT(e.background)),this.root.push(this.body)}add(e){return this.body.push(e),this}get Body(){return this.body}},fT=class{constructor(e){S(this,"document",void 0),S(this,"relationships",void 0),this.document=new hT(e),this.relationships=new ge}get View(){return this.document}get Relationships(){return this.relationships}},mT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},Ff=class extends I{constructor(e,t){super("w:p"),S(this,"paragraph",void 0),S(this,"mark",void 0),this.paragraph=e,this.mark=t}prepForXml(e){let t=this.paragraph.prepForXml(e)["w:p"],n=Array.isArray(t)?t:[],r=n.length>0&&"w:pPr"in n[0]?1:0;return{"w:p":[...n.slice(0,r),this.mark.prepForXml(e),...n.slice(r)]}}},gT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{type:"w:type",id:"w:id"})}},Hf=class extends Be{constructor(){super({style:"EndnoteReference"}),this.root.push(new L1)}},qu={SEPARATOR:"separator",CONTINUATION_SEPARATOR:"continuationSeparator"},Go=class extends I{constructor(e){super("w:endnote"),this.root.push(new gT({type:e.type,id:e.id}));for(let[t,n]of e.children.entries())this.root.push(t===0?new Ff(n,new Hf):n)}},bT=class extends I{constructor(){super("w:continuationSeparator")}},Uf=class extends Be{constructor(){super({}),this.root.push(new bT)}},vT=class extends I{constructor(){super("w:separator")}},qf=class extends Be{constructor(){super({}),this.root.push(new vT)}},Wf=class extends I{constructor(){super("w:endnotes"),S(this,"ownNotes",new Map),S(this,"highestId",0),this.root.push(new mT({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"}));let e=new Go({id:-1,type:qu.SEPARATOR,children:[new J({spacing:{after:0,line:240,lineRule:Tn.AUTO},children:[new qf]})]});this.root.push(e);let t=new Go({id:0,type:qu.CONTINUATION_SEPARATOR,children:[new J({spacing:{after:0,line:240,lineRule:Tn.AUTO},children:[new Uf]})]});this.root.push(t)}createEndnote(e,t){let n=new Go({id:e,children:t});this.root.push(n),Number.isFinite(e)&&(this.highestId=Math.max(this.highestId,Math.floor(e)))}idOf(e,t,n){if(n.viewWrapper!==n.file.Document)return;let r=this.ownNotes.get(e);if(r!==void 0)return r;let i=this.highestId+1;return this.createEndnote(i,t.children),this.ownNotes.set(e,i),i}prepForXml(e){let t=super.prepForXml(e);return Rr(t,e),t}},wT=class{constructor(){S(this,"endnotes",void 0),S(this,"relationships",void 0),this.endnotes=new Wf,this.relationships=new ge}get View(){return this.endnotes}get Relationships(){return this.relationships}},yT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",cp:"xmlns:cp",dc:"xmlns:dc",dcterms:"xmlns:dcterms",dcmitype:"xmlns:dcmitype",xsi:"xmlns:xsi",type:"xsi:type"})}},xT=class extends Dh{constructor(e,t){super("w:ftr",t),S(this,"refId",void 0),this.refId=e,t||this.root.push(new yT({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}))}get ReferenceId(){return this.refId}add(e){this.root.push(e)}prepForXml(e){let t=super.prepForXml(e);return Rr(t,e,this.refId),t}},kT=class{constructor(e,t,n){S(this,"media",void 0),S(this,"footer",void 0),S(this,"relationships",void 0),this.media=e,this.footer=new xT(t,n),this.relationships=new ge}add(e){this.footer.add(e)}addChildElement(e){this.footer.addChildElement(e)}get View(){return this.footer}get Relationships(){return this.relationships}get Media(){return this.media}},TT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{type:"w:type",id:"w:id"})}},ST=class extends I{constructor(){super("w:footnoteRef")}},jf=class extends Be{constructor(){super({style:"FootnoteReference"}),this.root.push(new ST)}},Wu={SEPERATOR:"separator",CONTINUATION_SEPERATOR:"continuationSeparator"},zo=class extends I{constructor(e){super("w:footnote"),this.root.push(new TT({type:e.type,id:e.id}));for(let[t,n]of e.children.entries())this.root.push(t===0?new Ff(n,new jf):n)}},ET=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},Kf=class extends I{constructor(){super("w:footnotes"),S(this,"ownNotes",new Map),S(this,"highestId",0),this.root.push(new ET({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"}));let e=new zo({id:-1,type:Wu.SEPERATOR,children:[new J({spacing:{after:0,line:240,lineRule:Tn.AUTO},children:[new qf]})]});this.root.push(e);let t=new zo({id:0,type:Wu.CONTINUATION_SEPERATOR,children:[new J({spacing:{after:0,line:240,lineRule:Tn.AUTO},children:[new Uf]})]});this.root.push(t)}createFootNote(e,t){let n=new zo({id:e,children:t});this.root.push(n),Number.isFinite(e)&&(this.highestId=Math.max(this.highestId,Math.floor(e)))}idOf(e,t,n){if(n.viewWrapper!==n.file.Document)return;let r=this.ownNotes.get(e);if(r!==void 0)return r;let i=this.highestId+1;return this.createFootNote(i,t.children),this.ownNotes.set(e,i),i}prepForXml(e){let t=super.prepForXml(e);return Rr(t,e),t}},CT=class{constructor(){S(this,"footnotess",void 0),S(this,"relationships",void 0),this.footnotess=new Kf,this.relationships=new ge}get View(){return this.footnotess}get Relationships(){return this.relationships}},_T=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",cp:"xmlns:cp",dc:"xmlns:dc",dcterms:"xmlns:dcterms",dcmitype:"xmlns:dcmitype",xsi:"xmlns:xsi",type:"xsi:type",cx:"xmlns:cx",cx1:"xmlns:cx1",cx2:"xmlns:cx2",cx3:"xmlns:cx3",cx4:"xmlns:cx4",cx5:"xmlns:cx5",cx6:"xmlns:cx6",cx7:"xmlns:cx7",cx8:"xmlns:cx8",w16cid:"xmlns:w16cid",w16se:"xmlns:w16se"})}},AT=class extends Dh{constructor(e,t){super("w:hdr",t),S(this,"refId",void 0),this.refId=e,t||this.root.push(new _T({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"}))}get ReferenceId(){return this.refId}add(e){this.root.push(e)}prepForXml(e){let t=super.prepForXml(e);return Rr(t,e,this.refId),t}},NT=class{constructor(e,t,n){S(this,"media",void 0),S(this,"header",void 0),S(this,"relationships",void 0),this.media=e,this.header=new AT(t,n),this.relationships=new ge}add(e){return this.header.add(e),this}addChildElement(e){this.header.addChildElement(e)}get View(){return this.header}get Relationships(){return this.relationships}get Media(){return this.media}},IT=()=>{let e=new Map;return t=>{var n;let r=((n=e.get(t))!==null&&n!==void 0?n:0)+1;return e.set(t,r),`media/image${r}.${t}`}},Gf=class{constructor(e=IT()){S(this,"map",new Map),S(this,"takePath",void 0),this.takePath=e}addImage(e,t){if(this.map.has(e))return;let n=this.takePath(t.type);this.map.set(e,k(k({},t),{},{fileName:n.slice(n.lastIndexOf("/")+1)}))}get Array(){return Array.from(this.map.values())}get Entries(){return Array.from(this.map.entries())}},pt={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH__DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULLSTOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PARENTHESES:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW1:"hebrew1",HEBREW2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText",CUSTOM:"custom"},PT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{ilvl:"w:ilvl",tentative:"w:tentative"})}},OT=class extends I{constructor(e){super("w:numFmt"),this.root.push(new Ce({val:e}))}},LT=class extends I{constructor(e){super("w:lvlText"),this.root.push(new Ce({val:e}))}},RT=e=>{switch(e){case de.CENTER:return"center";case de.END:case de.RIGHT:return"right";default:return"left"}},MT=class extends I{constructor(e){super("w:lvlJc"),this.root.push(new Ce({val:RT(e)}))}},DT=class extends I{constructor(e){super("w:suff"),this.root.push(new Ce({val:e}))}},BT=class extends I{constructor(){super("w:isLgl")}},$T=class extends I{constructor({level:e,format:t,text:n,alignment:r=de.START,start:i=1,style:s,suffix:a,isLegalNumberingStyle:o}){if(super("w:lvl"),S(this,"paragraphProperties",void 0),S(this,"runProperties",void 0),this.root.push(new br("w:start",oe(i))),t&&this.root.push(new OT(t)),s?.style&&this.root.push(gr(s.style)),o&&this.root.push(new BT),a&&this.root.push(new DT(a)),n&&this.root.push(new LT(n)),this.root.push(new MT(r)),this.paragraphProperties=new Sn(s&&s.paragraph,{implicitListParagraphStyle:!1,inListOrder:!1}),this.runProperties=new Zt(s?.run&&k(k({},s.run),{},{highlight:void 0,math:void 0,revision:void 0})),this.root.push(this.paragraphProperties),this.root.push(this.runProperties),e>9)throw new Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new PT({ilvl:oe(e),tentative:1}))}},FT=class extends $T{},HT=class extends I{constructor(e){super("w:multiLevelType"),this.root.push(new Ce({val:e}))}},UT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{abstractNumId:"w:abstractNumId",restartNumberingAfterBreak:"w15:restartNumberingAfterBreak"})}},Vo=class extends I{constructor(e,t){super("w:abstractNum"),S(this,"id",void 0),this.root.push(new UT({abstractNumId:oe(e),restartNumberingAfterBreak:0})),this.root.push(new HT("hybridMultilevel")),this.id=e;for(let n of t)this.root.push(new FT(n))}},qT=class extends I{constructor(e){super("w:abstractNumId"),this.root.push(new Ce({val:e}))}},WT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{numId:"w:numId"})}},ju=class extends I{constructor(e){if(super("w:num"),S(this,"numId",void 0),S(this,"reference",void 0),S(this,"instance",void 0),S(this,"restartedListId",void 0),this.numId=e.numId,this.reference=e.reference,this.instance=e.instance,this.restartedListId=e.restartedListId,this.root.push(new WT({numId:oe(e.numId)})),this.root.push(new qT(oe(e.abstractNumId))),e.overrideLevels&&e.overrideLevels.length)for(let t of e.overrideLevels)this.root.push(new KT(t.num,t.start))}},jT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{ilvl:"w:ilvl"})}},KT=class extends I{constructor(e,t){super("w:lvlOverride"),this.root.push(new jT({ilvl:e})),t!==void 0&&this.root.push(new zT(t))}},GT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{val:"w:val"})}},zT=class extends I{constructor(e){super("w:startOverride"),this.root.push(new GT({val:e}))}},zf=class extends I{constructor(e){super("w:numbering"),S(this,"abstractNumberingMap",new Map),S(this,"concreteNumberingMap",new Map),S(this,"referenceConfigMap",new Map),S(this,"abstractNumUniqueNumericId",mx()),S(this,"concreteNumUniqueNumericId",gx()),this.root.push(new Ds(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps"],"w14 w15 wp14"));let t=new Vo(this.abstractNumUniqueNumericId(),[{level:0,format:pt.BULLET,text:"\u25CF",alignment:de.LEFT,style:{paragraph:{indent:{left:We(.5),hanging:We(.25)}}}},{level:1,format:pt.BULLET,text:"\u25CB",alignment:de.LEFT,style:{paragraph:{indent:{left:We(1),hanging:We(.25)}}}},{level:2,format:pt.BULLET,text:"\u25A0",alignment:de.LEFT,style:{paragraph:{indent:{left:2160,hanging:We(.25)}}}},{level:3,format:pt.BULLET,text:"\u25CF",alignment:de.LEFT,style:{paragraph:{indent:{left:2880,hanging:We(.25)}}}},{level:4,format:pt.BULLET,text:"\u25CB",alignment:de.LEFT,style:{paragraph:{indent:{left:3600,hanging:We(.25)}}}},{level:5,format:pt.BULLET,text:"\u25A0",alignment:de.LEFT,style:{paragraph:{indent:{left:4320,hanging:We(.25)}}}},{level:6,format:pt.BULLET,text:"\u25CF",alignment:de.LEFT,style:{paragraph:{indent:{left:5040,hanging:We(.25)}}}},{level:7,format:pt.BULLET,text:"\u25CF",alignment:de.LEFT,style:{paragraph:{indent:{left:5760,hanging:We(.25)}}}},{level:8,format:pt.BULLET,text:"\u25CF",alignment:de.LEFT,style:{paragraph:{indent:{left:6480,hanging:We(.25)}}}}]);this.concreteNumberingMap.set("default-bullet-numbering",new ju({numId:1,abstractNumId:t.id,reference:"default-bullet-numbering",instance:0,overrideLevels:[{num:0,start:1}]})),this.abstractNumberingMap.set("default-bullet-numbering",t);for(let n of e.config)this.abstractNumberingMap.set(n.reference,new Vo(this.abstractNumUniqueNumericId(),n.levels)),this.referenceConfigMap.set(n.reference,n.levels)}prepForXml(e){return this.root.splice(1,this.root.length-1,...this.abstractNumberingMap.values(),...this.concreteNumberingMap.values()),super.prepForXml(e)}createConcreteNumberingInstance(e,t,n,r){var i;n&&!this.abstractNumberingMap.has(n.reference)&&(this.abstractNumberingMap.set(n.reference,new Vo(this.abstractNumUniqueNumericId(),n.levels)),this.referenceConfigMap.set(n.reference,n.levels));let s=this.abstractNumberingMap.get(e);if(!s)return;let a=xs(e,t,r);if(this.concreteNumberingMap.has(a))return;let o=(i=this.referenceConfigMap.get(e))!==null&&i!==void 0?i:[{level:0}],l={numId:this.concreteNumUniqueNumericId(),abstractNumId:s.id,reference:e,instance:t,restartedListId:r,overrideLevels:o.map(({level:c,start:d=1})=>({num:c,start:oe(d)}))};this.concreteNumberingMap.set(a,new ju(l))}get ConcreteNumbering(){return Array.from(this.concreteNumberingMap.values())}get ReferenceConfig(){return Array.from(this.referenceConfigMap.values())}},Vf=class{constructor(e,t=new Set){S(this,"contentTypes",void 0),S(this,"paths",new Map),S(this,"taken",void 0),S(this,"folders",new WeakMap),this.contentTypes=e,this.taken=new Set(t)}add(e){let t=this.paths.get(e);if(t!==void 0)return t;let{folder:n,name:r,extension:i,contentType:s}=e.options,a=this.takePath(n,r,i);return this.paths.set(e,a),this.contentTypes.addOverride(s,`/word/${a}`),a}takePath(e,t,n){let r=1;for(;this.taken.has(`${e}/${t}${r}.${n}`);)r++;let i=`${e}/${t}${r}.${n}`;return this.taken.add(i),i}get Array(){return[...this.paths].map(([e,t])=>({part:e,path:t}))}createRelationships(e){let t=new ge;return this.folders.set(t,e.slice(0,e.indexOf("/"))),t}getTarget(e,t){let n=this.folders.get(e);return n===void 0?t:t.startsWith(`${n}/`)?t.slice(n.length+1):`../${t}`}},VT=e=>new O({name:"w:compatSetting",attributes:{version:{key:"w:val",value:e},name:{key:"w:name",value:"compatibilityMode"},uri:{key:"w:uri",value:"http://schemas.microsoft.com/office/word"}}}),XT=class extends I{constructor(e){super("w:compat"),e.useSingleBorderforContiguousCells&&this.root.push(new P("w:useSingleBorderforContiguousCells",e.useSingleBorderforContiguousCells)),e.wordPerfectJustification&&this.root.push(new P("w:wpJustification",e.wordPerfectJustification)),e.noTabStopForHangingIndent&&this.root.push(new P("w:noTabHangInd",e.noTabStopForHangingIndent)),e.noLeading&&this.root.push(new P("w:noLeading",e.noLeading)),e.spaceForUnderline&&this.root.push(new P("w:spaceForUL",e.spaceForUnderline)),e.noColumnBalance&&this.root.push(new P("w:noColumnBalance",e.noColumnBalance)),e.balanceSingleByteDoubleByteWidth&&this.root.push(new P("w:balanceSingleByteDoubleByteWidth",e.balanceSingleByteDoubleByteWidth)),e.noExtraLineSpacing&&this.root.push(new P("w:noExtraLineSpacing",e.noExtraLineSpacing)),e.doNotLeaveBackslashAlone&&this.root.push(new P("w:doNotLeaveBackslashAlone",e.doNotLeaveBackslashAlone)),e.underlineTrailingSpaces&&this.root.push(new P("w:ulTrailSpace",e.underlineTrailingSpaces)),e.doNotExpandShiftReturn&&this.root.push(new P("w:doNotExpandShiftReturn",e.doNotExpandShiftReturn)),e.spacingInWholePoints&&this.root.push(new P("w:spacingInWholePoints",e.spacingInWholePoints)),e.lineWrapLikeWord6&&this.root.push(new P("w:lineWrapLikeWord6",e.lineWrapLikeWord6)),e.printBodyTextBeforeHeader&&this.root.push(new P("w:printBodyTextBeforeHeader",e.printBodyTextBeforeHeader)),e.printColorsBlack&&this.root.push(new P("w:printColBlack",e.printColorsBlack)),e.spaceWidth&&this.root.push(new P("w:wpSpaceWidth",e.spaceWidth)),e.showBreaksInFrames&&this.root.push(new P("w:showBreaksInFrames",e.showBreaksInFrames)),e.subFontBySize&&this.root.push(new P("w:subFontBySize",e.subFontBySize)),e.suppressBottomSpacing&&this.root.push(new P("w:suppressBottomSpacing",e.suppressBottomSpacing)),e.suppressTopSpacing&&this.root.push(new P("w:suppressTopSpacing",e.suppressTopSpacing)),e.suppressSpacingAtTopOfPage&&this.root.push(new P("w:suppressSpacingAtTopOfPage",e.suppressSpacingAtTopOfPage)),e.suppressTopSpacingWP&&this.root.push(new P("w:suppressTopSpacingWP",e.suppressTopSpacingWP)),e.suppressSpBfAfterPgBrk&&this.root.push(new P("w:suppressSpBfAfterPgBrk",e.suppressSpBfAfterPgBrk)),e.swapBordersFacingPages&&this.root.push(new P("w:swapBordersFacingPages",e.swapBordersFacingPages)),e.convertMailMergeEsc&&this.root.push(new P("w:convMailMergeEsc",e.convertMailMergeEsc)),e.truncateFontHeightsLikeWP6&&this.root.push(new P("w:truncateFontHeightsLikeWP6",e.truncateFontHeightsLikeWP6)),e.macWordSmallCaps&&this.root.push(new P("w:mwSmallCaps",e.macWordSmallCaps)),e.usePrinterMetrics&&this.root.push(new P("w:usePrinterMetrics",e.usePrinterMetrics)),e.doNotSuppressParagraphBorders&&this.root.push(new P("w:doNotSuppressParagraphBorders",e.doNotSuppressParagraphBorders)),e.wrapTrailSpaces&&this.root.push(new P("w:wrapTrailSpaces",e.wrapTrailSpaces)),e.footnoteLayoutLikeWW8&&this.root.push(new P("w:footnoteLayoutLikeWW8",e.footnoteLayoutLikeWW8)),e.shapeLayoutLikeWW8&&this.root.push(new P("w:shapeLayoutLikeWW8",e.shapeLayoutLikeWW8)),e.alignTablesRowByRow&&this.root.push(new P("w:alignTablesRowByRow",e.alignTablesRowByRow)),e.forgetLastTabAlignment&&this.root.push(new P("w:forgetLastTabAlignment",e.forgetLastTabAlignment)),e.adjustLineHeightInTable&&this.root.push(new P("w:adjustLineHeightInTable",e.adjustLineHeightInTable)),e.autoSpaceLikeWord95&&this.root.push(new P("w:autoSpaceLikeWord95",e.autoSpaceLikeWord95)),e.noSpaceRaiseLower&&this.root.push(new P("w:noSpaceRaiseLower",e.noSpaceRaiseLower)),e.doNotUseHTMLParagraphAutoSpacing&&this.root.push(new P("w:doNotUseHTMLParagraphAutoSpacing",e.doNotUseHTMLParagraphAutoSpacing)),e.layoutRawTableWidth&&this.root.push(new P("w:layoutRawTableWidth",e.layoutRawTableWidth)),e.layoutTableRowsApart&&this.root.push(new P("w:layoutTableRowsApart",e.layoutTableRowsApart)),e.useWord97LineBreakRules&&this.root.push(new P("w:useWord97LineBreakRules",e.useWord97LineBreakRules)),e.doNotBreakWrappedTables&&this.root.push(new P("w:doNotBreakWrappedTables",e.doNotBreakWrappedTables)),e.doNotSnapToGridInCell&&this.root.push(new P("w:doNotSnapToGridInCell",e.doNotSnapToGridInCell)),e.selectFieldWithFirstOrLastCharacter&&this.root.push(new P("w:selectFldWithFirstOrLastChar",e.selectFieldWithFirstOrLastCharacter)),e.applyBreakingRules&&this.root.push(new P("w:applyBreakingRules",e.applyBreakingRules)),e.doNotWrapTextWithPunctuation&&this.root.push(new P("w:doNotWrapTextWithPunct",e.doNotWrapTextWithPunctuation)),e.doNotUseEastAsianBreakRules&&this.root.push(new P("w:doNotUseEastAsianBreakRules",e.doNotUseEastAsianBreakRules)),e.useWord2002TableStyleRules&&this.root.push(new P("w:useWord2002TableStyleRules",e.useWord2002TableStyleRules)),e.growAutofit&&this.root.push(new P("w:growAutofit",e.growAutofit)),e.useFELayout&&this.root.push(new P("w:useFELayout",e.useFELayout)),e.useNormalStyleForList&&this.root.push(new P("w:useNormalStyleForList",e.useNormalStyleForList)),e.doNotUseIndentAsNumberingTabStop&&this.root.push(new P("w:doNotUseIndentAsNumberingTabStop",e.doNotUseIndentAsNumberingTabStop)),e.useAlternateEastAsianLineBreakRules&&this.root.push(new P("w:useAltKinsokuLineBreakRules",e.useAlternateEastAsianLineBreakRules)),e.allowSpaceOfSameStyleInTable&&this.root.push(new P("w:allowSpaceOfSameStyleInTable",e.allowSpaceOfSameStyleInTable)),e.doNotSuppressIndentation&&this.root.push(new P("w:doNotSuppressIndentation",e.doNotSuppressIndentation)),e.doNotAutofitConstrainedTables&&this.root.push(new P("w:doNotAutofitConstrainedTables",e.doNotAutofitConstrainedTables)),e.autofitToFirstFixedWidthCell&&this.root.push(new P("w:autofitToFirstFixedWidthCell",e.autofitToFirstFixedWidthCell)),e.underlineTabInNumberingList&&this.root.push(new P("w:underlineTabInNumList",e.underlineTabInNumberingList)),e.displayHangulFixedWidth&&this.root.push(new P("w:displayHangulFixedWidth",e.displayHangulFixedWidth)),e.splitPgBreakAndParaMark&&this.root.push(new P("w:splitPgBreakAndParaMark",e.splitPgBreakAndParaMark)),e.doNotVerticallyAlignCellWithSp&&this.root.push(new P("w:doNotVertAlignCellWithSp",e.doNotVerticallyAlignCellWithSp)),e.doNotBreakConstrainedForcedTable&&this.root.push(new P("w:doNotBreakConstrainedForcedTable",e.doNotBreakConstrainedForcedTable)),e.ignoreVerticalAlignmentInTextboxes&&this.root.push(new P("w:doNotVertAlignInTxbx",e.ignoreVerticalAlignmentInTextboxes)),e.useAnsiKerningPairs&&this.root.push(new P("w:useAnsiKerningPairs",e.useAnsiKerningPairs)),e.cachedColumnBalance&&this.root.push(new P("w:cachedColBalance",e.cachedColumnBalance)),e.version&&this.root.push(VT(e.version))}},Ku=1e5,Gu=15,YT=[57840,7439,52380,33984,4364,3600,61902,12606,6258,57657,54287,34041,10252,43370,20163],JT=[[44796,19929,39858,10053,20106,40212,10761],[31585,63170,64933,60267,50935,40399,11199],[17763,35526,1453,2906,5812,11624,23248],[885,1770,3540,7080,14160,28320,56640],[55369,41139,20807,41614,21821,43642,17621],[28485,56970,44341,19019,38038,14605,29210],[60195,50791,40175,10751,21502,43004,24537],[18387,36774,3949,7898,15796,31592,63184],[47201,24803,49606,37805,14203,28406,56812],[17824,35648,1697,3394,6788,13576,27152],[43601,17539,35078,557,1114,2228,4456],[30388,60776,51953,34243,7079,14158,28316],[14128,28256,56512,43425,17251,34502,7597],[13105,26210,52420,35241,883,1766,3532],[4129,8258,16516,33032,4657,9314,18628]],zu=e=>e>>14&1|e<<1&32767,QT=e=>{let t=e.slice(0,Gu).split("").map(i=>{let s=i.charCodeAt(0);return(s&255)!==0?s&255:s>>8&255}),n=t.reduce((i,s,a)=>JT[Gu-t.length+a].reduce((o,l,c)=>s>>c&1?o^l:o,i),YT[t.length-1]),r=(zu(t.reduceRight((i,s)=>zu(i)^s,0))^t.length^52811)&65535;return[r&255,r>>8,n&255,n>>8].map(i=>i.toString(16).toUpperCase().padStart(2,"0")).join("")},ZT=(e,t,n)=>{let r=[...QT(e)].flatMap(o=>[o.charCodeAt(0),0]),i=Ou(Uint8Array.from([...t,...r])),s=new Uint8Array(i.length+4),a=new DataView(s.buffer);for(let o=0;o<n;o++)s.set(i),a.setUint32(i.length,o,!0),i=Ou(s);return Array.from(i)},eS=e=>{var t;let n=new Uint8Array(e);return typeof((t=globalThis.crypto)===null||t===void 0?void 0:t.getRandomValues)=="function"?(globalThis.crypto.getRandomValues(n),[...n]):[...n].map(()=>Math.floor(Math.random()*256))},Vu=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{edit:"w:edit",enforcement:"w:enforcement",cryptProviderType:"w:cryptProviderType",cryptAlgorithmClass:"w:cryptAlgorithmClass",cryptAlgorithmType:"w:cryptAlgorithmType",cryptAlgorithmSid:"w:cryptAlgorithmSid",cryptSpinCount:"w:cryptSpinCount",hash:"w:hash",salt:"w:salt"})}},Xu=e=>btoa(String.fromCharCode(...e)),tS=class extends I{constructor({type:e,password:t}){if(super("w:documentProtection"),t===void 0||t===""){this.root.push(new Vu({edit:e,enforcement:!0}));return}let n=eS(16);this.root.push(new Vu({edit:e,enforcement:!0,cryptProviderType:"rsaAES",cryptAlgorithmClass:"hash",cryptAlgorithmType:"typeAny",cryptAlgorithmSid:12,cryptSpinCount:Ku,hash:Xu(ZT(t,n,Ku)),salt:Xu(n)}))}},nS=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},rS=class extends I{constructor(e){var t,n,r,i,s,a,o,l,c;super("w:settings"),this.root.push(new nS({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"})),this.root.push(new P("w:displayBackgroundShape",!0)),e.embedFonts!==void 0&&this.root.push(new P("w:embedTrueTypeFonts",e.embedFonts)),e.trackRevisions!==void 0&&this.root.push(new P("w:trackRevisions",e.trackRevisions)),e.protection!==void 0&&this.root.push(new tS(e.protection)),this.root.push(new br("w:defaultTabStop",(t=e.defaultTabStop)!==null&&t!==void 0?t:720)),((n=e.hyphenation)===null||n===void 0?void 0:n.autoHyphenation)!==void 0&&this.root.push(new P("w:autoHyphenation",e.hyphenation.autoHyphenation)),((r=e.hyphenation)===null||r===void 0?void 0:r.consecutiveHyphenLimit)!==void 0&&this.root.push(new br("w:consecutiveHyphenLimit",e.hyphenation.consecutiveHyphenLimit)),((i=e.hyphenation)===null||i===void 0?void 0:i.hyphenationZone)!==void 0&&this.root.push(new br("w:hyphenationZone",e.hyphenation.hyphenationZone)),((s=e.hyphenation)===null||s===void 0?void 0:s.doNotHyphenateCaps)!==void 0&&this.root.push(new P("w:doNotHyphenateCaps",e.hyphenation.doNotHyphenateCaps)),e.evenAndOddHeaders!==void 0&&this.root.push(new P("w:evenAndOddHeaders",e.evenAndOddHeaders)),e.updateFields!==void 0&&this.root.push(new P("w:updateFields",e.updateFields)),this.root.push(new XT(k(k({},(a=e.compatibility)!==null&&a!==void 0?a:{}),{},{version:(o=(l=(c=e.compatibility)===null||c===void 0?void 0:c.version)!==null&&l!==void 0?l:e.compatibilityModeVersion)!==null&&o!==void 0?o:15})))}},Xf=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{val:"w:val"})}},iS=class extends I{constructor(e){super("w:name"),this.root.push(new Xf({val:e}))}},sS=class extends I{constructor(e){super("w:uiPriority"),this.root.push(new Xf({val:oe(e)}))}},aS=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{type:"w:type",styleId:"w:styleId",default:"w:default",customStyle:"w:customStyle"})}},ec=class extends I{constructor(e,t){super("w:style"),this.root.push(new aS(e)),t.name&&this.root.push(new iS(t.name)),t.basedOn&&t.basedOn!==e.styleId&&this.root.push(new et("w:basedOn",t.basedOn)),t.next&&this.root.push(new et("w:next",t.next)),t.link&&this.root.push(new et("w:link",t.link)),t.uiPriority!==void 0&&this.root.push(new sS(t.uiPriority)),t.semiHidden!==void 0&&this.root.push(new P("w:semiHidden",t.semiHidden)),t.unhideWhenUsed!==void 0&&this.root.push(new P("w:unhideWhenUsed",t.unhideWhenUsed)),t.quickFormat!==void 0&&this.root.push(new P("w:qFormat",t.quickFormat))}},gt=class extends ec{constructor(e){super({type:"paragraph",styleId:e.id},e),S(this,"paragraphProperties",void 0),S(this,"runProperties",void 0),this.paragraphProperties=new Sn(e.paragraph,{implicitListParagraphStyle:!1,inListOrder:!1}),this.runProperties=new Zt(e.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties)}},en=class extends ec{constructor(e){super({type:"character",styleId:e.id},k({uiPriority:99,unhideWhenUsed:!0},e)),S(this,"runProperties",void 0),this.runProperties=new Zt(e.run),this.root.push(this.runProperties)}},Dt=class extends gt{constructor(e){super(k({basedOn:"Normal",next:"Normal",quickFormat:!0},e))}},oS=class extends Dt{constructor(e){super(k({id:"Title",name:"Title"},e))}},lS=class extends Dt{constructor(e){super(k({id:"Heading1",name:"Heading 1"},e))}},cS=class extends Dt{constructor(e){super(k({id:"Heading2",name:"Heading 2"},e))}},dS=class extends Dt{constructor(e){super(k({id:"Heading3",name:"Heading 3"},e))}},pS=class extends Dt{constructor(e){super(k({id:"Heading4",name:"Heading 4"},e))}},uS=class extends Dt{constructor(e){super(k({id:"Heading5",name:"Heading 5"},e))}},hS=class extends Dt{constructor(e){super(k({id:"Heading6",name:"Heading 6"},e))}},fS=class extends Dt{constructor(e){super(k({id:"Strong",name:"Strong"},e))}},mS=class extends gt{constructor(e){super(k({id:"ListParagraph",name:"List Paragraph",basedOn:"Normal",quickFormat:!0},e))}},gS=class extends gt{constructor(e){super(k({id:"Caption",name:"caption",basedOn:"Normal",next:"Normal",uiPriority:35,semiHidden:!0,unhideWhenUsed:!0,quickFormat:!0,paragraph:{spacing:{after:200}},run:{italics:!0,color:{theme:"dark2"},size:18}},e))}},bS=class extends gt{constructor(e){super(k({id:"Bibliography",name:"Bibliography",basedOn:"Normal",next:"Normal",uiPriority:37,unhideWhenUsed:!0},e))}},Yf=new WeakSet,Yu=e=>Yf.has(e),ut=class extends gt{constructor(e,t){super({id:`TOC${e}`,name:`toc ${e}`,basedOn:"Normal",next:"Normal",uiPriority:39,semiHidden:!0,unhideWhenUsed:!0,paragraph:k({spacing:{after:100}},e>1?{indent:{left:(e-1)*t}}:{})})}prepForXml(e){let t=super.prepForXml(e);return Yf.add(t),t}},Jf=class extends gt{constructor(e){super(k({id:"FootnoteText",name:"footnote text",link:"FootnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:Tn.AUTO}},run:{size:20}},e))}},Qf=class extends en{constructor(e){super(k({id:"FootnoteReference",name:"footnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},e))}},Zf=class extends en{constructor(e){super(k({id:"FootnoteTextChar",name:"Footnote Text Char",basedOn:"DefaultParagraphFont",link:"FootnoteText",semiHidden:!0,run:{size:20}},e))}},em=class extends gt{constructor(e){super(k({id:"EndnoteText",name:"endnote text",link:"EndnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:Tn.AUTO}},run:{size:20}},e))}},tm=class extends en{constructor(e){super(k({id:"EndnoteReference",name:"endnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},e))}},nm=class extends en{constructor(e){super(k({id:"EndnoteTextChar",name:"Endnote Text Char",basedOn:"DefaultParagraphFont",link:"EndnoteText",semiHidden:!0,run:{size:20}},e))}},vS=class extends en{constructor(e){super(k({id:"Hyperlink",name:"Hyperlink",basedOn:"DefaultParagraphFont",run:{color:"0563C1",underline:{type:Jh.SINGLE}}},e))}},wS=class extends en{constructor(e){super(k({id:"LineNumber",name:"line number",basedOn:"DefaultParagraphFont",semiHidden:!0},e))}},yS=class extends ec{constructor(){super({type:"table",styleId:"TableNormal",default:!0},{name:"Normal Table",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0}),this.root.push(new Zl({indent:{size:0,type:De.DXA},cellMargin:{top:0,left:108,bottom:0,right:108}}))}},wr=e=>typeof e=="object"?Object.keys(e)[0]:void 0,tc=e=>{var t;return(t=[e["w:style"]].flat().find(n=>n._attr))===null||t===void 0?void 0:t._attr},Ju=e=>{var t;return(t=tc(e))===null||t===void 0?void 0:t["w:styleId"]},Qu=e=>{var t;let n=(t=[e["w:style"]].flat().find(r=>wr(r)==="w:name"))===null||t===void 0||(t=t["w:name"])===null||t===void 0||(t=t._attr)===null||t===void 0?void 0:t["w:val"];return n===void 0?void 0:String(n).toLowerCase()},wl=e=>{var t,n;return wr(e)==="w:style"&&((t=(n=tc(e))===null||n===void 0?void 0:n["w:type"])!==null&&t!==void 0?t:"paragraph")==="paragraph"},xS=e=>{let t=wl(e)?tc(e):void 0;return t?.["w:default"]!==void 0&&!["0","false","off"].includes(String(t["w:default"]))},kS=e=>({"w:style":[e["w:style"]].flat().map(t=>t._attr?{_attr:k(k({},t._attr),{},{"w:default":"1"})}:t)}),Xo=class extends I{constructor(e){if(super("w:styles"),e.initialStyles&&this.root.push(e.initialStyles),e.importedStyles)for(let t of e.importedStyles)this.root.push(t);if(e.paragraphStyles)for(let t of e.paragraphStyles)this.root.push(new gt(t));if(e.characterStyles)for(let t of e.characterStyles)this.root.push(new en(t))}prepForXml(e){let t=super.prepForXml(e),n=t["w:styles"];if(!Array.isArray(n))return t;let r=c=>n.filter(d=>wr(d)===c),i=n.map(c=>wr(c)==="w:style"?Ju(c):void 0),s=n.filter((c,d)=>!["_attr","w:docDefaults","w:latentStyles"].includes(wr(c))&&(i[d]===void 0||i.lastIndexOf(i[d])===d)),a=new Set(s.filter(c=>wl(c)&&!Yu(c)).map(Qu)),o=s.filter(c=>!Yu(c)||!a.has(Qu(c))),l=o.some(xS)?o:o.map(c=>wl(c)&&Ju(c)==="Normal"?kS(c):c);return{"w:styles":[...r("_attr"),...r("w:docDefaults").slice(-1),...r("w:latentStyles").slice(-1),...l]}}},TS=class extends I{constructor(e){super("w:pPrDefault"),this.root.push(new Sn(e,{implicitListParagraphStyle:!1,inListOrder:!1}))}},SS=class extends I{constructor(e){super("w:rPrDefault"),this.root.push(new Zt(e))}},ES=class extends I{constructor(e){super("w:docDefaults"),S(this,"runPropertiesDefaults",void 0),S(this,"paragraphPropertiesDefaults",void 0),this.runPropertiesDefaults=new SS(e.run),this.paragraphPropertiesDefaults=new TS(e.paragraph),this.root.push(this.runPropertiesDefaults),this.root.push(this.paragraphPropertiesDefaults)}},CS=class{newInstance(e){let t=Pr(e),n;for(let i of t.elements||[])i.name==="w:styles"&&(n=i);if(n===void 0)throw new Error("can not find styles element");let r=n.elements||[];return{initialStyles:new Cy(n.attributes),importedStyles:r.map(i=>Bl(i))}}},_S=e=>{var t;let n=(t=e.document)===null||t===void 0||(t=t.run)===null||t===void 0?void 0:t.size;return n===void 0?200:Math.round(typeof n=="number"?n*10:Ot(n))},AS=e=>({tableOfContents1:new ut(1,e),tableOfContents2:new ut(2,e),tableOfContents3:new ut(3,e),tableOfContents4:new ut(4,e),tableOfContents5:new ut(5,e),tableOfContents6:new ut(6,e),tableOfContents7:new ut(7,e),tableOfContents8:new ut(8,e),tableOfContents9:new ut(9,e)}),nc=(e={})=>{var t;return k(k({normal:new gt({id:"Normal",name:"Normal",quickFormat:!0}),normalTable:new yS,document:new ES((t=e.document)!==null&&t!==void 0?t:{}),title:new oS(k({run:{size:56}},e.title)),heading1:new lS(k({run:{color:"2E74B5",size:32}},e.heading1)),heading2:new cS(k({run:{color:"2E74B5",size:26}},e.heading2)),heading3:new dS(k({run:{color:"1F4D78",size:24}},e.heading3)),heading4:new pS(k({run:{color:"2E74B5",italics:!0}},e.heading4)),heading5:new uS(k({run:{color:"2E74B5"}},e.heading5)),heading6:new hS(k({run:{color:"1F4D78"}},e.heading6)),strong:new fS(k({run:{bold:!0}},e.strong)),listParagraph:new mS(e.listParagraph||{}),caption:new gS(e.caption||{}),bibliography:new bS(e.bibliography||{})},AS(_S(e))),{},{hyperlink:new vS(e.hyperlink||{}),footnoteReference:new Qf(e.footnoteReference||{}),footnoteText:new Jf(e.footnoteText||{}),footnoteTextChar:new Zf(e.footnoteTextChar||{}),endnoteReference:new tm(e.endnoteReference||{}),endnoteText:new em(e.endnoteText||{}),endnoteTextChar:new nm(e.endnoteTextChar||{}),lineNumber:new wS(e.lineNumber||{})})},Zu=class{newInstance(e={}){return{initialStyles:new Ds(["mc","r","w","w14","w15"],"w14 w15"),importedStyles:Object.values(nc(e))}}},rm={headings:{latin:"Calibri Light",panose:"020F0302020204030204"},body:{latin:"Calibri",panose:"020F0502020204030204"}},NS=[["Jpan","\u6E38\u30B4\u30B7\u30C3\u30AF Light","\u6E38\u660E\u671D"],["Hang","\uB9D1\uC740 \uACE0\uB515"],["Hans","\u7B49\u7EBF Light","\u7B49\u7EBF"],["Hant","\u65B0\u7D30\u660E\u9AD4"],["Arab","Times New Roman","Arial"],["Hebr","Times New Roman","Arial"],["Thai","Angsana New","Cordia New"],["Ethi","Nyala"],["Beng","Vrinda"],["Gujr","Shruti"],["Khmr","MoolBoran","DaunPenh"],["Knda","Tunga"],["Guru","Raavi"],["Cans","Euphemia"],["Cher","Plantagenet Cherokee"],["Yiii","Microsoft Yi Baiti"],["Tibt","Microsoft Himalaya"],["Thaa","MV Boli"],["Deva","Mangal"],["Telu","Gautami"],["Taml","Latha"],["Syrc","Estrangelo Edessa"],["Orya","Kalinga"],["Mlym","Kartika"],["Laoo","DokChampa"],["Sinh","Iskoola Pota"],["Mong","Mongolian Baiti"],["Viet","Times New Roman","Arial"],["Uigh","Microsoft Uighur"],["Geor","Sylfaen"],["Armn","Arial"],["Bugi","Leelawadee UI"],["Bopo","Microsoft JhengHei"],["Java","Javanese Text"],["Lisu","Segoe UI"],["Mymr","Myanmar Text"],["Nkoo","Ebrima"],["Olck","Nirmala UI"],["Osma","Ebrima"],["Phag","Phagspa"],["Syrn","Estrangelo Edessa"],["Syrj","Estrangelo Edessa"],["Syre","Estrangelo Edessa"],["Sora","Nirmala UI"],["Tale","Microsoft Tai Le"],["Talu","Microsoft New Tai Lue"],["Tfng","Ebrima"]],Yo=(e,t,n)=>new O({name:e,attributes:{typeface:{key:"typeface",value:t},panose:{key:"panose",value:n}}}),IS=(e,t)=>{let n=t[e],r=typeof n=="string"?n:n?.latin;return r??rm[e].latin},PS=(e,t={})=>{let n=NS.map(([i,s,a=s])=>{var o;return[i,(o=t[i])!==null&&o!==void 0?o:e==="headings"?s:a]}),r=new Set(n.map(([i])=>i));return[...n,...Object.entries(t).filter(([i])=>!r.has(i))]},eh=(e,t)=>{let n=t[e],{eastAsia:r="",complexScript:i="",scripts:s}=typeof n=="object"?n:{},a=IS(e,t),o=rm[e];return new O({name:e==="headings"?"a:majorFont":"a:minorFont",children:[Yo("a:latin",a,a===o.latin?o.panose:void 0),Yo("a:ea",r),Yo("a:cs",i),...PS(e,s).map(([l,c])=>new O({name:"a:font",attributes:{script:{key:"script",value:l},typeface:{key:"typeface",value:c}}}))]})},OS=(e,t={})=>new O({name:"a:fontScheme",attributes:{name:{key:"name",value:e}},children:[eh("headings",t),eh("body",t)]}),im=(e=[])=>new O({name:"a:schemeClr",attributes:{value:{key:"val",value:"phClr"}},children:e.map(([t,n])=>new O({name:`a:${t}`,attributes:{value:{key:"val",value:n}}}))}),gs=e=>new O({name:"a:solidFill",children:[im(e)]}),Jo=e=>new O({name:"a:gradFill",attributes:{rotateWithShape:{key:"rotWithShape",value:!0}},children:[new O({name:"a:gsLst",children:e.map((t,n)=>new O({name:"a:gs",attributes:{position:{key:"pos",value:n*5e4}},children:[im(t)]}))}),new O({name:"a:lin",attributes:{angle:{key:"ang",value:54e5},scaled:{key:"scaled",value:!1}}})]}),Qo=e=>new O({name:"a:ln",attributes:{width:{key:"w",value:e},cap:{key:"cap",value:"flat"},compound:{key:"cmpd",value:"sng"},alignment:{key:"algn",value:"ctr"}},children:[gs(),new O({name:"a:prstDash",attributes:{value:{key:"val",value:"solid"}}}),new O({name:"a:miter",attributes:{limit:{key:"lim",value:8e5}}})]}),Zo=e=>new O({name:"a:effectStyle",children:[new O({name:"a:effectLst",children:e})]}),LS=()=>new O({name:"a:outerShdw",attributes:{blurRadius:{key:"blurRad",value:57150},distance:{key:"dist",value:19050},direction:{key:"dir",value:54e5},alignment:{key:"algn",value:"ctr"},rotateWithShape:{key:"rotWithShape",value:!1}},children:[new O({name:"a:srgbClr",attributes:{value:{key:"val",value:"000000"}},children:[new O({name:"a:alpha",attributes:{value:{key:"val",value:63e3}}})]})]}),RS=()=>new O({name:"a:fmtScheme",attributes:{name:{key:"name",value:"Office"}},children:[new O({name:"a:fillStyleLst",children:[gs(),Jo([[["lumMod",11e4],["satMod",105e3],["tint",67e3]],[["lumMod",105e3],["satMod",103e3],["tint",73e3]],[["lumMod",105e3],["satMod",109e3],["tint",81e3]]]),Jo([[["satMod",103e3],["lumMod",102e3],["tint",94e3]],[["satMod",11e4],["lumMod",1e5],["shade",1e5]],[["lumMod",99e3],["satMod",12e4],["shade",78e3]]])]}),new O({name:"a:lnStyleLst",children:[Qo(6350),Qo(12700),Qo(19050)]}),new O({name:"a:effectStyleLst",children:[Zo([]),Zo([]),Zo([LS()])]}),new O({name:"a:bgFillStyleLst",children:[gs(),gs([["tint",95e3],["satMod",17e4]]),Jo([[["tint",93e3],["satMod",15e4],["shade",98e3],["lumMod",102e3]],[["tint",98e3],["satMod",13e4],["shade",9e4],["lumMod",103e3]],[["shade",63e3],["satMod",12e4]]])]})]}),MS=class extends I{constructor({name:e="Office Theme",colors:t,fonts:n}={}){super("a:theme"),S(this,"colors",void 0),this.colors=Hl(t),this.root.push(new Nh({namespace:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"},name:{key:"name",value:e}})),this.root.push(new O({name:"a:themeElements",children:[My(t?e:"Office",t),OS(n?e:"Office",n),RS()]})),this.root.push(new O({name:"a:objectDefaults"})),this.root.push(new O({name:"a:extraClrSchemeLst"}))}get Colors(){return this.colors}},Ge=e=>{let t=e.lastIndexOf("/");return`${e.slice(0,t+1)}_rels/${e.slice(t+1)}.rels`},sm=e=>e.replace(/(^|\/)_rels\/([^/]*)\.rels$/,"$1$2"),am=e=>e.slice(0,e.lastIndexOf("/")+1),tn=(e,t)=>{let n=t.replace(/\\/g,"/");return(n.startsWith("/")?n:`${am(e)}${n}`).split("/").reduce((r,i)=>i===""||i==="."?r:i===".."?r.slice(0,-1):[...r,i],[]).join("/")},rc=(e,t)=>{let n=am(e).split("/").filter(Boolean),r=t.split("/"),i=n.findIndex((a,o)=>o>=r.length-1||r[o]!==a),s=i===-1?n.length:i;return[...n.slice(s).map(()=>".."),...r.slice(s)].join("/")},DS=(e,t)=>e.toLowerCase()===t.toLowerCase(),ae=Uint8Array,Oe=Uint16Array,ic=Int32Array,Bs=new ae([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),$s=new ae([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),yl=new ae([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),om=function(e,t){for(var n=new Oe(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new ic(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return{b:n,r:i}},lm=om(Bs,2),cm=lm.b,xl=lm.r;cm[28]=258,xl[258]=28;dm=om($s,0),BS=dm.b,th=dm.r,kl=new Oe(32768);for(K=0;K<32768;++K)ht=(K&43690)>>1|(K&21845)<<1,ht=(ht&52428)>>2|(ht&13107)<<2,ht=(ht&61680)>>4|(ht&3855)<<4,kl[K]=((ht&65280)>>8|(ht&255)<<8)>>1;tt=(function(e,t,n){for(var r=e.length,i=0,s=new Oe(t);i<r;++i)e[i]&&++s[e[i]-1];var a=new Oe(t);for(i=1;i<t;++i)a[i]=a[i-1]+s[i-1]<<1;var o;if(n){o=new Oe(1<<t);var l=15-t;for(i=0;i<r;++i)if(e[i])for(var c=i<<4|e[i],d=t-e[i],p=a[e[i]-1]++<<d,u=p|(1<<d)-1;p<=u;++p)o[kl[p]>>l]=c}else for(o=new Oe(r),i=0;i<r;++i)e[i]&&(o[i]=kl[a[e[i]-1]++]>>15-e[i]);return o}),Mt=new ae(288);for(K=0;K<144;++K)Mt[K]=8;for(K=144;K<256;++K)Mt[K]=9;for(K=256;K<280;++K)Mt[K]=7;for(K=280;K<288;++K)Mt[K]=8;_r=new ae(32);for(K=0;K<32;++K)_r[K]=5;$S=tt(Mt,9,0),FS=tt(Mt,9,1),HS=tt(_r,5,0),US=tt(_r,5,1),el=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},je=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},tl=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},sc=function(e){return(e+7)/8|0},Mr=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new ae(e.subarray(t,n))},qS=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Se=function(e,t,n){var r=new Error(t||qS[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Se),!n)throw r;return r},WS=function(e,t,n,r){var i=e.length,s=r?r.length:0;if(!i||t.f&&!t.l)return n||new ae(0);var a=!n,o=a||t.i!=2,l=t.i;a&&(n=new ae(i*3));var c=function(se){var Y=n.length;if(se>Y){var Pe=new ae(Math.max(Y*2,se));Pe.set(n),n=Pe}},d=t.f||0,p=t.p||0,u=t.b||0,f=t.l,m=t.d,h=t.m,g=t.n,v=i*8;do{if(!f){d=je(e,p,1);var w=je(e,p+1,3);if(p+=3,w)if(w==1)f=FS,m=US,h=9,g=5;else if(w==2){var y=je(e,p,31)+257,T=je(e,p+10,15)+4,x=y+je(e,p+5,31)+1;p+=14;for(var _=new ae(x),N=new ae(19),M=0;M<T;++M)N[yl[M]]=je(e,p+M*3,7);p+=T*3;for(var D=el(N),V=(1<<D)-1,re=tt(N,D,1),M=0;M<x;){var ee=re[je(e,p,V)];p+=ee&15;var b=ee>>4;if(b<16)_[M++]=b;else{var te=0,X=0;for(b==16?(X=3+je(e,p,3),p+=2,te=_[M-1]):b==17?(X=3+je(e,p,7),p+=3):b==18&&(X=11+je(e,p,127),p+=7);X--;)_[M++]=te}}var fe=_.subarray(0,y),le=_.subarray(y);h=el(fe),g=el(le),f=tt(fe,h,1),m=tt(le,g,1)}else Se(1);else{var b=sc(p)+4,C=e[b-4]|e[b-3]<<8,A=b+C;if(A>i){l&&Se(0);break}o&&c(u+C),n.set(e.subarray(b,A),u),t.b=u+=C,t.p=p=A*8,t.f=d;continue}if(p>v){l&&Se(0);break}}o&&c(u+131072);for(var wt=(1<<h)-1,Ee=(1<<g)-1,Fe=p;;Fe=p){var te=f[tl(e,p)&wt],ve=te>>4;if(p+=te&15,p>v){l&&Se(0);break}if(te||Se(2),ve<256)n[u++]=ve;else if(ve==256){Fe=p,f=null;break}else{var we=ve-254;if(ve>264){var M=ve-257,Q=Bs[M];we=je(e,p,(1<<Q)-1)+cm[M],p+=Q}var R=m[tl(e,p)&Ee],$=R>>4;R||Se(3),p+=R&15;var le=BS[$];if($>3){var Q=$s[$];le+=tl(e,p)&(1<<Q)-1,p+=Q}if(p>v){l&&Se(0);break}o&&c(u+131072);var F=u+we;if(u<le){var Z=s-le,ie=Math.min(le,F);for(Z+u<0&&Se(3);u<ie;++u)n[u]=r[Z+u]}for(;u<F;++u)n[u]=n[u-le]}}t.l=f,t.p=Fe,t.b=u,t.f=d,f&&(d=1,t.m=h,t.d=m,t.n=g)}while(!d);return u!=n.length&&a?Mr(n,0,u):n.subarray(0,u)},ft=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},pr=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},nl=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,s=n.slice();if(!i)return{t:um,l:0};if(i==1){var a=new ae(n[0].s+1);return a[n[0].s]=1,{t:a,l:1}}n.sort(function(A,y){return A.f-y.f}),n.push({s:-1,f:25001});var o=n[0],l=n[1],c=0,d=1,p=2;for(n[0]={s:-1,f:o.f+l.f,l:o,r:l};d!=i-1;)o=n[n[c].f<n[p].f?c++:p++],l=n[c!=d&&n[c].f<n[p].f?c++:p++],n[d++]={s:-1,f:o.f+l.f,l:o,r:l};for(var u=s[0].s,r=1;r<i;++r)s[r].s>u&&(u=s[r].s);var f=new Oe(u+1),m=Tl(n[d-1],f,0);if(m>t){var r=0,h=0,g=m-t,v=1<<g;for(s.sort(function(y,T){return f[T.s]-f[y.s]||y.f-T.f});r<i;++r){var w=s[r].s;if(f[w]>t)h+=v-(1<<m-f[w]),f[w]=t;else break}for(h>>=g;h>0;){var b=s[r].s;f[b]<t?h-=1<<t-f[b]++-1:++r}for(;r>=0&&h;--r){var C=s[r].s;f[C]==t&&(--f[C],++h)}m=t}return{t:new ae(f),l:m}},Tl=function(e,t,n){return e.s==-1?Math.max(Tl(e.l,t,n+1),Tl(e.r,t,n+1)):t[e.s]=n},nh=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Oe(++t),r=0,i=e[0],s=1,a=function(l){n[r++]=l},o=1;o<=t;++o)if(e[o]==i&&o!=t)++s;else{if(!i&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(i),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(i);s=1,i=e[o]}return{c:n.subarray(0,r),n:t}},ur=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},pm=function(e,t,n){var r=n.length,i=sc(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var s=0;s<r;++s)e[i+s+4]=n[s];return(i+4+r)*8},rh=function(e,t,n,r,i,s,a,o,l,c,d){ft(t,d++,n),++i[256];for(var p=nl(i,15),u=p.t,f=p.l,m=nl(s,15),h=m.t,g=m.l,v=nh(u),w=v.c,b=v.n,C=nh(h),A=C.c,y=C.n,T=new Oe(19),x=0;x<w.length;++x)++T[w[x]&31];for(var x=0;x<A.length;++x)++T[A[x]&31];for(var _=nl(T,7),N=_.t,M=_.l,D=19;D>4&&!N[yl[D-1]];--D);var V=c+5<<3,re=ur(i,Mt)+ur(s,_r)+a,ee=ur(i,u)+ur(s,h)+a+14+3*D+ur(T,N)+2*T[16]+3*T[17]+7*T[18];if(l>=0&&V<=re&&V<=ee)return pm(t,d,e.subarray(l,l+c));var te,X,fe,le;if(ft(t,d,1+(ee<re)),d+=2,ee<re){te=tt(u,f,0),X=u,fe=tt(h,g,0),le=h;var wt=tt(N,M,0);ft(t,d,b-257),ft(t,d+5,y-1),ft(t,d+10,D-4),d+=14;for(var x=0;x<D;++x)ft(t,d+3*x,N[yl[x]]);d+=3*D;for(var Ee=[w,A],Fe=0;Fe<2;++Fe)for(var ve=Ee[Fe],x=0;x<ve.length;++x){var we=ve[x]&31;ft(t,d,wt[we]),d+=N[we],we>15&&(ft(t,d,ve[x]>>5&127),d+=ve[x]>>12)}}else te=$S,X=Mt,fe=HS,le=_r;for(var x=0;x<o;++x){var Q=r[x];if(Q>255){var we=Q>>18&31;pr(t,d,te[we+257]),d+=X[we+257],we>7&&(ft(t,d,Q>>23&31),d+=Bs[we]);var R=Q&31;pr(t,d,fe[R]),d+=le[R],R>3&&(pr(t,d,Q>>5&8191),d+=$s[R])}else pr(t,d,te[Q]),d+=X[Q]}return pr(t,d,te[256]),d+X[256]},jS=new ic([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),um=new ae(0),KS=function(e,t,n,r,i,s){var a=s.z||e.length,o=new ae(r+a+5*(1+Math.ceil(a/7e3))+i),l=o.subarray(r,o.length-i),c=s.l,d=(s.r||0)&7;if(t){d&&(l[0]=s.r>>3);for(var p=jS[t-1],u=p>>13,f=p&8191,m=(1<<n)-1,h=s.p||new Oe(32768),g=s.h||new Oe(m+1),v=Math.ceil(n/3),w=2*v,b=function(Pe){return(e[Pe]^e[Pe+1]<<v^e[Pe+2]<<w)&m},C=new ic(25e3),A=new Oe(288),y=new Oe(32),T=0,x=0,_=s.i||0,N=0,M=s.w||0,D=0;_+2<a;++_){var V=b(_),re=_&32767,ee=g[V];if(h[re]=ee,g[V]=re,M<=_){var te=a-_;if((T>7e3||N>24576)&&(te>423||!c)){d=rh(e,l,0,C,A,y,x,N,D,_-D,d),N=T=x=0,D=_;for(var X=0;X<286;++X)A[X]=0;for(var X=0;X<30;++X)y[X]=0}var fe=2,le=0,wt=f,Ee=re-ee&32767;if(te>2&&V==b(_-Ee))for(var Fe=Math.min(u,te)-1,ve=Math.min(32767,_),we=Math.min(258,te);Ee<=ve&&--wt&&re!=ee;){if(e[_+fe]==e[_+fe-Ee]){for(var Q=0;Q<we&&e[_+Q]==e[_+Q-Ee];++Q);if(Q>fe){if(fe=Q,le=Ee,Q>Fe)break;for(var R=Math.min(Ee,Q-2),$=0,X=0;X<R;++X){var F=_-Ee+X&32767,Z=F-h[F]&32767;Z>$&&($=Z,ee=F)}}}re=ee,ee=h[re],Ee+=re-ee&32767}if(le){C[N++]=268435456|xl[fe]<<18|th[le];var ie=xl[fe]&31,se=th[le]&31;x+=Bs[ie]+$s[se],++A[257+ie],++y[se],M=_+fe,++T}else C[N++]=e[_],++A[e[_]]}}for(_=Math.max(_,M);_<a;++_)C[N++]=e[_],++A[e[_]];d=rh(e,l,c,C,A,y,x,N,D,_-D,d),c||(s.r=d&7|l[d/8|0]<<3,d-=7,s.h=g,s.p=h,s.i=_,s.w=M)}else{for(var _=s.w||0;_<a+c;_+=65535){var Y=_+65535;Y>=a&&(l[d/8|0]=c,Y=a),d=pm(l,d+1,e.subarray(_,Y))}s.i=a}return Mr(o,0,r+sc(d)+i)},GS=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),zS=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=GS[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},VS=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),a=new ae(s.length+e.length);a.set(s),a.set(e,s.length),e=a,i.w=s.length}return KS(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},hm=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},Qe=function(e,t){return e[t]|e[t+1]<<8},Re=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},rl=function(e,t){return Re(e,t)+Re(e,t+4)*4294967296},xe=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};fm=function(e,t,n,r){for(var i in e){var s=e[i],a=t+i,o=r;Array.isArray(s)&&(o=hm(r,s[1]),s=s[0]),ArrayBuffer.isView(s)?n[a]=[s,o]:(n[a+="/"]=[new ae(0),o],fm(s,a,n,r))}},ih=typeof TextEncoder<"u"&&new TextEncoder,Sl=typeof TextDecoder<"u"&&new TextDecoder;try{Sl.decode(um,{stream:!0})}catch{}JS=function(e){for(var t="",n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:Mr(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};ZS=function(e,t){return t+30+Qe(e,t+26)+Qe(e,t+28)},e2=function(e,t,n){var r=Qe(e,t+28),i=Qe(e,t+30),s=QS(e.subarray(t+46,t+46+r),!(Qe(e,t+8)&2048)),a=t+46+r,o=t2(e,a,i,n,Re(e,t+20),Re(e,t+24),Re(e,t+42)),l=o[0],c=o[1],d=o[2];return[Qe(e,t+10),l,c,s,a+i+Qe(e,t+32),d]},t2=function(e,t,n,r,i,s,a){var o=i==4294967295,l=s==4294967295,c=a==4294967295,d=t+n,p=o+l+c;if(r&&p){for(;t+4<d;t+=4+Qe(e,t+2))if(Qe(e,t)==1)return[o?rl(e,t+4+8*l):i,l?rl(e,t+4):s,c?rl(e,t+4+8*(l+o)):a,1];r<2&&Se(13)}return[i,s,a,0]},El=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&Se(9),t+=r+4}return t},ah=function(e,t,n,r,i,s,a,o){var l=r.length,c=n.extra,d=o&&o.length,p=El(c);xe(e,t,a!=null?33639248:67324752),t+=4,a!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(s<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var u=new Date(n.mtime==null?Date.now():n.mtime),f=u.getFullYear()-1980;if((f<0||f>119)&&Se(10),xe(e,t,f<<25|u.getMonth()+1<<21|u.getDate()<<16|u.getHours()<<11|u.getMinutes()<<5|u.getSeconds()>>1),t+=4,s!=-1&&(xe(e,t,n.crc),xe(e,t+4,s<0?-s-2:s),xe(e,t+8,n.size)),xe(e,t+12,l),xe(e,t+14,p),t+=16,a!=null&&(xe(e,t,d),xe(e,t+6,n.attrs),xe(e,t+10,a),t+=14),e.set(r,t),t+=l,p)for(var m in c){var h=c[m],g=h.length;xe(e,t,+m),xe(e,t+2,g),e.set(h,t+4),t+=4+g}return d&&(e.set(o,t),t+=d),t},n2=function(e,t,n,r,i){xe(e,t,101010256),xe(e,t+8,n),xe(e,t+10,n),xe(e,t+12,r),xe(e,t+16,i)};s2=e=>typeof e=="string"?xx(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),Ss=e=>r2(Object.fromEntries([...e].map(([t,n])=>[t,s2(n)]))),a2=1032,oh=e=>new Error(`Corrupted zip: ${e} isn't the size the zip file gives it`),mm=(e,t=()=>!0)=>{let n=new Map,r=0,i=i2(e,{filter:({name:a,size:o,originalSize:l})=>{if(a.endsWith("/")||!t(a))return!1;if(r+=o,r>e.length||l>o*a2)throw oh(a);return n.set(a,l),!0}}),s=Object.entries(i).find(([a,o])=>o.length!==n.get(a));if(s!==void 0)throw oh(s[0]);return new Map(Object.entries(i))},il=e=>{let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t},bs=e=>new Error(`${e} is not supported by this platform`),lh={uint8array:e=>e,arraybuffer:e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),array:e=>Array.from(e),string:il,binarystring:il,base64:e=>btoa(il(e)),blob:(e,t)=>{if(typeof Blob>"u")throw bs("blob");return new Blob([e],{type:t})},nodebuffer:e=>{if(typeof Buffer>"u")throw bs("nodebuffer");return Buffer.from(e.buffer,e.byteOffset,e.byteLength)},text:()=>{throw bs("text")}},Cl=(e,t,n)=>{let r=Object.prototype.hasOwnProperty.call(lh,t.toLowerCase())?lh[t.toLowerCase()]:void 0;if(r===void 0)throw bs(t);return r(e,n)},o2=new Map([["dk1","dark1"],["lt1","light1"],["dk2","dark2"],["lt2","light2"],["accent1","accent1"],["accent2","accent2"],["accent3","accent3"],["accent4","accent4"],["accent5","accent5"],["accent6","accent6"],["hlink","hyperlink"],["folHlink","followedHyperlink"]]),l2=new Map([["dark1","windowText"],["light1","window"]]),c2=new Set(["http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme","http://purl.oclc.org/ooxml/officeDocument/relationships/theme"]),Ar=e=>{var t,n;return(t=e==null||(n=e.name)===null||n===void 0?void 0:n.slice(e.name.indexOf(":")+1))!==null&&t!==void 0?t:""},Dr=e=>{var t,n;return(t=e==null||(n=e.elements)===null||n===void 0?void 0:n.filter(r=>r.type==="element"))!==null&&t!==void 0?t:[]},_l=(e,t)=>Dr(e).find(n=>Ar(n)===t),yr=(e,t)=>{var n;let r=e==null||(n=e.attributes)===null||n===void 0?void 0:n[t];return r===void 0?void 0:String(r)},d2=e=>new TextDecoder(e[0]===255&&e[1]===254?"utf-16le":e[0]===254&&e[1]===255?"utf-16be":"utf-8").decode(e),p2=(e,t,n)=>{let r=e.get(Ge(t)),i=yr(r&&Dr(_l(Pr(d2(r)),"Relationships")).find(s=>{var a;return n.has((a=yr(s,"Type"))!==null&&a!==void 0?a:"")}),"Target");return i===void 0?void 0:tn(t,i)},u2=(e,t)=>p2(e,t,c2),h2=(e,t,n)=>{let[r]=Dr(t),i=Ar(r)==="srgbClr"?yr(r,"val"):Ar(r)==="sysClr"&&(n||yr(r,"val")!==l2.get(e))?yr(r,"lastClr"):void 0;return i!==void 0&&/^[0-9A-Fa-f]{6}$/.test(i)?i.toUpperCase():void 0},f2=(e,t=!1)=>Object.fromEntries(Dr(e).flatMap(n=>{let r=o2.get(Ar(n)),i=r&&h2(r,n,t);return r&&i?[[r,i]]:[]})),m2=e=>{let[t]=Dr(Pr(e)),n=Ar(t)==="theme"?_l(_l(t,"themeElements"),"clrScheme"):void 0;return n?f2(n,!0):{}},g2=[208,207,17,224,161,177,26,225],gm=class{constructor(e){var t,n,r,i,s,a,o,l,c,d,p,u,f,m;if(S(this,"currentRelationshipId",1),S(this,"documentWrapper",void 0),S(this,"headers",[]),S(this,"footers",[]),S(this,"coreProperties",void 0),S(this,"numbering",void 0),S(this,"media",void 0),S(this,"fileRelationships",void 0),S(this,"footnotesWrapper",void 0),S(this,"endnotesWrapper",void 0),S(this,"settings",void 0),S(this,"contentTypes",void 0),S(this,"customProperties",void 0),S(this,"appProperties",void 0),S(this,"styles",void 0),S(this,"comments",void 0),S(this,"commentsExtended",void 0),S(this,"commentsIds",void 0),S(this,"fontWrapper",void 0),S(this,"theme",void 0),S(this,"packageParts",void 0),S(this,"macros",void 0),S(this,"bibliography",void 0),e.macros!==void 0){let{project:b,events:C=[]}=e.macros,A=b instanceof Uint8Array?b:new Uint8Array(b);if(!g2.every((T,x)=>A[x]===T))throw new Error("macros.project isn't a VBA project. Use createMacros from docx/macros, or the word/vbaProject.bin in a .docm rather than the .docm itself");let y=new ge;C.length>0&&y.addRelationship(1,"http://schemas.microsoft.com/office/2006/relationships/wordVbaData","vbaData.xml"),this.macros={project:A,events:C.length>0?pT(C):void 0,relationships:y}}if(this.coreProperties=new nT(k(k({},e),{},{creator:(t=e.creator)!==null&&t!==void 0?t:"Un-named",revision:(n=e.revision)!==null&&n!==void 0?n:1,lastModifiedBy:(r=e.lastModifiedBy)!==null&&r!==void 0?r:"Un-named"})),this.numbering=new zf(e.numbering?e.numbering:{config:[]}),this.comments=new S1((i=e.comments)!==null&&i!==void 0?i:{children:[]}),this.comments.ThreadData&&(this.commentsExtended=new A1(this.comments.ThreadData)),this.comments.CommentIdsData&&(this.commentsIds=new O1(this.comments.CommentIdsData)),this.fileRelationships=new ge,this.customProperties=new lT((s=e.customProperties)!==null&&s!==void 0?s:[]),this.appProperties=new Zk,this.footnotesWrapper=new CT,this.endnotesWrapper=new wT,this.contentTypes=new tT({macros:this.macros!==void 0}),((a=this.macros)===null||a===void 0?void 0:a.events)!==void 0&&this.contentTypes.addOverride("application/vnd.ms-word.vbaData+xml","/word/vbaData.xml"),e.bibliography!==void 0){let b=new ge;b.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps","itemProps1.xml"),this.bibliography={sources:e.bibliography.sources,properties:cT(`{${Xh().toUpperCase()}}`),relationships:b},this.contentTypes.addOverride("application/vnd.openxmlformats-officedocument.customXmlProperties+xml","/customXml/itemProps1.xml")}if(this.packageParts=new Vf(this.contentTypes),this.documentWrapper=new fT({background:e.background,pageNumbers:e.pageNumbers}),this.settings=new rS({compatibilityModeVersion:e.compatabilityModeVersion,compatibility:e.compatibility,evenAndOddHeaders:!!e.evenAndOddHeaderAndFooters,trackRevisions:(o=e.features)===null||o===void 0?void 0:o.trackRevisions,updateFields:(l=e.features)===null||l===void 0?void 0:l.updateFields,embedFonts:!((c=e.fonts)===null||c===void 0)&&c.length?!0:void 0,defaultTabStop:e.defaultTabStop,protection:e.protection,hyphenation:{autoHyphenation:(d=e.hyphenation)===null||d===void 0?void 0:d.autoHyphenation,hyphenationZone:(p=e.hyphenation)===null||p===void 0?void 0:p.hyphenationZone,consecutiveHyphenLimit:(u=e.hyphenation)===null||u===void 0?void 0:u.consecutiveHyphenLimit,doNotHyphenateCaps:(f=e.hyphenation)===null||f===void 0?void 0:f.doNotHyphenateCaps}}),this.media=new Gf(b=>this.packageParts.takePath("media","image",b)),e.externalStyles!==void 0){var h,g,v,w;let b=(h=(g=e.styles)===null||g===void 0?void 0:g.default)!==null&&h!==void 0?h:{},C=Object.entries(nc(b)),A=([T])=>b[T]!==void 0,y=new CS().newInstance(e.externalStyles);this.styles=new Xo(k(k({},y),{},{paragraphStyles:(v=e.styles)===null||v===void 0?void 0:v.paragraphStyles,characterStyles:(w=e.styles)===null||w===void 0?void 0:w.characterStyles,importedStyles:[...C.filter(T=>!A(T)).map(([,T])=>T),...y.importedStyles,...C.filter(A).map(([,T])=>T)]}))}else if(e.styles){let b=new Zu().newInstance(e.styles.default);this.styles=new Xo(k(k({},b),e.styles))}else{let b=new Zu;this.styles=new Xo(b.newInstance())}this.addDefaultRelationships();for(let b of e.sections)this.addSection(b);if(e.footnotes)for(let b in e.footnotes)this.footnotesWrapper.View.createFootNote(parseFloat(b),e.footnotes[b].children);if(e.endnotes)for(let b in e.endnotes)this.endnotesWrapper.View.createEndnote(parseFloat(b),e.endnotes[b].children);this.fontWrapper=new Sf((m=e.fonts)!==null&&m!==void 0?m:[]),this.theme=new MS(e.theme),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme","theme/theme1.xml"),this.macros!==void 0&&this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2006/relationships/vbaProject","vbaProject.bin"),this.bibliography!==void 0&&this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml","../customXml/item1.xml")}addSection({headers:e={},footers:t={},children:n,properties:r}){this.documentWrapper.View.Body.addSection(k(k({},r),{},{headerWrapperGroup:{default:e.default?this.createHeader(e.default):void 0,first:e.first?this.createHeader(e.first):void 0,even:e.even?this.createHeader(e.even):void 0},footerWrapperGroup:{default:t.default?this.createFooter(t.default):void 0,first:t.first?this.createFooter(t.first):void 0,even:t.even?this.createFooter(t.even):void 0}}));for(let i of n)this.documentWrapper.View.add(i)}createHeader(e){let t=new NT(this.media,this.currentRelationshipId++);for(let n of e.options.children)t.add(n);return this.addHeaderToDocument(t),t}createFooter(e){let t=new kT(this.media,this.currentRelationshipId++);for(let n of e.options.children)t.add(n);return this.addFooterToDocument(t),t}addHeaderToDocument(e,t=kn.DEFAULT){this.headers.push({header:e,type:t}),this.documentWrapper.Relationships.addRelationship(e.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",`header${this.headers.length}.xml`),this.contentTypes.addHeader(this.headers.length)}addFooterToDocument(e,t=kn.DEFAULT){this.footers.push({footer:e,type:t}),this.documentWrapper.Relationships.addRelationship(e.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",`footer${this.footers.length}.xml`),this.contentTypes.addFooter(this.footers.length)}addDefaultRelationships(){this.fileRelationships.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","word/document.xml"),this.fileRelationships.addRelationship(2,"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"),this.fileRelationships.addRelationship(3,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties","docProps/app.xml"),this.fileRelationships.addRelationship(4,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties","docProps/custom.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles","styles.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering","numbering.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","footnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes","endnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings","settings.xml"),this.comments.IsEmpty||(this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments","comments.xml"),this.contentTypes.addComments()),this.commentsExtended&&(this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2011/relationships/commentsExtended","commentsExtended.xml"),this.contentTypes.addCommentsExtended()),this.commentsIds&&(this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds","commentsIds.xml"),this.contentTypes.addCommentsIds())}get Document(){return this.documentWrapper}get Styles(){return this.styles}get CoreProperties(){return this.coreProperties}get Numbering(){return this.numbering}get Media(){return this.media}get FileRelationships(){return this.fileRelationships}get Headers(){return this.headers.map(e=>e.header)}get Footers(){return this.footers.map(e=>e.footer)}get ContentTypes(){return this.contentTypes}get CustomProperties(){return this.customProperties}get AppProperties(){return this.appProperties}get FootNotes(){return this.footnotesWrapper}get Endnotes(){return this.endnotesWrapper}get Settings(){return this.settings}get Comments(){return this.comments}get CommentsExtended(){return this.commentsExtended}get CommentsIds(){return this.commentsIds}get FontTable(){return this.fontWrapper}get Theme(){return this.theme}get PackageParts(){return this.packageParts}get Macros(){return this.macros}get Bibliography(){return this.bibliography}},b2=class extends I{constructor(e){super("w:sdtPr"),e&&this.root.push(new et("w:alias",e))}},v2=e=>new O({name:"w:docPartObj",children:[new et("w:docPartGallery",e),new O({name:"w:docPartUnique"})]}),w2=["contentChildren","cachedEntries","beginDirty","tabLeader"],bm=class extends Yl{constructor(e="Table of Contents",t={}){let{contentChildren:n=[],cachedEntries:r=[],beginDirty:i,tabLeader:s=$1.DOT}=t,a=Dl(t,w2);super("w:sdt"),S(this,"fromHeadings",void 0);let o=new b2(e);o.addChildElement(v2("Table of Contents")),this.root.push(o);let l=new of,c=[new Be({children:[lf(i),new af(a),Jt()]})],d=[new Be({children:[Qt()]})];if(r!==void 0&&r.length>0){let{stylesWithLevels:p}=a,u=r.map((m,h)=>{var g,v;let w=this.buildCachedContentParagraphChild(m,a),b=(g=p==null||(v=p.find(A=>A.level===m.level))===null||v===void 0?void 0:v.styleName)!==null&&g!==void 0?g:`TOC${m.level}`,C=h===0?[...c,w]:h===r.length-1?[w,...d]:[w];return new J({style:b,tabStops:this.getTabStopsForLevel(m.level,s),children:C})}),f=u;r.length<=1&&(f=[...u,new J({children:d})]);for(let m of f)l.addChildElement(m)}else{let p=new J({children:c});l.addChildElement(p);for(let f of n)l.addChildElement(f);let u=new J({children:d});l.addChildElement(u),n.length===0&&(this.fromHeadings={properties:a,beginDirty:i,tabLeader:s})}this.root.push(l)}prepForXml(e){let t=super.prepForXml(e);return Yx(t,this.fromHeadings&&k(k({},this.fromHeadings),{},{textWidth:this.textWidthIn(e)})),t}textWidthIn(e){var t,n;return(t=(n=e.file)===null||n===void 0||(n=n.Document)===null||n===void 0||(n=n.View.Body.getSectionPropertiesFor(this))===null||n===void 0?void 0:n.AvailableTextWidth)!==null&&t!==void 0?t:fs}getTabStopsForLevel(e,t,n=9025){return[{type:"clear",position:n+1-(e-1)*240},{type:"right",position:n,leader:t}]}buildCachedContentRun(e,t){var n,r;return new Be({style:t?.hyperlink&&e.href!==void 0?"IndexLink":void 0,children:[new Tr({text:e.title}),new Ls,new Tr({text:(n=(r=e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""})]})}buildCachedContentParagraphChild(e,t){let n=this.buildCachedContentRun(e,t);return t?.hyperlink&&e.href!==void 0?new vf({anchor:e.href,children:[n]}):n}},hr=0,sl=32,y2=32,x2=(e,t)=>{let n=t.replace(/-/g,"");if(n.length!==y2)throw new Error(`Error: Cannot extract GUID from font filename: ${t}`);let r=n.replace(/(..)/g,"$1 ").trim().split(" ").map(a=>parseInt(a,16));r.reverse();let i=e.slice(hr,sl).map((a,o)=>a^r[o%r.length]),s=new Uint8Array(hr+i.length+Math.max(0,e.length-sl));return s.set(e.slice(0,hr)),s.set(i,hr),s.set(e.slice(sl),hr+i.length),s},nn=class{format(e,t={stack:[]}){let n=e.prepForXml(t);if(n)return n;throw Error("XMLComponent did not format correctly")}},vm=/\{([^{}]+)\}/g,wm=(e,t)=>t.size===0?e:e.replace(vm,(n,r)=>{var i;return(i=t.get(r))!==null&&i!==void 0?i:n}),k2=e=>new Set(Array.from(e.matchAll(vm),([,t])=>t)),ym=class{replace(e,t,n){return wm(e,new Map(t.map((r,i)=>[r.key,(n+i).toString()])))}getMediaData(e,t){let n=k2(e);return t.Entries.filter(([r])=>n.has(r)).map(([r,{fileName:i}])=>({key:r,fileName:i}))}},T2=class{replace(e,t){return wm(e,new Map(t.map(({reference:n,instance:r,restartedListId:i,numId:s})=>[xs(n,r,i),s.toString()])))}},S2=new nn,al=(e,t,n,r,i=!0)=>U(S2.format(t,{viewWrapper:{View:t,Relationships:r},file:e,stack:[]}),{indent:n,declaration:i?{standalone:"yes",encoding:"UTF-8"}:{encoding:"UTF-8"}}),E2=(e,t,n,r)=>{let{content:i}=t.options;if(i instanceof Uint8Array)return[{data:i,path:`word/${n}`}];if("files"in i)return[{data:Ss(i.files.map(({path:c,content:d})=>[c,d instanceof Uint8Array?d:al(e,d,r,new ge)])),path:`word/${n}`}];let s=e.PackageParts.createRelationships(n),a=al(e,i,r,s),o=n.slice(0,n.lastIndexOf("/")),l=n.slice(n.lastIndexOf("/")+1);return[{data:a,path:`word/${n}`},...s.RelationshipCount>0?[{data:al(e,s,r,s,!1),path:`word/${o}/_rels/${l}.rels`}]:[]]},ac=(e,t,n=0)=>{let r=e.PackageParts.Array.slice(n);return r.length===0?[]:[...r.flatMap(({part:i,path:s})=>E2(e,i,s,t)),...ac(e,t,n+r.length)]},C2=["PackageParts"],_2=class{constructor(){S(this,"formatter",void 0),S(this,"imageReplacer",void 0),S(this,"numberingReplacer",void 0),this.formatter=new nn,this.imageReplacer=new ym,this.numberingReplacer=new T2}compile(e,t,n=[]){let r=this.xmlifyFile(e,t),{PackageParts:i}=r,s=Dl(r,C2),a=Object.values(s).flatMap(o=>Array.isArray(o)?o:[o]);return new Map([...a.map(({path:o,data:l})=>[o,l]),...i.map(({path:o,data:l})=>[o,l]),...n.map(({path:o,data:l})=>[o,l]),...e.Macros===void 0?[]:[["word/vbaProject.bin",e.Macros.project]],...e.Media.Array.map(o=>[`word/media/${o.fileName}`,o.data]),...e.FontTable.files.map(({data:o,fontKey:l},c)=>[`word/fonts/font${c+1}.odttf`,x2(o,l)])])}xmlifyFile(e,t){var n;let r=U(this.formatter.format(e.Document.View,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),i=U(this.formatter.format(e.Comments,{viewWrapper:{View:e.Comments,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),s=U(this.formatter.format(e.FootNotes.View,{viewWrapper:e.FootNotes,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),a=U(this.formatter.format(e.Endnotes.View,{viewWrapper:e.Endnotes,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),o=e.Document.Relationships.RelationshipCount+1,l=e.Comments.Relationships.RelationshipCount+1,c=e.FootNotes.Relationships.RelationshipCount+1,d=e.Endnotes.Relationships.RelationshipCount+1,p=this.imageReplacer.getMediaData(r,e.Media),u=this.imageReplacer.getMediaData(i,e.Media),f=this.imageReplacer.getMediaData(s,e.Media),m=this.imageReplacer.getMediaData(a,e.Media);return k(k(k(k(k(k({Relationships:{data:(()=>{let h=ge.copy(e.Document.Relationships);return p.forEach((g,v)=>{h.addRelationship(o+v,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${g.fileName}`)}),h.addRelationship(h.RelationshipCount+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable","fontTable.xml"),U(this.formatter.format(h,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/document.xml.rels"},Document:{data:(()=>{let h=this.imageReplacer.replace(r,p,o);return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/document.xml"},Styles:{data:(()=>{let h=U(this.formatter.format(e.Styles,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}});return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/styles.xml"},Properties:{data:U(this.formatter.format(e.CoreProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/core.xml"},FileRelationships:{data:U(this.formatter.format(e.FileRelationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"_rels/.rels"},HeaderRelationships:e.Headers.map((h,g)=>{let v=U(this.formatter.format(h.View,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),w=this.imageReplacer.getMediaData(v,e.Media),b=ge.copy(h.Relationships);return w.forEach((C,A)=>{b.addRelationship(A,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${C.fileName}`)}),{data:U(this.formatter.format(b,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:`word/_rels/header${g+1}.xml.rels`}}),FooterRelationships:e.Footers.map((h,g)=>{let v=U(this.formatter.format(h.View,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),w=this.imageReplacer.getMediaData(v,e.Media),b=ge.copy(h.Relationships);return w.forEach((C,A)=>{b.addRelationship(A,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${C.fileName}`)}),{data:U(this.formatter.format(b,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:`word/_rels/footer${g+1}.xml.rels`}}),Headers:e.Headers.map((h,g)=>{let v=U(this.formatter.format(h.View,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),w=this.imageReplacer.getMediaData(v,e.Media),b=this.imageReplacer.replace(v,w,0);return{data:this.numberingReplacer.replace(b,e.Numbering.ConcreteNumbering),path:`word/header${g+1}.xml`}}),Footers:e.Footers.map((h,g)=>{let v=U(this.formatter.format(h.View,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),w=this.imageReplacer.getMediaData(v,e.Media),b=this.imageReplacer.replace(v,w,0);return{data:this.numberingReplacer.replace(b,e.Numbering.ConcreteNumbering),path:`word/footer${g+1}.xml`}}),CustomProperties:{data:U(this.formatter.format(e.CustomProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/custom.xml"},AppProperties:{data:U(this.formatter.format(e.AppProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/app.xml"},FootNotes:{data:(()=>{let h=this.imageReplacer.replace(s,f,c);return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/footnotes.xml"},FootNotesRelationships:{data:(()=>{let h=ge.copy(e.FootNotes.Relationships);return f.forEach((g,v)=>{h.addRelationship(c+v,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${g.fileName}`)}),U(this.formatter.format(h,{viewWrapper:e.FootNotes,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/footnotes.xml.rels"},Endnotes:{data:(()=>{let h=this.imageReplacer.replace(a,m,d);return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/endnotes.xml"},EndnotesRelationships:{data:(()=>{let h=ge.copy(e.Endnotes.Relationships);return m.forEach((g,v)=>{h.addRelationship(d+v,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${g.fileName}`)}),U(this.formatter.format(h,{viewWrapper:e.Endnotes,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/endnotes.xml.rels"},Settings:{data:U(this.formatter.format(e.Settings,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/settings.xml"}},e.Comments.IsEmpty?{}:{Comments:{data:(()=>{let h=this.imageReplacer.replace(i,u,l);return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/comments.xml"},CommentsRelationships:{data:(()=>{let h=ge.copy(e.Comments.Relationships);return u.forEach((g,v)=>{h.addRelationship(l+v,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${g.fileName}`)}),U(this.formatter.format(h,{viewWrapper:{View:e.Comments,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/comments.xml.rels"}}),e.CommentsExtended?{CommentsExtended:{data:U(this.formatter.format(e.CommentsExtended,{viewWrapper:{View:e.CommentsExtended,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsExtended.xml"}}:{}),e.CommentsIds?{CommentsIds:{data:U(this.formatter.format(e.CommentsIds,{viewWrapper:{View:e.CommentsIds,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsIds.xml"}}:{}),{},{FontTable:{data:U(this.formatter.format(e.FontTable.View,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/fontTable.xml"},FontTableRelationships:{data:U(this.formatter.format(e.FontTable.Relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"word/_rels/fontTable.xml.rels"},Theme:{data:U(this.formatter.format(e.Theme,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/theme/theme1.xml"}},!((n=e.Macros)===null||n===void 0)&&n.events?{MacroEvents:{data:U(this.formatter.format(e.Macros.events,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/vbaData.xml"},MacroRelationships:{data:U(this.formatter.format(e.Macros.relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"word/_rels/vbaProject.bin.rels"}}:{}),e.Bibliography?{BibliographySources:{data:U(this.formatter.format(e.Bibliography.sources,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"customXml/item1.xml"},BibliographySourcesProperties:{data:U(this.formatter.format(e.Bibliography.properties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"no",encoding:"UTF-8"}}),path:"customXml/itemProps1.xml"},BibliographySourcesRelationships:{data:U(this.formatter.format(e.Bibliography.relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"customXml/_rels/item1.xml.rels"}}:{}),{},{PackageParts:ac(e,t),Numbering:{data:U(this.formatter.format(e.Numbering,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/numbering.xml"},ContentTypes:{data:U(this.formatter.format(e.ContentTypes,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"[Content_Types].xml"}})}},ch=py(((e,t)=>{var n=typeof Reflect=="object"?Reflect:null,r=n&&typeof n.apply=="function"?n.apply:function(T,x,_){return Function.prototype.apply.call(T,x,_)},i;n&&typeof n.ownKeys=="function"?i=n.ownKeys:Object.getOwnPropertySymbols?i=function(T){return Object.getOwnPropertyNames(T).concat(Object.getOwnPropertySymbols(T))}:i=function(T){return Object.getOwnPropertyNames(T)};function s(y){console&&console.warn&&console.warn(y)}var a=Number.isNaN||function(T){return T!==T};function o(){o.init.call(this)}t.exports=o,t.exports.once=b,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var l=10;function c(y){if(typeof y!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof y)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(y){if(typeof y!="number"||y<0||a(y))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+y+".");l=y}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(T){if(typeof T!="number"||T<0||a(T))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+T+".");return this._maxListeners=T,this};function d(y){return y._maxListeners===void 0?o.defaultMaxListeners:y._maxListeners}o.prototype.getMaxListeners=function(){return d(this)},o.prototype.emit=function(T){for(var x=[],_=1;_<arguments.length;_++)x.push(arguments[_]);var N=T==="error",M=this._events;if(M!==void 0)N=N&&M.error===void 0;else if(!N)return!1;if(N){var D;if(x.length>0&&(D=x[0]),D instanceof Error)throw D;var V=new Error("Unhandled error."+(D?" ("+D.message+")":""));throw V.context=D,V}var re=M[T];if(re===void 0)return!1;if(typeof re=="function")r(re,this,x);else for(var ee=re.length,te=g(re,ee),_=0;_<ee;++_)r(te[_],this,x);return!0};function p(y,T,x,_){var N,M,D;if(c(x),M=y._events,M===void 0?(M=y._events=Object.create(null),y._eventsCount=0):(M.newListener!==void 0&&(y.emit("newListener",T,x.listener?x.listener:x),M=y._events),D=M[T]),D===void 0)D=M[T]=x,++y._eventsCount;else if(typeof D=="function"?D=M[T]=_?[x,D]:[D,x]:_?D.unshift(x):D.push(x),N=d(y),N>0&&D.length>N&&!D.warned){D.warned=!0;var V=new Error("Possible EventEmitter memory leak detected. "+D.length+" "+String(T)+" listeners added. Use emitter.setMaxListeners() to increase limit");V.name="MaxListenersExceededWarning",V.emitter=y,V.type=T,V.count=D.length,s(V)}return y}o.prototype.addListener=function(T,x){return p(this,T,x,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(T,x){return p(this,T,x,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(y,T,x){var _={fired:!1,wrapFn:void 0,target:y,type:T,listener:x},N=u.bind(_);return N.listener=x,_.wrapFn=N,N}o.prototype.once=function(T,x){return c(x),this.on(T,f(this,T,x)),this},o.prototype.prependOnceListener=function(T,x){return c(x),this.prependListener(T,f(this,T,x)),this},o.prototype.removeListener=function(T,x){var _,N,M,D,V;if(c(x),N=this._events,N===void 0)return this;if(_=N[T],_===void 0)return this;if(_===x||_.listener===x)--this._eventsCount===0?this._events=Object.create(null):(delete N[T],N.removeListener&&this.emit("removeListener",T,_.listener||x));else if(typeof _!="function"){for(M=-1,D=_.length-1;D>=0;D--)if(_[D]===x||_[D].listener===x){V=_[D].listener,M=D;break}if(M<0)return this;M===0?_.shift():v(_,M),_.length===1&&(N[T]=_[0]),N.removeListener!==void 0&&this.emit("removeListener",T,V||x)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(T){var x,_=this._events,N;if(_===void 0)return this;if(_.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):_[T]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete _[T]),this;if(arguments.length===0){var M=Object.keys(_),D;for(N=0;N<M.length;++N)D=M[N],D!=="removeListener"&&this.removeAllListeners(D);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(x=_[T],typeof x=="function")this.removeListener(T,x);else if(x!==void 0)for(N=x.length-1;N>=0;N--)this.removeListener(T,x[N]);return this};function m(y,T,x){var _=y._events;if(_===void 0)return[];var N=_[T];return N===void 0?[]:typeof N=="function"?x?[N.listener||N]:[N]:x?w(N):g(N,N.length)}o.prototype.listeners=function(T){return m(this,T,!0)},o.prototype.rawListeners=function(T){return m(this,T,!1)},o.listenerCount=function(y,T){return typeof y.listenerCount=="function"?y.listenerCount(T):h.call(y,T)},o.prototype.listenerCount=h;function h(y){var T=this._events;if(T!==void 0){var x=T[y];if(typeof x=="function")return 1;if(x!==void 0)return x.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(y,T){for(var x=new Array(T),_=0;_<T;++_)x[_]=y[_];return x}function v(y,T){for(;T+1<y.length;T++)y[T]=y[T+1];y.pop()}function w(y){for(var T=new Array(y.length),x=0;x<T.length;++x)T[x]=y[x].listener||y[x];return T}function b(y,T){return new Promise(function(x,_){function N(D){y.removeListener(T,M),_(D)}function M(){typeof y.removeListener=="function"&&y.removeListener("error",N),x([].slice.call(arguments))}A(y,T,M,{once:!0}),T!=="error"&&C(y,N,{once:!0})})}function C(y,T,x){typeof y.on=="function"&&A(y,"error",T,x)}function A(y,T,x,_){if(typeof y.on=="function")_.once?y.once(T,x):y.on(T,x);else if(typeof y.addEventListener=="function")y.addEventListener(T,function N(M){_.once&&y.removeEventListener(T,N),x(M)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof y)}}))();A2=class extends ch.EventEmitter{pipe(e,t){let n=this,r=e,i=p=>{r.writable&&r.write(p)===!1&&n.pause&&n.pause()};n.on("data",i);let s=()=>{n.readable&&n.resume&&n.resume()};r.on("drain",s),!r._isStdio&&(!t||t.end!==!1)&&(n.on("end",o),n.on("close",l));let a=!1;function o(){a||(a=!0,r.end())}function l(){a||(a=!0,typeof r.destroy=="function"&&r.destroy())}function c(p){if(d(),ch.EventEmitter.listenerCount(this,"error")===0)throw p}n.on("error",c),r.on("error",c);function d(){n.removeListener("data",i),r.removeListener("drain",s),n.removeListener("end",o),n.removeListener("close",l),n.removeListener("error",c),r.removeListener("error",c),n.removeListener("end",d),n.removeListener("close",d),r.removeListener("close",d)}return n.on("end",d),n.on("close",d),r.on("close",d),r.emit("pipe",n),r}};N2={NONE:"",WITH_2_BLANKS:" ",WITH_4_BLANKS:" ",WITH_TAB:" "},ph=e=>e===!0?N2.WITH_2_BLANKS:e===!1?void 0:e,uh=e=>e.Macros===void 0?"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"application/vnd.ms-word.document.macroEnabled.12",oc=class xn{static pack(t,n,r){var i=this;return Bt(function*(s,a,o,l=[]){return Cl(Ss(i.compiler.compile(s,ph(o),l)),a,uh(s))}).apply(this,arguments)}static toString(t,n,r=[]){return xn.pack(t,"string",n,r)}static toBuffer(t,n,r=[]){return xn.pack(t,"nodebuffer",n,r)}static toBase64String(t,n,r=[]){return xn.pack(t,"base64",n,r)}static toBlob(t,n,r=[]){return xn.pack(t,"blob",n,r)}static toArrayBuffer(t,n,r=[]){return xn.pack(t,"arraybuffer",n,r)}static toStream(t,n,r=[]){let i=new A2,s=this.compiler.compile(t,ph(n),r);return new Promise(a=>setTimeout(a)).then(()=>Cl(Ss(s),"nodebuffer",uh(t))).then(a=>{i.emit("data",a),i.emit("end")},a=>i.emit("error",a)),i}};S(oc,"compiler",new _2);xm=e=>{var t;if(e.name!=="w:bookmarkStart"&&e.name!=="w:bookmarkEnd")return;let n=Number((t=e.attributes)===null||t===void 0?void 0:t["w:id"]);return Number.isInteger(n)?n:void 0},km=e=>{var t;let n=xm(e);return[...n===void 0?[]:[n],...((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(km)]},I2=e=>{let t=new Set(e),n=new Map,r=e.reduce((a,o)=>Math.max(a,o),0),i=a=>{let o=n.get(a);if(o!==void 0)return o;let l=t.has(a)?r+1:a;return r=Math.max(r,l),t.add(l),n.set(a,l),l},s=a=>{let o=xm(a);return k(k(k({},a),o===void 0?{}:{attributes:k(k({},a.attributes),{},{"w:id":String(i(o))})}),a.elements===void 0?{}:{elements:a.elements.map(s)})};return a=>a.map(s)},P2=new nn,Fs=e=>new TextDecoder("utf-8",{ignoreBOM:!0}).decode(e),it=e=>Pr(e,{keepWhitespaceText:!0}),Tm=e=>{var t;return(t=it(U(P2.format(new Tr({text:e})))).elements[0].elements)!==null&&t!==void 0?t:[]},Sm=e=>k(k({},e),{},{attributes:{"xml:space":"preserve"}}),ke=(e,t)=>{var n,r;let i=(n=e.elements)===null||n===void 0?void 0:n.find(s=>s.name===t);return i===void 0?[]:((r=i.elements)!==null&&r!==void 0||(i.elements=[]),i.elements)},Em=e=>{if(!e?.start.trim()||!e?.end.trim())throw new Error("Both start and end delimiters must be non-empty strings.")},yn=(e,t,n)=>{let r=ke(e,"Types");r.some(i=>{var s,a;return i.type==="element"&&i.name==="Default"&&(i==null||(s=i.attributes)===null||s===void 0?void 0:s.ContentType)===t&&(i==null||(a=i.attributes)===null||a===void 0?void 0:a.Extension)===n})||r.push({attributes:{ContentType:t,Extension:n},name:"Default",type:"element"})},O2=(e,t,n)=>{let r=ke(e,"Types");r.some(i=>{var s;return i.type==="element"&&i.name==="Override"&&((s=i.attributes)===null||s===void 0?void 0:s.PartName)===n})||r.push({attributes:{ContentType:t,PartName:n},name:"Override",type:"element"})},L2=(e,t)=>{var n;let r=(n=e.elements)===null||n===void 0?void 0:n.find(i=>i.name==="Types");r?.elements!==void 0&&(r.elements=r.elements.filter(i=>{var s,a;return!(i.name==="Override"&&String((s=(a=i.attributes)===null||a===void 0?void 0:a.PartName)!==null&&s!==void 0?s:"").toLowerCase()===t.toLowerCase())}))},R2=e=>{let t=parseInt(e.substring(3),10);return isNaN(t)?0:t},lc=e=>ke(e,"Relationships").map(t=>{var n,r;return R2((n=(r=t.attributes)===null||r===void 0||(r=r.Id)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"")}).reduce((t,n)=>Math.max(t,n),0)+1,Al=(e,t,n,r,i)=>{let s=ke(e,"Relationships");return s.push({attributes:{Id:`rId${t}`,Type:n,Target:r,TargetMode:i},name:"Relationship",type:"element"}),s},Nr=()=>({declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[]}]}),hh="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",M2="application/vnd.openxmlformats-package.core-properties+xml",fh="_rels/.rels",mh="docProps/core.xml",Nl={cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/"},D2={title:{namespace:"dc",name:"title"},subject:{namespace:"dc",name:"subject"},creator:{namespace:"dc",name:"creator"},keywords:{namespace:"cp",name:"keywords"},description:{namespace:"dc",name:"description"},lastModifiedBy:{namespace:"cp",name:"lastModifiedBy"},revision:{namespace:"cp",name:"revision"}},gh=e=>e===""?[]:[{type:"text",text:String(e)}],bh=e=>{var t;return(t=e.name)===null||t===void 0?void 0:t.slice(e.name.indexOf(":")+1)},B2=(e,t)=>{var n;let r=(n=Object.entries(k({},e.attributes)).find(([i,s])=>(i==="xmlns"||i.startsWith("xmlns:"))&&s===Nl[t]))===null||n===void 0?void 0:n[0];return r===void 0?(e.attributes=k(k({},e.attributes),{},{[`xmlns:${t}`]:Nl[t]}),`${t}:`):r==="xmlns"?"":`${r.slice(6)}:`},$2=e=>{let t=e[0]===255&&e[1]===254?"utf-16le":e[0]===254&&e[1]===255?"utf-16be":"utf-8";return new TextDecoder(t).decode(e)},F2=(e,t,n)=>{var r;let i=t.get(n);if(i===void 0)return e.get(n);let s=it($2(i));return!((r=s.declaration)===null||r===void 0)&&r.attributes&&(s.declaration.attributes.encoding="UTF-8"),t.delete(n),e.set(n,s),s},H2=e=>{var t,n;let r=(t=e.get(fh))!==null&&t!==void 0?t:Nr(),i=(n=ke(r,"Relationships").find(s=>{var a;return((a=s.attributes)===null||a===void 0?void 0:a.Type)===hh}))===null||n===void 0||(n=n.attributes)===null||n===void 0?void 0:n.Target;return typeof i=="string"?tn("",i):(Al(r,lc(r),hh,mh),e.set(fh,r),mh)},U2=(e,t,n,{addContentTypeOverride:r})=>{var i,s;let a=H2(e),o=F2(e,t,a),l=o??{declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"cp:coreProperties",attributes:{"xmlns:cp":Nl.cp},elements:[]}]};o===void 0&&(e.set(a,l),r(M2,`/${a}`));let c=(i=l.elements)===null||i===void 0?void 0:i.find(d=>bh(d)==="coreProperties");if(c===void 0)throw new Error(`Could not find the core properties in ${a}`);(s=c.elements)!==null&&s!==void 0||(c.elements=[]);for(let[d,{namespace:p,name:u}]of Object.entries(D2)){let f=n[d];if(f===void 0)continue;let m=c.elements.find(h=>bh(h)===u);m?m.elements=gh(f):c.elements.push({type:"element",name:`${B2(c,p)}${u}`,elements:gh(f)})}},Il=new Set(["wp:inline","wp:anchor"]),cc=new Set(["wp:docPr","wps:cNvPr","wpg:cNvPr"]),q2=new Set(["a:stCxn","a:endCxn"]),Es=(e,t)=>{var n,r;if(!t.has((n=e.name)!==null&&n!==void 0?n:""))return;let i=Number((r=e.attributes)===null||r===void 0?void 0:r.id);return Number.isInteger(i)?i:void 0},Cm=e=>{var t;let n=Es(e,cc);return[...n===void 0?[]:[n],...((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(Cm)]},W2=e=>{let t=n=>{var r;let i=Es(n,cc);return[...i===void 0?[]:[i],...((r=n.elements)!==null&&r!==void 0?r:[]).flatMap(s=>{var a;return Il.has((a=s.name)!==null&&a!==void 0?a:"")?[]:t(s)})]};return t(e)},j2=e=>{let t=new Set(e),n=e.reduce((a,o)=>Math.max(a,o),0),r=a=>{let o=t.has(a)?n+1:a;return n=Math.max(n,o),t.add(o),o},i=a=>{let o=new Map([...new Set(W2(a))].map(c=>[c,r(c)])),l=c=>{var d,p;if(c!==a&&Il.has((d=c.name)!==null&&d!==void 0?d:""))return i(c);let u=(p=Es(c,cc))!==null&&p!==void 0?p:Es(c,q2),f=u===void 0?void 0:o.get(u);return k(k(k({},c),f===void 0?{}:{attributes:k(k({},c.attributes),{},{id:String(f)})}),c.elements===void 0?{}:{elements:c.elements.map(l)})};return l(a)},s=a=>{var o;return Il.has((o=a.name)!==null&&o!==void 0?o:"")?i(a):k(k({},a),a.elements===void 0?{}:{elements:a.elements.map(s)})};return a=>a.map(s)},Te={DOCUMENT:"file",PARAGRAPH:"paragraph",TABLE_ROWS:"tableRows",DRAWING:"drawing"},K2=new Map([["wp:inline","wp:docPr"],["wp:anchor","wp:docPr"],["wpg:graphicFrame","wpg:cNvPr"],["wpc:graphicFrame","wpg:cNvPr"]]),Hs=e=>{var t;return((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(n=>{var r;let i=n.name===void 0?void 0:K2.get(n.name),s=i===void 0||(r=n.elements)===null||r===void 0?void 0:r.find(a=>a.name===i);return[...s?[{element:n,properties:s}]:[],...Hs(n)]})},_m=e=>{var t,n;return[(t=e.attributes)===null||t===void 0?void 0:t.descr,(n=e.attributes)===null||n===void 0?void 0:n.title].flatMap(r=>r===void 0?[]:[String(r)])},vh="[Content_Types].xml",G2=e=>{var t;if(!(!((t=e.elements)===null||t===void 0)&&t.some(r=>r.name==="Relationships"))){var n;e.elements=[...(n=e.elements)!==null&&n!==void 0?n:[],...Nr().elements]}return ke(e,"Relationships")},z2="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Pl=e=>{var t,n;return new Set(["r",...Object.entries((t=e.attributes)!==null&&t!==void 0?t:{}).flatMap(([r,i])=>r.startsWith("xmlns:")&&i===z2?[r.slice(6)]:[]),...((n=e.elements)!==null&&n!==void 0?n:[]).flatMap(r=>[...Pl(r)])])},Ol=(e,t)=>{var n,r;return new Set([...Object.entries((n=e.attributes)!==null&&n!==void 0?n:{}).flatMap(([i,s])=>i.includes(":")&&t.has(i.slice(0,i.indexOf(":")))?[String(s)]:[]),...((r=e.elements)!==null&&r!==void 0?r:[]).flatMap(i=>[...Ol(i,t)])])},V2=(e,t)=>{let n=c=>e.has(c)||t.has(c),r=c=>{if(n(c))return c;let d=(()=>{try{return decodeURI(c)}catch{return}})();if(d!==void 0&&n(d))return d;let p=c.toLowerCase();return[...e.keys(),...t.keys()].find(u=>u.toLowerCase()===p)},i=(c,d)=>{let p=e.get(Ge(c));return p===void 0?void 0:ke(p,"Relationships").find(u=>{var f;return u.name==="Relationship"&&((f=u.attributes)===null||f===void 0?void 0:f.Id)===d})},s=(c,d)=>{var p,u;let f=(p=d.attributes)===null||p===void 0?void 0:p.Target;return((u=d.attributes)===null||u===void 0?void 0:u.TargetMode)==="External"||f===void 0?void 0:r(tn(c,String(f)))},a=c=>[...e].some(([d,p])=>d.endsWith(".rels")&&ke(p,"Relationships").some(u=>s(sm(d),u)===c)),o=(c,d)=>{if(d===void 0||d===c||d===vh||d.endsWith(".rels")||a(d))return;let p=e.get(Ge(d));e.delete(d),t.delete(d),e.delete(Ge(d));let u=e.get(vh);u!==void 0&&L2(u,`/${d}`);for(let f of p===void 0?[]:ke(p,"Relationships"))o(d,s(d,f))};return{findRelationship:i,pathOf:s,removeIfUnreferenced:o,removeRelationships:(c,d)=>{var p,u;let f=(p=e.get(Ge(c)))===null||p===void 0||(p=p.elements)===null||p===void 0?void 0:p.find(h=>h.name==="Relationships"),m=((u=f?.elements)!==null&&u!==void 0?u:[]).filter(h=>{var g;return h.name==="Relationship"&&d.has(String((g=h.attributes)===null||g===void 0?void 0:g.Id))});if(!(f===void 0||m.length===0)){f.elements=f.elements.filter(h=>!m.includes(h));for(let h of m)o(c,s(c,h))}}}},X2=(e,{findRelationship:t,pathOf:n,removeIfUnreferenced:r},i,s)=>{let a=new nn;return{getRelatedPart:(o,l)=>{let c=t(o.path,l),d=c===void 0?void 0:n(o.path,c);return d===void 0?void 0:{path:d,xml:e.get(d)}},replaceRelatedPart:(o,l,c)=>{let d=`word/${i.PackageParts.add(c)}`,{relationshipType:p}=c.options,u=rc(o.path,d),f=l===void 0?void 0:t(o.path,l);if(f===void 0){var m;let g=Ge(o.path),v=(m=e.get(g))!==null&&m!==void 0?m:Nr();e.set(g,v);let w=l??`rId${lc(v)}`;return G2(v).push({type:"element",name:"Relationship",attributes:{Id:w,Type:p,Target:u}}),w}let h=n(o.path,f);return f.attributes=k(k({},Object.fromEntries(Object.entries(f.attributes).filter(([g])=>g!=="TargetMode"))),{},{Type:p,Target:u}),r(o.path,h),String(f.attributes.Id)},format:o=>it(U(a.format(o,s))).elements[0]}},Y2=({parts:e,binaryParts:t,file:n,patches:r,delimiters:i},s)=>{let a=r.map(([c,d])=>({placeholder:`${i.start}${c}${i.end}`,patch:d})),o=[...e].filter(([c])=>c.startsWith("word/")&&!c.endsWith(".rels")).flatMap(([c,d])=>Hs(d).flatMap(p=>{let u=_m(p.properties),f=a.filter(({placeholder:g})=>u.some(v=>v.includes(g)));if(f.length>1){var m,h;throw new Error(`The drawing "${(m=(h=p.properties.attributes)===null||h===void 0?void 0:h.name)!==null&&m!==void 0?m:""}" in ${c} has the placeholders ${f.map(({placeholder:g})=>g).join(" and ")} in its alt text. A drawing can only be patched once`)}return f.map(({placeholder:g,patch:v})=>({drawing:k(k({placeholder:g},p),{},{part:{path:c,xml:d}}),patch:v}))})),l=V2(e,t);for(let{drawing:c,patch:d}of o){let p=Ol(c.element,Pl(c.part.xml));d.patch(c,X2(e,l,n,s(c.part.path)));let u=Ol(c.part.xml,Pl(c.part.xml));l.removeRelationships(c.part.path,new Set([...p].filter(f=>!u.has(f))))}},J2=e=>typeof e=="object"&&e!==null&&"on"in e&&typeof e.on=="function",Q2=e=>typeof e=="object"&&e!==null&&"generateAsync"in e&&typeof e.generateAsync=="function",Z2=e=>["[object Blob]","[object File]"].includes(Object.prototype.toString.call(e)),eE=e=>new Promise((t,n)=>{let r=[];e.on("data",i=>{ArrayBuffer.isView(i)?r.push(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)):typeof i=="number"?r.push(i):n(new TypeError(`A template stream must give bytes, but it gave a ${typeof i}. A stream with an encoding set gives text, so do not set one.`))}),e.on("error",n),e.on("end",()=>{let i=new Uint8Array(r.reduce((s,a)=>s+(typeof a=="number"?1:a.length),0));r.reduce((s,a)=>typeof a=="number"?(i[s]=a,s+1):(i.set(a,s),s+a.length),0),t(i)})}),tE=(function(){var e=Bt(function*(t){return Q2(t)?t.generateAsync({type:"uint8array"}):J2(t)?eE(t):Z2(t)?new Uint8Array(yield t.arrayBuffer()):typeof t=="string"?Uint8Array.from({length:t.length},(n,r)=>t.charCodeAt(r)):Array.isArray(t)?Uint8Array.from(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)});return function(n){return e.apply(this,arguments)}})(),Am=(function(){var e=Bt(function*(t,n){return mm(yield tE(t),n)});return function(n,r){return e.apply(this,arguments)}})(),nE=new nn,cs="word/document.xml",rE={path:"word/footnotes.xml",rootName:"w:footnotes",noteName:"w:footnote",referenceName:"w:footnoteReference",contentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",create:{part:()=>new Kf,mark:()=>new jf,styles:()=>[new Jf({}),new Zf({}),new Qf({})]}},iE={path:"word/endnotes.xml",rootName:"w:endnotes",noteName:"w:endnote",referenceName:"w:endnoteReference",contentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml",relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",create:{part:()=>new Wf,mark:()=>new Hf,styles:()=>[new em({}),new nm({}),new tm({})]}},ds=(e,t)=>it(U(nE.format(e,t))).elements[0],Nm=(e,t)=>{var n,r,i;let s=t.includes((n=e.name)!==null&&n!==void 0?n:"")?Number((r=e.attributes)===null||r===void 0?void 0:r["w:id"]):NaN;return[...Number.isInteger(s)?[s]:[],...((i=e.elements)!==null&&i!==void 0?i:[]).flatMap(a=>Nm(a,t))]},sE=(e,t)=>{var n,r;let i=(n=e.elements)!==null&&n!==void 0?n:[],s=((r=i[0])===null||r===void 0?void 0:r.name)==="w:pPr"?1:0;return k(k({},e),{},{elements:[...i.slice(0,s),t,...i.slice(s)]})},wh=(e,t,n,{createContext:r,addContentTypeOverride:i,renumberBookmarks:s,renumberDrawings:a,renumberLists:o,useStyles:l})=>{let c=new Map(Object.entries(t).map(([w,b])=>[Number(w),b])),d=new Map,p=[...c.keys()].filter(Number.isFinite).reduce((w,b)=>Math.max(w,Math.floor(b)),0),u=new Map,f,m=w=>{var b,C;let A=w.name===e.referenceName?c.get(Number((b=w.attributes)===null||b===void 0?void 0:b["w:id"])):void 0;return A===void 0?w.elements===void 0?w:k(k({},w),{},{elements:w.elements.map(m)}):(f=((C=f)!==null&&C!==void 0?C:[...n.values()].flatMap(y=>Nm(y,[e.noteName,e.referenceName])).reduce((y,T)=>Math.max(y,T),0))+1,u.set(f,A),k(k({},w),{},{attributes:k(k({},w.attributes),{},{"w:id":String(f)})}))},h=()=>{var w;let b=ke((w=n.get(Ge(cs)))!==null&&w!==void 0?w:{},"Relationships").find(A=>{var y;return((y=A.attributes)===null||y===void 0?void 0:y.Type)===e.relationshipType}),C=b?tn(cs,String(b.attributes.Target)):e.path;return n.has(C)||(n.set(C,{declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[ds(e.create.part(),r(C))]}),i(e.contentType,`/${C}`)),b||r(cs).viewWrapper.Relationships.addRelationship(Cn(),e.relationshipType,rc(cs,C)),C};return{renumber:w=>w.map(m),write:()=>{if(u.size===0)return;let w=h(),b=r(w),C=new Map([...new Set(u.values())].map(y=>{let T=ds(e.create.mark(),b);return[y,l(o(s(y.children.map(x=>ds(x,b)).map((x,_)=>_===0?sE(x,T):x))))]}));ke(n.get(w),e.rootName).push(...[...u].map(([y,T])=>({type:"element",name:e.noteName,attributes:{"w:id":String(y)},elements:[...a(C.get(T))]})));let A=n.get("word/styles.xml");if(A){let y=ke(A,"w:styles"),T=new Set(y.map(x=>{var _;return(_=x.attributes)===null||_===void 0?void 0:_["w:styleId"]}));y.push(...e.create.styles().map(x=>ds(x,b)).filter(x=>{var _;return!T.has((_=x.attributes)===null||_===void 0?void 0:_["w:styleId"])}))}},carry:(w,b)=>{let C=d.get(w);return C!==void 0?C:(p++,c.set(p,b),d.set(w,p),p)}}},aE=({footnotes:e={},endnotes:t={}},n,r)=>{let i={footnotes:wh(rE,e,n,r),endnotes:wh(iE,t,n,r)};return{carry:(s,a,o)=>i[s].carry(a,o),renumber:s=>Object.values(i).reduce((a,o)=>o.renumber(a),s),write:()=>{for(let s of Object.values(i))s.write()}}},oE=new nn,ps="word/document.xml",lE="word/numbering.xml",cE="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",yh="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",dE="default-bullet-numbering",pE="1",uE=(e,t)=>it(U(oE.format(e,t))).elements[0],xh=e=>e.reduce((t,n)=>Math.max(t,n),0),hE=(e,t,{createContext:n,addContentTypeOverride:r})=>{let i=new Map,s,a=()=>{var m;return ke((m=t.get(Ge(ps)))!==null&&m!==void 0?m:{},"Relationships").find(h=>{var g;return((g=h.attributes)===null||g===void 0?void 0:g.Type)===yh})},o=(m=a())=>m?tn(ps,String(m.attributes.Target)):lE,l=(m,h)=>{var g;return ke((g=t.get(o()))!==null&&g!==void 0?g:{},"w:numbering").filter(v=>v.name===m).map(v=>Number(v.attributes[h]))},c=m=>{if(m===pE)return e.ConcreteNumbering.find(({reference:g})=>g===dE);if(!m.startsWith("{"))return;let h=e.ConcreteNumbering.find(({reference:g,instance:v})=>m===`{${g}-${v}}`);if(!h){let g=m.slice(1,-1).replace(/-\d+$/,"");throw new Error(`A paragraph in a patch uses the numbering "${g}", which isn't in the numbering option of patchDocument. Add it there with its levels, as in a Document`)}return h},d=m=>{var h;let g=i.get(m.numId);return g!==void 0?g:(s=((h=s)!==null&&h!==void 0?h:xh(l("w:num","w:numId")))+1,i.set(m.numId,s),s)},p=m=>{let h=m.name==="w:numId"?c(String(m.attributes["w:val"])):void 0;return h===void 0?m.elements===void 0?m:k(k({},m),{},{elements:m.elements.map(p)}):k(k({},m),{},{attributes:k(k({},m.attributes),{},{"w:val":String(d(h))})})},u=m=>{let h=a(),g=o(h);return t.has(g)||(t.set(g,{declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[k(k({},m),{},{elements:[]})]}),r(cE,`/${g}`)),h||n(ps).viewWrapper.Relationships.addRelationship(Cn(),yh,rc(ps,g)),g};return{renumber:m=>m.map(p),write:()=>{var m,h;if(i.size===0)return;let g=uE(e,n(o())),v=N=>Number(N.elements.find(M=>M.name==="w:abstractNumId").attributes["w:val"]),w=g.elements.filter(N=>N.name==="w:num"&&i.has(Number(N.attributes["w:numId"]))),b=xh(l("w:abstractNum","w:abstractNumId")),C=new Map([...new Set(w.map(v))].map((N,M)=>[N,b+M+1])),A=g.elements.flatMap(N=>{let M=N.name==="w:abstractNum"?C.get(Number(N.attributes["w:abstractNumId"])):void 0;return M===void 0?[]:[k(k({},N),{},{attributes:k(k({},N.attributes),{},{"w:abstractNumId":String(M)})})]}),y=u(g),T=t.get(y).elements.find(N=>N.name==="w:numbering");T.attributes=k(k(k({},Object.fromEntries(Object.entries(g.attributes).filter(([N])=>N.startsWith("xmlns:")))),T.attributes),{},{"mc:Ignorable":[...new Set([...String((m=(h=T.attributes)===null||h===void 0?void 0:h["mc:Ignorable"])!==null&&m!==void 0?m:"").split(" "),...String(g.attributes["mc:Ignorable"]).split(" ")])].filter(N=>N!=="").join(" ")});let x=ke(t.get(y),"w:numbering"),_=N=>{let M=x.findIndex(D=>N.includes(D.name));return M===-1?x.length:M};x.splice(_(["w:num","w:numIdMacAtCleanup"]),0,...A),x.splice(_(["w:numIdMacAtCleanup"]),0,...w.map(N=>k(k({},N),{},{attributes:k(k({},N.attributes),{},{"w:numId":String(i.get(Number(N.attributes["w:numId"])))}),elements:N.elements.map(M=>M.name==="w:abstractNumId"?k(k({},M),{},{attributes:{"w:val":String(C.get(v(N)))}}):M)})))}}},Ll={nameOf:e=>e.type==="element"?e.name:void 0,contentOf:e=>e.elements,attributeOf:(e,t)=>{var n;return(n=e.attributes)===null||n===void 0?void 0:n[t]},textOf:e=>{var t;return((t=e.elements)!==null&&t!==void 0?t:[]).filter(({type:n})=>n==="text").map(({text:n})=>String(n)).join("")},textElement:e=>({type:"element",name:"w:t",attributes:{"xml:space":"preserve"},elements:[{type:"text",text:e}]}),writeClean:(e,t)=>{var n;/^\s*(PAGEREF|TOC)\b/i.test(t)&&((n=e.attributes)===null||n===void 0?void 0:n["w:dirty"])!==void 0&&(e.attributes=Object.fromEntries(Object.entries(e.attributes).filter(([r])=>r!=="w:dirty")))},setSimpleFieldResult:(e,t)=>{e.elements=[{type:"element",name:"w:r",elements:[Ll.textElement(t)]}]}},ol="word/document.xml",fE="http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk",mE=[80,75,3,4],gE=(function(){var e=Bt(function*(t){if(mE.every((n,r)=>t[r]===n))try{let n=new Map,r=new Map;for(let[s,a]of mm(t))/\.(xml|rels)$/.test(s)?n.set(s,it(Fs(a))):r.set(s,a);let i=yield Im(n,r);return k({parts:n,binaryParts:r},i.size>0?{importedDocuments:i}:{})}catch{return}});return function(n){return e.apply(this,arguments)}})(),Im=(function(){var e=Bt(function*(t,n){let r=new Map;for(let[a,o]of t){var i,s;if(a.endsWith(".rels"))for(let{attributes:l={}}of(i=(s=vs(o))===null||s===void 0?void 0:s.elements)!==null&&i!==void 0?i:[]){let c=tn(sm(a),String(l.Target)),d=n.get(c),p=l.Type===fE&&l.TargetMode!=="External"&&d?yield gE(d):void 0;p&&r.set(c,p)}}return r});return function(n,r){return e.apply(this,arguments)}})(),vs=e=>{var t;return e==null||(t=e.elements)===null||t===void 0?void 0:t.find(({type:n})=>n==="element")},bE=(function(){var e=Bt(function*(t,n,r=new Map){var i,s;let a=vs(t.get(ol));if(!a)return;let o=yield Im(t,r),l=n(k({parts:t,binaryParts:r},o.size>0?{importedDocuments:o}:{})),c=rf(Ll,a,l,{blank:!0}),d=(i=(s=vs(t.get(Ge(ol))))===null||s===void 0?void 0:s.elements)!==null&&i!==void 0?i:[];for(let{attributes:p={}}of d){let u=/\/(header|footer)$/.test(String(p.Type))?vs(t.get(tn(ol,String(p.Target)))):void 0;u&&sf(Ll,u,l,{blank:!0,sectionPageCount:c.get(String(p.Id))})}});return function(n,r){return e.apply(this,arguments)}})(),vE=new Set(["w:hyperlink","w:sdt","w:sdtContent","w:ins","w:moveTo","w:smartTag","w:customXml","w:fldSimple","w:dir","w:bdo"]),Pm=(e,t)=>{var n;return((n=e.elements)!==null&&n!==void 0?n:[]).flatMap((r,i)=>{var s;return r.name==="w:r"?[{element:r,path:[...t,i]}]:vE.has((s=r.name)!==null&&s!==void 0?s:"")?Pm(r,[...t,i]):[]})},Cs=(e,t)=>t.reduce((n,r)=>n.elements[r],e),Br=e=>{if(e.element.name!=="w:p")throw new Error(`Invalid node type: ${e.element.name}`);if(!e.element.elements)return{text:"",runs:[],index:-1,pathToParagraph:[]};let t=0,n=Pm(e.element,[]).map(({element:r,path:i})=>{let s=wE(r,i,t);return t+=s.text.length,s});return{text:n.reduce((r,i)=>r+i.text,""),runs:n,index:e.index,pathToParagraph:Om(e)}},wE=(e,t,n)=>{if(!e.elements)return{text:"",parts:[],path:t,start:n,end:n};let r=n,i=e.elements.map((s,a)=>{var o,l;if(s.name!=="w:t"||!s.elements||s.elements.length===0)return;let c=(o=(l=s.elements[0].text)===null||l===void 0?void 0:l.toString())!==null&&o!==void 0?o:"",d=r;return r+=c.length,{text:c,index:a,start:d,end:d+c.length-1}}).filter(s=>!!s).map(s=>s);return{text:i.reduce((s,a)=>s+a.text,""),parts:i,path:t,start:n,end:i.length>0?i[i.length-1].end:n}},Om=e=>e.parent?[...Om(e.parent),e.index]:[e.index],yE=class extends Error{constructor(e){super(`Token ${e} not found`),this.name="TokenNotFoundError"}},xE=(e,t)=>{let n=Br({element:e,index:0,parent:void 0}).runs.find(({parts:r})=>r.some(({text:i})=>i.includes(t)));if(!n)throw new yE(t);return n.path},kE=(e,t)=>{var n,r;let i=-1,s=(n=(r=e.elements)===null||r===void 0?void 0:r.map((a,o)=>{if(i!==-1)return a;if(a.type==="element"&&a.name==="w:t"){var l,c;let d=((l=(c=a.elements)===null||c===void 0||(c=c[0])===null||c===void 0?void 0:c.text)!==null&&l!==void 0?l:"").split(t),p=d.map(u=>k(k(k({},a),Sm(a)),{},{elements:Tm(u)}));return d.length>1&&(i=o),p}else return a}).flat())!==null&&n!==void 0?n:[];return{left:k(k({},JSON.parse(JSON.stringify(e))),{},{elements:s.slice(0,i+1)}),right:k(k({},JSON.parse(JSON.stringify(e))),{},{elements:s.slice(i+1)})}},fr={START:0,MIDDLE:1,END:2},Lm=({paragraphElement:e,renderedParagraph:t,originalText:n,replacementText:r,fromIndex:i=0})=>{let s=t.text.indexOf(n,i),a=s+n.length-1,o=fr.START;for(let l of t.runs){let c=Cs(e,l.path);for(let{text:d,index:p,start:u,end:f}of l.parts)switch(o){case fr.START:if(s>=u&&s<=f){let m=s-u,h=Math.min(a,f)-u;if(d.substring(m,h+1)==="")continue;let g=d.substring(0,m)+r+d.substring(h+1);ll(c.elements[p],g),o=fr.MIDDLE;continue}break;case fr.MIDDLE:if(a<=f){let m=d.substring(a-u+1);ll(c.elements[p],m);let h=c.elements[p];c.elements[p]=Sm(h),o=fr.END}else ll(c.elements[p],"")}}return e},ll=(e,t)=>(e.elements=Tm(t),e),kh=e=>{var t,n;return(t=(n=e.element.elements)===null||n===void 0?void 0:n.map((r,i)=>({element:r,index:i,parent:e})))!==null&&t!==void 0?t:[]},Rm=e=>{let t=[],n=[...kh({element:e,index:0,parent:void 0})],r;for(;n.length>0;)r=n.shift(),r.element.name==="w:p"&&(t=[...t,Br(r)]),n.push(...kh(r));return t},dc=(e,t)=>Rm(e).filter(n=>n.text.includes(t)),cl="\uFFFF",TE=({json:e,patch:t,patchText:n,context:r,keepOriginalStyles:i=!0,recursive:s=!0,renumberIds:a=o=>o})=>{let o=dc(e,n);if(o.length===0)return{element:e,didFindOccurrence:!1};let l=[...o].reverse(),c=t.type===Te.DOCUMENT?RE(l):l,d,p=()=>{var f;return d=((f=d)!==null&&f!==void 0?f:Dm(e))+1,String(d)};for(let f of c)switch(t.type){case Te.DOCUMENT:{var u;let m=ME(e,f.pathToParagraph),h=DE(f.pathToParagraph),g=Th(t,r,a),v=m.name==="w:tc"&&h===m.elements.length-1&&((u=g[g.length-1])===null||u===void 0?void 0:u.name)!=="w:p"?[{type:"element",name:"w:p"}]:[];m.elements.splice(h,1,...g,...v);break}case Te.PARAGRAPH:default:{let m=Bm(e,f.pathToParagraph),h=f,g=0;do g=SE({paragraphElement:m,renderedParagraph:h,patchText:n,fromIndex:g,children:Th(t,r,a),keepOriginalStyles:i,newTrackedChangeId:p}),h=Br({element:m,index:f.index,parent:void 0});while(s&&h.text.includes(n,g));break}}return{element:e,didFindOccurrence:!0}},Th=(e,t,n)=>n(e.children.flatMap(r=>{var i;return(i=r.writtenAs)!==null&&i!==void 0?i:r}).flatMap(r=>{let i=r.prepForXml(t);return i?[it(U(i)).elements[0]]:[]})),SE=({paragraphElement:e,renderedParagraph:t,patchText:n,fromIndex:r,children:i,keepOriginalStyles:s,newTrackedChangeId:a})=>{let o=t.text.indexOf(n,r);Lm({paragraphElement:e,renderedParagraph:t,originalText:n,replacementText:cl,fromIndex:r});let l=xE(e,cl),c=l.slice(0,-1),d=Cs(e,c),p=l[l.length-1],u=c.map((A,y)=>Cs(e,c.slice(0,y+1))).filter(A=>A.name==="w:sdt"),f=[...u].reverse().find(EE),m=d.elements[p],{left:h,right:g}=kE(m,cl),v=m.elements.find(A=>A.type==="element"&&A.name==="w:rPr"),w=f?CE(f):v,b=s&&w?i.map(A=>Mm(A,w)):i,C=v?k(k({},g),{},{elements:[v,...g.elements]}):g;return d.elements.splice(p,1,h,...b,C),u.forEach(A=>NE(A,b)),PE(e,c,a),o+Br({element:{name:"w:p",elements:[...b]},index:0,parent:void 0}).text.length},pc=e=>{var t;return(t=e.elements)===null||t===void 0?void 0:t.find(n=>n.name==="w:sdtPr")},EE=e=>{var t;return!!(!((t=pc(e))===null||t===void 0||(t=t.elements)===null||t===void 0)&&t.some(n=>n.name==="w:showingPlcHdr"))},CE=e=>{var t;return(t=pc(e))===null||t===void 0||(t=t.elements)===null||t===void 0?void 0:t.find(n=>n.name==="w:rPr")},_E=new Set(["w:rPr","w:t","w:tab","w:br"]),AE=e=>e.name==="w:bookmarkStart"||e.name==="w:bookmarkEnd"||e.name==="w:r"&&Yt(e).every(t=>_E.has(t.name)),NE=(e,t)=>{let n=pc(e);if(!n?.elements)return;let r=n.elements.some(i=>i.name==="w:text")&&!t.every(AE);n.elements=n.elements.filter(i=>i.name!=="w:showingPlcHdr"&&i.name!=="w:dataBinding"&&!(r&&i.name==="w:text"))},Rl=new Set(["w:hyperlink","w:fldSimple","w:subDoc"]),IE=new Map([["w:ins",Rl],["w:moveTo",Rl],["w:hyperlink",new Set(["w:hyperlink"])]]),PE=(e,t,n)=>{for(let i=t.length;i>0;i--){var r;let s=Cs(e,t.slice(0,i-1)),a=t[i-1],o=s.elements[a],l=IE.get(o.name),c=g=>!!l?.has(g.name);if(!(!((r=o.elements)===null||r===void 0)&&r.some(c)))continue;let{elements:d}=o,p=d.flatMap((g,v)=>v===0||c(g)||c(d[v-1])?[v]:[]),u=p.map((g,v)=>d.slice(g,p[v+1])),f=l===Rl,m=!0,h=u.map(g=>{if(c(g[0]))return g[0];let v=f&&!m?k(k({},o.attributes),{},{"w:id":n()}):o.attributes;return m=!1,k(k({},o),{},{attributes:v,elements:[...g]})});s.elements.splice(a,1,...h)}},Mm=(e,t)=>e.name==="w:r"?OE(e,t):e.elements?k(k({},e),{},{elements:e.elements.map(n=>Mm(n,t))}):e,OE=(e,t)=>{let n=Yt(e).find(a=>a.type==="element"&&a.name==="w:rPr");if(!n)return k(k({},e),{},{elements:[t,...Yt(e)]});let r=new Set(Yt(n).map(a=>a.name)),i=[...Yt(t).filter(a=>!r.has(a.name)),...Yt(n)],s=k(k({},n),{},{elements:[...i].sort((a,o)=>Sh(a)-Sh(o))});return k(k({},e),{},{elements:Yt(e).map(a=>a===n?s:a)})},dl=["w:rStyle","w:rFonts","w:b","w:bCs","w:i","w:iCs","w:caps","w:smallCaps","w:strike","w:dstrike","w:outline","w:shadow","w:emboss","w:imprint","w:noProof","w:snapToGrid","w:vanish","w:webHidden","w:color","w:spacing","w:w","w:kern","w:position","w:sz","w:szCs","w:highlight","w:u","w:effect","w:bdr","w:shd","w:fitText","w:vertAlign","w:rtl","w:cs","w:em","w:lang","w:eastAsianLayout","w:specVanish","w:oMath","w14:glow","w14:shadow","w14:reflection","w14:textOutline","w14:textFill","w14:scene3d","w14:props3d","w14:ligatures","w14:numForm","w14:numSpacing","w14:stylisticSets","w14:cntxtAlts"],Sh=e=>{var t;if(e.name==="w:rPrChange")return dl.length+1;let n=dl.indexOf((t=e.name)!==null&&t!==void 0?t:"");return n===-1?dl.length:n},Yt=e=>{var t;return(t=e.elements)!==null&&t!==void 0?t:[]},Dm=e=>{var t,n;let r=Number((t=e.attributes)===null||t===void 0?void 0:t["w:id"]);return((n=e.elements)!==null&&n!==void 0?n:[]).reduce((i,s)=>Math.max(i,Dm(s)),Number.isInteger(r)?r:0)},LE=(e,t)=>e.length>t.length&&t.every((n,r)=>e[r]===n),RE=e=>e.filter(t=>!e.some(n=>LE(t.pathToParagraph,n.pathToParagraph))),Bm=(e,t)=>{let n=e;for(let r=1;r<t.length;r++){let i=t[r];n=n.elements[i]}return n},ME=(e,t)=>Bm(e,t.slice(0,t.length-1)),DE=e=>e[e.length-1],BE=new nn,pl="word/styles.xml",$E=new Set(["w:pStyle","w:rStyle","w:tblStyle","w:basedOn","w:next","w:link"]),xr=e=>{var t;return String((t=e.attributes)===null||t===void 0?void 0:t["w:styleId"])},Ml=e=>{var t;let n=(t=e.elements)===null||t===void 0||(t=t.find(r=>r.name==="w:name"))===null||t===void 0||(t=t.attributes)===null||t===void 0?void 0:t["w:val"];return n===void 0?void 0:String(n).toLowerCase()},ws=(e,t)=>{var n;return e==null||(n=e.elements)===null||n===void 0?void 0:n.find(r=>r.name===t)},Eh=e=>{var t;let n=Number((t=ws(e,"w:sz"))===null||t===void 0||(t=t.attributes)===null||t===void 0?void 0:t["w:val"]);return Number.isNaN(n)?void 0:n},FE=e=>{var t,n;let r=e.filter(a=>a.name==="w:style"),i=(t=r.find(a=>xr(a)==="Normal"))!==null&&t!==void 0?t:r.find(a=>{var o;return((o=a.attributes)===null||o===void 0?void 0:o["w:type"])==="paragraph"&&Ml(a)==="normal"}),s=e.find(a=>a.name==="w:docDefaults");return(n=Eh(ws(i,"w:rPr")))!==null&&n!==void 0?n:Eh(ws(ws(s,"w:rPrDefault"),"w:rPr"))},HE=(e,t)=>new Map(Object.values(nc({document:{run:{size:t}}})).map(n=>it(U(BE.format(n,e))).elements[0]).filter(n=>n.name==="w:style").map(n=>[xr(n),n])),UE=(e,t)=>{var n;let r=ke((n=e.get(pl))!==null&&n!==void 0?n:{},"w:styles"),i=r.filter(m=>m.name==="w:style"),s=new Set(i.map(xr)),a,o=m=>{var h;return(h=a)!==null&&h!==void 0||(a=HE(t(pl),FE(r))),a.get(m)},l=new Set,c=new Map,d=m=>{let h=s.has(m)?void 0:o(m);if(h===void 0)return m;let g=i.find(v=>{var w,b;return((w=v.attributes)===null||w===void 0?void 0:w["w:type"])===((b=h.attributes)===null||b===void 0?void 0:b["w:type"])&&Ml(v)===Ml(h)});return g!==void 0?xr(g):(l.add(m),m)},p=m=>(c.has(m)||c.set(m,d(m)),c.get(m)),u=m=>{var h;return $E.has((h=m.name)!==null&&h!==void 0?h:"")?k(k({},m),{},{attributes:k(k({},m.attributes),{},{"w:val":p(String(m.attributes["w:val"]))})}):m.elements===void 0?m:k(k({},m),{},{elements:m.elements.map(u)})};return{use:m=>m.map(u),write:()=>{let m=e.get(pl);if(!m)return;let h=ke(m,"w:styles"),g=new Set(h.map(xr));for(let v of l)g.has(v)||(g.add(v),h.push(u(o(v))))}}},qE={type:Te.PARAGRAPH,children:[]},WE=({json:e,key:t,patch:n,delimiters:{start:r,end:i},patchPlaceholder:s,renumberDrawings:a})=>{let o=`${r}${t}.`;for(let l of jE(e,o)){let c=zE(l.elements,o,i),d=n.rows.flatMap((p,u)=>{let f={type:"element",name:"w:tbl",elements:[...u===0?l.elements.map(VE):a(Fm(l.elements))]},m=new Map(Object.entries(p).flatMap(([h,g])=>g===void 0?[]:[[h,g]]));for(let[h,g]of m)s(f,`${t}.${h}`,g);for(let h of c.filter(g=>!m.has(g)))s(f,`${t}.${h}`,qE);return f.elements});l.parent.elements.splice(l.parent.elements.indexOf(l.elements[0]),l.elements.length,...d),l.table&&!$m(l.table.element)&&l.table.parent.elements.splice(l.table.parent.elements.indexOf(l.table.element),1)}},jE=(e,t)=>{let n=dc(e,t).flatMap(i=>{let s=KE(e,i.pathToParagraph);return s?[s]:[]}),r=n.filter(i=>!n.some(s=>GE(i.path,s.path))).filter((i,s,a)=>a.findIndex(o=>o.row===i.row)===s);return[...new Set(r.map(i=>i.parent))].flatMap(i=>{let s=i.elements.filter(l=>l.name==="w:tr"),a=r.filter(l=>l.parent===i).map(l=>s.indexOf(l.row)).sort((l,c)=>l-c),{table:o}=r.find(l=>l.parent===i);return a.reduce((l,c)=>{let d=l[l.length-1];return d?.[d.length-1]===c-1?[...l.slice(0,-1),[...d,c]]:[...l,[c]]},[]).map(l=>{let c=i.elements.indexOf(s[l[0]]),d=i.elements.indexOf(s[l[l.length-1]]);return{parent:i,table:o,elements:i.elements.slice(c,d+1)}})})},KE=(e,t)=>{let n=e,r,i;for(let s=1;s<t.length;s++){let a=n.elements[t[s]];a.name==="w:tbl"&&(i={element:a,parent:n}),a.name==="w:tr"&&(r={parent:n,table:i,row:a,path:t.slice(0,s+1)}),n=a}return r},GE=(e,t)=>e.length>t.length&&t.every((n,r)=>e[r]===n),$m=e=>{var t;return((t=e.elements)!==null&&t!==void 0?t:[]).some(n=>n.name==="w:tr"||n.name!=="w:tblPr"&&n.name!=="w:tblGrid"&&$m(n))},zE=(e,t,n)=>{let r=dc({elements:[...e]},t).flatMap(({text:i})=>i.split(t).slice(1).flatMap(s=>{let a=s.indexOf(n);return a>0?[s.slice(0,a)]:[]}));return[...new Set(r)]},VE=e=>JSON.parse(JSON.stringify(e)),XE=["w14:paraId","w14:textId"],YE=["w:bookmarkStart","w:bookmarkEnd"],Fm=(e,t)=>e.filter(n=>{var r;return!YE.includes((r=n.name)!==null&&r!==void 0?r:"")&&!(t?.name==="w:sdtPr"&&n.name==="w:id")}).map(n=>k(k(k({},n),n.attributes===void 0?{}:{attributes:Object.fromEntries(Object.entries(n.attributes).filter(([r])=>!XE.includes(r)))}),n.elements===void 0?{}:{elements:[...Fm(n.elements,n)]})),JE=e=>e[0]===255&&e[1]===254||e[0]===254&&e[1]===255,QE=e=>{var t;let n=u2(e,"word/document.xml"),r=n===void 0||(t=[...e].find(([i])=>DS(i,n)))===null||t===void 0?void 0:t[1];return r===void 0||JE(r)?void 0:Hl(m2(Fs(r)))},_s=(e,t,{start:n,end:r},i)=>{for(let s=e.indexOf(n,t);s!==-1;s=e.indexOf(n,s+1)){let a=e.indexOf(r,s+n.length);if(a===-1)return;let o=e.slice(s+n.length,a),l=o.trim();if(l!==o&&i(l))return{index:s,placeholder:e.slice(s,a+r.length),trimmed:`${n}${l}${r}`}}},ZE=(e,t,n)=>{let r=e;for(let i=_s(r,0,t,n);i!==void 0;i=_s(r,i.index+i.trimmed.length,t,n))r=`${r.slice(0,i.index)}${i.trimmed}${r.slice(i.index+i.placeholder.length)}`;return r},Hm=e=>{var t;return((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(n=>[...n.name==="w:p"?[n]:[],...Hm(n)])},eC=(e,t,n)=>{let r=()=>Br({element:e,index:0,parent:void 0});for(let i=r(),s=_s(i.text,0,t,n);s!==void 0;i=r(),s=_s(i.text,s.index+s.trimmed.length,t,n))Lm({paragraphElement:e,renderedParagraph:i,originalText:s.placeholder,replacementText:s.trimmed,fromIndex:s.index})},tC=(e,{delimiters:t,textKeys:n,tableRowsKeys:r,drawingKeys:i})=>{let s=l=>n.has(l)||r.some(c=>l.startsWith(`${c}.`));for(let l of Hm(e))eC(l,t,s);let a=l=>i.has(l);for(let{properties:l}of Hs(e))for(let c of["descr","title"]){var o;let d=(o=l.attributes)===null||o===void 0?void 0:o[c];d!==void 0&&(l.attributes[c]=ZE(String(d),t,a))}},Um=e=>{var t;return e.name==="v:shapetype"&&((t=e.attributes)===null||t===void 0?void 0:t.id)!==void 0?String(e.attributes.id):void 0},qm=e=>{var t;let n=Um(e);return[...n===void 0?[]:[n],...((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(qm)]},nC=e=>{let t=new Set(qm(e)),n=r=>{let i=Um(r);return i!==void 0?t.has(i)?[]:(t.add(i),[r]):[r.elements===void 0?r:k(k({},r),{},{elements:r.elements.flatMap(n)})]};return r=>r.flatMap(n)},Wm=(e,t,{inTableRow:n})=>{if(t?.type===Te.TABLE_ROWS&&Array.isArray(t.rows)){for(let r of t.rows){if(typeof r!="object"||r===null)throw new Error(`Invalid patch "${e}". Expected each of its rows to be an object of patches, by the name of their field`);for(let[i,s]of Object.entries(r))s!==void 0&&Wm(`${e}.${i}`,s,{inTableRow:!0})}return}if(!(t?.type===Te.DRAWING?!n&&typeof t.patch=="function":t?.type!==Te.TABLE_ROWS&&Array.isArray(t?.children)))throw new Error(`Invalid patch "${e}". Expected { type: PatchType.PARAGRAPH or PatchType.DOCUMENT, children: [...] }, ${n?"or { type: PatchType.TABLE_ROWS, rows: [...] }":"{ type: PatchType.TABLE_ROWS, rows: [...] }, or a drawing patch such as ImagePatch, or ChartDataPatch from docx/charts"}`)},Ch=new ym,rC=new Uint8Array([255,254]),iC=new Uint8Array([254,255]),sC=new Set(["w:document","w:hdr","w:ftr","w:footnotes","w:endnotes","w:comments"]),_h=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},DN=(function(){var e=Bt(function*({outputType:t,data:n,patches:r,keepOriginalStyles:i,placeholderDelimiters:s={start:"{{",end:"}}"},recursive:a=!0,trimPlaceholders:o=!1,footnotes:l,endnotes:c,numbering:d={config:[]},pageNumbers:p,properties:u}){let f=yield Am(n),m=new Map,h=QE(f),g=[],v=new Vf({addOverride:(R,$)=>g.push({contentType:R,partName:$})},new Set([...f.keys()].filter(R=>R.startsWith("word/")).map(R=>R.slice(5)))),w={Media:new Gf(R=>v.takePath("media","image",R)),Numbering:new zf(d),Theme:h&&{Colors:h},FootNotes:{View:{idOf:(R,$,F)=>wt("footnotes",R,$,F)}},Endnotes:{View:{idOf:(R,$,F)=>wt("endnotes",R,$,F)}},PackageParts:v},b=new Map,C=[],A=[],y=!1,T=new Map;Em(s);let{start:x,end:_}=s;for(let[R,$]of Object.entries(r))Wm(R,$,{inTableRow:!1});for(let[R,$]of f){var N;let F=$.slice(0,2);if(_h(F,rC)||_h(F,iC)){T.set(R,$);continue}if(!R.endsWith(".xml")&&!R.endsWith(".rels")){T.set(R,$);continue}let Z=it(Fs($)),ie=(N=Z.elements)===null||N===void 0?void 0:N.find(se=>{var Y;return sC.has((Y=se.name)!==null&&Y!==void 0?Y:"")});if(ie&&ie.attributes){for(let se of["mc","wp","r","w15","m","v","o"])ie.attributes[`xmlns:${se}`]=vl[se];ie.attributes["mc:Ignorable"]=`${ie.attributes["mc:Ignorable"]||""} w15`.trim()}b.set(R,Z)}let M=I2([...b.values()].flatMap(km)),D=j2([...b.values()].flatMap(Cm)),V=new Map,re=R=>{let $=V.get(R);if($)return $;let F={Relationships:{addRelationship:(Z,ie,se,Y)=>{A.push({key:R,id:Z,type:ie,target:se,targetMode:Y})}}};return V.set(R,F),F},ee=R=>({file:w,viewWrapper:re(R),stack:[]}),te=(R,$)=>{g.push({contentType:R,partName:$})},X=UE(b,ee),fe=hE(w.Numbering,b,{createContext:ee,addContentTypeOverride:te}),le=aE({footnotes:l,endnotes:c},b,{createContext:ee,addContentTypeOverride:te,renumberBookmarks:M,renumberDrawings:D,renumberLists:fe.renumber,useStyles:X.use}),wt=(R,$,F,Z)=>Z.viewWrapper===re("word/document.xml")?le.carry(R,$,F):void 0;if(o){let R=F=>Object.entries(r).flatMap(([Z,ie])=>F(ie.type)?[Z]:[]),$={delimiters:{start:x,end:_},textKeys:new Set(R(F=>F!==Te.TABLE_ROWS&&F!==Te.DRAWING)),tableRowsKeys:R(F=>F===Te.TABLE_ROWS),drawingKeys:new Set(R(F=>F===Te.DRAWING))};for(let[F,Z]of b)F.startsWith("word/")&&!F.endsWith(".rels")&&tC(Z,$)}Y2({parts:b,binaryParts:T,file:w,patches:Object.entries(r).flatMap(([R,$])=>$.type===Te.DRAWING?[[R,$]]:[]),delimiters:{start:x,end:_}},ee);let Ee=Object.entries(r).flatMap(([R,$])=>$.type===Te.DRAWING?[]:[[R,$]]),Fe=[...Ee.filter(([,R])=>R.type===Te.TABLE_ROWS),...Ee.filter(([,R])=>R.type!==Te.TABLE_ROWS)];for(let[R,$]of[...b]){if(!R.startsWith("word/")||R.endsWith(".xml.rels"))continue;let F=ee(R);m.set(R,F);let Z=nC($),ie=(se,Y,Pe)=>{if(Pe.type===Te.TABLE_ROWS){WE({json:se,key:Y,patch:Pe,delimiters:{start:x,end:_},patchPlaceholder:ie,renumberDrawings:D});return}let wc=[],{didFindOccurrence:dg}=TE({json:se,patch:k(k({},Pe),{},{children:Pe.children.flatMap(He=>He instanceof wf?He.writtenAs:[He]).map(He=>{if(He instanceof j1){let{target:pg,anchor:ug}=Tf(He.options.link),yc=new Jl(He.options.children,Cn(),ug,He.options.link);return wc.push({key:R,id:yc.linkId,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",target:pg,targetMode:jl.EXTERNAL}),yc}else return He})}),patchText:`${x}${Y}${_}`,context:F,keepOriginalStyles:i,recursive:a,renumberIds:He=>X.use(fe.renumber(le.renumber(M(D(Z(He))))))});dg&&A.push(...wc)};for(let[se,Y]of Fe)ie($,se,Y)}le.write(),fe.write(),X.write();for(let[R,$]of b){if(!R.startsWith("word/")||R.endsWith(".xml.rels"))continue;let F=Ch.getMediaData(JSON.stringify($),w.Media);F.length>0&&(y=!0,C.push({key:R,mediaDatas:F}))}for(let{key:R,mediaDatas:$}of C){var ve;let F=Ge(R),Z=(ve=b.get(F))!==null&&ve!==void 0?ve:Nr();b.set(F,Z);let ie=lc(Z),se=Ch.replace(JSON.stringify(b.get(R)),$,ie);b.set(R,JSON.parse(se));for(let Y=0;Y<$.length;Y++){let{fileName:Pe}=$[Y];Al(Z,ie+Y,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${Pe}`)}}for(let{key:R,id:$,type:F,target:Z,targetMode:ie}of A){var we;let se=Ge(R),Y=(we=b.get(se))!==null&&we!==void 0?we:Nr();b.set(se,Y),Al(Y,$,F,Z,ie)}p&&(yield bE(b,p,T)),u&&U2(b,T,u,{addContentTypeOverride:te});let Q=ac(w,void 0);if(y||g.length>0){let R=b.get("[Content_Types].xml");if(!R)throw new Error("Could not find content types file");y&&(yn(R,"image/png","png"),yn(R,"image/jpeg","jpeg"),yn(R,"image/jpeg","jpg"),yn(R,"image/bmp","bmp"),yn(R,"image/gif","gif"),yn(R,"image/svg+xml","svg"));for(let{contentType:$,partName:F}of g)O2(R,$,F)}return Cl(Ss([...[...b].map(([R,$])=>[R,Ty($)]),...T,...w.Media.Array.map(({data:R,fileName:$})=>[`word/media/${$}`,R]),...Q.map(({path:R,data:$})=>[R,$])]),t,"application/vnd.openxmlformats-officedocument.wordprocessingml.document")});return function(n){return e.apply(this,arguments)}})(),aC=e=>e.startsWith("word/")&&/\.(xml|rels)$/.test(e)&&!e.endsWith(".xml.rels"),BN=(function(){var e=Bt(function*({data:t,placeholderDelimiters:n={start:"{{",end:"}}"},trimPlaceholders:r=!1}){Em(n);let i=oC(n),s=yield Am(t,aC),a=new Set;for(let[,o]of s){let l=it(Fs(o));[...Rm(l).map(c=>c.text),...Hs(l).flatMap(({properties:c})=>_m(c))].flatMap(c=>{var d;return(d=c.match(i))!==null&&d!==void 0?d:[]}).map(c=>r?c.trim():c).filter(c=>c!=="").forEach(c=>a.add(c))}return Array.from(a)});return function(n){return e.apply(this,arguments)}})(),ul=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),oC=({start:e,end:t})=>new RegExp(`(?<=${ul(e)})(?:(?!${ul(e)}).)+?(?=${ul(t)})`,"gs")});var Qm={};xc(Qm,{EXPORT_DIR:()=>$r,FORMATS:()=>uc,buildIR:()=>Ws,exportDoc:()=>hc,irToDocx:()=>Jm,irToHtml:()=>js});import Km from"node:fs";import Gm from"node:path";function lC(e){return`${String(e.getDate()).padStart(2,"0")}/${String(e.getMonth()+1).padStart(2,"0")}/${e.getFullYear()}`}function dC(e){let t=e.result;if(!t)return[zm["not-run"]];let n=[zm[t.status]];return t.actual&&n.push("Th\u1EF1c t\u1EBF: "+t.actual),t.bug&&n.push("L\u1ED7i: "+t.bug),n}function pC(e,t){let n=e.kind==="non-functional",r=e.cases.filter(o=>!o.deleted),i=n?["STT","Y\xEAu c\u1EA7u","K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED","K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i"]:["STT","T\xECnh hu\u1ED1ng","C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n","K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i"],s=[7,27,38,28];t.results&&(i.push("K\u1EBFt qu\u1EA3","Ng\u01B0\u1EDDi test / ng\xE0y"),s=[8,20,27,20,13,12]);let a=r.map((o,l)=>{let d=[[String(l+1),...t.codes?[o.code]:[]],qs(n&&o.requirement||o.case),qs(o.steps),qs(o.expected)];return t.results&&d.push(dC(o),o.result?[o.result.by??"",cC(o.result.at)].filter(Boolean):[]),d});return{head:i,widths:s,rows:a}}function Xm(e){let t=lr();for(let n of e)$o(n,t);return t}function Ws(e,t={}){let n=e.config,r=n.overview??{},i=t.date??new Date,s=[],a=v=>or(e,v),o=e.modules.filter(v=>a(v.code).some(w=>w.kind==="functional")),l=e.modules.filter(v=>a(v.code).some(w=>w.kind==="non-functional")),c=zt(e.root,n.ba),d=c?Gt(c):null;s.push({k:"cover",lines:[...r.owner?[{text:r.owner.toUpperCase(),bold:!0}]:[],{text:""},{text:"T\xC0I LI\u1EC6U",bold:!0,size:32},{text:"K\u1ECACH B\u1EA2N KI\u1EC2M TH\u1EEC (CH\u1EE8C N\u0102NG, PHI CH\u1EE8C N\u0102NG)",bold:!0,size:32},{text:n.title,bold:!0,size:28},{text:""},{text:"Phi\xEAn b\u1EA3n t\xE0i li\u1EC7u: "+(r.docVersion||"1.0")},...t.results?[{text:"B\u1EA3n k\xE8m k\u1EBFt qu\u1EA3 ki\u1EC3m th\u1EED"}]:[],{text:""},...r.owner?[{text:"\u0110\u01A1n v\u1ECB qu\u1EA3n l\xFD: "+r.owner}]:[],...r.contractor?[{text:"\u0110\u01A1n v\u1ECB th\u1EF1c hi\u1EC7n: "+r.contractor}]:[],{text:""},{text:(r.place?r.place+", ":"")+lC(i)}]}),s.push({k:"pagebreak"}),s.push({k:"p",text:"TRANG K\xDD",bold:!0});let p=n.members.length?n.members:[{id:"",name:"",role:""}];s.push({k:"table",head:["TT","Ng\xE0y","H\u1ECD t\xEAn","Vai tr\xF2","K\xFD t\xEAn"],widths:[6,16,30,28,20],rows:p.map((v,w)=>[[String(w+1)],[""],[v.name],[v.role??""],[""]])}),s.push({k:"pagebreak"}),s.push({k:"toc",title:"M\u1EE4C L\u1EE4C"}),s.push({k:"pagebreak"});let u=0;s.push({k:"h",level:1,text:`${Vm[u++]}. T\u1ED4NG QUAN`}),s.push({k:"h",level:2,text:"1. M\u1EE5c \u0111\xEDch t\xE0i li\u1EC7u"}),s.push({k:"p",text:r.purpose||`T\xE0i li\u1EC7u n\xE0y m\xF4 t\u1EA3 c\xE1c t\xECnh hu\u1ED1ng ki\u1EC3m th\u1EED ch\u1EE9c n\u0103ng v\xE0 phi ch\u1EE9c n\u0103ng c\u1EE7a ${n.title}, l\xE0m c\u0103n c\u1EE9 ki\u1EC3m th\u1EED ch\u1EA5p nh\u1EADn (UAT) v\xE0 b\xE0n giao.`}),s.push({k:"h",level:2,text:"2. Ph\u1EA1m vi"}),r.scope?s.push({k:"p",text:r.scope}):(s.push({k:"p",text:"T\xE0i li\u1EC7u ki\u1EC3m th\u1EED c\xE1c ch\u1EE9c n\u0103ng, th\u1ECFa m\xE3n c\xE1c \u0111\u1EA7u m\u1EE5c ch\xEDnh nh\u01B0 sau:"}),s.push({k:"list",items:e.modules.filter(v=>a(v.code).length).map(v=>v.title)})),s.push({k:"h",level:2,text:"3. Th\xF4ng tin m\xF4i tr\u01B0\u1EDDng ki\u1EC3m th\u1EED"}),s.push({k:"p",text:r.environment||"\u0110\u01B0\u1EDDng d\u1EABn / m\xE1y ch\u1EE7: (b\u1ED5 sung)"}),s.push({k:"h",level:2,text:"4. T\xE0i li\u1EC7u li\xEAn quan"}),s.push({k:"p",text:r.references||"T\xE0i li\u1EC7u n\xE0y \u0111\u01B0\u1EE3c x\xE2y d\u1EF1ng d\u1EF1a tr\xEAn c\xE1c t\xE0i li\u1EC7u:"}),r.references||s.push({k:"list",items:["T\xE0i li\u1EC7u \u0111\u1EB7c t\u1EA3 y\xEAu c\u1EA7u ph\u1EA7n m\u1EC1m;","T\xE0i li\u1EC7u thi\u1EBFt k\u1EBF chi ti\u1EBFt;","T\xE0i li\u1EC7u \u0111\u1EB7c t\u1EA3 chi ti\u1EBFt ch\u1EE9c n\u0103ng."]}),s.push({k:"h",level:2,text:"5. Thu\u1EADt ng\u1EEF v\xE0 \u0111\u1ECBnh ngh\u0129a"});let f=r.terms?.length?r.terms:[{term:"UAT",desc:"Ki\u1EC3m th\u1EED ch\u1EA5p nh\u1EADn ng\u01B0\u1EDDi d\xF9ng (User Acceptance Test)"},{term:"K\u1ECBch b\u1EA3n",desc:"T\u1EADp t\xECnh hu\u1ED1ng ki\u1EC3m th\u1EED cho m\u1ED9t ch\u1EE9c n\u0103ng / use case"},{term:"T\xECnh hu\u1ED1ng",desc:"M\u1ED9t tr\u01B0\u1EDDng h\u1EE3p ki\u1EC3m th\u1EED: c\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n v\xE0 k\u1EBFt qu\u1EA3 mong \u0111\u1EE3i"}];s.push({k:"table",head:["STT","Thu\u1EADt ng\u1EEF / vi\u1EBFt t\u1EAFt","M\xF4 t\u1EA3"],widths:[8,30,62],rows:f.map((v,w)=>[[String(w+1)],[v.term],[v.desc]])});let m=(v,w,b)=>{if(s.push({k:"pagebreak"}),s.push({k:"h",level:1,text:`${Vm[u++]}. ${v}`}),!w.length){s.push({k:"p",text:"(Ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n.)",italic:!0});return}w.forEach((C,A)=>{s.push({k:"h",level:2,text:`${A+1}. ${C.title}`}),b==="functional"&&C.commonSteps.trim()&&(s.push({k:"p",text:"C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n chung:",bold:!0}),s.push({k:"list",items:qs(C.commonSteps)})),a(C.code).filter(y=>y.kind===b).forEach((y,T)=>{s.push({k:"h",level:3,text:`${A+1}.${T+1}. ${y.title}`});let x=[y.useCases.length?"Use case: "+y.useCases.join(", "):"",y.covers.length?"Ch\u1EE9c n\u0103ng: "+y.covers.map(N=>d?.get(N)?.title?`${N} (${d.get(N).title})`:N).join("; "):""].filter(Boolean);if(x.length&&s.push({k:"p",text:x.join(" \xB7 "),italic:!0}),y.preconditions&&s.push({k:"p",text:"\u0110i\u1EC1u ki\u1EC7n ti\xEAn quy\u1EBFt: "+y.preconditions}),y.description.trim())for(let N of y.description.trim().split(/\n\s*\n/))s.push({k:"p",text:N.trim()});let _=pC(y,t);_.rows.length?s.push({k:"table",..._}):s.push({k:"p",text:"(Ch\u01B0a c\xF3 t\xECnh hu\u1ED1ng.)",italic:!0})})})};m("CHI TI\u1EBET T\xCCNH HU\u1ED0NG KI\u1EC2M TH\u1EEC Y\xCAU C\u1EA6U CH\u1EE8C N\u0102NG \u1EE8NG D\u1EE4NG",o,"functional"),m("CHI TI\u1EBET T\xCCNH HU\u1ED0NG KI\u1EC2M TH\u1EEC Y\xCAU C\u1EA6U PHI CH\u1EE8C N\u0102NG \u1EE8NG D\u1EE4NG",l,"non-functional");let h=[];t.results&&h.push(()=>{s.push({k:"h",level:2,text:"T\u1ED5ng h\u1EE3p k\u1EBFt qu\u1EA3 ki\u1EC3m th\u1EED"});let v=e.modules.map(C=>({m:C,c:Xm(a(C.code))})).filter(C=>C.c.total),w=Xm(e.modules.flatMap(C=>a(C.code))),b=C=>C.total?Math.round(100*C.passed/C.total)+"%":"\u2014";s.push({k:"table",head:["Ph\xE2n h\u1EC7","T\xECnh hu\u1ED1ng","\u0110\u1EA1t","Kh\xF4ng \u0111\u1EA1t","B\u1ECB ch\u1EB7n","B\u1ECF qua","Ch\u01B0a test","T\u1EF7 l\u1EC7 \u0111\u1EA1t"],widths:[30,10,8,10,9,9,11,13],rows:[...v.map(({m:C,c:A})=>[[C.title],[String(A.total)],[String(A.passed)],[String(A.failed)],[String(A.blocked)],[String(A.skipped)],[String(A["not-run"])],[b(A)]]),[["T\u1ED5ng"],[String(w.total)],[String(w.passed)],[String(w.failed)],[String(w.blocked)],[String(w.skipped)],[String(w["not-run"])],[b(w)]]]})});let g=e.suites.filter(v=>v.status!=="deleted"&&v.covers.length);if(g.length&&h.push(()=>{s.push({k:"h",level:2,text:"Ma tr\u1EADn ch\u1EE9c n\u0103ng \u2013 k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED"});let v=new Map;for(let w of g)for(let b of w.covers)v.set(b,[...v.get(b)??[],w.title]);s.push({k:"table",head:["STT","Ch\u1EE9c n\u0103ng / m\xE0n (t\xE0i li\u1EC7u BA)","K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED"],widths:[8,42,50],rows:[...v.entries()].sort((w,b)=>w[0].localeCompare(b[0])).map(([w,b],C)=>[[String(C+1)],[d?.get(w)?.title?`${w} \u2013 ${d.get(w).title}`:w],b])})}),h.length){s.push({k:"pagebreak"}),s.push({k:"h",level:1,text:"PH\u1EE4 L\u1EE4C"});for(let v of h)v()}return{title:n.title,results:!!t.results,nodes:s}}function js(e){let t=[],n=e.nodes.filter(s=>s.k==="h"),r=0;for(let s of e.nodes)if(s.k==="cover")t.push(`<section class="cover">${s.lines.map(a=>a.text?`<p class="${a.bold?"b":""}"${a.size?` style="font-size:${a.size/2}pt"`:""}>${bt(a.text)}</p>`:"<p>&nbsp;</p>").join("")}</section>`);else if(s.k==="h")t.push(`<h${s.level} id="h${r++}">${bt(s.text)}</h${s.level}>`);else if(s.k==="p")t.push(`<p${s.bold||s.italic?` class="${s.bold?"b":""} ${s.italic?"i":""}"`:""}>${bt(s.text).replace(/\n/g,"<br>")}</p>`);else if(s.k==="list")t.push(`<ul>${s.items.map(a=>`<li>${bt(a)}</li>`).join("")}</ul>`);else if(s.k==="toc")t.push(`<nav class="toc"><p class="b">${bt(s.title)}</p>${n.map((a,o)=>`<a class="l${a.level}" href="#h${o}">${bt(a.text)}</a>`).join("")}</nav>`);else if(s.k==="pagebreak")t.push('<div class="pb"></div>');else if(s.k==="table"){let a=s.widths?`<colgroup>${s.widths.map(o=>`<col style="width:${o}%">`).join("")}</colgroup>`:"";t.push(`<table>${a}<thead><tr>${s.head.map(o=>`<th>${bt(o)}</th>`).join("")}</tr></thead><tbody>${s.rows.map(o=>`<tr>${o.map(l=>`<td>${l.map(bt).join("<br>")}</td>`).join("")}</tr>`).join("")}</tbody></table>`)}return`<!doctype html><html lang="vi"><head><meta charset="utf-8"><title>${bt(e.title)}</title><style>body{background:#e9ecef;margin:0;font:12pt/1.45 "Times New Roman",serif;color:#111}
5336
+ `;case"w:noBreakHyphen":return"-";default:return""}},jk=e=>{let t=[],n=r=>{let i=ct(r);if(i!==void 0&&Hk.has(i))return dt(r).map(n).join("");if(i==="w:fldChar"){let s=$e(r,"w:fldCharType");return s==="begin"?t.push(!1):s==="separate"?t[t.length-1]=!0:t.pop(),""}return t.every(Boolean)?Uk(r):""};return dt(e).map(n).join("")},Im=e=>{let t=ct(e);return t==="w:bookmarkStart"?[{start:!0,id:$e(e,"w:id"),name:$e(e,"w:name")}]:t==="w:bookmarkEnd"?[{start:!1,id:$e(e,"w:id")}]:t===void 0||t==="_attr"?[]:dt(e).flatMap(Im)},Wk=e=>{let t=new Map;return e.map(n=>{let r=Im(n),i=new Set([...t.values(),...r.flatMap(s=>s.start?[s.name]:[])]);for(let s of r)s.start?t.set(s.id,s.name):t.delete(s.id);return i})},Kk=(e,t)=>{let n=t?Wk(e):[];return e.map((r,i)=>{var s;let a=Je(r,"w:pPr");return{element:r,styleId:$e(Je(a,"w:pStyle"),"w:val"),outlineLevel:dc(Je(a,"w:outlineLvl"),"w:val"),text:jk(r),bookmarks:(s=n[i])!==null&&s!==void 0?s:new Set}})},Om=e=>{var t;let n=(t=e.file)===null||t===void 0||(t=t.Styles)===null||t===void 0?void 0:t.prepForXml(e);return new Map(dt(n).filter(r=>ct(r)==="w:style"&&["paragraph",void 0].includes($e(r,"w:type"))).map(r=>[$e(r,"w:styleId"),{name:$e(Je(r,"w:name"),"w:val"),basedOn:$e(Je(r,"w:basedOn"),"w:val"),outlineLevel:dc(Je(Je(r,"w:pPr"),"w:outlineLvl"),"w:val")}]))},Rm=e=>{let t=/^\s*(\d+)\s*-\s*(\d+)\s*$/.exec(e);return t?[Number(t[1]),Number(t[2])]:void 0},Il=(e,[t,n])=>e>=t&&e<=n,pc=(e,t)=>{var n,r;if(e===void 0)return;let i=/^heading ?([1-9])$/i.exec((n=(r=t.get(e))===null||r===void 0?void 0:r.name)!==null&&n!==void 0?n:e);return i?Number(i[1]):void 0},Lm=(e,t,n=0)=>{var r;if(e===void 0||n>t.size)return;let i=t.get(e),s=pc(e,t);return(r=i?.outlineLevel)!==null&&r!==void 0?r:s===void 0?Lm(i?.basedOn,t,n+1):s-1},Gk=e=>{let t=Om(e);return n=>{let r=Je(n,"w:pPr"),i=$e(Je(r,"w:pStyle"),"w:val"),s=pc(i,t),a=Mm({styleId:i,outlineLevel:dc(Je(r,"w:outlineLvl"),"w:val")},t),o=a===void 0||a>=9?void 0:a+1;return s!==void 0&&(o===void 0||o===s)?s:o===void 0?void 0:"unclear"}},Mm=(e,t)=>{var n;return(n=e.outlineLevel)!==null&&n!==void 0?n:Lm(e.styleId,t)},zk=(e,t,n)=>{var r;let{entriesFromBookmark:i,headingStyleRange:s,stylesWithLevels:a=[],useAppliedParagraphOutlineLevel:o}=e;if(t.text.trim()===""||i&&!t.bookmarks.has(i))return;let c=[t.styleId,t.styleId===void 0||(r=n.get(t.styleId))===null||r===void 0?void 0:r.name].filter(f=>f!==void 0).map(f=>f.toLowerCase()),l=a.find(f=>c.includes(f.styleName.toLowerCase()));if(l)return l.level;let u=!!s||a.length>0||!!o||!!e.tcFieldIdentifier||!!e.tcFieldLevelRange||!!e.captionLabel||!!e.captionLabelIncludingNumbers,d=s?Rm(s):u?void 0:[1,9],p=pc(t.styleId,n);if(d&&p!==void 0&&Il(p,d))return p;let h=o?Mm(t,n):void 0;return h!==void 0&&Il(h+1,d??[1,9])?h+1:void 0},Vk=(e,t)=>{let n=t.preserveTabInEntries?e:e.replace(/\t/g," ");return(t.preserveNewLineInEntries?n.split(`
5337
+ `):[n.replace(/\n/g," ")]).map((r,i)=>new Oe({break:i>0?1:void 0,children:r.split(" ").flatMap((s,a)=>[...a>0?[new Xs]:[],...s===""?[]:[s]])}))},Xk=({text:e,separator:t})=>t==="tab"?[new Oe(e),new Oe({children:[new Xs]})]:[new Oe(`${e} `)],Yk=(e,t)=>{let n=240*(e-1)+t+240;return n<=1920?Math.ceil(n/240)*240:Math.round(n)},Jk=(e,t)=>{var n,r;return(n=(r=[...t].find(([,i])=>{var s;return((s=i.name)===null||s===void 0?void 0:s.toLowerCase())===`toc ${e}`}))===null||r===void 0?void 0:r[0])!==null&&n!==void 0?n:`TOC${e}`},Qk=({properties:e,beginDirty:t,textWidth:n,tabLeader:r},i,s,a)=>{var o;let c=e.pageNumbersEntryLevelsRange?(o=Rm(e.pageNumbersEntryLevelsRange))!==null&&o!==void 0?o:[1,9]:void 0,l=new _m;return i.forEach((u,d)=>{var p;let h=c===void 0||!Il(u.level,c),f=[...u.listNumber?Xk(u.listNumber):[],...Vk(u.title,e),...h?[new Oe({children:[e.entryAndPageNumberSeparator||new Xs]}),new B1(u.bookmark,{hyperlink:e.hyperlink})]:[]];l.addChildElement(new ne({style:Jk(u.level,s),tabStops:[...((p=u.listNumber)===null||p===void 0?void 0:p.separator)==="tab"?[{type:"left",position:Yk(u.level,u.listNumber.width)}]:[],{type:"right",position:n,leader:r}],children:[...d===0?[new qe({children:[Nm(t),new Am(e),sn()]})]:[],...e.hyperlink?[new Fm({anchor:u.bookmark,children:f})]:f]}))}),l.addChildElement(new ne({children:[new qe({children:[an()]})]})),l.prepForXml(a)},Zk=(e,t,n,r)=>{let i=dt(e),s=i.findIndex(a=>ct(a)==="w:pPr")+1;e["w:p"]=[...i.slice(0,s),new Um(t,n).prepForXml(r),...i.slice(s),new jm(n).prepForXml(r)]},e1=(e,t,n,r)=>{let i=Pm(dt(e)),s=i.flatMap(u=>{let d=cc.get(u);return d?[[u,d]]:[]});if(s.length===0)return;let a=Om(t),o=s.some(([,{properties:u}])=>!!u.entriesFromBookmark),c=Kk(i.filter(u=>ct(u)==="w:p"),o).map(u=>({paragraph:u,levels:s.map(([,{properties:d}])=>zk(d,u,a))})).filter(({levels:u})=>u.some(d=>d!==void 0)).map((u,d)=>k(k({},u),{},{id:n.get(d)}));for(let{paragraph:u,id:d}of c)Zk(u.element,`_Toc${d}`,d,t);let l=c.length>0?r?.(e):void 0;s.forEach(([u,d],p)=>{let h=c.flatMap(({paragraph:f,levels:m,id:g})=>{let y=m[p],T=l?.get(`_Toc${g}`);return y===void 0?[]:[k({title:f.text,level:y,bookmark:`_Toc${g}`},T?{listNumber:T}:{})]});h.length!==0&&(u["w:sdt"]=dt(u).map(f=>ct(f)==="w:sdtContent"?Qk(d,h,a,t):f))})},t1=new RegExp("^\\p{L}[\\p{L}\\p{N}_]*$","u"),n1=e=>{var t,n;let r,i=!1,s,a=!1,o=!1;for(let d=0;d<e.length;d++){var c,l;let p=e[d],h=(c=e[d+1])!==null&&c!==void 0?c:"",f;if(d===0&&!p.startsWith("\\"))f={type:"bookmark"};else if(p==="\\c"||p==="\\n")f={type:p==="\\c"?"repeat":"next"};else if((p==="\\r"||p==="\\s")&&/^\d+$/.test(h))d++,f=p==="\\r"?{type:"reset",to:Number(h)}:{type:"heading",level:Number(h)};else if(p==="\\h")i=!0;else if(p==="\\#"&&d+1<e.length)d++,o=!0;else if(p==="\\*"&&d+1<e.length){let m=e[++d];if(km.has(m.toLowerCase()))a=!0;else if(!xm.has(m.toLowerCase())){if(s!==void 0)return;s=m}}else return;if(f&&r)return;r=(l=f)!==null&&l!==void 0?l:r}if(r?.type==="bookmark"&&e.length>1)return;let u=!o&&!(a&&s!==void 0&&s.toLowerCase()!=="arabic");return{step:(t=r)!==null&&t!==void 0?t:{type:"next"},hidden:i&&s===void 0,format:u?(n=s)!==null&&n!==void 0?n:"ARABIC":""}},uc=e=>{var t;let n=new RegExp("^\\s*SEQ\\b(.*)$","is").exec(e);if(!n)return;let[r,...i]=(t=n[1].match(/"[^"]*"|\S+/g))!==null&&t!==void 0?t:[];if(r===void 0)return{};let s=r.replace(/^"(.*)"$/,"$1");return t1.test(s)?{identifier:s,sequence:n1(i)}:{identifier:s}},r1=e=>uc(e)!==void 0,Ol=e=>typeof e!="object"||e===null?[]:Array.isArray(e)?e.flatMap(Ol):Object.entries(e).flatMap(([t,n])=>[...(t==="w:instrText"&&Array.isArray(n)?n:t==="_attr"?[n["w:instr"]]:[]).flatMap(r=>{let i=typeof r=="string"?uc(r):void 0;return i?.identifier===void 0?[]:[i.identifier.toLowerCase()]}),...Ol(n)]),i1=e=>{var t;let n=(t=e.file)===null||t===void 0?void 0:t.Comments;if(!n)return new Set;let r={View:n,Relationships:n.Relationships};return new Set(Ol(n.prepForXml(k(k({},e),{},{viewWrapper:r,stack:[]}))))},s1=e=>{let t=Gk(e),n=new Map,r=new Map,i=[],s=-1,a=-1,o,c=(l,u)=>{var d;let p=Math.max(-1,...i.slice(1,u+1).filter(m=>m!==void 0)),h=((d=r.get(l))!==null&&d!==void 0?d:[]).filter(m=>m.paragraph>=p),f=h.every(({step:m})=>m?.type==="next"||m?.type==="heading"&&m.level===u);return s>p||!f?void 0:h.length+1};return{startParagraph:l=>{a++;let u=t(l);u==="unclear"?s=a:u!==void 0&&(i[u]=a)},numberOf:(l,u)=>{var d,p,h;let{identifier:f,sequence:m}=uc(l);if(f===void 0||u==="fallback")return;(d=o)!==null&&d!==void 0||(o=i1(e));let g=f.toLowerCase();if(m?.step.type==="bookmark"&&u==="counted"&&!o.has(g))return;let y=n.has(g)?n.get(g):0,T=o.has(g)||u==="deleted"?void 0:m?.step,b=T?.type==="reset"?T.to:T?.type==="repeat"?y:T?.type==="heading"?c(g,T.level):T?.type==="next"&&y!==void 0?y+1:void 0;return n.set(g,b),r.set(g,[...(p=r.get(g))!==null&&p!==void 0?p:[],k({paragraph:a},b===void 0?{}:{step:T})]),b===void 0||m===void 0?void 0:m.hidden?"":(h=lc(m.format))===null||h===void 0?void 0:h(b)}}},sl=e=>{let t=typeof e=="object"&&e!==null&&!Array.isArray(e)?Object.keys(e)[0]:void 0;return t==="_attr"?void 0:t},th=e=>({"w:t":[{_attr:{"xml:space":"preserve"}},e]}),Vs={nameOf:sl,contentOf:e=>{let t=e[sl(e)];return Array.isArray(t)?t:void 0},attributeOf:(e,t)=>{var n;let r=e[sl(e)],i=Array.isArray(r)?r.find(s=>typeof s=="object"&&s!==null&&"_attr"in s):r;return i==null||(n=i._attr)===null||n===void 0?void 0:n[t]},textOf:e=>Vs.contentOf(e).filter(t=>typeof t=="string").join(""),textElement:th,writeClean:e=>{if($x(e)){let t=e["w:fldChar"]._attr;e["w:fldChar"]={_attr:Object.fromEntries(Object.entries(t).filter(([n])=>n!=="w:dirty"))}}},setSimpleFieldResult:(e,t)=>{let n=e["w:fldSimple"];e["w:fldSimple"]=[...(Array.isArray(n)?n:[n]).filter(r=>typeof r=="object"&&r!==null&&"_attr"in r),{"w:r":[th(t)]}]}},Dm=new WeakMap,a1=(e,t)=>{let{startParagraph:n,numberOf:r}=s1(t);Bk(Vs,e,{beforeParagraph:i=>n(i),resultOf:(i,s)=>r1(i)?r(i,s):void 0})},o1=(e,t,n)=>{let r=n(e,t),i=Cm(Vs,e,r,{blank:!1});t.file&&Dm.set(t.file,{estimate:r,partPageCounts:i})},zr=(e,t,n)=>{let r=t.file&&Dm.get(t.file);if(!e||!r)return;let i=n===void 0?void 0:r.partPageCounts.get(`rId${n}`),s="w:footnotes"in e||"w:endnotes"in e;Em(Vs,e,r.estimate,{blank:!1,sectionPageCount:i,notes:s})},l1=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{xmlns:"xmlns"})}},be=class Bm extends P{constructor(){super("Relationships"),this.root.push(new l1({xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}))}addRelationship(t,n,r,i){this.root.push(xk(`rId${t}`,n,r,i))}static copy(t){let n=new Bm;return n.root.push(...t.root.slice(1)),n}get RelationshipCount(){return this.root.length-1}},c1=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{id:"w:id",initials:"w:initials",author:"w:author",date:"w:date"})}},d1=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:cx":"xmlns:cx","xmlns:cx1":"xmlns:cx1","xmlns:cx2":"xmlns:cx2","xmlns:cx3":"xmlns:cx3","xmlns:cx4":"xmlns:cx4","xmlns:cx5":"xmlns:cx5","xmlns:cx6":"xmlns:cx6","xmlns:cx7":"xmlns:cx7","xmlns:cx8":"xmlns:cx8","xmlns:mc":"xmlns:mc","xmlns:aink":"xmlns:aink","xmlns:am3d":"xmlns:am3d","xmlns:o":"xmlns:o","xmlns:r":"xmlns:r","xmlns:m":"xmlns:m","xmlns:v":"xmlns:v","xmlns:wp14":"xmlns:wp14","xmlns:wp":"xmlns:wp","xmlns:w10":"xmlns:w10","xmlns:w":"xmlns:w","xmlns:w14":"xmlns:w14","xmlns:w15":"xmlns:w15","xmlns:w16cex":"xmlns:w16cex","xmlns:w16cid":"xmlns:w16cid","xmlns:w16":"xmlns:w16","xmlns:w16sdtdh":"xmlns:w16sdtdh","xmlns:w16se":"xmlns:w16se","xmlns:wpg":"xmlns:wpg","xmlns:wpi":"xmlns:wpi","xmlns:wne":"xmlns:wne","xmlns:wps":"xmlns:wps","mc:Ignorable":"mc:Ignorable"})}},nh=class extends P{constructor({id:e,initials:t,author:n,date:r=new Date,children:i},s){super("w:comment"),E(this,"paraId",void 0),this.paraId=s,this.root.push(new c1({id:e,initials:t,author:n,date:r.toISOString()}));for(let a of i)this.root.push(a)}prepForXml(e){let t=super.prepForXml(e);if(!t||!this.paraId)return t;let n=t["w:comment"];if(!Array.isArray(n))return t;for(let r=n.length-1;r>=0;r--){let i=n[r];if(i&&typeof i=="object"&&"w:p"in i){let s=i["w:p"];Array.isArray(s)&&s.unshift({_attr:{"w14:paraId":this.paraId,"w14:textId":this.paraId}});break}}return t}},p1=e=>(e+1).toString(16).toUpperCase().padStart(8,"0"),u1=class extends P{constructor({children:e}){super("w:comments"),E(this,"relationships",void 0),E(this,"threadData",void 0),E(this,"commentIdsData",void 0),E(this,"isEmpty",void 0),this.isEmpty=e.length===0,this.root.push(new d1({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 wp14"}));let t=e.some(r=>r.parentId!==void 0),n=e.some(r=>r.durableId!==void 0);if(t||n){let r=new Map(e.map(i=>[i.id,p1(i.id)]));for(let i of e)this.root.push(new nh(i,r.get(i.id)));t&&(this.threadData=e.map(i=>({paraId:r.get(i.id),parentParaId:i.parentId!==void 0?r.get(i.parentId):void 0,done:i.resolved}))),n&&(this.commentIdsData=e.map(i=>{var s;return{paraId:r.get(i.id),durableId:(s=i.durableId)!==null&&s!==void 0?s:r.get(i.id)}}))}else for(let r of e)this.root.push(new nh(r));this.relationships=new be}get Relationships(){return this.relationships}get ThreadData(){return this.threadData}get CommentIdsData(){return this.commentIdsData}get IsEmpty(){return this.isEmpty}prepForXml(e){let t=super.prepForXml(e);return zr(t,e),t}},h1=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:mc":"xmlns:mc","xmlns:w15":"xmlns:w15","mc:Ignorable":"mc:Ignorable"})}},m1=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{paraId:"w15:paraId",paraIdParent:"w15:paraIdParent",done:"w15:done"})}},f1=class extends P{constructor(e){super("w15:commentEx"),this.root.push(new m1({paraId:e.paraId,paraIdParent:e.parentParaId,done:e.done!==void 0?e.done?"1":"0":void 0}))}},g1=class extends P{constructor(e){super("w15:commentsEx"),this.root.push(new h1({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","mc:Ignorable":"w15"}));for(let t of e)this.root.push(new f1(t))}},b1=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{paraId:"w16cid:paraId",durableId:"w16cid:durableId"})}},v1=class extends P{constructor(e){super("w16cid:commentId"),this.root.push(new b1({paraId:e.paraId,durableId:e.durableId}))}},w1=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{"xmlns:w16cid":"xmlns:w16cid","xmlns:mc":"xmlns:mc","mc:Ignorable":"mc:Ignorable"})}},y1=class extends P{constructor(e){super("w16cid:commentsIds"),this.root.push(new w1({"xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","mc:Ignorable":"w16cid"}));for(let t of e)this.root.push(new v1(t))}},x1=class extends cm{constructor(){super("w:endnoteRef")}},Xs=class extends cm{constructor(){super("w:tab")}},k1={COLUMN:"column",PAGE:"page"},T1=class extends P{constructor(e){super("w:br"),this.root.push(new _e({type:e}))}},$m=class extends qe{constructor(){super({}),this.root.push(new T1(k1.PAGE))}},S1=class extends P{constructor(){super("w:pageBreakBefore")}},Mn={AT_LEAST:"atLeast",EXACTLY:"exactly",EXACT:"exact",AUTO:"auto"},C1=({after:e,before:t,line:n,lineRule:r,beforeAutoSpacing:i,afterAutoSpacing:s})=>new L({name:"w:spacing",attributes:{after:{key:"w:after",value:e},before:{key:"w:before",value:t},line:{key:"w:line",value:n},lineRule:{key:"w:lineRule",value:r},beforeAutoSpacing:{key:"w:beforeAutospacing",value:i},afterAutoSpacing:{key:"w:afterAutospacing",value:s}}}),Ys={HEADING_1:"Heading1",HEADING_2:"Heading2",HEADING_3:"Heading3",HEADING_4:"Heading4",HEADING_5:"Heading5",HEADING_6:"Heading6",TITLE:"Title"},Nr=e=>new L({name:"w:pStyle",attributes:{val:{key:"w:val",value:e}}}),rh={LEFT:"left",RIGHT:"right",CENTER:"center",BAR:"bar",CLEAR:"clear",DECIMAL:"decimal",END:"end",NUM:"num",START:"start"},E1={DOT:"dot",HYPHEN:"hyphen",MIDDLE_DOT:"middleDot",NONE:"none",UNDERSCORE:"underscore"},A1=({type:e,position:t,leader:n})=>new L({name:"w:tab",attributes:{val:{key:"w:val",value:e},pos:{key:"w:pos",value:at(t)},leader:{key:"w:leader",value:n}}}),_1=e=>new L({name:"w:tabs",children:e.map(t=>A1(t))}),Ts=class extends P{constructor(e,t){super("w:numPr"),this.root.push(new N1(t)),this.root.push(new P1(e))}},N1=class extends P{constructor(e){if(super("w:ilvl"),e>9)throw new Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new _e({val:e}))}},P1=class extends P{constructor(e){super("w:numId"),this.root.push(new _e({val:typeof e=="string"?`{${e}}`:e}))}},hc=class extends P{constructor(...e){super(...e),E(this,"fileChild",Symbol())}},I1=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{id:"r:id",history:"w:history",anchor:"w:anchor"})}},mc=class extends P{constructor(e,t,n,r){super("w:hyperlink"),E(this,"linkId",void 0),E(this,"drawingLink",void 0),this.linkId=t,this.drawingLink=n&&r!==void 0?new kk(r):void 0;let i=new I1({history:1,anchor:n||void 0,id:!n||r!==void 0?`rId${this.linkId}`:void 0});this.root.push(i),e.forEach(s=>{this.root.push(s)})}createDrawingClick(e,t){return this.drawingLink?(this.drawingLink.addRelationship(e),this.drawingLink.createClick(t)):ym(this.linkId,t)}},Fm=class extends mc{constructor(e){super(e.children,$n(),e.anchor)}},O1=class extends P{constructor(e){super("w:externalHyperlink"),E(this,"options",void 0),this.options=e}},R1=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{id:"w:id",name:"w:name"})}},L1=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{id:"w:id"})}},qm=class Hm{constructor(t){E(this,"start",void 0),E(this,"children",void 0),E(this,"end",void 0);let n=gm();this.start=new Um(t.id,n),this.children=t.children,this.end=new jm(n)}get writtenAs(){return[this.start,...this.children.flatMap(t=>t instanceof Hm?t.writtenAs:[t]),this.end]}},Um=class extends P{constructor(e,t){super("w:bookmarkStart");let n=new R1({name:e,id:t});this.root.push(n)}},jm=class extends P{constructor(e){super("w:bookmarkEnd");let t=new L1({id:e});this.root.push(t)}},M1=e=>new L({name:"w:outlineLvl",attributes:{val:{key:"w:val",value:e}}}),D1=class extends P{constructor(e,t={}){super("w:instrText"),this.root.push(new Ut({space:Ht.PRESERVE}));let n=`PAGEREF ${e}`;t.hyperlink&&(n=`${n} \\h`),t.useRelativePosition&&(n=`${n} \\p`),this.root.push(n)}},B1=class extends qe{constructor(e,t={}){super({children:[fm(),new D1(e,t),sn(),an()]})}},$1=255,Wm=e=>{let t=e.indexOf("#"),n=e.length-t-1;return t>0&&n>0&&n<=$1?{target:e.slice(0,t),anchor:e.slice(t+1)}:{target:e}},Bs=(e,t,n)=>n===void 0?`${e}-${t}`:`${e}-restart ${n}`,Ss=({id:e,fontKey:t,subsetted:n},r)=>new L({name:r,attributes:k({id:{key:"r:id",value:e}},t?{fontKey:{key:"w:fontKey",value:`{${t.toUpperCase()}}`}}:{}),children:[...n?[new I("w:subsetted",n)]:[]]}),F1=({name:e,altName:t,panose1:n,charset:r,family:i,notTrueType:s,pitch:a,sig:o,embedRegular:c,embedBold:l,embedItalic:u,embedBoldItalic:d})=>new L({name:"w:font",attributes:{name:{key:"w:name",value:e}},children:[...t?[kr("w:altName",t)]:[],...n?[kr("w:panose1",n)]:[],...r?[kr("w:charset",r)]:[],...i?[kr("w:family",i)]:[],...s?[new I("w:notTrueType",s)]:[],...a?[kr("w:pitch",a)]:[],...o?[new L({name:"w:sig",attributes:{usb0:{key:"w:usb0",value:o.usb0},usb1:{key:"w:usb1",value:o.usb1},usb2:{key:"w:usb2",value:o.usb2},usb3:{key:"w:usb3",value:o.usb3},csb0:{key:"w:csb0",value:o.csb0},csb1:{key:"w:csb1",value:o.csb1}}})]:[],...c?[Ss(c,"w:embedRegular")]:[],...l?[Ss(l,"w:embedBold")]:[],...u?[Ss(u,"w:embedItalic")]:[],...d?[Ss(d,"w:embedBoldItalic")]:[]]}),q1=({name:e,characterSet:t,embedRegular:n,embedBold:r,embedItalic:i,embedBoldItalic:s})=>F1({name:e,sig:{usb0:"E0002AFF",usb1:"C000247B",usb2:"00000009",usb3:"00000000",csb0:"000001FF",csb1:"00000000"},charset:t,family:"auto",pitch:"variable",embedRegular:n,embedBold:r,embedItalic:i,embedBoldItalic:s}),H1=e=>new L({name:"w:fonts",attributes:{mc:{key:"xmlns:mc",value:"http://schemas.openxmlformats.org/markup-compatibility/2006"},r:{key:"xmlns:r",value:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"},w:{key:"xmlns:w",value:"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},w14:{key:"xmlns:w14",value:"http://schemas.microsoft.com/office/word/2010/wordml"},w15:{key:"xmlns:w15",value:"http://schemas.microsoft.com/office/word/2012/wordml"},w16cex:{key:"xmlns:w16cex",value:"http://schemas.microsoft.com/office/word/2018/wordml/cex"},w16cid:{key:"xmlns:w16cid",value:"http://schemas.microsoft.com/office/word/2016/wordml/cid"},w16:{key:"xmlns:w16",value:"http://schemas.microsoft.com/office/word/2018/wordml"},w16sdtdh:{key:"xmlns:w16sdtdh",value:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash"},w16se:{key:"xmlns:w16se",value:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ignorable:{key:"mc:Ignorable",value:"w14 w15 w16se w16cid w16 w16cex w16sdtdh"}},children:e.map(q1)}),U1=[{option:"data",element:"embedRegular",bold:!1,italic:!1},{option:"bold",element:"embedBold",bold:!0,italic:!1},{option:"italic",element:"embedItalic",bold:!1,italic:!0},{option:"boldItalic",element:"embedBoldItalic",bold:!0,italic:!0}],Km=class{constructor(e){E(this,"options",void 0),E(this,"fontTable",void 0),E(this,"relationships",void 0),E(this,"fontOptionsWithKey",[]),E(this,"files",[]),this.options=e;let t=e.map(n=>U1.flatMap(({option:r,element:i,bold:s,italic:a})=>{let o=n[r];return o?[{element:i,file:{name:n.name,data:o,bold:s,italic:a,fontKey:bm()}}]:[]}));this.files=t.flatMap(n=>n.map(({file:r})=>r)),this.fontOptionsWithKey=e.map((n,r)=>k(k({},n),{},{fontKey:t[r][0].file.fontKey})),this.fontTable=H1(e.map((n,r)=>k({name:n.name,characterSet:n.characterSet},Object.fromEntries(t[r].map(({element:i,file:s})=>[i,{id:`rId${this.files.indexOf(s)+1}`,fontKey:s.fontKey}]))))),this.relationships=new be;for(let n=0;n<this.files.length;n++)this.relationships.addRelationship(n+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",`fonts/font${n+1}.odttf`)}get View(){return this.fontTable}get Relationships(){return this.relationships}},j1=()=>new L({name:"w:wordWrap",attributes:{val:{key:"w:val",value:0}}}),W1=e=>{var t,n;return new L({name:"w:framePr",attributes:{anchorLock:{key:"w:anchorLock",value:e.anchorLock},dropCap:{key:"w:dropCap",value:e.dropCap},width:{key:"w:w",value:e.width},height:{key:"w:h",value:e.height},x:{key:"w:x",value:e.position?e.position.x:void 0},y:{key:"w:y",value:e.position?e.position.y:void 0},anchorHorizontal:{key:"w:hAnchor",value:e.anchor.horizontal},anchorVertical:{key:"w:vAnchor",value:e.anchor.vertical},spaceHorizontal:{key:"w:hSpace",value:(t=e.space)===null||t===void 0?void 0:t.horizontal},spaceVertical:{key:"w:vSpace",value:(n=e.space)===null||n===void 0?void 0:n.vertical},rule:{key:"w:hRule",value:e.rule},alignmentX:{key:"w:xAlign",value:e.alignment?e.alignment.x:void 0},alignmentY:{key:"w:yAlign",value:e.alignment?e.alignment.y:void 0},lines:{key:"w:lines",value:e.lines},wrap:{key:"w:wrap",value:e.wrap}}})},al=new WeakMap,K1=Bn(),G1={left:"right",right:"left"},Dn=class extends St{constructor(e,{implicitListParagraphStyle:t=!0,inListOrder:n=!0}={}){if(super("w:pPr",e?.includeIfEmpty),E(this,"numbering",void 0),E(this,"numberProperties",void 0),!e)return this;if(e.heading&&this.push(Nr(e.heading)),t&&(e.bullet&&this.push(Nr("ListParagraph")),e.numbering&&!e.numbering.custom&&!e.style&&!e.heading&&this.push(Nr("ListParagraph"))),e.style&&this.push(Nr(e.style)),e.keepNext!==void 0&&this.push(new I("w:keepNext",e.keepNext)),e.keepLines!==void 0&&this.push(new I("w:keepLines",e.keepLines)),e.pageBreakBefore&&this.push(new S1),e.frame&&this.push(W1(e.frame)),e.widowControl!==void 0&&this.push(new I("w:widowControl",e.widowControl)),e.bullet&&this.push(new Ts(1,e.bullet.level)),e.numbering){let{reference:i,instance:s,level:a,restart:o}=e.numbering,c=typeof i=="string"?i:i.reference,l=new Ts(Bs(c,s??0),a);this.numbering={reference:c,level:a,instance:s,restartedListId:o&&n&&s===void 0?K1():void 0,definition:typeof i=="string"?void 0:i},this.numberProperties=l,this.push(l)}else e.numbering===!1&&this.push(new Ts(0,0));e.border&&this.push(new Rx(e.border)),e.thematicBreak&&this.push(new Lx),e.shading&&this.push(zs(e.shading)),e.wordWrap&&this.push(j1()),e.overflowPunctuation&&this.push(new I("w:overflowPunct",e.overflowPunctuation));let r=[...e.rightTabStop!==void 0?[{type:rh.RIGHT,position:e.rightTabStop}]:[],...e.tabStops?e.tabStops:[],...e.leftTabStop!==void 0?[{type:rh.LEFT,position:e.leftTabStop}]:[]];r.length>0&&this.push(_1(r)),e.bidirectional!==void 0&&this.push(new I("w:bidi",e.bidirectional)),e.spacing&&this.push(C1(e.spacing)),e.indent&&this.push(Mx(e.indent)),e.contextualSpacing!==void 0&&this.push(new I("w:contextualSpacing",e.contextualSpacing)),e.alignment&&this.push(dm(e.bidirectional&&G1[e.alignment]||e.alignment)),e.outlineLevel!==void 0&&this.push(M1(e.outlineLevel)),e.suppressLineNumbers!==void 0&&this.push(new I("w:suppressLineNumbers",e.suppressLineNumbers)),e.autoSpaceEastAsianText!==void 0&&this.push(new I("w:autoSpaceDN",e.autoSpaceEastAsianText)),e.run&&this.push(new vk(e.run)),e.revision&&this.push(new ih(e.revision))}push(e){this.root.push(e)}addSectionProperties(e){let t=this.root.findIndex(n=>n instanceof ih);if(t===-1){this.root.push(e);return}this.root.splice(t,0,e)}removeSectionProperties(e){let t=this.root.indexOf(e);t!==-1&&this.root.splice(t,1)}prepForXml(e){var t;if(this.numbering){var n,r;let{reference:a,level:o,instance:c=0,definition:l}=this.numbering,u=this.numbering.instance===void 0?(n=this.numbering.restartedListId)!==null&&n!==void 0?n:(r=al.get(e))===null||r===void 0?void 0:r.get(a):void 0;e.viewWrapper instanceof Km||e.file.Numbering.createConcreteNumberingInstance(a,c,l,u);let d=new Ts(Bs(a,c,u),o);this.root.splice(this.root.indexOf(this.numberProperties),1,d),this.numberProperties=d}let i=super.prepForXml(e);if(((t=this.numbering)===null||t===void 0?void 0:t.restartedListId)!==void 0){var s;al.set(e,new Map([...(s=al.get(e))!==null&&s!==void 0?s:[],[this.numbering.reference,this.numbering.restartedListId]]))}return i}},ih=class extends P{constructor(e){super("w:pPrChange"),this.root.push(new He({id:e.id,author:e.author,date:e.date})),this.root.push(new Dn(k(k({},e),{},{includeIfEmpty:!0}),{inListOrder:!1}))}},ne=class Gm extends hc{constructor(t){if(super("w:p"),E(this,"options",void 0),E(this,"properties",void 0),E(this,"alignment",void 0),this.options=typeof t=="string"?{text:t}:t,typeof t=="string")return this.alignment={},this.properties=new Dn({}),this.root.push(this.properties),this.root.push(new Oe(t)),this;if(this.alignment={alignment:t.alignment,bidirectional:t.bidirectional},this.properties=new Dn(t),this.root.push(this.properties),t.text&&this.root.push(new Oe(t.text)),t.children)for(let n of t.children){if(n instanceof qm){this.root.push(...n.writtenAs);continue}this.root.push(n)}}prepForXml(t){for(let n of this.root)if(Ws(n)==="w:externalHyperlink"){let r=this.root.indexOf(n),{options:i}=n,{target:s,anchor:a}=Wm(i.link),o=new mc(i.children,$n(),a,i.link);t.viewWrapper.Relationships.addRelationship(o.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",s,oc.EXTERNAL),this.root[r]=o}return super.prepForXml(t)}addSectionProperties(t){this.properties.addSectionProperties(t)}removeSectionProperties(t){this.properties.removeSectionProperties(t)}get Alignment(){return this.alignment}with(t){return new Gm(k(k({},this.options),t))}addRunToFront(t){return this.root.splice(1,0,t),this}},z1={TOP:"top",CENTER:"center",BOTTOM:"bottom"},ZP=k(k({},z1),{},{BOTH:"both"}),zm=e=>new L({name:"w:vAlign",attributes:{verticalAlign:{key:"w:val",value:e}}}),V1=({space:e,count:t,separate:n,equalWidth:r,children:i})=>new L({name:"w:cols",attributes:{space:{key:"w:space",value:e===void 0?void 0:ve(e)},count:{key:"w:num",value:t===void 0?void 0:le(t)},separate:{key:"w:sep",value:n},equalWidth:{key:"w:equalWidth",value:r}},children:!r&&i?i:void 0}),X1=({type:e,linePitch:t,charSpace:n})=>new L({name:"w:docGrid",attributes:{type:{key:"w:type",value:e},linePitch:{key:"w:linePitch",value:le(t)},charSpace:{key:"w:charSpace",value:n?le(n):void 0}}}),Ln={DEFAULT:"default",FIRST:"first",EVEN:"even"},sh={HEADER:"w:headerReference",FOOTER:"w:footerReference"},ol=(e,t)=>new L({name:e,attributes:{type:{key:"w:type",value:t.type||Ln.DEFAULT},id:{key:"r:id",value:`rId${t.id}`}}}),Y1=({countBy:e,start:t,restart:n,distance:r})=>new L({name:"w:lnNumType",attributes:{countBy:{key:"w:countBy",value:e===void 0?void 0:le(e)},start:{key:"w:start",value:t===void 0?void 0:le(t)},restart:{key:"w:restart",value:n},distance:{key:"w:distance",value:r===void 0?void 0:ve(r)}}}),Vm=({name:e,position:t,numberFormat:n,start:r,restart:i})=>new L({name:e,children:[...t===void 0?[]:[new L({name:"w:pos",attributes:{val:{key:"w:val",value:t}}})],...n?[new L({name:"w:numFmt",attributes:{val:{key:"w:val",value:n.type},format:{key:"w:format",value:n.format}}})]:[],...r===void 0?[]:[new L({name:"w:numStart",attributes:{val:{key:"w:val",value:le(r)}}})],...i===void 0?[]:[new L({name:"w:numRestart",attributes:{val:{key:"w:val",value:i}}})]]}),J1=e=>Vm(k({name:"w:footnotePr"},e)),Q1=e=>Vm(k({name:"w:endnotePr"},e)),ah=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{display:"w:display",offsetFrom:"w:offsetFrom",zOrder:"w:zOrder"})}},Z1=class extends St{constructor(e){if(super("w:pgBorders"),!e)return this;e.pageBorders?this.root.push(new ah({display:e.pageBorders.display,offsetFrom:e.pageBorders.offsetFrom,zOrder:e.pageBorders.zOrder})):this.root.push(new ah({})),e.pageBorderTop&&this.root.push(he("w:top",e.pageBorderTop)),e.pageBorderLeft&&this.root.push(he("w:left",e.pageBorderLeft)),e.pageBorderBottom&&this.root.push(he("w:bottom",e.pageBorderBottom)),e.pageBorderRight&&this.root.push(he("w:right",e.pageBorderRight))}},eT=(e,t,n,r,i,s,a)=>new L({name:"w:pgMar",attributes:{top:{key:"w:top",value:at(e)},right:{key:"w:right",value:ve(t)},bottom:{key:"w:bottom",value:at(n)},left:{key:"w:left",value:ve(r)},header:{key:"w:header",value:ve(i)},footer:{key:"w:footer",value:ve(s)},gutter:{key:"w:gutter",value:ve(a)}}}),tT={HYPHEN:"hyphen",PERIOD:"period",COLON:"colon",EM_DASH:"emDash",EN_DASH:"endash"},nT=({start:e,formatType:t,separator:n,chapterHeadingLevel:r})=>new L({name:"w:pgNumType",attributes:{start:{key:"w:start",value:e===void 0?void 0:le(e)},formatType:{key:"w:fmt",value:t},separator:{key:"w:chapSep",value:n===tT.EN_DASH?"enDash":n},chapterHeadingLevel:{key:"w:chapStyle",value:r===void 0?void 0:le(r)}}}),$s={PORTRAIT:"portrait",LANDSCAPE:"landscape"},rT=({width:e,height:t,orientation:n,code:r})=>{let i=ve(e),s=ve(t);return new L({name:"w:pgSz",attributes:{width:{key:"w:w",value:n===$s.LANDSCAPE?s:i},height:{key:"w:h",value:n===$s.LANDSCAPE?i:s},orientation:{key:"w:orient",value:n},code:{key:"w:code",value:r}}})},iT=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{val:"w:val"})}},sT=class extends P{constructor(e){super("w:textDirection"),this.root.push(new iT({val:e}))}},aT=e=>new L({name:"w:type",attributes:{val:{key:"w:val",value:e}}}),it={TOP:1440,RIGHT:1440,BOTTOM:1440,LEFT:1440,HEADER:708,FOOTER:708,GUTTER:0},Ns={WIDTH:11906,HEIGHT:16838,ORIENTATION:$s.PORTRAIT},Rl=class Xm extends P{constructor({page:{size:{width:t=Ns.WIDTH,height:n=Ns.HEIGHT,orientation:r=Ns.ORIENTATION,code:i}={},margin:{top:s=it.TOP,right:a=it.RIGHT,bottom:o=it.BOTTOM,left:c=it.LEFT,header:l=it.HEADER,footer:u=it.FOOTER,gutter:d=it.GUTTER}={},pageNumbers:p={},borders:h,textDirection:f}={},grid:{linePitch:m=360,charSpace:g,type:y}={},headerWrapperGroup:T={},footerWrapperGroup:b={},lineNumbers:C,titlePage:_,verticalAlign:w,column:x,type:v,footnoteProperties:A,endnoteProperties:N,revision:M}={}){super("w:sectPr"),E(this,"availableTextWidth",void 0),this.availableTextWidth=Xm.calculateAvailableTextWidth({pageWidth:r===$s.LANDSCAPE?n:t,left:c,right:a,gutter:d,column:x}),this.addHeaderFooterGroup(sh.HEADER,T),this.addHeaderFooterGroup(sh.FOOTER,b),A&&this.root.push(J1(A)),N&&this.root.push(Q1(N)),v&&this.root.push(aT(v)),this.root.push(rT({width:t,height:n,orientation:r,code:i})),this.root.push(eT(s,a,o,c,l,u,d)),h&&this.root.push(new Z1(h)),C&&this.root.push(Y1(C)),this.root.push(nT(p)),x&&this.root.push(V1(x)),w&&this.root.push(zm(w)),_!==void 0&&this.root.push(new I("w:titlePg",_)),f&&this.root.push(new sT(f)),this.root.push(X1({linePitch:m,charSpace:g,type:y})),M&&this.root.push(new oT(M))}get AvailableTextWidth(){return this.availableTextWidth}static calculateAvailableTextWidth({pageWidth:t,left:n,right:r,gutter:i,column:s}){var a,o;let c=qt(t)-qt(n)-qt(r)-qt(i),l=(a=s?.count)!==null&&a!==void 0?a:1;return l<=1?c:(c-qt((o=s?.space)!==null&&o!==void 0?o:720)*(l-1))/l}addHeaderFooterGroup(t,n){n.default&&this.root.push(ol(t,{type:Ln.DEFAULT,id:n.default.View.ReferenceId})),n.first&&this.root.push(ol(t,{type:Ln.FIRST,id:n.first.View.ReferenceId})),n.even&&this.root.push(ol(t,{type:Ln.EVEN,id:n.even.View.ReferenceId}))}},oT=class extends P{constructor(e){super("w:sectPrChange"),this.root.push(new He({id:e.id,author:e.author,date:e.date})),this.root.push(new Rl(e))}},Ym=class extends P{constructor({pageNumbers:e}={}){super("w:body"),E(this,"sections",[]),E(this,"sectionParagraphs",new Map),E(this,"headingBookmarkIds",new Fk),E(this,"pageNumbers",void 0),this.pageNumbers=e}getSectionPropertiesFor(e){let t=e?Math.max(this.root.indexOf(e),0):0;for(let n=t;n<this.root.length;n++){let r=this.root[n];if(r instanceof Rl)return r;let i=this.sectionParagraphs.get(r);if(i)return i}return this.sections[this.sections.length-1]}addSection(e){let t=this.sections.pop(),n=this.lastParagraphOfSection();if(t&&n)this.sectionParagraphs.set(n,t);else{let r=this.createSectionParagraph();this.root.push(r),t&&this.sectionParagraphs.set(r,t)}this.sections.push(new Rl(e))}prepForXml(e){var t;this.sections.length===1&&(this.root.splice(0,1),this.root.push(this.sections.pop()));for(let[i,s]of this.sectionParagraphs)i.addSectionProperties(s);let n;try{n=super.prepForXml(e)}finally{for(let[i,s]of this.sectionParagraphs)i.removeSectionProperties(s)}let r=(t=this.pageNumbers)===null||t===void 0?void 0:t.listNumbers;return e1(n,e,this.headingBookmarkIds,r&&(i=>r(i,e))),this.pageNumbers&&(a1(n,e),o1(n,e,this.pageNumbers)),n}push(e){let t=e instanceof ne?this.sectionParagraphs.get(e):void 0;if(t){let n=this.createSectionParagraph();this.root.splice(this.root.indexOf(e)+1,0,n),this.sectionParagraphs.delete(e),this.sectionParagraphs.set(n,t)}this.root.push(e)}lastParagraphOfSection(){let e=this.root[this.root.length-1];return e instanceof ne&&e!==this.root[0]&&!this.sectionParagraphs.has(e)&&this.root.indexOf(e)===this.root.length-1?e:void 0}createSectionParagraph(){return new ne({})}},Fe={AUTO:"auto",DXA:"dxa",NIL:"nil",PERCENTAGE:"pct"},$r=(e,{type:t=Fe.AUTO,size:n})=>{let r=n;return t===Fe.PERCENTAGE&&typeof n=="number"&&(r=Math.round(n*50)),new L({name:e,attributes:{type:{key:"w:type",value:t},size:{key:"w:w",value:lm(r)}}})},Ps=Ns.WIDTH-it.LEFT-it.RIGHT-it.GUTTER,Jm=e=>e.options.columnSpan||1,fc=(e,t)=>{if(!e)return;let{type:n=Fe.AUTO,size:r}=e;if(n!==Fe.PERCENTAGE&&n!==Fe.DXA)return;let i=typeof r=="number"?n===Fe.PERCENTAGE?r/100*t:r:r.endsWith("%")?Number(r.slice(0,-1))/100*t:qt(r);return i>0?i:void 0},lT=(e,t)=>{var n;return(n=fc(e,t))!==null&&n!==void 0?n:t},cT=e=>Math.max(0,...e.map(t=>t.cells.reduce((n,r)=>n+Jm(r),0))),oh=({rows:e,width:t,availableWidth:n})=>{let r=cT(e);if(r===0)return[];let i=lT(t,n),s=Array.from({length:r},()=>{}),a=[];for(let u of e){let d=0;for(let p of u.cells){let h=Jm(p),f=fc(p.options.width,i);if(f!==void 0)if(h===1){var o,c;(c=s[o=d])!==null&&c!==void 0||(s[o]=f)}else a.push({start:d,span:h,width:f});d+=h}}for(let{start:u,span:d,width:p}of a){let h=Array.from({length:d},(g,y)=>u+y).filter(g=>g<r),f=h.filter(g=>s[g]===void 0),m=p-h.reduce((g,y)=>{var T;return g+((T=s[y])!==null&&T!==void 0?T:0)},0);if(f.length>0&&m>0)for(let g of f)s[g]=m/f.length}let l=s.flatMap((u,d)=>u===void 0?[d]:[]);if(l.length>0){let u=i-s.reduce((p,h)=>p+(h??0),0),d=u>0?u/l.length:i/r;for(let p of l)s[p]=d}return s.map(u=>Math.round(u))},dT=e=>new L({name:"w:gridCol",attributes:e!==void 0?{width:{key:"w:w",value:ve(e)}}:void 0}),Is=class extends P{constructor(e,t){super("w:tblGrid");for(let n of e)this.root.push(dT(n));t&&this.root.push(new uT(t))}},pT=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{id:"w:id"})}},uT=class extends P{constructor(e){super("w:tblGridChange"),this.root.push(new pT({id:e.id})),this.root.push(new Is(e.columnWidths))}},hT=class extends P{constructor(e){super("w:ins"),this.root.push(new He({id:e.id,author:e.author,date:e.date}))}},mT=class extends P{constructor(e){super("w:del"),this.root.push(new He({id:e.id,author:e.author,date:e.date}))}},fT=class extends P{constructor(e){super("w:cellIns"),this.root.push(new He({id:e.id,author:e.author,date:e.date}))}},gT=class extends P{constructor(e){super("w:cellDel"),this.root.push(new He({id:e.id,author:e.author,date:e.date}))}},bT=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date",verticalMerge:"w:vMerge",verticalMergeOriginal:"w:vMergeOrig"})}},vT=class extends P{constructor(e){super("w:cellMerge"),this.root.push(new bT(e))}},Qm=({marginUnitType:e=Fe.DXA,top:t,left:n,bottom:r,right:i})=>[{name:"w:top",size:t},{name:"w:left",size:n},{name:"w:bottom",size:r},{name:"w:right",size:i}].filter(s=>s.size!==void 0).map(({name:s,size:a})=>$r(s,{type:e,size:a})),wT=e=>{let t=Qm(e);if(t.length!==0)return new L({name:"w:tblCellMar",children:t})},yT=e=>{let t=Qm(e);if(t.length!==0)return new L({name:"w:tcMar",children:t})},xT=class extends St{constructor(e){super("w:tcBorders"),e.top&&this.root.push(he("w:top",e.top)),e.start&&this.root.push(he("w:start",e.start)),e.left&&this.root.push(he("w:left",e.left)),e.bottom&&this.root.push(he("w:bottom",e.bottom)),e.end&&this.root.push(he("w:end",e.end)),e.right&&this.root.push(he("w:right",e.right)),e.diagonalDown&&this.root.push(he("w:tl2br",e.diagonalDown)),e.diagonalUp&&this.root.push(he("w:tr2bl",e.diagonalUp))}},kT=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{val:"w:val"})}},TT=class extends P{constructor(e){super("w:gridSpan"),this.root.push(new kT({val:le(e)}))}},Zm={CONTINUE:"continue",RESTART:"restart"},ST=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{val:"w:val"})}},lh=class extends P{constructor(e){super("w:vMerge"),this.root.push(new ST({val:e}))}},CT=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{val:"w:val"})}},ET=class extends P{constructor(e){super("w:textDirection"),this.root.push(new CT({val:e}))}},ef=class extends St{constructor(e){if(super("w:tcPr",e.includeIfEmpty),E(this,"hasWidth",void 0),E(this,"hasColumnWidth",!1),this.hasWidth=e.width!==void 0,e.width&&this.root.push($r("w:tcW",e.width)),e.columnSpan&&this.root.push(new TT(e.columnSpan)),e.verticalMerge?this.root.push(new lh(e.verticalMerge)):e.rowSpan&&e.rowSpan>1&&this.root.push(new lh(Zm.RESTART)),e.borders&&this.root.push(new xT(e.borders)),e.shading&&this.root.push(zs(e.shading)),e.margins){let t=yT(e.margins);t&&this.root.push(t)}e.textDirection&&this.root.push(new ET(e.textDirection)),e.verticalAlign&&this.root.push(zm(e.verticalAlign)),e.insertion&&this.root.push(new fT(e.insertion)),e.deletion&&this.root.push(new gT(e.deletion)),e.cellMerge&&this.root.push(new vT(e.cellMerge)),e.revision&&this.root.push(new AT(e.revision))}setColumnWidth(e){this.hasWidth||(this.root.splice(0,this.hasColumnWidth?1:0,$r("w:tcW",{size:e,type:Fe.DXA})),this.hasColumnWidth=!0)}},AT=class extends P{constructor(e){super("w:tcPrChange"),this.root.push(new He({id:e.id,author:e.author,date:e.date})),this.root.push(new ef(k(k({},e),{},{includeIfEmpty:!0})))}},Fr=class extends P{constructor(e){super("w:tc"),E(this,"options",void 0),E(this,"properties",void 0),this.options=e,this.properties=new ef(e),this.root.push(this.properties);for(let t of e.children)this.root.push(t)}setColumnWidth(e){this.properties.setColumnWidth(e)}prepForXml(e){return Ws(this.root[this.root.length-1])!=="w:p"&&this.root.push(new ne({})),super.prepForXml(e)}},Ll=(e,t)=>t?new I(e):new ot(e,"off"),In={style:Gr.NONE,size:0,color:"auto"},_T={style:Gr.SINGLE,size:4,color:"auto"},tf=class extends St{constructor(e,{fillMissingSides:t=!0}={}){super("w:tblBorders");let n=[["w:top",e.top],["w:left",e.left],["w:bottom",e.bottom],["w:right",e.right],["w:insideH",e.insideHorizontal],["w:insideV",e.insideVertical]];for(let[r,i]of n){let s=i??(t?_T:void 0);s&&this.root.push(he(r,s))}}};E(tf,"NONE",{top:In,bottom:In,left:In,right:In,insideHorizontal:In,insideVertical:In});ll={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},NT={CENTER:"center",INSIDE:"inside",BOTTOM:"bottom",OUTSIDE:"outside",INLINE:"inline",TOP:"top"},PT=({horizontalAnchor:e,verticalAnchor:t,absoluteHorizontalPosition:n,relativeHorizontalPosition:r,absoluteVerticalPosition:i,relativeVerticalPosition:s,bottomFromText:a,topFromText:o,leftFromText:c,rightFromText:l})=>new L({name:"w:tblpPr",attributes:{leftFromText:{key:"w:leftFromText",value:c===void 0?void 0:ve(c)},rightFromText:{key:"w:rightFromText",value:l===void 0?void 0:ve(l)},topFromText:{key:"w:topFromText",value:o===void 0?void 0:ve(o)},bottomFromText:{key:"w:bottomFromText",value:a===void 0?void 0:ve(a)},absoluteHorizontalPosition:{key:"w:tblpX",value:n===void 0?void 0:at(n)},absoluteVerticalPosition:{key:"w:tblpY",value:i===void 0?void 0:at(i)},horizontalAnchor:{key:"w:horzAnchor",value:e},relativeHorizontalPosition:{key:"w:tblpXSpec",value:r},relativeVerticalPosition:{key:"w:tblpYSpec",value:s},verticalAnchor:{key:"w:vertAnchor",value:t}}}),IT=e=>new L({name:"w:tblLayout",attributes:{type:{key:"w:type",value:e}}}),OT={DXA:"dxa",NIL:"nil"},nf=({type:e=OT.DXA,value:t})=>new L({name:"w:tblCellSpacing",attributes:{type:{key:"w:type",value:e},value:{key:"w:w",value:lm(t)}}}),RT=({firstRow:e,lastRow:t,firstColumn:n,lastColumn:r,noHBand:i,noVBand:s})=>new L({name:"w:tblLook",attributes:{firstRow:{key:"w:firstRow",value:e},lastRow:{key:"w:lastRow",value:t},firstColumn:{key:"w:firstColumn",value:n},lastColumn:{key:"w:lastColumn",value:r},noHBand:{key:"w:noHBand",value:i},noVBand:{key:"w:noVBand",value:s}}}),LT=e=>new L({name:"w:tblOverlap",attributes:{val:{key:"w:val",value:e}}}),MT={[ll.LEFT]:ue.LEFT,[ll.CENTER]:ue.CENTER,[ll.RIGHT]:ue.RIGHT},gc=class extends St{constructor(e){var t,n,r;super("w:tblPr",e.includeIfEmpty),e.style&&this.root.push(new ot("w:tblStyle",e.style));let i=((t=e.float)===null||t===void 0?void 0:t.relativeVerticalPosition)===NT.INLINE,s=i?void 0:e.float;s&&this.root.push(PT(s)),s?.overlap&&this.root.push(LT(s.overlap)),e.visuallyRightToLeft!==void 0&&this.root.push(Ll("w:bidiVisual",e.visuallyRightToLeft)),e.width&&this.root.push($r("w:tblW",e.width));let a=(n=e.alignment)!==null&&n!==void 0?n:i&&(!((r=e.float)===null||r===void 0)&&r.relativeHorizontalPosition)?MT[e.float.relativeHorizontalPosition]:void 0;if(a&&this.root.push(dm(a)),e.cellSpacing&&this.root.push(nf(e.cellSpacing)),e.indent&&this.root.push($r("w:tblInd",e.indent)),e.borders&&this.root.push(new tf(e.borders,{fillMissingSides:!e.style})),e.shading&&this.root.push(zs(e.shading)),e.layout&&this.root.push(IT(e.layout)),e.cellMargin){let o=wT(e.cellMargin);o&&this.root.push(o)}e.tableLook&&this.root.push(RT(e.tableLook)),e.revision&&this.root.push(new DT(e.revision))}},DT=class extends P{constructor(e){super("w:tblPrChange"),this.root.push(new He({id:e.id,author:e.author,date:e.date})),this.root.push(new gc(k(k({},e),{},{includeIfEmpty:!0})))}},BT=(e,t)=>new L({name:"w:trHeight",attributes:{value:{key:"w:val",value:ve(e)},rule:{key:"w:hRule",value:t}}}),rf=class extends St{constructor(e){super("w:trPr",e.includeIfEmpty),e.cantSplit!==void 0&&this.root.push(Ll("w:cantSplit",e.cantSplit)),e.tableHeader!==void 0&&this.root.push(Ll("w:tblHeader",e.tableHeader)),e.height&&this.root.push(BT(e.height.value,e.height.rule)),e.cellSpacing&&this.root.push(nf(e.cellSpacing)),e.insertion&&this.root.push(new hT(e.insertion)),e.deletion&&this.root.push(new mT(e.deletion)),e.revision&&this.root.push(new $T(e.revision))}},$T=class extends P{constructor(e){super("w:trPrChange"),this.root.push(new He({id:e.id,author:e.author,date:e.date})),this.root.push(new rf(k(k({},e),{},{includeIfEmpty:!0})))}},Fs=(e,t)=>{let n=e[t];return Array.isArray(n)?n:[]},Ir=e=>Object.keys(e)[0],FT=(e,t)=>{let n=Fs(e,"w:p"),r=n.find(o=>Ir(o)==="w:pPr");if(!r)return{"w:p":[{"w:pPr":[t]},...n]};let i=Fs(r,"w:pPr");if(i.some(o=>Ir(o)==="w:keepNext"))return e;let s=i.filter(o=>Ir(o)==="w:pStyle").length,a={"w:pPr":[...i.slice(0,s),t,...i.slice(s)]};return{"w:p":n.map(o=>o===r?a:o)}},Js=class extends P{constructor(e){super("w:tr"),E(this,"options",void 0),this.options=e,this.root.push(new rf(e));for(let t of e.children)this.root.push(t)}prepForXml(e){if(this.cells.length===0)return;let t=super.prepForXml(e);if(!t||this.options.keepNext===void 0)return t;let n=new I("w:keepNext",this.options.keepNext).prepForXml(e);return{"w:tr":Fs(t,"w:tr").map(r=>Ir(r)==="w:tc"?{"w:tc":Fs(r,"w:tc").map(i=>Ir(i)==="w:p"?FT(i,n):i)}:r)}}get CellCount(){return this.options.children.length}get cells(){return this.root.filter(e=>Ws(e)==="w:tc")}addCellToIndex(e,t){this.root.splice(t+1,0,e)}addCellToColumnIndex(e,t){let n=this.columnIndexToRootIndex(t,!0);this.addCellToIndex(e,n-1)}rootIndexToColumnIndex(e){if(e<1||e>=this.root.length)throw new Error(`cell 'rootIndex' should between 1 to ${this.root.length-1}`);let t=0;for(let n=1;n<e;n++){let r=this.root[n];t+=r.options.columnSpan||1}return t}columnIndexToRootIndex(e,t=!1){if(e<0)throw new Error("cell 'columnIndex' should not less than zero");let n=0,r=1;for(;n<=e;){if(r>=this.root.length){if(t)return this.root.length;throw new Error(`cell 'columnIndex' should not great than ${n-1}`)}let i=this.root[r];r+=1,n+=i&&i.options.columnSpan||1}return r-1}},sf=class af extends hc{constructor({rows:t,width:n,columnWidths:r,columnWidthsRevision:i,margins:s,indent:a,float:o,layout:c,style:l,borders:u,alignment:d,visuallyRightToLeft:p,tableLook:h,cellSpacing:f,revision:m}){super("w:tbl"),E(this,"rows",void 0),E(this,"width",void 0),E(this,"columnWidths",void 0),E(this,"columnWidthsRevision",void 0),E(this,"resolvedColumnWidths",void 0),this.rows=t,this.width=n??{size:100},this.columnWidths=r,this.columnWidthsRevision=i,t.forEach((g,y)=>{if(y===t.length-1)return;let T=0;g.cells.forEach(b=>{if(b.options.rowSpan&&b.options.rowSpan>1){let C=b.options.children[b.options.children.length-1],_=new Fr({rowSpan:b.options.rowSpan-1,columnSpan:b.options.columnSpan,width:b.options.width,borders:b.options.borders,shading:b.options.shading,margins:b.options.margins,textDirection:b.options.textDirection,verticalAlign:b.options.verticalAlign,children:C instanceof ne?[new ne(C.Alignment)]:[],verticalMerge:Zm.CONTINUE});t[y+1].addCellToColumnIndex(_,T)}T+=b.options.columnSpan||1})}),this.setCellWidths(Ps),this.resolvedColumnWidths=r??oh({rows:t,width:this.width,availableWidth:Ps}),this.root.push(new gc({borders:l?u:u??{},width:this.width,indent:a,float:o,layout:c,style:l,alignment:d,cellMargin:s,visuallyRightToLeft:p,tableLook:h,cellSpacing:f,revision:m})),this.root.push(new Is(this.resolvedColumnWidths,i));for(let g of t)this.root.push(g)}get ColumnWidths(){return this.resolvedColumnWidths}getCellWidth(t,n){let{cells:r}=t,i=r.indexOf(n);if(i===-1)return;let s=r.slice(0,i).reduce((o,c)=>o+(c.options.columnSpan||1),0),a=this.resolvedColumnWidths.slice(s,s+(n.options.columnSpan||1));return a.length===0?void 0:a.reduce((o,c)=>o+c,0)}prepForXml(t){if(this.setCellWidths(this.resolveAvailableWidth(t)),this.columnWidths===void 0){this.resolvedColumnWidths=oh({rows:this.rows,width:this.width,availableWidth:this.resolveAvailableWidth(t)});let n=this.root.findIndex(r=>r instanceof Is);this.root[n]=new Is(this.resolvedColumnWidths,this.columnWidthsRevision)}return super.prepForXml(t)}setCellWidths(t){var n;if(this.columnWidths===void 0)return;let r=this.columnWidths.reduce((a,o)=>a+o,0),i=(n=fc(this.width,t))!==null&&n!==void 0?n:0,s=r>0&&i>r?i/r:1;for(let a of this.rows){let o=0;for(let c of a.cells){let l=c.options.columnSpan||1,u=this.columnWidths.slice(o,o+l),d=Math.round(u.reduce((p,h)=>p+h,0)*s);u.length===l&&d>0&&c.setColumnWidth(d),o+=l}}}resolveAvailableWidth(t){var n,r,i;let{stack:s}=t,a=s[s.length-1],o=s[s.length-2],c=s[s.length-3];if(a instanceof Fr&&o instanceof Js&&c instanceof af){let p=c.getCellWidth(o,a);if(p!==void 0)return p}let l=s.findIndex(p=>p instanceof Ym),u=(n=t.file)===null||n===void 0||(n=n.Document)===null||n===void 0?void 0:n.View.Body,d=l>=0?s[l].getSectionPropertiesFor((r=s[l+1])!==null&&r!==void 0?r:this):u?.getSectionPropertiesFor();return(i=d?.AvailableTextWidth)!==null&&i!==void 0?i:Ps}},qT=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},HT=class extends P{constructor(){super("Properties"),this.root.push(new qT({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}))}},UT=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{xmlns:"xmlns"})}},wt=(e,t)=>new L({name:"Default",attributes:{contentType:{key:"ContentType",value:e},extension:{key:"Extension",value:t}}}),ge=(e,t)=>new L({name:"Override",attributes:{contentType:{key:"ContentType",value:e},partName:{key:"PartName",value:t}}}),jT=class extends P{constructor({macros:e=!1}={}){super("Types"),this.root.push(new UT({xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"})),this.root.push(wt("image/png","png")),this.root.push(wt("image/jpeg","jpeg")),this.root.push(wt("image/jpeg","jpg")),this.root.push(wt("image/bmp","bmp")),this.root.push(wt("image/gif","gif")),this.root.push(wt("image/svg+xml","svg")),this.root.push(wt("application/vnd.openxmlformats-package.relationships+xml","rels")),this.root.push(wt("application/xml","xml")),this.root.push(wt("application/vnd.openxmlformats-officedocument.obfuscatedFont","odttf")),this.root.push(ge(e?"application/vnd.ms-word.document.macroEnabled.main+xml":"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","/word/document.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml","/word/styles.xml")),this.root.push(ge("application/vnd.openxmlformats-package.core-properties+xml","/docProps/core.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.custom-properties+xml","/docProps/custom.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.extended-properties+xml","/docProps/app.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml","/word/numbering.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","/word/footnotes.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml","/word/endnotes.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml","/word/settings.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml","/word/fontTable.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.theme+xml","/word/theme/theme1.xml")),e&&this.root.push(ge("application/vnd.ms-office.vbaProject","/word/vbaProject.bin"))}addComments(){this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml","/word/comments.xml"))}addCommentsExtended(){this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml","/word/commentsExtended.xml"))}addCommentsIds(){this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml","/word/commentsIds.xml"))}addFooter(e){this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",`/word/footer${e}.xml`))}addOverride(e,t){this.root.push(ge(e,t))}addHeader(e){this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",`/word/header${e}.xml`))}},Ml={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",aink:"http://schemas.microsoft.com/office/drawing/2016/ink",am3d:"http://schemas.microsoft.com/office/drawing/2017/model3d",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Qs=class extends H{constructor(e,t){super(k({Ignorable:t},Object.fromEntries(e.map(n=>[n,Ml[n]])))),E(this,"xmlKeys",k({Ignorable:"mc:Ignorable"},Object.fromEntries(Object.keys(Ml).map(n=>[n,`xmlns:${n}`]))))}},WT=class extends P{constructor(e){super("cp:coreProperties"),this.root.push(new Qs(["cp","dc","dcterms","dcmitype","xsi"])),e.title&&this.root.push(new nn("dc:title",e.title)),e.subject&&this.root.push(new nn("dc:subject",e.subject)),e.creator&&this.root.push(new nn("dc:creator",e.creator)),e.keywords&&this.root.push(new nn("cp:keywords",e.keywords)),e.description&&this.root.push(new nn("dc:description",e.description)),e.lastModifiedBy&&this.root.push(new nn("cp:lastModifiedBy",e.lastModifiedBy)),e.revision&&this.root.push(new nn("cp:revision",String(e.revision))),this.root.push(new ch("dcterms:created")),this.root.push(new ch("dcterms:modified"))}},KT=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{type:"xsi:type"})}},ch=class extends P{constructor(e){super(e),this.root.push(new KT({type:"dcterms:W3CDTF"})),this.root.push(yx(new Date))}},GT=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},zT=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{formatId:"fmtid",pid:"pid",name:"name"})}},VT=class extends P{constructor(e,t){super("property"),this.root.push(new zT({formatId:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:e.toString(),name:t.name})),this.root.push(new XT(t.value))}},XT=class extends P{constructor(e){super("vt:lpwstr"),this.root.push(e)}},YT=class extends P{constructor(e){super("Properties"),E(this,"nextId",void 0),E(this,"properties",[]),this.root.push(new GT({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"})),this.nextId=2;for(let t of e)this.addCustomProperty(t)}prepForXml(e){return this.root.splice(1,this.root.length-1,...this.properties),super.prepForXml(e)}addCustomProperty(e){this.properties.push(new VT(this.nextId++,e))}},JT=e=>new L({name:"ds:datastoreItem",attributes:{itemId:{key:"ds:itemID",value:e},namespace:{key:"xmlns:ds",value:"http://schemas.openxmlformats.org/officeDocument/2006/customXml"}},children:[new L({name:"ds:schemaRefs",children:[new L({name:"ds:schemaRef",attributes:{uri:{key:"ds:uri",value:"http://schemas.openxmlformats.org/officeDocument/2006/bibliography"}}})]})]}),QT={new:"wne:eventDocNew",open:"wne:eventDocOpen",close:"wne:eventDocClose",sync:"wne:eventDocSync",xmlAfterInsert:"wne:eventDocXmlAfterInsert",xmlBeforeDelete:"wne:eventDocXmlBeforeDelete",contentControlAfterAdd:"wne:eventDocContentControlAfterInsert",contentControlBeforeDelete:"wne:eventDocContentControlBeforeDelete",contentControlOnExit:"wne:eventDocContentControlOnExit",contentControlOnEnter:"wne:eventDocContentControlOnEnter",contentControlBeforeStoreUpdate:"wne:eventDocStoreUpdate",contentControlBeforeContentUpdate:"wne:eventDocContentControlContentUpdate",buildingBlockInsert:"wne:eventDocBuildingBlockAfterInsert"},ZT=e=>new L({name:"wne:vbaSuppData",attributes:{namespace:{key:"xmlns:wne",value:"http://schemas.microsoft.com/office/word/2006/wordml"}},children:[new L({name:"wne:docEvents",children:Object.entries(QT).filter(([t])=>e.includes(t)).map(([,t])=>new L({name:t}))})]}),eS=class extends P{constructor({color:e,themeColor:t,themeShade:n,themeTint:r}){if(super("w:background"),typeof e=="object"&&(t!==void 0||n!==void 0||r!==void 0))throw new Error("Invalid background. Expected a theme color in color, or themeColor, themeShade and themeTint, not both");this.root.push(new ic([{keys:Kr,color:e},{key:"w:themeColor",value:t},{key:"w:themeShade",value:n===void 0?void 0:Yu(n)},{key:"w:themeTint",value:r===void 0?void 0:Yu(r)}]))}},tS=class extends P{constructor(e){super("w:document"),E(this,"body",void 0),this.root.push(new Qs(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps","cx","cx1","cx2","cx3","cx4","cx5","cx6","cx7","cx8","aink","am3d","w16cex","w16cid","w16","w16sdtdh","w16se"],"w14 w15 wp14")),this.body=new Ym({pageNumbers:e.pageNumbers}),e.background&&this.root.push(new eS(e.background)),this.root.push(this.body)}add(e){return this.body.push(e),this}get Body(){return this.body}},nS=class{constructor(e){E(this,"document",void 0),E(this,"relationships",void 0),this.document=new tS(e),this.relationships=new be}get View(){return this.document}get Relationships(){return this.relationships}},rS=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},of=class extends P{constructor(e,t){super("w:p"),E(this,"paragraph",void 0),E(this,"mark",void 0),this.paragraph=e,this.mark=t}prepForXml(e){let t=this.paragraph.prepForXml(e)["w:p"],n=Array.isArray(t)?t:[],r=n.length>0&&"w:pPr"in n[0]?1:0;return{"w:p":[...n.slice(0,r),this.mark.prepForXml(e),...n.slice(r)]}}},iS=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{type:"w:type",id:"w:id"})}},lf=class extends qe{constructor(){super({style:"EndnoteReference"}),this.root.push(new x1)}},dh={SEPARATOR:"separator",CONTINUATION_SEPARATOR:"continuationSeparator"},cl=class extends P{constructor(e){super("w:endnote"),this.root.push(new iS({type:e.type,id:e.id}));for(let[t,n]of e.children.entries())this.root.push(t===0?new of(n,new lf):n)}},sS=class extends P{constructor(){super("w:continuationSeparator")}},cf=class extends qe{constructor(){super({}),this.root.push(new sS)}},aS=class extends P{constructor(){super("w:separator")}},df=class extends qe{constructor(){super({}),this.root.push(new aS)}},pf=class extends P{constructor(){super("w:endnotes"),E(this,"ownNotes",new Map),E(this,"highestId",0),this.root.push(new rS({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"}));let e=new cl({id:-1,type:dh.SEPARATOR,children:[new ne({spacing:{after:0,line:240,lineRule:Mn.AUTO},children:[new df]})]});this.root.push(e);let t=new cl({id:0,type:dh.CONTINUATION_SEPARATOR,children:[new ne({spacing:{after:0,line:240,lineRule:Mn.AUTO},children:[new cf]})]});this.root.push(t)}createEndnote(e,t){let n=new cl({id:e,children:t});this.root.push(n),Number.isFinite(e)&&(this.highestId=Math.max(this.highestId,Math.floor(e)))}idOf(e,t,n){if(n.viewWrapper!==n.file.Document)return;let r=this.ownNotes.get(e);if(r!==void 0)return r;let i=this.highestId+1;return this.createEndnote(i,t.children),this.ownNotes.set(e,i),i}prepForXml(e){let t=super.prepForXml(e);return zr(t,e),t}},oS=class{constructor(){E(this,"endnotes",void 0),E(this,"relationships",void 0),this.endnotes=new pf,this.relationships=new be}get View(){return this.endnotes}get Relationships(){return this.relationships}},lS=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",cp:"xmlns:cp",dc:"xmlns:dc",dcterms:"xmlns:dcterms",dcmitype:"xmlns:dcmitype",xsi:"xmlns:xsi",type:"xsi:type"})}},cS=class extends im{constructor(e,t){super("w:ftr",t),E(this,"refId",void 0),this.refId=e,t||this.root.push(new lS({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}))}get ReferenceId(){return this.refId}add(e){this.root.push(e)}prepForXml(e){let t=super.prepForXml(e);return zr(t,e,this.refId),t}},dS=class{constructor(e,t,n){E(this,"media",void 0),E(this,"footer",void 0),E(this,"relationships",void 0),this.media=e,this.footer=new cS(t,n),this.relationships=new be}add(e){this.footer.add(e)}addChildElement(e){this.footer.addChildElement(e)}get View(){return this.footer}get Relationships(){return this.relationships}get Media(){return this.media}},pS=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{type:"w:type",id:"w:id"})}},uS=class extends P{constructor(){super("w:footnoteRef")}},uf=class extends qe{constructor(){super({style:"FootnoteReference"}),this.root.push(new uS)}},ph={SEPERATOR:"separator",CONTINUATION_SEPERATOR:"continuationSeparator"},dl=class extends P{constructor(e){super("w:footnote"),this.root.push(new pS({type:e.type,id:e.id}));for(let[t,n]of e.children.entries())this.root.push(t===0?new of(n,new uf):n)}},hS=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},hf=class extends P{constructor(){super("w:footnotes"),E(this,"ownNotes",new Map),E(this,"highestId",0),this.root.push(new hS({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"}));let e=new dl({id:-1,type:ph.SEPERATOR,children:[new ne({spacing:{after:0,line:240,lineRule:Mn.AUTO},children:[new df]})]});this.root.push(e);let t=new dl({id:0,type:ph.CONTINUATION_SEPERATOR,children:[new ne({spacing:{after:0,line:240,lineRule:Mn.AUTO},children:[new cf]})]});this.root.push(t)}createFootNote(e,t){let n=new dl({id:e,children:t});this.root.push(n),Number.isFinite(e)&&(this.highestId=Math.max(this.highestId,Math.floor(e)))}idOf(e,t,n){if(n.viewWrapper!==n.file.Document)return;let r=this.ownNotes.get(e);if(r!==void 0)return r;let i=this.highestId+1;return this.createFootNote(i,t.children),this.ownNotes.set(e,i),i}prepForXml(e){let t=super.prepForXml(e);return zr(t,e),t}},mS=class{constructor(){E(this,"footnotess",void 0),E(this,"relationships",void 0),this.footnotess=new hf,this.relationships=new be}get View(){return this.footnotess}get Relationships(){return this.relationships}},fS=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",cp:"xmlns:cp",dc:"xmlns:dc",dcterms:"xmlns:dcterms",dcmitype:"xmlns:dcmitype",xsi:"xmlns:xsi",type:"xsi:type",cx:"xmlns:cx",cx1:"xmlns:cx1",cx2:"xmlns:cx2",cx3:"xmlns:cx3",cx4:"xmlns:cx4",cx5:"xmlns:cx5",cx6:"xmlns:cx6",cx7:"xmlns:cx7",cx8:"xmlns:cx8",w16cid:"xmlns:w16cid",w16se:"xmlns:w16se"})}},gS=class extends im{constructor(e,t){super("w:hdr",t),E(this,"refId",void 0),this.refId=e,t||this.root.push(new fS({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"}))}get ReferenceId(){return this.refId}add(e){this.root.push(e)}prepForXml(e){let t=super.prepForXml(e);return zr(t,e,this.refId),t}},bS=class{constructor(e,t,n){E(this,"media",void 0),E(this,"header",void 0),E(this,"relationships",void 0),this.media=e,this.header=new gS(t,n),this.relationships=new be}add(e){return this.header.add(e),this}addChildElement(e){this.header.addChildElement(e)}get View(){return this.header}get Relationships(){return this.relationships}get Media(){return this.media}},vS=()=>{let e=new Map;return t=>{var n;let r=((n=e.get(t))!==null&&n!==void 0?n:0)+1;return e.set(t,r),`media/image${r}.${t}`}},mf=class{constructor(e=vS()){E(this,"map",new Map),E(this,"takePath",void 0),this.takePath=e}addImage(e,t){if(this.map.has(e))return;let n=this.takePath(t.type);this.map.set(e,k(k({},t),{},{fileName:n.slice(n.lastIndexOf("/")+1)}))}get Array(){return Array.from(this.map.values())}get Entries(){return Array.from(this.map.entries())}},yt={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH__DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULLSTOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PARENTHESES:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW1:"hebrew1",HEBREW2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText",CUSTOM:"custom"},wS=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{ilvl:"w:ilvl",tentative:"w:tentative"})}},yS=class extends P{constructor(e){super("w:numFmt"),this.root.push(new _e({val:e}))}},xS=class extends P{constructor(e){super("w:lvlText"),this.root.push(new _e({val:e}))}},kS=e=>{switch(e){case ue.CENTER:return"center";case ue.END:case ue.RIGHT:return"right";default:return"left"}},TS=class extends P{constructor(e){super("w:lvlJc"),this.root.push(new _e({val:kS(e)}))}},SS=class extends P{constructor(e){super("w:suff"),this.root.push(new _e({val:e}))}},CS=class extends P{constructor(){super("w:isLgl")}},ES=class extends P{constructor({level:e,format:t,text:n,alignment:r=ue.START,start:i=1,style:s,suffix:a,isLegalNumberingStyle:o}){if(super("w:lvl"),E(this,"paragraphProperties",void 0),E(this,"runProperties",void 0),this.root.push(new Pr("w:start",le(i))),t&&this.root.push(new yS(t)),s?.style&&this.root.push(Nr(s.style)),o&&this.root.push(new CS),a&&this.root.push(new SS(a)),n&&this.root.push(new xS(n)),this.root.push(new TS(r)),this.paragraphProperties=new Dn(s&&s.paragraph,{implicitListParagraphStyle:!1,inListOrder:!1}),this.runProperties=new on(s?.run&&k(k({},s.run),{},{highlight:void 0,math:void 0,revision:void 0})),this.root.push(this.paragraphProperties),this.root.push(this.runProperties),e>9)throw new Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new wS({ilvl:le(e),tentative:1}))}},AS=class extends ES{},_S=class extends P{constructor(e){super("w:multiLevelType"),this.root.push(new _e({val:e}))}},NS=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{abstractNumId:"w:abstractNumId",restartNumberingAfterBreak:"w15:restartNumberingAfterBreak"})}},pl=class extends P{constructor(e,t){super("w:abstractNum"),E(this,"id",void 0),this.root.push(new NS({abstractNumId:le(e),restartNumberingAfterBreak:0})),this.root.push(new _S("hybridMultilevel")),this.id=e;for(let n of t)this.root.push(new AS(n))}},PS=class extends P{constructor(e){super("w:abstractNumId"),this.root.push(new _e({val:e}))}},IS=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{numId:"w:numId"})}},uh=class extends P{constructor(e){if(super("w:num"),E(this,"numId",void 0),E(this,"reference",void 0),E(this,"instance",void 0),E(this,"restartedListId",void 0),this.numId=e.numId,this.reference=e.reference,this.instance=e.instance,this.restartedListId=e.restartedListId,this.root.push(new IS({numId:le(e.numId)})),this.root.push(new PS(le(e.abstractNumId))),e.overrideLevels&&e.overrideLevels.length)for(let t of e.overrideLevels)this.root.push(new RS(t.num,t.start))}},OS=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{ilvl:"w:ilvl"})}},RS=class extends P{constructor(e,t){super("w:lvlOverride"),this.root.push(new OS({ilvl:e})),t!==void 0&&this.root.push(new MS(t))}},LS=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{val:"w:val"})}},MS=class extends P{constructor(e){super("w:startOverride"),this.root.push(new LS({val:e}))}},ff=class extends P{constructor(e){super("w:numbering"),E(this,"abstractNumberingMap",new Map),E(this,"concreteNumberingMap",new Map),E(this,"referenceConfigMap",new Map),E(this,"abstractNumUniqueNumericId",rk()),E(this,"concreteNumUniqueNumericId",ik()),this.root.push(new Qs(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps"],"w14 w15 wp14"));let t=new pl(this.abstractNumUniqueNumericId(),[{level:0,format:yt.BULLET,text:"\u25CF",alignment:ue.LEFT,style:{paragraph:{indent:{left:Xe(.5),hanging:Xe(.25)}}}},{level:1,format:yt.BULLET,text:"\u25CB",alignment:ue.LEFT,style:{paragraph:{indent:{left:Xe(1),hanging:Xe(.25)}}}},{level:2,format:yt.BULLET,text:"\u25A0",alignment:ue.LEFT,style:{paragraph:{indent:{left:2160,hanging:Xe(.25)}}}},{level:3,format:yt.BULLET,text:"\u25CF",alignment:ue.LEFT,style:{paragraph:{indent:{left:2880,hanging:Xe(.25)}}}},{level:4,format:yt.BULLET,text:"\u25CB",alignment:ue.LEFT,style:{paragraph:{indent:{left:3600,hanging:Xe(.25)}}}},{level:5,format:yt.BULLET,text:"\u25A0",alignment:ue.LEFT,style:{paragraph:{indent:{left:4320,hanging:Xe(.25)}}}},{level:6,format:yt.BULLET,text:"\u25CF",alignment:ue.LEFT,style:{paragraph:{indent:{left:5040,hanging:Xe(.25)}}}},{level:7,format:yt.BULLET,text:"\u25CF",alignment:ue.LEFT,style:{paragraph:{indent:{left:5760,hanging:Xe(.25)}}}},{level:8,format:yt.BULLET,text:"\u25CF",alignment:ue.LEFT,style:{paragraph:{indent:{left:6480,hanging:Xe(.25)}}}}]);this.concreteNumberingMap.set("default-bullet-numbering",new uh({numId:1,abstractNumId:t.id,reference:"default-bullet-numbering",instance:0,overrideLevels:[{num:0,start:1}]})),this.abstractNumberingMap.set("default-bullet-numbering",t);for(let n of e.config)this.abstractNumberingMap.set(n.reference,new pl(this.abstractNumUniqueNumericId(),n.levels)),this.referenceConfigMap.set(n.reference,n.levels)}prepForXml(e){return this.root.splice(1,this.root.length-1,...this.abstractNumberingMap.values(),...this.concreteNumberingMap.values()),super.prepForXml(e)}createConcreteNumberingInstance(e,t,n,r){var i;n&&!this.abstractNumberingMap.has(n.reference)&&(this.abstractNumberingMap.set(n.reference,new pl(this.abstractNumUniqueNumericId(),n.levels)),this.referenceConfigMap.set(n.reference,n.levels));let s=this.abstractNumberingMap.get(e);if(!s)return;let a=Bs(e,t,r);if(this.concreteNumberingMap.has(a))return;let o=(i=this.referenceConfigMap.get(e))!==null&&i!==void 0?i:[{level:0}],c={numId:this.concreteNumUniqueNumericId(),abstractNumId:s.id,reference:e,instance:t,restartedListId:r,overrideLevels:o.map(({level:l,start:u=1})=>({num:l,start:le(u)}))};this.concreteNumberingMap.set(a,new uh(c))}get ConcreteNumbering(){return Array.from(this.concreteNumberingMap.values())}get ReferenceConfig(){return Array.from(this.referenceConfigMap.values())}},gf=class{constructor(e,t=new Set){E(this,"contentTypes",void 0),E(this,"paths",new Map),E(this,"taken",void 0),E(this,"folders",new WeakMap),this.contentTypes=e,this.taken=new Set(t)}add(e){let t=this.paths.get(e);if(t!==void 0)return t;let{folder:n,name:r,extension:i,contentType:s}=e.options,a=this.takePath(n,r,i);return this.paths.set(e,a),this.contentTypes.addOverride(s,`/word/${a}`),a}takePath(e,t,n){let r=1;for(;this.taken.has(`${e}/${t}${r}.${n}`);)r++;let i=`${e}/${t}${r}.${n}`;return this.taken.add(i),i}get Array(){return[...this.paths].map(([e,t])=>({part:e,path:t}))}createRelationships(e){let t=new be;return this.folders.set(t,e.slice(0,e.indexOf("/"))),t}getTarget(e,t){let n=this.folders.get(e);return n===void 0?t:t.startsWith(`${n}/`)?t.slice(n.length+1):`../${t}`}},DS=e=>new L({name:"w:compatSetting",attributes:{version:{key:"w:val",value:e},name:{key:"w:name",value:"compatibilityMode"},uri:{key:"w:uri",value:"http://schemas.microsoft.com/office/word"}}}),BS=class extends P{constructor(e){super("w:compat"),e.useSingleBorderforContiguousCells&&this.root.push(new I("w:useSingleBorderforContiguousCells",e.useSingleBorderforContiguousCells)),e.wordPerfectJustification&&this.root.push(new I("w:wpJustification",e.wordPerfectJustification)),e.noTabStopForHangingIndent&&this.root.push(new I("w:noTabHangInd",e.noTabStopForHangingIndent)),e.noLeading&&this.root.push(new I("w:noLeading",e.noLeading)),e.spaceForUnderline&&this.root.push(new I("w:spaceForUL",e.spaceForUnderline)),e.noColumnBalance&&this.root.push(new I("w:noColumnBalance",e.noColumnBalance)),e.balanceSingleByteDoubleByteWidth&&this.root.push(new I("w:balanceSingleByteDoubleByteWidth",e.balanceSingleByteDoubleByteWidth)),e.noExtraLineSpacing&&this.root.push(new I("w:noExtraLineSpacing",e.noExtraLineSpacing)),e.doNotLeaveBackslashAlone&&this.root.push(new I("w:doNotLeaveBackslashAlone",e.doNotLeaveBackslashAlone)),e.underlineTrailingSpaces&&this.root.push(new I("w:ulTrailSpace",e.underlineTrailingSpaces)),e.doNotExpandShiftReturn&&this.root.push(new I("w:doNotExpandShiftReturn",e.doNotExpandShiftReturn)),e.spacingInWholePoints&&this.root.push(new I("w:spacingInWholePoints",e.spacingInWholePoints)),e.lineWrapLikeWord6&&this.root.push(new I("w:lineWrapLikeWord6",e.lineWrapLikeWord6)),e.printBodyTextBeforeHeader&&this.root.push(new I("w:printBodyTextBeforeHeader",e.printBodyTextBeforeHeader)),e.printColorsBlack&&this.root.push(new I("w:printColBlack",e.printColorsBlack)),e.spaceWidth&&this.root.push(new I("w:wpSpaceWidth",e.spaceWidth)),e.showBreaksInFrames&&this.root.push(new I("w:showBreaksInFrames",e.showBreaksInFrames)),e.subFontBySize&&this.root.push(new I("w:subFontBySize",e.subFontBySize)),e.suppressBottomSpacing&&this.root.push(new I("w:suppressBottomSpacing",e.suppressBottomSpacing)),e.suppressTopSpacing&&this.root.push(new I("w:suppressTopSpacing",e.suppressTopSpacing)),e.suppressSpacingAtTopOfPage&&this.root.push(new I("w:suppressSpacingAtTopOfPage",e.suppressSpacingAtTopOfPage)),e.suppressTopSpacingWP&&this.root.push(new I("w:suppressTopSpacingWP",e.suppressTopSpacingWP)),e.suppressSpBfAfterPgBrk&&this.root.push(new I("w:suppressSpBfAfterPgBrk",e.suppressSpBfAfterPgBrk)),e.swapBordersFacingPages&&this.root.push(new I("w:swapBordersFacingPages",e.swapBordersFacingPages)),e.convertMailMergeEsc&&this.root.push(new I("w:convMailMergeEsc",e.convertMailMergeEsc)),e.truncateFontHeightsLikeWP6&&this.root.push(new I("w:truncateFontHeightsLikeWP6",e.truncateFontHeightsLikeWP6)),e.macWordSmallCaps&&this.root.push(new I("w:mwSmallCaps",e.macWordSmallCaps)),e.usePrinterMetrics&&this.root.push(new I("w:usePrinterMetrics",e.usePrinterMetrics)),e.doNotSuppressParagraphBorders&&this.root.push(new I("w:doNotSuppressParagraphBorders",e.doNotSuppressParagraphBorders)),e.wrapTrailSpaces&&this.root.push(new I("w:wrapTrailSpaces",e.wrapTrailSpaces)),e.footnoteLayoutLikeWW8&&this.root.push(new I("w:footnoteLayoutLikeWW8",e.footnoteLayoutLikeWW8)),e.shapeLayoutLikeWW8&&this.root.push(new I("w:shapeLayoutLikeWW8",e.shapeLayoutLikeWW8)),e.alignTablesRowByRow&&this.root.push(new I("w:alignTablesRowByRow",e.alignTablesRowByRow)),e.forgetLastTabAlignment&&this.root.push(new I("w:forgetLastTabAlignment",e.forgetLastTabAlignment)),e.adjustLineHeightInTable&&this.root.push(new I("w:adjustLineHeightInTable",e.adjustLineHeightInTable)),e.autoSpaceLikeWord95&&this.root.push(new I("w:autoSpaceLikeWord95",e.autoSpaceLikeWord95)),e.noSpaceRaiseLower&&this.root.push(new I("w:noSpaceRaiseLower",e.noSpaceRaiseLower)),e.doNotUseHTMLParagraphAutoSpacing&&this.root.push(new I("w:doNotUseHTMLParagraphAutoSpacing",e.doNotUseHTMLParagraphAutoSpacing)),e.layoutRawTableWidth&&this.root.push(new I("w:layoutRawTableWidth",e.layoutRawTableWidth)),e.layoutTableRowsApart&&this.root.push(new I("w:layoutTableRowsApart",e.layoutTableRowsApart)),e.useWord97LineBreakRules&&this.root.push(new I("w:useWord97LineBreakRules",e.useWord97LineBreakRules)),e.doNotBreakWrappedTables&&this.root.push(new I("w:doNotBreakWrappedTables",e.doNotBreakWrappedTables)),e.doNotSnapToGridInCell&&this.root.push(new I("w:doNotSnapToGridInCell",e.doNotSnapToGridInCell)),e.selectFieldWithFirstOrLastCharacter&&this.root.push(new I("w:selectFldWithFirstOrLastChar",e.selectFieldWithFirstOrLastCharacter)),e.applyBreakingRules&&this.root.push(new I("w:applyBreakingRules",e.applyBreakingRules)),e.doNotWrapTextWithPunctuation&&this.root.push(new I("w:doNotWrapTextWithPunct",e.doNotWrapTextWithPunctuation)),e.doNotUseEastAsianBreakRules&&this.root.push(new I("w:doNotUseEastAsianBreakRules",e.doNotUseEastAsianBreakRules)),e.useWord2002TableStyleRules&&this.root.push(new I("w:useWord2002TableStyleRules",e.useWord2002TableStyleRules)),e.growAutofit&&this.root.push(new I("w:growAutofit",e.growAutofit)),e.useFELayout&&this.root.push(new I("w:useFELayout",e.useFELayout)),e.useNormalStyleForList&&this.root.push(new I("w:useNormalStyleForList",e.useNormalStyleForList)),e.doNotUseIndentAsNumberingTabStop&&this.root.push(new I("w:doNotUseIndentAsNumberingTabStop",e.doNotUseIndentAsNumberingTabStop)),e.useAlternateEastAsianLineBreakRules&&this.root.push(new I("w:useAltKinsokuLineBreakRules",e.useAlternateEastAsianLineBreakRules)),e.allowSpaceOfSameStyleInTable&&this.root.push(new I("w:allowSpaceOfSameStyleInTable",e.allowSpaceOfSameStyleInTable)),e.doNotSuppressIndentation&&this.root.push(new I("w:doNotSuppressIndentation",e.doNotSuppressIndentation)),e.doNotAutofitConstrainedTables&&this.root.push(new I("w:doNotAutofitConstrainedTables",e.doNotAutofitConstrainedTables)),e.autofitToFirstFixedWidthCell&&this.root.push(new I("w:autofitToFirstFixedWidthCell",e.autofitToFirstFixedWidthCell)),e.underlineTabInNumberingList&&this.root.push(new I("w:underlineTabInNumList",e.underlineTabInNumberingList)),e.displayHangulFixedWidth&&this.root.push(new I("w:displayHangulFixedWidth",e.displayHangulFixedWidth)),e.splitPgBreakAndParaMark&&this.root.push(new I("w:splitPgBreakAndParaMark",e.splitPgBreakAndParaMark)),e.doNotVerticallyAlignCellWithSp&&this.root.push(new I("w:doNotVertAlignCellWithSp",e.doNotVerticallyAlignCellWithSp)),e.doNotBreakConstrainedForcedTable&&this.root.push(new I("w:doNotBreakConstrainedForcedTable",e.doNotBreakConstrainedForcedTable)),e.ignoreVerticalAlignmentInTextboxes&&this.root.push(new I("w:doNotVertAlignInTxbx",e.ignoreVerticalAlignmentInTextboxes)),e.useAnsiKerningPairs&&this.root.push(new I("w:useAnsiKerningPairs",e.useAnsiKerningPairs)),e.cachedColumnBalance&&this.root.push(new I("w:cachedColBalance",e.cachedColumnBalance)),e.version&&this.root.push(DS(e.version))}},hh=1e5,mh=15,$S=[57840,7439,52380,33984,4364,3600,61902,12606,6258,57657,54287,34041,10252,43370,20163],FS=[[44796,19929,39858,10053,20106,40212,10761],[31585,63170,64933,60267,50935,40399,11199],[17763,35526,1453,2906,5812,11624,23248],[885,1770,3540,7080,14160,28320,56640],[55369,41139,20807,41614,21821,43642,17621],[28485,56970,44341,19019,38038,14605,29210],[60195,50791,40175,10751,21502,43004,24537],[18387,36774,3949,7898,15796,31592,63184],[47201,24803,49606,37805,14203,28406,56812],[17824,35648,1697,3394,6788,13576,27152],[43601,17539,35078,557,1114,2228,4456],[30388,60776,51953,34243,7079,14158,28316],[14128,28256,56512,43425,17251,34502,7597],[13105,26210,52420,35241,883,1766,3532],[4129,8258,16516,33032,4657,9314,18628]],fh=e=>e>>14&1|e<<1&32767,qS=e=>{let t=e.slice(0,mh).split("").map(i=>{let s=i.charCodeAt(0);return(s&255)!==0?s&255:s>>8&255}),n=t.reduce((i,s,a)=>FS[mh-t.length+a].reduce((o,c,l)=>s>>l&1?o^c:o,i),$S[t.length-1]),r=(fh(t.reduceRight((i,s)=>fh(i)^s,0))^t.length^52811)&65535;return[r&255,r>>8,n&255,n>>8].map(i=>i.toString(16).toUpperCase().padStart(2,"0")).join("")},HS=(e,t,n)=>{let r=[...qS(e)].flatMap(o=>[o.charCodeAt(0),0]),i=eh(Uint8Array.from([...t,...r])),s=new Uint8Array(i.length+4),a=new DataView(s.buffer);for(let o=0;o<n;o++)s.set(i),a.setUint32(i.length,o,!0),i=eh(s);return Array.from(i)},US=e=>{var t;let n=new Uint8Array(e);return typeof((t=globalThis.crypto)===null||t===void 0?void 0:t.getRandomValues)=="function"?(globalThis.crypto.getRandomValues(n),[...n]):[...n].map(()=>Math.floor(Math.random()*256))},gh=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{edit:"w:edit",enforcement:"w:enforcement",cryptProviderType:"w:cryptProviderType",cryptAlgorithmClass:"w:cryptAlgorithmClass",cryptAlgorithmType:"w:cryptAlgorithmType",cryptAlgorithmSid:"w:cryptAlgorithmSid",cryptSpinCount:"w:cryptSpinCount",hash:"w:hash",salt:"w:salt"})}},bh=e=>btoa(String.fromCharCode(...e)),jS=class extends P{constructor({type:e,password:t}){if(super("w:documentProtection"),t===void 0||t===""){this.root.push(new gh({edit:e,enforcement:!0}));return}let n=US(16);this.root.push(new gh({edit:e,enforcement:!0,cryptProviderType:"rsaAES",cryptAlgorithmClass:"hash",cryptAlgorithmType:"typeAny",cryptAlgorithmSid:12,cryptSpinCount:hh,hash:bh(HS(t,n,hh)),salt:bh(n)}))}},WS=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},KS=class extends P{constructor(e){var t,n,r,i,s,a,o,c,l;super("w:settings"),this.root.push(new WS({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"})),this.root.push(new I("w:displayBackgroundShape",!0)),e.embedFonts!==void 0&&this.root.push(new I("w:embedTrueTypeFonts",e.embedFonts)),e.trackRevisions!==void 0&&this.root.push(new I("w:trackRevisions",e.trackRevisions)),e.protection!==void 0&&this.root.push(new jS(e.protection)),this.root.push(new Pr("w:defaultTabStop",(t=e.defaultTabStop)!==null&&t!==void 0?t:720)),((n=e.hyphenation)===null||n===void 0?void 0:n.autoHyphenation)!==void 0&&this.root.push(new I("w:autoHyphenation",e.hyphenation.autoHyphenation)),((r=e.hyphenation)===null||r===void 0?void 0:r.consecutiveHyphenLimit)!==void 0&&this.root.push(new Pr("w:consecutiveHyphenLimit",e.hyphenation.consecutiveHyphenLimit)),((i=e.hyphenation)===null||i===void 0?void 0:i.hyphenationZone)!==void 0&&this.root.push(new Pr("w:hyphenationZone",e.hyphenation.hyphenationZone)),((s=e.hyphenation)===null||s===void 0?void 0:s.doNotHyphenateCaps)!==void 0&&this.root.push(new I("w:doNotHyphenateCaps",e.hyphenation.doNotHyphenateCaps)),e.evenAndOddHeaders!==void 0&&this.root.push(new I("w:evenAndOddHeaders",e.evenAndOddHeaders)),e.updateFields!==void 0&&this.root.push(new I("w:updateFields",e.updateFields)),this.root.push(new BS(k(k({},(a=e.compatibility)!==null&&a!==void 0?a:{}),{},{version:(o=(c=(l=e.compatibility)===null||l===void 0?void 0:l.version)!==null&&c!==void 0?c:e.compatibilityModeVersion)!==null&&o!==void 0?o:15})))}},bf=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{val:"w:val"})}},GS=class extends P{constructor(e){super("w:name"),this.root.push(new bf({val:e}))}},zS=class extends P{constructor(e){super("w:uiPriority"),this.root.push(new bf({val:le(e)}))}},VS=class extends H{constructor(...e){super(...e),E(this,"xmlKeys",{type:"w:type",styleId:"w:styleId",default:"w:default",customStyle:"w:customStyle"})}},bc=class extends P{constructor(e,t){super("w:style"),this.root.push(new VS(e)),t.name&&this.root.push(new GS(t.name)),t.basedOn&&t.basedOn!==e.styleId&&this.root.push(new ot("w:basedOn",t.basedOn)),t.next&&this.root.push(new ot("w:next",t.next)),t.link&&this.root.push(new ot("w:link",t.link)),t.uiPriority!==void 0&&this.root.push(new zS(t.uiPriority)),t.semiHidden!==void 0&&this.root.push(new I("w:semiHidden",t.semiHidden)),t.unhideWhenUsed!==void 0&&this.root.push(new I("w:unhideWhenUsed",t.unhideWhenUsed)),t.quickFormat!==void 0&&this.root.push(new I("w:qFormat",t.quickFormat))}},Ct=class extends bc{constructor(e){super({type:"paragraph",styleId:e.id},e),E(this,"paragraphProperties",void 0),E(this,"runProperties",void 0),this.paragraphProperties=new Dn(e.paragraph,{implicitListParagraphStyle:!1,inListOrder:!1}),this.runProperties=new on(e.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties)}},ln=class extends bc{constructor(e){super({type:"character",styleId:e.id},k({uiPriority:99,unhideWhenUsed:!0},e)),E(this,"runProperties",void 0),this.runProperties=new on(e.run),this.root.push(this.runProperties)}},Wt=class extends Ct{constructor(e){super(k({basedOn:"Normal",next:"Normal",quickFormat:!0},e))}},XS=class extends Wt{constructor(e){super(k({id:"Title",name:"Title"},e))}},YS=class extends Wt{constructor(e){super(k({id:"Heading1",name:"Heading 1"},e))}},JS=class extends Wt{constructor(e){super(k({id:"Heading2",name:"Heading 2"},e))}},QS=class extends Wt{constructor(e){super(k({id:"Heading3",name:"Heading 3"},e))}},ZS=class extends Wt{constructor(e){super(k({id:"Heading4",name:"Heading 4"},e))}},eC=class extends Wt{constructor(e){super(k({id:"Heading5",name:"Heading 5"},e))}},tC=class extends Wt{constructor(e){super(k({id:"Heading6",name:"Heading 6"},e))}},nC=class extends Wt{constructor(e){super(k({id:"Strong",name:"Strong"},e))}},rC=class extends Ct{constructor(e){super(k({id:"ListParagraph",name:"List Paragraph",basedOn:"Normal",quickFormat:!0},e))}},iC=class extends Ct{constructor(e){super(k({id:"Caption",name:"caption",basedOn:"Normal",next:"Normal",uiPriority:35,semiHidden:!0,unhideWhenUsed:!0,quickFormat:!0,paragraph:{spacing:{after:200}},run:{italics:!0,color:{theme:"dark2"},size:18}},e))}},sC=class extends Ct{constructor(e){super(k({id:"Bibliography",name:"Bibliography",basedOn:"Normal",next:"Normal",uiPriority:37,unhideWhenUsed:!0},e))}},vf=new WeakSet,vh=e=>vf.has(e),xt=class extends Ct{constructor(e,t){super({id:`TOC${e}`,name:`toc ${e}`,basedOn:"Normal",next:"Normal",uiPriority:39,semiHidden:!0,unhideWhenUsed:!0,paragraph:k({spacing:{after:100}},e>1?{indent:{left:(e-1)*t}}:{})})}prepForXml(e){let t=super.prepForXml(e);return vf.add(t),t}},wf=class extends Ct{constructor(e){super(k({id:"FootnoteText",name:"footnote text",link:"FootnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:Mn.AUTO}},run:{size:20}},e))}},yf=class extends ln{constructor(e){super(k({id:"FootnoteReference",name:"footnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},e))}},xf=class extends ln{constructor(e){super(k({id:"FootnoteTextChar",name:"Footnote Text Char",basedOn:"DefaultParagraphFont",link:"FootnoteText",semiHidden:!0,run:{size:20}},e))}},kf=class extends Ct{constructor(e){super(k({id:"EndnoteText",name:"endnote text",link:"EndnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:Mn.AUTO}},run:{size:20}},e))}},Tf=class extends ln{constructor(e){super(k({id:"EndnoteReference",name:"endnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},e))}},Sf=class extends ln{constructor(e){super(k({id:"EndnoteTextChar",name:"Endnote Text Char",basedOn:"DefaultParagraphFont",link:"EndnoteText",semiHidden:!0,run:{size:20}},e))}},aC=class extends ln{constructor(e){super(k({id:"Hyperlink",name:"Hyperlink",basedOn:"DefaultParagraphFont",run:{color:"0563C1",underline:{type:wm.SINGLE}}},e))}},oC=class extends ln{constructor(e){super(k({id:"LineNumber",name:"line number",basedOn:"DefaultParagraphFont",semiHidden:!0},e))}},lC=class extends bc{constructor(){super({type:"table",styleId:"TableNormal",default:!0},{name:"Normal Table",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0}),this.root.push(new gc({indent:{size:0,type:Fe.DXA},cellMargin:{top:0,left:108,bottom:0,right:108}}))}},Or=e=>typeof e=="object"?Object.keys(e)[0]:void 0,vc=e=>{var t;return(t=[e["w:style"]].flat().find(n=>n._attr))===null||t===void 0?void 0:t._attr},wh=e=>{var t;return(t=vc(e))===null||t===void 0?void 0:t["w:styleId"]},yh=e=>{var t;let n=(t=[e["w:style"]].flat().find(r=>Or(r)==="w:name"))===null||t===void 0||(t=t["w:name"])===null||t===void 0||(t=t._attr)===null||t===void 0?void 0:t["w:val"];return n===void 0?void 0:String(n).toLowerCase()},Dl=e=>{var t,n;return Or(e)==="w:style"&&((t=(n=vc(e))===null||n===void 0?void 0:n["w:type"])!==null&&t!==void 0?t:"paragraph")==="paragraph"},cC=e=>{let t=Dl(e)?vc(e):void 0;return t?.["w:default"]!==void 0&&!["0","false","off"].includes(String(t["w:default"]))},dC=e=>({"w:style":[e["w:style"]].flat().map(t=>t._attr?{_attr:k(k({},t._attr),{},{"w:default":"1"})}:t)}),ul=class extends P{constructor(e){if(super("w:styles"),e.initialStyles&&this.root.push(e.initialStyles),e.importedStyles)for(let t of e.importedStyles)this.root.push(t);if(e.paragraphStyles)for(let t of e.paragraphStyles)this.root.push(new Ct(t));if(e.characterStyles)for(let t of e.characterStyles)this.root.push(new ln(t))}prepForXml(e){let t=super.prepForXml(e),n=t["w:styles"];if(!Array.isArray(n))return t;let r=l=>n.filter(u=>Or(u)===l),i=n.map(l=>Or(l)==="w:style"?wh(l):void 0),s=n.filter((l,u)=>!["_attr","w:docDefaults","w:latentStyles"].includes(Or(l))&&(i[u]===void 0||i.lastIndexOf(i[u])===u)),a=new Set(s.filter(l=>Dl(l)&&!vh(l)).map(yh)),o=s.filter(l=>!vh(l)||!a.has(yh(l))),c=o.some(cC)?o:o.map(l=>Dl(l)&&wh(l)==="Normal"?dC(l):l);return{"w:styles":[...r("_attr"),...r("w:docDefaults").slice(-1),...r("w:latentStyles").slice(-1),...c]}}},pC=class extends P{constructor(e){super("w:pPrDefault"),this.root.push(new Dn(e,{implicitListParagraphStyle:!1,inListOrder:!1}))}},uC=class extends P{constructor(e){super("w:rPrDefault"),this.root.push(new on(e))}},hC=class extends P{constructor(e){super("w:docDefaults"),E(this,"runPropertiesDefaults",void 0),E(this,"paragraphPropertiesDefaults",void 0),this.runPropertiesDefaults=new uC(e.run),this.paragraphPropertiesDefaults=new pC(e.paragraph),this.root.push(this.runPropertiesDefaults),this.root.push(this.paragraphPropertiesDefaults)}},mC=class{newInstance(e){let t=Wr(e),n;for(let i of t.elements||[])i.name==="w:styles"&&(n=i);if(n===void 0)throw new Error("can not find styles element");let r=n.elements||[];return{initialStyles:new mx(n.attributes),importedStyles:r.map(i=>ec(i))}}},fC=e=>{var t;let n=(t=e.document)===null||t===void 0||(t=t.run)===null||t===void 0?void 0:t.size;return n===void 0?200:Math.round(typeof n=="number"?n*10:qt(n))},gC=e=>({tableOfContents1:new xt(1,e),tableOfContents2:new xt(2,e),tableOfContents3:new xt(3,e),tableOfContents4:new xt(4,e),tableOfContents5:new xt(5,e),tableOfContents6:new xt(6,e),tableOfContents7:new xt(7,e),tableOfContents8:new xt(8,e),tableOfContents9:new xt(9,e)}),wc=(e={})=>{var t;return k(k({normal:new Ct({id:"Normal",name:"Normal",quickFormat:!0}),normalTable:new lC,document:new hC((t=e.document)!==null&&t!==void 0?t:{}),title:new XS(k({run:{size:56}},e.title)),heading1:new YS(k({run:{color:"2E74B5",size:32}},e.heading1)),heading2:new JS(k({run:{color:"2E74B5",size:26}},e.heading2)),heading3:new QS(k({run:{color:"1F4D78",size:24}},e.heading3)),heading4:new ZS(k({run:{color:"2E74B5",italics:!0}},e.heading4)),heading5:new eC(k({run:{color:"2E74B5"}},e.heading5)),heading6:new tC(k({run:{color:"1F4D78"}},e.heading6)),strong:new nC(k({run:{bold:!0}},e.strong)),listParagraph:new rC(e.listParagraph||{}),caption:new iC(e.caption||{}),bibliography:new sC(e.bibliography||{})},gC(fC(e))),{},{hyperlink:new aC(e.hyperlink||{}),footnoteReference:new yf(e.footnoteReference||{}),footnoteText:new wf(e.footnoteText||{}),footnoteTextChar:new xf(e.footnoteTextChar||{}),endnoteReference:new Tf(e.endnoteReference||{}),endnoteText:new kf(e.endnoteText||{}),endnoteTextChar:new Sf(e.endnoteTextChar||{}),lineNumber:new oC(e.lineNumber||{})})},xh=class{newInstance(e={}){return{initialStyles:new Qs(["mc","r","w","w14","w15"],"w14 w15"),importedStyles:Object.values(wc(e))}}},Cf={headings:{latin:"Calibri Light",panose:"020F0302020204030204"},body:{latin:"Calibri",panose:"020F0502020204030204"}},bC=[["Jpan","\u6E38\u30B4\u30B7\u30C3\u30AF Light","\u6E38\u660E\u671D"],["Hang","\uB9D1\uC740 \uACE0\uB515"],["Hans","\u7B49\u7EBF Light","\u7B49\u7EBF"],["Hant","\u65B0\u7D30\u660E\u9AD4"],["Arab","Times New Roman","Arial"],["Hebr","Times New Roman","Arial"],["Thai","Angsana New","Cordia New"],["Ethi","Nyala"],["Beng","Vrinda"],["Gujr","Shruti"],["Khmr","MoolBoran","DaunPenh"],["Knda","Tunga"],["Guru","Raavi"],["Cans","Euphemia"],["Cher","Plantagenet Cherokee"],["Yiii","Microsoft Yi Baiti"],["Tibt","Microsoft Himalaya"],["Thaa","MV Boli"],["Deva","Mangal"],["Telu","Gautami"],["Taml","Latha"],["Syrc","Estrangelo Edessa"],["Orya","Kalinga"],["Mlym","Kartika"],["Laoo","DokChampa"],["Sinh","Iskoola Pota"],["Mong","Mongolian Baiti"],["Viet","Times New Roman","Arial"],["Uigh","Microsoft Uighur"],["Geor","Sylfaen"],["Armn","Arial"],["Bugi","Leelawadee UI"],["Bopo","Microsoft JhengHei"],["Java","Javanese Text"],["Lisu","Segoe UI"],["Mymr","Myanmar Text"],["Nkoo","Ebrima"],["Olck","Nirmala UI"],["Osma","Ebrima"],["Phag","Phagspa"],["Syrn","Estrangelo Edessa"],["Syrj","Estrangelo Edessa"],["Syre","Estrangelo Edessa"],["Sora","Nirmala UI"],["Tale","Microsoft Tai Le"],["Talu","Microsoft New Tai Lue"],["Tfng","Ebrima"]],hl=(e,t,n)=>new L({name:e,attributes:{typeface:{key:"typeface",value:t},panose:{key:"panose",value:n}}}),vC=(e,t)=>{let n=t[e],r=typeof n=="string"?n:n?.latin;return r??Cf[e].latin},wC=(e,t={})=>{let n=bC.map(([i,s,a=s])=>{var o;return[i,(o=t[i])!==null&&o!==void 0?o:e==="headings"?s:a]}),r=new Set(n.map(([i])=>i));return[...n,...Object.entries(t).filter(([i])=>!r.has(i))]},kh=(e,t)=>{let n=t[e],{eastAsia:r="",complexScript:i="",scripts:s}=typeof n=="object"?n:{},a=vC(e,t),o=Cf[e];return new L({name:e==="headings"?"a:majorFont":"a:minorFont",children:[hl("a:latin",a,a===o.latin?o.panose:void 0),hl("a:ea",r),hl("a:cs",i),...wC(e,s).map(([c,l])=>new L({name:"a:font",attributes:{script:{key:"script",value:c},typeface:{key:"typeface",value:l}}}))]})},yC=(e,t={})=>new L({name:"a:fontScheme",attributes:{name:{key:"name",value:e}},children:[kh("headings",t),kh("body",t)]}),Ef=(e=[])=>new L({name:"a:schemeClr",attributes:{value:{key:"val",value:"phClr"}},children:e.map(([t,n])=>new L({name:`a:${t}`,attributes:{value:{key:"val",value:n}}}))}),Os=e=>new L({name:"a:solidFill",children:[Ef(e)]}),ml=e=>new L({name:"a:gradFill",attributes:{rotateWithShape:{key:"rotWithShape",value:!0}},children:[new L({name:"a:gsLst",children:e.map((t,n)=>new L({name:"a:gs",attributes:{position:{key:"pos",value:n*5e4}},children:[Ef(t)]}))}),new L({name:"a:lin",attributes:{angle:{key:"ang",value:54e5},scaled:{key:"scaled",value:!1}}})]}),fl=e=>new L({name:"a:ln",attributes:{width:{key:"w",value:e},cap:{key:"cap",value:"flat"},compound:{key:"cmpd",value:"sng"},alignment:{key:"algn",value:"ctr"}},children:[Os(),new L({name:"a:prstDash",attributes:{value:{key:"val",value:"solid"}}}),new L({name:"a:miter",attributes:{limit:{key:"lim",value:8e5}}})]}),gl=e=>new L({name:"a:effectStyle",children:[new L({name:"a:effectLst",children:e})]}),xC=()=>new L({name:"a:outerShdw",attributes:{blurRadius:{key:"blurRad",value:57150},distance:{key:"dist",value:19050},direction:{key:"dir",value:54e5},alignment:{key:"algn",value:"ctr"},rotateWithShape:{key:"rotWithShape",value:!1}},children:[new L({name:"a:srgbClr",attributes:{value:{key:"val",value:"000000"}},children:[new L({name:"a:alpha",attributes:{value:{key:"val",value:63e3}}})]})]}),kC=()=>new L({name:"a:fmtScheme",attributes:{name:{key:"name",value:"Office"}},children:[new L({name:"a:fillStyleLst",children:[Os(),ml([[["lumMod",11e4],["satMod",105e3],["tint",67e3]],[["lumMod",105e3],["satMod",103e3],["tint",73e3]],[["lumMod",105e3],["satMod",109e3],["tint",81e3]]]),ml([[["satMod",103e3],["lumMod",102e3],["tint",94e3]],[["satMod",11e4],["lumMod",1e5],["shade",1e5]],[["lumMod",99e3],["satMod",12e4],["shade",78e3]]])]}),new L({name:"a:lnStyleLst",children:[fl(6350),fl(12700),fl(19050)]}),new L({name:"a:effectStyleLst",children:[gl([]),gl([]),gl([xC()])]}),new L({name:"a:bgFillStyleLst",children:[Os(),Os([["tint",95e3],["satMod",17e4]]),ml([[["tint",93e3],["satMod",15e4],["shade",98e3],["lumMod",102e3]],[["tint",98e3],["satMod",13e4],["shade",9e4],["lumMod",103e3]],[["shade",63e3],["satMod",12e4]]])]})]}),TC=class extends P{constructor({name:e="Office Theme",colors:t,fonts:n}={}){super("a:theme"),E(this,"colors",void 0),this.colors=rc(t),this.root.push(new Jh({namespace:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"},name:{key:"name",value:e}})),this.root.push(new L({name:"a:themeElements",children:[Tx(t?e:"Office",t),yC(n?e:"Office",n),kC()]})),this.root.push(new L({name:"a:objectDefaults"})),this.root.push(new L({name:"a:extraClrSchemeLst"}))}get Colors(){return this.colors}},Qe=e=>{let t=e.lastIndexOf("/");return`${e.slice(0,t+1)}_rels/${e.slice(t+1)}.rels`},Af=e=>e.replace(/(^|\/)_rels\/([^/]*)\.rels$/,"$1$2"),_f=e=>e.slice(0,e.lastIndexOf("/")+1),cn=(e,t)=>{let n=t.replace(/\\/g,"/");return(n.startsWith("/")?n:`${_f(e)}${n}`).split("/").reduce((r,i)=>i===""||i==="."?r:i===".."?r.slice(0,-1):[...r,i],[]).join("/")},yc=(e,t)=>{let n=_f(e).split("/").filter(Boolean),r=t.split("/"),i=n.findIndex((a,o)=>o>=r.length-1||r[o]!==a),s=i===-1?n.length:i;return[...n.slice(s).map(()=>".."),...r.slice(s)].join("/")},SC=(e,t)=>e.toLowerCase()===t.toLowerCase(),oe=Uint8Array,Le=Uint16Array,xc=Int32Array,Zs=new oe([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ea=new oe([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Bl=new oe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Nf=function(e,t){for(var n=new Le(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new xc(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return{b:n,r:i}},Pf=Nf(Zs,2),If=Pf.b,$l=Pf.r;If[28]=258,$l[258]=28;Of=Nf(ea,0),CC=Of.b,Th=Of.r,Fl=new Le(32768);for(Y=0;Y<32768;++Y)kt=(Y&43690)>>1|(Y&21845)<<1,kt=(kt&52428)>>2|(kt&13107)<<2,kt=(kt&61680)>>4|(kt&3855)<<4,Fl[Y]=((kt&65280)>>8|(kt&255)<<8)>>1;lt=(function(e,t,n){for(var r=e.length,i=0,s=new Le(t);i<r;++i)e[i]&&++s[e[i]-1];var a=new Le(t);for(i=1;i<t;++i)a[i]=a[i-1]+s[i-1]<<1;var o;if(n){o=new Le(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=a[e[i]-1]++<<u,p=d|(1<<u)-1;d<=p;++d)o[Fl[d]>>c]=l}else for(o=new Le(r),i=0;i<r;++i)e[i]&&(o[i]=Fl[a[e[i]-1]++]>>15-e[i]);return o}),jt=new oe(288);for(Y=0;Y<144;++Y)jt[Y]=8;for(Y=144;Y<256;++Y)jt[Y]=9;for(Y=256;Y<280;++Y)jt[Y]=7;for(Y=280;Y<288;++Y)jt[Y]=8;qr=new oe(32);for(Y=0;Y<32;++Y)qr[Y]=5;EC=lt(jt,9,0),AC=lt(jt,9,1),_C=lt(qr,5,0),NC=lt(qr,5,1),bl=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ye=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},vl=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},kc=function(e){return(e+7)/8|0},Vr=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new oe(e.subarray(t,n))},PC=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ee=function(e,t,n){var r=new Error(t||PC[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Ee),!n)throw r;return r},IC=function(e,t,n,r){var i=e.length,s=r?r.length:0;if(!i||t.f&&!t.l)return n||new oe(0);var a=!n,o=a||t.i!=2,c=t.i;a&&(n=new oe(i*3));var l=function(ae){var te=n.length;if(ae>te){var Re=new oe(Math.max(te*2,ae));Re.set(n),n=Re}},u=t.f||0,d=t.p||0,p=t.b||0,h=t.l,f=t.d,m=t.m,g=t.n,y=i*8;do{if(!h){u=Ye(e,d,1);var T=Ye(e,d+1,3);if(d+=3,T)if(T==1)h=AC,f=NC,m=9,g=5;else if(T==2){var w=Ye(e,d,31)+257,x=Ye(e,d+10,15)+4,v=w+Ye(e,d+5,31)+1;d+=14;for(var A=new oe(v),N=new oe(19),M=0;M<x;++M)N[Bl[M]]=Ye(e,d+M*3,7);d+=x*3;for(var O=bl(N),F=(1<<O)-1,Q=lt(N,O,1),M=0;M<v;){var Z=Q[Ye(e,d,F)];d+=Z&15;var b=Z>>4;if(b<16)A[M++]=b;else{var V=0,G=0;for(b==16?(G=3+Ye(e,d,3),d+=2,V=A[M-1]):b==17?(G=3+Ye(e,d,7),d+=3):b==18&&(G=11+Ye(e,d,127),d+=7);G--;)A[M++]=V}}var de=A.subarray(0,w),ce=A.subarray(w);m=bl(de),g=bl(ce),h=lt(de,m,1),f=lt(ce,g,1)}else Ee(1);else{var b=kc(d)+4,C=e[b-4]|e[b-3]<<8,_=b+C;if(_>i){c&&Ee(0);break}o&&l(p+C),n.set(e.subarray(b,_),p),t.b=p+=C,t.p=d=_*8,t.f=u;continue}if(d>y){c&&Ee(0);break}}o&&l(p+131072);for(var _t=(1<<m)-1,Ae=(1<<g)-1,Ue=d;;Ue=d){var V=h[vl(e,d)&_t],we=V>>4;if(d+=V&15,d>y){c&&Ee(0);break}if(V||Ee(2),we<256)n[p++]=we;else if(we==256){Ue=d,h=null;break}else{var ye=we-254;if(we>264){var M=we-257,re=Zs[M];ye=Ye(e,d,(1<<re)-1)+If[M],d+=re}var D=f[vl(e,d)&Ae],$=D>>4;D||Ee(3),d+=D&15;var ce=CC[$];if($>3){var re=ea[$];ce+=vl(e,d)&(1<<re)-1,d+=re}if(d>y){c&&Ee(0);break}o&&l(p+131072);var q=p+ye;if(p<ce){var ie=s-ce,se=Math.min(ce,q);for(ie+p<0&&Ee(3);p<se;++p)n[p]=r[ie+p]}for(;p<q;++p)n[p]=n[p-ce]}}t.l=h,t.p=Ue,t.b=p,t.f=u,h&&(u=1,t.m=m,t.d=f,t.n=g)}while(!u);return p!=n.length&&a?Vr(n,0,p):n.subarray(0,p)},Tt=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},Sr=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},wl=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,s=n.slice();if(!i)return{t:Lf,l:0};if(i==1){var a=new oe(n[0].s+1);return a[n[0].s]=1,{t:a,l:1}}n.sort(function(_,w){return _.f-w.f}),n.push({s:-1,f:25001});var o=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:o.f+c.f,l:o,r:c};u!=i-1;)o=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:o.f+c.f,l:o,r:c};for(var p=s[0].s,r=1;r<i;++r)s[r].s>p&&(p=s[r].s);var h=new Le(p+1),f=ql(n[u-1],h,0);if(f>t){var r=0,m=0,g=f-t,y=1<<g;for(s.sort(function(w,x){return h[x.s]-h[w.s]||w.f-x.f});r<i;++r){var T=s[r].s;if(h[T]>t)m+=y-(1<<f-h[T]),h[T]=t;else break}for(m>>=g;m>0;){var b=s[r].s;h[b]<t?m-=1<<t-h[b]++-1:++r}for(;r>=0&&m;--r){var C=s[r].s;h[C]==t&&(--h[C],++m)}f=t}return{t:new oe(h),l:f}},ql=function(e,t,n){return e.s==-1?Math.max(ql(e.l,t,n+1),ql(e.r,t,n+1)):t[e.s]=n},Sh=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Le(++t),r=0,i=e[0],s=1,a=function(c){n[r++]=c},o=1;o<=t;++o)if(e[o]==i&&o!=t)++s;else{if(!i&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(i),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(i);s=1,i=e[o]}return{c:n.subarray(0,r),n:t}},Cr=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Rf=function(e,t,n){var r=n.length,i=kc(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var s=0;s<r;++s)e[i+s+4]=n[s];return(i+4+r)*8},Ch=function(e,t,n,r,i,s,a,o,c,l,u){Tt(t,u++,n),++i[256];for(var d=wl(i,15),p=d.t,h=d.l,f=wl(s,15),m=f.t,g=f.l,y=Sh(p),T=y.c,b=y.n,C=Sh(m),_=C.c,w=C.n,x=new Le(19),v=0;v<T.length;++v)++x[T[v]&31];for(var v=0;v<_.length;++v)++x[_[v]&31];for(var A=wl(x,7),N=A.t,M=A.l,O=19;O>4&&!N[Bl[O-1]];--O);var F=l+5<<3,Q=Cr(i,jt)+Cr(s,qr)+a,Z=Cr(i,p)+Cr(s,m)+a+14+3*O+Cr(x,N)+2*x[16]+3*x[17]+7*x[18];if(c>=0&&F<=Q&&F<=Z)return Rf(t,u,e.subarray(c,c+l));var V,G,de,ce;if(Tt(t,u,1+(Z<Q)),u+=2,Z<Q){V=lt(p,h,0),G=p,de=lt(m,g,0),ce=m;var _t=lt(N,M,0);Tt(t,u,b-257),Tt(t,u+5,w-1),Tt(t,u+10,O-4),u+=14;for(var v=0;v<O;++v)Tt(t,u+3*v,N[Bl[v]]);u+=3*O;for(var Ae=[T,_],Ue=0;Ue<2;++Ue)for(var we=Ae[Ue],v=0;v<we.length;++v){var ye=we[v]&31;Tt(t,u,_t[ye]),u+=N[ye],ye>15&&(Tt(t,u,we[v]>>5&127),u+=we[v]>>12)}}else V=EC,G=jt,de=_C,ce=qr;for(var v=0;v<o;++v){var re=r[v];if(re>255){var ye=re>>18&31;Sr(t,u,V[ye+257]),u+=G[ye+257],ye>7&&(Tt(t,u,re>>23&31),u+=Zs[ye]);var D=re&31;Sr(t,u,de[D]),u+=ce[D],D>3&&(Sr(t,u,re>>5&8191),u+=ea[D])}else Sr(t,u,V[re]),u+=G[re]}return Sr(t,u,V[256]),u+G[256]},OC=new xc([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Lf=new oe(0),RC=function(e,t,n,r,i,s){var a=s.z||e.length,o=new oe(r+a+5*(1+Math.ceil(a/7e3))+i),c=o.subarray(r,o.length-i),l=s.l,u=(s.r||0)&7;if(t){u&&(c[0]=s.r>>3);for(var d=OC[t-1],p=d>>13,h=d&8191,f=(1<<n)-1,m=s.p||new Le(32768),g=s.h||new Le(f+1),y=Math.ceil(n/3),T=2*y,b=function(Re){return(e[Re]^e[Re+1]<<y^e[Re+2]<<T)&f},C=new xc(25e3),_=new Le(288),w=new Le(32),x=0,v=0,A=s.i||0,N=0,M=s.w||0,O=0;A+2<a;++A){var F=b(A),Q=A&32767,Z=g[F];if(m[Q]=Z,g[F]=Q,M<=A){var V=a-A;if((x>7e3||N>24576)&&(V>423||!l)){u=Ch(e,c,0,C,_,w,v,N,O,A-O,u),N=x=v=0,O=A;for(var G=0;G<286;++G)_[G]=0;for(var G=0;G<30;++G)w[G]=0}var de=2,ce=0,_t=h,Ae=Q-Z&32767;if(V>2&&F==b(A-Ae))for(var Ue=Math.min(p,V)-1,we=Math.min(32767,A),ye=Math.min(258,V);Ae<=we&&--_t&&Q!=Z;){if(e[A+de]==e[A+de-Ae]){for(var re=0;re<ye&&e[A+re]==e[A+re-Ae];++re);if(re>de){if(de=re,ce=Ae,re>Ue)break;for(var D=Math.min(Ae,re-2),$=0,G=0;G<D;++G){var q=A-Ae+G&32767,ie=q-m[q]&32767;ie>$&&($=ie,Z=q)}}}Q=Z,Z=m[Q],Ae+=Q-Z&32767}if(ce){C[N++]=268435456|$l[de]<<18|Th[ce];var se=$l[de]&31,ae=Th[ce]&31;v+=Zs[se]+ea[ae],++_[257+se],++w[ae],M=A+de,++x}else C[N++]=e[A],++_[e[A]]}}for(A=Math.max(A,M);A<a;++A)C[N++]=e[A],++_[e[A]];u=Ch(e,c,l,C,_,w,v,N,O,A-O,u),l||(s.r=u&7|c[u/8|0]<<3,u-=7,s.h=g,s.p=m,s.i=A,s.w=M)}else{for(var A=s.w||0;A<a+l;A+=65535){var te=A+65535;te>=a&&(c[u/8|0]=l,te=a),u=Rf(c,u+1,e.subarray(A,te))}s.i=a}return Vr(o,0,r+kc(u)+i)},LC=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),MC=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=LC[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},DC=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),a=new oe(s.length+e.length);a.set(s),a.set(e,s.length),e=a,i.w=s.length}return RC(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},Mf=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},st=function(e,t){return e[t]|e[t+1]<<8},Be=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},yl=function(e,t){return Be(e,t)+Be(e,t+4)*4294967296},ke=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};Df=function(e,t,n,r){for(var i in e){var s=e[i],a=t+i,o=r;Array.isArray(s)&&(o=Mf(r,s[1]),s=s[0]),ArrayBuffer.isView(s)?n[a]=[s,o]:(n[a+="/"]=[new oe(0),o],Df(s,a,n,r))}},Eh=typeof TextEncoder<"u"&&new TextEncoder,Hl=typeof TextDecoder<"u"&&new TextDecoder;try{Hl.decode(Lf,{stream:!0})}catch{}FC=function(e){for(var t="",n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:Vr(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};HC=function(e,t){return t+30+st(e,t+26)+st(e,t+28)},UC=function(e,t,n){var r=st(e,t+28),i=st(e,t+30),s=qC(e.subarray(t+46,t+46+r),!(st(e,t+8)&2048)),a=t+46+r,o=jC(e,a,i,n,Be(e,t+20),Be(e,t+24),Be(e,t+42)),c=o[0],l=o[1],u=o[2];return[st(e,t+10),c,l,s,a+i+st(e,t+32),u]},jC=function(e,t,n,r,i,s,a){var o=i==4294967295,c=s==4294967295,l=a==4294967295,u=t+n,d=o+c+l;if(r&&d){for(;t+4<u;t+=4+st(e,t+2))if(st(e,t)==1)return[o?yl(e,t+4+8*c):i,c?yl(e,t+4):s,l?yl(e,t+4+8*(c+o)):a,1];r<2&&Ee(13)}return[i,s,a,0]},Ul=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&Ee(9),t+=r+4}return t},_h=function(e,t,n,r,i,s,a,o){var c=r.length,l=n.extra,u=o&&o.length,d=Ul(l);ke(e,t,a!=null?33639248:67324752),t+=4,a!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(s<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var p=new Date(n.mtime==null?Date.now():n.mtime),h=p.getFullYear()-1980;if((h<0||h>119)&&Ee(10),ke(e,t,h<<25|p.getMonth()+1<<21|p.getDate()<<16|p.getHours()<<11|p.getMinutes()<<5|p.getSeconds()>>1),t+=4,s!=-1&&(ke(e,t,n.crc),ke(e,t+4,s<0?-s-2:s),ke(e,t+8,n.size)),ke(e,t+12,c),ke(e,t+14,d),t+=16,a!=null&&(ke(e,t,u),ke(e,t+6,n.attrs),ke(e,t+10,a),t+=14),e.set(r,t),t+=c,d)for(var f in l){var m=l[f],g=m.length;ke(e,t,+f),ke(e,t+2,g),e.set(m,t+4),t+=4+g}return u&&(e.set(o,t),t+=u),t},WC=function(e,t,n,r,i){ke(e,t,101010256),ke(e,t+8,n),ke(e,t+10,n),ke(e,t+12,r),ke(e,t+16,i)};zC=e=>typeof e=="string"?ck(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),qs=e=>KC(Object.fromEntries([...e].map(([t,n])=>[t,zC(n)]))),VC=1032,Nh=e=>new Error(`Corrupted zip: ${e} isn't the size the zip file gives it`),Bf=(e,t=()=>!0)=>{let n=new Map,r=0,i=GC(e,{filter:({name:a,size:o,originalSize:c})=>{if(a.endsWith("/")||!t(a))return!1;if(r+=o,r>e.length||c>o*VC)throw Nh(a);return n.set(a,c),!0}}),s=Object.entries(i).find(([a,o])=>o.length!==n.get(a));if(s!==void 0)throw Nh(s[0]);return new Map(Object.entries(i))},xl=e=>{let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t},Rs=e=>new Error(`${e} is not supported by this platform`),Ph={uint8array:e=>e,arraybuffer:e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),array:e=>Array.from(e),string:xl,binarystring:xl,base64:e=>btoa(xl(e)),blob:(e,t)=>{if(typeof Blob>"u")throw Rs("blob");return new Blob([e],{type:t})},nodebuffer:e=>{if(typeof Buffer>"u")throw Rs("nodebuffer");return Buffer.from(e.buffer,e.byteOffset,e.byteLength)},text:()=>{throw Rs("text")}},jl=(e,t,n)=>{let r=Object.prototype.hasOwnProperty.call(Ph,t.toLowerCase())?Ph[t.toLowerCase()]:void 0;if(r===void 0)throw Rs(t);return r(e,n)},XC=new Map([["dk1","dark1"],["lt1","light1"],["dk2","dark2"],["lt2","light2"],["accent1","accent1"],["accent2","accent2"],["accent3","accent3"],["accent4","accent4"],["accent5","accent5"],["accent6","accent6"],["hlink","hyperlink"],["folHlink","followedHyperlink"]]),YC=new Map([["dark1","windowText"],["light1","window"]]),JC=new Set(["http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme","http://purl.oclc.org/ooxml/officeDocument/relationships/theme"]),Hr=e=>{var t,n;return(t=e==null||(n=e.name)===null||n===void 0?void 0:n.slice(e.name.indexOf(":")+1))!==null&&t!==void 0?t:""},Xr=e=>{var t,n;return(t=e==null||(n=e.elements)===null||n===void 0?void 0:n.filter(r=>r.type==="element"))!==null&&t!==void 0?t:[]},Wl=(e,t)=>Xr(e).find(n=>Hr(n)===t),Rr=(e,t)=>{var n;let r=e==null||(n=e.attributes)===null||n===void 0?void 0:n[t];return r===void 0?void 0:String(r)},QC=e=>new TextDecoder(e[0]===255&&e[1]===254?"utf-16le":e[0]===254&&e[1]===255?"utf-16be":"utf-8").decode(e),ZC=(e,t,n)=>{let r=e.get(Qe(t)),i=Rr(r&&Xr(Wl(Wr(QC(r)),"Relationships")).find(s=>{var a;return n.has((a=Rr(s,"Type"))!==null&&a!==void 0?a:"")}),"Target");return i===void 0?void 0:cn(t,i)},eE=(e,t)=>ZC(e,t,JC),tE=(e,t,n)=>{let[r]=Xr(t),i=Hr(r)==="srgbClr"?Rr(r,"val"):Hr(r)==="sysClr"&&(n||Rr(r,"val")!==YC.get(e))?Rr(r,"lastClr"):void 0;return i!==void 0&&/^[0-9A-Fa-f]{6}$/.test(i)?i.toUpperCase():void 0},nE=(e,t=!1)=>Object.fromEntries(Xr(e).flatMap(n=>{let r=XC.get(Hr(n)),i=r&&tE(r,n,t);return r&&i?[[r,i]]:[]})),rE=e=>{let[t]=Xr(Wr(e)),n=Hr(t)==="theme"?Wl(Wl(t,"themeElements"),"clrScheme"):void 0;return n?nE(n,!0):{}},iE=[208,207,17,224,161,177,26,225],$f=class{constructor(e){var t,n,r,i,s,a,o,c,l,u,d,p,h,f;if(E(this,"currentRelationshipId",1),E(this,"documentWrapper",void 0),E(this,"headers",[]),E(this,"footers",[]),E(this,"coreProperties",void 0),E(this,"numbering",void 0),E(this,"media",void 0),E(this,"fileRelationships",void 0),E(this,"footnotesWrapper",void 0),E(this,"endnotesWrapper",void 0),E(this,"settings",void 0),E(this,"contentTypes",void 0),E(this,"customProperties",void 0),E(this,"appProperties",void 0),E(this,"styles",void 0),E(this,"comments",void 0),E(this,"commentsExtended",void 0),E(this,"commentsIds",void 0),E(this,"fontWrapper",void 0),E(this,"theme",void 0),E(this,"packageParts",void 0),E(this,"macros",void 0),E(this,"bibliography",void 0),e.macros!==void 0){let{project:b,events:C=[]}=e.macros,_=b instanceof Uint8Array?b:new Uint8Array(b);if(!iE.every((x,v)=>_[v]===x))throw new Error("macros.project isn't a VBA project. Use createMacros from docx/macros, or the word/vbaProject.bin in a .docm rather than the .docm itself");let w=new be;C.length>0&&w.addRelationship(1,"http://schemas.microsoft.com/office/2006/relationships/wordVbaData","vbaData.xml"),this.macros={project:_,events:C.length>0?ZT(C):void 0,relationships:w}}if(this.coreProperties=new WT(k(k({},e),{},{creator:(t=e.creator)!==null&&t!==void 0?t:"Un-named",revision:(n=e.revision)!==null&&n!==void 0?n:1,lastModifiedBy:(r=e.lastModifiedBy)!==null&&r!==void 0?r:"Un-named"})),this.numbering=new ff(e.numbering?e.numbering:{config:[]}),this.comments=new u1((i=e.comments)!==null&&i!==void 0?i:{children:[]}),this.comments.ThreadData&&(this.commentsExtended=new g1(this.comments.ThreadData)),this.comments.CommentIdsData&&(this.commentsIds=new y1(this.comments.CommentIdsData)),this.fileRelationships=new be,this.customProperties=new YT((s=e.customProperties)!==null&&s!==void 0?s:[]),this.appProperties=new HT,this.footnotesWrapper=new mS,this.endnotesWrapper=new oS,this.contentTypes=new jT({macros:this.macros!==void 0}),((a=this.macros)===null||a===void 0?void 0:a.events)!==void 0&&this.contentTypes.addOverride("application/vnd.ms-word.vbaData+xml","/word/vbaData.xml"),e.bibliography!==void 0){let b=new be;b.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps","itemProps1.xml"),this.bibliography={sources:e.bibliography.sources,properties:JT(`{${bm().toUpperCase()}}`),relationships:b},this.contentTypes.addOverride("application/vnd.openxmlformats-officedocument.customXmlProperties+xml","/customXml/itemProps1.xml")}if(this.packageParts=new gf(this.contentTypes),this.documentWrapper=new nS({background:e.background,pageNumbers:e.pageNumbers}),this.settings=new KS({compatibilityModeVersion:e.compatabilityModeVersion,compatibility:e.compatibility,evenAndOddHeaders:!!e.evenAndOddHeaderAndFooters,trackRevisions:(o=e.features)===null||o===void 0?void 0:o.trackRevisions,updateFields:(c=e.features)===null||c===void 0?void 0:c.updateFields,embedFonts:!((l=e.fonts)===null||l===void 0)&&l.length?!0:void 0,defaultTabStop:e.defaultTabStop,protection:e.protection,hyphenation:{autoHyphenation:(u=e.hyphenation)===null||u===void 0?void 0:u.autoHyphenation,hyphenationZone:(d=e.hyphenation)===null||d===void 0?void 0:d.hyphenationZone,consecutiveHyphenLimit:(p=e.hyphenation)===null||p===void 0?void 0:p.consecutiveHyphenLimit,doNotHyphenateCaps:(h=e.hyphenation)===null||h===void 0?void 0:h.doNotHyphenateCaps}}),this.media=new mf(b=>this.packageParts.takePath("media","image",b)),e.externalStyles!==void 0){var m,g,y,T;let b=(m=(g=e.styles)===null||g===void 0?void 0:g.default)!==null&&m!==void 0?m:{},C=Object.entries(wc(b)),_=([x])=>b[x]!==void 0,w=new mC().newInstance(e.externalStyles);this.styles=new ul(k(k({},w),{},{paragraphStyles:(y=e.styles)===null||y===void 0?void 0:y.paragraphStyles,characterStyles:(T=e.styles)===null||T===void 0?void 0:T.characterStyles,importedStyles:[...C.filter(x=>!_(x)).map(([,x])=>x),...w.importedStyles,...C.filter(_).map(([,x])=>x)]}))}else if(e.styles){let b=new xh().newInstance(e.styles.default);this.styles=new ul(k(k({},b),e.styles))}else{let b=new xh;this.styles=new ul(b.newInstance())}this.addDefaultRelationships();for(let b of e.sections)this.addSection(b);if(e.footnotes)for(let b in e.footnotes)this.footnotesWrapper.View.createFootNote(parseFloat(b),e.footnotes[b].children);if(e.endnotes)for(let b in e.endnotes)this.endnotesWrapper.View.createEndnote(parseFloat(b),e.endnotes[b].children);this.fontWrapper=new Km((f=e.fonts)!==null&&f!==void 0?f:[]),this.theme=new TC(e.theme),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme","theme/theme1.xml"),this.macros!==void 0&&this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2006/relationships/vbaProject","vbaProject.bin"),this.bibliography!==void 0&&this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml","../customXml/item1.xml")}addSection({headers:e={},footers:t={},children:n,properties:r}){this.documentWrapper.View.Body.addSection(k(k({},r),{},{headerWrapperGroup:{default:e.default?this.createHeader(e.default):void 0,first:e.first?this.createHeader(e.first):void 0,even:e.even?this.createHeader(e.even):void 0},footerWrapperGroup:{default:t.default?this.createFooter(t.default):void 0,first:t.first?this.createFooter(t.first):void 0,even:t.even?this.createFooter(t.even):void 0}}));for(let i of n)this.documentWrapper.View.add(i)}createHeader(e){let t=new bS(this.media,this.currentRelationshipId++);for(let n of e.options.children)t.add(n);return this.addHeaderToDocument(t),t}createFooter(e){let t=new dS(this.media,this.currentRelationshipId++);for(let n of e.options.children)t.add(n);return this.addFooterToDocument(t),t}addHeaderToDocument(e,t=Ln.DEFAULT){this.headers.push({header:e,type:t}),this.documentWrapper.Relationships.addRelationship(e.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",`header${this.headers.length}.xml`),this.contentTypes.addHeader(this.headers.length)}addFooterToDocument(e,t=Ln.DEFAULT){this.footers.push({footer:e,type:t}),this.documentWrapper.Relationships.addRelationship(e.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",`footer${this.footers.length}.xml`),this.contentTypes.addFooter(this.footers.length)}addDefaultRelationships(){this.fileRelationships.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","word/document.xml"),this.fileRelationships.addRelationship(2,"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"),this.fileRelationships.addRelationship(3,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties","docProps/app.xml"),this.fileRelationships.addRelationship(4,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties","docProps/custom.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles","styles.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering","numbering.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","footnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes","endnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings","settings.xml"),this.comments.IsEmpty||(this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments","comments.xml"),this.contentTypes.addComments()),this.commentsExtended&&(this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2011/relationships/commentsExtended","commentsExtended.xml"),this.contentTypes.addCommentsExtended()),this.commentsIds&&(this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds","commentsIds.xml"),this.contentTypes.addCommentsIds())}get Document(){return this.documentWrapper}get Styles(){return this.styles}get CoreProperties(){return this.coreProperties}get Numbering(){return this.numbering}get Media(){return this.media}get FileRelationships(){return this.fileRelationships}get Headers(){return this.headers.map(e=>e.header)}get Footers(){return this.footers.map(e=>e.footer)}get ContentTypes(){return this.contentTypes}get CustomProperties(){return this.customProperties}get AppProperties(){return this.appProperties}get FootNotes(){return this.footnotesWrapper}get Endnotes(){return this.endnotesWrapper}get Settings(){return this.settings}get Comments(){return this.comments}get CommentsExtended(){return this.commentsExtended}get CommentsIds(){return this.commentsIds}get FontTable(){return this.fontWrapper}get Theme(){return this.theme}get PackageParts(){return this.packageParts}get Macros(){return this.macros}get Bibliography(){return this.bibliography}},sE=class extends P{constructor(e){super("w:sdtPr"),e&&this.root.push(new ot("w:alias",e))}},aE=e=>new L({name:"w:docPartObj",children:[new ot("w:docPartGallery",e),new L({name:"w:docPartUnique"})]}),oE=["contentChildren","cachedEntries","beginDirty","tabLeader"],Ff=class extends hc{constructor(e="Table of Contents",t={}){let{contentChildren:n=[],cachedEntries:r=[],beginDirty:i,tabLeader:s=E1.DOT}=t,a=Zl(t,oE);super("w:sdt"),E(this,"fromHeadings",void 0);let o=new sE(e);o.addChildElement(aE("Table of Contents")),this.root.push(o);let c=new _m,l=[new qe({children:[Nm(i),new Am(a),sn()]})],u=[new qe({children:[an()]})];if(r!==void 0&&r.length>0){let{stylesWithLevels:d}=a,p=r.map((f,m)=>{var g,y;let T=this.buildCachedContentParagraphChild(f,a),b=(g=d==null||(y=d.find(_=>_.level===f.level))===null||y===void 0?void 0:y.styleName)!==null&&g!==void 0?g:`TOC${f.level}`,C=m===0?[...l,T]:m===r.length-1?[T,...u]:[T];return new ne({style:b,tabStops:this.getTabStopsForLevel(f.level,s),children:C})}),h=p;r.length<=1&&(h=[...p,new ne({children:u})]);for(let f of h)c.addChildElement(f)}else{let d=new ne({children:l});c.addChildElement(d);for(let h of n)c.addChildElement(h);let p=new ne({children:u});c.addChildElement(p),n.length===0&&(this.fromHeadings={properties:a,beginDirty:i,tabLeader:s})}this.root.push(c)}prepForXml(e){let t=super.prepForXml(e);return $k(t,this.fromHeadings&&k(k({},this.fromHeadings),{},{textWidth:this.textWidthIn(e)})),t}textWidthIn(e){var t,n;return(t=(n=e.file)===null||n===void 0||(n=n.Document)===null||n===void 0||(n=n.View.Body.getSectionPropertiesFor(this))===null||n===void 0?void 0:n.AvailableTextWidth)!==null&&t!==void 0?t:Ps}getTabStopsForLevel(e,t,n=9025){return[{type:"clear",position:n+1-(e-1)*240},{type:"right",position:n,leader:t}]}buildCachedContentRun(e,t){var n,r;return new qe({style:t?.hyperlink&&e.href!==void 0?"IndexLink":void 0,children:[new Dr({text:e.title}),new Xs,new Dr({text:(n=(r=e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""})]})}buildCachedContentParagraphChild(e,t){let n=this.buildCachedContentRun(e,t);return t?.hyperlink&&e.href!==void 0?new Fm({anchor:e.href,children:[n]}):n}},Er=0,kl=32,lE=32,cE=(e,t)=>{let n=t.replace(/-/g,"");if(n.length!==lE)throw new Error(`Error: Cannot extract GUID from font filename: ${t}`);let r=n.replace(/(..)/g,"$1 ").trim().split(" ").map(a=>parseInt(a,16));r.reverse();let i=e.slice(Er,kl).map((a,o)=>a^r[o%r.length]),s=new Uint8Array(Er+i.length+Math.max(0,e.length-kl));return s.set(e.slice(0,Er)),s.set(i,Er),s.set(e.slice(kl),Er+i.length),s},dn=class{format(e,t={stack:[]}){let n=e.prepForXml(t);if(n)return n;throw Error("XMLComponent did not format correctly")}},qf=/\{([^{}]+)\}/g,Hf=(e,t)=>t.size===0?e:e.replace(qf,(n,r)=>{var i;return(i=t.get(r))!==null&&i!==void 0?i:n}),dE=e=>new Set(Array.from(e.matchAll(qf),([,t])=>t)),Uf=class{replace(e,t,n){return Hf(e,new Map(t.map((r,i)=>[r.key,(n+i).toString()])))}getMediaData(e,t){let n=dE(e);return t.Entries.filter(([r])=>n.has(r)).map(([r,{fileName:i}])=>({key:r,fileName:i}))}},pE=class{replace(e,t){return Hf(e,new Map(t.map(({reference:n,instance:r,restartedListId:i,numId:s})=>[Bs(n,r,i),s.toString()])))}},uE=new dn,Tl=(e,t,n,r,i=!0)=>j(uE.format(t,{viewWrapper:{View:t,Relationships:r},file:e,stack:[]}),{indent:n,declaration:i?{standalone:"yes",encoding:"UTF-8"}:{encoding:"UTF-8"}}),hE=(e,t,n,r)=>{let{content:i}=t.options;if(i instanceof Uint8Array)return[{data:i,path:`word/${n}`}];if("files"in i)return[{data:qs(i.files.map(({path:l,content:u})=>[l,u instanceof Uint8Array?u:Tl(e,u,r,new be)])),path:`word/${n}`}];let s=e.PackageParts.createRelationships(n),a=Tl(e,i,r,s),o=n.slice(0,n.lastIndexOf("/")),c=n.slice(n.lastIndexOf("/")+1);return[{data:a,path:`word/${n}`},...s.RelationshipCount>0?[{data:Tl(e,s,r,s,!1),path:`word/${o}/_rels/${c}.rels`}]:[]]},Tc=(e,t,n=0)=>{let r=e.PackageParts.Array.slice(n);return r.length===0?[]:[...r.flatMap(({part:i,path:s})=>hE(e,i,s,t)),...Tc(e,t,n+r.length)]},mE=["PackageParts"],fE=class{constructor(){E(this,"formatter",void 0),E(this,"imageReplacer",void 0),E(this,"numberingReplacer",void 0),this.formatter=new dn,this.imageReplacer=new Uf,this.numberingReplacer=new pE}compile(e,t,n=[]){let r=this.xmlifyFile(e,t),{PackageParts:i}=r,s=Zl(r,mE),a=Object.values(s).flatMap(o=>Array.isArray(o)?o:[o]);return new Map([...a.map(({path:o,data:c})=>[o,c]),...i.map(({path:o,data:c})=>[o,c]),...n.map(({path:o,data:c})=>[o,c]),...e.Macros===void 0?[]:[["word/vbaProject.bin",e.Macros.project]],...e.Media.Array.map(o=>[`word/media/${o.fileName}`,o.data]),...e.FontTable.files.map(({data:o,fontKey:c},l)=>[`word/fonts/font${l+1}.odttf`,cE(o,c)])])}xmlifyFile(e,t){var n;let r=j(this.formatter.format(e.Document.View,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),i=j(this.formatter.format(e.Comments,{viewWrapper:{View:e.Comments,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),s=j(this.formatter.format(e.FootNotes.View,{viewWrapper:e.FootNotes,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),a=j(this.formatter.format(e.Endnotes.View,{viewWrapper:e.Endnotes,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),o=e.Document.Relationships.RelationshipCount+1,c=e.Comments.Relationships.RelationshipCount+1,l=e.FootNotes.Relationships.RelationshipCount+1,u=e.Endnotes.Relationships.RelationshipCount+1,d=this.imageReplacer.getMediaData(r,e.Media),p=this.imageReplacer.getMediaData(i,e.Media),h=this.imageReplacer.getMediaData(s,e.Media),f=this.imageReplacer.getMediaData(a,e.Media);return k(k(k(k(k(k({Relationships:{data:(()=>{let m=be.copy(e.Document.Relationships);return d.forEach((g,y)=>{m.addRelationship(o+y,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${g.fileName}`)}),m.addRelationship(m.RelationshipCount+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable","fontTable.xml"),j(this.formatter.format(m,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/document.xml.rels"},Document:{data:(()=>{let m=this.imageReplacer.replace(r,d,o);return this.numberingReplacer.replace(m,e.Numbering.ConcreteNumbering)})(),path:"word/document.xml"},Styles:{data:(()=>{let m=j(this.formatter.format(e.Styles,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}});return this.numberingReplacer.replace(m,e.Numbering.ConcreteNumbering)})(),path:"word/styles.xml"},Properties:{data:j(this.formatter.format(e.CoreProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/core.xml"},FileRelationships:{data:j(this.formatter.format(e.FileRelationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"_rels/.rels"},HeaderRelationships:e.Headers.map((m,g)=>{let y=j(this.formatter.format(m.View,{viewWrapper:m,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),T=this.imageReplacer.getMediaData(y,e.Media),b=be.copy(m.Relationships);return T.forEach((C,_)=>{b.addRelationship(_,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${C.fileName}`)}),{data:j(this.formatter.format(b,{viewWrapper:m,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:`word/_rels/header${g+1}.xml.rels`}}),FooterRelationships:e.Footers.map((m,g)=>{let y=j(this.formatter.format(m.View,{viewWrapper:m,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),T=this.imageReplacer.getMediaData(y,e.Media),b=be.copy(m.Relationships);return T.forEach((C,_)=>{b.addRelationship(_,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${C.fileName}`)}),{data:j(this.formatter.format(b,{viewWrapper:m,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:`word/_rels/footer${g+1}.xml.rels`}}),Headers:e.Headers.map((m,g)=>{let y=j(this.formatter.format(m.View,{viewWrapper:m,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),T=this.imageReplacer.getMediaData(y,e.Media),b=this.imageReplacer.replace(y,T,0);return{data:this.numberingReplacer.replace(b,e.Numbering.ConcreteNumbering),path:`word/header${g+1}.xml`}}),Footers:e.Footers.map((m,g)=>{let y=j(this.formatter.format(m.View,{viewWrapper:m,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),T=this.imageReplacer.getMediaData(y,e.Media),b=this.imageReplacer.replace(y,T,0);return{data:this.numberingReplacer.replace(b,e.Numbering.ConcreteNumbering),path:`word/footer${g+1}.xml`}}),CustomProperties:{data:j(this.formatter.format(e.CustomProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/custom.xml"},AppProperties:{data:j(this.formatter.format(e.AppProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/app.xml"},FootNotes:{data:(()=>{let m=this.imageReplacer.replace(s,h,l);return this.numberingReplacer.replace(m,e.Numbering.ConcreteNumbering)})(),path:"word/footnotes.xml"},FootNotesRelationships:{data:(()=>{let m=be.copy(e.FootNotes.Relationships);return h.forEach((g,y)=>{m.addRelationship(l+y,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${g.fileName}`)}),j(this.formatter.format(m,{viewWrapper:e.FootNotes,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/footnotes.xml.rels"},Endnotes:{data:(()=>{let m=this.imageReplacer.replace(a,f,u);return this.numberingReplacer.replace(m,e.Numbering.ConcreteNumbering)})(),path:"word/endnotes.xml"},EndnotesRelationships:{data:(()=>{let m=be.copy(e.Endnotes.Relationships);return f.forEach((g,y)=>{m.addRelationship(u+y,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${g.fileName}`)}),j(this.formatter.format(m,{viewWrapper:e.Endnotes,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/endnotes.xml.rels"},Settings:{data:j(this.formatter.format(e.Settings,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/settings.xml"}},e.Comments.IsEmpty?{}:{Comments:{data:(()=>{let m=this.imageReplacer.replace(i,p,c);return this.numberingReplacer.replace(m,e.Numbering.ConcreteNumbering)})(),path:"word/comments.xml"},CommentsRelationships:{data:(()=>{let m=be.copy(e.Comments.Relationships);return p.forEach((g,y)=>{m.addRelationship(c+y,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${g.fileName}`)}),j(this.formatter.format(m,{viewWrapper:{View:e.Comments,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/comments.xml.rels"}}),e.CommentsExtended?{CommentsExtended:{data:j(this.formatter.format(e.CommentsExtended,{viewWrapper:{View:e.CommentsExtended,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsExtended.xml"}}:{}),e.CommentsIds?{CommentsIds:{data:j(this.formatter.format(e.CommentsIds,{viewWrapper:{View:e.CommentsIds,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsIds.xml"}}:{}),{},{FontTable:{data:j(this.formatter.format(e.FontTable.View,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/fontTable.xml"},FontTableRelationships:{data:j(this.formatter.format(e.FontTable.Relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"word/_rels/fontTable.xml.rels"},Theme:{data:j(this.formatter.format(e.Theme,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/theme/theme1.xml"}},!((n=e.Macros)===null||n===void 0)&&n.events?{MacroEvents:{data:j(this.formatter.format(e.Macros.events,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/vbaData.xml"},MacroRelationships:{data:j(this.formatter.format(e.Macros.relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"word/_rels/vbaProject.bin.rels"}}:{}),e.Bibliography?{BibliographySources:{data:j(this.formatter.format(e.Bibliography.sources,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"customXml/item1.xml"},BibliographySourcesProperties:{data:j(this.formatter.format(e.Bibliography.properties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"no",encoding:"UTF-8"}}),path:"customXml/itemProps1.xml"},BibliographySourcesRelationships:{data:j(this.formatter.format(e.Bibliography.relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"customXml/_rels/item1.xml.rels"}}:{}),{},{PackageParts:Tc(e,t),Numbering:{data:j(this.formatter.format(e.Numbering,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/numbering.xml"},ContentTypes:{data:j(this.formatter.format(e.ContentTypes,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"[Content_Types].xml"}})}},Ih=Zy(((e,t)=>{var n=typeof Reflect=="object"?Reflect:null,r=n&&typeof n.apply=="function"?n.apply:function(x,v,A){return Function.prototype.apply.call(x,v,A)},i;n&&typeof n.ownKeys=="function"?i=n.ownKeys:Object.getOwnPropertySymbols?i=function(x){return Object.getOwnPropertyNames(x).concat(Object.getOwnPropertySymbols(x))}:i=function(x){return Object.getOwnPropertyNames(x)};function s(w){console&&console.warn&&console.warn(w)}var a=Number.isNaN||function(x){return x!==x};function o(){o.init.call(this)}t.exports=o,t.exports.once=b,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var c=10;function l(w){if(typeof w!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof w)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(w){if(typeof w!="number"||w<0||a(w))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+w+".");c=w}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(x){if(typeof x!="number"||x<0||a(x))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+x+".");return this._maxListeners=x,this};function u(w){return w._maxListeners===void 0?o.defaultMaxListeners:w._maxListeners}o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(x){for(var v=[],A=1;A<arguments.length;A++)v.push(arguments[A]);var N=x==="error",M=this._events;if(M!==void 0)N=N&&M.error===void 0;else if(!N)return!1;if(N){var O;if(v.length>0&&(O=v[0]),O instanceof Error)throw O;var F=new Error("Unhandled error."+(O?" ("+O.message+")":""));throw F.context=O,F}var Q=M[x];if(Q===void 0)return!1;if(typeof Q=="function")r(Q,this,v);else for(var Z=Q.length,V=g(Q,Z),A=0;A<Z;++A)r(V[A],this,v);return!0};function d(w,x,v,A){var N,M,O;if(l(v),M=w._events,M===void 0?(M=w._events=Object.create(null),w._eventsCount=0):(M.newListener!==void 0&&(w.emit("newListener",x,v.listener?v.listener:v),M=w._events),O=M[x]),O===void 0)O=M[x]=v,++w._eventsCount;else if(typeof O=="function"?O=M[x]=A?[v,O]:[O,v]:A?O.unshift(v):O.push(v),N=u(w),N>0&&O.length>N&&!O.warned){O.warned=!0;var F=new Error("Possible EventEmitter memory leak detected. "+O.length+" "+String(x)+" listeners added. Use emitter.setMaxListeners() to increase limit");F.name="MaxListenersExceededWarning",F.emitter=w,F.type=x,F.count=O.length,s(F)}return w}o.prototype.addListener=function(x,v){return d(this,x,v,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(x,v){return d(this,x,v,!0)};function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(w,x,v){var A={fired:!1,wrapFn:void 0,target:w,type:x,listener:v},N=p.bind(A);return N.listener=v,A.wrapFn=N,N}o.prototype.once=function(x,v){return l(v),this.on(x,h(this,x,v)),this},o.prototype.prependOnceListener=function(x,v){return l(v),this.prependListener(x,h(this,x,v)),this},o.prototype.removeListener=function(x,v){var A,N,M,O,F;if(l(v),N=this._events,N===void 0)return this;if(A=N[x],A===void 0)return this;if(A===v||A.listener===v)--this._eventsCount===0?this._events=Object.create(null):(delete N[x],N.removeListener&&this.emit("removeListener",x,A.listener||v));else if(typeof A!="function"){for(M=-1,O=A.length-1;O>=0;O--)if(A[O]===v||A[O].listener===v){F=A[O].listener,M=O;break}if(M<0)return this;M===0?A.shift():y(A,M),A.length===1&&(N[x]=A[0]),N.removeListener!==void 0&&this.emit("removeListener",x,F||v)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(x){var v,A=this._events,N;if(A===void 0)return this;if(A.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):A[x]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete A[x]),this;if(arguments.length===0){var M=Object.keys(A),O;for(N=0;N<M.length;++N)O=M[N],O!=="removeListener"&&this.removeAllListeners(O);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(v=A[x],typeof v=="function")this.removeListener(x,v);else if(v!==void 0)for(N=v.length-1;N>=0;N--)this.removeListener(x,v[N]);return this};function f(w,x,v){var A=w._events;if(A===void 0)return[];var N=A[x];return N===void 0?[]:typeof N=="function"?v?[N.listener||N]:[N]:v?T(N):g(N,N.length)}o.prototype.listeners=function(x){return f(this,x,!0)},o.prototype.rawListeners=function(x){return f(this,x,!1)},o.listenerCount=function(w,x){return typeof w.listenerCount=="function"?w.listenerCount(x):m.call(w,x)},o.prototype.listenerCount=m;function m(w){var x=this._events;if(x!==void 0){var v=x[w];if(typeof v=="function")return 1;if(v!==void 0)return v.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(w,x){for(var v=new Array(x),A=0;A<x;++A)v[A]=w[A];return v}function y(w,x){for(;x+1<w.length;x++)w[x]=w[x+1];w.pop()}function T(w){for(var x=new Array(w.length),v=0;v<x.length;++v)x[v]=w[v].listener||w[v];return x}function b(w,x){return new Promise(function(v,A){function N(O){w.removeListener(x,M),A(O)}function M(){typeof w.removeListener=="function"&&w.removeListener("error",N),v([].slice.call(arguments))}_(w,x,M,{once:!0}),x!=="error"&&C(w,N,{once:!0})})}function C(w,x,v){typeof w.on=="function"&&_(w,"error",x,v)}function _(w,x,v,A){if(typeof w.on=="function")A.once?w.once(x,v):w.on(x,v);else if(typeof w.addEventListener=="function")w.addEventListener(x,function N(M){A.once&&w.removeEventListener(x,N),v(M)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof w)}}))();gE=class extends Ih.EventEmitter{pipe(e,t){let n=this,r=e,i=d=>{r.writable&&r.write(d)===!1&&n.pause&&n.pause()};n.on("data",i);let s=()=>{n.readable&&n.resume&&n.resume()};r.on("drain",s),!r._isStdio&&(!t||t.end!==!1)&&(n.on("end",o),n.on("close",c));let a=!1;function o(){a||(a=!0,r.end())}function c(){a||(a=!0,typeof r.destroy=="function"&&r.destroy())}function l(d){if(u(),Ih.EventEmitter.listenerCount(this,"error")===0)throw d}n.on("error",l),r.on("error",l);function u(){n.removeListener("data",i),r.removeListener("drain",s),n.removeListener("end",o),n.removeListener("close",c),n.removeListener("error",l),r.removeListener("error",l),n.removeListener("end",u),n.removeListener("close",u),r.removeListener("close",u)}return n.on("end",u),n.on("close",u),r.on("close",u),r.emit("pipe",n),r}};bE={NONE:"",WITH_2_BLANKS:" ",WITH_4_BLANKS:" ",WITH_TAB:" "},Rh=e=>e===!0?bE.WITH_2_BLANKS:e===!1?void 0:e,Lh=e=>e.Macros===void 0?"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"application/vnd.ms-word.document.macroEnabled.12",Sc=class Rn{static pack(t,n,r){var i=this;return Kt(function*(s,a,o,c=[]){return jl(qs(i.compiler.compile(s,Rh(o),c)),a,Lh(s))}).apply(this,arguments)}static toString(t,n,r=[]){return Rn.pack(t,"string",n,r)}static toBuffer(t,n,r=[]){return Rn.pack(t,"nodebuffer",n,r)}static toBase64String(t,n,r=[]){return Rn.pack(t,"base64",n,r)}static toBlob(t,n,r=[]){return Rn.pack(t,"blob",n,r)}static toArrayBuffer(t,n,r=[]){return Rn.pack(t,"arraybuffer",n,r)}static toStream(t,n,r=[]){let i=new gE,s=this.compiler.compile(t,Rh(n),r);return new Promise(a=>setTimeout(a)).then(()=>jl(qs(s),"nodebuffer",Lh(t))).then(a=>{i.emit("data",a),i.emit("end")},a=>i.emit("error",a)),i}};E(Sc,"compiler",new fE);jf=e=>{var t;if(e.name!=="w:bookmarkStart"&&e.name!=="w:bookmarkEnd")return;let n=Number((t=e.attributes)===null||t===void 0?void 0:t["w:id"]);return Number.isInteger(n)?n:void 0},Wf=e=>{var t;let n=jf(e);return[...n===void 0?[]:[n],...((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(Wf)]},vE=e=>{let t=new Set(e),n=new Map,r=e.reduce((a,o)=>Math.max(a,o),0),i=a=>{let o=n.get(a);if(o!==void 0)return o;let c=t.has(a)?r+1:a;return r=Math.max(r,c),t.add(c),n.set(a,c),c},s=a=>{let o=jf(a);return k(k(k({},a),o===void 0?{}:{attributes:k(k({},a.attributes),{},{"w:id":String(i(o))})}),a.elements===void 0?{}:{elements:a.elements.map(s)})};return a=>a.map(s)},wE=new dn,ta=e=>new TextDecoder("utf-8",{ignoreBOM:!0}).decode(e),pt=e=>Wr(e,{keepWhitespaceText:!0}),Kf=e=>{var t;return(t=pt(j(wE.format(new Dr({text:e})))).elements[0].elements)!==null&&t!==void 0?t:[]},Gf=e=>k(k({},e),{},{attributes:{"xml:space":"preserve"}}),Te=(e,t)=>{var n,r;let i=(n=e.elements)===null||n===void 0?void 0:n.find(s=>s.name===t);return i===void 0?[]:((r=i.elements)!==null&&r!==void 0||(i.elements=[]),i.elements)},zf=e=>{if(!e?.start.trim()||!e?.end.trim())throw new Error("Both start and end delimiters must be non-empty strings.")},On=(e,t,n)=>{let r=Te(e,"Types");r.some(i=>{var s,a;return i.type==="element"&&i.name==="Default"&&(i==null||(s=i.attributes)===null||s===void 0?void 0:s.ContentType)===t&&(i==null||(a=i.attributes)===null||a===void 0?void 0:a.Extension)===n})||r.push({attributes:{ContentType:t,Extension:n},name:"Default",type:"element"})},yE=(e,t,n)=>{let r=Te(e,"Types");r.some(i=>{var s;return i.type==="element"&&i.name==="Override"&&((s=i.attributes)===null||s===void 0?void 0:s.PartName)===n})||r.push({attributes:{ContentType:t,PartName:n},name:"Override",type:"element"})},xE=(e,t)=>{var n;let r=(n=e.elements)===null||n===void 0?void 0:n.find(i=>i.name==="Types");r?.elements!==void 0&&(r.elements=r.elements.filter(i=>{var s,a;return!(i.name==="Override"&&String((s=(a=i.attributes)===null||a===void 0?void 0:a.PartName)!==null&&s!==void 0?s:"").toLowerCase()===t.toLowerCase())}))},kE=e=>{let t=parseInt(e.substring(3),10);return isNaN(t)?0:t},Cc=e=>Te(e,"Relationships").map(t=>{var n,r;return kE((n=(r=t.attributes)===null||r===void 0||(r=r.Id)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"")}).reduce((t,n)=>Math.max(t,n),0)+1,Kl=(e,t,n,r,i)=>{let s=Te(e,"Relationships");return s.push({attributes:{Id:`rId${t}`,Type:n,Target:r,TargetMode:i},name:"Relationship",type:"element"}),s},Ur=()=>({declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[]}]}),Mh="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",TE="application/vnd.openxmlformats-package.core-properties+xml",Dh="_rels/.rels",Bh="docProps/core.xml",Gl={cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/"},SE={title:{namespace:"dc",name:"title"},subject:{namespace:"dc",name:"subject"},creator:{namespace:"dc",name:"creator"},keywords:{namespace:"cp",name:"keywords"},description:{namespace:"dc",name:"description"},lastModifiedBy:{namespace:"cp",name:"lastModifiedBy"},revision:{namespace:"cp",name:"revision"}},$h=e=>e===""?[]:[{type:"text",text:String(e)}],Fh=e=>{var t;return(t=e.name)===null||t===void 0?void 0:t.slice(e.name.indexOf(":")+1)},CE=(e,t)=>{var n;let r=(n=Object.entries(k({},e.attributes)).find(([i,s])=>(i==="xmlns"||i.startsWith("xmlns:"))&&s===Gl[t]))===null||n===void 0?void 0:n[0];return r===void 0?(e.attributes=k(k({},e.attributes),{},{[`xmlns:${t}`]:Gl[t]}),`${t}:`):r==="xmlns"?"":`${r.slice(6)}:`},EE=e=>{let t=e[0]===255&&e[1]===254?"utf-16le":e[0]===254&&e[1]===255?"utf-16be":"utf-8";return new TextDecoder(t).decode(e)},AE=(e,t,n)=>{var r;let i=t.get(n);if(i===void 0)return e.get(n);let s=pt(EE(i));return!((r=s.declaration)===null||r===void 0)&&r.attributes&&(s.declaration.attributes.encoding="UTF-8"),t.delete(n),e.set(n,s),s},_E=e=>{var t,n;let r=(t=e.get(Dh))!==null&&t!==void 0?t:Ur(),i=(n=Te(r,"Relationships").find(s=>{var a;return((a=s.attributes)===null||a===void 0?void 0:a.Type)===Mh}))===null||n===void 0||(n=n.attributes)===null||n===void 0?void 0:n.Target;return typeof i=="string"?cn("",i):(Kl(r,Cc(r),Mh,Bh),e.set(Dh,r),Bh)},NE=(e,t,n,{addContentTypeOverride:r})=>{var i,s;let a=_E(e),o=AE(e,t,a),c=o??{declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"cp:coreProperties",attributes:{"xmlns:cp":Gl.cp},elements:[]}]};o===void 0&&(e.set(a,c),r(TE,`/${a}`));let l=(i=c.elements)===null||i===void 0?void 0:i.find(u=>Fh(u)==="coreProperties");if(l===void 0)throw new Error(`Could not find the core properties in ${a}`);(s=l.elements)!==null&&s!==void 0||(l.elements=[]);for(let[u,{namespace:d,name:p}]of Object.entries(SE)){let h=n[u];if(h===void 0)continue;let f=l.elements.find(m=>Fh(m)===p);f?f.elements=$h(h):l.elements.push({type:"element",name:`${CE(l,d)}${p}`,elements:$h(h)})}},zl=new Set(["wp:inline","wp:anchor"]),Ec=new Set(["wp:docPr","wps:cNvPr","wpg:cNvPr"]),PE=new Set(["a:stCxn","a:endCxn"]),Hs=(e,t)=>{var n,r;if(!t.has((n=e.name)!==null&&n!==void 0?n:""))return;let i=Number((r=e.attributes)===null||r===void 0?void 0:r.id);return Number.isInteger(i)?i:void 0},Vf=e=>{var t;let n=Hs(e,Ec);return[...n===void 0?[]:[n],...((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(Vf)]},IE=e=>{let t=n=>{var r;let i=Hs(n,Ec);return[...i===void 0?[]:[i],...((r=n.elements)!==null&&r!==void 0?r:[]).flatMap(s=>{var a;return zl.has((a=s.name)!==null&&a!==void 0?a:"")?[]:t(s)})]};return t(e)},OE=e=>{let t=new Set(e),n=e.reduce((a,o)=>Math.max(a,o),0),r=a=>{let o=t.has(a)?n+1:a;return n=Math.max(n,o),t.add(o),o},i=a=>{let o=new Map([...new Set(IE(a))].map(l=>[l,r(l)])),c=l=>{var u,d;if(l!==a&&zl.has((u=l.name)!==null&&u!==void 0?u:""))return i(l);let p=(d=Hs(l,Ec))!==null&&d!==void 0?d:Hs(l,PE),h=p===void 0?void 0:o.get(p);return k(k(k({},l),h===void 0?{}:{attributes:k(k({},l.attributes),{},{id:String(h)})}),l.elements===void 0?{}:{elements:l.elements.map(c)})};return c(a)},s=a=>{var o;return zl.has((o=a.name)!==null&&o!==void 0?o:"")?i(a):k(k({},a),a.elements===void 0?{}:{elements:a.elements.map(s)})};return a=>a.map(s)},Ce={DOCUMENT:"file",PARAGRAPH:"paragraph",TABLE_ROWS:"tableRows",DRAWING:"drawing"},RE=new Map([["wp:inline","wp:docPr"],["wp:anchor","wp:docPr"],["wpg:graphicFrame","wpg:cNvPr"],["wpc:graphicFrame","wpg:cNvPr"]]),na=e=>{var t;return((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(n=>{var r;let i=n.name===void 0?void 0:RE.get(n.name),s=i===void 0||(r=n.elements)===null||r===void 0?void 0:r.find(a=>a.name===i);return[...s?[{element:n,properties:s}]:[],...na(n)]})},Xf=e=>{var t,n;return[(t=e.attributes)===null||t===void 0?void 0:t.descr,(n=e.attributes)===null||n===void 0?void 0:n.title].flatMap(r=>r===void 0?[]:[String(r)])},qh="[Content_Types].xml",LE=e=>{var t;if(!(!((t=e.elements)===null||t===void 0)&&t.some(r=>r.name==="Relationships"))){var n;e.elements=[...(n=e.elements)!==null&&n!==void 0?n:[],...Ur().elements]}return Te(e,"Relationships")},ME="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Vl=e=>{var t,n;return new Set(["r",...Object.entries((t=e.attributes)!==null&&t!==void 0?t:{}).flatMap(([r,i])=>r.startsWith("xmlns:")&&i===ME?[r.slice(6)]:[]),...((n=e.elements)!==null&&n!==void 0?n:[]).flatMap(r=>[...Vl(r)])])},Xl=(e,t)=>{var n,r;return new Set([...Object.entries((n=e.attributes)!==null&&n!==void 0?n:{}).flatMap(([i,s])=>i.includes(":")&&t.has(i.slice(0,i.indexOf(":")))?[String(s)]:[]),...((r=e.elements)!==null&&r!==void 0?r:[]).flatMap(i=>[...Xl(i,t)])])},DE=(e,t)=>{let n=l=>e.has(l)||t.has(l),r=l=>{if(n(l))return l;let u=(()=>{try{return decodeURI(l)}catch{return}})();if(u!==void 0&&n(u))return u;let d=l.toLowerCase();return[...e.keys(),...t.keys()].find(p=>p.toLowerCase()===d)},i=(l,u)=>{let d=e.get(Qe(l));return d===void 0?void 0:Te(d,"Relationships").find(p=>{var h;return p.name==="Relationship"&&((h=p.attributes)===null||h===void 0?void 0:h.Id)===u})},s=(l,u)=>{var d,p;let h=(d=u.attributes)===null||d===void 0?void 0:d.Target;return((p=u.attributes)===null||p===void 0?void 0:p.TargetMode)==="External"||h===void 0?void 0:r(cn(l,String(h)))},a=l=>[...e].some(([u,d])=>u.endsWith(".rels")&&Te(d,"Relationships").some(p=>s(Af(u),p)===l)),o=(l,u)=>{if(u===void 0||u===l||u===qh||u.endsWith(".rels")||a(u))return;let d=e.get(Qe(u));e.delete(u),t.delete(u),e.delete(Qe(u));let p=e.get(qh);p!==void 0&&xE(p,`/${u}`);for(let h of d===void 0?[]:Te(d,"Relationships"))o(u,s(u,h))};return{findRelationship:i,pathOf:s,removeIfUnreferenced:o,removeRelationships:(l,u)=>{var d,p;let h=(d=e.get(Qe(l)))===null||d===void 0||(d=d.elements)===null||d===void 0?void 0:d.find(m=>m.name==="Relationships"),f=((p=h?.elements)!==null&&p!==void 0?p:[]).filter(m=>{var g;return m.name==="Relationship"&&u.has(String((g=m.attributes)===null||g===void 0?void 0:g.Id))});if(!(h===void 0||f.length===0)){h.elements=h.elements.filter(m=>!f.includes(m));for(let m of f)o(l,s(l,m))}}}},BE=(e,{findRelationship:t,pathOf:n,removeIfUnreferenced:r},i,s)=>{let a=new dn;return{getRelatedPart:(o,c)=>{let l=t(o.path,c),u=l===void 0?void 0:n(o.path,l);return u===void 0?void 0:{path:u,xml:e.get(u)}},replaceRelatedPart:(o,c,l)=>{let u=`word/${i.PackageParts.add(l)}`,{relationshipType:d}=l.options,p=yc(o.path,u),h=c===void 0?void 0:t(o.path,c);if(h===void 0){var f;let g=Qe(o.path),y=(f=e.get(g))!==null&&f!==void 0?f:Ur();e.set(g,y);let T=c??`rId${Cc(y)}`;return LE(y).push({type:"element",name:"Relationship",attributes:{Id:T,Type:d,Target:p}}),T}let m=n(o.path,h);return h.attributes=k(k({},Object.fromEntries(Object.entries(h.attributes).filter(([g])=>g!=="TargetMode"))),{},{Type:d,Target:p}),r(o.path,m),String(h.attributes.Id)},format:o=>pt(j(a.format(o,s))).elements[0]}},$E=({parts:e,binaryParts:t,file:n,patches:r,delimiters:i},s)=>{let a=r.map(([l,u])=>({placeholder:`${i.start}${l}${i.end}`,patch:u})),o=[...e].filter(([l])=>l.startsWith("word/")&&!l.endsWith(".rels")).flatMap(([l,u])=>na(u).flatMap(d=>{let p=Xf(d.properties),h=a.filter(({placeholder:g})=>p.some(y=>y.includes(g)));if(h.length>1){var f,m;throw new Error(`The drawing "${(f=(m=d.properties.attributes)===null||m===void 0?void 0:m.name)!==null&&f!==void 0?f:""}" in ${l} has the placeholders ${h.map(({placeholder:g})=>g).join(" and ")} in its alt text. A drawing can only be patched once`)}return h.map(({placeholder:g,patch:y})=>({drawing:k(k({placeholder:g},d),{},{part:{path:l,xml:u}}),patch:y}))})),c=DE(e,t);for(let{drawing:l,patch:u}of o){let d=Xl(l.element,Vl(l.part.xml));u.patch(l,BE(e,c,n,s(l.part.path)));let p=Xl(l.part.xml,Vl(l.part.xml));c.removeRelationships(l.part.path,new Set([...d].filter(h=>!p.has(h))))}},FE=e=>typeof e=="object"&&e!==null&&"on"in e&&typeof e.on=="function",qE=e=>typeof e=="object"&&e!==null&&"generateAsync"in e&&typeof e.generateAsync=="function",HE=e=>["[object Blob]","[object File]"].includes(Object.prototype.toString.call(e)),UE=e=>new Promise((t,n)=>{let r=[];e.on("data",i=>{ArrayBuffer.isView(i)?r.push(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)):typeof i=="number"?r.push(i):n(new TypeError(`A template stream must give bytes, but it gave a ${typeof i}. A stream with an encoding set gives text, so do not set one.`))}),e.on("error",n),e.on("end",()=>{let i=new Uint8Array(r.reduce((s,a)=>s+(typeof a=="number"?1:a.length),0));r.reduce((s,a)=>typeof a=="number"?(i[s]=a,s+1):(i.set(a,s),s+a.length),0),t(i)})}),jE=(function(){var e=Kt(function*(t){return qE(t)?t.generateAsync({type:"uint8array"}):FE(t)?UE(t):HE(t)?new Uint8Array(yield t.arrayBuffer()):typeof t=="string"?Uint8Array.from({length:t.length},(n,r)=>t.charCodeAt(r)):Array.isArray(t)?Uint8Array.from(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)});return function(n){return e.apply(this,arguments)}})(),Yf=(function(){var e=Kt(function*(t,n){return Bf(yield jE(t),n)});return function(n,r){return e.apply(this,arguments)}})(),WE=new dn,Cs="word/document.xml",KE={path:"word/footnotes.xml",rootName:"w:footnotes",noteName:"w:footnote",referenceName:"w:footnoteReference",contentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",create:{part:()=>new hf,mark:()=>new uf,styles:()=>[new wf({}),new xf({}),new yf({})]}},GE={path:"word/endnotes.xml",rootName:"w:endnotes",noteName:"w:endnote",referenceName:"w:endnoteReference",contentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml",relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",create:{part:()=>new pf,mark:()=>new lf,styles:()=>[new kf({}),new Sf({}),new Tf({})]}},Es=(e,t)=>pt(j(WE.format(e,t))).elements[0],Jf=(e,t)=>{var n,r,i;let s=t.includes((n=e.name)!==null&&n!==void 0?n:"")?Number((r=e.attributes)===null||r===void 0?void 0:r["w:id"]):NaN;return[...Number.isInteger(s)?[s]:[],...((i=e.elements)!==null&&i!==void 0?i:[]).flatMap(a=>Jf(a,t))]},zE=(e,t)=>{var n,r;let i=(n=e.elements)!==null&&n!==void 0?n:[],s=((r=i[0])===null||r===void 0?void 0:r.name)==="w:pPr"?1:0;return k(k({},e),{},{elements:[...i.slice(0,s),t,...i.slice(s)]})},Hh=(e,t,n,{createContext:r,addContentTypeOverride:i,renumberBookmarks:s,renumberDrawings:a,renumberLists:o,useStyles:c})=>{let l=new Map(Object.entries(t).map(([T,b])=>[Number(T),b])),u=new Map,d=[...l.keys()].filter(Number.isFinite).reduce((T,b)=>Math.max(T,Math.floor(b)),0),p=new Map,h,f=T=>{var b,C;let _=T.name===e.referenceName?l.get(Number((b=T.attributes)===null||b===void 0?void 0:b["w:id"])):void 0;return _===void 0?T.elements===void 0?T:k(k({},T),{},{elements:T.elements.map(f)}):(h=((C=h)!==null&&C!==void 0?C:[...n.values()].flatMap(w=>Jf(w,[e.noteName,e.referenceName])).reduce((w,x)=>Math.max(w,x),0))+1,p.set(h,_),k(k({},T),{},{attributes:k(k({},T.attributes),{},{"w:id":String(h)})}))},m=()=>{var T;let b=Te((T=n.get(Qe(Cs)))!==null&&T!==void 0?T:{},"Relationships").find(_=>{var w;return((w=_.attributes)===null||w===void 0?void 0:w.Type)===e.relationshipType}),C=b?cn(Cs,String(b.attributes.Target)):e.path;return n.has(C)||(n.set(C,{declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[Es(e.create.part(),r(C))]}),i(e.contentType,`/${C}`)),b||r(Cs).viewWrapper.Relationships.addRelationship($n(),e.relationshipType,yc(Cs,C)),C};return{renumber:T=>T.map(f),write:()=>{if(p.size===0)return;let T=m(),b=r(T),C=new Map([...new Set(p.values())].map(w=>{let x=Es(e.create.mark(),b);return[w,c(o(s(w.children.map(v=>Es(v,b)).map((v,A)=>A===0?zE(v,x):v))))]}));Te(n.get(T),e.rootName).push(...[...p].map(([w,x])=>({type:"element",name:e.noteName,attributes:{"w:id":String(w)},elements:[...a(C.get(x))]})));let _=n.get("word/styles.xml");if(_){let w=Te(_,"w:styles"),x=new Set(w.map(v=>{var A;return(A=v.attributes)===null||A===void 0?void 0:A["w:styleId"]}));w.push(...e.create.styles().map(v=>Es(v,b)).filter(v=>{var A;return!x.has((A=v.attributes)===null||A===void 0?void 0:A["w:styleId"])}))}},carry:(T,b)=>{let C=u.get(T);return C!==void 0?C:(d++,l.set(d,b),u.set(T,d),d)}}},VE=({footnotes:e={},endnotes:t={}},n,r)=>{let i={footnotes:Hh(KE,e,n,r),endnotes:Hh(GE,t,n,r)};return{carry:(s,a,o)=>i[s].carry(a,o),renumber:s=>Object.values(i).reduce((a,o)=>o.renumber(a),s),write:()=>{for(let s of Object.values(i))s.write()}}},XE=new dn,As="word/document.xml",YE="word/numbering.xml",JE="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",Uh="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",QE="default-bullet-numbering",ZE="1",e2=(e,t)=>pt(j(XE.format(e,t))).elements[0],jh=e=>e.reduce((t,n)=>Math.max(t,n),0),t2=(e,t,{createContext:n,addContentTypeOverride:r})=>{let i=new Map,s,a=()=>{var f;return Te((f=t.get(Qe(As)))!==null&&f!==void 0?f:{},"Relationships").find(m=>{var g;return((g=m.attributes)===null||g===void 0?void 0:g.Type)===Uh})},o=(f=a())=>f?cn(As,String(f.attributes.Target)):YE,c=(f,m)=>{var g;return Te((g=t.get(o()))!==null&&g!==void 0?g:{},"w:numbering").filter(y=>y.name===f).map(y=>Number(y.attributes[m]))},l=f=>{if(f===ZE)return e.ConcreteNumbering.find(({reference:g})=>g===QE);if(!f.startsWith("{"))return;let m=e.ConcreteNumbering.find(({reference:g,instance:y})=>f===`{${g}-${y}}`);if(!m){let g=f.slice(1,-1).replace(/-\d+$/,"");throw new Error(`A paragraph in a patch uses the numbering "${g}", which isn't in the numbering option of patchDocument. Add it there with its levels, as in a Document`)}return m},u=f=>{var m;let g=i.get(f.numId);return g!==void 0?g:(s=((m=s)!==null&&m!==void 0?m:jh(c("w:num","w:numId")))+1,i.set(f.numId,s),s)},d=f=>{let m=f.name==="w:numId"?l(String(f.attributes["w:val"])):void 0;return m===void 0?f.elements===void 0?f:k(k({},f),{},{elements:f.elements.map(d)}):k(k({},f),{},{attributes:k(k({},f.attributes),{},{"w:val":String(u(m))})})},p=f=>{let m=a(),g=o(m);return t.has(g)||(t.set(g,{declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[k(k({},f),{},{elements:[]})]}),r(JE,`/${g}`)),m||n(As).viewWrapper.Relationships.addRelationship($n(),Uh,yc(As,g)),g};return{renumber:f=>f.map(d),write:()=>{var f,m;if(i.size===0)return;let g=e2(e,n(o())),y=N=>Number(N.elements.find(M=>M.name==="w:abstractNumId").attributes["w:val"]),T=g.elements.filter(N=>N.name==="w:num"&&i.has(Number(N.attributes["w:numId"]))),b=jh(c("w:abstractNum","w:abstractNumId")),C=new Map([...new Set(T.map(y))].map((N,M)=>[N,b+M+1])),_=g.elements.flatMap(N=>{let M=N.name==="w:abstractNum"?C.get(Number(N.attributes["w:abstractNumId"])):void 0;return M===void 0?[]:[k(k({},N),{},{attributes:k(k({},N.attributes),{},{"w:abstractNumId":String(M)})})]}),w=p(g),x=t.get(w).elements.find(N=>N.name==="w:numbering");x.attributes=k(k(k({},Object.fromEntries(Object.entries(g.attributes).filter(([N])=>N.startsWith("xmlns:")))),x.attributes),{},{"mc:Ignorable":[...new Set([...String((f=(m=x.attributes)===null||m===void 0?void 0:m["mc:Ignorable"])!==null&&f!==void 0?f:"").split(" "),...String(g.attributes["mc:Ignorable"]).split(" ")])].filter(N=>N!=="").join(" ")});let v=Te(t.get(w),"w:numbering"),A=N=>{let M=v.findIndex(O=>N.includes(O.name));return M===-1?v.length:M};v.splice(A(["w:num","w:numIdMacAtCleanup"]),0,..._),v.splice(A(["w:numIdMacAtCleanup"]),0,...T.map(N=>k(k({},N),{},{attributes:k(k({},N.attributes),{},{"w:numId":String(i.get(Number(N.attributes["w:numId"])))}),elements:N.elements.map(M=>M.name==="w:abstractNumId"?k(k({},M),{},{attributes:{"w:val":String(C.get(y(N)))}}):M)})))}}},Yl={nameOf:e=>e.type==="element"?e.name:void 0,contentOf:e=>e.elements,attributeOf:(e,t)=>{var n;return(n=e.attributes)===null||n===void 0?void 0:n[t]},textOf:e=>{var t;return((t=e.elements)!==null&&t!==void 0?t:[]).filter(({type:n})=>n==="text").map(({text:n})=>String(n)).join("")},textElement:e=>({type:"element",name:"w:t",attributes:{"xml:space":"preserve"},elements:[{type:"text",text:e}]}),writeClean:(e,t)=>{var n;/^\s*(PAGEREF|TOC)\b/i.test(t)&&((n=e.attributes)===null||n===void 0?void 0:n["w:dirty"])!==void 0&&(e.attributes=Object.fromEntries(Object.entries(e.attributes).filter(([r])=>r!=="w:dirty")))},setSimpleFieldResult:(e,t)=>{e.elements=[{type:"element",name:"w:r",elements:[Yl.textElement(t)]}]}},Sl="word/document.xml",n2="http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk",r2=[80,75,3,4],i2=(function(){var e=Kt(function*(t){if(r2.every((n,r)=>t[r]===n))try{let n=new Map,r=new Map;for(let[s,a]of Bf(t))/\.(xml|rels)$/.test(s)?n.set(s,pt(ta(a))):r.set(s,a);let i=yield Qf(n,r);return k({parts:n,binaryParts:r},i.size>0?{importedDocuments:i}:{})}catch{return}});return function(n){return e.apply(this,arguments)}})(),Qf=(function(){var e=Kt(function*(t,n){let r=new Map;for(let[a,o]of t){var i,s;if(a.endsWith(".rels"))for(let{attributes:c={}}of(i=(s=Ls(o))===null||s===void 0?void 0:s.elements)!==null&&i!==void 0?i:[]){let l=cn(Af(a),String(c.Target)),u=n.get(l),d=c.Type===n2&&c.TargetMode!=="External"&&u?yield i2(u):void 0;d&&r.set(l,d)}}return r});return function(n,r){return e.apply(this,arguments)}})(),Ls=e=>{var t;return e==null||(t=e.elements)===null||t===void 0?void 0:t.find(({type:n})=>n==="element")},s2=(function(){var e=Kt(function*(t,n,r=new Map){var i,s;let a=Ls(t.get(Sl));if(!a)return;let o=yield Qf(t,r),c=n(k({parts:t,binaryParts:r},o.size>0?{importedDocuments:o}:{})),l=Cm(Yl,a,c,{blank:!0}),u=(i=(s=Ls(t.get(Qe(Sl))))===null||s===void 0?void 0:s.elements)!==null&&i!==void 0?i:[];for(let{attributes:d={}}of u){let p=/\/(header|footer)$/.test(String(d.Type))?Ls(t.get(cn(Sl,String(d.Target)))):void 0;p&&Em(Yl,p,c,{blank:!0,sectionPageCount:l.get(String(d.Id))})}});return function(n,r){return e.apply(this,arguments)}})(),a2=new Set(["w:hyperlink","w:sdt","w:sdtContent","w:ins","w:moveTo","w:smartTag","w:customXml","w:fldSimple","w:dir","w:bdo"]),Zf=(e,t)=>{var n;return((n=e.elements)!==null&&n!==void 0?n:[]).flatMap((r,i)=>{var s;return r.name==="w:r"?[{element:r,path:[...t,i]}]:a2.has((s=r.name)!==null&&s!==void 0?s:"")?Zf(r,[...t,i]):[]})},Us=(e,t)=>t.reduce((n,r)=>n.elements[r],e),Yr=e=>{if(e.element.name!=="w:p")throw new Error(`Invalid node type: ${e.element.name}`);if(!e.element.elements)return{text:"",runs:[],index:-1,pathToParagraph:[]};let t=0,n=Zf(e.element,[]).map(({element:r,path:i})=>{let s=o2(r,i,t);return t+=s.text.length,s});return{text:n.reduce((r,i)=>r+i.text,""),runs:n,index:e.index,pathToParagraph:eg(e)}},o2=(e,t,n)=>{if(!e.elements)return{text:"",parts:[],path:t,start:n,end:n};let r=n,i=e.elements.map((s,a)=>{var o,c;if(s.name!=="w:t"||!s.elements||s.elements.length===0)return;let l=(o=(c=s.elements[0].text)===null||c===void 0?void 0:c.toString())!==null&&o!==void 0?o:"",u=r;return r+=l.length,{text:l,index:a,start:u,end:u+l.length-1}}).filter(s=>!!s).map(s=>s);return{text:i.reduce((s,a)=>s+a.text,""),parts:i,path:t,start:n,end:i.length>0?i[i.length-1].end:n}},eg=e=>e.parent?[...eg(e.parent),e.index]:[e.index],l2=class extends Error{constructor(e){super(`Token ${e} not found`),this.name="TokenNotFoundError"}},c2=(e,t)=>{let n=Yr({element:e,index:0,parent:void 0}).runs.find(({parts:r})=>r.some(({text:i})=>i.includes(t)));if(!n)throw new l2(t);return n.path},d2=(e,t)=>{var n,r;let i=-1,s=(n=(r=e.elements)===null||r===void 0?void 0:r.map((a,o)=>{if(i!==-1)return a;if(a.type==="element"&&a.name==="w:t"){var c,l;let u=((c=(l=a.elements)===null||l===void 0||(l=l[0])===null||l===void 0?void 0:l.text)!==null&&c!==void 0?c:"").split(t),d=u.map(p=>k(k(k({},a),Gf(a)),{},{elements:Kf(p)}));return u.length>1&&(i=o),d}else return a}).flat())!==null&&n!==void 0?n:[];return{left:k(k({},JSON.parse(JSON.stringify(e))),{},{elements:s.slice(0,i+1)}),right:k(k({},JSON.parse(JSON.stringify(e))),{},{elements:s.slice(i+1)})}},Ar={START:0,MIDDLE:1,END:2},tg=({paragraphElement:e,renderedParagraph:t,originalText:n,replacementText:r,fromIndex:i=0})=>{let s=t.text.indexOf(n,i),a=s+n.length-1,o=Ar.START;for(let c of t.runs){let l=Us(e,c.path);for(let{text:u,index:d,start:p,end:h}of c.parts)switch(o){case Ar.START:if(s>=p&&s<=h){let f=s-p,m=Math.min(a,h)-p;if(u.substring(f,m+1)==="")continue;let g=u.substring(0,f)+r+u.substring(m+1);Cl(l.elements[d],g),o=Ar.MIDDLE;continue}break;case Ar.MIDDLE:if(a<=h){let f=u.substring(a-p+1);Cl(l.elements[d],f);let m=l.elements[d];l.elements[d]=Gf(m),o=Ar.END}else Cl(l.elements[d],"")}}return e},Cl=(e,t)=>(e.elements=Kf(t),e),Wh=e=>{var t,n;return(t=(n=e.element.elements)===null||n===void 0?void 0:n.map((r,i)=>({element:r,index:i,parent:e})))!==null&&t!==void 0?t:[]},ng=e=>{let t=[],n=[...Wh({element:e,index:0,parent:void 0})],r;for(;n.length>0;)r=n.shift(),r.element.name==="w:p"&&(t=[...t,Yr(r)]),n.push(...Wh(r));return t},Ac=(e,t)=>ng(e).filter(n=>n.text.includes(t)),El="\uFFFF",p2=({json:e,patch:t,patchText:n,context:r,keepOriginalStyles:i=!0,recursive:s=!0,renumberIds:a=o=>o})=>{let o=Ac(e,n);if(o.length===0)return{element:e,didFindOccurrence:!1};let c=[...o].reverse(),l=t.type===Ce.DOCUMENT?k2(c):c,u,d=()=>{var h;return u=((h=u)!==null&&h!==void 0?h:ig(e))+1,String(u)};for(let h of l)switch(t.type){case Ce.DOCUMENT:{var p;let f=T2(e,h.pathToParagraph),m=S2(h.pathToParagraph),g=Kh(t,r,a),y=f.name==="w:tc"&&m===f.elements.length-1&&((p=g[g.length-1])===null||p===void 0?void 0:p.name)!=="w:p"?[{type:"element",name:"w:p"}]:[];f.elements.splice(m,1,...g,...y);break}case Ce.PARAGRAPH:default:{let f=sg(e,h.pathToParagraph),m=h,g=0;do g=u2({paragraphElement:f,renderedParagraph:m,patchText:n,fromIndex:g,children:Kh(t,r,a),keepOriginalStyles:i,newTrackedChangeId:d}),m=Yr({element:f,index:h.index,parent:void 0});while(s&&m.text.includes(n,g));break}}return{element:e,didFindOccurrence:!0}},Kh=(e,t,n)=>n(e.children.flatMap(r=>{var i;return(i=r.writtenAs)!==null&&i!==void 0?i:r}).flatMap(r=>{let i=r.prepForXml(t);return i?[pt(j(i)).elements[0]]:[]})),u2=({paragraphElement:e,renderedParagraph:t,patchText:n,fromIndex:r,children:i,keepOriginalStyles:s,newTrackedChangeId:a})=>{let o=t.text.indexOf(n,r);tg({paragraphElement:e,renderedParagraph:t,originalText:n,replacementText:El,fromIndex:r});let c=c2(e,El),l=c.slice(0,-1),u=Us(e,l),d=c[c.length-1],p=l.map((_,w)=>Us(e,l.slice(0,w+1))).filter(_=>_.name==="w:sdt"),h=[...p].reverse().find(h2),f=u.elements[d],{left:m,right:g}=d2(f,El),y=f.elements.find(_=>_.type==="element"&&_.name==="w:rPr"),T=h?m2(h):y,b=s&&T?i.map(_=>rg(_,T)):i,C=y?k(k({},g),{},{elements:[y,...g.elements]}):g;return u.elements.splice(d,1,m,...b,C),p.forEach(_=>b2(_,b)),w2(e,l,a),o+Yr({element:{name:"w:p",elements:[...b]},index:0,parent:void 0}).text.length},_c=e=>{var t;return(t=e.elements)===null||t===void 0?void 0:t.find(n=>n.name==="w:sdtPr")},h2=e=>{var t;return!!(!((t=_c(e))===null||t===void 0||(t=t.elements)===null||t===void 0)&&t.some(n=>n.name==="w:showingPlcHdr"))},m2=e=>{var t;return(t=_c(e))===null||t===void 0||(t=t.elements)===null||t===void 0?void 0:t.find(n=>n.name==="w:rPr")},f2=new Set(["w:rPr","w:t","w:tab","w:br"]),g2=e=>e.name==="w:bookmarkStart"||e.name==="w:bookmarkEnd"||e.name==="w:r"&&rn(e).every(t=>f2.has(t.name)),b2=(e,t)=>{let n=_c(e);if(!n?.elements)return;let r=n.elements.some(i=>i.name==="w:text")&&!t.every(g2);n.elements=n.elements.filter(i=>i.name!=="w:showingPlcHdr"&&i.name!=="w:dataBinding"&&!(r&&i.name==="w:text"))},Jl=new Set(["w:hyperlink","w:fldSimple","w:subDoc"]),v2=new Map([["w:ins",Jl],["w:moveTo",Jl],["w:hyperlink",new Set(["w:hyperlink"])]]),w2=(e,t,n)=>{for(let i=t.length;i>0;i--){var r;let s=Us(e,t.slice(0,i-1)),a=t[i-1],o=s.elements[a],c=v2.get(o.name),l=g=>!!c?.has(g.name);if(!(!((r=o.elements)===null||r===void 0)&&r.some(l)))continue;let{elements:u}=o,d=u.flatMap((g,y)=>y===0||l(g)||l(u[y-1])?[y]:[]),p=d.map((g,y)=>u.slice(g,d[y+1])),h=c===Jl,f=!0,m=p.map(g=>{if(l(g[0]))return g[0];let y=h&&!f?k(k({},o.attributes),{},{"w:id":n()}):o.attributes;return f=!1,k(k({},o),{},{attributes:y,elements:[...g]})});s.elements.splice(a,1,...m)}},rg=(e,t)=>e.name==="w:r"?y2(e,t):e.elements?k(k({},e),{},{elements:e.elements.map(n=>rg(n,t))}):e,y2=(e,t)=>{let n=rn(e).find(a=>a.type==="element"&&a.name==="w:rPr");if(!n)return k(k({},e),{},{elements:[t,...rn(e)]});let r=new Set(rn(n).map(a=>a.name)),i=[...rn(t).filter(a=>!r.has(a.name)),...rn(n)],s=k(k({},n),{},{elements:[...i].sort((a,o)=>Gh(a)-Gh(o))});return k(k({},e),{},{elements:rn(e).map(a=>a===n?s:a)})},Al=["w:rStyle","w:rFonts","w:b","w:bCs","w:i","w:iCs","w:caps","w:smallCaps","w:strike","w:dstrike","w:outline","w:shadow","w:emboss","w:imprint","w:noProof","w:snapToGrid","w:vanish","w:webHidden","w:color","w:spacing","w:w","w:kern","w:position","w:sz","w:szCs","w:highlight","w:u","w:effect","w:bdr","w:shd","w:fitText","w:vertAlign","w:rtl","w:cs","w:em","w:lang","w:eastAsianLayout","w:specVanish","w:oMath","w14:glow","w14:shadow","w14:reflection","w14:textOutline","w14:textFill","w14:scene3d","w14:props3d","w14:ligatures","w14:numForm","w14:numSpacing","w14:stylisticSets","w14:cntxtAlts"],Gh=e=>{var t;if(e.name==="w:rPrChange")return Al.length+1;let n=Al.indexOf((t=e.name)!==null&&t!==void 0?t:"");return n===-1?Al.length:n},rn=e=>{var t;return(t=e.elements)!==null&&t!==void 0?t:[]},ig=e=>{var t,n;let r=Number((t=e.attributes)===null||t===void 0?void 0:t["w:id"]);return((n=e.elements)!==null&&n!==void 0?n:[]).reduce((i,s)=>Math.max(i,ig(s)),Number.isInteger(r)?r:0)},x2=(e,t)=>e.length>t.length&&t.every((n,r)=>e[r]===n),k2=e=>e.filter(t=>!e.some(n=>x2(t.pathToParagraph,n.pathToParagraph))),sg=(e,t)=>{let n=e;for(let r=1;r<t.length;r++){let i=t[r];n=n.elements[i]}return n},T2=(e,t)=>sg(e,t.slice(0,t.length-1)),S2=e=>e[e.length-1],C2=new dn,_l="word/styles.xml",E2=new Set(["w:pStyle","w:rStyle","w:tblStyle","w:basedOn","w:next","w:link"]),Lr=e=>{var t;return String((t=e.attributes)===null||t===void 0?void 0:t["w:styleId"])},Ql=e=>{var t;let n=(t=e.elements)===null||t===void 0||(t=t.find(r=>r.name==="w:name"))===null||t===void 0||(t=t.attributes)===null||t===void 0?void 0:t["w:val"];return n===void 0?void 0:String(n).toLowerCase()},Ms=(e,t)=>{var n;return e==null||(n=e.elements)===null||n===void 0?void 0:n.find(r=>r.name===t)},zh=e=>{var t;let n=Number((t=Ms(e,"w:sz"))===null||t===void 0||(t=t.attributes)===null||t===void 0?void 0:t["w:val"]);return Number.isNaN(n)?void 0:n},A2=e=>{var t,n;let r=e.filter(a=>a.name==="w:style"),i=(t=r.find(a=>Lr(a)==="Normal"))!==null&&t!==void 0?t:r.find(a=>{var o;return((o=a.attributes)===null||o===void 0?void 0:o["w:type"])==="paragraph"&&Ql(a)==="normal"}),s=e.find(a=>a.name==="w:docDefaults");return(n=zh(Ms(i,"w:rPr")))!==null&&n!==void 0?n:zh(Ms(Ms(s,"w:rPrDefault"),"w:rPr"))},_2=(e,t)=>new Map(Object.values(wc({document:{run:{size:t}}})).map(n=>pt(j(C2.format(n,e))).elements[0]).filter(n=>n.name==="w:style").map(n=>[Lr(n),n])),N2=(e,t)=>{var n;let r=Te((n=e.get(_l))!==null&&n!==void 0?n:{},"w:styles"),i=r.filter(f=>f.name==="w:style"),s=new Set(i.map(Lr)),a,o=f=>{var m;return(m=a)!==null&&m!==void 0||(a=_2(t(_l),A2(r))),a.get(f)},c=new Set,l=new Map,u=f=>{let m=s.has(f)?void 0:o(f);if(m===void 0)return f;let g=i.find(y=>{var T,b;return((T=y.attributes)===null||T===void 0?void 0:T["w:type"])===((b=m.attributes)===null||b===void 0?void 0:b["w:type"])&&Ql(y)===Ql(m)});return g!==void 0?Lr(g):(c.add(f),f)},d=f=>(l.has(f)||l.set(f,u(f)),l.get(f)),p=f=>{var m;return E2.has((m=f.name)!==null&&m!==void 0?m:"")?k(k({},f),{},{attributes:k(k({},f.attributes),{},{"w:val":d(String(f.attributes["w:val"]))})}):f.elements===void 0?f:k(k({},f),{},{elements:f.elements.map(p)})};return{use:f=>f.map(p),write:()=>{let f=e.get(_l);if(!f)return;let m=Te(f,"w:styles"),g=new Set(m.map(Lr));for(let y of c)g.has(y)||(g.add(y),m.push(p(o(y))))}}},P2={type:Ce.PARAGRAPH,children:[]},I2=({json:e,key:t,patch:n,delimiters:{start:r,end:i},patchPlaceholder:s,renumberDrawings:a})=>{let o=`${r}${t}.`;for(let c of O2(e,o)){let l=M2(c.elements,o,i),u=n.rows.flatMap((d,p)=>{let h={type:"element",name:"w:tbl",elements:[...p===0?c.elements.map(D2):a(og(c.elements))]},f=new Map(Object.entries(d).flatMap(([m,g])=>g===void 0?[]:[[m,g]]));for(let[m,g]of f)s(h,`${t}.${m}`,g);for(let m of l.filter(g=>!f.has(g)))s(h,`${t}.${m}`,P2);return h.elements});c.parent.elements.splice(c.parent.elements.indexOf(c.elements[0]),c.elements.length,...u),c.table&&!ag(c.table.element)&&c.table.parent.elements.splice(c.table.parent.elements.indexOf(c.table.element),1)}},O2=(e,t)=>{let n=Ac(e,t).flatMap(i=>{let s=R2(e,i.pathToParagraph);return s?[s]:[]}),r=n.filter(i=>!n.some(s=>L2(i.path,s.path))).filter((i,s,a)=>a.findIndex(o=>o.row===i.row)===s);return[...new Set(r.map(i=>i.parent))].flatMap(i=>{let s=i.elements.filter(c=>c.name==="w:tr"),a=r.filter(c=>c.parent===i).map(c=>s.indexOf(c.row)).sort((c,l)=>c-l),{table:o}=r.find(c=>c.parent===i);return a.reduce((c,l)=>{let u=c[c.length-1];return u?.[u.length-1]===l-1?[...c.slice(0,-1),[...u,l]]:[...c,[l]]},[]).map(c=>{let l=i.elements.indexOf(s[c[0]]),u=i.elements.indexOf(s[c[c.length-1]]);return{parent:i,table:o,elements:i.elements.slice(l,u+1)}})})},R2=(e,t)=>{let n=e,r,i;for(let s=1;s<t.length;s++){let a=n.elements[t[s]];a.name==="w:tbl"&&(i={element:a,parent:n}),a.name==="w:tr"&&(r={parent:n,table:i,row:a,path:t.slice(0,s+1)}),n=a}return r},L2=(e,t)=>e.length>t.length&&t.every((n,r)=>e[r]===n),ag=e=>{var t;return((t=e.elements)!==null&&t!==void 0?t:[]).some(n=>n.name==="w:tr"||n.name!=="w:tblPr"&&n.name!=="w:tblGrid"&&ag(n))},M2=(e,t,n)=>{let r=Ac({elements:[...e]},t).flatMap(({text:i})=>i.split(t).slice(1).flatMap(s=>{let a=s.indexOf(n);return a>0?[s.slice(0,a)]:[]}));return[...new Set(r)]},D2=e=>JSON.parse(JSON.stringify(e)),B2=["w14:paraId","w14:textId"],$2=["w:bookmarkStart","w:bookmarkEnd"],og=(e,t)=>e.filter(n=>{var r;return!$2.includes((r=n.name)!==null&&r!==void 0?r:"")&&!(t?.name==="w:sdtPr"&&n.name==="w:id")}).map(n=>k(k(k({},n),n.attributes===void 0?{}:{attributes:Object.fromEntries(Object.entries(n.attributes).filter(([r])=>!B2.includes(r)))}),n.elements===void 0?{}:{elements:[...og(n.elements,n)]})),F2=e=>e[0]===255&&e[1]===254||e[0]===254&&e[1]===255,q2=e=>{var t;let n=eE(e,"word/document.xml"),r=n===void 0||(t=[...e].find(([i])=>SC(i,n)))===null||t===void 0?void 0:t[1];return r===void 0||F2(r)?void 0:rc(rE(ta(r)))},js=(e,t,{start:n,end:r},i)=>{for(let s=e.indexOf(n,t);s!==-1;s=e.indexOf(n,s+1)){let a=e.indexOf(r,s+n.length);if(a===-1)return;let o=e.slice(s+n.length,a),c=o.trim();if(c!==o&&i(c))return{index:s,placeholder:e.slice(s,a+r.length),trimmed:`${n}${c}${r}`}}},H2=(e,t,n)=>{let r=e;for(let i=js(r,0,t,n);i!==void 0;i=js(r,i.index+i.trimmed.length,t,n))r=`${r.slice(0,i.index)}${i.trimmed}${r.slice(i.index+i.placeholder.length)}`;return r},lg=e=>{var t;return((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(n=>[...n.name==="w:p"?[n]:[],...lg(n)])},U2=(e,t,n)=>{let r=()=>Yr({element:e,index:0,parent:void 0});for(let i=r(),s=js(i.text,0,t,n);s!==void 0;i=r(),s=js(i.text,s.index+s.trimmed.length,t,n))tg({paragraphElement:e,renderedParagraph:i,originalText:s.placeholder,replacementText:s.trimmed,fromIndex:s.index})},j2=(e,{delimiters:t,textKeys:n,tableRowsKeys:r,drawingKeys:i})=>{let s=c=>n.has(c)||r.some(l=>c.startsWith(`${l}.`));for(let c of lg(e))U2(c,t,s);let a=c=>i.has(c);for(let{properties:c}of na(e))for(let l of["descr","title"]){var o;let u=(o=c.attributes)===null||o===void 0?void 0:o[l];u!==void 0&&(c.attributes[l]=H2(String(u),t,a))}},cg=e=>{var t;return e.name==="v:shapetype"&&((t=e.attributes)===null||t===void 0?void 0:t.id)!==void 0?String(e.attributes.id):void 0},dg=e=>{var t;let n=cg(e);return[...n===void 0?[]:[n],...((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(dg)]},W2=e=>{let t=new Set(dg(e)),n=r=>{let i=cg(r);return i!==void 0?t.has(i)?[]:(t.add(i),[r]):[r.elements===void 0?r:k(k({},r),{},{elements:r.elements.flatMap(n)})]};return r=>r.flatMap(n)},pg=(e,t,{inTableRow:n})=>{if(t?.type===Ce.TABLE_ROWS&&Array.isArray(t.rows)){for(let r of t.rows){if(typeof r!="object"||r===null)throw new Error(`Invalid patch "${e}". Expected each of its rows to be an object of patches, by the name of their field`);for(let[i,s]of Object.entries(r))s!==void 0&&pg(`${e}.${i}`,s,{inTableRow:!0})}return}if(!(t?.type===Ce.DRAWING?!n&&typeof t.patch=="function":t?.type!==Ce.TABLE_ROWS&&Array.isArray(t?.children)))throw new Error(`Invalid patch "${e}". Expected { type: PatchType.PARAGRAPH or PatchType.DOCUMENT, children: [...] }, ${n?"or { type: PatchType.TABLE_ROWS, rows: [...] }":"{ type: PatchType.TABLE_ROWS, rows: [...] }, or a drawing patch such as ImagePatch, or ChartDataPatch from docx/charts"}`)},Vh=new Uf,K2=new Uint8Array([255,254]),G2=new Uint8Array([254,255]),z2=new Set(["w:document","w:hdr","w:ftr","w:footnotes","w:endnotes","w:comments"]),Xh=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},eI=(function(){var e=Kt(function*({outputType:t,data:n,patches:r,keepOriginalStyles:i,placeholderDelimiters:s={start:"{{",end:"}}"},recursive:a=!0,trimPlaceholders:o=!1,footnotes:c,endnotes:l,numbering:u={config:[]},pageNumbers:d,properties:p}){let h=yield Yf(n),f=new Map,m=q2(h),g=[],y=new gf({addOverride:(D,$)=>g.push({contentType:D,partName:$})},new Set([...h.keys()].filter(D=>D.startsWith("word/")).map(D=>D.slice(5)))),T={Media:new mf(D=>y.takePath("media","image",D)),Numbering:new ff(u),Theme:m&&{Colors:m},FootNotes:{View:{idOf:(D,$,q)=>_t("footnotes",D,$,q)}},Endnotes:{View:{idOf:(D,$,q)=>_t("endnotes",D,$,q)}},PackageParts:y},b=new Map,C=[],_=[],w=!1,x=new Map;zf(s);let{start:v,end:A}=s;for(let[D,$]of Object.entries(r))pg(D,$,{inTableRow:!1});for(let[D,$]of h){var N;let q=$.slice(0,2);if(Xh(q,K2)||Xh(q,G2)){x.set(D,$);continue}if(!D.endsWith(".xml")&&!D.endsWith(".rels")){x.set(D,$);continue}let ie=pt(ta($)),se=(N=ie.elements)===null||N===void 0?void 0:N.find(ae=>{var te;return z2.has((te=ae.name)!==null&&te!==void 0?te:"")});if(se&&se.attributes){for(let ae of["mc","wp","r","w15","m","v","o"])se.attributes[`xmlns:${ae}`]=Ml[ae];se.attributes["mc:Ignorable"]=`${se.attributes["mc:Ignorable"]||""} w15`.trim()}b.set(D,ie)}let M=vE([...b.values()].flatMap(Wf)),O=OE([...b.values()].flatMap(Vf)),F=new Map,Q=D=>{let $=F.get(D);if($)return $;let q={Relationships:{addRelationship:(ie,se,ae,te)=>{_.push({key:D,id:ie,type:se,target:ae,targetMode:te})}}};return F.set(D,q),q},Z=D=>({file:T,viewWrapper:Q(D),stack:[]}),V=(D,$)=>{g.push({contentType:D,partName:$})},G=N2(b,Z),de=t2(T.Numbering,b,{createContext:Z,addContentTypeOverride:V}),ce=VE({footnotes:c,endnotes:l},b,{createContext:Z,addContentTypeOverride:V,renumberBookmarks:M,renumberDrawings:O,renumberLists:de.renumber,useStyles:G.use}),_t=(D,$,q,ie)=>ie.viewWrapper===Q("word/document.xml")?ce.carry(D,$,q):void 0;if(o){let D=q=>Object.entries(r).flatMap(([ie,se])=>q(se.type)?[ie]:[]),$={delimiters:{start:v,end:A},textKeys:new Set(D(q=>q!==Ce.TABLE_ROWS&&q!==Ce.DRAWING)),tableRowsKeys:D(q=>q===Ce.TABLE_ROWS),drawingKeys:new Set(D(q=>q===Ce.DRAWING))};for(let[q,ie]of b)q.startsWith("word/")&&!q.endsWith(".rels")&&j2(ie,$)}$E({parts:b,binaryParts:x,file:T,patches:Object.entries(r).flatMap(([D,$])=>$.type===Ce.DRAWING?[[D,$]]:[]),delimiters:{start:v,end:A}},Z);let Ae=Object.entries(r).flatMap(([D,$])=>$.type===Ce.DRAWING?[]:[[D,$]]),Ue=[...Ae.filter(([,D])=>D.type===Ce.TABLE_ROWS),...Ae.filter(([,D])=>D.type!==Ce.TABLE_ROWS)];for(let[D,$]of[...b]){if(!D.startsWith("word/")||D.endsWith(".xml.rels"))continue;let q=Z(D);f.set(D,q);let ie=W2($),se=(ae,te,Re)=>{if(Re.type===Ce.TABLE_ROWS){I2({json:ae,key:te,patch:Re,delimiters:{start:v,end:A},patchPlaceholder:se,renumberDrawings:O});return}let Uc=[],{didFindOccurrence:Zg}=p2({json:ae,patch:k(k({},Re),{},{children:Re.children.flatMap(je=>je instanceof qm?je.writtenAs:[je]).map(je=>{if(je instanceof O1){let{target:eb,anchor:tb}=Wm(je.options.link),jc=new mc(je.options.children,$n(),tb,je.options.link);return Uc.push({key:D,id:jc.linkId,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",target:eb,targetMode:oc.EXTERNAL}),jc}else return je})}),patchText:`${v}${te}${A}`,context:q,keepOriginalStyles:i,recursive:a,renumberIds:je=>G.use(de.renumber(ce.renumber(M(O(ie(je))))))});Zg&&_.push(...Uc)};for(let[ae,te]of Ue)se($,ae,te)}ce.write(),de.write(),G.write();for(let[D,$]of b){if(!D.startsWith("word/")||D.endsWith(".xml.rels"))continue;let q=Vh.getMediaData(JSON.stringify($),T.Media);q.length>0&&(w=!0,C.push({key:D,mediaDatas:q}))}for(let{key:D,mediaDatas:$}of C){var we;let q=Qe(D),ie=(we=b.get(q))!==null&&we!==void 0?we:Ur();b.set(q,ie);let se=Cc(ie),ae=Vh.replace(JSON.stringify(b.get(D)),$,se);b.set(D,JSON.parse(ae));for(let te=0;te<$.length;te++){let{fileName:Re}=$[te];Kl(ie,se+te,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${Re}`)}}for(let{key:D,id:$,type:q,target:ie,targetMode:se}of _){var ye;let ae=Qe(D),te=(ye=b.get(ae))!==null&&ye!==void 0?ye:Ur();b.set(ae,te),Kl(te,$,q,ie,se)}d&&(yield s2(b,d,x)),p&&NE(b,x,p,{addContentTypeOverride:V});let re=Tc(T,void 0);if(w||g.length>0){let D=b.get("[Content_Types].xml");if(!D)throw new Error("Could not find content types file");w&&(On(D,"image/png","png"),On(D,"image/jpeg","jpeg"),On(D,"image/jpeg","jpg"),On(D,"image/bmp","bmp"),On(D,"image/gif","gif"),On(D,"image/svg+xml","svg"));for(let{contentType:$,partName:q}of g)yE(D,$,q)}return jl(qs([...[...b].map(([D,$])=>[D,px($)]),...x,...T.Media.Array.map(({data:D,fileName:$})=>[`word/media/${$}`,D]),...re.map(({path:D,data:$})=>[D,$])]),t,"application/vnd.openxmlformats-officedocument.wordprocessingml.document")});return function(n){return e.apply(this,arguments)}})(),V2=e=>e.startsWith("word/")&&/\.(xml|rels)$/.test(e)&&!e.endsWith(".xml.rels"),tI=(function(){var e=Kt(function*({data:t,placeholderDelimiters:n={start:"{{",end:"}}"},trimPlaceholders:r=!1}){zf(n);let i=X2(n),s=yield Yf(t,V2),a=new Set;for(let[,o]of s){let c=pt(ta(o));[...ng(c).map(l=>l.text),...na(c).flatMap(({properties:l})=>Xf(l))].flatMap(l=>{var u;return(u=l.match(i))!==null&&u!==void 0?u:[]}).map(l=>r?l.trim():l).filter(l=>l!=="").forEach(l=>a.add(l))}return Array.from(a)});return function(n){return e.apply(this,arguments)}})(),Nl=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X2=({start:e,end:t})=>new RegExp(`(?<=${Nl(e)})(?:(?!${Nl(e)}).)+?(?=${Nl(t)})`,"gs")});var wg={};ii(wg,{EXPORT_DIR:()=>Qr,FORMATS:()=>Nc,TX:()=>Jr,buildIR:()=>aa,caseRows:()=>sa,exportDoc:()=>Pc,irToDocx:()=>vg,irToHtml:()=>oa});import hg from"node:fs";import mg from"node:path";function Y2(e){return`${String(e.getDate()).padStart(2,"0")}/${String(e.getMonth()+1).padStart(2,"0")}/${e.getFullYear()}`}function Q2(e,t){let n=e.result;if(!n)return[t.status["not-run"]];let r=[t.status[n.status]];return n.actual&&r.push(t.actual+n.actual),n.bug&&r.push(t.bug+n.bug),r}function sa(e,t,n,r){let i=e.kind==="non-functional",s=e.cases.filter(l=>!l.deleted),a=[...i?n.headNf:n.headFn],o=[7,27,38,28];t.results&&(a.push(...n.headResult),o=[8,20,27,20,13,12]);let c=s.map((l,u)=>{let p=[[String(u+1),...t.codes?[l.code]:[]],ia(i&&l.requirement||l.case),ia(l.steps),ia(l.expected)];return t.results&&p.push(Q2(l,n),l.result?[l.result.by??"",J2(l.result.at,r)].filter(Boolean):[]),p});return{head:a,widths:o,rows:c}}function gg(e){let t=tn();for(let n of e)yr(n,t);return t}function aa(e,t={}){let n=e.config,r=n.overview??{},i=t.date??new Date,s=n.language==="en"?"en":"vi",a=Jr[s],o=[],c=b=>en(e,b),l=e.modules.filter(b=>c(b.code).some(C=>C.kind==="functional")),u=e.modules.filter(b=>c(b.code).some(C=>C.kind==="non-functional")),d=Ve(e.root,n.ba),p=d?bt(d):null;o.push({k:"cover",lines:[...r.owner?[{text:r.owner.toUpperCase(),bold:!0}]:[],{text:""},{text:a.coverDoc,bold:!0,size:32},{text:a.coverTitle,bold:!0,size:32},{text:n.title,bold:!0,size:28},{text:""},{text:a.docVersion+(r.docVersion||"1.0")},...t.results?[{text:a.withResults}]:[],{text:""},...r.owner?[{text:a.owner+r.owner}]:[],...r.contractor?[{text:a.contractor+r.contractor}]:[],{text:""},{text:(r.place?r.place+", ":"")+(s==="vi"?Y2(i):i.toISOString().slice(0,10))}]}),o.push({k:"pagebreak"}),o.push({k:"p",text:a.signPage,bold:!0});let h=n.members.length?n.members:[{id:"",name:"",role:""}];o.push({k:"table",head:a.signHead,widths:[6,16,30,28,20],rows:h.map((b,C)=>[[String(C+1)],[""],[b.name],[b.role??""],[""]])}),o.push({k:"pagebreak"}),o.push({k:"toc",title:a.toc}),o.push({k:"pagebreak"});let f=0;o.push({k:"h",level:1,text:`${fg[f++]}. ${a.overview}`}),o.push({k:"h",level:2,text:a.purpose}),o.push({k:"p",text:r.purpose||a.purposeText(n.title)}),o.push({k:"h",level:2,text:a.scope}),r.scope?o.push({k:"p",text:r.scope}):(o.push({k:"p",text:a.scopeIntro}),o.push({k:"list",items:e.modules.filter(b=>c(b.code).length).map(b=>b.title)})),o.push({k:"h",level:2,text:a.env}),o.push({k:"p",text:r.environment||a.envDefault}),o.push({k:"h",level:2,text:a.refs}),o.push({k:"p",text:r.references||a.refsIntro}),r.references||o.push({k:"list",items:a.refsList}),o.push({k:"h",level:2,text:a.terms});let m=r.terms?.length?r.terms:a.termsDefault;o.push({k:"table",head:a.termsHead,widths:[8,30,62],rows:m.map((b,C)=>[[String(C+1)],[b.term],[b.desc]])});let g=(b,C,_)=>{if(o.push({k:"pagebreak"}),o.push({k:"h",level:1,text:`${fg[f++]}. ${b}`}),!C.length){o.push({k:"p",text:a.noSuites,italic:!0});return}C.forEach((w,x)=>{o.push({k:"h",level:2,text:`${x+1}. ${w.title}`}),_==="functional"&&w.commonSteps.trim()&&(o.push({k:"p",text:a.commonSteps,bold:!0}),o.push({k:"list",items:ia(w.commonSteps)})),c(w.code).filter(v=>v.kind===_).forEach((v,A)=>{o.push({k:"h",level:3,text:`${x+1}.${A+1}. ${v.title}`});let N=[v.useCases.length?a.useCase+v.useCases.join(", "):"",v.covers.length?a.functions+v.covers.map(O=>p?.get(O)?.title?`${O} (${p.get(O).title})`:O).join("; "):""].filter(Boolean);if(N.length&&o.push({k:"p",text:N.join(" \xB7 "),italic:!0}),v.preconditions&&o.push({k:"p",text:a.pre+v.preconditions}),v.description.trim())for(let O of v.description.trim().split(/\n\s*\n/))o.push({k:"p",text:O.trim()});let M=sa(v,t,a,s);M.rows.length?o.push({k:"table",...M}):o.push({k:"p",text:a.noCases,italic:!0})})})};g(a.chFn,l,"functional"),g(a.chNf,u,"non-functional");let y=[];t.results&&y.push(()=>{o.push({k:"h",level:2,text:a.sumTitle});let b=e.modules.map(w=>({m:w,c:gg(c(w.code))})).filter(w=>w.c.total),C=gg(e.modules.flatMap(w=>c(w.code))),_=w=>w.total?Math.round(100*w.passed/w.total)+"%":"\u2014";o.push({k:"table",head:a.sumHead,widths:[30,10,8,10,9,9,11,13],rows:[...b.map(({m:w,c:x})=>[[w.title],[String(x.total)],[String(x.passed)],[String(x.failed)],[String(x.blocked)],[String(x.skipped)],[String(x["not-run"])],[_(x)]]),[[a.total],[String(C.total)],[String(C.passed)],[String(C.failed)],[String(C.blocked)],[String(C.skipped)],[String(C["not-run"])],[_(C)]]]})});let T=e.suites.filter(b=>b.status!=="deleted"&&b.covers.length);if(T.length&&y.push(()=>{o.push({k:"h",level:2,text:a.matrix});let b=new Map;for(let C of T)for(let _ of C.covers)b.set(_,[...b.get(_)??[],C.title]);o.push({k:"table",head:a.matrixHead,widths:[8,42,50],rows:[...b.entries()].sort((C,_)=>C[0].localeCompare(_[0])).map(([C,_],w)=>[[String(w+1)],[p?.get(C)?.title?`${C} \u2013 ${p.get(C).title}`:C],_])})}),y.length){o.push({k:"pagebreak"}),o.push({k:"h",level:1,text:a.appendix});for(let b of y)b()}return{title:n.title,lang:s,results:!!t.results,nodes:o}}function oa(e){let t=[],n=e.nodes.filter(s=>s.k==="h"),r=0;for(let s of e.nodes)if(s.k==="cover")t.push(`<section class="cover">${s.lines.map(a=>a.text?`<p class="${a.bold?"b":""}"${a.size?` style="font-size:${a.size/2}pt"`:""}>${Et(a.text)}</p>`:"<p>&nbsp;</p>").join("")}</section>`);else if(s.k==="h")t.push(`<h${s.level} id="h${r++}">${Et(s.text)}</h${s.level}>`);else if(s.k==="p")t.push(`<p${s.bold||s.italic?` class="${s.bold?"b":""} ${s.italic?"i":""}"`:""}>${Et(s.text).replace(/\n/g,"<br>")}</p>`);else if(s.k==="list")t.push(`<ul>${s.items.map(a=>`<li>${Et(a)}</li>`).join("")}</ul>`);else if(s.k==="toc")t.push(`<nav class="toc"><p class="b">${Et(s.title)}</p>${n.map((a,o)=>`<a class="l${a.level}" href="#h${o}">${Et(a.text)}</a>`).join("")}</nav>`);else if(s.k==="pagebreak")t.push('<div class="pb"></div>');else if(s.k==="table"){let a=s.widths?`<colgroup>${s.widths.map(o=>`<col style="width:${o}%">`).join("")}</colgroup>`:"";t.push(`<table>${a}<thead><tr>${s.head.map(o=>`<th>${Et(o)}</th>`).join("")}</tr></thead><tbody>${s.rows.map(o=>`<tr>${o.map(c=>`<td>${c.map(Et).join("<br>")}</td>`).join("")}</tr>`).join("")}</tbody></table>`)}return`<!doctype html><html lang="${e.lang}"><head><meta charset="utf-8"><title>${Et(e.title)}</title><style>body{background:#e9ecef;margin:0;font:12pt/1.45 "Times New Roman",serif;color:#111}
4282
5338
  main{background:#fff;max-width:794px;margin:24px auto;padding:72px 64px;box-shadow:0 1px 4px rgba(0,0,0,.15)}
4283
5339
  .cover{text-align:center;min-height:900px;display:flex;flex-direction:column;justify-content:center}.cover p{margin:4px 0}
4284
5340
  .b{font-weight:700}.i{font-style:italic}h1{font-size:14pt;margin:24px 0 10px}h2{font-size:13pt;margin:18px 0 8px}h3{font-size:12pt;margin:14px 0 6px}
@@ -4286,9 +5342,25 @@ p{margin:6px 0;text-align:justify}table{width:100%;border-collapse:collapse;marg
4286
5342
  th,td{border:1px solid #555;padding:4px 6px;vertical-align:top;text-align:left;overflow-wrap:break-word}th{background:#f1f3f5;overflow-wrap:normal;word-break:keep-all}
4287
5343
  .pb{height:0;border-top:1px dashed #ccc;margin:36px -64px;page-break-after:always}.toc a{display:block;color:#111;text-decoration:none;padding:2px 0}
4288
5344
  .toc .l2{padding-left:18px}.toc .l3{padding-left:36px;font-size:11pt}@media print{body{background:#fff}main{box-shadow:none;margin:0;padding:0}.pb{border:0;margin:0}}</style></head><body><main>${t.join(`
4289
- `)}</main></body></html>`}async function Jm(e){let t=[],n=(i,s=!1)=>(i.length?i:[""]).map(a=>new J({children:[new Ie({text:a,bold:s})]}));for(let i of e.nodes)if(i.k==="cover")for(let s of i.lines)t.push(new J({alignment:de.CENTER,spacing:{after:120},children:[new Ie({text:s.text,bold:!!s.bold,...s.size?{size:s.size}:{}})]}));else if(i.k==="h")t.push(new J({heading:uC[Math.min(i.level,3)-1],keepNext:!0,children:[new Ie({text:i.text})]}));else if(i.k==="p")t.push(new J({alignment:de.JUSTIFIED,children:i.text.split(`
4290
- `).map((s,a)=>new Ie({text:s,bold:!!i.bold,italics:!!i.italic,...a?{break:1}:{}}))}));else if(i.k==="list")for(let s of i.items)t.push(new J({bullet:{level:0},children:[new Ie({text:s})]}));else if(i.k==="toc")t.push(new J({alignment:de.CENTER,children:[new Ie({text:i.title,bold:!0})]})),t.push(new bm(i.title,{hyperlink:!0,headingStyleRange:"1-3"}));else if(i.k==="pagebreak")t.push(new J({children:[new bf]}));else if(i.k==="table"){let s=l=>i.widths?.[l]?{width:{size:i.widths[l],type:De.PERCENTAGE}}:{},a=new Ms({tableHeader:!0,cantSplit:!0,children:i.head.map((l,c)=>new Cr({borders:Ym,shading:{fill:"F1F3F5"},...s(c),children:n([l],!0)}))}),o=i.rows.map(l=>new Ms({cantSplit:!1,children:l.map((c,d)=>new Cr({borders:Ym,...s(d),children:n(c)}))}));t.push(new Bf({width:{size:100,type:De.PERCENTAGE},rows:[a,...o]})),t.push(new J({children:[]}))}let r=new gm({creator:"Pan Test",title:e.title,features:{updateFields:!0},styles:{default:{document:{run:{font:"Times New Roman",size:26}}}},sections:[{properties:{page:{margin:{top:1134,bottom:1134,left:1701,right:1134}}},children:t}]});return oc.toBuffer(r)}async function hc(e,t={}){let n=Ws(e,t),r=Gm.resolve(e.root,t.out??$r);Km.mkdirSync(r,{recursive:!0});let i=t.date??new Date,s=Gm.join(r,`${hC(e.config.title)}${t.results?"-ket-qua":""}-${i.toISOString().slice(0,10)}`),a=[];for(let o of t.formats??["docx"]){let l=`${s}.${o}`;Km.writeFileSync(l,o==="docx"?await Jm(n):js(n)),a.push(l)}return a}var zm,Vm,qs,cC,bt,Us,Ym,uC,$r,uc,hC,Ks=ze(()=>{"use strict";E();jm();zi();ss();ns();zm={"not-run":"Ch\u01B0a test",passed:"\u0110\u1EA1t",failed:"Kh\xF4ng \u0111\u1EA1t",blocked:"B\u1ECB ch\u1EB7n",skipped:"B\u1ECF qua"},Vm=["I","II","III","IV","V","VI"],qs=e=>String(e??"").split(`
4291
- `).map(t=>t.replace(/^\s*[-*+]\s+/,"").trimEnd()).filter(t=>t.trim());cC=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e??"");return t?`${t[3]}/${t[2]}/${t[1]}`:e??""};bt=e=>e.replace(/[&<>"]/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t]);Us={style:Lr.SINGLE,size:4,color:"555555"},Ym={top:Us,bottom:Us,left:Us,right:Us},uC=[Rs.HEADING_1,Rs.HEADING_2,Rs.HEADING_3];$r="exports",uc=["docx","html"],hC=e=>e.normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/đ/g,"d").replace(/Đ/g,"D").replace(/[^A-Za-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)||"tai-lieu-kiem-thu"});var sg={};xc(sg,{CSP:()=>gc,VIEW_CSP:()=>mc,createDocServer:()=>wC,embedSources:()=>rg});import{randomBytes as fC,timingSafeEqual as mC}from"node:crypto";import fc from"node:fs";import gC from"node:http";import vt from"node:path";import{fileURLToPath as bC}from"node:url";function eg(e){if(typeof L<"u"&&L[e]!==void 0)return L[e];for(let t of[vt.join(Zm,"ui"),vt.join(Zm,"..","..","src","doc","ui")]){let n=vt.join(t,Gs[e].file);if(fc.existsSync(n))return fc.readFileSync(n,"utf8")}throw new Error(`Thi\u1EBFu t\u1EC7p giao di\u1EC7n ${e}`)}function ig(e){let t=zt(e.root,e.config.ba);return t?Gt(t):null}function vC(e){let t=ig(e);return{root:e.root,me:Vt(e.root),config:e.config,modules:e.modules,suites:e.suites,readErrors:e.readErrors,ba:t?{linked:!0,items:[...t.values()].filter(n=>!n.deleted&&(n.type==="function"||n.type==="screen")).map(n=>({code:n.code,title:n.title,type:n.type}))}:{linked:!1,path:e.config.ba??null,items:[]},summary:is(e,t)}}function ng(e){let t={};for(let n of["case","steps","expected","requirement","tag"])ne(e[n])!==void 0&&(t[n]=ne(e[n]));return ne(e.priority)!==void 0&&(t.priority=ne(e.priority)),t}function wC(e){let t=ji(e.start);if(!t)throw new z(`Kh\xF4ng th\u1EA5y repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED (.pantest.yaml) t\u1EEB ${vt.resolve(e.start)}. T\u1EA1o b\u1EB1ng: pan-test doc init`);let n=e.token??fC(24).toString("hex"),r=rg(e.embed),i=r.length?gc.replace("frame-ancestors 'none'",`frame-ancestors ${r.join(" ")}`):gc,s=d=>({status:200,body:d}),a=r.length?mc.replace("frame-ancestors 'self'",`frame-ancestors 'self' ${r.join(" ")}`):mc,o={"/api/export":async(d,p)=>{let u=(Array.isArray(d.formats)?d.formats:["docx"]).map(String).filter(m=>uc.includes(m)),f=await hc(p,{formats:u.length?u:["docx"],results:d.results===!0,codes:d.codes===!0});return s({ok:!0,dir:vt.join(p.root,$r),files:f.map(m=>vt.relative(p.root,m).split(vt.sep).join("/"))})},"/api/open":async(d,p)=>{let u=vt.join(p.root,$r);fc.mkdirSync(u,{recursive:!0});let{spawn:f}=await import("node:child_process"),m=process.platform==="darwin"?"open":process.platform==="win32"?"explorer":"xdg-open";try{f(m,[u],{stdio:"ignore",detached:!0,windowsHide:!0}).unref()}catch{}return s({ok:!0,dir:u})}},l={"/api/module/new":(d,p)=>s(Xi(p,String(d.code??"").trim().toUpperCase(),String(d.title??"").trim())),"/api/module":(d,p)=>s(Bo(p,String(d.code),{...ne(d.title)!==void 0?{title:ne(d.title)}:{},...ne(d.commonSteps)!==void 0?{commonSteps:ne(d.commonSteps)}:{}})),"/api/suite/new":(d,p)=>s(Yi(p,{module:String(d.module),title:String(d.title??""),...d.kind==="non-functional"?{kind:"non-functional"}:{},..._n(d.covers)?{covers:_n(d.covers)}:{},...ne(d.after)?{after:ne(d.after)}:{},avoid:vn(p.root)})),"/api/suite":(d,p)=>{let u={};for(let f of["title","preconditions","description","owner"])ne(d[f])!==void 0&&(u[f]=ne(d[f]));return(d.kind==="functional"||d.kind==="non-functional")&&(u.kind=d.kind),(d.status==="drafting"||d.status==="done"||d.status==="deleted")&&(u.status=d.status),ne(d.priority)!==void 0&&(u.priority=ne(d.priority)),_n(d.covers)&&(u.covers=_n(d.covers)),_n(d.useCases)&&(u.useCases=_n(d.useCases)),s(Eu(p,String(d.code),u))},"/api/case/new":(d,p)=>s(Ji(p,String(d.suite),{case:"",...ng(d)},{...ne(d.after)?{after:ne(d.after)}:{},avoid:vn(p.root)})),"/api/case":(d,p)=>s(Zi(p,String(d.code),ng(d))),"/api/case/move":(d,p)=>s(Cu(p,String(d.code),d.dir===-1?-1:1)),"/api/case/delete":(d,p)=>s(es(p,String(d.code),ne(d.reason)??"")),"/api/result":(d,p)=>s(ts(p,String(d.code),{status:String(d.status),...ne(d.actual)!==void 0?{actual:ne(d.actual)}:{},...ne(d.env)!==void 0?{env:ne(d.env)}:{},...ne(d.bug)!==void 0?{bug:ne(d.bug)}:{}}))},c=gC.createServer((d,p)=>{let u=(h,g,v)=>{p.writeHead(h,{"Content-Type":v,"X-Content-Type-Options":"nosniff","Referrer-Policy":"no-referrer","Cache-Control":"no-store","Content-Security-Policy":i}),p.end(d.method==="HEAD"?void 0:g)},f=(h,g)=>u(h,JSON.stringify(g),"application/json; charset=utf-8"),m=h=>f(h instanceof z?400:500,{ok:!1,error:h.message});try{let h=c.address()?.port,g=String(d.headers.host||""),v=[`127.0.0.1:${h}`,`localhost:${h}`];if(!v.includes(g))return f(403,{error:"Host kh\xF4ng h\u1EE3p l\u1EC7"});let w=new URL(d.url||"/",`http://${g}`),b=w.pathname;if(d.method==="POST"){let A=l[b]??o[b];if(!A)return f(404,{error:"Kh\xF4ng c\xF3"});let y=String(d.headers.origin||"");if(y&&!v.some(M=>y===`http://${M}`))return f(403,{error:"Origin kh\xF4ng h\u1EE3p l\u1EC7"});let T=Buffer.from(String(d.headers["x-pan-test-token"]||"")),x=Buffer.from(n);if(T.length!==x.length||!mC(T,x))return f(403,{error:"Thi\u1EBFu token phi\xEAn"});if(!String(d.headers["content-type"]||"").startsWith("application/json"))return f(415,{error:"C\u1EA7n application/json"});let _=[],N=0;d.on("data",M=>{N+=M.length,N>tg?(f(413,{error:"Qu\xE1 l\u1EDBn"}),d.destroy()):_.push(M)}),d.on("end",()=>{if(N>tg)return;let M;try{M=JSON.parse(Buffer.concat(_).toString("utf8")||"{}")}catch{return f(400,{error:"JSON sai"})}Promise.resolve().then(()=>A(M,ct(t))).then(D=>f(D.status,D.body)).catch(m)});return}if(d.method!=="GET"&&d.method!=="HEAD")return f(405,{error:"Ch\u1EC9 cho GET/POST"});if(b==="/"||b==="/index.html"){let A=w.searchParams.get("lang")||e.lang||ct(t).config.language,y=eg("index.html").replace(/<head[^>]*>/,T=>`${T}<meta name="pantest-token" content="${n}"><meta name="panba-lang" content="${A==="en"?"en":"vi"}">`);return u(200,y,Gs["index.html"].type)}let C=/^\/ui\/([a-z0-9.]+)$/.exec(b);if(C&&Gs[C[1]])return u(200,eg(C[1]),Gs[C[1]].type);if(b==="/favicon.ico")return u(204,"","image/x-icon");if(b==="/api/index")return f(200,vC(ct(t)));if(b==="/view/doc"){let A=js(Ws(ct(t),{results:w.searchParams.get("results")==="1",codes:w.searchParams.get("codes")==="1"}));return p.writeHead(200,{"Content-Type":"text/html; charset=utf-8","X-Content-Type-Options":"nosniff","Referrer-Policy":"no-referrer","Cache-Control":"no-store","Content-Security-Policy":a}),p.end(d.method==="HEAD"?void 0:A)}if(b==="/api/check"){let A=ct(t);return f(200,{findings:rs(A,ig(A))})}return f(404,{error:"Kh\xF4ng c\xF3"})}catch(h){return m(h)}});return Object.assign(c,{token:n,root:t})}var Zm,Gs,mc,gc,tg,rg,ne,_n,ag=ze(()=>{"use strict";E();zi();ss();ns();Ks();sr();Zm=vt.dirname(bC(import.meta.url)),Gs={"index.html":{file:"index.html",type:"text/html; charset=utf-8"},"tokens.css":{file:"tokens.css",type:"text/css; charset=utf-8"},"shell.js":{file:"shell.browser.js",type:"text/javascript; charset=utf-8"},"i18n.js":{file:"i18n.browser.js",type:"text/javascript; charset=utf-8"},"app.js":{file:"app.browser.js",type:"text/javascript; charset=utf-8"}};mc="default-src 'none'; style-src 'unsafe-inline'; img-src 'self' data:; base-uri 'none'; form-action 'none'; frame-ancestors 'self'",gc="default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; connect-src 'self'; font-src 'self'; frame-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'",tg=4*1024*1024,rg=e=>(e??[]).filter(t=>/^[a-z][a-z0-9+.-]*:$/.test(t)||/^https?:\/\/[A-Za-z0-9.-]+(:\d+)?$/.test(t)),ne=e=>typeof e=="string"?e:void 0,_n=e=>Array.isArray(e)?e.map(String).map(t=>t.trim()).filter(Boolean):void 0});E();E();import yC from"node:fs";import vc from"node:path";E();Ur();An();sr();zi();ns();ss();Ks();var og=`pan-test doc \u2014 t\xE0i li\u1EC7u k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED
5345
+ `)}</main></body></html>`}async function vg(e){let t=[],n=(i,s=!1)=>(i.length?i:[""]).map(a=>new ne({children:[new Oe({text:a,bold:s})]}));for(let i of e.nodes)if(i.k==="cover")for(let s of i.lines)t.push(new ne({alignment:ue.CENTER,spacing:{after:120},children:[new Oe({text:s.text,bold:!!s.bold,...s.size?{size:s.size}:{}})]}));else if(i.k==="h")t.push(new ne({heading:Z2[Math.min(i.level,3)-1],keepNext:!0,children:[new Oe({text:i.text})]}));else if(i.k==="p")t.push(new ne({alignment:ue.JUSTIFIED,children:i.text.split(`
5346
+ `).map((s,a)=>new Oe({text:s,bold:!!i.bold,italics:!!i.italic,...a?{break:1}:{}}))}));else if(i.k==="list")for(let s of i.items)t.push(new ne({bullet:{level:0},children:[new Oe({text:s})]}));else if(i.k==="toc")t.push(new ne({alignment:ue.CENTER,children:[new Oe({text:i.title,bold:!0})]})),t.push(new Ff(i.title,{hyperlink:!0,headingStyleRange:"1-3"}));else if(i.k==="pagebreak")t.push(new ne({children:[new $m]}));else if(i.k==="table"){let s=c=>i.widths?.[c]?{width:{size:i.widths[c],type:Fe.PERCENTAGE}}:{},a=new Js({tableHeader:!0,cantSplit:!0,children:i.head.map((c,l)=>new Fr({borders:bg,shading:{fill:"F1F3F5"},...s(l),children:n([c],!0)}))}),o=i.rows.map(c=>new Js({cantSplit:!1,children:c.map((l,u)=>new Fr({borders:bg,...s(u),children:n(l)}))}));t.push(new sf({width:{size:100,type:Fe.PERCENTAGE},rows:[a,...o]})),t.push(new ne({children:[]}))}let r=new $f({creator:"Pan Test",title:e.title,features:{updateFields:!0},styles:{default:{document:{run:{font:"Times New Roman",size:26}}}},sections:[{properties:{page:{margin:{top:1134,bottom:1134,left:1701,right:1134}}},children:t}]});return Sc.toBuffer(r)}async function Pc(e,t={}){let n=aa(e,t),r=mg.resolve(e.root,t.out??Qr);hg.mkdirSync(r,{recursive:!0});let i=t.date??new Date,s=mg.join(r,`${eA(e.config.title)}${t.results?"-ket-qua":""}-${i.toISOString().slice(0,10)}`),a=[];for(let o of t.formats??["docx"]){let c=`${s}.${o}`;hg.writeFileSync(c,o==="docx"?await vg(n):oa(n)),a.push(c)}return a}var Jr,fg,ia,J2,Et,ra,bg,Z2,Qr,Nc,eA,Zr=Se(()=>{"use strict";S();ug();Nn();xr();wr();Jr={vi:{status:{"not-run":"Ch\u01B0a test",passed:"\u0110\u1EA1t",failed:"Kh\xF4ng \u0111\u1EA1t",blocked:"B\u1ECB ch\u1EB7n",skipped:"B\u1ECF qua"},actual:"Th\u1EF1c t\u1EBF: ",bug:"L\u1ED7i: ",headFn:["STT","T\xECnh hu\u1ED1ng","C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n","K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i"],headNf:["STT","Y\xEAu c\u1EA7u","K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED","K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i"],headResult:["K\u1EBFt qu\u1EA3","Ng\u01B0\u1EDDi test / ng\xE0y"],coverDoc:"T\xC0I LI\u1EC6U",coverTitle:"K\u1ECACH B\u1EA2N KI\u1EC2M TH\u1EEC (CH\u1EE8C N\u0102NG, PHI CH\u1EE8C N\u0102NG)",docVersion:"Phi\xEAn b\u1EA3n t\xE0i li\u1EC7u: ",withResults:"B\u1EA3n k\xE8m k\u1EBFt qu\u1EA3 ki\u1EC3m th\u1EED",owner:"\u0110\u01A1n v\u1ECB qu\u1EA3n l\xFD: ",contractor:"\u0110\u01A1n v\u1ECB th\u1EF1c hi\u1EC7n: ",signPage:"TRANG K\xDD",signHead:["TT","Ng\xE0y","H\u1ECD t\xEAn","Vai tr\xF2","K\xFD t\xEAn"],toc:"M\u1EE4C L\u1EE4C",overview:"T\u1ED4NG QUAN",purpose:"1. M\u1EE5c \u0111\xEDch t\xE0i li\u1EC7u",purposeText:e=>`T\xE0i li\u1EC7u n\xE0y m\xF4 t\u1EA3 c\xE1c t\xECnh hu\u1ED1ng ki\u1EC3m th\u1EED ch\u1EE9c n\u0103ng v\xE0 phi ch\u1EE9c n\u0103ng c\u1EE7a ${e}, l\xE0m c\u0103n c\u1EE9 ki\u1EC3m th\u1EED ch\u1EA5p nh\u1EADn (UAT) v\xE0 b\xE0n giao.`,scope:"2. Ph\u1EA1m vi",scopeIntro:"T\xE0i li\u1EC7u ki\u1EC3m th\u1EED c\xE1c ch\u1EE9c n\u0103ng, th\u1ECFa m\xE3n c\xE1c \u0111\u1EA7u m\u1EE5c ch\xEDnh nh\u01B0 sau:",env:"3. Th\xF4ng tin m\xF4i tr\u01B0\u1EDDng ki\u1EC3m th\u1EED",envDefault:"\u0110\u01B0\u1EDDng d\u1EABn / m\xE1y ch\u1EE7: (b\u1ED5 sung)",refs:"4. T\xE0i li\u1EC7u li\xEAn quan",refsIntro:"T\xE0i li\u1EC7u n\xE0y \u0111\u01B0\u1EE3c x\xE2y d\u1EF1ng d\u1EF1a tr\xEAn c\xE1c t\xE0i li\u1EC7u:",refsList:["T\xE0i li\u1EC7u \u0111\u1EB7c t\u1EA3 y\xEAu c\u1EA7u ph\u1EA7n m\u1EC1m;","T\xE0i li\u1EC7u thi\u1EBFt k\u1EBF chi ti\u1EBFt;","T\xE0i li\u1EC7u \u0111\u1EB7c t\u1EA3 chi ti\u1EBFt ch\u1EE9c n\u0103ng."],terms:"5. Thu\u1EADt ng\u1EEF v\xE0 \u0111\u1ECBnh ngh\u0129a",termsHead:["STT","Thu\u1EADt ng\u1EEF / vi\u1EBFt t\u1EAFt","M\xF4 t\u1EA3"],termsDefault:[{term:"UAT",desc:"Ki\u1EC3m th\u1EED ch\u1EA5p nh\u1EADn ng\u01B0\u1EDDi d\xF9ng (User Acceptance Test)"},{term:"K\u1ECBch b\u1EA3n",desc:"T\u1EADp t\xECnh hu\u1ED1ng ki\u1EC3m th\u1EED cho m\u1ED9t ch\u1EE9c n\u0103ng / use case"},{term:"T\xECnh hu\u1ED1ng",desc:"M\u1ED9t tr\u01B0\u1EDDng h\u1EE3p ki\u1EC3m th\u1EED: c\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n v\xE0 k\u1EBFt qu\u1EA3 mong \u0111\u1EE3i"}],chFn:"CHI TI\u1EBET T\xCCNH HU\u1ED0NG KI\u1EC2M TH\u1EEC Y\xCAU C\u1EA6U CH\u1EE8C N\u0102NG \u1EE8NG D\u1EE4NG",chNf:"CHI TI\u1EBET T\xCCNH HU\u1ED0NG KI\u1EC2M TH\u1EEC Y\xCAU C\u1EA6U PHI CH\u1EE8C N\u0102NG \u1EE8NG D\u1EE4NG",noSuites:"(Ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n.)",noCases:"(Ch\u01B0a c\xF3 t\xECnh hu\u1ED1ng.)",commonSteps:"C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n chung:",useCase:"Use case: ",functions:"Ch\u1EE9c n\u0103ng: ",pre:"\u0110i\u1EC1u ki\u1EC7n ti\xEAn quy\u1EBFt: ",appendix:"PH\u1EE4 L\u1EE4C",sumTitle:"T\u1ED5ng h\u1EE3p k\u1EBFt qu\u1EA3 ki\u1EC3m th\u1EED",sumHead:["Ph\xE2n h\u1EC7","T\xECnh hu\u1ED1ng","\u0110\u1EA1t","Kh\xF4ng \u0111\u1EA1t","B\u1ECB ch\u1EB7n","B\u1ECF qua","Ch\u01B0a test","T\u1EF7 l\u1EC7 \u0111\u1EA1t"],total:"T\u1ED5ng",matrix:"Ma tr\u1EADn ch\u1EE9c n\u0103ng \u2013 k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED",matrixHead:["STT","Ch\u1EE9c n\u0103ng / m\xE0n (t\xE0i li\u1EC7u BA)","K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED"]},en:{status:{"not-run":"Not run",passed:"Passed",failed:"Failed",blocked:"Blocked",skipped:"Skipped"},actual:"Actual: ",bug:"Bug: ",headFn:["No.","Test case","Steps","Expected result"],headNf:["No.","Requirement","Test scenario","Expected result"],headResult:["Result","Tester / date"],coverDoc:"DOCUMENT",coverTitle:"TEST SCENARIOS (FUNCTIONAL, NON-FUNCTIONAL)",docVersion:"Document version: ",withResults:"With test results",owner:"Owner: ",contractor:"Contractor: ",signPage:"SIGN-OFF",signHead:["No.","Date","Full name","Role","Signature"],toc:"TABLE OF CONTENTS",overview:"OVERVIEW",purpose:"1. Purpose",purposeText:e=>`This document describes the functional and non-functional test scenarios of ${e}, used for user acceptance testing (UAT) and handover.`,scope:"2. Scope",scopeIntro:"The document covers the following main areas:",env:"3. Test environment",envDefault:"URL / server: (to be added)",refs:"4. Related documents",refsIntro:"This document is based on:",refsList:["Software requirements specification;","Detailed design;","Detailed functional specification."],terms:"5. Terms and definitions",termsHead:["No.","Term / abbreviation","Description"],termsDefault:[{term:"UAT",desc:"User Acceptance Test"},{term:"Test suite",desc:"The test cases of one function / use case"},{term:"Test case",desc:"One check: steps to perform and the expected result"}],chFn:"FUNCTIONAL TEST SCENARIOS",chNf:"NON-FUNCTIONAL TEST SCENARIOS",noSuites:"(No test suites yet.)",noCases:"(No test cases yet.)",commonSteps:"Common steps:",useCase:"Use case: ",functions:"Functions: ",pre:"Preconditions: ",appendix:"APPENDIX",sumTitle:"Test results summary",sumHead:["Module","Test cases","Passed","Failed","Blocked","Skipped","Not run","Pass rate"],total:"Total",matrix:"Function \u2013 test suite matrix",matrixHead:["No.","Function / screen (BA document)","Test suite"]}},fg=["I","II","III","IV","V","VI"],ia=e=>String(e??"").split(`
5347
+ `).map(t=>t.replace(/^\s*[-*+]\s+/,"").trimEnd()).filter(t=>t.trim());J2=(e,t)=>{let n=/^(\d{4})-(\d{2})-(\d{2})/.exec(e??"");return n&&t==="vi"?`${n[3]}/${n[2]}/${n[1]}`:e??""};Et=e=>e.replace(/[&<>"]/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t]);ra={style:Gr.SINGLE,size:4,color:"555555"},bg={top:ra,bottom:ra,left:ra,right:ra},Z2=[Ys.HEADING_1,Ys.HEADING_2,Ys.HEADING_3];Qr="exports",Nc=["docx","html"],eA=e=>e.normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/đ/g,"d").replace(/Đ/g,"D").replace(/[^A-Za-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)||"tai-lieu-kiem-thu"});function kg(e){return e==="mixed"?["vi","en"]:[e]}function Ic(e){let t=[];for(let n of kg(e))for(let r of tA)for(let i of xg[n][r])t.push({kind:r,keyword:i});return t.sort((n,r)=>r.keyword.length-n.keyword.length)}function Oc(e){let t=[rA];for(let n of kg(e))for(let r of nA)t.push(...xg[n][r]);return t.sort((n,r)=>r.length-n.length)}function oA(e,t){for(let{kind:n,keyword:r}of t){let i=`${r}:`;if(e.startsWith(i))return{kind:n,keyword:r,title:e.slice(i.length).trim()}}return null}function lA(e,t){for(let n of t){let r=`${n} `;if(!e.startsWith(r))continue;let i=e.slice(r.length).trim();if(i)return{keyword:n,text:i}}return null}function cA(e){return e.trim().split(/\s+/).filter(t=>t.startsWith("@"))}function dA(e,t){let n=e.find(s=>s.trim()!=="");if(!n)return"mixed";let r=n.trim().match(iA);if(!r)return"mixed";let i=r[1].toLowerCase();if(i!=="vi"&&i!=="en")throw new Error(`Unsupported Gherkin language "${r[1]}" in ${t} (supported: vi, en)`);return i}function yg(e){if(!e.startsWith("|"))return null;let t=e.split("|");return t.length<2?null:t.slice(1,t.at(-1)?.trim()===""?-1:void 0).map(r=>r.trim())}function Tg(e){return e.length>0?e[e.length-1]:null}function pA(e,t){let n=Tg(e);n&&(n.dataTable||(n.dataTable=[]),n.dataTable.push(t))}function uA(e,t){let n=Tg(e);n&&(n.docString=t)}function hA(e,t){let{scenario:n,startLine:r,endLine:i}=e;return n.lineRange={start:r,end:i},n.rawBlock=t.slice(r-1,i).join(`
5348
+ `),n}function Sg(e,t){let n=e.split(/\r?\n/),r=dA(n,t),i=sA[r],s=aA[r],a=[],o="",c=[],l=[],u=[],d=0,p=null,h="none",f,m=[],g=!1,y=[],T=null;function b(){return h==="background"?c:h==="ruleBackground"?m:p&&h==="scenario"?p.scenario.ownSteps:null}let C=new Map;function _(){if(!p)return;let w=hA(p,n);C.set(w,[...p.ruleBackgroundSteps]),l.push(w),p=null}for(let w=0;w<n.length;w+=1){let x=n[w],v=w+1,A=x.trim();if(!A)continue;if(g){A==='"""'?(T&&uA(T,y.join(`
5349
+ `)),g=!1,y=[],T=null):y.push(x),p&&(p.endLine=v);continue}if(A.startsWith("@")){u.length===0&&(d=v),u.push(...cA(x));continue}if(A.startsWith("#"))continue;let N=oA(A,i);if(N){switch(N.kind){case"feature":_(),a=[...u],o=N.title,f=void 0,m=[],h="none";break;case"background":_(),h=f!==void 0?"ruleBackground":"background";break;case"rule":_(),f=N.title,m=[],h="none";break;case"scenario":case"scenarioOutline":{_();let F=u.length>0?d:v;p={startLine:F,endLine:v,ruleBackgroundSteps:[...m],scenario:{tags:[...u],title:N.title,keyword:N.keyword,isOutline:N.kind==="scenarioOutline",rule:f,steps:[],ownSteps:[],examples:[],rawBlock:"",lineRange:{start:F,end:v}}},h="scenario";break}case"examples":p&&(p.scenario.examples.push({keyword:N.keyword,headers:[],rows:[]}),p.endLine=v,h="examples");break}u=[];continue}let M=lA(A,s);if(M){h==="background"?c.push(M):h==="ruleBackground"?m.push(M):p&&(p.scenario.ownSteps.push(M),p.endLine=v,h="scenario");continue}if(h==="examples"&&p){let F=yg(A);if(F){let Q=p.scenario.examples[p.scenario.examples.length-1];Q.headers.length===0?Q.headers=F:Q.rows.push(F),p.endLine=v;continue}}if(A==='"""'){let F=b();if(F&&F.length>0){g=!0,y=[],T=F,p&&(p.endLine=v);continue}}let O=yg(A);if(O){let F=b();if(F){pA(F,O),p&&(p.endLine=v);continue}}p&&(p.endLine=v)}_();for(let w of l){let x=C.get(w)??[];w.steps=[...c,...x,...w.ownSteps]}return{filePath:t,language:r,featureTags:a,featureTitle:o,backgroundSteps:c,scenarios:l}}var xg,tA,nA,rA,iA,sA,aA,Cg=Se(()=>{"use strict";S();xg={vi:{feature:["T\xEDnh n\u0103ng"],background:["B\u1ED1i c\u1EA3nh"],rule:["Quy t\u1EAFc"],scenario:["T\xECnh hu\u1ED1ng","K\u1ECBch b\u1EA3n"],scenarioOutline:["Khung t\xECnh hu\u1ED1ng","Khung k\u1ECBch b\u1EA3n","K\u1ECBch b\u1EA3n m\u1EABu"],examples:["D\u1EEF li\u1EC7u","V\xED d\u1EE5"],given:["Bi\u1EBFt","Cho"],when:["Khi"],then:["Th\xEC"],and:["V\xE0"],but:["Nh\u01B0ng"]},en:{feature:["Feature"],background:["Background"],rule:["Rule"],scenario:["Scenario","Example"],scenarioOutline:["Scenario Outline","Scenario Template"],examples:["Examples","Scenarios"],given:["Given"],when:["When"],then:["Then"],and:["And"],but:["But"]}},tA=["feature","background","rule","scenario","scenarioOutline","examples"],nA=["given","when","then","and","but"],rA="*",iA=/^#\s*language\s*:\s*(.+?)\s*$/;sA={vi:Ic("vi"),en:Ic("en"),mixed:Ic("mixed")},aA={vi:Oc("vi"),en:Oc("en"),mixed:Oc("mixed")}});function Eg(e){let t=[];Ag(e.suites??[],t);let n=0,r=0,i=0,s=0;for(let a of t)a.status==="skipped"?s++:a.flaky?i++:a.status==="passed"?n++:r++;return{passed:n,failed:r,flaky:i,skipped:s,specs:t}}function Ag(e,t,n=""){for(let r of e){let i=r.file??n;for(let s of r.specs??[])t.push(mA(s,s.file??i));r.suites&&Ag(r.suites,t,i)}}function mA(e,t){let n=e.tests??[],r="skipped",i=!1,s=0,a;for(let o of n){let c=o.results??[];for(let u of c)s+=Number(u.duration??0)||0;let l=o.status;if(l==="flaky")i=!0,r="passed";else if(l==="expected")r="passed";else if(l==="unexpected")r="failed";else if(l==="skipped")r="skipped";else{let u=c[c.length-1]?.status;r=u==="passed"?"passed":u==="skipped"?"skipped":u?"failed":r}if(!a){let u=c.find(p=>p.error?.message||p.errors&&p.errors[0]?.message),d=u?.error?.message??u?.errors?.[0]?.message;d&&(a=fA(d).split(`
5350
+ `).slice(0,4).join(`
5351
+ `))}}return{title:e.title??"(untitled)",file:t,tags:(e.tags??[]).map(o=>o.startsWith("@")?o:`@${o}`),status:r,flaky:i,durationMs:s,errorText:a}}function fA(e){return e.replace(/\u001b\[[0-9;]*[a-zA-Z]/g,"")}var _g=Se(()=>{"use strict";S()});var Dc={};ii(Dc,{applyRunResults:()=>Mc,featureFiles:()=>wA,importFeature:()=>Lc,parseRunResults:()=>la,readRunResults:()=>yA,scenarioTag:()=>Ng,scenarioToCase:()=>Ig});import ei from"node:fs";import Rc from"node:path";function Ng(e,t=[]){let n=new Set(t.map(r=>r.toLowerCase()));return e.find(r=>!/^@p\d+$/i.test(r)&&!/^@domain-/i.test(r)&&!n.has(r.toLowerCase())&&!/^@(guide-video|flake|skip|wip|manual)$/i.test(r))}function Pg(e){let t=e.text;return e.dataTable?.length&&(t+=" "+e.dataTable.map(n=>n.join(" | ")).join("; ")),e.docString&&(t+=" \xAB"+e.docString.trim().replace(/\s+/g," ").slice(0,200)+"\xBB"),t}function Ig(e){let t=[],n=[],r="do";for(let a of e.ownSteps){let o=a.keyword.trim();vA.test(o)?r="expect":(gA.test(o)||bA.test(o))&&(r="do"),(r==="expect"?n:t).push(Pg(a))}let i=t.map((a,o)=>`B${o+1}: ${a}`),s=e.examples.reduce((a,o)=>a+o.rows.length,0);return e.isOutline&&s&&i.push(`(Ch\u1EA1y v\u1EDBi ${s} b\u1ED9 d\u1EEF li\u1EC7u: ${e.examples[0].headers.join(", ")})`),{steps:i.join(`
5352
+ `),expected:n.join(`
5353
+ `)}}function Lc(e,t,n){let r=ms(e,n.module),i=Sg(t,n.file);if(!i.featureTitle&&!i.scenarios.length)throw new K(U(`${n.file}: kh\xF4ng th\u1EA5y \xABT\xEDnh n\u0103ng:\xBB / \xABFeature:\xBB hay k\u1ECBch b\u1EA3n n\xE0o.`,`${n.file}: no \xABFeature:\xBB / \xABT\xEDnh n\u0103ng:\xBB or scenarios found.`));let s=n.by??vt(e.root),a=us(e,n.avoid),o=e.suites.find(d=>d.source===n.file&&d.status!=="deleted"),c=!o;if(o)i.featureTitle&&(o.title=i.featureTitle);else{let d=mn("KB",r.code,a);a.add(d),o={code:d,module:r.code,title:i.featureTitle||Rc.basename(n.file,".feature"),kind:"functional",status:"drafting",covers:[],useCases:[],owner:s,created:{by:s,at:new Date().toISOString().replace(/\.\d{3}Z$/,"Z")},source:n.file,description:"",cases:[],file:""},e.suites.push(o)}i.backgroundSteps.length&&(o.preconditions=i.backgroundSteps.map(Pg).join("; "));let l={suite:o.code,created:c,added:[],updated:[],missing:[],untagged:0},u=new Set;for(let d of i.scenarios){let p=Ng(d.tags,i.featureTags);p||l.untagged++;let{steps:h,expected:f}=Ig(d),m=o.cases.filter(y=>!y.deleted),g=p?m.find(y=>y.tag?.toLowerCase()===p.toLowerCase()):m.find(y=>!y.tag&&y.case===d.title);if(g)g.case=d.title,g.steps=h,g.expected=f,u.add(g.code),l.updated.push(g.code);else{let y=mn("TC",r.code,a);a.add(y);let T={code:y,case:d.title,steps:h,expected:f,...p?{tag:p}:{}};o.cases.push(T),u.add(y),l.added.push(y)}}return l.missing=o.cases.filter(d=>!d.deleted&&d.tag&&!u.has(d.code)).map(d=>d.code),ze(e.root,o),c&&vr(e,r.code,{suites:[...en(e,r.code).map(d=>d.code).filter(d=>d!==o.code),o.code]}),l}function wA(e){let t=[],n=r=>{for(let i of ei.readdirSync(r,{withFileTypes:!0})){if(i.name.startsWith(".")||i.name==="node_modules")continue;let s=Rc.join(r,i.name);i.isDirectory()?n(s):i.name.endsWith(".feature")&&t.push(s)}};return n(e),t.sort()}function yA(e){let t=ei.existsSync(e)&&ei.statSync(e).isDirectory()?Rc.join(e,"results.json"):e;if(!ei.existsSync(t))throw new K(U(`Kh\xF4ng th\u1EA5y ${t} \u2014 c\u1EA7n results.json c\u1EE7a l\u1EA7n ch\u1EA1y pan-test (Playwright JSON reporter).`,`${t} not found \u2014 need the results.json of a pan-test run (Playwright JSON reporter).`));return la(ei.readFileSync(t,"utf8"))}function la(e){let t;try{t=JSON.parse(e)}catch{throw new K(U("results.json kh\xF4ng ph\u1EA3i JSON h\u1EE3p l\u1EC7.","results.json is not valid JSON."))}return Eg(t).specs}function Mc(e,t,n={}){let r=new Map;for(let c of t)for(let l of c.tags)r.set(l.toLowerCase(),[...r.get(l.toLowerCase())??[],c]);let i={applied:[],notRun:[],unknownTags:[]},s=new Set,a=n.at??new Date().toISOString().slice(0,10);for(let c of e.suites){if(c.status==="deleted")continue;let l=!1;for(let u of c.cases){if(u.deleted||!u.tag)continue;let d=u.tag.toLowerCase();s.add(d);let p=r.get(d);if(!p?.length){i.notRun.push(u.code);continue}let h=p.filter(g=>g.status==="failed"),f=h.length?"failed":p.every(g=>g.status==="skipped")?"skipped":"passed",m=h.length?(h.map(g=>g.errorText).find(Boolean)??"K\u1ECBch b\u1EA3n t\u1EF1 \u0111\u1ED9ng kh\xF4ng \u0111\u1EA1t.").slice(0,600):void 0;u.result={status:f,by:n.by??"pan-test",at:a,...m?{actual:m}:{},...n.env?{env:n.env}:{}},i.applied.push({code:u.code,status:f}),l=!0}l&&ze(e.root,c)}let o=/^@(p\d+|domain-.*|guide-video|flake|skip|wip)$/i;return i.unknownTags=[...r.keys()].filter(c=>!s.has(c)&&!o.test(c)).sort(),i}var gA,bA,vA,ti=Se(()=>{"use strict";S();qn();Cg();_g();fn();wr();_n();gA=/^(given|cho|biết)$/i,bA=/^(when|khi)$/i,vA=/^(then|thì)$/i});import{spawn as Og}from"node:child_process";import xA from"node:http";import kA from"node:path";function Rg(e){let t=process.env.PAN_CLI_JS?.trim();return t?{file:process.execPath,args:[t,...e],shell:!1}:{file:"pan",args:e,shell:process.platform==="win32"}}function Lg(e,t){return new Promise(n=>{let r=Rg(e),i="",s="",a;try{a=Og(r.file,r.args,{cwd:t,env:process.env,stdio:["ignore","pipe","pipe"],shell:r.shell,windowsHide:!0})}catch(o){n({code:null,json:null,stderr:o.message});return}a.stdout.on("data",o=>{i+=o.toString("utf8")}),a.stderr.on("data",o=>{s=(s+o.toString("utf8")).slice(-4e3)}),a.on("error",o=>n({code:null,json:null,stderr:o.message})),a.on("close",o=>{let c=null;for(let l of i.trim().split(`
5354
+ `).reverse())if(l.trim().startsWith("{"))try{c=JSON.parse(l);break}catch{}n({code:o,json:c,stderr:s})})})}function SA(e,t){let n=pn.get(e);if(n)return n;let r=new Promise((i,s)=>{let a=TA(e,t),o=Og(a.file,a.args,{cwd:e,env:process.env,stdio:["pipe","pipe","pipe"],shell:a.shell,windowsHide:!0}),c="",l="",u=setTimeout(()=>{o.kill(),s(new Error("PAN_AI_HOST_TIMEOUT"))},3e4);o.stdout.on("data",d=>{c+=d.toString("utf8");for(let p of c.split(`
5355
+ `))if(p.trim().startsWith("{"))try{let h=JSON.parse(p);if(h.event==="listening"&&h.url&&h.token){clearTimeout(u),i({url:new URL(h.url),token:h.token,child:o});return}}catch{}}),o.stderr.on("data",d=>{l=(l+d.toString("utf8")).slice(-2e3)}),o.on("error",d=>{clearTimeout(u),pn.delete(e),s(d)}),o.on("exit",d=>{clearTimeout(u),pn.delete(e),s(new Error(`PAN_AI_HOST_EXIT ${d} ${l.slice(-400)}`))})});return pn.set(e,r),r.catch(()=>pn.delete(e)),r}function Mg(){for(let e of pn.values())e.then(t=>{try{t.child.stdin.end()}catch{}}).catch(()=>{});pn.clear()}function Dg(e,t){let n=e.config.language==="en",r=Ve(e.root,e.config.ba),i=t?e.suites.find(c=>c.code===t||c.cases.some(l=>l.code===t)):void 0,s=t&&i?i.cases.find(c=>c.code===t):void 0,a=n?["You are an assistant working DIRECTLY in a test-case document repo (Pan Test, `.pantest.yaml`) in the current folder \u2014 the tester has the app open.","Rules:","- Change content ONLY through commands so codes stay unique and results are kept: `pan test module add`, `pan test new <MOD> --title \u2026 --covers CN-\u2026,SCR-\u2026`, `pan test case add <KB-\u2026> --case \u2026 --steps \u2026 --expected \u2026`, `pan test case edit <TC-\u2026> \u2026`, `pan test case rm <TC-\u2026> --reason \u2026`. Never hand-edit the ```yaml pt:cases``` blocks; never invent or renumber codes.","- Test cases: happy path first, then validation (each required field, formats, limits), permissions, edge cases from the business rules. Steps = user actions on the screen (\xABB1: \u2026\xBB, \xABB2: \u2026\xBB); expected = what the user sees (quote message text from the BA doc).","- Read the BA document (read-only) for the covered functions / screens. Do NOT invent behaviour it does not state \u2014 write \xAB[To confirm]\xBB.","- Do NOT set results (`pan test result`) unless the user says the test was run.","- When done run `pan test check`; fix errors. No commit, no push. Keys and enum values stay English.","- If the user must choose: end the answer with a ```pan-choices block (\xAB? question\xBB, then \xAB- option\xBB lines, max 5).","- Answer SHORT in English: what you added / changed (by code), what still needs a decision."]:["B\u1EA1n l\xE0 tr\u1EE3 l\xFD l\xE0m vi\u1EC7c TR\u1EF0C TI\u1EBEP trong repo t\xE0i li\u1EC7u k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED (Pan Test, `.pantest.yaml`) \u1EDF th\u01B0 m\u1EE5c hi\u1EC7n t\u1EA1i \u2014 tester \u0111ang m\u1EDF app.","Lu\u1EADt:","- S\u1EEDa n\u1ED9i dung CH\u1EC8 b\u1EB1ng l\u1EC7nh \u0111\u1EC3 m\xE3 kh\xF4ng tr\xF9ng v\xE0 k\u1EBFt qu\u1EA3 kh\xF4ng m\u1EA5t: `pan test module add`, `pan test new <PH> --title \u2026 --covers CN-\u2026,SCR-\u2026`, `pan test case add <KB-\u2026> --case \u2026 --steps \u2026 --expected \u2026`, `pan test case edit <TC-\u2026> \u2026`, `pan test case rm <TC-\u2026> --reason \u2026`. Kh\xF4ng s\u1EEDa tay kh\u1ED1i ```yaml pt:cases```; kh\xF4ng b\u1ECBa / \u0111\xE1nh l\u1EA1i m\xE3.","- T\xECnh hu\u1ED1ng: lu\u1ED3ng \u0111\xFAng tr\u01B0\u1EDBc, r\u1ED3i ki\u1EC3m tra d\u1EEF li\u1EC7u (t\u1EEBng tr\u01B0\u1EDDng b\u1EAFt bu\u1ED9c, \u0111\u1ECBnh d\u1EA1ng, gi\u1EDBi h\u1EA1n), ph\xE2n quy\u1EC1n, tr\u01B0\u1EDDng h\u1EE3p bi\xEAn theo quy t\u1EAFc nghi\u1EC7p v\u1EE5. C\xE1c b\u01B0\u1EDBc = thao t\xE1c ng\u01B0\u1EDDi d\xF9ng tr\xEAn m\xE0n (\xABB1: \u2026\xBB, \xABB2: \u2026\xBB); k\u1EBFt qu\u1EA3 mong \u0111\u1EE3i = \u0111i\u1EC1u ng\u01B0\u1EDDi d\xF9ng th\u1EA5y (th\xF4ng b\xE1o tr\xEDch nguy\xEAn v\u0103n t\xE0i li\u1EC7u BA trong \xAB\u2026\xBB).","- \u0110\u1ECDc t\xE0i li\u1EC7u BA (ch\u1EC9 \u0111\u1ECDc) cho ch\u1EE9c n\u0103ng / m\xE0n \u0111\u01B0\u1EE3c ph\u1EE7. KH\xD4NG b\u1ECBa nghi\u1EC7p v\u1EE5 t\xE0i li\u1EC7u BA kh\xF4ng n\xF3i \u2014 ghi \xAB[C\u1EA7n x\xE1c nh\u1EADn]\xBB.","- KH\xD4NG ghi k\u1EBFt qu\u1EA3 (`pan test result`) tr\u1EEB khi ng\u01B0\u1EDDi d\xF9ng n\xF3i \u0111\xE3 ch\u1EA1y test.","- Xong ch\u1EA1y `pan test check`; c\xF2n l\u1ED7i th\xEC s\u1EEDa. Kh\xF4ng commit, kh\xF4ng push. Kho\xE1 v\xE0 gi\xE1 tr\u1ECB enum gi\u1EEF ti\u1EBFng Anh.","- C\u1EA7n ng\u01B0\u1EDDi d\xF9ng ch\u1ECDn: k\u1EBFt th\xFAc c\xE2u tr\u1EA3 l\u1EDDi b\u1EB1ng kh\u1ED1i ```pan-choices (d\xF2ng \u0111\u1EA7u \xAB? c\xE2u h\u1ECFi\xBB, m\u1ED7i l\u1EF1a ch\u1ECDn m\u1ED9t d\xF2ng \xAB- \u2026\xBB, t\u1ED1i \u0111a 5).","- Tr\u1EA3 l\u1EDDi NG\u1EAEN b\u1EB1ng ti\u1EBFng Vi\u1EC7t: \u0111\xE3 th\xEAm / s\u1EEDa g\xEC (theo m\xE3), c\xF2n g\xEC c\u1EA7n quy\u1EBFt."],o=[`${n?"Document":"T\xE0i li\u1EC7u"}: \xAB${e.config.title}\xBB (${e.suites.length} ${n?"suites":"k\u1ECBch b\u1EA3n"}, ${e.suites.reduce((c,l)=>c+l.cases.length,0)} ${n?"cases":"t\xECnh hu\u1ED1ng"})`,r?`${n?"BA document repo (read-only)":"Repo t\xE0i li\u1EC7u BA (ch\u1EC9 \u0111\u1ECDc)"}: ${r}`:"",i?`${n?"Selected suite":"K\u1ECBch b\u1EA3n \u0111ang ch\u1ECDn"}: ${i.code} \xAB${i.title}\xBB${i.covers.length?` (covers ${i.covers.join(", ")})`:""} \u2014 ${i.file}`:"",s?`${n?"Selected case":"T\xECnh hu\u1ED1ng \u0111ang ch\u1ECDn"}: ${s.code} \xAB${s.case}\xBB`:""].filter(Boolean).join(`
5356
+ `);return{system:[...a,"",(n?`Context:
5357
+ `:`Ng\u1EEF c\u1EA3nh:
5358
+ `)+o].join(`
5359
+ `),addDirs:r?[kA.resolve(r)]:[]}}async function Bc(e,t,n,r,i,s){let a=await SA(e,t),o=s===void 0?void 0:Buffer.from(JSON.stringify(s));await new Promise((c,l)=>{let u=xA.request({host:a.url.hostname,port:a.url.port,path:i,method:s===void 0?"GET":"POST",headers:{"x-pan-ai-token":a.token,...o?{"content-type":"application/json","content-length":String(o.length)}:{}}},d=>{r.writeHead(d.statusCode??502,{"Content-Type":String(d.headers["content-type"]||"application/json; charset=utf-8"),"Cache-Control":"no-store","X-Content-Type-Options":"nosniff"}),d.pipe(r),d.on("end",c)});u.on("error",l),n.on("close",()=>u.destroy()),u.end(o)})}var pn,TA,Bg=Se(()=>{"use strict";S();Nn();pn=new Map;TA=(e,t)=>Rg(["ai-host","--dir",e,"--lang",t,"--lifeline"])});var Wg={};ii(Wg,{CSP:()=>qc,VIEW_CSP:()=>Fc,createDocServer:()=>PA,embedSources:()=>Ug});import{randomBytes as CA,timingSafeEqual as EA}from"node:crypto";import $c from"node:fs";import AA from"node:http";import ut from"node:path";import{fileURLToPath as _A}from"node:url";function Fg(e){if(typeof R<"u"&&R[e]!==void 0)return R[e];for(let t of[ut.join($g,"ui"),ut.join($g,"..","..","src","doc","ui")]){let n=ut.join(t,ca[e].file);if($c.existsSync(n))return $c.readFileSync(n,"utf8")}throw new Error(`Thi\u1EBFu t\u1EC7p giao di\u1EC7n ${e}`)}function jg(e){let t=Ve(e.root,e.config.ba);return t?bt(t):null}function NA(e){let t=jg(e);return{root:e.root,me:vt(e.root),config:e.config,modules:e.modules,suites:e.suites,readErrors:e.readErrors,ba:t?{linked:!0,items:[...t.values()].filter(n=>!n.deleted&&(n.type==="function"||n.type==="screen")).map(n=>({code:n.code,title:n.title,type:n.type}))}:{linked:!1,path:e.config.ba??null,items:[]},summary:Pn(e,t)}}function Hg(e){let t={};for(let n of["case","steps","expected","requirement","tag"])ee(e[n])!==void 0&&(t[n]=ee(e[n]));return ee(e.priority)!==void 0&&(t.priority=ee(e.priority)),t}function PA(e){let t=ls(e.start);if(!t)throw new K(U(`Kh\xF4ng th\u1EA5y repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED (.pantest.yaml) t\u1EEB ${ut.resolve(e.start)}. T\u1EA1o b\u1EB1ng: pan-test doc init`,`No test document repo (.pantest.yaml) found from ${ut.resolve(e.start)}. Create one with: pan-test doc init`));let n=e.token??CA(24).toString("hex"),r=Ug(e.embed),i=r.length?qc.replace("frame-ancestors 'none'",`frame-ancestors ${r.join(" ")}`):qc,s=d=>({status:200,body:d}),a=r.length?Fc.replace("frame-ancestors 'self'",`frame-ancestors 'self' ${r.join(" ")}`):Fc,o={"/api/export":async(d,p)=>{let h=(Array.isArray(d.formats)?d.formats:["docx"]).map(String).filter(m=>Nc.includes(m)),f=await Pc(p,{formats:h.length?h:["docx"],results:d.results===!0,codes:d.codes===!0});return s({ok:!0,dir:ut.join(p.root,Qr),files:f.map(m=>ut.relative(p.root,m).split(ut.sep).join("/"))})},"/api/open":async(d,p)=>{let h=ut.join(p.root,Qr);$c.mkdirSync(h,{recursive:!0});let{spawn:f}=await import("node:child_process"),m=process.platform==="darwin"?"open":process.platform==="win32"?"explorer":"xdg-open";try{f(m,[h],{stdio:"ignore",detached:!0,windowsHide:!0}).unref()}catch{}return s({ok:!0,dir:h})}},c={"/api/module/new":(d,p)=>s(hs(p,String(d.code??"").trim().toUpperCase(),String(d.title??"").trim())),"/api/module":(d,p)=>s(vr(p,String(d.code),{...ee(d.title)!==void 0?{title:ee(d.title)}:{},...ee(d.commonSteps)!==void 0?{commonSteps:ee(d.commonSteps)}:{}})),"/api/suite/new":(d,p)=>s(fs(p,{module:String(d.module),title:String(d.title??""),...d.kind==="non-functional"?{kind:"non-functional"}:{},...Fn(d.covers)?{covers:Fn(d.covers)}:{},...ee(d.after)?{after:ee(d.after)}:{},avoid:Ft(p.root)})),"/api/suite":(d,p)=>{let h={};for(let f of["title","preconditions","description","owner"])ee(d[f])!==void 0&&(h[f]=ee(d[f]));return(d.kind==="functional"||d.kind==="non-functional")&&(h.kind=d.kind),(d.status==="drafting"||d.status==="done"||d.status==="deleted")&&(h.status=d.status),ee(d.priority)!==void 0&&(h.priority=ee(d.priority)),Fn(d.covers)&&(h.covers=Fn(d.covers)),Fn(d.useCases)&&(h.useCases=Fn(d.useCases)),s(zu(p,String(d.code),h))},"/api/case/new":(d,p)=>s(gs(p,String(d.suite),{case:"",...Hg(d)},{...ee(d.after)?{after:ee(d.after)}:{},avoid:Ft(p.root)})),"/api/case":(d,p)=>s(vs(p,String(d.code),Hg(d))),"/api/import/feature":(d,p)=>{let h=Array.isArray(d.files)?d.files:[];if(!h.length)throw new K(U("Ch\u01B0a ch\u1ECDn t\u1EC7p .feature n\xE0o.","No .feature file selected."));let f=Ft(p.root);return s({ok:!0,reports:h.map(m=>({name:String(m.name??""),...Lc(p,String(m.content??""),{file:String(m.name??"feature.feature"),module:String(d.module),avoid:f})}))})},"/api/results":(d,p)=>s({ok:!0,...Mc(p,la(String(d.content??"")),{...ee(d.env)?{env:ee(d.env)}:{}})}),"/api/case/move":(d,p)=>s(Vu(p,String(d.code),d.dir===-1?-1:1)),"/api/case/delete":(d,p)=>s(ws(p,String(d.code),ee(d.reason)??"")),"/api/result":(d,p)=>s(ys(p,String(d.code),{status:String(d.status),...ee(d.actual)!==void 0?{actual:ee(d.actual)}:{},...ee(d.env)!==void 0?{env:ee(d.env)}:{},...ee(d.bug)!==void 0?{bug:ee(d.bug)}:{}}))},l=()=>({status:404,body:{}}),u=AA.createServer((d,p)=>{let h=(b,C,_)=>{p.writeHead(b,{"Content-Type":_,"X-Content-Type-Options":"nosniff","Referrer-Policy":"no-referrer","Cache-Control":"no-store","Content-Security-Policy":i}),p.end(d.method==="HEAD"?void 0:C)},f=(b,C)=>h(b,JSON.stringify(C),"application/json; charset=utf-8"),m=b=>f(b instanceof K?400:500,{ok:!1,error:b.message}),g=b=>{if(p.headersSent){p.end();return}let C=U("C\u1EA7n Pan CLI (@pan-stack/cli \u2265 0.3.90) \u0111\u1EC3 d\xF9ng Tr\u1EE3 l\xFD AI: ","Pan CLI (@pan-stack/cli \u2265 0.3.90) is needed for the AI assistant: ")+b.message;T==="/api/ai"?f(200,{engines:[],max:0,runs:[],error:C}):f(503,{ok:!1,error:C})},y=b=>{Lg(["test",b,"--dir",t,"--json"],t).then(C=>{if(C.json)return f(C.json.ok===!1?400:200,C.json);let _=U("C\u1EA7n Pan CLI (@pan-stack/cli \u2265 0.3.91) \u0111\u1EC3 ph\xE1t h\xE0nh l\xEAn Pan Studio: ","Pan CLI (@pan-stack/cli \u2265 0.3.91) is needed to publish to Pan Studio: ")+(C.stderr.trim().slice(-300)||`exit ${C.code}`);return b==="studio"?f(200,{ok:!0,login:!1,cli:!1,error:_}):f(503,{ok:!1,error:_})}).catch(m)},T=(()=>{try{return new URL(d.url||"/","http://x").pathname}catch{return""}})();try{let b=u.address()?.port,C=String(d.headers.host||""),_=[`127.0.0.1:${b}`,`localhost:${b}`];if(!_.includes(C))return f(403,{error:"Host kh\xF4ng h\u1EE3p l\u1EC7"});let w=new URL(d.url||"/",`http://${C}`),x=w.pathname,v=x==="/api/ai"||x.startsWith("/api/ai/");if(d.method==="POST"){let N=c[x]??o[x]??(v||x.startsWith("/api/studio/")?l:void 0);if(!N)return f(404,{error:"Kh\xF4ng c\xF3"});let M=String(d.headers.origin||"");if(M&&!_.some(V=>M===`http://${V}`))return f(403,{error:"Origin kh\xF4ng h\u1EE3p l\u1EC7"});let O=Buffer.from(String(d.headers["x-pan-test-token"]||"")),F=Buffer.from(n);if(O.length!==F.length||!EA(O,F))return f(403,{error:"Thi\u1EBFu token phi\xEAn"});if(!String(d.headers["content-type"]||"").startsWith("application/json"))return f(415,{error:"C\u1EA7n application/json"});let Q=[],Z=0;d.on("data",V=>{Z+=V.length,Z>qg?(f(413,{error:"Qu\xE1 l\u1EDBn"}),d.destroy()):Q.push(V)}),d.on("end",()=>{if(Z>qg)return;let V;try{V=JSON.parse(Buffer.concat(Q).toString("utf8")||"{}")}catch{return f(400,{error:"JSON sai"})}if(x==="/api/studio/publish"||x==="/api/studio/remove"){y(x==="/api/studio/publish"?"publish":"unpublish");return}if(N===l){let G=Ge(t),de=x==="/api/ai/run"?{...V,...Dg(G,ee(V.item))}:V;Bc(t,G.config.language,d,p,x,de).catch(g);return}Promise.resolve().then(()=>{let G=Ge(t);return un(G.config.language),N(V,G)}).then(G=>f(G.status,G.body)).catch(m)});return}if(d.method!=="GET"&&d.method!=="HEAD")return f(405,{error:"Ch\u1EC9 cho GET/POST"});if(x==="/api/studio"){y("studio");return}if(v){let N=Ge(t);Bc(t,N.config.language,d,p,x+w.search).catch(g);return}if(x==="/"||x==="/index.html"){let N=w.searchParams.get("lang")||e.lang||Ge(t).config.language,M=Fg("index.html").replace(/<head[^>]*>/,O=>`${O}<meta name="pantest-token" content="${n}"><meta name="panba-lang" content="${N==="en"?"en":"vi"}">`);return h(200,M,ca["index.html"].type)}let A=/^\/ui\/([a-z0-9.]+)$/.exec(x);if(A&&ca[A[1]])return h(200,Fg(A[1]),ca[A[1]].type);if(x==="/favicon.ico")return h(204,"","image/x-icon");if(x==="/api/index")return f(200,NA(Ge(t)));if(x==="/view/doc"){let N=oa(aa(Ge(t),{results:w.searchParams.get("results")==="1",codes:w.searchParams.get("codes")==="1"}));return p.writeHead(200,{"Content-Type":"text/html; charset=utf-8","X-Content-Type-Options":"nosniff","Referrer-Policy":"no-referrer","Cache-Control":"no-store","Content-Security-Policy":a}),p.end(d.method==="HEAD"?void 0:N)}if(x==="/api/check"){let N=Ge(t);return f(200,{findings:xs(N,jg(N))})}return f(404,{error:"Kh\xF4ng c\xF3"})}catch(b){return m(b)}});return u.on("close",()=>Mg()),Object.assign(u,{token:n,root:t})}var $g,ca,Fc,qc,qg,Ug,ee,Fn,Kg=Se(()=>{"use strict";S();qn();Nn();xr();wr();ti();Zr();_n();Bg();$g=ut.dirname(_A(import.meta.url)),ca={"index.html":{file:"index.html",type:"text/html; charset=utf-8"},"tokens.css":{file:"tokens.css",type:"text/css; charset=utf-8"},"shell.js":{file:"shell.browser.js",type:"text/javascript; charset=utf-8"},"i18n.js":{file:"i18n.browser.js",type:"text/javascript; charset=utf-8"},"app.js":{file:"app.browser.js",type:"text/javascript; charset=utf-8"},"assist.js":{file:"assist.browser.js",type:"text/javascript; charset=utf-8"},"edit.js":{file:"edit.browser.js",type:"text/javascript; charset=utf-8"}};Fc="default-src 'none'; style-src 'unsafe-inline'; img-src 'self' data:; base-uri 'none'; form-action 'none'; frame-ancestors 'self'",qc="default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; connect-src 'self'; font-src 'self'; frame-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'",qg=24*1024*1024,Ug=e=>(e??[]).filter(t=>/^[a-z][a-z0-9+.-]*:$/.test(t)||/^https?:\/\/[A-Za-z0-9.-]+(:\d+)?$/.test(t)),ee=e=>typeof e=="string"?e:void 0,Fn=e=>Array.isArray(e)?e.map(String).map(t=>t.trim()).filter(Boolean):void 0});var Vg={};ii(Vg,{buildBundle:()=>RA});function OA(e,t,n){let r=Jr[n],i=yr(e,tn()),s=[`# ${e.code} \xB7 ${e.title}`,""],a=[e.covers.length?`- ${r.functions}${e.covers.join(", ")}`:"",e.useCases.length?`- ${r.useCase}${e.useCases.join(", ")}`:"",e.preconditions?`- ${r.pre}${e.preconditions.replace(/\n+/g," ")}`:"",`- ${r.sumHead[2]}: ${i.passed}/${i.total} \xB7 ${r.sumHead[3]}: ${i.failed} \xB7 ${r.sumHead[6]}: ${i["not-run"]}`].filter(Boolean);s.push(...a,""),e.description.trim()&&s.push(e.description.trim(),"");let o=t.modules.find(l=>l.code===e.module);o?.commonSteps.trim()&&s.push(`**${r.commonSteps}**`,"",o.commonSteps.trim(),"");let c=sa(e,{results:!0,codes:!0},r,n);if(!c.rows.length)s.push(r.noCases,"");else{s.push("| "+c.head.join(" | ")+" |","|"+c.head.map(()=>" --- |").join(""));for(let l of c.rows)s.push("| "+l.map(IA).join(" | ")+" |");s.push("")}return s.join(`
5360
+ `)}function RA(e){let t=e.config.language==="en"?"en":"vi",n=Jr[t],r=Ve(e.root,e.config.ba),i=Pn(e,r?bt(r):null),s={},a=[`# ${t==="en"?"Generated by \xABpan test publish\xBB \u2014 do not edit; the test document repo is the source.":"Sinh b\u1EDFi \xABpan test publish\xBB \u2014 \u0111\u1EEBng s\u1EEDa tay; ngu\u1ED3n l\xE0 repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED."}`,`title: ${Me(e.config.title)}`,`locale: ${t}`,"theme: classic","sections:"],o=n.sumHead,c=i.modules.map(h=>[`${h.code} \xB7 ${h.title}`,h.count.total,h.count.passed,h.count.failed,h.count.blocked,h.count.skipped,h.count["not-run"],zg(h.count.passed,h.count.total)]);c.push([`**${n.total}**`,i.all.total,i.all.passed,i.all.failed,i.all.blocked,i.all.skipped,i.all["not-run"],zg(i.all.passed,i.all.total)]),s["content/tong-hop/tong-hop.md"]=[`# ${n.sumTitle}`,"","| "+o.join(" | ")+" |","|"+o.map(()=>" --- |").join(""),...c.map(h=>"| "+h.join(" | ")+" |"),"",...i.coverage?[`${t==="en"?"BA function coverage":"\u0110\u1ED9 ph\u1EE7 ch\u1EE9c n\u0103ng t\xE0i li\u1EC7u BA"}: ${i.coverage.covered}/${i.coverage.functions}`,""]:[]].join(`
5361
+ `),a.push(` - id: ${Me("tong-hop")}`,` title: ${Me(n.sumTitle)}`," lessons:",` - id: ${Me("tong-hop")}`,` title: ${Me(n.sumTitle)}`," type: article",` src: ${Me("content/tong-hop/tong-hop.md")}`);let l=1,u=new Set(["tong-hop"]),d=h=>{let f=h;for(let m=2;u.has(f);m++)f=`${h}-${m}`;return u.add(f),f};return[...e.modules].sort((h,f)=>h.order-f.order).forEach((h,f)=>{let m=e.suites.filter(y=>y.module===h.code&&y.status!=="deleted").sort((y,T)=>(h.suites.indexOf(y.code)+1||1e9)-(h.suites.indexOf(T.code)+1||1e9)||y.code.localeCompare(T.code));if(!m.length)return;let g=d(Gg(h.code));a.push(` - id: ${Me(g)}`,` title: ${Me(`${f+1}. ${h.title}`)}`," lessons:");for(let y of m){let T=d(Gg(y.code)),b=`content/${g}/${T}.md`;s[b]=OA(y,e,t),a.push(` - id: ${Me(T)}`,` title: ${Me(`${y.code} \xB7 ${y.title}`)}`," type: article",` src: ${Me(b)}`,` code: ${Me(y.code)}`,` module: ${Me(h.code)}`),l++}}),s["handover.yaml"]=a.join(`
5362
+ `)+`
5363
+ `,{title:e.config.title,language:t,ba:r,lessons:l,files:s}}var Me,Gg,IA,zg,Xg=Se(()=>{"use strict";S();Nn();xr();Zr();Me=e=>JSON.stringify(e),Gg=e=>e.normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/đ/g,"d").replace(/Đ/g,"D").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"muc",IA=e=>e.map(t=>t.replace(/\|/g,"\\|")).join("<br>")||" ",zg=(e,t)=>t?`${Math.round(e/t*100)}%`:"\u2014"});S();S();qn();import da from"node:fs";import At from"node:path";S();si();fn();_n();Nn();wr();xr();Zr();ti();var LA=`pan-test doc \u2014 t\xE0i li\u1EC7u k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED
4292
5364
 
4293
5365
  doc init [th\u01B0 m\u1EE5c] --title <t\xEAn> [--ba <\u0111\u01B0\u1EDDng d\u1EABn repo BA>] [--lang vi|en]
4294
5366
  doc module add <PH> --title <t\xEAn>
@@ -4298,25 +5370,49 @@ th,td{border:1px solid #555;padding:4px 6px;vertical-align:top;text-align:left;o
4298
5370
  [--requirement <y\xEAu c\u1EA7u>] [--priority \u2026] [--tag <@tag>] [--after <TC-\u2026>]
4299
5371
  doc case edit <TC-\u2026> [--case \u2026] [--steps \u2026] [--expected \u2026] [--requirement \u2026] [--priority \u2026] [--tag \u2026]
4300
5372
  doc case rm <TC-\u2026> [--reason <l\xFD do>]
4301
- doc result <TC-\u2026> <${yt.join("|")}> [--actual <k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF>] [--env <m\xF4i tr\u01B0\u1EDDng>] [--bug <link>]
5373
+ doc result <TC-\u2026> <${et.join("|")}> [--actual <k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF>] [--env <m\xF4i tr\u01B0\u1EDDng>] [--bug <link>]
4302
5374
  doc list [--json] m\u1EE5c l\u1EE5c: ph\xE2n h\u1EC7 \u2192 k\u1ECBch b\u1EA3n \u2192 s\u1ED1 t\xECnh hu\u1ED1ng / k\u1EBFt qu\u1EA3
4303
5375
  doc check [--json] ki\u1EC3m l\u1ED7i (E01\u2013E04) v\xE0 c\u1EA3nh b\xE1o (T01\u2013T06)
4304
5376
  doc summary [--json] t\u1ED5ng h\u1EE3p k\u1EBFt qu\u1EA3 theo ph\xE2n h\u1EC7 + \u0111\u1ED9 ph\u1EE7 ch\u1EE9c n\u0103ng BA
5377
+ doc bundle g\xF3i b\xE0n giao (JSON) cho \xABpan test publish\xBB \u2014 ph\xE1t h\xE0nh l\xEAn Pan Studio
5378
+ doc import <t\u1EC7p.feature | th\u01B0 m\u1EE5c> --module <PH> nh\u1EADp k\u1ECBch b\u1EA3n Gherkin (pan-test); nh\u1EADp l\u1EA1i th\xEC c\u1EADp nh\u1EADt theo tag
5379
+ doc results <results.json | th\u01B0 m\u1EE5c b\xE1o c\xE1o> [--env <m\xF4i tr\u01B0\u1EDDng>] ghi k\u1EBFt qu\u1EA3 l\u1EA7n ch\u1EA1y t\u1EF1 \u0111\u1ED9ng theo tag
4305
5380
  doc export [--format docx,html] [--results] [--codes] [--out <th\u01B0 m\u1EE5c>]
4306
5381
  xu\u1EA5t t\xE0i li\u1EC7u (m\u1EB7c \u0111\u1ECBnh: b\u1EA3n b\xE0n giao DOCX v\xE0o exports/); --results k\xE8m k\u1EBFt qu\u1EA3 test
4307
5382
  doc ui [--port <n>] [--no-open] [--json] [--lang vi|en] m\u1EDF app so\u1EA1n t\xE0i li\u1EC7u ki\u1EC3m th\u1EED tr\xEAn tr\xECnh duy\u1EC7t
4308
5383
 
4309
- Chung: --dir <repo> (m\u1EB7c \u0111\u1ECBnh: th\u01B0 m\u1EE5c hi\u1EC7n t\u1EA1i, d\xF2 ng\u01B0\u1EE3c l\xEAn t\u1EDBi .pantest.yaml)`;function xC(e){let t=[],n={};for(let r=0;r<e.length;r++){let i=e[r];if(i.startsWith("--")){let s=i.indexOf("=");if(s>0)n[i.slice(2,s)]=i.slice(s+1);else{let a=e[r+1];a!==void 0&&!a.startsWith("--")?(n[i.slice(2)]=a,r++):n[i.slice(2)]=!0}}else t.push(i)}return{pos:t,opt:n}}var j=e=>typeof e=="string"?e:void 0,Fr=e=>j(e)?.split(",").map(t=>t.trim()).filter(Boolean),he=e=>j(e)?.replace(/\\n/g,`
4310
- `);function bc(e){let t=j(e);if(t!==void 0){if(!rn.includes(t))throw new z(`--priority ph\u1EA3i l\xE0 ${rn.join(" | ")}.`);return t}}function $t(e){let t=j(e.dir)??process.cwd(),n=ji(t);if(!n)throw new z(`Kh\xF4ng th\u1EA5y repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED (.pantest.yaml) t\u1EEB ${vc.resolve(t)}. T\u1EA1o b\u1EB1ng: pan-test doc init`);return ct(n)}var kC={"not-run":"Ch\u01B0a test",passed:"\u0110\u1EA1t",failed:"Kh\xF4ng \u0111\u1EA1t",blocked:"B\u1ECB ch\u1EB7n",skipped:"B\u1ECF qua"};function lg(e){return`${e.total} t\xECnh hu\u1ED1ng \xB7 \u0111\u1EA1t ${e.passed} \xB7 kh\xF4ng \u0111\u1EA1t ${e.failed} \xB7 b\u1ECB ch\u1EB7n ${e.blocked} \xB7 b\u1ECF qua ${e.skipped} \xB7 ch\u01B0a test ${e["not-run"]}`}async function cg(e){let{pos:t,opt:n}=xC(e),[r,i,s]=t,a=n.json===!0,o=(l,c)=>console.log(a?JSON.stringify(l,null,2):c);try{switch(r){case void 0:case"help":return console.log(og),r?0:1;case"ui":{let{createDocServer:l}=await Promise.resolve().then(()=>(ag(),sg)),c=j(n.embed)?.split(",").map(m=>m.trim()).filter(Boolean),d=l({start:j(n.dir)??process.cwd(),...j(n.lang)??process.env.PANAUTO_LANG?{lang:j(n.lang)??process.env.PANAUTO_LANG}:{},...c?{embed:c}:{}}),p=Number(j(n.port)??0)||0;await new Promise((m,h)=>{d.once("error",h),d.listen(p,"127.0.0.1",()=>m())});let f=`http://127.0.0.1:${d.address().port}/`;if(console.log(a?JSON.stringify({event:"listening",url:f,root:d.root}):`Pan Test \u2014 t\xE0i li\u1EC7u ki\u1EC3m th\u1EED: ${f}
4311
- repo: ${d.root}
4312
- Ctrl+C \u0111\u1EC3 d\u1EEBng.`),n["no-open"]!==!0&&!a){let{spawn:m}=await import("node:child_process"),h=process.platform==="darwin"?"open":process.platform==="win32"?"cmd":"xdg-open",g=process.platform==="win32"?["/c","start","",f]:[f];try{m(h,g,{stdio:"ignore",detached:!0}).unref()}catch{}}return n.lifeline===!0&&process.stdin.on("end",()=>process.exit(0)).resume(),await new Promise(()=>{}),0}case"init":{let l=vc.resolve(i??j(n.dir)??"."),c=j(n.title)??vc.basename(l),d=j(n.lang)==="en"?"en":"vi",p=Vt(yC.existsSync(l)?l:process.cwd()),u=ku(l,{title:c,language:d,...j(n.ba)?{ba:j(n.ba)}:{},me:{id:p,name:p}});return o(u,`\u2713 \u0110\xE3 t\u1EA1o repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED \xAB${u.title}\xBB \u1EDF ${l}${u.ba?` (repo BA: ${u.ba})`:""}.
4313
- Ti\u1EBFp: pan-test doc module add <PH> --title <t\xEAn ph\xE2n h\u1EC7>`),0}case"module":{if(i!=="add"||!s)throw new z("D\xF9ng: pan-test doc module add <PH> --title <t\xEAn>");let l=$t(n),c=Xi(l,s,j(n.title)??s);return o(c,`\u2713 \u0110\xE3 th\xEAm ph\xE2n h\u1EC7 ${c.code} \xB7 ${c.title}`),0}case"new":{if(!i)throw new z("D\xF9ng: pan-test doc new <PH> --title <t\xEAn k\u1ECBch b\u1EA3n>");let l=$t(n),c=j(n.kind);if(c&&c!=="functional"&&c!=="non-functional")throw new z("--kind ph\u1EA3i l\xE0 functional | non-functional.");let d=bc(n.priority),p=Yi(l,{module:i,title:j(n.title)??"",...c?{kind:c}:{},...Fr(n.covers)?{covers:Fr(n.covers)}:{},...Fr(n.uc)?{useCases:Fr(n.uc)}:{},...d?{priority:d}:{},...he(n.preconditions)?{preconditions:he(n.preconditions)}:{},...j(n.after)?{after:j(n.after)}:{},avoid:vn(l.root)});return o(p,`\u2713 \u0110\xE3 t\u1EA1o k\u1ECBch b\u1EA3n ${p.code} \xB7 ${p.title} (${p.file})`),0}case"case":{let l=$t(n);if(i==="add"&&s){let c=bc(n.priority),d=Ji(l,s,{case:he(n.case)??"",...he(n.steps)?{steps:he(n.steps)}:{},...he(n.expected)?{expected:he(n.expected)}:{},...he(n.requirement)?{requirement:he(n.requirement)}:{},...c?{priority:c}:{},...j(n.tag)?{tag:j(n.tag)}:{}},{...j(n.after)?{after:j(n.after)}:{},avoid:vn(l.root)});return o(d,`\u2713 \u0110\xE3 th\xEAm t\xECnh hu\u1ED1ng ${d.code} v\xE0o ${s}`),0}if(i==="edit"&&s){let c=bc(n.priority),d=Zi(l,s,{...he(n.case)!==void 0?{case:he(n.case)}:{},...he(n.steps)!==void 0?{steps:he(n.steps)}:{},...he(n.expected)!==void 0?{expected:he(n.expected)}:{},...he(n.requirement)!==void 0?{requirement:he(n.requirement)}:{},...c?{priority:c}:{},...j(n.tag)!==void 0?{tag:j(n.tag)}:{}});return o(d,`\u2713 \u0110\xE3 s\u1EEDa t\xECnh hu\u1ED1ng ${d.code}`),0}if(i==="rm"&&s){let c=es(l,s,j(n.reason)??"");return o(c,`\u2713 \u0110\xE3 xo\xE1 (m\u1EC1m) t\xECnh hu\u1ED1ng ${c.code} \u2014 m\xE3 gi\u1EEF l\u1EA1i, kh\xF4ng d\xF9ng l\u1EA1i.`),0}throw new z("D\xF9ng: pan-test doc case add <KB-\u2026> | edit <TC-\u2026> | rm <TC-\u2026>")}case"result":{if(!i||!s)throw new z(`D\xF9ng: pan-test doc result <TC-\u2026> <${yt.join("|")}>`);let l=$t(n),c=ts(l,i,{status:s,...he(n.actual)?{actual:he(n.actual)}:{},...j(n.env)?{env:j(n.env)}:{},...j(n.bug)?{bug:j(n.bug)}:{},...j(n.by)?{by:j(n.by)}:{}});return o(c,`\u2713 ${c.code}: ${kC[c.result?.status??"not-run"]}`),0}case"export":{let{exportDoc:l,FORMATS:c}=await Promise.resolve().then(()=>(Ks(),Qm)),d=$t(n),p=Fr(n.format)??["docx"];if(p.filter(m=>!c.includes(m)).length)throw new z(`--format ch\u1EC9 nh\u1EADn ${c.join(", ")}.`);let f=await l(d,{formats:p,results:n.results===!0,codes:n.codes===!0,...j(n.out)?{out:j(n.out)}:{}});return o({files:f},f.map(m=>`\u2713 ${m}`).join(`
4314
- `)),0}case"list":{let l=$t(n),c=l.modules.map(p=>({code:p.code,title:p.title,suites:or(l,p.code).map(u=>({code:u.code,title:u.title,kind:u.kind,cases:u.cases.filter(f=>!f.deleted).map(f=>({code:f.code,case:f.case,status:f.result?.status??"not-run"}))}))})),d=[`${l.config.title}`];return c.forEach((p,u)=>{d.push(`${u+1}. ${p.code} \xB7 ${p.title}`),p.suites.forEach((f,m)=>{let h=f.cases.filter(g=>g.status==="passed").length;d.push(` ${u+1}.${m+1} ${f.code} \xB7 ${f.title} [${h}/${f.cases.length} \u0111\u1EA1t]`)})}),o(c,d.join(`
4315
- `)),0}case"check":{let l=$t(n),c=zt(l.root,l.config.ba),d=rs(l,c?Gt(c):null),p=d.filter(m=>m.severity==="error").length,u=d.filter(m=>m.severity==="warn").length,f=d.length?d.map(m=>`${m.severity==="error"?"\u2717":m.severity==="warn"?"!":"i"} ${m.rule} ${m.message}${m.file?` (${m.file})`:""}`).join(`
5384
+ Chung: --dir <repo> (m\u1EB7c \u0111\u1ECBnh: th\u01B0 m\u1EE5c hi\u1EC7n t\u1EA1i, d\xF2 ng\u01B0\u1EE3c l\xEAn t\u1EDBi .pantest.yaml)`,MA=`pan-test doc \u2014 test case documents
5385
+
5386
+ doc init [dir] --title <name> [--ba <BA repo path>] [--lang vi|en]
5387
+ doc module add <MOD> --title <name>
5388
+ doc new <MOD> --title <name> [--covers CN-\u2026,SCR-\u2026] [--uc UC1,UC2] [--kind functional|non-functional]
5389
+ [--priority high|medium|low] [--preconditions <text>] [--after <KB-\u2026>]
5390
+ doc case add <KB-\u2026> --case <test case> [--steps <steps>] [--expected <expected result>]
5391
+ [--requirement <requirement>] [--priority \u2026] [--tag <@tag>] [--after <TC-\u2026>]
5392
+ doc case edit <TC-\u2026> [--case \u2026] [--steps \u2026] [--expected \u2026] [--requirement \u2026] [--priority \u2026] [--tag \u2026]
5393
+ doc case rm <TC-\u2026> [--reason <reason>]
5394
+ doc result <TC-\u2026> <${et.join("|")}> [--actual <actual result>] [--env <environment>] [--bug <link>]
5395
+ doc import <file.feature | dir> --module <MOD> import Gherkin scenarios (pan-test); re-import updates by tag
5396
+ doc results <results.json | report dir> [--env <environment>] record an automated run by tag
5397
+ doc export [--format docx,html] [--results] [--codes] [--out <dir>]
5398
+ doc list [--json] \xB7 doc check [--json] \xB7 doc summary [--json] \xB7 doc bundle (JSON for \xABpan test publish\xBB)
5399
+ doc ui [--port <n>] [--no-open] [--json] [--lang vi|en] open the test document app
5400
+
5401
+ Common: --dir <repo> (default: current folder, searching up to .pantest.yaml)`,Yg=()=>U(LA,MA);function DA(e){let t=[],n={};for(let r=0;r<e.length;r++){let i=e[r];if(i.startsWith("--")){let s=i.indexOf("=");if(s>0)n[i.slice(2,s)]=i.slice(s+1);else{let a=e[r+1];a!==void 0&&!a.startsWith("--")?(n[i.slice(2)]=a,r++):n[i.slice(2)]=!0}}else t.push(i)}return{pos:t,opt:n}}var W=e=>typeof e=="string"?e:void 0,ni=e=>W(e)?.split(",").map(t=>t.trim()).filter(Boolean),fe=e=>W(e)?.replace(/\\n/g,`
5402
+ `);function Hc(e){let t=W(e);if(t!==void 0){if(!hn.includes(t))throw new K(`--priority ph\u1EA3i l\xE0 ${hn.join(" | ")}.`);return t}}function Ze(e){let t=W(e.dir)??process.cwd(),n=ls(t);if(!n)throw new K(U(`Kh\xF4ng th\u1EA5y repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED (.pantest.yaml) t\u1EEB ${At.resolve(t)}. T\u1EA1o b\u1EB1ng: pan-test doc init`,`No test document repo (.pantest.yaml) found from ${At.resolve(t)}. Create one with: pan-test doc init`));let r=Ge(n);return un(r.config.language),r}var BA={"not-run":"Ch\u01B0a test",passed:"\u0110\u1EA1t",failed:"Kh\xF4ng \u0111\u1EA1t",blocked:"B\u1ECB ch\u1EB7n",skipped:"B\u1ECF qua"};function Jg(e){return U(`${e.total} t\xECnh hu\u1ED1ng \xB7 \u0111\u1EA1t ${e.passed} \xB7 kh\xF4ng \u0111\u1EA1t ${e.failed} \xB7 b\u1ECB ch\u1EB7n ${e.blocked} \xB7 b\u1ECF qua ${e.skipped} \xB7 ch\u01B0a test ${e["not-run"]}`,`${e.total} test case(s) \xB7 ${e.passed} passed \xB7 ${e.failed} failed \xB7 ${e.blocked} blocked \xB7 ${e.skipped} skipped \xB7 ${e["not-run"]} not run`)}async function Qg(e){let{pos:t,opt:n}=DA(e);typeof n.lang=="string"?un(n.lang,{pin:!0}):process.env.PANAUTO_LANG&&un(process.env.PANAUTO_LANG,{pin:!0});let[r,i,s]=t,a=n.json===!0,o=(c,l)=>console.log(a?JSON.stringify(c,null,2):l);try{switch(r){case void 0:case"help":return console.log(Yg()),r?0:1;case"ui":{let{createDocServer:c}=await Promise.resolve().then(()=>(Kg(),Wg)),l=W(n.embed)?.split(",").map(f=>f.trim()).filter(Boolean),u=c({start:W(n.dir)??process.cwd(),...W(n.lang)??process.env.PANAUTO_LANG?{lang:W(n.lang)??process.env.PANAUTO_LANG}:{},...l?{embed:l}:{}}),d=Number(W(n.port)??0)||0;await new Promise((f,m)=>{u.once("error",m),u.listen(d,"127.0.0.1",()=>f())});let h=`http://127.0.0.1:${u.address().port}/`;if(console.log(a?JSON.stringify({event:"listening",url:h,root:u.root}):`Pan Test \u2014 t\xE0i li\u1EC7u ki\u1EC3m th\u1EED: ${h}
5403
+ repo: ${u.root}
5404
+ Ctrl+C \u0111\u1EC3 d\u1EEBng.`),n["no-open"]!==!0&&!a){let{spawn:f}=await import("node:child_process"),m=process.platform==="darwin"?"open":process.platform==="win32"?"cmd":"xdg-open",g=process.platform==="win32"?["/c","start","",h]:[h];try{f(m,g,{stdio:"ignore",detached:!0}).unref()}catch{}}return n.lifeline===!0&&process.stdin.on("end",()=>process.exit(0)).resume(),await new Promise(()=>{}),0}case"init":{let c=At.resolve(i??W(n.dir)??"."),l=W(n.title)??At.basename(c),u=(W(n.lang)??process.env.PANAUTO_LANG)==="en"?"en":"vi",d=vt(da.existsSync(c)?c:process.cwd()),p=Ku(c,{title:l,language:u,...W(n.ba)?{ba:W(n.ba)}:{},me:{id:d,name:d}});return o(p,U(`\u2713 \u0110\xE3 t\u1EA1o repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED \xAB${p.title}\xBB \u1EDF ${c}${p.ba?` (repo BA: ${p.ba})`:""}.
5405
+ Ti\u1EBFp: pan-test doc module add <PH> --title <t\xEAn ph\xE2n h\u1EC7>`,`\u2713 Created test document repo \xAB${p.title}\xBB in ${c}${p.ba?` (BA repo: ${p.ba})`:""}.
5406
+ Next: pan-test doc module add <MOD> --title <module name>`)),0}case"module":{if(i!=="add"||!s)throw new K("D\xF9ng: pan-test doc module add <PH> --title <t\xEAn>");let c=Ze(n),l=hs(c,s,W(n.title)??s);return o(l,U(`\u2713 \u0110\xE3 th\xEAm ph\xE2n h\u1EC7 ${l.code} \xB7 ${l.title}`,`\u2713 Added module ${l.code} \xB7 ${l.title}`)),0}case"new":{if(!i)throw new K("D\xF9ng: pan-test doc new <PH> --title <t\xEAn k\u1ECBch b\u1EA3n>");let c=Ze(n),l=W(n.kind);if(l&&l!=="functional"&&l!=="non-functional")throw new K("--kind ph\u1EA3i l\xE0 functional | non-functional.");let u=Hc(n.priority),d=fs(c,{module:i,title:W(n.title)??"",...l?{kind:l}:{},...ni(n.covers)?{covers:ni(n.covers)}:{},...ni(n.uc)?{useCases:ni(n.uc)}:{},...u?{priority:u}:{},...fe(n.preconditions)?{preconditions:fe(n.preconditions)}:{},...W(n.after)?{after:W(n.after)}:{},avoid:Ft(c.root)});return o(d,U(`\u2713 \u0110\xE3 t\u1EA1o k\u1ECBch b\u1EA3n ${d.code} \xB7 ${d.title} (${d.file})`,`\u2713 Created test suite ${d.code} \xB7 ${d.title} (${d.file})`)),0}case"case":{let c=Ze(n);if(i==="add"&&s){let l=Hc(n.priority),u=gs(c,s,{case:fe(n.case)??"",...fe(n.steps)?{steps:fe(n.steps)}:{},...fe(n.expected)?{expected:fe(n.expected)}:{},...fe(n.requirement)?{requirement:fe(n.requirement)}:{},...l?{priority:l}:{},...W(n.tag)?{tag:W(n.tag)}:{}},{...W(n.after)?{after:W(n.after)}:{},avoid:Ft(c.root)});return o(u,U(`\u2713 \u0110\xE3 th\xEAm t\xECnh hu\u1ED1ng ${u.code} v\xE0o ${s}`,`\u2713 Added test case ${u.code} to ${s}`)),0}if(i==="edit"&&s){let l=Hc(n.priority),u=vs(c,s,{...fe(n.case)!==void 0?{case:fe(n.case)}:{},...fe(n.steps)!==void 0?{steps:fe(n.steps)}:{},...fe(n.expected)!==void 0?{expected:fe(n.expected)}:{},...fe(n.requirement)!==void 0?{requirement:fe(n.requirement)}:{},...l?{priority:l}:{},...W(n.tag)!==void 0?{tag:W(n.tag)}:{}});return o(u,U(`\u2713 \u0110\xE3 s\u1EEDa t\xECnh hu\u1ED1ng ${u.code}`,`\u2713 Updated test case ${u.code}`)),0}if(i==="rm"&&s){let l=ws(c,s,W(n.reason)??"");return o(l,U(`\u2713 \u0110\xE3 xo\xE1 (m\u1EC1m) t\xECnh hu\u1ED1ng ${l.code} \u2014 m\xE3 gi\u1EEF l\u1EA1i, kh\xF4ng d\xF9ng l\u1EA1i.`,`\u2713 Soft-deleted test case ${l.code} \u2014 the code is kept and never reused.`)),0}throw new K("D\xF9ng: pan-test doc case add <KB-\u2026> | edit <TC-\u2026> | rm <TC-\u2026>")}case"result":{if(!i||!s)throw new K(`D\xF9ng: pan-test doc result <TC-\u2026> <${et.join("|")}>`);let c=Ze(n),l=ys(c,i,{status:s,...fe(n.actual)?{actual:fe(n.actual)}:{},...W(n.env)?{env:W(n.env)}:{},...W(n.bug)?{bug:W(n.bug)}:{},...W(n.by)?{by:W(n.by)}:{}});return o(l,`\u2713 ${l.code}: ${U(BA[l.result?.status??"not-run"],l.result?.status??"not-run")}`),0}case"export":{let{exportDoc:c,FORMATS:l}=await Promise.resolve().then(()=>(Zr(),wg)),u=Ze(n),d=ni(n.format)??["docx"];if(d.filter(f=>!l.includes(f)).length)throw new K(`--format ch\u1EC9 nh\u1EADn ${l.join(", ")}.`);let h=await c(u,{formats:d,results:n.results===!0,codes:n.codes===!0,...W(n.out)?{out:W(n.out)}:{}});return o({files:h},h.map(f=>`\u2713 ${f}`).join(`
5407
+ `)),0}case"import":{if(!i||!W(n.module))throw new K("D\xF9ng: pan-test doc import <t\u1EC7p.feature | th\u01B0 m\u1EE5c> --module <PH> [--json]");let{featureFiles:c,importFeature:l}=await Promise.resolve().then(()=>(ti(),Dc)),u=Ze(n),d=At.resolve(i);if(!da.existsSync(d))throw new K(`Kh\xF4ng th\u1EA5y ${d}.`);let p=da.statSync(d).isDirectory()?c(d):[d];if(!p.length)throw new K(`Kh\xF4ng c\xF3 t\u1EC7p .feature n\xE0o trong ${d}.`);let h=Ft(u.root),f=p.map(m=>({file:m,...l(u,da.readFileSync(m,"utf8"),{file:At.relative(u.root,m).split(At.sep).join("/"),module:W(n.module),avoid:h})}));return o(f,f.map(m=>`\u2713 ${At.relative(process.cwd(),m.file)} \u2192 ${m.suite}${m.created?" (m\u1EDBi)":""}: th\xEAm ${m.added.length}, c\u1EADp nh\u1EADt ${m.updated.length}${m.missing.length?`, ${m.missing.length} t\xECnh hu\u1ED1ng kh\xF4ng c\xF2n trong t\u1EC7p (gi\u1EEF nguy\xEAn, xem l\u1EA1i)`:""}${m.untagged?`, ${m.untagged} k\u1ECBch b\u1EA3n kh\xF4ng c\xF3 tag \u0111\u1ECBnh danh (kh\u1EDBp theo t\xEAn)`:""}`).join(`
5408
+ `)),0}case"results":{if(!i)throw new K("D\xF9ng: pan-test doc results <results.json | th\u01B0 m\u1EE5c b\xE1o c\xE1o> [--env UAT] [--json]");let{applyRunResults:c,readRunResults:l}=await Promise.resolve().then(()=>(ti(),Dc)),u=Ze(n),d=c(u,l(At.resolve(i)),{...W(n.env)?{env:W(n.env)}:{}}),p=h=>d.applied.filter(f=>f.status===h).length;return o(d,U(`\u2713 Ghi k\u1EBFt qu\u1EA3 ${d.applied.length} t\xECnh hu\u1ED1ng: \u0111\u1EA1t ${p("passed")}, kh\xF4ng \u0111\u1EA1t ${p("failed")}, b\u1ECF qua ${p("skipped")}.`,`\u2713 Recorded ${d.applied.length} result(s): ${p("passed")} passed, ${p("failed")} failed, ${p("skipped")} skipped.`)+(d.notRun.length?`
5409
+ ${d.notRun.length} t\xECnh hu\u1ED1ng c\xF3 tag nh\u01B0ng l\u1EA7n ch\u1EA1y kh\xF4ng c\xF3: ${d.notRun.slice(0,10).join(", ")}${d.notRun.length>10?"\u2026":""}`:"")+(d.unknownTags.length?`
5410
+ Tag trong l\u1EA7n ch\u1EA1y ch\u01B0a c\xF3 trong t\xE0i li\u1EC7u: ${d.unknownTags.slice(0,10).join(", ")}${d.unknownTags.length>10?"\u2026":""}`:"")),0}case"list":{let c=Ze(n),l=c.modules.map(d=>({code:d.code,title:d.title,suites:en(c,d.code).map(p=>({code:p.code,title:p.title,kind:p.kind,cases:p.cases.filter(h=>!h.deleted).map(h=>({code:h.code,case:h.case,status:h.result?.status??"not-run"}))}))})),u=[`${c.config.title}`];return l.forEach((d,p)=>{u.push(`${p+1}. ${d.code} \xB7 ${d.title}`),d.suites.forEach((h,f)=>{let m=h.cases.filter(g=>g.status==="passed").length;u.push(` ${p+1}.${f+1} ${h.code} \xB7 ${h.title} [${m}/${h.cases.length} ${U("\u0111\u1EA1t","passed")}]`)})}),o(l,u.join(`
5411
+ `)),0}case"check":{let c=Ze(n),l=Ve(c.root,c.config.ba),u=xs(c,l?bt(l):null),d=u.filter(f=>f.severity==="error").length,p=u.filter(f=>f.severity==="warn").length,h=u.length?u.map(f=>`${f.severity==="error"?"\u2717":f.severity==="warn"?"!":"i"} ${f.rule} ${f.message}${f.file?` (${f.file})`:""}`).join(`
4316
5412
  `)+`
4317
5413
 
4318
- ${p} l\u1ED7i \xB7 ${u} c\u1EA3nh b\xE1o`:"\u2713 Kh\xF4ng c\xF3 l\u1ED7i.";return o({errors:p,warnings:u,findings:d},(l.config.ba&&!c?`! Kh\xF4ng th\u1EA5y repo BA \xAB${l.config.ba}\xBB \u2014 b\u1ECF qua ki\u1EC3m tham chi\u1EBFu.
4319
- `:"")+f),p?2:0}case"summary":{let l=$t(n),c=zt(l.root,l.config.ba),d=is(l,c?Gt(c):null),p=[`T\u1ED5ng: ${lg(d.all)}`,...d.modules.map(u=>` ${u.code} \xB7 ${u.title}: ${u.suites} k\u1ECBch b\u1EA3n \xB7 ${lg(u.count)}`)];return d.coverage&&p.push(`\u0110\u1ED9 ph\u1EE7 ch\u1EE9c n\u0103ng BA: ${d.coverage.covered}/${d.coverage.functions}`),o(d,p.join(`
4320
- `)),0}default:throw new z(`Kh\xF4ng c\xF3 l\u1EC7nh \xABdoc ${r}\xBB.
5414
+ ${U(`${d} l\u1ED7i \xB7 ${p} c\u1EA3nh b\xE1o`,`${d} error(s) \xB7 ${p} warning(s)`)}`:U("\u2713 Kh\xF4ng c\xF3 l\u1ED7i.","\u2713 No errors.");return o({errors:d,warnings:p,findings:u},(c.config.ba&&!l?`! Kh\xF4ng th\u1EA5y repo BA \xAB${c.config.ba}\xBB \u2014 b\u1ECF qua ki\u1EC3m tham chi\u1EBFu.
5415
+ `:"")+h),d?2:0}case"bundle":{let{buildBundle:c}=await Promise.resolve().then(()=>(Xg(),Vg)),l=Ze(n);return console.log(JSON.stringify({root:l.root,...c(l)})),0}case"summary":{let c=Ze(n),l=Ve(c.root,c.config.ba),u=Pn(c,l?bt(l):null),d=[`${U("T\u1ED5ng","Total")}: ${Jg(u.all)}`,...u.modules.map(p=>` ${p.code} \xB7 ${p.title}: ${p.suites} ${U("k\u1ECBch b\u1EA3n","suite(s)")} \xB7 ${Jg(p.count)}`)];return u.coverage&&d.push(`${U("\u0110\u1ED9 ph\u1EE7 ch\u1EE9c n\u0103ng BA","BA function coverage")}: ${u.coverage.covered}/${u.coverage.functions}`),o(u,d.join(`
5416
+ `)),0}default:throw new K(`Kh\xF4ng c\xF3 l\u1EC7nh \xABdoc ${r}\xBB.
4321
5417
 
4322
- ${og}`)}}catch(l){if(l instanceof z)return console.error(`\u2717 ${l.message}`),1;throw l}}cg(process.argv.slice(2)).then(e=>process.exit(e)).catch(e=>{console.error(e),process.exit(1)});
5418
+ ${Yg()}`)}}catch(c){if(c instanceof K)return console.error(`\u2717 ${c.message}`),1;throw c}}Qg(process.argv.slice(2)).then(e=>process.exit(e)).catch(e=>{console.error(e),process.exit(1)});