PageSourceSearch

https://samais.com.br/_next/static/chunks/pages/admin/categories-s…/[decisionTreeId]-9fbcba9021ab354f.js

js samais.com.br collected 2026-10-04 03:12:21 UTC 14,894 bytes, 9 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9129],{40500:function(t,e,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/categories-sections/[id]/decision-tree/[decisionTreeId]",function(){return n(88872)}])},98053:function(t,e,n){"use strict";n.d(e,{$:function(){return s}});var r=n(85893),i=n(96272);let s=t=>{let{children:e,onClick:n}=t;return(0,r.jsx)(i.z,{onClick:n||(()=>history.back()),size:"md",width:"100%",children:e})}},52862:function(t,e,n){"use strict";n.d(e,{A:function(){return a}});var r=n(85893),i=n(96272),s=n(56877),u=n(79352);function a(t){let{order:e,maxOrder:n,typeOrder:a,changeOrder:o,changeOrderArray:l,isDisabled:c,...d}=t,h=async()=>{try{let t="up"===a?e-1:e+1;o&&await o.mutateAsync(t),l&&l(e,t)}catch(t){}};return(0,r.jsx)(i.z,{size:"sm",fontSize:"sm",colorScheme:"gray",isDisabled:0===e&&"up"===a||e===n&&"down"===a||c,onClick:h,...d,children:(0,r.jsx)(s.J,{as:"up"===a?u.e_Z:u.dtO,fontSize:"20"})})}},95259:function(t,e,n){"use strict";n.d(e,{G:function(){return s}});var r=n(85893),i=n(96272);let s=t=>{let{children:e,...n}=t;return(0,r.jsx)(i.z,{type:"submit",w:"100%",size:"md",colorScheme:"green",loadingText:"Carregando",spinnerPlacement:"end",...n,children:e})}},79837:function(t,e,n){"use strict";n.d(e,{a:function(){return u}});var r=n(85893),i=n(96272),s=n(8193);function u(t){let{children:e}=t;return(0,r.jsx)(i.z,{onClick:()=>history.back(),variant:"outline",colorScheme:"facebook",leftIcon:(0,r.jsx)(s.kyg,{}),children:e})}},57843:function(t,e,n){"use strict";n.d(e,{I:function(){return f}});var r=n(85893),i=n(70654),s=n(96177),u=n(93863),a=n(25322),o=n(28129),l=n(89056),c=n(88911),d=n(67294),h=n(9216);let p=(t,e)=>{let{name:n,label:d,comments:p,prefix:f,error:x=null,popoverDescription:m,popoverImage:v,...g}=t;return(0,r.jsxs)(i.NI,{isInvalid:!!x,children:[!!d&&(0,r.jsxs)(s.l,{w:"100%",htmlFor:n,display:"flex",alignItems:"center",fontWeight:"bold",children:[d,(!!m||!!v)&&(0,r.jsx)(h.T,{description:m,image:v})]}),(0,r.jsxs)(u.B,{size:"lg",children:[f&&(0,r.jsx)(a.Ui,{children:f}),(0,r.jsx)(o.I,{fontSize:{sm:"md",md:"lg"},id:n,name:n,size:"lg",variant:"outline",ref:e,...g})]}),x&&(0,r.jsx)(l.J1,{fontSize:"xs",children:x.message}),p&&(0,r.jsx)(c.x,{fontSize:"sm",children:p})]})},f=(0,d.forwardRef)(p)},9216:function(t,e,n){"use strict";n.d(e,{T:function(){return d}});var r=n(85893),i=n(89076),s=n(53948),u=n(96272),a=n(44416),o=n(7126),l=n(20623),c=n(81941);function d(t){let{description:e,image:n}=t;return(0,r.jsxs)(i.J,{placement:"right",trigger:"hover",children:[(0,r.jsx)(s.x,{children:(0,r.jsx)(u.z,{variant:"unstyled",children:"?"})}),(0,r.jsxs)(a.y,{children:[(0,r.jsx)(o.Q,{}),(0,r.jsxs)(l.b,{children:[e,n&&(0,r.jsx)(c.E,{src:n,objectFit:"contain"})]})]})]})}},88872:function(t,e,n){"use strict";n.r(e),n.d(e,{__N_SSP:function(){return M}});var r=n(85893),i=n(93194),s=n(91669),u=n(204),a=n(88911),o=n(23100),l=n(31708),c=n(96272),d=n(36557),h=n(24304),p=n(36526),f=n(75421),x=n(28650),m=n(577),v=n(54641),g=n(89154),j=n(56877),y=n(87536),b=n(16310),S=n(57492),_=n(48228),w=n(91293),I=n(6347),E=n(67294),R=n(51649),C=n(98053),O=n(52862),T=n(95259),k=n(57843),A=n(79837);let z=b.Ry().shape({title:b.Z_().required("T\xedtulo obrigat\xf3rio.").typeError("T\xedtulo obrigat\xf3rio.")}),N=t=>{let{decisionTree:e}=t,{register:n,formState:b,formState:{errors:N},handleSubmit:M,control:G,setValue:L,watch:U,setError:V,clearErrors:D}=(0,y.cI)({resolver:(0,S.X)(z),defaultValues:{title:e.title,itens:e.itens.map(t=>t.title)}}),J=(0,i.p)(),P=(0,_.D)(async t=>await w.h.put("/v1/admin/decision-tree/".concat(e.secure_id),{...t}),{onSuccess:t=>{var e;I.E.invalidateQueries(["DecisionTreeAdmin"]),J({title:(null===(e=t.data)||void 0===e?void 0:e.message)||"\xc1rvore atualizada com sucesso!",position:"top-right",status:"success",isClosable:!0}),history.back()},onError:t=>{var e,n,r,i;J({title:(null==t?void 0:null===(e=t.response)||void 0===e?void 0:null===(n=e.data)||void 0===n?void 0:n.message)||"Ocorreu um problema ao atualizar \xe1rvore.",position:"top-right",status:(null==t?void 0:null===(r=t.response)||void 0===r?void 0:null===(i=r.data)||void 0===i?void 0:i.type)||"error",isClosable:!0})}}),$=async t=>{try{await P.mutateAsync(t)}catch(t){}},B=U("itemAdd"),W=U("itens"),X=()=>
1{if(B){if(!W){L("itens",[B]),L("itemAdd",null),D();return}if(W.find(t=>t===B)){V("itemAdd",{message:"Item j\xe1 adicionado"});return}D(),L("itens",[...W,B]),L("itemAdd",null)}},F=(0,E.useCallback)((t,e)=>{if(!W||t<0||t>=W.length||e<0||e>=W.length)return;let[n]=W.splice(t,1);W.splice(e,0,n),L("itens",W)},[W]),Q=(0,E.useCallback)(t=>{if(W&&t>=0&&t<W.length)return L("itens",W.filter((e,n)=>n!==t))},[W]);return(0,r.jsxs)(s.g,{spacing:"4",layerStyle:"container",children:[(0,r.jsxs)(u.k,{w:"100%",justify:"space-between",align:"center",children:[(0,r.jsx)(a.x,{textStyle:"headerLG",as:"header",children:"Atualizar \xe1rvore de decis\xf5es"}),(0,r.jsx)(A.a,{children:"Voltar"})]}),(0,r.jsx)(o.xu,{p:"4",as:"form",width:"100%",layerStyle:"card",onSubmit:M($),children:(0,r.jsxs)(s.g,{spacing:"6",align:"flex-start",children:[(0,r.jsx)(k.I,{placeholder:"T\xedtulo *",label:"T\xedtulo *",error:N.title,...n("title")}),(0,r.jsxs)(l.r,{width:"100%",gridTemplateColumns:"5fr 1fr",gap:5,children:[(0,r.jsx)(k.I,{label:"Item",...n("itemAdd")}),(0,r.jsx)(c.z,{colorScheme:"green",top:10,onClick:X,children:"Adicionar"})]}),(0,r.jsx)(a.x,{fontWeight:"bold",children:"Itens"}),(0,r.jsxs)(d.i,{variant:"simple",children:[(0,r.jsx)(h.h,{children:(0,r.jsxs)(p.Tr,{children:[(0,r.jsx)(f.Th,{children:"Nome"}),(0,r.jsx)(f.Th,{textAlign:"end",children:"A\xe7\xf5es"})]})}),(0,r.jsx)(x.p,{children:null==W?void 0:W.map((t,e)=>(0,r.jsxs)(p.Tr,{children:[(0,r.jsx)(m.Td,{children:(0,r.jsx)(o.xu,{dangerouslySetInnerHTML:{__html:t}})}),(0,r.jsx)(m.Td,{children:(0,r.jsxs)(v.U,{justify:"flex-end",children:[(0,r.jsx)(O.A,{order:e,maxOrder:W.length-1,typeOrder:"up",changeOrderArray:F}),(0,r.jsx)(O.A,{order:e,maxOrder:W.length-1,typeOrder:"down",changeOrderArray:F}),(0,r.jsx)(g.h,{variant:"ghost",colorScheme:"red","aria-label":"Remove Option",fontSize:"20",icon:(0,r.jsx)(j.J,{as:R.hME}),onClick:()=>Q(e)})]})})]},t))})]}),(0,r.jsx)(u.k,{justify:"flex-end",w:"100%",children:(0,r.jsxs)(v.U,{spacing:"4",width:"20em",children:[(0,r.jsx)(C.$,{children:"Cancelar"}),(0,r.jsx)(T.G,{isLoading:b.isSubmitting,loadingText:"Atualizando",children:"Atualizar"})]})})]})})]})};var M=!0;e.default=N},83:function(t,e,n){"use strict";/**
2 * @license React
3 * use-sync-external-store-shim.production.js
4 *
5 * Copyright (c) Meta Platforms, Inc. and affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var r=n(67294),i="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},s=r.useState,u=r.useEffect,a=r.useLayoutEffect,o=r.useDebugValue;function l(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!i(t,n)}catch(t){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(t,e){return e()}:function(t,e){var n=e(),r=s({inst:{value:n,getSnapshot:e}}),i=r[0].inst,c=r[1];return a(function(){i.value=n,i.getSnapshot=e,l(i)&&c({inst:i})},[t,n,e]),u(function(){return l(i)&&c({inst:i}),t(function(){l(i)&&c({inst:i})})},[t]),o(n),n};e.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:c},61688:function(t,e,n){"use strict";t.exports=n(83)},93863:function(t,e,n){"use strict";n.d(e,{B:function(){return x},m:function(){return f}});var r=n(55227),i=n(92495),s=n(35059),u=n(91639),a=n(33179),o=n(82504),l=n(25432),c=n(87052),d=n(67294),h=n(85893),[p,f]=(0,r.k)({name:"InputGroupStylesContext",errorMessage:"useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" "}),x=(0,s.G)(function(t,e){let n=(0,u.jC)("Input",t),{children:r,className:s,...f}=(0,a.Lr)(t),x=(0,l.cx)("chakra-input__group",s),m={},v=(0,i.W)(r),g=n.field;v.forEach(t=>{var e,r;n&&(g&&"InputLeftElement"===t.type.id&&(m.paddingStart=null!=(e=g.height)?e:g.h),g&&"InputRightElement"===t.type.id&&(m.paddingEnd=null!=(r=g.height)?r:g.h),"InputRightAddon"===t.type.id&&(m.borderEndRadius=0),"InputLeftAddon"===t.type.id&&(m.borderStartRadius=0))});let j=v.map(e=>{var n,r;let i=(0,c.o)({size:(null==(n=e.props)?void 0:n.size)||t.size,variant:(null==(r=e.props)?void 0:r.variant)||t.variant});return"Input"!==e.type.id?(0,d.cloneElement)(e,i):(0,d.cloneElement)(e,Object.assign(i,m,e.props))});return(0,h.jsx)(o.m.div,{className:x,ref:e,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate"},"data-group":!0,...f,children:(0,h.jsx)(p,{value:n,children:j})})});x.displayName="InputGroup"},25322:function(t,e,n){"use strict";n.d(e,{Ui:function(){return d}});var r=n(93863),i=n(82504),s=n(35059),u=n(25432),a=n(85893),o={left:{marginEnd:"-1px",borderEndRadius:0,borderEndColor:"transparent"},right:{marginStart:"-1px",borderStartRadius:0,borderStartColor:"transparent"}},l=(0,i.m)("div",{baseStyle:{flex:"0 0 auto",width:"auto",display:"flex",alignItems:"center",whiteSpace:"nowrap"}}),c=(0,s.G)(function(t,e){var n;let{placement:i="left",...s}=t,u=null!=(n=o[i])?n:{},c=(0,r.m)();return(0,a.jsx)(l,{ref:e,...s,__css:{...c.addon,...u}})});c.displayName="InputAddon";var d=(0,s.G)(function(t,e){return(0,a.jsx)(c,{ref:e,placement:"left",...t,className:(0,u.cx)("chakra-input__left-addon",t.className)})});d.displayName="InputLeftAddon",d.id="InputLeftAddon";var h=(0,s.G)(function(t,e){return(0,a.jsx)(c,{ref:e,placement:"right",...t,className:(0,u.cx)("chakra-input__right-addon",t.className)})});h.displayName="InputRightAddon",h.id="InputRightAddon"},28129:function(t,e,n){"use strict";n.d(e,{I:function(){return c}});var r=n(74939),i=n(35059),s=n(91639),u=n(33179),a=n(82504),o=n(25432),l=n(85893),c=(0,i.G)(function(t,e){let{htmlSize:n,...i}=t,c=(0,s.jC)("Input",i),d=(0,u.Lr)(i),h=(0,r.Y)(d),p=(0,o.cx)("chakra-input",t.className);return(0,l.jsx)(a.m.input,{size:n,...h,__css:c.field,ref:e,className:p})});c.displayName="Input",c.id="Input"},36557:function(t,e,n){"use strict";n.d(e,{i:function(){return h},p:function(){return d}});var r=n(35059),i=n(91639),s=n(33179),u=n(82504),a=n(25432),o=n(55227),l=n(85893),[c,d]=(0,o.k)({name:"TableStylesContext",errorMessage:"useTableStyles returned is 'undefined'. Seems you forgot to wrap the components in \"<Table />\" "}),h=(0,r.G)((t,e)=>{let n=(0,i.jC)("Table",t),{className:r,layout:o,...d}=(0,s.Lr)(t);return(0,l.jsx)(c,{value:n,children:(0,l.jsx)(u.m.table,{ref:e,__css:{tableLayout:o,...n.table},className:(0,a.cx)("chakra-table",r),...d})})});h.displayName="Table"}
9,577:function(t,e,n){"use strict";n.d(e,{Td:function(){return a}});var r=n(36557),i=n(35059),s=n(82504),u=n(85893),a=(0,i.G)(({isNumeric:t,...e},n)=>{let i=(0,r.p)();return(0,u.jsx)(s.m.td,{...e,ref:n,__css:i.td,"data-is-numeric":t})})},28650:function(t,e,n){"use strict";n.d(e,{p:function(){return a}});var r=n(36557),i=n(35059),s=n(82504),u=n(85893),a=(0,i.G)((t,e)=>{let n=(0,r.p)();return(0,u.jsx)(s.m.tbody,{...t,ref:e,__css:n.tbody})})},24304:function(t,e,n){"use strict";n.d(e,{h:function(){return a}});var r=n(36557),i=n(35059),s=n(82504),u=n(85893),a=(0,i.G)((t,e)=>{let n=(0,r.p)();return(0,u.jsx)(s.m.thead,{...t,ref:e,__css:n.thead})})},36526:function(t,e,n){"use strict";n.d(e,{Tr:function(){return a}});var r=n(36557),i=n(35059),s=n(82504),u=n(85893),a=(0,i.G)((t,e)=>{let n=(0,r.p)();return(0,u.jsx)(s.m.tr,{...t,ref:e,__css:n.tr})})},75421:function(t,e,n){"use strict";n.d(e,{Th:function(){return a}});var r=n(36557),i=n(35059),s=n(82504),u=n(85893),a=(0,i.G)(({isNumeric:t,...e},n)=>{let i=(0,r.p)();return(0,u.jsx)(s.m.th,{...e,ref:n,__css:i.th,"data-is-numeric":t})})},48228:function(t,e,n){"use strict";n.d(e,{D:function(){return h}});var r=n(67294),i=n(464),s=n(32161),u=n(89886),a=n(30081),o=n(33989);class l extends o.l{constructor(t,e){super(),this.client=t,this.setOptions(e),this.bindMethods(),this.updateResult()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var e;let n=this.options;this.options=this.client.defaultMutationOptions(t),(0,s.VS)(n,this.options)||this.client.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.currentMutation,observer:this}),null==(e=this.currentMutation)||e.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners()){var t;null==(t=this.currentMutation)||t.removeObserver(this)}}onMutationUpdate(t){this.updateResult();let e={listeners:!0};"success"===t.type?e.onSuccess=!0:"error"===t.type&&(e.onError=!0),this.notify(e)}getCurrentResult(){return this.currentResult}reset(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})}mutate(t,e){return this.mutateOptions=e,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,{...this.options,variables:void 0!==t?t:this.options.variables}),this.currentMutation.addObserver(this),this.currentMutation.execute()}updateResult(){let t=this.currentMutation?this.currentMutation.state:(0,u.R)(),e={...t,isLoading:"loading"===t.status,isSuccess:"success"===t.status,isError:"error"===t.status,isIdle:"idle"===t.status,mutate:this.mutate,reset:this.reset};this.currentResult=e}notify(t){a.V.batch(()=>{if(this.mutateOptions&&this.hasListeners()){var e,n,r,i,s,u,a,o;t.onSuccess?(null==(e=(n=this.mutateOptions).onSuccess)||e.call(n,this.currentResult.data,this.currentResult.variables,this.currentResult.context),null==(r=(i=this.mutateOptions).onSettled)||r.call(i,this.currentResult.data,null,this.currentResult.variables,this.currentResult.context)):t.onError&&(null==(s=(u=this.mutateOptions).onError)||s.call(u,this.currentResult.error,this.currentResult.variables,this.currentResult.context),null==(a=(o=this.mutateOptions).onSettled)||a.call(o,void 0,this.currentResult.error,this.currentResult.variables,this.currentResult.context))}t.listeners&&this.listeners.forEach(({listener:t})=>{t(this.currentResult)})})}}var c=n(85945),d=n(24798);function h(t,e,n){let u=(0,s.lV)(t,e,n),o=(0,c.NL)({context:u.context}),[h]=r.useState(()=>new l(o,u));r.useEffect(()=>{h.setOptions(u)},[h,u]);let f=(0,i.$)(r.useCallback(t=>h.subscribe(a.V.batchCalls(t)),[h]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),x=r.useCallback((t,e)=>{h.mutate(t,e).catch(p)},[h]);if(f.error&&(0,d.L)(h.options.useErrorBoundary,[f.error]))throw f.error;return{...f,mutate:x,mutateAsync:f.mutate}}function p(){}},464:function(t,e,n){"use strict";n.d(e,{$:function(){return i}});var r=n(61688);let i=r.useSyncExternalStore},24798:function(t,e,n){"use strict";function r(t,e){return"function"==typeof t?t(...e):!!t}n.d(e,{L:function(){return r}})}},function(t){t.O(0,[9912,7536,5097,9774,2888,179],function(){return t(t.s=40500)}),_N_E=t.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.