"use strict";var _=Object.create;var a=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var j=(t,r)=>{for(var s in r)a(t,s,{get:r[s],enumerable:!0})},y=(t,r,s,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of $(r))!C.call(t,n)&&n!==s&&a(t,n,{get:()=>r[n],enumerable:!(e=x(r,n))||e.enumerable});return t};var i=(t,r,s)=>(s=t!=null?_(b(t)):{},y(r||!t||!t.__esModule?a(s,"default",{value:t,enumerable:!0}):s,t)),E=t=>y(a({},"__esModule",{value:!0}),t);var D={};j(D,{reconstructConflict:()=>N});module.exports=E(D);var p=async(t,r)=>{switch(t){case"json":case"json5":return JSON.stringify(r,null,2);case"yaml":{let{stringify:s}=await import("yaml");return s(r)}case"toml":{let{stringify:s}=await import("smol-toml");return s(r)}case"xml":{let{XMLBuilder:s}=await import("fast-xml-parser");return new s({}).build(r)}default:throw new Error(`Unknown format: ${t}`)}};var M=i(require("fs/promises")),O=i(require("path")),g=Symbol("MERGE_DROP");var f=(t,r,s=[])=>{if(t!==g){if(t===void 0){let e=`__CONFLICT_MARKER::${r}__`;return s.push(r),e}if(Array.isArray(t))return t.map((e,n)=>f(e,`${r}[${n}]`,s)).filter(e=>e!==void 0);if(t&&typeof t=="object"){let e={};for(let[n,c]of Object.entries(t)){let o=f(c,r?`${r}.${n}`:n,s);o!==void 0&&(e[n]=o)}return e}return t}},N=async(t,r,s,e)=>{let n=[],c=f(t,"",n),o=await p(e,c);for(let l of n){let w=d(r,l),h=d(s,l),[k,P]=await Promise.all([w,h].map(S=>p(e,S))),F=["<<<<<<< ours",m(k,2),"=======",m(P,2),">>>>>>> theirs"].join(`
`),u=`__CONFLICT_MARKER::${l}__`;o=o.replace(/json/.test(e)?JSON.stringify(u):u,F)}return o},d=(t,r)=>{let s=r.replace(/\[(\d+)\]/g,".$1").split(".").filter(Boolean),e=t;for(let n of s)e=e==null?void 0:e[n];return e},m=(t,r)=>{let s=" ".repeat(r);return t.split(`
`).map(e=>e&&s+e).join(`
`)};0&&(module.exports={reconstructConflict});
