/*! For license information please see d5a0f38762e28a8613081e7f79ae77ce.js.LICENSE.txt */
"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([["sub-common/d5a0f38762e28a8613081e7f79ae77ce"],{"./src/components/SegmentedControl/index.tsx":function(e,t,n){var o=n("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js");var s=n("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");var d=n("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");var l=n("./node_modules/classnames/index.js");var a=n.n(l);var r=n("./node_modules/react/cjs/react.production.min.js");var i=n("./src/components/SegmentedControl/index.module.scss");var c=n("./node_modules/react/cjs/react-jsx-runtime.production.min.js");var u=function SegmentedControl(e){var t=(0,r.useState)({selected:-1,tabId:""}),n=(0,s["default"])(t,2),l=n[0],u=n[1];var f=e.list,m=e.defaultId,v=m===void 0?-1:m,p=e.onSelect;var b=function isValidNumber(e){return typeof e==="number"&&e>=0};(0,r.useEffect)((function(){console.log("defaultId",v);if(b(v)){console.log("defaultId:::",v);var e=f===null||f===void 0?void 0:f.findIndex((function(e){return e.id==v}));if(e!==-1){var t=e>0?e-1:0;u((function(e){return(0,o["default"])((0,o["default"])({},e),{},{tabId:f[t].id.toString()})}))}}u((function(e){return(0,o["default"])((0,o["default"])({},e),{},{selected:b(v)?v:-1})}));console.log("selectInfo",l)}),[v]);var j=function clickEvent(e){var t=e.item,n=e.index;var s=n>0?n-1:0;u((function(e){return(0,o["default"])((0,o["default"])({},e),{},{tabId:f[s].id.toString(),selected:t.id})}));p===null||p===void 0?void 0:p(t)};return(0,c.jsx)(d.View,{className:i["default"].status_list,children:(0,c.jsx)(d.ScrollView,{scrollX:true,scrollIntoView:"tabs_".concat(l.tabId),scrollWithAnimation:true,children:(0,c.jsx)(d.View,{className:i["default"].list_scroll,children:f.map((function(e,t){return(0,c.jsx)(d.View,{id:"tabs_".concat(e.id),onClick:function onClick(){return j({item:e,index:t})},className:a()(i["default"].status_item,l.selected===e.id?i["default"].selected:""),children:e.name},e.id)}))})})})};t["default"]=u}}]);