@tablestore/tablestore-agent-cli 0.1.7 → 0.1.8

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 (153) hide show
  1. package/dist/dashboard-runtime/dashboard/.next/BUILD_ID +1 -1
  2. package/dist/dashboard-runtime/dashboard/.next/build-manifest.json +3 -3
  3. package/dist/dashboard-runtime/dashboard/.next/prerender-manifest.json +3 -3
  4. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
  5. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
  6. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/documents/page.js.nft.json +1 -1
  7. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/documents/page_client-reference-manifest.js +1 -1
  8. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/page.js.nft.json +1 -1
  9. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/page_client-reference-manifest.js +1 -1
  10. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/qa/page.js.nft.json +1 -1
  11. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/qa/page_client-reference-manifest.js +1 -1
  12. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/retrieval/page.js.nft.json +1 -1
  13. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/retrieval/page_client-reference-manifest.js +1 -1
  14. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/settings/page.js.nft.json +1 -1
  15. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/settings/page_client-reference-manifest.js +1 -1
  16. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/create/page_client-reference-manifest.js +1 -1
  17. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/page.js.nft.json +1 -1
  18. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/page_client-reference-manifest.js +1 -1
  19. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/[id]/page_client-reference-manifest.js +1 -1
  20. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/new/page_client-reference-manifest.js +1 -1
  21. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/page.js.nft.json +1 -1
  22. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/page_client-reference-manifest.js +1 -1
  23. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/messages/page.js.nft.json +1 -1
  24. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/messages/page_client-reference-manifest.js +1 -1
  25. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/page.js.nft.json +1 -1
  26. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/page_client-reference-manifest.js +1 -1
  27. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/requests/page.js.nft.json +1 -1
  28. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/requests/page_client-reference-manifest.js +1 -1
  29. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/search/page.js.nft.json +1 -1
  30. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/search/page_client-reference-manifest.js +1 -1
  31. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/settings/page.js.nft.json +1 -1
  32. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/settings/page_client-reference-manifest.js +1 -1
  33. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/units/page.js.nft.json +1 -1
  34. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/units/page_client-reference-manifest.js +1 -1
  35. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/create/page_client-reference-manifest.js +1 -1
  36. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/page.js.nft.json +1 -1
  37. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/page_client-reference-manifest.js +1 -1
  38. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/projects/page.js.nft.json +1 -1
  39. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/projects/page_client-reference-manifest.js +1 -1
  40. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.html +1 -1
  41. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.rsc +1 -1
  42. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  43. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  44. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  45. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  46. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  47. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  48. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.html +1 -1
  49. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.rsc +2 -2
  50. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  51. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  52. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  53. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  54. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  55. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  56. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/upload/route.js.nft.json +1 -1
  57. package/dist/dashboard-runtime/dashboard/.next/server/app/index.html +1 -1
  58. package/dist/dashboard-runtime/dashboard/.next/server/app/index.rsc +2 -2
  59. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  60. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_full.segment.rsc +2 -2
  61. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_head.segment.rsc +1 -1
  62. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_index.segment.rsc +2 -2
  63. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  64. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  65. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.html +1 -1
  66. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.rsc +3 -3
  67. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_full.segment.rsc +3 -3
  68. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_head.segment.rsc +1 -1
  69. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_index.segment.rsc +2 -2
  70. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_tree.segment.rsc +2 -2
  71. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +2 -2
  72. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/onboarding.segment.rsc +1 -1
  73. package/dist/dashboard-runtime/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
  74. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/0b1r_app_(dashboard)_knowledge-base_[name]_documents_documents-client_tsx_0g2uxmt._.js +1 -1
  75. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__09_30hi._.js +3 -0
  76. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0kaiok7._.js +3 -0
  77. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0l937k4._.js +3 -0
  78. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0-dlo4s._.js +1 -1
  79. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_01pp~xx._.js +3 -0
  80. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/{_0476v7r._.js → _08j6p-z._.js} +2 -2
  81. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/{_0ct0n55._.js → _09eom0_._.js} +2 -2
  82. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/{_0mzxmfh._.js → _0f-may2._.js} +2 -2
  83. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0fp_nnb._.js +3 -0
  84. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0l6jz-5._.js +3 -0
  85. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/{_0fg6iap._.js → _0ntv66s._.js} +2 -2
  86. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0sc0tpz._.js +3 -0
  87. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0tyxwr3._.js +3 -0
  88. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0u9md36._.js +1 -1
  89. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_065m1.j._.js +1 -1
  90. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_knowledge-base_[name]_layout-client_tsx_05momc5._.js +1 -1
  91. package/dist/dashboard-runtime/dashboard/.next/server/middleware-build-manifest.js +3 -3
  92. package/dist/dashboard-runtime/dashboard/.next/server/pages/404.html +1 -1
  93. package/dist/dashboard-runtime/dashboard/.next/server/pages/500.html +1 -1
  94. package/dist/dashboard-runtime/dashboard/.next/server/server-reference-manifest.js +1 -1
  95. package/dist/dashboard-runtime/dashboard/.next/server/server-reference-manifest.json +1 -1
  96. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0-xqk6wfme5fu.js +1 -0
  97. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0jeb9kxtd_jq..js → 00.fyg_t3xjc~.js} +1 -1
  98. package/dist/dashboard-runtime/dashboard/.next/static/chunks/01k-.wkndubwy.js +138 -0
  99. package/dist/dashboard-runtime/dashboard/.next/static/chunks/07r22x5uhjxjb.js +1 -0
  100. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0cbu3udngtx-v.js +4 -0
  101. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0h7d69g2fdgs6.js +138 -0
  102. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0iv0g360z0ja5.js +1 -0
  103. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0jf4ytf.izmzh.js +1 -0
  104. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{17nx_vdk_qemm.js → 0m42mmyxmgn-i.js} +1 -1
  105. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0odz1whf-ozqn.css +1 -0
  106. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0ouxv_2qvf6.9.js +1 -0
  107. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0rbkgj._oqsb3.js +1 -0
  108. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0u6u.649ou67b.js +1 -0
  109. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0vf7~eysvh9bq.js +1 -0
  110. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{09qsmnfvk8dm3.js → 0wmaq.ay~r2sn.js} +1 -1
  111. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0i5aqiffpm9jr.js → 0xb0_9t-vmo6e.js} +1 -1
  112. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0yp_2ea75d19v.js +1 -0
  113. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0s3mvx9_dr13c.js → 11cizim1aug~b.js} +1 -1
  114. package/dist/dashboard-runtime/dashboard/.next/static/chunks/13-2ei295hl0-.js +1 -0
  115. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/knowledge-base/[name]/qa/page.tsx +23 -1
  116. package/dist/dashboard-runtime/dashboard/src/components/documents/doc-upload-dialog.tsx +370 -91
  117. package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/kb-card.tsx +8 -5
  118. package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/kb-header.tsx +18 -10
  119. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-header.tsx +8 -12
  120. package/dist/dashboard-runtime/dashboard/src/components/qa/qa-chat-panel.tsx +45 -4
  121. package/dist/dashboard-runtime/dashboard/src/components/qa/qa-message.tsx +636 -36
  122. package/dist/dashboard-runtime/dashboard/src/components/shared/confirm-dialog.tsx +8 -1
  123. package/dist/dashboard-runtime/dashboard/src/components/shared/refresh-button.tsx +102 -86
  124. package/dist/dashboard-runtime/dashboard/src/hooks/use-qa-chat.ts +261 -58
  125. package/dist/dashboard-runtime/dashboard/src/lib/chat-message-ops.ts +76 -0
  126. package/dist/dashboard-runtime/dashboard/src/lib/dev-flags.ts +24 -0
  127. package/dist/dashboard-runtime/dashboard/src/types/llm-chat.ts +19 -0
  128. package/package.json +1 -1
  129. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0i0y9.r._.js +0 -3
  130. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0r_6wpx._.js +0 -3
  131. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0y8rrcu._.js +0 -3
  132. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_02e0c00._.js +0 -3
  133. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0doczxg._.js +0 -3
  134. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0e9y.xc._.js +0 -3
  135. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0ti~om_._.js +0 -3
  136. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0~s~e-0._.js +0 -3
  137. package/dist/dashboard-runtime/dashboard/.next/static/chunks/055_bo6_3nt-s.js +0 -1
  138. package/dist/dashboard-runtime/dashboard/.next/static/chunks/07l4dodn5t6l4.js +0 -4
  139. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0a5ass8u78k90.js +0 -1
  140. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0j~63ld9lbb25.js +0 -1
  141. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0l6znnjqw.4yw.js +0 -1
  142. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0o-c2g8y5pw-c.js +0 -1
  143. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0o0i2ke2jbdvq.js +0 -138
  144. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0u2lo2lzizxy_.js +0 -1
  145. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0v.hno.6q74nn.css +0 -1
  146. package/dist/dashboard-runtime/dashboard/.next/static/chunks/100.ax5hitxko.js +0 -1
  147. package/dist/dashboard-runtime/dashboard/.next/static/chunks/14ti2gx~1fiub.js +0 -1
  148. package/dist/dashboard-runtime/dashboard/.next/static/chunks/14vqmdm7sosj2.js +0 -1
  149. package/dist/dashboard-runtime/dashboard/.next/static/chunks/17h~onnkksf44.js +0 -138
  150. package/dist/dashboard-runtime/dashboard/.next/static/chunks/186jubvt5xyuj.js +0 -1
  151. /package/dist/dashboard-runtime/dashboard/.next/static/{wWmSSYUu4w4mIF1R_7UoM → BGnMIk4OPjFx_qvLFMTBc}/_buildManifest.js +0 -0
  152. /package/dist/dashboard-runtime/dashboard/.next/static/{wWmSSYUu4w4mIF1R_7UoM → BGnMIk4OPjFx_qvLFMTBc}/_clientMiddlewareManifest.js +0 -0
  153. /package/dist/dashboard-runtime/dashboard/.next/static/{wWmSSYUu4w4mIF1R_7UoM → BGnMIk4OPjFx_qvLFMTBc}/_ssgManifest.js +0 -0
