import{r as l,j as e}from"./app-BGey7YPf.js";import{I as v}from"./input-CGSIKYsG.js";import{L as p}from"./label-BbSRpehS.js";import{I as U,a as A}from"./input-select-DHdS_tES.js";import{u as $,c as z,a as V}from"./index-BFyaOBDQ.js";import{c as j,u as N,P as I,a as _}from"./button-D5r5edT8.js";import{u as O}from"./index-BuSoVzfP.js";import{u as q}from"./index-CwO5dfCw.js";import{S as J,a as W,b as X,c as G,d as K}from"./select-BqSuhmAT.js";import{B as Q}from"./button-submit-end-BkQSWpq2.js";import{S as Y}from"./search-CA9JuCC9.js";import"./dialog-OAe1w9Cd.js";import"./x-C4WIHhXm.js";import"./separator-Di-l93J0.js";import"./chevron-down-DOZGaFlM.js";import"./index-Q2wK6uZI.js";import"./save-Bm3_KHjE.js";/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Z=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],D=j("Bell",Z);/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ee=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],te=j("House",ee);/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ne=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],se=j("Settings",ne);/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const re=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],oe=j("User",re);var k="Switch",[ie,Pe]=z(k),[ae,le]=ie(k),P=l.forwardRef((n,r)=>{const{__scopeSwitch:o,name:s,checked:i,defaultChecked:a,required:c,disabled:d,value:u="on",onCheckedChange:h,form:t,...S}=n,[m,f]=l.useState(null),w=N(r,b=>f(b)),y=l.useRef(!1),C=m?t||!!m.closest("form"):!0,[x,L]=$({prop:i,defaultProp:a??!1,onChange:h,caller:k});return e.jsxs(ae,{scope:o,checked:x,disabled:d,children:[e.jsx(I.button,{type:"button",role:"switch","aria-checked":x,"aria-required":c,"data-state":R(x),"data-disabled":d?"":void 0,disabled:d,value:u,...S,ref:w,onClick:V(n.onClick,b=>{L(H=>!H),C&&(y.current=b.isPropagationStopped(),y.current||b.stopPropagation())})}),C&&e.jsx(M,{control:m,bubbles:!y.current,name:s,value:u,checked:x,required:c,disabled:d,form:t,style:{transform:"translateX(-100%)"}})]})});P.displayName=k;var B="SwitchThumb",E=l.forwardRef((n,r)=>{const{__scopeSwitch:o,...s}=n,i=le(B,o);return e.jsx(I.span,{"data-state":R(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:r})});E.displayName=B;var ce="SwitchBubbleInput",M=l.forwardRef(({__scopeSwitch:n,control:r,checked:o,bubbles:s=!0,...i},a)=>{const c=l.useRef(null),d=N(c,a),u=O(o),h=q(r);return l.useEffect(()=>{const t=c.current;if(!t)return;const S=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(S,"checked").set;if(u!==o&&f){const w=new Event("click",{bubbles:s});f.call(t,o),t.dispatchEvent(w)}},[u,o,s]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o,...i,tabIndex:-1,ref:d,style:{...i.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});M.displayName=ce;function R(n){return n?"checked":"unchecked"}var F=P,de=E;const T=l.forwardRef(({className:n,...r},o)=>e.jsx(F,{className:_("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",n),...r,ref:o,children:e.jsx(de,{className:_("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));T.displayName=F.displayName;const g=l.forwardRef(({className:n,label:r,error:o,checked:s,onCheckedChange:i,...a},c)=>e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[r&&e.jsx("label",{htmlFor:a.id,className:"text-sm font-medium leading-none cursor-pointer select-none",children:r}),e.jsx(T,{id:a.id,checked:s,onCheckedChange:i,ref:c,className:_("relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border border-muted-foreground bg-muted transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50","hover:border-primary hover:bg-primary/20",s&&"bg-primary border-primary",n),...a,children:e.jsx("span",{className:_("pointer-events-none inline-block h-5 w-5 rounded-full bg-background shadow ring-0","transform will-change-transform transition-transform duration-300 ease-in-out",s?"translate-x-5":"translate-x-0")})})]}),o&&e.jsx("p",{className:"text-red-500 text-xs mt-1 ml-[3.25rem]",children:o})]}));g.displayName="InputSwitch";const ue=({value:n,onChange:r,options:o,placeholder:s="Pilih opsi",className:i})=>e.jsxs(J,{value:n,onValueChange:r,children:[e.jsx(W,{className:i,children:e.jsx(X,{placeholder:s})}),e.jsx(G,{children:o.map(a=>e.jsx(K,{value:a.value,children:a.label},a.value))})]});function Be({data:n,errors:r,processing:o,setData:s,storeData:i,reset:a,link_profile_id:c,lembagasData:d=[]}){var h;const u=[{value:"home",label:"Home",icon:te},{value:"user",label:"User",icon:oe},{value:"settings",label:"Settings",icon:se},{value:"search",label:"Search",icon:Y},{value:"bell",label:"Bell",icon:D}];return l.useEffect(()=>{n.is_cbt_offline&&(s("is_active",!0),s("is_safemode",!1))},[n.is_cbt_offline]),e.jsx("div",{className:"p-4 pt-0 space-y-4",children:e.jsxs("form",{onSubmit:i,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(p,{htmlFor:"link_npsn",children:"Lembaga (NPSN)"}),e.jsx(ue,{name:"link_npsn",value:((h=n.link_npsn)==null?void 0:h.toString())||"",onChange:t=>s("link_npsn",t),options:d.map(t=>({label:`${t.name} (${t.npsn})`,value:t.npsn})),placeholder:"-- Pilih Lembaga --"}),e.jsx("p",{className:"text-red-500 text-xs",children:r.link_npsn})]}),e.jsx("input",{type:"hidden",name:"link_profile_id",id:"link_npsn",value:c}),e.jsxs("div",{children:[e.jsx(p,{htmlFor:"title",children:"Judul"}),e.jsx(v,{type:"text",name:"title",value:n.title,onChange:t=>s("title",t.target.value),placeholder:"Masukkan Judul"}),e.jsx("p",{className:"text-red-500 text-xs",children:r.title})]}),e.jsxs("div",{children:[e.jsx(p,{htmlFor:"url",children:"URL"}),e.jsx(v,{type:"text",name:"url",value:n.url,onChange:t=>s("url",t.target.value),placeholder:"https://contoh.com"}),e.jsx("p",{className:"text-red-500 text-xs",children:r.url})]}),e.jsxs("div",{children:[e.jsx(p,{htmlFor:"icon",children:"Icon"}),e.jsx(U,{options:u,value:n.icon||"",isDialog:!0,onValueChange:t=>{n.icon!==t&&s("icon",t)},clearable:!0,children:t=>e.jsx(A,{...t})}),e.jsx("p",{className:"text-red-500 text-xs",children:r.icon})]}),e.jsxs("div",{children:[e.jsx(p,{htmlFor:"bg_color",children:"Warna Background"}),e.jsx(v,{type:"text",name:"bg_color",value:n.bg_color,onChange:t=>s("bg_color",t.target.value),placeholder:"Contoh: bg-blue-500"}),e.jsx("p",{className:"text-red-500 text-xs",children:r.bg_color})]}),e.jsxs("div",{children:[e.jsx(p,{htmlFor:"order",children:"Urutan Tampil"}),e.jsx(v,{type:"number",name:"order",value:n.order,onChange:t=>s("order",parseInt(t.target.value)),placeholder:"Masukkan urutan"}),e.jsx("p",{className:"text-red-500 text-xs",children:r.order})]}),e.jsx("div",{children:e.jsx(g,{id:"is_cbt_offline",label:"CBT OFFLINE",checked:n.is_cbt_offline??!0,onCheckedChange:t=>s("is_cbt_offline",t),error:r.is_cbt_offline})}),!n.is_cbt_offline&&e.jsx("div",{children:e.jsx(g,{id:"is_active",label:"Status Aktif",checked:n.is_active??!0,onCheckedChange:t=>s("is_active",t),error:r.is_active})}),!n.is_cbt_offline&&e.jsx("div",{children:e.jsx(g,{id:"is_safemode",label:"Safe Mode CBT",checked:n.is_safemode??!0,onCheckedChange:t=>s("is_safemode",t),error:r.is_safemode})}),e.jsx(Q,{reset:a,processing:o})]})})}export{Be as default};
