"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function C(t){const n=t.slice(0,-1),e=t.at(-1);return[n,e]}function j(t){return t==="__proto__"||t==="constructor"||t==="prototype"}function E(t,n){return m(t)?Object.prototype.hasOwnProperty.call(t,n):!1}function m(t){return typeof t=="object"&&t!==null}function d(t){return Array.isArray(t)?[...t]:m(t)?{...t}:t}function v(t){return typeof t=="number"?v(t.toString()):t.replace(/~/g,"~0").replace(/\//g,"~1")}function P(t){return t.replace(/\~1/g,"/").replace(/\~0/g,"~")}function A(t){if(t.startsWith("#")){const e=decodeURIComponent(t).replace(/^#/,"");return A(e)}return t.split("/").map(P)}function S(t,n){return typeof p(t,n,()=>{})<"u"}function w(t,n){if(t.length===0)return"";const e=t.map(v).join("/"),r=e.startsWith("/")?"":"/";return n==="uri"?`#${r}${encodeURIComponent(e)}`:r+e}function p(t,n,e){const[r,...s]=A(n);if((r===void 0||r==="")&&s.length===0)return e&&e(t,"",void 0,[]),t;let o=t,c;for(const i of s){if(j(i))throw new Error("Prototype pollution attempt");if(!E(o,i)){if(e){o=void 0;break}throw new Error(`Cannot find ${i} in ${JSON.stringify(o)}`)}c=o,o=o[i]}if(e){const[i,f]=C(s);e(o,f,c,i)}return o}function O(t,n){return p(t,n)}function I(t,n){let e=d(t);return p(e,n,(r,s,o,c)=>{if(typeof r>"u")return;const i=d(o),f=w(c);if(Array.isArray(i)){const l=+s;i.splice(l,1),e=a(e,f,i)}else delete i[s],e=a(e,f,i)}),e}function K(t){const n={},e=(r,s)=>{for(const o in r){const c=r[o];if(m(c)){const i=[...s,o];e(c,i);continue}n[w([...s,o])]=c}};return e(t,[]),n}function L(t,n){return(Array.isArray(t)?t:Object.entries(t)).reduce((r,[s,o])=>a(r,s,o),n??{})}function a(t,n,e){let r=d(t);return p(t,n,(o,c,i,f)=>{if(o===e)return;const l=f.length;let y=0,u=r;do{const h=f[y],g=y>=l;if(g&&Array.isArray(u)){c==="-"?u.push(e):u[+c]=e;return}if(g&&c===""){r=e;return}if(g){u[c]=e;return}const $=u[h]??{};u[h]=d($),u=u[h]}while(++y<=l)}),r}function _(t,n){if(S(t,n))return O(t,n)}function U(t,n,e){const r=_(t,n),s=e(r);return a(t,n,s)}function W(...t){return n=>t.reduce((e,r)=>r(e),n)}exports.chain=W;exports.compile=w;exports.compose=L;exports.dict=K;exports.escape=v;exports.get=O;exports.has=S;exports.parse=A;exports.read=_;exports.remove=I;exports.resolve=p;exports.set=a;exports.transform=U;exports.unescape=P;