Files
powerservice/wp-content/plugins/yabe-webfont/assets/dist/assets/use-unsaved-changes-CBW9Uy54.js
T
2026-10-19 12:45:45 -06:00

1 line
1.6 KiB
JavaScript

import{r as e}from"./rolldown-runtime-hePW80VL.js";import{U as t,W as n,j as r,r as i}from"./button-BhAQo6Sy.js";import{J as a}from"./api-Bb85n68L.js";import"./switch-DMNAfdJq.js";import{t as o}from"./input-DbQb1wvc.js";var s=t(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),c=i();function l({label:e,hint:t,error:n,children:i,className:a}){return(0,c.jsxs)(`label`,{className:r(`grid gap-1.5 text-sm font-medium text-foreground`,a),children:[(0,c.jsx)(`span`,{children:e}),i,(n||t)&&(0,c.jsx)(`span`,{className:r(`text-xs font-normal text-muted-foreground`,n&&`text-destructive`),children:n||t})]})}function u(e){return(0,c.jsx)(o,{...e})}function d({className:e,...t}){return(0,c.jsx)(`select`,{className:r(`h-8 w-full rounded-lg border border-input bg-background px-2.5 text-sm text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,e),...t})}var f=e(n(),1);function p(e){let t=(0,f.useRef)(!1),n=a(({currentLocation:n,nextLocation:r})=>e&&!t.current&&n.pathname!==r.pathname);return(0,f.useEffect)(()=>{let t=t=>{e&&t.preventDefault()};return window.addEventListener(`beforeunload`,t),()=>window.removeEventListener(`beforeunload`,t)},[e]),(0,f.useEffect)(()=>{n.state===`blocked`&&(window.confirm(wp.i18n.__(`You have unsaved changes. Leave this page?`,`jooosi-fon`))?n.proceed():n.reset())},[n]),(0,f.useCallback)(()=>{t.current=!0},[])}export{s as a,u as i,l as n,d as r,p as t};