"use strict";var e=require("react"),t=require("lodash/get"),l=require("lodash/isEmpty"),r=require("lodash/sortBy"),n=require("../utils/completion.js"),i=require("../constants/completion.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=u(t),s=u(l),a=u(r);module.exports=function(t){var l=t.padId,r=t.well,u=t.wells,o=t.fracFleet,f=t.settingsByAsset,c=function(e,t,l,r){var u=n.getAssetKey(l,t,e);return s.default(d.default(r,[u]))?n.getDefaultPadModeSetting(l,t,i.COMPLETION_APP_TYPES.fracMultiWellApp,!0):d.default(r,[u])}(l,r,o,f),v=e.useMemo((function(){var e,t;if(r)return[r];var n=(null===(e=null==o?void 0:o.pad_frac_fleets)||void 0===e?void 0:e.find((function(e){return e.pad.id===l||e.current})))||(null===(t=a.default(null==o?void 0:o.pad_frac_fleets,"last_current_at"))||void 0===t?void 0:t[0]),i=(null==n?void 0:n.frac_fleet_lines)||[];if(!i.length)return(null==u?void 0:u.length)?u:[];var d=c.selectedLine;if("custom"===c.mode){var s=c.selectedAssets[0],f=i.find((function(e){var t=e.frac_fleet_line_wells;return(void 0===t?[]:t).find((function(e){return+e.id===s}))}));d=null==f?void 0:f.id}var v=i.find((function(e){return e.id===d}))||i[0];return(null==v?void 0:v.frac_fleet_line_wells)||[]}),[c.mode,c.selectedLine,c.selectedAssets,null==o?void 0:o.pad_frac_fleets,l,r,u]);return v};