@@ -1,138 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,20688,(e,t,r)=>{var n={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,a=l(e),s=a[0],o=a[1],u=new i((s+o)*3/4-o),c=0,p=o>0?s-4:s;for(r=0;r<p;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===o&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===o&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],s=0,o=n-i;s<o;s+=16383)a.push(function(e,t,n){for(var i,a=[],s=t;s<n;s+=3)i=(e[s]<<16&0xff0000)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}(e,s,s+16383>o?o:s+16383));return 1===i?a.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&a.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),a.join("")};for(var r=[],n=[],i="u">typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,o=a.length;s<o;++s)r[s]=a[s],n[a.charCodeAt(s)]=s;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},72:function(e,t,r){"use strict";var n=r(675),i=r(783),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function s(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!o.isEncoding(i))throw TypeError("Unknown encoding: "+i);var a=0|d(n,i),l=s(a),u=l.write(n,i);return u!==a&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e))return p(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(I(e,ArrayBuffer)||e&&I(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(I(e,SharedArrayBuffer)||e&&I(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),o.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var c=e.valueOf&&e.valueOf();if(null!=c&&c!==e)return o.from(c,t,r);var f=function(e){if(o.isBuffer(e)){var t=0|h(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?s(0):p(e):"Buffer"===e.type&&Array.isArray(e.data)?p(e.data):void 0}(e);if(f)return f;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),s(e<0?0:0|h(e))}function p(e){for(var t=e.length<0?0:0|h(e.length),r=s(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,o.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!o.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return(u(e),e<=0)?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)},o.allocUnsafe=function(e){return c(e)},o.allocUnsafeSlow=function(e){return c(e)};function h(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function d(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||I(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return C(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return N(e).length;default:if(i)return n?-1:C(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,r){var i,a,s,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=L[e[a]];return i}(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,a=t,s=r,0===a&&s===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(a,s));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}(this,t,r);default:if(o)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){var a;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(a=r*=1)!=a&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return y(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var a,s=1,o=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;s=2,o/=2,l/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(a=r;a<o;a++)if(u(e,a)===u(t,-1===c?0:a-c)){if(-1===c&&(c=a),a-c+1===l)return c*s}else -1!==c&&(a-=a-c),c=-1}else for(r+l>o&&(r=o-l),a=r;a>=0;a--){for(var p=!0,h=0;h<l;h++)if(u(e,a+h)!==u(t,h)){p=!1;break}if(p)return a}return -1}o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(I(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),I(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=o.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(I(a,Uint8Array)&&(a=o.from(a)),!o.isBuffer(a))throw TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},o.byteLength=d,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},o.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?b(this,0,e):f.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},a&&(o.prototype[a]=o.prototype.inspect),o.prototype.compare=function(e,t,r,n,i){if(I(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var a=i-n,s=r-t,l=Math.min(a,s),u=this.slice(n,i),c=e.slice(t,r),p=0;p<l;++p)if(u[p]!==c[p]){a=u[p],s=c[p];break}return a<s?-1:+(s<a)},o.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)};function b(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,s,o,l,u=e[i],c=null,p=u>239?4:u>223?3:u>191?2:1;if(i+p<=r)switch(p){case 1:u<128&&(c=u);break;case 2:(192&(a=e[i+1]))==128&&(l=(31&u)<<6|63&a)>127&&(c=l);break;case 3:a=e[i+1],s=e[i+2],(192&a)==128&&(192&s)==128&&(l=(15&u)<<12|(63&a)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:a=e[i+1],s=e[i+2],o=e[i+3],(192&a)==128&&(192&s)==128&&(192&o)==128&&(l=(15&u)<<18|(63&a)<<12|(63&s)<<6|63&o)>65535&&l<1114112&&(c=l)}null===c?(c=65533,p=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=p}var h=n,d=h.length;if(d<=4096)return String.fromCharCode.apply(String,h);for(var f="",m=0;m<d;)f+=String.fromCharCode.apply(String,h.slice(m,m+=4096));return f}function w(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function A(e,t,r,n,i,a){if(!o.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function _(e,t,r,n,i,a){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function x(e,t,r,n,a){return t*=1,r>>>=0,a||_(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function v(e,t,r,n,a){return t*=1,r>>>=0,a||_(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}o.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,a,s,o,l,u,c,p,h=this.length-t;if((void 0===r||r>h)&&(r=h),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var d=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;n>a/2&&(n=a/2);for(var s=0;s<n;++s){var o,l=parseInt(t.substr(2*s,2),16);if((o=l)!=o)break;e[r+s]=l}return s}(this,e,t,r);case"utf8":case"utf-8":return i=t,a=r,E(C(e,this.length-i),this,i,a);case"ascii":return s=t,o=r,E(S(e),this,s,o);case"latin1":case"binary":return function(e,t,r,n){return E(S(t),e,r,n)}(this,e,t,r);case"base64":return l=t,u=r,E(N(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,p=r,E(function(e,t){for(var r,n,i=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,i.push(r%256),i.push(n);return i}(e,this.length-c),this,c,p);default:if(d)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,o.prototype),n},o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUInt8=function(e,t){return e>>>=0,t||w(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},o.prototype.readInt8=function(e,t){return(e>>>=0,t||w(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||w(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||w(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||w(e,4,this.length),i.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||w(e,4,this.length),i.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||w(e,8,this.length),i.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||w(e,8,this.length),i.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;A(this,e,t,r,i,0)}var a=1,s=0;for(this[t]=255&e;++s<r&&(a*=256);)this[t+s]=e/a&255;return t+r},o.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;A(this,e,t,r,i,0)}var a=r-1,s=1;for(this[t+a]=255&e;--a>=0&&(s*=256);)this[t+a]=e/s&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);A(this,e,t,r,i-1,-i)}var a=0,s=1,o=0;for(this[t]=255&e;++a<r&&(s*=256);)e<0&&0===o&&0!==this[t+a-1]&&(o=1),this[t+a]=(e/s|0)-o&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);A(this,e,t,r,i-1,-i)}var a=r-1,s=1,o=0;for(this[t+a]=255&e;--a>=0&&(s*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/s|0)-o&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeFloatLE=function(e,t,r){return x(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return x(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return v(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return v(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(!o.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var a=i-1;a>=0;--a)e[a+t]=this[a+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},o.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,a=e.charCodeAt(0);("utf8"===n&&a<128||"latin1"===n)&&(e=a)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var s=o.isBuffer(e)?e:o.from(e,n),l=s.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%l]}return this};var k=/[^+/0-9A-Za-z-_]/g;function C(e,t){t=t||1/0;for(var r,n=e.length,i=null,a=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319||s+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return a}function S(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function N(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(k,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function E(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function I(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var L=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},783:function(e,t){t.read=function(e,t,r,n,i){var a,s,o=8*i-n-1,l=(1<<o)-1,u=l>>1,c=-7,p=r?i-1:0,h=r?-1:1,d=e[t+p];for(p+=h,a=d&(1<<-c)-1,d>>=-c,c+=o;c>0;a=256*a+e[t+p],p+=h,c-=8);for(s=a&(1<<-c)-1,a>>=-c,c+=n;c>0;s=256*s+e[t+p],p+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),a-=u}return(d?-1:1)*s*Math.pow(2,a-n)},t.write=function(e,t,r,n,i,a){var s,o,l,u=8*a-i-1,c=(1<<u)-1,p=c>>1,h=5960464477539062e-23*(23===i),d=n?0:a-1,f=n?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(o=+!!isNaN(t),s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+p>=1?t+=h/l:t+=h*Math.pow(2,1-p),t*l>=2&&(s++,l/=2),s+p>=c?(o=0,s=c):s+p>=1?(o=(t*l-1)*Math.pow(2,i),s+=p):(o=t*Math.pow(2,p-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&o,d+=f,o/=256,i-=8);for(s=s<<i|o,u+=i;u>0;e[r+d]=255&s,d+=f,s/=256,u-=8);e[r+d-f]|=128*m}}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}},s=!0;try{n[e](r,r.exports,a),s=!1}finally{s&&delete i[e]}return r.exports}a.ab="/ROOT/node_modules/.pnpm/next@16.2.4_react-dom@19.2.5_react@19.2.5__react@19.2.5/node_modules/next/dist/compiled/buffer/",t.exports=a(72)},21122,50657,51024,9012,e=>{"use strict";let t,r,n,i,a;var s,o,l,u=e.i(44501),c=e.i(17635),p=e.i(37769),h=e.i(86620);let d=(0,h.default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]),f=(0,h.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var m=e.i(42595),g=e.i(45123),y=e.i(99877),b=e.i(76490);let w=(0,h.default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),A=(0,h.default)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);var _=e.i(18722),x=e.i(20268),v=e.i(96416),k=e.i(64209);let C=[{id:"abap",name:"ABAP",import:()=>e.A(81107)},{id:"actionscript-3",name:"ActionScript",import:()=>e.A(63750)},{id:"ada",name:"Ada",import:()=>e.A(91813)},{id:"angular-html",name:"Angular HTML",import:()=>e.A(56500)},{id:"angular-ts",name:"Angular TypeScript",import:()=>e.A(16569)},{id:"apache",name:"Apache Conf",import:()=>e.A(34082)},{id:"apex",name:"Apex",import:()=>e.A(96050)},{id:"apl",name:"APL",import:()=>e.A(19847)},{id:"applescript",name:"AppleScript",import:()=>e.A(78893)},{id:"ara",name:"Ara",import:()=>e.A(73785)},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>e.A(70789)},{id:"asm",name:"Assembly",import:()=>e.A(57041)},{id:"astro",name:"Astro",import:()=>e.A(77155)},{id:"awk",name:"AWK",import:()=>e.A(19686)},{id:"ballerina",name:"Ballerina",import:()=>e.A(4821)},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>e.A(81214)},{id:"beancount",name:"Beancount",import:()=>e.A(7827)},{id:"berry",name:"Berry",aliases:["be"],import:()=>e.A(59139)},{id:"bibtex",name:"BibTeX",import:()=>e.A(2523)},{id:"bicep",name:"Bicep",import:()=>e.A(65206)},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:()=>e.A(20766)},{id:"blade",name:"Blade",import:()=>e.A(43021)},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>e.A(590)},{id:"c",name:"C",import:()=>e.A(2328)},{id:"c3",name:"C3",import:()=>e.A(853)},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>e.A(87209)},{id:"cairo",name:"Cairo",import:()=>e.A(82927)},{id:"clarity",name:"Clarity",import:()=>e.A(52460)},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>e.A(85623)},{id:"cmake",name:"CMake",import:()=>e.A(85367)},{id:"cobol",name:"COBOL",import:()=>e.A(93874)},{id:"codeowners",name:"CODEOWNERS",import:()=>e.A(81727)},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>e.A(52172)},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>e.A(67432)},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>e.A(92185)},{id:"coq",name:"Coq",import:()=>e.A(83109)},{id:"cpp",name:"C++",aliases:["c++"],import:()=>e.A(63419)},{id:"crystal",name:"Crystal",import:()=>e.A(80210)},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>e.A(37160)},{id:"css",name:"CSS",import:()=>e.A(35302)},{id:"csv",name:"CSV",import:()=>e.A(4163)},{id:"cue",name:"CUE",import:()=>e.A(2170)},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>e.A(59146)},{id:"d",name:"D",import:()=>e.A(53717)},{id:"dart",name:"Dart",import:()=>e.A(40194)},{id:"dax",name:"DAX",import:()=>e.A(96874)},{id:"desktop",name:"Desktop",import:()=>e.A(17925)},{id:"diff",name:"Diff",import:()=>e.A(58196)},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>e.A(41274)},{id:"dotenv",name:"dotEnv",import:()=>e.A(169)},{id:"dream-maker",name:"Dream Maker",import:()=>e.A(86068)},{id:"edge",name:"Edge",import:()=>e.A(24716)},{id:"elixir",name:"Elixir",import:()=>e.A(62285)},{id:"elm",name:"Elm",import:()=>e.A(35711)},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>e.A(70112)},{id:"erb",name:"ERB",import:()=>e.A(19341)},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>e.A(16686)},{id:"fennel",name:"Fennel",import:()=>e.A(6581)},{id:"fish",name:"Fish",import:()=>e.A(14037)},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>e.A(35601)},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>e.A(83987)},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>e.A(6099)},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>e.A(83499)},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:()=>e.A(87861)},{id:"gdscript",name:"GDScript",aliases:["gd"],import:()=>e.A(80083)},{id:"gdshader",name:"GDShader",import:()=>e.A(38264)},{id:"genie",name:"Genie",import:()=>e.A(7204)},{id:"gherkin",name:"Gherkin",import:()=>e.A(13549)},{id:"git-commit",name:"Git Commit Message",import:()=>e.A(97183)},{id:"git-rebase",name:"Git Rebase Message",import:()=>e.A(32046)},{id:"gleam",name:"Gleam",import:()=>e.A(7826)},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>e.A(7076)},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>e.A(25338)},{id:"glsl",name:"GLSL",import:()=>e.A(20366)},{id:"gn",name:"GN",import:()=>e.A(7005)},{id:"gnuplot",name:"Gnuplot",import:()=>e.A(9742)},{id:"go",name:"Go",import:()=>e.A(32961)},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>e.A(28949)},{id:"groovy",name:"Groovy",import:()=>e.A(99953)},{id:"hack",name:"Hack",import:()=>e.A(94818)},{id:"haml",name:"Ruby Haml",import:()=>e.A(45962)},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>e.A(54989)},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>e.A(19766)},{id:"haxe",name:"Haxe",import:()=>e.A(36800)},{id:"hcl",name:"HashiCorp HCL",import:()=>e.A(48226)},{id:"hjson",name:"Hjson",import:()=>e.A(82962)},{id:"hlsl",name:"HLSL",import:()=>e.A(44097)},{id:"html",name:"HTML",import:()=>e.A(63665)},{id:"html-derivative",name:"HTML (Derivative)",import:()=>e.A(94224)},{id:"http",name:"HTTP",import:()=>e.A(67513)},{id:"hurl",name:"Hurl",import:()=>e.A(81432)},{id:"hxml",name:"HXML",import:()=>e.A(62205)},{id:"hy",name:"Hy",import:()=>e.A(79622)},{id:"imba",name:"Imba",import:()=>e.A(92033)},{id:"ini",name:"INI",aliases:["properties"],import:()=>e.A(80261)},{id:"java",name:"Java",import:()=>e.A(44410)},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:()=>e.A(91941)},{id:"jinja",name:"Jinja",import:()=>e.A(61819)},{id:"jison",name:"Jison",import:()=>e.A(12957)},{id:"json",name:"JSON",import:()=>e.A(69035)},{id:"json5",name:"JSON5",import:()=>e.A(15864)},{id:"jsonc",name:"JSON with Comments",import:()=>e.A(61453)},{id:"jsonl",name:"JSON Lines",import:()=>e.A(27145)},{id:"jsonnet",name:"Jsonnet",import:()=>e.A(72102)},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>e.A(61866)},{id:"jsx",name:"JSX",import:()=>e.A(47375)},{id:"julia",name:"Julia",aliases:["jl"],import:()=>e.A(79483)},{id:"just",name:"Just",import:()=>e.A(27549)},{id:"kdl",name:"KDL",import:()=>e.A(78226)},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>e.A(89992)},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>e.A(96473)},{id:"latex",name:"LaTeX",import:()=>e.A(39084)},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>e.A(87185)},{id:"less",name:"Less",import:()=>e.A(67110)},{id:"liquid",name:"Liquid",import:()=>e.A(77875)},{id:"llvm",name:"LLVM IR",import:()=>e.A(67140)},{id:"log",name:"Log file",import:()=>e.A(92086)},{id:"logo",name:"Logo",import:()=>e.A(96265)},{id:"lua",name:"Lua",import:()=>e.A(19030)},{id:"luau",name:"Luau",import:()=>e.A(56786)},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>e.A(43167)},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>e.A(90015)},{id:"marko",name:"Marko",import:()=>e.A(77121)},{id:"matlab",name:"MATLAB",import:()=>e.A(93408)},{id:"mdc",name:"MDC",import:()=>e.A(81294)},{id:"mdx",name:"MDX",import:()=>e.A(42248)},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>e.A(18803)},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>e.A(89643)},{id:"mojo",name:"Mojo",import:()=>e.A(29681)},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:()=>e.A(75864)},{id:"move",name:"Move",import:()=>e.A(1566)},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>e.A(17849)},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>e.A(68450)},{id:"nextflow-groovy",name:"nextflow-groovy",import:()=>e.A(44946)},{id:"nginx",name:"Nginx",import:()=>e.A(35471)},{id:"nim",name:"Nim",import:()=>e.A(24230)},{id:"nix",name:"Nix",import:()=>e.A(91052)},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>e.A(40785)},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>e.A(65479)},{id:"objective-cpp",name:"Objective-C++",import:()=>e.A(74546)},{id:"ocaml",name:"OCaml",import:()=>e.A(64834)},{id:"odin",name:"Odin",import:()=>e.A(91473)},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:()=>e.A(31836)},{id:"pascal",name:"Pascal",import:()=>e.A(86958)},{id:"perl",name:"Perl",import:()=>e.A(98959)},{id:"php",name:"PHP",import:()=>e.A(6721)},{id:"pkl",name:"Pkl",import:()=>e.A(98326)},{id:"plsql",name:"PL/SQL",import:()=>e.A(93909)},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>e.A(19867)},{id:"polar",name:"Polar",import:()=>e.A(67362)},{id:"postcss",name:"PostCSS",import:()=>e.A(44583)},{id:"powerquery",name:"PowerQuery",import:()=>e.A(65129)},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>e.A(69514)},{id:"prisma",name:"Prisma",import:()=>e.A(43874)},{id:"prolog",name:"Prolog",import:()=>e.A(65557)},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>e.A(53316)},{id:"pug",name:"Pug",aliases:["jade"],import:()=>e.A(6098)},{id:"puppet",name:"Puppet",import:()=>e.A(32516)},{id:"purescript",name:"PureScript",import:()=>e.A(58805)},{id:"python",name:"Python",aliases:["py"],import:()=>e.A(86636)},{id:"qml",name:"QML",import:()=>e.A(48377)},{id:"qmldir",name:"QML Directory",import:()=>e.A(28449)},{id:"qss",name:"Qt Style Sheets",import:()=>e.A(80279)},{id:"r",name:"R",import:()=>e.A(74190)},{id:"racket",name:"Racket",import:()=>e.A(22166)},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>e.A(43712)},{id:"razor",name:"ASP.NET Razor",import:()=>e.A(94256)},{id:"reg",name:"Windows Registry Script",import:()=>e.A(10369)},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>e.A(27379)},{id:"rel",name:"Rel",import:()=>e.A(62502)},{id:"riscv",name:"RISC-V",import:()=>e.A(36578)},{id:"ron",name:"RON",import:()=>e.A(34463)},{id:"rosmsg",name:"ROS Interface",import:()=>e.A(57616)},{id:"rst",name:"reStructuredText",import:()=>e.A(25130)},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>e.A(70562)},{id:"rust",name:"Rust",aliases:["rs"],import:()=>e.A(20768)},{id:"sas",name:"SAS",import:()=>e.A(93376)},{id:"sass",name:"Sass",import:()=>e.A(84802)},{id:"scala",name:"Scala",import:()=>e.A(87506)},{id:"scheme",name:"Scheme",import:()=>e.A(23504)},{id:"scss",name:"SCSS",import:()=>e.A(4006)},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>e.A(31324)},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>e.A(90222)},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>e.A(17085)},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>e.A(36141)},{id:"smalltalk",name:"Smalltalk",import:()=>e.A(73046)},{id:"solidity",name:"Solidity",import:()=>e.A(37320)},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>e.A(12549)},{id:"sparql",name:"SPARQL",import:()=>e.A(55388)},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>e.A(71559)},{id:"sql",name:"SQL",import:()=>e.A(62250)},{id:"ssh-config",name:"SSH Config",import:()=>e.A(79140)},{id:"stata",name:"Stata",import:()=>e.A(58405)},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>e.A(96543)},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:()=>e.A(13164)},{id:"svelte",name:"Svelte",import:()=>e.A(76180)},{id:"swift",name:"Swift",import:()=>e.A(83238)},{id:"system-verilog",name:"SystemVerilog",import:()=>e.A(20599)},{id:"systemd",name:"Systemd Units",import:()=>e.A(33838)},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>e.A(24411)},{id:"tasl",name:"Tasl",import:()=>e.A(13935)},{id:"tcl",name:"Tcl",import:()=>e.A(20474)},{id:"templ",name:"Templ",import:()=>e.A(53318)},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>e.A(79228)},{id:"tex",name:"TeX",import:()=>e.A(40618)},{id:"toml",name:"TOML",import:()=>e.A(5470)},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>e.A(30537)},{id:"tsv",name:"TSV",import:()=>e.A(40623)},{id:"tsx",name:"TSX",import:()=>e.A(24096)},{id:"turtle",name:"Turtle",import:()=>e.A(27542)},{id:"twig",name:"Twig",import:()=>e.A(77825)},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:()=>e.A(19350)},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>e.A(86116)},{id:"typst",name:"Typst",aliases:["typ"],import:()=>e.A(72085)},{id:"v",name:"V",import:()=>e.A(56293)},{id:"vala",name:"Vala",import:()=>e.A(3131)},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>e.A(67619)},{id:"verilog",name:"Verilog",import:()=>e.A(86165)},{id:"vhdl",name:"VHDL",import:()=>e.A(35200)},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>e.A(33464)},{id:"vue",name:"Vue",import:()=>e.A(54049)},{id:"vue-html",name:"Vue HTML",import:()=>e.A(499)},{id:"vue-vine",name:"Vue Vine",import:()=>e.A(6993)},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>e.A(80598)},{id:"wasm",name:"WebAssembly",import:()=>e.A(72318)},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>e.A(84860)},{id:"wgsl",name:"WGSL",import:()=>e.A(46196)},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>e.A(19331)},{id:"wit",name:"WebAssembly Interface Types",import:()=>e.A(25277)},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>e.A(68013)},{id:"xml",name:"XML",import:()=>e.A(64046)},{id:"xsl",name:"XSL",import:()=>e.A(7544)},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>e.A(18299)},{id:"zenscript",name:"ZenScript",import:()=>e.A(36493)},{id:"zig",name:"Zig",import:()=>e.A(76720)}],S=Object.fromEntries(C.map(e=>[e.id,e.import])),N=Object.fromEntries(C.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),E={...S,...N};class I extends Error{constructor(e){super(e),this.name="ShikiError"}}var L=e.i(35884);function P(e,...t){return t.forEach(t=>{for(let r in t)e[r]=t[r]}),e}var R=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,$=class{static hasCaptures(e){return null!==e&&(R.lastIndex=0,R.test(e))}static replaceCaptures(e,t,r){return e.replace(R,(e,n,i,a)=>{let s=r[parseInt(n||i,10)];if(!s)return e;{let e=t.substring(s.start,s.end);for(;"."===e[0];)e=e.substring(1);switch(a){case"downcase":return e.toLowerCase();case"upcase":return e.toUpperCase();default:return e}}})}};function T(e,t){if(null===e&&null===t)return 0;if(!e)return -1;if(!t)return 1;let r=e.length,n=t.length;if(r===n){for(let n=0;n<r;n++){var i,a;let r=(i=e[n],i<(a=t[n])?-1:+(i>a));if(0!==r)return r}return 0}return r-n}function M(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function j(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var B=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},O=class{constructor(e,t,r){this._colorMap=e,this._defaults=t,this._root=r}static createFromRawTheme(e,t){return this.createFromParsedTheme(function(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,r=[],n=0;for(let e=0,i=t.length;e<i;e++){let i,a=t[e];if(!a.settings)continue;if("string"==typeof a.scope){let e=a.scope;i=(e=(e=e.replace(/^[,]+/,"")).replace(/[,]+$/,"")).split(",")}else i=Array.isArray(a.scope)?a.scope:[""];let s=-1;if("string"==typeof a.settings.fontStyle){s=0;let e=a.settings.fontStyle.split(" ");for(let t=0,r=e.length;t<r;t++)switch(e[t]){case"italic":s|=1;break;case"bold":s|=2;break;case"underline":s|=4;break;case"strikethrough":s|=8}}let o=null;"string"==typeof a.settings.foreground&&M(a.settings.foreground)&&(o=a.settings.foreground);let l=null;"string"==typeof a.settings.background&&M(a.settings.background)&&(l=a.settings.background);for(let t=0,a=i.length;t<a;t++){let a=i[t].trim().split(" "),u=a[a.length-1],c=null;a.length>1&&(c=a.slice(0,a.length-1)).reverse(),r[n++]=new D(u,c,e,s,o,l)}}return r}(e),t)}static createFromParsedTheme(e,t){return function(e,t){e.sort((e,t)=>{var r,n;let i=(r=e.scope,r<(n=t.scope)?-1:+(r>n));return 0!==i||0!==(i=T(e.parentScopes,t.parentScopes))?i:e.index-t.index});let r=0,n="#000000",i="#ffffff";for(;e.length>=1&&""===e[0].scope;){let t=e.shift();-1!==t.fontStyle&&(r=t.fontStyle),null!==t.foreground&&(n=t.foreground),null!==t.background&&(i=t.background)}let a=new W(t),s=new U(r,a.getId(n),a.getId(i)),o=new q(new z(0,null,-1,0,0),[]);for(let t=0,r=e.length;t<r;t++){let r=e[t];o.insert(0,r.scope,r.parentScopes,r.fontStyle,a.getId(r.foreground),a.getId(r.background))}return new O(a,s,o)}(e,t)}_cachedMatchRoot=new B(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(null===e)return this._defaults;let t=e.scopeName,r=this._cachedMatchRoot.get(t).find(t=>(function(e,t){if(0===t.length)return!0;for(let i=0;i<t.length;i++){var r,n;let a=t[i],s=!1;if(">"===a){if(i===t.length-1)return!1;a=t[++i],s=!0}for(;e&&(r=e.scopeName,!((n=a)===r||r.startsWith(n)&&"."===r[n.length]));){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0})(e.parent,t.parentScopes));return r?new U(r.fontStyle,r.foreground,r.background):null}},G=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,r){for(let n of r)t=new e(t,n);return t}static from(...t){let r=null;for(let n=0;n<t.length;n++)r=new e(r,t[n]);return r}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e||null!==this.parent&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],r=this;for(;r&&r!==e;)t.push(r.scopeName),r=r.parent;return r===e?t.reverse():void 0}},U=class{constructor(e,t,r){this.fontStyle=e,this.foregroundId=t,this.backgroundId=r}},D=class{constructor(e,t,r,n,i,a){this.scope=e,this.parentScopes=t,this.index=r,this.fontStyle=n,this.foreground=i,this.background=a}},F=((s=F||{})[s.NotSet=-1]="NotSet",s[s.None=0]="None",s[s.Italic=1]="Italic",s[s.Bold=2]="Bold",s[s.Underline=4]="Underline",s[s.Strikethrough=8]="Strikethrough",s),W=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,r=e.length;t<r;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(null===e)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},H=Object.freeze([]),z=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,r,n,i){this.scopeDepth=e,this.parentScopes=t||H,this.fontStyle=r,this.foreground=n,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let r=0,n=e.length;r<n;r++)t[r]=e[r].clone();return t}acceptOverwrite(e,t,r,n){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,-1!==t&&(this.fontStyle=t),0!==r&&(this.foreground=r),0!==n&&(this.background=n)}},q=class e{constructor(e,t=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let r=0,n=0;for(;">"===e.parentScopes[r]&&r++,">"===t.parentScopes[n]&&n++,!(r>=e.parentScopes.length)&&!(n>=t.parentScopes.length);){let i=t.parentScopes[n].length-e.parentScopes[r].length;if(0!==i)return i;r++,n++}return t.parentScopes.length-e.parentScopes.length}match(t){if(""!==t){let e,r,n=t.indexOf(".");if(-1===n?(e=t,r=""):(e=t.substring(0,n),r=t.substring(n+1)),this._children.hasOwnProperty(e))return this._children[e].match(r)}let r=this._rulesWithParentScopes.concat(this._mainRule);return r.sort(e._cmpBySpecificity),r}insert(t,r,n,i,a,s){let o,l,u;if(""===r)return void this._doInsertHere(t,n,i,a,s);let c=r.indexOf(".");-1===c?(o=r,l=""):(o=r.substring(0,c),l=r.substring(c+1)),this._children.hasOwnProperty(o)?u=this._children[o]:(u=new e(this._mainRule.clone(),z.cloneArr(this._rulesWithParentScopes)),this._children[o]=u),u.insert(t+1,l,n,i,a,s)}_doInsertHere(e,t,r,n,i){if(null===t)return void this._mainRule.acceptOverwrite(e,r,n,i);for(let a=0,s=this._rulesWithParentScopes.length;a<s;a++){let s=this._rulesWithParentScopes[a];if(0===T(s.parentScopes,t))return void s.acceptOverwrite(e,r,n,i)}-1===r&&(r=this._mainRule.fontStyle),0===n&&(n=this._mainRule.foreground),0===i&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new z(e,t,r,n,i))}},V=class e{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(t){let r=e.getLanguageId(t),n=e.getTokenType(t),i=e.getFontStyle(t);console.log({languageId:r,tokenType:n,fontStyle:i,foreground:e.getForeground(t),background:e.getBackground(t)})}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return(1024&e)!=0}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(0xff8000&e)>>>15}static getBackground(e){return(0xff000000&e)>>>24}static set(t,r,n,i,a,s,o){let l=e.getLanguageId(t),u=e.getTokenType(t),c=+!!e.containsBalancedBrackets(t),p=e.getFontStyle(t),h=e.getForeground(t),d=e.getBackground(t);return 0!==r&&(l=r),8!==n&&(u=n),null!==i&&(c=+!!i),-1!==a&&(p=a),0!==s&&(h=s),0!==o&&(d=o),(l|u<<8|c<<10|p<<11|h<<15|d<<24)>>>0}};function Q(e,t){var r;let n,i,a=[],s=(r=e,i=(n=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g).exec(r),{next:()=>{if(!i)return null;let e=i[0];return i=n.exec(r),e}}),o=s.next();for(;null!==o;){let e=0;if(2===o.length&&":"===o.charAt(1)){switch(o.charAt(0)){case"R":e=1;break;case"L":e=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=s.next()}let t=u();if(a.push({matcher:t,priority:e}),","!==o)break;o=s.next()}return a;function l(){if("-"===o){o=s.next();let e=l();return t=>!!e&&!e(t)}if("("===o){o=s.next();let e=function(){let e=[],t=u();for(;t&&(e.push(t),"|"===o||","===o);){do o=s.next();while("|"===o||","===o)t=u()}return t=>e.some(e=>e(t))}();return")"===o&&(o=s.next()),e}if(X(o)){let e=[];do e.push(o),o=s.next();while(X(o))return r=>t(e,r)}return null}function u(){let e=[],t=l();for(;t;)e.push(t),t=l();return t=>e.every(e=>e(t))}}function X(e){return!!e&&!!e.match(/[\w\.:]+/)}var K=((o=K||{})[o.None=0]="None",o[o.NotBeginString=1]="NotBeginString",o[o.NotEndString=2]="NotEndString",o[o.NotBeginPosition=4]="NotBeginPosition",o[o.DebugCall=8]="DebugCall",o);function J(e){"function"==typeof e.dispose&&e.dispose()}var Z=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Y=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},ee=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},et=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Z(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new ee;for(let r of e)!function(e,t,r,n){let i=r.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=r.lookup(t);e instanceof Z?en({baseGrammar:a,selfGrammar:i},n):er(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},n);let s=r.injections(e.scopeName);if(s)for(let e of s)n.add(new Z(e))}(r,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof Z){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function er(e,t,r){t.repository&&t.repository[e]&&ei([t.repository[e]],t,r)}function en(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&ei(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&ei(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function ei(e,t,r){for(let n of e){if(r.visitedRule.has(n))continue;r.visitedRule.add(n);let e=n.repository?P({},t.repository,n.repository):t.repository;Array.isArray(n.patterns)&&ei(n.patterns,{...t,repository:e},r);let i=n.include;if(!i)continue;let a=ec(i);switch(a.kind){case 0:en({...t,selfGrammar:t.baseGrammar},r);break;case 1:en(t,r);break;case 2:er(a.ruleName,{...t,repository:e},r);break;case 3:case 4:let s=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(s){let n={baseGrammar:t.baseGrammar,selfGrammar:s,repository:e};4===a.kind?er(a.ruleName,n,r):en(n,r)}else 4===a.kind?r.add(new Y(a.scopeName,a.ruleName)):r.add(new Z(a.scopeName))}}}var ea=class{kind=0},es=class{kind=1},eo=class{constructor(e){this.ruleName=e}kind=2},el=class{constructor(e){this.scopeName=e}kind=3},eu=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function ec(e){if("$base"===e)return new ea;if("$self"===e)return new es;let t=e.indexOf("#");return -1===t?new el(e):0===t?new eo(e.substring(1)):new eu(e.substring(0,t),e.substring(t+1))}var ep=/\\(\d+)/,eh=/\\(\d+)/g;Symbol("RuleId");var ed=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,r,n){this.$location=e,this.id=t,this._name=r||null,this._nameIsCapturing=$.hasCaptures(this._name),this._contentName=n||null,this._contentNameIsCapturing=$.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${function e(t){let r=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return 0===r?t:~r==t.length-1?e(t.substring(0,t.length-1)):t.substr(~r+1)}(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return this._nameIsCapturing&&null!==this._name&&null!==e&&null!==t?$.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?$.replaceCaptures(this._contentName,e,t):this._contentName}},ef=class extends ed{retokenizeCapturedWithRuleId;constructor(e,t,r,n,i){super(e,t,r,n),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error("Not supported!")}compile(e,t){throw Error("Not supported!")}compileAG(e,t,r,n){throw Error("Not supported!")}},em=class extends ed{_match;captures;_cachedCompiledPatterns;constructor(e,t,r,n,i){super(e,t,r,null),this._match=new eA(n,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,r,n){return this._getCachedCompiledPatterns(e).compileAG(e,r,n)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new e_,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},eg=class extends ed{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,r,n,i){super(e,t,r,n),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(let r of this.patterns)e.getRule(r).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,r,n){return this._getCachedCompiledPatterns(e).compileAG(e,r,n)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new e_,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ey=class extends ed{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,r,n,i,a,s,o,l,u){super(e,t,r,n),this._begin=new eA(i,this.id),this.beginCaptures=a,this._end=new eA(s||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=o,this.applyEndPatternLast=l||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,r,n){return this._getCachedCompiledPatterns(e,t).compileAG(e,r,n)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){for(let t of(this._cachedCompiledPatterns=new e_,this.patterns))e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},eb=class extends ed{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,r,n,i,a,s,o,l){super(e,t,r,n),this._begin=new eA(i,this.id),this.beginCaptures=a,this.whileCaptures=o,this._while=new eA(s,-2),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,r,n){return this._getCachedCompiledPatterns(e).compileAG(e,r,n)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns)for(let t of(this._cachedCompiledPatterns=new e_,this.patterns))e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,r,n){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,r,n)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new e_,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},ew=class e{static createCaptureRule(e,t,r,n,i){return e.registerRule(e=>new ef(t,e,r,n,i))}static getCompiledRuleId(t,r,n){return t.id||r.registerRule(i=>{if(t.id=i,t.match)return new em(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,r,n));if(void 0===t.begin){t.repository&&(n=P({},n,t.repository));let i=t.patterns;return void 0===i&&t.include&&(i=[{include:t.include}]),new eg(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,r,n))}return t.while?new eb(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,r,n),t.while,e._compileCaptures(t.whileCaptures||t.captures,r,n),e._compilePatterns(t.patterns,r,n)):new ey(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,r,n),t.end,e._compileCaptures(t.endCaptures||t.captures,r,n),t.applyEndPatternLast,e._compilePatterns(t.patterns,r,n))}),t.id}static _compileCaptures(t,r,n){let i=[];if(t){let a=0;for(let e in t){if("$vscodeTextmateLocation"===e)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if("$vscodeTextmateLocation"===a)continue;let s=parseInt(a,10),o=0;t[a].patterns&&(o=e.getCompiledRuleId(t[a],r,n)),i[s]=e.createCaptureRule(r,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,o)}}return i}static _compilePatterns(t,r,n){let i=[];if(t)for(let a=0,s=t.length;a<s;a++){let s=t[a],o=-1;if(s.include){let t=ec(s.include);switch(t.kind){case 0:case 1:o=e.getCompiledRuleId(n[s.include],r,n);break;case 2:let i=n[t.ruleName];i&&(o=e.getCompiledRuleId(i,r,n));break;case 3:case 4:let a=t.scopeName,l=4===t.kind?t.ruleName:null,u=r.getExternalGrammar(a,n);if(u)if(l){let t=u.repository[l];t&&(o=e.getCompiledRuleId(t,r,u.repository))}else o=e.getCompiledRuleId(u.repository.$self,r,u.repository)}}else o=e.getCompiledRuleId(s,r,n);if(-1!==o){let e=r.getRule(o),t=!1;if((e instanceof eg||e instanceof ey||e instanceof eb)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;i.push(o)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},eA=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&"string"==typeof e){const t=e.length;let r=0,n=[],i=!1;for(let a=0;a<t;a++)if("\\"===e.charAt(a)&&a+1<t){const t=e.charAt(a+1);"z"===t?(n.push(e.substring(r,a)),n.push("$(?!\\n)(?<!\\n)"),r=a+2):("A"===t||"G"===t)&&(i=!0),a++}this.hasAnchor=i,0===r?this.source=e:(n.push(e.substring(r,t)),this.source=n.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,"string"==typeof this.source?this.hasBackReferences=ep.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if("string"!=typeof this.source)throw Error("This method should only be called if the source is a string");let r=t.map(t=>e.substring(t.start,t.end));return eh.lastIndex=0,this.source.replace(eh,(e,t)=>j(r[parseInt(t,10)]||""))}_buildAnchorCache(){let e,t,r,n;if("string"!=typeof this.source)throw Error("This method should only be called if the source is a string");let i=[],a=[],s=[],o=[];for(e=0,t=this.source.length;e<t;e++)r=this.source.charAt(e),i[e]=r,a[e]=r,s[e]=r,o[e]=r,"\\"===r&&e+1<t&&("A"===(n=this.source.charAt(e+1))?(i[e+1]="￿",a[e+1]="￿",s[e+1]="A",o[e+1]="A"):"G"===n?(i[e+1]="￿",a[e+1]="G",s[e+1]="￿",o[e+1]="G"):(i[e+1]=n,a[e+1]=n,s[e+1]=n,o[e+1]=n),e++);return{A0_G0:i.join(""),A0_G1:a.join(""),A1_G0:s.join(""),A1_G1:o.join("")}}resolveAnchors(e,t){if(!this.hasAnchor||!this._anchorCache||"string"!=typeof this.source)return this.source;if(e)if(t)return this._anchorCache.A1_G1;else return this._anchorCache.A1_G0;return t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},e_=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new ex(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,r){if(!this._hasAnchors)return this.compile(e);if(t)if(r)return this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,r)),this._anchorCache.A1_G1;else return this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,r)),this._anchorCache.A1_G0;return r?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,r)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,r)),this._anchorCache.A0_G0)}_resolveAnchors(e,t,r){return new ex(e,this._items.map(e=>e.resolveAnchors(t,r)),this._items.map(e=>e.ruleId))}},ex=class{constructor(e,t,r){this.regExps=t,this.rules=r,this.scanner=e.createOnigScanner(t)}scanner;dispose(){"function"==typeof this.scanner.dispose&&this.scanner.dispose()}toString(){let e=[];for(let t=0,r=this.rules.length;t<r;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join("\n")}findNextMatchSync(e,t,r){let n=this.scanner.findNextMatchSync(e,t,r);return n?{ruleId:this.rules[n.index],captureIndices:n.captureIndices}:null}},ev=class{constructor(e,t){this.languageId=e,this.tokenType=t}},ek=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new ev(e,8),this._embeddedLanguagesMatcher=new eC(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return null===t?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new ev(0,0);_getBasicScopeAttributes=new B(e=>new ev(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let r=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!r)return 8;switch(r[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},eC=class{values;scopesRegExp;constructor(e){if(0===e.length)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([e,t])=>j(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};void 0!==L.default&&L.default.env.VSCODE_TEXTMATE_DEBUG;var eS=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function eN(e,t,r,n,i,a,s,o){let l=t.content.length,u=!1,c=-1;if(s){let s=function(e,t,r,n,i,a){let s=i.beginRuleCapturedEOL?0:-1,o=[];for(let t=i;t;t=t.pop()){let r=t.getRule(e);r instanceof eb&&o.push({rule:r,stack:t})}for(let d=o.pop();d;d=o.pop()){var l,u,c,p,h;let{ruleScanner:o,findOptions:f}=(l=d.rule,u=e,c=d.stack.endRule,p=r,h=n===s,{ruleScanner:l.compileWhileAG(u,c,p,h),findOptions:0}),m=o.findNextMatchSync(t,n,f);if(m){if(-2!==m.ruleId){i=d.stack.pop();break}m.captureIndices&&m.captureIndices.length&&(a.produce(d.stack,m.captureIndices[0].start),eI(e,t,r,d.stack,a,d.rule.whileCaptures,m.captureIndices),a.produce(d.stack,m.captureIndices[0].end),s=m.captureIndices[0].end,m.captureIndices[0].end>n&&(n=m.captureIndices[0].end,r=!1))}else{i=d.stack.pop();break}}return{stack:i,linePos:n,anchorPosition:s,isFirstLine:r}}(e,t,r,n,i,a);i=s.stack,n=s.linePos,r=s.isFirstLine,c=s.anchorPosition}let p=Date.now();for(;!u;){if(0!==o&&Date.now()-p>o)return new eS(i,!0);!function(){let s=function(e,t,r,n,i,a){let s=function(e,t,r,n,i,a){let{ruleScanner:s,findOptions:o}=eE(i.getRule(e),e,i.endRule,r,n===a),l=s.findNextMatchSync(t,n,o);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}(e,t,r,n,i,a),o=e.getInjections();if(0===o.length)return s;let l=function(e,t,r,n,i,a,s){let o,l=Number.MAX_VALUE,u=null,c=0,p=a.contentNameScopesList.getScopeNames();for(let a=0,h=e.length;a<h;a++){let h=e[a];if(!h.matcher(p))continue;let{ruleScanner:d,findOptions:f}=eE(t.getRule(h.ruleId),t,null,n,i===s),m=d.findNextMatchSync(r,i,f);if(!m)continue;let g=m.captureIndices[0].start;if(!(g>=l)&&(l=g,u=m.captureIndices,o=m.ruleId,c=h.priority,l===i))break}return u?{priorityMatch:-1===c,captureIndices:u,matchedRuleId:o}:null}(o,e,t,r,n,i,a);if(!l)return s;if(!s)return l;let u=s.captureIndices[0].start,c=l.captureIndices[0].start;return c<u||l.priorityMatch&&c===u?l:s}(e,t,r,n,i,c);if(!s){a.produce(i,l),u=!0;return}let o=s.captureIndices,p=s.matchedRuleId,h=!!o&&o.length>0&&o[0].end>n;if(-1===p){let s=i.getRule(e);a.produce(i,o[0].start),i=i.withContentNameScopesList(i.nameScopesList),eI(e,t,r,i,a,s.endCaptures,o),a.produce(i,o[0].end);let p=i;if(i=i.parent,c=p.getAnchorPos(),!h&&p.getEnterPos()===n){i=p,a.produce(i,l),u=!0;return}}else{let s=e.getRule(p);a.produce(i,o[0].start);let d=i,f=s.getName(t.content,o),m=i.contentNameScopesList.pushAttributed(f,e);if(i=i.push(p,n,c,o[0].end===l,null,m,m),s instanceof ey){eI(e,t,r,i,a,s.beginCaptures,o),a.produce(i,o[0].end),c=o[0].end;let n=s.getContentName(t.content,o),p=m.pushAttributed(n,e);if(i=i.withContentNameScopesList(p),s.endHasBackReferences&&(i=i.withEndRule(s.getEndWithResolvedBackReferences(t.content,o))),!h&&d.hasSameRuleAs(i)){i=i.pop(),a.produce(i,l),u=!0;return}}else if(s instanceof eb){eI(e,t,r,i,a,s.beginCaptures,o),a.produce(i,o[0].end),c=o[0].end;let n=s.getContentName(t.content,o),p=m.pushAttributed(n,e);if(i=i.withContentNameScopesList(p),s.whileHasBackReferences&&(i=i.withEndRule(s.getWhileWithResolvedBackReferences(t.content,o))),!h&&d.hasSameRuleAs(i)){i=i.pop(),a.produce(i,l),u=!0;return}}else if(eI(e,t,r,i,a,s.captures,o),a.produce(i,o[0].end),i=i.pop(),!h){i=i.safePop(),a.produce(i,l),u=!0;return}}o[0].end>n&&(n=o[0].end,r=!1)}()}return new eS(i,!1)}function eE(e,t,r,n,i){return{ruleScanner:e.compileAG(t,r,n,i),findOptions:0}}function eI(e,t,r,n,i,a,s){if(0===a.length)return;let o=t.content,l=Math.min(a.length,s.length),u=[],c=s[0].end;for(let t=0;t<l;t++){let l=a[t];if(null===l)continue;let p=s[t];if(0===p.length)continue;if(p.start>c)break;for(;u.length>0&&u[u.length-1].endPos<=p.start;)i.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?i.produceFromScopes(u[u.length-1].scopes,p.start):i.produce(n,p.start),l.retokenizeCapturedWithRuleId){let t=l.getName(o,s),a=n.contentNameScopesList.pushAttributed(t,e),u=l.getContentName(o,s),c=a.pushAttributed(u,e),h=n.push(l.retokenizeCapturedWithRuleId,p.start,-1,!1,null,a,c),d=e.createOnigString(o.substring(0,p.end));eN(e,d,r&&0===p.start,p.start,h,i,!1,0),J(d);continue}let h=l.getName(o,s);if(null!==h){let t=(u.length>0?u[u.length-1].scopes:n.contentNameScopesList).pushAttributed(h,e);u.push(new eL(t,p.end))}}for(;u.length>0;)i.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var eL=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function eP(e,t,r,n,i){let a=Q(t,eR),s=ew.getCompiledRuleId(r,n,i.repository);for(let r of a)e.push({debugSelector:t,matcher:r.matcher,ruleId:s,grammar:i,priority:r.priority})}function eR(e,t){if(t.length<e.length)return!1;let r=0;return e.every(e=>{for(let n=r;n<t.length;n++)if(function(e,t){if(!e)return!1;if(e===t)return!0;let r=t.length;return e.length>r&&e.substr(0,r)===t&&"."===e[r]}(t[n],e))return r=n+1,!0;return!1})}var e$=class{constructor(e,t,r,n,i,a,s,o){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=o,this._basicScopeAttributesProvider=new ek(r,n),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=s,this._grammar=eT(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(const e of Object.keys(i))for(const t of Q(e,eR))this._tokenTypeMatchers.push({matcher:t.matcher,type:i[e]})}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e=[],t=this._rootScopeName,r=({lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)}).lookup(t);if(r){let n=r.injections;if(n)for(let t in n)eP(e,t,n[t],this,r);let i=this._grammarRepository.injections(t);i&&i.forEach(t=>{let r=this.getExternalGrammar(t);if(r){let t=r.injectionSelector;t&&eP(e,t,r,this,r)}})}return e.sort((e,t)=>e.priority-t.priority),e}getInjections(){return null===this._injections&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,r=e(t);return this._ruleId2desc[t]=r,r}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let r=this._grammarRepository.lookup(e);if(r)return this._includedGrammars[e]=eT(r,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,r=0){let n=this._tokenize(e,t,!1,r);return{tokens:n.lineTokens.getResult(n.ruleStack,n.lineLength),ruleStack:n.ruleStack,stoppedEarly:n.stoppedEarly}}tokenizeLine2(e,t,r=0){let n=this._tokenize(e,t,!0,r);return{tokens:n.lineTokens.getBinaryResult(n.ruleStack,n.lineLength),ruleStack:n.ruleStack,stoppedEarly:n.stoppedEarly}}_tokenize(e,t,r,n){let i;if(-1===this._rootId&&(this._rootId=ew.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==ej.NULL)i=!1,t.reset();else{let e;i=!0;let r=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),a=V.set(0,r.languageId,r.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),s=this.getRule(this._rootId).getName(null,null);e=s?eM.createRootAndLookUpScopeName(s,a,this):eM.createRoot("unknown",a),t=new ej(null,this._rootId,-1,-1,!1,null,e,e)}e+="\n";let a=this.createOnigString(e),s=a.content.length,o=new eO(r,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=eN(this,a,i,0,t,o,!0,n);return J(a),{lineLength:s,lineTokens:o,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function eT(e,t){return(e=function e(t){return Array.isArray(t)?function(t){let r=[];for(let n=0,i=t.length;n<i;n++)r[n]=e(t[n]);return r}(t):t instanceof RegExp?t:"object"==typeof t?function(t){let r={};for(let n in t)r[n]=e(t[n]);return r}(t):t}(e)).repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var eM=class e{constructor(e,t,r){this.parent=e,this.scopePath=t,this.tokenAttributes=r}static fromExtension(t,r){let n=t,i=t?.scopePath??null;for(let t of r)n=new e(n,i=G.push(i,t.scopeNames),t.encodedTokenAttributes);return n}static createRoot(t,r){return new e(null,new G(null,t),r)}static createRootAndLookUpScopeName(t,r,n){let i=n.getMetadataForScope(t),a=new G(null,t),s=n.themeProvider.themeMatch(a),o=e.mergeAttributes(r,i,s);return new e(null,a,o)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(e,t){for(;;){if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}}static mergeAttributes(e,t,r){let n=-1,i=0,a=0;return null!==r&&(n=r.fontStyle,i=r.foregroundId,a=r.backgroundId),V.set(e,t.languageId,t.tokenType,null,n,i,a)}pushAttributed(t,r){if(null===t)return this;if(-1===t.indexOf(" "))return e._pushAttributed(this,t,r);let n=t.split(/ /g),i=this;for(let t of n)i=e._pushAttributed(i,t,r);return i}static _pushAttributed(t,r,n){let i=n.getMetadataForScope(r),a=t.scopePath.push(r),s=n.themeProvider.themeMatch(a),o=e.mergeAttributes(t.tokenAttributes,i,s);return new e(t,a,o)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],r=this;for(;r&&r!==e;)t.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?t.reverse():void 0}},ej=class e{constructor(e,t,r,n,i,a,s,o){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=s,this.contentNameScopesList=o,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=n}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return null!==t&&e._equals(this,t)}static _equals(e,t){return e===t||!!this._structuralEquals(e,t)&&eM.equals(e.contentNameScopesList,t.contentNameScopesList)}static _structuralEquals(e,t){for(;;){if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,r,n,i,a,s,o){return new e(this,t,r,n,i,a,s,o)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,r){let n=eM.fromExtension(t?.nameScopesList??null,r.nameScopesList);return new e(t,r.ruleId,r.enterPos??-1,r.anchorPos??-1,r.beginRuleCapturedEOL,r.endRule,n,eM.fromExtension(n,r.contentNameScopesList))}},eB=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):Q(e,eR).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Q(e,eR).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&0===this.unbalancedBracketScopes.length}get matchesNever(){return 0===this.balancedBracketScopes.length&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},eO=class{constructor(e,t,r,n){this.balancedBracketSelectors=n,this._emitBinaryTokens=e,this._tokenTypeOverrides=r,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let r=e?.tokenAttributes??0,n=!1;if(this.balancedBracketSelectors?.matchesAlways&&(n=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(r=V.set(r,0,e.type,null,-1,0,0));this.balancedBracketSelectors&&(n=this.balancedBracketSelectors.match(t))}if(n&&(r=V.set(r,0,8,n,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=t;return}let r=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:r}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let r=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)r[e]=this._binaryTokens[e];return r}},eG=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,r,n,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,new e$(e,a,t,r,n,i,this,this._onigLib))}return this._grammars.get(e)}},eU=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new eG(O.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(O.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,r){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:r})}loadGrammarWithConfiguration(e,t,r){return this._loadGrammar(e,t,r.embeddedLanguages,r.tokenTypes,new eB(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,r,n,i){let a=new et(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,r,n,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let r="function"==typeof this._options.getInjections?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,r)}}addGrammar(e,t=[],r=0,n=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,r,n)}_grammarForScopeName(e,t=0,r=null,n=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,r,n,i)}},eD=ej.NULL,eF=e.i(577),eW=e.i(61634),eH=e.i(79694);let ez=/["&'<>`]/g,eq=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,eV=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,eQ=/[|\\{}()[\]^$+*?.]/g,eX=new WeakMap,eK=/[\dA-Fa-f]/,eJ=/\d/,eZ=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],eY={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},e0=["cent","copy","divide","gt","lt","not","para","times"],e1={}.hasOwnProperty,e2={};for(t in eY)e1.call(eY,t)&&(e2[eY[t]]=t);let e6=/[^\dA-Za-z]/;function e5(e,t,r){var n,i;let a,s,o=(n=r.omitOptionalSemicolons,a="&#x"+e.toString(16).toUpperCase(),n&&t&&!eK.test(String.fromCharCode(t))?a:a+";");if((r.useNamedReferences||r.useShortestReferences)&&(s=function(e,t,r,n){let i=String.fromCharCode(e);if(e1.call(e2,i)){let e=e2[i],a="&"+e;return r&&eZ.includes(e)&&!e0.includes(e)&&(!n||t&&61!==t&&e6.test(String.fromCharCode(t)))?a:a+";"}return""}(e,t,r.omitOptionalSemicolons,r.attribute)),(r.useShortestReferences||!s)&&r.useShortestReferences){let n,a=(i=r.omitOptionalSemicolons,n="&#"+String(e),i&&t&&!eJ.test(String.fromCharCode(t))?n:n+";");a.length<o.length&&(o=a)}return s&&(!r.useShortestReferences||s.length<o.length)?s:o}function e8(e,t){let r;var n,i=e,a=Object.assign({format:e5},t);if(i=i.replace(a.subset?(n=a.subset,(r=eX.get(n))||(r=function(e){let t=[],r=-1;for(;++r<e.length;)t.push(e[r].replace(eQ,"\\$&"));return RegExp("(?:"+t.join("|")+")","g")}(n),eX.set(n,r)),r):ez,s),a.subset||a.escapeOnly)return i;return i.replace(eq,function(e,t,r){return a.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(t+2),a)}).replace(eV,s);function s(e,t,r){return a.format(e.charCodeAt(0),r.charCodeAt(t+1),a)}}let e3=/^>|^->|<!--|-->|--!>|<!-$/g,e4=[">"],e9=["<",">"];var e7=e.i(70284),te=e.i(16220),tt=e.i(73638),tr=e.i(82772),tn=e.i(58206);let ti=to(1),ta=to(-1),ts=[];function to(e){return function(t,r,n){let i=t?t.children:ts,a=(r||0)+e,s=i[a];if(!n)for(;s&&(0,tn.whitespace)(s);)a+=e,s=i[a];return s}}let tl={}.hasOwnProperty;function tu(e){return function(t,r,n){return tl.call(e,t.tagName)&&e[t.tagName](t,r,n)}}let tc=tu({body:function(e,t,r){let n=ti(r,t);return!n||"comment"!==n.type},caption:tp,colgroup:tp,dd:function(e,t,r){let n=ti(r,t);return!n||"element"===n.type&&("dt"===n.tagName||"dd"===n.tagName)},dt:function(e,t,r){let n=ti(r,t);return!!(n&&"element"===n.type&&("dt"===n.tagName||"dd"===n.tagName))},head:tp,html:function(e,t,r){let n=ti(r,t);return!n||"comment"!==n.type},li:function(e,t,r){let n=ti(r,t);return!n||"element"===n.type&&"li"===n.tagName},optgroup:function(e,t,r){let n=ti(r,t);return!n||"element"===n.type&&"optgroup"===n.tagName},option:function(e,t,r){let n=ti(r,t);return!n||"element"===n.type&&("option"===n.tagName||"optgroup"===n.tagName)},p:function(e,t,r){let n=ti(r,t);return n?"element"===n.type&&("address"===n.tagName||"article"===n.tagName||"aside"===n.tagName||"blockquote"===n.tagName||"details"===n.tagName||"div"===n.tagName||"dl"===n.tagName||"fieldset"===n.tagName||"figcaption"===n.tagName||"figure"===n.tagName||"footer"===n.tagName||"form"===n.tagName||"h1"===n.tagName||"h2"===n.tagName||"h3"===n.tagName||"h4"===n.tagName||"h5"===n.tagName||"h6"===n.tagName||"header"===n.tagName||"hgroup"===n.tagName||"hr"===n.tagName||"main"===n.tagName||"menu"===n.tagName||"nav"===n.tagName||"ol"===n.tagName||"p"===n.tagName||"pre"===n.tagName||"section"===n.tagName||"table"===n.tagName||"ul"===n.tagName):!r||"element"!==r.type||"a"!==r.tagName&&"audio"!==r.tagName&&"del"!==r.tagName&&"ins"!==r.tagName&&"map"!==r.tagName&&"noscript"!==r.tagName&&"video"!==r.tagName},rp:th,rt:th,tbody:function(e,t,r){let n=ti(r,t);return!n||"element"===n.type&&("tbody"===n.tagName||"tfoot"===n.tagName)},td:td,tfoot:function(e,t,r){return!ti(r,t)},th:td,thead:function(e,t,r){let n=ti(r,t);return!!(n&&"element"===n.type&&("tbody"===n.tagName||"tfoot"===n.tagName))},tr:function(e,t,r){let n=ti(r,t);return!n||"element"===n.type&&"tr"===n.tagName}});function tp(e,t,r){let n=ti(r,t,!0);return!n||"comment"!==n.type&&!("text"===n.type&&(0,tn.whitespace)(n.value.charAt(0)))}function th(e,t,r){let n=ti(r,t);return!n||"element"===n.type&&("rp"===n.tagName||"rt"===n.tagName)}function td(e,t,r){let n=ti(r,t);return!n||"element"===n.type&&("td"===n.tagName||"th"===n.tagName)}let tf=tu({body:function(e){let t=ti(e,-1,!0);return!t||"comment"!==t.type&&!("text"===t.type&&(0,tn.whitespace)(t.value.charAt(0)))&&("element"!==t.type||"meta"!==t.tagName&&"link"!==t.tagName&&"script"!==t.tagName&&"style"!==t.tagName&&"template"!==t.tagName)},colgroup:function(e,t,r){let n=ta(r,t),i=ti(e,-1,!0);return!(r&&n&&"element"===n.type&&"colgroup"===n.tagName&&tc(n,r.children.indexOf(n),r))&&!!(i&&"element"===i.type&&"col"===i.tagName)},head:function(e){let t=new Set;for(let r of e.children)if("element"===r.type&&("base"===r.tagName||"title"===r.tagName)){if(t.has(r.tagName))return!1;t.add(r.tagName)}let r=e.children[0];return!r||"element"===r.type},html:function(e){let t=ti(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,r){let n=ta(r,t),i=ti(e,-1);return!(r&&n&&"element"===n.type&&("thead"===n.tagName||"tbody"===n.tagName)&&tc(n,r.children.indexOf(n),r))&&!!(i&&"element"===i.type&&"tr"===i.tagName)}}),tm={name:[[" \n\f\r &/=>".split("")," \n\f\r \"&'/=>`".split("")],["\0 \n\f\r \"&'/<=>".split(""),"\0 \n\f\r \"&'/<=>`".split("")]],unquoted:[[" \n\f\r &>".split(""),"\0 \n\f\r \"&'<=>`".split("")],["\0 \n\f\r \"&'<=>`".split(""),"\0 \n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]},tg=["<","&"];function ty(e,t,r,n){return r&&"element"===r.type&&("script"===r.tagName||"style"===r.tagName)?e.value:e8(e.value,Object.assign({},n.settings.characterReferences,{subset:tg}))}let tb=(0,eH.zwitch)("type",{invalid:function(e){throw Error("Expected node, not `"+e+"`")},unknown:function(e){throw Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,r,n){return n.settings.bogusComments?"<?"+e8(e.value,Object.assign({},n.settings.characterReferences,{subset:e4}))+">":"<!--"+e.value.replace(e3,function(e){return e8(e,Object.assign({},n.settings.characterReferences,{subset:e9}))})+"-->"},doctype:function(e,t,r,n){return"<!"+(n.settings.upperDoctype?"DOCTYPE":"doctype")+(n.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,r,n){let i,a=n.schema,s="svg"!==a.space&&n.settings.omitOptionalTags,o="svg"===a.space?n.settings.closeEmptyElements:n.settings.voids.includes(e.tagName.toLowerCase()),l=[];"html"===a.space&&"svg"===e.tagName&&(n.schema=eW.svg);let u=function(e,t){let r,n=[],i=-1;if(t){for(r in t)if(null!==t[r]&&void 0!==t[r]){let i=function(e,t,r){let n,i=(0,tt.find)(e.schema,t),a=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,s=+!e.settings.allowDangerousCharacters,o=e.quote;if(i.overloadedBoolean&&(r===i.attribute||""===r)?r=!0:(i.boolean||i.overloadedBoolean)&&("string"!=typeof r||r===i.attribute||""===r)&&(r=!!r),null==r||!1===r||"number"==typeof r&&Number.isNaN(r))return"";let l=e8(i.attribute,Object.assign({},e.settings.characterReferences,{subset:tm.name[a][s]}));return!0===r||(r=Array.isArray(r)?(i.commaSeparated?te.stringify:tr.stringify)(r,{padLeft:!e.settings.tightCommaSeparatedLists}):String(r),e.settings.collapseEmptyAttributes&&!r)?l:(e.settings.preferUnquoted&&(n=e8(r,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:tm.unquoted[a][s]}))),n!==r&&(e.settings.quoteSmart&&(0,e7.ccount)(r,o)>(0,e7.ccount)(r,e.alternative)&&(o=e.alternative),n=o+e8(r,Object.assign({},e.settings.characterReferences,{subset:("'"===o?tm.single:tm.double)[a][s],attribute:!0}))+o),l+(n?"="+n:n))}(e,r,t[r]);i&&n.push(i)}}for(;++i<n.length;){let t=e.settings.tightAttributes?n[i].charAt(n[i].length-1):void 0;i!==n.length-1&&'"'!==t&&"'"!==t&&(n[i]+=" ")}return n.join("")}(n,e.properties),c=n.all("html"===a.space&&"template"===e.tagName?e.content:e);return n.schema=a,c&&(o=!1),!u&&s&&tf(e,t,r)||(l.push("<",e.tagName,u?" "+u:""),o&&("svg"===a.space||n.settings.closeSelfClosing)&&(i=u.charAt(u.length-1),(!n.settings.tightSelfClosing||"/"===i||i&&'"'!==i&&"'"!==i)&&l.push(" "),l.push("/")),l.push(">")),l.push(c),o||s&&tc(e,t,r)||l.push("</"+e.tagName+">"),l.join("")},raw:function(e,t,r,n){return n.settings.allowDangerousHtml?e.value:ty(e,t,r,n)},root:function(e,t,r,n){return n.all(e)},text:ty}}),tw={},tA={},t_=[];function tx(e,t,r){return tb(e,t,r,this)}function tv(e){let t=[],r=e&&e.children||t_,n=-1;for(;++n<r.length;)t[n]=this.one(r[n],n,e);return t.join("")}function tk(e,t){let r="string"==typeof e?{}:{...e.colorReplacements},n="string"==typeof e?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))"string"==typeof i?r[e]=i:e===n&&Object.assign(r,i);return r}function tC(e,t){return e&&t?.[e?.toLowerCase()]||e}async function tS(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function tN(e){return!e||["plaintext","txt","text","plain"].includes(e)}function tE(e){return"ansi"===e||tN(e)}function tI(e){return"none"===e}function tL(e,t){if(!t)return e;for(let r of(e.properties||={},e.properties.class||=[],"string"==typeof e.properties.class&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]),Array.isArray(t)?t:t.split(/\s+/g)))r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}function tP(e,t=!1){if(0===e.length)return[["",0]];let r=e.split(/(\r?\n)/g),n=0,i=[];for(let e=0;e<r.length;e+=2){let a=t?r[e]+(r[e+1]||""):r[e];i.push([a,n]),n+=r[e].length,n+=r[e+1]?.length||0}return i}let tR="light-dark()",t$=["color","background-color"];function tT(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&F.Italic&&(t["font-style"]="italic"),e.fontStyle&F.Bold&&(t["font-weight"]="bold");let r=[];e.fontStyle&F.Underline&&r.push("underline"),e.fontStyle&F.Strikethrough&&r.push("line-through"),r.length&&(t["text-decoration"]=r.join(" "))}return t}function tM(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}let tj=new WeakMap;function tB(e,t){tj.set(e,t)}function tO(e){return tj.get(e)}class tG{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,t){return new tG(Object.fromEntries((Array.isArray(t)?t:[t]).map(e=>[e,eD])),e)}constructor(...e){if(2===e.length){const[t,r]=e;this.lang=r,this._stacks=t}else{const[t,r,n]=e;this.lang=r,this._stacks={[n]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){var t;let r,n;return t=this._stacks[e],r=[],n=new Set,!function e(t){if(n.has(t))return;n.add(t);let i=t?.nameScopesList?.scopeName;i&&r.push(i),t.parent&&e(t.parent)}(t),r}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}let tU=[function(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){var r;let n,i=function(e){if("number"==typeof e){if(e<0||e>t.source.length)throw new I(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...a.indexToPos(e),offset:e}}{let t=a.lines[e.line];if(void 0===t)throw new I(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${a.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new I(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:a.posToIndex(e.line,r)}}},a={lines:n=tP(r=t.source,!0).map(([e])=>e),indexToPos:function(e){if(e===r.length)return{line:n.length-1,character:n[n.length-1].length};let t=e,i=0;for(let e of n){if(t<e.length)break;t-=e.length,i++}return{line:i,character:t}},posToIndex:function(e,t){let r=0;for(let t=0;t<e;t++)r+=n[t].length;return r+t}},s=(t.options.decorations||[]).map(e=>({...e,start:i(e.start),end:i(e.end)}));(function(e){for(let t=0;t<e.length;t++){let r=e[t];if(r.start.offset>r.end.offset)throw new I(`Invalid decoration range: ${JSON.stringify(r.start)} - ${JSON.stringify(r.end)}`);for(let n=t+1;n<e.length;n++){let t=e[n],i=r.start.offset<=t.start.offset&&t.start.offset<r.end.offset,a=r.start.offset<t.end.offset&&t.end.offset<=r.end.offset,s=t.start.offset<=r.start.offset&&r.start.offset<t.end.offset,o=t.start.offset<r.end.offset&&r.end.offset<=t.end.offset;if(i||a||s||o){if(i&&a||s&&o||s&&r.start.offset===r.end.offset||a&&t.start.offset===t.end.offset)continue;throw new I(`Decorations ${JSON.stringify(r.start)} and ${JSON.stringify(t.start)} intersect.`)}}}})(s),e.set(t.meta,{decorations:s,converter:a,source:t.source})}return e.get(t.meta)}return{name:"shiki:decorations",tokens(e){let r;if(!this.options.decorations?.length)return;let n=t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]);return(r=Array.from(n instanceof Set?n:new Set(n)).sort((e,t)=>e-t)).length?e.map(e=>e.flatMap(e=>{let t=r.filter(t=>e.offset<t&&t<e.offset+e.content.length).map(t=>t-e.offset).sort((e,t)=>e-t);if(!t.length)return e;let n=0,i=[];for(let r of t)r>n&&i.push({...e,content:e.content.slice(n,r),offset:e.offset+n}),n=r;return n<e.content.length&&i.push({...e,content:e.content.slice(n),offset:e.offset+n}),i})):e},code(e){if(!this.options.decorations?.length)return;let r=t(this),n=Array.from(e.children).filter(e=>"element"===e.type&&"span"===e.tagName);if(n.length!==r.converter.lines.length)throw new I(`Number of lines in code element (${n.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function i(e,t,r,i){let s=n[e],o="",l=-1,u=-1;if(0===t&&(l=0),0===r&&(u=0),r===1/0&&(u=s.children.length),-1===l||-1===u)for(let e=0;e<s.children.length;e++)o+=function e(t){return"text"===t.type?t.value:"element"===t.type?t.children.map(e).join(""):""}(s.children[e]),-1===l&&o.length===t&&(l=e+1),-1===u&&o.length===r&&(u=e+1);if(-1===l)throw new I(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(-1===u)throw new I(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let c=s.children.slice(l,u);if(i.alwaysWrap||c.length!==s.children.length)if(i.alwaysWrap||1!==c.length||"element"!==c[0].type){let e={type:"element",tagName:"span",properties:{},children:c};a(e,i,"wrapper"),s.children.splice(l,c.length,e)}else a(c[0],i,"token");else a(s,i,"line")}function a(e,t,r){let n=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||"span",e.properties={...e.properties,...n,class:e.properties.class},t.properties?.class&&tL(e,t.properties.class),e=i(e,r)||e}let s=[];for(let e of r.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset)){let{start:t,end:r}=e;if(t.line===r.line)i(t.line,t.character,r.character,e);else if(t.line<r.line){i(t.line,t.character,1/0,e);for(let i=t.line+1;i<r.line;i++)s.unshift(()=>{var t;n[t=i]=a(n[t],e,"line")});i(r.line,0,r.character,e)}}s.forEach(e=>e())}}}()];function tD(e){let t=function(e){let t=[],r=[],n=[];for(let i of e)switch(i.enforce){case"pre":t.push(i);break;case"post":r.push(i);break;default:n.push(i)}return{pre:t,post:r,normal:n}}(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...tU]}var tF=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],tW={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function tH(e){let t=e.shift();if("2"===t){let t=e.splice(0,3).map(e=>Number.parseInt(e));if(3!==t.length||t.some(e=>Number.isNaN(e)))return;return{type:"rgb",rgb:t}}if("5"===t){let t=e.shift();if(t)return{type:"table",index:Number(t)}}}var tz={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};let tq={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function tV(e,t,r={}){var n,i;let a,s,{theme:o=e.getLoadedThemes()[0]}=r,l=e.resolveLangAlias(r.lang||"text");if(tN(l)||tI(o))return tP(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:u,colorMap:c}=e.setTheme(o);if("ansi"===l){let e,n,i,a,s,o,l;return e=tk(u,r),n=tP(t),i=function(e=tz){let t;function r(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,"0")).join("")}`}return{value:function(n){switch(n.type){case"named":return e[n.name];case"rgb":return r(n.rgb);case"table":var i;return i=n.index,function(){if(t)return t;t=[];for(let r=0;r<tF.length;r++)t.push(e[tF[r]]);let n=[0,95,135,175,215,255];for(let e=0;e<6;e++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)t.push(r([n[e],n[i],n[a]]));let i=8;for(let e=0;e<24;e++,i+=10)t.push(r([i,i,i]));return t}()[i]}}}}(Object.fromEntries(tF.map(e=>{let t=`terminal.ansi${e[0].toUpperCase()}${e.substring(1)}`;return[e,u.colors?.[t]||tq[e]]}))),a=null,s=null,o=new Set,l={parse(e){let t=[],r=0;do{let n=function(e,t){let r=e.indexOf("\x1b",t);if(-1!==r&&"["===e[r+1]){let t=e.indexOf("m",r);if(-1!==t)return{sequence:e.substring(r+2,t).split(";"),startPosition:r,position:t+1}}return{position:e.length}}(e,r),i=n.sequence?e.substring(r,n.startPosition):e.substring(r);if(i.length>0&&t.push({value:i,foreground:a,background:s,decorations:new Set(o)}),n.sequence){let e=function(e){let t=[];for(;e.length>0;){let r=e.shift();if(!r)continue;let n=Number.parseInt(r);if(!Number.isNaN(n))if(0===n)t.push({type:"resetAll"});else if(n<=9)tW[n]&&t.push({type:"setDecoration",value:tW[n]});else if(n<=29){let e=tW[n-20];e&&(t.push({type:"resetDecoration",value:e}),"dim"===e&&t.push({type:"resetDecoration",value:"bold"}))}else if(n<=37)t.push({type:"setForegroundColor",value:{type:"named",name:tF[n-30]}});else if(38===n){let r=tH(e);r&&t.push({type:"setForegroundColor",value:r})}else if(39===n)t.push({type:"resetForegroundColor"});else if(n<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:tF[n-40]}});else if(48===n){let r=tH(e);r&&t.push({type:"setBackgroundColor",value:r})}else 49===n?t.push({type:"resetBackgroundColor"}):53===n?t.push({type:"setDecoration",value:"overline"}):55===n?t.push({type:"resetDecoration",value:"overline"}):n>=90&&n<=97?t.push({type:"setForegroundColor",value:{type:"named",name:tF[n-90+8]}}):n>=100&&n<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:tF[n-100+8]}})}return t}(n.sequence);for(let t of e)"resetAll"===t.type?(a=null,s=null,o.clear()):"resetForegroundColor"===t.type?a=null:"resetBackgroundColor"===t.type?s=null:"resetDecoration"===t.type&&o.delete(t.value);for(let t of e)"setForegroundColor"===t.type?a=t.value:"setBackgroundColor"===t.type?s=t.value:"setDecoration"===t.type&&o.add(t.value)}r=n.position}while(r<e.length)return t}},n.map(t=>l.parse(t[0]).map(r=>{let n,a;r.decorations.has("reverse")?(n=r.background?i.value(r.background):u.bg,a=r.foreground?i.value(r.foreground):u.fg):(n=r.foreground?i.value(r.foreground):u.fg,a=r.background?i.value(r.background):void 0),n=tC(n,e),a=tC(a,e),r.decorations.has("dim")&&(n=function(e){let t=e.match(/#([0-9a-f]{3,8})/i);if(t){let e=t[1];if(8===e.length){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${e.slice(0,6)}${t}`}if(6===e.length)return`#${e}80`;if(4===e.length){let t=e[0],r=e[1],n=e[2],i=e[3],a=Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,"0");return`#${t}${t}${r}${r}${n}${n}${a}`}else if(3===e.length){let t=e[0],r=e[1],n=e[2];return`#${t}${t}${r}${r}${n}${n}80`}}let r=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return r?`var(${r[1]}-dim)`:e}(n));let s=F.None;return r.decorations.has("bold")&&(s|=F.Bold),r.decorations.has("italic")&&(s|=F.Italic),r.decorations.has("underline")&&(s|=F.Underline),r.decorations.has("strikethrough")&&(s|=F.Strikethrough),{content:r.value,offset:t[1],color:n,bgColor:a,fontStyle:s}}))}let p=e.getLanguage(r.lang||"text");if(r.grammarState){if(r.grammarState.lang!==p.name)throw new I(`Grammar state language "${r.grammarState.lang}" does not match highlight language "${p.name}"`);if(!r.grammarState.themes.includes(u.name))throw new I(`Grammar state themes "${r.grammarState.themes}" do not contain highlight theme "${u.name}"`)}return s=new tG((a=tQ(t,n=p,i=u,c,r)).stateStack,n.name,i.name),tB(a.tokens,s),a.tokens}function tQ(e,t,r,n,i){let a=tk(r,i),{tokenizeMaxLineLength:s=0,tokenizeTimeLimit:o=500}=i,l=tP(e),u=i.grammarState?function(e,t){if(!(e instanceof tG))throw new I("Invalid grammar state");return e.getInternalStack(t)}(i.grammarState,r.name)??eD:null!=i.grammarContextCode?tQ(i.grammarContextCode,t,r,n,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack:eD,c=[],p=[];for(let e=0,h=l.length;e<h;e++){let h,d,[f,m]=l[e];if(""===f){c=[],p.push([]);continue}if(s>0&&f.length>=s){c=[],p.push([{content:f,offset:m,color:"",fontStyle:0}]);continue}i.includeExplanation&&(h=t.tokenizeLine(f,u,o).tokens,d=0);let g=t.tokenizeLine2(f,u,o),y=g.tokens.length/2;for(let e=0;e<y;e++){let t=g.tokens[2*e],s=e+1<y?g.tokens[2*e+2]:f.length;if(t===s)continue;let o=g.tokens[2*e+1],l=tC(n[V.getForeground(o)],a),u=V.getFontStyle(o),p={content:f.substring(t,s),offset:m+t,color:l,fontStyle:u};if(i.includeExplanation){let e=[];if("scopeName"!==i.includeExplanation)for(let t of r.settings){let r;switch(typeof t.scope){case"string":r=t.scope.split(/,/).map(e=>e.trim());break;case"object":r=t.scope;break;default:continue}e.push({settings:t,selectors:r.map(e=>e.split(/ /))})}p.explanation=[];let n=0;for(;t+n<s;){let t=h[d],r=f.substring(t.startIndex,t.endIndex);n+=r.length,p.explanation.push({content:r,scopes:"scopeName"===i.includeExplanation?t.scopes.map(e=>({scopeName:e})):function(e,t){let r=[];for(let n=0,i=t.length;n<i;n++){let i=t[n];r[n]={scopeName:i,themeMatches:function(e,t,r){let n=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(function(e,t,r){if(!tX(e[e.length-1],t))return!1;let n=e.length-2,i=r.length-1;for(;n>=0&&i>=0;)tX(e[n],r[i])&&(n-=1),i-=1;return -1===n}(e,t,r)){n.push(a);break}return n}(e,i,t.slice(0,n))}}return r}(e,t.scopes)}),d+=1}}c.push(p)}p.push(c),c=[],u=g.ruleStack}return{tokens:p,stateStack:u}}function tX(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function tK(e,t,r){let n=Object.entries(r.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),i=n.map(n=>{let i=tV(e,t,{...r,theme:n.theme}),a=tO(i);return{tokens:i,state:a,theme:"string"==typeof n.theme?n.theme:n.theme.name}}),a=function(...e){let t=e.map(()=>[]),r=e.length;for(let n=0;n<e[0].length;n++){let i=e.map(e=>e[n]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let s=i.map(()=>0),o=i.map(e=>e[0]);for(;o.every(e=>e);){let e=Math.min(...o.map(e=>e.content.length));for(let t=0;t<r;t++){let r=o[t];r.content.length===e?(a[t].push(r),s[t]+=1,o[t]=i[t][s[t]]):(a[t].push({...r,content:r.content.slice(0,e)}),o[t]={...r,content:r.content.slice(e),offset:r.offset+e})}}}return t}(...i.map(e=>e.tokens)),s=a[0].map((e,t)=>e.map((e,i)=>{let s={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in r&&r.includeExplanation&&(s.explanation=e.explanation),a.forEach((e,r)=>{let{content:a,explanation:o,offset:l,...u}=e[t][i];s.variants[n[r].color]=u}),s})),o=i[0].state?new tG(Object.fromEntries(i.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),i[0].state.lang):void 0;return o&&tB(s,o),s}function tJ(e,t,r){let n,i,a,s,o,l;if("themes"in r){let{defaultColor:u="light",cssVariablePrefix:c="--shiki-",colorsRendering:p="css-vars"}=r,h=Object.entries(r.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===u?-1:+(t.color===u));if(0===h.length)throw new I("`themes` option must not be empty");let d=tK(e,t,r);if(l=tO(d),u&&tR!==u&&!h.find(e=>e.color===u))throw new I(`\`themes\` option must contain the defaultColor key \`${u}\``);let f=h.map(t=>e.getTheme(t.theme)),m=h.map(e=>e.color);a=d.map(e=>e.map(e=>(function(e,t,r,n,i="css-vars"){let a={content:e.content,explanation:e.explanation,offset:e.offset},s=t.map(t=>tT(e.variants[t])),o=new Set(s.flatMap(e=>Object.keys(e))),l={},u=(e,n)=>{let i="color"===n?"":"background-color"===n?"-bg":`-${n}`;return r+t[e]+("color"===n?"":i)};return s.forEach((e,r)=>{for(let a of o){let o=e[a]||"inherit";if(0===r&&n&&t$.includes(a))if(n===tR&&s.length>1){let e=t.findIndex(e=>"light"===e),n=t.findIndex(e=>"dark"===e);if(-1===e||-1===n)throw new I('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let c=s[e][a]||"inherit",p=s[n][a]||"inherit";l[a]=`light-dark(${c}, ${p})`,"css-vars"===i&&(l[u(r,a)]=o)}else l[a]=o;else"css-vars"===i&&(l[u(r,a)]=o)}}),a.htmlStyle=l,a})(e,m,c,u,p))),l&&tB(a,l);let g=h.map(e=>tk(e.theme,r));i=tZ(h,f,g,c,u,"fg",p),n=tZ(h,f,g,c,u,"bg",p),s=`shiki-themes ${f.map(e=>e.name).join(" ")}`,o=u?void 0:[i,n].join(";")}else if("theme"in r){let o=tk(r.theme,r);a=tV(e,t,r);let u=e.getTheme(r.theme);n=tC(u.bg,o),i=tC(u.fg,o),s=u.name,l=tO(a)}else throw new I("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:n,themeName:s,rootStyle:o,grammarState:l}}function tZ(e,t,r,n,i,a,s){return e.map((o,l)=>{let u=tC(t[l][a],r[l])||"inherit",c=`${n+o.color}${"bg"===a?"-bg":""}:${u}`;if(0===l&&i){if(i===tR&&e.length>1){let n=e.findIndex(e=>"light"===e.color),i=e.findIndex(e=>"dark"===e.color);if(-1===n||-1===i)throw new I('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let s=tC(t[n][a],r[n])||"inherit",o=tC(t[i][a],r[i])||"inherit";return`light-dark(${s}, ${o});${c}`}return u}return"css-vars"===s?c:null}).filter(e=>!!e).join(";")}function tY(e,t,r,n={meta:{},options:r,codeToHast:(t,r)=>tY(e,t,r),codeToTokens:(t,r)=>tJ(e,t,r)}){let i=t;for(let e of tD(r))i=e.preprocess?.call(n,i,r)||i;let{tokens:a,fg:s,bg:o,themeName:l,rootStyle:u,grammarState:c}=tJ(e,i,r),{mergeWhitespaces:p=!0,mergeSameStyleTokens:h=!1}=r;!0===p?a=a.map(e=>{let t,r=[],n="";return e.forEach((i,a)=>{let s=!(i.fontStyle&&(i.fontStyle&F.Underline||i.fontStyle&F.Strikethrough));s&&i.content.match(/^\s+$/)&&e[a+1]?(void 0===t&&(t=i.offset),n+=i.content):n?(s?r.push({...i,offset:t,content:n+i.content}):r.push({content:n,offset:t},i),t=void 0,n=""):r.push(i)}),r}):"never"===p&&(a=a.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;let t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;let[,r,n,i]=t;if(!r&&!i)return e;let a=[{...e,offset:e.offset+r.length,content:n}];return r&&a.unshift({content:r,offset:e.offset}),i&&a.push({content:i,offset:e.offset+r.length+n.length}),a}))),h&&(a=a.map(e=>{let t=[];for(let r of e){if(0===t.length){t.push({...r});continue}let e=t[t.length-1],n=tM(e.htmlStyle||tT(e)),i=tM(r.htmlStyle||tT(r)),a=e.fontStyle&&(e.fontStyle&F.Underline||e.fontStyle&F.Strikethrough),s=r.fontStyle&&(r.fontStyle&F.Underline||r.fontStyle&F.Strikethrough);a||s||n!==i?t.push({...r}):e.content+=r.content}return t}));let d={...n,get source(){return i}};for(let e of tD(r))a=e.tokens?.call(d,a)||a;return function(e,t,r,n=tO(e)){let i=tD(t),a=[],s={type:"root",children:[]},{structure:o="classic",tabindex:l="0"}=t,u={class:`shiki ${t.themeName||""}`};for(let[e,r]of(!1!==t.rootStyle&&(null!=t.rootStyle?u.style=t.rootStyle:u.style=`background-color:${t.bg};color:${t.fg}`),!1!==l&&null!=l&&(u.tabindex=l.toString()),Object.entries(t.meta||{})))e.startsWith("_")||(u[e]=r);let c={type:"element",tagName:"pre",properties:u,children:[],data:t.data},p={type:"element",tagName:"code",properties:{},children:a},h=[],d={...r,structure:o,addClassToHast:tL,get source(){return r.source},get tokens(){return e},get options(){return t},get root(){return s},get pre(){return c},get code(){return p},get lines(){return h}};if(e.forEach((e,t)=>{t&&("inline"===o?s.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===o&&a.push({type:"text",value:"\n"}));let r={type:"element",tagName:"span",properties:{class:"line"},children:[]},n=0;for(let a of e){let e={type:"element",tagName:"span",properties:{...a.htmlAttrs},children:[{type:"text",value:a.content}]},l=tM(a.htmlStyle||tT(a));for(let s of(l&&(e.properties.style=l),i))e=s?.span?.call(d,e,t+1,n,r,a)||e;"inline"===o?s.children.push(e):"classic"===o&&r.children.push(e),n+=a.content.length}if("classic"===o){for(let e of i)r=e?.line?.call(d,r,t+1)||r;h.push(r),a.push(r)}else"inline"===o&&h.push(r)}),"classic"===o){for(let e of i)p=e?.code?.call(d,p)||p;for(let e of(c.children.push(p),i))c=e?.pre?.call(d,c)||c;s.children.push(c)}else if("inline"===o){let e=[],t={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(let r of s.children)"element"===r.type&&"br"===r.tagName?(e.push(t),t={type:"element",tagName:"span",properties:{class:"line"},children:[]}):("element"===r.type||"text"===r.type)&&t.children.push(r);e.push(t);let r={type:"element",tagName:"code",properties:{},children:e};for(let e of i)r=e?.code?.call(d,r)||r;s.children=[];for(let e=0;e<r.children.length;e++){e>0&&s.children.push({type:"element",tagName:"br",properties:{},children:[]});let t=r.children[e];"element"===t.type&&s.children.push(...t.children)}}let f=s;for(let e of i)f=e?.root?.call(d,f)||f;return n&&tB(f,n),f}(a,{...r,fg:s,bg:o,themeName:l,rootStyle:!1!==r.rootStyle&&(r.rootStyle??u)},d,c)}let t0=function(e,t){let r=t||tw,n=r.quote||'"';if('"'!==n&&"'"!==n)throw Error("Invalid quote `"+n+"`, expected `'` or `\"`");return({one:tx,all:tv,settings:{omitOptionalTags:r.omitOptionalTags||!1,allowParseErrors:r.allowParseErrors||!1,allowDangerousCharacters:r.allowDangerousCharacters||!1,quoteSmart:r.quoteSmart||!1,preferUnquoted:r.preferUnquoted||!1,tightAttributes:r.tightAttributes||!1,upperDoctype:r.upperDoctype||!1,tightDoctype:r.tightDoctype||!1,bogusComments:r.bogusComments||!1,tightCommaSeparatedLists:r.tightCommaSeparatedLists||!1,tightSelfClosing:r.tightSelfClosing||!1,collapseEmptyAttributes:r.collapseEmptyAttributes||!1,allowDangerousHtml:r.allowDangerousHtml||!1,voids:r.voids||eF.htmlVoidElements,characterReferences:r.characterReferences||tA,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:"svg"===r.space?eW.svg:eW.html,quote:n,alternative:'"'===n?"'":'"'}).one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)},t1="__shiki_resolved";function t2(e){if(e?.[t1])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:r,fg:n}=t;if(!r||!n){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(n=e.settings.foreground),e?.settings?.background&&(r=e.settings.background),!n&&t?.colors?.["editor.foreground"]&&(n=t.colors["editor.foreground"]),!r&&t?.colors?.["editor.background"]&&(r=t.colors["editor.background"]),n||(n="light"===t.type?"#333333":"#bbbbbb"),r||(r="light"===t.type?"#fffffe":"#1e1e1e"),t.fg=n,t.bg=r}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function s(e){if(a.has(e))return a.get(e);i+=1;let r=`#${i.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${r}`]?s(e):(a.set(e,r),r)}for(let e of(t.settings=t.settings.map(e=>{let r=e.settings?.foreground&&!e.settings.foreground.startsWith("#"),n=e.settings?.background&&!e.settings.background.startsWith("#");if(!r&&!n)return e;let i={...e,settings:{...e.settings}};if(r){let r=s(e.settings.foreground);t.colorReplacements[r]=e.settings.foreground,i.settings.foreground=r}if(n){let r=s(e.settings.background);t.colorReplacements[r]=e.settings.background,i.settings.background=r}return i}),Object.keys(t.colors||{})))if(("editor.foreground"===e||"editor.background"===e||e.startsWith("terminal.ansi"))&&!t.colors[e]?.startsWith("#")){let r=s(t.colors[e]);t.colorReplacements[r]=t.colors[e],t.colors[e]=r}return Object.defineProperty(t,t1,{enumerable:!1,writable:!1,value:!0}),t}async function t6(e){return Array.from(new Set((await Promise.all(e.filter(e=>!tE(e)).map(async e=>await tS(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function t5(e){return(await Promise.all(e.map(async e=>tI(e)?null:t2(await tS(e))))).filter(e=>!!e)}class t8 extends Error{constructor(e){super(e),this.name="ShikiError"}}function t3(e,t){if(!t)return e;if(t[e]){let r=new Set([e]);for(;t[e];){if(e=t[e],r.has(e))throw new t8(`Circular alias \`${Array.from(r).join(" -> ")} -> ${e}\``);r.add(e)}}return e}class t4 extends eU{constructor(e,t,r,n={}){super(e),this._resolver=e,this._themes=t,this._langs=r,this._alias=n,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return"string"==typeof e?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=t2(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=O.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=t3(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let n=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(n.name=e.name,this._resolvedGrammars.set(e.name,n),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=Array.from(this._langGraph.entries()),r=t.filter(([e,t])=>!t);if(r.length){let e=t.filter(([e,t])=>{if(!t)return!1;let n=t.embeddedLanguages||t.embeddedLangs;return n?.some(e=>r.map(([e])=>e).includes(e))}).filter(e=>!r.includes(e));throw new t8(`Missing languages ${r.map(([e])=>`\`${e}\``).join(", ")}, required by ${e.map(([e])=>`\`${e}\``).join(", ")}`)}for(let[e,r]of t)this._resolver.addLanguage(r);for(let[e,r]of t)this.loadLanguage(r)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}}class t9{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split("."),r=[];for(let e=1;e<=t.length;e++){let n=t.slice(0,e).join(".");r=[...r,...this._injections.get(n)||[]]}return r}}let t7=0;async function re(e){e.engine||function(e,t=3){if(!(t>3))if(1)console.trace(`[SHIKI DEPRECATE]: ${e}`);else throw Error(`[SHIKI DEPRECATE]: ${e}`)}("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,r,n]=await Promise.all([t5(e.themes||[]),t6(e.langs||[]),e.engine]);return function(e){let t;t7+=1,!1!==e.warnings&&t7>=10&&t7%10==0&&console.warn(`[Shiki] ${t7} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let r=!1;if(!e.engine)throw new t8("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),i=(e.themes||[]).flat(1).map(t2),a=new t4(new t9(e.engine,n),i,n,e.langAlias);function s(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};u();let t=a.getTheme(e);if(!t)throw new t8(`Theme \`${e}\` not found, you may need to load it first`);return t}function o(...e){u(),a.loadLanguages(e.flat(1))}function l(...e){for(let t of(u(),e.flat(1)))a.loadTheme(t)}function u(){if(r)throw new t8("Shiki instance has been disposed")}function c(){r||(r=!0,a.dispose(),t7-=1)}return{setTheme:function(e){u();let r=s(e);return t!==e&&(a.setTheme(r),t=e),{theme:r,colorMap:a.getColorMap()}},getTheme:s,getLanguage:function(e){u();let t=a.getGrammar("string"==typeof e?e:e.name);if(!t)throw new t8(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return u(),a.getLoadedThemes()},getLoadedLanguages:function(){return u(),a.getLoadedLanguages()},resolveLangAlias:function(t){return t3(t,e.langAlias)},loadLanguage:async function(...e){return o(await t6(e))},loadLanguageSync:o,loadTheme:async function(...e){return u(),l(await t5(e))},loadThemeSync:l,dispose:c,[Symbol.dispose]:c}}({...e,themes:t,langs:r,engine:n})}async function rt(e){let t=await re(e);return{getLastGrammarState:(...e)=>(function(...e){if(2===e.length)return tO(e[1]);let[t,r,n={}]=e,{lang:i="text",theme:a=t.getLoadedThemes()[0]}=n;if(tN(i)||tI(a))throw new I("Plain language does not have grammar state");if("ansi"===i)throw new I("ANSI language does not have grammar state");let{theme:s,colorMap:o}=t.setTheme(a),l=t.getLanguage(i);return new tG(tQ(r,l,s,o,n).stateStack,l.name,s.name)})(t,...e),codeToTokensBase:(e,r)=>tV(t,e,r),codeToTokensWithThemes:(e,r)=>tK(t,e,r),codeToTokens:(e,r)=>tJ(t,e,r),codeToHast:(e,r)=>tY(t,e,r),codeToHtml:(e,r)=>(function(e,t,r){let n={meta:{},options:r,codeToHast:(t,r)=>tY(e,t,r),codeToTokens:(t,r)=>tJ(e,t,r)},i=t0(tY(e,t,r,n));for(let e of tD(r))i=e.postprocess?.call(n,i,r)||i;return i})(t,e,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}let rr=Object.fromEntries([{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>e.A(71233)},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>e.A(69905)},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>e.A(21579)},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:()=>e.A(17347)},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:()=>e.A(79579)},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>e.A(17235)},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>e.A(82774)},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>e.A(52161)},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>e.A(10803)},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>e.A(60897)},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>e.A(88958)},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>e.A(24347)},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>e.A(39415)},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>e.A(12625)},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>e.A(88984)},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>e.A(99547)},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>e.A(26878)},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>e.A(97301)},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>e.A(4877)},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>e.A(36193)},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>e.A(40608)},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>e.A(96394)},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>e.A(21243)},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>e.A(10707)},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>e.A(17644)},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>e.A(5583)},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>e.A(17669)},{id:"horizon",displayName:"Horizon",type:"dark",import:()=>e.A(63824)},{id:"horizon-bright",displayName:"Horizon Bright",type:"dark",import:()=>e.A(86278)},{id:"houston",displayName:"Houston",type:"dark",import:()=>e.A(27289)},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>e.A(88348)},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>e.A(44132)},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>e.A(14230)},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>e.A(71202)},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>e.A(25402)},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>e.A(14117)},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>e.A(90077)},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>e.A(32896)},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>e.A(26230)},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>e.A(16100)},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>e.A(47952)},{id:"min-light",displayName:"Min Light",type:"light",import:()=>e.A(28043)},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>e.A(17390)},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>e.A(67165)},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:()=>e.A(34685)},{id:"nord",displayName:"Nord",type:"dark",import:()=>e.A(87e3)},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>e.A(93697)},{id:"one-light",displayName:"One Light",type:"light",import:()=>e.A(52159)},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>e.A(71284)},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>e.A(1663)},{id:"red",displayName:"Red",type:"dark",import:()=>e.A(20216)},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>e.A(55440)},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>e.A(78800)},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>e.A(23257)},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>e.A(55807)},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>e.A(95487)},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>e.A(36490)},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>e.A(48663)},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>e.A(15839)},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>e.A(35719)},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>e.A(39152)},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>e.A(2271)},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>e.A(13655)},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>e.A(61619)},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>e.A(55196)}].map(e=>[e.id,e.import]));var rn=e.i(20688);class ri extends Error{constructor(e){super(e),this.name="ShikiError"}}function ra(){return"u">typeof performance?performance.now():Date.now()}let rs=(e,t)=>e+(t-e%t)%t;async function ro(e){let t,r,n={};function i(e){r=e,n.HEAPU8=new Uint8Array(e),n.HEAPU32=new Uint32Array(e)}let a="u">typeof TextDecoder?new TextDecoder("utf8"):void 0;function s(e,t){return e?function(e,t,r=1024){let n=t+r,i=t;for(;e[i]&&!(i>=n);)++i;if(i-t>16&&e.buffer&&a)return a.decode(e.subarray(t,i));let s="";for(;t<i;){let r=e[t++];if(!(128&r)){s+=String.fromCharCode(r);continue}let n=63&e[t++];if((224&r)==192){s+=String.fromCharCode((31&r)<<6|n);continue}let i=63&e[t++];if((r=(240&r)==224?(15&r)<<12|n<<6|i:(7&r)<<18|n<<12|i<<6|63&e[t++])<65536)s+=String.fromCharCode(r);else{let e=r-65536;s+=String.fromCharCode(55296|e>>10,56320|1023&e)}}return s}(n.HEAPU8,e,t):""}let o={emscripten_get_now:ra,emscripten_memcpy_big:function(e,t,r){n.HEAPU8.copyWithin(e,t,t+r)},emscripten_resize_heap:function(e){let a=n.HEAPU8.length;if((e>>>=0)>0x80000000)return!1;for(let n=1;n<=4;n*=2){let s=a*(1+.2/n);if(s=Math.min(s,e+0x6000000),function(e){try{return t.grow(e-r.byteLength+65535>>>16),i(t.buffer),1}catch{}}(Math.min(0x80000000,rs(Math.max(e,s),65536))))return!0}return!1},fd_write:()=>0};async function l(){let r=await e({env:o,wasi_snapshot_preview1:o});i((t=r.memory).buffer),Object.assign(n,r),n.UTF8ToString=s}return await l(),n}var rl=Object.defineProperty,ru=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?rl(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r};let rc=null;class rp{constructor(e){ru(this,"utf16Length"),ru(this,"utf8Length"),ru(this,"utf16Value"),ru(this,"utf8Value"),ru(this,"utf16OffsetToUtf8"),ru(this,"utf8OffsetToUtf16");const t=e.length,r=rp._utf8ByteLength(e),n=r!==t,i=n?new Uint32Array(t+1):null;n&&(i[t]=r);const a=n?new Uint32Array(r+1):null;n&&(a[r]=t);const s=new Uint8Array(r);let o=0;for(let r=0;r<t;r++){const l=e.charCodeAt(r);let u=l,c=!1;if(l>=55296&&l<=56319&&r+1<t){const t=e.charCodeAt(r+1);t>=56320&&t<=57343&&(u=(l-55296<<10)+65536|t-56320,c=!0)}n&&(i[r]=o,c&&(i[r+1]=o),u<=127?a[o+0]=r:u<=2047?(a[o+0]=r,a[o+1]=r):u<=65535?(a[o+0]=r,a[o+1]=r,a[o+2]=r):(a[o+0]=r,a[o+1]=r,a[o+2]=r,a[o+3]=r)),u<=127?s[o++]=u:(u<=2047?s[o++]=192|(1984&u)>>>6:(u<=65535?s[o++]=224|(61440&u)>>>12:(s[o++]=240|(1835008&u)>>>18,s[o++]=128|(258048&u)>>>12),s[o++]=128|(4032&u)>>>6),s[o++]=128|(63&u)>>>0),c&&r++}this.utf16Length=t,this.utf8Length=r,this.utf16Value=e,this.utf8Value=s,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=a}static _utf8ByteLength(e){let t=0;for(let r=0,n=e.length;r<n;r++){let i=e.charCodeAt(r),a=i,s=!1;if(i>=55296&&i<=56319&&r+1<n){let t=e.charCodeAt(r+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,s=!0)}a<=127?t+=1:a<=2047?t+=2:a<=65535?t+=3:t+=4,s&&r++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}}let rh=class e{constructor(t){if(ru(this,"id",++e.LAST_ID),ru(this,"_onigBinding"),ru(this,"content"),ru(this,"utf16Length"),ru(this,"utf8Length"),ru(this,"utf16OffsetToUtf8"),ru(this,"utf8OffsetToUtf16"),ru(this,"ptr"),!rc)throw new ri("Must invoke loadWasm first.");this._onigBinding=rc,this.content=t;const r=new rp(t);this.utf16Length=r.utf16Length,this.utf8Length=r.utf8Length,this.utf16OffsetToUtf8=r.utf16OffsetToUtf8,this.utf8OffsetToUtf16=r.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||(e._sharedPtr=rc.omalloc(1e4)),e._sharedPtrInUse=!0,rc.HEAPU8.set(r.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=r.createString(rc)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};ru(rh,"LAST_ID",0),ru(rh,"_sharedPtr",0),ru(rh,"_sharedPtrInUse",!1);class rd{constructor(e){if(ru(this,"_onigBinding"),ru(this,"_ptr"),!rc)throw new ri("Must invoke loadWasm first.");const t=[],r=[];for(let n=0,i=e.length;n<i;n++){const i=new rp(e[n]);t[n]=i.createString(rc),r[n]=i.utf8Length}const n=rc.omalloc(4*e.length);rc.HEAPU32.set(t,n/4);const i=rc.omalloc(4*e.length);rc.HEAPU32.set(r,i/4);const a=rc.createOnigScanner(n,i,e.length);for(let r=0,n=e.length;r<n;r++)rc.ofree(t[r]);rc.ofree(i),rc.ofree(n),0===a&&function(e){throw new ri(e.UTF8ToString(e.getLastOnigError()))}(rc),this._onigBinding=rc,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,r){let n=0;if("number"==typeof r&&(n=r),"string"==typeof e){e=new rh(e);let r=this._findNextMatchSync(e,t,!1,n);return e.dispose(),r}return this._findNextMatchSync(e,t,!1,n)}_findNextMatchSync(e,t,r,n){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),n);if(0===a)return null;let s=i.HEAPU32,o=a/4,l=s[o++],u=s[o++],c=[];for(let t=0;t<u;t++){let r=e.convertUtf8OffsetToUtf16(s[o++]),n=e.convertUtf8OffsetToUtf16(s[o++]);c[t]={start:r,end:n,length:n-r}}return{index:l,captureIndices:c}}}function rf(e){return t=>WebAssembly.instantiate(e,t)}async function rm(e){return e&&await (r||(r=async function(){rc=await ro(async t=>{let r=e;if("function"==typeof(r=await r)&&(r=await r(t)),"function"==typeof r&&(r=await r(t)),"function"==typeof r.instantiator)r=await r.instantiator(t);else if("function"==typeof r.default)r=await r.default(t);else{var n,i,a,s;if(void 0!==r.data&&(r=r.data),n=r,"u">typeof Response&&n instanceof Response){r="function"==typeof WebAssembly.instantiateStreaming?await (a=r,e=>WebAssembly.instantiateStreaming(a,e))(t):await (s=r,async e=>{let t=await s.arrayBuffer();return WebAssembly.instantiate(t,e)})(t)}else(i=r,"u">typeof ArrayBuffer&&(i instanceof ArrayBuffer||ArrayBuffer.isView(i))||void 0!==rn.Buffer&&rn.Buffer.isBuffer?.(i)||"u">typeof SharedArrayBuffer&&i instanceof SharedArrayBuffer||"u">typeof Uint32Array&&i instanceof Uint32Array||r instanceof WebAssembly.Module)?r=await rf(r)(t):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await rf(r.default)(t))}return"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}())),{createScanner:e=>new rd(e.map(e=>"string"==typeof e?e:e.source)),createString:e=>new rh(e)}}let rg=(n=(l={langs:E,themes:rr,engine:()=>rm(e.A(62631))}).langs,i=l.themes,a=l.engine,async function(e){function t(t){if("string"==typeof t){if(tE(t=e.langAlias?.[t]||t))return[];let r=n[t];if(!r)throw new I(`Language \`${t}\` is not included in this bundle. You may want to load it from external source.`);return r}return t}function r(e){if(tI(e))return"none";if("string"==typeof e){let t=i[e];if(!t)throw new I(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let s=(e.themes??[]).map(e=>r(e)),o=(e.langs??[]).map(e=>t(e)),l=await rt({engine:e.engine??a(),...e,themes:s,langs:o});return{...l,loadLanguage:(...e)=>l.loadLanguage(...e.map(t)),loadTheme:(...e)=>l.loadTheme(...e.map(r)),getBundledLanguages:()=>n,getBundledThemes:()=>i}});function ry(e){if(1!=[...e].length)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}let rb=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),rw=String.raw;function rA(e,t){if(null==e)throw Error(t??"Value expected");return e}let r_=rw`\[\^?`,rx=`c.? | C(?:-.?)?|${rw`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${rw`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${rw`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${rw`o\{[^\}]*\}?`}|${rw`\d{1,3}`}`,rv=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,rk=RegExp(rw`
2
- \\ (?:
3
- ${rx}
4
- | [gk]<[^>]*>?
5
- | [gk]'[^']*'?
6
- | .
7
- )
8
- | \( (?:
9
- \? (?:
10
- [:=!>({]
11
- | <[=!]
12
- | <[^>]*>
13
- | '[^']*'
14
- | ~\|?
15
- | #(?:[^)\\]|\\.?)*
16
- | [^:)]*[:)]
17
- )?
18
- | \*[^\)]*\)?
19
- )?
20
- | (?:${rv.source})+
21
- | ${r_}
22
- | .
23
- `.replace(/\s+/g,""),"gsu"),rC=RegExp(rw`
24
- \\ (?:
25
- ${rx}
26
- | .
27
- )
28
- | \[:(?:\^?\p{Alpha}+|\^):\]
29
- | ${r_}
30
- | &&
31
- | .
32
- `.replace(/\s+/g,""),"gsu");function rS(e,{inCharClass:t}){let r=e[1];if("c"===r||"C"===r){var n,i=e;let t="c"===i[1]?i[2]:i[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${i}"`);return rI(ry(t.toUpperCase())-64,i)}if("dDhHsSwW".includes(r)){let t;return rP({d:"digit",h:"hex",s:"space",w:"word"}[t=(n=e)[1].toLowerCase()],n,{negate:n[1]!==t})}if(e.startsWith(rw`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(3===e.length)throw Error(`Incomplete or invalid Unicode property "${e}"`);return function(e){let{p:t,neg:r,value:n}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return rP("property",e,{value:n,negate:"P"===t&&!r||"p"===t&&!!r})}(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),r=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),n=new TextEncoder;return[...r].map(e=>{let t=[...n.encode(e)].map(e=>`\\x${e.toString(16)}`).join("");return rI(ry(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if("u"===r||"x"===r)return rI(function(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);return parseInt("{"===e[2]?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2),16)}(e),e);if(rM.has(r))return rI(rM.get(r),e);if(/\d/.test(r))return{type:"EscapedNumber",inCharClass:t,raw:e};if("\\"===e)throw Error(rw`Incomplete escape "\"`);if("M"===r)throw Error(`Unsupported meta "${e}"`);if(2==[...e].length)return rI(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function rN(e,t){return{type:"Assertion",kind:e,raw:t}}function rE(e){return{type:"Backreference",raw:e}}function rI(e,t){return{type:"Character",value:e,raw:t}}function rL(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function rP(e,t,r={}){return{type:"CharacterSet",kind:e,...r,raw:t}}function rR(e,t,r={}){return"keep"===e?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:rA(r.flags),raw:t}}function r$(e,t,r={}){return{type:"GroupOpen",kind:e,...r,raw:t}}let rT=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),rM=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function rj(e){let t=null,r,n;if("{"===e[0]){let{minStr:i,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups;if(+i>1e5||a&&+a>1e5)throw Error("Quantifier value unsupported in Oniguruma");if((r=+i)>(n=void 0===a?+i:""===a?1/0:+a)&&(t="possessive",[r,n]=[n,r]),e.endsWith("?")){if("possessive"===t)throw Error('Unsupported possessive interval quantifier chain with "?"');t="lazy"}else t||(t="greedy")}else r=+("+"===e[0]),n="?"===e[0]?1:1/0,t="+"===e[1]?"possessive":"?"===e[1]?"lazy":"greedy";return{type:"Quantifier",kind:t,min:r,max:n,raw:e}}function rB(e){let t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function rO(e,t){if(!Array.isArray(e.body))throw Error("Expected node with body array");if(1!==e.body.length)return!1;let r=e.body[0];return!t||Object.keys(t).every(e=>t[e]===r[e])}let rG=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function rU(e,t={}){var r;let n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},i=function(e,t={}){let r={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if("string"!=typeof e)throw Error("String expected as pattern");let n=function(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let r=0;r<e.length;r++){let n=e[r];if(!"imxDPSWy".includes(n))throw Error(`Invalid flag "${n}"`);if("y"===n){if(!/^y{[gw]}/.test(e.slice(r)))throw Error('Invalid or unspecified flag "y" mode');t.textSegmentMode="g"===e[r+2]?"grapheme":"word",r+=3;continue}t[({i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"})[n]]=!0}return t}(r.flags),i=[n.extended],a={captureGroup:r.rules.captureGroup,getCurrentModX:()=>i.at(-1),numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:r.rules.singleline},s=[],o;for(rk.lastIndex=0;o=rk.exec(e);){let t=function(e,t,r,n){let[i,a]=r;if("["===r||"[^"===r){let e=function(e,t,r){let n=[rL("^"===t[1],t)],i=1,a;for(rC.lastIndex=r;a=rC.exec(e);){let e=a[0];if("["===e[0]&&":"!==e[1])i++,n.push(rL("^"===e[1],e));else if("]"===e){if("CharacterClassOpen"===n.at(-1).type)n.push(rI(93,e));else if(i--,n.push({type:"CharacterClassClose",raw:e}),!i)break}else{let t=function(e){if("\\"===e[0])return rS(e,{inCharClass:!0});if("["===e[0]){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!rb.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return rP("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return"-"===e?{type:"CharacterClassHyphen",raw:e}:"&&"===e?{type:"CharacterClassIntersector",raw:e}:rI(ry(e),e)}(e);Array.isArray(t)?n.push(...t):n.push(t)}}return{tokens:n,lastIndex:rC.lastIndex||e.length}}(t,r,n);return{tokens:e.tokens,lastIndex:e.lastIndex}}if("\\"===i){if("AbBGyYzZ".includes(a))return{token:rN(r,r)};if(/^\\g[<']/.test(r)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(r))throw Error(`Invalid group name "${r}"`);return{token:{type:"Subroutine",raw:r}}}if(/^\\k[<']/.test(r)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(r))throw Error(`Invalid group name "${r}"`);return{token:rE(r)}}if("K"===a)return{token:rR("keep",r)};if("N"===a||"R"===a)return{token:rP("newline",r,{negate:"N"===a})};if("O"===a)return{token:rP("any",r)};if("X"===a)return{token:rP("text_segment",r)};let e=rS(r,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if("("===i){if("*"===a)return{token:function(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:r,tag:n,args:i}=t.groups;if(!r)throw Error(`Invalid named callout "${e}"`);if(""===n)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(",").filter(e=>""!==e).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[s,o,l]=a,u=rT.has(r)?r.toLowerCase():"custom";switch(u){case"fail":case"mismatch":case"skip":if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case"error":if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if("string"==typeof s)throw Error(`Named callout argument must be a number "${s}"`);break;case"max":if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if("string"==typeof s&&!/^[A-Za-z_]\w*$/.test(s))throw Error(`Named callout argument one must be a tag or number "${s}"`);if(2===a.length&&("number"==typeof o||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${o}"`);break;case"count":case"total_count":if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(1===a.length&&("number"==typeof s||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${s}"`);break;case"cmp":if(3!==a.length)throw Error(`Named callout must have three arguments "${a}"`);if("string"==typeof s&&!/^[A-Za-z_]\w*$/.test(s))throw Error(`Named callout argument one must be a tag or number "${s}"`);if("number"==typeof o||!/^(?:[<>!=]=|[<>])$/.test(o))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${o}"`);if("string"==typeof l&&!/^[A-Za-z_]\w*$/.test(l))throw Error(`Named callout argument three must be a tag or number "${l}"`);break;case"custom":throw Error(`Undefined callout name "${r}"`);default:throw Error(`Unexpected named callout kind "${u}"`)}return{type:"NamedCallout",kind:u,tag:n??null,arguments:i?.split(",")??null,raw:e}}(r)};if("(?{"===r)throw Error(`Unsupported callout "${r}"`);if(r.startsWith("(?#")){if(")"!==t[n])throw Error('Unclosed comment group "(?#"');return{lastIndex:n+1}}if(/^\(\?[-imx]+[:)]$/.test(r))return{token:function(e,t){let{on:r,off:n}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;n??="";let i=(t.getCurrentModX()||r.includes("x"))&&!n.includes("x"),a=rB(r),s=rB(n),o={};if(a&&(o.enable=a),s&&(o.disable=s),e.endsWith(")"))return t.replaceCurrentModX(i),rR("flags",e,{flags:o});if(e.endsWith(":"))return t.pushModX(i),t.numOpenGroups++,r$("group",e,{...(a||s)&&{flags:o}});throw Error(`Unexpected flag modifier "${e}"`)}(r,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,"("===r&&!e.captureGroup||"(?:"===r)return{token:r$("group",r)};if("(?>"===r)return{token:r$("atomic",r)};if("(?="===r||"(?!"===r||"(?<="===r||"(?<!"===r)return{token:r$("<"===r[2]?"lookbehind":"lookahead",r,{negate:r.endsWith("!")})};if("("===r&&e.captureGroup||r.startsWith("(?<")&&r.endsWith(">")||r.startsWith("(?'")&&r.endsWith("'"))return{token:r$("capturing",r,{..."("!==r&&{name:r.slice(3,-1)}})};if(r.startsWith("(?~")){if("(?~|"===r)throw Error(`Unsupported absence function kind "${r}"`);return{token:r$("absence_repeater",r)}}throw"(?("===r?Error(`Unsupported conditional "${r}"`):Error(`Invalid or unsupported group option "${r}"`)}if(")"===r){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error('Unmatched ")"');return{token:{type:"GroupClose",raw:r}}}if(e.getCurrentModX()){if("#"===r){let e=t.indexOf(`
33
- `,n);return{lastIndex:-1===e?t.length:e}}if(/^\s$/.test(r)){let e=/\s+/y;return e.lastIndex=n,{lastIndex:e.exec(t)?e.lastIndex:n}}}return"."===r?{token:rP("dot",r)}:"^"===r||"$"===r?{token:rN(e.singleline?({"^":rw`\A`,$:rw`\Z`})[r]:r,r)}:"|"===r?{token:{type:"Alternator",raw:r}}:rv.test(r)?{tokens:function(e){let t,r=[],n=RegExp(rv,"gy");for(;t=n.exec(e);){let e=t[0];if("{"===e[0]){let t=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(t){let{min:i,max:a}=t.groups;if(+i>+a&&e.endsWith("?")){n.lastIndex--,r.push(rj(e.slice(0,-1)));continue}}}r.push(rj(e))}return r}(r)}:{token:rI(ry(r),r)}}(a,e,o[0],rk.lastIndex);t.tokens?s.push(...t.tokens):t.token&&s.push(t.token),void 0!==t.lastIndex&&(rk.lastIndex=t.lastIndex)}let l=[],u=0;s.filter(e=>"GroupOpen"===e.type).forEach(e=>{"capturing"===e.kind?e.number=++u:"("===e.raw&&l.push(e)}),u||l.forEach((e,t)=>{e.kind="capturing",e.number=t+1});let c=u||l.length;return{tokens:s.map(e=>"EscapedNumber"===e.type?function(e,t){let{raw:r,inCharClass:n}=e,i=r.slice(1);if(!n&&("0"!==i&&1===i.length||"0"!==i[0]&&+i<=t))return[rE(r)];let a=[],s=i.match(/^[0-7]+|\d/g);for(let e=0;e<s.length;e++){let t,n=s[e];if(0===e&&"8"!==n&&"9"!==n){if((t=parseInt(n,8))>127)throw Error(rw`Octal encoded byte above 177 unsupported "${r}"`)}else t=ry(n);a.push(rI(t,(0===e?"\\":"")+n))}return a}(e,c):e).flat(),flags:n}}(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),a=(e,t)=>{let r=i.tokens[s.nextIndex];switch(s.parent=e,s.nextIndex++,r.type){case"Alternator":return rD();case"Assertion":return function({kind:e}){return rF(rA({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===rw`\B`||e===rw`\Y`})}(r);case"Backreference":return function({raw:e},t){let r=/^\\k[<']/.test(e),n=r?e.slice(3,-1):e.slice(1),i=(r,n=!1)=>{let i=t.capturingGroups.length,a=!1;if(r>i)if(t.skipBackrefValidation)a=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,rW(n?i+1-r:r,{orphan:a})};if(r){let r=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(n);if(r)return i(+r.groups.num,!!r.groups.sign);if(/[-+]/.test(n))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(n))throw Error(`Group name not defined to the left "${e}"`);return rW(n)}return i(+n)}(r,s);case"Character":return rz(r.value,{useLastValid:!!t.isCheckingRangeEnd});case"CharacterClassHyphen":return function(e,t){let{tokens:r,walk:n}=e,i=e.parent,a=i.body.at(-1),s=r[e.nextIndex];if(!t.isCheckingRangeEnd&&a&&"CharacterClass"!==a.type&&"CharacterClassRange"!==a.type&&s&&"CharacterClassOpen"!==s.type&&"CharacterClassClose"!==s.type&&"CharacterClassIntersector"!==s.type){let e=n(i,{...t,isCheckingRangeEnd:!0});if("Character"===a.type&&"Character"===e.type)return i.body.pop(),function(e,t){if(t.value<e.value)throw Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}(a,e);throw Error("Invalid character class range")}return rz(ry("-"))}(s,t);case"CharacterClassOpen":return function({negate:e},t,r){let{tokens:n,walk:i}=t,a=[rq()],s=n[t.nextIndex],o=r5(s);for(;"CharacterClassClose"!==o.type;){if("CharacterClassIntersector"===o.type)a.push(rq()),t.nextIndex++;else{let e=a.at(-1);e.body.push(i(e,r))}o=r5(n[t.nextIndex],s)}let l=rq({negate:e});return 1===a.length?l.body=a[0].body:(l.kind="intersection",l.body=a.map(e=>1===e.body.length?e.body[0]:e)),t.nextIndex++,l}(r,s,t);case"CharacterSet":return function({kind:e,negate:t,value:r},n){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:s}=n;if("property"===e){let n=r6(r);if(!rb.has(n)||s?.has(n))return rZ(r,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:s});e="posix",r=n}return"posix"===e?function(e,t){let r=!!t?.negate;if(!rb.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:r}}(r,{negate:t}):rV(e,{negate:t})}(r,s);case"Directive":return function(e,t={}){if("keep"===e)return{type:"Directive",kind:e};if("flags"===e)return{type:"Directive",kind:e,flags:rA(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}(r.kind,{flags:r.flags});case"GroupOpen":return function(e,t,r){var n,i;let{tokens:a,capturingGroups:s,namedGroupsByName:o,skipLookbehindValidation:l,walk:u}=t,c=function({flags:e,kind:t,name:r,negate:n,number:i}){switch(t){case"absence_repeater":var a="repeater";!1;return{type:"AbsenceFunction",kind:a,body:rY(void 0)};case"atomic":return rQ({atomic:!0});case"capturing":return rH(i,{name:r});case"group":return rQ({flags:e});case"lookahead":case"lookbehind":return rX({behind:"lookbehind"===t,negate:n});default:throw Error(`Unexpected group kind "${t}"`)}}(e),p="AbsenceFunction"===c.type,h=r2(c),d=h&&c.negate;if("CapturingGroup"===c.type&&(s.push(c),c.name&&(n=c.name,i=[],o.has(n)||o.set(n,i),o.get(n)).push(c)),p&&r.isInAbsenceFunction)throw Error("Nested absence function not supported by Oniguruma");let f=r8(a[t.nextIndex]);for(;"GroupClose"!==f.type;){if("Alternator"===f.type)c.body.push(rD()),t.nextIndex++;else{let e=c.body.at(-1),t=u(e,{...r,isInAbsenceFunction:r.isInAbsenceFunction||p,isInLookbehind:r.isInLookbehind||h,isInNegLookbehind:r.isInNegLookbehind||d});if(e.body.push(t),(h||r.isInLookbehind)&&!l){let e="Lookbehind includes a pattern not allowed by Oniguruma";if(d||r.isInNegLookbehind){if(r1(t)||"CapturingGroup"===t.type)throw Error(e)}else if(r1(t)||r2(t)&&t.negate)throw Error(e)}}f=r8(a[t.nextIndex])}return t.nextIndex++,c}(r,s,t);case"NamedCallout":var n,a;return n=r.kind,a=r.tag,{type:"NamedCallout",kind:n,tag:a,arguments:r.arguments};case"Quantifier":return function({kind:e,min:t,max:r},n){let i=n.parent,a=i.body.at(-1);if(!a||!rG.has(a.type))throw Error("Quantifier requires a repeatable token");let s=rK(e,t,r,a);return i.body.pop(),s}(r,s);case"Subroutine":return function({raw:e},t){let{capturingGroups:r,subroutines:n}=t,i=e.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(a){let e=+a.groups.num,n=r.length;if(t.hasNumberedRef=!0,(i=({"":e,"+":n+e,"-":n+1-e})[a.groups.sign])<1)throw Error("Invalid subroutine number")}else"0"===i&&(i=0);let s=rJ(i);return n.push(s),s}(r,s);default:throw Error(`Unexpected token type "${r.type}"`)}},s={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:i.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:a},o=(r={type:"Flags",...i.flags},{type:"Regex",body:rY(void 0),flags:r}),l=o.body[0];for(;s.nextIndex<i.tokens.length;){let e=a(l,{});"Alternative"===e.type?(o.body.push(e),l=e):l.body.push(e)}let{capturingGroups:u,hasNumberedRef:c,namedGroupsByName:p,subroutines:h}=s;if(c&&p.size&&!n.rules.captureGroup)throw Error("Numbered backref/subroutine not allowed when using named capture");for(let{ref:e}of h)if("number"==typeof e){if(e>u.length)throw Error("Subroutine uses a group number that's not defined");e&&(u[e-1].isSubroutined=!0)}else if(p.has(e)){if(p.get(e).length>1)throw Error(rw`Subroutine uses a duplicate group name "\g<${e}>"`);p.get(e)[0].isSubroutined=!0}else throw Error(rw`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function rD(e){return{type:"Alternative",body:r0(e?.body)}}function rF(e,t){let r={type:"Assertion",kind:e};return("word_boundary"===e||"text_segment_boundary"===e)&&(r.negate=!!t?.negate),r}function rW(e,t){let r=!!t?.orphan;return{type:"Backreference",ref:e,...r&&{orphan:r}}}function rH(e,t){var r;let n={name:void 0,isSubroutined:!1,...t};if(void 0!==n.name&&(r=n.name,!/^[\p{Alpha}\p{Pc}][^)]*$/u.test(r)))throw Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:rY(t?.body)}}function rz(e,t){let r={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(r.useLastValid)e=1114111;else throw e>1310719?Error(`Invalid code point out of range "\\x{${t}}"`):Error(`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:"Character",value:e}}function rq(e){let t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:r0(e?.body)}}function rV(e,t){let r=!!t?.negate,n={type:"CharacterSet",kind:e};return("digit"===e||"hex"===e||"newline"===e||"space"===e||"word"===e)&&(n.negate=r),"text_segment"!==e&&("newline"!==e||r)||(n.variableLength=!0),n}function rQ(e){let t=e?.atomic,r=e?.flags;if(t&&r)throw Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...r&&{flags:r},body:rY(e?.body)}}function rX(e){let t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:rY(e?.body)}}function rK(e,t,r,n){if(t>r)throw Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:r,body:n}}function rJ(e){return{type:"Subroutine",ref:e}}function rZ(e,t){let r={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},n=r.unicodePropertyMap?.get(r6(e));if(!n){if(r.normalizeUnknownPropertyNames)n=e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase());else if(r.unicodePropertyMap&&!r.skipPropertyNameValidation)throw Error(rw`Invalid Unicode property "\p{${e}}"`)}return{type:"CharacterSet",kind:"property",value:n??e,negate:r.negate}}function rY(e){if(void 0===e)e=[rD()];else if(!Array.isArray(e)||!e.length||!e.every(e=>"Alternative"===e.type))throw Error("Invalid body; expected array of one or more Alternative nodes");return e}function r0(e){if(void 0===e)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error("Invalid body; expected array of nodes");return e}function r1(e){return"LookaroundAssertion"===e.type&&"lookahead"===e.kind}function r2(e){return"LookaroundAssertion"===e.type&&"lookbehind"===e.kind}function r6(e){return e.replace(/[- _]+/g,"").toLowerCase()}function r5(e,t){return rA(e,`Unclosed character class${t?.type==="Character"&&93===t.value&&"]"===t.raw?' (started with "]")':""}`)}function r8(e){return rA(e,"Unclosed group")}function r3(e,t,r=null){function n(e,t){for(let r=0;r<e.length;r++){let n=i(e[r],t,r,e);r=Math.max(-1,r+n)}}function i(a,s=null,o=null,l=null){let u=0,c=!1,p={node:a,parent:s,key:o,container:l,root:e,remove(){r4(l).splice(Math.max(0,r9(o)+u),1),u--,c=!0},removeAllNextSiblings:()=>r4(l).splice(r9(o)+1),removeAllPrevSiblings(){let e=r9(o)+u;return u-=e,r4(l).splice(0,Math.max(0,e))},replaceWith(e,t={}){let r=!!t.traverse;l?l[Math.max(0,r9(o)+u)]=e:rA(s,"Can't replace root node")[o]=e,r&&i(e,s,o,l),c=!0},replaceWithMultiple(e,t={}){let r=!!t.traverse;if(r4(l).splice(Math.max(0,r9(o)+u),1,...e),u+=e.length-1,r){let t=0;for(let r=0;r<e.length;r++)t+=i(e[r],s,r9(o)+r+t,l)}c=!0},skip(){c=!0}},{type:h}=a,d=t["*"],f=t[h],m="function"==typeof d?d:d?.enter,g="function"==typeof f?f:f?.enter;if(m?.(p,r),g?.(p,r),!c)switch(h){case"AbsenceFunction":case"Alternative":case"CapturingGroup":case"CharacterClass":case"Group":case"LookaroundAssertion":n(a.body,a);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":i(a.min,a,"min"),i(a.max,a,"max");break;case"Quantifier":i(a.body,a,"body");break;case"Regex":n(a.body,a),i(a.flags,a,"flags");break;default:throw Error(`Unexpected node type "${h}"`)}return f?.exit?.(p,r),d?.exit?.(p,r),u}return i(e),e}function r4(e){if(!Array.isArray(e))throw Error("Container expected");return e}function r9(e){if("number"!=typeof e)throw Error("Numeric key expected");return e}let r7=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`,ne=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function nt(e,t,r,n){let i=RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),a=[!1],s=0,o="";for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;if(!i&&(!n||n===ne.DEFAULT==!s)){r instanceof Function?o+=r(t,{context:s?ne.CHAR_CLASS:ne.DEFAULT,negated:a[a.length-1]}):o+=r;continue}"["===e[0]?(s++,a.push("^"===e[1])):"]"===e&&s&&(s--,a.pop()),o+=e}return o}function nr(e,t,r){return!!function(e,t,r=0,n){let i;if(!RegExp(t,"su").test(e))return null;let a=RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");a.lastIndex=r;let s=0;for(;i=a.exec(e);){let{0:e,groups:{$skip:t}}=i;if(!t&&(!n||n===ne.DEFAULT==!s))return i;"["===e?s++:"]"===e&&s&&s--,a.lastIndex==i.index&&a.lastIndex++}return null}(e,t,0,r)}let nn=RegExp(String.raw`(?<noncapturingStart>${r7})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu"),ni=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,na=RegExp(String.raw`
34
- \\(?: \d+
35
- | c[A-Za-z]
36
- | [gk]<[^>]+>
37
- | [pPu]\{[^\}]+\}
38
- | u[A-Fa-f\d]{4}
39
- | x[A-Fa-f\d]{2}
40
- )
41
- | \((?: \? (?: [:=!>]
42
- | <(?:[=!]|[^>]+>)
43
- | [A-Za-z\-]+:
44
- | \(DEFINE\)
45
- ))?
46
- | (?<qBase>${ni})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
47
- | \\?.
48
- `.replace(/\s+/g,""),"gsu"),ns=String.raw,no=ns`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,nl=ns`\(\?R=(?<rDepth>[^\)]+)\)|${no}`,nu=ns`\(\?<(?![=!])(?<captureName>[^>]+)>`,nc=ns`${nu}|(?<unnamed>\()(?!\?)`,np=RegExp(ns`${nu}|${nl}|\(\?|\\?.`,"gsu"),nh="Cannot use multiple overlapping recursions";function nd(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e*=1)<2||e>100)throw Error(t)}function nf(e,t,r,n,i,a,s){let o=new Set;n&&nt(e+t,nu,({groups:{captureName:e}})=>{o.add(e)},ne.DEFAULT);let l=[r,n?o:null,i,a,s];return`${e}${nm(`(?:${e}`,"forward",...l)}(?:)${nm(`${t})`,"backward",...l)}${t}`}function nm(e,t,r,n,i,a,s){let o=e=>"forward"===t?e+2:r-e+2-1,l="";for(let t=0;t<r;t++){let r=o(t);l+=nt(e,ns`${nc}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:o,backref:l}})=>{if(l&&n&&!n.has(l))return e;let u=`_$${r}`;if(o||t){let r=s+a.length+1;return a.push(r),function(e,t){for(let r=0;r<e.length;r++)e[r]>=t&&e[r]++}(i,r),o?e:`(?<${t}${u}>`}return ns`\k<${l}${u}>`},ne.DEFAULT)}return l}function ng(e,t,r,n,i,a){if(e.size&&n){let s=0;nt(t,nc,()=>s++,ne.DEFAULT);let o=a-s+i,l=new Map;return e.forEach((e,t)=>{let i=(n-s*r)/r,a=s*r,u=t>o+s?t+n:t,c=[];for(let t of e)if(t<=o)c.push(t);else if(t>o+s+i)c.push(t+n);else if(t<=o+s)for(let e=0;e<=r;e++)c.push(t+s*e);else for(let e=0;e<=r;e++)c.push(t+a+i*e);l.set(u,c)}),l}return e}var ny=String.fromCodePoint,nb=String.raw,nw={},nA=globalThis.RegExp;function n_(e,{enable:t,disable:r}){return{dotAll:!r?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!r?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function nx(e,t,r){return e.has(t)||e.set(t,r),e.get(t)}nw.flagGroups=(()=>{try{new nA("(?i:)")}catch{return!1}return!0})(),nw.unicodeSets=(()=>{try{new nA("[[]]","v")}catch{return!1}return!0})(),nw.bugFlagVLiteralHyphenIsRange=!!nw.unicodeSets&&(()=>{try{new nA(nb`[\d\-a]`,"v")}catch{return!0}return!1})(),nw.bugNestedClassIgnoresNegation=nw.unicodeSets&&new nA("[[^a]]","v").test("a");var nv={ES2025:2025,ES2024:2024,ES2018:2018},nk={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function nC(e={}){if("[object Object]"!==({}).toString.call(e))throw Error("Unexpected options");if(void 0!==e.target&&!nk[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return"auto"===t.target&&(t.target=nw.flagGroups?"ES2025":nw.unicodeSets?"ES2024":"ES2018"),t}var nS=new Set([ny(304),ny(305)]),nN=nb`[\p{L}\p{M}\p{N}\p{Pc}]`;function nE(e){if(nS.has(e))return[e];let t=new Set,r=e.toLowerCase(),n=r.toUpperCase(),i=nR.get(r),a=nL.get(r),s=nP.get(r);return 1==[...n].length&&t.add(n),s&&t.add(s),i&&t.add(i),t.add(r),a&&t.add(a),[...t]}var nI=new Map(`C Other
49
- Cc Control cntrl
50
- Cf Format
51
- Cn Unassigned
52
- Co Private_Use
53
- Cs Surrogate
54
- L Letter
55
- LC Cased_Letter
56
- Ll Lowercase_Letter
57
- Lm Modifier_Letter
58
- Lo Other_Letter
59
- Lt Titlecase_Letter
60
- Lu Uppercase_Letter
61
- M Mark Combining_Mark
62
- Mc Spacing_Mark
63
- Me Enclosing_Mark
64
- Mn Nonspacing_Mark
65
- N Number
66
- Nd Decimal_Number digit
67
- Nl Letter_Number
68
- No Other_Number
69
- P Punctuation punct
70
- Pc Connector_Punctuation
71
- Pd Dash_Punctuation
72
- Pe Close_Punctuation
73
- Pf Final_Punctuation
74
- Pi Initial_Punctuation
75
- Po Other_Punctuation
76
- Ps Open_Punctuation
77
- S Symbol
78
- Sc Currency_Symbol
79
- Sk Modifier_Symbol
80
- Sm Math_Symbol
81
- So Other_Symbol
82
- Z Separator
83
- Zl Line_Separator
84
- Zp Paragraph_Separator
85
- Zs Space_Separator
86
- ASCII
87
- ASCII_Hex_Digit AHex
88
- Alphabetic Alpha
89
- Any
90
- Assigned
91
- Bidi_Control Bidi_C
92
- Bidi_Mirrored Bidi_M
93
- Case_Ignorable CI
94
- Cased
95
- Changes_When_Casefolded CWCF
96
- Changes_When_Casemapped CWCM
97
- Changes_When_Lowercased CWL
98
- Changes_When_NFKC_Casefolded CWKCF
99
- Changes_When_Titlecased CWT
100
- Changes_When_Uppercased CWU
101
- Dash
102
- Default_Ignorable_Code_Point DI
103
- Deprecated Dep
104
- Diacritic Dia
105
- Emoji
106
- Emoji_Component EComp
107
- Emoji_Modifier EMod
108
- Emoji_Modifier_Base EBase
109
- Emoji_Presentation EPres
110
- Extended_Pictographic ExtPict
111
- Extender Ext
112
- Grapheme_Base Gr_Base
113
- Grapheme_Extend Gr_Ext
114
- Hex_Digit Hex
115
- IDS_Binary_Operator IDSB
116
- IDS_Trinary_Operator IDST
117
- ID_Continue IDC
118
- ID_Start IDS
119
- Ideographic Ideo
120
- Join_Control Join_C
121
- Logical_Order_Exception LOE
122
- Lowercase Lower
123
- Math
124
- Noncharacter_Code_Point NChar
125
- Pattern_Syntax Pat_Syn
126
- Pattern_White_Space Pat_WS
127
- Quotation_Mark QMark
128
- Radical
129
- Regional_Indicator RI
130
- Sentence_Terminal STerm
131
- Soft_Dotted SD
132
- Terminal_Punctuation Term
133
- Unified_Ideograph UIdeo
134
- Uppercase Upper
135
- Variation_Selector VS
136
- White_Space space
137
- XID_Continue XIDC
138
- XID_Start XIDS`.split(/\s/).map(e=>[r6(e),e])),nL=new Map([["s",ny(383)],[ny(383),"s"]]),nP=new Map([[ny(223),ny(7838)],[ny(107),ny(8490)],[ny(229),ny(8491)],[ny(969),ny(8486)]]),nR=new Map([nT(453),nT(456),nT(459),nT(498),...nM(8072,8079),...nM(8088,8095),...nM(8104,8111),nT(8124),nT(8140),nT(8188)]),n$=new Map([["alnum",nb`[\p{Alpha}\p{Nd}]`],["alpha",nb`\p{Alpha}`],["ascii",nb`\p{ASCII}`],["blank",nb`[\p{Zs}\t]`],["cntrl",nb`\p{Cc}`],["digit",nb`\p{Nd}`],["graph",nb`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",nb`\p{Lower}`],["print",nb`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",nb`[\p{P}\p{S}]`],["space",nb`\p{space}`],["upper",nb`\p{Upper}`],["word",nb`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",nb`\p{AHex}`]]);function nT(e){let t=ny(e);return[t.toLowerCase(),t]}function nM(e,t){return(function(e,t){let r=[];for(let n=e;n<=t;n++)r.push(n);return r})(e,t).map(e=>nT(e))}var nj=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]),nB={AbsenceFunction({node:e,parent:t,replaceWith:r}){let{body:n,kind:i}=e;if("repeater"===i){let e=rQ();e.body[0].body.push(rX({negate:!0,body:n}),rZ("Any"));let i=rQ();i.body[0].body.push(rK("greedy",0,1/0,e)),r(nX(i,t),{traverse:!0})}else throw Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:t,key:r},{flagDirectivesByAlt:n}){let i=e.body.filter(e=>"flags"===e.kind);for(let e=r+1;e<t.body.length;e++)nx(n,t.body[e],[]).push(...i)},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let r=nW(t.get(e));if(r){let t=rQ({flags:r});t.body[0].body=e.body,e.body=[nX(t,e)]}}}},Assertion({node:e,parent:t,key:r,container:n,root:i,remove:a,replaceWith:s},o){let{kind:l,negate:u}=e,{asciiWordBoundaries:c,avoidSubclass:p,supportedGNodes:h,wordIsAscii:d}=o;if("text_segment_boundary"===l)throw Error(`Unsupported text segment boundary "\\${u?"Y":"y"}"`);if("line_end"===l)s(nX(rX({body:[rD({body:[rF("string_end")]}),rD({body:[rz(10)]})]}),t));else if("line_start"===l)s(nX(nq(nb`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if("search_start"===l)if(h.has(e))i.flags.sticky=!0,a();else{var f;let e,i=n[r-1];if(i&&((e=["Character","CharacterClass","CharacterSet"]).includes((f=i).type)||"Quantifier"===f.type&&f.min&&e.includes(f.body.type)))s(nX(rX({negate:!0}),t));else if(p)throw Error(nb`Uses "\G" in a way that requires a subclass`);else s(nQ(rF("string_start"),t)),o.strategy="clip_search"}else if("string_end"===l||"string_start"===l);else if("string_end_newline"===l)s(nX(nq(nb`(?=\n?\z)`),t));else if("word_boundary"===l){if(!d&&!c){let e=`(?:(?<=${nN})(?!${nN})|(?<!${nN})(?=${nN}))`,r=`(?:(?<=${nN})(?=${nN})|(?<!${nN})(?!${nN}))`;s(nX(nq(u?r:e),t))}}else throw Error(`Unexpected assertion kind "${l}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:r}=e;"string"!=typeof r||nz(r)||(e.ref=r=nF(r,t))},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:r}){let{name:n}=e;n&&!nz(n)&&(e.name=n=nF(n,t)),r.set(e.number,e),n&&r.set(n,e)},CharacterClassRange({node:e,parent:t,replaceWith:r}){"intersection"===t.kind&&r(nX(rq({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:r},{accuracy:n,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:s,wordIsAscii:o}){let{kind:l,negate:u,value:c}=e;if(a&&("digit"===l||"digit"===c))return void r(nQ(rV("digit",{negate:u}),t));if(s&&("space"===l||"space"===c))return void r(nX(nV(nq("[ -\r ]"),u),t));if(o&&("word"===l||"word"===c))return void r(nQ(rV("word",{negate:u}),t));if("any"===l)r(nQ(rZ("Any"),t));else if("digit"===l)r(nQ(rZ("Nd",{negate:u}),t));else if("dot"===l);else if("text_segment"===l){if("strict"===n)throw Error(nb`Use of "\X" requires non-strict accuracy`);let e="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",a=nb`\p{RI}{2}|${e}(?:\u200D${e})*`;r(nX(nq(nb`(?>\r\n|${i?nb`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if("hex"===l)r(nQ(rZ("AHex",{negate:u}),t));else if("newline"===l)r(nX(nq(u?"[^\n]":"(?>\r\n?|[\n\v\f…\u2028\u2029])"),t));else if("posix"===l)if(i||"graph"!==c&&"print"!==c)r(nX(nV(nq(n$.get(c)),u),t));else{if("strict"===n)throw Error(`POSIX class "${c}" requires min target ES2024 or non-strict accuracy`);let e={graph:"!-~",print:" -~"}[c];u&&(e=`\0-${ny(e.codePointAt(0)-1)}${ny(e.codePointAt(2)+1)}-\u{10FFFF}`),r(nX(nq(`[${e}]`),t))}else if("property"===l)nI.has(r6(c))||(e.key="sc");else if("space"===l)r(nQ(rZ("space",{negate:u}),t));else if("word"===l)r(nX(nV(nq(nN),u),t));else throw Error(`Unexpected character set kind "${l}"`)},Directive({node:e,parent:t,root:r,remove:n,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:s}){let{kind:o,flags:l}=e;if("flags"===o)if(l.enable||l.disable){let e=rQ({flags:l});e.body[0].body=s(),i(nX(e,t),{traverse:!0})}else n();else if("keep"===o){let e=r.body[0],n=1===r.body.length&&rO(e,{type:"Group"})&&1===e.body[0].body.length?e.body[0]:r;if(t.parent!==n||n.body.length>1)throw Error(nb`Uses "\K" in a way that's unsupported`);let s=rX({behind:!0});s.body[0].body=a(),i(nX(s,t))}else throw Error(`Unexpected directive kind "${o}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error('Unsupported flag "P"');if("word"===e.textSegmentMode)throw Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:r}=e.flags;t?.extended&&delete t.extended,r?.extended&&delete r.extended,t?.dotAll&&r?.dotAll&&delete t.dotAll,t?.ignoreCase&&r?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,r&&!Object.keys(r).length&&delete e.flags.disable,e.flags.enable||e.flags.disable||delete e.flags},LookaroundAssertion({node:e},t){let{kind:r}=e;"lookbehind"===r&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:r}){let{kind:n}=e;if("fail"===n)r(nX(rX({negate:!0}),t));else throw Error(`Unsupported named callout "(*${n.toUpperCase()}"`)},Quantifier({node:e}){if("Quantifier"===e.body.type){let t=rQ();t.body[0].body.push(e.body),e.body=nX(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let r=[],n=!1,i=!1;for(let t of e.body)if(1===t.body.length&&"search_start"===t.body[0].kind)t.body.pop();else{let e=function e(t){let r=t.find(e=>"search_start"===e.kind||function(e,t){let r={negate:null,...t};return"LookaroundAssertion"===e.type&&(null===r.negate||e.negate===r.negate)&&1===e.body.length&&rO(e.body[0],{type:"Assertion",kind:"search_start"})}(e,{negate:!1})||!function({type:e}){return"Assertion"===e||"Directive"===e||"LookaroundAssertion"===e}(e));if(!r)return null;if("search_start"===r.kind)return r;if("LookaroundAssertion"===r.type)return r.body[0].body[0];if("CapturingGroup"===r.type||"Group"===r.type){let t=[];for(let n of r.body){let r=e(n.body);if(!r)return null;Array.isArray(r)?t.push(...r):t.push(r)}return t}return null}(t.body);e?(n=!0,Array.isArray(e)?r.push(...e):r.push(e)):i=!0}n&&!i&&r.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:r,strategy:n}){if("strict"===t&&r&&n)throw Error(nb`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:r}=e;"string"!=typeof r||nz(r)||(e.ref=r=nF(r,t))}},nO={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:r}){let{orphan:n,ref:i}=e;n||r.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:r,skip:n},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:s,openRefs:o,reffedNodesByReferencer:l}){let u=i.get(e);if(u&&o.has(e.number)){let n=nQ(nD(e.number),t);l.set(n,o.get(e.number)),r(n);return}o.set(e.number,e),s.set(e.number,[]),e.name&&nx(s,e.name,[]);let c=s.get(e.name??e.number);for(let t=0;t<c.length;t++){let r=c[t];if(u===r.node||u&&u===r.origin||e===r.origin){c.splice(t,1);break}}if(s.get(e.number).push({node:e,origin:u}),e.name&&s.get(e.name).push({node:e,origin:u}),e.name){let t=nx(a,e.name,new Map),r=!1;if(u)r=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){r=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:r})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=n_(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:r},n){let{isRecursive:i,ref:a}=e;if(i){let r=t;for(;(r=r.parent)&&("CapturingGroup"!==r.type||r.name!==a&&r.number!==a););n.reffedNodesByReferencer.set(e,r);return}let s=n.subroutineRefMap.get(a),o=0===a,l=o?nD(0):function e(t,r,n,i){let a=Array.isArray(t)?[]:{};for(let[s,o]of Object.entries(t))"parent"===s?a.parent=Array.isArray(n)?i:n:o&&"object"==typeof o?a[s]=e(o,r,a,n):("type"===s&&"CapturingGroup"===o&&r.set(a,r.get(t)??t),a[s]=o);return a}(s,n.groupOriginByCopy,null),u=l;if(!o){var c,p;let e=nW(function(e,t){let r=[];for(;e=e.parent;)(!t||t(e))&&r.push(e);return r}(s,e=>"Group"===e.type&&!!e.flags)),t=e?n_(n.globalFlags,e):n.globalFlags;c=t,p=n.currentFlags,(c.dotAll!==p.dotAll||c.ignoreCase!==p.ignoreCase)&&(u=rQ({flags:function({dotAll:e,ignoreCase:t}){let r={};return(e||t)&&(r.enable={},e&&(r.enable.dotAll=!0),t&&(r.enable.ignoreCase=!0)),e&&t||(r.disable={},e||(r.disable.dotAll=!0),t||(r.disable.ignoreCase=!0)),r}(t)})).body[0].body.push(l)}r(nX(u,t),{traverse:!o})}},nG={Backreference({node:e,parent:t,replaceWith:r},n){if(e.orphan){n.highestOrphanBackref=Math.max(n.highestOrphanBackref,e.ref);return}let i=n.reffedNodesByReferencer.get(e).filter(t=>(function(e,t){let r=t;do{if("Regex"===r.type)return!1;if("Alternative"===r.type)continue;if(r===e)return!1;for(let t of nH(r.parent)){if(t===r)break;if(t===e||function e(t,r){for(let n of nH(t)??[])if(n===r||e(n,r))return!0;return!1}(t,e))return!0}}while(r=r.parent)throw Error("Unexpected path")})(t,e));i.length?i.length>1?r(nX(rQ({atomic:!0,body:i.reverse().map(e=>rD({body:[rW(e.number)]}))}),t)):e.ref=i[0].number:r(nX(rX({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let r=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<r;t++){let t=rH();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&0!==e.ref&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function nU(e){r3(e,{"*"({node:e,parent:t}){e.parent=t}})}function nD(e){let t=rJ(e);return t.isRecursive=!0,t}function nF(e,t){if(t.has(e))return t.get(e);let r=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,r),r}function nW(e){let t=["dotAll","ignoreCase"],r={enable:{},disable:{}};return(e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete r.disable[t],r.enable[t]=!0),e.disable?.[t]&&(r.disable[t]=!0)})}),Object.keys(r.enable).length||delete r.enable,Object.keys(r.disable).length||delete r.disable,r.enable||r.disable)?r:null}function nH(e){if(!e)throw Error("Node expected");let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function nz(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function nq(e,t){let r=rU(e,{...t,unicodePropertyMap:nI}).body;return r.length>1||r[0].body.length>1?rQ({body:r}):r[0].body[0]}function nV(e,t){return e.negate=t,e}function nQ(e,t){return e.parent=t,e}function nX(e,t){return nU(e),e.parent=t,e}var nK={"*":{enter({node:e},t){if(n3(e)){let r=t.getCurrentModI();t.pushModI(e.flags?n_({ignoreCase:r},e.flags).ignoreCase:r)}},exit({node:e},t){n3(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){n6(ny(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},r){t(),n5(e,{firstOnly:!0}).length&&r.setHasCasedChar()},CharacterSet({node:e},t){"property"===e.kind&&nj.has(e.value)&&t.setHasCasedChar()}},nJ={Alternative:({body:e},t,r)=>e.map(r).join(""),Assertion({kind:e,negate:t}){if("string_end"===e)return"$";if("string_start"===e)return"^";if("word_boundary"===e)return t?nb`\B`:nb`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if("number"!=typeof e)throw Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&"strict"===t.accuracy&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,r){let{body:n,name:i,number:a}=e,s={ignoreCase:t.currentFlags.ignoreCase},o=t.originMap.get(e);return o&&(s.hidden=!0,a>o.number&&(s.transferTo=o.number)),t.captureMap.set(a,s),`(${i?`?<${i}>`:""}${n.map(r).join("|")})`},Character({value:e},t){let r=ny(e),n=n8(e,{escDigit:"Backreference"===t.lastNode.type,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(n!==r)return n;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&n6(r)){let e=nE(r);return t.inCharClass?e.join(""):e.length>1?`[${e.join("")}]`:e[0]}return r},CharacterClass(e,t,r){let{kind:n,negate:i,parent:a}=e,{body:s}=e;if("intersection"===n&&!t.useFlagV)throw Error("Use of character class intersection requires min target ES2024");nw.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&s.some(n4)&&(s=[rz(45),...s.filter(e=>!n4(e))]);let o=()=>`[${i?"^":""}${s.map(r).join("intersection"===n?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||nw.bugNestedClassIgnoresNegation)&&!i){let t=s.filter(e=>"CharacterClass"===e.type&&"union"===e.kind&&e.negate);if(t.length){let n=rQ(),i=n.body[0];return n.parent=a,i.parent=n,e.body=s=s.filter(e=>!t.includes(e)),s.length?(e.parent=i,i.body.push(e)):n.body.pop(),t.forEach(e=>{let t=rD({body:[e]});e.parent=t,t.parent=n,n.body.push(t)}),r(n)}}t.inCharClass=!0;let n=o();return t.inCharClass=!1,n}let l=s[0];if("union"===n&&!i&&l&&((!t.useFlagV||!t.verbose)&&"union"===a.kind&&!(nw.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&"intersection"===a.kind&&1===s.length&&"CharacterClassRange"!==l.type))return s.map(r).join("");if(!t.useFlagV&&"CharacterClass"===a.type)throw Error("Uses nested character class in a way that requires min target ES2024");return o()},CharacterClassRange(e,t){let r=e.min.value,n=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=n8(r,i),s=n8(n,i),o=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&(function(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),r=[],n=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?n??=t[e]:null===n?r.push(t[e]):(r.push([n,t[e]]),n=null);return r})(n5(e)).forEach(e=>{o.add(Array.isArray(e)?`${n8(e[0],i)}-${n8(e[1],i)}`:n8(e,i))}),`${a}-${s}${[...o].join("")}`},CharacterSet({kind:e,negate:t,value:r,key:n},i){if("dot"===e)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?".":"[^]":nb`[^\n]`;if("digit"===e)return t?nb`\D`:nb`\d`;if("property"===e){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&nj.has(r))throw Error(`Unicode property "${r}" can't be case-insensitive when other chars have specific case`);return`${t?nb`\P`:nb`\p`}{${n?`${n}=`:""}${r}}`}if("word"===e)return t?nb`\W`:nb`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags:(e,t)=>(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":""),Group({atomic:e,body:t,flags:r,parent:n},i,a){let s=i.currentFlags;r&&(i.currentFlags=n_(s,r));let o=t.map(a).join("|"),l=i.verbose||1!==t.length||"Quantifier"===n.type||e||i.useFlagMods&&r?`(?${function(e,t,r){if(e)return">";let n="";if(t&&r){let{enable:e,disable:r}=t;n=(e?.ignoreCase?"i":"")+(e?.dotAll?"s":"")+(r?"-":"")+(r?.ignoreCase?"i":"")+(r?.dotAll?"s":"")}return`${n}:`}(e,r,i.useFlagMods)}${o})`:o;return i.currentFlags=s,l},LookaroundAssertion({body:e,kind:t,negate:r},n,i){let a=`${"lookahead"===t?"":"<"}${r?"!":"="}`;return`(?${a}${e.map(i).join("|")})`},Quantifier:(e,t,r)=>r(e.body)+function({kind:e,max:t,min:r}){return(r||1!==t?r||t!==1/0?1===r&&t===1/0?"+":r===t?`{${r}}`:`{${r},${t===1/0?"":t}}`:"*":"?")+({greedy:"",lazy:"?",possessive:"+"})[e]}(e),Subroutine({isRecursive:e,ref:t},r){if(!e)throw Error("Unexpected non-recursive subroutine in transformed AST");let n=r.recursionLimit;return 0===t?`(?R=${n})`:nb`\g<${t}&R=${n}>`}},nZ=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),nY=new Set(["-","\\","]","^","["]),n0=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),n1=new Map([[9,nb`\t`],[10,nb`\n`],[11,nb`\v`],[12,nb`\f`],[13,nb`\r`],[8232,nb`\u2028`],[8233,nb`\u2029`],[65279,nb`\uFEFF`]]),n2=/^\p{Cased}$/u;function n6(e){return n2.test(e)}function n5(e,t){let r=!!t?.firstOnly,n=e.min.value,i=e.max.value,a=[];if(n<65&&(65535===i||i>=131071)||65536===n&&i>=131071)return a;for(let e=n;e<=i;e++){let t=ny(e);if(!n6(t))continue;let s=nE(t).filter(e=>{let t=e.codePointAt(0);return t<n||t>i});if(s.length&&(a.push(...s),r))break}return a}function n8(e,{escDigit:t,inCharClass:r,useFlagV:n}){var i;if(n1.has(e))return n1.get(e);if(e<32||e>126&&e<160||e>262143||t&&(i=e)>47&&i<58)return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;let a=ny(e);return((r?n?n0:nY:nZ).has(a)?"\\":"")+a}function n3({type:e}){return"CapturingGroup"===e||"Group"===e||"LookaroundAssertion"===e}function n4({type:e,value:t}){return"Character"===e&&45===t}var n9=class e extends RegExp{#e=new Map;#t=null;#r;#n=null;#i=null;rawOptions={};get source(){return this.#r||"(?:)"}constructor(t,r,n){const i=!!n?.lazyCompile;if(t instanceof RegExp){if(n)throw Error("Cannot provide options when copying a regexp");super(t,r),this.#r=t.source,t instanceof e&&(this.#e=t.#e,this.#n=t.#n,this.#i=t.#i,this.rawOptions=t.rawOptions)}else{const e={hiddenCaptures:[],strategy:null,transfers:[],...n};super(i?"":t,r),this.#r=t,this.#e=function(e,t){let r=new Map;for(let t of e)r.set(t,{hidden:!0});for(let[e,n]of t)for(let t of n)nx(r,t,{}).transferTo=e;return r}(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=n??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...r}=this.rawOptions;this.#t=new e(this.#r,this.flags,r)}let r=this.global||this.sticky,n=this.lastIndex;if("clip_search"===this.#i&&r&&n){this.lastIndex=0;let e=this.#a(t.slice(n));return e&&(function(e,t,r,n){if(e.index+=t,e.input=r,n){let r=e.indices;for(let e=0;e<r.length;e++){let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])}let n=r.groups;n&&Object.keys(n).forEach(e=>{let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])})}}(e,n,t,this.hasIndices),this.lastIndex+=n),e}return this.#a(t)}#a(e){let t;this.#t.lastIndex=this.lastIndex;let r=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!r||!this.#e.size)return r;let n=[...r];r.length=1,this.hasIndices&&(t=[...r.indices],r.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:s}=this.#e.get(e)??{};if(a?i.push(null):(i.push(r.length),r.push(n[e]),this.hasIndices&&r.indices.push(t[e])),s&&void 0!==n[e]){let a=i[s];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(r[a]=n[e],this.hasIndices&&(r.indices[a]=t[e]),r.groups){this.#n||(this.#n=function(e){let t,r=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,i=0,a=0;for(;t=r.exec(e);){let{0:e,groups:{capture:r,name:s}}=t;"["===e?i++:i?"]"===e&&i--:r&&(a++,s&&n.set(a,s))}return n}(this.source));let i=this.#n.get(s);i&&(r.groups[i]=n[e],this.hasIndices&&(r.indices.groups[i]=t[e]))}}}return r}};class n7{constructor(e,t={}){this.patterns=e,this.options=t;const{forgiving:r=!1,cache:n,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if("string"!=typeof e)return e;let t=n?.get(e);if(t){if(t instanceof RegExp)return t;if(r)return null;throw t}try{let t=i(e);return n?.set(e,t),t}catch(t){if(n?.set(e,t),r)return null;throw t}})}regexps;findNextMatchSync(e,t,r){let n="string"==typeof e?e:e.content,i=[];function a(e,t,r=0){return{index:e,captureIndices:t.indices.map(e=>null==e?{start:0xffffffff,end:0xffffffff,length:0}:{start:e[0]+r,end:e[1]+r,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let r=this.regexps[e];if(r)try{r.lastIndex=t;let s=r.exec(n);if(!s)continue;if(s.index===t)return a(e,s,0);i.push([e,s,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(i.length){let e=Math.min(...i.map(e=>e[1].index));for(let[t,r,n]of i)if(r.index===e)return a(t,r,n)}return null}}var ie=function(e={}){let t=Object.assign({target:"auto",cache:new Map},e);return t.regexConstructor||=e=>{let r;return(r=function(e,t){var r;let n,i,a,s,o=nC(t),l=(r=rU(e,{flags:o.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:o.rules.captureGroup,singleline:o.rules.singleline},skipBackrefValidation:o.rules.allowOrphanBackrefs,unicodePropertyMap:nI}),n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...{accuracy:o.accuracy,asciiWordBoundaries:o.rules.asciiWordBoundaries,avoidSubclass:o.avoidSubclass,bestEffortTarget:o.target}},nU(r),i={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:nv[n.bestEffortTarget]>=nv.ES2024,passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:r.flags.digitIsAscii,spaceIsAscii:r.flags.spaceIsAscii,wordIsAscii:r.flags.wordIsAscii},r3(r,nB,i),s={currentFlags:a={dotAll:r.flags.dotAll,ignoreCase:r.flags.ignoreCase},prevFlags:null,globalFlags:a,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:i.subroutineRefMap},r3(r,nO,s),r3(r,nG,{groupsByName:s.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:s.reffedNodesByReferencer}),r._originMap=s.groupOriginByCopy,r._strategy=i.strategy,r),u=function(e,t){let r=nC(t),n=nv[r.target]>=nv.ES2024,i=nv[r.target]>=nv.ES2025,a=r.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error("Invalid recursionLimit; use 2-20");let s=null,o=null;if(!i){let t=[e.flags.ignoreCase];r3(e,nK,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?s=!0:o=!0}})}let l={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||s)&&!o)},u=e,c={accuracy:r.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:u,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&s&&o),useFlagMods:i,useFlagV:n,verbose:r.verbose};function p(e){return c.lastNode=u,u=e,(function(e,t){if(null==e)throw Error(t??"Value expected");return e})(nJ[e.type],`Unexpected node type "${e.type}"`)(e,c,p)}let h={pattern:e.body.map(p).join("|"),flags:p(e.flags),options:{...e.options}};return n||(delete h.options.force.v,h.options.disable.v=!0,h.options.unicodeSetsPlugin=null),h._captureTransfers=new Map,h._hiddenCaptures=[],c.captureMap.forEach((e,t)=>{e.hidden&&h._hiddenCaptures.push(t),e.transferTo&&nx(h._captureTransfers,e.transferTo,[]).push(t)}),h}(l,o),c=function(e,t){let r,{hiddenCaptures:n,mode:i}={hiddenCaptures:[],mode:"plugin",...t},a=t?.captureTransfers??new Map;if(!RegExp(nl,"su").test(e))return{pattern:e,captureTransfers:a,hiddenCaptures:n};if("plugin"===i&&nr(e,ns`\(\?\(DEFINE\)`,ne.DEFAULT))throw Error("DEFINE groups cannot be used with recursion");let s=[],o=nr(e,ns`\\[1-9]`,ne.DEFAULT),l=new Map,u=[],c=!1,p=0,h=0;for(np.lastIndex=0;r=np.exec(e);){let{0:t,groups:{captureName:d,rDepth:f,gRNameOrNum:m,gRDepth:g}}=r;if("["===t)p++;else if(p)"]"===t&&p--;else if(f){if(nd(f),c)throw Error(nh);if(o)throw Error(`${"external"===i?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);let t=e.slice(0,r.index),l=e.slice(np.lastIndex);if(nr(l,nl,ne.DEFAULT))throw Error(nh);let u=f-1;e=nf(t,l,u,!1,n,s,h),a=ng(a,t,u,s.length,0,h);break}else if(m){nd(g);let p=!1;for(let e of u)if(e.name===m||e.num===+m){if(p=!0,e.hasRecursedWithin)throw Error(nh);break}if(!p)throw Error(ns`Recursive \g cannot be used outside the referenced group "${"external"===i?m:ns`\g<${m}&R=${g}>`}"`);let d=l.get(m),f=function(e,t){let r,n=/\\?./gsu;n.lastIndex=t;let i=e.length,a=0,s=1;for(;r=n.exec(e);){let[e]=r;if("["===e)a++;else if(a)"]"===e&&a--;else if("("===e)s++;else if(")"===e&&!--s){i=r.index;break}}return e.slice(t,i)}(e,d);if(o&&nr(f,ns`${nu}|\((?!\?)`,ne.DEFAULT))throw Error(`${"external"===i?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);let y=e.slice(d,r.index),b=f.slice(y.length+t.length),w=s.length,A=g-1,_=nf(y,b,A,!0,n,s,h);a=ng(a,y,A,s.length-w,w,h);let x=e.slice(0,d),v=e.slice(d+f.length);e=`${x}${_}${v}`,np.lastIndex+=_.length-t.length-y.length-b.length,u.forEach(e=>e.hasRecursedWithin=!0),c=!0}else if(d)h++,l.set(String(h),np.lastIndex),l.set(d,np.lastIndex),u.push({num:h,name:d});else if("("===t[0]){let e="("===t;e&&(h++,l.set(String(h),np.lastIndex)),u.push(e?{num:h}:{})}else")"===t&&u.pop()}return n.push(...s),{pattern:e,captureTransfers:a,hiddenCaptures:n}}(u.pattern,{captureTransfers:u._captureTransfers,hiddenCaptures:u._hiddenCaptures,mode:"external"}),p=function(e,t){let r,n=t?.hiddenCaptures??[],i=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};let a="(?:(?=(",s=[0],o=[],l=0,u=0,c=NaN;do{let t;r=!1;let p=0,h=0,d=!1;for(nn.lastIndex=Number.isNaN(c)?0:c+a.length;t=nn.exec(e);){let{0:f,index:m,groups:{capturingStart:g,noncapturingStart:y}}=t;if("["===f)p++;else if(p)"]"===f&&p--;else if("(?>"!==f||d){if(d&&y)h++;else if(g)d?h++:(l++,s.push(l+u));else if(")"===f&&d){if(!h){let t=l+ ++u;e=`${e.slice(0,c)}${a}${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,r=!0,o.push(t);for(let e=0;e<n.length;e++)n[e]>=t&&n[e]++;if(i.size){let e=new Map;i.forEach((r,n)=>{e.set(n>=t?n+1:n,r.map(e=>e>=t?e+1:e))}),i=e}break}h--}}else c=m,d=!0}}while(r)return n.push(...o),{pattern:e=nt(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:r}})=>{if(t){let r=+t;if(r>s.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${s[r]}`}return`\\${r}`},ne.DEFAULT),captureTransfers:i,hiddenCaptures:n}}(function(e){let t;if(!RegExp(`${ni}\\+`).test(e))return{pattern:e};let r=[],n=null,i=null,a="",s=0;for(na.lastIndex=0;t=na.exec(e);){let{0:u,index:c,groups:{qBase:p,qMod:h,invalidQ:d}}=t;if("["===u)s||(i=c),s++;else if("]"===u)s?s--:i=null;else if(!s)if("+"===h&&a&&!a.startsWith("(")){if(d)throw Error(`Invalid quantifier "${u}"`);let t=-1;if(/^\{\d+\}$/.test(p)){var o,l;o=e,l=c+p.length,e=o.slice(0,l)+""+o.slice(l+h.length)}else{if(")"===a||"]"===a){let t=")"===a?n:i;if(null===t)throw Error(`Invalid unmatched "${a}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${p})${e.slice(c+u.length)}`}else e=`${e.slice(0,c-a.length)}(?>${a}${p})${e.slice(c+u.length)}`;t+=4}na.lastIndex+=t}else"("===u[0]?r.push(c):")"===u&&(n=r.length?r.pop():null);a=u}return{pattern:e}}(c.pattern).pattern,{captureTransfers:c.captureTransfers,hiddenCaptures:c.hiddenCaptures}),h={pattern:p.pattern,flags:`${o.hasIndices?"d":""}${o.global?"g":""}${u.flags}${u.options.disable.v?"u":"v"}`};if(o.avoidSubclass){if(o.lazyCompileLength!==1/0)throw Error("Lazy compilation requires subclass")}else{let e=p.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(p.captureTransfers),r=l._strategy,n=h.pattern.length>=o.lazyCompileLength;(e.length||t.length||r||n)&&(h.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...r&&{strategy:r},...n&&{lazyCompile:n}})}return h}(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...{target:t.target}})).options?new n9(r.pattern,r.flags,r.options):new RegExp(r.pattern,r.flags)},{createScanner:e=>new n7(e,t),createString:e=>({content:e})}}({forgiving:!0}),it=Object.fromEntries(C.flatMap(e=>{var t;return(null!=(t=e.aliases)?t:[]).map(t=>[t,e.id])})),ir=new Set(Object.keys(E)),ii=e=>{let t=e.trim().toLowerCase();return it[t]||(ir.has(t),t)},ia=new Map,is=new Map,io=new Map,il=e=>{var t;return"string"==typeof e?e:null!=(t=e.name)?t:"custom"},iu=function(e={}){var t;let r=null!=(t=e.themes)?t:["github-light","github-dark"];return{name:"shiki",type:"code-highlighter",supportsLanguage(e){let t=ii(e);return ir.has(t)},getSupportedLanguages:()=>Array.from(ir),getThemes:()=>r,highlight({code:e,language:t,themes:r},n){let i,a,s=ii(t),o=[il(r[0]),il(r[1])],l=(i=e.slice(0,100),a=e.length>100?e.slice(-100):"",`${s}:${o[0]}:${o[1]}:${e.length}:${i}:${a}`);return is.has(l)?is.get(l):(n&&(io.has(l)||io.set(l,new Set),io.get(l).add(n)),((e,t)=>{let r=`${e}-${il(t[0])}-${il(t[1])}`;if(ia.has(r))return ia.get(r);let n=rg({themes:t,langs:[e],engine:ie});return ia.set(r,n),n})(ir.has(s)?s:"text",r).then(t=>{let r=t.getLoadedLanguages().includes(s)?s:"text",n=t.codeToTokens(e,{lang:r,themes:{light:o[0],dark:o[1]}});is.set(l,n);let i=io.get(l);if(i){for(let e of i)e(n);io.delete(l)}}).catch(e=>{console.error("[Streamdown Code] Failed to highlight code:",e),io.delete(l)}),null)}}}(),ic=e.i(76116),ip=e.i(6703),ih=e.i(82652);function id({className:e,children:t,node:r,...n}){let i=(0,c.useRef)(null),[a,s]=(0,c.useState)(!1),o=function(e){for(let t of c.Children.toArray(e)){if(!(0,c.isValidElement)(t))continue;let e=t.props;if("string"!=typeof e?.className)continue;let r=e.className.match(/language-([a-z0-9+#-]+)/i);if(r)return r[1]}}(t)??"",l=(0,c.useCallback)(async()=>{let e=i.current?.innerText??"";if(e)try{await navigator.clipboard.writeText(e),s(!0),window.setTimeout(()=>s(!1),2e3)}catch{}},[]);return(0,u.jsxs)("div",{className:"group relative my-2 overflow-hidden rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.5)]",children:[(0,u.jsxs)("div",{className:"flex items-center justify-between border-b border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.8)] px-3 py-1.5",children:[(0,u.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:o||"text"}),(0,u.jsx)("button",{type:"button",onClick:l,className:(0,b.cn)("inline-flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-muted-foreground","opacity-0 transition-opacity hover:bg-[hsl(var(--accent))] hover:text-foreground","group-hover:opacity-100 focus-visible:opacity-100",a&&"opacity-100 text-primary"),"aria-label":"复制代码",children:a?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(ip.Check,{className:"h-3 w-3"}),"已复制"]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(ih.Copy,{className:"h-3 w-3"}),"复制"]})})]}),(0,u.jsx)("pre",{ref:i,className:(0,b.cn)("overflow-x-auto p-3 text-xs leading-relaxed","[&_code]:bg-transparent [&_code]:p-0",e),...n,children:t})]})}let im=["https://","http://","mailto:","#","/"],ig=["https://","data:image/"],iy=(e,t)=>{let r=e.toLowerCase();return("src"===t?ig:im).some(e=>r.startsWith(e))?e:""};function ib({children:e,className:t}){return(0,u.jsx)("div",{className:(0,b.cn)("text-sm leading-relaxed text-foreground/90","[&_p]:my-2 [&_ul]:my-2 [&_ol]:my-2 [&_li]:my-0.5","[&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5","[&_h1]:mt-4 [&_h1]:mb-2 [&_h1]:text-lg [&_h1]:font-semibold","[&_h2]:mt-3 [&_h2]:mb-2 [&_h2]:text-base [&_h2]:font-semibold","[&_h3]:mt-3 [&_h3]:mb-1.5 [&_h3]:text-sm [&_h3]:font-semibold","[&_a]:text-primary [&_a]:underline [&_a]:underline-offset-2","[&_:not(pre)>code]:rounded [&_:not(pre)>code]:bg-[hsl(var(--muted))] [&_:not(pre)>code]:px-1 [&_:not(pre)>code]:py-0.5 [&_:not(pre)>code]:text-[0.85em]","[&_table]:my-2 [&_table]:w-full [&_table]:border-collapse","[&_th]:border [&_th]:border-[hsl(var(--border))] [&_th]:px-2 [&_th]:py-1 [&_th]:text-left [&_th]:font-semibold","[&_td]:border [&_td]:border-[hsl(var(--border))] [&_td]:px-2 [&_td]:py-1","[&_blockquote]:my-2 [&_blockquote]:border-l-2 [&_blockquote]:border-[hsl(var(--border))] [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground","[&_hr]:my-3 [&_hr]:border-[hsl(var(--border))]",t),children:(0,u.jsx)(ic.C,{parseIncompleteMarkdown:!0,skipHtml:!0,urlTransform:iy,plugins:{code:iu},components:{pre:id},controls:{code:!1,table:!1,mermaid:!1},children:e})})}let iw=(0,c.memo)(function({message:e}){return"user"===e.role?(0,u.jsx)(iA,{content:e.content}):(0,u.jsx)(i_,{message:e})},(e,t)=>e.message===t.message);function iA({content:e}){return(0,u.jsx)("div",{className:"flex justify-end",children:(0,u.jsx)("div",{className:"max-w-[85%] rounded-2xl rounded-tr-sm bg-[hsl(var(--muted)/0.7)] px-4 py-2.5 text-sm leading-relaxed text-foreground whitespace-pre-wrap",children:e})})}function i_({message:e}){let t="streaming"===e.status,r="error"===e.status;return(0,u.jsxs)("div",{className:"space-y-3 text-sm leading-relaxed",children:[e.reasoning?(0,u.jsx)(ix,{reasoning:e.reasoning,streaming:t}):null,e.retrievalQueryRewritten&&e.retrievalQuery?(0,u.jsxs)("div",{className:"inline-flex max-w-full items-center gap-1.5 rounded-md bg-[hsl(var(--muted)/0.4)] px-2 py-1 text-xs text-muted-foreground",children:[(0,u.jsx)(v.Search,{className:"h-3 w-3 shrink-0"}),(0,u.jsx)("span",{className:"font-medium shrink-0",children:"检索关键词:"}),(0,u.jsx)("span",{className:"truncate font-mono text-foreground/80",children:e.retrievalQuery})]}):null,e.retrievedChunks&&e.retrievedChunks.length>0?(0,u.jsx)(iv,{chunks:e.retrievedChunks,groups:e.retrievalGroups}):null,r?(0,u.jsxs)("div",{className:"flex items-start gap-2 rounded-md border border-[hsl(var(--destructive))/0.3] bg-[hsl(var(--destructive))/0.05] px-3 py-2 text-[hsl(var(--destructive))]",children:[(0,u.jsx)(w,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,u.jsx)("span",{className:"text-xs",children:e.errorMessage??"生成失败"})]}):(0,u.jsxs)("div",{className:"text-foreground/90",children:[(0,u.jsx)(ib,{children:e.content}),t?(0,u.jsx)("span",{className:"ml-0.5 inline-block h-3.5 w-1.5 animate-pulse bg-foreground align-baseline"}):null]})]})}function ix({reasoning:e,streaming:t}){let[r,n]=(0,c.useState)(!1);return(0,u.jsxs)(k.Collapsible,{open:r,onOpenChange:n,children:[(0,u.jsx)(k.CollapsibleTrigger,{asChild:!0,children:(0,u.jsxs)("button",{type:"button",className:(0,b.cn)("inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium","text-muted-foreground transition-colors hover:bg-[hsl(var(--accent))] hover:text-foreground"),children:[(0,u.jsx)(_.Brain,{className:"h-3.5 w-3.5"}),t?(0,u.jsx)("span",{className:"animate-text-shimmer bg-[linear-gradient(90deg,hsl(var(--muted-foreground))_0%,hsl(var(--foreground))_50%,hsl(var(--muted-foreground))_100%)] bg-[length:200%_100%] bg-clip-text text-transparent",children:"深度思考中"}):"深度思考",(0,u.jsx)(x.ChevronDown,{className:(0,b.cn)("h-3 w-3 transition-transform duration-200",r&&"rotate-180")})]})}),(0,u.jsx)(k.CollapsibleContent,{children:(0,u.jsx)("div",{className:"mt-2 border-l-2 border-[hsl(var(--border))] pl-3 text-xs leading-relaxed text-muted-foreground whitespace-pre-wrap",children:e})})]})}function iv({chunks:e,groups:t}){let[r,n]=(0,c.useState)(!1),i=new Map;e.forEach((e,t)=>{i.set(`${e.docId}#${e.chunkId}`,t+1)});let a=(t??[]).filter(e=>!e.error),s=(t??[]).filter(e=>e.error),o=a.length>=2||s.length>0;return(0,u.jsxs)(k.Collapsible,{open:r,onOpenChange:n,children:[(0,u.jsx)(k.CollapsibleTrigger,{asChild:!0,children:(0,u.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-[hsl(var(--accent))] hover:text-foreground",children:[(0,u.jsx)(A,{className:"h-3.5 w-3.5"}),"查看 ",e.length," 个引用",o?(0,u.jsxs)("span",{className:"text-muted-foreground/70",children:["· ",a.length," 个知识库",s.length>0?`(${s.length} 失败)`:""]}):null,(0,u.jsx)(x.ChevronDown,{className:(0,b.cn)("h-3 w-3 transition-transform duration-200",r&&"rotate-180")})]})}),(0,u.jsx)(k.CollapsibleContent,{children:(0,u.jsx)("div",{className:"mt-2 space-y-3",children:o?(0,u.jsxs)(u.Fragment,{children:[a.map(e=>(0,u.jsx)(ik,{group:e,indexByKey:i},`ok-${e.knowledgeBaseName}`)),s.map(e=>(0,u.jsxs)("div",{className:"rounded-md border border-[hsl(var(--destructive))/0.3] bg-[hsl(var(--destructive))/0.05] px-3 py-2 text-xs text-[hsl(var(--destructive))]",children:[(0,u.jsx)("span",{className:"font-medium",children:e.knowledgeBaseName}),(0,u.jsxs)("span",{className:"ml-2 text-[hsl(var(--destructive))/0.8]",children:["检索失败:",e.error]})]},`err-${e.knowledgeBaseName}`))]}):(0,u.jsx)("div",{className:"space-y-2",children:e.map((e,t)=>(0,u.jsx)(iC,{chunk:e,index:t+1},`${e.docId}-${e.chunkId}`))})})})]})}function ik({group:e,indexByKey:t}){return(0,u.jsxs)("div",{className:"space-y-2",children:[(0,u.jsxs)("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[(0,u.jsx)("span",{className:"text-foreground/80",children:e.knowledgeBaseName}),(0,u.jsxs)("span",{children:["· ",e.chunks.length," 条"]})]}),(0,u.jsx)("div",{className:"space-y-2 border-l-2 border-[hsl(var(--border))] pl-3",children:e.chunks.map(e=>{let r=`${e.docId}#${e.chunkId}`,n=t.get(r)??0;return(0,u.jsx)(iC,{chunk:e,index:n},`${e.docId}-${e.chunkId}`)})})]})}function iC({chunk:e,index:t}){let r=e.ossKey?.split("/").pop()||e.ossKey||"未知文件";return(0,u.jsxs)("div",{className:"rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.3)] p-3",children:[(0,u.jsxs)("div",{className:"mb-1.5 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,u.jsx)("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-[hsl(var(--primary-50))] font-semibold text-primary",children:t>0?t:"–"}),(0,u.jsx)("span",{className:"font-medium text-foreground/80",children:r}),(0,u.jsxs)("span",{children:["Chunk #",e.chunkId]}),(0,u.jsx)("span",{className:"ml-auto font-mono",children:e.score.toFixed(4)})]}),(0,u.jsx)("p",{className:"line-clamp-4 whitespace-pre-wrap text-xs text-foreground/80",children:e.content})]})}iw.displayName="QaMessage",e.s(["QaChatPanel",0,function({messages:e,isStreaming:t,canSend:r,error:n,onSend:i,onStop:a,emptyState:s,disabledPlaceholder:o}){let[l,h]=(0,c.useState)(""),w=(0,c.useRef)(null);(0,c.useEffect)(()=>{let e=w.current;!e||e.scrollHeight-e.scrollTop-e.clientHeight<120&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[e]);let A=()=>{let e=l.trim();e&&r&&!t&&(i(e),h(""))};return(0,u.jsxs)("div",{className:"flex h-full flex-col rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--surface))]",children:[(0,u.jsx)("div",{ref:w,role:"log","aria-live":"polite","aria-relevant":"additions text","aria-busy":t,className:"flex-1 space-y-6 overflow-y-auto px-6 py-5",children:0===e.length?(0,u.jsx)("div",{className:"flex h-full min-h-[320px] items-center justify-center",children:(0,u.jsx)(y.EmptyState,{icon:p.MessageSquare,title:s?.title??"开始对话",description:s?.description??"输入问题,系统会先从知识库检索相关内容,再让大模型基于检索结果回答",action:s?.actionLabel&&s?.onAction?(0,u.jsx)(m.Button,{type:"button",onClick:s.onAction,children:s.actionLabel}):void 0})}):e.map(e=>(0,u.jsx)(iw,{message:e},e.id))}),(0,u.jsxs)("div",{className:"border-t border-[hsl(var(--border))] bg-[hsl(var(--surface)/0.6)] px-4 py-3",children:[n&&(0,u.jsx)("p",{className:"mb-2 text-xs text-[hsl(var(--destructive))]",children:n}),(0,u.jsxs)("div",{className:"flex items-end gap-2",children:[(0,u.jsx)(g.Textarea,{value:l,onChange:e=>h(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),A())},placeholder:r?"输入问题,Enter 发送,Shift+Enter 换行":o??"请先在左侧选择模型...",disabled:!r,className:(0,b.cn)("min-h-[44px] max-h-40 resize-none text-sm"),rows:1}),t?(0,u.jsx)(m.Button,{type:"button",variant:"outline",size:"icon",onClick:a,title:"停止",children:(0,u.jsx)(f,{className:"h-4 w-4 fill-current"})}):(0,u.jsx)(m.Button,{type:"button",size:"icon",disabled:!r||!l.trim(),onClick:A,title:"发送",children:(0,u.jsx)(d,{className:"h-4 w-4"})})]})]})]})}],21122);var iS=e.i(51517),iN=e.i(30068),iE=e.i(23888),iI=e.i(66476),iL=e.i(66473),iP=e.i(70036),iR=e.i(43876),i$=e.i(92820);e.s(["LLMModelSelector",0,function({providerId:e,model:t,onProviderChange:r,onModelChange:n,allowFreeText:i=!1,autoSelectFirst:a=!1,providerLabel:s="Provider",modelLabel:o="Model"}){let{data:l=[],isLoading:p}=(0,iP.useLLMProviders)(),{data:h,isFetching:d,refetch:f}=function(e,t={}){return(0,iR.useQuery)({queryKey:["llm-provider-models",e],queryFn:()=>(0,i$.fetchProviderModels)(e),enabled:!!e&&(t.enabled??!0),staleTime:3e5,retry:!1})}(e||void 0,{enabled:!!e});(0,c.useEffect)(()=>{if(!a||e||0===l.length)return;let t=l[0];r(t.id,t.defaultModel??"")},[a,e,l]);let g=(0,c.useMemo)(()=>{let r=new Set;for(let e of(t&&r.add(t),h??[]))r.add(e.id);let n=l.find(t=>t.id===e);return n?.defaultModel&&r.add(n.defaultModel),Array.from(r)},[t,h,l,e]);return(0,u.jsxs)("div",{className:"space-y-4",children:[(0,u.jsxs)("div",{className:"space-y-2",children:[(0,u.jsx)(iI.Label,{className:"text-sm font-medium",children:s}),(0,u.jsxs)(iL.Select,{value:e,onValueChange:e=>{let t=l.find(t=>t.id===e);r(e,t?.defaultModel??"")},disabled:p||0===l.length,children:[(0,u.jsx)(iL.SelectTrigger,{children:(0,u.jsx)(iL.SelectValue,{placeholder:p?"加载中...":0===l.length?"请先在「大模型」中创建配置":"选择 Provider"})}),(0,u.jsx)(iL.SelectContent,{children:l.map(e=>(0,u.jsx)(iL.SelectItem,{value:e.id,children:e.name},e.id))})]})]}),(0,u.jsxs)("div",{className:"space-y-2",children:[(0,u.jsxs)("div",{className:"flex items-center justify-between",children:[(0,u.jsx)(iI.Label,{className:"text-sm font-medium",children:o}),(0,u.jsxs)(m.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",disabled:!e||d,onClick:()=>f(),children:[d?(0,u.jsx)(iS.Loader2,{className:"mr-1 h-3 w-3 animate-spin"}):(0,u.jsx)(iN.RefreshCw,{className:"mr-1 h-3 w-3"}),"刷新列表"]})]}),i?(0,u.jsxs)("div",{className:"flex gap-2",children:[(0,u.jsxs)(iL.Select,{value:g.includes(t)?t:"",onValueChange:n,disabled:!e,children:[(0,u.jsx)(iL.SelectTrigger,{className:"flex-1",children:(0,u.jsx)(iL.SelectValue,{placeholder:"选择或输入模型名"})}),(0,u.jsx)(iL.SelectContent,{children:0===g.length?(0,u.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"点击「刷新列表」拉取可用模型"}):g.map(e=>(0,u.jsx)(iL.SelectItem,{value:e,children:e},e))})]}),(0,u.jsx)(iE.Input,{placeholder:"或手动输入",value:t,onChange:e=>n(e.target.value),className:"flex-1"})]}):(0,u.jsxs)(iL.Select,{value:t,onValueChange:n,disabled:!e,children:[(0,u.jsx)(iL.SelectTrigger,{children:(0,u.jsx)(iL.SelectValue,{placeholder:"选择模型"})}),(0,u.jsx)(iL.SelectContent,{children:0===g.length?(0,u.jsx)(iL.SelectItem,{value:"__empty",disabled:!0,children:"无可用模型"}):g.map(e=>(0,u.jsx)(iL.SelectItem,{value:e,children:e},e))})]})]})]})}],50657),e.s(["SystemPromptInput",0,function({value:e,onChange:t,placeholder:r,helperText:n,rows:i=3,label:a="系统提示词"}){return(0,u.jsxs)("div",{className:"space-y-2",children:[(0,u.jsx)(iI.Label,{className:"text-sm font-medium",children:a}),(0,u.jsx)(g.Textarea,{rows:i,value:e,onChange:e=>t(e.target.value),placeholder:r,className:"text-sm"}),n&&(0,u.jsx)("p",{className:"text-xs text-muted-foreground",children:n})]})}],51024);var iT=e.i(27069),iM=e.i(91967),ij=e.i(67928),iB=e.i(43250),iO=e.i(17256),iG=e.i(25486),iU=e.i(84017),iD=e.i(61614),iF=e.i(80939),iW=e.i(41986),iH=["PageUp","PageDown"],iz=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],iq={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},iV="Slider",[iQ,iX,iK]=(0,iW.createCollection)(iV),[iJ,iZ]=(0,iB.createContextScope)(iV,[iK]),[iY,i0]=iJ(iV),i1=c.forwardRef((e,t)=>{let{name:r,min:n=0,max:i=100,step:a=1,orientation:s="horizontal",disabled:o=!1,minStepsBetweenThumbs:l=0,defaultValue:p=[n],value:h,onValueChange:d=()=>{},onValueCommit:f=()=>{},inverted:m=!1,form:g,...y}=e,b=c.useRef(new Set),w=c.useRef(0),A="horizontal"===s,[_=[],x]=(0,iO.useControllableState)({prop:h,defaultProp:p,onChange:e=>{let t=[...b.current];t[w.current]?.focus(),d(e)}}),v=c.useRef(_);function k(e,t,{commit:r}={commit:!1}){let s,o=(String(a).split(".")[1]||"").length,u=Math.round((Math.round((e-n)/a)*a+n)*(s=Math.pow(10,o)))/s,c=(0,iT.clamp)(u,[n,i]);x((e=[])=>{let n=function(e=[],t,r){let n=[...e];return n[r]=t,n.sort((e,t)=>e-t)}(e,c,t);if(!function(e,t){if(t>0)return Math.min(...e.slice(0,-1).map((t,r)=>e[r+1]-t))>=t;return!0}(n,l*a))return e;{w.current=n.indexOf(c);let t=String(n)!==String(e);return t&&r&&f(n),t?n:e}})}return(0,u.jsx)(iY,{scope:e.__scopeSlider,name:r,disabled:o,min:n,max:i,valueIndexToChangeRef:w,thumbs:b.current,values:_,orientation:s,form:g,children:(0,u.jsx)(iQ.Provider,{scope:e.__scopeSlider,children:(0,u.jsx)(iQ.Slot,{scope:e.__scopeSlider,children:(0,u.jsx)(A?i5:i8,{"aria-disabled":o,"data-disabled":o?"":void 0,...y,ref:t,onPointerDown:(0,iM.composeEventHandlers)(y.onPointerDown,()=>{o||(v.current=_)}),min:n,max:i,inverted:m,onSlideStart:o?void 0:function(e){let t=function(e,t){if(1===e.length)return 0;let r=e.map(e=>Math.abs(e-t)),n=Math.min(...r);return r.indexOf(n)}(_,e);k(e,t)},onSlideMove:o?void 0:function(e){k(e,w.current)},onSlideEnd:o?void 0:function(){let e=v.current[w.current];_[w.current]!==e&&f(_)},onHomeKeyDown:()=>!o&&k(n,0,{commit:!0}),onEndKeyDown:()=>!o&&k(i,_.length-1,{commit:!0}),onStepKeyDown:({event:e,direction:t})=>{if(!o){let r=iH.includes(e.key)||e.shiftKey&&iz.includes(e.key),n=w.current;k(_[n]+a*(r?10:1)*t,n,{commit:!0})}}})})})})});i1.displayName=iV;var[i2,i6]=iJ(iV,{startEdge:"left",endEdge:"right",size:"width",direction:1}),i5=c.forwardRef((e,t)=>{let{min:r,max:n,dir:i,inverted:a,onSlideStart:s,onSlideMove:o,onSlideEnd:l,onStepKeyDown:p,...h}=e,[d,f]=c.useState(null),m=(0,ij.useComposedRefs)(t,e=>f(e)),g=c.useRef(void 0),y=(0,iG.useDirection)(i),b="ltr"===y,w=b&&!a||!b&&a;function A(e){let t=g.current||d.getBoundingClientRect(),i=as([0,t.width],w?[r,n]:[n,r]);return g.current=t,i(e-t.left)}return(0,u.jsx)(i2,{scope:e.__scopeSlider,startEdge:w?"left":"right",endEdge:w?"right":"left",direction:w?1:-1,size:"width",children:(0,u.jsx)(i3,{dir:y,"data-orientation":"horizontal",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:e=>{let t=A(e.clientX);s?.(t)},onSlideMove:e=>{let t=A(e.clientX);o?.(t)},onSlideEnd:()=>{g.current=void 0,l?.()},onStepKeyDown:e=>{let t=iq[w?"from-left":"from-right"].includes(e.key);p?.({event:e,direction:t?-1:1})}})})}),i8=c.forwardRef((e,t)=>{let{min:r,max:n,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:o,onStepKeyDown:l,...p}=e,h=c.useRef(null),d=(0,ij.useComposedRefs)(t,h),f=c.useRef(void 0),m=!i;function g(e){let t=f.current||h.current.getBoundingClientRect(),i=as([0,t.height],m?[n,r]:[r,n]);return f.current=t,i(e-t.top)}return(0,u.jsx)(i2,{scope:e.__scopeSlider,startEdge:m?"bottom":"top",endEdge:m?"top":"bottom",size:"height",direction:m?1:-1,children:(0,u.jsx)(i3,{"data-orientation":"vertical",...p,ref:d,style:{...p.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:e=>{let t=g(e.clientY);a?.(t)},onSlideMove:e=>{let t=g(e.clientY);s?.(t)},onSlideEnd:()=>{f.current=void 0,o?.()},onStepKeyDown:e=>{let t=iq[m?"from-bottom":"from-top"].includes(e.key);l?.({event:e,direction:t?-1:1})}})})}),i3=c.forwardRef((e,t)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:s,onEndKeyDown:o,onStepKeyDown:l,...c}=e,p=i0(iV,r);return(0,u.jsx)(iF.Primitive.span,{...c,ref:t,onKeyDown:(0,iM.composeEventHandlers)(e.onKeyDown,e=>{"Home"===e.key?(s(e),e.preventDefault()):"End"===e.key?(o(e),e.preventDefault()):iH.concat(iz).includes(e.key)&&(l(e),e.preventDefault())}),onPointerDown:(0,iM.composeEventHandlers)(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),p.thumbs.has(t)?t.focus():n(e)}),onPointerMove:(0,iM.composeEventHandlers)(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&i(e)}),onPointerUp:(0,iM.composeEventHandlers)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),a(e))})})}),i4="SliderTrack",i9=c.forwardRef((e,t)=>{let{__scopeSlider:r,...n}=e,i=i0(i4,r);return(0,u.jsx)(iF.Primitive.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...n,ref:t})});i9.displayName=i4;var i7="SliderRange",ae=c.forwardRef((e,t)=>{let{__scopeSlider:r,...n}=e,i=i0(i7,r),a=i6(i7,r),s=c.useRef(null),o=(0,ij.useComposedRefs)(t,s),l=i.values.length,p=i.values.map(e=>aa(e,i.min,i.max)),h=l>1?Math.min(...p):0,d=100-Math.max(...p);return(0,u.jsx)(iF.Primitive.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...n,ref:o,style:{...e.style,[a.startEdge]:h+"%",[a.endEdge]:d+"%"}})});ae.displayName=i7;var at="SliderThumb",ar=c.forwardRef((e,t)=>{let r=iX(e.__scopeSlider),[n,i]=c.useState(null),a=(0,ij.useComposedRefs)(t,e=>i(e)),s=c.useMemo(()=>n?r().findIndex(e=>e.ref.current===n):-1,[r,n]);return(0,u.jsx)(an,{...e,ref:a,index:s})}),an=c.forwardRef((e,t)=>{var r,n,i,a,s;let o,l,{__scopeSlider:p,index:h,name:d,...f}=e,m=i0(at,p),g=i6(at,p),[y,b]=c.useState(null),w=(0,ij.useComposedRefs)(t,e=>b(e)),A=!y||m.form||!!y.closest("form"),_=(0,iD.useSize)(y),x=m.values[h],v=void 0===x?0:aa(x,m.min,m.max),k=(r=h,(n=m.values.length)>2?`Value ${r+1} of ${n}`:2===n?["Minimum","Maximum"][r]:void 0),C=_?.[g.size],S=C?(i=C,a=v,s=g.direction,l=as([0,50],[0,o=i/2]),(o-l(a)*s)*s):0;return c.useEffect(()=>{if(y)return m.thumbs.add(y),()=>{m.thumbs.delete(y)}},[y,m.thumbs]),(0,u.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[g.startEdge]:`calc(${v}% + ${S}px)`},children:[(0,u.jsx)(iQ.ItemSlot,{scope:e.__scopeSlider,children:(0,u.jsx)(iF.Primitive.span,{role:"slider","aria-label":e["aria-label"]||k,"aria-valuemin":m.min,"aria-valuenow":x,"aria-valuemax":m.max,"aria-orientation":m.orientation,"data-orientation":m.orientation,"data-disabled":m.disabled?"":void 0,tabIndex:m.disabled?void 0:0,...f,ref:w,style:void 0===x?{display:"none"}:e.style,onFocus:(0,iM.composeEventHandlers)(e.onFocus,()=>{m.valueIndexToChangeRef.current=h})})}),A&&(0,u.jsx)(ai,{name:d??(m.name?m.name+(m.values.length>1?"[]":""):void 0),form:m.form,value:x},h)]})});ar.displayName=at;var ai=c.forwardRef(({__scopeSlider:e,value:t,...r},n)=>{let i=c.useRef(null),a=(0,ij.useComposedRefs)(i,n),s=(0,iU.usePrevious)(t);return c.useEffect(()=>{let e=i.current;if(!e)return;let r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;if(s!==t&&r){let n=new Event("input",{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[s,t]),(0,u.jsx)(iF.Primitive.input,{style:{display:"none"},...r,ref:a,defaultValue:t})});function aa(e,t,r){return(0,iT.clamp)(100/(r-t)*(e-t),[0,100])}function as(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}ai.displayName="RadioBubbleInput";let ao=c.forwardRef(({className:e,...t},r)=>(0,u.jsxs)(i1,{ref:r,className:(0,b.cn)("relative flex w-full touch-none select-none items-center",e),...t,children:[(0,u.jsx)(i9,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-[hsl(var(--muted))]",children:(0,u.jsx)(ae,{className:"absolute h-full bg-[hsl(var(--primary))]"})}),(0,u.jsx)(ar,{className:"block h-4 w-4 rounded-full border border-[hsl(var(--primary))] bg-[hsl(var(--background))] shadow-sm ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));ao.displayName=i1.displayName,e.s(["TemperatureSlider",0,function({value:e,onChange:t,min:r=0,max:n=2,step:i=.05,fallback:a=.7,label:s="温度"}){let o=(e??a).toFixed(2);return(0,u.jsxs)("div",{className:"space-y-2",children:[(0,u.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,u.jsx)("span",{className:"font-medium",children:s}),(0,u.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:o})]}),(0,u.jsx)(ao,{value:[e??a],min:r,max:n,step:i,onValueChange:e=>t(e[0]??a)})]})}],9012)},6962,e=>{"use strict";e.s(["newId",0,function(e="id"){return"u">typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():`${e}_${Date.now()}_${Math.random().toString(36).slice(2)}`}])},84625,e=>{"use strict";async function*t(e,t){let n=await fetch("/api/v1/llm/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});if(!n.ok||!n.body){let e=`Chat request failed with status ${n.status}`,t="STREAM_ERROR";try{let r=await n.json();e=r.message??e,t=r.code??t}catch{}yield{type:"error",code:t,message:e};return}let i=n.body.getReader(),a=new TextDecoder("utf-8"),s="";for(;;){let{value:e,done:t}=await i.read();if(t)break;let n=(s+=a.decode(e,{stream:!0})).indexOf("\n\n");for(;-1!==n;){let e=s.slice(0,n);s=s.slice(n+2);let t=r(e);t&&(yield t),n=s.indexOf("\n\n")}}if(s.trim()){let e=r(s);e&&(yield e)}}function r(e){let t=e.split("\n"),r=[];for(let e of t)!(!e||e.startsWith(":"))&&e.startsWith("data:")&&r.push(e.slice(5).trimStart());if(0===r.length)return null;try{return JSON.parse(r.join("\n"))}catch{return null}}e.s(["streamChat",0,t])},40596,e=>{"use strict";var t=e.i(17635),r=e.i(84625),n=e.i(6962);e.s(["useQaChat",0,function(e){let[i,a]=(0,t.useState)([]),[s,o]=(0,t.useState)(!1),[l,u]=(0,t.useState)(null),c=(0,t.useRef)(null),p=(0,t.useRef)(e.onPersist);p.current=e.onPersist;let h=(0,t.useRef)(i);h.current=i;let d=(0,t.useRef)(e);d.current=e;let f=(0,t.useRef)(s);f.current=s;let m=(0,t.useRef)(new Map),g=(0,t.useRef)(null),y=(0,t.useCallback)(()=>{g.current=null;let e=m.current;if(0===e.size)return;let t=new Map(e);e.clear(),a(e=>e.map(e=>{let r=t.get(e.id);return r?{...e,...r.content?{content:e.content+r.content}:null,...r.reasoning?{reasoning:(e.reasoning??"")+r.reasoning}:null}:e}))},[]),b=(0,t.useCallback)(()=>{if(null===g.current){if("u"<typeof requestAnimationFrame)return void y();g.current=requestAnimationFrame(y)}},[y]),w=(0,t.useCallback)(()=>{null!==g.current&&"u">typeof cancelAnimationFrame&&cancelAnimationFrame(g.current),g.current=null},[]);(0,t.useEffect)(()=>w,[w]);let A=(0,t.useCallback)(()=>{c.current?.abort()},[]),_=(0,t.useCallback)(()=>{c.current?.abort(),a([]),u(null)},[]),x=(0,t.useCallback)(e=>{c.current?.abort(),a(e),u(null)},[]);return{messages:i,isStreaming:s,error:l,send:(0,t.useCallback)(async e=>{let t=e.trim();if(!t||f.current)return;let i=d.current;if(!i.providerId||!i.model)return void u("请先选择模型与 Provider");u(null);let s={id:(0,n.newId)(),role:"user",content:t,createdAt:Date.now(),status:"done"},l=(0,n.newId)(),g={id:l,role:"assistant",content:"",reasoning:"",createdAt:Date.now(),status:"streaming"},A=[...h.current,s].map(e=>({role:e.role,content:e.content}));a(e=>[...e,s,g]),o(!0);let _=new AbortController;c.current=_;let x=e=>{a(t=>t.map(t=>t.id===l?{...t,...e}:t))};try{let e={providerId:i.providerId,model:i.model,messages:A,systemPrompt:i.systemPrompt,temperature:i.temperature,rag:i.rag};for await(let t of(0,r.streamChat)(e,_.signal))if("query.rewritten"===t.type)x({retrievalQuery:t.query,retrievalQueryRewritten:t.query!==t.original});else if("query.fallback"===t.type)x({retrievalQuery:t.original,retrievalQueryRewritten:!1});else if("retrieval.done"===t.type)x({retrievedChunks:t.chunks,retrievalGroups:t.byKnowledgeBase});else if("reasoning.delta"===t.type){let e=m.current.get(l)??{};e.reasoning=(e.reasoning??"")+t.delta,m.current.set(l,e),b()}else if("content.delta"===t.type){let e=m.current.get(l)??{};e.content=(e.content??"")+t.delta,m.current.set(l,e),b()}else if("error"===t.type){w(),y(),x({status:"error",errorMessage:`${t.code}: ${t.message}`}),u(t.message);break}else if("done"===t.type){w(),y(),x({status:"done"});break}}catch(e){if(w(),y(),e instanceof DOMException&&"AbortError"===e.name)x({status:"done"});else{let t=e instanceof Error?e.message:String(e);x({status:"error",errorMessage:t}),u(t)}}finally{o(!1),c.current=null;let e=p.current;e&&a(t=>(e(t),t))}},[b,y,w]),stop:A,clear:_,setMessages:x}}])}]);