"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),i=require("../utils/legacyUtil.js");function d(u,{id:s,pId:n,rootPId:l}){const o={},c=[];return u.map(r=>{const e={...r},t=e[s];return o[t]=e,e.key=e.key||t,e}).forEach(r=>{const e=r[n],t=o[e];t&&(t.children=t.children||[],t.children.push(r)),(e===l||!t&&l===null)&&c.push(r)}),c}function v(u,s,n){const l=a.shallowRef();return a.watch([n,u,s],()=>{const o=n.value;u.value?l.value=n.value?d(a.toRaw(u.value),{id:"id",pId:"pId",rootPId:null,...o!==!0?o:{}}):a.toRaw(u.value).slice():l.value=i.convertChildrenToData(a.toRaw(s.value))},{immediate:!0,deep:!0}),l}exports.default=v;
