HEX
Server: Apache
System: Linux webd006.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: zwafgyp (177615)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/zwafgyp/locationdebateau/wp-content/plugins/woocommerce-delivery-notes/build/admin.js
!function(){"use strict";var e={338:function(e,t,n){var a=n(795);t.H=a.createRoot,a.hydrateRoot},795:function(e){e.exports=window.ReactDOM}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,n),s.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var a,o=n(338),s=window.React,l=n(795);function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},r.apply(this,arguments)}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(a||(a={}));const i="popstate";function c(e,t){if(!1===e||null==e)throw new Error(t)}function d(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function u(e,t){return{usr:e.state,key:e.key,idx:t}}function h(e,t,n,a){return void 0===n&&(n=null),r({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof t?p(t):t,{state:n,key:t&&t.key||a||Math.random().toString(36).substr(2,8)})}function m(e){let{pathname:t="/",search:n="",hash:a=""}=e;return n&&"?"!==n&&(t+="?"===n.charAt(0)?n:"?"+n),a&&"#"!==a&&(t+="#"===a.charAt(0)?a:"#"+a),t}function p(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let a=e.indexOf("?");a>=0&&(t.search=e.substr(a),e=e.substr(0,a)),e&&(t.pathname=e)}return t}var g;function v(e,t,n){return void 0===n&&(n="/"),function(e,t,n,a){let o=L(("string"==typeof t?p(t):t).pathname||"/",n);if(null==o)return null;let s=x(e);!function(e){e.sort((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)))}(s);let l=null;for(let e=0;null==l&&e<s.length;++e){let t=T(o);l=k(s[e],t,a)}return l}(e,t,n,!1)}function x(e,t,n,a){void 0===t&&(t=[]),void 0===n&&(n=[]),void 0===a&&(a="");let o=(e,o,s)=>{let l={relativePath:void 0===s?e.path||"":s,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};l.relativePath.startsWith("/")&&(c(l.relativePath.startsWith(a),'Absolute route path "'+l.relativePath+'" nested under path "'+a+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),l.relativePath=l.relativePath.slice(a.length));let r=B([a,l.relativePath]),i=n.concat(l);e.children&&e.children.length>0&&(c(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+r+'".'),x(e.children,t,i,r)),(null!=e.path||e.index)&&t.push({path:r,score:C(r,e.index),routesMeta:i})};return e.forEach((e,t)=>{var n;if(""!==e.path&&null!=(n=e.path)&&n.includes("?"))for(let n of w(e.path))o(e,t,n);else o(e,t)}),t}function w(e){let t=e.split("/");if(0===t.length)return[];let[n,...a]=t,o=n.endsWith("?"),s=n.replace(/\?$/,"");if(0===a.length)return o?[s,""]:[s];let l=w(a.join("/")),r=[];return r.push(...l.map(e=>""===e?s:[s,e].join("/"))),o&&r.push(...l),r.map(t=>e.startsWith("/")&&""===t?"/":t)}!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(g||(g={})),new Set(["lazy","caseSensitive","path","id","index","children"]);const f=/^:[\w-]+$/,_=3,b=2,j=1,y=10,N=-2,S=e=>"*"===e;function C(e,t){let n=e.split("/"),a=n.length;return n.some(S)&&(a+=N),t&&(a+=b),n.filter(e=>!S(e)).reduce((e,t)=>e+(f.test(t)?_:""===t?j:y),a)}function k(e,t,n){void 0===n&&(n=!1);let{routesMeta:a}=e,o={},s="/",l=[];for(let e=0;e<a.length;++e){let r=a[e],i=e===a.length-1,c="/"===s?t:t.slice(s.length)||"/",d=P({path:r.relativePath,caseSensitive:r.caseSensitive,end:i},c),u=r.route;if(!d&&i&&n&&!a[a.length-1].route.index&&(d=P({path:r.relativePath,caseSensitive:r.caseSensitive,end:!1},c)),!d)return null;Object.assign(o,d.params),l.push({params:o,pathname:B([s,d.pathname]),pathnameBase:I(B([s,d.pathnameBase])),route:u}),"/"!==d.pathnameBase&&(s=B([s,d.pathnameBase]))}return l}function P(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),d("*"===e||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were "'+e.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+e.replace(/\*$/,"/*")+'".');let a=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(a.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(a.push({paramName:"*"}),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),a]}(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let s=o[0],l=s.replace(/(.)\/+$/,"$1"),r=o.slice(1);return{params:a.reduce((e,t,n)=>{let{paramName:a,isOptional:o}=t;if("*"===a){let e=r[n]||"";l=s.slice(0,s.length-e.length).replace(/(.)\/+$/,"$1")}const i=r[n];return e[a]=o&&!i?void 0:(i||"").replace(/%2F/g,"/"),e},{}),pathname:s,pathnameBase:l,pattern:e}}function T(e){try{return e.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(t){return d(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function L(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,a=e.charAt(n);return a&&"/"!==a?null:e.slice(n)||"/"}const F=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function E(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)}),n.length>1?n.join("/"):"/"}function D(e,t,n,a){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(a)+"].  Please separate it out to the `to."+n+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function R(e,t){let n=function(e){return e.filter((e,t)=>0===t||e.route.path&&e.route.path.length>0)}(e);return t?n.map((e,t)=>t===n.length-1?e.pathname:e.pathnameBase):n.map(e=>e.pathnameBase)}function A(e,t,n,a){let o;void 0===a&&(a=!1),"string"==typeof e?o=p(e):(o=r({},e),c(!o.pathname||!o.pathname.includes("?"),D("?","pathname","search",o)),c(!o.pathname||!o.pathname.includes("#"),D("#","pathname","hash",o)),c(!o.search||!o.search.includes("#"),D("#","search","hash",o)));let s,l=""===e||""===o.pathname,i=l?"/":o.pathname;if(null==i)s=n;else{let e=t.length-1;if(!a&&i.startsWith("..")){let t=i.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}s=e>=0?t[e]:"/"}let u=function(e,t){void 0===t&&(t="/");let n,{pathname:a,search:o="",hash:s=""}="string"==typeof e?p(e):e;if(a)if(l=a,F.test(l))n=a;else{if(a.includes("//")){let e=a;a=a.replace(/\/\/+/g,"/"),d(!1,"Pathnames cannot have embedded double slashes - normalizing "+e+" -> "+a)}n=a.startsWith("/")?E(a.substring(1),"/"):E(a,t)}else n=t;var l;return{pathname:n,search:z(o),hash:H(s)}}(o,s),h=i&&"/"!==i&&i.endsWith("/"),m=(l||"."===i)&&n.endsWith("/");return u.pathname.endsWith("/")||!h&&!m||(u.pathname+="/"),u}const B=e=>e.join("/").replace(/\/\/+/g,"/"),I=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),z=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",H=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";Error;const W=["post","put","patch","delete"],O=(new Set(W),["get",...W]);function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},M.apply(this,arguments)}new Set(O),new Set([301,302,303,307,308]),new Set([307,308]),Symbol("deferred");const $=s.createContext(null),U=s.createContext(null),V=s.createContext(null),q=s.createContext(null),Y=s.createContext({outlet:null,matches:[],isDataRoute:!1}),G=s.createContext(null);function J(){return null!=s.useContext(q)}function K(){return J()||c(!1),s.useContext(q).location}function Q(e){s.useContext(V).static||s.useLayoutEffect(e)}function Z(){let{isDataRoute:e}=s.useContext(Y);return e?function(){let{router:e}=function(){let e=s.useContext($);return e||c(!1),e}(se.UseNavigateStable),t=re(le.UseNavigateStable),n=s.useRef(!1);return Q(()=>{n.current=!0}),s.useCallback(function(a,o){void 0===o&&(o={}),n.current&&("number"==typeof a?e.navigate(a):e.navigate(a,M({fromRouteId:t},o)))},[e,t])}():function(){J()||c(!1);let e=s.useContext($),{basename:t,future:n,navigator:a}=s.useContext(V),{matches:o}=s.useContext(Y),{pathname:l}=K(),r=JSON.stringify(R(o,n.v7_relativeSplatPath)),i=s.useRef(!1);return Q(()=>{i.current=!0}),s.useCallback(function(n,o){if(void 0===o&&(o={}),!i.current)return;if("number"==typeof n)return void a.go(n);let s=A(n,JSON.parse(r),l,"path"===o.relative);null==e&&"/"!==t&&(s.pathname="/"===s.pathname?t:B([t,s.pathname])),(o.replace?a.replace:a.push)(s,o.state,o)},[t,a,r,l,e])}()}function X(e,t){let{relative:n}=void 0===t?{}:t,{future:a}=s.useContext(V),{matches:o}=s.useContext(Y),{pathname:l}=K(),r=JSON.stringify(R(o,a.v7_relativeSplatPath));return s.useMemo(()=>A(e,JSON.parse(r),l,"path"===n),[e,r,l,n])}function ee(e,t,n,o){J()||c(!1);let{navigator:l}=s.useContext(V),{matches:r}=s.useContext(Y),i=r[r.length-1],d=i?i.params:{},u=(i&&i.pathname,i?i.pathnameBase:"/");i&&i.route;let h,m=K();if(t){var g;let e="string"==typeof t?p(t):t;"/"===u||(null==(g=e.pathname)?void 0:g.startsWith(u))||c(!1),h=e}else h=m;let x=h.pathname||"/",w=x;if("/"!==u){let e=u.replace(/^\//,"").split("/");w="/"+x.replace(/^\//,"").split("/").slice(e.length).join("/")}let f=v(e,{pathname:w}),_=function(e,t,n,a){var o;if(void 0===t&&(t=[]),void 0===n&&(n=null),void 0===a&&(a=null),null==e){var l;if(!n)return null;if(n.errors)e=n.matches;else{if(!(null!=(l=a)&&l.v7_partialHydration&&0===t.length&&!n.initialized&&n.matches.length>0))return null;e=n.matches}}let r=e,i=null==(o=n)?void 0:o.errors;if(null!=i){let e=r.findIndex(e=>e.route.id&&void 0!==(null==i?void 0:i[e.route.id]));e>=0||c(!1),r=r.slice(0,Math.min(r.length,e+1))}let d=!1,u=-1;if(n&&a&&a.v7_partialHydration)for(let e=0;e<r.length;e++){let t=r[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(u=e),t.route.id){let{loaderData:e,errors:a}=n,o=t.route.loader&&void 0===e[t.route.id]&&(!a||void 0===a[t.route.id]);if(t.route.lazy||o){d=!0,r=u>=0?r.slice(0,u+1):[r[0]];break}}}return r.reduceRight((e,a,o)=>{let l,c=!1,h=null,m=null;var p;n&&(l=i&&a.route.id?i[a.route.id]:void 0,h=a.route.errorElement||ne,d&&(u<0&&0===o?(ie[p="route-fallback"]||(ie[p]=!0),c=!0,m=null):u===o&&(c=!0,m=a.route.hydrateFallbackElement||null)));let g=t.concat(r.slice(0,o+1)),v=()=>{let t;return t=l?h:c?m:a.route.Component?s.createElement(a.route.Component,null):a.route.element?a.route.element:e,s.createElement(oe,{match:a,routeContext:{outlet:e,matches:g,isDataRoute:null!=n},children:t})};return n&&(a.route.ErrorBoundary||a.route.errorElement||0===o)?s.createElement(ae,{location:n.location,revalidation:n.revalidation,component:h,error:l,children:v(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):v()},null)}(f&&f.map(e=>Object.assign({},e,{params:Object.assign({},d,e.params),pathname:B([u,l.encodeLocation?l.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?u:B([u,l.encodeLocation?l.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])})),r,n,o);return t&&_?s.createElement(q.Provider,{value:{location:M({pathname:"/",search:"",hash:"",state:null,key:"default"},h),navigationType:a.Pop}},_):_}function te(){let e=function(){var e;let t=s.useContext(G),n=function(){let e=s.useContext(U);return e||c(!1),e}(le.UseRouteError),a=re(le.UseRouteError);return void 0!==t?t:null==(e=n.errors)?void 0:e[a]}(),t=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return s.createElement(s.Fragment,null,s.createElement("h2",null,"Unexpected Application Error!"),s.createElement("h3",{style:{fontStyle:"italic"}},t),n?s.createElement("pre",{style:a},n):null,null)}const ne=s.createElement(te,null);class ae extends s.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?s.createElement(Y.Provider,{value:this.props.routeContext},s.createElement(G.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function oe(e){let{routeContext:t,match:n,children:a}=e,o=s.useContext($);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),s.createElement(Y.Provider,{value:t},a)}var se=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(se||{}),le=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(le||{});function re(e){let t=function(){let e=s.useContext(Y);return e||c(!1),e}(),n=t.matches[t.matches.length-1];return n.route.id||c(!1),n.route.id}const ie={};function ce(e){c(!1)}function de(e){let{basename:t="/",children:n=null,location:o,navigationType:l=a.Pop,navigator:r,static:i=!1,future:d}=e;J()&&c(!1);let u=t.replace(/^\/*/,"/"),h=s.useMemo(()=>({basename:u,navigator:r,static:i,future:M({v7_relativeSplatPath:!1},d)}),[u,d,r,i]);"string"==typeof o&&(o=p(o));let{pathname:m="/",search:g="",hash:v="",state:x=null,key:w="default"}=o,f=s.useMemo(()=>{let e=L(m,u);return null==e?null:{location:{pathname:e,search:g,hash:v,state:x,key:w},navigationType:l}},[u,m,g,v,x,w,l]);return null==f?null:s.createElement(V.Provider,{value:h},s.createElement(q.Provider,{children:n,value:f}))}function ue(e){let{children:t,location:n}=e;return ee(he(t),n)}function he(e,t){void 0===t&&(t=[]);let n=[];return s.Children.forEach(e,(e,a)=>{if(!s.isValidElement(e))return;let o=[...t,a];if(e.type===s.Fragment)return void n.push.apply(n,he(e.props.children,o));e.type!==ce&&c(!1),e.props.index&&e.props.children&&c(!1);let l={id:e.props.id||o.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(l.children=he(e.props.children,o)),n.push(l)}),n}function me(){return me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},me.apply(this,arguments)}function pe(e,t){if(null==e)return{};var n,a,o={},s=Object.keys(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||(o[n]=e[n]);return o}s.startTransition,new Promise(()=>{}),s.Component,new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);const ge=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],ve=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"];try{window.__reactRouterVersion="6"}catch(e){}const xe=s.createContext({isTransitioning:!1});new Map;const we=s.startTransition;function fe(e){let{basename:t,children:n,future:o,window:l}=e,g=s.useRef();var v;null==g.current&&(g.current=(void 0===(v={window:l,v5Compat:!0})&&(v={}),function(e,t,n,o){void 0===o&&(o={});let{window:s=document.defaultView,v5Compat:l=!1}=o,d=s.history,p=a.Pop,g=null,v=x();function x(){return(d.state||{idx:null}).idx}function w(){p=a.Pop;let e=x(),t=null==e?null:e-v;v=e,g&&g({action:p,location:_.location,delta:t})}function f(e){let t="null"!==s.location.origin?s.location.origin:s.location.href,n="string"==typeof e?e:m(e);return n=n.replace(/ $/,"%20"),c(t,"No window.location.(origin|href) available to create URL for href: "+n),new URL(n,t)}null==v&&(v=0,d.replaceState(r({},d.state,{idx:v}),""));let _={get action(){return p},get location(){return e(s,d)},listen(e){if(g)throw new Error("A history only accepts one active listener");return s.addEventListener(i,w),g=e,()=>{s.removeEventListener(i,w),g=null}},createHref(e){return t(s,e)},createURL:f,encodeLocation(e){let t=f(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){p=a.Push;let o=h(_.location,e,t);n&&n(o,e),v=x()+1;let r=u(o,v),i=_.createHref(o);try{d.pushState(r,"",i)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;s.location.assign(i)}l&&g&&g({action:p,location:_.location,delta:1})},replace:function(e,t){p=a.Replace;let o=h(_.location,e,t);n&&n(o,e),v=x();let s=u(o,v),r=_.createHref(o);d.replaceState(s,"",r),l&&g&&g({action:p,location:_.location,delta:0})},go(e){return d.go(e)}};return _}(function(e,t){let{pathname:n="/",search:a="",hash:o=""}=p(e.location.hash.substr(1));return n.startsWith("/")||n.startsWith(".")||(n="/"+n),h("",{pathname:n,search:a,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")},function(e,t){let n=e.document.querySelector("base"),a="";if(n&&n.getAttribute("href")){let t=e.location.href,n=t.indexOf("#");a=-1===n?t:t.slice(0,n)}return a+"#"+("string"==typeof t?t:m(t))},function(e,t){d("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")},v)));let x=g.current,[w,f]=s.useState({action:x.action,location:x.location}),{v7_startTransition:_}=o||{},b=s.useCallback(e=>{_&&we?we(()=>f(e)):f(e)},[f,_]);return s.useLayoutEffect(()=>x.listen(b),[x,b]),s.useEffect(()=>{return null==(e=o)||e.v7_startTransition,void 0===(null==e?void 0:e.v7_relativeSplatPath)&&(!t||t.v7_relativeSplatPath),void(t&&(t.v7_fetcherPersist,t.v7_normalizeFormMethod,t.v7_partialHydration,t.v7_skipActionErrorRevalidation));var e,t},[o]),s.createElement(de,{basename:t,children:n,location:w.location,navigationType:w.action,navigator:x,future:o})}l.flushSync,s.useId;const _e="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,be=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,je=s.forwardRef(function(e,t){let n,{onClick:a,relative:o,reloadDocument:l,replace:r,state:i,target:d,to:u,preventScrollReset:h,viewTransition:p}=e,g=pe(e,ge),{basename:v}=s.useContext(V),x=!1;if("string"==typeof u&&be.test(u)&&(n=u,_e))try{let e=new URL(window.location.href),t=u.startsWith("//")?new URL(e.protocol+u):new URL(u),n=L(t.pathname,v);t.origin===e.origin&&null!=n?u=n+t.search+t.hash:x=!0}catch(e){}let w=function(e,t){let{relative:n}=void 0===t?{}:t;J()||c(!1);let{basename:a,navigator:o}=s.useContext(V),{hash:l,pathname:r,search:i}=X(e,{relative:n}),d=r;return"/"!==a&&(d="/"===r?a:B([a,r])),o.createHref({pathname:d,search:i,hash:l})}(u,{relative:o}),f=function(e,t){let{target:n,replace:a,state:o,preventScrollReset:l,relative:r,viewTransition:i}=void 0===t?{}:t,c=Z(),d=K(),u=X(e,{relative:r});return s.useCallback(t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,n)){t.preventDefault();let n=void 0!==a?a:m(d)===m(u);c(e,{replace:n,state:o,preventScrollReset:l,relative:r,viewTransition:i})}},[d,c,u,a,o,n,e,l,r,i])}(u,{replace:r,state:i,target:d,preventScrollReset:h,relative:o,viewTransition:p});return s.createElement("a",me({},g,{href:n||w,onClick:x||l?a:function(e){a&&a(e),e.defaultPrevented||f(e)},ref:t,target:d}))}),ye=s.forwardRef(function(e,t){let{"aria-current":n="page",caseSensitive:a=!1,className:o="",end:l=!1,style:r,to:i,viewTransition:d,children:u}=e,h=pe(e,ve),m=X(i,{relative:h.relative}),p=K(),g=s.useContext(U),{navigator:v,basename:x}=s.useContext(V),w=null!=g&&function(e,t){void 0===t&&(t={});let n=s.useContext(xe);null==n&&c(!1);let{basename:a}=function(){let e=s.useContext($);return e||c(!1),e}(Ne.useViewTransitionState),o=X(e,{relative:t.relative});if(!n.isTransitioning)return!1;let l=L(n.currentLocation.pathname,a)||n.currentLocation.pathname,r=L(n.nextLocation.pathname,a)||n.nextLocation.pathname;return null!=P(o.pathname,r)||null!=P(o.pathname,l)}(m)&&!0===d,f=v.encodeLocation?v.encodeLocation(m).pathname:m.pathname,_=p.pathname,b=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;a||(_=_.toLowerCase(),b=b?b.toLowerCase():null,f=f.toLowerCase()),b&&x&&(b=L(b,x)||b);const j="/"!==f&&f.endsWith("/")?f.length-1:f.length;let y,N=_===f||!l&&_.startsWith(f)&&"/"===_.charAt(j),S=null!=b&&(b===f||!l&&b.startsWith(f)&&"/"===b.charAt(f.length)),C={isActive:N,isPending:S,isTransitioning:w},k=N?n:void 0;y="function"==typeof o?o(C):[o,N?"active":null,S?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let T="function"==typeof r?r(C):r;return s.createElement(je,me({},h,{"aria-current":k,className:y,ref:t,style:T,to:i,viewTransition:d}),"function"==typeof u?u(C):u)});var Ne,Se;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ne||(Ne={})),function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(Se||(Se={}));var Ce=window.wp.element,ke=window.wp.data,Pe=window.wp.coreData;const Te=(Le="init",()=>(0,ke.useSelect)(e=>({data:e(Pe.store).getEntityRecord("wcdn",Le),hasResolved:e(Pe.store).hasFinishedResolution("getEntityRecord",["wcdn",Le])}),[]));var Le,Fe=window.ReactJSXRuntime;const Ee=(0,Ce.createContext)();function De(){return(0,Ce.useContext)(Ee)}var Re=({children:e})=>{const[t,n]=(0,Ce.useState)({}),[a,o]=(0,Ce.useState)(!1),[s,l]=(0,Ce.useState)(!0),{wcdnData:r,hasResolved:i}=Te();return(0,Ce.useEffect)(()=>{i&&(r?.data&&n(r.data),o(!0),l(!1))},[i]),(0,Fe.jsx)(Ee.Provider,{value:{data:t,setData:n,showLoader:s,setShowLoader:l,isDataLoaded:a},children:e})},Ae=window.wp.components,Be=window.wp.i18n,Ie=function(){return(0,Fe.jsxs)("div",{id:"wcdn-header",children:[(0,Fe.jsxs)(Ae.Card,{className:"wcdn-topbar",isBorderless:!0,children:[(0,Fe.jsx)("h1",{children:(0,Be.__)("Print Invoices & Delivery Notes","woocommerce-delivery-notes")}),(0,Fe.jsx)("p",{children:(0,Be.__)("Generate, customize, print, and email order documents.","woocommerce-delivery-notes")})]}),(0,Fe.jsx)(Ae.Card,{className:"wcdn-navigation",isBorderless:!0,children:(0,Fe.jsx)(Ae.__experimentalHStack,{align:"end",justify:"left",spacing:5,children:(0,Fe.jsx)(Ae.__experimentalHStack,{justify:"left",className:"wcdn-navigation-menu",children:[{name:(0,Be.__)("Dashboard","woocommerce-delivery-notes"),path:"/"},{name:(0,Be.__)("Templates","woocommerce-delivery-notes"),path:"/templates"},{name:(0,Be.__)("Settings","woocommerce-delivery-notes"),path:"/settings"},{name:(0,Be.__)("FAQs","woocommerce-delivery-notes"),path:"/faqs"}].map((e,t)=>(0,Fe.jsx)(ye,{to:e.path,className:({isActive:e})=>e?"is-active":"",children:e.name},t))})})})]})},ze=function({storageKey:e,children:t}){const[n,a]=(0,Ce.useState)(()=>"1"!==localStorage.getItem(e));return n?(0,Fe.jsxs)("div",{className:"wcdn-alert",children:[(0,Fe.jsx)("span",{className:"wcdn-alert-content",children:t}),(0,Fe.jsx)("button",{className:"wcdn-alert-dismiss",onClick:()=>{localStorage.setItem(e,"1"),a(!1)},"aria-label":(0,Be.__)("Dismiss","woocommerce-delivery-notes"),children:"×"})]}):null},He=function(){return(0,Fe.jsxs)("div",{id:"wcdn-footer",children:[(0,Fe.jsxs)(ze,{storageKey:"wcdn_orddd_promo_dismissed",children:[(0,Be.__)("Get our","woocommerce-delivery-notes")," ",(0,Fe.jsx)("a",{href:"https://www.tychesoftwares.com/products/woocommerce-order-delivery-date-pro-plugin/",target:"_blank",rel:"noreferrer",children:(0,Be.__)("Order Delivery Date Pro","woocommerce-delivery-notes")})," ",(0,Be.__)("plugin to schedule and manage your local deliveries and pickups in WooCommerce.","woocommerce-delivery-notes")]}),(0,Fe.jsxs)("p",{children:[(0,Fe.jsx)("a",{href:"https://wordpress.org/support/plugin/woocommerce-delivery-notes/",target:"_blank",rel:"noreferrer",title:(0,Be.__)("Open the support forum for this plugin on WordPress.org","woocommerce-delivery-notes"),children:(0,Be.__)("Need Support?","woocommerce-delivery-notes")})," ",(0,Be.__)("We're always happy to help you.","woocommerce-delivery-notes")]}),(0,Fe.jsxs)("p",{children:[(0,Be.__)("If this plugin helped you,","woocommerce-delivery-notes")," ",(0,Fe.jsx)("a",{href:"https://wordpress.org/support/plugin/woocommerce-delivery-notes/reviews/#new-post",target:"_blank",rel:"noreferrer",title:(0,Be.__)("Leave a review for this plugin on WordPress.org","woocommerce-delivery-notes"),children:(0,Be.__)("please rate it","woocommerce-delivery-notes")})," ",(0,Fe.jsx)("span",{"aria-hidden":"true",style:{color:"#f0ad00"},children:"★".repeat(5)})]}),(0,Fe.jsxs)("p",{children:[(0,Be.__)("Check out more plugins by","woocommerce-delivery-notes")," ",(0,Fe.jsx)("a",{href:"https://www.tychesoftwares.com",target:"_blank",rel:"noreferrer",title:(0,Be.__)("Visit Tyche Softwares to explore more WooCommerce plugins","woocommerce-delivery-notes"),children:(0,Be.__)("Tyche Softwares","woocommerce-delivery-notes")}),"."]})]})},We=window.wp.notices,Oe=function(){const e=(0,ke.useSelect)(e=>e(We.store).getNotices(),[]),{removeNotice:t}=(0,ke.useDispatch)(We.store);return(0,Ce.useEffect)(()=>{if(!e.length)return;const n=e.map(e=>setTimeout(()=>{t(e.id)},2e4));return()=>n.forEach(clearTimeout)},[e]),e.length?(0,Fe.jsx)("div",{className:"wcdn-toast",children:e.map(e=>(0,Fe.jsx)(Ae.Notice,{status:e.status,isDismissible:!0,onRemove:()=>t(e.id),className:"wcdn-toast-notice",children:e.content},e.id))}):null},Me=function(){const{showLoader:e}=De();return e?(0,Fe.jsx)("div",{className:"wcdn-loading-overlay",children:(0,Fe.jsx)(Ae.Spinner,{})}):null};const $e="woocommerce-delivery-notes";var Ue=window.wp.apiFetch,Ve=n.n(Ue);function qe(e){if(e.data&&"success"===e.status)return e.data;throw e?.data?.error_description||(0,Be.__)("Request failed",$e)}let Ye={},Ge={};function Je(e){Ye[e]=null}function Ke(e){const t=e;return{fetch(n=!1){return function(e,t,n=!1){return Ye[e]&&!n?Promise.resolve(Ye[e]):(Ge[e]&&!n||(Ge[e]=t().then(t=>(Ye[e]=t,Ge[e]=null,t)).catch(t=>{throw Ge[e]=null,t})),Ge[e])}(t,()=>Ve()({path:`/wcdn/v1/${e}`}).then(qe),n)},save(n){return Ve()({path:`/wcdn/v1/${e}`,method:"POST",data:n}).then(qe).then(e=>(Je(t),e||{}))},clearCache(){Je(t)}}}const Qe=Ke("dashboard"),Ze=Qe.fetch;Qe.clearCache;var Xe=function(){return(0,Fe.jsxs)("div",{className:"wcdn-dashboard-skeleton",children:[(0,Fe.jsxs)(Ae.Card,{className:"wcdn-card",children:[(0,Fe.jsx)(Ae.CardHeader,{children:(0,Fe.jsx)(Ae.__experimentalHeading,{level:4,children:(0,Fe.jsx)("div",{className:"wcdn-skeleton-line wcdn-skeleton-title"})})}),(0,Fe.jsxs)(Ae.CardBody,{children:[(0,Fe.jsx)("div",{className:"wcdn-skeleton-checklist",children:[1,2,3,4].map(e=>(0,Fe.jsxs)("div",{className:"wcdn-skeleton-check-row",children:[(0,Fe.jsx)("div",{className:"wcdn-skeleton-box"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-line wcdn-skeleton-text"})]},e))}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-progress"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-line wcdn-skeleton-small"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-line wcdn-skeleton-wide"})]})]}),(0,Fe.jsxs)(Ae.Card,{className:"wcdn-card",children:[(0,Fe.jsx)(Ae.CardHeader,{children:(0,Fe.jsx)(Ae.__experimentalHeading,{level:4,children:(0,Fe.jsx)("div",{className:"wcdn-skeleton-line wcdn-skeleton-title"})})}),(0,Fe.jsxs)(Ae.CardBody,{children:[[1,2,3].map(e=>(0,Fe.jsx)("div",{className:"wcdn-skeleton-button"},e)),(0,Fe.jsx)("div",{className:"wcdn-skeleton-notice"})]})]})]})};const et={success(e){(0,ke.dispatch)(We.store).createNotice("success",e)},error(e){(0,ke.dispatch)(We.store).createNotice("error",e)},warning(e){(0,ke.dispatch)(We.store).createNotice("warning",e)},info(e){(0,ke.dispatch)(We.store).createNotice("info",e)}};var tt=function(){const[e,t]=(0,Ce.useState)(null),[n,a]=(0,Ce.useState)(!0);if((0,Ce.useEffect)(()=>{let e=!0;return Ze().then(n=>{e&&t(n||null)}).catch(e=>{et.error(e?.message||(0,Be.__)("Failed to load Dashboard data",$e))}).finally(()=>{e&&a(!1)}),()=>{e=!1}},[]),n||!e)return(0,Fe.jsx)(Xe,{});const o=[e?.store_details_configured,e?.at_least_one_template_enabled,e?.pdf_generation_enabled,e?.invoice_numbering_configured],s=o.filter(Boolean).length,l=o.length,r=l?s/l*100:0;let i="";const c=o.every(Boolean),d=o.every(e=>!e);return i=c?(0,Be.__)("You're ready to generate and print documents!",$e):e?.store_details_configured&&e?.at_least_one_template_enabled&&e?.pdf_generation_enabled&&!e?.invoice_numbering_configured?(0,Be.__)("Your setup is almost ready. Complete the remaining steps to start generating documents.",$e):d?(0,Be.__)("Complete these steps to start printing and email order documents.",$e):(0,Be.__)("Complete the remaining steps to start generating documents.",$e),(0,Fe.jsxs)("div",{className:"wcdn-dashboard-content",children:[(0,Fe.jsxs)(Ae.Card,{isRounded:!1,className:"wcdn-card",children:[(0,Fe.jsx)(Ae.CardHeader,{className:"wcdn-card-header",children:(0,Fe.jsx)(Ae.__experimentalHeading,{level:4,children:(0,Be.__)("Getting Started",$e)})}),(0,Fe.jsxs)(Ae.CardBody,{children:[(0,Fe.jsx)(Ae.CheckboxControl,{className:"wcdn-checkbox",disabled:!0,label:(0,Be.__)("Store details configured",$e),checked:e?.store_details_configured}),(0,Fe.jsx)(Ae.CheckboxControl,{className:"wcdn-checkbox",disabled:!0,label:(0,Be.__)("At least one template enabled",$e),checked:e?.at_least_one_template_enabled}),(0,Fe.jsx)(Ae.CheckboxControl,{className:"wcdn-checkbox",disabled:!0,label:(0,Be.__)("PDF generation enabled",$e),checked:e?.pdf_generation_enabled}),(0,Fe.jsx)(Ae.CheckboxControl,{className:"wcdn-checkbox",disabled:!0,label:(0,Be.__)("Invoice numbering configured",$e),checked:e?.invoice_numbering_configured}),(0,Fe.jsx)(Ae.ProgressBar,{value:r,max:100,className:"wcdn-progress-bar"}),(0,Fe.jsx)("p",{className:"wcdn-progress-bar-text",children:(0,Be.sprintf)(/* translators: 1: completed steps, 2: total steps */ /* translators: 1: completed steps, 2: total steps */
(0,Be.__)("%1$d of %2$d steps completed",$e),s,l)}),(0,Fe.jsx)("p",{children:i})]})]}),(0,Fe.jsxs)(Ae.Card,{isRounded:!1,className:"wcdn-card",children:[(0,Fe.jsx)(Ae.CardHeader,{className:"wcdn-card-header",children:(0,Fe.jsx)(Ae.__experimentalHeading,{level:4,children:(0,Be.__)("Quick Actions",$e)})}),(0,Fe.jsx)(Ae.CardBody,{children:(0,Fe.jsxs)(Ae.__experimentalVStack,{spacing:4,children:[(0,Fe.jsx)(Ae.Button,{variant:"primary",isLarge:!0,className:"wcdn-quick-action",onClick:()=>{window.open(e?.url?.preview_sample_invoice,"_blank","noopener,noreferrer")},disabled:!e?.url?.preview_sample_invoice,children:(0,Be.__)("Preview Sample Document",$e)}),(0,Fe.jsx)(Ae.Button,{variant:"primary",isLarge:!0,className:"wcdn-quick-action",onClick:()=>{window.open(e?.url?.view_latest_order_invoice,"_blank","noopener,noreferrer")},disabled:!e?.url?.view_latest_order_invoice,children:(0,Be.__)("View Latest Order Invoice",$e)}),(0,Fe.jsx)(Ae.Button,{variant:"primary",isLarge:!0,className:"wcdn-quick-action",onClick:()=>{window.location.href=e?.url?.edit_templates},disabled:!e?.url?.view_latest_order_invoice,children:(0,Be.__)("Edit Templates",$e)}),(0,Fe.jsx)(Ae.Notice,{status:"info",isDismissible:!1,className:"wcdn-quick-actions-notice",children:(0,Be.__)("You can customize documents anytime to match your store.",$e)})]})})]})]})},nt=function(){return(0,Fe.jsxs)(Ae.Card,{isRounded:!1,className:"wcdn-card",children:[(0,Fe.jsxs)(Ae.CardHeader,{className:"wcdn-card-header wcdn-faq",isBorderless:!0,children:[(0,Fe.jsx)(Ae.__experimentalHeading,{level:3,children:(0,Be.__)("Frequently Asked Questions",$e)}),(0,Fe.jsx)("p",{className:"wcdn-faq-subtitle",children:(0,Be.__)("Find answers to common questions about the Print Invoices & Delivery Notes plugin.",$e)})]}),(0,Fe.jsxs)(Ae.CardBody,{style:{paddingTop:0},children:[(0,Fe.jsx)(Ae.Panel,{className:"wcdn-faq-panel",children:[{title:(0,Be.__)("How do templates work?",$e),content:(0,Be.__)("Templates are pre-designed layouts for your documents. You can enable or disable each template (Invoice, Receipt, Delivery Note, etc.) and customize their sections, fonts, colors, and content. Changes are reflected in real-time in the preview pane.",$e)},{title:(0,Be.__)("Why does the order print show a 404 page?",$e),content:(0,Be.__)("This usually happens due to permalink settings — resave your WordPress Permalinks or WooCommerce Print Settings and ensure a My Account Page is selected in WooCommerce settings.",$e)},{title:(0,Be.__)("How can I translate the plugin?",$e),content:(0,Be.__)("Upload your .mo and .po files to /wp-content/languages/plugins/ using the correct locale (e.g. woocommerce-delivery-notes-it_IT.mo).",$e)},{title:(0,Be.__)("Does this plugin modify order data?",$e),content:(0,Be.__)("No, the plugin only reads WooCommerce order data to generate documents and does not modify any order information.",$e)},{title:(0,Be.__)("What is the difference between an invoice and a receipt?",$e),content:(0,Be.__)("An invoice requests payment before it is made, while a receipt confirms that payment has already been received.",$e)},{title:(0,Be.__)("Why can’t customers see the Print button?",$e),content:(0,Be.__)("Ensure the print button option is enabled, the document template is active, and order status rules are properly configured.",$e)},{title:(0,Be.__)("How do I enable automatic PDF attachments to emails?",$e),content:(0,Be.__)("Enable PDF attachments for customer or admin emails in the Documents tab, and configure order status rules if needed.",$e)},{title:(0,Be.__)("Is the plugin GDPR compliant?",$e),content:(0,Be.__)("Yes, the plugin stores minimal data beyond WooCommerce, but storing generated PDFs should be disclosed in your privacy policy.",$e)},{title:(0,Be.__)("Can I change item prices in documents?",$e),content:(0,Be.__)("No, document prices come directly from WooCommerce orders, though you can choose the price source in the Templates settings.",$e)}].map((e,t)=>(0,Fe.jsx)(Ae.PanelBody,{title:e.title,initialOpen:!1,children:(0,Fe.jsx)("p",{children:e.content})}))}),(0,Fe.jsxs)("div",{className:"wcdn-faq-footer",children:[(0,Fe.jsx)("strong",{children:(0,Be.__)("Still need help?",$e)})," ",(0,Be.__)("Visit our",$e)," ",(0,Fe.jsx)("a",{href:"https://www.tychesoftwares.com/docs/docs/print-invoice-delivery-notes-for-woocommerce/",target:"_blank",rel:"noopener noreferrer",children:(0,Be.__)("documentation",$e)})," ",(0,Be.__)("or",$e)," ",(0,Fe.jsx)("a",{href:"https://support.tychesoftwares.com/help/2285384554",target:"_blank",rel:"noopener noreferrer",children:(0,Be.__)("contact support.",$e)})]})]})]})},at=function(){return(0,Fe.jsxs)("div",{className:"wcdn-settings-skeleton",children:[(0,Fe.jsxs)(Ae.Card,{className:"wcdn-card",children:[(0,Fe.jsx)(Ae.CardHeader,{children:(0,Fe.jsx)(Ae.__experimentalHeading,{level:4,children:(0,Fe.jsx)("div",{className:"wcdn-skeleton-line wcdn-skeleton-title"})})}),(0,Fe.jsxs)(Ae.CardBody,{children:[(0,Fe.jsx)("div",{className:"wcdn-skeleton-line"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-line"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-line"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-line"})]})]}),(0,Fe.jsxs)(Ae.Card,{className:"wcdn-card",children:[(0,Fe.jsx)(Ae.CardHeader,{children:(0,Fe.jsx)(Ae.__experimentalHeading,{level:4,children:(0,Fe.jsx)("div",{className:"wcdn-skeleton-line wcdn-skeleton-title"})})}),(0,Fe.jsxs)(Ae.CardBody,{children:[(0,Fe.jsx)("div",{className:"wcdn-skeleton-line"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-line"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-line"})]})]})]})},ot=function({children:e,variant:t="primary",isBusy:n=!1,disabled:a=!1,fullWidth:o=!1,onClick:s,type:l="button",className:r="",...i}){return(0,Fe.jsx)(Ae.Button,{variant:t,isBusy:n,disabled:a,onClick:s,type:l,className:`\n                wcdn-button\n                ${o?"wcdn-button-full":""}\n                ${r}\n            `,...i,children:e})},st=function({title:e,description:t,children:n,className:a}){return(0,Fe.jsxs)(Ae.Card,{className:`wcdn-card mt-30 ${a}`,isRounded:!1,children:[(0,Fe.jsxs)(Ae.CardHeader,{className:"wcdn-card-header",children:[(0,Fe.jsx)("h4",{children:e}),t&&(0,Fe.jsx)("p",{className:"wcdn-section-description",children:t})]}),(0,Fe.jsx)(Ae.CardBody,{className:"wcdn-section-card",children:n})]})},lt=window.wp.primitives,rt=(0,Fe.jsx)(lt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Fe.jsx)(lt.Path,{d:"M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z"})}),it=(0,Fe.jsx)(lt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Fe.jsx)(lt.Path,{d:"m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z"})}),ct=function({status:e,message:t,onRemove:n,timeout:a=1e4}){return(0,Ce.useEffect)(()=>{if(!n)return;const e=setTimeout(()=>{n()},a);return()=>clearTimeout(e)},[a,n]),(0,Fe.jsx)(Ae.Notice,{status:e,isDismissible:!0,onRemove:n,className:`wcdn-notice wcdn-notice-${e}`,children:(0,Fe.jsxs)("div",{className:"wcdn-notice-inner",children:[(0,Fe.jsx)(Ae.Icon,{icon:"success"===e?rt:it,size:20}),(0,Fe.jsx)("span",{children:t})]})})},dt=function({onSave:e,isSaving:t=!1,hasChanges:n,notice:a,setNotice:o}){const[s,l]=(0,Ce.useState)(!1);return(0,Ce.useEffect)(()=>{const e=()=>{const e=window.innerHeight+window.scrollY,t=document.documentElement.scrollHeight;l(e>=t-5)};return e(),window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)},[]),(0,Fe.jsx)("div",{className:"wcdn-save-bar "+(s?"is-bottom":"is-floating"),children:(0,Fe.jsxs)("div",{className:"wcdn-save-bar-row",children:[(0,Fe.jsx)(ot,{variant:"primary",onClick:e,isBusy:t,disabled:!n,children:(0,Be.__)("Save Settings","woocommerce-delivery-notes")}),a&&(0,Fe.jsx)(ct,{...a,onRemove:()=>o(null)})]})})},ut=function({label:e,tooltip:t}){return t?(0,Fe.jsxs)("div",{className:"wcdn-label-with-tooltip",children:[(0,Fe.jsx)("span",{children:e}),(0,Fe.jsx)(Ae.Tooltip,{text:t,children:(0,Fe.jsx)("span",{className:"wcdn-tooltip-icon",children:"?"})})]}):e},ht=function({label:e,tooltip:t,value:n,onChange:a,help:o,bottomLabel:s,...l}){return(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)(Ae.TextControl,{label:(0,Fe.jsx)(ut,{label:e,tooltip:t}),value:n,onChange:a,help:o,...l}),s&&""!==s&&!l?.error&&(0,Fe.jsx)("p",{className:"wcdn-form-bottom-label",children:s}),l?.error&&(0,Fe.jsx)("p",{className:"wcdn-error",children:l.error})]})},mt=function({label:e,tooltip:t,value:n,onChange:a,help:o,bottomLabel:s,...l}){return(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)(Ae.TextareaControl,{label:(0,Fe.jsx)(ut,{label:e,tooltip:t}),value:n,onChange:a,help:o,...l}),s&&(0,Fe.jsx)("p",{className:"wcdn-form-bottom-label",children:s})]})},pt=function({label:e,tooltip:t,checked:n,onChange:a,help:o,...s}){return(0,Fe.jsx)(Ae.CheckboxControl,{label:(0,Fe.jsx)(ut,{label:e,tooltip:t}),checked:n,onChange:a,help:s?.bottomLabel,...s})},gt=function({label:e,tooltip:t,value:n,options:a,onChange:o,help:s,multiple:l,...r}){if(!l)return(0,Fe.jsx)(Ae.SelectControl,{label:(0,Fe.jsx)(ut,{label:e,tooltip:t}),value:n,options:a,onChange:o,help:s,...r});const i=Array.isArray(n)?n:[],c=i.map(e=>a.find(t=>t.value===e)?.label).filter(Boolean),d=a.filter(e=>!i.includes(e.value)).map(e=>e.label);return(0,Fe.jsxs)("div",{className:r.className,children:[e&&(0,Fe.jsx)("label",{className:"components-base-control__label",children:(0,Fe.jsx)(ut,{label:e,tooltip:t})}),(0,Fe.jsx)(Ae.FormTokenField,{label:null,help:null,value:c,suggestions:d,onChange:e=>{const t=e.map(e=>{const t=a.find(t=>t.label===e);return t?t.value:null}).filter(Boolean);o(t)},placeholder:r.bottomLabel})]})},vt=(0,Fe.jsx)(lt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Fe.jsx)(lt.Path,{d:"M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"})}),xt=function({label:e,tooltip:t,value:n,onChange:a,help:o,className:s}){const l=(0,Ce.useRef)(null);return(0,Fe.jsxs)("div",{className:`wcdn-logo-upload ${s}`,children:[(0,Fe.jsx)(ut,{label:e,tooltip:t}),(0,Fe.jsxs)("div",{className:"wcdn-logo-row",children:[(0,Fe.jsx)("div",{className:"wcdn-logo-preview",children:n?(0,Fe.jsx)("img",{src:n,alt:"",style:{maxWidth:"100%",maxHeight:"100%"}}):(0,Be.__)("Logo",$e)}),(0,Fe.jsxs)("div",{className:"wcdn-logo-actions",children:[(0,Fe.jsxs)(Ae.Button,{variant:"secondary",onClick:()=>{l.current||(l.current=wp.media({title:(0,Be.__)("Select Logo",$e),button:{text:(0,Be.__)("Use Logo",$e)},library:{type:"image"},multiple:!1}),l.current.on("select",()=>{const e=l.current.state().get("selection").first().toJSON();a(e.url)})),l.current.open()},className:"wcdn-upload-button",children:[(0,Fe.jsx)(Ae.Icon,{icon:vt,size:18}),(0,Be.__)("Upload Logo",$e)]}),n&&(0,Fe.jsx)(Ae.Button,{variant:"tertiary",onClick:()=>a(""),children:(0,Be.__)("Remove Logo",$e)}),o&&(0,Fe.jsx)("div",{className:"wcdn-logo-help",children:o})]})]})]})},wt=function({label:e,tooltip:t,value:n,onChange:a,options:o=[],disabled:s,bottomLabel:l,...r}){const i=o.some(e=>e.description);return(0,Fe.jsxs)("div",{className:`wcdn-radio-group ${r.className??""}`,children:[(0,Fe.jsx)(ut,{label:e,tooltip:t}),i?(0,Fe.jsx)("div",{className:"wcdn-radio-options",children:o.map(e=>(0,Fe.jsxs)("label",{className:"wcdn-radio-option"+(s?" is-disabled":""),children:[(0,Fe.jsx)("input",{type:"radio",value:e.value,checked:n===e.value,onChange:()=>!s&&a(e.value),disabled:s}),(0,Fe.jsxs)("span",{className:"wcdn-radio-option__body",children:[(0,Fe.jsx)("span",{className:"wcdn-radio-option__label",children:e.label}),(0,Fe.jsx)("span",{className:"wcdn-radio-option__description",children:e.description})]})]},e.value))}):(0,Fe.jsx)(Ae.RadioControl,{selected:n,options:o,onChange:a,disabled:s}),l&&(0,Fe.jsx)("p",{className:"wcdn-radio-group__help",children:l})]})},ft=function({label:e,value:t,onChange:n,disabled:a,className:o=""}){return(0,Fe.jsx)(Ae.BaseControl,{label:e,className:`wcdn-color-control ${o}`,children:(0,Fe.jsx)("input",{type:"color",value:t,onChange:e=>n(e.target.value),disabled:a})})},_t=function({label:e,tooltip:t,value:n,onChange:a,help:o,bottomLabel:s,...l}){return(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)(Ae.__experimentalNumberControl,{label:(0,Fe.jsx)(ut,{label:e,tooltip:t}),value:n,onChange:a,help:o,...l}),s&&""!==s&&!l?.error&&(0,Fe.jsx)("p",{className:"wcdn-form-bottom-label",children:s}),l?.error&&(0,Fe.jsx)("p",{className:"wcdn-error",children:l.error})]})};const bt=Ke("settings"),jt=bt.fetch,yt=bt.save,Nt=(bt.clearCache,Ke("templates")),St=Nt.fetch,Ct=Nt.save,kt=Nt.clearCache;var Pt=function({settings:e,updateSetting:t}){return(0,Fe.jsxs)("div",{children:[(0,Fe.jsxs)(st,{title:(0,Be.__)("Store Identity",$e),children:[(0,Fe.jsx)(ht,{label:(0,Be.__)("Store Name",$e),tooltip:(0,Be.__)("Your business or store name that will appear on all documents.",$e),value:e.storeName,onChange:e=>t("storeName",e)}),(0,Fe.jsx)(xt,{className:"mt-20",label:(0,Be.__)("Store Logo",$e),tooltip:(0,Be.__)("Logo that will be displayed at the top of documents",$e),value:e.storeLogo,onChange:e=>t("storeLogo",e),help:(0,Be.__)("Recommended size: 300×100px.",$e)})]}),(0,Fe.jsxs)(st,{title:(0,Be.__)("Store Information",$e),children:[(0,Fe.jsx)(mt,{label:(0,Be.__)("Store Address",$e),tooltip:(0,Be.__)("This address will appear on invoices and other documents as the sender/from address.",$e),value:e.storeAddress,onChange:e=>t("storeAddress",e),bottomLabel:(0,Be.__)("Complete address including street, city, state, postal code and country",$e)}),(0,Fe.jsx)(ht,{className:"mt-20",label:(0,Be.__)("Contact Email",$e),tooltip:(0,Be.__)("Primary email address for customer inquiries and support.",$e),value:e.email,onChange:e=>t("email",e)}),(0,Fe.jsx)(ht,{className:"mt-20",label:(0,Be.__)("Contact Phone",$e),tooltip:(0,Be.__)("Phone number printed on documents.",$e),value:e.phone,onChange:e=>t("phone",e)})]}),(0,Fe.jsx)(st,{title:(0,Be.__)("Footer Content",$e),children:(0,Fe.jsx)(mt,{label:(0,Be.__)("Footer Text",$e),tooltip:(0,Be.__)("Appears at the bottom of printed documents.",$e),value:e.footerText,onChange:e=>t("footerText",e),bottomLabel:(0,Be.__)("This text will appear at the bottom of all documents",$e)})}),(0,Fe.jsx)(st,{title:(0,Be.__)("Complimentary Close",$e),children:(0,Fe.jsx)(mt,{label:(0,Be.__)("Complimentary Close",$e),tooltip:(0,Be.__)("A formal closing statement, typically including a sign-off and signature line.",$e),value:e.complimentaryClose,onChange:e=>t("complimentaryClose",e),bottomLabel:(0,Be.__)("Closing message to appear on documents",$e)})}),(0,Fe.jsx)(st,{title:(0,Be.__)("Policies",$e),children:(0,Fe.jsx)(mt,{label:(0,Be.__)("Policies",$e),tooltip:(0,Be.__)("Legal and policy information to display on documents for customer reference.",$e),value:e.policies,onChange:e=>t("policies",e),bottomLabel:(0,Be.__)("Return policy, privacy policy, and terms & conditions",$e)})})]})},Tt=function({settings:e,updateSetting:t,validation:n,saveSettingsHandler:a}){return(0,Fe.jsxs)("div",{children:[(0,Fe.jsxs)(st,{title:(0,Be.__)("Print Page",$e),children:[(0,Fe.jsx)(ht,{label:(0,Be.__)("Print Page Endpoint",$e),tooltip:(0,Be.__)("The URL path customers will ue to access their printable documents.",$e),value:e.printEndpoint,onChange:e=>t("printEndpoint",e),bottomLabel:(0,Be.__)("Custom URL slug for the print page",$e)}),(0,Fe.jsx)(ht,{className:"mt-20",label:(0,Be.__)("Page Title (Browser Tab)",$e),tooltip:(0,Be.__)("The title shown in the browser tab when viewing a document. This does not affect the document content or PDF title.",$e),value:e.defaultDocumentLabel,onChange:e=>t("defaultDocumentLabel",e),bottomLabel:(0,Be.__)("Controls the text shown in the browser tab when a document is opened.",$e)}),(0,Fe.jsx)(pt,{className:"mt-20",label:(0,Be.__)("Open print dialog on page load",$e),checked:e.autoPrintDialog,onChange:e=>t("autoPrintDialog",e),bottomLabel:(0,Be.__)("When enabled, the browser's print dialog will open automatically as soon as a document page finishes loading.",$e)})]}),(0,Fe.jsxs)(st,{title:(0,Be.__)("Invoice",$e),children:[(0,Fe.jsx)(ht,{label:(0,Be.__)("Invoice Number Format",$e),tooltip:(0,Be.__)("Format for the Invoice Number used across all documents.",$e),value:e.invoiceNumberFormat,onChange:e=>t("invoiceNumberFormat",e),bottomLabel:e.resetInvoiceNumberYearly&&!e.invoiceNumberFormat.includes("{year}")?(0,Be.__)("Year placeholder is recommended when yearly reset is enabled.",$e):(0,Be.__)("Available placeholders: {next_number}, {order_number}, {order_date}, {customer_name}, {year}, {month}, {day}, {site_name}, {customer_id}",$e),error:n.yearFormat?(0,Be.__)("ERROR: Year placeholder {year} is required when yearly reset is enabled.",$e):""}),(0,Fe.jsx)(_t,{className:"mt-20",label:(0,Be.__)("Next Invoice Number",$e),tooltip:(0,Be.__)("The next number that will be assigned to a newly generated invoice.",$e),value:e.nextInvoiceNumber,min:1,onChange:e=>t("nextInvoiceNumber",e),bottomLabel:(0,Be.__)("Used to generate invoice numbers sequentially. This will increment automatically after each invoice is created. Changing this will only affect future invoices.",$e),error:n.nextNumber?(0,Be.sprintf)((0,Be.__)("ERROR: Value must be greater than the current next invoice number value - %d.",$e),e.meta?.maxInvoiceNumber||1):""}),(0,Fe.jsx)(pt,{className:"mt-20",label:(0,Be.__)("Reset Invoice Numbers yearly",$e),tooltip:(0,Be.__)("Automatically restart invoice numbering at the beginning of each year.",$e),checked:e.resetInvoiceNumberYearly,onChange:e=>t("resetInvoiceNumberYearly",e)}),e.resetInvoiceNumberYearly&&(0,Fe.jsx)(_t,{className:"mt-20",min:1,label:(0,Be.__)("Starting number for each new year",$e),tooltip:(0,Be.__)("The number assigned to the first invoice of every new year.",$e),value:e.startingNumberForEachYear,onChange:e=>t("startingNumberForEachYear",e)})]}),(0,Fe.jsxs)(st,{title:(0,Be.__)("Document Formatting",$e),children:[(0,Fe.jsx)(wt,{label:(0,Be.__)("Text Direction",$e),tooltip:(0,Be.__)("Set the text direction for all documents. Use RTL for languages like Arabic or Hebrew.",$e),value:e.textDirection,onChange:e=>t("textDirection",e),options:[{label:(0,Be.__)("Left to Right (LTR)",$e),value:"ltr"},{label:(0,Be.__)("Right to Left (RTL)",$e),value:"rtl"}]}),(0,Fe.jsx)(gt,{className:"mt-20",label:(0,Be.__)("PDF Paper Size",$e),tooltip:(0,Be.__)("Paper size used when generating PDF documents.",$e),value:e.pdfPaperSize,onChange:e=>t("pdfPaperSize",e),options:[{label:"A4",value:"A4"},{label:"A3",value:"A3"},{label:"A5",value:"A5"},{label:(0,Be.__)("Letter",$e),value:"letter"},{label:(0,Be.__)("Legal",$e),value:"legal"}]}),(0,Fe.jsx)(pt,{className:"mt-20",label:(0,Be.__)("Use ISO currency code in PDFs",$e),tooltip:(0,Be.__)("Show the ISO currency code (e.g. INR, JPY) instead of the currency symbol in generated PDFs.",$e),bottomLabel:(0,Be.__)("Disable this to show the currency symbol (e.g. ₹, ¥) — only do so if your currency symbol renders correctly in PDFs.",$e),checked:e.pdfUseCurrencyCode,onChange:e=>t("pdfUseCurrencyCode",e)})]}),(0,Fe.jsxs)(st,{title:(0,Be.__)("PDF Handling",$e),children:[(0,Fe.jsx)(pt,{label:(0,Be.__)("Enable PDF generation",$e),tooltip:(0,Be.__)("Allow the plugin to generate PDF versions of documents for download and email attachment.",$e),checked:e.enablePDF,onChange:e=>t("enablePDF",e)}),(0,Fe.jsx)(pt,{className:"mt-20",label:(0,Be.__)("Store generated PDFs",$e),tooltip:(0,Be.__)("Save generated PDFs to your website for faster access.",$e),checked:e.enablePDFStorage,onChange:e=>t("enablePDFStorage",e)}),e.enablePDFStorage&&(0,Fe.jsx)(_t,{className:"mt-20",label:(0,Be.__)("Days to Keep Generated PDFs",$e),tooltip:(0,Be.__)("Number of days for expiration after which generated PDFs will be deleted.",$e),value:e.numberDaysPdfExpiration,onChange:e=>t("numberDaysPdfExpiration",e),bottomLabel:(0,Be.__)("Number of days for expiration after which generated PDFs will be deleted.",$e)})]}),(0,Fe.jsxs)(st,{title:(0,Be.__)("Print Links",$e),children:[(0,Fe.jsx)(pt,{label:(0,Be.__)("Show print link in customer emails",$e),checked:e.showCustomerEmailLink,tooltip:(0,Be.__)("Add a link in order confirmation emails allowing customers to view and print their documents.",$e),onChange:e=>t("showCustomerEmailLink",e)}),e.showCustomerEmailLink&&(0,Fe.jsx)(ht,{className:"mt-10 mb-30",label:(0,Be.__)("Customer Email Link Text",$e),value:e.customerEmailText,onChange:e=>t("customerEmailText",e),tooltip:(0,Be.__)("The text that will appear as the clickable link in customer emails.",$e)}),(0,Fe.jsx)(pt,{className:"mt-20",label:(0,Be.__)("Show print link in admin emails",$e),checked:e.showAdminEmailLink,onChange:e=>t("showAdminEmailLink",e),tooltip:(0,Be.__)("Add a print link in order notification emails sent to store administrators.",$e)}),e.showAdminEmailLink&&(0,Fe.jsx)(ht,{className:"mt-10",label:(0,Be.__)("Admin Email Link Text",$e),value:e.adminEmailText,onChange:e=>t("adminEmailText",e),tooltip:(0,Be.__)("The text that will appear as the clickable link in admin notification emails.",$e)})]}),(0,Fe.jsxs)(st,{title:(0,Be.__)("My Account Print Buttons",$e),children:[(0,Fe.jsx)(pt,{label:(0,Be.__)("Show print button on My Account Page",$e),checked:e.showPrintButtonMyAccountPage,onChange:e=>t("showPrintButtonMyAccountPage",e),tooltip:(0,Be.__)("Display a print button on the My Account page",$e)}),(0,Fe.jsx)(pt,{className:"mt-20",label:(0,Be.__)("Show print button on View Order page",$e),checked:e.showViewOrderButton,onChange:e=>t("showViewOrderButton",e),tooltip:(0,Be.__)("Display a print button on the order details page when viewing a specific order",$e)})]}),(0,Fe.jsxs)(st,{title:(0,Be.__)("Button Label for Templates",$e),children:[(0,Fe.jsx)(ht,{label:(0,Be.__)("Invoice Print Button Label",$e),value:e.invoiceButtonLabel,onChange:e=>t("invoiceButtonLabel",e),tooltip:(0,Be.__)("Label for the invoice print button.",$e)}),(0,Fe.jsx)(ht,{className:"mt-20",label:(0,Be.__)("Delivery Note Print Button Label",$e),value:e.deliveryNoteButtonLabel,onChange:e=>t("deliveryNoteButtonLabel",e),tooltip:(0,Be.__)("Label for the delivery note print button.",$e)}),(0,Fe.jsx)(ht,{className:"mt-20",label:(0,Be.__)("Receipt Print Button Label",$e),value:e.receiptButtonLabel,onChange:e=>t("receiptButtonLabel",e),tooltip:(0,Be.__)("Label for the receipt print button.",$e)}),(0,Fe.jsx)(ht,{className:"mt-20",label:(0,Be.__)("Credit Note Print Button Label",$e),value:e.creditNoteButtonLabel,onChange:e=>t("creditNoteButtonLabel",e),tooltip:(0,Be.__)("Label for the credit note print button.",$e)}),(0,Fe.jsx)(ht,{className:"mt-20",label:(0,Be.__)("Packing Slip Print Button Label",$e),value:e.packingSlipButtonLabel,onChange:e=>t("packingSlipButtonLabel",e),tooltip:(0,Be.__)("Label for the packing slip print button.",$e)})]}),(0,Fe.jsx)(st,{title:(0,Be.__)("Plugin Usage Tracking",$e),children:(0,Fe.jsx)(Ae.Button,{variant:"secondary",className:"wcdn-reset-plugin-usage-button",onClick:()=>a("reset_plugin_usage_tracking"),children:(0,Be.__)("Reset Tracking Settings",$e)})})]})};function Lt({label:e,weight:t,file:n,onUpload:a,onDelete:o,isUploading:s}){const l=(0,Ce.useRef)(null);return(0,Fe.jsxs)("div",{className:"wcdn-font-row",children:[(0,Fe.jsx)("div",{className:"wcdn-font-row__label",children:e}),n?(0,Fe.jsxs)("div",{className:"wcdn-font-row__status wcdn-font-row__status--present",children:[(0,Fe.jsxs)("span",{className:"wcdn-font-row__filename",children:[n.name,(0,Fe.jsxs)("em",{className:"wcdn-font-row__size",children:[" (",(e=>{if(!e)return"";const t=e/1024;return t>=1024?`${(t/1024).toFixed(1)} MB`:`${t.toFixed(0)} KB`})(n.size),")"]})]}),(0,Fe.jsx)(Ae.Button,{variant:"tertiary",isDestructive:!0,onClick:()=>o(t),disabled:s,children:(0,Be.__)("Remove",$e)})]}):(0,Fe.jsxs)("div",{className:"wcdn-font-row__status wcdn-font-row__status--missing",children:[(0,Fe.jsx)("span",{className:"wcdn-font-row__missing",children:(0,Be.__)("No font uploaded",$e)}),(0,Fe.jsxs)(Ae.Button,{variant:"secondary",onClick:()=>l.current?.click(),disabled:s,children:[s?(0,Be.__)("Uploading…",$e):(0,Be.__)("Upload font",$e),s&&(0,Fe.jsx)(Ae.Spinner,{})]}),(0,Fe.jsx)("input",{ref:l,type:"file",accept:".ttf,.otf",style:{display:"none"},onChange:e=>{const n=e.target.files?.[0];n&&a(n,t),e.target.value=""}})]})]})}var Ft=function(){const[e,t]=(0,Ce.useState)(null),[n,a]=(0,Ce.useState)(null);(0,Ce.useEffect)(()=>{let e=!0;return Ve()({path:"/wcdn/v1/fonts"}).then(qe).then(n=>{e&&t(n)}).catch(()=>{e&&et.error((0,Be.__)("Failed to load font status.",$e))}),()=>{e=!1}},[]);const o=async(e,n)=>{a(n);try{const a=await function(e,t="regular"){const n=new FormData;return n.append("font_file",e),n.append("weight",t),Ve()({path:"/wcdn/v1/fonts",method:"POST",body:n}).then(qe)}(e,n);t(a.status),et.success((0,Be.__)("Font uploaded successfully.",$e))}catch(e){et.error(e||(0,Be.__)("Failed to upload font.",$e))}finally{a(null)}},s=async e=>{try{const n=await function(e="regular"){return Ve()({path:`/wcdn/v1/fonts?weight=${e}`,method:"DELETE"}).then(qe)}(e);t(n.status),et.success((0,Be.__)("Font removed.",$e))}catch(e){et.error(e||(0,Be.__)("Failed to remove font.",$e))}};return e?e.needed?(0,Fe.jsx)("div",{className:"wcdn-font-settings",children:(0,Fe.jsxs)(st,{title:(0,Be.__)("Document Fonts",$e),children:[(0,Fe.jsxs)("p",{children:[(0,Be.__)("Your store is currently set to",$e)," ",(0,Fe.jsx)("strong",{children:e.language}),(0,Be.__)(", which requires the",$e)," ",(0,Fe.jsx)("strong",{children:e.display_name})," ",(0,Be.__)("font. Without it, characters may appear as boxes or blank spaces in your printed documents.",$e)]}),(0,Fe.jsxs)("p",{children:[(0,Be.__)("Download the font for free from Google Fonts, then upload both the Regular and Bold versions below.",$e)," ",(0,Fe.jsx)("a",{href:e.google_url,target:"_blank",rel:"noreferrer",children:(0,Be.sprintf)(/* translators: %s: font family name */ /* translators: %s: font family name */
(0,Be.__)("Download %s →",$e),e.display_name)})]}),(0,Fe.jsxs)("div",{className:"wcdn-font-rows",children:[(0,Fe.jsx)(Lt,{label:(0,Be.__)("Regular",$e),weight:"regular",file:e.regular,onUpload:o,onDelete:s,isUploading:"regular"===n}),(0,Fe.jsx)(Lt,{label:(0,Be.__)("Bold",$e),weight:"bold",file:e.bold,onUpload:o,onDelete:s,isUploading:"bold"===n})]})]})}):(0,Fe.jsx)("div",{className:"wcdn-font-settings",children:(0,Fe.jsx)(st,{title:(0,Be.__)("Document Fonts",$e),children:(0,Fe.jsx)("p",{children:(0,Be.__)("Everything looks good! Your store's language is fully supported and PDF documents will be generated correctly without any extra setup.",$e)})})}):(0,Fe.jsx)("div",{className:"wcdn-font-settings",children:(0,Fe.jsx)(Ae.Spinner,{})})},Et=function(){const[e,t]=(0,Ce.useState)(null),[n,a]=(0,Ce.useState)(!1),[o,s]=(0,Ce.useState)(!0),[l,r]=(0,Ce.useState)(!1),[i,c]=(0,Ce.useState)(null),[d,u]=(0,Ce.useState)("store");(0,Ce.useEffect)(()=>{let e=!0;return jt().then(n=>{e&&t(n||null)}).catch(e=>{et.error(e||(0,Be.__)("Failed to load settings data",$e))}).finally(()=>{e&&s(!1)}),()=>{e=!1}},[]);const h=(e,n)=>{t(t=>({...t,[e]:n})),r(!0)},m=async(t="")=>{const o="reset_plugin_usage_tracking"===t;if(o||!n&&!g){a(!0);try{const t=await yt(o?{reset_plugin_usage_tracking:!0}:e);kt(),setTimeout(()=>{a(!1),r(!1),c({status:"success",message:t?.message})},800)}catch(e){c({status:"error",message:e||(o?(0,Be.__)("Failed to reset plugin usage tracking settings.",$e):(0,Be.__)("Failed to save settings.",$e))}),et.error(e),a(!1)}}else g&&et.error((0,Be.__)("Please fix validation errors before saving.",$e))};if(o||!e)return(0,Fe.jsx)(at,{});const p={yearFormat:e.resetInvoiceNumberYearly&&!e.invoiceNumberFormat.includes("{year}"),nextNumber:parseInt(e.nextInvoiceNumber)<(e?.meta?.maxInvoiceNumber||0)},g=p.yearFormat||p.nextNumber;return(0,Fe.jsxs)("div",{className:"wcdn-card-page",children:[(0,Fe.jsx)(Ae.TabPanel,{className:"wcdn-card-tabs",activeClass:"is-active",tabs:[{name:"store",title:(0,Be.__)("Store Settings",$e)},{name:"general",title:(0,Be.__)("General Settings",$e)},{name:"fonts",title:(0,Be.__)("Font Settings",$e)}],onSelect:u,children:t=>(0,Fe.jsxs)(Fe.Fragment,{children:["store"===t.name&&(0,Fe.jsx)(Pt,{settings:e,updateSetting:h}),"general"===t.name&&(0,Fe.jsx)(Tt,{settings:e,updateSetting:h,validation:p,saveSettingsHandler:m}),"fonts"===t.name&&(0,Fe.jsx)(Ft,{})]})}),"fonts"!==d&&(0,Fe.jsx)(dt,{onSave:m,isSaving:n,hasChanges:l&&!g,notice:i,setNotice:c})]})},Dt=function(){return(0,Fe.jsxs)("div",{className:"wcdn-template-skeleton",children:[(0,Fe.jsxs)("div",{className:"wcdn-template-sidebar",children:[(0,Fe.jsxs)("div",{className:"wcdn-skeleton-card",children:[(0,Fe.jsx)("div",{className:"wcdn-skeleton-heading"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-line"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-input"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-line"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-input"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-checkbox"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-checkbox"})]}),(0,Fe.jsxs)("div",{className:"wcdn-skeleton-card",children:[(0,Fe.jsx)("div",{className:"wcdn-skeleton-heading"}),[1,2,3,4].map(e=>(0,Fe.jsxs)("div",{className:"wcdn-skeleton-group",children:[(0,Fe.jsx)("div",{className:"wcdn-skeleton-line short"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-input"})]},e))]})]}),(0,Fe.jsx)("div",{className:"wcdn-template-preview",children:(0,Fe.jsxs)("div",{className:"wcdn-preview-card",children:[(0,Fe.jsx)("div",{className:"wcdn-skeleton-logo"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-title"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-divider"}),(0,Fe.jsxs)("div",{className:"wcdn-skeleton-address-row",children:[(0,Fe.jsx)("div",{className:"wcdn-skeleton-address"}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-address"})]}),(0,Fe.jsx)("div",{className:"wcdn-skeleton-divider"}),(0,Fe.jsxs)("div",{className:"wcdn-skeleton-table",children:[(0,Fe.jsx)("div",{className:"wcdn-skeleton-table-header"}),[1,2,3].map(e=>(0,Fe.jsx)("div",{className:"wcdn-skeleton-table-row"},e))]})]})})]})},Rt=(0,Fe.jsx)(lt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Fe.jsx)(lt.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})}),At=(0,Fe.jsx)(lt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Fe.jsx)(lt.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})}),Bt=function({label:e="",checked:t=!1,disabled:n,onToggle:a={},children:o}){const[s,l]=(0,Ce.useState)(!1),r=(0,Ce.useRef)(null);return(0,Fe.jsxs)("div",{ref:r,className:"wcdn-template-settings-item wcdn-section-item",children:[""!==e&&(0,Fe.jsxs)("div",{className:"wcdn-section-header",children:[(0,Fe.jsx)("div",{className:"wcdn-section-title",children:(0,Fe.jsx)(pt,{label:e,checked:t,onChange:a,disabled:n})}),o&&o.length>0&&(0,Fe.jsxs)("button",{type:"button",className:"wcdn-customize-toggle",onClick:()=>{const e=!s,t=r.current.getBoundingClientRect().top+window.scrollY-120;l(e),!s&&r.current&&setTimeout(()=>{r.current.scrollIntoView({behavior:"smooth",block:"start",top:t})},100)},children:[(0,Be.__)("Customize","woocommerce-delivery-notes"),(0,Fe.jsx)(Ae.Icon,{icon:s?Rt:At})]})]}),t&&o&&s&&(0,Fe.jsx)("div",{className:"wcdn-section-content",children:o}),""===e&&!t&&o]})},It=function({type:e,field:t,label:n,data:a,update:o,options:s=[],min:l=10,max:r=40,bottomLabel:i,disabled:c,className:d="",step:u}){const h=a[t];switch(e){case"text":return(0,Fe.jsx)(ht,{className:d,label:n,value:h,onChange:e=>o(t,e),bottomLabel:i,disabled:c});case"checkbox":return(0,Fe.jsx)(pt,{className:d,label:n,checked:h,onChange:e=>o(t,e),disabled:c,bottomLabel:i});case"select":case"multiselect":return(0,Fe.jsx)(gt,{className:d,label:n,value:h,options:s,onChange:e=>o(t,e),disabled:c,multiple:"multiselect"===e,bottomLabel:i});case"radio":return(0,Fe.jsx)(wt,{className:d,label:n,value:h,options:s,onChange:e=>o(t,e),disabled:c,bottomLabel:i});case"slider":return(0,Fe.jsx)(Ae.RangeControl,{className:d,label:n,value:h,min:l,max:r,step:u,onChange:e=>o(t,e),renderTooltipContent:e=>`${e}px`,disabled:c});case"color":return(0,Fe.jsx)(ft,{className:d,label:n,value:h,onChange:e=>o(t,e),disabled:c});case"textarea":return(0,Fe.jsx)(mt,{className:d,label:n,value:h,onChange:e=>o(t,e),bottomLabel:i,disabled:c});default:return null}},zt=function({data:e,update:t,config:n}){const a=!e.enabled;return n.map(n=>(0,Fe.jsx)(st,{title:n.title,className:"wcdn-template-settings",children:n.items.map(n=>{const o=!n.condition||(void 0!==n.conditionValue?e[n.condition]===n.conditionValue:!!e[n.condition]);if("field"===n.type)return o?(0,Fe.jsx)(It,{...n,type:n.fieldType,data:e,update:t,disabled:"enabled"!==n.field&&a,className:"mt-20"},n.field):null;if("group"===n.type){if(!o)return null;const s=!n.toggle||e[n.toggle];return(0,Fe.jsx)(Bt,{label:n.label,checked:s,onToggle:n.toggle?e=>t(n.toggle,e):void 0,disabled:a,children:n.items.map(n=>{if(n.condition&&!(void 0!==n.conditionValue?e[n.condition]===n.conditionValue:e[n.condition]))return null;let o=a;return!o&&n.disabledWhen&&(o=e[n.disabledWhen.field]===n.disabledWhen.value),(0,Fe.jsx)(It,{...n,type:n.fieldType,data:e,update:t,disabled:o,className:"mt-20"},n.field)})},n.id)}return null})},n.id))},Ht=function({data:e,update:t,config:n}){return(0,Fe.jsx)(zt,{data:e,update:t,config:n})},Wt=function({data:e,update:t,config:n}){return(0,Fe.jsx)(zt,{data:e,update:t,config:n})},Ot=function({data:e,update:t,config:n}){return(0,Fe.jsx)(zt,{data:e,update:t,config:n})},Mt=function({data:e,update:t,config:n}){return(0,Fe.jsx)(zt,{data:e,update:t,config:n})},$t=function({data:e,update:t,config:n}){return(0,Fe.jsx)(zt,{data:e,update:t,config:n})},Ut=function({template:e,data:t,update:n,config:a}){switch(e){case"invoice":return(0,Fe.jsx)(Ht,{data:t,update:n,config:a});case"receipt":return(0,Fe.jsx)(Wt,{data:t,update:n,config:a});case"deliverynote":return(0,Fe.jsx)(Ot,{data:t,update:n,config:a});case"packingslip":return(0,Fe.jsx)(Mt,{data:t,update:n,config:a});case"creditnote":return(0,Fe.jsx)($t,{data:t,update:n,config:a});default:return null}},Vt=window.wp.date;function qt(e=[],t=" · "){return e.filter(Boolean).map((e,n)=>(0,Fe.jsxs)(Ce.Fragment,{children:[n>0&&t,e]},n))}var Yt=function({template:e,settings:t,preview:n}){const a=n?.shop??{},o=n?.order??{},s=n?.document??{},l="creditnote"===e?o?.refund?.items??[]:o?.items??[],r="creditnote"===e?{total:o?.refund?.total}:o?.totals,i=e=>{if(!e)return"";const n=t.dateFormat||window._wpDateSettings?.formats?.date||"Y-m-d";return(0,Vt.dateI18n)(n,new Date(e).getTime())},c=(e,t)=>({textAlign:e[`${t}Align`],fontSize:e[`${t}FontSize`],color:e[`${t}TextColor`],fontWeight:"bold"===e[`${t}FontStyle`]?600:400}),d=t.orderMetaPosition??"columns",u=[{key:"invoiceNumber",show:t.showInvoiceNumber,label:t.invoiceNumberText,value:o.invoiceNumber,style:c(t,"invoiceNumber")},{key:"documentDate",show:t.showDocumentDate,label:t.documentDateText,value:o.documentDate,style:c(t,"documentDate")},{key:"orderNumber",show:t.showOrderNumber,label:t.orderNumberText,value:o.orderNumber,style:c(t,"orderNumber")},{key:"orderDate",show:t.showOrderDate,label:t.orderDateText,value:i(o?.date),style:c(t,"orderDate")},{key:"paymentMethod",show:t.showPaymentMethod,label:t.paymentMethodText,value:o.paymentMethod,style:c(t,"paymentMethod")},{key:"paymentDate",show:t.showPaymentDate,label:t.paymentDateText,value:i(o?.paymentDate),style:c(t,"paymentDate")},{key:"shippingMethod",show:t.showShippingMethod,label:t.shippingMethodText,value:o.shippingMethod,style:c(t,"shippingMethod")},{key:"refundDate",show:t.showRefundDate,label:t.refundDateText,value:i(o?.refund?.date),style:c(t,"refundDate")},{key:"refundReason",show:t.showRefundReason,label:t.refundReasonText,value:o?.refund?.reason,style:c(t,"refundReason")},..."below"===d&&t.showBillingPhone&&o?.billing?.phone?[{key:"billingPhone",show:!0,label:t.billingPhoneText??(0,Be.__)("Phone",$e),value:o.billing.phone,style:{fontSize:`${t.billingPhoneFontSize??14}px`,fontWeight:"bold"===t.billingPhoneFontStyle?600:400,textAlign:t.billingPhoneAlign??"left",color:t.billingPhoneTextColor??"#000000"}}]:[],..."below"===d&&t.showBillingEmail&&o?.billing?.email?[{key:"billingEmail",show:!0,label:t.billingEmailText??(0,Be.__)("Email",$e),value:o.billing.email,style:{fontSize:`${t.billingEmailFontSize??14}px`,fontWeight:"bold"===t.billingEmailFontStyle?600:400,textAlign:t.billingEmailAlign??"left",color:t.billingEmailTextColor??"#000000"}}]:[]],h=u.some(e=>e.show&&e.value);return(0,Fe.jsxs)("div",{className:"wcdn-preview-document mt-30 "+(s.isRTL?"is-rtl":""),children:[t.showWatermark&&t.watermarkText&&("repeat"===t.watermarkLayout?(0,Fe.jsx)("div",{className:"wcdn-preview-watermark-repeat",children:Array.from({length:12}).map((e,n)=>(0,Fe.jsx)("span",{style:{color:t.watermarkColor||"#000",opacity:t.watermarkOpacity??.08,fontSize:t.watermarkFontSize||"120px",transform:`rotate(${t.watermarkAngle||-25}deg)`},children:t.watermarkText},n))}):(0,Fe.jsx)("div",{className:"wcdn-preview-watermark",style:{color:t.watermarkColor||"#000",opacity:t.watermarkOpacity??.08,fontSize:t.watermarkFontSize||"120px",transform:`translate(-50%, -50%) rotate(${t.watermarkAngle||-25}deg)`},children:t.watermarkText})),(0,Fe.jsxs)("div",{style:{transform:`scale(${(t.documentZoom??100)/100})`,transformOrigin:"top left"},children:[t.showLogo&&(0,Fe.jsx)("div",{className:`wcdn-preview-logo align-${t.logoAlignment}`,children:(0,Fe.jsx)("div",{className:"wcdn-preview-logo-box",style:{transform:`scale(${t.logoScale/100})`},children:a.logo?(0,Fe.jsx)("img",{src:a.logo,alt:a.name,style:{transform:`scale(${t.logoScale/100})`}}):(0,Fe.jsx)("div",{className:"wcdn-preview-logo-box",style:{transform:`scale(${t.logoScale/100})`},children:(0,Be.__)("[SHOP LOGO]",$e)})})}),t.showDocumentTitle&&(0,Fe.jsx)("h1",{className:"wcdn-preview-title",style:{fontSize:t.documentTitleFontSize,color:t.documentTitleTextColor,textAlign:t.documentTitleAlign,fontWeight:"bold"===t.documentTitleFontStyle?600:400},children:t.documentTitle}),(t.showShopName||t.showShopAddress||t.showShopPhone||t.showShopEmail)&&(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)("div",{className:"wcdn-preview-divider"}),(0,Fe.jsxs)("div",{className:"wcdn-preview-shop",children:[t.showShopName&&a.name&&(0,Fe.jsx)("div",{className:"shop-name",style:{fontSize:t.shopNameFontSize,color:t.shopNameTextColor,textAlign:t.shopNameAlign,fontWeight:"bold"===t.shopNameFontStyle?600:400},children:a.name}),t.showShopAddress&&a.address&&(0,Fe.jsx)("div",{className:"shop-address",style:{fontSize:t.addressFontSize,color:t.addressTextColor,textAlign:t.addressAlign,fontWeight:"bold"===t.addressFontStyle?600:400},dangerouslySetInnerHTML:{__html:a.address.replace(/\n/g,"<br />")}}),t.showShopPhone&&a.phone&&(0,Fe.jsxs)("div",{className:"shop-phone",style:{fontSize:t.shopPhoneFontSize,color:t.shopPhoneTextColor,fontWeight:"bold"===t.shopPhoneFontStyle?600:400,textAlign:t.shopPhoneAlign,marginTop:t.shopPhoneMarginTop,marginBottom:t.shopPhoneMarginBottom},children:[t.shopPhoneText?`${t.shopPhoneText}: `:"",a.phone]}),t.showShopEmail&&a.email&&(0,Fe.jsxs)("div",{className:"shop-email",style:{fontSize:t.shopEmailFontSize,color:t.shopEmailTextColor,fontWeight:"bold"===t.shopEmailFontStyle?600:400,textAlign:t.shopEmailAlign,marginTop:t.shopEmailMarginTop,marginBottom:t.shopEmailMarginBottom},children:[t.shopEmailText?`${t.shopEmailText}: `:"",a.email]})]})]}),(()=>{const e="below"===d,n=t.showBillingAddress&&o?.billing||t.showShippingAddress&&o?.shipping||!e&&h,a=e&&h;return n||a?(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)("div",{className:"wcdn-preview-divider"}),n&&(0,Fe.jsxs)("div",{className:"wcdn-preview-address-grid",children:[t.showBillingAddress&&o?.billing&&(0,Fe.jsxs)("div",{style:{textAlign:t.billingAddressAlign,fontSize:t.billingAddressFontSize,fontWeight:"bold"===t.billingAddressFontStyle?600:400,color:t.billingAddressTextColor},children:[(0,Fe.jsx)("h4",{children:t.billingAddressText}),(0,Fe.jsxs)("p",{style:{fontSize:t.billingAddressFontSize},children:[o.billing.name,o.billing.address?.map((e,t)=>(0,Fe.jsxs)("span",{children:[(0,Fe.jsx)("br",{}),e]},t))]}),"columns"===d&&t.showBillingPhone&&o.billing.phone&&(0,Fe.jsxs)("div",{style:{fontSize:`${t.billingPhoneFontSize??14}px`,fontWeight:"bold"===t.billingPhoneFontStyle?600:400,textAlign:t.billingPhoneAlign??"left",color:t.billingPhoneTextColor??"#000000"},children:[t.billingPhoneText?`${t.billingPhoneText}: `:"",o.billing.phone]}),"columns"===d&&t.showBillingEmail&&o.billing.email&&(0,Fe.jsxs)("div",{style:{fontSize:`${t.billingEmailFontSize??14}px`,fontWeight:"bold"===t.billingEmailFontStyle?600:400,textAlign:t.billingEmailAlign??"left",color:t.billingEmailTextColor??"#000000"},children:[t.billingEmailText?`${t.billingEmailText}: `:"",o.billing.email]})]}),t.showShippingAddress&&o?.shipping&&(0,Fe.jsxs)("div",{style:{textAlign:t.shippingAddressAlign,fontSize:t.shippingAddressFontSize,fontWeight:"bold"===t.shippingAddressFontStyle?600:400,color:t.shippingAddressTextColor},children:[(0,Fe.jsx)("h4",{children:t.shippingAddressText}),(0,Fe.jsxs)("p",{style:{fontSize:t.shippingAddressFontSize},children:[o.shipping.name,o.shipping.address?.map((e,t)=>(0,Fe.jsxs)("span",{children:[(0,Fe.jsx)("br",{}),e]},t)),o.shipping.email&&(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)("br",{}),(0,Be.__)("Email",$e),": ",o.shipping.email]})]})]}),!e&&h&&(0,Fe.jsx)("div",{className:"wcdn-preview-order-meta",children:qt(u.filter(e=>e.show&&e.value).map(e=>(0,Fe.jsxs)("p",{style:e.style,children:[(0,Fe.jsxs)("span",{children:[e.label,":"]})," ",e.value]},e.key)),"")})]}),a&&t.showOrderDataHeader&&t.orderDataHeaderText&&(0,Fe.jsx)("p",{style:{marginTop:`${t.orderDataHeaderSpacingTop??20}px`,marginBottom:`${t.orderDataHeaderSpacingBottom??5}px`,fontSize:`${t.orderDataHeaderFontSize??17}px`,fontWeight:"bold"===t.orderDataHeaderFontStyle?600:400,textAlign:t.orderDataHeaderAlign??"left",color:t.orderDataHeaderTextColor??"#000000"},children:t.orderDataHeaderText}),a&&t.showOrderDataHeader&&!1!==t.showOrderDataHeaderBorder&&(0,Fe.jsx)("div",{className:"wcdn-preview-divider",style:{margin:"0 0 8px"}}),a&&(0,Fe.jsx)("table",{className:"wcdn-preview-order-meta-below",children:(0,Fe.jsx)("tbody",{children:u.filter(e=>e.show&&e.value).map(e=>(0,Fe.jsxs)("tr",{children:[(0,Fe.jsxs)("td",{className:"label",style:e.style,children:[e.label,":"]}),(0,Fe.jsx)("td",{className:"value",style:e.style,children:e.value})]},e.key))})})]}):null})(),l.length>0&&(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)("div",{className:"wcdn-preview-divider"}),(0,Fe.jsxs)("table",{className:"wcdn-preview-table",children:[(t?.displayPriceInProductDetailsTable||"creditnote"===e&&t?.displayRefundItemsInTable)&&(0,Fe.jsxs)("colgroup",{children:[(0,Fe.jsx)("col",{className:"wcdn-col-product"}),(0,Fe.jsx)("col",{className:"wcdn-col-price"}),(0,Fe.jsx)("col",{className:"wcdn-col-qty"}),(0,Fe.jsx)("col",{className:"wcdn-col-total"})]}),(0,Fe.jsx)("thead",{children:(0,Fe.jsxs)("tr",{children:[(0,Fe.jsx)("th",{children:"creditnote"===e?(0,Be.__)("Refunded Item",$e):(0,Be.__)("Product",$e)}),(t?.displayPriceInProductDetailsTable||"creditnote"===e&&t?.displayRefundItemsInTable)&&(0,Fe.jsx)("th",{children:(0,Be.__)("Price",$e)}),(0,Fe.jsx)("th",{children:(0,Be.__)("Quantity",$e)}),(t?.displayPriceInProductDetailsTable||"creditnote"===e&&t?.displayRefundItemsInTable)&&(0,Fe.jsx)("th",{children:"creditnote"===e?(0,Be.__)("Total Refunded",$e):(0,Be.__)("Total",$e)})]})}),(0,Fe.jsx)("tbody",{children:l.map((n,a)=>(0,Fe.jsxs)("tr",{children:[(0,Fe.jsx)("td",{className:"wcdn-product-cell",children:n.addon?(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)("div",{className:"wcdn-item-addon-name",children:n.addon.name}),(0,Fe.jsx)("div",{className:"wcdn-item-addon-value",children:n.addon.value})]}):(0,Fe.jsxs)("div",{style:t.showProductImages?{display:"flex",alignItems:"flex-start",gap:8}:{},children:[t.showProductImages&&(n.image_url?(0,Fe.jsx)("img",{className:"wcdn-item-image",src:n.image_url,width:t.productImageSize??40,height:t.productImageSize??40,alt:"",style:{flexShrink:0}}):(0,Fe.jsx)("div",{className:"wcdn-item-image-placeholder",style:{width:t.productImageSize??40,height:t.productImageSize??40,flexShrink:0}})),(0,Fe.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,Fe.jsxs)("span",{className:"wcdn-item-name",style:{fontSize:t.productNameFontSize?`${t.productNameFontSize}px`:void 0,fontWeight:"bold"===t.productNameFontStyle?600:400,color:t.productNameTextColor||void 0,paddingTop:null!=t.productNamePadding?`${t.productNamePadding}px`:void 0,paddingBottom:null!=t.productNamePadding?`${t.productNamePadding}px`:void 0,display:"block"},children:[n.name,n.sku&&(0,Fe.jsx)("span",{className:"wcdn-item-sku",children:(0,Be.sprintf)((0,Be.__)("(SKU: %s)",$e),n.sku)})]}),n.meta?.length>0&&(0,Fe.jsx)("dl",{className:"wcdn-item-meta",children:n.meta.map((e,t)=>(0,Fe.jsxs)("span",{children:[(0,Fe.jsx)("dt",{children:e.label}),(0,Fe.jsx)("dd",{children:e.value})]},t))})]})]})}),(t?.displayPriceInProductDetailsTable||"creditnote"===e&&t?.displayRefundItemsInTable)&&(0,Fe.jsx)("td",{dangerouslySetInnerHTML:{__html:n.price}}),(0,Fe.jsx)("td",{children:n.quantity}),(t.displayPriceInProductDetailsTable||"creditnote"===e&&t?.displayRefundItemsInTable)&&(0,Fe.jsx)("td",{dangerouslySetInnerHTML:{__html:n.total}})]},a))})]})]}),void 0!==r?.total&&t.displayPriceInProductDetailsTable&&"creditnote"!==e&&(0,Fe.jsxs)("table",{className:"wcdn-preview-totals",style:{fontSize:t.totalsFontSize},children:[(0,Fe.jsxs)("colgroup",{children:[(0,Fe.jsx)("col",{className:"wcdn-col-product"}),(0,Fe.jsx)("col",{className:"wcdn-col-price"}),(0,Fe.jsx)("col",{className:"wcdn-col-qty"}),(0,Fe.jsx)("col",{className:"wcdn-col-total"})]}),!1!==t.showProductCharges&&!1!==t.showSubtotal&&(0,Fe.jsxs)("tr",{children:[(0,Fe.jsx)("td",{colSpan:3,className:"wcdn-preview-totals-label",children:(0,Be.__)("Subtotal:",$e)}),(0,Fe.jsx)("td",{className:"wcdn-preview-totals-value",dangerouslySetInnerHTML:{__html:r.subtotal}})]}),!1!==t.showProductCharges&&!1!==t.showTax&&(r.tax_lines?.length>0?r.tax_lines.map((e,t)=>(0,Fe.jsxs)("tr",{children:[(0,Fe.jsxs)("td",{colSpan:3,className:"wcdn-preview-totals-label",children:[e.label,":"]}),(0,Fe.jsx)("td",{className:"wcdn-preview-totals-value",dangerouslySetInnerHTML:{__html:e.value}})]},t)):r.tax&&(0,Fe.jsxs)("tr",{children:[(0,Fe.jsx)("td",{colSpan:3,className:"wcdn-preview-totals-label",children:(0,Be.__)("Tax:",$e)}),(0,Fe.jsx)("td",{className:"wcdn-preview-totals-value",dangerouslySetInnerHTML:{__html:r.tax}})]})),!1!==t.showProductCharges&&!1!==t.showShipping&&(0,Fe.jsxs)("tr",{children:[(0,Fe.jsx)("td",{colSpan:3,className:"wcdn-preview-totals-label",children:(0,Be.__)("Shipping:",$e)}),(0,Fe.jsx)("td",{className:"wcdn-preview-totals-value",dangerouslySetInnerHTML:{__html:r.shipping}})]}),r.has_refund?(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsxs)("tr",{children:[(0,Fe.jsx)("td",{colSpan:3,className:"wcdn-preview-totals-label",children:(0,Be.__)("Order Total:",$e)}),(0,Fe.jsx)("td",{className:"wcdn-preview-totals-value",dangerouslySetInnerHTML:{__html:r.total}})]}),(0,Fe.jsxs)("tr",{children:[(0,Fe.jsx)("td",{colSpan:3,className:"wcdn-preview-totals-label",children:(0,Be.__)("Refund:",$e)}),(0,Fe.jsx)("td",{className:"wcdn-preview-totals-value",dangerouslySetInnerHTML:{__html:r.refunded}})]}),(0,Fe.jsxs)("tr",{className:"wcdn-preview-total",children:[(0,Fe.jsx)("td",{colSpan:3,className:"wcdn-preview-totals-label",children:(0,Fe.jsx)("strong",{children:(0,Be.__)("Total:",$e)})}),(0,Fe.jsx)("td",{className:"wcdn-preview-totals-value",children:(0,Fe.jsxs)("strong",{children:[(0,Fe.jsx)("span",{dangerouslySetInnerHTML:{__html:r.net_total}}),r.tax_label&&(0,Fe.jsx)("span",{dangerouslySetInnerHTML:{__html:r.tax_label}})]})})]})]}):(0,Fe.jsxs)("tr",{className:"wcdn-preview-total",children:[(0,Fe.jsx)("td",{colSpan:3,className:"wcdn-preview-totals-label",children:(0,Fe.jsx)("strong",{children:(0,Be.__)("Total:",$e)})}),(0,Fe.jsx)("td",{className:"wcdn-preview-totals-value",dangerouslySetInnerHTML:{__html:r.total}})]})]}),t.showPayNowButton&&r?.total&&(0,Fe.jsx)("div",{className:"wcdn-preview-pay",children:(0,Fe.jsxs)("button",{style:{background:t.payNowColor},children:[t.payNowLabel," —"," ",(0,Fe.jsx)("span",{dangerouslySetInnerHTML:{__html:r.total}})]})}),t.showCustomerNote&&(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)("div",{className:"wcdn-preview-divider"}),(0,Fe.jsxs)("div",{className:"wcdn-preview-policies",children:[(0,Fe.jsxs)("span",{style:{fontSize:t.customerNoteFontSize,color:t.customerNoteTextColor,fontWeight:600},children:[t.customerNoteTitle,":"]})," ",(0,Fe.jsx)("span",{style:{fontSize:t.customerNoteFontSize,color:t.customerNoteTextColor,fontWeight:"bold"===t.customerNoteFontStyle?600:400},children:(0,Be.__)("Sample Customer Note",$e)})]})]}),t.showPolicies&&s.policies&&(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)("div",{className:"wcdn-preview-divider"}),(0,Fe.jsx)("div",{className:"wcdn-preview-policies",style:{fontSize:t.policiesFontSize,color:t.policiesTextColor,fontWeight:"bold"===t.policiesFontStyle?600:400,textAlign:t.policiesAlign},dangerouslySetInnerHTML:{__html:s.policies?.replace(/\n/g,"<br />")}})]}),t.showComplimentaryClose&&s.complimentaryClose&&(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)("div",{className:"wcdn-preview-divider"}),(0,Fe.jsx)("div",{className:"wcdn-preview-business",style:{fontSize:t.complimentaryCloseFontSize,color:t.complimentaryCloseTextColor,fontWeight:"bold"===t.complimentaryCloseFontStyle?600:400,textAlign:t.complimentaryCloseAlign},dangerouslySetInnerHTML:{__html:s.complimentaryClose?.replace(/\n/g,"<br />")}})]}),t.showFooter&&s.footer&&(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)("div",{className:"wcdn-preview-divider"}),(0,Fe.jsx)("div",{className:"wcdn-preview-footer",style:{fontSize:t.footerFontSize,color:t.footerTextColor,fontWeight:"bold"===t.footerFontStyle?600:400,textAlign:t.footerAlign},dangerouslySetInnerHTML:{__html:s.footer?.replace(/\n/g,"<br />")}})]})]})]})},Gt=function({template:e,settings:t,preview:n}){return(0,Fe.jsx)(Yt,{template:e,settings:t,preview:n})},Jt=function({template:e,settings:t,preview:n}){return(0,Fe.jsx)(Yt,{template:e,settings:t,preview:n})},Kt=function({template:e,settings:t,preview:n}){return(0,Fe.jsx)(Yt,{template:e,settings:t,preview:n})},Qt=function({template:e,settings:t,preview:n}){return(0,Fe.jsx)(Yt,{template:e,settings:t,preview:n})},Zt=function({template:e,settings:t,preview:n}){return(0,Fe.jsx)(Yt,{template:e,settings:t,preview:n})};const Xt={A4:{width:794,height:1123},A3:{width:1123,height:1587},A5:{width:559,height:794},letter:{width:816,height:1056},legal:{width:816,height:1344}};var en=function({template:e,settings:t,preview:n,pdfPaperSize:a}){const o=Xt[a]??Xt.A4,s=(0,Ce.useRef)(null),[l,r]=(0,Ce.useState)(1);return(0,Ce.useEffect)(()=>{function e(){if(!s.current)return;const e=s.current.offsetWidth;r(Math.min(e/o.width,1))}return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[o.width]),(0,Fe.jsx)("div",{ref:s,className:"wcdn-preview-wrapper",style:{minHeight:o.height*l},children:(0,Fe.jsxs)("div",{className:"wcdn-preview-canvas",style:{width:o.width,minHeight:o.height,transform:`scale(${l})`,transformOrigin:"left top"},children:["invoice"===e&&(0,Fe.jsx)(Gt,{template:e,settings:t,preview:n}),"receipt"===e&&(0,Fe.jsx)(Jt,{template:e,settings:t,preview:n}),"deliverynote"===e&&(0,Fe.jsx)(Kt,{template:e,settings:t,preview:n}),"packingslip"===e&&(0,Fe.jsx)(Qt,{template:e,settings:t,preview:n}),"creditnote"===e&&(0,Fe.jsx)(Zt,{template:e,settings:t,preview:n})]})})};const tn={invoice:(0,Be.__)("Invoice",$e),receipt:(0,Be.__)("Receipt",$e),deliverynote:(0,Be.__)("Delivery Note",$e),packingslip:(0,Be.__)("Packing Slip",$e),creditnote:(0,Be.__)("Credit Note",$e)};var nn=function(){const[e,t]=(0,Ce.useState)(null),[n,a]=(0,Ce.useState)(null),[o,s]=(0,Ce.useState)(null),[l,r]=(0,Ce.useState)("A4"),[i,c]=(0,Ce.useState)("invoice"),[d,u]=(0,Ce.useState)(!1),[h,m]=(0,Ce.useState)(!0),[p,g]=(0,Ce.useState)(!1),[v,x]=(0,Ce.useState)(null),w=null!==e?e[i]:{};(0,Ce.useEffect)(()=>{e||St().then(e=>{t(e.templates),a(e.preview),s(e.config),r(e.pdfPaperSize??"A4")}).catch(()=>{et.error((0,Be.__)("Failed to load templates.",$e))}).finally(()=>{m(!1)})},[]);const f=(e,n)=>{t(t=>({...t,[i]:{...t[i],[e]:n}})),g(!0)};return h||!e?(0,Fe.jsx)(Dt,{}):(0,Fe.jsxs)("div",{className:"wcdn-card-page",children:[(0,Fe.jsx)(Ae.TabPanel,{className:"wcdn-card-tabs",activeClass:"is-active",tabs:[{name:"invoice",title:(0,Be.__)("Invoice",$e)},{name:"receipt",title:(0,Be.__)("Receipt",$e)},{name:"deliverynote",title:(0,Be.__)("Delivery Note",$e)},{name:"creditnote",title:(0,Be.__)("Credit Note",$e)},{name:"packingslip",title:(0,Be.__)("Packing Slip",$e)}],children:e=>(setTimeout(()=>c(e.name),0),(0,Fe.jsxs)("div",{className:"wcdn-templates-layout",children:[(0,Fe.jsx)("div",{className:"wcdn-templates-left",children:(0,Fe.jsx)(Ut,{template:i,data:w,update:f,config:o[i]})}),(0,Fe.jsx)("div",{className:"wcdn-templates-right",children:(0,Fe.jsx)(en,{template:i,settings:w,preview:n,pdfPaperSize:l})})]}))}),(0,Fe.jsx)(dt,{onSave:async()=>{const n=tn[i],a=!!w?.applyZoomToAll;u(!0);try{const o=await Ct({template:i,data:e[i]});a&&o.allTemplates?t(o.allTemplates):o.template&&t(e=>({...e,[i]:o.template})),g(!1),x({status:"success",message:a?(0,Be.__)("Zoom settings applied to all templates.",$e):(0,Be.sprintf)((0,Be.__)("%s template saved successfully.",$e),n)})}catch{et.error((0,Be.sprintf)((0,Be.__)("Failed to save %s template.",$e),n))}u(!1)},isSaving:d,hasChanges:p,notice:v,setNotice:x})]})};const an=()=>(0,Fe.jsxs)(ue,{children:[(0,Fe.jsx)(ce,{path:"/",element:(0,Fe.jsx)(tt,{})}),(0,Fe.jsx)(ce,{path:"/faqs",element:(0,Fe.jsx)(nt,{})}),(0,Fe.jsx)(ce,{path:"/settings",element:(0,Fe.jsx)(Et,{})}),(0,Fe.jsx)(ce,{path:"/templates",element:(0,Fe.jsx)(nn,{})})]});(0,ke.dispatch)(Pe.store).addEntities([{kind:"wcdn",name:"settings",baseURL:"/wp/v2/wcdn/settings"},{kind:"wcdn",name:"logs",baseURL:"/wp/v2/wcdn/logs"},{kind:"wcdn",name:"reports",baseURL:"/wp/v2/wcdn/reports"}]);var on=function(){const{isDataLoaded:e}=De();return(0,Fe.jsx)(Fe.Fragment,{children:e&&(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)(Ie,{}),(0,Fe.jsx)(Ae.__experimentalVStack,{className:"wcdn-page",children:(0,Fe.jsx)(an,{})}),(0,Fe.jsx)(Oe,{}),(0,Fe.jsx)(Me,{}),(0,Fe.jsx)(He,{})]})})};window.addEventListener("load",function(){const e=document.querySelector("div#woocommerce-delivery-notes");e&&(0,o.H)(e).render((0,Fe.jsx)(Re,{children:(0,Fe.jsx)(fe,{children:(0,Fe.jsx)(on,{})})}))},!1)}();