const h=["number","boolean","function","symbol"];function x(c){return Object.prototype.toString.call(c)==="[object RegExp]"}function j(c){const s=typeof c;return c!==null&&(s==="object"||s==="function")}function O(c,s,b=""){const i=[];return(function y(e,r={},f=""){r.indent=r.indent||"	";const n={newLine:`
`,newLineOrSpace:`
`,pad:f,indent:f+r.indent},w=t=>{if(r.inlineCharacterLimit===void 0)return t;const l=t.replace(new RegExp(n.newLine,"g"),"").replace(new RegExp(n.newLineOrSpace,"g")," ").replace(new RegExp(n.pad+"|"+n.indent,"g"),"");return l.length<=r.inlineCharacterLimit?l:t.replace(new RegExp(n.newLine+"|"+n.newLineOrSpace,"g"),`
`).replace(new RegExp(n.pad,"g"),f).replace(new RegExp(n.indent,"g"),f+r.indent)};if(i.indexOf(e)!==-1)return'"Circular"';if(e===null)return"NULL";if(e===void 0||h.includes(typeof e)||x(e))return String(e);if(e instanceof Date)return`date('${e.toISOString()}')`;if(Array.isArray(e)){if(e.length===0)return"array()";i.push(e);const t="array("+n.newLine+e.map((l,a)=>{const d=e.length-1===a?n.newLine:","+n.newLineOrSpace;let g=y(l,r,f+r.indent);return r.transform&&(g=r.transform(e,a,g)),n.indent+g+d}).join("")+n.pad+")";return i.pop(),w(t)}if(j(e)){let t=Object.keys(e);if(r.filter&&(t=t.filter(a=>r.filter?.(e,a))),t.length===0)return Array.isArray(e)?"array()":"(object)[]";i.push(e);const l="array("+n.newLine+t.map((a,d)=>{const g=t.length-1===d?n.newLine:","+n.newLineOrSpace,L=typeof a=="symbol",m=!L&&/^[a-z$_][a-z$_0-9]*$/i.test(a),S=L||m?a:y(a,r);let o=y(e[a],r,f+r.indent);return r.transform&&(o=r.transform(e,a,o)),`${n.indent}"${String(S)}" => ${o}${g}`}).join("")+n.pad+")";return i.pop(),w(l)}return e=String(e).replace(/[\r\n]/g,t=>t===`
`?"\\n":"\\r"),r.singleQuotes===!1?(e=e.replace(/"/g,'\\"'),`"${e}"`):(e=e.replace(/\\?'/g,"\\'"),`"${e}"`)})(c,s,b)}export{O as objectToPhpArray};
