sandforge 0.0.0-stage → 1.79.0

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 (220) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +54 -2
  3. package/THIRD-PARTY-NOTICES.md +1624 -0
  4. package/bin/sandforge-autopilot.mjs +12 -0
  5. package/bin/sandforge-backup.mjs +12 -0
  6. package/bin/sandforge-checkpoint.mjs +12 -0
  7. package/bin/sandforge-cleanup.mjs +12 -0
  8. package/bin/sandforge-clone.mjs +12 -0
  9. package/bin/sandforge-compare.mjs +12 -0
  10. package/bin/sandforge-dataops.mjs +12 -0
  11. package/bin/sandforge-empty.mjs +12 -0
  12. package/bin/sandforge-env.mjs +12 -0
  13. package/bin/sandforge-frozen.mjs +12 -0
  14. package/bin/sandforge-mcp.mjs +12 -0
  15. package/bin/sandforge-monitor.mjs +12 -0
  16. package/bin/sandforge-seed.mjs +12 -0
  17. package/bin/sandforge-sync.mjs +12 -0
  18. package/bin/sandforge.mjs +12 -0
  19. package/lib/catalogue.en.json +1 -0
  20. package/lib/chunk-2BVTCNWA.mjs +7 -0
  21. package/lib/chunk-2S5OMIIA.mjs +7 -0
  22. package/lib/chunk-2YIV2OB2.mjs +7 -0
  23. package/lib/chunk-342FN7AO.mjs +9 -0
  24. package/lib/chunk-36U7IQ6Y.mjs +25 -0
  25. package/lib/chunk-3CA767QB.mjs +7 -0
  26. package/lib/chunk-3DCUADVK.mjs +7 -0
  27. package/lib/chunk-3F5YMM2F.mjs +7 -0
  28. package/lib/chunk-3OHPD72J.mjs +9 -0
  29. package/lib/chunk-3RYLICRX.mjs +7 -0
  30. package/lib/chunk-3SRXFZSD.mjs +7 -0
  31. package/lib/chunk-42RER7V4.mjs +14 -0
  32. package/lib/chunk-4GL773D5.mjs +7 -0
  33. package/lib/chunk-4HFRHFGQ.mjs +7 -0
  34. package/lib/chunk-4HW535YJ.mjs +7 -0
  35. package/lib/chunk-4NAHW2D3.mjs +7 -0
  36. package/lib/chunk-4SNDMJP2.mjs +7 -0
  37. package/lib/chunk-4TLYUZD5.mjs +7 -0
  38. package/lib/chunk-4U6NXJNL.mjs +7 -0
  39. package/lib/chunk-4XZ5YT5O.mjs +7 -0
  40. package/lib/chunk-55HEMHEG.mjs +7 -0
  41. package/lib/chunk-57VHUYNG.mjs +10 -0
  42. package/lib/chunk-5AJRHRXA.mjs +20 -0
  43. package/lib/chunk-5CD257T7.mjs +7 -0
  44. package/lib/chunk-5HMAPZBV.mjs +7 -0
  45. package/lib/chunk-5LFSFYFJ.mjs +7 -0
  46. package/lib/chunk-5MMXFWPD.mjs +7 -0
  47. package/lib/chunk-5O6JOMHS.mjs +13 -0
  48. package/lib/chunk-5P4PHJRL.mjs +9 -0
  49. package/lib/chunk-5QKTYCWE.mjs +11 -0
  50. package/lib/chunk-66NMFCWX.mjs +7 -0
  51. package/lib/chunk-6EBMEGZB.mjs +7 -0
  52. package/lib/chunk-6LAXTAVN.mjs +7 -0
  53. package/lib/chunk-6MUEPV7M.mjs +9 -0
  54. package/lib/chunk-6QSM2WIH.mjs +10 -0
  55. package/lib/chunk-75ADZS6B.mjs +7 -0
  56. package/lib/chunk-7EANH5PY.mjs +68 -0
  57. package/lib/chunk-7F54PZUS.mjs +7 -0
  58. package/lib/chunk-7UQD6V6F.mjs +7 -0
  59. package/lib/chunk-AAVJ5XVX.mjs +7 -0
  60. package/lib/chunk-ALJVEUUS.mjs +7 -0
  61. package/lib/chunk-ALUFROGA.mjs +7 -0
  62. package/lib/chunk-AR7BE5O2.mjs +7 -0
  63. package/lib/chunk-AUTM6H6Z.mjs +7 -0
  64. package/lib/chunk-AV5SWEHP.mjs +9 -0
  65. package/lib/chunk-B45CNPUX.mjs +47 -0
  66. package/lib/chunk-BILZ3SSR.mjs +7 -0
  67. package/lib/chunk-BN7A4GRQ.mjs +7 -0
  68. package/lib/chunk-BOGNK4LV.mjs +7 -0
  69. package/lib/chunk-BS5T3MOQ.mjs +7 -0
  70. package/lib/chunk-BZ24IAP5.mjs +7 -0
  71. package/lib/chunk-CA5NAXSU.mjs +7 -0
  72. package/lib/chunk-CE6ZDGBB.mjs +7 -0
  73. package/lib/chunk-CGWXQX75.mjs +7 -0
  74. package/lib/chunk-CHCHAE4B.mjs +7 -0
  75. package/lib/chunk-D3QRXG63.mjs +787 -0
  76. package/lib/chunk-DBFJB2B6.mjs +7 -0
  77. package/lib/chunk-DLDX6RRC.mjs +7 -0
  78. package/lib/chunk-EADHKH3A.mjs +7 -0
  79. package/lib/chunk-EEVVGGM6.mjs +7 -0
  80. package/lib/chunk-ENLBYECD.mjs +7 -0
  81. package/lib/chunk-EQF2IJS2.mjs +11 -0
  82. package/lib/chunk-EQOQASDQ.mjs +7 -0
  83. package/lib/chunk-F2424IKX.mjs +7 -0
  84. package/lib/chunk-F74IHMGL.mjs +7 -0
  85. package/lib/chunk-FOVVHGEP.mjs +7 -0
  86. package/lib/chunk-FQBRBBY4.mjs +7 -0
  87. package/lib/chunk-FQGHL7GR.mjs +259 -0
  88. package/lib/chunk-GAM726CK.mjs +7 -0
  89. package/lib/chunk-GCOB7K5N.mjs +7 -0
  90. package/lib/chunk-GMY5427L.mjs +7 -0
  91. package/lib/chunk-GNC27UEU.mjs +7 -0
  92. package/lib/chunk-H2PJNIYJ.mjs +7 -0
  93. package/lib/chunk-H45UXY6G.mjs +7 -0
  94. package/lib/chunk-HCIDVIOW.mjs +7 -0
  95. package/lib/chunk-HF6LAK3G.mjs +7 -0
  96. package/lib/chunk-HJC7AIBK.mjs +7 -0
  97. package/lib/chunk-HJKM3E56.mjs +7 -0
  98. package/lib/chunk-HTJ5OGP5.mjs +7 -0
  99. package/lib/chunk-HUMEKZT5.mjs +8 -0
  100. package/lib/chunk-HV2MXMGI.mjs +7 -0
  101. package/lib/chunk-HXS7ORUF.mjs +11 -0
  102. package/lib/chunk-I3JKJTLO.mjs +110 -0
  103. package/lib/chunk-I7O6C2B5.mjs +8 -0
  104. package/lib/chunk-IAZB4WIL.mjs +7 -0
  105. package/lib/chunk-IC2C2GOF.mjs +8 -0
  106. package/lib/chunk-IEYG5ATY.mjs +7 -0
  107. package/lib/chunk-INIQ23K6.mjs +7 -0
  108. package/lib/chunk-INIT2UKJ.mjs +7 -0
  109. package/lib/chunk-J7HVXMSW.mjs +7 -0
  110. package/lib/chunk-JVL444U5.mjs +7 -0
  111. package/lib/chunk-K22PA4XL.mjs +7 -0
  112. package/lib/chunk-K2FBZIXY.mjs +7 -0
  113. package/lib/chunk-KLX67VPL.mjs +7 -0
  114. package/lib/chunk-L776PUMV.mjs +7 -0
  115. package/lib/chunk-LQ4DRFUH.mjs +9 -0
  116. package/lib/chunk-LRFAIUN7.mjs +7 -0
  117. package/lib/chunk-LV6G4XTK.mjs +7 -0
  118. package/lib/chunk-M6P5ZZLE.mjs +7 -0
  119. package/lib/chunk-MTMH6H2A.mjs +8 -0
  120. package/lib/chunk-MYTIL2JD.mjs +10 -0
  121. package/lib/chunk-NEVXIGR6.mjs +10 -0
  122. package/lib/chunk-NGSMZZDA.mjs +7 -0
  123. package/lib/chunk-NHWE66K5.mjs +7 -0
  124. package/lib/chunk-NM4MDLK4.mjs +7 -0
  125. package/lib/chunk-NTDN2JQZ.mjs +19 -0
  126. package/lib/chunk-NTOVCTRS.mjs +7 -0
  127. package/lib/chunk-NZ5ZZLKS.mjs +7 -0
  128. package/lib/chunk-OQOZAPCI.mjs +7 -0
  129. package/lib/chunk-OTWRDD6L.mjs +7 -0
  130. package/lib/chunk-P2PJYWGQ.mjs +7 -0
  131. package/lib/chunk-P42X3B4D.mjs +7 -0
  132. package/lib/chunk-P7GSGFJO.mjs +7 -0
  133. package/lib/chunk-PA3MKJVH.mjs +7 -0
  134. package/lib/chunk-PBI4BYWW.mjs +7 -0
  135. package/lib/chunk-PNCONNFJ.mjs +10 -0
  136. package/lib/chunk-PTTHSSQO.mjs +7 -0
  137. package/lib/chunk-PUOX4NBJ.mjs +8 -0
  138. package/lib/chunk-PZTSVQSF.mjs +7 -0
  139. package/lib/chunk-QPF6C5MX.mjs +7 -0
  140. package/lib/chunk-QQZZMKU3.mjs +7 -0
  141. package/lib/chunk-QROPNEGY.mjs +14 -0
  142. package/lib/chunk-QRV2OSIS.mjs +7 -0
  143. package/lib/chunk-QSRAEUGZ.mjs +7 -0
  144. package/lib/chunk-QWT2C74M.mjs +7 -0
  145. package/lib/chunk-RAAANPPG.mjs +7 -0
  146. package/lib/chunk-RACDTRZA.mjs +7 -0
  147. package/lib/chunk-RFEO2KAN.mjs +7 -0
  148. package/lib/chunk-RH3N2H7P.mjs +7 -0
  149. package/lib/chunk-RSWDYIHY.mjs +37 -0
  150. package/lib/chunk-RSYICMZG.mjs +8 -0
  151. package/lib/chunk-SAR5622P.mjs +7 -0
  152. package/lib/chunk-SBIMVCXT.mjs +101 -0
  153. package/lib/chunk-SCKUIE3R.mjs +7 -0
  154. package/lib/chunk-SFURUNJM.mjs +7 -0
  155. package/lib/chunk-SIOZXPFG.mjs +7 -0
  156. package/lib/chunk-SRPWW4A2.mjs +10 -0
  157. package/lib/chunk-SRQDABQ2.mjs +15 -0
  158. package/lib/chunk-SVS6UMDU.mjs +323 -0
  159. package/lib/chunk-T63U4OZJ.mjs +7 -0
  160. package/lib/chunk-TBZMC2VV.mjs +11 -0
  161. package/lib/chunk-TEOLMRDO.mjs +7 -0
  162. package/lib/chunk-TLH7AD35.mjs +7 -0
  163. package/lib/chunk-TNXUU6W7.mjs +14 -0
  164. package/lib/chunk-TQX3PURV.mjs +7 -0
  165. package/lib/chunk-TUACWKIH.mjs +7 -0
  166. package/lib/chunk-TW3N6W5Z.mjs +7 -0
  167. package/lib/chunk-TYYOBZMU.mjs +10 -0
  168. package/lib/chunk-TZE3Y7IQ.mjs +7 -0
  169. package/lib/chunk-UNDIBZWG.mjs +7 -0
  170. package/lib/chunk-VGW4MXXZ.mjs +7 -0
  171. package/lib/chunk-VHI54FBK.mjs +441 -0
  172. package/lib/chunk-VXHDBYMI.mjs +7 -0
  173. package/lib/chunk-W7KFAY55.mjs +7 -0
  174. package/lib/chunk-WFEB5X4U.mjs +8 -0
  175. package/lib/chunk-WIO4XO4F.mjs +7 -0
  176. package/lib/chunk-WJY54JO7.mjs +13 -0
  177. package/lib/chunk-WR2GIKWE.mjs +7 -0
  178. package/lib/chunk-WRU5FJFC.mjs +7 -0
  179. package/lib/chunk-X2PY6MWZ.mjs +7 -0
  180. package/lib/chunk-X65MT4W3.mjs +7 -0
  181. package/lib/chunk-XBG5SP6Q.mjs +7 -0
  182. package/lib/chunk-XCA5AONB.mjs +7 -0
  183. package/lib/chunk-XEFDB2R4.mjs +7 -0
  184. package/lib/chunk-XETCPL7E.mjs +7 -0
  185. package/lib/chunk-Y5CGXLUB.mjs +7 -0
  186. package/lib/chunk-Y6J6QFI2.mjs +7 -0
  187. package/lib/chunk-YAZO75G2.mjs +8 -0
  188. package/lib/chunk-YBU4Z4QV.mjs +7 -0
  189. package/lib/chunk-YMJVMFPY.mjs +7 -0
  190. package/lib/chunk-YPSRZRIT.mjs +7 -0
  191. package/lib/chunk-YS4G22C2.mjs +7 -0
  192. package/lib/chunk-YW2SBL4Z.mjs +7 -0
  193. package/lib/chunk-YYZL7UGV.mjs +7 -0
  194. package/lib/chunk-Z7X534S4.mjs +10 -0
  195. package/lib/chunk-ZE6HKRR4.mjs +9 -0
  196. package/lib/chunk-ZHJP7L3K.mjs +7 -0
  197. package/lib/chunk-ZJKCWBRJ.mjs +7 -0
  198. package/lib/chunk-ZLZRU6MO.mjs +7 -0
  199. package/lib/chunk-ZOVSMN5C.mjs +7 -0
  200. package/lib/chunk-ZPYJPGDK.mjs +7 -0
  201. package/lib/chunk-ZQOZ4EFW.mjs +7 -0
  202. package/lib/chunk-ZUTYVST5.mjs +7 -0
  203. package/lib/chunk-ZXH4MBWP.mjs +7 -0
  204. package/lib/chunk-ZYEE34WO.mjs +7 -0
  205. package/lib/sandforge-autopilot.mjs +157 -0
  206. package/lib/sandforge-backup.mjs +99 -0
  207. package/lib/sandforge-checkpoint.mjs +353 -0
  208. package/lib/sandforge-cleanup.mjs +56 -0
  209. package/lib/sandforge-clone.mjs +7 -0
  210. package/lib/sandforge-compare.mjs +54 -0
  211. package/lib/sandforge-dataops.mjs +7 -0
  212. package/lib/sandforge-empty.mjs +140 -0
  213. package/lib/sandforge-env.mjs +355 -0
  214. package/lib/sandforge-frozen.mjs +263 -0
  215. package/lib/sandforge-mcp.mjs +40 -0
  216. package/lib/sandforge-monitor.mjs +43 -0
  217. package/lib/sandforge-seed.mjs +7 -0
  218. package/lib/sandforge-sync.mjs +7 -0
  219. package/lib/sandforge.mjs +28 -0
  220. package/package.json +52 -4
@@ -0,0 +1,8 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ import{b as kn}from"./chunk-CA5NAXSU.mjs";import{b as De,f as Sn,l as yt,u as Mn}from"./chunk-7EANH5PY.mjs";import{a as On,b as E,d as Tn}from"./chunk-NTOVCTRS.mjs";var Dn=E(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0})});var X=E(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.CronField=void 0;var gt=class n{#e=!1;#n=!1;#s=!1;#r=[];options={rawValue:""};static get min(){throw new Error("min must be overridden")}static get max(){throw new Error("max must be overridden")}static get chars(){return Object.freeze([])}static get validChars(){return/^[?,*\dH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}static get constraints(){return{min:this.min,max:this.max,chars:this.chars,validChars:this.validChars}}constructor(e,t={rawValue:""}){if(!Array.isArray(e))throw new Error(`${this.constructor.name} Validation error, values is not an array`);if(!(e.length>0))throw new Error(`${this.constructor.name} Validation error, values contains no values`);this.options={...t,rawValue:t.rawValue??""},this.#r=[...e].sort(n.sorter),this.#s=this.options.wildcard!==void 0?this.options.wildcard:this.#i(),this.#e=this.options.rawValue.includes("L")||e.includes("L"),this.#n=this.options.rawValue.includes("?")||e.includes("?")}get min(){return this.constructor.min}get max(){return this.constructor.max}get chars(){return this.constructor.chars}get hasLastChar(){return this.#e}get hasQuestionMarkChar(){return this.#n}get isWildcard(){return this.#s}get values(){return this.#r}static sorter(e,t){let r=typeof e=="number",s=typeof t=="number";return r&&s?e-t:!r&&!s?e.localeCompare(t):r?-1:1}static findNearestValueInList(e,t,r){if(r){for(let s=e.length-1;s>=0;s--)if(e[s]<t)return e[s];return null}for(let s=0;s<e.length;s++)if(e[s]>t)return e[s];return null}findNearestValue(e,t){return this.constructor.findNearestValueInList(this.values,e,t)}serialize(){return{wildcard:this.#s,values:this.#r}}validate(){let e,t=this.chars.length>0?` or chars ${this.chars.join("")}`:"",r=o=>u=>new RegExp(`^\\d{0,2}${u}$`).test(o),s=o=>(e=o,typeof o=="number"?o>=this.min&&o<=this.max:this.chars.some(r(o)));if(!this.#r.every(s))throw new Error(`${this.constructor.name} Validation error, got value ${e} expected range ${this.min}-${this.max}${t}`);let a=this.#r.find((o,u)=>this.#r.indexOf(o)!==u);if(a!==void 0)throw new Error(`${this.constructor.name} Validation error, duplicate values found: ${a}`)}#i(){return this.options.rawValue.length>0?["*","?"].includes(this.options.rawValue):Array.from({length:this.max-this.min+1},(e,t)=>t+this.min).every(e=>this.#r.includes(e))}};Re.CronField=gt});var ts=E(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});var B=class extends Error{},Et=class extends B{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Ct=class extends B{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Nt=class extends B{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},te=class extends B{},Pe=class extends B{constructor(e){super(`Invalid unit ${e}`)}},v=class extends B{},G=class extends B{constructor(){super("Zone is an abstract class")}},c="numeric",Y="short",W="long",Ye={year:c,month:c,day:c},nr={year:c,month:Y,day:c},Os={year:c,month:Y,day:c,weekday:Y},rr={year:c,month:W,day:c},sr={year:c,month:W,day:c,weekday:W},ir={hour:c,minute:c},ar={hour:c,minute:c,second:c},or={hour:c,minute:c,second:c,timeZoneName:Y},ur={hour:c,minute:c,second:c,timeZoneName:W},lr={hour:c,minute:c,hourCycle:"h23"},cr={hour:c,minute:c,second:c,hourCycle:"h23"},dr={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:Y},hr={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:W},fr={year:c,month:c,day:c,hour:c,minute:c},mr={year:c,month:c,day:c,hour:c,minute:c,second:c},yr={year:c,month:Y,day:c,hour:c,minute:c},gr={year:c,month:Y,day:c,hour:c,minute:c,second:c},Ts={year:c,month:Y,day:c,weekday:Y,hour:c,minute:c},wr={year:c,month:W,day:c,hour:c,minute:c,timeZoneName:Y},pr={year:c,month:W,day:c,hour:c,minute:c,second:c,timeZoneName:Y},Or={year:c,month:W,day:c,weekday:W,hour:c,minute:c,timeZoneName:W},Tr={year:c,month:W,day:c,weekday:W,hour:c,minute:c,second:c,timeZoneName:W},re=class{get type(){throw new G}get name(){throw new G}get ianaName(){return this.name}get isUniversal(){throw new G}offsetName(e,t){throw new G}formatOffset(e,t){throw new G}offset(e){throw new G}equals(e){throw new G}get isValid(){throw new G}},wt=null,xe=class n extends re{static get instance(){return wt===null&&(wt=new n),wt}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return xr(e,t,r)}formatOffset(e,t){return be(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}},It=new Map;function Ss(n){let e=It.get(n);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),It.set(n,e)),e}var Ms={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function ks(n,e){let t=n.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,s,i,a,o,u,l,d]=r;return[a,s,i,o,u,l,d]}function vs(n,e){let t=n.formatToParts(e),r=[];for(let s=0;s<t.length;s++){let{type:i,value:a}=t[s],o=Ms[i];i==="era"?r[o]=a:m(o)||(r[o]=parseInt(a,10))}return r}var pt=new Map,Q=class n extends re{static create(e){let t=pt.get(e);return t===void 0&&pt.set(e,t=new n(e)),t}static resetCache(){pt.clear(),It.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=n.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return xr(e,t,r,this.name)}formatOffset(e,t){return be(this.offset(e),t)}offset(e){if(!this.valid)return NaN;let t=new Date(e);if(isNaN(t))return NaN;let r=Ss(this.name),[s,i,a,o,u,l,d]=r.formatToParts?vs(r,t):ks(r,t);o==="BC"&&(s=-Math.abs(s)+1);let y=Ke({year:s,month:i,day:a,hour:u===24?0:u,minute:l,second:d,millisecond:0}),h=+t,p=h%1e3;return h-=p>=0?p:1e3+p,(y-h)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}},En={};function Ds(n,e={}){let t=JSON.stringify([n,e]),r=En[t];return r||(r=new Intl.ListFormat(n,e),En[t]=r),r}var bt=new Map;function xt(n,e={}){let t=JSON.stringify([n,e]),r=bt.get(t);return r===void 0&&(r=new Intl.DateTimeFormat(n,e),bt.set(t,r)),r}var Ft=new Map;function Es(n,e={}){let t=JSON.stringify([n,e]),r=Ft.get(t);return r===void 0&&(r=new Intl.NumberFormat(n,e),Ft.set(t,r)),r}var Vt=new Map;function Cs(n,e={}){let{base:t,...r}=e,s=JSON.stringify([n,r]),i=Vt.get(s);return i===void 0&&(i=new Intl.RelativeTimeFormat(n,e),Vt.set(s,i)),i}var Ce=null;function Ns(){return Ce||(Ce=new Intl.DateTimeFormat().resolvedOptions().locale,Ce)}var Wt=new Map;function Sr(n){let e=Wt.get(n);return e===void 0&&(e=new Intl.DateTimeFormat(n).resolvedOptions(),Wt.set(n,e)),e}var $t=new Map;function Is(n){let e=$t.get(n);if(!e){let t=new Intl.Locale(n);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...Mr,...e}),$t.set(n,e)}return e}function bs(n){let e=n.indexOf("-x-");e!==-1&&(n=n.substring(0,e));let t=n.indexOf("-u-");if(t===-1)return[n];{let r,s;try{r=xt(n).resolvedOptions(),s=n}catch{let u=n.substring(0,t);r=xt(u).resolvedOptions(),s=u}let{numberingSystem:i,calendar:a}=r;return[s,i,a]}}function xs(n,e,t){return(t||e)&&(n.includes("-u-")||(n+="-u"),t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function Fs(n){let e=[];for(let t=1;t<=12;t++){let r=T.utc(2009,t,1);e.push(n(r))}return e}function Vs(n){let e=[];for(let t=1;t<=7;t++){let r=T.utc(2016,11,13+t);e.push(n(r))}return e}function Ae(n,e,t,r){let s=n.listingMode();return s==="error"?null:s==="en"?t(e):r(e)}function Ws(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||Sr(n.locale).numberingSystem==="latn"}var Lt=class{constructor(e,t,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;let{padTo:s,floor:i,...a}=r;if(!t||Object.keys(a).length>0){let o={useGrouping:!1,...r};r.padTo>0&&(o.minimumIntegerDigits=r.padTo),this.inf=Es(e,o)}}format(e){if(this.inf){let t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{let t=this.floor?Math.floor(e):jt(e,3);return M(t,this.padTo)}}},Rt=class{constructor(e,t,r){this.opts=r,this.originalZone=void 0;let s;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let a=-1*(e.offset/60),o=a>=0?`Etc/GMT+${a}`:`Etc/GMT${a}`;e.offset!==0&&Q.create(o).valid?(s=o,this.dt=e):(s="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,s=e.zone.name):(s="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let i={...this.opts};i.timeZone=i.timeZone||s,this.dtf=xt(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){let r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:r}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},At=class{constructor(e,t,r){this.opts={style:"long",...r},!t&&Ir()&&(this.rtf=Cs(e,r))}format(e,t){return this.rtf?this.rtf.format(e,t):ti(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}},Mr={firstDay:1,minimalDays:4,weekend:[6,7]},w=class n{static fromOpts(e){return n.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,r,s,i=!1){let a=e||O.defaultLocale,o=a||(i?"en-US":Ns()),u=t||O.defaultNumberingSystem,l=r||O.defaultOutputCalendar,d=Ht(s)||O.defaultWeekSettings;return new n(o,u,l,d,a)}static resetCache(){Ce=null,bt.clear(),Ft.clear(),Vt.clear(),Wt.clear(),$t.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:r,weekSettings:s}={}){return n.create(e,t,r,s)}constructor(e,t,r,s,i){let[a,o,u]=bs(e);this.locale=a,this.numberingSystem=t||o||null,this.outputCalendar=r||u||null,this.weekSettings=s,this.intl=xs(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Ws(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:n.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Ht(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return Ae(this,e,Wr,()=>{let r=this.intl==="ja"||this.intl.startsWith("ja-");t&=!r;let s=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";if(!this.monthsCache[i][e]){let a=r?o=>this.dtFormatter(o,s).format():o=>this.extract(o,s,"month");this.monthsCache[i][e]=Fs(a)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return Ae(this,e,Rr,()=>{let r=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},s=t?"format":"standalone";return this.weekdaysCache[s][e]||(this.weekdaysCache[s][e]=Vs(i=>this.extract(i,r,"weekday"))),this.weekdaysCache[s][e]})}meridiems(){return Ae(this,void 0,()=>Ar,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[T.utc(2016,11,13,9),T.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Ae(this,e,_r,()=>{let t={era:e};return this.eraCache[e]||(this.eraCache[e]=[T.utc(-40,1,1),T.utc(2017,1,1)].map(r=>this.extract(r,t,"era"))),this.eraCache[e]})}extract(e,t,r){let s=this.dtFormatter(e,t),i=s.formatToParts(),a=i.find(o=>o.type.toLowerCase()===r);return a?a.value:null}numberFormatter(e={}){return new Lt(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Rt(e,this.intl,t)}relFormatter(e={}){return new At(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Ds(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||Sr(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:br()?Is(this.locale):Mr}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}},Ot=null,$=class n extends re{static get utcInstance(){return Ot===null&&(Ot=new n(0)),Ot}static instance(e){return e===0?n.utcInstance:new n(e)}static parseSpecifier(e){if(e){let t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new n(et(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${be(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${be(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return be(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}},je=class extends re{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function ee(n,e){if(m(n)||n===null)return e;if(n instanceof re)return n;if(Hs(n)){let t=n.toLowerCase();return t==="default"?e:t==="local"||t==="system"?xe.instance:t==="utc"||t==="gmt"?$.utcInstance:$.parseSpecifier(t)||Q.create(n)}else return ne(n)?$.instance(n):typeof n=="object"&&"offset"in n&&typeof n.offset=="function"?n:new je(n)}var Zt={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},Cn={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},$s=Zt.hanidec.replace(/[\[|\]]/g,"").split("");function Ls(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t<n.length;t++){let r=n.charCodeAt(t);if(n[t].search(Zt.hanidec)!==-1)e+=$s.indexOf(n[t]);else for(let s in Cn){let[i,a]=Cn[s];r>=i&&r<=a&&(e+=r-i)}}return parseInt(e,10)}else return e}var _t=new Map;function Rs(){_t.clear()}function q({numberingSystem:n},e=""){let t=n||"latn",r=_t.get(t);r===void 0&&(r=new Map,_t.set(t,r));let s=r.get(e);return s===void 0&&(s=new RegExp(`${Zt[t]}${e}`),r.set(e,s)),s}var Nn=()=>Date.now(),In="system",bn=null,xn=null,Fn=null,Vn=60,Wn,$n=null,O=class{static get now(){return Nn}static set now(e){Nn=e}static set defaultZone(e){In=e}static get defaultZone(){return ee(In,xe.instance)}static get defaultLocale(){return bn}static set defaultLocale(e){bn=e}static get defaultNumberingSystem(){return xn}static set defaultNumberingSystem(e){xn=e}static get defaultOutputCalendar(){return Fn}static set defaultOutputCalendar(e){Fn=e}static get defaultWeekSettings(){return $n}static set defaultWeekSettings(e){$n=Ht(e)}static get twoDigitCutoffYear(){return Vn}static set twoDigitCutoffYear(e){Vn=e%100}static get throwOnInvalid(){return Wn}static set throwOnInvalid(e){Wn=e}static resetCaches(){w.resetCache(),Q.resetCache(),T.resetCache(),Rs()}},V=class{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},kr=[0,31,59,90,120,151,181,212,243,273,304,334],vr=[0,31,60,91,121,152,182,213,244,274,305,335];function A(n,e){return new V("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function qt(n,e,t){let r=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);let s=r.getUTCDay();return s===0?7:s}function Dr(n,e,t){return t+(Ve(n)?vr:kr)[e-1]}function Er(n,e){let t=Ve(n)?vr:kr,r=t.findIndex(i=>i<e),s=e-t[r];return{month:r+1,day:s}}function Pt(n,e){return(n-e+7)%7+1}function Ge(n,e=4,t=1){let{year:r,month:s,day:i}=n,a=Dr(r,s,i),o=Pt(qt(r,s,i),t),u=Math.floor((a-o+14-e)/7),l;return u<1?(l=r-1,u=Fe(l,e,t)):u>Fe(r,e,t)?(l=r+1,u=1):l=r,{weekYear:l,weekNumber:u,weekday:o,...tt(n)}}function Ln(n,e=4,t=1){let{weekYear:r,weekNumber:s,weekday:i}=n,a=Pt(qt(r,1,e),t),o=ye(r),u=s*7+i-a-7+e,l;u<1?(l=r-1,u+=ye(l)):u>o?(l=r+1,u-=ye(r)):l=r;let{month:d,day:f}=Er(l,u);return{year:l,month:d,day:f,...tt(n)}}function Tt(n){let{year:e,month:t,day:r}=n,s=Dr(e,t,r);return{year:e,ordinal:s,...tt(n)}}function Rn(n){let{year:e,ordinal:t}=n,{month:r,day:s}=Er(e,t);return{year:e,month:r,day:s,...tt(n)}}function An(n,e){if(!m(n.localWeekday)||!m(n.localWeekNumber)||!m(n.localWeekYear)){if(!m(n.weekday)||!m(n.weekNumber)||!m(n.weekYear))throw new te("Cannot mix locale-based week fields with ISO-based week fields");return m(n.localWeekday)||(n.weekday=n.localWeekday),m(n.localWeekNumber)||(n.weekNumber=n.localWeekNumber),m(n.localWeekYear)||(n.weekYear=n.localWeekYear),delete n.localWeekday,delete n.localWeekNumber,delete n.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function As(n,e=4,t=1){let r=Xe(n.weekYear),s=_(n.weekNumber,1,Fe(n.weekYear,e,t)),i=_(n.weekday,1,7);return r?s?i?!1:A("weekday",n.weekday):A("week",n.weekNumber):A("weekYear",n.weekYear)}function _s(n){let e=Xe(n.year),t=_(n.ordinal,1,ye(n.year));return e?t?!1:A("ordinal",n.ordinal):A("year",n.year)}function Cr(n){let e=Xe(n.year),t=_(n.month,1,12),r=_(n.day,1,Je(n.year,n.month));return e?t?r?!1:A("day",n.day):A("month",n.month):A("year",n.year)}function Nr(n){let{hour:e,minute:t,second:r,millisecond:s}=n,i=_(e,0,23)||e===24&&t===0&&r===0&&s===0,a=_(t,0,59),o=_(r,0,59),u=_(s,0,999);return i?a?o?u?!1:A("millisecond",s):A("second",r):A("minute",t):A("hour",e)}function m(n){return typeof n>"u"}function ne(n){return typeof n=="number"}function Xe(n){return typeof n=="number"&&n%1===0}function Hs(n){return typeof n=="string"}function zs(n){return Object.prototype.toString.call(n)==="[object Date]"}function Ir(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function br(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Us(n){return Array.isArray(n)?n:[n]}function _n(n,e,t){if(n.length!==0)return n.reduce((r,s)=>{let i=[e(s),s];return r&&t(r[0],i[0])===r[0]?r:i},null)[1]}function Zs(n,e){return e.reduce((t,r)=>(t[r]=n[r],t),{})}function we(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function Ht(n){if(n==null)return null;if(typeof n!="object")throw new v("Week settings must be an object");if(!_(n.firstDay,1,7)||!_(n.minimalDays,1,7)||!Array.isArray(n.weekend)||n.weekend.some(e=>!_(e,1,7)))throw new v("Invalid week settings");return{firstDay:n.firstDay,minimalDays:n.minimalDays,weekend:Array.from(n.weekend)}}function _(n,e,t){return Xe(n)&&n>=e&&n<=t}function qs(n,e){return n-e*Math.floor(n/e)}function M(n,e=2){let t=n<0,r;return t?r="-"+(""+-n).padStart(e,"0"):r=(""+n).padStart(e,"0"),r}function K(n){if(!(m(n)||n===null||n===""))return parseInt(n,10)}function ie(n){if(!(m(n)||n===null||n===""))return parseFloat(n)}function Yt(n){if(!(m(n)||n===null||n==="")){let e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function jt(n,e,t="round"){let r=10**e;switch(t){case"expand":return n>0?Math.ceil(n*r)/r:Math.floor(n*r)/r;case"trunc":return Math.trunc(n*r)/r;case"round":return Math.round(n*r)/r;case"floor":return Math.floor(n*r)/r;case"ceil":return Math.ceil(n*r)/r;default:throw new RangeError(`Value rounding ${t} is out of range`)}}function Ve(n){return n%4===0&&(n%100!==0||n%400===0)}function ye(n){return Ve(n)?366:365}function Je(n,e){let t=qs(e-1,12)+1,r=n+(e-t)/12;return t===2?Ve(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Ke(n){let e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(n.year,n.month-1,n.day)),+e}function Hn(n,e,t){return-Pt(qt(n,1,e),t)+e-1}function Fe(n,e=4,t=1){let r=Hn(n,e,t),s=Hn(n+1,e,t);return(ye(n)-r+s)/7}function zt(n){return n>99?n:n>O.twoDigitCutoffYear?1900+n:2e3+n}function xr(n,e,t,r=null){let s=new Date(n),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(i.timeZone=r);let a={timeZoneName:e,...i},o=new Intl.DateTimeFormat(t,a).formatToParts(s).find(u=>u.type.toLowerCase()==="timezonename");return o?o.value:null}function et(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);let r=parseInt(e,10)||0,s=t<0||Object.is(t,-0)?-r:r;return t*60+s}function Fr(n){let e=Number(n);if(typeof n=="boolean"||n===""||!Number.isFinite(e))throw new v(`Invalid unit value ${n}`);return e}function Be(n,e){let t={};for(let r in n)if(we(n,r)){let s=n[r];if(s==null)continue;t[e(r)]=Fr(s)}return t}function be(n,e){let t=Math.trunc(Math.abs(n/60)),r=Math.trunc(Math.abs(n%60)),s=n>=0?"+":"-";switch(e){case"short":return`${s}${M(t,2)}:${M(r,2)}`;case"narrow":return`${s}${t}${r>0?`:${r}`:""}`;case"techie":return`${s}${M(t,2)}${M(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function tt(n){return Zs(n,["hour","minute","second","millisecond"])}var Ps=["January","February","March","April","May","June","July","August","September","October","November","December"],Vr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ys=["J","F","M","A","M","J","J","A","S","O","N","D"];function Wr(n){switch(n){case"narrow":return[...Ys];case"short":return[...Vr];case"long":return[...Ps];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var $r=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Lr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],js=["M","T","W","T","F","S","S"];function Rr(n){switch(n){case"narrow":return[...js];case"short":return[...Lr];case"long":return[...$r];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var Ar=["AM","PM"],Gs=["Before Christ","Anno Domini"],Js=["BC","AD"],Bs=["B","A"];function _r(n){switch(n){case"narrow":return[...Bs];case"short":return[...Js];case"long":return[...Gs];default:return null}}function Qs(n){return Ar[n.hour<12?0:1]}function Xs(n,e){return Rr(e)[n.weekday-1]}function Ks(n,e){return Wr(e)[n.month-1]}function ei(n,e){return _r(e)[n.year<0?0:1]}function ti(n,e,t="always",r=!1){let s={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&i){let f=n==="days";switch(e){case 1:return f?"tomorrow":`next ${s[n][0]}`;case-1:return f?"yesterday":`last ${s[n][0]}`;case 0:return f?"today":`this ${s[n][0]}`}}let a=Object.is(e,-0)||e<0,o=Math.abs(e),u=o===1,l=s[n],d=r?u?l[1]:l[2]||l[1]:u?s[n][0]:n;return a?`${o} ${d} ago`:`in ${o} ${d}`}function zn(n,e){let t="";for(let r of n)r.literal?t+=r.val:t+=e(r.val);return t}var ni={D:Ye,DD:nr,DDD:rr,DDDD:sr,t:ir,tt:ar,ttt:or,tttt:ur,T:lr,TT:cr,TTT:dr,TTTT:hr,f:fr,ff:yr,fff:wr,ffff:Or,F:mr,FF:gr,FFF:pr,FFFF:Tr},F=class n{static create(e,t={}){return new n(e,t)}static parseFormat(e){let t=null,r="",s=!1,i=[];for(let a=0;a<e.length;a++){let o=e.charAt(a);o==="'"?((r.length>0||s)&&i.push({literal:s||/^\s+$/.test(r),val:r===""?"'":r}),t=null,r="",s=!s):s||o===t?r+=o:(r.length>0&&i.push({literal:/^\s+$/.test(r),val:r}),r=o,t=o)}return r.length>0&&i.push({literal:s||/^\s+$/.test(r),val:r}),i}static macroTokenToFormatOpts(e){return ni[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,r=void 0){if(this.opts.forceSimple)return M(e,t);let s={...this.opts};return t>0&&(s.padTo=t),r&&(s.signDisplay=r),this.loc.numberFormatter(s).format(e)}formatDateTimeFromString(e,t){let r=this.loc.listingMode()==="en",s=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(h,p)=>this.loc.extract(e,h,p),a=h=>e.isOffsetFixed&&e.offset===0&&h.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,h.format):"",o=()=>r?Qs(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(h,p)=>r?Ks(e,h):i(p?{month:h}:{month:h,day:"numeric"},"month"),l=(h,p)=>r?Xs(e,h):i(p?{weekday:h}:{weekday:h,month:"long",day:"numeric"},"weekday"),d=h=>{let p=n.macroTokenToFormatOpts(h);return p?this.formatWithSystemDefault(e,p):h},f=h=>r?ei(e,h):i({era:h},"era"),y=h=>{switch(h){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return a({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return a({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return a({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return o();case"d":return s?i({day:"numeric"},"day"):this.num(e.day);case"dd":return s?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return s?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return s?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return u("short",!0);case"LLLL":return u("long",!0);case"LLLLL":return u("narrow",!0);case"M":return s?i({month:"numeric"},"month"):this.num(e.month);case"MM":return s?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return u("short",!1);case"MMMM":return u("long",!1);case"MMMMM":return u("narrow",!1);case"y":return s?i({year:"numeric"},"year"):this.num(e.year);case"yy":return s?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return s?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return s?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return f("short");case"GG":return f("long");case"GGGGG":return f("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return d(h)}};return zn(n.parseFormat(t),y)}formatDurationFromString(e,t){let r=this.opts.signMode==="negativeLargestOnly"?-1:1,s=d=>{switch(d[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},i=(d,f)=>y=>{let h=s(y);if(h){let p=f.isNegativeDuration&&h!==f.largestUnit?r:1,x;return this.opts.signMode==="negativeLargestOnly"&&h!==f.largestUnit?x="never":this.opts.signMode==="all"?x="always":x="auto",this.num(d.get(h)*p,y.length,x)}else return y},a=n.parseFormat(t),o=a.reduce((d,{literal:f,val:y})=>f?d:d.concat(y),[]),u=e.shiftTo(...o.map(s).filter(d=>d)),l={isNegativeDuration:u<0,largestUnit:Object.keys(u.values)[0]};return zn(a,i(u,l))}},Hr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function pe(...n){let e=n.reduce((t,r)=>t+r.source,"");return RegExp(`^${e}$`)}function Oe(...n){return e=>n.reduce(([t,r,s],i)=>{let[a,o,u]=i(e,s);return[{...t,...a},o||r,u]},[{},null,1]).slice(0,2)}function Te(n,...e){if(n==null)return[null,null];for(let[t,r]of e){let s=t.exec(n);if(s)return r(s)}return[null,null]}function zr(...n){return(e,t)=>{let r={},s;for(s=0;s<n.length;s++)r[n[s]]=K(e[t+s]);return[r,null,t+s]}}var Ur=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,ri=`(?:${Ur.source}?(?:\\[(${Hr.source})\\])?)?`,Gt=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Zr=RegExp(`${Gt.source}${ri}`),Jt=RegExp(`(?:[Tt]${Zr.source})?`),si=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,ii=/(\d{4})-?W(\d\d)(?:-?(\d))?/,ai=/(\d{4})-?(\d{3})/,oi=zr("weekYear","weekNumber","weekDay"),ui=zr("year","ordinal"),li=/(\d{4})-(\d\d)-(\d\d)/,qr=RegExp(`${Gt.source} ?(?:${Ur.source}|(${Hr.source}))?`),ci=RegExp(`(?: ${qr.source})?`);function ge(n,e,t){let r=n[e];return m(r)?t:K(r)}function di(n,e){return[{year:ge(n,e),month:ge(n,e+1,1),day:ge(n,e+2,1)},null,e+3]}function Se(n,e){return[{hours:ge(n,e,0),minutes:ge(n,e+1,0),seconds:ge(n,e+2,0),milliseconds:Yt(n[e+3])},null,e+4]}function We(n,e){let t=!n[e]&&!n[e+1],r=et(n[e+1],n[e+2]),s=t?null:$.instance(r);return[{},s,e+3]}function $e(n,e){let t=n[e]?Q.create(n[e]):null;return[{},t,e+1]}var hi=RegExp(`^T?${Gt.source}$`),fi=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function mi(n){let[e,t,r,s,i,a,o,u,l]=n,d=e[0]==="-",f=u&&u[0]==="-",y=(h,p=!1)=>h!==void 0&&(p||h&&d)?-h:h;return[{years:y(ie(t)),months:y(ie(r)),weeks:y(ie(s)),days:y(ie(i)),hours:y(ie(a)),minutes:y(ie(o)),seconds:y(ie(u),u==="-0"),milliseconds:y(Yt(l),f)}]}var yi={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Bt(n,e,t,r,s,i,a){let o={year:e.length===2?zt(K(e)):K(e),month:Vr.indexOf(t)+1,day:K(r),hour:K(s),minute:K(i)};return a&&(o.second=K(a)),n&&(o.weekday=n.length>3?$r.indexOf(n)+1:Lr.indexOf(n)+1),o}var gi=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function wi(n){let[,e,t,r,s,i,a,o,u,l,d,f]=n,y=Bt(e,s,r,t,i,a,o),h;return u?h=yi[u]:l?h=0:h=et(d,f),[y,new $(h)]}function pi(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var Oi=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Ti=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Si=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Un(n){let[,e,t,r,s,i,a,o]=n;return[Bt(e,s,r,t,i,a,o),$.utcInstance]}function Mi(n){let[,e,t,r,s,i,a,o]=n;return[Bt(e,o,t,r,s,i,a),$.utcInstance]}var ki=pe(si,Jt),vi=pe(ii,Jt),Di=pe(ai,Jt),Ei=pe(Zr),Pr=Oe(di,Se,We,$e),Ci=Oe(oi,Se,We,$e),Ni=Oe(ui,Se,We,$e),Ii=Oe(Se,We,$e);function bi(n){return Te(n,[ki,Pr],[vi,Ci],[Di,Ni],[Ei,Ii])}function xi(n){return Te(pi(n),[gi,wi])}function Fi(n){return Te(n,[Oi,Un],[Ti,Un],[Si,Mi])}function Vi(n){return Te(n,[fi,mi])}var Wi=Oe(Se);function $i(n){return Te(n,[hi,Wi])}var Li=pe(li,ci),Ri=pe(qr),Ai=Oe(Se,We,$e);function _i(n){return Te(n,[Li,Pr],[Ri,Ai])}var Zn="Invalid Duration",Yr={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Hi={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...Yr},R=146097/400,he=146097/4800,zi={years:{quarters:4,months:12,weeks:R/7,days:R,hours:R*24,minutes:R*24*60,seconds:R*24*60*60,milliseconds:R*24*60*60*1e3},quarters:{months:3,weeks:R/28,days:R/4,hours:R*24/4,minutes:R*24*60/4,seconds:R*24*60*60/4,milliseconds:R*24*60*60*1e3/4},months:{weeks:he/7,days:he,hours:he*24,minutes:he*24*60,seconds:he*24*60*60,milliseconds:he*24*60*60*1e3},...Yr},oe=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Ui=oe.slice(0).reverse();function J(n,e,t=!1){let r={values:t?e.values:{...n.values,...e.values||{}},loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy,matrix:e.matrix||n.matrix};return new k(r)}function jr(n,e){var t;let r=(t=e.milliseconds)!=null?t:0;for(let s of Ui.slice(1))e[s]&&(r+=e[s]*n[s].milliseconds);return r}function qn(n,e){let t=jr(n,e)<0?-1:1;oe.reduceRight((r,s)=>{if(m(e[s]))return r;if(r){let i=e[r]*t,a=n[s][r],o=Math.floor(i/a);e[s]+=o*t,e[r]-=o*a*t}return s},null),oe.reduce((r,s)=>{if(m(e[s]))return r;if(r){let i=e[r]%1;e[r]-=i,e[s]+=i*n[r][s]}return s},null)}function Pn(n){let e={};for(let[t,r]of Object.entries(n))r!==0&&(e[t]=r);return e}var k=class n{constructor(e){let t=e.conversionAccuracy==="longterm"||!1,r=t?zi:Hi;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||w.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,t){return n.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new v(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new n({values:Be(e,n.normalizeUnit),loc:w.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(ne(e))return n.fromMillis(e);if(n.isDuration(e))return e;if(typeof e=="object")return n.fromObject(e);throw new v(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){let[r]=Vi(e);return r?n.fromObject(r,t):n.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){let[r]=$i(e);return r?n.fromObject(r,t):n.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new v("need to specify a reason the Duration is invalid");let r=e instanceof V?e:new V(e,t);if(O.throwOnInvalid)throw new Nt(r);return new n({invalid:r})}static normalizeUnit(e){let t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Pe(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){let r={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?F.create(this.loc,r).formatDurationFromString(this,e):Zn}toHuman(e={}){if(!this.isValid)return Zn;let t=e.showZeros!==!1,r=oe.map(s=>{let i=this.values[s];return m(i)||i===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:s.slice(0,-1)}).format(i)}).filter(s=>s);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=jt(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},T.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?jr(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let t=n.fromDurationLike(e),r={};for(let s of oe)(we(t.values,s)||we(this.values,s))&&(r[s]=t.get(s)+this.get(s));return J(this,{values:r},!0)}minus(e){if(!this.isValid)return this;let t=n.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;let t={};for(let r of Object.keys(this.values))t[r]=Fr(e(this.values[r],r));return J(this,{values:t},!0)}get(e){return this[n.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let t={...this.values,...Be(e,n.normalizeUnit)};return J(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:r,matrix:s}={}){let a={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:s,conversionAccuracy:r};return J(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return qn(this.matrix,e),J(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Pn(this.normalize().shiftToAll().toObject());return J(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(a=>n.normalizeUnit(a));let t={},r={},s=this.toObject(),i;for(let a of oe)if(e.indexOf(a)>=0){i=a;let o=0;for(let l in r)o+=this.matrix[l][a]*r[l],r[l]=0;ne(s[a])&&(o+=s[a]);let u=Math.trunc(o);t[a]=u,r[a]=(o*1e3-u*1e3)/1e3}else ne(s[a])&&(r[a]=s[a]);for(let a in r)r[a]!==0&&(t[i]+=a===i?r[a]:r[a]/this.matrix[i][a]);return qn(this.matrix,t),J(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return J(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;let e=Pn(this.values);return J(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(r,s){return r===void 0||r===0?s===void 0||s===0:r===s}for(let r of oe)if(!t(this.values[r],e.values[r]))return!1;return!0}},fe="Invalid Interval";function Zi(n,e){return!n||!n.isValid?le.invalid("missing or invalid start"):!e||!e.isValid?le.invalid("missing or invalid end"):e<n?le.invalid("end before start",`The end of an interval must be after its start, but you had start=${n.toISO()} and end=${e.toISO()}`):null}var le=class n{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new v("need to specify a reason the Interval is invalid");let r=e instanceof V?e:new V(e,t);if(O.throwOnInvalid)throw new Ct(r);return new n({invalid:r})}static fromDateTimes(e,t){let r=Ee(e),s=Ee(t),i=Zi(r,s);return i??new n({start:r,end:s})}static after(e,t){let r=k.fromDurationLike(t),s=Ee(e);return n.fromDateTimes(s,s.plus(r))}static before(e,t){let r=k.fromDurationLike(t),s=Ee(e);return n.fromDateTimes(s.minus(r),s)}static fromISO(e,t){let[r,s]=(e||"").split("/",2);if(r&&s){let i,a;try{i=T.fromISO(r,t),a=i.isValid}catch{a=!1}let o,u;try{o=T.fromISO(s,t),u=o.isValid}catch{u=!1}if(a&&u)return n.fromDateTimes(i,o);if(a){let l=k.fromISO(s,t);if(l.isValid)return n.after(i,l)}else if(u){let l=k.fromISO(r,t);if(l.isValid)return n.before(o,l)}}return n.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;let r=this.start.startOf(e,t),s;return t!=null&&t.useLocaleWeeks?s=this.end.reconfigure({locale:r.locale}):s=this.end,s=s.startOf(e,t),Math.floor(s.diff(r,e).get(e))+(s.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?n.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];let t=e.map(Ee).filter(a=>this.contains(a)).sort((a,o)=>a.toMillis()-o.toMillis()),r=[],{s}=this,i=0;for(;s<this.e;){let a=t[i]||this.e,o=+a>+this.e?this.e:a;r.push(n.fromDateTimes(s,o)),s=o,i+=1}return r}splitBy(e){let t=k.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:r}=this,s=1,i,a=[];for(;r<this.e;){let o=this.start.plus(t.mapUnits(u=>u*s));i=+o>+this.e?this.e:o,a.push(n.fromDateTimes(r,i)),r=i,s+=1}return a}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let t=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return t>=r?null:n.fromDateTimes(t,r)}union(e){if(!this.isValid)return this;let t=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return n.fromDateTimes(t,r)}static merge(e){let[t,r]=e.sort((s,i)=>s.s-i.s).reduce(([s,i],a)=>i?i.overlaps(a)||i.abutsStart(a)?[s,i.union(a)]:[s.concat([i]),a]:[s,a],[[],null]);return r&&t.push(r),t}static xor(e){let t=null,r=0,s=[],i=e.map(u=>[{time:u.s,type:"s"},{time:u.e,type:"e"}]),a=Array.prototype.concat(...i),o=a.sort((u,l)=>u.time-l.time);for(let u of o)r+=u.type==="s"?1:-1,r===1?t=u.time:(t&&+t!=+u.time&&s.push(n.fromDateTimes(t,u.time)),t=null);return n.merge(s)}difference(...e){return n.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:fe}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Ye,t={}){return this.isValid?F.create(this.s.loc.clone(t),e).formatInterval(this):fe}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:fe}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:fe}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:fe}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:fe}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):k.invalid(this.invalidReason)}mapEndpoints(e){return n.fromDateTimes(e(this.s),e(this.e))}},ue=class{static hasDST(e=O.defaultZone){let t=T.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Q.isValidZone(e)}static normalizeZone(e){return ee(e,O.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||w.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||w.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||w.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:r=null,locObj:s=null,outputCalendar:i="gregory"}={}){return(s||w.create(t,r,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:s=null,outputCalendar:i="gregory"}={}){return(s||w.create(t,r,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:r=null,locObj:s=null}={}){return(s||w.create(t,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:s=null}={}){return(s||w.create(t,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return w.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return w.create(t,null,"gregory").eras(e)}static features(){return{relative:Ir(),localeWeek:br()}}};function Yn(n,e){let t=s=>s.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=t(e)-t(n);return Math.floor(k.fromMillis(r).as("days"))}function qi(n,e,t){let r=[["years",(u,l)=>l.year-u.year],["quarters",(u,l)=>l.quarter-u.quarter+(l.year-u.year)*4],["months",(u,l)=>l.month-u.month+(l.year-u.year)*12],["weeks",(u,l)=>{let d=Yn(u,l);return(d-d%7)/7}],["days",Yn]],s={},i=n,a,o;for(let[u,l]of r)t.indexOf(u)>=0&&(a=u,s[u]=l(n,e),o=i.plus(s),o>e?(s[u]--,n=i.plus(s),n>e&&(o=n,s[u]--,n=i.plus(s))):n=o);return[n,s,o,a]}function Pi(n,e,t,r){let[s,i,a,o]=qi(n,e,t),u=e-s,l=t.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);l.length===0&&(a<e&&(a=s.plus({[o]:1})),a!==s&&(i[o]=(i[o]||0)+u/(a-s)));let d=k.fromObject(i,r);return l.length>0?k.fromMillis(u,r).shiftTo(...l).plus(d):d}var Yi="missing Intl.DateTimeFormat.formatToParts support";function g(n,e=t=>t){return{regex:n,deser:([t])=>e(Ls(t))}}var ji="\xA0",Gr=`[ ${ji}]`,Jr=new RegExp(Gr,"g");function Gi(n){return n.replace(/\./g,"\\.?").replace(Jr,Gr)}function jn(n){return n.replace(/\./g,"").replace(Jr," ").toLowerCase()}function P(n,e){return n===null?null:{regex:RegExp(n.map(Gi).join("|")),deser:([t])=>n.findIndex(r=>jn(t)===jn(r))+e}}function Gn(n,e){return{regex:n,deser:([,t,r])=>et(t,r),groups:e}}function _e(n){return{regex:n,deser:([e])=>e}}function Ji(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Bi(n,e){let t=q(e),r=q(e,"{2}"),s=q(e,"{3}"),i=q(e,"{4}"),a=q(e,"{6}"),o=q(e,"{1,2}"),u=q(e,"{1,3}"),l=q(e,"{1,6}"),d=q(e,"{1,9}"),f=q(e,"{2,4}"),y=q(e,"{4,6}"),h=j=>({regex:RegExp(Ji(j.val)),deser:([de])=>de,literal:!0}),x=(j=>{if(n.literal)return h(j);switch(j.val){case"G":return P(e.eras("short"),0);case"GG":return P(e.eras("long"),0);case"y":return g(l);case"yy":return g(f,zt);case"yyyy":return g(i);case"yyyyy":return g(y);case"yyyyyy":return g(a);case"M":return g(o);case"MM":return g(r);case"MMM":return P(e.months("short",!0),1);case"MMMM":return P(e.months("long",!0),1);case"L":return g(o);case"LL":return g(r);case"LLL":return P(e.months("short",!1),1);case"LLLL":return P(e.months("long",!1),1);case"d":return g(o);case"dd":return g(r);case"o":return g(u);case"ooo":return g(s);case"HH":return g(r);case"H":return g(o);case"hh":return g(r);case"h":return g(o);case"mm":return g(r);case"m":return g(o);case"q":return g(o);case"qq":return g(r);case"s":return g(o);case"ss":return g(r);case"S":return g(u);case"SSS":return g(s);case"u":return _e(d);case"uu":return _e(o);case"uuu":return g(t);case"a":return P(e.meridiems(),0);case"kkkk":return g(i);case"kk":return g(f,zt);case"W":return g(o);case"WW":return g(r);case"E":case"c":return g(t);case"EEE":return P(e.weekdays("short",!1),1);case"EEEE":return P(e.weekdays("long",!1),1);case"ccc":return P(e.weekdays("short",!0),1);case"cccc":return P(e.weekdays("long",!0),1);case"Z":case"ZZ":return Gn(new RegExp(`([+-]${o.source})(?::(${r.source}))?`),2);case"ZZZ":return Gn(new RegExp(`([+-]${o.source})(${r.source})?`),2);case"z":return _e(/[a-z_+-/]{1,256}?/i);case" ":return _e(/[^\S\n\r]/);default:return h(j)}})(n)||{invalidReason:Yi};return x.token=n,x}var Qi={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function Xi(n,e,t){let{type:r,value:s}=n;if(r==="literal"){let u=/^\s+$/.test(s);return{literal:!u,val:u?" ":s}}let i=e[r],a=r;r==="hour"&&(e.hour12!=null?a=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?a="hour12":a="hour24":a=t.hour12?"hour12":"hour24");let o=Qi[a];if(typeof o=="object"&&(o=o[i]),o)return{literal:!1,val:o}}function Ki(n){return[`^${n.map(t=>t.regex).reduce((t,r)=>`${t}(${r.source})`,"")}$`,n]}function ea(n,e,t){let r=n.match(e);if(r){let s={},i=1;for(let a in t)if(we(t,a)){let o=t[a],u=o.groups?o.groups+1:1;!o.literal&&o.token&&(s[o.token.val[0]]=o.deser(r.slice(i,i+u))),i+=u}return[r,s]}else return[r,{}]}function ta(n){let e=i=>{switch(i){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},t=null,r;return m(n.z)||(t=Q.create(n.z)),m(n.Z)||(t||(t=new $(n.Z)),r=n.Z),m(n.q)||(n.M=(n.q-1)*3+1),m(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),m(n.u)||(n.S=Yt(n.u)),[Object.keys(n).reduce((i,a)=>{let o=e(a);return o&&(i[o]=n[a]),i},{}),t,r]}var St=null;function na(){return St||(St=T.fromMillis(1555555555555)),St}function ra(n,e){if(n.literal)return n;let t=F.macroTokenToFormatOpts(n.val),r=Xr(t,e);return r==null||r.includes(void 0)?n:r}function Br(n,e){return Array.prototype.concat(...n.map(t=>ra(t,e)))}var Qe=class{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=Br(F.parseFormat(t),e),this.units=this.tokens.map(r=>Bi(r,e)),this.disqualifyingUnit=this.units.find(r=>r.invalidReason),!this.disqualifyingUnit){let[r,s]=Ki(this.units);this.regex=RegExp(r,"i"),this.handlers=s}}explainFromTokens(e){if(this.isValid){let[t,r]=ea(e,this.regex,this.handlers),[s,i,a]=r?ta(r):[null,null,void 0];if(we(r,"a")&&we(r,"H"))throw new te("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:r,result:s,zone:i,specificOffset:a}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function Qr(n,e,t){return new Qe(n,t).explainFromTokens(e)}function sa(n,e,t){let{result:r,zone:s,specificOffset:i,invalidReason:a}=Qr(n,e,t);return[r,s,i,a]}function Xr(n,e){if(!n)return null;let r=F.create(e,n).dtFormatter(na()),s=r.formatToParts(),i=r.resolvedOptions();return s.map(a=>Xi(a,n,i))}var Mt="Invalid DateTime",Jn=864e13;function Ne(n){return new V("unsupported zone",`the zone "${n.name}" is not supported`)}function kt(n){return n.weekData===null&&(n.weekData=Ge(n.c)),n.weekData}function vt(n){return n.localWeekData===null&&(n.localWeekData=Ge(n.c,n.loc.getMinDaysInFirstWeek(),n.loc.getStartOfWeek())),n.localWeekData}function ae(n,e){let t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new T({...t,...e,old:t})}function Kr(n,e,t){let r=n-e*60*1e3,s=t.offset(r);if(e===s)return[r,e];r-=(s-e)*60*1e3;let i=t.offset(r);return s===i?[r,s]:[n-Math.min(s,i)*60*1e3,Math.max(s,i)]}function He(n,e){n+=e*60*1e3;let t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Ue(n,e,t){return Kr(Ke(n),e,t)}function Bn(n,e){let t=n.o,r=n.c.year+Math.trunc(e.years),s=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...n.c,year:r,month:s,day:Math.min(n.c.day,Je(r,s))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=k.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),o=Ke(i),[u,l]=Kr(o,t,n.zone);return a!==0&&(u+=a,l=n.zone.offset(u)),{ts:u,o:l}}function me(n,e,t,r,s,i){let{setZone:a,zone:o}=t;if(n&&Object.keys(n).length!==0||e){let u=e||o,l=T.fromObject(n,{...t,zone:u,specificOffset:i});return a?l:l.setZone(o)}else return T.invalid(new V("unparsable",`the input "${s}" can't be parsed as ${r}`))}function ze(n,e,t=!0){return n.isValid?F.create(w.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function Dt(n,e,t){let r=n.c.year>9999||n.c.year<0,s="";if(r&&n.c.year>=0&&(s+="+"),s+=M(n.c.year,r?6:4),t==="year")return s;if(e){if(s+="-",s+=M(n.c.month),t==="month")return s;s+="-"}else if(s+=M(n.c.month),t==="month")return s;return s+=M(n.c.day),s}function Qn(n,e,t,r,s,i,a){let o=!t||n.c.millisecond!==0||n.c.second!==0,u="";switch(a){case"day":case"month":case"year":break;default:if(u+=M(n.c.hour),a==="hour")break;if(e){if(u+=":",u+=M(n.c.minute),a==="minute")break;o&&(u+=":",u+=M(n.c.second))}else{if(u+=M(n.c.minute),a==="minute")break;o&&(u+=M(n.c.second))}if(a==="second")break;o&&(!r||n.c.millisecond!==0)&&(u+=".",u+=M(n.c.millisecond,3))}return s&&(n.isOffsetFixed&&n.offset===0&&!i?u+="Z":n.o<0?(u+="-",u+=M(Math.trunc(-n.o/60)),u+=":",u+=M(Math.trunc(-n.o%60))):(u+="+",u+=M(Math.trunc(n.o/60)),u+=":",u+=M(Math.trunc(n.o%60)))),i&&(u+="["+n.zone.ianaName+"]"),u}var es={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},ia={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},aa={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Ze=["year","month","day","hour","minute","second","millisecond"],oa=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],ua=["year","ordinal","hour","minute","second","millisecond"];function qe(n){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new Pe(n);return e}function Xn(n){switch(n.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return qe(n)}}function la(n){if(Ie===void 0&&(Ie=O.now()),n.type!=="iana")return n.offset(Ie);let e=n.name,t=Ut.get(e);return t===void 0&&(t=n.offset(Ie),Ut.set(e,t)),t}function Kn(n,e){let t=ee(e.zone,O.defaultZone);if(!t.isValid)return T.invalid(Ne(t));let r=w.fromObject(e),s,i;if(m(n.year))s=O.now();else{for(let u of Ze)m(n[u])&&(n[u]=es[u]);let a=Cr(n)||Nr(n);if(a)return T.invalid(a);let o=la(t);[s,i]=Ue(n,o,t)}return new T({ts:s,zone:t,loc:r,o:i})}function er(n,e,t){let r=m(t.round)?!0:t.round,s=m(t.rounding)?"trunc":t.rounding,i=(o,u)=>(o=jt(o,r||t.calendary?0:2,t.calendary?"round":s),e.loc.clone(t).relFormatter(t).format(o,u)),a=o=>t.calendary?e.hasSame(n,o)?0:e.startOf(o).diff(n.startOf(o),o).get(o):e.diff(n,o).get(o);if(t.unit)return i(a(t.unit),t.unit);for(let o of t.units){let u=a(o);if(Math.abs(u)>=1)return i(u,o)}return i(n>e?-0:0,t.units[t.units.length-1])}function tr(n){let e={},t;return n.length>0&&typeof n[n.length-1]=="object"?(e=n[n.length-1],t=Array.from(n).slice(0,n.length-1)):t=Array.from(n),[e,t]}var Ie,Ut=new Map,T=class n{constructor(e){let t=e.zone||O.defaultZone,r=e.invalid||(Number.isNaN(e.ts)?new V("invalid input"):null)||(t.isValid?null:Ne(t));this.ts=m(e.ts)?O.now():e.ts;let s=null,i=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[s,i]=[e.old.c,e.old.o];else{let o=ne(e.o)&&!e.old?e.o:t.offset(this.ts);s=He(this.ts,o),r=Number.isNaN(s.year)?new V("invalid input"):null,s=r?null:s,i=r?null:o}this._zone=t,this.loc=e.loc||w.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=s,this.o=i,this.isLuxonDateTime=!0}static now(){return new n({})}static local(){let[e,t]=tr(arguments),[r,s,i,a,o,u,l]=t;return Kn({year:r,month:s,day:i,hour:a,minute:o,second:u,millisecond:l},e)}static utc(){let[e,t]=tr(arguments),[r,s,i,a,o,u,l]=t;return e.zone=$.utcInstance,Kn({year:r,month:s,day:i,hour:a,minute:o,second:u,millisecond:l},e)}static fromJSDate(e,t={}){let r=zs(e)?e.valueOf():NaN;if(Number.isNaN(r))return n.invalid("invalid input");let s=ee(t.zone,O.defaultZone);return s.isValid?new n({ts:r,zone:s,loc:w.fromObject(t)}):n.invalid(Ne(s))}static fromMillis(e,t={}){if(ne(e))return e<-Jn||e>Jn?n.invalid("Timestamp out of range"):new n({ts:e,zone:ee(t.zone,O.defaultZone),loc:w.fromObject(t)});throw new v(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(ne(e))return new n({ts:e*1e3,zone:ee(t.zone,O.defaultZone),loc:w.fromObject(t)});throw new v("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};let r=ee(t.zone,O.defaultZone);if(!r.isValid)return n.invalid(Ne(r));let s=w.fromObject(t),i=Be(e,Xn),{minDaysInFirstWeek:a,startOfWeek:o}=An(i,s),u=O.now(),l=m(t.specificOffset)?r.offset(u):t.specificOffset,d=!m(i.ordinal),f=!m(i.year),y=!m(i.month)||!m(i.day),h=f||y,p=i.weekYear||i.weekNumber;if((h||d)&&p)throw new te("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(y&&d)throw new te("Can't mix ordinal dates with month/day");let x=p||i.weekday&&!h,j,de,Me=He(u,l);x?(j=oa,de=ia,Me=Ge(Me,a,o)):d?(j=ua,de=aa,Me=Tt(Me)):(j=Ze,de=es);let wn=!1;for(let ve of j){let ps=i[ve];m(ps)?wn?i[ve]=de[ve]:i[ve]=Me[ve]:wn=!0}let ms=x?As(i,a,o):d?_s(i):Cr(i),pn=ms||Nr(i);if(pn)return n.invalid(pn);let ys=x?Ln(i,a,o):d?Rn(i):i,[gs,ws]=Ue(ys,l,r),ke=new n({ts:gs,zone:r,o:ws,loc:s});return i.weekday&&h&&e.weekday!==ke.weekday?n.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${ke.toISO()}`):ke.isValid?ke:n.invalid(ke.invalid)}static fromISO(e,t={}){let[r,s]=bi(e);return me(r,s,t,"ISO 8601",e)}static fromRFC2822(e,t={}){let[r,s]=xi(e);return me(r,s,t,"RFC 2822",e)}static fromHTTP(e,t={}){let[r,s]=Fi(e);return me(r,s,t,"HTTP",t)}static fromFormat(e,t,r={}){if(m(e)||m(t))throw new v("fromFormat requires an input string and a format");let{locale:s=null,numberingSystem:i=null}=r,a=w.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0}),[o,u,l,d]=sa(a,e,t);return d?n.invalid(d):me(o,u,r,`format ${t}`,e,l)}static fromString(e,t,r={}){return n.fromFormat(e,t,r)}static fromSQL(e,t={}){let[r,s]=_i(e);return me(r,s,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new v("need to specify a reason the DateTime is invalid");let r=e instanceof V?e:new V(e,t);if(O.throwOnInvalid)throw new Et(r);return new n({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){let r=Xr(e,w.fromObject(t));return r?r.map(s=>s?s.val:null).join(""):null}static expandFormat(e,t={}){return Br(F.parseFormat(e),w.fromObject(t)).map(s=>s.val).join("")}static resetCache(){Ie=void 0,Ut.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?kt(this).weekYear:NaN}get weekNumber(){return this.isValid?kt(this).weekNumber:NaN}get weekday(){return this.isValid?kt(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?vt(this).weekday:NaN}get localWeekNumber(){return this.isValid?vt(this).weekNumber:NaN}get localWeekYear(){return this.isValid?vt(this).weekYear:NaN}get ordinal(){return this.isValid?Tt(this.c).ordinal:NaN}get monthShort(){return this.isValid?ue.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?ue.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?ue.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?ue.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,t=6e4,r=Ke(this.c),s=this.zone.offset(r-e),i=this.zone.offset(r+e),a=this.zone.offset(r-s*t),o=this.zone.offset(r-i*t);if(a===o)return[this];let u=r-a*t,l=r-o*t,d=He(u,a),f=He(l,o);return d.hour===f.hour&&d.minute===f.minute&&d.second===f.second&&d.millisecond===f.millisecond?[ae(this,{ts:u}),ae(this,{ts:l})]:[this]}get isInLeapYear(){return Ve(this.year)}get daysInMonth(){return Je(this.year,this.month)}get daysInYear(){return this.isValid?ye(this.year):NaN}get weeksInWeekYear(){return this.isValid?Fe(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Fe(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:t,numberingSystem:r,calendar:s}=F.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:r,outputCalendar:s}}toUTC(e=0,t={}){return this.setZone($.instance(e),t)}toLocal(){return this.setZone(O.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:r=!1}={}){if(e=ee(e,O.defaultZone),e.equals(this.zone))return this;if(e.isValid){let s=this.ts;if(t||r){let i=e.offset(this.ts),a=this.toObject();[s]=Ue(a,i,e)}return ae(this,{ts:s,zone:e})}else return n.invalid(Ne(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:r}={}){let s=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:r});return ae(this,{loc:s})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let t=Be(e,Xn),{minDaysInFirstWeek:r,startOfWeek:s}=An(t,this.loc),i=!m(t.weekYear)||!m(t.weekNumber)||!m(t.weekday),a=!m(t.ordinal),o=!m(t.year),u=!m(t.month)||!m(t.day),l=o||u,d=t.weekYear||t.weekNumber;if((l||a)&&d)throw new te("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new te("Can't mix ordinal dates with month/day");let f;i?f=Ln({...Ge(this.c,r,s),...t},r,s):m(t.ordinal)?(f={...this.toObject(),...t},m(t.day)&&(f.day=Math.min(Je(f.year,f.month),f.day))):f=Rn({...Tt(this.c),...t});let[y,h]=Ue(f,this.o,this.zone);return ae(this,{ts:y,o:h})}plus(e){if(!this.isValid)return this;let t=k.fromDurationLike(e);return ae(this,Bn(this,t))}minus(e){if(!this.isValid)return this;let t=k.fromDurationLike(e).negate();return ae(this,Bn(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;let r={},s=k.normalizeUnit(e);switch(s){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break}if(s==="weeks")if(t){let i=this.loc.getStartOfWeek(),{weekday:a}=this;a<i&&(r.weekNumber=this.weekNumber-1),r.weekday=i}else r.weekday=1;if(s==="quarters"){let i=Math.ceil(this.month/3);r.month=(i-1)*3+1}return this.set(r)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?F.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Mt}toLocaleString(e=Ye,t={}){return this.isValid?F.create(this.loc.clone(t),e).formatDateTime(this):Mt}toLocaleParts(e={}){return this.isValid?F.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:r=!1,includeOffset:s=!0,extendedZone:i=!1,precision:a="milliseconds"}={}){if(!this.isValid)return null;a=qe(a);let o=e==="extended",u=Dt(this,o,a);return Ze.indexOf(a)>=3&&(u+="T"),u+=Qn(this,o,t,r,s,i,a),u}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?Dt(this,e==="extended",qe(t)):null}toISOWeekDate(){return ze(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:r=!0,includePrefix:s=!1,extendedZone:i=!1,format:a="extended",precision:o="milliseconds"}={}){return this.isValid?(o=qe(o),(s&&Ze.indexOf(o)>=3?"T":"")+Qn(this,a==="extended",t,e,r,i,o)):null}toRFC2822(){return ze(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return ze(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Dt(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:r=!0}={}){let s="HH:mm:ss.SSS";return(t||e)&&(r&&(s+=" "),t?s+="z":e&&(s+="ZZ")),ze(this,s,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Mt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",r={}){if(!this.isValid||!e.isValid)return k.invalid("created by diffing an invalid DateTime");let s={locale:this.locale,numberingSystem:this.numberingSystem,...r},i=Us(t).map(k.normalizeUnit),a=e.valueOf()>this.valueOf(),o=a?this:e,u=a?e:this,l=Pi(o,u,i,s);return a?l.negate():l}diffNow(e="milliseconds",t={}){return this.diff(n.now(),e,t)}until(e){return this.isValid?le.fromDateTimes(this,e):this}hasSame(e,t,r){if(!this.isValid)return!1;let s=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,r)<=s&&s<=i.endOf(t,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let t=e.base||n.fromObject({},{zone:this.zone}),r=e.padding?this<t?-e.padding:e.padding:0,s=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(s=e.unit,i=void 0),er(t,this.plus(r),{...e,numeric:"always",units:s,unit:i})}toRelativeCalendar(e={}){return this.isValid?er(e.base||n.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(n.isDateTime))throw new v("min requires all arguments be DateTimes");return _n(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(n.isDateTime))throw new v("max requires all arguments be DateTimes");return _n(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,r={}){let{locale:s=null,numberingSystem:i=null}=r,a=w.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0});return Qr(a,e,t)}static fromStringExplain(e,t,r={}){return n.fromFormatExplain(e,t,r)}static buildFormatParser(e,t={}){let{locale:r=null,numberingSystem:s=null}=t,i=w.fromOpts({locale:r,numberingSystem:s,defaultToEN:!0});return new Qe(i,e)}static fromFormatParser(e,t,r={}){if(m(e)||m(t))throw new v("fromFormatParser requires an input string and a format parser");let{locale:s=null,numberingSystem:i=null}=r,a=w.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0});if(!a.equals(t.locale))throw new v(`fromFormatParser called with a locale of ${a}, but the format parser was created for ${t.locale}`);let{result:o,zone:u,specificOffset:l,invalidReason:d}=t.explainFromTokens(e);return d?n.invalid(d):me(o,u,r,`format ${t.format}`,e,l)}static get DATE_SHORT(){return Ye}static get DATE_MED(){return nr}static get DATE_MED_WITH_WEEKDAY(){return Os}static get DATE_FULL(){return rr}static get DATE_HUGE(){return sr}static get TIME_SIMPLE(){return ir}static get TIME_WITH_SECONDS(){return ar}static get TIME_WITH_SHORT_OFFSET(){return or}static get TIME_WITH_LONG_OFFSET(){return ur}static get TIME_24_SIMPLE(){return lr}static get TIME_24_WITH_SECONDS(){return cr}static get TIME_24_WITH_SHORT_OFFSET(){return dr}static get TIME_24_WITH_LONG_OFFSET(){return hr}static get DATETIME_SHORT(){return fr}static get DATETIME_SHORT_WITH_SECONDS(){return mr}static get DATETIME_MED(){return yr}static get DATETIME_MED_WITH_SECONDS(){return gr}static get DATETIME_MED_WITH_WEEKDAY(){return Ts}static get DATETIME_FULL(){return wr}static get DATETIME_FULL_WITH_SECONDS(){return pr}static get DATETIME_HUGE(){return Or}static get DATETIME_HUGE_WITH_SECONDS(){return Tr}};function Ee(n){if(T.isDateTime(n))return n;if(n&&n.valueOf&&ne(n.valueOf()))return T.fromJSDate(n);if(n&&typeof n=="object")return T.fromObject(n);throw new v(`Unknown datetime argument: ${n}, of type ${typeof n}`)}var ca="3.7.2";L.DateTime=T;L.Duration=k;L.FixedOffsetZone=$;L.IANAZone=Q;L.Info=ue;L.Interval=le;L.InvalidZone=je;L.Settings=O;L.SystemZone=xe;L.VERSION=ca;L.Zone=re});var rt=E(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.CronDate=N.DAYS_IN_MONTH=N.DateMathOp=N.TimeUnit=void 0;var ce=ts(),C;(function(n){n.Second="Second",n.Minute="Minute",n.Hour="Hour",n.Day="Day",n.Month="Month",n.Year="Year"})(C||(N.TimeUnit=C={}));var Le;(function(n){n.Add="Add",n.Subtract="Subtract"})(Le||(N.DateMathOp=Le={}));N.DAYS_IN_MONTH=Object.freeze([31,29,31,30,31,30,31,31,30,31,30,31]);var nt=class n{#e;#n=null;#s=null;#r=null;constructor(e,t){let r={zone:t};if(e?e instanceof n?(this.#e=e.#e,this.#n=e.#n,this.#s=e.#s,this.#r=e.#r):e instanceof Date?this.#e=ce.DateTime.fromJSDate(e,r):typeof e=="number"?this.#e=ce.DateTime.fromMillis(e,r):(this.#e=ce.DateTime.fromISO(e,r),this.#e.isValid||(this.#e=ce.DateTime.fromRFC2822(e,r)),this.#e.isValid||(this.#e=ce.DateTime.fromSQL(e,r)),this.#e.isValid||(this.#e=ce.DateTime.fromFormat(e,"EEE, d MMM yyyy HH:mm:ss",r))):this.#e=ce.DateTime.local(),!this.#e.isValid)throw new Error(`CronDate: unhandled timestamp: ${e}`);t&&t!==this.#e.zoneName&&(this.#e=this.#e.setZone(t))}static#i(e){return e%4===0&&e%100!==0||e%400===0}get dstStart(){return this.#n}get dstStartLandingHour(){return this.#s}clearDstStart(){this.#n=null,this.#s=null}get dstEnd(){return this.#r}set dstEnd(e){this.#r=e}addYear(){this.#e=this.#e.plus({years:1})}addMonth(){this.#e=this.#e.plus({months:1}).startOf("month")}addDay(){this.#e=this.#e.plus({days:1}).startOf("day")}addHour(){this.#e=this.#e.plus({hours:1}).startOf("hour")}addMinute(){this.#e=this.#e.plus({minutes:1}).startOf("minute")}addSecond(){this.#e=this.#e.plus({seconds:1})}subtractYear(){this.#e=this.#e.minus({years:1})}subtractMonth(){this.#e=this.#e.minus({months:1}).endOf("month").startOf("second")}subtractDay(){this.#e=this.#e.minus({days:1}).endOf("day").startOf("second")}subtractHour(){this.#e=this.#e.minus({hours:1}).endOf("hour").startOf("second")}subtractMinute(){this.#e=this.#e.minus({minutes:1}).endOf("minute").startOf("second")}subtractSecond(){this.#e=this.#e.minus({seconds:1})}addUnit(e){switch(e){case C.Year:return this.addYear();case C.Month:return this.addMonth();case C.Day:return this.addDay();case C.Hour:return this.addHour();case C.Minute:return this.addMinute();case C.Second:return this.addSecond()}}subtractUnit(e){switch(e){case C.Year:return this.subtractYear();case C.Month:return this.subtractMonth();case C.Day:return this.subtractDay();case C.Hour:return this.subtractHour();case C.Minute:return this.subtractMinute();case C.Second:return this.subtractSecond()}}invokeDateOperation(e,t){if(e===Le.Add){this.addUnit(t);return}if(e===Le.Subtract){this.subtractUnit(t);return}throw new Error(`Invalid verb: ${e}`)}getDate(){return this.#e.day}getFullYear(){return this.#e.year}getDay(){let e=this.#e.weekday;return e===7?0:e}getMonth(){return this.#e.month-1}getHours(){return this.#e.hour}getMinutes(){return this.#e.minute}getSeconds(){return this.#e.second}getMilliseconds(){return this.#e.millisecond}getUTCOffset(){return this.#e.offset}setStartOfDay(){this.#e=this.#e.startOf("day")}setEndOfDay(){this.#e=this.#e.endOf("day")}getTime(){return this.#e.valueOf()}getUTCDate(){return this.#t().day}getUTCFullYear(){return this.#t().year}getUTCDay(){let e=this.#t().weekday;return e===7?0:e}getUTCMonth(){return this.#t().month-1}getUTCHours(){return this.#t().hour}getUTCMinutes(){return this.#t().minute}getUTCSeconds(){return this.#t().second}toISOString(){return this.#e.toUTC().toISO()}toJSON(){return this.#e.toJSON()}setDate(e){this.#e=this.#e.set({day:e})}setFullYear(e){this.#e=this.#e.set({year:e})}setDay(e){this.#e=this.#e.set({weekday:e})}setMonth(e){this.#e=this.#e.set({month:e+1})}setHours(e){this.#e=this.#e.set({hour:e})}setMinutes(e){this.#e=this.#e.set({minute:e})}setSeconds(e){this.#e=this.#e.set({second:e})}setMilliseconds(e){this.#e=this.#e.set({millisecond:e})}toString(){return this.toDate().toString()}toDate(){return this.#e.toJSDate()}isLastDayOfMonth(){let{day:e,month:t}=this.#e;if(t===2){let r=n.#i(this.#e.year);return e===N.DAYS_IN_MONTH[t-1]-(r?0:1)}return e===N.DAYS_IN_MONTH[t-1]}isLastWeekdayOfMonth(){let{day:e,month:t}=this.#e,r;return t===2?r=N.DAYS_IN_MONTH[t-1]-(n.#i(this.#e.year)?0:1):r=N.DAYS_IN_MONTH[t-1],e>r-7}applyDateOperation(e,t,r){if(t===C.Month||t===C.Day){this.invokeDateOperation(e,t);return}let s=this.getHours(),i=this.getUTCOffset();this.invokeDateOperation(e,t);let a=this.getHours(),o=(a-s+24)%24;e===Le.Add&&this.getUTCOffset()>i&&o>=2?r!==24&&(this.#n=(s+1)%24,this.#s=a):o===0&&this.getMinutes()===0&&this.getSeconds()===0&&r!==24&&(this.dstEnd=a)}#t(){return this.#e.toUTC()}};N.CronDate=nt;N.default=nt});var Xt=E(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.CronMonth=void 0;var da=rt(),ha=X(),fa=1,ma=12,ya=Object.freeze([]),Qt=class extends ha.CronField{static get min(){return fa}static get max(){return ma}static get chars(){return ya}static get daysInMonth(){return da.DAYS_IN_MONTH}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}};st.CronMonth=Qt});var ns=E(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.CronDayOfMonth=void 0;var ga=X(),wa=Xt(),pa=1,Oa=31,Ta=Object.freeze(["L"]),Kt=class n extends ga.CronField{static fromMonth(e,t,r){if(e.length!==1)return new n(t,r);let s=wa.CronMonth.daysInMonth[e[0]-1],i=t.filter(a=>typeof a!="number"||a<=s);return new n(i.length>0?i:t,r)}static get min(){return pa}static get max(){return Oa}static get chars(){return Ta}static get validChars(){return/^[?,*\dLH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}};it.CronDayOfMonth=Kt});var rs=E(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.CronDayOfWeek=void 0;var Sa=X(),Ma=0,ka=7,va=Object.freeze(["L"]),en=class extends Sa.CronField{static get min(){return Ma}static get max(){return ka}static get chars(){return va}static get validChars(){return/^[?,*\dLH#/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(e,t){if(super(e,t),this.validate(),this.values.some(r=>r==="L"))throw new Error(`${this.constructor.name} Validation error, unexpected standalone L`)}get values(){return super.values}get nthDay(){return this.options.nthDayOfWeek??0}};at.CronDayOfWeek=en});var ss=E(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.CronHour=void 0;var Da=X(),Ea=0,Ca=23,Na=Object.freeze([]),tn=class extends Da.CronField{static get min(){return Ea}static get max(){return Ca}static get chars(){return Na}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}};ot.CronHour=tn});var is=E(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.CronMinute=void 0;var Ia=X(),ba=0,xa=59,Fa=Object.freeze([]),nn=class extends Ia.CronField{static get min(){return ba}static get max(){return xa}static get chars(){return Fa}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}};ut.CronMinute=nn});var as=E(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.CronSecond=void 0;var Va=X(),Wa=0,$a=59,La=Object.freeze([]),rn=class extends Va.CronField{static get min(){return Wa}static get max(){return $a}static get chars(){return La}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}};lt.CronSecond=rn});var ct=E(I=>{"use strict";var Ra=I&&I.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,s)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),se=I&&I.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Ra(e,n,t)};Object.defineProperty(I,"__esModule",{value:!0});se(Dn(),I);se(ns(),I);se(rs(),I);se(X(),I);se(ss(),I);se(is(),I);se(Xt(),I);se(as(),I)});var an=E(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.CronFieldCollection=void 0;var b=ct(),sn=class n{#e;#n;#s;#r;#i;#t;static from(e,t){return new n({second:this.resolveField(b.CronSecond,e.second,t.second),minute:this.resolveField(b.CronMinute,e.minute,t.minute),hour:this.resolveField(b.CronHour,e.hour,t.hour),dayOfMonth:this.resolveField(b.CronDayOfMonth,e.dayOfMonth,t.dayOfMonth),month:this.resolveField(b.CronMonth,e.month,t.month),dayOfWeek:this.resolveField(b.CronDayOfWeek,e.dayOfWeek,t.dayOfWeek)})}static resolveField(e,t,r){return r?r instanceof b.CronField?r:new e(r):t}constructor({second:e,minute:t,hour:r,dayOfMonth:s,month:i,dayOfWeek:a}){if(!e)throw new Error("Validation error, Field second is missing");if(!t)throw new Error("Validation error, Field minute is missing");if(!r)throw new Error("Validation error, Field hour is missing");if(!s)throw new Error("Validation error, Field dayOfMonth is missing");if(!i)throw new Error("Validation error, Field month is missing");if(!a)throw new Error("Validation error, Field dayOfWeek is missing");if(i.values.length===1&&!s.hasLastChar&&a.isWildcard&&!(parseInt(s.values[0],10)<=b.CronMonth.daysInMonth[i.values[0]-1]))throw new Error("Invalid explicit day of month definition");this.#e=e,this.#n=t,this.#s=r,this.#i=i,this.#t=a,this.#r=s}get second(){return this.#e}get minute(){return this.#n}get hour(){return this.#s}get dayOfMonth(){return this.#r}get month(){return this.#i}get dayOfWeek(){return this.#t}static compactField(e){if(e.length===0)return[];let t=[],r;return e.forEach((s,i,a)=>{if(r===void 0){r={start:s,count:1};return}let o=a[i-1]||r.start,u=a[i+1];if(s==="L"||s==="W"){t.push(r),t.push({start:s,count:1}),r=void 0;return}if(r.step===void 0&&u!==void 0){let l=s-o,d=u-s;if(l<=d){r={...r,count:2,end:s,step:l};return}r.step=1}s-(r.end??0)===r.step?(r.count++,r.end=s):(r.count===1?t.push({start:r.start,count:1}):r.count===2?(t.push({start:r.start,count:1}),t.push({start:r.end??o,count:1})):t.push(r),r={start:s,count:1})}),r&&t.push(r),t}static#l(e,t,r){let s=t.step;return s?s===1&&t.start===e.min&&t.end&&t.end>=r?(e instanceof b.CronDayOfMonth||e instanceof b.CronDayOfWeek)&&!e.isWildcard?null:e.hasQuestionMarkChar?"?":"*":s!==1&&t.start===e.min&&t.end&&t.end>=r-s+1?`*/${s}`:null:null}static#o(e){let t=e.step;if(t===1)return`${e.start}-${e.end}`;let r=e.start===0?e.count-1:e.count;if(!t)throw new Error("Unexpected range step");if(!e.end)throw new Error("Unexpected range end");if(t*r>e.end){let s=(a,o)=>{if(typeof e.start!="number")throw new Error("Unexpected range start");return o%t===0?e.start+o:null};if(typeof e.start!="number")throw new Error("Unexpected range start");let i={length:e.end-e.start+1};return Array.from(i,s).filter(a=>a!==null).join(",")}return`${e.start}-${e.end}/${t}`}stringifyField(e){let t=e.max,r=e.values;if(e instanceof b.CronDayOfWeek){t=6;let i=this.#t.values;r=i[i.length-1]===7?i.slice(0,-1):i}e instanceof b.CronDayOfMonth&&(t=this.#i.values.length===1?b.CronMonth.daysInMonth[this.#i.values[0]-1]:e.max);let s=n.compactField(r);if(s.length===1){let i=n.#l(e,s[0],t);if(i)return i}return s.map(i=>{let a=i.count===1?i.start.toString():n.#o(i);return e instanceof b.CronDayOfWeek&&e.nthDay>0?`${a}#${e.nthDay}`:a}).join(",")}stringify(e=!1){let t=[];return e&&t.push(this.stringifyField(this.#e)),t.push(this.stringifyField(this.#n),this.stringifyField(this.#s),this.stringifyField(this.#r),this.stringifyField(this.#i),this.stringifyField(this.#t)),t.join(" ")}serialize(){return{second:this.#e.serialize(),minute:this.#n.serialize(),hour:this.#s.serialize(),dayOfMonth:this.#r.serialize(),month:this.#i.serialize(),dayOfWeek:this.#t.serialize()}}};dt.CronFieldCollection=sn});var on=E(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.CronExpression=H.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE=H.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE=void 0;var S=rt();H.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE="Out of the time span range";H.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE="Invalid expression, loop limit exceeded";var os=1e4,ht=class n{#e;#n;#s;#r;#i;#t;#l=null;#o=!1;constructor(e,t){this.#e=t,this.#n=t.tz,this.#r=t.startDate?new S.CronDate(t.startDate,this.#n):null,this.#i=t.endDate?new S.CronDate(t.endDate,this.#n):null;let r=t.currentDate??t.startDate;if(r){let s=new S.CronDate(r,this.#n);this.#r&&s.getTime()<this.#r.getTime()?r=this.#r:this.#i&&s.getTime()>this.#i.getTime()&&(r=this.#i)}this.#s=new S.CronDate(r,this.#n),this.#t=e}get fields(){return this.#t}static fieldsToExpression(e,t){return new n(e,t||{})}static#a(e,t){return t.some(r=>r===e)}#u(e,t){return e[t?e.length-1:0]}#f(e){let t=`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`;if(this.#l===t)return this.#o;let r=new S.CronDate(e);r.setStartOfDay();let s=new S.CronDate(e);return s.setEndOfDay(),this.#l=t,this.#o=r.getUTCOffset()!==s.getUTCOffset(),this.#o}#m(e,t,r){let s=this.#t.second.values,i=e.getSeconds(),a=this.#t.second.findNearestValue(i,r);if(a!==null){e.setSeconds(a);return}e.applyDateOperation(t,S.TimeUnit.Minute,this.#t.hour.values.length),e.setSeconds(this.#u(s,r))}#y(e,t,r){let s=this.#t.minute.values,i=this.#t.second.values,a=e.getMinutes(),o=this.#t.minute.findNearestValue(a,r);if(o!==null){e.setMinutes(o),e.setSeconds(this.#u(i,r));return}e.applyDateOperation(t,S.TimeUnit.Hour,this.#t.hour.values.length),e.setMinutes(this.#u(s,r)),e.setSeconds(this.#u(i,r))}static#d(e,t){if(!t.isLastWeekdayOfMonth())return!1;let r=t.getDay();return e.some(s=>r===parseInt(s.toString().charAt(0),10)%7)}static#g(e,t){return e<=0||Math.ceil(t.getDate()/7)===e}next(){return this.#c()}prev(){return this.#c(!0)}hasNext(){let e=this.#s;try{return this.#c(),!0}catch{return!1}finally{this.#s=e}}hasPrev(){let e=this.#s;try{return this.#c(!0),!0}catch{return!1}finally{this.#s=e}}take(e){let t=[];if(e>=0)for(let r=0;r<e;r++)try{t.push(this.next())}catch{return t}else for(let r=0;r>e;r--)try{t.push(this.prev())}catch{return t}return t}reset(e){this.#s=new S.CronDate(e||this.#e.currentDate,this.#n)}stringify(e=!1){return this.#t.stringify(e)}includesDate(e){let{second:t,minute:r,hour:s,month:i}=this.#t,a=new S.CronDate(e,this.#n);return!(!t.values.includes(a.getSeconds())||!r.values.includes(a.getMinutes())||!s.values.includes(a.getHours())||!i.values.includes(a.getMonth()+1)||!this.#h(a))}toString(){return this.#e.expression||this.stringify(!0)}#h(e){let t=this.#t.dayOfMonth.isWildcard,r=!t,s=this.#t.dayOfWeek.isWildcard,i=!s,a=n.#a(e.getDate(),this.#t.dayOfMonth.values)||this.#t.dayOfMonth.hasLastChar&&e.isLastDayOfMonth(),o=this.#t.dayOfWeek.nthDay,u=n.#a(e.getDay(),this.#t.dayOfWeek.values)&&n.#g(o,e)||this.#t.dayOfWeek.hasLastChar&&n.#d(this.#t.dayOfWeek.values,e);return!!(r&&i&&(a||u)||a&&!i||t&&!s&&u)}#w(e,t,r){let s=this.#t.hour.values,i=s,a=e.getHours(),o=n.#a(a,s),u=e.dstEnd===a;if(e.dstStart!==null&&e.dstStartLandingHour===a){for(let d=e.dstStart;d!==a;d=(d+1)%24)if(n.#a(d,s))return!0}if(u&&!r)return e.dstEnd=null,e.applyDateOperation(S.DateMathOp.Add,S.TimeUnit.Hour,i.length),!1;if(o)return!0;e.clearDstStart();let l=this.#t.hour.findNearestValue(a,r);if(l===null)return e.applyDateOperation(t,S.TimeUnit.Day,i.length),!1;if(this.#f(e)){let d=r?a-l:l-a;for(let f=0;f<d&&(e.applyDateOperation(t,S.TimeUnit.Hour,i.length),!(!r&&e.getHours()>=l||r&&e.getHours()<=l));f++);}else e.setHours(l);return e.setMinutes(this.#u(this.#t.minute.values,r)),e.setSeconds(this.#u(this.#t.second.values,r)),!1}#p(e){if(!this.#r&&!this.#i)return;let t=e.getTime();if(this.#r&&t<this.#r.getTime())throw new Error(H.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE);if(this.#i&&t>this.#i.getTime())throw new Error(H.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE)}#c(e=!1){let t=e?S.DateMathOp.Subtract:S.DateMathOp.Add,r=new S.CronDate(this.#s),s=r.getTime();r.getMilliseconds()>0&&(r.setMilliseconds(0),e||r.applyDateOperation(S.DateMathOp.Add,S.TimeUnit.Second,this.#t.hour.values.length));let i=0;for(;++i<os;){if(this.#p(r),!this.#h(r)){r.applyDateOperation(t,S.TimeUnit.Day,this.#t.hour.values.length);continue}if(!n.#a(r.getMonth()+1,this.#t.month.values)){r.applyDateOperation(t,S.TimeUnit.Month,this.#t.hour.values.length);continue}if(this.#w(r,t,e)){if(!n.#a(r.getMinutes(),this.#t.minute.values)){this.#y(r,t,e);continue}if(!n.#a(r.getSeconds(),this.#t.second.values)){this.#m(r,t,e);continue}if(s===r.getTime()){r.applyDateOperation(t,S.TimeUnit.Second,this.#t.hour.values.length);continue}break}}if(i>=os)throw new Error(H.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE);return this.#s=r,r}[Symbol.iterator](){return{next:()=>{try{return{value:this.#c(),done:!1}}catch{return{value:void 0,done:!0}}}}}};H.CronExpression=ht;H.default=ht});var us=E(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.seededRandom=Ha;function Aa(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return()=>e>>>0}function _a(n){return()=>{let e=n+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}function Ha(n){let e=n?Aa(n)():Math.floor(Math.random()*1e10);return _a(e)}});var ft=E(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.CronExpressionParser=Z.DayOfWeek=Z.Months=Z.CronUnit=Z.PredefinedExpressions=void 0;var za=an(),Ua=on(),Za=us(),z=ct(),ln;(function(n){n["@yearly"]="0 0 0 1 1 *",n["@annually"]="0 0 0 1 1 *",n["@monthly"]="0 0 0 1 * *",n["@weekly"]="0 0 0 * * 0",n["@daily"]="0 0 0 * * *",n["@hourly"]="0 0 * * * *",n["@minutely"]="0 * * * * *",n["@secondly"]="* * * * * *",n["@weekdays"]="0 0 0 * * 1-5",n["@weekends"]="0 0 0 * * 0,6"})(ln||(Z.PredefinedExpressions=ln={}));var U;(function(n){n.Second="Second",n.Minute="Minute",n.Hour="Hour",n.DayOfMonth="DayOfMonth",n.Month="Month",n.DayOfWeek="DayOfWeek"})(U||(Z.CronUnit=U={}));var cn;(function(n){n[n.jan=1]="jan",n[n.feb=2]="feb",n[n.mar=3]="mar",n[n.apr=4]="apr",n[n.may=5]="may",n[n.jun=6]="jun",n[n.jul=7]="jul",n[n.aug=8]="aug",n[n.sep=9]="sep",n[n.oct=10]="oct",n[n.nov=11]="nov",n[n.dec=12]="dec"})(cn||(Z.Months=cn={}));var dn;(function(n){n[n.sun=0]="sun",n[n.mon=1]="mon",n[n.tue=2]="tue",n[n.wed=3]="wed",n[n.thu=4]="thu",n[n.fri=5]="fri",n[n.sat=6]="sat"})(dn||(Z.DayOfWeek=dn={}));var ls=256,hn=class n{static parse(e,t={}){let{strict:r=!1,hashSeed:s}=t,i=(0,Za.seededRandom)(s);e=ln[e]||e;let a=n.#e(e,r);if(!(a.dayOfMonth==="*"||a.dayOfWeek==="*"||!r))throw new Error("Cannot use both dayOfMonth and dayOfWeek together in strict mode!");let o=n.#n(U.Second,a.second,z.CronSecond.constraints,i,r),u=n.#n(U.Minute,a.minute,z.CronMinute.constraints,i,r),l=n.#n(U.Hour,a.hour,z.CronHour.constraints,i,r),d=n.#n(U.Month,a.month,z.CronMonth.constraints,i,r),f=n.#n(U.DayOfMonth,a.dayOfMonth,z.CronDayOfMonth.constraints,i,r),{dayOfWeek:y,nthDayOfWeek:h}=n.#g(a.dayOfWeek),p=n.#n(U.DayOfWeek,y,z.CronDayOfWeek.constraints,i,r),x=new za.CronFieldCollection({second:new z.CronSecond(o,{rawValue:a.second}),minute:new z.CronMinute(u,{rawValue:a.minute}),hour:new z.CronHour(l,{rawValue:a.hour}),dayOfMonth:z.CronDayOfMonth.fromMonth(d,f,{rawValue:a.dayOfMonth}),month:new z.CronMonth(d,{rawValue:a.month}),dayOfWeek:new z.CronDayOfWeek(p,{rawValue:a.dayOfWeek,nthDayOfWeek:h})});return new Ua.CronExpression(x,{...t,expression:e})}static#e(e,t){if(t&&!e.length)throw new Error("Invalid cron expression");e=e||"0 * * * * *";let r=e.trim().split(/\s+/);if(t&&r.length<6)throw new Error("Invalid cron expression, expected 6 fields");if(r.length>6)throw new Error("Invalid cron expression, too many fields");let s=["0","*","*","*","*","*"];r.length<s.length&&r.unshift(...s.slice(0,s.length-r.length));let[i,a,o,u,l,d]=r;return{second:i,minute:a,hour:o,dayOfMonth:u,month:l,dayOfWeek:d}}static#n(e,t,r,s,i){if((e===U.Month||e===U.DayOfWeek)&&(t=t.replace(/[a-z]{3}/gi,a=>{a=a.toLowerCase();let o=cn[a]||dn[a];if(o===void 0)throw new Error(`Validation error, cannot resolve alias "${a}"`);return o.toString()})),!r.validChars.test(t))throw new Error(`Invalid characters, got value: ${t}`);return t=this.#s(t,r),t=this.#r(t,r,s,e,i),this.#a(e,t,r)}static#s(e,t){return e.replace(/[*?]/g,t.min+"-"+t.max)}static#r(e,t,r,s,i){let a=r();return e.replace(/H(?:\((\d+)-(\d+)\))?(?:\/(\d+))?/g,(o,u,l,d)=>{if(u&&l&&d){let f=parseInt(u,10),y=parseInt(l,10),h=parseInt(d,10);if(h<=0)throw new Error(`Invalid step: ${h}, must be positive`);let p=n.#l(f,y,t,s,i);return n.#o(a,p.min,p.max,h,s,i)}else if(u&&l){let f=parseInt(u,10),y=parseInt(l,10),h=n.#l(f,y,t,s,i);return String(n.#i(a,h.min,h.max))}else if(d){let f=parseInt(d,10);if(f<=0)throw new Error(`Invalid step: ${f}, must be positive`);return n.#o(a,t.min,t.max,f,s,i)}else return String(n.#i(a,t.min,t.max))})}static#i(e,t,r){return Math.floor(e*(r-t+1))+t}static#t(e){return e.charAt(0).toLowerCase()+e.slice(1)}static#l(e,t,r,s,i){if(e>t)throw new Error(`Invalid range: ${e}-${t}, min > max`);if(i&&(e<r.min||t>r.max))throw new Error(`Invalid range: ${e}-${t}, outside the ${r.min}-${r.max} range of the ${n.#t(s)} field`);let a=Math.max(e,r.min),o=Math.min(t,r.max);if(a>o)throw new Error(`Invalid range: ${e}-${t}, no usable value in the ${n.#t(s)} field`);return{min:a,max:o}}static#o(e,t,r,s,i,a){if(a&&s>r-t+1)throw new Error(`Invalid step: ${s}, wider than the ${t}-${r} range of the ${n.#t(i)} field`);let o=Math.floor(e*s),u=[];for(let l=Math.floor(t/s)*s+o;l<=r;l+=s)l>=t&&u.push(l);return u.length===0?String(n.#i(e,t,r)):u.join(",")}static#a(e,t,r){let s=[];function i(o,u){if(Array.isArray(o))s.push(...o);else if(n.#h(u,o))s.push(o);else{let l=parseInt(o.toString(),10);if(!(l>=u.min&&l<=u.max))throw new Error(`Constraint error, got value ${o} expected range ${u.min}-${u.max}`);s.push(e===U.DayOfWeek?l%7:o)}}let a=t.split(",");for(let o of a){if(s.length>ls)throw new Error(`Constraint error, too many values in ${e} field, expected at most ${ls}`);if(!(o.length>0))throw new Error("Invalid list value format");i(n.#u(e,o,r),r)}return s}static#u(e,t,r){let s=t.split("/");if(s.length>2)throw new Error(`Invalid repeat: ${t}`);return s.length===2?(s[0].includes("-")||(s[0]=`${s[0]}-${r.max}`),n.#d(e,s[0],parseInt(s[1],10),r)):n.#d(e,t,1,r)}static#f(e,t,r){if(!(!isNaN(e)&&!isNaN(t)&&e>=r.min&&t<=r.max))throw new Error(`Constraint error, got range ${e}-${t} expected range ${r.min}-${r.max}`);if(e>t)throw new Error(`Invalid range: ${e}-${t}, min(${e}) > max(${t})`)}static#m(e){if(!(!isNaN(e)&&e>0))throw new Error(`Constraint error, cannot repeat at every ${e} time.`)}static#y(e,t,r,s){let i=[];e===U.DayOfWeek&&r%7===0&&(r-t)%s===0&&i.push(0);for(let a=t;a<=r;a+=s)i.indexOf(a)===-1&&i.push(a);return i}static#d(e,t,r,s){let i=t.split("-");if(i.length<=1)return isNaN(+t)?t:+t;let[a,o]=i.map(u=>parseInt(u,10));return this.#f(a,o,s),this.#m(r),this.#y(e,a,o,r)}static#g(e){let t=e.split("#");if(t.length<=1)return{dayOfWeek:t[0]};let r=+t[t.length-1],s=e.match(/([,\-/])/);if(s!==null)throw new Error(`Constraint error, invalid dayOfWeek \`#\` and \`${s?.[0]}\` special characters are incompatible`);if(!(t.length<=2&&!isNaN(r)&&r>=1&&r<=5))throw new Error("Constraint error, invalid dayOfWeek occurrence number (#)");return{dayOfWeek:t[0],nthDayOfWeek:r}}static#h(e,t){return e.chars.some(r=>t.toString().includes(r))}};Z.CronExpressionParser=hn});var cs=E(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.CronFileParser=void 0;var qa=ft(),fn=class n{static async parseFile(e){let{readFile:t}=On("fs/promises"),r=await t(e,"utf8");return n.#e(r)}static parseFileSync(e){let{readFileSync:t}=On("fs"),r=t(e,"utf8");return n.#e(r)}static#e(e){let t=e.split(`
8
+ `),r={variables:{},expressions:[],errors:{}};for(let s of t){let i=s.trim();if(i.length===0||i.startsWith("#"))continue;let a=i.match(/^(.*)=(.*)$/);if(a){let[,o,u]=a;r.variables[o]=u.replace(/["']/g,"");continue}try{let o=n.#n(i);r.expressions.push(o.interval)}catch(o){r.errors[i]=o}}return r}static#n(e){let t=e.split(" ");return{interval:qa.CronExpressionParser.parse(t.slice(0,5).join(" ")),command:t.slice(5,t.length)}}};mt.CronFileParser=fn});var mn=E(D=>{"use strict";var Pa=D&&D.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,s)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),Ya=D&&D.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Pa(e,n,t)};Object.defineProperty(D,"__esModule",{value:!0});D.CronFileParser=D.CronExpressionParser=D.CronExpression=D.CronFieldCollection=D.CronDate=void 0;var ja=ft(),Ga=rt();Object.defineProperty(D,"CronDate",{enumerable:!0,get:function(){return Ga.CronDate}});var Ja=an();Object.defineProperty(D,"CronFieldCollection",{enumerable:!0,get:function(){return Ja.CronFieldCollection}});var Ba=on();Object.defineProperty(D,"CronExpression",{enumerable:!0,get:function(){return Ba.CronExpression}});var Qa=ft();Object.defineProperty(D,"CronExpressionParser",{enumerable:!0,get:function(){return Qa.CronExpressionParser}});var Xa=cs();Object.defineProperty(D,"CronFileParser",{enumerable:!0,get:function(){return Xa.CronFileParser}});Ya(ct(),D);D.default=ja.CronExpressionParser});var gn=Tn(mn());var ds=Tn(mn());var Ka=367*24*60*60*1e3,eo="No date in the coming year matches this cron expression: a day of the month its months do not have, such as the 31st of February or April, never comes, and 29 February comes only once in four years.";function yn(n){try{return new Intl.DateTimeFormat("en",{timeZone:n}),!0}catch{return!1}}function hs(n,e,t){if(!yn(e))return{refused:"unknownTimezone",reason:`SandForge does not know the time zone "${e}".`};let r;try{r=ds.CronExpressionParser.parse(n,{tz:e,currentDate:new Date(t),endDate:new Date(t+Ka)})}catch(s){return{refused:"unreadable",reason:kn(s)}}try{return r.next().getTime()}catch{return{refused:"noRunWithinYear",reason:eo}}}var Co=yt({id:De().min(1).max(200),type:Mn(["manual","schedule","event","webhook","sandbox_refresh","deployment_complete"]),enabled:Sn(),config:yt({cron:De().max(200).optional(),timezone:De().max(100).optional(),orgId:De().max(200).optional()}).loose().default({})}),to=5;function no(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function ro(n){return n instanceof Error?n.message:String(n)}var so={unknownTimezone:"badTimezone",unreadable:"badCron",noRunWithinYear:"noNextRun"},fs=class{timezoneOf(e){let t=e.config.timezone?.trim();return t||no()}idleReason(e,t,r=Date.now()){if(!e.enabled)return{idle:"disabled"};if(e.type==="schedule"){let s=this.nextRun(e,r);return typeof s=="number"?void 0:s}if(e.type==="sandbox_refresh")return this.refreshProblem(e,t)}nextRun(e,t){let r=this.scheduleProblem(e);if(r)return r;let s=hs(this.cronOf(e),this.timezoneOf(e),t);return typeof s=="number"?s:{idle:so[s.refused],detail:s.reason}}dueBetween(e,t,r,s){if(r<=t||this.scheduleProblem(e))return{times:[],more:!1};let i=[];try{let a=gn.CronExpressionParser.parse(this.cronOf(e),{tz:this.timezoneOf(e),currentDate:new Date(t),endDate:new Date(r)});for(;a.hasNext();){if(i.length===s)return{times:i,more:!0};i.push(a.next().getTime())}}catch{}return{times:i,more:!1}}firesOnRefreshOf(e,t){return e.type==="sandbox_refresh"&&e.enabled&&e.config.orgId===t}cronOf(e){return(e.config.cron??"").trim().split(/\s+/).join(" ")}scheduleProblem(e){let t=this.cronOf(e);if(t==="")return{idle:"noCron"};let r=t.split(" ").length;if(r!==to)return{idle:"badCron",detail:`A schedule takes five fields (minute, hour, day of the month, month, day of the week); this one has ${r}.`};let s=this.timezoneOf(e);if(!yn(s))return{idle:"badTimezone",detail:s};try{gn.CronExpressionParser.parse(t,{tz:s,currentDate:new Date(0)})}catch(i){return{idle:"badCron",detail:ro(i)}}}refreshProblem(e,t){if(!e.config.orgId?.trim())return{idle:"noSandbox"};if(!t)return{idle:"unknownSandbox"};if(!t.sandbox)return{idle:"notSandbox"}}};export{Ka as a,hs as b,Co as c,fs as d};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ import{yd as c}from"./chunk-B45CNPUX.mjs";import"./chunk-7EANH5PY.mjs";import"./chunk-NTOVCTRS.mjs";var y=[{type:"seed",label:"Seed Data",description:"Seed an org with a template saved on the Seed page or shipped with SandForge, never a production org; its records are taken back from Seed\u2019s Recent runs",category:"data",icon:"database",configSchema:{orgId:{type:"string"},templateId:{type:"string"}}},{type:"sync",label:"Sync Data",description:"Run a Sync configuration saved on the Sync page; a target Production Guard asks about, a production org or a sandbox marked Staging, needs an Approval step before it",category:"data",icon:"sync",configSchema:{configId:{type:"string"}}},{type:"backup",label:"Backup",description:"Take a DataOps snapshot of the listed objects into local storage",category:"data",icon:"archive",configSchema:{orgId:{type:"string"},objects:{type:"array"}}},{type:"restore",label:"Restore",description:"Restore data from a previous backup snapshot",category:"data",icon:"history",configSchema:{backupId:{type:"string"}}},{type:"anonymize",label:"Anonymize",description:"Mask an org with a DataOps template, after a snapshot of the values it writes over, never a production org",category:"data",icon:"shield",configSchema:{orgId:{type:"string"},templateId:{type:"string"},object:{type:"string",optional:!0},where:{type:"string",optional:!0},acceptAutomation:{type:"boolean",default:!1},acceptEmails:{type:"boolean",default:!1},muteAutomation:{type:"boolean",default:!1}}},{type:"delete",label:"Delete",description:"Delete records matching specified criteria",category:"data",icon:"trash",configSchema:{objectName:{type:"string"},where:{type:"string"}}},{type:"checkpoint",label:"Checkpoint",description:"Take a checkpoint of a sandbox, a scratch org or a Developer Edition org, kept on this machine",category:"data",icon:"bookmark",configSchema:{orgId:{type:"string"},mode:{type:"string",default:"everything"},objects:{type:"array",optional:!0},excluded:{type:"array",optional:!0},name:{type:"string",optional:!0},keepDays:{type:"number",default:c},maxTotal:{type:"number",optional:!0},ignoredFields:{type:"array",optional:!0}}},{type:"rewind",label:"Rewind",description:"Put an org back to a checkpoint kept on this machine, once confirmed by typing the org\u2019s alias, at most maxRecords records",category:"data",icon:"history",configSchema:{orgId:{type:"string"},checkpointId:{type:"string"},objects:{type:"array",optional:!0},acceptAutomation:{type:"boolean",default:!1},acceptEmails:{type:"boolean",default:!1},muteAutomation:{type:"boolean",default:!1},acceptNoUndo:{type:"boolean",default:!1},acceptRecreate:{type:"boolean",default:!1},acceptOutside:{type:"boolean",default:!1},acceptUnseen:{type:"boolean",default:!1},maxRecords:{type:"number",required:!0},refuseWhenActive:{type:"boolean",default:!0}}},{type:"compare",label:"Compare Orgs",description:"Compare the metadata of two orgs, as the Compare page does",category:"quality",icon:"git-compare",configSchema:{sourceOrgId:{type:"string"},targetOrgId:{type:"string"},types:{type:"array"}}},{type:"precheck",label:"Pre-check",description:"Read an org\u2019s API usage, storage, error logs or failed jobs as the Monitor does; the run stops on a critical reading",category:"quality",icon:"check-circle",configSchema:{orgId:{type:"string"},checks:{type:"array"}}},{type:"condition",label:"Condition",description:"Branch pipeline execution based on conditions",category:"control",icon:"git-branch",configSchema:{field:{type:"string"},operator:{type:"string"},value:{type:"string"}}},{type:"delay",label:"Delay",description:"Wait for a specified duration before continuing",category:"control",icon:"clock",configSchema:{durationMs:{type:"number"}}},{type:"approval",label:"Approval",description:"Pauses the run until someone approves it in VS Code; a rejection, or no answer in time, stops it",category:"control",icon:"user-check",configSchema:{message:{type:"string"},timeoutMinutes:{type:"number"}}},{type:"notification",label:"Notification",description:"Shows its message as a VS Code notification",category:"notification",icon:"bell",configSchema:{message:{type:"string"}}}],p=class{registry;constructor(){this.registry=new Map(y.map(e=>[e.type,e]))}getStepTypes(){return[...this.registry.values()]}getStepType(e){return this.registry.get(e)}getDefaultConfig(e){let r=this.registry.get(e);if(!r)return{};let o={};for(let[t,a]of Object.entries(r.configSchema)){let n=a;if(!(n.optional===!0||n.required===!0)){if("default"in n){o[t]=n.default;continue}switch(n.type){case"string":o[t]="";break;case"number":o[t]=0;break;case"array":o[t]=[];break;case"boolean":o[t]=!1;break;default:o[t]=null}}}return o}validateStepConfig(e,r){let o=this.registry.get(e);if(!o)return[`Unknown step type: ${e}`];let t=[];for(let[a,n]of Object.entries(o.configSchema)){let l=n,i=r[a],s=l.type;i!=null&&(s==="array"&&!Array.isArray(i)?t.push(`Field "${a}" must be an array`):s==="string"&&typeof i!="string"?t.push(`Field "${a}" must be a string`):s==="number"&&typeof i!="number"?t.push(`Field "${a}" must be a number`):s==="boolean"&&typeof i!="boolean"&&t.push(`Field "${a}" must be a boolean`))}return t}getStepCategories(){let e=new Set;for(let r of this.registry.values())e.add(r.category);return[...e]}};export{p as StepLibrary};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ var l=class{resolve(r,n){return r.map(t=>g(t,n))}detectConflicts(r,n,t){let o=new Map;for(let s of n){let c=String(s[t]??"");c&&o.set(c,s)}let d=[];for(let s of r){let c=String(s[t]??"");if(!c)continue;let i=o.get(c);if(!i)continue;let u=y(s,i,t);u.length>0&&d.push({objectApiName:"",recordId:c,sourceValues:f(s,u),targetValues:f(i,u),conflictFields:u})}return d}};function g(e,r){let n=e.resolution??r;switch(n){case"source_wins":return{recordId:e.recordId,resolvedValues:{...e.sourceValues},strategy:n};case"target_wins":return{recordId:e.recordId,resolvedValues:{...e.targetValues},strategy:n};case"newest_wins":return w(e,n);case"merge":return R(e,n);default:throw new Error(`A sync run settles a conflict by source wins, target wins, newest wins or merge, not by "${String(n)}": nothing was written for ${e.recordId}.`)}}function w(e,r){let n=a(e.sourceValues.LastModifiedDate),t=a(e.targetValues.LastModifiedDate);return n&&t&&t>n?{recordId:e.recordId,resolvedValues:{...e.targetValues},strategy:r}:{recordId:e.recordId,resolvedValues:{...e.sourceValues},strategy:r}}function R(e,r){let n={...e.targetValues};for(let t of e.conflictFields){let o=e.sourceValues[t];o!=null&&(n[t]=o)}return{recordId:e.recordId,resolvedValues:n,strategy:r}}function a(e){if(!e)return null;let r=new Date(String(e));return isNaN(r.getTime())?null:r}function y(e,r,n){let t=new Set([...Object.keys(e),...Object.keys(r)]),o=[];for(let d of t){if(d===n)continue;let s=e[d],c=r[d];S(s,c)||o.push(d)}return o}function S(e,r){return e===r?!0:e==null?r==null:JSON.stringify(e)===JSON.stringify(r)}function f(e,r){let n={};for(let t of r)n[t]=e[t];return n}export{l as a};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ var b=/^[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*$/,h=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/;function p(t){return encodeURIComponent(t).length}function x(t){let s=["Id"],e=new Set(["id"]);for(let n of t)e.has(n.toLowerCase())||(e.add(n.toLowerCase()),s.push(n));return s}function S(t,s=["Id"]){if(p(t.join(", "))<=7e3)return[[...t]];let e=x(s),n=new Set(e.map(r=>r.toLowerCase())),o=p(", "),c=p(e.join(", ")),i=[],a=[...e],f=c;for(let r of t){if(n.has(r.toLowerCase()))continue;let d=o+p(r);a.length>e.length&&f+d>7e3&&(i.push(a),a=[...e],f=c),a.push(r),f+=d}return(a.length>e.length||i.length===0)&&i.push(a),i}function $(t){return S(t)[0]??[]}var w="SystemModstamp";function T(t){let s=/^\s*SELECT\s+([\s\S]+?)\s+FROM\s+([A-Za-z][A-Za-z0-9_]*)(\s[\s\S]*)?$/i.exec(t);if(!s)return;let[,e,n,o=""]=s,c=e.split(",").map(i=>i.trim());if(c.every(i=>b.test(i)))return{objectApiName:n,fields:c,rest:o}}function L(t){let s=w.toLowerCase();return T(t)?.fields.some(e=>e.toLowerCase()===s)?{stamp:w}:void 0}function _(t,s){let e=T(t);if(!e)return;let{objectApiName:n,fields:o,rest:c}=e,i=S(o,s);if(i.length<2)return;let[a,...f]=i;return{objectApiName:n,first:`SELECT ${a.join(", ")} FROM ${n}${c}`,firstGroup:a,others:f}}function R(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function M(t){return t!=="__proto__"&&t!=="constructor"&&t!=="prototype"}function A(t,s){for(let[e,n]of Object.entries(s)){if(e==="attributes"||!M(e))continue;let o=t[e];R(o)&&R(n)?A(o,n):t[e]=n}}function l(t,s,e,n){let o=n===void 0?"":`${n} AND `,c=`SELECT ${s.join(", ")} FROM ${t} WHERE ${o}Id IN (`,i=p(`${c})`),a=p(", "),f=[],r=[],d=i,u=()=>{f.push(`${c}${r.join(", ")})`),r=[],d=i};for(let m of e){let g=`'${m}'`,C=d+a+p(g)>14e3||r.length>=500;r.length>0&&C&&u(),d+=(r.length>0?a:0)+p(g),r.push(g)}return r.length>0&&u(),f}var y="001000000000000AAA";function N(t,s,e){let n=Array.from({length:500},()=>y),[o=""]=l(t,s,n,e);return o.split(`'${y}'`).length-1}async function E(t,s,e){let n=new Map;for(let c of t){let i=c.Id;typeof i=="string"&&h.test(i)&&!n.has(i)&&n.set(i,c)}let o=[...n.keys()];if(o.length===0)return t;for(let c of s.others)for(let i of l(s.objectApiName,c,o))for(let a of await e(i)){let f=a.Id,r=typeof f=="string"?n.get(f):void 0;r&&A(r,a)}return t}var k=3;async function O(t,s,e,n){let o=new Set;for(let c of s.others){let i=[...t.keys()].filter(f=>!o.has(f));if(i.length===0)break;let a=new Set;for(let f of l(s.objectApiName,c,i,n.idsWhere))for(let r of await e(f)){let d=r.Id,u=typeof d=="string"?t.get(d):void 0;typeof d!="string"||!u||a.has(d)||(a.add(d),r[n.stamp]!==u[n.stamp]?o.add(d):A(u,r))}for(let f of i)a.has(f)||t.delete(f)}return o}async function I(t,s,e,n){let o=n.rereads??k,c=new Map;for(let f of t){let r=f.Id;typeof r=="string"&&h.test(r)&&!c.has(r)&&c.set(r,f)}let i=new Map;for(let f=0;c.size>0;f++){let r=await O(c,s,e,n);for(let[u,m]of c)r.has(u)||i.set(u,m);if(r.size===0)break;if(f>=o)throw new Error(`${r.size} record(s) of ${s.objectApiName} were written between two reads of their columns ${o+1} times in a row: they could not be read as one write left them.`);let d=new Map;for(let u of l(s.objectApiName,s.firstGroup,[...r],n.idsWhere))for(let m of await e(u)){let g=m.Id;typeof g=="string"&&r.has(g)&&!d.has(g)&&d.set(g,m)}c=d}let a=[];for(let f of t){let r=f.Id;if(typeof r!="string"||!h.test(r))a.push(f);else{let d=i.get(r);d&&a.push(d)}}return a}async function P(t,s,e){let n=_(t,e===void 0?void 0:["Id",e.stamp]);if(!n)return s(t);let o=await s(n.first);return e===void 0?E(o,n,s):I(o,n,s,e)}async function*j(t,s,e,n){let o=_(t,n===void 0?void 0:["Id",n.stamp]);if(!o){yield*s(t);return}for await(let c of s(o.first))yield n===void 0?await E(c,o,e):await I(c,o,e,n)}export{p as a,S as b,$ as c,L as d,_ as e,N as f,E as g,I as h,P as i,j};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ import{a,b}from"./chunk-HTJ5OGP5.mjs";import"./chunk-B45CNPUX.mjs";import"./chunk-7EANH5PY.mjs";import"./chunk-NTOVCTRS.mjs";export{a as DataPlanBuilder,b as resolveInsertOrder};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ import{c as A}from"./chunk-66NMFCWX.mjs";import{S as D}from"./chunk-6QSM2WIH.mjs";import{g as R}from"./chunk-PA3MKJVH.mjs";import{c as x,p as g,q as h,s as P,t as k}from"./chunk-CGWXQX75.mjs";import{fc as O}from"./chunk-B45CNPUX.mjs";import{b as d,f as l,k as m,l as b}from"./chunk-7EANH5PY.mjs";var j=[{child:"Entitlement",field:"AccountId",parent:"Account",refused:"always"},{child:"Order",field:"AccountId",parent:"Account",refused:"pastDraft"},{child:"Opportunity",field:"AccountId",parent:"Account",refused:"closedWon",rows:{field:"IsWon",value:!0}}];function C(e,n,t){let[s,r,a]=[e,n,t??""].map(i=>i.toLowerCase());return j.some(i=>i.refused==="always"&&i.child.toLowerCase()===s&&i.field.toLowerCase()===r&&(t===void 0||i.parent.toLowerCase()===a))}var W=b({name:d(),type:d(),createable:l().optional(),updateable:l().optional(),nillable:l().optional(),calculated:l().optional(),autoNumber:l().optional(),permissionable:l().optional(),encrypted:l().optional(),referenceTo:m(d()).nullish()}).loose(),oe=b({name:d(),undeletable:l().optional(),fields:m(W),childRelationships:m(b({childSObject:d(),field:d(),cascadeDelete:l().optional(),restrictedDelete:l().optional()}).loose()).nullish()}).loose(),F=["Id","SystemModstamp","CreatedDate","CreatedById","LastModifiedDate","LastModifiedById"],S="IsPersonAccount",M="Event",I=["LatestPublishedVersionId","ContentSize"],_=["ParentId","ContentAssetId","IsArchived"],v="VersionData";function N(e){return e.toLowerCase()===R.toLowerCase()}function B(e){return new Set(N(e)?I.map(n=>n.toLowerCase()):[])}function U(e){return e===x||e===M?"scanAllLive":"query"}function V(e){let n={name:e.name,label:e.name,labelPlural:e.name,keyPrefix:null,custom:!1,createable:!0,updateable:!0,deletable:!0,queryable:!0,fields:e.fields.map(t=>({name:t.name,label:t.name,type:t.type,length:0,nillable:t.nillable===!0,createable:t.createable===!0,updateable:t.updateable===!0,externalId:!1,referenceTo:t.referenceTo??[],relationshipName:null,picklistValues:[],defaultValue:null,calculated:t.calculated===!0,autoNumber:t.autoNumber===!0,unique:!1,...t.permissionable===void 0?{}:{permissionable:t.permissionable}})),recordTypeInfos:[],childRelationships:[]};return new A(async()=>n)}function G(e){return e.type==="address"||e.type==="location"}function y(e){return new Map(e.fields.map(n=>[n.name.toLowerCase(),n]))}async function K(e,n){let t=y(e),s=F.filter(o=>t.has(o.toLowerCase())),r=t.get(S.toLowerCase());r&&(e.name===g||e.name===h)&&s.push(r.name);let a=N(e.name);if(a)for(let o of I){let c=t.get(o.toLowerCase());c&&s.push(c.name)}let i=new Set(a?_.map(o=>o.toLowerCase()):[]),p=new Set(s.map(o=>o.toLowerCase())),f=e.fields.map(o=>o.name).filter(o=>!p.has(o.toLowerCase())&&!i.has(o.toLowerCase())),{writable:L,skipped:z,denied:T}=await V(e).partitionWritableFields(e.name,"upsert",f),w=[],u=new Map;for(let o of T)u.set(o,"fls");for(let o of z){let c=t.get(o.toLowerCase());c&&G(c)&&u.set(o,"compound")}let E=new Set(L);for(let o of L){let c=t.get(o.toLowerCase())?.type;c==="base64"?u.set(o,"base64"):c===D&&!n.viewsEncryptedData&&u.set(o,"encrypted")}for(let o of f){let c=u.get(o);c!==void 0?w.push({field:o,reason:c}):E.has(o)&&s.push(o)}return a&&w.push({field:v,reason:"base64"}),{fields:s,leftOutFields:w}}function q(e,n){let t=y(e),s=e.name.toLowerCase(),r=new Set;for(let a of n)for(let i of a.childRelationships??[]){if(i.cascadeDelete!==!0||i.childSObject.toLowerCase()!==s||C(e.name,i.field,a.name))continue;let p=t.get(i.field.toLowerCase());p&&r.add(p.name)}return[...r].sort()}function Y(e,n){let t=y(e),s=e.name.toLowerCase(),r=new Set;for(let a of n)for(let i of a.childRelationships??[]){if(!(i.restrictedDelete===!0&&i.cascadeDelete!==!0||C(e.name,i.field,a.name))||i.childSObject.toLowerCase()!==s)continue;let f=t.get(i.field.toLowerCase());f&&r.add(f.name)}return[...r].sort()}function re(e){let n=e.cascadeParents.filter(t=>C(e.objectApiName,t));return n.length===0?e:{...e,cascadeParents:e.cascadeParents.filter(t=>!n.includes(t)),restrictParents:[...new Set([...e.restrictParents??[],...n])].sort()}}async function se(e,n,t){return{objectApiName:e.name,readMode:U(e.name),undeletable:e.undeletable===!0,cascadeParents:q(e,n),restrictParents:Y(e,n),...await K(e,t)}}function H(e,n){let t=e.toLowerCase(),s=new Set;for(let r of n){let a=r.indexOf(".");a<=0||a===r.length-1||r.slice(0,a).toLowerCase()===t&&s.add(r.slice(a+1).toLowerCase())}return s}function J(e,n){let t=n.toLowerCase();return t!==S.toLowerCase()&&!F.some(s=>s.toLowerCase()===t)&&!B(e).has(t)}function ae(e,n,t){let s=H(e,t);return n.filter(r=>J(e,r)&&!s.has(r.toLowerCase()))}function ie(e,n){return e===h&&P(n)}function ce(e,n,t){let s=e===g?k(n,!1):void 0,r={};typeof n.Id=="string"&&(r.Id=n.Id);for(let a of t)a in n&&(s!==void 0&&O(g,a,s)||(r[a]=n[a]));return r}export{j as a,C as b,W as c,oe as d,S as e,I as f,U as g,re as h,se as i,H as j,ae as k,ie as l,ce as m};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ import{a,b,c}from"./chunk-AR7BE5O2.mjs";import"./chunk-3OHPD72J.mjs";import"./chunk-3RYLICRX.mjs";import"./chunk-PUOX4NBJ.mjs";import"./chunk-EQF2IJS2.mjs";import"./chunk-RSYICMZG.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-TEOLMRDO.mjs";import"./chunk-NTDN2JQZ.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-B45CNPUX.mjs";import"./chunk-7EANH5PY.mjs";import"./chunk-NTOVCTRS.mjs";export{a as DX_PROJECT_FILE,b as scenarioProjectOf,c as writeRunTestFile};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ import{a as y}from"./chunk-4TLYUZD5.mjs";import{d,f as i,g as u}from"./chunk-GCOB7K5N.mjs";import{b as p,k as m,l as f}from"./chunk-7EANH5PY.mjs";var M="SELECT Id, Name, DeveloperName, NamespacePrefix, SobjectType FROM RecordType WHERE IsActive = true",l=m(f({Id:p().min(1),Name:p(),DeveloperName:p().min(1),NamespacePrefix:p().nullable().optional(),SobjectType:p().min(1)}));function b(e){return l.parse(e).map(t=>({id:t.Id,name:t.Name,developerName:t.DeveloperName,namespacePrefix:t.NamespacePrefix?t.NamespacePrefix:null,sobjectType:t.SobjectType}))}var I=/^012000000000000(AAA)?$/;function T(e){return e===null||e===""||typeof e=="string"&&I.test(e)}function h(e){if(!T(e.RecordTypeId))return e;let t={...e};return delete t.RecordTypeId,t}function j(e,t,s="forge"){y.warn(`[${s}] ${e}: RecordTypeId ${t} has no active ${e} record type with the same API name on the target org. Records keep the source Id and the target org will likely refuse them \u2014 create or activate that record type on the target.`)}function k(e,t){let s=new Set(t.map(i)),a=[];for(let n of e){if(s.has(i(n)))continue;let o=t.filter(r=>r.developerName===n.developerName&&(r.sobjectType??"")===(n.sobjectType??""));o.length!==0&&a.push({objectApiName:n.sobjectType??"",source:d(n),target:o.map(d)})}return a}function v(e){let t=u(e.source).namespacePrefix,s=t?`of package ${t}`:"the source org's own";return`${e.objectApiName}: record type ${e.source}, ${s}, is not mapped to ${e.target.join(" or ")} in the target org: a record type is matched to one of the same namespace only. Its records keep the source Id unless the target gets ${e.source}, or a decision maps it.`}var R=class{buildMapping(t,s){let a=new Map;for(let o of s)a.set(i(o),o);let n=[];for(let o of t){let r=a.get(i(o));r&&n.push({sourceId:o.id,targetId:r.id,developerName:d(o)})}return n}apply(t,s,a){let n=new Map;for(let r of s)n.set(r.sourceId,r.targetId);let o=new Set;return t.map(r=>{let c=r.RecordTypeId;if(T(c))return h(r);if(typeof c!="string")return{...r};let g=n.get(c);return g?{...r,RecordTypeId:g}:(a&&!o.has(c)&&(o.add(c),a(c)),{...r})})}};export{M as a,b,T as c,h as d,j as e,k as f,v as g,R as h};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ import{a as b,b as D}from"./chunk-5CD257T7.mjs";import{a as S,b as R}from"./chunk-RH3N2H7P.mjs";import{b as C}from"./chunk-CA5NAXSU.mjs";import{Zb as k}from"./chunk-B45CNPUX.mjs";var A=[{field:"PermissionsViewAllData",label:"View All Data"},{field:"PermissionsModifyAllData",label:"Modify All Data"}],O="PermissionsQueryAllFiles",E="PermissionsCustomizeApplication",d="No record was read or written.";function c(e,t){return{allowed:!1,refusal:{code:e,message:t}}}function g(e,t){return c("PRODUCTION",`${e} is a production org, or cannot be told from one: ${t}. Checkpoints are for sandboxes, scratch orgs and Developer Edition orgs: SandForge never takes a checkpoint of, or rewinds, a production org. ${d}`)}function T(e){return e.edition?`its Organization record says IsSandbox false, edition ${e.edition}`:"its Organization record says IsSandbox false, and no edition"}function $(e,t){return e.slice(0,15)===t.slice(0,15)}function v(e,t){return e.orgType==="Scratch"?"scratch":t.sandbox?"sandbox":"developer"}var G={take:"A checkpoint needs a user with View All Data and Modify All Data: a rewind to it must",preview:"A preview needs a user with View All Data and Modify All Data: a record the user cannot see would read as deleted since, and the rewind it shows must",rewind:"Rewind needs a user with View All Data and Modify All Data: it must",undo:"Undo needs a user with View All Data and Modify All Data: it must",import:"An import needs a user with View All Data and Modify All Data: SandForge never keeps on this machine records its user could not see in the org, and a rewind to it must"},j={take:"Leave the custom settings out of the checkpoint, or give the user Customize Application.",preview:"This checkpoint holds custom settings: give the user Customize Application.",rewind:"This checkpoint holds custom settings: give the user Customize Application.",undo:"This checkpoint holds custom settings: give the user Customize Application.",import:"This checkpoint holds custom settings: give the user Customize Application."};function N(e){return c("PERMISSIONS",`${e.username} needs Customize Application to keep and rewind custom settings, and doesn't have it: View All Custom Settings lets a user read them, never write them. ${j[e.act]} ${d}`)}async function V(e,t){let r=[...A.map(n=>n.field),...t?[E]:[]],i=async n=>(await e.query(`SELECT ${n.join(", ")} FROM UserPermissionAccess`)).records[0],o;try{o=await i([...r,O])}catch{try{o=await i(r)}catch(n){return{unread:n instanceof Error?n.message:String(n)}}}return{missing:A.filter(n=>o?.[n.field]!==!0).map(n=>n.label),viewAllData:o?.PermissionsViewAllData===!0,modifyAllData:o?.PermissionsModifyAllData===!0,queryAllFiles:o?.[O]===!0,customizeApplication:o?.[E]===!0}}var z=/^005[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/,x=/^0PG[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/,P="SobjectType, PermissionsViewAllRecords, PermissionsModifyAllRecords";async function f(e,t){let r=await e.query(t),i=1,o=[...r.records];for(;!r.done;){let n=r.nextRecordsUrl;if(n===void 0||e.queryMore===void 0)throw new Error(`the org answered ${o.length} rows of ${r.totalSize}, and no next page`);r=await e.queryMore(n),i++,o.push(...r.records)}return{rows:o,requests:i}}async function F(e,t){let r=0;try{let i=await t();if(r++,!z.test(i))throw new Error(`the org named the user ${JSON.stringify(i)}`);let o=await f(e,`SELECT ${P} FROM ObjectPermissions WHERE ParentId IN (SELECT PermissionSetId FROM PermissionSetAssignment WHERE AssigneeId = '${i}' AND PermissionSetGroupId = null)`);r+=o.requests;let n=await f(e,`SELECT PermissionSetGroupId FROM PermissionSetAssignment WHERE AssigneeId = '${i}' AND PermissionSetGroupId != null`);r+=n.requests;let l=[...new Set(n.rows.map(a=>a.PermissionSetGroupId).filter(a=>typeof a=="string"&&x.test(a)))],s=[...o.rows];if(l.length>0){let a=await f(e,`SELECT ${P} FROM ObjectPermissions WHERE Parent.PermissionSetGroupId IN (${l.map(u=>`'${u}'`).join(", ")})`);r+=a.requests,s.push(...a.rows)}return{grants:b(s),requests:r}}catch(i){return{unread:C(i)}}}var I={take:"A checkpoint needs a user with View All Data and Modify All Data, or with View All and Modify All on each object it holds: a rewind to it must see and put back what everyone changed there.",preview:"A preview needs a user with View All Data and Modify All Data, or with View All and Modify All on each object it reads: a record the user cannot see would read as deleted since.",rewind:"Rewind needs a user with View All Data and Modify All Data, or with View All and Modify All on each object it puts back: it must see and put back what everyone changed there.",undo:"Undo needs a user with View All Data and Modify All Data, or with View All and Modify All on each object it takes back: it must see and put back what everyone changed there."};async function H(e,t,r={}){let{orgName:i,registered:o}=t;if(o===void 0)return g(i,"SandForge has no record of what kind of org it is");if(!k(o))return g(i,"SandForge has it registered as a production org");let n;try{n=await S(e)}catch(m){let M=m instanceof Error?m.message:String(m);return g(i,`it did not say what org it is (${M})`)}if(R(n))return g(i,T(n));if(t.act!=="take"&&!$(n.id,t.organizationId))return c("OTHER_ORG",t.act==="import"?`${i} is another org than the one this file holds a checkpoint of: it is imported for the org it was taken of alone, under any alias of it. Nothing was imported.`:`${i} is another org than the one this checkpoint was taken of: its Organization Id has changed, as a sandbox's does when it is refreshed. This checkpoint is of the org before it, and can only be deleted. ${d}`);let l=t.customSettings===!0,s=await V(e,l),a=`${G[t.act]} see and put back what everyone changed.`;if("unread"in s)return c("PERMISSIONS",`${a} SandForge could not read whether ${t.username} has them (${s.unread}), and takes an org that will not say for a user who has neither. `+d);let u=s.missing.length===A.length?"them":s.missing.join(" and "),p=t.act,w=p==="import"?void 0:r.userId;if(s.missing.length>0&&w===void 0)return c("PERMISSIONS",`${a} ${t.username} doesn't have ${u}. ${d}`);if(l&&!s.customizeApplication)return N(t);let y={allowed:!0,org:n,tier:v(o,n),queryAllFiles:s.queryAllFiles};if(s.missing.length===0||w===void 0||p==="import")return{...y,grants:{kind:"org"}};let h=await F(e,w);return"unread"in h?c("PERMISSIONS",`${I[p]} ${t.username} doesn't have ${u}, and SandForge could not read which objects they have View All and Modify All on (${h.unread}). View Setup and Configuration lets a user read their own permissions; with View All Data and Modify All Data, nothing needs reading. `+d):D(h.grants)?{...y,grants:{kind:"perObject",viewAllData:s.viewAllData,modifyAllData:s.modifyAllData,objects:h.grants,requests:h.requests}}:c("PERMISSIONS",`${I[p]} ${t.username} doesn't have ${u}, nor View All and Modify All on any object. Give the user View All and Modify All on the objects to hold, or View All Data and Modify All Data. ${d}`)}export{F as a,H as b};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ import{m,n as w}from"./chunk-6MUEPV7M.mjs";import{b as h}from"./chunk-MTMH6H2A.mjs";import{ac as g,o as l,p}from"./chunk-B45CNPUX.mjs";import{A as f}from"./chunk-7EANH5PY.mjs";import{a as b,b as C}from"./chunk-SBIMVCXT.mjs";import{d as u}from"./chunk-NTOVCTRS.mjs";var c=class extends Error{constructor(r,t){super(`${t} Nothing was read from ${r}.`);this.alias=r;this.reason=t;this.name="SfSessionError",this.stack=this.message}alias;reason},$=f.object({name:f.string().optional(),message:f.string().optional()}).loose();function S(e){if(typeof e!="string")return;let n=e.replace(/\u001b\[[0-9;]*m/g,""),r=n.indexOf("{");if(r!==-1)try{let t=$.safeParse(JSON.parse(n.slice(r)));return t.success?t.data:void 0}catch{return}}function E(e,n=process.platform){let r=typeof e=="object"&&e!==null?e:{};return r.code==="ENOENT"?!0:n==="win32"&&(r.status===9009||/is not recognized as an internal or external command/i.test(String(r.stderr??"")))}function x(e,n,r=process.platform){if(E(n,r))return new c(e,`${l} SandForge reads each org through the Salesforce CLI: install it with "npm install -g @salesforce/cli" (${p}), sign in to the org with "sf org login web --alias ${e}", and run again.`);let t=typeof n=="object"&&n!==null?n:{},o=S(t.stdout)??S(t.stderr);if(o?.name==="NamedOrgNotFoundError"||/^No authorization information found for /.test(o?.message??""))return new c(e,`sf does not know ${e}: "sf org list" names the orgs it knows; "sf org login web --alias ${e}" adds it (in a CI job, "sf org login jwt" or "sf org login sfdxurl").`);let i=typeof t.stderr=="string"?t.stderr.split(/\r?\n/).find(a=>a.trim()!==""):void 0,s=o?.message?.trim()||i?.trim()||(n instanceof Error?n.message:String(n));return new c(e,`sf could not show ${e}: ${s}`)}var y=u(C()),k=u(b());import{execFileSync as I}from"node:child_process";function T(e){try{return I("sf",["org","display","--target-org",e,"--json"],{encoding:"utf8",maxBuffer:50*1024*1024,shell:process.platform==="win32"})}catch(n){throw x(e,n)}}async function J(e,n=w){if(!h.test(e))throw new Error(`Invalid SF org alias: "${e}" (an alias or a username: letters, digits, _ . @ + and -, not starting with . @ + or -)`);let r=T(e),t=JSON.parse(r),o=t.result;if(typeof o?.devHubId=="string"&&o.devHubId!==""){let s=typeof o.expirationDate=="string"?g({orgType:"Scratch",metadata:{expirationDate:o.expirationDate}},new Date().toISOString().slice(0,10)):void 0;if(s!==void 0||o.status==="Deleted")throw new Error(`The scratch org '${e}' ${s!==void 0?`expired on ${s}`:"is deleted"}: Salesforce deletes a scratch org when it expires, and no sign-in brings it back. Create a new one ("sf org create scratch") and give its alias.`)}if(!t.result?.instanceUrl)throw new Error(`sf org display did not return a usable session for alias '${e}'.`);let i=await n(e);if(!m(i.accessToken))throw new Error(`The Salesforce CLI showed no usable access token for alias '${e}'. Sign in again with "sf org login web --alias ${e}" where a browser opens; in a CI job, with "sf org login jwt --alias ${e}" (a client id, a key file and a username) or "sf org login sfdxurl --alias ${e} --sfdx-url-file <file>" (see ci-examples/README.md).`);return{alias:e,username:t.result.username??"",instanceUrl:i.instanceUrl??t.result.instanceUrl,accessToken:i.accessToken,...typeof t.result.devHubId=="string"&&t.result.devHubId!==""?{scratch:!0}:{}}}function d(e,n){let r=(e[n.toLowerCase()]??e[n.toUpperCase()]??"").trim();return r===""?void 0:r}function L(e,n){if(n===void 0)return!1;let r=e.hostname.toLowerCase(),t=e.port||(e.protocol==="https:"?"443":"80");return n.split(/[\s,]+/).filter(o=>o!=="").some(o=>{if(o==="*")return!0;let[,i="",s]=/^(.*?)(?::(\d+))?$/.exec(o.toLowerCase())??[];if(s!==void 0&&s!==t)return!1;let a=i.replace(/^\*?\.?/,"");return a!==""&&(r===a||r.endsWith(`.${a}`))})}function N(e,n=process.env){let r;try{r=new URL(e)}catch{return}let t=r.protocol==="https:"?d(n,"https_proxy")??d(n,"http_proxy"):d(n,"http_proxy");if(t!==void 0)return L(r,d(n,"no_proxy"))?void 0:t}function A(e,n=process.env){let r=N(e.instanceUrl,n),t=new y.default.Connection({instanceUrl:e.instanceUrl,accessToken:e.accessToken,version:"66.0",...r!==void 0?{httpProxy:r}:{}});return r===void 0&&(t._transport=new k.HttpProxyTransport("")),t}export{c as a,J as b,A as c};
@@ -0,0 +1,9 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ import{i as E}from"./chunk-57VHUYNG.mjs";import{b as j,c as S,e as U,m as O,n as P,o as C}from"./chunk-342FN7AO.mjs";import{h as B}from"./chunk-PA3MKJVH.mjs";import{ca as N}from"./chunk-CGWXQX75.mjs";import{Kc as A,Sc as y}from"./chunk-B45CNPUX.mjs";var h="No record was written.",l=e=>e.toLocaleString("en-US"),D=e=>e.toDelete.createdSince+e.toDelete.broughtBackSince+e.toDelete.comesBackWithParent,$=e=>e.toBringBack.inBin+e.toBringBack.withParent+e.toBringBack.deletedWhileTaken,k=e=>e.toRecreate??0,v=e=>e.toBringBack.carriers??0;function L(e){let n=t=>D(t)+t.toGiveBack.records+$(t)+v(t)+k(t)>0,o=e.objects.filter(n).map(t=>t.objectApiName),a=e.files;return a!==void 0&&a.unlink+a.relink+a.updateLinks>0&&o.push(B),o}function M(e){return e.objects.reduce((n,o)=>({toDelete:n.toDelete+D(o),toGiveBack:n.toGiveBack+o.toGiveBack.records,toBringBack:n.toBringBack+$(o),toRecreate:n.toRecreate+k(o)}),{toDelete:0,toGiveBack:0,toBringBack:0,toRecreate:0})}function te(e,n){let o=new Set(n.objects),a=new Map(n.acts.map(i=>[i.objectApiName,i]));return{...E(e,o),objects:e.objects.filter(i=>o.has(i.objectApiName)||a.has(i.objectApiName)).map(i=>{let s=a.get(i.objectApiName),r=o.has(i.objectApiName);return{...i,toDelete:{createdSince:s?.toDelete??0,broughtBackSince:0,comesBackWithParent:0},toGiveBack:{...i.toGiveBack,records:s?.toGiveBack??0},toBringBack:{inBin:s?.toBringBack??0,withParent:0,deletedWhileTaken:0,...r&&i.toBringBack.carriers!==void 0?{carriers:i.toBringBack.carriers}:{}},toRecreate:s?.toRecreate??0,cannotUndo:r?i.cannotUndo:[],unexplained:r?i.unexplained:0}}),undoCannot:[...n.undoCannot]}}function W(e){let n=e.objects.filter(t=>D(t)+v(t)>0).map(t=>t.objectApiName),o=e.files,a=(t,i)=>i>0?[...t,B]:t;return{bringBack:e.objects.filter(t=>$(t)+v(t)>0).map(t=>t.objectApiName),recreate:a(e.objects.filter(t=>k(t)>0).map(t=>t.objectApiName),o?.relink??0),giveBack:a(e.objects.filter(t=>j(t)+U(t)>0).map(t=>t.objectApiName),o?.updateLinks??0),setToDraft:e.objects.filter(t=>S(t)>0).map(t=>t.objectApiName),delete:a(n,o?.unlink??0)}}function z(e){return new Set(e.map(n=>`${n.objectApiName}
8
+ ${n.kind}
9
+ ${n.name}`)).size}function ne(e,n,o,a=!1){let t=(c,f)=>(c??[]).includes(f),i=o.filter(c=>!t(n.recreate,c)),s=o.filter(c=>N[c]!==void 0&&!t(n.giveBack,c)),r=new Set(e.objectsRead),d=[...i,...s];return{fired:y(e,{recreate:i,giveBack:s}),blind:d.length>0&&(!a&&A(e.unread)||d.some(c=>!r.has(c)))}}var T={limit:e=>`this step's limit of ${l(e)}`,mutes:!1,lift:{acceptAutomation:"turn on muteAutomation in the step for what a bypass keeps quiet, or acceptAutomation to let it run, and confirm it again to rewind all the same",acceptEmails:"turn on acceptEmails in the step and confirm it again to rewind all the same",acceptNoUndo:"turn on acceptNoUndo in the step and confirm it again to rewind all the same",acceptRecreate:"turn on acceptRecreate in the step and confirm it again to rewind all the same",acceptUnseen:"turn on acceptUnseen in the step and confirm it again to rewind all the same",maxRecords:"preview the rewind, then raise the step's maxRecords to what it rewinds and confirm it again",refuseWhenActive:"run it once they are done, or turn off refuseWhenActive in the step and confirm it again"}},oe={...T,lift:{...T.lift,acceptAutomation:"turn on acceptAutomation in the step to let what no bypass keeps quiet run, and confirm it again to rewind all the same"}},H=[{reason:"onlyWithParent",words:"Salesforce undeletes them only with their parent, which stays"},{reason:"deletedBeforeParent",words:"deleted before a record they point at, which the rewind deletes next, Salesforce cannot bring them back after that"}],Y="Add --accept-emails to rewind all the same";function q(e,n,o,a,t){let{automation:i,deliverability:s}=n;if(!i||!s)return;let r=W(n.diff),{refusal:d}=C({act:"rewind",orgName:e,automation:i,steps:r,accepted:o.acceptEmails===!0,mayMute:t,...P({automation:i,steps:r}),reading:s.reading});if(!d)return;let c=a.acceptEmails;return{...d,message:d.message.replace(Y,`${c.charAt(0).toUpperCase()}${c.slice(1)}`)}}function ie(e,n,o,a,t="the user SandForge connects as",i=!1){return _(e,n,o,a,t,i)[0]}function _(e,n,o,a,t="the user SandForge connects as",i=!1){let s=[],{diff:r,automation:d}=n;if(r.undoCannot.length>0&&!o.acceptNoUndo){let u=H.flatMap(({reason:w,words:g})=>{let R=r.undoCannot.filter(b=>(b.reason??"onlyWithParent")===w);if(R.length===0)return[];let F=R.reduce((b,G)=>b+G.count,0),I=[...new Set(R.map(b=>b.objectApiName))].join(", ");return[`Undo couldn't bring back ${l(F)} ${I} record(s) this rewind deletes: ${g}.`]});s.push({code:"NO_UNDO",message:`${u.join(" ")} Rewind refused; ${a.acceptNoUndo}. ${h}`})}let c=r.objects.filter(u=>k(u)>0);if(c.length>0&&!o.acceptRecreate){let u=c.reduce((w,g)=>w+k(g),0);s.push({code:"RECREATE",message:`${l(u)} ${c.map(w=>w.objectApiName).join(", ")} record(s) deleted since are no longer in the recycle bin, or Salesforce keeps them there for good: this rewind makes them again from the checkpoint, with new Ids. Anything outside Salesforce that names their old Ids \u2014 an integration, a link, a report filter \u2014 no longer finds them. Rewind refused; ${a.acceptRecreate}. ${h}`})}let f=r.unseen??[];if(f.length>0&&o.acceptUnseen!==!0){let u=f.map(({objectApiName:w,children:g,records:R})=>`Deleting ${l(R)} ${w} record(s) created since also deletes what ${t} can't see under them in ${g.join(", ")}: Rewind can't count those.`);s.push({code:"UNSEEN",message:`${u.join(" ")} Rewind refused; ${a.acceptUnseen}. ${h}`})}if(!d)return s;let m=K(e,n,o,a),p=q(e,n,o,a,i);return[...s,...m?[m]:[],...p?[p]:[]]}function K(e,n,o,a){let{diff:t,automation:i,emailsUncounted:s}=n;if(!i||o.acceptAutomation)return;let r=W(t),d=y(i,r);if(d.length===0&&!A(i.unread)&&s===void 0)return;let c=[...new Set(d.map(u=>u.objectApiName))],f=(r.recreate??[]).some(u=>u!==B)?"makes them again, ":"",m=d.length>0?`${z(d)} flow(s), trigger(s) or rule(s) of ${c.join(", ")} run as the rewind brings records back, ${f}gives them their values back or deletes them`:"what runs as the rewind writes could not all be read, so automation may run",p=s!==void 0?`The emails it sends as the rewind writes were not counted against its daily limits, as what sends them was not read (${s}). `:"";return{code:"AUTOMATION",message:`${e}: ${m}. ${p}Rewind refused; ${a.acceptAutomation}. `+h}}var x=e=>e.slice(0,15);async function ae(e){return(await J(e))[0]}async function J(e){let{orgName:n,preview:o,bounds:a,words:t}=e,{diff:i}=o;if(L(i).length===0)return[];let s=[],r=M(i),d=r.toDelete+r.toGiveBack+r.toBringBack+r.toRecreate;if(a.maxRecords!==void 0&&d>a.maxRecords){let f=[`${l(r.toDelete)} to delete`,`${l(r.toGiveBack)} to give back`,`${l(r.toBringBack)} to bring back`,...r.toRecreate>0?[`${l(r.toRecreate)} to make again`]:[]];s.push({code:"TOO_MANY_TO_REWIND",message:`The rewind of ${n} would rewind ${l(d)} records (${f.join(", ")}), past ${t.limit(a.maxRecords)}. Rewind refused; ${t.lift.maxRecords}. `+h})}if(a.refuseWhenActive&&i.activeLastHour.length>0){let f=new Set((await e.writers()).map(x)),m=new Set(i.activeLastHour.map(x).filter(p=>!f.has(p)));if(m.size>0){let p=m.size===1?"1 person":`${l(m.size)} people`;s.push({code:"PEOPLE_ACTIVE",message:`${p} other than the user the rewind writes as changed records of the checkpoint's objects in ${n} in the hour before the rewind read it: it would take their work back. Rewind refused; ${t.lift.refuseWhenActive}. `+h})}}let c=O("rewind",o.emails??[],n);return[...s,..._(n,o,e.accepted,t.lift,e.user,t.mutes),...c?[c]:[]]}function re(e,n,o){let a=n.map(t=>`${t.objectApiName} (${l(t.records)})`).join(", ");return{code:"UNDELETABLE_UNATTENDED",message:`The user SandForge connects to ${e} as may not delete the ${a} record(s) this rewind deletes. With nobody to ask whether to delete the rest, the deletion was left untouched. Give the user Delete on those objects, or rewind from the Checkpoints page, which asks. `+(o?"What the rewind's first pass wrote stays: its result says what, and Undo takes it back.":h)}}function se(e,n){return{code:"NOT_CONFIRMED",message:`Rewind step "${e}" has `+(n?"not been confirmed since it was changed":"never been confirmed")+": open it and type the org's alias, or, for an org that has none, its name or Organization Id. "+h}}export{L as a,M as b,te as c,W as d,z as e,ne as f,T as g,oe as h,ie as i,ae as j,J as k,re as l,se as m};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ import{b as N}from"./chunk-WR2GIKWE.mjs";import{a as k}from"./chunk-BOGNK4LV.mjs";import{i as S}from"./chunk-Z7X534S4.mjs";import{a as _,b as E}from"./chunk-T63U4OZJ.mjs";import{Ba as V,E as L,Ha as H,N as F,O as w,Q as U,R as x,T as G,U as v,W as B,Wa as X,_ as j,qa as M,ta as W,ya as z}from"./chunk-VXHDBYMI.mjs";import{b as h,f as P,k as b,l as D}from"./chunk-7EANH5PY.mjs";var q={PII:"PII",PHI:"PHI",PCI:"PCI",Confidential:"SENSITIVE"},K={PII:"fake",PHI:"nullify",PCI:"mask",SENSITIVE:"hash",NONE:"fake"},$={name_pattern:"field_name",type_analysis:"field_name",content_pattern:"content_sampling"},J=.9;function ie(e,t){let n=[];for(let[i,a]of t){let c=a.fields.filter(o=>o.createable&&N({name:o.name,label:o.label,type:o.type})),l=new Map(c.map(o=>[o.name,o])),r=new Map,s=e.detectPII(i,c.map(o=>({apiName:o.name,label:o.label,type:o.type})));for(let o of s.piiFields){let u=l.get(o.fieldApiName);if(!u)continue;let d=q[o.classification];r.set(u.name,{objectApiName:i,fieldApiName:u.name,fieldLabel:u.label,fieldType:u.type,piiCategory:d,detectionMethod:$[o.detectionMethod],confidence:o.confidence,suggestedMethod:K[d]})}for(let o of c)r.has(o.name)||E(o.name,o.type)===void 0||r.set(o.name,{objectApiName:i,fieldApiName:o.name,fieldLabel:o.label,fieldType:o.type,piiCategory:"PII",detectionMethod:"field_name",confidence:J,suggestedMethod:"fake"});n.push(...r.values())}return n}function ae(e,t){let n=a=>`${a.objectApiName}.${a.fieldApiName}`,i=new Set(e.map(n));return[...e,...t.filter(a=>!i.has(n(a)))]}var Y=["Contact","Lead"];function re(e,t,n){if(e==="none")return[];let i=new Set(t),a=[];for(let c of Y){if(!i.has(c))continue;let l=n.filter(s=>s.objectApiName===c).map(s=>s.fieldApiName),r=[];l.some(_)||r.push("name"),l.some(s=>E(s,"string")==="email")||r.push("email"),l.some(s=>E(s,"string")==="phone")||r.push("phone"),r.length>0&&a.push({objectApiName:c,missing:r})}return a}function ce(e){return e.fatalError!==void 0?"failure":e.totalFailure>0||e.failedObjects.length>0?e.totalSuccess+(e.totalLinked??0)>0?"partial":"failure":[...Object.values(e.lookups??{}),...Object.values(e.statuses??{})].some(n=>n.refusals.length>0)||e.stopped===!0?"partial":"success"}var Q=D({name:h().min(1),referenceTo:b(h()).min(1),createable:P().optional(),updateable:P().optional()}).loose();function de(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let i=Q.safeParse(n);i.success&&t.push({name:i.data.name,referenceTo:i.data.referenceTo,createable:i.data.createable??!1,updateable:i.data.updateable??!1})}return t}var ge={STORAGE_EXCEEDED:"AUTOPILOT_STORAGE_EXCEEDED",API_BUDGET_EXCEEDED:"API_BUDGET_EXCEEDED",WRITE_DECLINED:"AUTOPILOT_WRITE_DECLINED",CONFIRMATION_UNAVAILABLE:"AUTOPILOT_CONFIRMATION_UNAVAILABLE",CHECKPOINT_REFUSED:"CHECKPOINT_REFUSED",RUN_CANCELLED:"RUN_CANCELLED",EMAILS_NOT_ACCEPTED:z},Ae={NO_PLAN:"AUTOPILOT_NO_PLAN",STORAGE_UNREAD:"AUTOPILOT_FIT_STORAGE_UNREAD",READ_REFUSED:"AUTOPILOT_FIT_READ_REFUSED",STALE:"AUTOPILOT_FIT_STALE"};function Ie(e,t,n=new Map){return L(e.waves.flatMap(i=>i.objects).map(i=>{let a=n.get(i);return{objectApiName:i,rows:[],counted:{rows:t.get(i)??0,...a!==void 0?{personAccounts:a}:{}}}}))}function Ce(e){return[...new Set(e.waves.flatMap(t=>t.objects.map(String)))]}async function he(e){return M(e)}function Z(e){return e.filter(t=>t.verdict==="exceeds").map(W)}function ee(e){return e.filter(t=>t.verdict==="unread").map(t=>({limit:t.limit,emails:t.emails,unread:t.unread??""}))}function Pe(e){return e.objects.filter(({rows:t})=>t>0).length}async function te(e,t,n,i,a={}){let c="unread"in t?await n().catch(o=>({unread:o instanceof Error?o.message:String(o)})):t.dailyApiRequests,{readBack:l=0,deliverability:r=0,mute:s=0}=a;return w({run:F(e.objects.map(({rows:o})=>({rows:o}))),...G(i),...s>0?{mute:s}:{},...l>0?{readBack:l}:{},...r>0?{deliverability:r}:{}},c)}async function ke(e){let{plan:t}=e,n=j(t,e.storage);if(t.totalRows===0)return{go:!0,check:n,asked:!1};let i=e.checkpointFirst?.estimate,a=v(i);if(a)return{go:!1,...a,check:n};let c=X(n,e.org);if(c)return{go:!1,code:"STORAGE_EXCEEDED",message:`${c} Nothing was written.`,check:n};let l=await te(t,e.storage,e.readApiBudget,i,{...e.readBack!==void 0?{readBack:e.readBack}:{},...e.mute!==void 0?{mute:e.mute}:{},...V(e.runEmails?.ofRun)}),r=U(l,e.org);if(r)return{go:!1,code:"API_BUDGET_EXCEEDED",message:r,check:n};let s=e.confirmAboveRecords,o=s>0&&t.totalRows>s?s:void 0,u=Z(e.emails??[]),d=ee(e.emails??[]),g=e.emailsUncounted,f=e.runEmails?.gate,y=f?.verdict==="asks",R=async m=>{let p=k(f,m&&y),I=e.checkpointFirst;if(I===void 0)return{go:!0,check:n,asked:m,...p};let C=await B(()=>I.take(I.estimate));return"stop"in C?{go:!1,...C.stop,check:n,...p}:{go:!0,check:n,asked:m,checkpoint:C.checkpoint,...p}};if(o===void 0&&n.verdict==="fits"&&u.length===0&&d.length===0&&g===void 0&&i===void 0&&!y)return R(!1);let A=S(e.orgTier),T=await e.confirm({stage:"write",module:"autopilot",org:e.org,orgTier:e.orgTier,objects:t.objects.map(({objectApiName:m,rows:p})=>({objectApiName:m,rows:p})),total:t.totalRows,...o!==void 0?{aboveRecords:o}:{},...A!==void 0&&t.totalRows>A?{largeVolume:A}:{},storage:H(n),counted:!0,...u.length>0?{emails:u}:{},...d.length>0?{emailsUnread:d}:{},...g!==void 0?{emailsUncounted:g}:{},...x(l),...i!==void 0?{checkpoint:i}:{},...f?.confirmation});if(T==="confirmed")return R(!0);let O=k(f,!1);return T==="declined"?{go:!1,code:"WRITE_DECLINED",message:"The Autopilot run was cancelled before it wrote anything. Nothing was written.",check:n,...O}:{go:!1,code:"CONFIRMATION_UNAVAILABLE",message:"The Autopilot run needed a confirmation before it wrote, and there was no one to ask. Nothing was written.",check:n,...O}}export{ie as a,ae as b,re as c,ce as d,de as e,ge as f,Ae as g,Ie as h,Ce as i,he as j,Pe as k,te as l,ke as m};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ import{b as l}from"./chunk-CA5NAXSU.mjs";import{ld as m,md as S,qd as h,rd as g,sd as y}from"./chunk-B45CNPUX.mjs";var T=576*60*60*1e3,P=T,f=class extends Error{constructor(e){super(e),this.name="StepCancelledError"}},b=Symbol("stopped");function w(t,e,n,i){let r=new Date().toISOString();return{stepId:t.id,stepName:t.name,stepType:t.type,status:"completed",output:e,summary:i,startTime:n,endTime:r,duration:new Date(r).getTime()-new Date(n).getTime()}}function d(t,e,n){let i=new Date().toISOString();return{stepId:t.id,stepName:t.name,stepType:t.type,status:"failed",error:e,startTime:n,endTime:i,duration:new Date(i).getTime()-new Date(n).getTime()}}function v(t){return y(t.type)?`Step "${t.name}" is a ${String(t.type)} step, which SandForge no longer supports: remove it from the pipeline.`:g(t.type)?`Step "${t.name}" is a ${String(t.type)} step, and this step type cannot run in a pipeline yet.`:`Step "${t.name}" is a "${String(t.type)}" step, a step type this release of SandForge does not have: the pipeline was saved by a later release, or written by hand. Remove the step, or update SandForge.`}function x(t){let{timeout:e}=t;if(e!==void 0){if(typeof e!="number"||!Number.isFinite(e))return`Step "${t.name}" has a timeout that is not a number of milliseconds: ${JSON.stringify(e)}.`;if(e>P)return`Step "${t.name}" has a timeout of ${e} ms, longer than a step can be given: set at most 24 days (${P} ms).`}}function D(t){let e=t.seconds,n=e===void 0?t.durationMs:e;if(typeof n!="number"||!Number.isFinite(n)||n<0)return;let i=e===void 0?n:n*1e3;return i<=T?i:void 0}function C(t){if(t.config.seconds===void 0&&t.config.durationMs===void 0)return`Delay step "${t.name}" has no duration: set how many seconds it waits.`;if(D(t.config)===void 0)return`Delay step "${t.name}" has no usable duration: set a number of seconds, from 0 up to 24 days.`}function H(t,e,n){let i=`Condition step "${t.name}"`;switch(n){case"noEarlierStep":return`${i} tests how the previous step went, and no step comes before it.`;case"noCompare":return`${i} tests how many differences a comparison found, and no Compare step comes before it.`;case"noPrecheck":return`${i} tests ${e}, which a Pre-check hands on, and no Pre-check before it takes that reading.`}}function k(t){let e=t.condition;if(!e||typeof e.field!="string"||e.field.trim()==="")return`Condition step "${t.name}" has no condition to evaluate.`;let n=m(e);return n===void 0?void 0:`Condition step "${t.name}" ${n}.`}function M(t,e){let n=k(t);if(n!==void 0||!t.condition||!e)return n;let i=t.condition,r=h(i,e.steps.slice(0,e.index),e.declared);return r===void 0?void 0:H(t,i.field,r)}function E(t,e){return e?.aborted?Promise.resolve(!1):new Promise(n=>{let i=()=>{clearTimeout(r),n(!1)},r=setTimeout(()=>{e?.removeEventListener("abort",i),n(!0)},t);e?.addEventListener("abort",i,{once:!0})})}var $=class{handlers=new Map;checks=new Map;constructor(){this.registerDefaults()}async execute(e,n){let i=new Date().toISOString(),r=this.check(e);if(r)return d(e,r,i);let o=this.getExecutor(e.type),c=e.retries??0,u="";for(let p=0;p<=c;p++){let s=await this.attempt(o,e,n);if("result"in s)return s.result;if(s.stopped)return{...d(e,s.error,i),status:"stopped"};u=s.error}return d(e,u,i)}async attempt(e,n,i){let r=i.signal;if(r?.aborted)return{error:`Step "${n.name}" was stopped before it started.`,stopped:!0};let o=new AbortController,c=new Promise(a=>{o.signal.addEventListener("abort",()=>a(b),{once:!0})}),u=()=>o.abort();r?.addEventListener("abort",u,{once:!0});let p=!1,s=n.timeout,R=s!==void 0&&s>0?setTimeout(()=>{p=!0,o.abort()},s):void 0;try{let a=await Promise.race([e(n,{...i,signal:o.signal}),c]);return a!==b?{result:a}:p?{error:`Step "${n.name}" timed out after ${s} ms.`}:{error:`Step "${n.name}" was stopped before it finished.`,stopped:!0}}catch(a){return a instanceof f?{error:a.message,stopped:!0}:{error:l(a)}}finally{clearTimeout(R),r?.removeEventListener("abort",u)}}check(e,n){return this.handlers.has(e.type)?x(e)??this.checks.get(e.type)?.(e,n):v(e)}getExecutor(e){return this.handlers.get(e)??this.refusingHandler}registerHandler(e,n,i){this.handlers.set(e,n),i?this.checks.set(e,i):this.checks.delete(e)}refusingHandler=async e=>d(e,v(e),new Date().toISOString());registerDefaults(){this.handlers.set("delay",this.createDelayHandler()),this.checks.set("delay",C),this.handlers.set("condition",this.createConditionHandler()),this.checks.set("condition",M)}createDelayHandler(){return async(e,n)=>{let i=new Date().toISOString(),r=D(e.config);return r===void 0?d(e,C(e)??"No usable duration",i):await E(r,n.signal)?w(e,{delayed:r},i,`Waited ${r/1e3} s.`):d(e,`Delay step "${e.name}" was stopped before its ${r} ms wait ended.`,i)}}createConditionHandler(){return async(e,n)=>{let i=new Date().toISOString(),r=k(e);if(r||!e.condition)return d(e,r??"No condition",i);try{let o=S(e.condition,n.variables);return w(e,{conditionMet:o},i,o?"The condition held.":"The condition did not hold.")}catch(o){return d(e,`Condition step "${e.name}" could not be evaluated: ${l(o)}.`,i)}}}};export{f as a,$ as b};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ var l="ObjectPermissions",c="SobjectType",f="SELECT PermissionsModifyAllData FROM UserPermissionAccess",u=/^[A-Za-z][A-Za-z0-9_]{0,79}$/;function d(r){return`SELECT QualifiedApiName, IsEverCreatable FROM EntityDefinition WHERE QualifiedApiName IN (${r.map(e=>`'${e}'`).join(", ")})`}function p(r,a,e){if(e===!1)return"platform";if(a.coverable===void 0)return"user";let t=a.coverable.has(r.toLowerCase());return a.modifyAllData===!0?t?"feature":"setup":t?"user":"parent"}function g(r){return r==="platform"||r==="setup"}async function b(r,a){let e=0,[t,o]=await Promise.allSettled([r.describeFields(a,l),r.query(a,f)]),n={};if(t.status==="fulfilled"){t.value.sent&&e++;let s=t.value.fields.find(i=>i.name===c);s&&s.picklistValues.length>0&&(n.coverable=new Set(s.picklistValues.map(i=>i.toLowerCase())))}else e++;if(o.status==="fulfilled"){e+=o.value.requests;let s=o.value.records[0];s&&typeof s.PermissionsModifyAllData=="boolean"&&(n.modifyAllData=s.PermissionsModifyAllData)}else e++;return{facts:n,requests:e}}async function m(r,a,e){let t=new Map,o=e.filter(n=>u.test(n));if(o.length===0)return{answered:t,requests:0};try{let n=await r(a,d(o));for(let s of n.records){let i=s.QualifiedApiName;typeof i=="string"&&typeof s.IsEverCreatable=="boolean"&&t.set(i.toLowerCase(),s.IsEverCreatable)}return{answered:t,requests:n.requests}}catch{return{answered:t,requests:1}}}function y(r,a){return async(e,t)=>{let[o,n]=await Promise.all([a(e).catch(()=>({})),m(r,e,t)]);return new Map(t.map(s=>[s,p(s,o,n.answered.get(s.toLowerCase()))]))}}function C(r,a){let e=a.coverable;if(!e)return[];let t=new Set;for(let o of r)if(!(o.type!=="reference"||o.nillable))for(let n of o.referenceTo)e.has(n.toLowerCase())&&t.add(n);return[...t]}export{p as a,g as b,b as c,m as d,y as e,C as f};
@@ -0,0 +1,8 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ var l=["--help","-h"];function f(e,t){let r=new Set([...t.switches,...l]),a=new Set(t.values);for(let o=t.words??0;o<e.length;o++){let n=e[o];if(a.has(n)){let u=e[o+1];if(u===void 0||u.startsWith("--"))return`${n} wants a value. Nothing was run.`;o++;continue}if(r.has(n))continue;let s=n.indexOf("="),i=s>0?n.slice(0,s):n;return n.startsWith("-")&&s>0&&r.has(i)?`"${n}" is not read: ${i} takes no value, it is on when given and off when left out. Nothing was run.`:n.startsWith("-")&&s>0&&a.has(i)?`"${n}" is not read: give its value after a space, as ${i} ${n.slice(s+1)}. Nothing was run.`:n.startsWith("-")?`"${n}" is not a flag this command reads. Nothing was run.`:`"${n}" is not read: a value goes after the flag it is for. Nothing was run.`}}function c(e,t){let r=f(e,t);r!==void 0&&(process.stderr.write(`${r} Run with --help.
8
+ `),process.exit(2))}var E=/^[A-Za-z0-9_][A-Za-z0-9_.@+-]{0,254}$/;function p(e,t){return e==="failure"?1:e==="partial"&&t?3:0}function I(e){return e.status==="failure"?1:Number(e.totalFailed??0)>0||e.partial===!0||e.keptChanged!==void 0?3:0}function T(e){e!==0&&(process.exitCode!==void 0&&process.exitCode!==0||(process.exitCode=e))}var d=[0,3,4,1];function g(e){return e.reduce((t,r)=>d.indexOf(r)>d.indexOf(t)?r:t,0)}function _(){for(let e of[process.stdout,process.stderr])e._handle?.setBlocking?.(!0)}export{c as a,E as b,p as c,I as d,T as e,g as f,_ as g};
@@ -0,0 +1,10 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ import{a as E}from"./chunk-5P4PHJRL.mjs";import{W as Y,ha as R,ia as P}from"./chunk-6QSM2WIH.mjs";import{a as O,z as _}from"./chunk-WJY54JO7.mjs";import{E as S,c as X,p as A,q as z}from"./chunk-NEVXIGR6.mjs";import{g as w,h as y}from"./chunk-PA3MKJVH.mjs";import{Tb as u}from"./chunk-B45CNPUX.mjs";import{b as D,e as W,f as Q,l as L}from"./chunk-7EANH5PY.mjs";import{mkdir as se,rm as M}from"node:fs/promises";import{join as I}from"node:path";var ee=200,ne=Y*10,B=2e3,te=["Id","ContentDocumentId","LinkedEntityId","ShareType","Visibility"],ae=["Id","LatestPublishedVersionId","ContentSize"],de="taking",h=D().regex(/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,"Not a record id"),T=D().regex(/^[A-Za-z]{1,40}$/,"Not a sharing value"),V=L({Id:h,ContentDocumentId:h,LinkedEntityId:h,ShareType:T,Visibility:T}),J=L({Id:h,LatestPublishedVersionId:h.nullable(),ContentSize:W().int().nonnegative().nullable(),anchored:Q()});function Re(e,n){return I(e,`${y}.${n}.ndjson`)}var Ce=V.extend({now:L({ShareType:T,Visibility:T})});function Fe(e,n){let t=new Set(n.map(r=>r.toLowerCase())),i=new Map;for(let r of e){let a=r.keyPrefix;t.has(r.name.toLowerCase())&&typeof a=="string"&&a.length===3&&i.set(a,r.name)}return i}function Te(e,n){let t=e.LinkedEntityId;return typeof t=="string"&&t.length>=15?n.get(t.slice(0,3)):void 0}function oe(e){return e.map(n=>{if(!h.safeParse(n).success)throw new Error(`Not a record id: ${n}`);return`'${n}'`}).join(", ")}function ce(e){let n=u(e);return{objectApiName:n,soql:`SELECT ${te.join(", ")} FROM ${y} WHERE LinkedEntityId IN (SELECT Id FROM ${n})`,scanAll:!1}}function be(e){let n=u(e);return{objectApiName:n,soql:`SELECT COUNT() FROM ${y} WHERE LinkedEntityId IN (SELECT Id FROM ${n})`,scanAll:!1}}function le(e,n){return{objectApiName:u(e),soql:`SELECT ${te.join(", ")} FROM ${y} WHERE LinkedEntityId IN (${oe(n)})`,scanAll:!1}}function fe(e){return{objectApiName:w,soql:`SELECT ${ae.join(", ")} FROM ${w} WHERE Id IN (${oe(e)})`,scanAll:!1}}async function*v(e,n){let t=[];for await(let i of e)t.push(i),t.length>=n&&(yield t,t=[]);t.length>0&&(yield t)}function*C(e,n){let t=[];for(let i of e)t.push(i),t.length>=n&&(yield t,t=[]);t.length>0&&(yield t)}function G(e,n,t){let i=e.safeParse(n);if(!i.success)throw new Error(`The org answered a ${t} that does not read as one: ${i.error.message}`);return i.data}function F(e){return e.slice(0,15)}async function xe(e){let{reader:n,folder:t,signal:i}=e,r=e.files??O(E(t.dir)),a=I(t.filesDir,de);await se(a,{recursive:!0,mode:X});let m=z(t),b=A(t);await r.writeFile(m,""),await r.writeFile(b,"");try{let x=new Map,q=0,H=async d=>{for await(let c of v(P(d),B)){let s=c.map(o=>G(V,o,"link"));for(let o of s)x.has(F(o.ContentDocumentId))||x.set(F(o.ContentDocumentId),o.ContentDocumentId);q+=s.length,await r.appendFile(m,s.map(o=>`${JSON.stringify(o)}
8
+ `).join(""))}await M(d,{force:!0})},K=e.linked.map(d=>({...ce(d),file:I(a,`${u(d)}.links.ndjson`)})),re=await R(n,K,i),$=[];for(let[d,c]of re.entries()){if(c.read){await H(K[d].file);continue}let s=e.linked[d];$.push(s);let o=await _.read(t,e.snapshotId,s),l=0;for(let g of C(C(pe(o),ee),ne)){let f=g.map(k=>({...le(s,k),file:I(a,`${u(s)}.links.${l++}.ndjson`)})),N=(await R(n,f,i)).find(k=>!k.read);if(N&&!N.read)throw new Error(`The links of the files of ${s} could not be read whole: ${c.reason}; read by the ids of its records, ${N.reason}`);for(let k of f)await H(k.file)}}let j=0,U=0,Z=new Set;for(let d of C(C(x.values(),ee),ne)){let c=d.map((l,g)=>({...fe(l),file:I(a,`documents.${g}.ndjson`)})),o=(await R(n,c,i)).find(l=>!l.read);if(o&&!o.read)throw new Error(`The files the links name could not be read by their ids: ${o.reason}`);for(let l of c){for await(let g of v(P(l.file),B)){let f=g.map(p=>({...G(J.omit({anchored:!0}),p,"file"),anchored:!0}));for(let p of f)Z.add(F(p.Id));j+=f.length,U+=f.length,await r.appendFile(b,f.map(p=>`${JSON.stringify(p)}
9
+ `).join(""))}await M(l.file,{force:!0})}}if(e.documentsInSnapshot){let d=await _.read(t,e.snapshotId,w);for await(let c of v(d.records(),B)){let s=c.filter(o=>typeof o.Id=="string"&&!Z.has(F(o.Id))).map(o=>({...G(J.omit({anchored:!0}),ue(o),"file"),anchored:!1}));j+=s.length,s.length>0&&await r.appendFile(b,s.map(o=>`${JSON.stringify(o)}
10
+ `).join(""))}}return{documents:j,links:q,anchored:U,...$.length>0?{readByIds:$}:{}}}finally{await M(a,{recursive:!0,force:!0})}}function*pe(e){for(let n=0;n<e.size;n++)yield e.idAt(n)}function ue(e){return{Id:e.Id,LatestPublishedVersionId:e.LatestPublishedVersionId??null,ContentSize:e.ContentSize??null}}async function*ie(e,n,t,i){if(!await e.exists(n))throw new S("damaged",`The checkpoint\u2019s ${i} are not there`);for await(let r of e.readLines(n)){if(r==="")continue;let a;try{a=JSON.parse(r)}catch{throw new S("damaged",`The checkpoint\u2019s ${i} hold a line that is not JSON`)}let m=t.safeParse(a);if(!m.success)throw new S("damaged",`The checkpoint\u2019s ${i} hold a line that does not parse`);yield m.data}}function $e(e,n=O(E(e.dir))){return ie(n,z(e),V,"file links")}function je(e,n=O(E(e.dir))){return ie(n,A(e),J,"files")}export{ee as a,te as b,V as c,Re as d,Ce as e,Fe as f,Te as g,ce as h,be as i,le as j,xe as k,$e as l,je as m};