const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Login-BDOaCNiK.js","assets/vendor-ChGFRQAq.js","assets/ui-wfmc48pO.js","assets/pdf-DdgWE7Gk.js","assets/CustomerDashboard-C1RMRyoa.js","assets/PageHeader-D_F085dh.js","assets/StatCard-CgmwCM64.js","assets/ModernTable-DaMc_sWT.js","assets/SupplierDashboard-CnDs_wwe.js","assets/jspdf.plugin.autotable--NsDeQP_.js","assets/SlidingTabs-B8YRTrwv.js","assets/QuotationDashboard-wiq5sRLQ.js","assets/AdminDashboard-CgKSWZ_u.js","assets/Administration-BGpriKLU.js","assets/SSTManagement-DrE4YGhY.js","assets/OrderManagement-BoDgHy0_.js","assets/ProductionTracking-9vZPqUqC.js","assets/ProductionStepManager-448RYEt4.js","assets/QualityControl-ppDYkB1W.js","assets/Accounting-BlvRAVtY.js","assets/ChartOfAccounts-Ba4JFHHD.js","assets/Analytics-DcYwfgB9.js","assets/NewOrder-Dgm3_ijs.js","assets/OrderForm-DqNVsXXj.js","assets/AddCommissionPersonModal-C7CHECcP.js","assets/AddEditCustomerModal-CvC0Ih86.js","assets/react-barcode-NDIZ92Xv.js","assets/ImpositionVisualizer-UO6iznHJ.js","assets/RequestQuote-tFracgGI.js","assets/BiometricAttendance-Ddq3PwB2.js","assets/AttendanceReports-g_KV1zws.js","assets/PayrollHR-BED5ieJF.js","assets/overtimeUtils-Cq3bSoGL.js","assets/Commission-BWUXbwRk.js","assets/PartnersManagement-BjCKNANv.js","assets/LayoutPlanner-D6dC07CY.js","assets/MaterialsLibrary-B_W3pbim.js","assets/MaterialDetailModal-BxBQye4y.js","assets/PrintingSection-7ZZ8XjNJ.js","assets/AddEditPaperModal-BnHsOrYm.js","assets/AddEditFinishingModal-Cv7hCBqO.js","assets/AddEditPrintingModal-CAenaEAB.js","assets/SaasLandingPage-Bv1SXtoX.js","assets/SaasFeaturesPage-DqV7lB0Z.js","assets/CompanyLandingPage-BA1jXYwH.js","assets/Integrations-Dxhl4vS9.js","assets/Inventory-CdApuqqG.js","assets/excelUtils-Qlyr40P6.js","assets/PipelineMonitor-B08p7bC6.js","assets/JobStatusBoard-Dae5iV4Z.js","assets/QuotesList-BCTAv9hX.js","assets/ComplexOrderForm-Ck1M8gWr.js","assets/InvoicesList-yaMhsQSq.js","assets/MonthlySalesAnalysis-C28WCWaL.js","assets/ScanGateway-BlYzU2U_.js","assets/PurchaseOrders-D4QARm_V.js","assets/JobCostingReport-_JYIVvaL.js","assets/MachineScheduling-5b2NjZ3D.js","assets/ExecutiveDashboard-CCj1roxY.js","assets/DispatchManager-Df_64ntD.js","assets/MachineMaintenance-D_XwKL5c.js","assets/DeliveryRoute-B6YyfM-c.js","assets/utils-CRoqAWlT.js","assets/FloatingChat-1_ZHGKq6.js"])))=>i.map(i=>d[i]);
var Zm=Object.defineProperty;var Ia=t=>{throw TypeError(t)};var ef=(t,e,n)=>e in t?Zm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ra=(t,e,n)=>ef(t,typeof e!="symbol"?e+"":e,n),Ks=(t,e,n)=>e.has(t)||Ia("Cannot "+n);var D=(t,e,n)=>(Ks(t,e,"read from private field"),n?n.call(t):e.get(t)),oe=(t,e,n)=>e.has(t)?Ia("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Y=(t,e,n,i)=>(Ks(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),_e=(t,e,n)=>(Ks(t,e,"access private method"),n);var To=(t,e,n,i)=>({set _(o){Y(t,e,o,n)},get _(){return D(t,e,i)}});import{r as b,a as Qu,R as ue,u as ds,N as zo,t as Ma,b as ji,d as tf,L as Va,H as nf,e as La,f as me}from"./vendor-ChGFRQAq.js";import{a as he}from"./pdf-DdgWE7Gk.js";import{C as ea,A as Fi,b as of,I as sf,X as en,P as qo,c as Js,d as Ws,M as rf,S as Xu,e as zs,f as Zu,g as af,h as Oa,i as ja,j as lf,k as cf,L as ta,l as Yn,F as Ft,U as ed,B as td,m as Qn,H as uf,D as na,T as df,R as Yo,n as nd,o as pf,Q as id,p as Lt,q as Wt,r as eo,s as Uo,t as to,E as $o,u as Fa,v as Bo,w as xi,x as Ot,y as ar,W as lr,z as cr,G as ur,J as dr,K as Si,N as od,O as mf,V as qa,Y as uo,Z as po,$ as sd,a0 as rd,a1 as no,a2 as ff,a3 as hf,a4 as gf,a5 as ia,a6 as Ao,a7 as yf,a8 as ad,a9 as vf,aa as bf,ab as _f,ac as Nf,ad as xf,ae as Sf,af as Ef,ag as wf,ah as Cf,ai as Df,aj as Ua}from"./ui-wfmc48pO.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const r of s.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();var ld={exports:{}},pr={};/**
 * @license React
 * react-jsx-dev-runtime.development.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(){var t=b,e=Symbol.for("react.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),r=Symbol.for("react.provider"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),y=Symbol.iterator,_="@@iterator";function v(S){if(S===null||typeof S!="object")return null;var V=y&&S[y]||S[_];return typeof V=="function"?V:null}var x=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(S){{for(var V=arguments.length,N=new Array(V>1?V-1:0),M=1;M<V;M++)N[M-1]=arguments[M];w("error",S,N)}}function w(S,V,N){{var M=x.ReactDebugCurrentFrame,B=M.getStackAddendum();B!==""&&(V+="%s",N=N.concat([B]));var W=N.map(function(Z){return String(Z)});W.unshift("Warning: "+V),Function.prototype.apply.call(console[S],console,W)}}var C=!1,P=!1,k=!1,I=!1,j=!1,A;A=Symbol.for("react.module.reference");function R(S){return!!(typeof S=="string"||typeof S=="function"||S===i||S===s||j||S===o||S===d||S===p||I||S===g||C||P||k||typeof S=="object"&&S!==null&&(S.$$typeof===h||S.$$typeof===f||S.$$typeof===r||S.$$typeof===a||S.$$typeof===c||S.$$typeof===A||S.getModuleId!==void 0))}function q(S,V,N){var M=S.displayName;if(M)return M;var B=V.displayName||V.name||"";return B!==""?N+"("+B+")":N}function G(S){return S.displayName||"Context"}function L(S){if(S==null)return null;if(typeof S.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof S=="function")return S.displayName||S.name||null;if(typeof S=="string")return S;switch(S){case i:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case d:return"Suspense";case p:return"SuspenseList"}if(typeof S=="object")switch(S.$$typeof){case a:var V=S;return G(V)+".Consumer";case r:var N=S;return G(N._context)+".Provider";case c:return q(S,S.render,"ForwardRef");case f:var M=S.displayName||null;return M!==null?M:L(S.type)||"Memo";case h:{var B=S,W=B._payload,Z=B._init;try{return L(Z(W))}catch{return null}}}return null}var F=Object.assign,T=0,$,Q,X,te,J,O,U;function H(){}H.__reactDisabledLog=!0;function re(){{if(T===0){$=console.log,Q=console.info,X=console.warn,te=console.error,J=console.group,O=console.groupCollapsed,U=console.groupEnd;var S={configurable:!0,enumerable:!0,value:H,writable:!0};Object.defineProperties(console,{info:S,log:S,warn:S,error:S,group:S,groupCollapsed:S,groupEnd:S})}T++}}function de(){{if(T--,T===0){var S={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},S,{value:$}),info:F({},S,{value:Q}),warn:F({},S,{value:X}),error:F({},S,{value:te}),group:F({},S,{value:J}),groupCollapsed:F({},S,{value:O}),groupEnd:F({},S,{value:U})})}T<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var le=x.ReactCurrentDispatcher,fe;function De(S,V,N){{if(fe===void 0)try{throw Error()}catch(B){var M=B.stack.trim().match(/\n( *(at )?)/);fe=M&&M[1]||""}return`
`+fe+S}}var K=!1,ae;{var ve=typeof WeakMap=="function"?WeakMap:Map;ae=new ve}function Ie(S,V){if(!S||K)return"";{var N=ae.get(S);if(N!==void 0)return N}var M;K=!0;var B=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var W;W=le.current,le.current=null,re();try{if(V){var Z=function(){throw Error()};if(Object.defineProperty(Z.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Z,[])}catch(Me){M=Me}Reflect.construct(S,[],Z)}else{try{Z.call()}catch(Me){M=Me}S.call(Z.prototype)}}else{try{throw Error()}catch(Me){M=Me}S()}}catch(Me){if(Me&&M&&typeof Me.stack=="string"){for(var ee=Me.stack.split(`
`),se=M.stack.split(`
`),ne=ee.length-1,be=se.length-1;ne>=1&&be>=0&&ee[ne]!==se[be];)be--;for(;ne>=1&&be>=0;ne--,be--)if(ee[ne]!==se[be]){if(ne!==1||be!==1)do if(ne--,be--,be<0||ee[ne]!==se[be]){var xe=`
`+ee[ne].replace(" at new "," at ");return S.displayName&&xe.includes("<anonymous>")&&(xe=xe.replace("<anonymous>",S.displayName)),typeof S=="function"&&ae.set(S,xe),xe}while(ne>=1&&be>=0);break}}}finally{K=!1,le.current=W,de(),Error.prepareStackTrace=B}var Te=S?S.displayName||S.name:"",Ve=Te?De(Te):"";return typeof S=="function"&&ae.set(S,Ve),Ve}function it(S,V,N){return Ie(S,!1)}function Gt(S){var V=S.prototype;return!!(V&&V.isReactComponent)}function qe(S,V,N){if(S==null)return"";if(typeof S=="function")return Ie(S,Gt(S));if(typeof S=="string")return De(S);switch(S){case d:return De("Suspense");case p:return De("SuspenseList")}if(typeof S=="object")switch(S.$$typeof){case c:return it(S.render);case f:return qe(S.type,V,N);case h:{var M=S,B=M._payload,W=M._init;try{return qe(W(B),V,N)}catch{}}}return""}var Ue=Object.prototype.hasOwnProperty,ot={},ht=x.ReactDebugCurrentFrame;function Oe(S){if(S){var V=S._owner,N=qe(S.type,S._source,V?V.type:null);ht.setExtraStackFrame(N)}else ht.setExtraStackFrame(null)}function gt(S,V,N,M,B){{var W=Function.call.bind(Ue);for(var Z in S)if(W(S,Z)){var ee=void 0;try{if(typeof S[Z]!="function"){var se=Error((M||"React class")+": "+N+" type `"+Z+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof S[Z]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw se.name="Invariant Violation",se}ee=S[Z](V,Z,M,N,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ne){ee=ne}ee&&!(ee instanceof Error)&&(Oe(B),E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",M||"React class",N,Z,typeof ee),Oe(null)),ee instanceof Error&&!(ee.message in ot)&&(ot[ee.message]=!0,Oe(B),E("Failed %s type: %s",N,ee.message),Oe(null))}}}var an=Array.isArray;function Be(S){return an(S)}function at(S){{var V=typeof Symbol=="function"&&Symbol.toStringTag,N=V&&S[Symbol.toStringTag]||S.constructor.name||"Object";return N}}function ke(S){try{return Ct(S),!1}catch{return!0}}function Ct(S){return""+S}function Dt(S){if(ke(S))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",at(S)),Ct(S)}var st=x.ReactCurrentOwner,ln={key:!0,ref:!0,__self:!0,__source:!0},Tt,At,ie;ie={};function Pe(S){if(Ue.call(S,"ref")){var V=Object.getOwnPropertyDescriptor(S,"ref").get;if(V&&V.isReactWarning)return!1}return S.ref!==void 0}function li(S){if(Ue.call(S,"key")){var V=Object.getOwnPropertyDescriptor(S,"key").get;if(V&&V.isReactWarning)return!1}return S.key!==void 0}function ci(S,V){if(typeof S.ref=="string"&&st.current&&V&&st.current.stateNode!==V){var N=L(st.current.type);ie[N]||(E('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',L(st.current.type),S.ref),ie[N]=!0)}}function ui(S,V){{var N=function(){Tt||(Tt=!0,E("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",V))};N.isReactWarning=!0,Object.defineProperty(S,"key",{get:N,configurable:!0})}}function di(S,V){{var N=function(){At||(At=!0,E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",V))};N.isReactWarning=!0,Object.defineProperty(S,"ref",{get:N,configurable:!0})}}var pi=function(S,V,N,M,B,W,Z){var ee={$$typeof:e,type:S,key:V,ref:N,props:Z,_owner:W};return ee._store={},Object.defineProperty(ee._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ee,"_self",{configurable:!1,enumerable:!1,writable:!1,value:M}),Object.defineProperty(ee,"_source",{configurable:!1,enumerable:!1,writable:!1,value:B}),Object.freeze&&(Object.freeze(ee.props),Object.freeze(ee)),ee};function cn(S,V,N,M,B){{var W,Z={},ee=null,se=null;N!==void 0&&(Dt(N),ee=""+N),li(V)&&(Dt(V.key),ee=""+V.key),Pe(V)&&(se=V.ref,ci(V,B));for(W in V)Ue.call(V,W)&&!ln.hasOwnProperty(W)&&(Z[W]=V[W]);if(S&&S.defaultProps){var ne=S.defaultProps;for(W in ne)Z[W]===void 0&&(Z[W]=ne[W])}if(ee||se){var be=typeof S=="function"?S.displayName||S.name||"Unknown":S;ee&&ui(Z,be),se&&di(Z,be)}return pi(S,ee,se,B,M,st.current,Z)}}var Ht=x.ReactCurrentOwner,lt=x.ReactDebugCurrentFrame;function rt(S){if(S){var V=S._owner,N=qe(S.type,S._source,V?V.type:null);lt.setExtraStackFrame(N)}else lt.setExtraStackFrame(null)}var kt;kt=!1;function Kt(S){return typeof S=="object"&&S!==null&&S.$$typeof===e}function Tn(){{if(Ht.current){var S=L(Ht.current.type);if(S)return`

Check the render method of \``+S+"`."}return""}}function An(S){{if(S!==void 0){var V=S.fileName.replace(/^.*[\\\/]/,""),N=S.lineNumber;return`

Check your code at `+V+":"+N+"."}return""}}var kn={};function Pn(S){{var V=Tn();if(!V){var N=typeof S=="string"?S:S.displayName||S.name;N&&(V=`

Check the top-level render call using <`+N+">.")}return V}}function un(S,V){{if(!S._store||S._store.validated||S.key!=null)return;S._store.validated=!0;var N=Pn(V);if(kn[N])return;kn[N]=!0;var M="";S&&S._owner&&S._owner!==Ht.current&&(M=" It was passed a child from "+L(S._owner.type)+"."),rt(S),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',N,M),rt(null)}}function In(S,V){{if(typeof S!="object")return;if(Be(S))for(var N=0;N<S.length;N++){var M=S[N];Kt(M)&&un(M,V)}else if(Kt(S))S._store&&(S._store.validated=!0);else if(S){var B=v(S);if(typeof B=="function"&&B!==S.entries)for(var W=B.call(S),Z;!(Z=W.next()).done;)Kt(Z.value)&&un(Z.value,V)}}}function mi(S){{var V=S.type;if(V==null||typeof V=="string")return;var N;if(typeof V=="function")N=V.propTypes;else if(typeof V=="object"&&(V.$$typeof===c||V.$$typeof===f))N=V.propTypes;else return;if(N){var M=L(V);gt(N,S.props,"prop",M,S)}else if(V.PropTypes!==void 0&&!kt){kt=!0;var B=L(V);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",B||"Unknown")}typeof V.getDefaultProps=="function"&&!V.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Rn(S){{for(var V=Object.keys(S.props),N=0;N<V.length;N++){var M=V[N];if(M!=="children"&&M!=="key"){rt(S),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",M),rt(null);break}}S.ref!==null&&(rt(S),E("Invalid attribute `ref` supplied to `React.Fragment`."),rt(null))}}var dn={};function fi(S,V,N,M,B,W){{var Z=R(S);if(!Z){var ee="";(S===void 0||typeof S=="object"&&S!==null&&Object.keys(S).length===0)&&(ee+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var se=An(B);se?ee+=se:ee+=Tn();var ne;S===null?ne="null":Be(S)?ne="array":S!==void 0&&S.$$typeof===e?(ne="<"+(L(S.type)||"Unknown")+" />",ee=" Did you accidentally export a JSX literal instead of a component?"):ne=typeof S,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ne,ee)}var be=cn(S,V,N,B,W);if(be==null)return be;if(Z){var xe=V.children;if(xe!==void 0)if(M)if(Be(xe)){for(var Te=0;Te<xe.length;Te++)In(xe[Te],S);Object.freeze&&Object.freeze(xe)}else E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else In(xe,S)}if(Ue.call(V,"key")){var Ve=L(S),Me=Object.keys(V).filter(function(Gi){return Gi!=="key"}),yt=Me.length>0?"{key: someKey, "+Me.join(": ..., ")+": ...}":"{key: someKey}";if(!dn[Ve+yt]){var Ge=Me.length>0?"{"+Me.join(": ..., ")+": ...}":"{}";E(`A props object containing a "key" prop is being spread into JSX:
  let props = %s;
  <%s {...props} />
React keys must be passed directly to JSX without using spread:
  let props = %s;
  <%s key={someKey} {...props} />`,yt,Ve,Ge,Ve),dn[Ve+yt]=!0}}return S===i?Rn(be):mi(be),be}}var Bi=fi;pr.Fragment=i,pr.jsxDEV=Bi})();ld.exports=pr;var m=ld.exports,cd,$a=Qu;{var Ba=$a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;cd=function(t,e){Ba.usingClientEntryPoint=!0;try{return $a.createRoot(t,e)}finally{Ba.usingClientEntryPoint=!1}}}var So=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Tf={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},It,qn,Uu,Af=(Uu=class{constructor(){oe(this,It,Tf);oe(this,qn,!1)}setTimeoutProvider(t){D(this,qn)&&t!==D(this,It)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:D(this,It),provider:t}),Y(this,It,t),Y(this,qn,!1)}setTimeout(t,e){return Y(this,qn,!0),D(this,It).setTimeout(t,e)}clearTimeout(t){D(this,It).clearTimeout(t)}setInterval(t,e){return Y(this,qn,!0),D(this,It).setInterval(t,e)}clearInterval(t){D(this,It).clearInterval(t)}},It=new WeakMap,qn=new WeakMap,Uu),jn=new Af;function kf(t){setTimeout(t,0)}var Xn=typeof window>"u"||"Deno"in globalThis;function Ze(){}function Pf(t,e){return typeof t=="function"?t(e):t}function mr(t){return typeof t=="number"&&t>=0&&t!==1/0}function ud(t,e){return Math.max(t+(e||0)-Date.now(),0)}function En(t,e){return typeof t=="function"?t(e):t}function dt(t,e){return typeof t=="function"?t(e):t}function Ga(t,e){const{type:n="all",exact:i,fetchStatus:o,predicate:s,queryKey:r,stale:a}=t;if(r){if(i){if(e.queryHash!==oa(r,e.options))return!1}else if(!fo(e.queryKey,r))return!1}if(n!=="all"){const c=e.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||o&&o!==e.state.fetchStatus||s&&!s(e))}function Ha(t,e){const{exact:n,status:i,predicate:o,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(mo(e.options.mutationKey)!==mo(s))return!1}else if(!fo(e.options.mutationKey,s))return!1}return!(i&&e.state.status!==i||o&&!o(e))}function oa(t,e){return((e==null?void 0:e.queryKeyHashFn)||mo)(t)}function mo(t){return JSON.stringify(t,(e,n)=>gr(n)?Object.keys(n).sort().reduce((i,o)=>(i[o]=n[o],i),{}):n)}function fo(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>fo(t[n],e[n])):!1}var If=Object.prototype.hasOwnProperty;function fr(t,e,n=0){if(t===e)return t;if(n>500)return e;const i=Ka(t)&&Ka(e);if(!i&&!(gr(t)&&gr(e)))return e;const s=(i?t:Object.keys(t)).length,r=i?e:Object.keys(e),a=r.length,c=i?new Array(a):{};let d=0;for(let p=0;p<a;p++){const f=i?p:r[p],h=t[f],g=e[f];if(h===g){c[f]=h,(i?p<s:If.call(t,f))&&d++;continue}if(h===null||g===null||typeof h!="object"||typeof g!="object"){c[f]=g;continue}const y=fr(h,g,n+1);c[f]=y,y===h&&d++}return s===a&&d===s?t:c}function hr(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function Ka(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function gr(t){if(!Ja(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!Ja(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function Ja(t){return Object.prototype.toString.call(t)==="[object Object]"}function Rf(t){return new Promise(e=>{jn.setTimeout(e,t)})}function yr(t,e,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(t,e);if(n.structuralSharing!==!1){try{return fr(t,e)}catch(i){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${i}`),i}return fr(t,e)}return e}function Mf(t,e,n=0){const i=[...t,e];return n&&i.length>n?i.slice(1):i}function Vf(t,e,n=0){const i=[e,...t];return n&&i.length>n?i.slice(0,-1):i}var Qo=Symbol();function dd(t,e){return t.queryFn===Qo&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`),!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Qo?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function pd(t,e){return typeof t=="function"?t(...e):!!t}function Lf(t,e,n){let i=!1,o;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(o??(o=e()),i||(i=!0,o.aborted?n():o.addEventListener("abort",n,{once:!0})),o)}),t}var Un,hn,Ci,$u,Of=($u=class extends So{constructor(){super();oe(this,Un);oe(this,hn);oe(this,Ci);Y(this,Ci,e=>{if(!Xn&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){D(this,hn)||this.setEventListener(D(this,Ci))}onUnsubscribe(){var e;this.hasListeners()||((e=D(this,hn))==null||e.call(this),Y(this,hn,void 0))}setEventListener(e){var n;Y(this,Ci,e),(n=D(this,hn))==null||n.call(this),Y(this,hn,e(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(e){D(this,Un)!==e&&(Y(this,Un,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof D(this,Un)=="boolean"?D(this,Un):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Un=new WeakMap,hn=new WeakMap,Ci=new WeakMap,$u),sa=new Of;function vr(){let t,e;const n=new Promise((o,s)=>{t=o,e=s});n.status="pending",n.catch(()=>{});function i(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{i({status:"fulfilled",value:o}),t(o)},n.reject=o=>{i({status:"rejected",reason:o}),e(o)},n}var jf=kf;function Ff(){let t=[],e=0,n=a=>{a()},i=a=>{a()},o=jf;const s=a=>{e?t.push(a):o(()=>{n(a)})},r=()=>{const a=t;t=[],a.length&&o(()=>{i(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;e++;try{c=a()}finally{e--,e||r()}return c},batchCalls:a=>(...c)=>{s(()=>{a(...c)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{i=a},setScheduler:a=>{o=a}}}var $e=Ff(),Di,gn,Ti,Bu,qf=(Bu=class extends So{constructor(){super();oe(this,Di,!0);oe(this,gn);oe(this,Ti);Y(this,Ti,e=>{if(!Xn&&window.addEventListener){const n=()=>e(!0),i=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",i)}}})}onSubscribe(){D(this,gn)||this.setEventListener(D(this,Ti))}onUnsubscribe(){var e;this.hasListeners()||((e=D(this,gn))==null||e.call(this),Y(this,gn,void 0))}setEventListener(e){var n;Y(this,Ti,e),(n=D(this,gn))==null||n.call(this),Y(this,gn,e(this.setOnline.bind(this)))}setOnline(e){D(this,Di)!==e&&(Y(this,Di,e),this.listeners.forEach(i=>{i(e)}))}isOnline(){return D(this,Di)}},Di=new WeakMap,gn=new WeakMap,Ti=new WeakMap,Bu),Xo=new qf;function Uf(t){return Math.min(1e3*2**t,3e4)}function md(t){return(t??"online")==="online"?Xo.isOnline():!0}var br=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function fd(t){let e=!1,n=0,i;const o=vr(),s=()=>o.status!=="pending",r=_=>{var v;if(!s()){const x=new br(_);h(x),(v=t.onCancel)==null||v.call(t,x)}},a=()=>{e=!0},c=()=>{e=!1},d=()=>sa.isFocused()&&(t.networkMode==="always"||Xo.isOnline())&&t.canRun(),p=()=>md(t.networkMode)&&t.canRun(),f=_=>{s()||(i==null||i(),o.resolve(_))},h=_=>{s()||(i==null||i(),o.reject(_))},g=()=>new Promise(_=>{var v;i=x=>{(s()||d())&&_(x)},(v=t.onPause)==null||v.call(t)}).then(()=>{var _;i=void 0,s()||(_=t.onContinue)==null||_.call(t)}),y=()=>{if(s())return;let _;const v=n===0?t.initialPromise:void 0;try{_=v??t.fn()}catch(x){_=Promise.reject(x)}Promise.resolve(_).then(f).catch(x=>{var k;if(s())return;const E=t.retry??(Xn?0:3),w=t.retryDelay??Uf,C=typeof w=="function"?w(n,x):w,P=E===!0||typeof E=="number"&&n<E||typeof E=="function"&&E(n,x);if(e||!P){h(x);return}n++,(k=t.onFail)==null||k.call(t,n,x),Rf(C).then(()=>d()?void 0:g()).then(()=>{e?h(x):y()})})};return{promise:o,status:()=>o.status,cancel:r,continue:()=>(i==null||i(),o),cancelRetry:a,continueRetry:c,canStart:p,start:()=>(p()?y():g().then(y),o)}}var $n,Gu,hd=(Gu=class{constructor(){oe(this,$n)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),mr(this.gcTime)&&Y(this,$n,jn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Xn?1/0:5*60*1e3))}clearGcTimeout(){D(this,$n)&&(jn.clearTimeout(D(this,$n)),Y(this,$n,void 0))}},$n=new WeakMap,Gu),Bn,Ai,ut,Gn,je,vo,Hn,vt,Jt,Hu,$f=(Hu=class extends hd{constructor(e){super();oe(this,vt);oe(this,Bn);oe(this,Ai);oe(this,ut);oe(this,Gn);oe(this,je);oe(this,vo);oe(this,Hn);Y(this,Hn,!1),Y(this,vo,e.defaultOptions),this.setOptions(e.options),this.observers=[],Y(this,Gn,e.client),Y(this,ut,D(this,Gn).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Y(this,Bn,za(this.options)),this.state=e.state??D(this,Bn),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=D(this,je))==null?void 0:e.promise}setOptions(e){if(this.options={...D(this,vo),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=za(this.options);n.data!==void 0&&(this.setState(Wa(n.data,n.dataUpdatedAt)),Y(this,Bn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&D(this,ut).remove(this)}setData(e,n){const i=yr(this.state.data,e,this.options);return _e(this,vt,Jt).call(this,{data:i,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),i}setState(e,n){_e(this,vt,Jt).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var i,o;const n=(i=D(this,je))==null?void 0:i.promise;return(o=D(this,je))==null||o.cancel(e),n?n.then(Ze).catch(Ze):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(D(this,Bn))}isActive(){return this.observers.some(e=>dt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Qo||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>En(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!ud(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(i=>i.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=D(this,je))==null||n.continue()}onOnline(){var n;const e=this.observers.find(i=>i.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=D(this,je))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),D(this,ut).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(D(this,je)&&(D(this,Hn)?D(this,je).cancel({revert:!0}):D(this,je).cancelRetry()),this.scheduleGc()),D(this,ut).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_e(this,vt,Jt).call(this,{type:"invalidate"})}async fetch(e,n){var c,d,p,f,h,g,y,_,v,x,E,w;if(this.state.fetchStatus!=="idle"&&((c=D(this,je))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(D(this,je))return D(this,je).continueRetry(),D(this,je).promise}if(e&&this.setOptions(e),!this.options.queryFn){const C=this.observers.find(P=>P.options.queryFn);C&&this.setOptions(C.options)}Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']");const i=new AbortController,o=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(Y(this,Hn,!0),i.signal)})},s=()=>{const C=dd(this.options,n),k=(()=>{const I={client:D(this,Gn),queryKey:this.queryKey,meta:this.meta};return o(I),I})();return Y(this,Hn,!1),this.options.persister?this.options.persister(C,k,this):C(k)},a=(()=>{const C={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:D(this,Gn),state:this.state,fetchFn:s};return o(C),C})();(d=this.options.behavior)==null||d.onFetch(a,this),Y(this,Ai,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=a.fetchOptions)==null?void 0:p.meta))&&_e(this,vt,Jt).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),Y(this,je,fd({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:C=>{C instanceof br&&C.revert&&this.setState({...D(this,Ai),fetchStatus:"idle"}),i.abort()},onFail:(C,P)=>{_e(this,vt,Jt).call(this,{type:"failed",failureCount:C,error:P})},onPause:()=>{_e(this,vt,Jt).call(this,{type:"pause"})},onContinue:()=>{_e(this,vt,Jt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const C=await D(this,je).start();if(C===void 0)throw console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(C),(g=(h=D(this,ut).config).onSuccess)==null||g.call(h,C,this),(_=(y=D(this,ut).config).onSettled)==null||_.call(y,C,this.state.error,this),C}catch(C){if(C instanceof br){if(C.silent)return D(this,je).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw _e(this,vt,Jt).call(this,{type:"error",error:C}),(x=(v=D(this,ut).config).onError)==null||x.call(v,C,this),(w=(E=D(this,ut).config).onSettled)==null||w.call(E,this.state.data,C,this),C}finally{this.scheduleGc()}}},Bn=new WeakMap,Ai=new WeakMap,ut=new WeakMap,Gn=new WeakMap,je=new WeakMap,vo=new WeakMap,Hn=new WeakMap,vt=new WeakSet,Jt=function(e){const n=i=>{switch(e.type){case"failed":return{...i,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...gd(i.data,this.options),fetchMeta:e.meta??null};case"success":const o={...i,...Wa(e.data,e.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Y(this,Ai,e.manual?o:void 0),o;case"error":const s=e.error;return{...i,error:s,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...e.state}}};this.state=n(this.state),$e.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),D(this,ut).notify({query:this,type:"updated",action:e})})},Hu);function gd(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:md(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Wa(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function za(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,i=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Xe,Ne,bo,We,Kn,ki,zt,yn,_o,Pi,Ii,Jn,Wn,vn,Ri,Ce,zi,_r,Nr,xr,Sr,Er,wr,Cr,yd,Ku,Bf=(Ku=class extends So{constructor(e,n){super();oe(this,Ce);oe(this,Xe);oe(this,Ne);oe(this,bo);oe(this,We);oe(this,Kn);oe(this,ki);oe(this,zt);oe(this,yn);oe(this,_o);oe(this,Pi);oe(this,Ii);oe(this,Jn);oe(this,Wn);oe(this,vn);oe(this,Ri,new Set);this.options=n,Y(this,Xe,e),Y(this,yn,null),Y(this,zt,vr()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(D(this,Ne).addObserver(this),Ya(D(this,Ne),this.options)?_e(this,Ce,zi).call(this):this.updateResult(),_e(this,Ce,Sr).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Dr(D(this,Ne),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Dr(D(this,Ne),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_e(this,Ce,Er).call(this),_e(this,Ce,wr).call(this),D(this,Ne).removeObserver(this)}setOptions(e){const n=this.options,i=D(this,Ne);if(this.options=D(this,Xe).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof dt(this.options.enabled,D(this,Ne))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_e(this,Ce,Cr).call(this),D(this,Ne).setOptions(this.options),n._defaulted&&!hr(this.options,n)&&D(this,Xe).getQueryCache().notify({type:"observerOptionsUpdated",query:D(this,Ne),observer:this});const o=this.hasListeners();o&&Qa(D(this,Ne),i,this.options,n)&&_e(this,Ce,zi).call(this),this.updateResult(),o&&(D(this,Ne)!==i||dt(this.options.enabled,D(this,Ne))!==dt(n.enabled,D(this,Ne))||En(this.options.staleTime,D(this,Ne))!==En(n.staleTime,D(this,Ne)))&&_e(this,Ce,_r).call(this);const s=_e(this,Ce,Nr).call(this);o&&(D(this,Ne)!==i||dt(this.options.enabled,D(this,Ne))!==dt(n.enabled,D(this,Ne))||s!==D(this,vn))&&_e(this,Ce,xr).call(this,s)}getOptimisticResult(e){const n=D(this,Xe).getQueryCache().build(D(this,Xe),e),i=this.createResult(n,e);return Hf(this,i)&&(Y(this,We,i),Y(this,ki,this.options),Y(this,Kn,D(this,Ne).state)),i}getCurrentResult(){return D(this,We)}trackResult(e,n){return new Proxy(e,{get:(i,o)=>(this.trackProp(o),n==null||n(o),o==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&D(this,zt).status==="pending"&&D(this,zt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,o))})}trackProp(e){D(this,Ri).add(e)}getCurrentQuery(){return D(this,Ne)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=D(this,Xe).defaultQueryOptions(e),i=D(this,Xe).getQueryCache().build(D(this,Xe),n);return i.fetch().then(()=>this.createResult(i,n))}fetch(e){return _e(this,Ce,zi).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),D(this,We)))}createResult(e,n){var A;const i=D(this,Ne),o=this.options,s=D(this,We),r=D(this,Kn),a=D(this,ki),d=e!==i?e.state:D(this,bo),{state:p}=e;let f={...p},h=!1,g;if(n._optimisticResults){const R=this.hasListeners(),q=!R&&Ya(e,n),G=R&&Qa(e,i,n,o);(q||G)&&(f={...f,...gd(p.data,e.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:y,errorUpdatedAt:_,status:v}=f;g=f.data;let x=!1;if(n.placeholderData!==void 0&&g===void 0&&v==="pending"){let R;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(R=s.data,x=!0):R=typeof n.placeholderData=="function"?n.placeholderData((A=D(this,Ii))==null?void 0:A.state.data,D(this,Ii)):n.placeholderData,R!==void 0&&(v="success",g=yr(s==null?void 0:s.data,R,n),h=!0)}if(n.select&&g!==void 0&&!x)if(s&&g===(r==null?void 0:r.data)&&n.select===D(this,_o))g=D(this,Pi);else try{Y(this,_o,n.select),g=n.select(g),g=yr(s==null?void 0:s.data,g,n),Y(this,Pi,g),Y(this,yn,null)}catch(R){Y(this,yn,R)}D(this,yn)&&(y=D(this,yn),g=D(this,Pi),_=Date.now(),v="error");const E=f.fetchStatus==="fetching",w=v==="pending",C=v==="error",P=w&&E,k=g!==void 0,j={status:v,fetchStatus:f.fetchStatus,isPending:w,isSuccess:v==="success",isError:C,isInitialLoading:P,isLoading:P,data:g,dataUpdatedAt:f.dataUpdatedAt,error:y,errorUpdatedAt:_,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:E,isRefetching:E&&!w,isLoadingError:C&&!k,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:C&&k,isStale:ra(e,n),refetch:this.refetch,promise:D(this,zt),isEnabled:dt(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const R=j.data!==void 0,q=j.status==="error"&&!R,G=T=>{q?T.reject(j.error):R&&T.resolve(j.data)},L=()=>{const T=Y(this,zt,j.promise=vr());G(T)},F=D(this,zt);switch(F.status){case"pending":e.queryHash===i.queryHash&&G(F);break;case"fulfilled":(q||j.data!==F.value)&&L();break;case"rejected":(!q||j.error!==F.reason)&&L();break}}return j}updateResult(){const e=D(this,We),n=this.createResult(D(this,Ne),this.options);if(Y(this,Kn,D(this,Ne).state),Y(this,ki,this.options),D(this,Kn).data!==void 0&&Y(this,Ii,D(this,Ne)),hr(n,e))return;Y(this,We,n);const i=()=>{if(!e)return!0;const{notifyOnChangeProps:o}=this.options,s=typeof o=="function"?o():o;if(s==="all"||!s&&!D(this,Ri).size)return!0;const r=new Set(s??D(this,Ri));return this.options.throwOnError&&r.add("error"),Object.keys(D(this,We)).some(a=>{const c=a;return D(this,We)[c]!==e[c]&&r.has(c)})};_e(this,Ce,yd).call(this,{listeners:i()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_e(this,Ce,Sr).call(this)}},Xe=new WeakMap,Ne=new WeakMap,bo=new WeakMap,We=new WeakMap,Kn=new WeakMap,ki=new WeakMap,zt=new WeakMap,yn=new WeakMap,_o=new WeakMap,Pi=new WeakMap,Ii=new WeakMap,Jn=new WeakMap,Wn=new WeakMap,vn=new WeakMap,Ri=new WeakMap,Ce=new WeakSet,zi=function(e){_e(this,Ce,Cr).call(this);let n=D(this,Ne).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Ze)),n},_r=function(){_e(this,Ce,Er).call(this);const e=En(this.options.staleTime,D(this,Ne));if(Xn||D(this,We).isStale||!mr(e))return;const i=ud(D(this,We).dataUpdatedAt,e)+1;Y(this,Jn,jn.setTimeout(()=>{D(this,We).isStale||this.updateResult()},i))},Nr=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(D(this,Ne)):this.options.refetchInterval)??!1},xr=function(e){_e(this,Ce,wr).call(this),Y(this,vn,e),!(Xn||dt(this.options.enabled,D(this,Ne))===!1||!mr(D(this,vn))||D(this,vn)===0)&&Y(this,Wn,jn.setInterval(()=>{(this.options.refetchIntervalInBackground||sa.isFocused())&&_e(this,Ce,zi).call(this)},D(this,vn)))},Sr=function(){_e(this,Ce,_r).call(this),_e(this,Ce,xr).call(this,_e(this,Ce,Nr).call(this))},Er=function(){D(this,Jn)&&(jn.clearTimeout(D(this,Jn)),Y(this,Jn,void 0))},wr=function(){D(this,Wn)&&(jn.clearInterval(D(this,Wn)),Y(this,Wn,void 0))},Cr=function(){const e=D(this,Xe).getQueryCache().build(D(this,Xe),this.options);if(e===D(this,Ne))return;const n=D(this,Ne);Y(this,Ne,e),Y(this,bo,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},yd=function(e){$e.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(D(this,We))}),D(this,Xe).getQueryCache().notify({query:D(this,Ne),type:"observerResultsUpdated"})})},Ku);function Gf(t,e){return dt(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Ya(t,e){return Gf(t,e)||t.state.data!==void 0&&Dr(t,e,e.refetchOnMount)}function Dr(t,e,n){if(dt(e.enabled,t)!==!1&&En(e.staleTime,t)!=="static"){const i=typeof n=="function"?n(t):n;return i==="always"||i!==!1&&ra(t,e)}return!1}function Qa(t,e,n,i){return(t!==e||dt(i.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&ra(t,n)}function ra(t,e){return dt(e.enabled,t)!==!1&&t.isStaleByTime(En(e.staleTime,t))}function Hf(t,e){return!hr(t.getCurrentResult(),e)}function Xa(t){return{onFetch:(e,n)=>{var p,f,h,g,y;const i=e.options,o=(h=(f=(p=e.fetchOptions)==null?void 0:p.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,s=((g=e.state.data)==null?void 0:g.pages)||[],r=((y=e.state.data)==null?void 0:y.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const d=async()=>{let _=!1;const v=w=>{Lf(w,()=>e.signal,()=>_=!0)},x=dd(e.options,e.fetchOptions),E=async(w,C,P)=>{if(_)return Promise.reject();if(C==null&&w.pages.length)return Promise.resolve(w);const I=(()=>{const q={client:e.client,queryKey:e.queryKey,pageParam:C,direction:P?"backward":"forward",meta:e.options.meta};return v(q),q})(),j=await x(I),{maxPages:A}=e.options,R=P?Vf:Mf;return{pages:R(w.pages,j,A),pageParams:R(w.pageParams,C,A)}};if(o&&s.length){const w=o==="backward",C=w?Kf:Za,P={pages:s,pageParams:r},k=C(i,P);a=await E(P,k,w)}else{const w=t??s.length;do{const C=c===0?r[0]??i.initialPageParam:Za(i,a);if(c>0&&C==null)break;a=await E(a,C),c++}while(c<w)}return a};e.options.persister?e.fetchFn=()=>{var _,v;return(v=(_=e.options).persister)==null?void 0:v.call(_,d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=d}}}function Za(t,{pages:e,pageParams:n}){const i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,n[i],n):void 0}function Kf(t,{pages:e,pageParams:n}){var i;return e.length>0?(i=t.getPreviousPageParam)==null?void 0:i.call(t,e[0],e,n[0],n):void 0}var No,Rt,He,zn,Mt,pn,Ju,Jf=(Ju=class extends hd{constructor(e){super();oe(this,Mt);oe(this,No);oe(this,Rt);oe(this,He);oe(this,zn);Y(this,No,e.client),this.mutationId=e.mutationId,Y(this,He,e.mutationCache),Y(this,Rt,[]),this.state=e.state||Wf(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){D(this,Rt).includes(e)||(D(this,Rt).push(e),this.clearGcTimeout(),D(this,He).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Y(this,Rt,D(this,Rt).filter(n=>n!==e)),this.scheduleGc(),D(this,He).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){D(this,Rt).length||(this.state.status==="pending"?this.scheduleGc():D(this,He).remove(this))}continue(){var e;return((e=D(this,zn))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var r,a,c,d,p,f,h,g,y,_,v,x,E,w,C,P,k,I;const n=()=>{_e(this,Mt,pn).call(this,{type:"continue"})},i={client:D(this,No),meta:this.options.meta,mutationKey:this.options.mutationKey};Y(this,zn,fd({fn:()=>this.options.mutationFn?this.options.mutationFn(e,i):Promise.reject(new Error("No mutationFn found")),onFail:(j,A)=>{_e(this,Mt,pn).call(this,{type:"failed",failureCount:j,error:A})},onPause:()=>{_e(this,Mt,pn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>D(this,He).canRun(this)}));const o=this.state.status==="pending",s=!D(this,zn).canStart();try{if(o)n();else{_e(this,Mt,pn).call(this,{type:"pending",variables:e,isPaused:s}),D(this,He).config.onMutate&&await D(this,He).config.onMutate(e,this,i);const A=await((a=(r=this.options).onMutate)==null?void 0:a.call(r,e,i));A!==this.state.context&&_e(this,Mt,pn).call(this,{type:"pending",context:A,variables:e,isPaused:s})}const j=await D(this,zn).start();return await((d=(c=D(this,He).config).onSuccess)==null?void 0:d.call(c,j,e,this.state.context,this,i)),await((f=(p=this.options).onSuccess)==null?void 0:f.call(p,j,e,this.state.context,i)),await((g=(h=D(this,He).config).onSettled)==null?void 0:g.call(h,j,null,this.state.variables,this.state.context,this,i)),await((_=(y=this.options).onSettled)==null?void 0:_.call(y,j,null,e,this.state.context,i)),_e(this,Mt,pn).call(this,{type:"success",data:j}),j}catch(j){try{await((x=(v=D(this,He).config).onError)==null?void 0:x.call(v,j,e,this.state.context,this,i))}catch(A){Promise.reject(A)}try{await((w=(E=this.options).onError)==null?void 0:w.call(E,j,e,this.state.context,i))}catch(A){Promise.reject(A)}try{await((P=(C=D(this,He).config).onSettled)==null?void 0:P.call(C,void 0,j,this.state.variables,this.state.context,this,i))}catch(A){Promise.reject(A)}try{await((I=(k=this.options).onSettled)==null?void 0:I.call(k,void 0,j,e,this.state.context,i))}catch(A){Promise.reject(A)}throw _e(this,Mt,pn).call(this,{type:"error",error:j}),j}finally{D(this,He).runNext(this)}}},No=new WeakMap,Rt=new WeakMap,He=new WeakMap,zn=new WeakMap,Mt=new WeakSet,pn=function(e){const n=i=>{switch(e.type){case"failed":return{...i,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...i,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:e.error,failureCount:i.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),$e.batch(()=>{D(this,Rt).forEach(i=>{i.onMutationUpdate(e)}),D(this,He).notify({mutation:this,type:"updated",action:e})})},Ju);function Wf(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Yt,bt,xo,Wu,zf=(Wu=class extends So{constructor(e={}){super();oe(this,Yt);oe(this,bt);oe(this,xo);this.config=e,Y(this,Yt,new Set),Y(this,bt,new Map),Y(this,xo,0)}build(e,n,i){const o=new Jf({client:e,mutationCache:this,mutationId:++To(this,xo)._,options:e.defaultMutationOptions(n),state:i});return this.add(o),o}add(e){D(this,Yt).add(e);const n=ko(e);if(typeof n=="string"){const i=D(this,bt).get(n);i?i.push(e):D(this,bt).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(D(this,Yt).delete(e)){const n=ko(e);if(typeof n=="string"){const i=D(this,bt).get(n);if(i)if(i.length>1){const o=i.indexOf(e);o!==-1&&i.splice(o,1)}else i[0]===e&&D(this,bt).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=ko(e);if(typeof n=="string"){const i=D(this,bt).get(n),o=i==null?void 0:i.find(s=>s.state.status==="pending");return!o||o===e}else return!0}runNext(e){var i;const n=ko(e);if(typeof n=="string"){const o=(i=D(this,bt).get(n))==null?void 0:i.find(s=>s!==e&&s.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){$e.batch(()=>{D(this,Yt).forEach(e=>{this.notify({type:"removed",mutation:e})}),D(this,Yt).clear(),D(this,bt).clear()})}getAll(){return Array.from(D(this,Yt))}find(e){const n={exact:!0,...e};return this.getAll().find(i=>Ha(n,i))}findAll(e={}){return this.getAll().filter(n=>Ha(e,n))}notify(e){$e.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return $e.batch(()=>Promise.all(e.map(n=>n.continue().catch(Ze))))}},Yt=new WeakMap,bt=new WeakMap,xo=new WeakMap,Wu);function ko(t){var e;return(e=t.options.scope)==null?void 0:e.id}var Vt,zu,Yf=(zu=class extends So{constructor(e={}){super();oe(this,Vt);this.config=e,Y(this,Vt,new Map)}build(e,n,i){const o=n.queryKey,s=n.queryHash??oa(o,n);let r=this.get(s);return r||(r=new $f({client:e,queryKey:o,queryHash:s,options:e.defaultQueryOptions(n),state:i,defaultOptions:e.getQueryDefaults(o)}),this.add(r)),r}add(e){D(this,Vt).has(e.queryHash)||(D(this,Vt).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=D(this,Vt).get(e.queryHash);n&&(e.destroy(),n===e&&D(this,Vt).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){$e.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return D(this,Vt).get(e)}getAll(){return[...D(this,Vt).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(i=>Ga(n,i))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(i=>Ga(e,i)):n}notify(e){$e.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){$e.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){$e.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Vt=new WeakMap,zu),Re,bn,_n,Mi,Vi,Nn,Li,Oi,Yu,Qf=(Yu=class{constructor(t={}){oe(this,Re);oe(this,bn);oe(this,_n);oe(this,Mi);oe(this,Vi);oe(this,Nn);oe(this,Li);oe(this,Oi);Y(this,Re,t.queryCache||new Yf),Y(this,bn,t.mutationCache||new zf),Y(this,_n,t.defaultOptions||{}),Y(this,Mi,new Map),Y(this,Vi,new Map),Y(this,Nn,0)}mount(){To(this,Nn)._++,D(this,Nn)===1&&(Y(this,Li,sa.subscribe(async t=>{t&&(await this.resumePausedMutations(),D(this,Re).onFocus())})),Y(this,Oi,Xo.subscribe(async t=>{t&&(await this.resumePausedMutations(),D(this,Re).onOnline())})))}unmount(){var t,e;To(this,Nn)._--,D(this,Nn)===0&&((t=D(this,Li))==null||t.call(this),Y(this,Li,void 0),(e=D(this,Oi))==null||e.call(this),Y(this,Oi,void 0))}isFetching(t){return D(this,Re).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return D(this,bn).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=D(this,Re).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=D(this,Re).build(this,e),i=n.state.data;return i===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(En(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return D(this,Re).findAll(t).map(({queryKey:e,state:n})=>{const i=n.data;return[e,i]})}setQueryData(t,e,n){const i=this.defaultQueryOptions({queryKey:t}),o=D(this,Re).get(i.queryHash),s=o==null?void 0:o.state.data,r=Pf(e,s);if(r!==void 0)return D(this,Re).build(this,i).setData(r,{...n,manual:!0})}setQueriesData(t,e,n){return $e.batch(()=>D(this,Re).findAll(t).map(({queryKey:i})=>[i,this.setQueryData(i,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=D(this,Re).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=D(this,Re);$e.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=D(this,Re);return $e.batch(()=>(n.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},i=$e.batch(()=>D(this,Re).findAll(t).map(o=>o.cancel(n)));return Promise.all(i).then(Ze).catch(Ze)}invalidateQueries(t,e={}){return $e.batch(()=>(D(this,Re).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},i=$e.batch(()=>D(this,Re).findAll(t).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let s=o.fetch(void 0,n);return n.throwOnError||(s=s.catch(Ze)),o.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(i).then(Ze)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=D(this,Re).build(this,e);return n.isStaleByTime(En(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Ze).catch(Ze)}fetchInfiniteQuery(t){return t.behavior=Xa(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Ze).catch(Ze)}ensureInfiniteQueryData(t){return t.behavior=Xa(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Xo.isOnline()?D(this,bn).resumePausedMutations():Promise.resolve()}getQueryCache(){return D(this,Re)}getMutationCache(){return D(this,bn)}getDefaultOptions(){return D(this,_n)}setDefaultOptions(t){Y(this,_n,t)}setQueryDefaults(t,e){D(this,Mi).set(mo(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...D(this,Mi).values()],n={};return e.forEach(i=>{fo(t,i.queryKey)&&Object.assign(n,i.defaultOptions)}),n}setMutationDefaults(t,e){D(this,Vi).set(mo(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...D(this,Vi).values()],n={};return e.forEach(i=>{fo(t,i.mutationKey)&&Object.assign(n,i.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...D(this,_n).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=oa(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Qo&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...D(this,_n).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){D(this,Re).clear(),D(this,bn).clear()}},Re=new WeakMap,bn=new WeakMap,_n=new WeakMap,Mi=new WeakMap,Vi=new WeakMap,Nn=new WeakMap,Li=new WeakMap,Oi=new WeakMap,Yu),vd={exports:{}},Go={};/**
 * @license React
 * react-jsx-runtime.development.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(){var t=b,e=Symbol.for("react.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),r=Symbol.for("react.provider"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),y=Symbol.iterator,_="@@iterator";function v(N){if(N===null||typeof N!="object")return null;var M=y&&N[y]||N[_];return typeof M=="function"?M:null}var x=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(N){{for(var M=arguments.length,B=new Array(M>1?M-1:0),W=1;W<M;W++)B[W-1]=arguments[W];w("error",N,B)}}function w(N,M,B){{var W=x.ReactDebugCurrentFrame,Z=W.getStackAddendum();Z!==""&&(M+="%s",B=B.concat([Z]));var ee=B.map(function(se){return String(se)});ee.unshift("Warning: "+M),Function.prototype.apply.call(console[N],console,ee)}}var C=!1,P=!1,k=!1,I=!1,j=!1,A;A=Symbol.for("react.module.reference");function R(N){return!!(typeof N=="string"||typeof N=="function"||N===i||N===s||j||N===o||N===d||N===p||I||N===g||C||P||k||typeof N=="object"&&N!==null&&(N.$$typeof===h||N.$$typeof===f||N.$$typeof===r||N.$$typeof===a||N.$$typeof===c||N.$$typeof===A||N.getModuleId!==void 0))}function q(N,M,B){var W=N.displayName;if(W)return W;var Z=M.displayName||M.name||"";return Z!==""?B+"("+Z+")":B}function G(N){return N.displayName||"Context"}function L(N){if(N==null)return null;if(typeof N.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof N=="function")return N.displayName||N.name||null;if(typeof N=="string")return N;switch(N){case i:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case d:return"Suspense";case p:return"SuspenseList"}if(typeof N=="object")switch(N.$$typeof){case a:var M=N;return G(M)+".Consumer";case r:var B=N;return G(B._context)+".Provider";case c:return q(N,N.render,"ForwardRef");case f:var W=N.displayName||null;return W!==null?W:L(N.type)||"Memo";case h:{var Z=N,ee=Z._payload,se=Z._init;try{return L(se(ee))}catch{return null}}}return null}var F=Object.assign,T=0,$,Q,X,te,J,O,U;function H(){}H.__reactDisabledLog=!0;function re(){{if(T===0){$=console.log,Q=console.info,X=console.warn,te=console.error,J=console.group,O=console.groupCollapsed,U=console.groupEnd;var N={configurable:!0,enumerable:!0,value:H,writable:!0};Object.defineProperties(console,{info:N,log:N,warn:N,error:N,group:N,groupCollapsed:N,groupEnd:N})}T++}}function de(){{if(T--,T===0){var N={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},N,{value:$}),info:F({},N,{value:Q}),warn:F({},N,{value:X}),error:F({},N,{value:te}),group:F({},N,{value:J}),groupCollapsed:F({},N,{value:O}),groupEnd:F({},N,{value:U})})}T<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var le=x.ReactCurrentDispatcher,fe;function De(N,M,B){{if(fe===void 0)try{throw Error()}catch(Z){var W=Z.stack.trim().match(/\n( *(at )?)/);fe=W&&W[1]||""}return`
`+fe+N}}var K=!1,ae;{var ve=typeof WeakMap=="function"?WeakMap:Map;ae=new ve}function Ie(N,M){if(!N||K)return"";{var B=ae.get(N);if(B!==void 0)return B}var W;K=!0;var Z=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ee;ee=le.current,le.current=null,re();try{if(M){var se=function(){throw Error()};if(Object.defineProperty(se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(se,[])}catch(Ge){W=Ge}Reflect.construct(N,[],se)}else{try{se.call()}catch(Ge){W=Ge}N.call(se.prototype)}}else{try{throw Error()}catch(Ge){W=Ge}N()}}catch(Ge){if(Ge&&W&&typeof Ge.stack=="string"){for(var ne=Ge.stack.split(`
`),be=W.stack.split(`
`),xe=ne.length-1,Te=be.length-1;xe>=1&&Te>=0&&ne[xe]!==be[Te];)Te--;for(;xe>=1&&Te>=0;xe--,Te--)if(ne[xe]!==be[Te]){if(xe!==1||Te!==1)do if(xe--,Te--,Te<0||ne[xe]!==be[Te]){var Ve=`
`+ne[xe].replace(" at new "," at ");return N.displayName&&Ve.includes("<anonymous>")&&(Ve=Ve.replace("<anonymous>",N.displayName)),typeof N=="function"&&ae.set(N,Ve),Ve}while(xe>=1&&Te>=0);break}}}finally{K=!1,le.current=ee,de(),Error.prepareStackTrace=Z}var Me=N?N.displayName||N.name:"",yt=Me?De(Me):"";return typeof N=="function"&&ae.set(N,yt),yt}function it(N,M,B){return Ie(N,!1)}function Gt(N){var M=N.prototype;return!!(M&&M.isReactComponent)}function qe(N,M,B){if(N==null)return"";if(typeof N=="function")return Ie(N,Gt(N));if(typeof N=="string")return De(N);switch(N){case d:return De("Suspense");case p:return De("SuspenseList")}if(typeof N=="object")switch(N.$$typeof){case c:return it(N.render);case f:return qe(N.type,M,B);case h:{var W=N,Z=W._payload,ee=W._init;try{return qe(ee(Z),M,B)}catch{}}}return""}var Ue=Object.prototype.hasOwnProperty,ot={},ht=x.ReactDebugCurrentFrame;function Oe(N){if(N){var M=N._owner,B=qe(N.type,N._source,M?M.type:null);ht.setExtraStackFrame(B)}else ht.setExtraStackFrame(null)}function gt(N,M,B,W,Z){{var ee=Function.call.bind(Ue);for(var se in N)if(ee(N,se)){var ne=void 0;try{if(typeof N[se]!="function"){var be=Error((W||"React class")+": "+B+" type `"+se+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof N[se]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw be.name="Invariant Violation",be}ne=N[se](M,se,W,B,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(xe){ne=xe}ne&&!(ne instanceof Error)&&(Oe(Z),E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",W||"React class",B,se,typeof ne),Oe(null)),ne instanceof Error&&!(ne.message in ot)&&(ot[ne.message]=!0,Oe(Z),E("Failed %s type: %s",B,ne.message),Oe(null))}}}var an=Array.isArray;function Be(N){return an(N)}function at(N){{var M=typeof Symbol=="function"&&Symbol.toStringTag,B=M&&N[Symbol.toStringTag]||N.constructor.name||"Object";return B}}function ke(N){try{return Ct(N),!1}catch{return!0}}function Ct(N){return""+N}function Dt(N){if(ke(N))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",at(N)),Ct(N)}var st=x.ReactCurrentOwner,ln={key:!0,ref:!0,__self:!0,__source:!0},Tt,At;function ie(N){if(Ue.call(N,"ref")){var M=Object.getOwnPropertyDescriptor(N,"ref").get;if(M&&M.isReactWarning)return!1}return N.ref!==void 0}function Pe(N){if(Ue.call(N,"key")){var M=Object.getOwnPropertyDescriptor(N,"key").get;if(M&&M.isReactWarning)return!1}return N.key!==void 0}function li(N,M){typeof N.ref=="string"&&st.current}function ci(N,M){{var B=function(){Tt||(Tt=!0,E("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",M))};B.isReactWarning=!0,Object.defineProperty(N,"key",{get:B,configurable:!0})}}function ui(N,M){{var B=function(){At||(At=!0,E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",M))};B.isReactWarning=!0,Object.defineProperty(N,"ref",{get:B,configurable:!0})}}var di=function(N,M,B,W,Z,ee,se){var ne={$$typeof:e,type:N,key:M,ref:B,props:se,_owner:ee};return ne._store={},Object.defineProperty(ne._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ne,"_self",{configurable:!1,enumerable:!1,writable:!1,value:W}),Object.defineProperty(ne,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Z}),Object.freeze&&(Object.freeze(ne.props),Object.freeze(ne)),ne};function pi(N,M,B,W,Z){{var ee,se={},ne=null,be=null;B!==void 0&&(Dt(B),ne=""+B),Pe(M)&&(Dt(M.key),ne=""+M.key),ie(M)&&(be=M.ref,li(M,Z));for(ee in M)Ue.call(M,ee)&&!ln.hasOwnProperty(ee)&&(se[ee]=M[ee]);if(N&&N.defaultProps){var xe=N.defaultProps;for(ee in xe)se[ee]===void 0&&(se[ee]=xe[ee])}if(ne||be){var Te=typeof N=="function"?N.displayName||N.name||"Unknown":N;ne&&ci(se,Te),be&&ui(se,Te)}return di(N,ne,be,Z,W,st.current,se)}}var cn=x.ReactCurrentOwner,Ht=x.ReactDebugCurrentFrame;function lt(N){if(N){var M=N._owner,B=qe(N.type,N._source,M?M.type:null);Ht.setExtraStackFrame(B)}else Ht.setExtraStackFrame(null)}var rt;rt=!1;function kt(N){return typeof N=="object"&&N!==null&&N.$$typeof===e}function Kt(){{if(cn.current){var N=L(cn.current.type);if(N)return`

Check the render method of \``+N+"`."}return""}}function Tn(N){return""}var An={};function kn(N){{var M=Kt();if(!M){var B=typeof N=="string"?N:N.displayName||N.name;B&&(M=`

Check the top-level render call using <`+B+">.")}return M}}function Pn(N,M){{if(!N._store||N._store.validated||N.key!=null)return;N._store.validated=!0;var B=kn(M);if(An[B])return;An[B]=!0;var W="";N&&N._owner&&N._owner!==cn.current&&(W=" It was passed a child from "+L(N._owner.type)+"."),lt(N),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',B,W),lt(null)}}function un(N,M){{if(typeof N!="object")return;if(Be(N))for(var B=0;B<N.length;B++){var W=N[B];kt(W)&&Pn(W,M)}else if(kt(N))N._store&&(N._store.validated=!0);else if(N){var Z=v(N);if(typeof Z=="function"&&Z!==N.entries)for(var ee=Z.call(N),se;!(se=ee.next()).done;)kt(se.value)&&Pn(se.value,M)}}}function In(N){{var M=N.type;if(M==null||typeof M=="string")return;var B;if(typeof M=="function")B=M.propTypes;else if(typeof M=="object"&&(M.$$typeof===c||M.$$typeof===f))B=M.propTypes;else return;if(B){var W=L(M);gt(B,N.props,"prop",W,N)}else if(M.PropTypes!==void 0&&!rt){rt=!0;var Z=L(M);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Z||"Unknown")}typeof M.getDefaultProps=="function"&&!M.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function mi(N){{for(var M=Object.keys(N.props),B=0;B<M.length;B++){var W=M[B];if(W!=="children"&&W!=="key"){lt(N),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",W),lt(null);break}}N.ref!==null&&(lt(N),E("Invalid attribute `ref` supplied to `React.Fragment`."),lt(null))}}var Rn={};function dn(N,M,B,W,Z,ee){{var se=R(N);if(!se){var ne="";(N===void 0||typeof N=="object"&&N!==null&&Object.keys(N).length===0)&&(ne+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var be=Tn();be?ne+=be:ne+=Kt();var xe;N===null?xe="null":Be(N)?xe="array":N!==void 0&&N.$$typeof===e?(xe="<"+(L(N.type)||"Unknown")+" />",ne=" Did you accidentally export a JSX literal instead of a component?"):xe=typeof N,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",xe,ne)}var Te=pi(N,M,B,Z,ee);if(Te==null)return Te;if(se){var Ve=M.children;if(Ve!==void 0)if(W)if(Be(Ve)){for(var Me=0;Me<Ve.length;Me++)un(Ve[Me],N);Object.freeze&&Object.freeze(Ve)}else E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else un(Ve,N)}if(Ue.call(M,"key")){var yt=L(N),Ge=Object.keys(M).filter(function(Xm){return Xm!=="key"}),Gi=Ge.length>0?"{key: someKey, "+Ge.join(": ..., ")+": ...}":"{key: someKey}";if(!Rn[yt+Gi]){var Qm=Ge.length>0?"{"+Ge.join(": ..., ")+": ...}":"{}";E(`A props object containing a "key" prop is being spread into JSX:
  let props = %s;
  <%s {...props} />
React keys must be passed directly to JSX without using spread:
  let props = %s;
  <%s key={someKey} {...props} />`,Gi,yt,Qm,yt),Rn[yt+Gi]=!0}}return N===i?mi(Te):In(Te),Te}}function fi(N,M,B){return dn(N,M,B,!0)}function Bi(N,M,B){return dn(N,M,B,!1)}var S=Bi,V=fi;Go.Fragment=i,Go.jsx=S,Go.jsxs=V})();vd.exports=Go;var Xf=vd.exports,bd=b.createContext(void 0),Zf=t=>{const e=b.useContext(bd);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},eh=({client:t,children:e})=>(b.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),Xf.jsx(bd.Provider,{value:t,children:e})),_d=b.createContext(!1),th=()=>b.useContext(_d);_d.Provider;function nh(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var ih=b.createContext(nh()),oh=()=>b.useContext(ih),sh=(t,e,n)=>{const i=n!=null&&n.state.error&&typeof t.throwOnError=="function"?pd(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||i)&&(e.isReset()||(t.retryOnMount=!1))},rh=t=>{b.useEffect(()=>{t.clearReset()},[t])},ah=({result:t,errorResetBoundary:e,throwOnError:n,query:i,suspense:o})=>t.isError&&!e.isReset()&&!t.isFetching&&i&&(o&&t.data===void 0||pd(n,[t.error,i])),lh=t=>{if(t.suspense){const n=o=>o==="static"?o:Math.max(o??1e3,1e3),i=t.staleTime;t.staleTime=typeof i=="function"?(...o)=>n(i(...o)):n(i),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},ch=(t,e)=>t.isLoading&&t.isFetching&&!e,uh=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,el=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function dh(t,e,n){var h,g,y,_;if(typeof t!="object"||Array.isArray(t))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const i=th(),o=oh(),s=Zf(),r=s.defaultQueryOptions(t);(g=(h=s.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||g.call(h,r);const a=s.getQueryCache().get(r.queryHash);r.queryFn||console.error(`[${r.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`),r._optimisticResults=i?"isRestoring":"optimistic",lh(r),sh(r,o,a),rh(o);const c=!s.getQueryCache().get(r.queryHash),[d]=b.useState(()=>new e(s,r)),p=d.getOptimisticResult(r),f=!i&&t.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(v=>{const x=f?d.subscribe($e.batchCalls(v)):Ze;return d.updateResult(),x},[d,f]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),b.useEffect(()=>{d.setOptions(r)},[r,d]),uh(r,p))throw el(r,d,o);if(ah({result:p,errorResetBoundary:o,throwOnError:r.throwOnError,query:a,suspense:r.suspense}))throw p.error;if((_=(y=s.getDefaultOptions().queries)==null?void 0:y._experimental_afterQuery)==null||_.call(y,r,p),r.experimental_prefetchInRender&&!Xn&&ch(p,i)){const v=c?el(r,d,o):a==null?void 0:a.promise;v==null||v.catch(Ze).finally(()=>{d.updateResult()})}return r.notifyOnChangeProps?p:d.trackResult(p)}function ye(t,e){return dh(t,Bf)}const ce=t=>typeof t=="string",Hi=()=>{let t,e;const n=new Promise((i,o)=>{t=i,e=o});return n.resolve=t,n.reject=e,n},tl=t=>t==null?"":""+t,ph=(t,e,n)=>{t.forEach(i=>{e[i]&&(n[i]=e[i])})},mh=/###/g,nl=t=>t&&t.indexOf("###")>-1?t.replace(mh,"."):t,il=t=>!t||ce(t),io=(t,e,n)=>{const i=ce(e)?e.split("."):e;let o=0;for(;o<i.length-1;){if(il(t))return{};const s=nl(i[o]);!t[s]&&n&&(t[s]=new n),Object.prototype.hasOwnProperty.call(t,s)?t=t[s]:t={},++o}return il(t)?{}:{obj:t,k:nl(i[o])}},ol=(t,e,n)=>{const{obj:i,k:o}=io(t,e,Object);if(i!==void 0||e.length===1){i[o]=n;return}let s=e[e.length-1],r=e.slice(0,e.length-1),a=io(t,r,Object);for(;a.obj===void 0&&r.length;)s=`${r[r.length-1]}.${s}`,r=r.slice(0,r.length-1),a=io(t,r,Object),a!=null&&a.obj&&typeof a.obj[`${a.k}.${s}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${s}`]=n},fh=(t,e,n,i)=>{const{obj:o,k:s}=io(t,e,Object);o[s]=o[s]||[],o[s].push(n)},Zo=(t,e)=>{const{obj:n,k:i}=io(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,i))return n[i]},hh=(t,e,n)=>{const i=Zo(t,n);return i!==void 0?i:Zo(e,n)},Nd=(t,e,n)=>{for(const i in e)i!=="__proto__"&&i!=="constructor"&&(i in t?ce(t[i])||t[i]instanceof String||ce(e[i])||e[i]instanceof String?n&&(t[i]=e[i]):Nd(t[i],e[i],n):t[i]=e[i]);return t},Mn=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var gh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const yh=t=>ce(t)?t.replace(/[&<>"'\/]/g,e=>gh[e]):t;class vh{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const i=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,i),this.regExpQueue.push(e),i}}const bh=[" ",",","?","!",";"],_h=new vh(20),Nh=(t,e,n)=>{e=e||"",n=n||"";const i=bh.filter(r=>e.indexOf(r)<0&&n.indexOf(r)<0);if(i.length===0)return!0;const o=_h.getRegExp(`(${i.map(r=>r==="?"?"\\?":r).join("|")})`);let s=!o.test(t);if(!s){const r=t.indexOf(n);r>0&&!o.test(t.substring(0,r))&&(s=!0)}return s},Tr=(t,e,n=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const i=e.split(n);let o=t;for(let s=0;s<i.length;){if(!o||typeof o!="object")return;let r,a="";for(let c=s;c<i.length;++c)if(c!==s&&(a+=n),a+=i[c],r=o[a],r!==void 0){if(["string","number","boolean"].indexOf(typeof r)>-1&&c<i.length-1)continue;s+=c-s+1;break}o=r}return o},ho=t=>t==null?void 0:t.replace("_","-"),xh={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){var n,i;(i=(n=console==null?void 0:console[t])==null?void 0:n.apply)==null||i.call(n,console,e)}};class es{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||xh,this.options=n,this.debug=n.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,n,i,o){return o&&!this.debug?null:(ce(e[0])&&(e[0]=`${i}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new es(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new es(this.logger,e)}}var jt=new es;class ps{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(i=>{this.observers[i]||(this.observers[i]=new Map);const o=this.observers[i].get(n)||0;this.observers[i].set(n,o+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}emit(e,...n){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([o,s])=>{for(let r=0;r<s;r++)o(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,s])=>{for(let r=0;r<s;r++)o.apply(o,[e,...n])})}}class sl extends ps{constructor(e,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,i,o={}){var d,p;const s=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,r=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.indexOf(".")>-1?a=e.split("."):(a=[e,n],i&&(Array.isArray(i)?a.push(...i):ce(i)&&s?a.push(...i.split(s)):a.push(i)));const c=Zo(this.data,a);return!c&&!n&&!i&&e.indexOf(".")>-1&&(e=a[0],n=a[1],i=a.slice(2).join(".")),c||!r||!ce(i)?c:Tr((p=(d=this.data)==null?void 0:d[e])==null?void 0:p[n],i,s)}addResource(e,n,i,o,s={silent:!1}){const r=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let a=[e,n];i&&(a=a.concat(r?i.split(r):i)),e.indexOf(".")>-1&&(a=e.split("."),o=n,n=a[1]),this.addNamespaces(n),ol(this.data,a,o),s.silent||this.emit("added",e,n,i,o)}addResources(e,n,i,o={silent:!1}){for(const s in i)(ce(i[s])||Array.isArray(i[s]))&&this.addResource(e,n,s,i[s],{silent:!0});o.silent||this.emit("added",e,n,i)}addResourceBundle(e,n,i,o,s,r={silent:!1,skipCopy:!1}){let a=[e,n];e.indexOf(".")>-1&&(a=e.split("."),o=i,i=n,n=a[1]),this.addNamespaces(n);let c=Zo(this.data,a)||{};r.skipCopy||(i=JSON.parse(JSON.stringify(i))),o?Nd(c,i,s):c={...c,...i},ol(this.data,a,c),r.silent||this.emit("added",e,n,i)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(o=>n[o]&&Object.keys(n[o]).length>0)}toJSON(){return this.data}}var xd={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,i,o){return t.forEach(s=>{var r;e=((r=this.processors[s])==null?void 0:r.process(e,n,i,o))??e}),e}};const Sd=Symbol("i18next/PATH_KEY");function Sh(){const t=[],e=Object.create(null);let n;return e.get=(i,o)=>{var s;return(s=n==null?void 0:n.revoke)==null||s.call(n),o===Sd?t:(t.push(o),n=Proxy.revocable(i,e),n.proxy)},Proxy.revocable(Object.create(null),e).proxy}function Ar(t,e){const{[Sd]:n}=t(Sh());return n.join((e==null?void 0:e.keySeparator)??".")}const rl={},Ys=t=>!ce(t)&&typeof t!="boolean"&&typeof t!="number";class ts extends ps{constructor(e,n={}){super(),ph(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=jt.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){const i={...n};if(e==null)return!1;const o=this.resolve(e,i);if((o==null?void 0:o.res)===void 0)return!1;const s=Ys(o.res);return!(i.returnObjects===!1&&s)}extractFromKey(e,n){let i=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;i===void 0&&(i=":");const o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let s=n.ns||this.options.defaultNS||[];const r=i&&e.indexOf(i)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Nh(e,i,o);if(r&&!a){const c=e.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:e,namespaces:ce(s)?[s]:s};const d=e.split(i);(i!==o||i===o&&this.options.ns.indexOf(d[0])>-1)&&(s=d.shift()),e=d.join(o)}return{key:e,namespaces:ce(s)?[s]:s}}translate(e,n,i){let o=typeof n=="object"?{...n}:n;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof o=="object"&&(o={...o}),o||(o={}),e==null)return"";typeof e=="function"&&(e=Ar(e,{...this.options,...o})),Array.isArray(e)||(e=[String(e)]);const s=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,r=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:a,namespaces:c}=this.extractFromKey(e[e.length-1],o),d=c[c.length-1];let p=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;p===void 0&&(p=":");const f=o.lng||this.language,h=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((f==null?void 0:f.toLowerCase())==="cimode")return h?s?{res:`${d}${p}${a}`,usedKey:a,exactUsedKey:a,usedLng:f,usedNS:d,usedParams:this.getUsedParamsDetails(o)}:`${d}${p}${a}`:s?{res:a,usedKey:a,exactUsedKey:a,usedLng:f,usedNS:d,usedParams:this.getUsedParamsDetails(o)}:a;const g=this.resolve(e,o);let y=g==null?void 0:g.res;const _=(g==null?void 0:g.usedKey)||a,v=(g==null?void 0:g.exactUsedKey)||a,x=["[object Number]","[object Function]","[object RegExp]"],E=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,w=!this.i18nFormat||this.i18nFormat.handleAsObject,C=o.count!==void 0&&!ce(o.count),P=ts.hasDefaultValue(o),k=C?this.pluralResolver.getSuffix(f,o.count,o):"",I=o.ordinal&&C?this.pluralResolver.getSuffix(f,o.count,{ordinal:!1}):"",j=C&&!o.ordinal&&o.count===0,A=j&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${k}`]||o[`defaultValue${I}`]||o.defaultValue;let R=y;w&&!y&&P&&(R=A);const q=Ys(R),G=Object.prototype.toString.apply(R);if(w&&R&&q&&x.indexOf(G)<0&&!(ce(E)&&Array.isArray(R))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const L=this.options.returnedObjectHandler?this.options.returnedObjectHandler(_,R,{...o,ns:c}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(g.res=L,g.usedParams=this.getUsedParamsDetails(o),g):L}if(r){const L=Array.isArray(R),F=L?[]:{},T=L?v:_;for(const $ in R)if(Object.prototype.hasOwnProperty.call(R,$)){const Q=`${T}${r}${$}`;P&&!y?F[$]=this.translate(Q,{...o,defaultValue:Ys(A)?A[$]:void 0,joinArrays:!1,ns:c}):F[$]=this.translate(Q,{...o,joinArrays:!1,ns:c}),F[$]===Q&&(F[$]=R[$])}y=F}}else if(w&&ce(E)&&Array.isArray(y))y=y.join(E),y&&(y=this.extendTranslation(y,e,o,i));else{let L=!1,F=!1;!this.isValidLookup(y)&&P&&(L=!0,y=A),this.isValidLookup(y)||(F=!0,y=a);const $=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&F?void 0:y,Q=P&&A!==y&&this.options.updateMissing;if(F||L||Q){if(this.logger.log(Q?"updateKey":"missingKey",f,d,a,Q?A:y),r){const O=this.resolve(a,{...o,keySeparator:!1});O&&O.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let X=[];const te=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&te&&te[0])for(let O=0;O<te.length;O++)X.push(te[O]);else this.options.saveMissingTo==="all"?X=this.languageUtils.toResolveHierarchy(o.lng||this.language):X.push(o.lng||this.language);const J=(O,U,H)=>{var de;const re=P&&H!==y?H:$;this.options.missingKeyHandler?this.options.missingKeyHandler(O,d,U,re,Q,o):(de=this.backendConnector)!=null&&de.saveMissing&&this.backendConnector.saveMissing(O,d,U,re,Q,o),this.emit("missingKey",O,d,U,y)};this.options.saveMissing&&(this.options.saveMissingPlurals&&C?X.forEach(O=>{const U=this.pluralResolver.getSuffixes(O,o);j&&o[`defaultValue${this.options.pluralSeparator}zero`]&&U.indexOf(`${this.options.pluralSeparator}zero`)<0&&U.push(`${this.options.pluralSeparator}zero`),U.forEach(H=>{J([O],a+H,o[`defaultValue${H}`]||A)})}):J(X,a,A))}y=this.extendTranslation(y,e,o,g,i),F&&y===a&&this.options.appendNamespaceToMissingKey&&(y=`${d}${p}${a}`),(F||L)&&this.options.parseMissingKeyHandler&&(y=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${d}${p}${a}`:a,L?y:void 0,o))}return s?(g.res=y,g.usedParams=this.getUsedParamsDetails(o),g):y}extendTranslation(e,n,i,o,s){var c,d;if((c=this.i18nFormat)!=null&&c.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...i},i.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init({...i,interpolation:{...this.options.interpolation,...i.interpolation}});const p=ce(e)&&(((d=i==null?void 0:i.interpolation)==null?void 0:d.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let f;if(p){const g=e.match(this.interpolator.nestingRegexp);f=g&&g.length}let h=i.replace&&!ce(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(h={...this.options.interpolation.defaultVariables,...h}),e=this.interpolator.interpolate(e,h,i.lng||this.language||o.usedLng,i),p){const g=e.match(this.interpolator.nestingRegexp),y=g&&g.length;f<y&&(i.nest=!1)}!i.lng&&o&&o.res&&(i.lng=this.language||o.usedLng),i.nest!==!1&&(e=this.interpolator.nest(e,(...g)=>(s==null?void 0:s[0])===g[0]&&!i.context?(this.logger.warn(`It seems you are nesting recursively key: ${g[0]} in key: ${n[0]}`),null):this.translate(...g,n),i)),i.interpolation&&this.interpolator.reset()}const r=i.postProcess||this.options.postProcess,a=ce(r)?[r]:r;return e!=null&&(a!=null&&a.length)&&i.applyPostProcessor!==!1&&(e=xd.handle(a,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(i)},...i}:i,this)),e}resolve(e,n={}){let i,o,s,r,a;return ce(e)&&(e=[e]),e.forEach(c=>{if(this.isValidLookup(i))return;const d=this.extractFromKey(c,n),p=d.key;o=p;let f=d.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const h=n.count!==void 0&&!ce(n.count),g=h&&!n.ordinal&&n.count===0,y=n.context!==void 0&&(ce(n.context)||typeof n.context=="number")&&n.context!=="",_=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(v=>{var x,E;this.isValidLookup(i)||(a=v,!rl[`${_[0]}-${v}`]&&((x=this.utils)!=null&&x.hasLoadedNamespace)&&!((E=this.utils)!=null&&E.hasLoadedNamespace(a))&&(rl[`${_[0]}-${v}`]=!0,this.logger.warn(`key "${o}" for languages "${_.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),_.forEach(w=>{var k;if(this.isValidLookup(i))return;r=w;const C=[p];if((k=this.i18nFormat)!=null&&k.addLookupKeys)this.i18nFormat.addLookupKeys(C,p,w,v,n);else{let I;h&&(I=this.pluralResolver.getSuffix(w,n.count,n));const j=`${this.options.pluralSeparator}zero`,A=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(h&&(n.ordinal&&I.indexOf(A)===0&&C.push(p+I.replace(A,this.options.pluralSeparator)),C.push(p+I),g&&C.push(p+j)),y){const R=`${p}${this.options.contextSeparator||"_"}${n.context}`;C.push(R),h&&(n.ordinal&&I.indexOf(A)===0&&C.push(R+I.replace(A,this.options.pluralSeparator)),C.push(R+I),g&&C.push(R+j))}}let P;for(;P=C.pop();)this.isValidLookup(i)||(s=P,i=this.getResource(w,v,P,n))}))})}),{res:i,usedKey:o,exactUsedKey:s,usedLng:r,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,i,o={}){var s;return(s=this.i18nFormat)!=null&&s.getResource?this.i18nFormat.getResource(e,n,i,o):this.resourceStore.getResource(e,n,i,o)}getUsedParamsDetails(e={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=e.replace&&!ce(e.replace);let o=i?e.replace:e;if(i&&typeof e.count<"u"&&(o.count=e.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!i){o={...o};for(const s of n)delete o[s]}return o}static hasDefaultValue(e){const n="defaultValue";for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&n===i.substring(0,n.length)&&e[i]!==void 0)return!0;return!1}}class al{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=jt.create("languageUtils")}getScriptPartFromCode(e){if(e=ho(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=ho(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(ce(e)&&e.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(i=>{if(n)return;const o=this.formatLanguageCode(i);(!this.options.supportedLngs||this.isSupportedCode(o))&&(n=o)}),!n&&this.options.supportedLngs&&e.forEach(i=>{if(n)return;const o=this.getScriptPartFromCode(i);if(this.isSupportedCode(o))return n=o;const s=this.getLanguagePartFromCode(i);if(this.isSupportedCode(s))return n=s;n=this.options.supportedLngs.find(r=>{if(r===s)return r;if(!(r.indexOf("-")<0&&s.indexOf("-")<0)&&(r.indexOf("-")>0&&s.indexOf("-")<0&&r.substring(0,r.indexOf("-"))===s||r.indexOf(s)===0&&s.length>1))return r})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),ce(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let i=e[n];return i||(i=e[this.getScriptPartFromCode(n)]),i||(i=e[this.formatLanguageCode(n)]),i||(i=e[this.getLanguagePartFromCode(n)]),i||(i=e.default),i||[]}toResolveHierarchy(e,n){const i=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),o=[],s=r=>{r&&(this.isSupportedCode(r)?o.push(r):this.logger.warn(`rejecting language code not found in supportedLngs: ${r}`))};return ce(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):ce(e)&&s(this.formatLanguageCode(e)),i.forEach(r=>{o.indexOf(r)<0&&s(this.formatLanguageCode(r))}),o}}const ll={zero:0,one:1,two:2,few:3,many:4,other:5},cl={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Eh{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=jt.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){const i=ho(e==="dev"?"en":e),o=n.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:i,type:o});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let r;try{r=new Intl.PluralRules(i,{type:o})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),cl;if(!e.match(/-|_/))return cl;const c=this.languageUtils.getLanguagePartFromCode(e);r=this.getRule(c,n)}return this.pluralRulesCache[s]=r,r}needsPlural(e,n={}){let i=this.getRule(e,n);return i||(i=this.getRule("dev",n)),(i==null?void 0:i.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,n,i={}){return this.getSuffixes(e,i).map(o=>`${n}${o}`)}getSuffixes(e,n={}){let i=this.getRule(e,n);return i||(i=this.getRule("dev",n)),i?i.resolvedOptions().pluralCategories.sort((o,s)=>ll[o]-ll[s]).map(o=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(e,n,i={}){const o=this.getRule(e,i);return o?`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${o.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,i))}}const ul=(t,e,n,i=".",o=!0)=>{let s=hh(t,e,n);return!s&&o&&ce(n)&&(s=Tr(t,n,i),s===void 0&&(s=Tr(e,n,i))),s},Qs=t=>t.replace(/\$/g,"$$$$");class dl{constructor(e={}){var n;this.logger=jt.create("interpolator"),this.options=e,this.format=((n=e==null?void 0:e.interpolation)==null?void 0:n.format)||(i=>i),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:i,useRawValueToEscape:o,prefix:s,prefixEscaped:r,suffix:a,suffixEscaped:c,formatSeparator:d,unescapeSuffix:p,unescapePrefix:f,nestingPrefix:h,nestingPrefixEscaped:g,nestingSuffix:y,nestingSuffixEscaped:_,nestingOptionsSeparator:v,maxReplaces:x,alwaysFormat:E}=e.interpolation;this.escape=n!==void 0?n:yh,this.escapeValue=i!==void 0?i:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=s?Mn(s):r||"{{",this.suffix=a?Mn(a):c||"}}",this.formatSeparator=d||",",this.unescapePrefix=p?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=h?Mn(h):g||Mn("$t("),this.nestingSuffix=y?Mn(y):_||Mn(")"),this.nestingOptionsSeparator=v||",",this.maxReplaces=x||1e3,this.alwaysFormat=E!==void 0?E:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,i)=>(n==null?void 0:n.source)===i?(n.lastIndex=0,n):new RegExp(i,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,n,i,o){var g;let s,r,a;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=y=>{if(y.indexOf(this.formatSeparator)<0){const E=ul(n,c,y,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(E,void 0,i,{...o,...n,interpolationkey:y}):E}const _=y.split(this.formatSeparator),v=_.shift().trim(),x=_.join(this.formatSeparator).trim();return this.format(ul(n,c,v,this.options.keySeparator,this.options.ignoreJSONStructure),x,i,{...o,...n,interpolationkey:v})};this.resetRegExp();const p=(o==null?void 0:o.missingInterpolationHandler)||this.options.missingInterpolationHandler,f=((g=o==null?void 0:o.interpolation)==null?void 0:g.skipOnVariables)!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:y=>Qs(y)},{regex:this.regexp,safeValue:y=>this.escapeValue?Qs(this.escape(y)):Qs(y)}].forEach(y=>{for(a=0;s=y.regex.exec(e);){const _=s[1].trim();if(r=d(_),r===void 0)if(typeof p=="function"){const x=p(e,s,o);r=ce(x)?x:""}else if(o&&Object.prototype.hasOwnProperty.call(o,_))r="";else if(f){r=s[0];continue}else this.logger.warn(`missed to pass in variable ${_} for interpolating ${e}`),r="";else!ce(r)&&!this.useRawValueToEscape&&(r=tl(r));const v=y.safeValue(r);if(e=e.replace(s[0],v),f?(y.regex.lastIndex+=r.length,y.regex.lastIndex-=s[0].length):y.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,n,i={}){let o,s,r;const a=(c,d)=>{const p=this.nestingOptionsSeparator;if(c.indexOf(p)<0)return c;const f=c.split(new RegExp(`${Mn(p)}[ ]*{`));let h=`{${f[1]}`;c=f[0],h=this.interpolate(h,r);const g=h.match(/'/g),y=h.match(/"/g);(((g==null?void 0:g.length)??0)%2===0&&!y||((y==null?void 0:y.length)??0)%2!==0)&&(h=h.replace(/'/g,'"'));try{r=JSON.parse(h),d&&(r={...d,...r})}catch(_){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,_),`${c}${p}${h}`}return r.defaultValue&&r.defaultValue.indexOf(this.prefix)>-1&&delete r.defaultValue,c};for(;o=this.nestingRegexp.exec(e);){let c=[];r={...i},r=r.replace&&!ce(r.replace)?r.replace:r,r.applyPostProcessor=!1,delete r.defaultValue;const d=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(d!==-1&&(c=o[1].slice(d).split(this.formatSeparator).map(p=>p.trim()).filter(Boolean),o[1]=o[1].slice(0,d)),s=n(a.call(this,o[1].trim(),r),r),s&&o[0]===e&&!ce(s))return s;ce(s)||(s=tl(s)),s||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${e}`),s=""),c.length&&(s=c.reduce((p,f)=>this.format(p,f,i.lng,{...i,interpolationkey:o[1].trim()}),s.trim())),e=e.replace(o[0],s),this.regexp.lastIndex=0}return e}}const wh=t=>{let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const i=t.split("(");e=i[0].toLowerCase().trim();const o=i[1].substring(0,i[1].length-1);e==="currency"&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):e==="relativetime"&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach(r=>{if(r){const[a,...c]=r.split(":"),d=c.join(":").trim().replace(/^'+|'+$/g,""),p=a.trim();n[p]||(n[p]=d),d==="false"&&(n[p]=!1),d==="true"&&(n[p]=!0),isNaN(d)||(n[p]=parseInt(d,10))}})}return{formatName:e,formatOptions:n}},pl=t=>{const e={};return(n,i,o)=>{let s=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(s={...s,[o.interpolationkey]:void 0});const r=i+JSON.stringify(s);let a=e[r];return a||(a=t(ho(i),o),e[r]=a),a(n)}},Ch=t=>(e,n,i)=>t(ho(n),i)(e);class Dh{constructor(e={}){this.logger=jt.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const i=n.cacheInBuiltFormats?pl:Ch;this.formats={number:i((o,s)=>{const r=new Intl.NumberFormat(o,{...s});return a=>r.format(a)}),currency:i((o,s)=>{const r=new Intl.NumberFormat(o,{...s,style:"currency"});return a=>r.format(a)}),datetime:i((o,s)=>{const r=new Intl.DateTimeFormat(o,{...s});return a=>r.format(a)}),relativetime:i((o,s)=>{const r=new Intl.RelativeTimeFormat(o,{...s});return a=>r.format(a,s.range||"day")}),list:i((o,s)=>{const r=new Intl.ListFormat(o,{...s});return a=>r.format(a)})}}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=pl(n)}format(e,n,i,o={}){const s=n.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(a=>a.indexOf(")")>-1)){const a=s.findIndex(c=>c.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,a)].join(this.formatSeparator)}return s.reduce((a,c)=>{var f;const{formatName:d,formatOptions:p}=wh(c);if(this.formats[d]){let h=a;try{const g=((f=o==null?void 0:o.formatParams)==null?void 0:f[o.interpolationkey])||{},y=g.locale||g.lng||o.locale||o.lng||i;h=this.formats[d](a,y,{...p,...o,...g})}catch(g){this.logger.warn(g)}return h}else this.logger.warn(`there was no format function for ${d}`);return a},e)}}const Th=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class Ah extends ps{constructor(e,n,i,o={}){var s,r;super(),this.backend=e,this.store=n,this.services=i,this.languageUtils=i.languageUtils,this.options=o,this.logger=jt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],(r=(s=this.backend)==null?void 0:s.init)==null||r.call(s,i,o.backend,o)}queueLoad(e,n,i,o){const s={},r={},a={},c={};return e.forEach(d=>{let p=!0;n.forEach(f=>{const h=`${d}|${f}`;!i.reload&&this.store.hasResourceBundle(d,f)?this.state[h]=2:this.state[h]<0||(this.state[h]===1?r[h]===void 0&&(r[h]=!0):(this.state[h]=1,p=!1,r[h]===void 0&&(r[h]=!0),s[h]===void 0&&(s[h]=!0),c[f]===void 0&&(c[f]=!0)))}),p||(a[d]=!0)}),(Object.keys(s).length||Object.keys(r).length)&&this.queue.push({pending:r,pendingCount:Object.keys(r).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(s),pending:Object.keys(r),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(c)}}loaded(e,n,i){const o=e.split("|"),s=o[0],r=o[1];n&&this.emit("failedLoading",s,r,n),!n&&i&&this.store.addResourceBundle(s,r,i,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&i&&(this.state[e]=0);const a={};this.queue.forEach(c=>{fh(c.loaded,[s],r),Th(c,e),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(d=>{a[d]||(a[d]={});const p=c.loaded[d];p.length&&p.forEach(f=>{a[d][f]===void 0&&(a[d][f]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(c=>!c.done)}read(e,n,i,o=0,s=this.retryTimeout,r){if(!e.length)return r(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:i,tried:o,wait:s,callback:r});return}this.readingCalls++;const a=(d,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(d&&p&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,i,o+1,s*2,r)},s);return}r(d,p)},c=this.backend[i].bind(this.backend);if(c.length===2){try{const d=c(e,n);d&&typeof d.then=="function"?d.then(p=>a(null,p)).catch(a):a(null,d)}catch(d){a(d)}return}return c(e,n,a)}prepareLoading(e,n,i={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();ce(e)&&(e=this.languageUtils.toResolveHierarchy(e)),ce(n)&&(n=[n]);const s=this.queueLoad(e,n,i,o);if(!s.toLoad.length)return s.pending.length||o(),null;s.toLoad.forEach(r=>{this.loadOne(r)})}load(e,n,i){this.prepareLoading(e,n,{},i)}reload(e,n,i){this.prepareLoading(e,n,{reload:!0},i)}loadOne(e,n=""){const i=e.split("|"),o=i[0],s=i[1];this.read(o,s,"read",void 0,void 0,(r,a)=>{r&&this.logger.warn(`${n}loading namespace ${s} for language ${o} failed`,r),!r&&a&&this.logger.log(`${n}loaded namespace ${s} for language ${o}`,a),this.loaded(e,r,a)})}saveMissing(e,n,i,o,s,r={},a=()=>{}){var c,d,p,f,h;if((d=(c=this.services)==null?void 0:c.utils)!=null&&d.hasLoadedNamespace&&!((f=(p=this.services)==null?void 0:p.utils)!=null&&f.hasLoadedNamespace(n))){this.logger.warn(`did not save key "${i}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(i==null||i==="")){if((h=this.backend)!=null&&h.create){const g={...r,isUpdate:s},y=this.backend.create.bind(this.backend);if(y.length<6)try{let _;y.length===5?_=y(e,n,i,o,g):_=y(e,n,i,o),_&&typeof _.then=="function"?_.then(v=>a(null,v)).catch(a):a(null,_)}catch(_){a(_)}else y(e,n,i,o,a,g)}!e||!e[0]||this.store.addResource(e[0],n,i,o)}}}const Xs=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),ce(t[1])&&(e.defaultValue=t[1]),ce(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(i=>{e[i]=n[i]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),ml=t=>{var e,n;return ce(t.ns)&&(t.ns=[t.ns]),ce(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),ce(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),((n=(e=t.supportedLngs)==null?void 0:e.indexOf)==null?void 0:n.call(e,"cimode"))<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t},Po=()=>{},kh=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};let fl=!1;const Ph=t=>{var e,n,i,o,s,r,a,c,d;return!!(((i=(n=(e=t==null?void 0:t.modules)==null?void 0:e.backend)==null?void 0:n.name)==null?void 0:i.indexOf("Locize"))>0||((a=(r=(s=(o=t==null?void 0:t.modules)==null?void 0:o.backend)==null?void 0:s.constructor)==null?void 0:r.name)==null?void 0:a.indexOf("Locize"))>0||(d=(c=t==null?void 0:t.options)==null?void 0:c.backend)!=null&&d.backends&&t.options.backend.backends.some(p=>{var f,h,g;return((f=p==null?void 0:p.name)==null?void 0:f.indexOf("Locize"))>0||((g=(h=p==null?void 0:p.constructor)==null?void 0:h.name)==null?void 0:g.indexOf("Locize"))>0}))};class oo extends ps{constructor(e={},n){if(super(),this.options=ml(e),this.services={},this.logger=jt,this.modules={external:[]},kh(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(e={},n){this.isInitializing=!0,typeof e=="function"&&(n=e,e={}),e.defaultNS==null&&e.ns&&(ce(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const i=Xs();this.options={...i,...this.options,...ml(e)},this.options.interpolation={...i.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=i.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!Ph(this)&&!fl&&(typeof console<"u"&&typeof console.info<"u"&&console.info("🌐 i18next is maintained with support from Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"),fl=!0);const o=d=>d?typeof d=="function"?new d:d:null;if(!this.options.isClone){this.modules.logger?jt.init(o(this.modules.logger),this.options):jt.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:d=Dh;const p=new al(this.options);this.store=new sl(this.options.resources,this.options);const f=this.services;f.logger=jt,f.resourceStore=this.store,f.languageUtils=p,f.pluralResolver=new Eh(p,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==i.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),d&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=o(d),f.formatter.init&&f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new dl(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new Ah(o(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",(g,...y)=>{this.emit(g,...y)}),this.modules.languageDetector&&(f.languageDetector=o(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=o(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new ts(this.services,this.options),this.translator.on("*",(g,...y)=>{this.emit(g,...y)}),this.modules.external.forEach(g=>{g.init&&g.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Po),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(d=>{this[d]=(...p)=>this.store[d](...p)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=(...p)=>(this.store[d](...p),this)});const a=Hi(),c=()=>{const d=(p,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(f),n(p,f)};if(this.languages&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),a}loadResources(e,n=Po){var s,r;let i=n;const o=ce(e)?e:this.language;if(typeof e=="function"&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if((o==null?void 0:o.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return i();const a=[],c=d=>{if(!d||d==="cimode")return;this.services.languageUtils.toResolveHierarchy(d).forEach(f=>{f!=="cimode"&&a.indexOf(f)<0&&a.push(f)})};o?c(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(p=>c(p)),(r=(s=this.options.preload)==null?void 0:s.forEach)==null||r.call(s,d=>c(d)),this.services.backendConnector.load(a,this.options.ns,d=>{!d&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),i(d)})}else i(null)}reloadResources(e,n,i){const o=Hi();return typeof e=="function"&&(i=e,e=void 0),typeof n=="function"&&(i=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),i||(i=Po),this.services.backendConnector.reload(e,n,s=>{o.resolve(),i(s)}),o}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&xd.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let n=0;n<this.languages.length;n++){const i=this.languages[n];if(!(["cimode","dev"].indexOf(i)>-1)&&this.store.hasLanguageSomeTranslations(i)){this.resolvedLanguage=i;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,n){this.isLanguageChangingTo=e;const i=Hi();this.emit("languageChanging",e);const o=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},s=(a,c)=>{c?this.isLanguageChangingTo===e&&(o(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,i.resolve((...d)=>this.t(...d)),n&&n(a,(...d)=>this.t(...d))},r=a=>{var p,f;!e&&!a&&this.services.languageDetector&&(a=[]);const c=ce(a)?a:a&&a[0],d=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(ce(a)?[a]:a);d&&(this.language||o(d),this.translator.language||this.translator.changeLanguage(d),(f=(p=this.services.languageDetector)==null?void 0:p.cacheUserLanguage)==null||f.call(p,d)),this.loadResources(d,h=>{s(h,d)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?r(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(r):this.services.languageDetector.detect(r):r(e),i}getFixedT(e,n,i){const o=(s,r,...a)=>{let c;typeof r!="object"?c=this.options.overloadTranslationOptionHandler([s,r].concat(a)):c={...r},c.lng=c.lng||o.lng,c.lngs=c.lngs||o.lngs,c.ns=c.ns||o.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||i||o.keyPrefix);const d=this.options.keySeparator||".";let p;return c.keyPrefix&&Array.isArray(s)?p=s.map(f=>(typeof f=="function"&&(f=Ar(f,{...this.options,...r})),`${c.keyPrefix}${d}${f}`)):(typeof s=="function"&&(s=Ar(s,{...this.options,...r})),p=c.keyPrefix?`${c.keyPrefix}${d}${s}`:s),this.t(p,c)};return ce(e)?o.lng=e:o.lngs=e,o.ns=n,o.keyPrefix=i,o}t(...e){var n;return(n=this.translator)==null?void 0:n.translate(...e)}exists(...e){var n;return(n=this.translator)==null?void 0:n.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const i=n.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return!0;const r=(a,c)=>{const d=this.services.backendConnector.state[`${a}|${c}`];return d===-1||d===0||d===2};if(n.precheck){const a=n.precheck(this,r);if(a!==void 0)return a}return!!(this.hasResourceBundle(i,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||r(i,e)&&(!o||r(s,e)))}loadNamespaces(e,n){const i=Hi();return this.options.ns?(ce(e)&&(e=[e]),e.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{i.resolve(),n&&n(o)}),i):(n&&n(),Promise.resolve())}loadLanguages(e,n){const i=Hi();ce(e)&&(e=[e]);const o=this.options.preload||[],s=e.filter(r=>o.indexOf(r)<0&&this.services.languageUtils.isSupportedCode(r));return s.length?(this.options.preload=o.concat(s),this.loadResources(r=>{i.resolve(),n&&n(r)}),i):(n&&n(),Promise.resolve())}dir(e){var o,s;if(e||(e=this.resolvedLanguage||(((o=this.languages)==null?void 0:o.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const r=new Intl.Locale(e);if(r&&r.getTextInfo){const a=r.getTextInfo();if(a&&a.direction)return a.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],i=((s=this.services)==null?void 0:s.languageUtils)||new al(Xs());return e.toLowerCase().indexOf("-latn")>1?"ltr":n.indexOf(i.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},n){const i=new oo(e,n);return i.createInstance=oo.createInstance,i}cloneInstance(e={},n=Po){const i=e.forkResourceStore;i&&delete e.forkResourceStore;const o={...this.options,...e,isClone:!0},s=new oo(o);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(a=>{s[a]=this[a]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},i){const a=Object.keys(this.store.data).reduce((c,d)=>(c[d]={...this.store.data[d]},c[d]=Object.keys(c[d]).reduce((p,f)=>(p[f]={...c[d][f]},p),c[d]),c),{});s.store=new sl(a,o),s.services.resourceStore=s.store}if(e.interpolation){const c={...Xs().interpolation,...this.options.interpolation,...e.interpolation},d={...o,interpolation:c};s.services.interpolator=new dl(d)}return s.translator=new ts(s.services,o),s.translator.on("*",(a,...c)=>{s.emit(a,...c)}),s.init(o,n),s.translator.options=o,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Qe=oo.createInstance();Qe.createInstance;Qe.dir;Qe.init;Qe.loadResources;Qe.reloadResources;Qe.use;Qe.changeLanguage;Qe.getFixedT;Qe.t;Qe.exists;Qe.setDefaultNamespace;Qe.hasLoadedNamespace;Qe.loadNamespaces;Qe.loadLanguages;const Ih=(t,e,n,i)=>{var s,r,a,c;const o=[n,{code:e,...i||{}}];if((r=(s=t==null?void 0:t.services)==null?void 0:s.logger)!=null&&r.forward)return t.services.logger.forward(o,"warn","react-i18next::",!0);Zn(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),(c=(a=t==null?void 0:t.services)==null?void 0:a.logger)!=null&&c.warn?t.services.logger.warn(...o):console!=null&&console.warn&&console.warn(...o)},hl={},Ed=(t,e,n,i)=>{Zn(n)&&hl[n]||(Zn(n)&&(hl[n]=new Date),Ih(t,e,n,i))},wd=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}},kr=(t,e,n)=>{t.loadNamespaces(e,wd(t,n))},gl=(t,e,n,i)=>{if(Zn(n)&&(n=[n]),t.options.preload&&t.options.preload.indexOf(e)>-1)return kr(t,n,i);n.forEach(o=>{t.options.ns.indexOf(o)<0&&t.options.ns.push(o)}),t.loadLanguages(e,wd(t,i))},Rh=(t,e,n={})=>!e.languages||!e.languages.length?(Ed(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:n.lng,precheck:(i,o)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!o(i.isLanguageChangingTo,t))return!1}}),Zn=t=>typeof t=="string",Mh=t=>typeof t=="object"&&t!==null,Vh=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Lh={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Oh=t=>Lh[t],jh=t=>t.replace(Vh,Oh);let Pr={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:jh,transDefaultProps:void 0};const Fh=(t={})=>{Pr={...Pr,...t}},qh=()=>Pr;let Cd;const Uh=t=>{Cd=t},$h=()=>Cd,Bh={type:"3rdParty",init(t){Fh(t.options.react),Uh(t)}},Gh=b.createContext();class Hh{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var Dd={exports:{}},Td={};/**
 * @license React
 * use-sync-external-store-shim.development.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(){function t(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}function e(g,y){p||o.startTransition===void 0||(p=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var _=y();if(!f){var v=y();s(_,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}v=r({inst:{value:_,getSnapshot:y}});var x=v[0].inst,E=v[1];return c(function(){x.value=_,x.getSnapshot=y,n(x)&&E({inst:x})},[g,_,y]),a(function(){return n(x)&&E({inst:x}),g(function(){n(x)&&E({inst:x})})},[g]),d(_),_}function n(g){var y=g.getSnapshot;g=g.value;try{var _=y();return!s(g,_)}catch{return!0}}function i(g,y){return y()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=b,s=typeof Object.is=="function"?Object.is:t,r=o.useState,a=o.useEffect,c=o.useLayoutEffect,d=o.useDebugValue,p=!1,f=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?i:e;Td.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})();Dd.exports=Td;var Kh=Dd.exports;const Jh=(t,e)=>Zn(e)?e:Mh(e)&&Zn(e.defaultValue)?e.defaultValue:Array.isArray(t)?t[t.length-1]:t,Wh={t:Jh,ready:!1},zh=()=>()=>{},ni=(t,e={})=>{var A,R,q;const{i18n:n}=e,{i18n:i,defaultNS:o}=b.useContext(Gh)||{},s=n||i||$h();s&&!s.reportNamespaces&&(s.reportNamespaces=new Hh),s||Ed(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const r=b.useMemo(()=>{var G;return{...qh(),...(G=s==null?void 0:s.options)==null?void 0:G.react,...e}},[s,e]),{useSuspense:a,keyPrefix:c}=r,d=o||((A=s==null?void 0:s.options)==null?void 0:A.defaultNS),p=Zn(d)?[d]:d||["translation"],f=b.useMemo(()=>p,p);(q=(R=s==null?void 0:s.reportNamespaces)==null?void 0:R.addUsedNamespaces)==null||q.call(R,f);const h=b.useRef(0),g=b.useCallback(G=>{if(!s)return zh;const{bindI18n:L,bindI18nStore:F}=r,T=()=>{h.current+=1,G()};return L&&s.on(L,T),F&&s.store.on(F,T),()=>{L&&L.split(" ").forEach($=>s.off($,T)),F&&F.split(" ").forEach($=>s.store.off($,T))}},[s,r]),y=b.useRef(),_=b.useCallback(()=>{if(!s)return Wh;const G=!!(s.isInitialized||s.initializedStoreOnce)&&f.every(X=>Rh(X,s,r)),L=e.lng||s.language,F=h.current,T=y.current;if(T&&T.ready===G&&T.lng===L&&T.keyPrefix===c&&T.revision===F)return T;const Q={t:s.getFixedT(L,r.nsMode==="fallback"?f:f[0],c),ready:G,lng:L,keyPrefix:c,revision:F};return y.current=Q,Q},[s,f,c,r,e.lng]),[v,x]=b.useState(0),{t:E,ready:w}=Kh.useSyncExternalStore(g,_,_);b.useEffect(()=>{if(s&&!w&&!a){const G=()=>x(L=>L+1);e.lng?gl(s,e.lng,f,G):kr(s,f,G)}},[s,e.lng,f,w,a,v]);const C=s||{},P=b.useRef(null),k=b.useRef(),I=G=>{const L=Object.getOwnPropertyDescriptors(G);L.__original&&delete L.__original;const F=Object.create(Object.getPrototypeOf(G),L);if(!Object.prototype.hasOwnProperty.call(F,"__original"))try{Object.defineProperty(F,"__original",{value:G,writable:!1,enumerable:!1,configurable:!1})}catch{}return F},j=b.useMemo(()=>{const G=C,L=G==null?void 0:G.language;let F=G;G&&(P.current&&P.current.__original===G?k.current!==L?(F=I(G),P.current=F,k.current=L):F=P.current:(F=I(G),P.current=F,k.current=L));const T=[E,F,w];return T.t=E,T.i18n=F,T.ready=w,T},[E,C,w,C.resolvedLanguage,C.language,C.languages]);if(s&&a&&!w)throw new Promise(G=>{const L=()=>G();e.lng?gl(s,e.lng,f,L):kr(s,f,L)});return j},so="/api",jI=t=>{if(!t)return"";if(t.startsWith("http")||t.startsWith("data:"))return t;const e=so.endsWith("/")?so.slice(0,-1):so;return t.startsWith("/materials")?`${e}${t}`:t.startsWith("/")?`${e}${t}`:`${e}/${t}`},Io=async(t,e,n)=>{const i=`${so}${e}`,o=localStorage.getItem("token"),s={method:t,headers:{"Content-Type":"application/json",...o?{Authorization:`Bearer ${o}`}:{}}};n&&(s.body=JSON.stringify(n));try{console.log(`📡 [API] ${t} ${i}`,n||"");const r=await fetch(i,s);if(!r.ok)throw console.error(`❌ [API] ${t} ${i} Error ${r.status}: ${r.statusText}`),new Error(`API error: ${r.status} ${r.statusText}`);const a=await r.json();return console.log(`✅ [API] ${t} ${i} Success`,a),a}catch(r){return r.name==="TypeError"&&r.message==="Failed to fetch"?console.error(`🚨 [API] NETWORK ERROR: backend at ${so} is unreachable. Is the server running?`):console.error(`❌ [API] ${t} ${i} failed:`,r),t==="GET"?e.includes("/")?null:[]:{success:!1,error:r}}},Le={get:t=>Io("GET",t),post:(t,e)=>Io("POST",t,e),put:(t,e)=>Io("PUT",t,e),delete:t=>Io("DELETE",t)},FI=(t,e,n)=>Le.post("/upload",{image:t,folder:e,fileName:n}),Ad=b.createContext(void 0),Ut=()=>{const t=b.useContext(Ad);if(t===void 0)throw new Error("useAuth must be used within AuthProvider");return t},Yh=({children:t})=>{const[e,n]=b.useState(null),[i,o]=b.useState(!0);b.useEffect(()=>{const p=localStorage.getItem("user"),f=localStorage.getItem("token");if(p&&f)try{n(JSON.parse(p))}catch{localStorage.removeItem("user"),localStorage.removeItem("token")}o(!1)},[]);const s=async(p,f)=>{try{const h=await Le.post("/auth/login",{email:p,password:f});if(h&&h.user&&h.token)localStorage.setItem("user",JSON.stringify(h.user)),localStorage.setItem("token",h.token),n(h.user);else throw new Error((h==null?void 0:h.message)||"Authentication failed")}catch(h){throw console.error("Login failed:",h),h}},r=async()=>{try{await Le.post("/auth/logout",{})}catch{console.warn("Logout API call failed")}localStorage.removeItem("token"),localStorage.removeItem("user"),n(null)},a=async p=>{if(e)try{if((await Le.put(`/users/${e.id}`,p)).success){const h={...e,...p};n(h),localStorage.setItem("user",JSON.stringify(h))}}catch(f){console.error("Update profile failed:",f)}},c=async p=>{await Le.post("/auth/register",p)},d=ue.useMemo(()=>({user:e,login:s,logout:r,isAuthenticated:!!e,loading:i,updateProfile:a,addUser:c}),[e,i]);return m.jsxDEV(Ad.Provider,{value:d,children:!i&&t},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/AuthContext.tsx",lineNumber:113,columnNumber:5},void 0)},ge=t=>({get:(e=0,n=1e3)=>Le.get(`/${t}?page=${e}&limit=${n}`),create:e=>Le.post(`/${t}`,e),update:(e,n)=>Le.put(`/${t}/${e}`,n),delete:e=>Le.delete(`/${t}/${e}`)}),Qh=()=>Le.get("/settings"),Ki=(t,e)=>Le.put(`/settings/${t}`,{value:e}),ms=ge("customers"),Xh=ms.get,Zh=ms.create,eg=ms.update,tg=ms.delete,fs=ge("orders"),ng=fs.get,ig=fs.create,ii=fs.update,og=fs.delete,hs=ge("suppliers"),sg=hs.get,rg=hs.create,ag=hs.update,lg=hs.delete,gs=ge("materials"),cg=gs.get,ug=gs.create,dg=gs.update,pg=gs.delete,ys=ge("employees"),mg=ys.get,fg=ys.create,hg=ys.update,gg=ys.delete,vs=ge("paper-types"),yg=vs.get,vg=vs.create,bg=vs.update,_g=vs.delete,bs=ge("finishing-options"),Ng=bs.get,xg=bs.create,Sg=bs.update,Eg=bs.delete,_s=ge("printing-options"),wg=_s.get,Cg=_s.create,Dg=_s.update,Tg=_s.delete,Ns=ge("chatbots"),Ag=Ns.get,kg=Ns.create,Pg=Ns.update,Ig=Ns.delete,xs=ge("expenses"),Rg=xs.get,Mg=xs.create,Vg=xs.update,Lg=xs.delete,aa=ge("delivery-notes"),kd=aa.get,Pd=aa.create,Id=aa.update,Ss=ge("machines"),Og=Ss.get,jg=Ss.create,Fg=Ss.update,qg=Ss.delete,la=ge("warehouses"),Ug=la.get,$g=la.create,Bg=la.update,Es=ge("accounts"),Gg=Es.get,Hg=Es.create,Kg=Es.update,Jg=Es.delete,ws=ge("roles"),Wg=ws.get,zg=ws.create,Yg=ws.update,Qg=ws.delete,Rd=ge("budgets"),Xg=Rd.get,Zg=Rd.create,ca=ge("partners"),ey=ca.get,ty=ca.create,ny=ca.update,Md=ge("capital-contributions"),iy=Md.get,oy=Md.create,Vd=ge("attendance-records"),sy=Vd.get,ry=Vd.create,Ld=ge("biometric-credentials"),ay=Ld.get,ly=Ld.create,Od=ge("quotations"),cy=Od.get,uy=Od.create,jd=ge("commission-persons"),dy=jd.get,Fd=jd.create,py=ge("maintenance-tasks"),my=py.get,fy=ge("machine-logs"),hy=fy.get,gy=ge("inventory/stock"),yy=gy.get,qd=ge("inventory/transactions"),vy=qd.get,by=qd.create,Ud=ge("customer-monitor-notes"),_y=Ud.get,Ny=Ud.create,$d=ge("quality-checks"),xy=$d.get,Sy=$d.create,Cs=ge("fixed-assets"),Ey=Cs.get,wy=Cs.create,Cy=Cs.update,Dy=Cs.delete,Ds=ge("liabilities"),Ty=Ds.get,Ay=Ds.create,ky=Ds.update,Py=Ds.delete,Ts=ge("plates"),Iy=Ts.get,Ry=Ts.create,My=Ts.update,Vy=Ts.delete,As=ge("finishing-blocks"),Ly=As.get,Oy=As.create,jy=As.update,Fy=As.delete,ua=ge("cheques"),qy=ua.get,Uy=ua.create,$y=ua.update,By=ge("accounting-entries"),Gy=By.get,Bd=ge("purchase-orders"),Hy=Bd.get,Ky=Bd.update,Jy=ge("payments"),Wy=Jy.get,Gd=ge("distributions"),zy=Gd.get,Yy=Gd.create,Qy=ge("credit-notes"),Xy=Qy.get,Zy=ge("audit-logs"),ev=Zy.get,tv=ge("recurring-invoices"),nv=tv.get,iv=(t,e)=>Le.post("/rpc/update-document-template",{type:t,settings:e}),ov=(t,e,n)=>Le.post("/rpc/update-sst-percentage",{percentage:t,effectiveDate:e,notes:n}),sv=t=>Le.post("/production-steps",t),oi=(t,e)=>Le.put(`/production-steps/${t}`,e),rv=t=>Le.delete(`/production-steps/${t}`),av=t=>Le.post("/payments",t),lv=(t,e,n)=>Le.post("/rpc/update-customer-stats",{customerId:t,amount:e,ordersAdded:n}),cv=(t,e,n)=>Le.post("/rpc/create-journal-entry",{description:t,date:e,lines:n}),uv=cv,dv=(t,e)=>Le.post("/rpc/decrement-paper-stock",{p_id:t,p_qty:e}),pv=()=>ye({queryKey:["warehouses"],queryFn:async()=>{const t=await Ug();return Array.isArray(t)?t:[]},staleTime:1e3*60*10}),mv=()=>ye({queryKey:["inventory-stock"],queryFn:async()=>{const t=await yy();return(Array.isArray(t)?t:[]).map(e=>({...e,lastUpdated:new Date(e.last_updated||e.created_at)}))},staleTime:1e3*60*5}),fv=(t=0,e=100)=>ye({queryKey:["inventory-transactions",t,e],queryFn:async()=>{const n=await vy(t,e);return(Array.isArray(n)?n:[]).map(i=>({...i,date:new Date(i.date)}))},staleTime:1e3*60*2}),Hd=()=>ye({queryKey:["paper-types"],queryFn:async()=>{const t=await yg();return(Array.isArray(t)?t:[]).map(e=>{try{const n=typeof e.params=="string"?JSON.parse(e.params):e.params||{};return{...e,inStock:e.in_stock||0,pricePerUnit:e.price_per_unit||0,sizes:typeof e.sizes=="string"?JSON.parse(e.sizes):e.sizes||[],suitableSides:e.suitable_sides||"both",photoUrl:e.photo_url,supplier:e.supplier,grammage:e.weight?parseInt(String(e.weight).replace(/[^0-9]/g,"")):void 0,finish:e.finish,minStockLevel:e.min_stock_level||0,grainDirection:n.grainDirection,brand:n.brand}}catch(n){return console.error("Failed to map paper record:",e,n),null}}).filter(Boolean)},staleTime:1e3*60*10}),hv=()=>ye({queryKey:["finishing-options"],queryFn:async()=>{const t=await Ng();return(Array.isArray(t)?t:[]).map(e=>{var n;return{id:e.id,name:e.name,description:e.description,costUnit:e.cost_unit||"item",estimatedDays:e.estimated_days||0,priceTiers:typeof e.price_tiers=="string"?JSON.parse(e.price_tiers):e.price_tiers||[],photoUrl:e.photo_url,requiresBlock:e.requires_block,blockSettings:typeof e.block_settings=="string"?JSON.parse(e.block_settings):e.block_settings,supplierId:e.supplier_id,supplierName:(n=e.suppliers)==null?void 0:n.name}})},staleTime:1e3*60*10}),Kd=()=>ye({queryKey:["printing-options"],queryFn:async()=>{const t=await wg();return(Array.isArray(t)?t:[]).map(e=>{const n=typeof e.params=="string"?JSON.parse(e.params):e.params||{};return{...e,machineModel:e.machine_model||"",priceTiers:typeof e.price_tiers=="string"?JSON.parse(e.price_tiers):e.price_tiers||[],sizes:typeof e.sizes=="string"?JSON.parse(e.sizes):e.sizes||[],params:n,photoUrl:e.photo_url,operatorId:e.operator_id,supplierId:e.supplier_id,setupCost:Number(e.setup_cost)||0,clickCharge:Number(e.click_charge)||0,hourlyRate:Number(e.hourly_rate)||0,minWidth:Number(e.min_width)||0,minHeight:Number(e.min_length||e.min_height)||0,maxWidth:Number(e.max_width)||0,maxHeight:Number(e.max_length||e.max_height)||0,speedPerHour:Number(e.capacity_per_hour||e.speed_per_hour)||1e3,gripEdge:Number(n.gripEdge)||10,physicalUnit:n.physicalUnit||"mm"}})},staleTime:1e3*60*10}),gv=()=>ye({queryKey:["plates"],queryFn:async()=>{const t=await Iy();return Array.isArray(t)?t:[]},staleTime:1e3*60*5}),yv=()=>ye({queryKey:["finishing-blocks"],queryFn:async()=>{const t=await Ly();return Array.isArray(t)?t:[]},staleTime:1e3*60*5}),Jd=(t=0,e=50)=>ye({queryKey:["delivery-notes",t,e],queryFn:async()=>{const n=await kd(t,e);return(Array.isArray(n)?n:[]).map(i=>({...i,date:new Date(i.created_at)}))},staleTime:1e3*60*5}),vv=()=>ye({queryKey:["customers"],queryFn:()=>Xh(0,50),staleTime:1e3*60*5,select:t=>(Array.isArray(t)?t:[]).map(e=>({...e,createdAt:new Date(e.created_at),totalOrders:e.total_orders||0,totalSpent:e.total_spent||0,accountBalance:e.account_balance||0}))||[]}),da=()=>ye({queryKey:["orders"],queryFn:()=>ng(0,50),staleTime:1e3*60*2,select:t=>(Array.isArray(t)?t:[]).map(e=>({...e,createdAt:new Date(e.created_at),customerId:e.customer_id,invoiceNumber:e.invoice_number||e.id.substring(0,8).toUpperCase(),totalPrice:Number(e.total_price||0),productionSteps:(Array.isArray(e.production_steps)?e.production_steps:[]).map(n=>{let i=n.supplier_id;return!i&&n.notes&&n.notes.startsWith("Supplier: ")&&(i=n.notes.replace("Supplier: ","")),{id:n.id,name:n.name,type:n.type,order:n.step_order,estimatedDays:n.estimated_days,cost:n.cost||0,status:n.status||(n.started_at?"in_progress":n.received_at?"received":"pending"),completedAt:n.completed_at,completedBy:n.completed_by,startedAt:n.started_at,receivedAt:n.received_at,supplierId:i,finishingBlockId:n.finishing_block_id||null}}).sort((n,i)=>(n.order||0)-(i.order||0))}))||[]}),Wd=()=>ye({queryKey:["materials"],queryFn:()=>cg(0,1e3),staleTime:1e3*60*10,select:t=>(Array.isArray(t)?t:[]).map(e=>({...e,currentStock:e.current_stock||0,minStock:e.min_stock||0,unitPrice:e.unit_price||0,inventoryLots:e.inventory_lots||[]}))||[]}),bv=()=>ye({queryKey:["suppliers"],queryFn:()=>sg(0,100),staleTime:1e3*60*10,select:t=>(Array.isArray(t)?t:[]).map(e=>({...e,totalPurchases:e.total_purchases||0,currentBalance:e.current_balance||0,creditLimit:e.credit_limit||0,paymentTerms:e.payment_terms||"net30"}))||[]}),_v=()=>ye({queryKey:["employees"],queryFn:()=>mg(),staleTime:1e3*60*15,select:t=>(Array.isArray(t)?t:[]).map(e=>({...e,hourlyRate:e.hourly_rate||0,hoursWorked:e.hours_worked||0,totalEarnings:e.total_earnings||0,department:"Production"}))||[]}),pa=()=>ye({queryKey:["accounts"],queryFn:()=>Gg(),staleTime:1e3*60*30,select:t=>(Array.isArray(t)?t:[]).map(e=>({id:e.id,code:e.code,name:e.name,type:e.type,description:e.description||void 0,parentId:e.parent_id||void 0}))||[]}),zd=(t=0,e=100)=>ye({queryKey:["accounting-entries",t,e],queryFn:()=>Gy(t,e),staleTime:1e3*60*5,select:n=>(Array.isArray(n)?n:[]).map(i=>({id:i.id,date:new Date(i.date),accountId:i.account_id,accountName:i.account_name,type:i.type,amount:i.amount,description:i.description,orderId:i.order_id,supplierId:i.supplier_id,customerId:i.customer_id,partnerId:i.partner_id,category:i.category,reference:i.reference,paymentMethod:i.payment_method,expenseId:i.expense_id,journalId:i.journal_id,isManual:i.is_manual,reconciled:i.reconciled,reconciliationId:i.reconciliation_id,reconciledAt:i.reconciled_at?new Date(i.reconciled_at):void 0,status:i.status,metadata:i.metadata}))||[]}),Yd=(t=0,e=50)=>ye({queryKey:["payments",t,e],queryFn:()=>Wy(t,e),staleTime:1e3*60*5,select:n=>(Array.isArray(n)?n:[]).map(i=>({id:i.id,orderId:i.order_id,customerId:i.customer_id,amount:i.amount,type:i.type,method:i.method,status:i.status,date:new Date(i.created_at||i.date),reference:i.reference,receiptNumber:i.receipt_number||"",bankDetails:i.bank_details,cardLastFour:i.card_last_four,chequeDetails:i.cheque_details,proofUrl:i.proof_url}))||[]}),Nv=()=>ye({queryKey:["expenses"],queryFn:()=>Rg(),staleTime:1e3*60*10,select:t=>(Array.isArray(t)?t:[]).map(e=>({...e,date:new Date(e.date||e.created_at)}))||[]}),Qd=()=>ye({queryKey:["commission-persons"],queryFn:()=>dy(),staleTime:1e3*60*15,select:t=>(Array.isArray(t)?t:[]).map(e=>({...e,joinDate:new Date(e.join_date||e.created_at),paidCommission:e.paid_commission||0,pendingCommission:e.pending_commission||0,totalCommission:e.total_commission||0,totalSales:e.total_sales||0}))||[]}),xv=()=>ye({queryKey:["cheques"],queryFn:()=>qy(),staleTime:1e3*60*10,select:t=>(Array.isArray(t)?t:[]).map(e=>({...e,issueDate:new Date(e.issue_date),dueDate:new Date(e.due_date)}))||[]}),Sv=()=>ye({queryKey:["fixed-assets"],queryFn:()=>Ey(),staleTime:1e3*60*30,select:t=>Array.isArray(t)?t:[]}),Ev=()=>ye({queryKey:["liabilities"],queryFn:()=>Ty(),staleTime:1e3*60*30,select:t=>Array.isArray(t)?t:[]}),Xd=(t=0,e=50)=>ye({queryKey:["purchase-orders",t,e],queryFn:()=>Hy(t,e),staleTime:1e3*60*5,select:n=>(Array.isArray(n)?n:[]).map(i=>({...i,date:new Date(i.created_at||i.date)}))||[]}),wv=()=>ye({queryKey:["partners"],queryFn:()=>ey(),staleTime:1e3*60*30,select:t=>(Array.isArray(t)?t:[]).map(e=>({id:e.id,name:e.name,email:e.email||"",phone:e.phone||"",type:e.type||"investor",ownershipPercentage:Number(e.ownership_percentage||0),joinDate:new Date(e.join_date||new Date),photoUrl:e.photo_url||"",totalContribution:Number(e.total_contribution||0),totalDistribution:Number(e.total_distribution||0),netEquity:Number(e.net_equity||0)}))||[]}),Cv=()=>ye({queryKey:["capital-contributions"],queryFn:()=>iy(),staleTime:1e3*60*30,select:t=>(Array.isArray(t)?t:[]).map(e=>({id:e.id,partnerId:e.partner_id,amount:Number(e.amount),date:new Date(e.date),notes:e.notes}))||[]}),Dv=()=>ye({queryKey:["distributions"],queryFn:()=>zy(),staleTime:1e3*60*30,select:t=>(Array.isArray(t)?t:[]).map(e=>({id:e.id,partnerId:e.partner_id,amount:Number(e.amount),date:new Date(e.date),notes:e.notes}))||[]}),Tv=()=>ye({queryKey:["attendance-records"],queryFn:()=>sy(),staleTime:1e3*60*10,select:t=>(Array.isArray(t)?t:[]).map(e=>({...e,timestamp:new Date(e.timestamp),clockIn:e.clock_in?new Date(e.clock_in):void 0,clockOut:e.clock_out?new Date(e.clock_out):void 0}))||[]}),Av=()=>ye({queryKey:["biometric-credentials"],queryFn:()=>ay(),staleTime:1e3*60*60,select:t=>Array.isArray(t)?t:[]}),kv=()=>ye({queryKey:["quotations"],queryFn:()=>cy(),staleTime:1e3*60*5,select:t=>(Array.isArray(t)?t:[]).map(e=>({...e,createdAt:new Date(e.created_at||e.date),totalPrice:Number(e.total_price||0)}))||[]}),Pv=()=>ye({queryKey:["customer-monitor-notes"],queryFn:()=>_y(),staleTime:1e3*60*10,select:t=>(Array.isArray(t)?t:[]).map(e=>({...e,createdAt:new Date(e.created_at||e.timestamp)}))||[]}),Iv=()=>ye({queryKey:["credit-notes"],queryFn:()=>Xy(),staleTime:1e3*60*10,select:t=>(Array.isArray(t)?t:[]).map(e=>({...e,date:new Date(e.created_at||e.date)}))||[]}),Rv=()=>ye({queryKey:["quality-checks"],queryFn:()=>xy(),staleTime:1e3*60*5,select:t=>(Array.isArray(t)?t:[]).map(e=>({...e,createdAt:new Date(e.created_at||e.timestamp)}))||[]}),Mv=()=>ye({queryKey:["delivery-notes"],queryFn:()=>kd(),staleTime:1e3*60*10,select:t=>(Array.isArray(t)?t:[]).map(e=>({...e,date:new Date(e.date||e.created_at)}))||[]}),Vv=()=>ye({queryKey:["audit-logs"],queryFn:()=>ev().catch(()=>[]),staleTime:1e3*60*15}),Lv=()=>ye({queryKey:["recurring-invoices"],queryFn:()=>nv().catch(()=>[]),staleTime:1e3*60*30,select:t=>(Array.isArray(t)?t:[]).map(e=>({...e,startDate:new Date(e.start_date||e.created_at),endDate:e.end_date?new Date(e.end_date):void 0}))}),Ov=()=>ye({queryKey:["budgets"],queryFn:()=>Xg(),staleTime:1e3*60*60,select:t=>(Array.isArray(t)?t:[]).map(e=>({...e,amount:Number(e.amount),spent:Number(e.spent||0)}))});async function jv(t,e){var n;try{const i={name:e.name,category:e.category,unit:e.unit,unit_price:e.unitPrice,average_cost:e.averageCost||e.unitPrice,min_stock:e.minStock,current_stock:e.currentStock||0,location:e.location,supplier_id:e.supplierId,description:e.description},o=await ug(i);if(!o)throw new Error("Failed to create material in DB");const s=o.id,r={...e,id:s,currentStock:o.current_stock||0,inventoryLots:[]};if(t.setMaterials(a=>[...a,r]),(e.currentStock||0)>0){const a=t.warehouses.find(c=>c.isDefault)||t.warehouses[0];a&&await t.processStockTransaction({materialId:s,quantity:e.currentStock,unitCost:e.averageCost||e.unitPrice,type:"adjustment",warehouseId:a.id,referenceType:"Adjustment",notes:"Opening Balance",performedBy:((n=t.currentUser)==null?void 0:n.name)||"System"})}return t.showToast("Material added successfully","success"),r}catch(i){return console.error("InventoryService: addMaterial error:",i),t.showToast("Failed to add material","error"),null}}async function Fv(t,e,n){var i;if(n.currentStock!==void 0){const o=t.materials.find(s=>s.id===e);if(o&&o.currentStock!==n.currentStock){const s=n.currentStock-(o.currentStock||0);if(s!==0){const r=t.warehouses.find(a=>a.isDefault);if(r){await t.processStockTransaction({materialId:e,quantity:Math.abs(s),unitCost:o.averageCost||o.unitPrice,type:s>0?"adjustment":"usage",warehouseId:r.id,referenceType:"Adjustment",notes:"Manual Stock Update via Edit",performedBy:((i=t.currentUser)==null?void 0:i.name)||"System"});const{currentStock:a,...c}=n;Object.keys(c).length>0&&t.setMaterials(d=>d.map(p=>p.id===e?{...p,...c}:p));return}}}}try{const o={...n};n.unitPrice&&(o.unit_price=n.unitPrice,delete o.unitPrice),n.averageCost&&(o.average_cost=n.averageCost,delete o.averageCost),n.minStock&&(o.min_stock=n.minStock,delete o.minStock),n.currentStock&&(o.current_stock=n.currentStock,delete o.currentStock),n.supplierId&&(o.supplier_id=n.supplierId,delete o.supplierId),await dg(e,o),t.setMaterials(s=>s.map(r=>r.id===e?{...r,...n}:r)),t.showToast("Material updated successfully","success")}catch(o){console.error("InventoryService: updateMaterial error:",o),t.showToast("Failed to update material","error")}}async function qv(t,e){try{await pg(e),t.setMaterials(n=>n.filter(i=>i.id!==e)),t.showToast("Material deleted successfully","success")}catch(n){console.error("InventoryService: deleteMaterial error:",n),t.showToast("Failed to delete material","error")}}async function Uv(t,e){var n,i;try{const o={name:e.name,description:e.description,price_per_unit:e.pricePerUnit||0,in_stock:e.inStock||0,suitable_sides:e.suitableSides||"both",photo_url:e.photoUrl||"",sizes:e.sizes||[],weight:e.grammage?`${e.grammage}gsm`:null,brand:e.brand,finish:e.finish,supplier:e.supplier,min_stock_level:e.minStockLevel||0,params:{grainDirection:e.grainDirection,brand:e.brand}},s=await vg(o);if(s){const r={id:s.id,name:s.name,description:s.description,pricePerUnit:s.price_per_unit||0,inStock:s.in_stock||0,suitableSides:s.suitable_sides||"both",photoUrl:s.photo_url||"",sizes:s.sizes||[],supplier:s.supplier,grammage:s.weight?parseInt(String(s.weight).replace(/[^0-9]/g,"")):void 0,finish:s.finish,minStockLevel:s.min_stock_level||0,grainDirection:(n=s.params)==null?void 0:n.grainDirection,brand:(i=s.params)==null?void 0:i.brand};t.setPaperTypes(a=>[...a,r]),t.showToast("Paper type added successfully","success")}}catch(o){console.error("InventoryService: addPaperType error:",o),t.showToast("Failed to add paper type","error")}}async function $v(t,e,n){try{const i={};n.name!==void 0&&(i.name=n.name),n.description!==void 0&&(i.description=n.description),n.pricePerUnit!==void 0&&(i.price_per_unit=n.pricePerUnit),n.inStock!==void 0&&(i.in_stock=n.inStock),n.suitableSides!==void 0&&(i.suitable_sides=n.suitableSides),n.photoUrl!==void 0&&(i.photo_url=n.photoUrl),n.sizes!==void 0&&(i.sizes=n.sizes),n.grammage!==void 0&&(i.weight=`${n.grammage}gsm`),n.finish!==void 0&&(i.finish=n.finish),n.supplier!==void 0&&(i.supplier=n.supplier),n.minStockLevel!==void 0&&(i.min_stock_level=n.minStockLevel),(n.grainDirection!==void 0||n.brand!==void 0)&&(i.params={...n.grainDirection!==void 0?{grainDirection:n.grainDirection}:{},...n.brand!==void 0?{brand:n.brand}:{}}),await bg(e,i)&&(t.setPaperTypes(s=>s.map(r=>r.id===e?{...r,...n}:r)),t.showToast("Paper type updated successfully","success"))}catch(i){console.error("InventoryService: updatePaperType error:",i),t.showToast("Failed to update paper type","error")}}async function Bv(t,e){try{await _g(e),t.setPaperTypes(n=>n.filter(i=>i.id!==e)),t.showToast("Paper type deleted successfully","success")}catch(n){console.error("InventoryService: deletePaperType error:",n),t.showToast("Failed to delete paper type","error")}}async function Gv(t,e){try{const n={name:e.name,description:e.description,cost_unit:e.costUnit,estimated_days:e.estimatedDays,price_tiers:e.priceTiers,photo_url:e.photoUrl,requires_block:e.requiresBlock,block_settings:e.blockSettings,supplier_id:e.supplierId},i=await xg(n);if(i){const o={id:i.id,name:i.name,description:i.description,costUnit:i.cost_unit||"item",estimatedDays:i.estimated_days||0,priceTiers:i.price_tiers||[],photoUrl:i.photo_url,requiresBlock:i.requires_block,blockSettings:i.block_settings,supplierId:i.supplier_id};t.setFinishingOptions(s=>[...s,o]),t.showToast("Finishing option added successfully","success")}}catch(n){console.error("InventoryService: addFinishingOption error:",n),t.showToast("Failed to add finishing option","error")}}async function Hv(t,e,n){try{const i={};n.name!==void 0&&(i.name=n.name),n.description!==void 0&&(i.description=n.description),n.costUnit!==void 0&&(i.cost_unit=n.costUnit),n.estimatedDays!==void 0&&(i.estimated_days=n.estimatedDays),n.priceTiers!==void 0&&(i.price_tiers=n.priceTiers),n.photoUrl!==void 0&&(i.photo_url=n.photoUrl),n.requiresBlock!==void 0&&(i.requires_block=n.requiresBlock),n.blockSettings!==void 0&&(i.block_settings=n.blockSettings),n.supplierId!==void 0&&(i.supplier_id=n.supplierId),await Sg(e,i)&&(t.setFinishingOptions(s=>s.map(r=>r.id===e?{...r,...n}:r)),t.showToast("Finishing option updated successfully","success"))}catch(i){console.error("InventoryService: updateFinishingOption error:",i),t.showToast("Failed to update finishing option","error")}}async function Kv(t,e){try{await Eg(e),t.setFinishingOptions(n=>n.filter(i=>i.id!==e)),t.showToast("Finishing option deleted successfully","success")}catch(n){console.error("InventoryService: deleteFinishingOption error:",n),t.showToast("Failed to delete finishing option","error")}}async function Jv(t,e){try{const n={name:e.name,type:e.type,machine_model:e.machineModel,price_tiers:e.priceTiers,sizes:e.sizes,photo_url:e.photoUrl,operator_id:e.operatorId,supplier_id:e.supplierId,setup_cost:e.setupCost,click_charge:e.clickCharge,hourly_rate:e.hourlyRate,min_width:e.minWidth,min_length:e.minHeight,max_width:e.maxWidth,max_length:e.maxHeight,capacity_per_hour:e.speedPerHour,params:{...e.params||{},gripEdge:e.gripEdge,physicalUnit:e.physicalUnit}},i=await Cg(n);if(i){const o={id:i.id,name:i.name,type:i.type,machineModel:i.machine_model||"",priceTiers:i.price_tiers||[],params:i.params||{},photoUrl:i.photo_url,operatorId:i.operator_id,supplierId:i.supplier_id};t.setPrintingOptions(s=>[...s,o]),t.showToast("Printing option added successfully","success")}}catch(n){console.error("InventoryService: addPrintingOption error:",n),t.showToast("Failed to add printing option","error")}}async function Wv(t,e,n){try{const i={};n.name!==void 0&&(i.name=n.name),n.type!==void 0&&(i.type=n.type),n.machineModel!==void 0&&(i.machine_model=n.machineModel),n.priceTiers!==void 0&&(i.price_tiers=n.priceTiers),n.sizes!==void 0&&(i.sizes=n.sizes),n.photoUrl!==void 0&&(i.photo_url=n.photoUrl),n.operatorId!==void 0&&(i.operator_id=n.operatorId),n.supplierId!==void 0&&(i.supplier_id=n.supplierId),n.setupCost!==void 0&&(i.setup_cost=n.setupCost),n.clickCharge!==void 0&&(i.click_charge=n.clickCharge),n.hourlyRate!==void 0&&(i.hourly_rate=n.hourlyRate),n.minWidth!==void 0&&(i.min_width=n.minWidth),n.minHeight!==void 0&&(i.min_length=n.minHeight),n.maxWidth!==void 0&&(i.max_width=n.maxWidth),n.maxHeight!==void 0&&(i.max_length=n.maxHeight),n.speedPerHour!==void 0&&(i.capacity_per_hour=n.speedPerHour),(n.gripEdge!==void 0||n.physicalUnit!==void 0||n.params!==void 0)&&(i.params={...n.params||{},...n.gripEdge!==void 0?{gripEdge:n.gripEdge}:{},...n.physicalUnit!==void 0?{physicalUnit:n.physicalUnit}:{}}),await Dg(e,i)&&(t.setPrintingOptions(s=>s.map(r=>r.id===e?{...r,...n}:r)),t.showToast("Printing option updated successfully","success"))}catch(i){console.error("InventoryService: updatePrintingOption error:",i),t.showToast("Failed to update printing option","error")}}async function zv(t,e){try{await Tg(e),t.setPrintingOptions(n=>n.filter(i=>i.id!==e)),t.showToast("Printing option deleted successfully","success")}catch(n){console.error("InventoryService: deletePrintingOption error:",n),t.showToast("Failed to delete printing option","error")}}async function Yv(t,e){try{const n={name:e.name,job_id:e.jobId,customer_name:e.customerName,purchase_date:e.purchaseDate,cost:e.cost,supplier_id:e.supplierId,supplier_name:e.supplierName,status:e.status,location:e.location,last_used:e.lastUsed,times_used:e.timesUsed,notes:e.notes,photo_url:e.photoUrl,history:e.history},i=await Ry(n);if(i){const o={...e,id:i.id,purchaseDate:new Date(i.purchase_date),lastUsed:new Date(i.last_used),history:i.history||[]};return t.setPlates(s=>[o,...s]),t.showToast("Plate added successfully","success"),o}}catch(n){console.error("InventoryService: addPlate error:",n),t.showToast("Failed to add plate","error")}return null}async function Qv(t,e,n){try{const i={...n};n.jobId&&(i.job_id=n.jobId,delete i.jobId),n.customerName&&(i.customer_name=n.customerName,delete i.customerName),n.purchaseDate&&(i.purchase_date=n.purchaseDate,delete i.purchaseDate),n.supplierId&&(i.supplier_id=n.supplierId,delete i.supplierId),n.supplierName&&(i.supplier_name=n.supplierName,delete i.supplierName),n.lastUsed&&(i.last_used=n.lastUsed,delete i.lastUsed),n.timesUsed!==void 0&&(i.times_used=n.timesUsed,delete i.timesUsed),n.photoUrl&&(i.photo_url=n.photoUrl,delete i.photoUrl),await My(e,i),t.setPlates(o=>o.map(s=>s.id===e?{...s,...n}:s)),t.showToast("Plate updated successfully","success")}catch(i){console.error("InventoryService: updatePlate error:",i),t.showToast("Failed to update plate","error")}}async function Xv(t,e){try{await Vy(e),t.setPlates(n=>n.filter(i=>i.id!==e)),t.showToast("Plate deleted successfully","success")}catch(n){console.error("InventoryService: deletePlate error:",n),t.showToast("Failed to delete plate","error")}}async function Zv(t,e){try{const n={name:e.name,job_id:e.jobId,customer_name:e.customerName,finishing_type:e.finishingType,purchase_date:e.purchaseDate,cost:e.cost,supplier_id:e.supplierId,supplier_name:e.supplierName,status:e.status,location:e.location,last_used:e.lastUsed,times_used:e.timesUsed,notes:e.notes,photo_url:e.photoUrl,history:e.history},i=await Oy(n);if(i){const o={...e,id:i.id,purchaseDate:new Date(i.purchase_date),lastUsed:new Date(i.last_used),history:i.history||[]};return t.setFinishingBlocks(s=>[o,...s]),t.showToast("Finishing block added successfully","success"),o}}catch(n){console.error("InventoryService: addFinishingBlock error:",n),t.showToast("Failed to add finishing block","error")}return null}async function eb(t,e,n){try{const i={...n};n.jobId&&(i.job_id=n.jobId,delete i.jobId),n.customerName&&(i.customer_name=n.customerName,delete i.customerName),n.finishingType&&(i.finishing_type=n.finishingType,delete i.finishingType),n.purchaseDate&&(i.purchase_date=n.purchaseDate,delete i.purchaseDate),n.supplierId&&(i.supplier_id=n.supplierId,delete i.supplierId),n.supplierName&&(i.supplier_name=n.supplierName,delete i.supplierName),n.lastUsed&&(i.last_used=n.lastUsed,delete n.lastUsed),n.timesUsed!==void 0&&(i.times_used=n.timesUsed,delete i.timesUsed),n.photoUrl&&(i.photo_url=n.photoUrl,delete i.photoUrl),await jy(e,i),t.setFinishingBlocks(o=>o.map(s=>s.id===e?{...s,...n}:s)),t.showToast("Finishing block updated successfully","success")}catch(i){console.error("InventoryService: updateFinishingBlock error:",i),t.showToast("Failed to update finishing block","error")}}async function tb(t,e){try{await Fy(e),t.setFinishingBlocks(n=>n.filter(i=>i.id!==e)),t.showToast("Finishing block deleted successfully","success")}catch(n){console.error("InventoryService: deleteFinishingBlock error:",n),t.showToast("Failed to delete finishing block","error")}}async function nb(t,e){try{const n=e.quantity*(e.unitCost||0),i={material_id:e.materialId||e.paperId,quantity:e.quantity,type:e.type,unit_cost:e.unitCost,total_cost:n,warehouse_id:e.warehouseId,reference_type:e.referenceType,reference_id:e.referenceId,performed_by:e.performedBy,notes:e.notes},o=await by(i);if(o){const s={...e,id:o.id,date:new Date,totalCost:n};if(t.setInventoryTransactions(r=>[s,...r]),t.setInventoryStock(r=>{const a=r.find(c=>c.materialId===(e.materialId||e.paperId)&&c.warehouseId===e.warehouseId);return a?r.map(c=>c.id===a.id?{...c,quantity:c.quantity+e.quantity,lastUpdated:new Date}:c):[...r,{id:`stock-${Date.now()}`,materialId:e.materialId||e.paperId||"",warehouseId:e.warehouseId,quantity:e.quantity,lastUpdated:new Date}]}),!e.skipAccounting){const r=t.materials.find(c=>c.id===(e.materialId||e.paperId)),a=(r==null?void 0:r.name)||"Inventory Item";await t.addJournalEntry(`Stock ${e.type}: ${a}`,new Date,[{accountId:e.targetAccountId||t.ACC_INVENTORY,description:`Debit Inventory Asset - ${a}`,debit:n,credit:0},{accountId:t.ACC_AP,description:`Credit Adjustment Account - ${a}`,debit:0,credit:n}])}}}catch(n){console.error("Failed to process stock transaction:",n),t.showToast("Failed to update inventory","error")}}async function ib(t,e){try{const n=await $g(e);n&&(t.setWarehouses(i=>[...i,n]),t.showToast("Warehouse added","success"))}catch(n){console.error("Failed to add warehouse:",n),t.showToast("Failed to add warehouse","error")}}async function ob(t,e,n){try{await Bg(e,n),t.setWarehouses(i=>i.map(o=>o.id===e?{...o,...n}:o)),t.showToast("Warehouse updated","success")}catch(i){console.error("Failed to update warehouse:",i),t.showToast("Failed to update warehouse","error")}}async function sb(t,e){try{const n=await jg({name:e.name,model:e.model,serial_number:e.serialNumber,hourly_rate:e.hourlyRate,purchase_date:e.purchaseDate,last_maintenance:e.lastMaintenance,status:e.status,photo_url:e.photoUrl});n&&(t.setMachines(i=>[...i,{...e,id:n.id}]),t.showToast("Machine added","success"))}catch(n){console.error("Failed to add machine:",n),t.showToast("Failed to add machine","error")}}async function rb(t,e,n){try{const i={...n};n.hourlyRate&&(i.hourly_rate=n.hourlyRate),n.serialNumber&&(i.serial_number=n.serialNumber),n.purchaseDate&&(i.purchase_date=n.purchaseDate),n.lastMaintenance&&(i.last_maintenance=n.lastMaintenance),n.photoUrl&&(i.photo_url=n.photoUrl),await Fg(e,i),t.setMachines(o=>o.map(s=>s.id===e?{...s,...n}:s)),t.showToast("Machine updated","success")}catch(i){console.error("Failed to update machine:",i),t.showToast("Failed to update machine","error")}}async function ab(t,e){try{await qg(e),t.setMachines(n=>n.filter(i=>i.id!==e)),t.showToast("Machine removed","success")}catch(n){console.error("Failed to delete machine:",n),t.showToast("Failed to delete machine","error")}}async function lb(t,e){try{const n=await Pd({order_id:e.orderId,customer_id:e.customerId,delivery_address:e.deliveryAddress,recipient_name:e.recipientName,recipient_phone:e.recipientPhone,items:e.items,status:e.status,tracking_number:e.trackingNumber,scheduled_date:e.scheduledDate});if(n)return t.setDeliveryNotes(i=>[...i,{...e,id:n.id,date:new Date}]),t.showToast("Delivery note created","success"),n.id}catch(n){console.error("Failed to add delivery note:",n),t.showToast("Failed to create delivery note","error")}return""}async function cb(t,e,n){try{await Id(e,{status:"delivered",proof_url:n,delivered_at:new Date}),t.setDeliveryNotes(i=>i.map(o=>o.id===e?{...o,status:"delivered",proofUrl:n}:o)),t.showToast("Marked as delivered","success")}catch(i){console.error("Failed to mark delivered:",i),t.showToast("Failed to update delivery status","error")}}async function Zd(t,e){const n=t.orders.find(s=>s.id===e);if(!n)return;let i=0;(n.productionSteps||[]).forEach(s=>{i+=s.cost||0}),(t.machineLogs||[]).filter(s=>s.jobId===e).forEach(s=>{i+=s.totalCost||0});try{await ii(e,{cost_of_goods_sold:i}),console.log(`Persisted COGS for Order ${n.invoiceNumber}: RM ${i.toFixed(2)}`)}catch(s){console.error(`Failed to persist COGS for order ${e}:`,s)}}async function ub(t,e,n,i,o="run"){if(t.machineLogs.find(d=>d.machineId===e&&d.status==="running"))throw new Error(`Machine ${e} is already running.`);const r=t.machines.find(d=>d.id===e),a=t.orders.find(d=>d.id===n),c={id:`log-${Date.now()}`,machineId:e,machineName:(r==null?void 0:r.name)||"Unknown Machine",jobId:n,orderNumber:(a==null?void 0:a.invoiceNumber)||"Unknown",operatorId:i,logType:o,startTime:new Date,hourlyRate:(r==null?void 0:r.hourlyRate)||50,totalCost:0,overheadAllocated:0,status:"running"};return t.setMachineLogs(d=>[...d,c]),c.id}async function db(t,e){const n=t.machineLogs.find(c=>c.id===e);if(!n||n.status!=="running")return;const i=new Date,o=(i.getTime()-new Date(n.startTime).getTime())/(1e3*60*60),s=o*n.hourlyRate,r=s;if(s>0){const c=(n.machineName||"").toLowerCase(),p=c.includes("digital")||c.includes("ricoh")||c.includes("konica")?t.ACC_OVERHEAD_DIGITAL:t.ACC_OVERHEAD_OFFSET;await t.addJournalEntry(`Machine Overhead Allocation: ${n.machineName} - Job #${n.orderNumber}`,i,[{accountId:t.ACC_WIP,description:`WIP - Machine Overhead (${n.machineName})`,debit:s,credit:0},{accountId:p,description:`Applied Overhead (${n.machineName})`,debit:0,credit:s}])}const a={...n,endTime:i,durationHours:o,totalCost:s,overheadAllocated:r,status:"completed"};t.setMachineLogs(c=>c.map(d=>d.id===e?a:d)),n.jobId&&await Zd(t,n.jobId)}async function pb(t,e,n){t.setMachineLogs(i=>i.map(o=>o.id===e?{...o,...n}:o))}async function mb(t,e,n){const i=t.machines.find(o=>o.id===e);if(i)try{const o=t.accounts.find(r=>(r.name||"").toLowerCase().includes("depreciation")&&r.type==="Expense")||t.accounts.find(r=>r.name==="General Expense"),s=t.accounts.find(r=>(r.name||"").toLowerCase().includes("accumulated")&&r.type==="Asset")||t.accounts.find(r=>r.name==="Fixed Assets");o&&s&&(await t.addJournalEntry(`Monthly Depreciation - ${i.name}`,new Date,[{accountId:o.id,description:`Depreciation Expense - ${i.name}`,debit:n,credit:0},{accountId:s.id,description:`Accumulated Depreciation - ${i.name}`,debit:0,credit:n}]),t.showToast(`Recorded depreciation for ${i.name}`,"success"))}catch(o){console.error("Failed to record depreciation",o)}}const ep=b.createContext(void 0),$t=()=>{const t=b.useContext(ep);if(t===void 0)throw new Error("useToast must be used within a ToastProvider");return t},fb=({children:t})=>{const[e,n]=b.useState([]),i=b.useCallback((s,r="info")=>{const a=Date.now().toString();n(c=>[...c,{id:a,message:s,type:r}]),setTimeout(()=>{n(c=>c.filter(d=>d.id!==a))},3e3)},[]),o=s=>{n(r=>r.filter(a=>a.id!==s))};return m.jsxDEV(ep.Provider,{value:{showToast:i},children:[t,m.jsxDEV("div",{className:"fixed bottom-4 right-4 z-[100] flex flex-col gap-2",children:e.map(s=>m.jsxDEV("div",{className:`flex items-center p-4 rounded-lg shadow-lg border min-w-[300px] animate-slide-up transition-all duration-300 ${s.type==="success"?"bg-white dark:bg-gray-800 border-green-500 text-green-600 dark:text-green-400":s.type==="error"?"bg-white dark:bg-gray-800 border-red-500 text-red-600 dark:text-red-400":s.type==="warning"?"bg-white dark:bg-gray-800 border-yellow-500 text-yellow-600 dark:text-yellow-400":"bg-white dark:bg-gray-800 border-blue-500 text-blue-600 dark:text-blue-400"}`,children:[m.jsxDEV("div",{className:"flex-shrink-0 mr-3",children:[s.type==="success"&&m.jsxDEV(ea,{className:"h-5 w-5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/ToastContext.tsx",lineNumber:59,columnNumber:46},void 0),s.type==="error"&&m.jsxDEV(Fi,{className:"h-5 w-5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/ToastContext.tsx",lineNumber:60,columnNumber:44},void 0),s.type==="warning"&&m.jsxDEV(of,{className:"h-5 w-5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/ToastContext.tsx",lineNumber:61,columnNumber:46},void 0),s.type==="info"&&m.jsxDEV(sf,{className:"h-5 w-5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/ToastContext.tsx",lineNumber:62,columnNumber:43},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/contexts/ToastContext.tsx",lineNumber:58,columnNumber:13},void 0),m.jsxDEV("div",{className:"flex-1 text-sm font-medium text-gray-900 dark:text-white",children:s.message},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/ToastContext.tsx",lineNumber:64,columnNumber:13},void 0),m.jsxDEV("button",{onClick:()=>o(s.id),className:"ml-4 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200",children:m.jsxDEV(en,{className:"h-4 w-4"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/ToastContext.tsx",lineNumber:69,columnNumber:15},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/ToastContext.tsx",lineNumber:65,columnNumber:13},void 0)]},s.id,!0,{fileName:"D:/devlop/projects/printing system/src/contexts/ToastContext.tsx",lineNumber:49,columnNumber:11},void 0))},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/ToastContext.tsx",lineNumber:47,columnNumber:7},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/contexts/ToastContext.tsx",lineNumber:45,columnNumber:5},void 0)};async function tp(t,e,n,i){try{const o=await uv({description:e,date:n,lines:i.map(s=>({account_id:s.accountId,description:s.description,debit:s.debit,credit:s.credit}))});if(o){const s=i.map((r,a)=>{var c;return{id:`${o.id}-${a}`,date:new Date(n),accountId:r.accountId,accountName:((c=t.accounts.find(d=>d.id===r.accountId))==null?void 0:c.name)||"Unknown",type:r.debit>0?"debit":"credit",amount:r.debit>0?r.debit:r.credit,description:r.description,journalId:o.id,category:"general",reference:e,isManual:!1,status:"posted"}});t.setAccountingEntries(r=>[...s,...r])}}catch(o){console.error("Failed to add journal entry:",o),t.showToast("Failed to record accounting entry","error")}}function yl(t,e,n,i){const o={revenue:0,expenses:0,cogs:0,sst:0,netProfit:0},s={assets:0,liabilities:0,equity:0},r={};return t.forEach(a=>{const c=a.type==="debit"?a.amount:-a.amount;r[a.accountId]=(r[a.accountId]||0)+c}),e.forEach(a=>{const c=r[a.id]||0;a.type==="Revenue"?o.revenue+=-c:a.type==="Expense"?(o.expenses+=c,a.id===n&&(o.cogs+=c)):a.type==="Asset"?s.assets+=c:a.type==="Liability"?(s.liabilities+=-c,a.id===i&&(o.sst+=-c)):a.type==="Equity"&&(s.equity+=-c)}),o.netProfit=o.revenue-o.expenses,{pnl:o,bs:s}}async function hb(t,e,n){const i=t.accounts.find(r=>r.code==="3100");if(!i){t.showToast("Retained Earnings account (3100) not found. Seeding required.","error");return}const o=[],s={};if(t.accountingEntries.forEach(r=>{const a=r.type==="debit"?r.amount:-r.amount;s[r.accountId]=(s[r.accountId]||0)+a}),t.accounts.forEach(r=>{const a=s[r.id]||0;r.type==="Revenue"&&a!==0?o.push({accountId:r.id,description:`Closing Revenue - ${r.name}`,debit:-a,credit:0}):r.type==="Expense"&&a!==0&&o.push({accountId:r.id,description:`Closing Expense - ${r.name}`,debit:0,credit:a})}),n!==0&&o.push({accountId:i.id,description:`Close Fiscal Year ${e} - Net Profit/Loss Transfer`,debit:0,credit:n}),o.length===0){t.showToast("No balances to close for this period.","info");return}await tp(t,`Year-End Closing ${e}`,new Date(`${e}-12-31`),o),t.showToast(`Fiscal Year ${e} Closed Successfully`,"success")}async function gb(t,e){try{const n={type:e.type,party_id:e.partyId,party_name:e.partyName,cheque_number:e.chequeNumber,bank:e.bank,amount:e.amount,issue_date:e.issueDate,due_date:e.dueDate,status:e.status,notes:e.notes},i=await Uy(n);if(i){const o={...e,id:i.id,issueDate:new Date(i.issue_date),dueDate:new Date(i.due_date)};return t.setCheques(s=>[...s,o]),t.showToast("Cheque added successfully","success"),o}}catch(n){console.error("AccountingService: addCheque error:",n),t.showToast("Failed to add cheque","error")}return null}async function yb(t,e,n,i){try{await $y(e,{status:n,notes:i}),t.setCheques(o=>o.map(s=>s.id===e?{...s,status:n,notes:i}:s)),t.showToast("Cheque status updated","success")}catch(o){console.error("AccountingService: updateChequeStatus error:",o),t.showToast("Failed to update cheque status","error")}}async function vb(t,e){try{const n={name:e.name,purchase_date:e.purchaseDate,purchase_cost:e.purchaseCost,depreciation_method:e.depreciationMethod,useful_life:e.usefulLife,salvage_value:e.salvageValue,current_book_value:e.currentBookValue||e.purchaseCost},i=await wy(n);if(i){const o={...e,id:i.id,purchaseDate:new Date(i.purchase_date),currentBookValue:Number(i.current_book_value)};t.setFixedAssets(s=>[...s,o]),t.showToast("Asset added successfully","success")}}catch(n){console.error("AssetService: addAsset error:",n),t.showToast("Failed to add asset","error")}}async function bb(t,e,n){try{const i={...n};n.purchaseDate&&(i.purchase_date=n.purchaseDate,delete i.purchaseDate),n.purchaseCost&&(i.purchase_cost=n.purchaseCost,delete i.purchaseCost),n.depreciationMethod&&(i.depreciation_method=n.depreciationMethod,delete i.depreciationMethod),n.usefulLife&&(i.useful_life=n.usefulLife,delete i.usefulLife),n.salvageValue&&(i.salvage_value=n.salvageValue,delete i.salvageValue),n.currentBookValue&&(i.current_book_value=n.currentBookValue,delete i.currentBookValue),await Cy(e,i),t.setFixedAssets(o=>o.map(s=>s.id===e?{...s,...n}:s)),t.showToast("Asset updated successfully","success")}catch(i){console.error("AssetService: updateAsset error:",i),t.showToast("Failed to update asset","error")}}async function _b(t,e){try{await Dy(e),t.setFixedAssets(n=>n.filter(i=>i.id!==e)),t.showToast("Asset deleted successfully","success")}catch(n){console.error("AssetService: deleteAsset error:",n),t.showToast("Failed to delete asset","error")}}async function Nb(t,e){try{const n={name:e.name,type:e.type,lender:e.lender,principal:e.principal,interest_rate:e.interestRate,term:e.term,issue_date:e.issueDate,remaining_balance:e.remainingBalance||e.principal},i=await Ay(n);if(i){const o={...e,id:i.id,issueDate:new Date(i.issue_date),remainingBalance:Number(i.remaining_balance)};t.setLiabilities(s=>[...s,o]),t.showToast("Liability added successfully","success")}}catch(n){console.error("AssetService: addLiability error:",n),t.showToast("Failed to add liability","error")}}async function xb(t,e,n){try{const i={...n};n.interestRate&&(i.interest_rate=n.interestRate,delete i.interestRate),n.issueDate&&(i.issue_date=n.issueDate,delete i.issueDate),n.remainingBalance&&(i.remaining_balance=n.remainingBalance,delete i.remainingBalance),await ky(e,i),t.setLiabilities(o=>o.map(s=>s.id===e?{...s,...n}:s)),t.showToast("Liability updated successfully","success")}catch(i){console.error("AssetService: updateLiability error:",i),t.showToast("Failed to update liability","error")}}async function Sb(t,e){try{await Py(e),t.setLiabilities(n=>n.filter(i=>i.id!==e)),t.showToast("Liability deleted successfully","success")}catch(n){console.error("AssetService: deleteLiability error:",n),t.showToast("Failed to delete liability","error")}}const np=b.createContext(void 0),si=()=>{const t=b.useContext(np);if(!t)throw new Error("useAccounting must be used within an AccountingProvider");return t},Eb=({children:t})=>{const{showToast:e}=$t(),{data:n=[],isLoading:i,refetch:o}=pa(),{data:s=[],isLoading:r,refetch:a}=zd(),{data:c=[],isLoading:d,refetch:p}=Yd(),{data:f=[],isLoading:h,refetch:g}=Nv(),{data:y=[],isLoading:_,refetch:v}=Qd(),{data:x=[],isLoading:E,refetch:w}=xv(),{data:C=[],isLoading:P,refetch:k}=Sv(),{data:I=[],isLoading:j,refetch:A}=Ev(),{data:R=[],isLoading:q,refetch:G}=Xd(),{data:L=[],isLoading:F,refetch:T}=wv(),{data:$=[],isLoading:Q,refetch:X}=Cv(),{data:te=[],isLoading:J,refetch:O}=Dv(),{data:U=[],isLoading:H,refetch:re}=Lv(),{data:de=[],isLoading:le,refetch:fe}=Ov(),{data:De=[],isLoading:K,refetch:ae}=Iv(),[ve,Ie]=b.useState(6),[it,Gt]=b.useState([]),[qe,Ue]=b.useState(["Utility","Rent","Salary","Material","Other"]),[ot,ht]=b.useState([]),[Oe,gt]=b.useState([]),an=i||r||d||h||_||E||P||j||q||F||Q||J||H||le||K,Be="6441b8ec-52d8-5dee-af3b-983203d8f3d1",at="191f05d0-565f-5cea-935b-b1fb39129942",ke=b.useCallback(()=>({accounts:n,accountingEntries:s,setAccountingEntries:async()=>await a(),showToast:e,ACC_COGS:Be,ACC_SST:at,cheques:x,setCheques:async()=>await w()}),[n,s,a,e,Be,at,x,w]),Ct=b.useCallback(async(S,V,N)=>{await tp(ke(),S,V,N)},[ke]),Dt=b.useCallback(async S=>await gb(ke(),S),[ke]),st=b.useCallback(async(S,V,N)=>{await yb(ke(),S,V,N)},[ke]),ln=b.useCallback(async S=>{await Mg(S)&&(e("Expense added successfully","success"),await g())},[e,g]),Tt=b.useCallback(async(S,V)=>{await Vg(S,V),await g()},[g]),At=b.useCallback(async S=>{await Lg(S),await g()},[g]),ie=b.useCallback(async S=>{await vb(ke(),S),await k()},[ke,k]),Pe=b.useCallback(async(S,V)=>{await bb(ke(),S,V),await k()},[ke,k]),li=b.useCallback(async S=>{await _b(ke(),S),await k()},[ke,k]),ci=b.useCallback(async S=>{await Nb(ke(),S),await A()},[ke,A]),ui=b.useCallback(async(S,V)=>{await xb(ke(),S,V),await A()},[ke,A]),di=b.useCallback(async S=>{await Sb(ke(),S),await A()},[ke,A]),pi=b.useCallback(async(S,V,N)=>{await ov(S,V.toISOString(),N),Ie(S),e("SST percentage updated","success")},[e]),cn=b.useCallback(async S=>{const V=yl(s,n,Be,at);await hb(ke(),S,V.pnl.netProfit)},[s,n,Be,at,ke]),Ht=b.useMemo(()=>yl(s,n,Be,at),[s,n,Be,at]),lt=b.useCallback(async S=>{await Zg(S)&&(await fe(),e("Budget added successfully","success"))},[fe,e]),rt=b.useCallback(async S=>{const V=await Hg(S);return V?(await o(),e("Account added successfully","success"),V):null},[o,e]),kt=b.useCallback(async(S,V)=>{await Kg(S,V),await o()},[o]),Kt=b.useCallback(async S=>{await Jg(S),await o()},[o]),Tn=b.useCallback(async S=>{gt(V=>[...V,S]),e("Stock Group added successfully","success")},[e]),An=b.useCallback(async(S,V)=>{gt(N=>N.map(M=>M.id===S?{...M,...V}:M)),e("Stock Group updated successfully","success")},[e]),kn=b.useCallback(async S=>{gt(V=>V.filter(N=>N.id!==S)),e("Stock Group deleted successfully","success")},[e]),Pn=b.useCallback(async(S,V)=>{await Ky(S,{status:V}),await G()},[G]),un=b.useCallback(async(S,V)=>{await ty(S)&&(await T(),e("Partner added successfully","success"))},[T,e]),In=b.useCallback(async(S,V)=>{await ny(S,V),await T()},[T]),mi=b.useCallback(async S=>{await oy(S)&&(await X(),e("Contribution recorded","success"))},[X,e]),Rn=b.useCallback(async S=>{await Yy(S)&&(await O(),e("Distribution recorded","success"))},[O,e]),dn=b.useCallback(async S=>{await Fd(S)&&(await v(),e("Commission person added","success"))},[v,e]),fi=b.useCallback(async(S,V)=>{console.log("Reconciling entries:",S,V),e("Entries reconciled successfully","success")},[e]),Bi=b.useMemo(()=>({accounts:n,accountingEntries:s,payments:c,expenses:f,commissionPersons:y,cheques:x,fixedAssets:C,liabilities:I,purchaseOrders:R,budgets:de,creditNotes:De,partners:L,capitalContributions:$,distributions:te,isLoading:an,recurringInvoices:U,sstPercentage:ve,expenseCategories:qe,commissionPayments:ot,setCommissionPayments:ht,stockGroups:Oe,addJournalEntry:Ct,addCheque:Dt,updateChequeStatus:st,addExpense:ln,updateExpense:Tt,deleteExpense:At,addAsset:ie,updateAsset:Pe,deleteAsset:li,addLiability:ci,updateLiability:ui,deleteLiability:di,updateSSTPercentage:pi,closeFiscalYear:cn,getFinancialSummary:Ht,addBudget:lt,addAccount:rt,updateAccount:kt,deleteAccount:Kt,updatePurchaseOrderStatus:Pn,addPartnerWithTransfers:un,updatePartner:In,addCapitalContribution:mi,addDistribution:Rn,addCommissionPerson:dn,reconcileEntries:fi,sstHistory:it,addStockGroup:Tn,updateStockGroup:An,deleteStockGroup:kn}),[n,s,c,f,y,x,C,I,R,de,De,L,$,te,an,U,ve,qe,Ht,ot,it,Oe,Ct,Dt,st,ln,Tt,At,ie,Pe,li,ci,ui,di,pi,cn,lt,rt,kt,Kt,Pn,un,In,mi,Rn,dn,fi,Tn,An,kn]);return m.jsxDEV(np.Provider,{value:Bi,children:t},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/AccountingContext.tsx",lineNumber:322,columnNumber:9},void 0)},ip=b.createContext(void 0),op=()=>{const t=b.useContext(ip);if(!t)throw new Error("useInventory must be used within an InventoryProvider");return t},wb=({children:t})=>{const{showToast:e}=$t(),[n,i]=b.useState("AVERAGE"),{data:o=[],isLoading:s,refetch:r}=Hd(),{data:a=[],isLoading:c,refetch:d}=hv(),{data:p=[],isLoading:f,refetch:h}=Kd(),{data:g=[],isLoading:y,refetch:_}=pv(),{data:v=[],isLoading:x,refetch:E}=mv(),{data:w=[],isLoading:C,refetch:P}=fv(),{data:k=[],isLoading:I,refetch:j}=gv(),{data:A=[],isLoading:R,refetch:q}=yv(),{data:G=[],isLoading:L,refetch:F}=Jd(),{data:T=[],isLoading:$,refetch:Q}=Wd(),{data:X=[],isLoading:te,refetch:J}=Xd(),O=s||c||f||y||x||C||I||R||L||$||te,{user:U}=Ut(),{addJournalEntry:H}=si(),{data:re=[]}=pa(),{data:de=[]}=da(),le=()=>({materials:T,setMaterials:async()=>await Q(),paperTypes:o,setPaperTypes:async()=>await r(),finishingOptions:a,setFinishingOptions:async()=>await d(),printingOptions:p,setPrintingOptions:async()=>await h(),plates:k,setPlates:async()=>await j(),finishingBlocks:A,setFinishingBlocks:async()=>await q(),warehouses:g,currentUser:U,accounts:re,showToast:e,processStockTransaction:async ie=>await Oe(ie)}),fe=()=>({inventoryTransactions:w,setInventoryTransactions:async()=>await P(),inventoryStock:v,setInventoryStock:async()=>await E(),materials:T,warehouses:g,setWarehouses:async()=>await _(),machines:[],setMachines:()=>{},machineLogs:[],setMachineLogs:()=>{},deliveryNotes:G,setDeliveryNotes:async()=>await F(),orders:de,accounts:re,paperTypes:o,printingOptions:p,showToast:e,addJournalEntry:H,ACC_INVENTORY:"0af35741-c8b0-516a-84ac-4507308cd507",ACC_AP:"c1e3562e-53ab-57ce-9138-8d6d4acff22b",ACC_WIP:"2c49a3dc-bc57-5813-86f6-f2a92c426e7f",ACC_OVERHEAD_DIGITAL:"837b1afa-a0ca-571d-8428-491c8db0ff5c",ACC_OVERHEAD_OFFSET:"a62a53ce-b9b1-5aaf-8b4f-6c1f228b6312"}),De=async ie=>{await Uv(le(),ie),await r()},K=async(ie,Pe)=>{await $v(le(),ie,Pe),await r()},ae=async ie=>{await Bv(le(),ie),await r()},ve=async ie=>{await Gv(le(),ie),await d()},Ie=async(ie,Pe)=>{await Hv(le(),ie,Pe),await d()},it=async ie=>{await Kv(le(),ie),await d()},Gt=async ie=>{await Jv(le(),ie),await h()},qe=async(ie,Pe)=>{await Wv(le(),ie,Pe),await h()},Ue=async ie=>{await zv(le(),ie),await h()},ot=async ie=>{await ib(fe(),ie),await _()},ht=async(ie,Pe)=>{await ob(fe(),ie,Pe),await _()},Oe=async ie=>{await nb(fe(),ie),await Promise.all([P(),E()])},gt=async ie=>{await Zd(fe(),ie)},an=async ie=>{const Pe=await Yv(le(),ie);return await j(),Pe},Be=async(ie,Pe)=>{await Qv(le(),ie,Pe),await j()},at=async ie=>{await Xv(le(),ie),await j()},ke=async ie=>{const Pe=await Zv(le(),ie);return await q(),Pe},Ct=async(ie,Pe)=>{await eb(le(),ie,Pe),await q()},Dt=async ie=>{await tb(le(),ie),await q()},st=async ie=>{const Pe=await jv(le(),ie);return await Q(),Pe},ln=async(ie,Pe)=>{await Fv(le(),ie,Pe),await Q()},Tt=async ie=>{await qv(le(),ie),await Q()},At=b.useMemo(()=>({materials:T,paperTypes:o,finishingOptions:a,printingOptions:p,warehouses:g,inventoryStock:v,inventoryTransactions:w,plates:k,finishingBlocks:A,deliveryNotes:G,inventoryCostingMethod:n,setInventoryCostingMethod:i,isLoading:O,addPaperType:De,updatePaperType:K,deletePaperType:ae,addFinishingOption:ve,updateFinishingOption:Ie,deleteFinishingOption:it,addPrintingOption:Gt,updatePrintingOption:qe,deletePrintingOption:Ue,addWarehouse:ot,updateWarehouse:ht,processStockTransaction:Oe,recalculateOrderCosts:gt,addPlate:an,updatePlate:Be,deletePlate:at,addFinishingBlock:ke,updateFinishingBlock:Ct,deleteFinishingBlock:Dt,addMaterial:st,updateMaterial:ln,deleteMaterial:Tt,purchaseOrders:X}),[o,a,p,g,v,w,k,A,G,n,O,de,T,X]);return m.jsxDEV(ip.Provider,{value:At,children:t},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/InventoryContext.tsx",lineNumber:267,columnNumber:9},void 0)},Cb=()=>ye({queryKey:["machines"],queryFn:async()=>{const t=await Og();return Array.isArray(t)?t:[]},staleTime:1e3*60*10}),Db=(t=0,e=100)=>ye({queryKey:["machine-logs",t,e],queryFn:async()=>{const n=await hy(t,e);return(Array.isArray(n)?n:[]).map(i=>({...i,startTime:new Date(i.startTime||i.start_time),endTime:i.endTime||i.end_time?new Date(i.endTime||i.end_time):void 0}))},staleTime:1e3*60*5}),Tb=()=>ye({queryKey:["maintenance-tasks"],queryFn:async()=>{const t=await my();return(Array.isArray(t)?t:[]).map(e=>({...e,createdAt:new Date(e.created_at||e.createdAt),scheduledDate:e.scheduled_date||e.scheduledDate?new Date(e.scheduled_date||e.scheduledDate):void 0,completedAt:e.completed_at||e.completedAt?new Date(e.completed_at||e.completedAt):void 0}))},staleTime:1e3*60*10}),sp=b.createContext(void 0),Ab=()=>{const t=b.useContext(sp);if(!t)throw new Error("useMachine must be used within a MachineProvider");return t},kb=({children:t})=>{const{showToast:e}=$t(),{addJournalEntry:n}=si(),{data:i=[]}=da(),{data:o=[]}=pa(),{data:s=[]}=Hd(),{data:r=[]}=Kd(),{data:a=[]}=Wd(),{data:c=[],isLoading:d,refetch:p}=Cb(),{data:f=[],isLoading:h,refetch:g}=Db(),{data:y=[],isLoading:_,refetch:v}=Tb(),{data:x=[],isLoading:E,refetch:w}=Jd(),C=d||h||_||E,P="0af35741-c8b0-516a-84ac-4507308cd507",k="c1e3562e-53ab-57ce-9138-8d6d4acff22b",I="2c49a3dc-bc57-5813-86f6-f2a92c426e7f",j="837b1afa-a0ca-571d-8428-491c8db0ff5c",A="a62a53ce-b9b1-5aaf-8b4f-6c1f228b6312",R=()=>({machines:c,setMachines:async()=>await p(),machineLogs:f,setMachineLogs:async()=>await g(),maintenanceTasks:y,setMaintenanceTasks:async()=>await v(),orders:i,accounts:o,addJournalEntry:n,paperTypes:s,printingOptions:r,materials:a,warehouses:[],inventoryStock:[],inventoryTransactions:[],deliveryNotes:x,setInventoryStock:()=>{},setInventoryTransactions:()=>{},setWarehouses:()=>{},setDeliveryNotes:()=>{},showToast:e,ACC_INVENTORY:P,ACC_AP:k,ACC_WIP:I,ACC_OVERHEAD_DIGITAL:j,ACC_OVERHEAD_OFFSET:A}),q=async O=>{await sb(R(),O),await p()},G=async(O,U)=>{await rb(R(),O,U),await p()},L=async O=>{await ab(R(),O),await p()},F=async(O,U,H,re="run")=>{const de=await ub(R(),O,U,H,re);return await g(),de},T=async O=>{await db(R(),O),await g()},$=async(O,U)=>{await pb(R(),O,U),await g()},Q=async(O,U)=>{await mb(R(),O,U)},X=async O=>{const U=await lb(R(),O);return await w(),U},te=async(O,U)=>{await cb(R(),O,U),await w()},J=b.useMemo(()=>({machines:c,machineLogs:f,maintenanceTasks:y,isLoading:C,addMachine:q,updateMachine:G,deleteMachine:L,startMachine:F,stopMachine:T,updateMachineLog:$,recordMachineDepreciation:Q,addDeliveryNote:X,markDelivered:te,deliveryNotes:x}),[c,f,y,C,x]);return m.jsxDEV(sp.Provider,{value:J,children:t},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/MachineContext.tsx",lineNumber:138,columnNumber:9},void 0)};async function Pb(t,e){try{const n={name:e.name,role:e.role,email:e.email,phone:e.phone,base_salary:e.baseSalary,hourly_rate:e.hourlyRate,commission_rate:e.commissionRate,bank_details:e.bankDetails,tax_bracket:e.taxBracket,is_attendance_monitor:e.isAttendanceMonitor},i=await fg(n);if(i){const o={...e,id:i.id,baseSalary:Number(i.base_salary||0),hourlyRate:Number(i.hourly_rate||0),commissionRate:Number(i.commission_rate||0),isAttendanceMonitor:i.is_attendance_monitor||!1};return t.setEmployees(s=>[...s,o]),t.showToast("Employee added successfully","success"),o}}catch(n){console.error("Failed to add employee:",n),t.showToast("Failed to add employee","error")}return null}async function Ib(t,e,n){try{const i={...n};n.baseSalary!==void 0&&(i.base_salary=n.baseSalary,delete i.baseSalary),n.hourlyRate!==void 0&&(i.hourly_rate=n.hourlyRate,delete i.hourlyRate),n.commissionRate!==void 0&&(i.commission_rate=n.commissionRate,delete i.commissionRate),n.bankDetails!==void 0&&(i.bank_details=n.bankDetails,delete i.bankDetails),n.taxBracket!==void 0&&(i.tax_bracket=n.taxBracket,delete i.taxBracket),n.isAttendanceMonitor!==void 0&&(i.is_attendance_monitor=n.isAttendanceMonitor,delete i.isAttendanceMonitor),await hg(e,i)&&(t.setEmployees(s=>s.map(r=>r.id===e?{...r,...n}:r)),t.showToast("Employee updated successfully","success"))}catch(i){console.error("Failed to update employee:",i),t.showToast("Failed to update employee","error")}}async function Rb(t,e){try{await gg(e),t.setEmployees(n=>n.filter(i=>i.id!==e)),t.showToast("Employee deleted successfully","success")}catch(n){console.error("Failed to delete employee:",n),t.showToast("Failed to delete employee","error")}}async function Mb(t,e){try{const n={employee_id:e.employeeId,date:e.date,check_in:e.checkIn,check_out:e.checkOut,status:e.status,location:e.location,notes:e.notes},i=await ry(n);i&&(t.setAttendanceRecords(o=>[...o,{...e,id:i.id}]),t.showToast("Attendance recorded","success"))}catch(n){console.error("Failed to add attendance record:",n),t.showToast("Failed to add attendance","error")}}async function Vb(t,e){try{const n={employee_id:e.employeeId,type:e.type,value:e.value,last_used:e.lastUsed},i=await ly(n);i&&t.setBiometricCredentials(o=>[...o,{...e,id:i.id}])}catch(n){console.error("Failed to add biometric credential:",n)}}async function Lb(t,e){var i,o;let n=0;for(const s of e)n+=s.amount,await t.addExpense({date:new Date,amount:s.amount,category:"salaries",description:"Salary Payout",paymentMethod:"bank_transfer"});try{const s=((i=t.accounts.find(a=>a.code==="5200"))==null?void 0:i.id)||"",r=((o=t.accounts.find(a=>a.code==="1000"))==null?void 0:o.id)||"";n>0&&s&&r&&await t.addJournalEntry("Payroll Run Batch",new Date,[{accountId:s,description:"Payroll Expense",debit:n,credit:0},{accountId:r,description:"Bank/Cash - Payroll Out",debit:0,credit:n}])}catch(s){console.error("Failed to post payroll journal entry",s)}t.showToast(`Processed payroll for ${e.length} employees`,"success")}async function Ob(t,e){try{const n={name:e.name,email:e.email,phone:e.phone,role:e.role,commission_rate:e.commissionRate},i=await Fd(n);if(i){const o={...e,id:i.id,totalCommission:0,pendingCommission:0,paidCommission:0,totalSales:0,joinDate:new Date};return t.setCommissionPersons(s=>[...s,o]),t.showToast("Commission person added","success"),o}}catch(n){console.error("Failed to add commission person:",n),t.showToast("Failed to add commission person","error")}return null}const rp=b.createContext(void 0),jb=()=>{const t=b.useContext(rp);if(!t)throw new Error("useHR must be used within an HRProvider");return t},Fb=({children:t})=>{const{showToast:e}=$t(),{addExpense:n,addJournalEntry:i,accounts:o}=si(),{data:s=[],isLoading:r,refetch:a}=_v(),{data:c=[],isLoading:d,refetch:p}=Tv(),{data:f=[],isLoading:h,refetch:g}=Av(),{data:y=[],isLoading:_,refetch:v}=Qd(),x=r||d||h||_,E=()=>({employees:s,setEmployees:async()=>await a(),attendanceRecords:c,setAttendanceRecords:async()=>await p(),biometricCredentials:f,setBiometricCredentials:async()=>await g(),commissionPersons:y,setCommissionPersons:async()=>await v(),accounts:o,showToast:e,addExpense:n,addJournalEntry:i}),w=async q=>await Pb(E(),q),C=async(q,G)=>{await Ib(E(),q,G)},P=async q=>{await Rb(E(),q)},k=async q=>{await Mb(E(),q)},I=async q=>{await Vb(E(),q)},j=async q=>{await Lb(E(),q)},A=async q=>await Ob(E(),q),R=b.useMemo(()=>({employees:s,attendanceRecords:c,biometricCredentials:f,commissionPersons:y,isLoading:x,addEmployee:w,updateEmployee:C,deleteEmployee:P,addAttendanceRecord:k,addBiometricCredential:I,processPayroll:j,addCommissionPerson:A}),[s,c,f,y,x]);return m.jsxDEV(rp.Provider,{value:R,children:t},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/HRContext.tsx",lineNumber:96,columnNumber:9},void 0)};async function qb(t,e){try{const n={name:e.name,email:e.email||null,phone:e.phone||null,address:e.address||null,company:e.company||null},i=await Zh(n);if(i){const o=t.mapCustomerFromDB(i);return t.setCustomers(s=>[...s,o]),t.showToast("Customer added successfully","success"),o}throw new Error("Failed to create customer")}catch(n){throw console.error("CRM: addCustomer error:",n),t.showToast("Failed to create customer","error"),n}}async function Ub(t,e,n){try{const i={...n};n.tin&&(i.tax_id=n.tin,delete i.tin),n.grantPortalAccess!==void 0&&(i.grant_portal_access=n.grantPortalAccess,delete i.grantPortalAccess),n.portalEmail&&(i.portal_email=n.portalEmail,delete i.portalEmail),n.portalPassword&&(i.portal_password=n.portalPassword,delete i.portalPassword);const o=await eg(e,i);if(o){const s=t.mapCustomerFromDB(o);t.setCustomers(r=>r.map(a=>a.id===e?s:a)),t.showToast("Customer updated successfully","success")}}catch(i){console.error("CRM: updateCustomer error:",i),t.showToast("Failed to update customer","error")}}async function $b(t,e){try{await tg(e),t.setCustomers(n=>n.filter(i=>i.id!==e)),t.showToast("Customer deleted successfully","success")}catch(n){console.error("CRM: deleteCustomer error:",n),t.showToast("Failed to delete customer","error")}}async function Bb(t,e){var n,i;try{const o={name:e.name,contact:e.contact,email:e.email,phone:e.phone,address:e.address,tax_id:e.tin,category:e.category,current_balance:e.currentBalance,credit_limit:e.creditLimit,payment_terms:e.paymentTerms,is_active:e.isActive,has_portal_access:e.hasPortalAccess,portal_username:e.hasPortalAccess?(n=e.portalCredentials)==null?void 0:n.username:void 0,portal_password:e.hasPortalAccess?(i=e.portalCredentials)==null?void 0:i.password:void 0},s=await rg(o);if(s){const r=t.mapSupplierFromDB(s);t.setSuppliers(a=>[r,...a]),t.showToast("Supplier added successfully","success")}else t.showToast("Failed to add supplier","error")}catch(o){console.error("CRM: addSupplier error:",o),t.showToast("Failed to add supplier","error")}}async function Gb(t,e,n){try{const i={...n};n.paymentTerms&&(i.payment_terms=n.paymentTerms,delete i.paymentTerms),n.creditLimit&&(i.credit_limit=n.creditLimit,delete i.creditLimit),n.currentBalance!==void 0&&(i.current_balance=n.currentBalance,delete i.currentBalance),n.tin&&(i.tax_id=n.tin,delete i.tin),n.hasPortalAccess!==void 0&&(i.has_portal_access=n.hasPortalAccess,delete i.hasPortalAccess),n.isActive!==void 0&&(i.is_active=n.isActive,delete i.isActive),n.totalPurchases!==void 0&&(i.total_purchases=n.totalPurchases,delete i.totalPurchases),n.portalCredentials&&(n.portalCredentials.username&&(i.portal_username=n.portalCredentials.username),n.portalCredentials.password&&(i.portal_password=n.portalCredentials.password),delete i.portalCredentials);const o=await ag(e,i);if(o){const s=t.mapSupplierFromDB(o);t.setSuppliers(r=>r.map(a=>a.id===e?s:a)),t.showToast("Supplier updated successfully","success")}}catch(i){console.error("CRM: updateSupplier error:",i),t.showToast("Failed to update supplier","error")}}async function Hb(t,e){try{await lg(e),t.setSuppliers(n=>n.filter(i=>i.id!==e)),t.showToast("Supplier deleted successfully","success")}catch(n){console.error("CRM: deleteSupplier error:",n),t.showToast("Failed to delete supplier","error")}}async function Kb(t,e){try{const n={customer_id:e.customerId,note:e.note,type:e.type,author_id:e.authorId},i=await Ny(n);if(i){const o={id:i.id,customerId:i.customer_id,note:i.note,type:i.type,authorId:i.author_id,createdAt:new Date(i.created_at)};t.setCustomerMonitorNotes(s=>[...s,o]),t.showToast("Note added successfully","success")}}catch(n){console.error("CRM: addCustomerMonitorNote error:",n),t.showToast("Failed to add note","error")}}const Jb=t=>({id:t.id,orderId:t.order_id,customerId:t.customer_id,amount:Number(t.amount||0),type:t.type,method:t.method,status:t.status,date:new Date(t.created_at||t.date||Date.now()),reference:t.reference,receiptNumber:t.receipt_number||"",bankDetails:t.bank_details,cardLastFour:t.card_last_four,chequeDetails:t.cheque_details,proofUrl:t.proof_url}),Wb=t=>({...t,id:t.id,createdAt:new Date(t.created_at||Date.now()),totalOrders:t.total_orders||0,totalSpent:Number(t.total_spent||0),accountBalance:Number(t.account_balance||0),tin:t.tax_id,grantPortalAccess:t.grant_portal_access,portalEmail:t.portal_email,portalPassword:t.portal_password}),zb=t=>({...t,id:t.id,totalPurchases:Number(t.total_purchases||0),currentBalance:Number(t.current_balance||0),creditLimit:Number(t.credit_limit||0),paymentTerms:t.payment_terms||"net30",tin:t.tax_id,hasPortalAccess:t.has_portal_access,isActive:t.is_active,portalCredentials:t.portal_username?{username:t.portal_username,password:t.portal_password}:void 0}),ap=b.createContext(void 0),lp=()=>{const t=b.useContext(ap);if(!t)throw new Error("useCRM must be used within a CRMProvider");return t},Yb=({children:t})=>{const{showToast:e}=$t(),{data:n=[],isLoading:i,refetch:o}=vv(),{data:s=[],isLoading:r,refetch:a}=bv(),{data:c=[],isLoading:d,refetch:p}=Pv(),f=i||r||d,h=()=>({customers:n,setCustomers:async()=>await o(),suppliers:s,setSuppliers:async()=>await a(),monitorNotes:c,setMonitorNotes:async()=>await p(),showToast:e,mapCustomerFromDB:Wb,mapSupplierFromDB:zb}),g=async I=>{const j=await qb(h(),I);return await o(),j},y=async(I,j)=>{await Ub(h(),I,j),await o()},_=async I=>{await $b(h(),I),await o()},v=async I=>{const j=await Bb(h(),I);return await a(),j},x=async(I,j)=>{await Gb(h(),I,j),await a()},E=async I=>{await Hb(h(),I),await a()},w=async I=>{await Kb(h(),I),await p()},[C,P]=ue.useState(null),k=b.useMemo(()=>({customers:n,suppliers:s,customerMonitorNotes:c,isLoading:f,viewingSupplierId:C,setViewingSupplierId:P,addCustomer:g,updateCustomer:y,deleteCustomer:_,addSupplier:v,updateSupplier:x,deleteSupplier:E,addCustomerMonitorNote:w}),[n,s,c,f,C]);return m.jsxDEV(ap.Provider,{value:k,children:t},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/CRMContext.tsx",lineNumber:106,columnNumber:9},void 0)};async function cp(t,e){var c,d;const n=t.printingOptions.find(p=>p.id===e.specifications.printingOptionId);let i=0;if(n&&n.priceTiers){const p=((c=e.specifications.quantities[0])==null?void 0:c.qty)||1,f=n.priceTiers.find(h=>p>=h.fromQty&&(h.toQty===null||p<=h.toQty));f&&n.supplierId&&typeof f.costPrice=="number"&&(i=f.costPrice*p)}let o=[{id:`ps-${Date.now()}-1`,name:"Artwork Verification",type:"artwork",status:"pending",estimatedDays:1,order:1}];(n==null?void 0:n.type)==="Offset"&&o.push({id:`ps-${Date.now()}-plates`,name:"Printing Plates",type:"printing_plates",status:"pending",estimatedDays:1,order:2,supplierId:e.specifications.printingPlatesSupplierId,cost:e.specifications.printingPlatesPrice||0}),n&&o.push({id:`ps-${Date.now()}-printing`,name:`Printing(${n.name})`,type:"printing",status:"pending",estimatedDays:2,order:2,supplierId:n.supplierId,cost:i,finishingOptionId:void 0}),e.specifications.finishing.forEach(p=>{var _;const f=((_=e.specifications.quantities[0])==null?void 0:_.qty)||1,h=p.priceTiers.find(v=>f>=v.fromQty&&(v.toQty===null||f<=v.toQty))||p.priceTiers[0],y=(h?h.costPrice:0)*f;o.push({id:`ps-${Date.now()}-${p.id}`,name:p.name,type:"finishing",status:"pending",supplierId:p.supplierId,cost:y,estimatedDays:p.estimatedDays,finishingOptionId:p.id,finishingBlockId:p.finishingBlockId})}),o.push({id:`ps-${Date.now()}-qc`,name:"Quality Control",type:"quality_check",status:"pending",estimatedDays:1,order:0},{id:`ps-${Date.now()}-pack`,name:"Packaging",type:"packaging",status:"pending",estimatedDays:1,order:0},{id:`ps-${Date.now()}-delivery`,name:"Ready for Delivery",type:"delivery",status:"pending",estimatedDays:0,order:0});let s=1;o=o.filter(Boolean).map(p=>({...p,order:s++}));const r={invoice_number:e.invoiceNumber||`INV-${Date.now()}`,barcode:e.barcode||"",customer_id:e.customerId||null,title:e.title,status:e.status||"pending",payment_status:e.paymentStatus||"unpaid",total_price:e.totalPrice||0,sst_percentage:e.sstPercentage||0,specifications:e.specifications,current_production_step_index:0,estimated_delivery:e.estimatedDelivery||null,created_at:new Date},a=await ig(r);if(a){const p={...e,id:a.id,invoiceNumber:a.invoice_number,totalPrice:Number(e.totalPrice||0),createdAt:new Date(a.created_at),currentProductionStepIndex:a.current_production_step_index,status:a.status,productionSteps:(a.production_steps||[]).map(f=>{let h=f.supplier_id;return!h&&f.notes&&f.notes.startsWith("Supplier: ")&&(h=f.notes.replace("Supplier: ","")),{id:f.id,name:f.name,type:f.type,status:f.status,startedAt:f.started_at?new Date(f.started_at):void 0,finishedAt:f.completed_at?new Date(f.completed_at):void 0,cost:Number(f.cost),order:f.step_order,estimatedDays:f.estimated_days,supplierId:h,finishingBlockId:f.finishing_block_id,receivedAt:f.received_at?new Date(f.received_at):void 0,receivedBy:f.received_by}})};t.setOrders(f=>[p,...f]);try{const f=e.specifications.paperType,h=t.paperTypes.find(g=>g.name===f);if(h){const g=((d=e.specifications.quantities[0])==null?void 0:d.qty)||0,y=Math.ceil(g*1.05);await dv(h.id,y),t.setPaperTypes(_=>_.map(v=>v.id===h.id?{...v,inStock:Math.max(0,v.inStock-y)}:v));try{const _=y*(h.pricePerUnit||0);_>0&&await t.addJournalEntry(`WIP - Paper for Order #${p.invoiceNumber} (${f})`,new Date,[{accountId:t.ACC_WIP,description:"Debit WIP - Paper Consumption",debit:_,credit:0},{accountId:t.ACC_INVENTORY,description:"Credit Inventory - Paper Stock Reduction",debit:0,credit:_}])}catch(_){console.error("Failed to create Paper WIP entry",_)}}}catch(f){console.error("Failed to automatically deduct paper stock:",f)}return p}throw new Error("Failed to create order in database")}async function Qb(t,e,n){const i={...n};n.customerId&&(i.customer_id=n.customerId),n.customerName&&delete i.customerName,n.invoiceNumber&&(i.invoice_number=n.invoiceNumber),n.totalPrice&&(i.total_price=n.totalPrice),n.paymentStatus&&(i.payment_status=n.paymentStatus),n.currentProductionStepIndex!==void 0&&(i.current_production_step_index=n.currentProductionStepIndex),n.sstPercentage&&(i.sst_percentage=n.sstPercentage),n.eInvoiceStatus&&(i.e_invoice_status=n.eInvoiceStatus),n.estimatedDelivery&&(i.estimated_delivery=n.estimatedDelivery),delete i.customerId,delete i.invoiceNumber,delete i.totalPrice,delete i.paymentStatus,delete i.currentProductionStepIndex,delete i.sstPercentage,delete i.eInvoiceStatus,delete i.estimatedDelivery,delete i.productionSteps,await ii(e,i)&&t.setOrders(s=>s.map(r=>r.id===e?{...r,...n}:r))}async function Xb(t,e){const n=t.orders.find(o=>o.id===e);if(!n)return;t.accountingEntries.some(o=>o.orderId===e)?(console.warn(`ERP Auditor: Order ${n.invoiceNumber} has accounting entries. Voiding instead of deleting.`),await ii(e,{status:"voided"}),t.setOrders(o=>o.map(s=>s.id===e?{...s,status:"voided"}:s)),t.showToast("Order voided (cannot delete due to financial history)","info")):(await og(e),t.setOrders(o=>o.filter(s=>s.id!==e)),t.showToast("Order deleted","success"))}async function Zb(t,e){try{const n={quotation_number:e.quotationNumber||`QTN-${Date.now()}`,customer_id:e.customerId,customer_name:e.customerName,title:e.title,total:e.totalPrice,status:e.status||"draft",specifications:e.specifications,expiry_date:e.validUntil||new Date(Date.now()+2592e6)},i=await uy(n);if(i){const o={...e,id:i.id,quotationNumber:i.quotation_number||n.quotation_number,total:Number(n.total||0),createdAt:new Date,date:new Date,expiryDate:new Date(n.expiry_date)};t.setQuotations(s=>[...s,o]),t.showToast("Quotation created","success")}}catch(n){console.error("Failed to add quotation:",n),t.showToast("Failed to add quotation","error")}}async function e_(t,e,n,i,o){const s=t.quotations.find(c=>c.id===e);if(!s)throw new Error("Quotation not found");const r={customerId:s.customerId,customerName:s.customerName,invoiceNumber:`INV-${Date.now()}`,title:s.title||`Order from ${s.quotationNumber}`,totalPrice:n*(s.totalPrice/s.specifications.quantities[0].qty),paidAmount:0,paymentStatus:"unpaid",status:"pending_payment",estimatedDelivery:new Date(Date.now()+7*24*60*60*1e3),specifications:{...s.specifications,quantities:[{qty:n,price:s.totalPrice}]},files:s.files,barcode:`ORD-${Date.now()}`,productionSteps:[],currentProductionStepIndex:0,sstPercentage:s.sstPercentage||6,eInvoiceStatus:"not_submitted"},a=await cp(t,r);return i>0&&await up(t,a.id,i,o,"Online Transfer",{}),a}async function up(t,e,n,i,o,s){const r=t.orders.find(h=>h.id===e);if(!r)return;const c=t.payments.filter(h=>h.orderId===e).reduce((h,g)=>h+g.amount,0)+n;let d=r.paymentStatus;c>=r.totalPrice?d="paid":c>0&&(d="partial_payment"),await ii(e,{payment_status:d}),t.setOrders(h=>h.map(g=>g.id===e?{...g,paymentStatus:d}:g));const p={order_id:e,amount:n,type:i,method:o,reference:s.reference||"",receipt_number:`REC-${Date.now()}`,bank_details:s.bankDetails,card_last_four:s.cardLastFour,cheque_details:s.chequeDetails,status:"completed"},f=await av(p);if(f){const h=t.mapPaymentFromDB(f);t.setPayments(g=>[...g,h]),r.commissionPersonId&&await t.calculateCommission(e,n);try{const g=t.accounts.find(y=>(y.name||"").toLowerCase()===(o||"").toLowerCase())||t.accounts.find(y=>y.type==="Asset"&&(y.name||"").toLowerCase().includes((o||"").toLowerCase()))||t.accounts.find(y=>y.name==="Bank Account - Maybank")||t.accounts.find(y=>y.code==="1010");if(g){const y=["delivered","ready_for_delivery","ready_for_pickup"].includes(r.status),_=y?t.ACC_AR:t.ACC_DEPOSITS,v=y?`Credit AR - Order #${r.invoiceNumber} Settlement`:`Credit Customer Deposits - Advance for Order #${r.invoiceNumber}`;await t.addJournalEntry(`Payment Received - Order #${r.invoiceNumber} (${o})`,new Date,[{accountId:g.id,description:`Debit ${g.name} - Payment Received`,debit:n,credit:0},{accountId:_,description:v,debit:0,credit:n}])}}catch(g){console.error("Failed to create Payment accounting entry",g)}return h}}async function t_(t,e){const n=`cn-${Date.now()}`,i=`CN-${Date.now()}`,o={...e,id:n,creditNoteNumber:i};try{const s=t.orders.find(d=>d.invoiceNumber===e.originalInvoiceNumber),r=e.subtotal,a=e.tax,c=e.total;return c>0&&(await t.addJournalEntry(`Credit Note Issued - ${i} (Ref: ${e.originalInvoiceNumber})`,new Date,[{accountId:t.ACC_REVENUE,description:"Debit Sales Revenue - Partial Return",debit:r,credit:0},{accountId:t.ACC_SST,description:"Debit SST Payable - Tax Adjustment",debit:a,credit:0},{accountId:t.ACC_AR,description:`Credit Accounts Receivable - ${i}`,debit:0,credit:c}]),s&&console.log(`CPA: Credit Note ${i} applied to Order #${s.invoiceNumber}`)),t.setCreditNotes(d=>[o,...d]),t.showToast(`Credit Note ${i} issued`,"success"),o}catch(s){console.error("Failed to issue credit note",s),t.showToast("Error issuing credit note","error")}}function n_(t){console.log("Generate Receipt PDF")}async function i_(t,e,n){var i,o,s,r,a,c,d,p,f;try{const h=t.orders.find(v=>v.id===e);if(!h)return;const g=h.status;if(await ii(e,{status:n}),n==="in_production"&&g!=="in_production")try{let v=0;const x=h.specifications.paperType,E=t.paperTypes.find(w=>w.name===x);if(E){const w=((i=h.specifications.quantities[0])==null?void 0:i.qty)||0;v=Math.ceil(w*1.05)*(E.pricePerUnit||0)}v>0&&await t.addJournalEntry(`Production Start - Order #${h.invoiceNumber}`,new Date,[{accountId:t.ACC_WIP,description:"Debit WIP - Material Issue (Paper)",debit:v,credit:0},{accountId:t.ACC_INV_RAW_MAT,description:"Credit Raw Materials - Paper Issue",debit:0,credit:v}])}catch(v){console.error("Failed to process Production Start journal",v)}t.setOrders(v=>v.map(x=>x.id===e?{...x,status:n}:x));const y=["delivered"].includes(n)&&!["delivered"].includes(g);if(["ready_for_delivery","ready_for_pickup"].includes(n)&&!["ready_for_delivery","ready_for_pickup","delivered"].includes(g))try{let v=0;const x=h.specifications.paperType,E=t.paperTypes.find(I=>I.name===x);if(E){const I=((o=h.specifications.quantities[0])==null?void 0:o.qty)||0,j=Math.ceil(I*1.05);v+=j*(E.pricePerUnit||0)}const w=h.productionSteps.filter(I=>I.type==="printing"),C=((s=h.specifications.quantities[0])==null?void 0:s.qty)||0,P=t.materials.filter(I=>(I.name||"").toLowerCase().includes("ink"));for(const I of w)for(const j of P){const A=C/1e3*.1;v+=A*(j.unitPrice||0)}const k=v*.2;v+=k,v>0&&await t.addJournalEntry(`Job Completion - Order #${h.invoiceNumber}`,new Date,[{accountId:t.ACC_INV_FG,description:"Debit Finished Goods - Order Completed",debit:v,credit:0},{accountId:t.ACC_WIP,description:"Credit WIP - Transfer to FG",debit:0,credit:v}])}catch(v){console.error("Failed to process Job Completion journal",v)}if(y){try{const v=h.totalPrice||0,x=h.sstPercentage||0,E=v/(1+x/100),w=v-E;v>0&&await t.addJournalEntry(`Revenue Recognition - Order #${h.invoiceNumber}`,new Date,[{accountId:t.ACC_AR,description:"Debit Accounts Receivable - Order Fulfillment",debit:v,credit:0},{accountId:t.ACC_REVENUE,description:"Credit Sales Revenue - Order Fulfillment",debit:0,credit:E},{accountId:t.ACC_SST,description:"Credit SST Payable - Tax Recognition",debit:0,credit:w}])}catch(v){console.error("Failed to recognize revenue",v)}try{const x=t.payments.filter(E=>E.orderId===h.id).filter(E=>E.type==="deposit").reduce((E,w)=>E+w.amount,0);x>0&&await t.addJournalEntry(`Clear Customer Deposit - Order #${h.invoiceNumber}`,new Date,[{accountId:t.ACC_DEPOSITS,description:"Debit Customer Deposits - Fulfillment Clearance",debit:x,credit:0},{accountId:t.ACC_AR,description:"Credit Accounts Receivable - Deposit Application",debit:0,credit:x}])}catch(v){console.error("Failed to clear customer deposits",v)}try{let v=0,x=0;const E=h.specifications.paperType,w=t.paperTypes.find(A=>A.name===E);if(w){const A=((r=h.specifications.quantities[0])==null?void 0:r.qty)||0;v=Math.ceil(A*1.05)*(w.pricePerUnit||0)}const C=h.productionSteps.filter(A=>A.type==="printing"),P=((a=h.specifications.quantities[0])==null?void 0:a.qty)||0,k=t.materials.filter(A=>(A.name||"").toLowerCase().includes("ink"));for(const A of C)for(const R of k){const q=P/1e3*.1;x+=q*(R.unitPrice||0)}const I=(v+x)*.2,j=v+x+I;j>0&&await t.addJournalEntry(`COGS Recognition - Order #${h.invoiceNumber}`,new Date,[{accountId:t.ACC_COGS,description:"Debit COGS - Product Shipment",debit:j,credit:0},{accountId:t.ACC_INV_FG,description:"Credit Finished Goods - Sale",debit:0,credit:j}])}catch(v){console.error("Failed to transfer WIP to COGS",v)}try{const v=h.specifications.paperType,x=t.paperTypes.find(k=>k.name===v),E=((c=h.specifications.quantities[0])==null?void 0:c.qty)||0,w=x?Math.ceil(E*1.05)*(x.pricePerUnit||0):0,C=h.productionSteps.filter(k=>k.type==="printing").length*t.materials.filter(k=>k.name.toLowerCase().includes("ink")).reduce((k,I)=>k+E/1e3*.1*(I.unitPrice||0),0),P=w+C+(w+C)*.2;if(h.commissionPersonId){const k=t.commissionPersons.find(I=>I.id===h.commissionPersonId);if(k){const I=h.totalPrice||0,j=h.sstPercentage||0,A=I/(1+j/100),R=Math.max(0,A-P);let q=0;if(k.commissionType==="percentage"?q=R*((k.commissionRate||0)/100):q=k.commissionAmount||0,q>0){const G={id:`cpymt-${Date.now()}`,personId:k.id,personName:k.name,amount:q,date:new Date,status:"pending",orderId:h.id,orderReference:h.invoiceNumber};t.setCommissionPayments(L=>[...L,G]),t.setCommissionPersons(L=>L.map(F=>F.id===k.id?{...F,pendingCommission:F.pendingCommission+q,totalCommission:F.totalCommission+q,totalSales:F.totalSales+A}:F))}}}}catch(v){console.error("Failed to process commission",v)}try{if(h.customerId){const v=h.totalPrice||0;await lv(h.customerId,v,1)}}catch(v){console.error("Failed to update CRM tracking analytics",v)}}if(n==="cancelled"&&g!=="cancelled")try{let v=0;const x=h.specifications.paperType,E=t.paperTypes.find(C=>C.name===x);if(E){const C=((d=h.specifications.quantities[0])==null?void 0:d.qty)||0;v=Math.ceil(C*1.05)*(E.pricePerUnit||0)}const w=(h.productionSteps||[]).filter(C=>C.status==="completed").reduce((C,P)=>C+(Number(P.cost)||0),0);if(v+=w,v+=v*.2,v>0){await t.addJournalEntry(`Cancellation Loss - Order #${h.invoiceNumber}`,new Date,[{accountId:t.ACC_SPOILAGE,description:`Loss on Cancelled Order #${h.invoiceNumber}`,debit:v,credit:0},{accountId:t.ACC_WIP,description:"Credit WIP - Reversal on Cancellation",debit:0,credit:v}]);const P=t.payments.filter(k=>k.orderId===h.id).filter(k=>k.type==="deposit").reduce((k,I)=>k+I.amount,0);if(P>0){const k=Math.min(P,v);await t.addJournalEntry(`Cost Recovery from Deposit - Order #${h.invoiceNumber}`,new Date,[{accountId:t.ACC_DEPOSITS,description:"Debit Deposit - Cost Recovery for Cancellation",debit:k,credit:0},{accountId:t.ACC_SPOILAGE,description:"Credit Spoilage - Recovery from Deposit",debit:0,credit:k}])}}}catch(v){console.error("Failed to process Cancellation logic",v)}if(n==="rejected"&&g!=="rejected")try{let v=0,x=0;const E=h.specifications.paperType,w=t.paperTypes.find(R=>R.name===E);if(w){const R=((p=h.specifications.quantities[0])==null?void 0:p.qty)||0;v=Math.ceil(R*1.05)*(w.pricePerUnit||0)}const C=h.productionSteps.filter(R=>R.type==="printing"&&R.status==="completed"),P=((f=h.specifications.quantities[0])==null?void 0:f.qty)||0,k=t.materials.filter(R=>(R.name||"").toLowerCase().includes("ink"));for(const R of C)for(const q of k){const G=P/1e3*.1;x+=G*(q.unitPrice||0)}const I=v+x+(v+x)*.2,j=h.productionSteps.filter(R=>R.supplierId&&R.status==="completed").reduce((R,q)=>R+(q.cost||0),0),A=I+j;A>0&&await t.addJournalEntry(`Spoilage Recognition - Rejected Order #${h.invoiceNumber}`,new Date,[{accountId:t.ACC_SPOILAGE,description:"Debit Spoilage Expense - Order Rejection",debit:A,credit:0},{accountId:t.ACC_WIP,description:"Credit WIP - Clearing Cost of Rejected Job",debit:0,credit:A}])}catch(v){console.error("Failed to recognize spoilage",v)}t.showToast(`Order status updated to ${n}`,"success")}catch(h){console.error("Failed to update order status:",h),t.showToast("Error updating order status","error")}}const dp=b.createContext(void 0),pp=()=>{const t=b.useContext(dp);if(!t)throw new Error("useOrdersContext must be used within an OrderProvider");return t},qI=pp,o_=({children:t})=>{const{showToast:e}=$t(),{data:n=[],isLoading:i,refetch:o}=da(),{data:s=[],isLoading:r,refetch:a}=kv(),{data:c=[],isLoading:d,refetch:p}=Yd(),{data:f=[]}=zd(),{printingOptions:h,paperTypes:g,materials:y}=op(),{accounts:_,addJournalEntry:v}=si(),[x,E]=b.useState([]),w=b.useMemo(()=>n.length>0?n:x,[n,x]),C=s,P=c,k=i||r||d,I="7f9103e9-01f1-5f28-a567-2f3b978c430e",j="0af35741-c8b0-516a-84ac-4507308cd507",A="3a2e1d0c-b9b1-5aaf-8b4f-6c1f228b6312",R="d4c3b2a1-01f1-5f28-a567-2f3b978c430e",q="5441b8ec-52d8-5dee-af3b-983203d8f3d1",G="191f05d0-565f-5cea-935b-b1fb39129942",L=()=>({orders:w,setOrders:re=>{if(typeof re=="function"){const de=re(w);E(de)}},printingOptions:h,paperTypes:g,setPaperTypes:()=>{},accountingEntries:f,quotations:C,setQuotations:async()=>await a(),payments:P,setPayments:async()=>await p(),creditNotes:[],setCreditNotes:()=>{},materials:y,commissionPersons:[],setCommissionPersons:()=>{},setCommissionPayments:()=>{},accounts:_,addJournalEntry:v,showToast:e,calculateCommission:async()=>{},ACC_WIP:I,ACC_INVENTORY:j,ACC_DEPOSITS:A,ACC_AR:R,ACC_REVENUE:q,ACC_SST:G,ACC_INV_RAW_MAT:"550e8400-e29b-41d4-a716-446655440000",ACC_INV_FG:"550e8400-e29b-41d4-a716-446655440001",ACC_COGS:"6441b8ec-52d8-5dee-af3b-983203d8f3d1",ACC_SPOILAGE:"550e8400-e29b-41d4-a716-446655440002",mapPaymentFromDB:Jb}),F=async re=>{const de=await cp(L(),re);return await o(),de.id},T=async(re,de)=>{await Qb(L(),re,de),await o()},$=async re=>{await Xb(L(),re),await o()},Q=async(re,de)=>{await i_(L(),re,de),await o()},X=async re=>(await Zb(L(),re),await a(),"new-id"),te=async(re,de,le,fe)=>{const De=await e_(L(),re,de,le,fe);return await Promise.all([o(),a()]),De.id},J=async(re,de,le,fe,De)=>{const K=await up(L(),re,de,le,fe,De);return await Promise.all([o(),p()]),K},O=async re=>{await t_(L(),re)},U=async(re,de)=>{n_(),e("Receipt generated","success")},H=b.useMemo(()=>({orders:w,quotations:C,payments:P,isLoading:k,setOrders:E,addOrder:F,updateOrder:T,deleteOrder:$,updateOrderStatus:Q,addQuotation:X,convertQuotationToOrder:te,processPayment:J,addCreditNote:O,generateDepositReceipt:U}),[w,C,P,k]);return m.jsxDEV(dp.Provider,{value:H,children:t},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/OrderContext.tsx",lineNumber:162,columnNumber:9},void 0)};async function s_(t,e,n){try{const i=n.map((d,p)=>({...d,order:p+1})),o=t.orders.find(d=>d.id===e);if(!o)return;const s=o.productionSteps,r=new Set(n.map(d=>d.id)),a=s.filter(d=>!r.has(d.id));for(const d of a)d.id.startsWith("custom-")||await rv(d.id);const c=[];for(const d of i){const p={order_id:e,type:d.type,label:d.label,sequence_order:d.order,estimated_duration:d.estimatedDays,status:d.status||"pending",assigned_to:d.assignedTo,department:d.department,name:d.name,cost:d.cost||0,finishing_block_id:d.finishingBlockId||null,started_at:d.startedAt?d.startedAt.toISOString():null,completed_at:d.finishedAt?d.finishedAt.toISOString():null,received_at:d.receivedAt?d.receivedAt.toISOString():null,notes:d.supplierId?`Supplier: ${d.supplierId}`:null};if(d.id.startsWith("custom-")){const f=await sv(p);c.push({...d,id:f.id,status:f.status,startedAt:f.started_at?new Date(f.started_at):void 0,finishedAt:f.completed_at?new Date(f.completed_at):void 0})}else await oi(d.id,p),c.push(d)}t.setOrders(d=>d.map(p=>p.id===e?{...p,productionSteps:c}:p)),t.showToast("Process steps updated","success")}catch(i){console.error("Failed to update step order:",i),t.showToast("Failed to save changes","error")}}async function r_(t,e,n,i){var o;try{const s=t.orders.find(c=>c.id===e);if(!s)return;const r=s.productionSteps.find(c=>c.id===n);if(!r||!r.finishingBlockId)return;await t.updateFinishingBlock(r.finishingBlockId,{status:"in_use",location:"Production Station",lastUsed:new Date,timesUsed:(((o=t.finishingBlocks.find(c=>c.id===r.finishingBlockId))==null?void 0:o.timesUsed)||0)+1});const a=s.productionSteps.map(c=>c.id===n?{...c,status:"in_progress",blockStatus:"at_station",startedAt:new Date,startedBy:i}:c);await oi(n,{status:"in_progress",started_at:new Date().toISOString()}),t.setOrders(c=>c.map(d=>d.id===e?{...d,productionSteps:a}:d)),t.showToast("Block handed in and step started","success")}catch(s){console.error("Failed to start step with block:",s),t.showToast("Error processing block action","error")}}async function a_(t,e,n,i,o){try{const s=t.orders.find(a=>a.id===e);if(!s)return;const r=s.productionSteps.find(a=>a.id===n);if(!r||!r.finishingBlockId)return;await t.updateFinishingBlock(r.finishingBlockId,{status:i==="returned"?"available":"with_supplier",location:o.location||"Storage",lastUsed:new Date}),await ma(t,e,n,o.userId),t.setOrders(a=>a.map(c=>c.id===e?{...c,productionSteps:c.productionSteps.map(d=>d.id===n?{...d,blockStatus:i}:d)}:c))}catch(s){console.error("Failed to finish step with block:",s),t.showToast("Error processing block return","error")}}async function l_(t,e,n,i){var o;try{const s=t.orders.find(c=>c.id===e);if(!s)return;const r=s.productionSteps.find(c=>c.id===n);if(!r||!r.plateId)return;await t.updatePlate(r.plateId,{status:"in_use",location:"Production Station",lastUsed:new Date,timesUsed:(((o=t.plates.find(c=>c.id===r.plateId))==null?void 0:o.timesUsed)||0)+1});const a=s.productionSteps.map(c=>c.id===n?{...c,status:"in_progress",plateStatus:"at_station",startedAt:new Date,startedBy:i}:c);await oi(n,{status:"in_progress",started_at:new Date().toISOString()}),t.setOrders(c=>c.map(d=>d.id===e?{...d,productionSteps:a}:d)),t.showToast("Plate received and step started","success")}catch(s){console.error("Failed to start step with plate:",s),t.showToast("Error processing plate action","error")}}async function c_(t,e,n,i,o){try{const s=t.orders.find(a=>a.id===e);if(!s)return;const r=s.productionSteps.find(a=>a.id===n);if(!r||!r.plateId)return;await t.updatePlate(r.plateId,{status:i==="returned"?"available":"with_supplier",location:o.location||"Storage",lastUsed:new Date}),await ma(t,e,n,o.userId),t.setOrders(a=>a.map(c=>c.id===e?{...c,productionSteps:c.productionSteps.map(d=>d.id===n?{...d,plateStatus:i}:d)}:c))}catch(s){console.error("Failed to finish step with plate:",s),t.showToast("Error processing plate return","error")}}async function u_(t,e,n,i){const o=s=>s&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(s);try{const s=t.orders.find(d=>d.id===e);if(!s)return;if(!o(n)){console.error("Invalid Step ID (not a UUID):",n),t.showToast("Invalid Step ID. Please refresh and try again.","error");return}const r=d=>!!d,a=new Date,c=s.productionSteps.map(d=>d.id===n?{...d,status:"received",receivedAt:a,receivedBy:i}:d);await oi(n,{status:"received",received_at:a.toISOString(),received_by:r(i)?i:null}),t.setOrders(d=>d.map(p=>p.id===e?{...p,productionSteps:c}:p)),t.showToast("Step marked as received","success")}catch(s){console.error("Failed to receive step:",s),t.showToast(`Failed to update step: ${s.message||"Unknown error"}`,"error")}}async function d_(t,e,n,i){const o=s=>!!s;try{const s=t.orders.find(c=>c.id===e);if(!s)return;if(!o(n)){console.error("Invalid Step ID:",n),t.showToast("Invalid Step ID","error");return}const r=new Date,a=s.productionSteps.map(c=>c.id===n?{...c,status:"in_progress",startedAt:r,startedBy:i}:c);await oi(n,{status:"in_progress",started_at:r.toISOString()}),t.setOrders(c=>c.map(d=>d.id===e?{...d,productionSteps:a}:d)),t.showToast("Step started","success")}catch(s){console.error("Failed to start step:",s),t.showToast(`Failed to update step: ${s.message||"Unknown error"}`,"error")}}async function ma(t,e,n,i){var o,s,r,a;try{const c=t.orders.find(x=>x.id===e);if(!c)return;const d=c.productionSteps.findIndex(x=>x.id===n);if(d===-1)return;const p=c.productionSteps.map((x,E)=>E===d?{...x,status:"completed",finishedAt:new Date,finishedBy:i}:x);let f=c.currentProductionStepIndex;d===c.currentProductionStepIndex&&(f=Math.min(c.currentProductionStepIndex+1,c.productionSteps.length-1));let h=c.status;d===c.productionSteps.length-1?h="ready_for_delivery":(c.status==="confirmed"||c.status==="pending")&&(h="in_production");const y=(x=>x&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(x))(i)?i:null;await Promise.all([oi(n,{status:"completed",completed_at:new Date().toISOString(),completed_by:y}),ii(e,{current_production_step_index:f,status:h})]),t.setOrders(x=>x.map(E=>E.id===e?{...E,productionSteps:p,currentProductionStepIndex:f,status:h}:E)),t.showToast("Step completed","success");const _=c.productionSteps[d];if(_&&_.type==="printing")try{const x=((o=c.specifications.quantities[0])==null?void 0:o.qty)||0,E=t.materials.filter(C=>(C.name||"").toLowerCase().includes("ink"));let w=0;if(E.length===0){const P=x/1e3*.1;w+=P*50}else for(const C of E){const P=x/1e3*.1;if(P>0){const k=C.averageCost||C.unitPrice||50;w+=P*k;const I=t.warehouses.find(j=>j.isDefault);I&&await t.processStockTransaction({materialId:C.id,quantity:P,unitCost:k,type:"usage",warehouseId:I.id,referenceType:"Order",referenceId:c.id,notes:`Auto-deduction for Order #${c.invoiceNumber}`,performedBy:((s=t.currentUser)==null?void 0:s.name)||"System",targetAccountId:t.ACC_WIP}).catch(j=>console.error("Stock tx failed",j))}}if(w>0){const C=w*.2;C>0&&await t.addJournalEntry(`Overhead Allocation - Order #${c.invoiceNumber} (Step: ${_.name||n})`,new Date,[{accountId:t.ACC_WIP,description:"Debit WIP - Applied Overhead",debit:C,credit:0},{accountId:t.ACC_OVERHEAD_OFFSET,description:"Credit Factory Overhead - Absorption",debit:0,credit:C}]).catch(P=>console.error("Overhead JE failed",P))}}catch(x){console.error("Error processing ink stock deduction/accounting:",x)}if(_&&(_.type==="printing_plates"||_.type==="finishing"||_.type==="post_press"))try{if(!_.supplierId){const x=_.type==="printing_plates"?["plate"]:[_.name.toLowerCase().split(" ")[0],"laminat","bind","wire"],E=t.materials.find(w=>x.some(C=>(w.name||"").toLowerCase().includes(C)));if(E){const w=((r=c.specifications.quantities[0])==null?void 0:r.qty)||0,C=_.type==="printing_plates"?4:Math.ceil(w*1.05),P=E.averageCost||E.unitPrice||0;if(C>0&&P>0){const k=t.warehouses.find(I=>I.isDefault);k&&await t.processStockTransaction({materialId:E.id,quantity:C,unitCost:P,type:"usage",warehouseId:k.id,referenceType:"Order",referenceId:c.id,notes:`Auto-deduction for Order #${c.invoiceNumber} (${_.name})`,performedBy:((a=t.currentUser)==null?void 0:a.name)||"System",targetAccountId:t.ACC_WIP}).catch(I=>console.error("Finishing stock tx failed",I))}}}}catch(x){console.error("Error processing material stock deduction:",x)}const v=t.accounts.find(x=>x.name==="Accounts Payable");if(_&&_.cost>0&&_.supplierId&&v)try{await t.addJournalEntry(`Outsourced Production Cost - Order #${c.invoiceNumber} (Step: ${_.name})`,new Date,[{accountId:t.ACC_WIP,description:`Debit WIP - Outsourced ${_.type}`,debit:_.cost,credit:0},{accountId:v.id,description:`Credit Accounts Payable - ${_.supplierId}`,debit:0,credit:_.cost}])}catch(x){console.error("Failed to recognize outsourced WIP cost",x)}}catch(c){console.error("Failed to finish production step:",c),t.showToast(`Failed to complete step: ${c.message||"Unknown error"}`,"error")}}async function p_(t,e,n){try{const i=t.orders.find(c=>c.id===e);if(!i)return;const o=i.productionSteps.findIndex(c=>c.id===n);if(o===-1)return;const s=i.productionSteps[o];let r=[...i.productionSteps],a=i.currentProductionStepIndex;if(s.status==="completed")r[o]={...s,status:"in_progress",finishedAt:void 0,finishedBy:void 0},a=o;else if(s.status==="in_progress"||s.status==="received")r[o]={...s,status:"pending",startedAt:void 0,startedBy:void 0,receivedAt:void 0,receivedBy:void 0};else if(s.status==="pending"&&o>0){const c=i.productionSteps[o-1];r[o-1]={...c,status:"in_progress",finishedAt:void 0,finishedBy:void 0},a=o-1}await Promise.all([oi(n,{status:"pending",completed_at:null,completed_by:null}),ii(e,{current_production_step_index:a})]),t.setOrders(c=>c.map(d=>d.id===e?{...d,productionSteps:r,currentProductionStepIndex:a}:d)),t.showToast("Step reversed","success")}catch(i){console.error("Failed to reverse step:",i),t.showToast(`Failed to reverse step: ${i.message||"Unknown error"}`,"error")}}async function m_(t,e){try{const n={order_id:e.orderId,checked_by:e.checkedBy,status:e.status,notes:e.notes,parameters:e.parameters},i=await Sy(n);i&&(t.setQualityChecks(o=>[...o,{...e,id:i.id}]),e.status==="passed"&&t.updateOrderStatus&&await t.updateOrderStatus(e.orderId,"ready_for_delivery"),t.showToast("Quality check recorded","success"))}catch(n){console.error("ProductionService: createQualityCheck error:",n),t.showToast("Failed to record quality check","error")}}const mp=b.createContext(void 0),UI=()=>{const t=b.useContext(mp);if(!t)throw new Error("useProduction must be used within a ProductionProvider");return t},f_=({children:t})=>{const{showToast:e}=$t(),{currentUser:n}=Ut(),{orders:i,setOrders:o,updateOrderStatus:s}=pp(),{finishingBlocks:r,plates:a,materials:c,warehouses:d,updateFinishingBlock:p,updatePlate:f,processStockTransaction:h}=op(),{addJournalEntry:g,accounts:y}=si(),{machineLogs:_}=Ab(),{data:v=[],isLoading:x,refetch:E}=Rv(),{data:w=[],isLoading:C,refetch:P}=Mv(),k=x||C,I=()=>({orders:i,setOrders:o,updateOrderStatus:s,finishingBlocks:r,plates:a,materials:c,warehouses:d,accounts:y,machineLogs:_,currentUser:n,showToast:e,updateFinishingBlock:p,updatePlate:f,processStockTransaction:h,addJournalEntry:g,setQualityChecks:async()=>await E(),ACC_WIP:"7f9103e9-01f1-5f28-a567-2f3b978c430e",ACC_OVERHEAD_OFFSET:"a62a53ce-b9b1-5aaf-8b4f-6c1f228b6312"}),j=async(O,U)=>s_(I(),O,U),A=async(O,U,H)=>r_(I(),O,U,H),R=async(O,U,H,re)=>a_(I(),O,U,H,re),q=async(O,U,H)=>l_(I(),O,U,H),G=async(O,U,H,re)=>c_(I(),O,U,H,re),L=async(O,U,H)=>u_(I(),O,U,H),F=async(O,U,H)=>d_(I(),O,U,H),T=async(O,U,H)=>ma(I(),O,U,H),$=async(O,U)=>p_(I(),O,U),Q=async O=>m_(I(),O),X=async O=>{await Pd(O)&&(await P(),e("Delivery note created","success"))},te=async O=>{const U=w.find(H=>H.id===O);U&&(await Promise.all([s(U.orderId,"delivered"),Id(O,{status:"delivered"})]),await P(),e("Order marked as delivered","success"))},J=b.useMemo(()=>({qualityChecks:v,deliveryNotes:w,isLoading:k,updateProductionStepOrder:j,startStepAndHandInBlock:A,finishStepAndReceiveBlock:R,startStepAndHandInPlate:q,finishStepAndReceivePlate:G,receiveProductionStep:L,startProductionStep:F,finishProductionStep:T,reverseProductionStep:$,createQualityCheck:Q,addDeliveryNote:X,markDelivered:te}),[v,w,k]);return m.jsxDEV(mp.Provider,{value:J,children:t},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/ProductionContext.tsx",lineNumber:120,columnNumber:9},void 0)},Zs={logoUrl:"",primaryColor:"#000000",fontFamily:"Inter",fontSize:"base",headerText:"",footerText:"",layoutType:"modern",showWatermark:!1,watermarkText:"",showBankDetails:!0,showTaxId:!0,showQrCode:!0},h_={printingBleed:3,globalMarkup:25,pricingFormula:"(PAPER + PRINTING + PLATES + FINISHING) * (1 + MARKUP / 100)",roundTo:.05,paperMultiplier:1.2,printingMultiplier:1,finishingMultiplier:1.1,platesMultiplier:1,fixedFee:0},fp=b.createContext(void 0),fa=()=>{const t=b.useContext(fp);if(!t)throw new Error("useAdmin must be used within an AdminProvider");return t},g_=({children:t})=>{const{showToast:e}=$t(),{loading:n}=Ut(),[i,o]=b.useState([]),[s,r]=b.useState([]),[a,c]=b.useState(()=>localStorage.getItem("activeAdminChatbotId")||""),[d,p]=b.useState(()=>localStorage.getItem("activeCustomerChatbotId")||""),[f,h]=b.useState({name:"Pioneer Cetak",address:"123 Print Street, KL",phone:"03-1234 5678",email:"hello@pioneercetak.com",website:"www.pioneercetak.com",logoUrl:"",bank:"Maybank",accountNumber:"1234567890",tin:"",brn:"",sstRegistrationNo:"",msicCode:"",businessActivity:""}),[g,y]=b.useState([{id:"hq",name:"Headquarters",code:"HQ",isDefault:!0,isActive:!0}]),[_,v]=b.useState({reset_database:"admin123"}),[x]=b.useState({invoice:Zs,quotation:Zs,receipt:Zs}),[E,w]=b.useState(["Utility","Rent","Salary","Material","Other"]),[C,P]=b.useState(h_),[k,I]=b.useState(()=>{const K=localStorage.getItem("settings:useArcMenu");return K===null?!0:K==="true"}),{data:j=[]}=Vv();b.useEffect(()=>{(async()=>{if(n)return;const ae=await Qh().catch(()=>[]);if(Array.isArray(ae)){const it=ht=>{var Oe;return(Oe=ae.find(gt=>gt.key===ht))==null?void 0:Oe.value},Gt=it("company_info");Gt&&h(Gt);const qe=it("admin_power_settings");qe&&v(qe);const Ue=it("expense_categories");Ue&&w(Ue);const ot=it("pricing_defaults");ot&&P(ot)}const ve=await Wg().catch(()=>[]);Array.isArray(ve)&&r(ve);const Ie=await Ag().catch(()=>[]);Array.isArray(Ie)&&o(Ie)})()},[n]);const A=async K=>{const ae=await kg(K),ve={...K,id:ae.id,createdAt:new Date};return o(Ie=>[...Ie,ve]),ve},R=async(K,ae)=>{await Pg(K,ae),o(ve=>ve.map(Ie=>Ie.id===K?{...Ie,...ae}:Ie))},q=async K=>{await Ig(K),o(ae=>ae.filter(ve=>ve.id!==K))},G=K=>{c(K),localStorage.setItem("activeAdminChatbotId",K)},L=K=>{p(K),localStorage.setItem("activeCustomerChatbotId",K)},F=async K=>{const ae=await zg(K);ae&&r(ve=>[...ve,ae])},T=async(K,ae)=>{await Yg(K,ae),r(ve=>ve.map(Ie=>Ie.id===K?{id:K,...ae}:Ie))},$=async K=>{await Qg(K),r(ae=>ae.filter(ve=>ve.id!==K))},Q=async K=>{h(K),await Ki("company_info",K),e("Company info updated","success")},X=(K,ae)=>_[K]===ae,te=async(K,ae)=>{const ve={..._,[K]:ae};v(ve),await Ki("admin_power_settings",ve)},J=async(K,ae)=>{const ve={..._,[K]:ae};v(ve),await Ki("admin_power_settings",ve)},O=async K=>{const ae={..._};delete ae[K],v(ae),await Ki("admin_power_settings",ae)},U=async(K,ae)=>{await iv(K,ae),e("Template updated","success")},H=async K=>{P(K),await Ki("pricing_defaults",K),e("Pricing defaults updated","success")},re=K=>{const ae={...K,id:`br-${Date.now()}`};y(ve=>[...ve,ae])},de=(K,ae)=>{y(ve=>ve.map(Ie=>Ie.id===K?{...Ie,...ae}:Ie))},le=K=>{y(ae=>ae.filter(ve=>ve.id!==K))},fe=K=>{I(K),localStorage.setItem("settings:useArcMenu",String(K)),e(K?"Mobile Arc Menu enabled":"Mobile Arc Menu disabled","success")},De=b.useMemo(()=>({chatbots:i,roles:s,activeAdminChatbotId:a,activeCustomerChatbotId:d,companyInfo:f,adminPowerSettings:_,documentTemplates:x,expenseCategories:E,auditLogs:j,pricingDefaults:C,useArcMenu:k,branches:g,addChatbot:A,updateChatbot:R,deleteChatbot:q,setActiveAdminChatbot:G,setActiveCustomerChatbot:L,addRole:F,updateRole:T,deleteRole:$,updateCompanyInfo:Q,verifyMaintenancePassword:X,updateMaintenancePassword:te,addProtectedAction:J,removeProtectedAction:O,updateDocumentTemplate:U,updatePricingDefaults:H,setUseArcMenu:fe,addBranch:re,updateBranch:de,deleteBranch:le}),[i,s,a,d,f,_,x,E,j,C,k,g]);return m.jsxDEV(fp.Provider,{value:De,children:t},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/AdminContext.tsx",lineNumber:238,columnNumber:12},void 0)},hp=b.createContext(void 0),Et=()=>{const t=b.useContext(hp);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},y_=({children:t})=>{const[e,n]=b.useState({mode:"light",color:"indigo",preset:"standard",gradient:{enabled:!1,startColor:"blue",endColor:"purple",direction:"to-r"}});b.useEffect(()=>{const f=localStorage.getItem("theme_v2");if(f)try{const h=JSON.parse(f);n(h)}catch(h){console.error("Error parsing saved theme:",h)}},[]),b.useEffect(()=>{localStorage.setItem("theme_v2",JSON.stringify(e));const f=document.documentElement;f.classList.remove("light","dark"),f.classList.remove("theme-blue","theme-purple","theme-green","theme-orange","theme-indigo","theme-pink"),f.classList.remove("theme-preset-standard","theme-preset-frosted-glass","theme-preset-sophisticated-dark","theme-preset-geometric-balance","theme-preset-bento-grid","theme-preset-editorial-aesthetic"),f.classList.remove("gradient-enabled"),f.classList.remove("gradient-blue-purple","gradient-blue-green","gradient-blue-orange","gradient-blue-indigo","gradient-blue-pink","gradient-purple-blue","gradient-purple-green","gradient-purple-orange","gradient-purple-indigo","gradient-purple-pink","gradient-green-blue","gradient-green-purple","gradient-green-orange","gradient-green-indigo","gradient-green-pink","gradient-orange-blue","gradient-orange-purple","gradient-orange-green","gradient-orange-indigo","gradient-orange-pink","gradient-indigo-blue","gradient-indigo-purple","gradient-indigo-green","gradient-indigo-orange","gradient-indigo-pink","gradient-pink-blue","gradient-pink-purple","gradient-pink-green","gradient-pink-orange","gradient-pink-indigo"),f.classList.remove("gradient-to-r","gradient-to-l","gradient-to-t","gradient-to-b","gradient-to-tr","gradient-to-tl","gradient-to-br","gradient-to-bl"),f.classList.add(e.mode),f.classList.add(`theme-${e.color}`),f.classList.add(`theme-preset-${e.preset}`),e.gradient.enabled&&(f.classList.add("gradient-enabled"),f.classList.add(`gradient-${e.gradient.startColor}-${e.gradient.endColor}`),f.classList.add(`gradient-${e.gradient.direction}`))},[e]);const i=f=>{n(f)},o=()=>{n(f=>({...f,mode:f.mode==="light"?"dark":"light"}))},s=f=>{n(h=>({...h,mode:f}))},r=f=>{n(h=>({...h,color:f}))},a=f=>{n(h=>({...h,preset:f}))},c=(f,h,g)=>{n(y=>({...y,gradient:{enabled:!0,startColor:f,endColor:h,direction:g}}))},d=()=>e.mode==="dark"?"bg-gray-900 text-white":"bg-gray-50 text-gray-900",p=(f="primary")=>{const h={blue:{primary:"bg-blue-600 text-white",secondary:e.mode==="dark"?"bg-blue-800 text-blue-100":"bg-blue-100 text-blue-800",accent:e.mode==="dark"?"text-blue-400":"text-blue-600"},purple:{primary:"bg-purple-600 text-white",secondary:e.mode==="dark"?"bg-purple-800 text-purple-100":"bg-purple-100 text-purple-800",accent:e.mode==="dark"?"text-purple-400":"text-purple-600"},green:{primary:"bg-green-600 text-white",secondary:e.mode==="dark"?"bg-green-800 text-green-100":"bg-green-100 text-green-800",accent:e.mode==="dark"?"text-green-400":"text-green-600"},orange:{primary:"bg-orange-600 text-white",secondary:e.mode==="dark"?"bg-orange-800 text-orange-100":"bg-orange-100 text-orange-800",accent:e.mode==="dark"?"text-orange-400":"text-orange-600"},indigo:{primary:"bg-indigo-600 text-white",secondary:e.mode==="dark"?"bg-indigo-800 text-indigo-100":"bg-indigo-100 text-indigo-800",accent:e.mode==="dark"?"text-indigo-400":"text-indigo-600"},pink:{primary:"bg-pink-600 text-white",secondary:e.mode==="dark"?"bg-pink-800 text-pink-100":"bg-pink-100 text-pink-800",accent:e.mode==="dark"?"text-pink-400":"text-pink-600"}};return f==="gradient"&&e.gradient.enabled?`gradient-enabled gradient-${e.gradient.direction} gradient-${e.gradient.startColor}-${e.gradient.endColor} text-white`:f==="gradient"?h[e.color].primary:h[e.color][f]};return m.jsxDEV(hp.Provider,{value:{theme:e,setTheme:i,toggleMode:o,setMode:s,setColor:r,setPreset:a,setGradient:c,getThemeClasses:d,getColorClasses:p},children:t},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/contexts/ThemeContext.tsx",lineNumber:202,columnNumber:5},void 0)},Ee=({children:t,allowedRoles:e=[]})=>{const{isAuthenticated:n,user:i}=Ut(),o=ds();return n?e.length>0&&i&&!e.includes(i.role)?m.jsxDEV(zo,{to:"/dashboard",replace:!0},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/auth/ProtectedRoute.tsx",lineNumber:23,columnNumber:12},void 0):m.jsxDEV(m.Fragment,{children:t},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/auth/ProtectedRoute.tsx",lineNumber:26,columnNumber:10},void 0):m.jsxDEV(zo,{to:"/login",state:{from:o},replace:!0},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/auth/ProtectedRoute.tsx",lineNumber:19,columnNumber:12},void 0)},v_=({isOpen:t,onClose:e})=>{const{theme:n,setMode:i,setColor:o,getColorClasses:s,setGradient:r,setPreset:a}=Et(),[c,d]=b.useState("#3b82f6"),[p,f]=b.useState("#8b5cf6"),[h,g]=b.useState("to-r"),[y,_]=b.useState(!1),[v,x]=b.useState(!1),E=b.useRef(null),w=b.useRef(null),C=[{name:"Ocean Blue",value:"blue",preview:"bg-blue-600"},{name:"Royal Purple",value:"purple",preview:"bg-purple-600"},{name:"Forest Green",value:"green",preview:"bg-green-600"},{name:"Sunset Orange",value:"orange",preview:"bg-orange-600"},{name:"Deep Indigo",value:"indigo",preview:"bg-indigo-600"},{name:"Rose Pink",value:"pink",preview:"bg-pink-600"}],P=[{name:"Right",value:"to-r",icon:Oa},{name:"Bottom Right",value:"to-br",icon:Ws},{name:"Bottom",value:"to-b",icon:Ws},{name:"Bottom Left",value:"to-bl",icon:ja},{name:"Left",value:"to-l",icon:ja},{name:"Top Left",value:"to-tl",icon:Js},{name:"Top",value:"to-t",icon:Js},{name:"Top Right",value:"to-tr",icon:Oa}],k=[{id:"editorial-aesthetic",name:"Editorial Aesthetic"},{id:"bento-grid",name:"Bento Grid"},{id:"geometric-balance",name:"Geometric Balance"},{id:"frosted-glass",name:"Frosted Glass"},{id:"sophisticated-dark",name:"Sophisticated Dark"},{id:"standard",name:"Standard"}],I=(T,$,Q)=>{const X=Q*$,te=X*(1-Math.abs(T/60%2-1)),J=Q-X;let O=0,U=0,H=0;return 0<=T&&T<60?(O=X,U=te,H=0):60<=T&&T<120?(O=te,U=X,H=0):120<=T&&T<180?(O=0,U=X,H=te):180<=T&&T<240?(O=0,U=te,H=X):240<=T&&T<300?(O=te,U=0,H=X):300<=T&&T<360&&(O=X,U=0,H=te),O=Math.round((O+J)*255),U=Math.round((U+J)*255),H=Math.round((H+J)*255),{r:O,g:U,b:H}},j=(T,$,Q)=>"#"+((1<<24)+(T<<16)+($<<8)+Q).toString(16).slice(1),A=b.useCallback(T=>{if(!E.current)return;const $=E.current.getBoundingClientRect(),Q=T.clientX-$.left,te=Math.max(0,Math.min(1,Q/$.width))*360,{r:J,g:O,b:U}=I(te,1,1),H=j(J,O,U);d(H)},[]),R=b.useCallback(T=>{if(!w.current)return;const $=w.current.getBoundingClientRect(),Q=T.clientX-$.left,te=Math.max(0,Math.min(1,Q/$.width))*360,{r:J,g:O,b:U}=I(te,1,1),H=j(J,O,U);f(H)},[]),q=()=>{const T=c.replace("#","");if(T.length!==6)return;const $=parseInt(T.substr(0,2),16),Q=parseInt(T.substr(2,2),16),X=parseInt(T.substr(4,2),16),te=[{color:"blue",r:59,g:130,b:246},{color:"purple",r:139,g:92,b:246},{color:"green",r:16,g:185,b:129},{color:"orange",r:245,g:158,b:11},{color:"indigo",r:99,g:102,b:241},{color:"pink",r:236,g:72,b:153}];let J="blue",O=1/0;te.forEach(({color:U,r:H,g:re,b:de})=>{const le=Math.sqrt(Math.pow($-H,2)+Math.pow(Q-re,2)+Math.pow(X-de,2));le<O&&(O=le,J=U)}),o(J),_(!1)},G=()=>{const T=L(c),$=L(p);r(T,$,h),x(!1)},L=T=>{const $=T.replace("#","");if($.length!==6)return"blue";const Q=parseInt($.substr(0,2),16),X=parseInt($.substr(2,2),16),te=parseInt($.substr(4,2),16),J=[{color:"blue",r:59,g:130,b:246},{color:"purple",r:139,g:92,b:246},{color:"green",r:16,g:185,b:129},{color:"orange",r:245,g:158,b:11},{color:"indigo",r:99,g:102,b:241},{color:"pink",r:236,g:72,b:153}];let O="blue",U=1/0;return J.forEach(({color:H,r:re,g:de,b:le})=>{const fe=Math.sqrt(Math.pow(Q-re,2)+Math.pow(X-de,2)+Math.pow(te-le,2));fe<U&&(U=fe,O=H)}),O},F=T=>{T=T.replace("#","");const $=parseInt(T.substring(0,2),16),Q=parseInt(T.substring(2,4),16),X=parseInt(T.substring(4,6),16);return`${$} ${Q} ${X}`};return t?m.jsxDEV("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-2 sm:p-4 z-50 backdrop-blur-sm overflow-y-auto",onClick:e,children:m.jsxDEV("div",{className:`${n.mode==="dark"?"bg-gray-700 text-white":"bg-white text-gray-900"} rounded-2xl max-w-md w-full shadow-2xl border ${n.mode==="dark"?"border-gray-600":"border-gray-200"} max-h-[90vh] flex flex-col my-2 sm:my-4`,onClick:T=>T.stopPropagation(),children:[m.jsxDEV("div",{className:`px-4 sm:px-6 py-4 border-b ${n.mode==="dark"?"border-gray-600":"border-gray-200"} flex justify-between items-center flex-shrink-0`,children:[m.jsxDEV("div",{className:"flex items-center space-x-3",children:[m.jsxDEV("div",{className:`p-2 rounded-lg ${s("secondary")}`,children:m.jsxDEV(qo,{className:"h-5 w-5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:252,columnNumber:15},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:251,columnNumber:13},void 0),m.jsxDEV("div",{children:[m.jsxDEV("h2",{className:"text-lg font-semibold",children:"Theme Settings"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:255,columnNumber:15},void 0),m.jsxDEV("p",{className:`text-sm ${n.mode==="dark"?"text-gray-400":"text-gray-600"}`,children:"Customize your experience"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:256,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:254,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:250,columnNumber:11},void 0),m.jsxDEV("button",{onClick:e,className:`p-2 rounded-lg transition-colors ${n.mode==="dark"?"hover:bg-gray-600 text-gray-400 hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600"}`,children:m.jsxDEV(en,{className:"h-5 w-5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:265,columnNumber:13},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:261,columnNumber:11},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:249,columnNumber:9},void 0),m.jsxDEV("div",{className:"p-4 sm:p-6 space-y-4 sm:space-y-6 overflow-y-auto flex-1",children:[m.jsxDEV("div",{className:"mb-6",children:[m.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[m.jsxDEV("div",{className:"flex items-center gap-2",children:[m.jsxDEV("h3",{className:"text-lg font-bold text-white tracking-tight",children:"Design presets"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:274,columnNumber:17},void 0),m.jsxDEV("span",{className:"px-1.5 py-0.5 rounded bg-indigo-500/20 text-indigo-400 text-[10px] font-black uppercase tracking-wider border border-indigo-500/30",children:"NEW"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:275,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:273,columnNumber:15},void 0),m.jsxDEV("div",{className:"flex items-center gap-4",children:[m.jsxDEV("button",{className:"text-sm font-bold text-gray-400 hover:text-white transition-colors",children:"Skip"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:278,columnNumber:17},void 0),m.jsxDEV("button",{onClick:e,className:"px-5 py-2.5 rounded-2xl bg-white text-black text-sm font-black transition-transform active:scale-95 shadow-xl shadow-white/10",children:"Select this design"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:279,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:277,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:272,columnNumber:13},void 0),m.jsxDEV("div",{className:"flex gap-8 items-center",children:[m.jsxDEV("div",{className:`relative flex-1 aspect-video rounded-3xl overflow-hidden border border-white/10 ${n.mode==="dark"?"bg-slate-900":"bg-slate-100"}`,children:[n.preset==="frosted-glass"&&m.jsxDEV("div",{className:"absolute inset-0 bg-[#050508] p-4 flex gap-3",children:[m.jsxDEV("div",{className:"w-20 h-full rounded-2xl bg-white/5 border border-white/5 p-2 flex flex-col gap-2",children:[m.jsxDEV("div",{className:"w-6 h-6 rounded-lg bg-indigo-500 shadow-lg shadow-indigo-500/40"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:294,columnNumber:24},void 0),m.jsxDEV("div",{className:"w-full h-2 rounded-full bg-white/10"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:295,columnNumber:24},void 0),m.jsxDEV("div",{className:"w-full h-2 rounded-full bg-white/5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:296,columnNumber:24},void 0),m.jsxDEV("div",{className:"w-full h-2 rounded-full bg-white/5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:297,columnNumber:24},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:293,columnNumber:21},void 0),m.jsxDEV("div",{className:"flex-1 space-y-3",children:[m.jsxDEV("div",{className:"flex justify-between items-center",children:[m.jsxDEV("div",{className:"w-24 h-3 rounded-full bg-white/10"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:301,columnNumber:27},void 0),m.jsxDEV("div",{className:"w-12 h-4 rounded-full bg-indigo-500/20"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:302,columnNumber:27},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:300,columnNumber:24},void 0),m.jsxDEV("div",{className:"grid grid-cols-3 gap-2",children:[m.jsxDEV("div",{className:"aspect-square rounded-xl bg-white/5 border border-white/5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:305,columnNumber:27},void 0),m.jsxDEV("div",{className:"aspect-square rounded-xl bg-white/5 border border-white/5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:306,columnNumber:27},void 0),m.jsxDEV("div",{className:"aspect-square rounded-xl bg-white/5 border border-white/5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:307,columnNumber:27},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:304,columnNumber:24},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:299,columnNumber:21},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:292,columnNumber:19},void 0),m.jsxDEV("div",{className:"absolute -bottom-10 -left-10 w-32 h-32 bg-purple-500/20 blur-3xl rounded-full"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:313,columnNumber:17},void 0),m.jsxDEV("div",{className:"absolute -top-10 -right-10 w-32 h-32 bg-blue-500/10 blur-3xl rounded-full"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:314,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:290,columnNumber:15},void 0),m.jsxDEV("div",{className:"flex flex-col items-center gap-4",children:[m.jsxDEV("button",{className:"p-2 rounded-full bg-white/5 border border-white/10 text-gray-400 hover:text-white transition-colors",children:m.jsxDEV(Js,{size:20},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:320,columnNumber:19},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:319,columnNumber:17},void 0),m.jsxDEV("div",{className:"flex flex-col gap-5 py-2",children:k.map(T=>m.jsxDEV("button",{onClick:()=>a(T.id),className:"flex items-center gap-4 group transition-all",children:[m.jsxDEV("div",{className:`w-2.5 h-2.5 rounded-full transition-all ${n.preset===T.id?"bg-white scale-125 shadow-[0_0_10px_white]":"bg-white/10 group-hover:bg-white/30"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:330,columnNumber:23},void 0),m.jsxDEV("span",{className:`text-base font-bold tracking-tight transition-all ${n.preset===T.id?"text-white translate-x-1":"text-gray-500 group-hover:text-gray-300"}`,children:T.name},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:331,columnNumber:23},void 0)]},T.id,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:325,columnNumber:21},void 0))},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:323,columnNumber:17},void 0),m.jsxDEV("button",{className:"p-2 rounded-full bg-white/5 border border-white/10 text-gray-400 hover:text-white transition-colors",children:m.jsxDEV(Ws,{size:20},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:339,columnNumber:19},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:338,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:318,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:288,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:271,columnNumber:11},void 0),m.jsxDEV("div",{className:`h-px w-full ${n.mode==="dark"?"bg-white/5":"bg-gray-100"} mb-6`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:345,columnNumber:11},void 0),m.jsxDEV("div",{children:[m.jsxDEV("h3",{className:"text-sm font-medium mb-3 flex items-center",children:[m.jsxDEV(rf,{className:"h-4 w-4 mr-2"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:350,columnNumber:15},void 0),"Appearance Mode"]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:349,columnNumber:13},void 0),m.jsxDEV("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[m.jsxDEV("button",{onClick:()=>i("light"),className:`p-3 sm:p-4 rounded-xl border-2 transition-all flex flex-col items-center space-y-2 touch-target ${n.mode==="light"?`${s("primary")} border-transparent shadow-lg text-white`:"border-gray-500 hover:border-gray-400 bg-gray-600"}`,children:[m.jsxDEV(Xu,{className:"h-6 w-6"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:361,columnNumber:17},void 0),m.jsxDEV("span",{className:"text-sm font-medium",children:"Light"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:362,columnNumber:17},void 0),n.mode==="light"&&m.jsxDEV(zs,{className:"h-4 w-4 text-white"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:363,columnNumber:44},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:354,columnNumber:15},void 0),m.jsxDEV("button",{onClick:()=>i("dark"),className:`p-3 sm:p-4 rounded-xl border-2 transition-all flex flex-col items-center space-y-2 touch-target ${n.mode==="dark"?`${s("primary")} border-transparent shadow-lg text-white`:"border-gray-200 hover:border-gray-300 bg-gray-50"}`,children:[m.jsxDEV(Zu,{className:"h-6 w-6"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:373,columnNumber:17},void 0),m.jsxDEV("span",{className:"text-sm font-medium",children:"Dark"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:374,columnNumber:17},void 0),n.mode==="dark"&&m.jsxDEV(zs,{className:"h-4 w-4 text-white"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:375,columnNumber:43},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:366,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:353,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:348,columnNumber:11},void 0),m.jsxDEV("div",{children:[m.jsxDEV("h3",{className:"text-sm font-medium mb-3 flex items-center",children:[m.jsxDEV(qo,{className:"h-4 w-4 mr-2"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:383,columnNumber:15},void 0),"Color Theme"]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:382,columnNumber:13},void 0),m.jsxDEV("div",{className:"grid grid-cols-2 gap-2 sm:gap-3 mb-3 sm:mb-4",children:C.map(T=>m.jsxDEV("button",{onClick:()=>o(T.value),className:`p-3 sm:p-4 rounded-xl border-2 transition-all flex items-center space-x-2 sm:space-x-3 touch-target ${n.color===T.value?`${s("primary")} border-transparent shadow-lg text-white`:`${n.mode==="dark"?"border-gray-500 hover:border-gray-400 bg-gray-600":"border-gray-200 hover:border-gray-300 bg-gray-50"}`}`,children:[m.jsxDEV("div",{className:`w-6 h-6 rounded-full ${T.preview} shadow-md`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:398,columnNumber:19},void 0),m.jsxDEV("div",{className:"flex-1 text-left",children:[m.jsxDEV("span",{className:"text-sm font-medium",children:T.name},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:400,columnNumber:21},void 0),n.color===T.value&&m.jsxDEV(zs,{className:"h-4 w-4 float-right mt-0.5 text-white"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:402,columnNumber:23},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:399,columnNumber:19},void 0)]},T.value,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:390,columnNumber:17},void 0))},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:388,columnNumber:13},void 0),m.jsxDEV("div",{className:`p-3 sm:p-4 rounded-xl border-2 ${n.mode==="dark"?"border-gray-500 bg-gray-600":"border-gray-200 bg-gray-50"} mb-4`,children:[m.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[m.jsxDEV("div",{className:"flex items-center space-x-2",children:[m.jsxDEV(af,{className:"h-4 w-4"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:413,columnNumber:19},void 0),m.jsxDEV("span",{className:"text-sm font-medium",children:"Custom Color"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:414,columnNumber:19},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:412,columnNumber:17},void 0),m.jsxDEV("button",{onClick:()=>_(!y),className:`px-3 py-1 rounded-lg text-xs font-medium transition-colors ${y?s("primary")+" text-white":n.mode==="dark"?"bg-gray-500 hover:bg-gray-400 text-white":"bg-gray-200 hover:bg-gray-300 text-gray-700"}`,children:[y?"Hide":"Show"," Picker"]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:416,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:411,columnNumber:15},void 0),y&&m.jsxDEV("div",{className:"space-y-3",children:[m.jsxDEV("div",{className:"relative",children:[m.jsxDEV("div",{ref:E,onClick:A,className:"h-8 w-full rounded-lg cursor-crosshair shadow-inner border",style:{background:"linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%)",borderColor:n.mode==="dark"?"#4b5563":"#d1d5db"}},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:431,columnNumber:21},void 0),m.jsxDEV("div",{className:`text-xs text-center mt-1 ${n.mode==="dark"?"text-gray-400":"text-gray-500"}`,children:"Click anywhere on the color bar to select"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:440,columnNumber:21},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:430,columnNumber:19},void 0),m.jsxDEV("div",{className:"flex items-center space-x-3",children:[m.jsxDEV("div",{className:"w-8 h-8 rounded-lg shadow-md border-2",style:{backgroundColor:c,borderColor:n.mode==="dark"?"#6b7280":"#d1d5db"}},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:447,columnNumber:21},void 0),m.jsxDEV("div",{className:"flex-1",children:m.jsxDEV("input",{type:"text",value:c,onChange:T=>d(T.target.value),className:`w-full px-3 py-2 text-sm rounded-lg border ${n.mode==="dark"?"border-gray-400 bg-gray-500 text-white placeholder-gray-300":"border-gray-300 bg-white text-gray-900 placeholder-gray-500"} focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"#3b82f6"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:455,columnNumber:23},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:454,columnNumber:21},void 0),m.jsxDEV("button",{onClick:q,className:`px-3 sm:px-4 py-2 rounded-lg text-sm font-medium transition-colors ${s("primary")} text-white hover:opacity-90 touch-target`,children:"Apply"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:466,columnNumber:21},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:446,columnNumber:19},void 0),m.jsxDEV("div",{className:`text-xs ${n.mode==="dark"?"text-gray-400":"text-gray-500"} p-2 rounded ${n.mode==="dark"?"bg-gray-700":"bg-gray-100"}`,children:["💡 ",m.jsxDEV("strong",{children:"Tip:"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:476,columnNumber:24},void 0)," Click on the color bar above to pick any color, or enter a hex code manually. The closest predefined theme will be applied."]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:475,columnNumber:19},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:428,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:410,columnNumber:13},void 0),m.jsxDEV("div",{className:`p-3 sm:p-4 rounded-xl border-2 ${n.mode==="dark"?"border-gray-500 bg-gray-600":"border-gray-200 bg-gray-50"}`,children:[m.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[m.jsxDEV("div",{className:"flex items-center space-x-2",children:[m.jsxDEV(qo,{className:"h-4 w-4"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:486,columnNumber:19},void 0),m.jsxDEV("span",{className:"text-sm font-medium",children:"Gradient Theme"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:487,columnNumber:19},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:485,columnNumber:17},void 0),m.jsxDEV("button",{onClick:()=>x(!v),className:`px-3 py-1 rounded-lg text-xs font-medium transition-colors ${v?s("primary")+" text-white":n.mode==="dark"?"bg-gray-500 hover:bg-gray-400 text-white":"bg-gray-200 hover:bg-gray-300 text-gray-700"}`,children:[v?"Hide":"Show"," Picker"]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:489,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:484,columnNumber:15},void 0),v&&m.jsxDEV("div",{className:"space-y-3",children:[m.jsxDEV("div",{children:[m.jsxDEV("p",{className:"text-xs mb-1",children:"Start Color"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:504,columnNumber:21},void 0),m.jsxDEV("div",{className:"relative",children:m.jsxDEV("div",{ref:E,onClick:A,className:"h-8 w-full rounded-lg cursor-crosshair shadow-inner border",style:{background:"linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%)",borderColor:n.mode==="dark"?"#4b5563":"#d1d5db"}},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:506,columnNumber:23},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:505,columnNumber:21},void 0),m.jsxDEV("div",{className:"flex items-center space-x-3 mt-2",children:[m.jsxDEV("div",{className:"w-8 h-8 rounded-lg shadow-md border-2",style:{backgroundColor:c,borderColor:n.mode==="dark"?"#6b7280":"#d1d5db"}},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:517,columnNumber:23},void 0),m.jsxDEV("input",{type:"text",value:c,onChange:T=>d(T.target.value),className:`flex-1 px-3 py-2 text-sm rounded-lg border ${n.mode==="dark"?"border-gray-400 bg-gray-500 text-white placeholder-gray-300":"border-gray-300 bg-white text-gray-900 placeholder-gray-500"} focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"#3b82f6"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:524,columnNumber:23},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:516,columnNumber:21},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:503,columnNumber:19},void 0),m.jsxDEV("div",{children:[m.jsxDEV("p",{className:"text-xs mb-1",children:"End Color"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:539,columnNumber:21},void 0),m.jsxDEV("div",{className:"relative",children:m.jsxDEV("div",{ref:w,onClick:R,className:"h-8 w-full rounded-lg cursor-crosshair shadow-inner border",style:{background:"linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%)",borderColor:n.mode==="dark"?"#4b5563":"#d1d5db"}},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:541,columnNumber:23},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:540,columnNumber:21},void 0),m.jsxDEV("div",{className:"flex items-center space-x-3 mt-2",children:[m.jsxDEV("div",{className:"w-8 h-8 rounded-lg shadow-md border-2",style:{backgroundColor:p,borderColor:n.mode==="dark"?"#6b7280":"#d1d5db"}},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:552,columnNumber:23},void 0),m.jsxDEV("input",{type:"text",value:p,onChange:T=>f(T.target.value),className:`flex-1 px-3 py-2 text-sm rounded-lg border ${n.mode==="dark"?"border-gray-400 bg-gray-500 text-white placeholder-gray-300":"border-gray-300 bg-white text-gray-900 placeholder-gray-500"} focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"#8b5cf6"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:559,columnNumber:23},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:551,columnNumber:21},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:538,columnNumber:19},void 0),m.jsxDEV("div",{children:[m.jsxDEV("p",{className:"text-xs mb-1",children:"Gradient Direction"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:574,columnNumber:21},void 0),m.jsxDEV("div",{className:"grid grid-cols-4 gap-2",children:P.map(T=>{const $=T.icon;return m.jsxDEV("button",{onClick:()=>g(T.value),className:`p-2 rounded-lg border transition-colors ${h===T.value?s("primary")+" text-white border-transparent":n.mode==="dark"?"bg-gray-500 text-white border-gray-400 hover:bg-gray-400":"bg-gray-100 text-gray-700 border-gray-200 hover:bg-gray-200"}`,title:T.name,children:m.jsxDEV($,{className:"h-4 w-4 mx-auto"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:590,columnNumber:29},void 0)},T.value,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:579,columnNumber:27},void 0)})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:575,columnNumber:21},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:573,columnNumber:19},void 0),m.jsxDEV("div",{className:"mt-3",children:[m.jsxDEV("p",{className:"text-xs mb-1",children:"Preview"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:599,columnNumber:21},void 0),m.jsxDEV("div",{className:`h-12 rounded-lg border gradient-enabled gradient-${h} ${n.mode==="dark"?"border-gray-500":"border-gray-300"}`,style:{"--gradient-from":F(c),"--gradient-to":F(p)}},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:600,columnNumber:21},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:598,columnNumber:19},void 0),m.jsxDEV("button",{onClick:G,className:`w-full mt-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${s("primary")} text-white hover:opacity-90 touch-target`,children:"Apply Gradient"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:609,columnNumber:19},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:501,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:483,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:381,columnNumber:11},void 0),m.jsxDEV("div",{children:[m.jsxDEV("h3",{className:"text-sm font-medium mb-3",children:"Preview"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:622,columnNumber:13},void 0),m.jsxDEV("div",{className:`p-3 sm:p-4 rounded-xl border ${n.mode==="dark"?"border-gray-500 bg-gray-600":"border-gray-200 bg-gray-50"}`,children:[m.jsxDEV("div",{className:"flex items-center space-x-3 mb-3",children:[m.jsxDEV("div",{className:`w-8 h-8 rounded-lg ${s("primary")} flex items-center justify-center text-white`,children:m.jsxDEV(lf,{className:"h-4 w-4 text-white"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:626,columnNumber:19},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:625,columnNumber:17},void 0),m.jsxDEV("div",{children:[m.jsxDEV("div",{className:`font-medium ${n.mode==="dark"?"text-white":"text-gray-900"}`,children:"Pioneer Cetak SDN.BHD"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:629,columnNumber:19},void 0),m.jsxDEV("div",{className:`text-sm ${n.mode==="dark"?"text-gray-400":"text-gray-600"}`,children:"Print Management System"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:630,columnNumber:19},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:628,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:624,columnNumber:15},void 0),m.jsxDEV("div",{className:`px-3 py-2 rounded-lg ${s("secondary")} text-sm`,children:"Sample notification message"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:635,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:623,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:621,columnNumber:11},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:269,columnNumber:9},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:248,columnNumber:7},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ThemeSelector.tsx",lineNumber:247,columnNumber:5},void 0):null},b_=()=>m.jsxDEV("svg",{width:"60%",height:"60%",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsxDEV("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:14,columnNumber:9},void 0),m.jsxDEV("polyline",{points:"14 2 14 8 20 8"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:15,columnNumber:9},void 0),m.jsxDEV("line",{x1:"16",y1:"13",x2:"8",y2:"13"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:16,columnNumber:9},void 0),m.jsxDEV("line",{x1:"16",y1:"17",x2:"8",y2:"17"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:17,columnNumber:9},void 0),m.jsxDEV("polyline",{points:"10 9 9 9 8 9"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:18,columnNumber:9},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:13,columnNumber:5},void 0),__=()=>m.jsxDEV("svg",{width:"80%",height:"80%",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsxDEV("path",{d:"M3 10h18M3 6h18M3 14h10M16 14h2M12 18h8M3 18h2"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:25,columnNumber:9},void 0),m.jsxDEV("path",{d:"M21 6v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:26,columnNumber:9},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:24,columnNumber:5},void 0),gp=({onCapture:t,onClose:e,guideType:n})=>{const i=b.useRef(null),o=b.useRef(null),[s,r]=b.useState(null),[a,c]=b.useState(null);b.useEffect(()=>{let f=null;return(async()=>{try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Camera API is not available on this browser.");f=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}}),r(f),i.current&&(i.current.srcObject=f)}catch(g){console.error("Error accessing camera:",g),c("Could not access camera. Please check permissions and ensure you are on a secure (HTTPS) connection.")}})(),()=>{f&&f.getTracks().forEach(g=>g.stop())}},[]);const d=b.useCallback(()=>{if(i.current&&o.current&&s){const f=i.current,h=o.current;h.width=f.videoWidth,h.height=f.videoHeight;const g=h.getContext("2d");g&&(g.drawImage(f,0,0,f.videoWidth,f.videoHeight),h.toBlob(y=>{if(y){const _=new File([y],`capture-${Date.now()}.jpg`,{type:"image/jpeg"});t(_)}},"image/jpeg",.9))}},[s,t]),p=n==="invoice"?"guide-invoice":"guide-cheque";return a?m.jsxDEV("div",{className:"fixed inset-0 bg-black z-50 flex flex-col items-center justify-center p-4 text-white text-center",children:[m.jsxDEV("h2",{className:"text-xl font-bold mb-4",children:"Camera Error"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:90,columnNumber:9},void 0),m.jsxDEV("p",{className:"mb-6",children:a},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:91,columnNumber:9},void 0),m.jsxDEV("button",{onClick:e,className:"px-4 py-2 bg-red-600 rounded-lg",children:"Close"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:92,columnNumber:9},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:89,columnNumber:7},void 0):m.jsxDEV("div",{className:"fixed inset-0 bg-black z-[100] flex flex-col items-center justify-center",children:[m.jsxDEV("video",{ref:i,autoPlay:!0,playsInline:!0,className:"absolute inset-0 w-full h-full object-cover"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:99,columnNumber:7},void 0),m.jsxDEV("div",{className:"camera-overlay",children:[m.jsxDEV("div",{className:`guide-cutout ${p}`,children:[m.jsxDEV("div",{className:"guide-icon-container",children:n==="invoice"?m.jsxDEV(b_,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:105,columnNumber:40},void 0):m.jsxDEV(__,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:105,columnNumber:58},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:104,columnNumber:11},void 0),m.jsxDEV("div",{className:"corner top-left"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:107,columnNumber:11},void 0),m.jsxDEV("div",{className:"corner top-right"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:108,columnNumber:11},void 0),m.jsxDEV("div",{className:"corner bottom-left"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:109,columnNumber:11},void 0),m.jsxDEV("div",{className:"corner bottom-right"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:110,columnNumber:11},void 0),m.jsxDEV("div",{className:"scanning-line"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:111,columnNumber:11},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:103,columnNumber:9},void 0),m.jsxDEV("p",{className:"guide-text",children:["Align ",n," within the frame"]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:113,columnNumber:9},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:102,columnNumber:7},void 0),m.jsxDEV("div",{className:"absolute top-0 left-0 right-0 p-4 flex justify-end",children:m.jsxDEV("button",{onClick:e,className:"p-2 text-white bg-black bg-opacity-50 rounded-full",children:m.jsxDEV(en,{size:28},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:120,columnNumber:11},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:119,columnNumber:9},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:118,columnNumber:7},void 0),m.jsxDEV("div",{className:"absolute bottom-0 left-0 right-0 p-8 flex justify-center items-center",children:m.jsxDEV("button",{onClick:d,className:"w-20 h-20 bg-white rounded-full border-4 border-gray-400 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-black focus:ring-white flex items-center justify-center",children:m.jsxDEV("div",{className:"w-16 h-16 bg-white rounded-full border-2 border-black"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:125,columnNumber:11},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:124,columnNumber:9},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:123,columnNumber:7},void 0),m.jsxDEV("canvas",{ref:o,className:"hidden"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:128,columnNumber:7},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/CameraWithGuide.tsx",lineNumber:98,columnNumber:5},void 0)};var vl;(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(vl||(vl={}));/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var bl;(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(bl||(bl={}));var _l;(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(_l||(_l={}));/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Nl=["user","model","function","system"];var xl;(function(t){t.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",t.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",t.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",t.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",t.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",t.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY"})(xl||(xl={}));var Sl;(function(t){t.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",t.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",t.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",t.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",t.BLOCK_NONE="BLOCK_NONE"})(Sl||(Sl={}));var El;(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(El||(El={}));var wl;(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(wl||(wl={}));var ro;(function(t){t.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",t.STOP="STOP",t.MAX_TOKENS="MAX_TOKENS",t.SAFETY="SAFETY",t.RECITATION="RECITATION",t.LANGUAGE="LANGUAGE",t.BLOCKLIST="BLOCKLIST",t.PROHIBITED_CONTENT="PROHIBITED_CONTENT",t.SPII="SPII",t.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",t.OTHER="OTHER"})(ro||(ro={}));var Cl;(function(t){t.TASK_TYPE_UNSPECIFIED="TASK_TYPE_UNSPECIFIED",t.RETRIEVAL_QUERY="RETRIEVAL_QUERY",t.RETRIEVAL_DOCUMENT="RETRIEVAL_DOCUMENT",t.SEMANTIC_SIMILARITY="SEMANTIC_SIMILARITY",t.CLASSIFICATION="CLASSIFICATION",t.CLUSTERING="CLUSTERING"})(Cl||(Cl={}));var Dl;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(Dl||(Dl={}));var Tl;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(Tl||(Tl={}));/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Ke extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}}class hi extends Ke{constructor(e,n){super(e),this.response=n}}class yp extends Ke{constructor(e,n,i,o){super(e),this.status=n,this.statusText=i,this.errorDetails=o}}class wn extends Ke{}class vp extends Ke{}/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const N_="https://generativelanguage.googleapis.com",x_="v1beta",S_="0.24.1",E_="genai-js";var ei;(function(t){t.GENERATE_CONTENT="generateContent",t.STREAM_GENERATE_CONTENT="streamGenerateContent",t.COUNT_TOKENS="countTokens",t.EMBED_CONTENT="embedContent",t.BATCH_EMBED_CONTENTS="batchEmbedContents"})(ei||(ei={}));class w_{constructor(e,n,i,o,s){this.model=e,this.task=n,this.apiKey=i,this.stream=o,this.requestOptions=s}toString(){var e,n;const i=((e=this.requestOptions)===null||e===void 0?void 0:e.apiVersion)||x_;let s=`${((n=this.requestOptions)===null||n===void 0?void 0:n.baseUrl)||N_}/${i}/${this.model}:${this.task}`;return this.stream&&(s+="?alt=sse"),s}}function C_(t){const e=[];return t!=null&&t.apiClient&&e.push(t.apiClient),e.push(`${E_}/${S_}`),e.join(" ")}async function D_(t){var e;const n=new Headers;n.append("Content-Type","application/json"),n.append("x-goog-api-client",C_(t.requestOptions)),n.append("x-goog-api-key",t.apiKey);let i=(e=t.requestOptions)===null||e===void 0?void 0:e.customHeaders;if(i){if(!(i instanceof Headers))try{i=new Headers(i)}catch(o){throw new wn(`unable to convert customHeaders value ${JSON.stringify(i)} to Headers: ${o.message}`)}for(const[o,s]of i.entries()){if(o==="x-goog-api-key")throw new wn(`Cannot set reserved header name ${o}`);if(o==="x-goog-api-client")throw new wn(`Header name ${o} can only be set using the apiClient field`);n.append(o,s)}}return n}async function T_(t,e,n,i,o,s){const r=new w_(t,e,n,i,s);return{url:r.toString(),fetchOptions:Object.assign(Object.assign({},I_(s)),{method:"POST",headers:await D_(r),body:o})}}async function Eo(t,e,n,i,o,s={},r=fetch){const{url:a,fetchOptions:c}=await T_(t,e,n,i,o,s);return A_(a,c,r)}async function A_(t,e,n=fetch){let i;try{i=await n(t,e)}catch(o){k_(o,t)}return i.ok||await P_(i,t),i}function k_(t,e){let n=t;throw n.name==="AbortError"?(n=new vp(`Request aborted when fetching ${e.toString()}: ${t.message}`),n.stack=t.stack):t instanceof yp||t instanceof wn||(n=new Ke(`Error fetching from ${e.toString()}: ${t.message}`),n.stack=t.stack),n}async function P_(t,e){let n="",i;try{const o=await t.json();n=o.error.message,o.error.details&&(n+=` ${JSON.stringify(o.error.details)}`,i=o.error.details)}catch{}throw new yp(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${n}`,t.status,t.statusText,i)}function I_(t){const e={};if((t==null?void 0:t.signal)!==void 0||(t==null?void 0:t.timeout)>=0){const n=new AbortController;(t==null?void 0:t.timeout)>=0&&setTimeout(()=>n.abort(),t.timeout),t!=null&&t.signal&&t.signal.addEventListener("abort",()=>{n.abort()}),e.signal=n.signal}return e}/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function ha(t){return t.text=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`),Ho(t.candidates[0]))throw new hi(`${mn(t)}`,t);return R_(t)}else if(t.promptFeedback)throw new hi(`Text not available. ${mn(t)}`,t);return""},t.functionCall=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),Ho(t.candidates[0]))throw new hi(`${mn(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),Al(t)[0]}else if(t.promptFeedback)throw new hi(`Function call not available. ${mn(t)}`,t)},t.functionCalls=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),Ho(t.candidates[0]))throw new hi(`${mn(t)}`,t);return Al(t)}else if(t.promptFeedback)throw new hi(`Function call not available. ${mn(t)}`,t)},t}function R_(t){var e,n,i,o;const s=[];if(!((n=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||n===void 0)&&n.parts)for(const r of(o=(i=t.candidates)===null||i===void 0?void 0:i[0].content)===null||o===void 0?void 0:o.parts)r.text&&s.push(r.text),r.executableCode&&s.push("\n```"+r.executableCode.language+`
`+r.executableCode.code+"\n```\n"),r.codeExecutionResult&&s.push("\n```\n"+r.codeExecutionResult.output+"\n```\n");return s.length>0?s.join(""):""}function Al(t){var e,n,i,o;const s=[];if(!((n=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||n===void 0)&&n.parts)for(const r of(o=(i=t.candidates)===null||i===void 0?void 0:i[0].content)===null||o===void 0?void 0:o.parts)r.functionCall&&s.push(r.functionCall);if(s.length>0)return s}const M_=[ro.RECITATION,ro.SAFETY,ro.LANGUAGE];function Ho(t){return!!t.finishReason&&M_.includes(t.finishReason)}function mn(t){var e,n,i;let o="";if((!t.candidates||t.candidates.length===0)&&t.promptFeedback)o+="Response was blocked",!((e=t.promptFeedback)===null||e===void 0)&&e.blockReason&&(o+=` due to ${t.promptFeedback.blockReason}`),!((n=t.promptFeedback)===null||n===void 0)&&n.blockReasonMessage&&(o+=`: ${t.promptFeedback.blockReasonMessage}`);else if(!((i=t.candidates)===null||i===void 0)&&i[0]){const s=t.candidates[0];Ho(s)&&(o+=`Candidate was blocked due to ${s.finishReason}`,s.finishMessage&&(o+=`: ${s.finishMessage}`))}return o}function go(t){return this instanceof go?(this.v=t,this):new go(t)}function V_(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n.apply(t,e||[]),o,s=[];return o={},r("next"),r("throw"),r("return"),o[Symbol.asyncIterator]=function(){return this},o;function r(h){i[h]&&(o[h]=function(g){return new Promise(function(y,_){s.push([h,g,y,_])>1||a(h,g)})})}function a(h,g){try{c(i[h](g))}catch(y){f(s[0][3],y)}}function c(h){h.value instanceof go?Promise.resolve(h.value.v).then(d,p):f(s[0][2],h)}function d(h){a("next",h)}function p(h){a("throw",h)}function f(h,g){h(g),s.shift(),s.length&&a(s[0][0],s[0][1])}}/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const kl=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;function L_(t){const e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),n=F_(e),[i,o]=n.tee();return{stream:j_(i),response:O_(o)}}async function O_(t){const e=[],n=t.getReader();for(;;){const{done:i,value:o}=await n.read();if(i)return ha(q_(e));e.push(o)}}function j_(t){return V_(this,arguments,function*(){const n=t.getReader();for(;;){const{value:i,done:o}=yield go(n.read());if(o)break;yield yield go(ha(i))}})}function F_(t){const e=t.getReader();return new ReadableStream({start(i){let o="";return s();function s(){return e.read().then(({value:r,done:a})=>{if(a){if(o.trim()){i.error(new Ke("Failed to parse stream"));return}i.close();return}o+=r;let c=o.match(kl),d;for(;c;){try{d=JSON.parse(c[1])}catch{i.error(new Ke(`Error parsing JSON response: "${c[1]}"`));return}i.enqueue(d),o=o.substring(c[0].length),c=o.match(kl)}return s()}).catch(r=>{let a=r;throw a.stack=r.stack,a.name==="AbortError"?a=new vp("Request aborted when reading from the stream"):a=new Ke("Error reading from the stream"),a})}}})}function q_(t){const e=t[t.length-1],n={promptFeedback:e==null?void 0:e.promptFeedback};for(const i of t){if(i.candidates){let o=0;for(const s of i.candidates)if(n.candidates||(n.candidates=[]),n.candidates[o]||(n.candidates[o]={index:o}),n.candidates[o].citationMetadata=s.citationMetadata,n.candidates[o].groundingMetadata=s.groundingMetadata,n.candidates[o].finishReason=s.finishReason,n.candidates[o].finishMessage=s.finishMessage,n.candidates[o].safetyRatings=s.safetyRatings,s.content&&s.content.parts){n.candidates[o].content||(n.candidates[o].content={role:s.content.role||"user",parts:[]});const r={};for(const a of s.content.parts)a.text&&(r.text=a.text),a.functionCall&&(r.functionCall=a.functionCall),a.executableCode&&(r.executableCode=a.executableCode),a.codeExecutionResult&&(r.codeExecutionResult=a.codeExecutionResult),Object.keys(r).length===0&&(r.text=""),n.candidates[o].content.parts.push(r)}o++}i.usageMetadata&&(n.usageMetadata=i.usageMetadata)}return n}/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function bp(t,e,n,i){const o=await Eo(e,ei.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(n),i);return L_(o)}async function _p(t,e,n,i){const s=await(await Eo(e,ei.GENERATE_CONTENT,t,!1,JSON.stringify(n),i)).json();return{response:ha(s)}}/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Np(t){if(t!=null){if(typeof t=="string")return{role:"system",parts:[{text:t}]};if(t.text)return{role:"system",parts:[t]};if(t.parts)return t.role?t:{role:"system",parts:t.parts}}}function yo(t){let e=[];if(typeof t=="string")e=[{text:t}];else for(const n of t)typeof n=="string"?e.push({text:n}):e.push(n);return U_(e)}function U_(t){const e={role:"user",parts:[]},n={role:"function",parts:[]};let i=!1,o=!1;for(const s of t)"functionResponse"in s?(n.parts.push(s),o=!0):(e.parts.push(s),i=!0);if(i&&o)throw new Ke("Within a single message, FunctionResponse cannot be mixed with other type of part in the request for sending chat message.");if(!i&&!o)throw new Ke("No content is provided for sending chat message.");return i?e:n}function $_(t,e){var n;let i={model:e==null?void 0:e.model,generationConfig:e==null?void 0:e.generationConfig,safetySettings:e==null?void 0:e.safetySettings,tools:e==null?void 0:e.tools,toolConfig:e==null?void 0:e.toolConfig,systemInstruction:e==null?void 0:e.systemInstruction,cachedContent:(n=e==null?void 0:e.cachedContent)===null||n===void 0?void 0:n.name,contents:[]};const o=t.generateContentRequest!=null;if(t.contents){if(o)throw new wn("CountTokensRequest must have one of contents or generateContentRequest, not both.");i.contents=t.contents}else if(o)i=Object.assign(Object.assign({},i),t.generateContentRequest);else{const s=yo(t);i.contents=[s]}return{generateContentRequest:i}}function Pl(t){let e;return t.contents?e=t:e={contents:[yo(t)]},t.systemInstruction&&(e.systemInstruction=Np(t.systemInstruction)),e}function B_(t){return typeof t=="string"||Array.isArray(t)?{content:yo(t)}:t}/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Il=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],G_={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};function H_(t){let e=!1;for(const n of t){const{role:i,parts:o}=n;if(!e&&i!=="user")throw new Ke(`First content should be with role 'user', got ${i}`);if(!Nl.includes(i))throw new Ke(`Each item should include role field. Got ${i} but valid roles are: ${JSON.stringify(Nl)}`);if(!Array.isArray(o))throw new Ke("Content should have 'parts' property with an array of Parts");if(o.length===0)throw new Ke("Each Content should have at least one part");const s={text:0,inlineData:0,functionCall:0,functionResponse:0,fileData:0,executableCode:0,codeExecutionResult:0};for(const a of o)for(const c of Il)c in a&&(s[c]+=1);const r=G_[i];for(const a of Il)if(!r.includes(a)&&s[a]>0)throw new Ke(`Content with role '${i}' can't contain '${a}' part`);e=!0}}function Rl(t){var e;if(t.candidates===void 0||t.candidates.length===0)return!1;const n=(e=t.candidates[0])===null||e===void 0?void 0:e.content;if(n===void 0||n.parts===void 0||n.parts.length===0)return!1;for(const i of n.parts)if(i===void 0||Object.keys(i).length===0||i.text!==void 0&&i.text==="")return!1;return!0}/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Ml="SILENT_ERROR";class K_{constructor(e,n,i,o={}){this.model=n,this.params=i,this._requestOptions=o,this._history=[],this._sendPromise=Promise.resolve(),this._apiKey=e,i!=null&&i.history&&(H_(i.history),this._history=i.history)}async getHistory(){return await this._sendPromise,this._history}async sendMessage(e,n={}){var i,o,s,r,a,c;await this._sendPromise;const d=yo(e),p={safetySettings:(i=this.params)===null||i===void 0?void 0:i.safetySettings,generationConfig:(o=this.params)===null||o===void 0?void 0:o.generationConfig,tools:(s=this.params)===null||s===void 0?void 0:s.tools,toolConfig:(r=this.params)===null||r===void 0?void 0:r.toolConfig,systemInstruction:(a=this.params)===null||a===void 0?void 0:a.systemInstruction,cachedContent:(c=this.params)===null||c===void 0?void 0:c.cachedContent,contents:[...this._history,d]},f=Object.assign(Object.assign({},this._requestOptions),n);let h;return this._sendPromise=this._sendPromise.then(()=>_p(this._apiKey,this.model,p,f)).then(g=>{var y;if(Rl(g.response)){this._history.push(d);const _=Object.assign({parts:[],role:"model"},(y=g.response.candidates)===null||y===void 0?void 0:y[0].content);this._history.push(_)}else{const _=mn(g.response);_&&console.warn(`sendMessage() was unsuccessful. ${_}. Inspect response object for details.`)}h=g}).catch(g=>{throw this._sendPromise=Promise.resolve(),g}),await this._sendPromise,h}async sendMessageStream(e,n={}){var i,o,s,r,a,c;await this._sendPromise;const d=yo(e),p={safetySettings:(i=this.params)===null||i===void 0?void 0:i.safetySettings,generationConfig:(o=this.params)===null||o===void 0?void 0:o.generationConfig,tools:(s=this.params)===null||s===void 0?void 0:s.tools,toolConfig:(r=this.params)===null||r===void 0?void 0:r.toolConfig,systemInstruction:(a=this.params)===null||a===void 0?void 0:a.systemInstruction,cachedContent:(c=this.params)===null||c===void 0?void 0:c.cachedContent,contents:[...this._history,d]},f=Object.assign(Object.assign({},this._requestOptions),n),h=bp(this._apiKey,this.model,p,f);return this._sendPromise=this._sendPromise.then(()=>h).catch(g=>{throw new Error(Ml)}).then(g=>g.response).then(g=>{if(Rl(g)){this._history.push(d);const y=Object.assign({},g.candidates[0].content);y.role||(y.role="model"),this._history.push(y)}else{const y=mn(g);y&&console.warn(`sendMessageStream() was unsuccessful. ${y}. Inspect response object for details.`)}}).catch(g=>{g.message!==Ml&&console.error(g)}),h}}/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function J_(t,e,n,i){return(await Eo(e,ei.COUNT_TOKENS,t,!1,JSON.stringify(n),i)).json()}/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function W_(t,e,n,i){return(await Eo(e,ei.EMBED_CONTENT,t,!1,JSON.stringify(n),i)).json()}async function z_(t,e,n,i){const o=n.requests.map(r=>Object.assign(Object.assign({},r),{model:e}));return(await Eo(e,ei.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:o}),i)).json()}/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Vl{constructor(e,n,i={}){this.apiKey=e,this._requestOptions=i,n.model.includes("/")?this.model=n.model:this.model=`models/${n.model}`,this.generationConfig=n.generationConfig||{},this.safetySettings=n.safetySettings||[],this.tools=n.tools,this.toolConfig=n.toolConfig,this.systemInstruction=Np(n.systemInstruction),this.cachedContent=n.cachedContent}async generateContent(e,n={}){var i;const o=Pl(e),s=Object.assign(Object.assign({},this._requestOptions),n);return _p(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(i=this.cachedContent)===null||i===void 0?void 0:i.name},o),s)}async generateContentStream(e,n={}){var i;const o=Pl(e),s=Object.assign(Object.assign({},this._requestOptions),n);return bp(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(i=this.cachedContent)===null||i===void 0?void 0:i.name},o),s)}startChat(e){var n;return new K_(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(n=this.cachedContent)===null||n===void 0?void 0:n.name},e),this._requestOptions)}async countTokens(e,n={}){const i=$_(e,{model:this.model,generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:this.cachedContent}),o=Object.assign(Object.assign({},this._requestOptions),n);return J_(this.apiKey,this.model,i,o)}async embedContent(e,n={}){const i=B_(e),o=Object.assign(Object.assign({},this._requestOptions),n);return W_(this.apiKey,this.model,i,o)}async batchEmbedContents(e,n={}){const i=Object.assign(Object.assign({},this._requestOptions),n);return z_(this.apiKey,this.model,e,i)}}/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Y_{constructor(e){this.apiKey=e}getGenerativeModel(e,n){if(!e.model)throw new Ke("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new Vl(this.apiKey,e,n)}getGenerativeModelFromCachedContent(e,n,i){if(!e.name)throw new wn("Cached content must contain a `name` field.");if(!e.model)throw new wn("Cached content must contain a `model` field.");const o=["model","systemInstruction"];for(const r of o)if(n!=null&&n[r]&&e[r]&&(n==null?void 0:n[r])!==e[r]){if(r==="model"){const a=n.model.startsWith("models/")?n.model.replace("models/",""):n.model,c=e.model.startsWith("models/")?e.model.replace("models/",""):e.model;if(a===c)continue}throw new wn(`Different value for "${r}" specified in modelParams (${n[r]}) and cachedContent (${e[r]})`)}const s=Object.assign(Object.assign({},n),{model:e.model,tools:e.tools,toolConfig:e.toolConfig,systemInstruction:e.systemInstruction,cachedContent:e});return new Vl(this.apiKey,s,i)}}var Q_=Object.defineProperty,X_=(t,e,n)=>e in t?Q_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,er=(t,e,n)=>(X_(t,typeof e!="symbol"?e+"":e,n),n);let Z_=class{constructor(){er(this,"current",this.detect()),er(this,"handoffState","pending"),er(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},qt=new Z_;function wo(t){var e;return qt.isServer?null:t==null?document:(e=t==null?void 0:t.ownerDocument)!=null?e:document}function Ir(t){var e,n;return qt.isServer?null:t==null?document:(n=(e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))!=null?n:document}function xp(t){var e,n;return(n=(e=Ir(t))==null?void 0:e.activeElement)!=null?n:null}function e0(t){return xp(t)===t}function ks(t){typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t).catch(e=>setTimeout(()=>{throw e}))}function on(){let t=[],e={addEventListener(n,i,o,s){return n.addEventListener(i,o,s),e.add(()=>n.removeEventListener(i,o,s))},requestAnimationFrame(...n){let i=requestAnimationFrame(...n);return e.add(()=>cancelAnimationFrame(i))},nextFrame(...n){return e.requestAnimationFrame(()=>e.requestAnimationFrame(...n))},setTimeout(...n){let i=setTimeout(...n);return e.add(()=>clearTimeout(i))},microTask(...n){let i={current:!0};return ks(()=>{i.current&&n[0]()}),e.add(()=>{i.current=!1})},style(n,i,o){let s=n.style.getPropertyValue(i);return Object.assign(n.style,{[i]:o}),this.add(()=>{Object.assign(n.style,{[i]:s})})},group(n){let i=on();return n(i),this.add(()=>i.dispose())},add(n){return t.includes(n)||t.push(n),()=>{let i=t.indexOf(n);if(i>=0)for(let o of t.splice(i,1))o()}},dispose(){for(let n of t.splice(0))n()}};return e}function Ps(){let[t]=b.useState(on);return b.useEffect(()=>()=>t.dispose(),[t]),t}let tt=(t,e)=>{qt.isServer?b.useEffect(t,e):b.useLayoutEffect(t,e)};function ri(t){let e=b.useRef(t);return tt(()=>{e.current=t},[t]),e}let Ae=function(t){let e=ri(t);return ue.useCallback((...n)=>e.current(...n),[e])};function Co(t){return b.useMemo(()=>t,Object.values(t))}let t0=b.createContext(void 0);function n0(){return b.useContext(t0)}function Rr(...t){return Array.from(new Set(t.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}function tn(t,e,...n){if(t in e){let o=e[t];return typeof o=="function"?o(...n):o}let i=new Error(`Tried to handle "${t}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(i,tn),i}var ns=(t=>(t[t.None=0]="None",t[t.RenderStrategy=1]="RenderStrategy",t[t.Static=2]="Static",t))(ns||{}),xn=(t=>(t[t.Unmount=0]="Unmount",t[t.Hidden=1]="Hidden",t))(xn||{});function ft(){let t=o0();return b.useCallback(e=>i0({mergeRefs:t,...e}),[t])}function i0({ourProps:t,theirProps:e,slot:n,defaultTag:i,features:o,visible:s=!0,name:r,mergeRefs:a}){a=a??s0;let c=Sp(e,t);if(s)return Ro(c,n,i,r,a);let d=o??0;if(d&2){let{static:p=!1,...f}=c;if(p)return Ro(f,n,i,r,a)}if(d&1){let{unmount:p=!0,...f}=c;return tn(p?0:1,{0(){return null},1(){return Ro({...f,hidden:!0,style:{display:"none"}},n,i,r,a)}})}return Ro(c,n,i,r,a)}function Ro(t,e={},n,i,o){let{as:s=n,children:r,refName:a="ref",...c}=tr(t,["unmount","static"]),d=t.ref!==void 0?{[a]:t.ref}:{},p=typeof r=="function"?r(e):r;"className"in c&&c.className&&typeof c.className=="function"&&(c.className=c.className(e)),c["aria-labelledby"]&&c["aria-labelledby"]===c.id&&(c["aria-labelledby"]=void 0);let f={};if(e){let h=!1,g=[];for(let[y,_]of Object.entries(e))typeof _=="boolean"&&(h=!0),_===!0&&g.push(y.replace(/([A-Z])/g,v=>`-${v.toLowerCase()}`));if(h){f["data-headlessui-state"]=g.join(" ");for(let y of g)f[`data-${y}`]=""}}if(ao(s)&&(Object.keys(Vn(c)).length>0||Object.keys(Vn(f)).length>0))if(!b.isValidElement(p)||Array.isArray(p)&&p.length>1||a0(p)){if(Object.keys(Vn(c)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${i} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Vn(c)).concat(Object.keys(Vn(f))).map(h=>`  - ${h}`).join(`
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(h=>`  - ${h}`).join(`
`)].join(`
`))}else{let h=p.props,g=h==null?void 0:h.className,y=typeof g=="function"?(...x)=>Rr(g(...x),c.className):Rr(g,c.className),_=y?{className:y}:{},v=Sp(p.props,Vn(tr(c,["ref"])));for(let x in f)x in v&&delete f[x];return b.cloneElement(p,Object.assign({},v,f,d,{ref:o(r0(p),d.ref)},_))}return b.createElement(s,Object.assign({},tr(c,["ref"]),!ao(s)&&d,!ao(s)&&f),p)}function o0(){let t=b.useRef([]),e=b.useCallback(n=>{for(let i of t.current)i!=null&&(typeof i=="function"?i(n):i.current=n)},[]);return(...n)=>{if(!n.every(i=>i==null))return t.current=n,e}}function s0(...t){return t.every(e=>e==null)?void 0:e=>{for(let n of t)n!=null&&(typeof n=="function"?n(e):n.current=e)}}function Sp(...t){if(t.length===0)return{};if(t.length===1)return t[0];let e={},n={};for(let i of t)for(let o in i)o.startsWith("on")&&typeof i[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(i[o])):e[o]=i[o];if(e.disabled||e["aria-disabled"])for(let i in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(i)&&(n[i]=[o=>{var s;return(s=o==null?void 0:o.preventDefault)==null?void 0:s.call(o)}]);for(let i in n)Object.assign(e,{[i](o,...s){let r=n[i];for(let a of r){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;a(o,...s)}}});return e}function nt(t){var e;return Object.assign(b.forwardRef(t),{displayName:(e=t.displayName)!=null?e:t.name})}function Vn(t){let e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function tr(t,e=[]){let n=Object.assign({},t);for(let i of e)i in n&&delete n[i];return n}function r0(t){return ue.version.split(".")[0]>="19"?t.props.ref:t.ref}function ao(t){return t===b.Fragment||t===Symbol.for("react.fragment")}function a0(t){return ao(t.type)}let l0="span";var is=(t=>(t[t.None=1]="None",t[t.Focusable=2]="Focusable",t[t.Hidden=4]="Hidden",t))(is||{});function c0(t,e){var n;let{features:i=1,...o}=t,s={ref:e,"aria-hidden":(i&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(i&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(i&4)===4&&(i&2)!==2&&{display:"none"}}};return ft()({ourProps:s,theirProps:o,slot:{},defaultTag:l0,name:"Hidden"})}let Mr=nt(c0);function u0(t){return typeof t!="object"||t===null?!1:"nodeType"in t}function Cn(t){return u0(t)&&"tagName"in t}function ti(t){return Cn(t)&&"accessKey"in t}function Sn(t){return Cn(t)&&"tabIndex"in t}function d0(t){return Cn(t)&&"style"in t}function p0(t){return ti(t)&&t.nodeName==="IFRAME"}function m0(t){return ti(t)&&t.nodeName==="INPUT"}let Ep=Symbol();function f0(t,e=!0){return Object.assign(t,{[Ep]:e})}function Bt(...t){let e=b.useRef(t);b.useEffect(()=>{e.current=t},[t]);let n=Ae(i=>{for(let o of e.current)o!=null&&(typeof o=="function"?o(i):o.current=i)});return t.every(i=>i==null||(i==null?void 0:i[Ep]))?void 0:n}let ga=b.createContext(null);ga.displayName="DescriptionContext";function wp(){let t=b.useContext(ga);if(t===null){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,wp),e}return t}function h0(){let[t,e]=b.useState([]);return[t.length>0?t.join(" "):void 0,b.useMemo(()=>function(n){let i=Ae(s=>(e(r=>[...r,s]),()=>e(r=>{let a=r.slice(),c=a.indexOf(s);return c!==-1&&a.splice(c,1),a}))),o=b.useMemo(()=>({register:i,slot:n.slot,name:n.name,props:n.props,value:n.value}),[i,n.slot,n.name,n.props,n.value]);return ue.createElement(ga.Provider,{value:o},n.children)},[e])]}let g0="p";function y0(t,e){let n=b.useId(),i=n0(),{id:o=`headlessui-description-${n}`,...s}=t,r=wp(),a=Bt(e);tt(()=>r.register(o),[o,r.register]);let c=Co({...r.slot,disabled:i||!1}),d={ref:a,...r.props,id:o};return ft()({ourProps:d,theirProps:s,slot:c,defaultTag:g0,name:r.name||"Description"})}let v0=nt(y0),b0=Object.assign(v0,{});var Cp=(t=>(t.Space=" ",t.Enter="Enter",t.Escape="Escape",t.Backspace="Backspace",t.Delete="Delete",t.ArrowLeft="ArrowLeft",t.ArrowUp="ArrowUp",t.ArrowRight="ArrowRight",t.ArrowDown="ArrowDown",t.Home="Home",t.End="End",t.PageUp="PageUp",t.PageDown="PageDown",t.Tab="Tab",t))(Cp||{});let _0=b.createContext(()=>{});function N0({value:t,children:e}){return ue.createElement(_0.Provider,{value:t},e)}let Dp=class extends Map{constructor(e){super(),this.factory=e}get(e){let n=super.get(e);return n===void 0&&(n=this.factory(e),this.set(e,n)),n}};var x0=Object.defineProperty,S0=(t,e,n)=>e in t?x0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,E0=(t,e,n)=>(S0(t,e+"",n),n),Tp=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},ct=(t,e,n)=>(Tp(t,e,"read from private field"),n?n.call(t):e.get(t)),nr=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Ll=(t,e,n,i)=>(Tp(t,e,"write to private field"),e.set(t,n),n),Pt,Yi,Qi;let w0=class{constructor(e){nr(this,Pt,{}),nr(this,Yi,new Dp(()=>new Set)),nr(this,Qi,new Set),E0(this,"disposables",on()),Ll(this,Pt,e),qt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return ct(this,Pt)}subscribe(e,n){if(qt.isServer)return()=>{};let i={selector:e,callback:n,current:e(ct(this,Pt))};return ct(this,Qi).add(i),this.disposables.add(()=>{ct(this,Qi).delete(i)})}on(e,n){return qt.isServer?()=>{}:(ct(this,Yi).get(e).add(n),this.disposables.add(()=>{ct(this,Yi).get(e).delete(n)}))}send(e){let n=this.reduce(ct(this,Pt),e);if(n!==ct(this,Pt)){Ll(this,Pt,n);for(let i of ct(this,Qi)){let o=i.selector(ct(this,Pt));Ap(i.current,o)||(i.current=o,i.callback(o))}for(let i of ct(this,Yi).get(e.type))i(ct(this,Pt),e)}}};Pt=new WeakMap,Yi=new WeakMap,Qi=new WeakMap;function Ap(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null?!1:Array.isArray(t)&&Array.isArray(e)?t.length!==e.length?!1:ir(t[Symbol.iterator](),e[Symbol.iterator]()):t instanceof Map&&e instanceof Map||t instanceof Set&&e instanceof Set?t.size!==e.size?!1:ir(t.entries(),e.entries()):Ol(t)&&Ol(e)?ir(Object.entries(t)[Symbol.iterator](),Object.entries(e)[Symbol.iterator]()):!1}function ir(t,e){do{let n=t.next(),i=e.next();if(n.done&&i.done)return!0;if(n.done||i.done||!Object.is(n.value,i.value))return!1}while(!0)}function Ol(t){if(Object.prototype.toString.call(t)!=="[object Object]")return!1;let e=Object.getPrototypeOf(t);return e===null||Object.getPrototypeOf(e)===null}var C0=Object.defineProperty,D0=(t,e,n)=>e in t?C0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,jl=(t,e,n)=>(D0(t,typeof e!="symbol"?e+"":e,n),n),T0=(t=>(t[t.Push=0]="Push",t[t.Pop=1]="Pop",t))(T0||{});let A0={0(t,e){let n=e.id,i=t.stack,o=t.stack.indexOf(n);if(o!==-1){let s=t.stack.slice();return s.splice(o,1),s.push(n),i=s,{...t,stack:i}}return{...t,stack:[...t.stack,n]}},1(t,e){let n=e.id,i=t.stack.indexOf(n);if(i===-1)return t;let o=t.stack.slice();return o.splice(i,1),{...t,stack:o}}},k0=class kp extends w0{constructor(){super(...arguments),jl(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),jl(this,"selectors",{isTop:(e,n)=>e.stack[e.stack.length-1]===n,inStack:(e,n)=>e.stack.includes(n)})}static new(){return new kp({stack:[]})}reduce(e,n){return tn(n.type,A0,e,n)}};const Pp=new Dp(()=>k0.new());var Ip={exports:{}},Rp={};/**
 * @license React
 * use-sync-external-store-with-selector.development.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(){function t(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=b,n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,r=e.useMemo,a=e.useDebugValue;Rp.useSyncExternalStoreWithSelector=function(c,d,p,f,h){var g=o(null);if(g.current===null){var y={hasValue:!1,value:null};g.current=y}else y=g.current;g=r(function(){function v(P){if(!x){if(x=!0,E=P,P=f(P),h!==void 0&&y.hasValue){var k=y.value;if(h(k,P))return w=k}return w=P}if(k=w,n(E,P))return k;var I=f(P);return h!==void 0&&h(k,I)?(E=P,k):(E=P,w=I)}var x=!1,E,w,C=p===void 0?null:p;return[function(){return v(d())},C===null?void 0:function(){return v(C())}]},[d,p,f,h]);var _=i(c,g[0],g[1]);return s(function(){y.hasValue=!0,y.value=_},[_]),a(_),_},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})();Ip.exports=Rp;var P0=Ip.exports;function Mp(t,e,n=Ap){return P0.useSyncExternalStoreWithSelector(Ae(i=>t.subscribe(I0,i)),Ae(()=>t.state),Ae(()=>t.state),Ae(e),n)}function I0(t){return t}function Do(t,e){let n=b.useId(),i=Pp.get(e),[o,s]=Mp(i,b.useCallback(r=>[i.selectors.isTop(r,n),i.selectors.inStack(r,n)],[i,n]));return tt(()=>{if(t)return i.actions.push(n),()=>i.actions.pop(n)},[i,t,n]),t?s?o:!0:!1}let Vr=new Map,lo=new Map;function Fl(t){var e;let n=(e=lo.get(t))!=null?e:0;return lo.set(t,n+1),n!==0?()=>ql(t):(Vr.set(t,{"aria-hidden":t.getAttribute("aria-hidden"),inert:t.inert}),t.setAttribute("aria-hidden","true"),t.inert=!0,()=>ql(t))}function ql(t){var e;let n=(e=lo.get(t))!=null?e:1;if(n===1?lo.delete(t):lo.set(t,n-1),n!==1)return;let i=Vr.get(t);i&&(i["aria-hidden"]===null?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",i["aria-hidden"]),t.inert=i.inert,Vr.delete(t))}function R0(t,{allowed:e,disallowed:n}={}){let i=Do(t,"inert-others");tt(()=>{var o,s;if(!i)return;let r=on();for(let c of(o=n==null?void 0:n())!=null?o:[])c&&r.add(Fl(c));let a=(s=e==null?void 0:e())!=null?s:[];for(let c of a){if(!c)continue;let d=wo(c);if(!d)continue;let p=c.parentElement;for(;p&&p!==d.body;){for(let f of p.children)a.some(h=>f.contains(h))||r.add(Fl(f));p=p.parentElement}}return r.dispose},[i,e,n])}function M0(t,e,n){let i=ri(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});b.useEffect(()=>{if(!t)return;let o=e===null?null:ti(e)?e:e.current;if(!o)return;let s=on();if(typeof ResizeObserver<"u"){let r=new ResizeObserver(()=>i.current(o));r.observe(o),s.add(()=>r.disconnect())}if(typeof IntersectionObserver<"u"){let r=new IntersectionObserver(()=>i.current(o));r.observe(o),s.add(()=>r.disconnect())}return()=>s.dispose()},[e,i,t])}let os=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(t=>`${t}:not([tabindex='-1'])`).join(","),V0=["[data-autofocus]"].map(t=>`${t}:not([tabindex='-1'])`).join(",");var Qt=(t=>(t[t.First=1]="First",t[t.Previous=2]="Previous",t[t.Next=4]="Next",t[t.Last=8]="Last",t[t.WrapAround=16]="WrapAround",t[t.NoScroll=32]="NoScroll",t[t.AutoFocus=64]="AutoFocus",t))(Qt||{}),Lr=(t=>(t[t.Error=0]="Error",t[t.Overflow=1]="Overflow",t[t.Success=2]="Success",t[t.Underflow=3]="Underflow",t))(Lr||{}),L0=(t=>(t[t.Previous=-1]="Previous",t[t.Next=1]="Next",t))(L0||{});function O0(t=document.body){return t==null?[]:Array.from(t.querySelectorAll(os)).sort((e,n)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function j0(t=document.body){return t==null?[]:Array.from(t.querySelectorAll(V0)).sort((e,n)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Vp=(t=>(t[t.Strict=0]="Strict",t[t.Loose=1]="Loose",t))(Vp||{});function F0(t,e=0){var n;return t===((n=wo(t))==null?void 0:n.body)?!1:tn(e,{0(){return t.matches(os)},1(){let i=t;for(;i!==null;){if(i.matches(os))return!0;i=i.parentElement}return!1}})}var q0=(t=>(t[t.Keyboard=0]="Keyboard",t[t.Mouse=1]="Mouse",t))(q0||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",t=>{t.metaKey||t.altKey||t.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",t=>{t.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:t.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function Zt(t){t==null||t.focus({preventScroll:!0})}let U0=["textarea","input"].join(",");function $0(t){var e,n;return(n=(e=t==null?void 0:t.matches)==null?void 0:e.call(t,U0))!=null?n:!1}function B0(t,e=n=>n){return t.slice().sort((n,i)=>{let o=e(n),s=e(i);if(o===null||s===null)return 0;let r=o.compareDocumentPosition(s);return r&Node.DOCUMENT_POSITION_FOLLOWING?-1:r&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function co(t,e,{sorted:n=!0,relativeTo:i=null,skipElements:o=[]}={}){let s=Array.isArray(t)?t.length>0?Ir(t[0]):document:Ir(t),r=Array.isArray(t)?n?B0(t):t:e&64?j0(t):O0(t);o.length>0&&r.length>1&&(r=r.filter(g=>!o.some(y=>y!=null&&"current"in y?(y==null?void 0:y.current)===g:y===g))),i=i??(s==null?void 0:s.activeElement);let a=(()=>{if(e&5)return 1;if(e&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=(()=>{if(e&1)return 0;if(e&2)return Math.max(0,r.indexOf(i))-1;if(e&4)return Math.max(0,r.indexOf(i))+1;if(e&8)return r.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),d=e&32?{preventScroll:!0}:{},p=0,f=r.length,h;do{if(p>=f||p+f<=0)return 0;let g=c+p;if(e&16)g=(g+f)%f;else{if(g<0)return 3;if(g>=f)return 1}h=r[g],h==null||h.focus(d),p+=a}while(h!==xp(h));return e&6&&$0(h)&&h.select(),2}function Lp(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function G0(){return/Android/gi.test(window.navigator.userAgent)}function Ul(){return Lp()||G0()}function Mo(t,e,n,i){let o=ri(n);b.useEffect(()=>{if(!t)return;function s(r){o.current(r)}return document.addEventListener(e,s,i),()=>document.removeEventListener(e,s,i)},[t,e,i])}function Op(t,e,n,i){let o=ri(n);b.useEffect(()=>{if(!t)return;function s(r){o.current(r)}return window.addEventListener(e,s,i),()=>window.removeEventListener(e,s,i)},[t,e,i])}const $l=30;function H0(t,e,n){let i=ri(n),o=b.useCallback(function(a,c){if(a.defaultPrevented)return;let d=c(a);if(d===null||!d.getRootNode().contains(d)||!d.isConnected)return;let p=function f(h){return typeof h=="function"?f(h()):Array.isArray(h)||h instanceof Set?h:[h]}(e);for(let f of p)if(f!==null&&(f.contains(d)||a.composed&&a.composedPath().includes(f)))return;return!F0(d,Vp.Loose)&&d.tabIndex!==-1&&a.preventDefault(),i.current(a,d)},[i,e]),s=b.useRef(null);Mo(t,"pointerdown",a=>{var c,d;Ul()||(s.current=((d=(c=a.composedPath)==null?void 0:c.call(a))==null?void 0:d[0])||a.target)},!0),Mo(t,"pointerup",a=>{if(Ul()||!s.current)return;let c=s.current;return s.current=null,o(a,()=>c)},!0);let r=b.useRef({x:0,y:0});Mo(t,"touchstart",a=>{r.current.x=a.touches[0].clientX,r.current.y=a.touches[0].clientY},!0),Mo(t,"touchend",a=>{let c={x:a.changedTouches[0].clientX,y:a.changedTouches[0].clientY};if(!(Math.abs(c.x-r.current.x)>=$l||Math.abs(c.y-r.current.y)>=$l))return o(a,()=>Sn(a.target)?a.target:null)},!0),Op(t,"blur",a=>o(a,()=>p0(window.document.activeElement)?window.document.activeElement:null),!0)}function ya(...t){return b.useMemo(()=>wo(...t),[...t])}function jp(t,e,n,i){let o=ri(n);b.useEffect(()=>{t=t??window;function s(r){o.current(r)}return t.addEventListener(e,s,i),()=>t.removeEventListener(e,s,i)},[t,e,i])}function K0(t){return b.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot)}function J0(t,e){let n=t(),i=new Set;return{getSnapshot(){return n},subscribe(o){return i.add(o),()=>i.delete(o)},dispatch(o,...s){let r=e[o].call(n,...s);r&&(n=r,i.forEach(a=>a()))}}}function W0(){let t;return{before({doc:e}){var n;let i=e.documentElement,o=(n=e.defaultView)!=null?n:window;t=Math.max(0,o.innerWidth-i.clientWidth)},after({doc:e,d:n}){let i=e.documentElement,o=Math.max(0,i.clientWidth-i.offsetWidth),s=Math.max(0,t-o);n.style(i,"paddingRight",`${s}px`)}}}function z0(){return Lp()?{before({doc:t,d:e,meta:n}){function i(o){for(let s of n().containers)for(let r of s())if(r.contains(o))return!0;return!1}e.microTask(()=>{var o;if(window.getComputedStyle(t.documentElement).scrollBehavior!=="auto"){let a=on();a.style(t.documentElement,"scrollBehavior","auto"),e.add(()=>e.microTask(()=>a.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,r=null;e.addEventListener(t,"click",a=>{if(Sn(a.target))try{let c=a.target.closest("a");if(!c)return;let{hash:d}=new URL(c.href),p=t.querySelector(d);Sn(p)&&!i(p)&&(r=p)}catch{}},!0),e.group(a=>{e.addEventListener(t,"touchstart",c=>{if(a.dispose(),Sn(c.target)&&d0(c.target))if(i(c.target)){let d=c.target;for(;d.parentElement&&i(d.parentElement);)d=d.parentElement;a.style(d,"overscrollBehavior","contain")}else a.style(c.target,"touchAction","none")})}),e.addEventListener(t,"touchmove",a=>{if(Sn(a.target)){if(m0(a.target))return;if(i(a.target)){let c=a.target;for(;c.parentElement&&c.dataset.headlessuiPortal!==""&&!(c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth);)c=c.parentElement;c.dataset.headlessuiPortal===""&&a.preventDefault()}else a.preventDefault()}},{passive:!1}),e.add(()=>{var a;let c=(a=window.scrollY)!=null?a:window.pageYOffset;s!==c&&window.scrollTo(0,s),r&&r.isConnected&&(r.scrollIntoView({block:"nearest"}),r=null)})})}}:{}}function Y0(){return{before({doc:t,d:e}){e.style(t.documentElement,"overflow","hidden")}}}function Bl(t){let e={};for(let n of t)Object.assign(e,n(e));return e}let Fn=J0(()=>new Map,{PUSH(t,e){var n;let i=(n=this.get(t))!=null?n:{doc:t,count:0,d:on(),meta:new Set,computedMeta:{}};return i.count++,i.meta.add(e),i.computedMeta=Bl(i.meta),this.set(t,i),this},POP(t,e){let n=this.get(t);return n&&(n.count--,n.meta.delete(e),n.computedMeta=Bl(n.meta)),this},SCROLL_PREVENT(t){let e={doc:t.doc,d:t.d,meta(){return t.computedMeta}},n=[z0(),W0(),Y0()];n.forEach(({before:i})=>i==null?void 0:i(e)),n.forEach(({after:i})=>i==null?void 0:i(e))},SCROLL_ALLOW({d:t}){t.dispose()},TEARDOWN({doc:t}){this.delete(t)}});Fn.subscribe(()=>{let t=Fn.getSnapshot(),e=new Map;for(let[n]of t)e.set(n,n.documentElement.style.overflow);for(let n of t.values()){let i=e.get(n.doc)==="hidden",o=n.count!==0;(o&&!i||!o&&i)&&Fn.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Fn.dispatch("TEARDOWN",n)}});function Q0(t,e,n=()=>({containers:[]})){let i=K0(Fn),o=e?i.get(e):void 0,s=o?o.count>0:!1;return tt(()=>{if(!(!e||!t))return Fn.dispatch("PUSH",e,n),()=>Fn.dispatch("POP",e,n)},[t,e]),s}function X0(t,e,n=()=>[document.body]){let i=Do(t,"scroll-lock");Q0(i,e,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function Z0(t=0){let[e,n]=b.useState(t),i=b.useCallback(c=>n(c),[]),o=b.useCallback(c=>n(d=>d|c),[]),s=b.useCallback(c=>(e&c)===c,[e]),r=b.useCallback(c=>n(d=>d&~c),[]),a=b.useCallback(c=>n(d=>d^c),[]);return{flags:e,setFlag:i,addFlag:o,hasFlag:s,removeFlag:r,toggleFlag:a}}var eN={},Gl,Hl;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Gl=process==null?void 0:eN)==null?void 0:Gl.NODE_ENV)==="test"&&typeof((Hl=Element==null?void 0:Element.prototype)==null?void 0:Hl.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
`)),[]});var tN=(t=>(t[t.None=0]="None",t[t.Closed=1]="Closed",t[t.Enter=2]="Enter",t[t.Leave=4]="Leave",t))(tN||{});function nN(t){let e={};for(let n in t)t[n]===!0&&(e[`data-${n}`]="");return e}function iN(t,e,n,i){let[o,s]=b.useState(n),{hasFlag:r,addFlag:a,removeFlag:c}=Z0(t&&o?3:0),d=b.useRef(!1),p=b.useRef(!1),f=Ps();return tt(()=>{var h;if(t){if(n&&s(!0),!e){n&&a(3);return}return(h=i==null?void 0:i.start)==null||h.call(i,n),oN(e,{inFlight:d,prepare(){p.current?p.current=!1:p.current=d.current,d.current=!0,!p.current&&(n?(a(3),c(4)):(a(4),c(2)))},run(){p.current?n?(c(3),a(4)):(c(4),a(3)):n?c(1):a(1)},done(){var g;p.current&&aN(e)||(d.current=!1,c(7),n||s(!1),(g=i==null?void 0:i.end)==null||g.call(i,n))}})}},[t,n,e,f]),t?[o,{closed:r(1),enter:r(2),leave:r(4),transition:r(2)||r(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function oN(t,{prepare:e,run:n,done:i,inFlight:o}){let s=on();return rN(t,{prepare:e,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(sN(t,i))})}),s.dispose}function sN(t,e){var n,i;let o=on();if(!t)return o.dispose;let s=!1;o.add(()=>{s=!0});let r=(i=(n=t.getAnimations)==null?void 0:n.call(t).filter(a=>a instanceof CSSTransition))!=null?i:[];return r.length===0?(e(),o.dispose):(Promise.allSettled(r.map(a=>a.finished)).then(()=>{s||e()}),o.dispose)}function rN(t,{inFlight:e,prepare:n}){if(e!=null&&e.current){n();return}let i=t.style.transition;t.style.transition="none",n(),t.offsetHeight,t.style.transition=i}function aN(t){var e,n;return((n=(e=t.getAnimations)==null?void 0:e.call(t))!=null?n:[]).some(i=>i instanceof CSSTransition&&i.playState!=="finished")}function va(t,e){let n=b.useRef([]),i=Ae(t);b.useEffect(()=>{let o=[...n.current];for(let[s,r]of e.entries())if(n.current[s]!==r){let a=i(e,o);return n.current=e,a}},[i,...e])}let Is=b.createContext(null);Is.displayName="OpenClosedContext";var Nt=(t=>(t[t.Open=1]="Open",t[t.Closed=2]="Closed",t[t.Closing=4]="Closing",t[t.Opening=8]="Opening",t))(Nt||{});function Rs(){return b.useContext(Is)}function lN({value:t,children:e}){return ue.createElement(Is.Provider,{value:t},e)}function cN({children:t}){return ue.createElement(Is.Provider,{value:null},t)}function uN(t){function e(){document.readyState!=="loading"&&(t(),document.removeEventListener("DOMContentLoaded",e))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}let fn=[];uN(()=>{function t(e){if(!Sn(e.target)||e.target===document.body||fn[0]===e.target)return;let n=e.target;n=n.closest(os),fn.unshift(n??e.target),fn=fn.filter(i=>i!=null&&i.isConnected),fn.splice(10)}window.addEventListener("click",t,{capture:!0}),window.addEventListener("mousedown",t,{capture:!0}),window.addEventListener("focus",t,{capture:!0}),document.body.addEventListener("click",t,{capture:!0}),document.body.addEventListener("mousedown",t,{capture:!0}),document.body.addEventListener("focus",t,{capture:!0})});function Fp(t){let e=Ae(t),n=b.useRef(!1);b.useEffect(()=>(n.current=!1,()=>{n.current=!0,ks(()=>{n.current&&e()})}),[e])}let qp=b.createContext(!1);function dN(){return b.useContext(qp)}function Kl(t){return ue.createElement(qp.Provider,{value:t.force},t.children)}function pN(t){let e=dN(),n=b.useContext($p),[i,o]=b.useState(()=>{var s;if(!e&&n!==null)return(s=n.current)!=null?s:null;if(qt.isServer)return null;let r=t==null?void 0:t.getElementById("headlessui-portal-root");if(r)return r;if(t===null)return null;let a=t.createElement("div");return a.setAttribute("id","headlessui-portal-root"),t.body.appendChild(a)});return b.useEffect(()=>{i!==null&&(t!=null&&t.body.contains(i)||t==null||t.body.appendChild(i))},[i,t]),b.useEffect(()=>{e||n!==null&&o(n.current)},[n,o,e]),i}let Up=b.Fragment,mN=nt(function(t,e){let{ownerDocument:n=null,...i}=t,o=b.useRef(null),s=Bt(f0(h=>{o.current=h}),e),r=ya(o.current),a=n??r,c=pN(a),d=b.useContext(Or),p=Ps(),f=ft();return Fp(()=>{var h;c&&c.childNodes.length<=0&&((h=c.parentElement)==null||h.removeChild(c))}),c?Qu.createPortal(ue.createElement("div",{"data-headlessui-portal":"",ref:h=>{p.dispose(),d&&h&&p.add(d.register(h))}},f({ourProps:{ref:s},theirProps:i,slot:{},defaultTag:Up,name:"Portal"})),c):null});function fN(t,e){let n=Bt(e),{enabled:i=!0,ownerDocument:o,...s}=t,r=ft();return i?ue.createElement(mN,{...s,ownerDocument:o,ref:n}):r({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:Up,name:"Portal"})}let hN=b.Fragment,$p=b.createContext(null);function gN(t,e){let{target:n,...i}=t,o={ref:Bt(e)},s=ft();return ue.createElement($p.Provider,{value:n},s({ourProps:o,theirProps:i,defaultTag:hN,name:"Popover.Group"}))}let Or=b.createContext(null);function yN(){let t=b.useContext(Or),e=b.useRef([]),n=Ae(s=>(e.current.push(s),t&&t.register(s),()=>i(s))),i=Ae(s=>{let r=e.current.indexOf(s);r!==-1&&e.current.splice(r,1),t&&t.unregister(s)}),o=b.useMemo(()=>({register:n,unregister:i,portals:e}),[n,i,e]);return[e,b.useMemo(()=>function({children:s}){return ue.createElement(Or.Provider,{value:o},s)},[o])]}let vN=nt(fN),Bp=nt(gN),bN=Object.assign(vN,{Group:Bp});function _N(t,e=typeof document<"u"?document.defaultView:null,n){let i=Do(t,"escape");jp(e,"keydown",o=>{i&&(o.defaultPrevented||o.key===Cp.Escape&&n(o))})}function NN(){var t;let[e]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[n,i]=b.useState((t=e==null?void 0:e.matches)!=null?t:!1);return tt(()=>{if(!e)return;function o(s){i(s.matches)}return e.addEventListener("change",o),()=>e.removeEventListener("change",o)},[e]),n}function xN({defaultContainers:t=[],portals:e,mainTreeNode:n}={}){let i=Ae(()=>{var o,s;let r=wo(n),a=[];for(let c of t)c!==null&&(Cn(c)?a.push(c):"current"in c&&Cn(c.current)&&a.push(c.current));if(e!=null&&e.current)for(let c of e.current)a.push(c);for(let c of(o=r==null?void 0:r.querySelectorAll("html > *, body > *"))!=null?o:[])c!==document.body&&c!==document.head&&Cn(c)&&c.id!=="headlessui-portal-root"&&(n&&(c.contains(n)||c.contains((s=n==null?void 0:n.getRootNode())==null?void 0:s.host))||a.some(d=>c.contains(d))||a.push(c));return a});return{resolveContainers:i,contains:Ae(o=>i().some(s=>s.contains(o)))}}let Gp=b.createContext(null);function Jl({children:t,node:e}){let[n,i]=b.useState(null),o=Hp(e??n);return ue.createElement(Gp.Provider,{value:o},t,o===null&&ue.createElement(Mr,{features:is.Hidden,ref:s=>{var r,a;if(s){for(let c of(a=(r=wo(s))==null?void 0:r.querySelectorAll("html > *, body > *"))!=null?a:[])if(c!==document.body&&c!==document.head&&Cn(c)&&c!=null&&c.contains(s)){i(c);break}}}}))}function Hp(t=null){var e;return(e=b.useContext(Gp))!=null?e:t}function SN(){let t=typeof document>"u";return"useSyncExternalStore"in Ma?(e=>e.useSyncExternalStore)(Ma)(()=>()=>{},()=>!1,()=>!t):!1}function Ms(){let t=SN(),[e,n]=b.useState(qt.isHandoffComplete);return e&&qt.isHandoffComplete===!1&&n(!1),b.useEffect(()=>{e!==!0&&n(!0)},[e]),b.useEffect(()=>qt.handoff(),[]),t?!1:e}function ba(){let t=b.useRef(!1);return tt(()=>(t.current=!0,()=>{t.current=!1}),[]),t}var Xi=(t=>(t[t.Forwards=0]="Forwards",t[t.Backwards=1]="Backwards",t))(Xi||{});function EN(){let t=b.useRef(0);return Op(!0,"keydown",e=>{e.key==="Tab"&&(t.current=e.shiftKey?1:0)},!0),t}function Kp(t){if(!t)return new Set;if(typeof t=="function")return new Set(t());let e=new Set;for(let n of t.current)Cn(n.current)&&e.add(n.current);return e}let wN="div";var On=(t=>(t[t.None=0]="None",t[t.InitialFocus=1]="InitialFocus",t[t.TabLock=2]="TabLock",t[t.FocusLock=4]="FocusLock",t[t.RestoreFocus=8]="RestoreFocus",t[t.AutoFocus=16]="AutoFocus",t))(On||{});function CN(t,e){let n=b.useRef(null),i=Bt(n,e),{initialFocus:o,initialFocusFallback:s,containers:r,features:a=15,...c}=t;Ms()||(a=0);let d=ya(n.current);kN(a,{ownerDocument:d});let p=PN(a,{ownerDocument:d,container:n,initialFocus:o,initialFocusFallback:s});IN(a,{ownerDocument:d,container:n,containers:r,previousActiveElement:p});let f=EN(),h=Ae(E=>{if(!ti(n.current))return;let w=n.current;(C=>C())(()=>{tn(f.current,{[Xi.Forwards]:()=>{co(w,Qt.First,{skipElements:[E.relatedTarget,s]})},[Xi.Backwards]:()=>{co(w,Qt.Last,{skipElements:[E.relatedTarget,s]})}})})}),g=Do(!!(a&2),"focus-trap#tab-lock"),y=Ps(),_=b.useRef(!1),v={ref:i,onKeyDown(E){E.key=="Tab"&&(_.current=!0,y.requestAnimationFrame(()=>{_.current=!1}))},onBlur(E){if(!(a&4))return;let w=Kp(r);ti(n.current)&&w.add(n.current);let C=E.relatedTarget;Sn(C)&&C.dataset.headlessuiFocusGuard!=="true"&&(Jp(w,C)||(_.current?co(n.current,tn(f.current,{[Xi.Forwards]:()=>Qt.Next,[Xi.Backwards]:()=>Qt.Previous})|Qt.WrapAround,{relativeTo:E.target}):Sn(E.target)&&Zt(E.target)))}},x=ft();return ue.createElement(ue.Fragment,null,g&&ue.createElement(Mr,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:h,features:is.Focusable}),x({ourProps:v,theirProps:c,defaultTag:wN,name:"FocusTrap"}),g&&ue.createElement(Mr,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:h,features:is.Focusable}))}let DN=nt(CN),TN=Object.assign(DN,{features:On});function AN(t=!0){let e=b.useRef(fn.slice());return va(([n],[i])=>{i===!0&&n===!1&&ks(()=>{e.current.splice(0)}),i===!1&&n===!0&&(e.current=fn.slice())},[t,fn,e]),Ae(()=>{var n;return(n=e.current.find(i=>i!=null&&i.isConnected))!=null?n:null})}function kN(t,{ownerDocument:e}){let n=!!(t&8),i=AN(n);va(()=>{n||e0(e==null?void 0:e.body)&&Zt(i())},[n]),Fp(()=>{n&&Zt(i())})}function PN(t,{ownerDocument:e,container:n,initialFocus:i,initialFocusFallback:o}){let s=b.useRef(null),r=Do(!!(t&1),"focus-trap#initial-focus"),a=ba();return va(()=>{if(t===0)return;if(!r){o!=null&&o.current&&Zt(o.current);return}let c=n.current;c&&ks(()=>{if(!a.current)return;let d=e==null?void 0:e.activeElement;if(i!=null&&i.current){if((i==null?void 0:i.current)===d){s.current=d;return}}else if(c.contains(d)){s.current=d;return}if(i!=null&&i.current)Zt(i.current);else{if(t&16){if(co(c,Qt.First|Qt.AutoFocus)!==Lr.Error)return}else if(co(c,Qt.First)!==Lr.Error)return;if(o!=null&&o.current&&(Zt(o.current),(e==null?void 0:e.activeElement)===o.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}s.current=e==null?void 0:e.activeElement})},[o,r,t]),s}function IN(t,{ownerDocument:e,container:n,containers:i,previousActiveElement:o}){let s=ba(),r=!!(t&4);jp(e==null?void 0:e.defaultView,"focus",a=>{if(!r||!s.current)return;let c=Kp(i);ti(n.current)&&c.add(n.current);let d=o.current;if(!d)return;let p=a.target;ti(p)?Jp(c,p)?(o.current=p,Zt(p)):(a.preventDefault(),a.stopPropagation(),Zt(d)):Zt(o.current)},!0)}function Jp(t,e){for(let n of t)if(n.contains(e))return!0;return!1}function Wp(t){var e;return!!(t.enter||t.enterFrom||t.enterTo||t.leave||t.leaveFrom||t.leaveTo)||!ao((e=t.as)!=null?e:Yp)||ue.Children.count(t.children)===1}let Vs=b.createContext(null);Vs.displayName="TransitionContext";var RN=(t=>(t.Visible="visible",t.Hidden="hidden",t))(RN||{});function MN(){let t=b.useContext(Vs);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}function VN(){let t=b.useContext(Ls);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}let Ls=b.createContext(null);Ls.displayName="NestingContext";function Os(t){return"children"in t?Os(t.children):t.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function zp(t,e){let n=ri(t),i=b.useRef([]),o=ba(),s=Ps(),r=Ae((g,y=xn.Hidden)=>{let _=i.current.findIndex(({el:v})=>v===g);_!==-1&&(tn(y,{[xn.Unmount](){i.current.splice(_,1)},[xn.Hidden](){i.current[_].state="hidden"}}),s.microTask(()=>{var v;!Os(i)&&o.current&&((v=n.current)==null||v.call(n))}))}),a=Ae(g=>{let y=i.current.find(({el:_})=>_===g);return y?y.state!=="visible"&&(y.state="visible"):i.current.push({el:g,state:"visible"}),()=>r(g,xn.Unmount)}),c=b.useRef([]),d=b.useRef(Promise.resolve()),p=b.useRef({enter:[],leave:[]}),f=Ae((g,y,_)=>{c.current.splice(0),e&&(e.chains.current[y]=e.chains.current[y].filter(([v])=>v!==g)),e==null||e.chains.current[y].push([g,new Promise(v=>{c.current.push(v)})]),e==null||e.chains.current[y].push([g,new Promise(v=>{Promise.all(p.current[y].map(([x,E])=>E)).then(()=>v())})]),y==="enter"?d.current=d.current.then(()=>e==null?void 0:e.wait.current).then(()=>_(y)):_(y)}),h=Ae((g,y,_)=>{Promise.all(p.current[y].splice(0).map(([v,x])=>x)).then(()=>{var v;(v=c.current.shift())==null||v()}).then(()=>_(y))});return b.useMemo(()=>({children:i,register:a,unregister:r,onStart:f,onStop:h,wait:d,chains:p}),[a,r,i,f,h,p,d])}let Yp=b.Fragment,Qp=ns.RenderStrategy;function LN(t,e){var n,i;let{transition:o=!0,beforeEnter:s,afterEnter:r,beforeLeave:a,afterLeave:c,enter:d,enterFrom:p,enterTo:f,entered:h,leave:g,leaveFrom:y,leaveTo:_,...v}=t,[x,E]=b.useState(null),w=b.useRef(null),C=Wp(t),P=Bt(...C?[w,e,E]:e===null?[]:[e]),k=(n=v.unmount)==null||n?xn.Unmount:xn.Hidden,{show:I,appear:j,initial:A}=MN(),[R,q]=b.useState(I?"visible":"hidden"),G=VN(),{register:L,unregister:F}=G;tt(()=>L(w),[L,w]),tt(()=>{if(k===xn.Hidden&&w.current){if(I&&R!=="visible"){q("visible");return}return tn(R,{hidden:()=>F(w),visible:()=>L(w)})}},[R,w,L,F,I,k]);let T=Ms();tt(()=>{if(C&&T&&R==="visible"&&w.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[w,R,T,C]);let $=A&&!j,Q=j&&I&&A,X=b.useRef(!1),te=zp(()=>{X.current||(q("hidden"),F(w))},G),J=Ae(fe=>{X.current=!0;let De=fe?"enter":"leave";te.onStart(w,De,K=>{K==="enter"?s==null||s():K==="leave"&&(a==null||a())})}),O=Ae(fe=>{let De=fe?"enter":"leave";X.current=!1,te.onStop(w,De,K=>{K==="enter"?r==null||r():K==="leave"&&(c==null||c())}),De==="leave"&&!Os(te)&&(q("hidden"),F(w))});b.useEffect(()=>{C&&o||(J(I),O(I))},[I,C,o]);let U=!(!o||!C||!T||$),[,H]=iN(U,x,I,{start:J,end:O}),re=Vn({ref:P,className:((i=Rr(v.className,Q&&d,Q&&p,H.enter&&d,H.enter&&H.closed&&p,H.enter&&!H.closed&&f,H.leave&&g,H.leave&&!H.closed&&y,H.leave&&H.closed&&_,!H.transition&&I&&h))==null?void 0:i.trim())||void 0,...nN(H)}),de=0;R==="visible"&&(de|=Nt.Open),R==="hidden"&&(de|=Nt.Closed),I&&R==="hidden"&&(de|=Nt.Opening),!I&&R==="visible"&&(de|=Nt.Closing);let le=ft();return ue.createElement(Ls.Provider,{value:te},ue.createElement(lN,{value:de},le({ourProps:re,theirProps:v,defaultTag:Yp,features:Qp,visible:R==="visible",name:"Transition.Child"})))}function ON(t,e){let{show:n,appear:i=!1,unmount:o=!0,...s}=t,r=b.useRef(null),a=Wp(t),c=Bt(...a?[r,e]:e===null?[]:[e]);Ms();let d=Rs();if(n===void 0&&d!==null&&(n=(d&Nt.Open)===Nt.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[p,f]=b.useState(n?"visible":"hidden"),h=zp(()=>{n||f("hidden")}),[g,y]=b.useState(!0),_=b.useRef([n]);tt(()=>{g!==!1&&_.current[_.current.length-1]!==n&&(_.current.push(n),y(!1))},[_,n]);let v=b.useMemo(()=>({show:n,appear:i,initial:g}),[n,i,g]);tt(()=>{n?f("visible"):!Os(h)&&r.current!==null&&f("hidden")},[n,h]);let x={unmount:o},E=Ae(()=>{var P;g&&y(!1),(P=t.beforeEnter)==null||P.call(t)}),w=Ae(()=>{var P;g&&y(!1),(P=t.beforeLeave)==null||P.call(t)}),C=ft();return ue.createElement(Ls.Provider,{value:h},ue.createElement(Vs.Provider,{value:v},C({ourProps:{...x,as:b.Fragment,children:ue.createElement(Xp,{ref:c,...x,...s,beforeEnter:E,beforeLeave:w})},theirProps:{},defaultTag:b.Fragment,features:Qp,visible:p==="visible",name:"Transition"})))}function jN(t,e){let n=b.useContext(Vs)!==null,i=Rs()!==null;return ue.createElement(ue.Fragment,null,!n&&i?ue.createElement(jr,{ref:e,...t}):ue.createElement(Xp,{ref:e,...t}))}let jr=nt(ON),Xp=nt(LN),_a=nt(jN),Ko=Object.assign(jr,{Child:_a,Root:jr});var FN=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(FN||{}),qN=(t=>(t[t.SetTitleId=0]="SetTitleId",t))(qN||{});let UN={0(t,e){return t.titleId===e.id?t:{...t,titleId:e.id}}},Na=b.createContext(null);Na.displayName="DialogContext";function js(t){let e=b.useContext(Na);if(e===null){let n=new Error(`<${t} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,js),n}return e}function $N(t,e){return tn(e.type,UN,t,e)}let Wl=nt(function(t,e){let n=b.useId(),{id:i=`headlessui-dialog-${n}`,open:o,onClose:s,initialFocus:r,role:a="dialog",autoFocus:c=!0,__demoMode:d=!1,unmount:p=!1,...f}=t,h=b.useRef(!1);a=function(){return a==="dialog"||a==="alertdialog"?a:(h.current||(h.current=!0,console.warn(`Invalid role [${a}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let g=Rs();o===void 0&&g!==null&&(o=(g&Nt.Open)===Nt.Open);let y=b.useRef(null),_=Bt(y,e),v=ya(y.current),x=o?0:1,[E,w]=b.useReducer($N,{titleId:null,descriptionId:null,panelRef:b.createRef()}),C=Ae(()=>s(!1)),P=Ae(H=>w({type:0,id:H})),k=Ms()?x===0:!1,[I,j]=yN(),A={get current(){var H;return(H=E.panelRef.current)!=null?H:y.current}},R=Hp(),{resolveContainers:q}=xN({mainTreeNode:R,portals:I,defaultContainers:[A]}),G=g!==null?(g&Nt.Closing)===Nt.Closing:!1;R0(d||G?!1:k,{allowed:Ae(()=>{var H,re;return[(re=(H=y.current)==null?void 0:H.closest("[data-headlessui-portal]"))!=null?re:null]}),disallowed:Ae(()=>{var H;return[(H=R==null?void 0:R.closest("body > *:not(#headlessui-portal-root)"))!=null?H:null]})});let L=Pp.get(null);tt(()=>{if(k)return L.actions.push(i),()=>L.actions.pop(i)},[L,i,k]);let F=Mp(L,b.useCallback(H=>L.selectors.isTop(H,i),[L,i]));H0(F,q,H=>{H.preventDefault(),C()}),_N(F,v==null?void 0:v.defaultView,H=>{H.preventDefault(),H.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),C()}),X0(d||G?!1:k,v,q),M0(k,y,C);let[T,$]=h0(),Q=b.useMemo(()=>[{dialogState:x,close:C,setTitleId:P,unmount:p},E],[x,C,P,p,E]),X=Co({open:x===0}),te={ref:_,id:i,role:a,tabIndex:-1,"aria-modal":d?void 0:x===0?!0:void 0,"aria-labelledby":E.titleId,"aria-describedby":T,unmount:p},J=!NN(),O=On.None;k&&!d&&(O|=On.RestoreFocus,O|=On.TabLock,c&&(O|=On.AutoFocus),J&&(O|=On.InitialFocus));let U=ft();return ue.createElement(cN,null,ue.createElement(Kl,{force:!0},ue.createElement(bN,null,ue.createElement(Na.Provider,{value:Q},ue.createElement(Bp,{target:y},ue.createElement(Kl,{force:!1},ue.createElement($,{slot:X},ue.createElement(j,null,ue.createElement(TN,{initialFocus:r,initialFocusFallback:y,containers:q,features:O},ue.createElement(N0,{value:C},U({ourProps:te,theirProps:f,slot:X,defaultTag:BN,features:GN,visible:x===0,name:"Dialog"})))))))))))}),BN="div",GN=ns.RenderStrategy|ns.Static;function HN(t,e){let{transition:n=!1,open:i,...o}=t,s=Rs(),r=t.hasOwnProperty("open")||s!==null,a=t.hasOwnProperty("onClose");if(!r&&!a)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!r)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!a)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!s&&typeof t.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${t.open}`);if(typeof t.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${t.onClose}`);return(i!==void 0||n)&&!o.static?ue.createElement(Jl,null,ue.createElement(Ko,{show:i,transition:n,unmount:o.unmount},ue.createElement(Wl,{ref:e,...o}))):ue.createElement(Jl,null,ue.createElement(Wl,{ref:e,open:i,...o}))}let KN="div";function JN(t,e){let n=b.useId(),{id:i=`headlessui-dialog-panel-${n}`,transition:o=!1,...s}=t,[{dialogState:r,unmount:a},c]=js("Dialog.Panel"),d=Bt(e,c.panelRef),p=Co({open:r===0}),f=Ae(v=>{v.stopPropagation()}),h={ref:d,id:i,onClick:f},g=o?_a:b.Fragment,y=o?{unmount:a}:{},_=ft();return ue.createElement(g,{...y},_({ourProps:h,theirProps:s,slot:p,defaultTag:KN,name:"Dialog.Panel"}))}let WN="div";function zN(t,e){let{transition:n=!1,...i}=t,[{dialogState:o,unmount:s}]=js("Dialog.Backdrop"),r=Co({open:o===0}),a={ref:e,"aria-hidden":!0},c=n?_a:b.Fragment,d=n?{unmount:s}:{},p=ft();return ue.createElement(c,{...d},p({ourProps:a,theirProps:i,slot:r,defaultTag:WN,name:"Dialog.Backdrop"}))}let YN="h2";function QN(t,e){let n=b.useId(),{id:i=`headlessui-dialog-title-${n}`,...o}=t,[{dialogState:s,setTitleId:r}]=js("Dialog.Title"),a=Bt(e);b.useEffect(()=>(r(i),()=>r(null)),[i,r]);let c=Co({open:s===0}),d={ref:a,id:i};return ft()({ourProps:d,theirProps:o,slot:c,defaultTag:YN,name:"Dialog.Title"})}let XN=nt(HN),ZN=nt(JN);nt(zN);let ex=nt(QN),or=Object.assign(XN,{Panel:ZN,Title:ex,Description:b0});const Zp=({isOpen:t,onClose:e,title:n,subtitle:i,children:o,maxWidth:s="max-w-2xl",maxHeight:r="max-h-[85vh]",icon:a,variant:c="primary",hideHeader:d=!1,contentPadding:p="p-6"})=>{const{theme:f}=Et(),h=f.mode==="dark",g=()=>{switch(c){case"success":return"bg-emerald-100 text-emerald-600 dark:bg-emerald-900/30 dark:text-emerald-400";case"danger":return"bg-rose-100 text-rose-600 dark:bg-rose-900/30 dark:text-rose-400";case"warning":return"bg-amber-100 text-amber-600 dark:bg-amber-900/30 dark:text-amber-400";case"info":return"bg-blue-100 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400";case"teal":return"bg-teal-100 text-teal-600 dark:bg-teal-900/30 dark:text-teal-400";case"primary":return"bg-indigo-100 text-indigo-600 dark:bg-indigo-900/30 dark:text-indigo-400";default:return"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400"}};return m.jsxDEV(Ko,{appear:!0,show:t,as:b.Fragment,children:m.jsxDEV(or,{as:"div",className:"relative z-[9999]",onClose:e,children:[m.jsxDEV(Ko.Child,{as:b.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:m.jsxDEV("div",{className:"fixed inset-0 bg-slate-900/60 backdrop-blur-md transition-opacity"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:61,columnNumber:21},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:52,columnNumber:17},void 0),m.jsxDEV("div",{className:"fixed inset-0 z-[9999] overflow-y-auto",children:m.jsxDEV("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:m.jsxDEV(Ko.Child,{as:b.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-8 scale-95",enterTo:"opacity-100 translate-y-0 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 scale-100",leaveTo:"opacity-0 translate-y-8 scale-95",children:m.jsxDEV(or.Panel,{className:`
                                  w-full ${s}
                                  max-h-[90dvh]
                                  transform overflow-hidden text-left align-middle shadow-2xl transition-all
                                  border border-white/10
                                  rounded-[2rem] md:rounded-[2.5rem]
                                  ${h?"bg-slate-900":"bg-white"}
                                  flex flex-col
                                `,children:[!d&&m.jsxDEV("div",{className:`relative px-5 py-4 border-b ${h?"border-gray-800":"border-gray-100"} flex justify-between items-center flex-shrink-0`,children:[m.jsxDEV("div",{className:"flex items-center space-x-3",children:[a&&m.jsxDEV("div",{className:`p-2 rounded-lg ${g()}`,children:m.jsxDEV(a,{size:20},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:94,columnNumber:53},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:93,columnNumber:49},void 0),m.jsxDEV("div",{children:[m.jsxDEV(or.Title,{as:"h3",className:`text-lg font-bold leading-6 ${h?"text-white":"text-gray-900"}`,children:n},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:98,columnNumber:49},void 0),i&&m.jsxDEV("p",{className:`mt-1 text-xs font-medium ${h?"text-gray-400":"text-gray-500"}`,children:i},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:105,columnNumber:53},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:97,columnNumber:45},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:91,columnNumber:41},void 0),m.jsxDEV("button",{type:"button",className:`rounded-lg p-2 transition-colors ${h?"text-gray-500 hover:bg-gray-800 hover:text-white":"text-gray-400 hover:bg-gray-100 hover:text-gray-600"}`,onClick:e,children:m.jsxDEV(en,{className:"h-5 w-5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:119,columnNumber:45},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:111,columnNumber:41},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:90,columnNumber:37},void 0),m.jsxDEV("div",{className:`${p} overflow-y-auto custom-scrollbar flex-1 relative`,children:o},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:125,columnNumber:33},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:76,columnNumber:29},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:67,columnNumber:25},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:66,columnNumber:21},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:64,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:51,columnNumber:13},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernModal.tsx",lineNumber:50,columnNumber:9},void 0)},Xt=({label:t,icon:e,error:n,className:i="",containerClassName:o="",id:s,...r})=>{const{theme:a}=Et(),c=a.mode==="dark";return m.jsxDEV("div",{className:`space-y-1.5 ${o}`,children:[t&&m.jsxDEV("label",{htmlFor:s,className:`block text-xs font-bold uppercase tracking-wider ml-1 ${c?"text-gray-400":"text-gray-500"}`,children:t},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernInput.tsx",lineNumber:27,columnNumber:17},void 0),m.jsxDEV("div",{className:"relative group",children:[e&&m.jsxDEV("div",{className:"absolute left-4 top-1/2 -translate-y-1/2 pointer-events-none z-10",children:m.jsxDEV(e,{size:18,className:`transition-colors ${c?"text-gray-500 group-focus-within:text-indigo-400":"text-gray-400 group-focus-within:text-indigo-600"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernInput.tsx",lineNumber:38,columnNumber:25},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernInput.tsx",lineNumber:37,columnNumber:21},void 0),m.jsxDEV("input",{id:s,step:r.type==="number"?r.step||"any":r.step,className:`
            w-full bg-white dark:bg-gray-900 
            border transition-all duration-200 ease-in-out
            rounded-xl py-3 text-sm font-medium outline-none
            shadow-sm group-hover:shadow
            ${e?"pl-11 pr-4":"px-4"}
            ${n?"border-rose-500 focus:border-rose-500 focus:ring-4 focus:ring-rose-500/10":c?"border-gray-700 hover:border-gray-600 focus:border-indigo-500/50 focus:ring-4 focus:ring-indigo-500/10 text-white placeholder-gray-600":"border-gray-200 hover:border-gray-300 focus:border-indigo-500 focus:ring-4 focus:ring-indigo-500/10 text-gray-900 placeholder-gray-400"}
            ${i}
          `,...r},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernInput.tsx",lineNumber:48,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernInput.tsx",lineNumber:35,columnNumber:13},void 0),n&&m.jsxDEV("p",{className:"text-xs font-semibold text-rose-500 ml-1 animate-pulse",children:n},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernInput.tsx",lineNumber:69,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernInput.tsx",lineNumber:25,columnNumber:9},void 0)},Fr=({label:t,icon:e,error:n,className:i="",containerClassName:o="",id:s,children:r,options:a,...c})=>{const{theme:d}=Et(),p=d.mode==="dark";return m.jsxDEV("div",{className:`space-y-1.5 ${o}`,children:[t&&m.jsxDEV("label",{htmlFor:s,className:`block text-xs font-bold uppercase tracking-wider ml-1 ${p?"text-gray-400":"text-gray-500"}`,children:t},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernSelect.tsx",lineNumber:30,columnNumber:17},void 0),m.jsxDEV("div",{className:"relative group",children:[e&&m.jsxDEV("div",{className:"absolute left-4 top-1/2 -translate-y-1/2 pointer-events-none z-10",children:m.jsxDEV(e,{size:18,className:`transition-colors ${p?"text-gray-500 group-focus-within:text-indigo-400":"text-gray-400 group-focus-within:text-indigo-600"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernSelect.tsx",lineNumber:41,columnNumber:25},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernSelect.tsx",lineNumber:40,columnNumber:21},void 0),m.jsxDEV("div",{className:"absolute right-4 top-1/2 -translate-y-1/2 pointer-events-none z-10",children:m.jsxDEV(cf,{size:16,className:`transition-colors ${p?"text-gray-500":"text-gray-400"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernSelect.tsx",lineNumber:52,columnNumber:21},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernSelect.tsx",lineNumber:51,columnNumber:17},void 0),m.jsxDEV("select",{id:s,className:`
            w-full bg-white dark:bg-gray-900 
            border transition-all duration-200 ease-in-out
            rounded-xl py-3 text-sm font-medium outline-none appearance-none cursor-pointer
            shadow-sm group-hover:shadow
            ${e?"pl-11 pr-10":"pl-4 pr-10"}
            ${n?"border-rose-500 focus:border-rose-500 focus:ring-4 focus:ring-rose-500/10":p?"border-gray-700 hover:border-gray-600 focus:border-indigo-500/50 focus:ring-4 focus:ring-indigo-500/10 text-white placeholder-gray-600":"border-gray-200 hover:border-gray-300 focus:border-indigo-500 focus:ring-4 focus:ring-indigo-500/10 text-gray-900 placeholder-gray-400"}
            ${i}
          `,...c,children:[r,a&&a.map(f=>m.jsxDEV("option",{value:f.value,children:f.label},f.value,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernSelect.tsx",lineNumber:78,columnNumber:25},void 0))]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernSelect.tsx",lineNumber:58,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernSelect.tsx",lineNumber:38,columnNumber:13},void 0),n&&m.jsxDEV("p",{className:"text-xs font-semibold text-rose-500 ml-1 animate-pulse",children:n},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernSelect.tsx",lineNumber:85,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernSelect.tsx",lineNumber:28,columnNumber:9},void 0)},_t=({children:t,variant:e="primary",size:n="md",icon:i,isLoading:o=!1,block:s=!1,className:r="",disabled:a,...c})=>{const{theme:d}=Et(),p=d.mode==="dark",f="inline-flex items-center justify-center font-bold rounded-xl transition-all duration-300 active:scale-95 disabled:opacity-50 disabled:pointer-events-none disabled:active:scale-100",h={sm:"px-3 py-1.5 text-xs",md:"px-5 py-2.5 text-sm",lg:"px-6 py-3.5 text-base"},g={primary:"bg-gradient-to-r from-indigo-600 to-purple-600 hover:from-indigo-500 hover:to-purple-500 text-white shadow-lg shadow-indigo-500/25 hover:shadow-indigo-500/40",secondary:p?"bg-slate-800 hover:bg-slate-700 text-white border border-slate-700":"bg-white hover:bg-slate-50 text-slate-900 border border-slate-200 shadow-sm hover:shadow-md",outline:p?"border-2 border-slate-700 hover:border-indigo-500 text-slate-400 hover:text-indigo-400 bg-transparent":"border-2 border-slate-200 hover:border-indigo-500 text-slate-600 hover:text-indigo-600 bg-transparent",ghost:p?"text-slate-400 hover:text-white hover:bg-slate-800":"text-slate-500 hover:text-indigo-600 hover:bg-indigo-50",danger:"bg-gradient-to-r from-rose-500 to-pink-600 hover:from-rose-400 hover:to-pink-500 text-white shadow-lg shadow-rose-500/25",success:"bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-400 hover:to-teal-500 text-white shadow-lg shadow-emerald-500/25"};return m.jsxDEV("button",{className:`
        ${f}
        ${h[n]}
        ${g[e]}
        ${s?"w-full":""}
        ${r}
      `,disabled:a||o,...c,children:[o?m.jsxDEV(ta,{className:"mr-2 h-4 w-4 animate-spin"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernButton.tsx",lineNumber:63,columnNumber:17},void 0):i?m.jsxDEV(i,{className:`mr-2 ${n==="lg"?"h-5 w-5":"h-4 w-4"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernButton.tsx",lineNumber:65,columnNumber:17},void 0):null,t]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernButton.tsx",lineNumber:51,columnNumber:9},void 0)},tx=({label:t,icon:e,error:n,className:i="",containerClassName:o="",id:s,...r})=>{const{theme:a}=Et(),c=a.mode==="dark";return m.jsxDEV("div",{className:`space-y-1.5 ${o}`,children:[t&&m.jsxDEV("label",{htmlFor:s,className:`block text-xs font-bold uppercase tracking-wider ml-1 ${c?"text-gray-400":"text-gray-500"}`,children:t},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernTextArea.tsx",lineNumber:27,columnNumber:17},void 0),m.jsxDEV("div",{className:"relative group",children:[e&&m.jsxDEV("div",{className:"absolute left-4 top-4 pointer-events-none z-10",children:m.jsxDEV(e,{size:18,className:`transition-colors ${c?"text-gray-500 group-focus-within:text-indigo-400":"text-gray-400 group-focus-within:text-indigo-600"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernTextArea.tsx",lineNumber:38,columnNumber:25},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernTextArea.tsx",lineNumber:37,columnNumber:21},void 0),m.jsxDEV("textarea",{id:s,className:`
            w-full bg-white dark:bg-gray-900 
            border transition-all duration-200 ease-in-out
            rounded-xl py-3 text-sm font-medium outline-none
            shadow-sm group-hover:shadow
            ${e?"pl-11 pr-4":"px-4"}
            ${n?"border-rose-500 focus:border-rose-500 focus:ring-4 focus:ring-rose-500/10":c?"border-gray-700 hover:border-gray-600 focus:border-indigo-500/50 focus:ring-4 focus:ring-indigo-500/10 text-white placeholder-gray-600":"border-gray-200 hover:border-gray-300 focus:border-indigo-500 focus:ring-4 focus:ring-indigo-500/10 text-gray-900 placeholder-gray-400"}
            ${i}
          `,...r},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernTextArea.tsx",lineNumber:48,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernTextArea.tsx",lineNumber:35,columnNumber:13},void 0),n&&m.jsxDEV("p",{className:"text-xs font-semibold text-rose-500 ml-1 animate-pulse",children:n},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernTextArea.tsx",lineNumber:68,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/modern/ModernTextArea.tsx",lineNumber:25,columnNumber:9},void 0)},em=({isOpen:t,onClose:e})=>{const{t:n}=ni(),{addExpense:i}=si(),{expenseCategories:o}=fa(),{suppliers:s}=lp(),{showToast:r}=$t(),a=b.useRef(null),[c,d]=b.useState("upload"),[p,f]=b.useState(null),[h,g]=b.useState(!1),[y,_]=b.useState(!1),[v,x]=b.useState(null),[E,w]=b.useState({amount:0,date:new Date().toISOString().split("T")[0],category:o[0]||"",description:"",merchant:"",invoiceNumber:"",supplierId:""}),C=A=>{var q;const R=(q=A.target.files)==null?void 0:q[0];if(R){const G=new FileReader;G.onloadend=()=>{const L=G.result;f(L),k(L,R.type)},G.readAsDataURL(R)}},P=A=>{const R=URL.createObjectURL(A);f(R),_(!1);const q=new FileReader;q.onloadend=()=>{const G=q.result;k(G,A.type)},q.readAsDataURL(A)},k=async(A,R="image/jpeg")=>{g(!0),x(null);try{const q=A.includes(",")?A.split(",")[1]:A,G="";if(!G)throw new Error("API Key not configured");const X=(await(await new Y_(G).getGenerativeModel({model:"gemini-1.5-flash"}).generateContent([`Analyze this receipt/invoice image. Extract the following details strictly in JSON format: 
            - amount (number)
            - date (YYYY-MM-DD)
            - merchant (string, the supplier name)
            - invoiceNumber (string)
            - description (short summary of items)
            If a field is not found, use null.`,{inlineData:{data:q,mimeType:R}}])).response).text(),te=X.replace(/```json/g,"").replace(/```/g,"").trim();let J;try{J=JSON.parse(te)}catch{throw console.error("Failed to parse AI response",X),new Error("Failed to parse invoice data")}const O=s.find(U=>(U.name||"").toLowerCase().includes((J.merchant||"").toLowerCase())||(J.merchant||"").toLowerCase().includes((U.name||"").toLowerCase()));w({amount:J.amount||0,date:J.date||new Date().toISOString().split("T")[0],merchant:J.merchant||"",description:J.description||`Expense from ${J.merchant||"Unknown Merchant"}`,category:o[0]||"",invoiceNumber:J.invoiceNumber||"",supplierId:(O==null?void 0:O.id)||""}),d("confirm")}catch(q){console.error("AI Scan Error:",q),x(n("accounting_modals.scan_invoice.error_extract",{defaultValue:"Failed to extract data. Please try again or enter manually."})),r(n("accounting_modals.scan_invoice.error_extract",{defaultValue:"Failed to extract data. Please try again or enter manually."}),"error"),d("confirm")}finally{g(!1)}},I=()=>{var R;if(!E.amount||!E.description){r(n("accounting_modals.scan_invoice.error_required",{defaultValue:"Amount and description are required."}),"error");return}const A={date:new Date(E.date),category:E.category,description:E.description,amount:E.amount,supplierId:E.supplierId||void 0,supplierName:E.supplierId?(R=s.find(q=>q.id===E.supplierId))==null?void 0:R.name:E.merchant,invoiceNumber:E.invoiceNumber,paymentMethod:"cash"};i(A),r(n("accounting_modals.scan_invoice.success",{defaultValue:"Expense added successfully"}),"success"),j()},j=()=>{d("upload"),f(null),x(null),e()};return t?y?m.jsxDEV(gp,{onCapture:P,onClose:()=>_(!1),guideType:"invoice"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:180,columnNumber:16},void 0):m.jsxDEV(Zp,{isOpen:t,onClose:j,title:n("accounting_modals.scan_invoice.title",{defaultValue:"Scan Invoice"}),subtitle:n("accounting_modals.scan_invoice.subtitle",{defaultValue:"Extract Data"}),icon:Yn,variant:"primary",maxWidth:"max-w-4xl",children:m.jsxDEV("div",{className:"space-y-8",children:[c==="upload"&&m.jsxDEV("div",{className:"flex flex-col items-center justify-center py-6 sm:py-10 text-center",children:[m.jsxDEV("div",{className:"mb-12 animate-fade-in",children:[m.jsxDEV("div",{className:"w-32 h-32 bg-gray-50 dark:bg-gray-900 border border-gray-100 dark:border-gray-800 rounded-[3rem] flex items-center justify-center mx-auto mb-6 shadow-xl shadow-gray-200/20 dark:shadow-none",children:m.jsxDEV(Ft,{size:48,className:"text-indigo-500 opacity-40"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:198,columnNumber:33},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:197,columnNumber:29},void 0),m.jsxDEV("h3",{className:"text-2xl font-black text-gray-900 dark:text-white uppercase tracking-tight mb-2",children:n("accounting_modals.scan_invoice.upload_title",{defaultValue:"Upload Invoice"})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:200,columnNumber:29},void 0),m.jsxDEV("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 max-w-xs mx-auto",children:n("accounting_modals.scan_invoice.upload_desc",{defaultValue:"Upload an image of your invoice, bill, or receipt for processing."})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:201,columnNumber:29},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:196,columnNumber:25},void 0),m.jsxDEV("div",{className:"w-full max-w-sm grid grid-cols-1 gap-4 px-2",children:[m.jsxDEV(_t,{variant:"secondary",onClick:()=>{var A;return(A=a.current)==null?void 0:A.click()},icon:ed,className:"w-full py-5",children:n("accounting_modals.scan_invoice.library_upload",{defaultValue:"Library Upload"})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:205,columnNumber:29},void 0),m.jsxDEV(_t,{variant:"primary",onClick:()=>_(!0),icon:Yn,className:"w-full py-5",children:n("accounting_modals.scan_invoice.capture_now",{defaultValue:"Capture Now"})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:213,columnNumber:29},void 0),m.jsxDEV("input",{type:"file",ref:a,onChange:C,className:"hidden",accept:"image/*,.pdf"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:221,columnNumber:29},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:204,columnNumber:25},void 0),v&&m.jsxDEV("div",{className:"mt-8 flex items-center gap-3 text-rose-500 bg-rose-50 dark:bg-rose-900/10 px-6 py-3 rounded-2xl border border-rose-100 dark:border-rose-900/30 animate-shake",children:[m.jsxDEV(Fi,{size:18},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:226,columnNumber:33},void 0),m.jsxDEV("span",{className:"text-xs font-black uppercase tracking-widest",children:v},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:227,columnNumber:33},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:225,columnNumber:29},void 0),h&&m.jsxDEV("div",{className:"mt-12 flex items-center gap-4 text-indigo-600 bg-indigo-50 dark:bg-indigo-900/20 px-8 py-4 rounded-2xl border border-indigo-100 dark:border-indigo-900/30 shadow-lg shadow-indigo-500/10",children:[m.jsxDEV(ta,{className:"animate-spin h-6 w-6"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:233,columnNumber:33},void 0),m.jsxDEV("span",{className:"text-sm font-black uppercase tracking-[0.2em]",children:n("accounting_modals.scan_invoice.processing",{defaultValue:"Analyzing..."})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:234,columnNumber:33},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:232,columnNumber:29},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:195,columnNumber:21},void 0),c==="confirm"&&m.jsxDEV("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-10 animate-fade-in",children:[m.jsxDEV("div",{className:"space-y-8 order-2 lg:order-1",children:[m.jsxDEV("div",{children:[m.jsxDEV("h3",{className:"text-xl font-black text-gray-900 dark:text-white uppercase tracking-tight",children:n("accounting_modals.scan_invoice.verify_title",{defaultValue:"Verify Details"})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:245,columnNumber:33},void 0),m.jsxDEV("p",{className:"text-[10px] text-gray-500 dark:text-gray-400 font-black uppercase tracking-widest mt-0.5",children:n("accounting_modals.scan_invoice.verify_subtitle",{defaultValue:"Review Extractions"})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:246,columnNumber:33},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:244,columnNumber:29},void 0),m.jsxDEV("div",{className:"space-y-6",children:[m.jsxDEV("div",{children:[m.jsxDEV(Xt,{label:n("accounting_modals.scan_invoice.merchant",{defaultValue:"Supplier / Merchant"}),icon:td,value:E.merchant,onChange:A=>w(R=>({...R,merchant:A.target.value}))},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:251,columnNumber:37},void 0),E.supplierId&&m.jsxDEV("p",{className:"text-[10px] text-green-600 font-black mt-2 ml-1 flex items-center gap-1 uppercase tracking-tight",children:[m.jsxDEV(ea,{size:12},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:259,columnNumber:45},void 0)," ",n("accounting_modals.scan_invoice.matched",{defaultValue:"Matched to registered supplier"})]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:258,columnNumber:41},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:250,columnNumber:33},void 0),m.jsxDEV("div",{className:"grid grid-cols-2 gap-4",children:[m.jsxDEV(Xt,{label:n("accounting_modals.scan_invoice.date",{defaultValue:"Date"}),icon:Qn,type:"date",value:E.date,onChange:A=>w(R=>({...R,date:A.target.value}))},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:265,columnNumber:37},void 0),m.jsxDEV(Xt,{label:n("accounting_modals.scan_invoice.invoice_num",{defaultValue:"Invoice #"}),icon:uf,value:E.invoiceNumber,onChange:A=>w(R=>({...R,invoiceNumber:A.target.value})),className:"font-mono"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:272,columnNumber:37},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:264,columnNumber:33},void 0),m.jsxDEV(Xt,{label:n("accounting_modals.scan_invoice.value",{defaultValue:"Value (RM)"}),icon:na,type:"number",step:"0.01",value:E.amount,onChange:A=>w(R=>({...R,amount:parseFloat(A.target.value)||0})),className:"text-xl font-black text-rose-600 dark:text-rose-400 font-mono"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:281,columnNumber:33},void 0),m.jsxDEV(Fr,{label:n("accounting_modals.scan_invoice.classification",{defaultValue:"Classification"}),icon:df,value:E.category,onChange:A=>w(R=>({...R,category:A.target.value})),children:o.map(A=>m.jsxDEV("option",{value:A,className:"capitalize",children:n(`accounting_modals.expense_categories.${A}`,{defaultValue:A.replace(/_/g," ")})},A,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:297,columnNumber:65},void 0))},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:291,columnNumber:33},void 0),m.jsxDEV(tx,{label:n("accounting_modals.scan_invoice.description",{defaultValue:"Description"}),value:E.description,onChange:A=>w(R=>({...R,description:A.target.value})),rows:3},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:300,columnNumber:33},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:249,columnNumber:29},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:243,columnNumber:25},void 0),m.jsxDEV("div",{className:"space-y-6 order-1 lg:order-2",children:[m.jsxDEV("h3",{className:"text-[10px] font-black text-gray-400 uppercase tracking-[0.2em]",children:n("accounting_modals.scan_invoice.source",{defaultValue:"Document Source"})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:311,columnNumber:29},void 0),m.jsxDEV("div",{className:"border-8 border-gray-50 dark:border-gray-800 rounded-[3rem] overflow-hidden shadow-2xl flex items-center justify-center bg-gray-50 dark:bg-gray-950 ring-1 ring-gray-100 dark:ring-gray-800",children:p?m.jsxDEV("img",{src:p,alt:"Invoice source",className:"max-w-full max-h-[500px] object-contain transition-transform hover:scale-110 duration-700"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:314,columnNumber:37},void 0):m.jsxDEV("div",{className:"p-20 text-gray-300 dark:text-gray-700 text-center font-bold uppercase tracking-widest text-xs",children:n("accounting_modals.scan_invoice.no_image",{defaultValue:"No image data"})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:316,columnNumber:37},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:312,columnNumber:29},void 0),m.jsxDEV("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 rounded-2xl border border-blue-100 dark:border-blue-900/30 flex items-center space-x-3",children:[m.jsxDEV(Yo,{className:"h-4 w-4 text-blue-500 animate-spin-once"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:320,columnNumber:33},void 0),m.jsxDEV("p",{className:"text-[10px] font-black text-blue-800 dark:text-blue-300 uppercase tracking-tight",children:n("accounting_modals.scan_invoice.ai_confidence",{defaultValue:"AI Confidence: High (Structured Metadata Match)"})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:321,columnNumber:33},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:319,columnNumber:29},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:310,columnNumber:25},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:241,columnNumber:21},void 0),m.jsxDEV("div",{className:"pt-8 border-t dark:border-gray-800 flex flex-col sm:flex-row justify-end gap-3",children:c==="confirm"?m.jsxDEV(m.Fragment,{children:[m.jsxDEV(_t,{variant:"secondary",onClick:()=>d("upload"),className:"w-full sm:w-auto px-8",children:n("accounting_modals.scan_invoice.recapture",{defaultValue:"Re-capture"})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:330,columnNumber:29},void 0),m.jsxDEV(_t,{onClick:I,icon:nd,className:"w-full sm:w-[220px]",children:n("accounting_modals.scan_invoice.save",{defaultValue:"Save Expense"})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:337,columnNumber:29},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:329,columnNumber:25},void 0):m.jsxDEV(_t,{variant:"secondary",onClick:j,className:"w-full sm:w-auto px-8",children:n("hr.attendance_kiosk.cancel")},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:346,columnNumber:25},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:327,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:193,columnNumber:13},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanInvoiceModal.tsx",lineNumber:184,columnNumber:9},void 0):null},HI=Object.freeze(Object.defineProperty({__proto__:null,default:em},Symbol.toStringTag,{value:"Module"}));var nx={};/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */let ix,ox;function sx(){return{geminiUrl:ix,vertexUrl:ox}}function rx(t,e,n,i){var o,s;if(!(t!=null&&t.baseUrl)){const r=sx();return e?(o=r.vertexUrl)!==null&&o!==void 0?o:n:(s=r.geminiUrl)!==null&&s!==void 0?s:i}return t.baseUrl}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class sn{}function z(t,e){const n=/\{([^}]+)\}/g;return t.replace(n,(i,o)=>{if(Object.prototype.hasOwnProperty.call(e,o)){const s=e[o];return s!=null?String(s):""}else throw new Error(`Key '${o}' not found in valueMap.`)})}function u(t,e,n){for(let s=0;s<e.length-1;s++){const r=e[s];if(r.endsWith("[]")){const a=r.slice(0,-2);if(!(a in t))if(Array.isArray(n))t[a]=Array.from({length:n.length},()=>({}));else throw new Error(`Value must be a list given an array path ${r}`);if(Array.isArray(t[a])){const c=t[a];if(Array.isArray(n))for(let d=0;d<c.length;d++){const p=c[d];u(p,e.slice(s+1),n[d])}else for(const d of c)u(d,e.slice(s+1),n)}return}else if(r.endsWith("[0]")){const a=r.slice(0,-3);a in t||(t[a]=[{}]);const c=t[a];u(c[0],e.slice(s+1),n);return}(!t[r]||typeof t[r]!="object")&&(t[r]={}),t=t[r]}const i=e[e.length-1],o=t[i];if(o!==void 0){if(!n||typeof n=="object"&&Object.keys(n).length===0||n===o)return;if(typeof o=="object"&&typeof n=="object"&&o!==null&&n!==null)Object.assign(o,n);else throw new Error(`Cannot set value for an existing key. Key: ${i}`)}else i==="_self"&&typeof n=="object"&&n!==null&&!Array.isArray(n)?Object.assign(t,n):t[i]=n}function l(t,e,n=void 0){try{if(e.length===1&&e[0]==="_self")return t;for(let i=0;i<e.length;i++){if(typeof t!="object"||t===null)return n;const o=e[i];if(o.endsWith("[]")){const s=o.slice(0,-2);if(s in t){const r=t[s];return Array.isArray(r)?r.map(a=>l(a,e.slice(i+1),n)):n}else return n}else t=t[o]}return t}catch(i){if(i instanceof TypeError)return n;throw i}}function ax(t,e){for(const[n,i]of Object.entries(e)){const o=n.split("."),s=i.split("."),r=new Set;let a=-1;for(let c=0;c<o.length;c++)if(o[c]==="*"){a=c;break}if(a!==-1&&s.length>a)for(let c=a;c<s.length;c++){const d=s[c];d!=="*"&&!d.endsWith("[]")&&!d.endsWith("[0]")&&r.add(d)}qr(t,o,s,0,r)}}function qr(t,e,n,i,o){if(i>=e.length||typeof t!="object"||t===null)return;const s=e[i];if(s.endsWith("[]")){const r=s.slice(0,-2),a=t;if(r in a&&Array.isArray(a[r]))for(const c of a[r])qr(c,e,n,i+1,o)}else if(s==="*"){if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const r=t,a=Object.keys(r).filter(d=>!d.startsWith("_")&&!o.has(d)),c={};for(const d of a)c[d]=r[d];for(const[d,p]of Object.entries(c)){const f=[];for(const h of n.slice(i))h==="*"?f.push(d):f.push(h);u(r,f,p)}for(const d of a)delete r[d]}}else{const r=t;s in r&&qr(r[s],e,n,i+1,o)}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function xa(t){if(typeof t!="string")throw new Error("fromImageBytes must be a string");return t}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function lx(t){const e={},n=l(t,["operationName"]);n!=null&&u(e,["operationName"],n);const i=l(t,["resourceName"]);return i!=null&&u(e,["_url","resourceName"],i),e}function cx(t){const e={},n=l(t,["name"]);n!=null&&u(e,["name"],n);const i=l(t,["metadata"]);i!=null&&u(e,["metadata"],i);const o=l(t,["done"]);o!=null&&u(e,["done"],o);const s=l(t,["error"]);s!=null&&u(e,["error"],s);const r=l(t,["response","generateVideoResponse"]);return r!=null&&u(e,["response"],dx(r)),e}function ux(t){const e={},n=l(t,["name"]);n!=null&&u(e,["name"],n);const i=l(t,["metadata"]);i!=null&&u(e,["metadata"],i);const o=l(t,["done"]);o!=null&&u(e,["done"],o);const s=l(t,["error"]);s!=null&&u(e,["error"],s);const r=l(t,["response"]);return r!=null&&u(e,["response"],px(r)),e}function dx(t){const e={},n=l(t,["generatedSamples"]);if(n!=null){let s=n;Array.isArray(s)&&(s=s.map(r=>mx(r))),u(e,["generatedVideos"],s)}const i=l(t,["raiMediaFilteredCount"]);i!=null&&u(e,["raiMediaFilteredCount"],i);const o=l(t,["raiMediaFilteredReasons"]);return o!=null&&u(e,["raiMediaFilteredReasons"],o),e}function px(t){const e={},n=l(t,["videos"]);if(n!=null){let s=n;Array.isArray(s)&&(s=s.map(r=>fx(r))),u(e,["generatedVideos"],s)}const i=l(t,["raiMediaFilteredCount"]);i!=null&&u(e,["raiMediaFilteredCount"],i);const o=l(t,["raiMediaFilteredReasons"]);return o!=null&&u(e,["raiMediaFilteredReasons"],o),e}function mx(t){const e={},n=l(t,["video"]);return n!=null&&u(e,["video"],_x(n)),e}function fx(t){const e={},n=l(t,["_self"]);return n!=null&&u(e,["video"],Nx(n)),e}function hx(t){const e={},n=l(t,["operationName"]);return n!=null&&u(e,["_url","operationName"],n),e}function gx(t){const e={},n=l(t,["operationName"]);return n!=null&&u(e,["_url","operationName"],n),e}function yx(t){const e={},n=l(t,["name"]);n!=null&&u(e,["name"],n);const i=l(t,["metadata"]);i!=null&&u(e,["metadata"],i);const o=l(t,["done"]);o!=null&&u(e,["done"],o);const s=l(t,["error"]);s!=null&&u(e,["error"],s);const r=l(t,["response"]);return r!=null&&u(e,["response"],vx(r)),e}function vx(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["parent"]);i!=null&&u(e,["parent"],i);const o=l(t,["documentName"]);return o!=null&&u(e,["documentName"],o),e}function tm(t){const e={},n=l(t,["name"]);n!=null&&u(e,["name"],n);const i=l(t,["metadata"]);i!=null&&u(e,["metadata"],i);const o=l(t,["done"]);o!=null&&u(e,["done"],o);const s=l(t,["error"]);s!=null&&u(e,["error"],s);const r=l(t,["response"]);return r!=null&&u(e,["response"],bx(r)),e}function bx(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["parent"]);i!=null&&u(e,["parent"],i);const o=l(t,["documentName"]);return o!=null&&u(e,["documentName"],o),e}function _x(t){const e={},n=l(t,["uri"]);n!=null&&u(e,["uri"],n);const i=l(t,["encodedVideo"]);i!=null&&u(e,["videoBytes"],xa(i));const o=l(t,["encoding"]);return o!=null&&u(e,["mimeType"],o),e}function Nx(t){const e={},n=l(t,["gcsUri"]);n!=null&&u(e,["uri"],n);const i=l(t,["bytesBase64Encoded"]);i!=null&&u(e,["videoBytes"],xa(i));const o=l(t,["mimeType"]);return o!=null&&u(e,["mimeType"],o),e}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */var zl;(function(t){t.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",t.OUTCOME_OK="OUTCOME_OK",t.OUTCOME_FAILED="OUTCOME_FAILED",t.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(zl||(zl={}));var Yl;(function(t){t.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",t.PYTHON="PYTHON"})(Yl||(Yl={}));var Ql;(function(t){t.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",t.SILENT="SILENT",t.WHEN_IDLE="WHEN_IDLE",t.INTERRUPT="INTERRUPT"})(Ql||(Ql={}));var et;(function(t){t.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",t.STRING="STRING",t.NUMBER="NUMBER",t.INTEGER="INTEGER",t.BOOLEAN="BOOLEAN",t.ARRAY="ARRAY",t.OBJECT="OBJECT",t.NULL="NULL"})(et||(et={}));var Xl;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(Xl||(Xl={}));var Zl;(function(t){t.API_SPEC_UNSPECIFIED="API_SPEC_UNSPECIFIED",t.SIMPLE_SEARCH="SIMPLE_SEARCH",t.ELASTIC_SEARCH="ELASTIC_SEARCH"})(Zl||(Zl={}));var ec;(function(t){t.AUTH_TYPE_UNSPECIFIED="AUTH_TYPE_UNSPECIFIED",t.NO_AUTH="NO_AUTH",t.API_KEY_AUTH="API_KEY_AUTH",t.HTTP_BASIC_AUTH="HTTP_BASIC_AUTH",t.GOOGLE_SERVICE_ACCOUNT_AUTH="GOOGLE_SERVICE_ACCOUNT_AUTH",t.OAUTH="OAUTH",t.OIDC_AUTH="OIDC_AUTH"})(ec||(ec={}));var tc;(function(t){t.HTTP_IN_UNSPECIFIED="HTTP_IN_UNSPECIFIED",t.HTTP_IN_QUERY="HTTP_IN_QUERY",t.HTTP_IN_HEADER="HTTP_IN_HEADER",t.HTTP_IN_PATH="HTTP_IN_PATH",t.HTTP_IN_BODY="HTTP_IN_BODY",t.HTTP_IN_COOKIE="HTTP_IN_COOKIE"})(tc||(tc={}));var nc;(function(t){t.PHISH_BLOCK_THRESHOLD_UNSPECIFIED="PHISH_BLOCK_THRESHOLD_UNSPECIFIED",t.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",t.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",t.BLOCK_HIGH_AND_ABOVE="BLOCK_HIGH_AND_ABOVE",t.BLOCK_HIGHER_AND_ABOVE="BLOCK_HIGHER_AND_ABOVE",t.BLOCK_VERY_HIGH_AND_ABOVE="BLOCK_VERY_HIGH_AND_ABOVE",t.BLOCK_ONLY_EXTREMELY_HIGH="BLOCK_ONLY_EXTREMELY_HIGH"})(nc||(nc={}));var ic;(function(t){t.THINKING_LEVEL_UNSPECIFIED="THINKING_LEVEL_UNSPECIFIED",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH",t.MINIMAL="MINIMAL"})(ic||(ic={}));var oc;(function(t){t.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",t.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",t.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",t.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",t.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",t.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY",t.HARM_CATEGORY_IMAGE_HATE="HARM_CATEGORY_IMAGE_HATE",t.HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT="HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT",t.HARM_CATEGORY_IMAGE_HARASSMENT="HARM_CATEGORY_IMAGE_HARASSMENT",t.HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT="HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT",t.HARM_CATEGORY_JAILBREAK="HARM_CATEGORY_JAILBREAK"})(oc||(oc={}));var sc;(function(t){t.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",t.SEVERITY="SEVERITY",t.PROBABILITY="PROBABILITY"})(sc||(sc={}));var rc;(function(t){t.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",t.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",t.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",t.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",t.BLOCK_NONE="BLOCK_NONE",t.OFF="OFF"})(rc||(rc={}));var ac;(function(t){t.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",t.STOP="STOP",t.MAX_TOKENS="MAX_TOKENS",t.SAFETY="SAFETY",t.RECITATION="RECITATION",t.LANGUAGE="LANGUAGE",t.OTHER="OTHER",t.BLOCKLIST="BLOCKLIST",t.PROHIBITED_CONTENT="PROHIBITED_CONTENT",t.SPII="SPII",t.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",t.IMAGE_SAFETY="IMAGE_SAFETY",t.UNEXPECTED_TOOL_CALL="UNEXPECTED_TOOL_CALL",t.IMAGE_PROHIBITED_CONTENT="IMAGE_PROHIBITED_CONTENT",t.NO_IMAGE="NO_IMAGE",t.IMAGE_RECITATION="IMAGE_RECITATION",t.IMAGE_OTHER="IMAGE_OTHER"})(ac||(ac={}));var lc;(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(lc||(lc={}));var cc;(function(t){t.HARM_SEVERITY_UNSPECIFIED="HARM_SEVERITY_UNSPECIFIED",t.HARM_SEVERITY_NEGLIGIBLE="HARM_SEVERITY_NEGLIGIBLE",t.HARM_SEVERITY_LOW="HARM_SEVERITY_LOW",t.HARM_SEVERITY_MEDIUM="HARM_SEVERITY_MEDIUM",t.HARM_SEVERITY_HIGH="HARM_SEVERITY_HIGH"})(cc||(cc={}));var uc;(function(t){t.URL_RETRIEVAL_STATUS_UNSPECIFIED="URL_RETRIEVAL_STATUS_UNSPECIFIED",t.URL_RETRIEVAL_STATUS_SUCCESS="URL_RETRIEVAL_STATUS_SUCCESS",t.URL_RETRIEVAL_STATUS_ERROR="URL_RETRIEVAL_STATUS_ERROR",t.URL_RETRIEVAL_STATUS_PAYWALL="URL_RETRIEVAL_STATUS_PAYWALL",t.URL_RETRIEVAL_STATUS_UNSAFE="URL_RETRIEVAL_STATUS_UNSAFE"})(uc||(uc={}));var dc;(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER",t.BLOCKLIST="BLOCKLIST",t.PROHIBITED_CONTENT="PROHIBITED_CONTENT",t.IMAGE_SAFETY="IMAGE_SAFETY",t.MODEL_ARMOR="MODEL_ARMOR",t.JAILBREAK="JAILBREAK"})(dc||(dc={}));var pc;(function(t){t.TRAFFIC_TYPE_UNSPECIFIED="TRAFFIC_TYPE_UNSPECIFIED",t.ON_DEMAND="ON_DEMAND",t.PROVISIONED_THROUGHPUT="PROVISIONED_THROUGHPUT"})(pc||(pc={}));var ss;(function(t){t.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",t.TEXT="TEXT",t.IMAGE="IMAGE",t.AUDIO="AUDIO"})(ss||(ss={}));var mc;(function(t){t.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",t.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",t.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",t.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH"})(mc||(mc={}));var fc;(function(t){t.TUNING_MODE_UNSPECIFIED="TUNING_MODE_UNSPECIFIED",t.TUNING_MODE_FULL="TUNING_MODE_FULL",t.TUNING_MODE_PEFT_ADAPTER="TUNING_MODE_PEFT_ADAPTER"})(fc||(fc={}));var hc;(function(t){t.ADAPTER_SIZE_UNSPECIFIED="ADAPTER_SIZE_UNSPECIFIED",t.ADAPTER_SIZE_ONE="ADAPTER_SIZE_ONE",t.ADAPTER_SIZE_TWO="ADAPTER_SIZE_TWO",t.ADAPTER_SIZE_FOUR="ADAPTER_SIZE_FOUR",t.ADAPTER_SIZE_EIGHT="ADAPTER_SIZE_EIGHT",t.ADAPTER_SIZE_SIXTEEN="ADAPTER_SIZE_SIXTEEN",t.ADAPTER_SIZE_THIRTY_TWO="ADAPTER_SIZE_THIRTY_TWO"})(hc||(hc={}));var Ur;(function(t){t.JOB_STATE_UNSPECIFIED="JOB_STATE_UNSPECIFIED",t.JOB_STATE_QUEUED="JOB_STATE_QUEUED",t.JOB_STATE_PENDING="JOB_STATE_PENDING",t.JOB_STATE_RUNNING="JOB_STATE_RUNNING",t.JOB_STATE_SUCCEEDED="JOB_STATE_SUCCEEDED",t.JOB_STATE_FAILED="JOB_STATE_FAILED",t.JOB_STATE_CANCELLING="JOB_STATE_CANCELLING",t.JOB_STATE_CANCELLED="JOB_STATE_CANCELLED",t.JOB_STATE_PAUSED="JOB_STATE_PAUSED",t.JOB_STATE_EXPIRED="JOB_STATE_EXPIRED",t.JOB_STATE_UPDATING="JOB_STATE_UPDATING",t.JOB_STATE_PARTIALLY_SUCCEEDED="JOB_STATE_PARTIALLY_SUCCEEDED"})(Ur||(Ur={}));var gc;(function(t){t.TUNING_TASK_UNSPECIFIED="TUNING_TASK_UNSPECIFIED",t.TUNING_TASK_I2V="TUNING_TASK_I2V",t.TUNING_TASK_T2V="TUNING_TASK_T2V",t.TUNING_TASK_R2V="TUNING_TASK_R2V"})(gc||(gc={}));var yc;(function(t){t.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",t.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",t.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",t.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH",t.MEDIA_RESOLUTION_ULTRA_HIGH="MEDIA_RESOLUTION_ULTRA_HIGH"})(yc||(yc={}));var vc;(function(t){t.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",t.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",t.BALANCED="BALANCED",t.PRIORITIZE_COST="PRIORITIZE_COST"})(vc||(vc={}));var bc;(function(t){t.UNSPECIFIED="UNSPECIFIED",t.BLOCKING="BLOCKING",t.NON_BLOCKING="NON_BLOCKING"})(bc||(bc={}));var _c;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(_c||(_c={}));var Nc;(function(t){t.ENVIRONMENT_UNSPECIFIED="ENVIRONMENT_UNSPECIFIED",t.ENVIRONMENT_BROWSER="ENVIRONMENT_BROWSER"})(Nc||(Nc={}));var xc;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE",t.VALIDATED="VALIDATED"})(xc||(xc={}));var Sc;(function(t){t.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",t.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",t.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",t.BLOCK_NONE="BLOCK_NONE"})(Sc||(Sc={}));var Ec;(function(t){t.DONT_ALLOW="DONT_ALLOW",t.ALLOW_ADULT="ALLOW_ADULT",t.ALLOW_ALL="ALLOW_ALL"})(Ec||(Ec={}));var wc;(function(t){t.auto="auto",t.en="en",t.ja="ja",t.ko="ko",t.hi="hi",t.zh="zh",t.pt="pt",t.es="es"})(wc||(wc={}));var Cc;(function(t){t.MASK_MODE_DEFAULT="MASK_MODE_DEFAULT",t.MASK_MODE_USER_PROVIDED="MASK_MODE_USER_PROVIDED",t.MASK_MODE_BACKGROUND="MASK_MODE_BACKGROUND",t.MASK_MODE_FOREGROUND="MASK_MODE_FOREGROUND",t.MASK_MODE_SEMANTIC="MASK_MODE_SEMANTIC"})(Cc||(Cc={}));var Dc;(function(t){t.CONTROL_TYPE_DEFAULT="CONTROL_TYPE_DEFAULT",t.CONTROL_TYPE_CANNY="CONTROL_TYPE_CANNY",t.CONTROL_TYPE_SCRIBBLE="CONTROL_TYPE_SCRIBBLE",t.CONTROL_TYPE_FACE_MESH="CONTROL_TYPE_FACE_MESH"})(Dc||(Dc={}));var Tc;(function(t){t.SUBJECT_TYPE_DEFAULT="SUBJECT_TYPE_DEFAULT",t.SUBJECT_TYPE_PERSON="SUBJECT_TYPE_PERSON",t.SUBJECT_TYPE_ANIMAL="SUBJECT_TYPE_ANIMAL",t.SUBJECT_TYPE_PRODUCT="SUBJECT_TYPE_PRODUCT"})(Tc||(Tc={}));var Ac;(function(t){t.EDIT_MODE_DEFAULT="EDIT_MODE_DEFAULT",t.EDIT_MODE_INPAINT_REMOVAL="EDIT_MODE_INPAINT_REMOVAL",t.EDIT_MODE_INPAINT_INSERTION="EDIT_MODE_INPAINT_INSERTION",t.EDIT_MODE_OUTPAINT="EDIT_MODE_OUTPAINT",t.EDIT_MODE_CONTROLLED_EDITING="EDIT_MODE_CONTROLLED_EDITING",t.EDIT_MODE_STYLE="EDIT_MODE_STYLE",t.EDIT_MODE_BGSWAP="EDIT_MODE_BGSWAP",t.EDIT_MODE_PRODUCT_IMAGE="EDIT_MODE_PRODUCT_IMAGE"})(Ac||(Ac={}));var kc;(function(t){t.FOREGROUND="FOREGROUND",t.BACKGROUND="BACKGROUND",t.PROMPT="PROMPT",t.SEMANTIC="SEMANTIC",t.INTERACTIVE="INTERACTIVE"})(kc||(kc={}));var Pc;(function(t){t.ASSET="ASSET",t.STYLE="STYLE"})(Pc||(Pc={}));var Ic;(function(t){t.INSERT="INSERT",t.REMOVE="REMOVE",t.REMOVE_STATIC="REMOVE_STATIC",t.OUTPAINT="OUTPAINT"})(Ic||(Ic={}));var Rc;(function(t){t.OPTIMIZED="OPTIMIZED",t.LOSSLESS="LOSSLESS"})(Rc||(Rc={}));var Mc;(function(t){t.SUPERVISED_FINE_TUNING="SUPERVISED_FINE_TUNING",t.PREFERENCE_TUNING="PREFERENCE_TUNING"})(Mc||(Mc={}));var Vc;(function(t){t.STATE_UNSPECIFIED="STATE_UNSPECIFIED",t.STATE_PENDING="STATE_PENDING",t.STATE_ACTIVE="STATE_ACTIVE",t.STATE_FAILED="STATE_FAILED"})(Vc||(Vc={}));var Lc;(function(t){t.STATE_UNSPECIFIED="STATE_UNSPECIFIED",t.PROCESSING="PROCESSING",t.ACTIVE="ACTIVE",t.FAILED="FAILED"})(Lc||(Lc={}));var Oc;(function(t){t.SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",t.UPLOADED="UPLOADED",t.GENERATED="GENERATED"})(Oc||(Oc={}));var jc;(function(t){t.TURN_COMPLETE_REASON_UNSPECIFIED="TURN_COMPLETE_REASON_UNSPECIFIED",t.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",t.RESPONSE_REJECTED="RESPONSE_REJECTED",t.NEED_MORE_INPUT="NEED_MORE_INPUT"})(jc||(jc={}));var Fc;(function(t){t.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",t.TEXT="TEXT",t.IMAGE="IMAGE",t.VIDEO="VIDEO",t.AUDIO="AUDIO",t.DOCUMENT="DOCUMENT"})(Fc||(Fc={}));var qc;(function(t){t.VAD_SIGNAL_TYPE_UNSPECIFIED="VAD_SIGNAL_TYPE_UNSPECIFIED",t.VAD_SIGNAL_TYPE_SOS="VAD_SIGNAL_TYPE_SOS",t.VAD_SIGNAL_TYPE_EOS="VAD_SIGNAL_TYPE_EOS"})(qc||(qc={}));var Uc;(function(t){t.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",t.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",t.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})(Uc||(Uc={}));var $c;(function(t){t.END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",t.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",t.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW"})($c||($c={}));var Bc;(function(t){t.ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",t.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",t.NO_INTERRUPTION="NO_INTERRUPTION"})(Bc||(Bc={}));var Gc;(function(t){t.TURN_COVERAGE_UNSPECIFIED="TURN_COVERAGE_UNSPECIFIED",t.TURN_INCLUDES_ONLY_ACTIVITY="TURN_INCLUDES_ONLY_ACTIVITY",t.TURN_INCLUDES_ALL_INPUT="TURN_INCLUDES_ALL_INPUT"})(Gc||(Gc={}));var Hc;(function(t){t.SCALE_UNSPECIFIED="SCALE_UNSPECIFIED",t.C_MAJOR_A_MINOR="C_MAJOR_A_MINOR",t.D_FLAT_MAJOR_B_FLAT_MINOR="D_FLAT_MAJOR_B_FLAT_MINOR",t.D_MAJOR_B_MINOR="D_MAJOR_B_MINOR",t.E_FLAT_MAJOR_C_MINOR="E_FLAT_MAJOR_C_MINOR",t.E_MAJOR_D_FLAT_MINOR="E_MAJOR_D_FLAT_MINOR",t.F_MAJOR_D_MINOR="F_MAJOR_D_MINOR",t.G_FLAT_MAJOR_E_FLAT_MINOR="G_FLAT_MAJOR_E_FLAT_MINOR",t.G_MAJOR_E_MINOR="G_MAJOR_E_MINOR",t.A_FLAT_MAJOR_F_MINOR="A_FLAT_MAJOR_F_MINOR",t.A_MAJOR_G_FLAT_MINOR="A_MAJOR_G_FLAT_MINOR",t.B_FLAT_MAJOR_G_MINOR="B_FLAT_MAJOR_G_MINOR",t.B_MAJOR_A_FLAT_MINOR="B_MAJOR_A_FLAT_MINOR"})(Hc||(Hc={}));var Kc;(function(t){t.MUSIC_GENERATION_MODE_UNSPECIFIED="MUSIC_GENERATION_MODE_UNSPECIFIED",t.QUALITY="QUALITY",t.DIVERSITY="DIVERSITY",t.VOCALIZATION="VOCALIZATION"})(Kc||(Kc={}));var _i;(function(t){t.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",t.PLAY="PLAY",t.PAUSE="PAUSE",t.STOP="STOP",t.RESET_CONTEXT="RESET_CONTEXT"})(_i||(_i={}));class $r{constructor(e){const n={};for(const i of e.headers.entries())n[i[0]]=i[1];this.headers=n,this.responseInternal=e}json(){return this.responseInternal.json()}}class Ji{get text(){var e,n,i,o,s,r,a,c;if(((o=(i=(n=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||n===void 0?void 0:n.content)===null||i===void 0?void 0:i.parts)===null||o===void 0?void 0:o.length)===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning text from the first one.");let d="",p=!1;const f=[];for(const h of(c=(a=(r=(s=this.candidates)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.content)===null||a===void 0?void 0:a.parts)!==null&&c!==void 0?c:[]){for(const[g,y]of Object.entries(h))g!=="text"&&g!=="thought"&&g!=="thoughtSignature"&&(y!==null||y!==void 0)&&f.push(g);if(typeof h.text=="string"){if(typeof h.thought=="boolean"&&h.thought)continue;p=!0,d+=h.text}}return f.length>0&&console.warn(`there are non-text parts ${f} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),p?d:void 0}get data(){var e,n,i,o,s,r,a,c;if(((o=(i=(n=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||n===void 0?void 0:n.content)===null||i===void 0?void 0:i.parts)===null||o===void 0?void 0:o.length)===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning data from the first one.");let d="";const p=[];for(const f of(c=(a=(r=(s=this.candidates)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.content)===null||a===void 0?void 0:a.parts)!==null&&c!==void 0?c:[]){for(const[h,g]of Object.entries(f))h!=="inlineData"&&(g!==null||g!==void 0)&&p.push(h);f.inlineData&&typeof f.inlineData.data=="string"&&(d+=atob(f.inlineData.data))}return p.length>0&&console.warn(`there are non-data parts ${p} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),d.length>0?btoa(d):void 0}get functionCalls(){var e,n,i,o,s,r,a,c;if(((o=(i=(n=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||n===void 0?void 0:n.content)===null||i===void 0?void 0:i.parts)===null||o===void 0?void 0:o.length)===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning function calls from the first one.");const d=(c=(a=(r=(s=this.candidates)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.content)===null||a===void 0?void 0:a.parts)===null||c===void 0?void 0:c.filter(p=>p.functionCall).map(p=>p.functionCall).filter(p=>p!==void 0);if((d==null?void 0:d.length)!==0)return d}get executableCode(){var e,n,i,o,s,r,a,c,d;if(((o=(i=(n=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||n===void 0?void 0:n.content)===null||i===void 0?void 0:i.parts)===null||o===void 0?void 0:o.length)===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning executable code from the first one.");const p=(c=(a=(r=(s=this.candidates)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.content)===null||a===void 0?void 0:a.parts)===null||c===void 0?void 0:c.filter(f=>f.executableCode).map(f=>f.executableCode).filter(f=>f!==void 0);if((p==null?void 0:p.length)!==0)return(d=p==null?void 0:p[0])===null||d===void 0?void 0:d.code}get codeExecutionResult(){var e,n,i,o,s,r,a,c,d;if(((o=(i=(n=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||n===void 0?void 0:n.content)===null||i===void 0?void 0:i.parts)===null||o===void 0?void 0:o.length)===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning code execution result from the first one.");const p=(c=(a=(r=(s=this.candidates)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.content)===null||a===void 0?void 0:a.parts)===null||c===void 0?void 0:c.filter(f=>f.codeExecutionResult).map(f=>f.codeExecutionResult).filter(f=>f!==void 0);if((p==null?void 0:p.length)!==0)return(d=p==null?void 0:p[0])===null||d===void 0?void 0:d.output}}class Jc{}class Wc{}class xx{}class Sx{}class Ex{}class wx{}class zc{}class Yc{}class Qc{}class Cx{}class rs{_fromAPIResponse({apiResponse:e,_isVertexAI:n}){const i=new rs;let o;const s=e;return n?o=ux(s):o=cx(s),Object.assign(i,o),i}}class Xc{}class Zc{}class eu{}class tu{}class Dx{}class Tx{}class Ax{}class Sa{_fromAPIResponse({apiResponse:e,_isVertexAI:n}){const i=new Sa,s=yx(e);return Object.assign(i,s),i}}class kx{}class Px{}class Ix{}class nu{}class Rx{get text(){var e,n,i;let o="",s=!1;const r=[];for(const a of(i=(n=(e=this.serverContent)===null||e===void 0?void 0:e.modelTurn)===null||n===void 0?void 0:n.parts)!==null&&i!==void 0?i:[]){for(const[c,d]of Object.entries(a))c!=="text"&&c!=="thought"&&d!==null&&r.push(c);if(typeof a.text=="string"){if(typeof a.thought=="boolean"&&a.thought)continue;s=!0,o+=a.text}}return r.length>0&&console.warn(`there are non-text parts ${r} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),s?o:void 0}get data(){var e,n,i;let o="";const s=[];for(const r of(i=(n=(e=this.serverContent)===null||e===void 0?void 0:e.modelTurn)===null||n===void 0?void 0:n.parts)!==null&&i!==void 0?i:[]){for(const[a,c]of Object.entries(r))a!=="inlineData"&&c!==null&&s.push(a);r.inlineData&&typeof r.inlineData.data=="string"&&(o+=atob(r.inlineData.data))}return s.length>0&&console.warn(`there are non-data parts ${s} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),o.length>0?btoa(o):void 0}}class Mx{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}}class Ea{_fromAPIResponse({apiResponse:e,_isVertexAI:n}){const i=new Ea,s=tm(e);return Object.assign(i,s),i}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function Se(t,e){if(!e||typeof e!="string")throw new Error("model is required and must be a string");if(e.includes("..")||e.includes("?")||e.includes("&"))throw new Error("invalid model parameter");if(t.isVertexAI()){if(e.startsWith("publishers/")||e.startsWith("projects/")||e.startsWith("models/"))return e;if(e.indexOf("/")>=0){const n=e.split("/",2);return`publishers/${n[0]}/models/${n[1]}`}else return`publishers/google/models/${e}`}else return e.startsWith("models/")||e.startsWith("tunedModels/")?e:`models/${e}`}function nm(t,e){const n=Se(t,e);return n?n.startsWith("publishers/")&&t.isVertexAI()?`projects/${t.getProject()}/locations/${t.getLocation()}/${n}`:n.startsWith("models/")&&t.isVertexAI()?`projects/${t.getProject()}/locations/${t.getLocation()}/publishers/google/${n}`:n:""}function im(t){return Array.isArray(t)?t.map(e=>as(e)):[as(t)]}function as(t){if(typeof t=="object"&&t!==null)return t;throw new Error(`Could not parse input as Blob. Unsupported blob type: ${typeof t}`)}function om(t){const e=as(t);if(e.mimeType&&e.mimeType.startsWith("image/"))return e;throw new Error(`Unsupported mime type: ${e.mimeType}`)}function sm(t){const e=as(t);if(e.mimeType&&e.mimeType.startsWith("audio/"))return e;throw new Error(`Unsupported mime type: ${e.mimeType}`)}function iu(t){if(t==null)throw new Error("PartUnion is required");if(typeof t=="object")return t;if(typeof t=="string")return{text:t};throw new Error(`Unsupported part type: ${typeof t}`)}function rm(t){if(t==null||Array.isArray(t)&&t.length===0)throw new Error("PartListUnion is required");return Array.isArray(t)?t.map(e=>iu(e)):[iu(t)]}function Br(t){return t!=null&&typeof t=="object"&&"parts"in t&&Array.isArray(t.parts)}function ou(t){return t!=null&&typeof t=="object"&&"functionCall"in t}function su(t){return t!=null&&typeof t=="object"&&"functionResponse"in t}function Je(t){if(t==null)throw new Error("ContentUnion is required");return Br(t)?t:{role:"user",parts:rm(t)}}function wa(t,e){if(!e)return[];if(t.isVertexAI()&&Array.isArray(e))return e.flatMap(n=>{const i=Je(n);return i.parts&&i.parts.length>0&&i.parts[0].text!==void 0?[i.parts[0].text]:[]});if(t.isVertexAI()){const n=Je(e);return n.parts&&n.parts.length>0&&n.parts[0].text!==void 0?[n.parts[0].text]:[]}return Array.isArray(e)?e.map(n=>Je(n)):[Je(e)]}function pt(t){if(t==null||Array.isArray(t)&&t.length===0)throw new Error("contents are required");if(!Array.isArray(t)){if(ou(t)||su(t))throw new Error("To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them");return[Je(t)]}const e=[],n=[],i=Br(t[0]);for(const o of t){const s=Br(o);if(s!=i)throw new Error("Mixing Content and Parts is not supported, please group the parts into a the appropriate Content objects and specify the roles for them");if(s)e.push(o);else{if(ou(o)||su(o))throw new Error("To specify functionCall or functionResponse parts, please wrap them, and any other parts, in Content objects as appropriate, specifying the role for them");n.push(o)}}return i||e.push({role:"user",parts:rm(n)}),e}function Vx(t,e){t.includes("null")&&(e.nullable=!0);const n=t.filter(i=>i!=="null");if(n.length===1)e.type=Object.values(et).includes(n[0].toUpperCase())?n[0].toUpperCase():et.TYPE_UNSPECIFIED;else{e.anyOf=[];for(const i of n)e.anyOf.push({type:Object.values(et).includes(i.toUpperCase())?i.toUpperCase():et.TYPE_UNSPECIFIED})}}function Ei(t){const e={},n=["items"],i=["anyOf"],o=["properties"];if(t.type&&t.anyOf)throw new Error("type and anyOf cannot be both populated.");const s=t.anyOf;s!=null&&s.length==2&&(s[0].type==="null"?(e.nullable=!0,t=s[1]):s[1].type==="null"&&(e.nullable=!0,t=s[0])),t.type instanceof Array&&Vx(t.type,e);for(const[r,a]of Object.entries(t))if(a!=null)if(r=="type"){if(a==="null")throw new Error("type: null can not be the only possible type for the field.");if(a instanceof Array)continue;e.type=Object.values(et).includes(a.toUpperCase())?a.toUpperCase():et.TYPE_UNSPECIFIED}else if(n.includes(r))e[r]=Ei(a);else if(i.includes(r)){const c=[];for(const d of a){if(d.type=="null"){e.nullable=!0;continue}c.push(Ei(d))}e[r]=c}else if(o.includes(r)){const c={};for(const[d,p]of Object.entries(a))c[d]=Ei(p);e[r]=c}else{if(r==="additionalProperties")continue;e[r]=a}return e}function Ca(t){return Ei(t)}function Da(t){if(typeof t=="object")return t;if(typeof t=="string")return{voiceConfig:{prebuiltVoiceConfig:{voiceName:t}}};throw new Error(`Unsupported speechConfig type: ${typeof t}`)}function Ta(t){if("multiSpeakerVoiceConfig"in t)throw new Error("multiSpeakerVoiceConfig is not supported in the live API.");return t}function qi(t){if(t.functionDeclarations)for(const e of t.functionDeclarations)e.parameters&&(Object.keys(e.parameters).includes("$schema")?e.parametersJsonSchema||(e.parametersJsonSchema=e.parameters,delete e.parameters):e.parameters=Ei(e.parameters)),e.response&&(Object.keys(e.response).includes("$schema")?e.responseJsonSchema||(e.responseJsonSchema=e.response,delete e.response):e.response=Ei(e.response));return t}function Ui(t){if(t==null)throw new Error("tools is required");if(!Array.isArray(t))throw new Error("tools is required and must be an array of Tools");const e=[];for(const n of t)e.push(n);return e}function Lx(t,e,n,i=1){const o=!e.startsWith(`${n}/`)&&e.split("/").length===i;return t.isVertexAI()?e.startsWith("projects/")?e:e.startsWith("locations/")?`projects/${t.getProject()}/${e}`:e.startsWith(`${n}/`)?`projects/${t.getProject()}/locations/${t.getLocation()}/${e}`:o?`projects/${t.getProject()}/locations/${t.getLocation()}/${n}/${e}`:e:o?`${n}/${e}`:e}function rn(t,e){if(typeof e!="string")throw new Error("name must be a string");return Lx(t,e,"cachedContents")}function am(t){switch(t){case"STATE_UNSPECIFIED":return"JOB_STATE_UNSPECIFIED";case"CREATING":return"JOB_STATE_RUNNING";case"ACTIVE":return"JOB_STATE_SUCCEEDED";case"FAILED":return"JOB_STATE_FAILED";default:return t}}function Dn(t){return xa(t)}function Ox(t){return t!=null&&typeof t=="object"&&"name"in t}function jx(t){return t!=null&&typeof t=="object"&&"video"in t}function Fx(t){return t!=null&&typeof t=="object"&&"uri"in t}function lm(t){var e;let n;if(Ox(t)&&(n=t.name),!(Fx(t)&&(n=t.uri,n===void 0))&&!(jx(t)&&(n=(e=t.video)===null||e===void 0?void 0:e.uri,n===void 0))){if(typeof t=="string"&&(n=t),n===void 0)throw new Error("Could not extract file name from the provided input.");if(n.startsWith("https://")){const o=n.split("files/")[1].match(/[a-z0-9]+/);if(o===null)throw new Error(`Could not extract file name from URI ${n}`);n=o[0]}else n.startsWith("files/")&&(n=n.split("files/")[1]);return n}}function cm(t,e){let n;return t.isVertexAI()?n=e?"publishers/google/models":"models":n=e?"models":"tunedModels",n}function um(t){for(const e of["models","tunedModels","publisherModels"])if(qx(t,e))return t[e];return[]}function qx(t,e){return t!==null&&typeof t=="object"&&e in t}function Ux(t,e={}){const n=t,i={name:n.name,description:n.description,parametersJsonSchema:n.inputSchema};return n.outputSchema&&(i.responseJsonSchema=n.outputSchema),e.behavior&&(i.behavior=e.behavior),{functionDeclarations:[i]}}function $x(t,e={}){const n=[],i=new Set;for(const o of t){const s=o.name;if(i.has(s))throw new Error(`Duplicate function name ${s} found in MCP tools. Please ensure function names are unique.`);i.add(s);const r=Ux(o,e);r.functionDeclarations&&n.push(...r.functionDeclarations)}return{functionDeclarations:n}}function dm(t,e){let n;if(typeof e=="string")if(t.isVertexAI())if(e.startsWith("gs://"))n={format:"jsonl",gcsUri:[e]};else if(e.startsWith("bq://"))n={format:"bigquery",bigqueryUri:e};else throw new Error(`Unsupported string source for Vertex AI: ${e}`);else if(e.startsWith("files/"))n={fileName:e};else throw new Error(`Unsupported string source for Gemini API: ${e}`);else if(Array.isArray(e)){if(t.isVertexAI())throw new Error("InlinedRequest[] is not supported in Vertex AI.");n={inlinedRequests:e}}else n=e;const i=[n.gcsUri,n.bigqueryUri].filter(Boolean).length,o=[n.inlinedRequests,n.fileName].filter(Boolean).length;if(t.isVertexAI()){if(o>0||i!==1)throw new Error("Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.")}else if(i>0||o!==1)throw new Error("Exactly one of `inlinedRequests`, `fileName`, must be set for Gemini API.");return n}function Bx(t){if(typeof t!="string")return t;const e=t;if(e.startsWith("gs://"))return{format:"jsonl",gcsUri:e};if(e.startsWith("bq://"))return{format:"bigquery",bigqueryUri:e};throw new Error(`Unsupported destination: ${e}`)}function pm(t){if(typeof t!="object"||t===null)return{};const e=t,n=e.inlinedResponses;if(typeof n!="object"||n===null)return t;const o=n.inlinedResponses;if(!Array.isArray(o)||o.length===0)return t;let s=!1;for(const r of o){if(typeof r!="object"||r===null)continue;const c=r.response;if(typeof c!="object"||c===null)continue;if(c.embedding!==void 0){s=!0;break}}return s&&(e.inlinedEmbedContentResponses=e.inlinedResponses,delete e.inlinedResponses),t}function $i(t,e){const n=e;if(!t.isVertexAI()){if(/batches\/[^/]+$/.test(n))return n.split("/").pop();throw new Error(`Invalid batch job name: ${n}.`)}if(/^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/.test(n))return n.split("/").pop();if(/^\d+$/.test(n))return n;throw new Error(`Invalid batch job name: ${n}.`)}function mm(t){const e=t;return e==="BATCH_STATE_UNSPECIFIED"?"JOB_STATE_UNSPECIFIED":e==="BATCH_STATE_PENDING"?"JOB_STATE_PENDING":e==="BATCH_STATE_RUNNING"?"JOB_STATE_RUNNING":e==="BATCH_STATE_SUCCEEDED"?"JOB_STATE_SUCCEEDED":e==="BATCH_STATE_FAILED"?"JOB_STATE_FAILED":e==="BATCH_STATE_CANCELLED"?"JOB_STATE_CANCELLED":e==="BATCH_STATE_EXPIRED"?"JOB_STATE_EXPIRED":e}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function Gx(t){const e={},n=l(t,["responsesFile"]);n!=null&&u(e,["fileName"],n);const i=l(t,["inlinedResponses","inlinedResponses"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>ES(r))),u(e,["inlinedResponses"],s)}const o=l(t,["inlinedEmbedContentResponses","inlinedResponses"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>r)),u(e,["inlinedEmbedContentResponses"],s)}return e}function Hx(t){const e={},n=l(t,["predictionsFormat"]);n!=null&&u(e,["format"],n);const i=l(t,["gcsDestination","outputUriPrefix"]);i!=null&&u(e,["gcsUri"],i);const o=l(t,["bigqueryDestination","outputUri"]);return o!=null&&u(e,["bigqueryUri"],o),e}function Kx(t){const e={},n=l(t,["format"]);n!=null&&u(e,["predictionsFormat"],n);const i=l(t,["gcsUri"]);i!=null&&u(e,["gcsDestination","outputUriPrefix"],i);const o=l(t,["bigqueryUri"]);if(o!=null&&u(e,["bigqueryDestination","outputUri"],o),l(t,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(l(t,["inlinedResponses"])!==void 0)throw new Error("inlinedResponses parameter is not supported in Vertex AI.");if(l(t,["inlinedEmbedContentResponses"])!==void 0)throw new Error("inlinedEmbedContentResponses parameter is not supported in Vertex AI.");return e}function Jo(t){const e={},n=l(t,["name"]);n!=null&&u(e,["name"],n);const i=l(t,["metadata","displayName"]);i!=null&&u(e,["displayName"],i);const o=l(t,["metadata","state"]);o!=null&&u(e,["state"],mm(o));const s=l(t,["metadata","createTime"]);s!=null&&u(e,["createTime"],s);const r=l(t,["metadata","endTime"]);r!=null&&u(e,["endTime"],r);const a=l(t,["metadata","updateTime"]);a!=null&&u(e,["updateTime"],a);const c=l(t,["metadata","model"]);c!=null&&u(e,["model"],c);const d=l(t,["metadata","output"]);return d!=null&&u(e,["dest"],Gx(pm(d))),e}function Gr(t){const e={},n=l(t,["name"]);n!=null&&u(e,["name"],n);const i=l(t,["displayName"]);i!=null&&u(e,["displayName"],i);const o=l(t,["state"]);o!=null&&u(e,["state"],mm(o));const s=l(t,["error"]);s!=null&&u(e,["error"],s);const r=l(t,["createTime"]);r!=null&&u(e,["createTime"],r);const a=l(t,["startTime"]);a!=null&&u(e,["startTime"],a);const c=l(t,["endTime"]);c!=null&&u(e,["endTime"],c);const d=l(t,["updateTime"]);d!=null&&u(e,["updateTime"],d);const p=l(t,["model"]);p!=null&&u(e,["model"],p);const f=l(t,["inputConfig"]);f!=null&&u(e,["src"],Jx(f));const h=l(t,["outputConfig"]);h!=null&&u(e,["dest"],Hx(pm(h)));const g=l(t,["completionStats"]);return g!=null&&u(e,["completionStats"],g),e}function Jx(t){const e={},n=l(t,["instancesFormat"]);n!=null&&u(e,["format"],n);const i=l(t,["gcsSource","uris"]);i!=null&&u(e,["gcsUri"],i);const o=l(t,["bigquerySource","inputUri"]);return o!=null&&u(e,["bigqueryUri"],o),e}function Wx(t,e){const n={};if(l(e,["format"])!==void 0)throw new Error("format parameter is not supported in Gemini API.");if(l(e,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(l(e,["bigqueryUri"])!==void 0)throw new Error("bigqueryUri parameter is not supported in Gemini API.");const i=l(e,["fileName"]);i!=null&&u(n,["fileName"],i);const o=l(e,["inlinedRequests"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>SS(t,r))),u(n,["requests","requests"],s)}return n}function zx(t){const e={},n=l(t,["format"]);n!=null&&u(e,["instancesFormat"],n);const i=l(t,["gcsUri"]);i!=null&&u(e,["gcsSource","uris"],i);const o=l(t,["bigqueryUri"]);if(o!=null&&u(e,["bigquerySource","inputUri"],o),l(t,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(l(t,["inlinedRequests"])!==void 0)throw new Error("inlinedRequests parameter is not supported in Vertex AI.");return e}function Yx(t){const e={},n=l(t,["data"]);if(n!=null&&u(e,["data"],n),l(t,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=l(t,["mimeType"]);return i!=null&&u(e,["mimeType"],i),e}function Qx(t,e){const n={},i=l(e,["name"]);return i!=null&&u(n,["_url","name"],$i(t,i)),n}function Xx(t,e){const n={},i=l(e,["name"]);return i!=null&&u(n,["_url","name"],$i(t,i)),n}function Zx(t){const e={},n=l(t,["content"]);n!=null&&u(e,["content"],n);const i=l(t,["citationMetadata"]);i!=null&&u(e,["citationMetadata"],eS(i));const o=l(t,["tokenCount"]);o!=null&&u(e,["tokenCount"],o);const s=l(t,["finishReason"]);s!=null&&u(e,["finishReason"],s);const r=l(t,["avgLogprobs"]);r!=null&&u(e,["avgLogprobs"],r);const a=l(t,["groundingMetadata"]);a!=null&&u(e,["groundingMetadata"],a);const c=l(t,["index"]);c!=null&&u(e,["index"],c);const d=l(t,["logprobsResult"]);d!=null&&u(e,["logprobsResult"],d);const p=l(t,["safetyRatings"]);if(p!=null){let h=p;Array.isArray(h)&&(h=h.map(g=>g)),u(e,["safetyRatings"],h)}const f=l(t,["urlContextMetadata"]);return f!=null&&u(e,["urlContextMetadata"],f),e}function eS(t){const e={},n=l(t,["citationSources"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(o=>o)),u(e,["citations"],i)}return e}function fm(t){const e={},n=l(t,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(s=>PS(s))),u(e,["parts"],o)}const i=l(t,["role"]);return i!=null&&u(e,["role"],i),e}function tS(t,e){const n={},i=l(t,["displayName"]);if(e!==void 0&&i!=null&&u(e,["batch","displayName"],i),l(t,["dest"])!==void 0)throw new Error("dest parameter is not supported in Gemini API.");return n}function nS(t,e){const n={},i=l(t,["displayName"]);e!==void 0&&i!=null&&u(e,["displayName"],i);const o=l(t,["dest"]);return e!==void 0&&o!=null&&u(e,["outputConfig"],Kx(Bx(o))),n}function ru(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["src"]);o!=null&&u(n,["batch","inputConfig"],Wx(t,dm(t,o)));const s=l(e,["config"]);return s!=null&&tS(s,n),n}function iS(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["model"],Se(t,i));const o=l(e,["src"]);o!=null&&u(n,["inputConfig"],zx(dm(t,o)));const s=l(e,["config"]);return s!=null&&nS(s,n),n}function oS(t,e){const n={},i=l(t,["displayName"]);return e!==void 0&&i!=null&&u(e,["batch","displayName"],i),n}function sS(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["src"]);o!=null&&u(n,["batch","inputConfig"],pS(t,o));const s=l(e,["config"]);return s!=null&&oS(s,n),n}function rS(t,e){const n={},i=l(e,["name"]);return i!=null&&u(n,["_url","name"],$i(t,i)),n}function aS(t,e){const n={},i=l(e,["name"]);return i!=null&&u(n,["_url","name"],$i(t,i)),n}function lS(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["name"]);i!=null&&u(e,["name"],i);const o=l(t,["done"]);o!=null&&u(e,["done"],o);const s=l(t,["error"]);return s!=null&&u(e,["error"],s),e}function cS(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["name"]);i!=null&&u(e,["name"],i);const o=l(t,["done"]);o!=null&&u(e,["done"],o);const s=l(t,["error"]);return s!=null&&u(e,["error"],s),e}function uS(t,e){const n={},i=l(e,["contents"]);if(i!=null){let s=wa(t,i);Array.isArray(s)&&(s=s.map(r=>r)),u(n,["requests[]","request","content"],s)}const o=l(e,["config"]);return o!=null&&(u(n,["_self"],dS(o,n)),ax(n,{"requests[].*":"requests[].request.*"})),n}function dS(t,e){const n={},i=l(t,["taskType"]);e!==void 0&&i!=null&&u(e,["requests[]","taskType"],i);const o=l(t,["title"]);e!==void 0&&o!=null&&u(e,["requests[]","title"],o);const s=l(t,["outputDimensionality"]);if(e!==void 0&&s!=null&&u(e,["requests[]","outputDimensionality"],s),l(t,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(l(t,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return n}function pS(t,e){const n={},i=l(e,["fileName"]);i!=null&&u(n,["file_name"],i);const o=l(e,["inlinedRequests"]);return o!=null&&u(n,["requests"],uS(t,o)),n}function mS(t){const e={};if(l(t,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=l(t,["fileUri"]);n!=null&&u(e,["fileUri"],n);const i=l(t,["mimeType"]);return i!=null&&u(e,["mimeType"],i),e}function fS(t){const e={},n=l(t,["id"]);n!=null&&u(e,["id"],n);const i=l(t,["args"]);i!=null&&u(e,["args"],i);const o=l(t,["name"]);if(o!=null&&u(e,["name"],o),l(t,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(l(t,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}function hS(t){const e={},n=l(t,["mode"]);n!=null&&u(e,["mode"],n);const i=l(t,["allowedFunctionNames"]);if(i!=null&&u(e,["allowedFunctionNames"],i),l(t,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return e}function gS(t,e,n){const i={},o=l(e,["systemInstruction"]);n!==void 0&&o!=null&&u(n,["systemInstruction"],fm(Je(o)));const s=l(e,["temperature"]);s!=null&&u(i,["temperature"],s);const r=l(e,["topP"]);r!=null&&u(i,["topP"],r);const a=l(e,["topK"]);a!=null&&u(i,["topK"],a);const c=l(e,["candidateCount"]);c!=null&&u(i,["candidateCount"],c);const d=l(e,["maxOutputTokens"]);d!=null&&u(i,["maxOutputTokens"],d);const p=l(e,["stopSequences"]);p!=null&&u(i,["stopSequences"],p);const f=l(e,["responseLogprobs"]);f!=null&&u(i,["responseLogprobs"],f);const h=l(e,["logprobs"]);h!=null&&u(i,["logprobs"],h);const g=l(e,["presencePenalty"]);g!=null&&u(i,["presencePenalty"],g);const y=l(e,["frequencyPenalty"]);y!=null&&u(i,["frequencyPenalty"],y);const _=l(e,["seed"]);_!=null&&u(i,["seed"],_);const v=l(e,["responseMimeType"]);v!=null&&u(i,["responseMimeType"],v);const x=l(e,["responseSchema"]);x!=null&&u(i,["responseSchema"],Ca(x));const E=l(e,["responseJsonSchema"]);if(E!=null&&u(i,["responseJsonSchema"],E),l(e,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(l(e,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const w=l(e,["safetySettings"]);if(n!==void 0&&w!=null){let L=w;Array.isArray(L)&&(L=L.map(F=>IS(F))),u(n,["safetySettings"],L)}const C=l(e,["tools"]);if(n!==void 0&&C!=null){let L=Ui(C);Array.isArray(L)&&(L=L.map(F=>MS(qi(F)))),u(n,["tools"],L)}const P=l(e,["toolConfig"]);if(n!==void 0&&P!=null&&u(n,["toolConfig"],RS(P)),l(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const k=l(e,["cachedContent"]);n!==void 0&&k!=null&&u(n,["cachedContent"],rn(t,k));const I=l(e,["responseModalities"]);I!=null&&u(i,["responseModalities"],I);const j=l(e,["mediaResolution"]);j!=null&&u(i,["mediaResolution"],j);const A=l(e,["speechConfig"]);if(A!=null&&u(i,["speechConfig"],Da(A)),l(e,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const R=l(e,["thinkingConfig"]);R!=null&&u(i,["thinkingConfig"],R);const q=l(e,["imageConfig"]);q!=null&&u(i,["imageConfig"],xS(q));const G=l(e,["enableEnhancedCivicAnswers"]);return G!=null&&u(i,["enableEnhancedCivicAnswers"],G),i}function yS(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["candidates"]);if(i!=null){let c=i;Array.isArray(c)&&(c=c.map(d=>Zx(d))),u(e,["candidates"],c)}const o=l(t,["modelVersion"]);o!=null&&u(e,["modelVersion"],o);const s=l(t,["promptFeedback"]);s!=null&&u(e,["promptFeedback"],s);const r=l(t,["responseId"]);r!=null&&u(e,["responseId"],r);const a=l(t,["usageMetadata"]);return a!=null&&u(e,["usageMetadata"],a),e}function vS(t,e){const n={},i=l(e,["name"]);return i!=null&&u(n,["_url","name"],$i(t,i)),n}function bS(t,e){const n={},i=l(e,["name"]);return i!=null&&u(n,["_url","name"],$i(t,i)),n}function _S(t){const e={};if(l(t,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const n=l(t,["enableWidget"]);return n!=null&&u(e,["enableWidget"],n),e}function NS(t){const e={};if(l(t,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(l(t,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const n=l(t,["timeRangeFilter"]);return n!=null&&u(e,["timeRangeFilter"],n),e}function xS(t){const e={},n=l(t,["aspectRatio"]);n!=null&&u(e,["aspectRatio"],n);const i=l(t,["imageSize"]);if(i!=null&&u(e,["imageSize"],i),l(t,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(l(t,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return e}function SS(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["request","model"],Se(t,i));const o=l(e,["contents"]);if(o!=null){let a=pt(o);Array.isArray(a)&&(a=a.map(c=>fm(c))),u(n,["request","contents"],a)}const s=l(e,["metadata"]);s!=null&&u(n,["metadata"],s);const r=l(e,["config"]);return r!=null&&u(n,["request","generationConfig"],gS(t,r,l(n,["request"],{}))),n}function ES(t){const e={},n=l(t,["response"]);n!=null&&u(e,["response"],yS(n));const i=l(t,["error"]);return i!=null&&u(e,["error"],i),e}function wS(t,e){const n={},i=l(t,["pageSize"]);e!==void 0&&i!=null&&u(e,["_query","pageSize"],i);const o=l(t,["pageToken"]);if(e!==void 0&&o!=null&&u(e,["_query","pageToken"],o),l(t,["filter"])!==void 0)throw new Error("filter parameter is not supported in Gemini API.");return n}function CS(t,e){const n={},i=l(t,["pageSize"]);e!==void 0&&i!=null&&u(e,["_query","pageSize"],i);const o=l(t,["pageToken"]);e!==void 0&&o!=null&&u(e,["_query","pageToken"],o);const s=l(t,["filter"]);return e!==void 0&&s!=null&&u(e,["_query","filter"],s),n}function DS(t){const e={},n=l(t,["config"]);return n!=null&&wS(n,e),e}function TS(t){const e={},n=l(t,["config"]);return n!=null&&CS(n,e),e}function AS(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["nextPageToken"]);i!=null&&u(e,["nextPageToken"],i);const o=l(t,["operations"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>Jo(r))),u(e,["batchJobs"],s)}return e}function kS(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["nextPageToken"]);i!=null&&u(e,["nextPageToken"],i);const o=l(t,["batchPredictionJobs"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>Gr(r))),u(e,["batchJobs"],s)}return e}function PS(t){const e={},n=l(t,["mediaResolution"]);n!=null&&u(e,["mediaResolution"],n);const i=l(t,["codeExecutionResult"]);i!=null&&u(e,["codeExecutionResult"],i);const o=l(t,["executableCode"]);o!=null&&u(e,["executableCode"],o);const s=l(t,["fileData"]);s!=null&&u(e,["fileData"],mS(s));const r=l(t,["functionCall"]);r!=null&&u(e,["functionCall"],fS(r));const a=l(t,["functionResponse"]);a!=null&&u(e,["functionResponse"],a);const c=l(t,["inlineData"]);c!=null&&u(e,["inlineData"],Yx(c));const d=l(t,["text"]);d!=null&&u(e,["text"],d);const p=l(t,["thought"]);p!=null&&u(e,["thought"],p);const f=l(t,["thoughtSignature"]);f!=null&&u(e,["thoughtSignature"],f);const h=l(t,["videoMetadata"]);return h!=null&&u(e,["videoMetadata"],h),e}function IS(t){const e={},n=l(t,["category"]);if(n!=null&&u(e,["category"],n),l(t,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const i=l(t,["threshold"]);return i!=null&&u(e,["threshold"],i),e}function RS(t){const e={},n=l(t,["functionCallingConfig"]);n!=null&&u(e,["functionCallingConfig"],hS(n));const i=l(t,["retrievalConfig"]);return i!=null&&u(e,["retrievalConfig"],i),e}function MS(t){const e={},n=l(t,["functionDeclarations"]);if(n!=null){let p=n;Array.isArray(p)&&(p=p.map(f=>f)),u(e,["functionDeclarations"],p)}if(l(t,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const i=l(t,["googleSearchRetrieval"]);i!=null&&u(e,["googleSearchRetrieval"],i);const o=l(t,["computerUse"]);o!=null&&u(e,["computerUse"],o);const s=l(t,["fileSearch"]);s!=null&&u(e,["fileSearch"],s);const r=l(t,["codeExecution"]);if(r!=null&&u(e,["codeExecution"],r),l(t,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const a=l(t,["googleMaps"]);a!=null&&u(e,["googleMaps"],_S(a));const c=l(t,["googleSearch"]);c!=null&&u(e,["googleSearch"],NS(c));const d=l(t,["urlContext"]);return d!=null&&u(e,["urlContext"],d),e}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */var nn;(function(t){t.PAGED_ITEM_BATCH_JOBS="batchJobs",t.PAGED_ITEM_MODELS="models",t.PAGED_ITEM_TUNING_JOBS="tuningJobs",t.PAGED_ITEM_FILES="files",t.PAGED_ITEM_CACHED_CONTENTS="cachedContents",t.PAGED_ITEM_FILE_SEARCH_STORES="fileSearchStores",t.PAGED_ITEM_DOCUMENTS="documents"})(nn||(nn={}));class ai{constructor(e,n,i,o){this.pageInternal=[],this.paramsInternal={},this.requestInternal=n,this.init(e,i,o)}init(e,n,i){var o,s;this.nameInternal=e,this.pageInternal=n[this.nameInternal]||[],this.sdkHttpResponseInternal=n==null?void 0:n.sdkHttpResponse,this.idxInternal=0;let r={config:{}};!i||Object.keys(i).length===0?r={config:{}}:typeof i=="object"?r=Object.assign({},i):r=i,r.config&&(r.config.pageToken=n.nextPageToken),this.paramsInternal=r,this.pageInternalSize=(s=(o=r.config)===null||o===void 0?void 0:o.pageSize)!==null&&s!==void 0?s:this.pageInternal.length}initNextPage(e){this.init(this.nameInternal,e,this.paramsInternal)}get page(){return this.pageInternal}get name(){return this.nameInternal}get pageSize(){return this.pageInternalSize}get sdkHttpResponse(){return this.sdkHttpResponseInternal}get params(){return this.paramsInternal}get pageLength(){return this.pageInternal.length}getItem(e){return this.pageInternal[e]}[Symbol.asyncIterator](){return{next:async()=>{if(this.idxInternal>=this.pageLength)if(this.hasNextPage())await this.nextPage();else return{value:void 0,done:!0};const e=this.getItem(this.idxInternal);return this.idxInternal+=1,{value:e,done:!1}},return:async()=>({value:void 0,done:!0})}}async nextPage(){if(!this.hasNextPage())throw new Error("No more pages to fetch.");const e=await this.requestInternal(this.params);return this.initNextPage(e),this.page}hasNextPage(){var e;return((e=this.params.config)===null||e===void 0?void 0:e.pageToken)!==void 0}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class VS extends sn{constructor(e){super(),this.apiClient=e,this.list=async(n={})=>new ai(nn.PAGED_ITEM_BATCH_JOBS,i=>this.listInternal(i),await this.listInternal(n),n),this.create=async n=>(this.apiClient.isVertexAI()&&(n.config=this.formatDestination(n.src,n.config)),this.createInternal(n)),this.createEmbeddings=async n=>{if(console.warn("batches.createEmbeddings() is experimental and may change without notice."),this.apiClient.isVertexAI())throw new Error("Vertex AI does not support batches.createEmbeddings.");return this.createEmbeddingsInternal(n)}}createInlinedGenerateContentRequest(e){const n=ru(this.apiClient,e),i=n._url,o=z("{model}:batchGenerateContent",i),a=n.batch.inputConfig.requests,c=a.requests,d=[];for(const p of c){const f=Object.assign({},p);if(f.systemInstruction){const h=f.systemInstruction;delete f.systemInstruction;const g=f.request;g.systemInstruction=h,f.request=g}d.push(f)}return a.requests=d,delete n.config,delete n._url,delete n._query,{path:o,body:n}}getGcsUri(e){if(typeof e=="string")return e.startsWith("gs://")?e:void 0;if(!Array.isArray(e)&&e.gcsUri&&e.gcsUri.length>0)return e.gcsUri[0]}getBigqueryUri(e){if(typeof e=="string")return e.startsWith("bq://")?e:void 0;if(!Array.isArray(e))return e.bigqueryUri}formatDestination(e,n){const i=n?Object.assign({},n):{},o=Date.now().toString();if(i.displayName||(i.displayName=`genaiBatchJob_${o}`),i.dest===void 0){const s=this.getGcsUri(e),r=this.getBigqueryUri(e);if(s)s.endsWith(".jsonl")?i.dest=`${s.slice(0,-6)}/dest`:i.dest=`${s}_dest_${o}`;else if(r)i.dest=`${r}_dest_${o}`;else throw new Error("Unsupported source for Vertex AI: No GCS or BigQuery URI found.")}return i}async createInternal(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=iS(this.apiClient,e);return a=z("batchPredictionJobs",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json()),r.then(p=>Gr(p))}else{const d=ru(this.apiClient,e);return a=z("{model}:batchGenerateContent",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),r.then(p=>Jo(p))}}async createEmbeddingsInternal(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const a=sS(this.apiClient,e);return s=z("{model}:asyncBatchEmbedContent",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json()),o.then(c=>Jo(c))}}async get(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=bS(this.apiClient,e);return a=z("batchPredictionJobs/{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json()),r.then(p=>Gr(p))}else{const d=vS(this.apiClient,e);return a=z("batches/{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),r.then(p=>Jo(p))}}async cancel(e){var n,i,o,s;let r="",a={};if(this.apiClient.isVertexAI()){const c=Xx(this.apiClient,e);r=z("batchPredictionJobs/{name}:cancel",c._url),a=c._query,delete c._url,delete c._query,await this.apiClient.request({path:r,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal})}else{const c=Qx(this.apiClient,e);r=z("batches/{name}:cancel",c._url),a=c._query,delete c._url,delete c._query,await this.apiClient.request({path:r,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal})}}async listInternal(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=TS(e);return a=z("batchPredictionJobs",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=kS(p),h=new nu;return Object.assign(h,f),h})}else{const d=DS(e);return a=z("batches",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=AS(p),h=new nu;return Object.assign(h,f),h})}}async delete(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=aS(this.apiClient,e);return a=z("batchPredictionJobs/{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"DELETE",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>cS(p))}else{const d=rS(this.apiClient,e);return a=z("batches/{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"DELETE",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>lS(p))}}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function LS(t){const e={},n=l(t,["data"]);if(n!=null&&u(e,["data"],n),l(t,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=l(t,["mimeType"]);return i!=null&&u(e,["mimeType"],i),e}function au(t){const e={},n=l(t,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(s=>sE(s))),u(e,["parts"],o)}const i=l(t,["role"]);return i!=null&&u(e,["role"],i),e}function OS(t,e){const n={},i=l(t,["ttl"]);e!==void 0&&i!=null&&u(e,["ttl"],i);const o=l(t,["expireTime"]);e!==void 0&&o!=null&&u(e,["expireTime"],o);const s=l(t,["displayName"]);e!==void 0&&s!=null&&u(e,["displayName"],s);const r=l(t,["contents"]);if(e!==void 0&&r!=null){let p=pt(r);Array.isArray(p)&&(p=p.map(f=>au(f))),u(e,["contents"],p)}const a=l(t,["systemInstruction"]);e!==void 0&&a!=null&&u(e,["systemInstruction"],au(Je(a)));const c=l(t,["tools"]);if(e!==void 0&&c!=null){let p=c;Array.isArray(p)&&(p=p.map(f=>aE(f))),u(e,["tools"],p)}const d=l(t,["toolConfig"]);if(e!==void 0&&d!=null&&u(e,["toolConfig"],rE(d)),l(t,["kmsKeyName"])!==void 0)throw new Error("kmsKeyName parameter is not supported in Gemini API.");return n}function jS(t,e){const n={},i=l(t,["ttl"]);e!==void 0&&i!=null&&u(e,["ttl"],i);const o=l(t,["expireTime"]);e!==void 0&&o!=null&&u(e,["expireTime"],o);const s=l(t,["displayName"]);e!==void 0&&s!=null&&u(e,["displayName"],s);const r=l(t,["contents"]);if(e!==void 0&&r!=null){let f=pt(r);Array.isArray(f)&&(f=f.map(h=>h)),u(e,["contents"],f)}const a=l(t,["systemInstruction"]);e!==void 0&&a!=null&&u(e,["systemInstruction"],Je(a));const c=l(t,["tools"]);if(e!==void 0&&c!=null){let f=c;Array.isArray(f)&&(f=f.map(h=>lE(h))),u(e,["tools"],f)}const d=l(t,["toolConfig"]);e!==void 0&&d!=null&&u(e,["toolConfig"],d);const p=l(t,["kmsKeyName"]);return e!==void 0&&p!=null&&u(e,["encryption_spec","kmsKeyName"],p),n}function FS(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["model"],nm(t,i));const o=l(e,["config"]);return o!=null&&OS(o,n),n}function qS(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["model"],nm(t,i));const o=l(e,["config"]);return o!=null&&jS(o,n),n}function US(t,e){const n={},i=l(e,["name"]);return i!=null&&u(n,["_url","name"],rn(t,i)),n}function $S(t,e){const n={},i=l(e,["name"]);return i!=null&&u(n,["_url","name"],rn(t,i)),n}function BS(t){const e={},n=l(t,["sdkHttpResponse"]);return n!=null&&u(e,["sdkHttpResponse"],n),e}function GS(t){const e={},n=l(t,["sdkHttpResponse"]);return n!=null&&u(e,["sdkHttpResponse"],n),e}function HS(t){const e={};if(l(t,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=l(t,["fileUri"]);n!=null&&u(e,["fileUri"],n);const i=l(t,["mimeType"]);return i!=null&&u(e,["mimeType"],i),e}function KS(t){const e={},n=l(t,["id"]);n!=null&&u(e,["id"],n);const i=l(t,["args"]);i!=null&&u(e,["args"],i);const o=l(t,["name"]);if(o!=null&&u(e,["name"],o),l(t,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(l(t,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}function JS(t){const e={},n=l(t,["mode"]);n!=null&&u(e,["mode"],n);const i=l(t,["allowedFunctionNames"]);if(i!=null&&u(e,["allowedFunctionNames"],i),l(t,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return e}function WS(t){const e={};if(l(t,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const n=l(t,["description"]);n!=null&&u(e,["description"],n);const i=l(t,["name"]);i!=null&&u(e,["name"],i);const o=l(t,["parameters"]);o!=null&&u(e,["parameters"],o);const s=l(t,["parametersJsonSchema"]);s!=null&&u(e,["parametersJsonSchema"],s);const r=l(t,["response"]);r!=null&&u(e,["response"],r);const a=l(t,["responseJsonSchema"]);return a!=null&&u(e,["responseJsonSchema"],a),e}function zS(t,e){const n={},i=l(e,["name"]);return i!=null&&u(n,["_url","name"],rn(t,i)),n}function YS(t,e){const n={},i=l(e,["name"]);return i!=null&&u(n,["_url","name"],rn(t,i)),n}function QS(t){const e={};if(l(t,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const n=l(t,["enableWidget"]);return n!=null&&u(e,["enableWidget"],n),e}function XS(t){const e={};if(l(t,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(l(t,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const n=l(t,["timeRangeFilter"]);return n!=null&&u(e,["timeRangeFilter"],n),e}function ZS(t,e){const n={},i=l(t,["pageSize"]);e!==void 0&&i!=null&&u(e,["_query","pageSize"],i);const o=l(t,["pageToken"]);return e!==void 0&&o!=null&&u(e,["_query","pageToken"],o),n}function eE(t,e){const n={},i=l(t,["pageSize"]);e!==void 0&&i!=null&&u(e,["_query","pageSize"],i);const o=l(t,["pageToken"]);return e!==void 0&&o!=null&&u(e,["_query","pageToken"],o),n}function tE(t){const e={},n=l(t,["config"]);return n!=null&&ZS(n,e),e}function nE(t){const e={},n=l(t,["config"]);return n!=null&&eE(n,e),e}function iE(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["nextPageToken"]);i!=null&&u(e,["nextPageToken"],i);const o=l(t,["cachedContents"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>r)),u(e,["cachedContents"],s)}return e}function oE(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["nextPageToken"]);i!=null&&u(e,["nextPageToken"],i);const o=l(t,["cachedContents"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>r)),u(e,["cachedContents"],s)}return e}function sE(t){const e={},n=l(t,["mediaResolution"]);n!=null&&u(e,["mediaResolution"],n);const i=l(t,["codeExecutionResult"]);i!=null&&u(e,["codeExecutionResult"],i);const o=l(t,["executableCode"]);o!=null&&u(e,["executableCode"],o);const s=l(t,["fileData"]);s!=null&&u(e,["fileData"],HS(s));const r=l(t,["functionCall"]);r!=null&&u(e,["functionCall"],KS(r));const a=l(t,["functionResponse"]);a!=null&&u(e,["functionResponse"],a);const c=l(t,["inlineData"]);c!=null&&u(e,["inlineData"],LS(c));const d=l(t,["text"]);d!=null&&u(e,["text"],d);const p=l(t,["thought"]);p!=null&&u(e,["thought"],p);const f=l(t,["thoughtSignature"]);f!=null&&u(e,["thoughtSignature"],f);const h=l(t,["videoMetadata"]);return h!=null&&u(e,["videoMetadata"],h),e}function rE(t){const e={},n=l(t,["functionCallingConfig"]);n!=null&&u(e,["functionCallingConfig"],JS(n));const i=l(t,["retrievalConfig"]);return i!=null&&u(e,["retrievalConfig"],i),e}function aE(t){const e={},n=l(t,["functionDeclarations"]);if(n!=null){let p=n;Array.isArray(p)&&(p=p.map(f=>f)),u(e,["functionDeclarations"],p)}if(l(t,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const i=l(t,["googleSearchRetrieval"]);i!=null&&u(e,["googleSearchRetrieval"],i);const o=l(t,["computerUse"]);o!=null&&u(e,["computerUse"],o);const s=l(t,["fileSearch"]);s!=null&&u(e,["fileSearch"],s);const r=l(t,["codeExecution"]);if(r!=null&&u(e,["codeExecution"],r),l(t,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const a=l(t,["googleMaps"]);a!=null&&u(e,["googleMaps"],QS(a));const c=l(t,["googleSearch"]);c!=null&&u(e,["googleSearch"],XS(c));const d=l(t,["urlContext"]);return d!=null&&u(e,["urlContext"],d),e}function lE(t){const e={},n=l(t,["functionDeclarations"]);if(n!=null){let f=n;Array.isArray(f)&&(f=f.map(h=>WS(h))),u(e,["functionDeclarations"],f)}const i=l(t,["retrieval"]);i!=null&&u(e,["retrieval"],i);const o=l(t,["googleSearchRetrieval"]);o!=null&&u(e,["googleSearchRetrieval"],o);const s=l(t,["computerUse"]);if(s!=null&&u(e,["computerUse"],s),l(t,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const r=l(t,["codeExecution"]);r!=null&&u(e,["codeExecution"],r);const a=l(t,["enterpriseWebSearch"]);a!=null&&u(e,["enterpriseWebSearch"],a);const c=l(t,["googleMaps"]);c!=null&&u(e,["googleMaps"],c);const d=l(t,["googleSearch"]);d!=null&&u(e,["googleSearch"],d);const p=l(t,["urlContext"]);return p!=null&&u(e,["urlContext"],p),e}function cE(t,e){const n={},i=l(t,["ttl"]);e!==void 0&&i!=null&&u(e,["ttl"],i);const o=l(t,["expireTime"]);return e!==void 0&&o!=null&&u(e,["expireTime"],o),n}function uE(t,e){const n={},i=l(t,["ttl"]);e!==void 0&&i!=null&&u(e,["ttl"],i);const o=l(t,["expireTime"]);return e!==void 0&&o!=null&&u(e,["expireTime"],o),n}function dE(t,e){const n={},i=l(e,["name"]);i!=null&&u(n,["_url","name"],rn(t,i));const o=l(e,["config"]);return o!=null&&cE(o,n),n}function pE(t,e){const n={},i=l(e,["name"]);i!=null&&u(n,["_url","name"],rn(t,i));const o=l(e,["config"]);return o!=null&&uE(o,n),n}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class mE extends sn{constructor(e){super(),this.apiClient=e,this.list=async(n={})=>new ai(nn.PAGED_ITEM_CACHED_CONTENTS,i=>this.listInternal(i),await this.listInternal(n),n)}async create(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=qS(this.apiClient,e);return a=z("cachedContents",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json()),r.then(p=>p)}else{const d=FS(this.apiClient,e);return a=z("cachedContents",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),r.then(p=>p)}}async get(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=YS(this.apiClient,e);return a=z("{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json()),r.then(p=>p)}else{const d=zS(this.apiClient,e);return a=z("{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),r.then(p=>p)}}async delete(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=$S(this.apiClient,e);return a=z("{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"DELETE",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=GS(p),h=new eu;return Object.assign(h,f),h})}else{const d=US(this.apiClient,e);return a=z("{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"DELETE",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=BS(p),h=new eu;return Object.assign(h,f),h})}}async update(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=pE(this.apiClient,e);return a=z("{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"PATCH",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json()),r.then(p=>p)}else{const d=dE(this.apiClient,e);return a=z("{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"PATCH",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),r.then(p=>p)}}async listInternal(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=nE(e);return a=z("cachedContents",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=oE(p),h=new tu;return Object.assign(h,f),h})}else{const d=tE(e);return a=z("cachedContents",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=iE(p),h=new tu;return Object.assign(h,f),h})}}}function ls(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(n[i[o]]=t[i[o]]);return n}function lu(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function pe(t){return this instanceof pe?(this.v=t,this):new pe(t)}function xt(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n.apply(t,e||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",r),o[Symbol.asyncIterator]=function(){return this},o;function r(g){return function(y){return Promise.resolve(y).then(g,f)}}function a(g,y){i[g]&&(o[g]=function(_){return new Promise(function(v,x){s.push([g,_,v,x])>1||c(g,_)})},y&&(o[g]=y(o[g])))}function c(g,y){try{d(i[g](y))}catch(_){h(s[0][3],_)}}function d(g){g.value instanceof pe?Promise.resolve(g.value.v).then(p,f):h(s[0][2],g)}function p(g){c("next",g)}function f(g){c("throw",g)}function h(g,y){g(y),s.shift(),s.length&&c(s[0][0],s[0][1])}}function St(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof lu=="function"?lu(t):t[Symbol.iterator](),n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n);function i(s){n[s]=t[s]&&function(r){return new Promise(function(a,c){r=t[s](r),o(a,c,r.done,r.value)})}}function o(s,r,a,c){Promise.resolve(c).then(function(d){s({value:d,done:a})},r)}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function fE(t){var e;if(t.candidates==null||t.candidates.length===0)return!1;const n=(e=t.candidates[0])===null||e===void 0?void 0:e.content;return n===void 0?!1:hm(n)}function hm(t){if(t.parts===void 0||t.parts.length===0)return!1;for(const e of t.parts)if(e===void 0||Object.keys(e).length===0)return!1;return!0}function hE(t){if(t.length!==0){for(const e of t)if(e.role!=="user"&&e.role!=="model")throw new Error(`Role must be user or model, but got ${e.role}.`)}}function cu(t){if(t===void 0||t.length===0)return[];const e=[],n=t.length;let i=0;for(;i<n;)if(t[i].role==="user")e.push(t[i]),i++;else{const o=[];let s=!0;for(;i<n&&t[i].role==="model";)o.push(t[i]),s&&!hm(t[i])&&(s=!1),i++;s?e.push(...o):e.pop()}return e}class gE{constructor(e,n){this.modelsModule=e,this.apiClient=n}create(e){return new yE(this.apiClient,this.modelsModule,e.model,e.config,structuredClone(e.history))}}class yE{constructor(e,n,i,o={},s=[]){this.apiClient=e,this.modelsModule=n,this.model=i,this.config=o,this.history=s,this.sendPromise=Promise.resolve(),hE(s)}async sendMessage(e){var n;await this.sendPromise;const i=Je(e.message),o=this.modelsModule.generateContent({model:this.model,contents:this.getHistory(!0).concat(i),config:(n=e.config)!==null&&n!==void 0?n:this.config});return this.sendPromise=(async()=>{var s,r,a;const c=await o,d=(r=(s=c.candidates)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.content,p=c.automaticFunctionCallingHistory,f=this.getHistory(!0).length;let h=[];p!=null&&(h=(a=p.slice(f))!==null&&a!==void 0?a:[]);const g=d?[d]:[];this.recordHistory(i,g,h)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),o}async sendMessageStream(e){var n;await this.sendPromise;const i=Je(e.message),o=this.modelsModule.generateContentStream({model:this.model,contents:this.getHistory(!0).concat(i),config:(n=e.config)!==null&&n!==void 0?n:this.config});this.sendPromise=o.then(()=>{}).catch(()=>{});const s=await o;return this.processStreamResponse(s,i)}getHistory(e=!1){const n=e?cu(this.history):this.history;return structuredClone(n)}processStreamResponse(e,n){return xt(this,arguments,function*(){var o,s,r,a,c,d;const p=[];try{for(var f=!0,h=St(e),g;g=yield pe(h.next()),o=g.done,!o;f=!0){a=g.value,f=!1;const y=a;if(fE(y)){const _=(d=(c=y.candidates)===null||c===void 0?void 0:c[0])===null||d===void 0?void 0:d.content;_!==void 0&&p.push(_)}yield yield pe(y)}}catch(y){s={error:y}}finally{try{!f&&!o&&(r=h.return)&&(yield pe(r.call(h)))}finally{if(s)throw s.error}}this.recordHistory(n,p)})}recordHistory(e,n,i){let o=[];n.length>0&&n.every(s=>s.role!==void 0)?o=n:o.push({role:"model",parts:[]}),i&&i.length>0?this.history.push(...cu(i)):this.history.push(e),this.history.push(...o)}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class Fs extends Error{constructor(e){super(e.message),this.name="ApiError",this.status=e.status,Object.setPrototypeOf(this,Fs.prototype)}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function vE(t){const e={},n=l(t,["file"]);return n!=null&&u(e,["file"],n),e}function bE(t){const e={},n=l(t,["sdkHttpResponse"]);return n!=null&&u(e,["sdkHttpResponse"],n),e}function _E(t){const e={},n=l(t,["name"]);return n!=null&&u(e,["_url","file"],lm(n)),e}function NE(t){const e={},n=l(t,["sdkHttpResponse"]);return n!=null&&u(e,["sdkHttpResponse"],n),e}function xE(t){const e={},n=l(t,["name"]);return n!=null&&u(e,["_url","file"],lm(n)),e}function SE(t,e){const n={},i=l(t,["pageSize"]);e!==void 0&&i!=null&&u(e,["_query","pageSize"],i);const o=l(t,["pageToken"]);return e!==void 0&&o!=null&&u(e,["_query","pageToken"],o),n}function EE(t){const e={},n=l(t,["config"]);return n!=null&&SE(n,e),e}function wE(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["nextPageToken"]);i!=null&&u(e,["nextPageToken"],i);const o=l(t,["files"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>r)),u(e,["files"],s)}return e}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class CE extends sn{constructor(e){super(),this.apiClient=e,this.list=async(n={})=>new ai(nn.PAGED_ITEM_FILES,i=>this.listInternal(i),await this.listInternal(n),n)}async upload(e){if(this.apiClient.isVertexAI())throw new Error("Vertex AI does not support uploading files. You can share files through a GCS bucket.");return this.apiClient.uploadFile(e.file,e.config).then(n=>n)}async download(e){await this.apiClient.downloadFile(e)}async listInternal(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const a=EE(e);return s=z("files",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json().then(d=>{const p=d;return p.sdkHttpResponse={headers:c.headers},p})),o.then(c=>{const d=wE(c),p=new kx;return Object.assign(p,d),p})}}async createInternal(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const a=vE(e);return s=z("upload/v1beta/files",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json()),o.then(c=>{const d=bE(c),p=new Px;return Object.assign(p,d),p})}}async get(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const a=xE(e);return s=z("files/{file}",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json()),o.then(c=>c)}}async delete(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const a=_E(e);return s=z("files/{file}",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"DELETE",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json().then(d=>{const p=d;return p.sdkHttpResponse={headers:c.headers},p})),o.then(c=>{const d=NE(c),p=new Ix;return Object.assign(p,d),p})}}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function Wo(t){const e={},n=l(t,["data"]);if(n!=null&&u(e,["data"],n),l(t,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=l(t,["mimeType"]);return i!=null&&u(e,["mimeType"],i),e}function DE(t){const e={},n=l(t,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(s=>BE(s))),u(e,["parts"],o)}const i=l(t,["role"]);return i!=null&&u(e,["role"],i),e}function TE(t){const e={};if(l(t,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=l(t,["fileUri"]);n!=null&&u(e,["fileUri"],n);const i=l(t,["mimeType"]);return i!=null&&u(e,["mimeType"],i),e}function AE(t){const e={},n=l(t,["id"]);n!=null&&u(e,["id"],n);const i=l(t,["args"]);i!=null&&u(e,["args"],i);const o=l(t,["name"]);if(o!=null&&u(e,["name"],o),l(t,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(l(t,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}function kE(t){const e={};if(l(t,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const n=l(t,["description"]);n!=null&&u(e,["description"],n);const i=l(t,["name"]);i!=null&&u(e,["name"],i);const o=l(t,["parameters"]);o!=null&&u(e,["parameters"],o);const s=l(t,["parametersJsonSchema"]);s!=null&&u(e,["parametersJsonSchema"],s);const r=l(t,["response"]);r!=null&&u(e,["response"],r);const a=l(t,["responseJsonSchema"]);return a!=null&&u(e,["responseJsonSchema"],a),e}function PE(t){const e={},n=l(t,["modelSelectionConfig"]);n!=null&&u(e,["modelConfig"],n);const i=l(t,["responseJsonSchema"]);i!=null&&u(e,["responseJsonSchema"],i);const o=l(t,["audioTimestamp"]);o!=null&&u(e,["audioTimestamp"],o);const s=l(t,["candidateCount"]);s!=null&&u(e,["candidateCount"],s);const r=l(t,["enableAffectiveDialog"]);r!=null&&u(e,["enableAffectiveDialog"],r);const a=l(t,["frequencyPenalty"]);a!=null&&u(e,["frequencyPenalty"],a);const c=l(t,["logprobs"]);c!=null&&u(e,["logprobs"],c);const d=l(t,["maxOutputTokens"]);d!=null&&u(e,["maxOutputTokens"],d);const p=l(t,["mediaResolution"]);p!=null&&u(e,["mediaResolution"],p);const f=l(t,["presencePenalty"]);f!=null&&u(e,["presencePenalty"],f);const h=l(t,["responseLogprobs"]);h!=null&&u(e,["responseLogprobs"],h);const g=l(t,["responseMimeType"]);g!=null&&u(e,["responseMimeType"],g);const y=l(t,["responseModalities"]);y!=null&&u(e,["responseModalities"],y);const _=l(t,["responseSchema"]);_!=null&&u(e,["responseSchema"],_);const v=l(t,["routingConfig"]);v!=null&&u(e,["routingConfig"],v);const x=l(t,["seed"]);x!=null&&u(e,["seed"],x);const E=l(t,["speechConfig"]);E!=null&&u(e,["speechConfig"],E);const w=l(t,["stopSequences"]);w!=null&&u(e,["stopSequences"],w);const C=l(t,["temperature"]);C!=null&&u(e,["temperature"],C);const P=l(t,["thinkingConfig"]);P!=null&&u(e,["thinkingConfig"],P);const k=l(t,["topK"]);k!=null&&u(e,["topK"],k);const I=l(t,["topP"]);if(I!=null&&u(e,["topP"],I),l(t,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return e}function IE(t){const e={};if(l(t,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const n=l(t,["enableWidget"]);return n!=null&&u(e,["enableWidget"],n),e}function RE(t){const e={};if(l(t,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(l(t,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const n=l(t,["timeRangeFilter"]);return n!=null&&u(e,["timeRangeFilter"],n),e}function ME(t,e){const n={},i=l(t,["generationConfig"]);e!==void 0&&i!=null&&u(e,["setup","generationConfig"],i);const o=l(t,["responseModalities"]);e!==void 0&&o!=null&&u(e,["setup","generationConfig","responseModalities"],o);const s=l(t,["temperature"]);e!==void 0&&s!=null&&u(e,["setup","generationConfig","temperature"],s);const r=l(t,["topP"]);e!==void 0&&r!=null&&u(e,["setup","generationConfig","topP"],r);const a=l(t,["topK"]);e!==void 0&&a!=null&&u(e,["setup","generationConfig","topK"],a);const c=l(t,["maxOutputTokens"]);e!==void 0&&c!=null&&u(e,["setup","generationConfig","maxOutputTokens"],c);const d=l(t,["mediaResolution"]);e!==void 0&&d!=null&&u(e,["setup","generationConfig","mediaResolution"],d);const p=l(t,["seed"]);e!==void 0&&p!=null&&u(e,["setup","generationConfig","seed"],p);const f=l(t,["speechConfig"]);e!==void 0&&f!=null&&u(e,["setup","generationConfig","speechConfig"],Ta(f));const h=l(t,["thinkingConfig"]);e!==void 0&&h!=null&&u(e,["setup","generationConfig","thinkingConfig"],h);const g=l(t,["enableAffectiveDialog"]);e!==void 0&&g!=null&&u(e,["setup","generationConfig","enableAffectiveDialog"],g);const y=l(t,["systemInstruction"]);e!==void 0&&y!=null&&u(e,["setup","systemInstruction"],DE(Je(y)));const _=l(t,["tools"]);if(e!==void 0&&_!=null){let k=Ui(_);Array.isArray(k)&&(k=k.map(I=>HE(qi(I)))),u(e,["setup","tools"],k)}const v=l(t,["sessionResumption"]);e!==void 0&&v!=null&&u(e,["setup","sessionResumption"],GE(v));const x=l(t,["inputAudioTranscription"]);e!==void 0&&x!=null&&u(e,["setup","inputAudioTranscription"],x);const E=l(t,["outputAudioTranscription"]);e!==void 0&&E!=null&&u(e,["setup","outputAudioTranscription"],E);const w=l(t,["realtimeInputConfig"]);e!==void 0&&w!=null&&u(e,["setup","realtimeInputConfig"],w);const C=l(t,["contextWindowCompression"]);e!==void 0&&C!=null&&u(e,["setup","contextWindowCompression"],C);const P=l(t,["proactivity"]);if(e!==void 0&&P!=null&&u(e,["setup","proactivity"],P),l(t,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is not supported in Gemini API.");return n}function VE(t,e){const n={},i=l(t,["generationConfig"]);e!==void 0&&i!=null&&u(e,["setup","generationConfig"],PE(i));const o=l(t,["responseModalities"]);e!==void 0&&o!=null&&u(e,["setup","generationConfig","responseModalities"],o);const s=l(t,["temperature"]);e!==void 0&&s!=null&&u(e,["setup","generationConfig","temperature"],s);const r=l(t,["topP"]);e!==void 0&&r!=null&&u(e,["setup","generationConfig","topP"],r);const a=l(t,["topK"]);e!==void 0&&a!=null&&u(e,["setup","generationConfig","topK"],a);const c=l(t,["maxOutputTokens"]);e!==void 0&&c!=null&&u(e,["setup","generationConfig","maxOutputTokens"],c);const d=l(t,["mediaResolution"]);e!==void 0&&d!=null&&u(e,["setup","generationConfig","mediaResolution"],d);const p=l(t,["seed"]);e!==void 0&&p!=null&&u(e,["setup","generationConfig","seed"],p);const f=l(t,["speechConfig"]);e!==void 0&&f!=null&&u(e,["setup","generationConfig","speechConfig"],Ta(f));const h=l(t,["thinkingConfig"]);e!==void 0&&h!=null&&u(e,["setup","generationConfig","thinkingConfig"],h);const g=l(t,["enableAffectiveDialog"]);e!==void 0&&g!=null&&u(e,["setup","generationConfig","enableAffectiveDialog"],g);const y=l(t,["systemInstruction"]);e!==void 0&&y!=null&&u(e,["setup","systemInstruction"],Je(y));const _=l(t,["tools"]);if(e!==void 0&&_!=null){let I=Ui(_);Array.isArray(I)&&(I=I.map(j=>KE(qi(j)))),u(e,["setup","tools"],I)}const v=l(t,["sessionResumption"]);e!==void 0&&v!=null&&u(e,["setup","sessionResumption"],v);const x=l(t,["inputAudioTranscription"]);e!==void 0&&x!=null&&u(e,["setup","inputAudioTranscription"],x);const E=l(t,["outputAudioTranscription"]);e!==void 0&&E!=null&&u(e,["setup","outputAudioTranscription"],E);const w=l(t,["realtimeInputConfig"]);e!==void 0&&w!=null&&u(e,["setup","realtimeInputConfig"],w);const C=l(t,["contextWindowCompression"]);e!==void 0&&C!=null&&u(e,["setup","contextWindowCompression"],C);const P=l(t,["proactivity"]);e!==void 0&&P!=null&&u(e,["setup","proactivity"],P);const k=l(t,["explicitVadSignal"]);return e!==void 0&&k!=null&&u(e,["setup","explicitVadSignal"],k),n}function LE(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["setup","model"],Se(t,i));const o=l(e,["config"]);return o!=null&&u(n,["config"],ME(o,n)),n}function OE(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["setup","model"],Se(t,i));const o=l(e,["config"]);return o!=null&&u(n,["config"],VE(o,n)),n}function jE(t){const e={},n=l(t,["musicGenerationConfig"]);return n!=null&&u(e,["musicGenerationConfig"],n),e}function FE(t){const e={},n=l(t,["weightedPrompts"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(o=>o)),u(e,["weightedPrompts"],i)}return e}function qE(t){const e={},n=l(t,["media"]);if(n!=null){let d=im(n);Array.isArray(d)&&(d=d.map(p=>Wo(p))),u(e,["mediaChunks"],d)}const i=l(t,["audio"]);i!=null&&u(e,["audio"],Wo(sm(i)));const o=l(t,["audioStreamEnd"]);o!=null&&u(e,["audioStreamEnd"],o);const s=l(t,["video"]);s!=null&&u(e,["video"],Wo(om(s)));const r=l(t,["text"]);r!=null&&u(e,["text"],r);const a=l(t,["activityStart"]);a!=null&&u(e,["activityStart"],a);const c=l(t,["activityEnd"]);return c!=null&&u(e,["activityEnd"],c),e}function UE(t){const e={},n=l(t,["media"]);if(n!=null){let d=im(n);Array.isArray(d)&&(d=d.map(p=>p)),u(e,["mediaChunks"],d)}const i=l(t,["audio"]);i!=null&&u(e,["audio"],sm(i));const o=l(t,["audioStreamEnd"]);o!=null&&u(e,["audioStreamEnd"],o);const s=l(t,["video"]);s!=null&&u(e,["video"],om(s));const r=l(t,["text"]);r!=null&&u(e,["text"],r);const a=l(t,["activityStart"]);a!=null&&u(e,["activityStart"],a);const c=l(t,["activityEnd"]);return c!=null&&u(e,["activityEnd"],c),e}function $E(t){const e={},n=l(t,["setupComplete"]);n!=null&&u(e,["setupComplete"],n);const i=l(t,["serverContent"]);i!=null&&u(e,["serverContent"],i);const o=l(t,["toolCall"]);o!=null&&u(e,["toolCall"],o);const s=l(t,["toolCallCancellation"]);s!=null&&u(e,["toolCallCancellation"],s);const r=l(t,["usageMetadata"]);r!=null&&u(e,["usageMetadata"],JE(r));const a=l(t,["goAway"]);a!=null&&u(e,["goAway"],a);const c=l(t,["sessionResumptionUpdate"]);c!=null&&u(e,["sessionResumptionUpdate"],c);const d=l(t,["voiceActivityDetectionSignal"]);return d!=null&&u(e,["voiceActivityDetectionSignal"],d),e}function BE(t){const e={},n=l(t,["mediaResolution"]);n!=null&&u(e,["mediaResolution"],n);const i=l(t,["codeExecutionResult"]);i!=null&&u(e,["codeExecutionResult"],i);const o=l(t,["executableCode"]);o!=null&&u(e,["executableCode"],o);const s=l(t,["fileData"]);s!=null&&u(e,["fileData"],TE(s));const r=l(t,["functionCall"]);r!=null&&u(e,["functionCall"],AE(r));const a=l(t,["functionResponse"]);a!=null&&u(e,["functionResponse"],a);const c=l(t,["inlineData"]);c!=null&&u(e,["inlineData"],Wo(c));const d=l(t,["text"]);d!=null&&u(e,["text"],d);const p=l(t,["thought"]);p!=null&&u(e,["thought"],p);const f=l(t,["thoughtSignature"]);f!=null&&u(e,["thoughtSignature"],f);const h=l(t,["videoMetadata"]);return h!=null&&u(e,["videoMetadata"],h),e}function GE(t){const e={},n=l(t,["handle"]);if(n!=null&&u(e,["handle"],n),l(t,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return e}function HE(t){const e={},n=l(t,["functionDeclarations"]);if(n!=null){let p=n;Array.isArray(p)&&(p=p.map(f=>f)),u(e,["functionDeclarations"],p)}if(l(t,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const i=l(t,["googleSearchRetrieval"]);i!=null&&u(e,["googleSearchRetrieval"],i);const o=l(t,["computerUse"]);o!=null&&u(e,["computerUse"],o);const s=l(t,["fileSearch"]);s!=null&&u(e,["fileSearch"],s);const r=l(t,["codeExecution"]);if(r!=null&&u(e,["codeExecution"],r),l(t,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const a=l(t,["googleMaps"]);a!=null&&u(e,["googleMaps"],IE(a));const c=l(t,["googleSearch"]);c!=null&&u(e,["googleSearch"],RE(c));const d=l(t,["urlContext"]);return d!=null&&u(e,["urlContext"],d),e}function KE(t){const e={},n=l(t,["functionDeclarations"]);if(n!=null){let f=n;Array.isArray(f)&&(f=f.map(h=>kE(h))),u(e,["functionDeclarations"],f)}const i=l(t,["retrieval"]);i!=null&&u(e,["retrieval"],i);const o=l(t,["googleSearchRetrieval"]);o!=null&&u(e,["googleSearchRetrieval"],o);const s=l(t,["computerUse"]);if(s!=null&&u(e,["computerUse"],s),l(t,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const r=l(t,["codeExecution"]);r!=null&&u(e,["codeExecution"],r);const a=l(t,["enterpriseWebSearch"]);a!=null&&u(e,["enterpriseWebSearch"],a);const c=l(t,["googleMaps"]);c!=null&&u(e,["googleMaps"],c);const d=l(t,["googleSearch"]);d!=null&&u(e,["googleSearch"],d);const p=l(t,["urlContext"]);return p!=null&&u(e,["urlContext"],p),e}function JE(t){const e={},n=l(t,["promptTokenCount"]);n!=null&&u(e,["promptTokenCount"],n);const i=l(t,["cachedContentTokenCount"]);i!=null&&u(e,["cachedContentTokenCount"],i);const o=l(t,["candidatesTokenCount"]);o!=null&&u(e,["responseTokenCount"],o);const s=l(t,["toolUsePromptTokenCount"]);s!=null&&u(e,["toolUsePromptTokenCount"],s);const r=l(t,["thoughtsTokenCount"]);r!=null&&u(e,["thoughtsTokenCount"],r);const a=l(t,["totalTokenCount"]);a!=null&&u(e,["totalTokenCount"],a);const c=l(t,["promptTokensDetails"]);if(c!=null){let g=c;Array.isArray(g)&&(g=g.map(y=>y)),u(e,["promptTokensDetails"],g)}const d=l(t,["cacheTokensDetails"]);if(d!=null){let g=d;Array.isArray(g)&&(g=g.map(y=>y)),u(e,["cacheTokensDetails"],g)}const p=l(t,["candidatesTokensDetails"]);if(p!=null){let g=p;Array.isArray(g)&&(g=g.map(y=>y)),u(e,["responseTokensDetails"],g)}const f=l(t,["toolUsePromptTokensDetails"]);if(f!=null){let g=f;Array.isArray(g)&&(g=g.map(y=>y)),u(e,["toolUsePromptTokensDetails"],g)}const h=l(t,["trafficType"]);return h!=null&&u(e,["trafficType"],h),e}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function WE(t){const e={},n=l(t,["data"]);if(n!=null&&u(e,["data"],n),l(t,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=l(t,["mimeType"]);return i!=null&&u(e,["mimeType"],i),e}function zE(t){const e={},n=l(t,["content"]);n!=null&&u(e,["content"],n);const i=l(t,["citationMetadata"]);i!=null&&u(e,["citationMetadata"],YE(i));const o=l(t,["tokenCount"]);o!=null&&u(e,["tokenCount"],o);const s=l(t,["finishReason"]);s!=null&&u(e,["finishReason"],s);const r=l(t,["avgLogprobs"]);r!=null&&u(e,["avgLogprobs"],r);const a=l(t,["groundingMetadata"]);a!=null&&u(e,["groundingMetadata"],a);const c=l(t,["index"]);c!=null&&u(e,["index"],c);const d=l(t,["logprobsResult"]);d!=null&&u(e,["logprobsResult"],d);const p=l(t,["safetyRatings"]);if(p!=null){let h=p;Array.isArray(h)&&(h=h.map(g=>g)),u(e,["safetyRatings"],h)}const f=l(t,["urlContextMetadata"]);return f!=null&&u(e,["urlContextMetadata"],f),e}function YE(t){const e={},n=l(t,["citationSources"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(o=>o)),u(e,["citations"],i)}return e}function QE(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["contents"]);if(o!=null){let s=pt(o);Array.isArray(s)&&(s=s.map(r=>r)),u(n,["contents"],s)}return n}function XE(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["tokensInfo"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(s=>s)),u(e,["tokensInfo"],o)}return e}function ZE(t){const e={},n=l(t,["values"]);n!=null&&u(e,["values"],n);const i=l(t,["statistics"]);return i!=null&&u(e,["statistics"],ew(i)),e}function ew(t){const e={},n=l(t,["truncated"]);n!=null&&u(e,["truncated"],n);const i=l(t,["token_count"]);return i!=null&&u(e,["tokenCount"],i),e}function qs(t){const e={},n=l(t,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(s=>cC(s))),u(e,["parts"],o)}const i=l(t,["role"]);return i!=null&&u(e,["role"],i),e}function tw(t){const e={},n=l(t,["controlType"]);n!=null&&u(e,["controlType"],n);const i=l(t,["enableControlImageComputation"]);return i!=null&&u(e,["computeControl"],i),e}function nw(t){const e={};if(l(t,["systemInstruction"])!==void 0)throw new Error("systemInstruction parameter is not supported in Gemini API.");if(l(t,["tools"])!==void 0)throw new Error("tools parameter is not supported in Gemini API.");if(l(t,["generationConfig"])!==void 0)throw new Error("generationConfig parameter is not supported in Gemini API.");return e}function iw(t,e){const n={},i=l(t,["systemInstruction"]);e!==void 0&&i!=null&&u(e,["systemInstruction"],Je(i));const o=l(t,["tools"]);if(e!==void 0&&o!=null){let r=o;Array.isArray(r)&&(r=r.map(a=>bm(a))),u(e,["tools"],r)}const s=l(t,["generationConfig"]);return e!==void 0&&s!=null&&u(e,["generationConfig"],Ww(s)),n}function ow(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["contents"]);if(o!=null){let r=pt(o);Array.isArray(r)&&(r=r.map(a=>qs(a))),u(n,["contents"],r)}const s=l(e,["config"]);return s!=null&&nw(s),n}function sw(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["contents"]);if(o!=null){let r=pt(o);Array.isArray(r)&&(r=r.map(a=>a)),u(n,["contents"],r)}const s=l(e,["config"]);return s!=null&&iw(s,n),n}function rw(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["totalTokens"]);i!=null&&u(e,["totalTokens"],i);const o=l(t,["cachedContentTokenCount"]);return o!=null&&u(e,["cachedContentTokenCount"],o),e}function aw(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["totalTokens"]);return i!=null&&u(e,["totalTokens"],i),e}function lw(t,e){const n={},i=l(e,["model"]);return i!=null&&u(n,["_url","name"],Se(t,i)),n}function cw(t,e){const n={},i=l(e,["model"]);return i!=null&&u(n,["_url","name"],Se(t,i)),n}function uw(t){const e={},n=l(t,["sdkHttpResponse"]);return n!=null&&u(e,["sdkHttpResponse"],n),e}function dw(t){const e={},n=l(t,["sdkHttpResponse"]);return n!=null&&u(e,["sdkHttpResponse"],n),e}function pw(t,e){const n={},i=l(t,["outputGcsUri"]);e!==void 0&&i!=null&&u(e,["parameters","storageUri"],i);const o=l(t,["negativePrompt"]);e!==void 0&&o!=null&&u(e,["parameters","negativePrompt"],o);const s=l(t,["numberOfImages"]);e!==void 0&&s!=null&&u(e,["parameters","sampleCount"],s);const r=l(t,["aspectRatio"]);e!==void 0&&r!=null&&u(e,["parameters","aspectRatio"],r);const a=l(t,["guidanceScale"]);e!==void 0&&a!=null&&u(e,["parameters","guidanceScale"],a);const c=l(t,["seed"]);e!==void 0&&c!=null&&u(e,["parameters","seed"],c);const d=l(t,["safetyFilterLevel"]);e!==void 0&&d!=null&&u(e,["parameters","safetySetting"],d);const p=l(t,["personGeneration"]);e!==void 0&&p!=null&&u(e,["parameters","personGeneration"],p);const f=l(t,["includeSafetyAttributes"]);e!==void 0&&f!=null&&u(e,["parameters","includeSafetyAttributes"],f);const h=l(t,["includeRaiReason"]);e!==void 0&&h!=null&&u(e,["parameters","includeRaiReason"],h);const g=l(t,["language"]);e!==void 0&&g!=null&&u(e,["parameters","language"],g);const y=l(t,["outputMimeType"]);e!==void 0&&y!=null&&u(e,["parameters","outputOptions","mimeType"],y);const _=l(t,["outputCompressionQuality"]);e!==void 0&&_!=null&&u(e,["parameters","outputOptions","compressionQuality"],_);const v=l(t,["addWatermark"]);e!==void 0&&v!=null&&u(e,["parameters","addWatermark"],v);const x=l(t,["labels"]);e!==void 0&&x!=null&&u(e,["labels"],x);const E=l(t,["editMode"]);e!==void 0&&E!=null&&u(e,["parameters","editMode"],E);const w=l(t,["baseSteps"]);return e!==void 0&&w!=null&&u(e,["parameters","editConfig","baseSteps"],w),n}function mw(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["prompt"]);o!=null&&u(n,["instances[0]","prompt"],o);const s=l(e,["referenceImages"]);if(s!=null){let a=s;Array.isArray(a)&&(a=a.map(c=>hC(c))),u(n,["instances[0]","referenceImages"],a)}const r=l(e,["config"]);return r!=null&&pw(r,n),n}function fw(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["predictions"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(s=>Us(s))),u(e,["generatedImages"],o)}return e}function hw(t,e){const n={},i=l(t,["taskType"]);e!==void 0&&i!=null&&u(e,["requests[]","taskType"],i);const o=l(t,["title"]);e!==void 0&&o!=null&&u(e,["requests[]","title"],o);const s=l(t,["outputDimensionality"]);if(e!==void 0&&s!=null&&u(e,["requests[]","outputDimensionality"],s),l(t,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(l(t,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return n}function gw(t,e){const n={},i=l(t,["taskType"]);e!==void 0&&i!=null&&u(e,["instances[]","task_type"],i);const o=l(t,["title"]);e!==void 0&&o!=null&&u(e,["instances[]","title"],o);const s=l(t,["outputDimensionality"]);e!==void 0&&s!=null&&u(e,["parameters","outputDimensionality"],s);const r=l(t,["mimeType"]);e!==void 0&&r!=null&&u(e,["instances[]","mimeType"],r);const a=l(t,["autoTruncate"]);return e!==void 0&&a!=null&&u(e,["parameters","autoTruncate"],a),n}function yw(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["contents"]);if(o!=null){let a=wa(t,o);Array.isArray(a)&&(a=a.map(c=>c)),u(n,["requests[]","content"],a)}const s=l(e,["config"]);s!=null&&hw(s,n);const r=l(e,["model"]);return r!==void 0&&u(n,["requests[]","model"],Se(t,r)),n}function vw(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["contents"]);if(o!=null){let r=wa(t,o);Array.isArray(r)&&(r=r.map(a=>a)),u(n,["instances[]","content"],r)}const s=l(e,["config"]);return s!=null&&gw(s,n),n}function bw(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["embeddings"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>r)),u(e,["embeddings"],s)}const o=l(t,["metadata"]);return o!=null&&u(e,["metadata"],o),e}function _w(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["predictions[]","embeddings"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>ZE(r))),u(e,["embeddings"],s)}const o=l(t,["metadata"]);return o!=null&&u(e,["metadata"],o),e}function Nw(t){const e={},n=l(t,["endpoint"]);n!=null&&u(e,["name"],n);const i=l(t,["deployedModelId"]);return i!=null&&u(e,["deployedModelId"],i),e}function xw(t){const e={};if(l(t,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=l(t,["fileUri"]);n!=null&&u(e,["fileUri"],n);const i=l(t,["mimeType"]);return i!=null&&u(e,["mimeType"],i),e}function Sw(t){const e={},n=l(t,["id"]);n!=null&&u(e,["id"],n);const i=l(t,["args"]);i!=null&&u(e,["args"],i);const o=l(t,["name"]);if(o!=null&&u(e,["name"],o),l(t,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(l(t,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}function Ew(t){const e={},n=l(t,["mode"]);n!=null&&u(e,["mode"],n);const i=l(t,["allowedFunctionNames"]);if(i!=null&&u(e,["allowedFunctionNames"],i),l(t,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return e}function ww(t){const e={};if(l(t,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const n=l(t,["description"]);n!=null&&u(e,["description"],n);const i=l(t,["name"]);i!=null&&u(e,["name"],i);const o=l(t,["parameters"]);o!=null&&u(e,["parameters"],o);const s=l(t,["parametersJsonSchema"]);s!=null&&u(e,["parametersJsonSchema"],s);const r=l(t,["response"]);r!=null&&u(e,["response"],r);const a=l(t,["responseJsonSchema"]);return a!=null&&u(e,["responseJsonSchema"],a),e}function Cw(t,e,n){const i={},o=l(e,["systemInstruction"]);n!==void 0&&o!=null&&u(n,["systemInstruction"],qs(Je(o)));const s=l(e,["temperature"]);s!=null&&u(i,["temperature"],s);const r=l(e,["topP"]);r!=null&&u(i,["topP"],r);const a=l(e,["topK"]);a!=null&&u(i,["topK"],a);const c=l(e,["candidateCount"]);c!=null&&u(i,["candidateCount"],c);const d=l(e,["maxOutputTokens"]);d!=null&&u(i,["maxOutputTokens"],d);const p=l(e,["stopSequences"]);p!=null&&u(i,["stopSequences"],p);const f=l(e,["responseLogprobs"]);f!=null&&u(i,["responseLogprobs"],f);const h=l(e,["logprobs"]);h!=null&&u(i,["logprobs"],h);const g=l(e,["presencePenalty"]);g!=null&&u(i,["presencePenalty"],g);const y=l(e,["frequencyPenalty"]);y!=null&&u(i,["frequencyPenalty"],y);const _=l(e,["seed"]);_!=null&&u(i,["seed"],_);const v=l(e,["responseMimeType"]);v!=null&&u(i,["responseMimeType"],v);const x=l(e,["responseSchema"]);x!=null&&u(i,["responseSchema"],Ca(x));const E=l(e,["responseJsonSchema"]);if(E!=null&&u(i,["responseJsonSchema"],E),l(e,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(l(e,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const w=l(e,["safetySettings"]);if(n!==void 0&&w!=null){let L=w;Array.isArray(L)&&(L=L.map(F=>gC(F))),u(n,["safetySettings"],L)}const C=l(e,["tools"]);if(n!==void 0&&C!=null){let L=Ui(C);Array.isArray(L)&&(L=L.map(F=>SC(qi(F)))),u(n,["tools"],L)}const P=l(e,["toolConfig"]);if(n!==void 0&&P!=null&&u(n,["toolConfig"],xC(P)),l(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const k=l(e,["cachedContent"]);n!==void 0&&k!=null&&u(n,["cachedContent"],rn(t,k));const I=l(e,["responseModalities"]);I!=null&&u(i,["responseModalities"],I);const j=l(e,["mediaResolution"]);j!=null&&u(i,["mediaResolution"],j);const A=l(e,["speechConfig"]);if(A!=null&&u(i,["speechConfig"],Da(A)),l(e,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const R=l(e,["thinkingConfig"]);R!=null&&u(i,["thinkingConfig"],R);const q=l(e,["imageConfig"]);q!=null&&u(i,["imageConfig"],Zw(q));const G=l(e,["enableEnhancedCivicAnswers"]);return G!=null&&u(i,["enableEnhancedCivicAnswers"],G),i}function Dw(t,e,n){const i={},o=l(e,["systemInstruction"]);n!==void 0&&o!=null&&u(n,["systemInstruction"],Je(o));const s=l(e,["temperature"]);s!=null&&u(i,["temperature"],s);const r=l(e,["topP"]);r!=null&&u(i,["topP"],r);const a=l(e,["topK"]);a!=null&&u(i,["topK"],a);const c=l(e,["candidateCount"]);c!=null&&u(i,["candidateCount"],c);const d=l(e,["maxOutputTokens"]);d!=null&&u(i,["maxOutputTokens"],d);const p=l(e,["stopSequences"]);p!=null&&u(i,["stopSequences"],p);const f=l(e,["responseLogprobs"]);f!=null&&u(i,["responseLogprobs"],f);const h=l(e,["logprobs"]);h!=null&&u(i,["logprobs"],h);const g=l(e,["presencePenalty"]);g!=null&&u(i,["presencePenalty"],g);const y=l(e,["frequencyPenalty"]);y!=null&&u(i,["frequencyPenalty"],y);const _=l(e,["seed"]);_!=null&&u(i,["seed"],_);const v=l(e,["responseMimeType"]);v!=null&&u(i,["responseMimeType"],v);const x=l(e,["responseSchema"]);x!=null&&u(i,["responseSchema"],Ca(x));const E=l(e,["responseJsonSchema"]);E!=null&&u(i,["responseJsonSchema"],E);const w=l(e,["routingConfig"]);w!=null&&u(i,["routingConfig"],w);const C=l(e,["modelSelectionConfig"]);C!=null&&u(i,["modelConfig"],C);const P=l(e,["safetySettings"]);if(n!==void 0&&P!=null){let $=P;Array.isArray($)&&($=$.map(Q=>Q)),u(n,["safetySettings"],$)}const k=l(e,["tools"]);if(n!==void 0&&k!=null){let $=Ui(k);Array.isArray($)&&($=$.map(Q=>bm(qi(Q)))),u(n,["tools"],$)}const I=l(e,["toolConfig"]);n!==void 0&&I!=null&&u(n,["toolConfig"],I);const j=l(e,["labels"]);n!==void 0&&j!=null&&u(n,["labels"],j);const A=l(e,["cachedContent"]);n!==void 0&&A!=null&&u(n,["cachedContent"],rn(t,A));const R=l(e,["responseModalities"]);R!=null&&u(i,["responseModalities"],R);const q=l(e,["mediaResolution"]);q!=null&&u(i,["mediaResolution"],q);const G=l(e,["speechConfig"]);G!=null&&u(i,["speechConfig"],Da(G));const L=l(e,["audioTimestamp"]);L!=null&&u(i,["audioTimestamp"],L);const F=l(e,["thinkingConfig"]);F!=null&&u(i,["thinkingConfig"],F);const T=l(e,["imageConfig"]);if(T!=null&&u(i,["imageConfig"],eC(T)),l(e,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return i}function uu(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["contents"]);if(o!=null){let r=pt(o);Array.isArray(r)&&(r=r.map(a=>qs(a))),u(n,["contents"],r)}const s=l(e,["config"]);return s!=null&&u(n,["generationConfig"],Cw(t,s,n)),n}function du(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["contents"]);if(o!=null){let r=pt(o);Array.isArray(r)&&(r=r.map(a=>a)),u(n,["contents"],r)}const s=l(e,["config"]);return s!=null&&u(n,["generationConfig"],Dw(t,s,n)),n}function pu(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["candidates"]);if(i!=null){let c=i;Array.isArray(c)&&(c=c.map(d=>zE(d))),u(e,["candidates"],c)}const o=l(t,["modelVersion"]);o!=null&&u(e,["modelVersion"],o);const s=l(t,["promptFeedback"]);s!=null&&u(e,["promptFeedback"],s);const r=l(t,["responseId"]);r!=null&&u(e,["responseId"],r);const a=l(t,["usageMetadata"]);return a!=null&&u(e,["usageMetadata"],a),e}function mu(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["candidates"]);if(i!=null){let d=i;Array.isArray(d)&&(d=d.map(p=>p)),u(e,["candidates"],d)}const o=l(t,["createTime"]);o!=null&&u(e,["createTime"],o);const s=l(t,["modelVersion"]);s!=null&&u(e,["modelVersion"],s);const r=l(t,["promptFeedback"]);r!=null&&u(e,["promptFeedback"],r);const a=l(t,["responseId"]);a!=null&&u(e,["responseId"],a);const c=l(t,["usageMetadata"]);return c!=null&&u(e,["usageMetadata"],c),e}function Tw(t,e){const n={};if(l(t,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(l(t,["negativePrompt"])!==void 0)throw new Error("negativePrompt parameter is not supported in Gemini API.");const i=l(t,["numberOfImages"]);e!==void 0&&i!=null&&u(e,["parameters","sampleCount"],i);const o=l(t,["aspectRatio"]);e!==void 0&&o!=null&&u(e,["parameters","aspectRatio"],o);const s=l(t,["guidanceScale"]);if(e!==void 0&&s!=null&&u(e,["parameters","guidanceScale"],s),l(t,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const r=l(t,["safetyFilterLevel"]);e!==void 0&&r!=null&&u(e,["parameters","safetySetting"],r);const a=l(t,["personGeneration"]);e!==void 0&&a!=null&&u(e,["parameters","personGeneration"],a);const c=l(t,["includeSafetyAttributes"]);e!==void 0&&c!=null&&u(e,["parameters","includeSafetyAttributes"],c);const d=l(t,["includeRaiReason"]);e!==void 0&&d!=null&&u(e,["parameters","includeRaiReason"],d);const p=l(t,["language"]);e!==void 0&&p!=null&&u(e,["parameters","language"],p);const f=l(t,["outputMimeType"]);e!==void 0&&f!=null&&u(e,["parameters","outputOptions","mimeType"],f);const h=l(t,["outputCompressionQuality"]);if(e!==void 0&&h!=null&&u(e,["parameters","outputOptions","compressionQuality"],h),l(t,["addWatermark"])!==void 0)throw new Error("addWatermark parameter is not supported in Gemini API.");if(l(t,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const g=l(t,["imageSize"]);if(e!==void 0&&g!=null&&u(e,["parameters","sampleImageSize"],g),l(t,["enhancePrompt"])!==void 0)throw new Error("enhancePrompt parameter is not supported in Gemini API.");return n}function Aw(t,e){const n={},i=l(t,["outputGcsUri"]);e!==void 0&&i!=null&&u(e,["parameters","storageUri"],i);const o=l(t,["negativePrompt"]);e!==void 0&&o!=null&&u(e,["parameters","negativePrompt"],o);const s=l(t,["numberOfImages"]);e!==void 0&&s!=null&&u(e,["parameters","sampleCount"],s);const r=l(t,["aspectRatio"]);e!==void 0&&r!=null&&u(e,["parameters","aspectRatio"],r);const a=l(t,["guidanceScale"]);e!==void 0&&a!=null&&u(e,["parameters","guidanceScale"],a);const c=l(t,["seed"]);e!==void 0&&c!=null&&u(e,["parameters","seed"],c);const d=l(t,["safetyFilterLevel"]);e!==void 0&&d!=null&&u(e,["parameters","safetySetting"],d);const p=l(t,["personGeneration"]);e!==void 0&&p!=null&&u(e,["parameters","personGeneration"],p);const f=l(t,["includeSafetyAttributes"]);e!==void 0&&f!=null&&u(e,["parameters","includeSafetyAttributes"],f);const h=l(t,["includeRaiReason"]);e!==void 0&&h!=null&&u(e,["parameters","includeRaiReason"],h);const g=l(t,["language"]);e!==void 0&&g!=null&&u(e,["parameters","language"],g);const y=l(t,["outputMimeType"]);e!==void 0&&y!=null&&u(e,["parameters","outputOptions","mimeType"],y);const _=l(t,["outputCompressionQuality"]);e!==void 0&&_!=null&&u(e,["parameters","outputOptions","compressionQuality"],_);const v=l(t,["addWatermark"]);e!==void 0&&v!=null&&u(e,["parameters","addWatermark"],v);const x=l(t,["labels"]);e!==void 0&&x!=null&&u(e,["labels"],x);const E=l(t,["imageSize"]);e!==void 0&&E!=null&&u(e,["parameters","sampleImageSize"],E);const w=l(t,["enhancePrompt"]);return e!==void 0&&w!=null&&u(e,["parameters","enhancePrompt"],w),n}function kw(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["prompt"]);o!=null&&u(n,["instances[0]","prompt"],o);const s=l(e,["config"]);return s!=null&&Tw(s,n),n}function Pw(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["prompt"]);o!=null&&u(n,["instances[0]","prompt"],o);const s=l(e,["config"]);return s!=null&&Aw(s,n),n}function Iw(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["predictions"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>Gw(r))),u(e,["generatedImages"],s)}const o=l(t,["positivePromptSafetyAttributes"]);return o!=null&&u(e,["positivePromptSafetyAttributes"],ym(o)),e}function Rw(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["predictions"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>Us(r))),u(e,["generatedImages"],s)}const o=l(t,["positivePromptSafetyAttributes"]);return o!=null&&u(e,["positivePromptSafetyAttributes"],vm(o)),e}function Mw(t,e){const n={},i=l(t,["numberOfVideos"]);if(e!==void 0&&i!=null&&u(e,["parameters","sampleCount"],i),l(t,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(l(t,["fps"])!==void 0)throw new Error("fps parameter is not supported in Gemini API.");const o=l(t,["durationSeconds"]);if(e!==void 0&&o!=null&&u(e,["parameters","durationSeconds"],o),l(t,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const s=l(t,["aspectRatio"]);e!==void 0&&s!=null&&u(e,["parameters","aspectRatio"],s);const r=l(t,["resolution"]);e!==void 0&&r!=null&&u(e,["parameters","resolution"],r);const a=l(t,["personGeneration"]);if(e!==void 0&&a!=null&&u(e,["parameters","personGeneration"],a),l(t,["pubsubTopic"])!==void 0)throw new Error("pubsubTopic parameter is not supported in Gemini API.");const c=l(t,["negativePrompt"]);e!==void 0&&c!=null&&u(e,["parameters","negativePrompt"],c);const d=l(t,["enhancePrompt"]);if(e!==void 0&&d!=null&&u(e,["parameters","enhancePrompt"],d),l(t,["generateAudio"])!==void 0)throw new Error("generateAudio parameter is not supported in Gemini API.");const p=l(t,["lastFrame"]);e!==void 0&&p!=null&&u(e,["instances[0]","lastFrame"],$s(p));const f=l(t,["referenceImages"]);if(e!==void 0&&f!=null){let h=f;Array.isArray(h)&&(h=h.map(g=>LC(g))),u(e,["instances[0]","referenceImages"],h)}if(l(t,["mask"])!==void 0)throw new Error("mask parameter is not supported in Gemini API.");if(l(t,["compressionQuality"])!==void 0)throw new Error("compressionQuality parameter is not supported in Gemini API.");return n}function Vw(t,e){const n={},i=l(t,["numberOfVideos"]);e!==void 0&&i!=null&&u(e,["parameters","sampleCount"],i);const o=l(t,["outputGcsUri"]);e!==void 0&&o!=null&&u(e,["parameters","storageUri"],o);const s=l(t,["fps"]);e!==void 0&&s!=null&&u(e,["parameters","fps"],s);const r=l(t,["durationSeconds"]);e!==void 0&&r!=null&&u(e,["parameters","durationSeconds"],r);const a=l(t,["seed"]);e!==void 0&&a!=null&&u(e,["parameters","seed"],a);const c=l(t,["aspectRatio"]);e!==void 0&&c!=null&&u(e,["parameters","aspectRatio"],c);const d=l(t,["resolution"]);e!==void 0&&d!=null&&u(e,["parameters","resolution"],d);const p=l(t,["personGeneration"]);e!==void 0&&p!=null&&u(e,["parameters","personGeneration"],p);const f=l(t,["pubsubTopic"]);e!==void 0&&f!=null&&u(e,["parameters","pubsubTopic"],f);const h=l(t,["negativePrompt"]);e!==void 0&&h!=null&&u(e,["parameters","negativePrompt"],h);const g=l(t,["enhancePrompt"]);e!==void 0&&g!=null&&u(e,["parameters","enhancePrompt"],g);const y=l(t,["generateAudio"]);e!==void 0&&y!=null&&u(e,["parameters","generateAudio"],y);const _=l(t,["lastFrame"]);e!==void 0&&_!=null&&u(e,["instances[0]","lastFrame"],wt(_));const v=l(t,["referenceImages"]);if(e!==void 0&&v!=null){let w=v;Array.isArray(w)&&(w=w.map(C=>OC(C))),u(e,["instances[0]","referenceImages"],w)}const x=l(t,["mask"]);e!==void 0&&x!=null&&u(e,["instances[0]","mask"],VC(x));const E=l(t,["compressionQuality"]);return e!==void 0&&E!=null&&u(e,["parameters","compressionQuality"],E),n}function Lw(t){const e={},n=l(t,["name"]);n!=null&&u(e,["name"],n);const i=l(t,["metadata"]);i!=null&&u(e,["metadata"],i);const o=l(t,["done"]);o!=null&&u(e,["done"],o);const s=l(t,["error"]);s!=null&&u(e,["error"],s);const r=l(t,["response","generateVideoResponse"]);return r!=null&&u(e,["response"],qw(r)),e}function Ow(t){const e={},n=l(t,["name"]);n!=null&&u(e,["name"],n);const i=l(t,["metadata"]);i!=null&&u(e,["metadata"],i);const o=l(t,["done"]);o!=null&&u(e,["done"],o);const s=l(t,["error"]);s!=null&&u(e,["error"],s);const r=l(t,["response"]);return r!=null&&u(e,["response"],Uw(r)),e}function jw(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["prompt"]);o!=null&&u(n,["instances[0]","prompt"],o);const s=l(e,["image"]);s!=null&&u(n,["instances[0]","image"],$s(s));const r=l(e,["video"]);r!=null&&u(n,["instances[0]","video"],_m(r));const a=l(e,["source"]);a!=null&&$w(a,n);const c=l(e,["config"]);return c!=null&&Mw(c,n),n}function Fw(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["prompt"]);o!=null&&u(n,["instances[0]","prompt"],o);const s=l(e,["image"]);s!=null&&u(n,["instances[0]","image"],wt(s));const r=l(e,["video"]);r!=null&&u(n,["instances[0]","video"],Nm(r));const a=l(e,["source"]);a!=null&&Bw(a,n);const c=l(e,["config"]);return c!=null&&Vw(c,n),n}function qw(t){const e={},n=l(t,["generatedSamples"]);if(n!=null){let s=n;Array.isArray(s)&&(s=s.map(r=>Kw(r))),u(e,["generatedVideos"],s)}const i=l(t,["raiMediaFilteredCount"]);i!=null&&u(e,["raiMediaFilteredCount"],i);const o=l(t,["raiMediaFilteredReasons"]);return o!=null&&u(e,["raiMediaFilteredReasons"],o),e}function Uw(t){const e={},n=l(t,["videos"]);if(n!=null){let s=n;Array.isArray(s)&&(s=s.map(r=>Jw(r))),u(e,["generatedVideos"],s)}const i=l(t,["raiMediaFilteredCount"]);i!=null&&u(e,["raiMediaFilteredCount"],i);const o=l(t,["raiMediaFilteredReasons"]);return o!=null&&u(e,["raiMediaFilteredReasons"],o),e}function $w(t,e){const n={},i=l(t,["prompt"]);e!==void 0&&i!=null&&u(e,["instances[0]","prompt"],i);const o=l(t,["image"]);e!==void 0&&o!=null&&u(e,["instances[0]","image"],$s(o));const s=l(t,["video"]);return e!==void 0&&s!=null&&u(e,["instances[0]","video"],_m(s)),n}function Bw(t,e){const n={},i=l(t,["prompt"]);e!==void 0&&i!=null&&u(e,["instances[0]","prompt"],i);const o=l(t,["image"]);e!==void 0&&o!=null&&u(e,["instances[0]","image"],wt(o));const s=l(t,["video"]);return e!==void 0&&s!=null&&u(e,["instances[0]","video"],Nm(s)),n}function Gw(t){const e={},n=l(t,["_self"]);n!=null&&u(e,["image"],tC(n));const i=l(t,["raiFilteredReason"]);i!=null&&u(e,["raiFilteredReason"],i);const o=l(t,["_self"]);return o!=null&&u(e,["safetyAttributes"],ym(o)),e}function Us(t){const e={},n=l(t,["_self"]);n!=null&&u(e,["image"],gm(n));const i=l(t,["raiFilteredReason"]);i!=null&&u(e,["raiFilteredReason"],i);const o=l(t,["_self"]);o!=null&&u(e,["safetyAttributes"],vm(o));const s=l(t,["prompt"]);return s!=null&&u(e,["enhancedPrompt"],s),e}function Hw(t){const e={},n=l(t,["_self"]);n!=null&&u(e,["mask"],gm(n));const i=l(t,["labels"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(s=>s)),u(e,["labels"],o)}return e}function Kw(t){const e={},n=l(t,["video"]);return n!=null&&u(e,["video"],RC(n)),e}function Jw(t){const e={},n=l(t,["_self"]);return n!=null&&u(e,["video"],MC(n)),e}function Ww(t){const e={},n=l(t,["modelSelectionConfig"]);n!=null&&u(e,["modelConfig"],n);const i=l(t,["responseJsonSchema"]);i!=null&&u(e,["responseJsonSchema"],i);const o=l(t,["audioTimestamp"]);o!=null&&u(e,["audioTimestamp"],o);const s=l(t,["candidateCount"]);s!=null&&u(e,["candidateCount"],s);const r=l(t,["enableAffectiveDialog"]);r!=null&&u(e,["enableAffectiveDialog"],r);const a=l(t,["frequencyPenalty"]);a!=null&&u(e,["frequencyPenalty"],a);const c=l(t,["logprobs"]);c!=null&&u(e,["logprobs"],c);const d=l(t,["maxOutputTokens"]);d!=null&&u(e,["maxOutputTokens"],d);const p=l(t,["mediaResolution"]);p!=null&&u(e,["mediaResolution"],p);const f=l(t,["presencePenalty"]);f!=null&&u(e,["presencePenalty"],f);const h=l(t,["responseLogprobs"]);h!=null&&u(e,["responseLogprobs"],h);const g=l(t,["responseMimeType"]);g!=null&&u(e,["responseMimeType"],g);const y=l(t,["responseModalities"]);y!=null&&u(e,["responseModalities"],y);const _=l(t,["responseSchema"]);_!=null&&u(e,["responseSchema"],_);const v=l(t,["routingConfig"]);v!=null&&u(e,["routingConfig"],v);const x=l(t,["seed"]);x!=null&&u(e,["seed"],x);const E=l(t,["speechConfig"]);E!=null&&u(e,["speechConfig"],E);const w=l(t,["stopSequences"]);w!=null&&u(e,["stopSequences"],w);const C=l(t,["temperature"]);C!=null&&u(e,["temperature"],C);const P=l(t,["thinkingConfig"]);P!=null&&u(e,["thinkingConfig"],P);const k=l(t,["topK"]);k!=null&&u(e,["topK"],k);const I=l(t,["topP"]);if(I!=null&&u(e,["topP"],I),l(t,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return e}function zw(t,e){const n={},i=l(e,["model"]);return i!=null&&u(n,["_url","name"],Se(t,i)),n}function Yw(t,e){const n={},i=l(e,["model"]);return i!=null&&u(n,["_url","name"],Se(t,i)),n}function Qw(t){const e={};if(l(t,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const n=l(t,["enableWidget"]);return n!=null&&u(e,["enableWidget"],n),e}function Xw(t){const e={};if(l(t,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(l(t,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const n=l(t,["timeRangeFilter"]);return n!=null&&u(e,["timeRangeFilter"],n),e}function Zw(t){const e={},n=l(t,["aspectRatio"]);n!=null&&u(e,["aspectRatio"],n);const i=l(t,["imageSize"]);if(i!=null&&u(e,["imageSize"],i),l(t,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(l(t,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return e}function eC(t){const e={},n=l(t,["aspectRatio"]);n!=null&&u(e,["aspectRatio"],n);const i=l(t,["imageSize"]);i!=null&&u(e,["imageSize"],i);const o=l(t,["outputMimeType"]);o!=null&&u(e,["imageOutputOptions","mimeType"],o);const s=l(t,["outputCompressionQuality"]);return s!=null&&u(e,["imageOutputOptions","compressionQuality"],s),e}function tC(t){const e={},n=l(t,["bytesBase64Encoded"]);n!=null&&u(e,["imageBytes"],Dn(n));const i=l(t,["mimeType"]);return i!=null&&u(e,["mimeType"],i),e}function gm(t){const e={},n=l(t,["gcsUri"]);n!=null&&u(e,["gcsUri"],n);const i=l(t,["bytesBase64Encoded"]);i!=null&&u(e,["imageBytes"],Dn(i));const o=l(t,["mimeType"]);return o!=null&&u(e,["mimeType"],o),e}function $s(t){const e={};if(l(t,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");const n=l(t,["imageBytes"]);n!=null&&u(e,["bytesBase64Encoded"],Dn(n));const i=l(t,["mimeType"]);return i!=null&&u(e,["mimeType"],i),e}function wt(t){const e={},n=l(t,["gcsUri"]);n!=null&&u(e,["gcsUri"],n);const i=l(t,["imageBytes"]);i!=null&&u(e,["bytesBase64Encoded"],Dn(i));const o=l(t,["mimeType"]);return o!=null&&u(e,["mimeType"],o),e}function nC(t,e,n){const i={},o=l(e,["pageSize"]);n!==void 0&&o!=null&&u(n,["_query","pageSize"],o);const s=l(e,["pageToken"]);n!==void 0&&s!=null&&u(n,["_query","pageToken"],s);const r=l(e,["filter"]);n!==void 0&&r!=null&&u(n,["_query","filter"],r);const a=l(e,["queryBase"]);return n!==void 0&&a!=null&&u(n,["_url","models_url"],cm(t,a)),i}function iC(t,e,n){const i={},o=l(e,["pageSize"]);n!==void 0&&o!=null&&u(n,["_query","pageSize"],o);const s=l(e,["pageToken"]);n!==void 0&&s!=null&&u(n,["_query","pageToken"],s);const r=l(e,["filter"]);n!==void 0&&r!=null&&u(n,["_query","filter"],r);const a=l(e,["queryBase"]);return n!==void 0&&a!=null&&u(n,["_url","models_url"],cm(t,a)),i}function oC(t,e){const n={},i=l(e,["config"]);return i!=null&&nC(t,i,n),n}function sC(t,e){const n={},i=l(e,["config"]);return i!=null&&iC(t,i,n),n}function rC(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["nextPageToken"]);i!=null&&u(e,["nextPageToken"],i);const o=l(t,["_self"]);if(o!=null){let s=um(o);Array.isArray(s)&&(s=s.map(r=>Hr(r))),u(e,["models"],s)}return e}function aC(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["nextPageToken"]);i!=null&&u(e,["nextPageToken"],i);const o=l(t,["_self"]);if(o!=null){let s=um(o);Array.isArray(s)&&(s=s.map(r=>Kr(r))),u(e,["models"],s)}return e}function lC(t){const e={},n=l(t,["maskMode"]);n!=null&&u(e,["maskMode"],n);const i=l(t,["segmentationClasses"]);i!=null&&u(e,["maskClasses"],i);const o=l(t,["maskDilation"]);return o!=null&&u(e,["dilation"],o),e}function Hr(t){const e={},n=l(t,["name"]);n!=null&&u(e,["name"],n);const i=l(t,["displayName"]);i!=null&&u(e,["displayName"],i);const o=l(t,["description"]);o!=null&&u(e,["description"],o);const s=l(t,["version"]);s!=null&&u(e,["version"],s);const r=l(t,["_self"]);r!=null&&u(e,["tunedModelInfo"],EC(r));const a=l(t,["inputTokenLimit"]);a!=null&&u(e,["inputTokenLimit"],a);const c=l(t,["outputTokenLimit"]);c!=null&&u(e,["outputTokenLimit"],c);const d=l(t,["supportedGenerationMethods"]);d!=null&&u(e,["supportedActions"],d);const p=l(t,["temperature"]);p!=null&&u(e,["temperature"],p);const f=l(t,["maxTemperature"]);f!=null&&u(e,["maxTemperature"],f);const h=l(t,["topP"]);h!=null&&u(e,["topP"],h);const g=l(t,["topK"]);g!=null&&u(e,["topK"],g);const y=l(t,["thinking"]);return y!=null&&u(e,["thinking"],y),e}function Kr(t){const e={},n=l(t,["name"]);n!=null&&u(e,["name"],n);const i=l(t,["displayName"]);i!=null&&u(e,["displayName"],i);const o=l(t,["description"]);o!=null&&u(e,["description"],o);const s=l(t,["versionId"]);s!=null&&u(e,["version"],s);const r=l(t,["deployedModels"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(h=>Nw(h))),u(e,["endpoints"],f)}const a=l(t,["labels"]);a!=null&&u(e,["labels"],a);const c=l(t,["_self"]);c!=null&&u(e,["tunedModelInfo"],wC(c));const d=l(t,["defaultCheckpointId"]);d!=null&&u(e,["defaultCheckpointId"],d);const p=l(t,["checkpoints"]);if(p!=null){let f=p;Array.isArray(f)&&(f=f.map(h=>h)),u(e,["checkpoints"],f)}return e}function cC(t){const e={},n=l(t,["mediaResolution"]);n!=null&&u(e,["mediaResolution"],n);const i=l(t,["codeExecutionResult"]);i!=null&&u(e,["codeExecutionResult"],i);const o=l(t,["executableCode"]);o!=null&&u(e,["executableCode"],o);const s=l(t,["fileData"]);s!=null&&u(e,["fileData"],xw(s));const r=l(t,["functionCall"]);r!=null&&u(e,["functionCall"],Sw(r));const a=l(t,["functionResponse"]);a!=null&&u(e,["functionResponse"],a);const c=l(t,["inlineData"]);c!=null&&u(e,["inlineData"],WE(c));const d=l(t,["text"]);d!=null&&u(e,["text"],d);const p=l(t,["thought"]);p!=null&&u(e,["thought"],p);const f=l(t,["thoughtSignature"]);f!=null&&u(e,["thoughtSignature"],f);const h=l(t,["videoMetadata"]);return h!=null&&u(e,["videoMetadata"],h),e}function uC(t){const e={},n=l(t,["productImage"]);return n!=null&&u(e,["image"],wt(n)),e}function dC(t,e){const n={},i=l(t,["numberOfImages"]);e!==void 0&&i!=null&&u(e,["parameters","sampleCount"],i);const o=l(t,["baseSteps"]);e!==void 0&&o!=null&&u(e,["parameters","baseSteps"],o);const s=l(t,["outputGcsUri"]);e!==void 0&&s!=null&&u(e,["parameters","storageUri"],s);const r=l(t,["seed"]);e!==void 0&&r!=null&&u(e,["parameters","seed"],r);const a=l(t,["safetyFilterLevel"]);e!==void 0&&a!=null&&u(e,["parameters","safetySetting"],a);const c=l(t,["personGeneration"]);e!==void 0&&c!=null&&u(e,["parameters","personGeneration"],c);const d=l(t,["addWatermark"]);e!==void 0&&d!=null&&u(e,["parameters","addWatermark"],d);const p=l(t,["outputMimeType"]);e!==void 0&&p!=null&&u(e,["parameters","outputOptions","mimeType"],p);const f=l(t,["outputCompressionQuality"]);e!==void 0&&f!=null&&u(e,["parameters","outputOptions","compressionQuality"],f);const h=l(t,["enhancePrompt"]);e!==void 0&&h!=null&&u(e,["parameters","enhancePrompt"],h);const g=l(t,["labels"]);return e!==void 0&&g!=null&&u(e,["labels"],g),n}function pC(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["source"]);o!=null&&fC(o,n);const s=l(e,["config"]);return s!=null&&dC(s,n),n}function mC(t){const e={},n=l(t,["predictions"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(o=>Us(o))),u(e,["generatedImages"],i)}return e}function fC(t,e){const n={},i=l(t,["prompt"]);e!==void 0&&i!=null&&u(e,["instances[0]","prompt"],i);const o=l(t,["personImage"]);e!==void 0&&o!=null&&u(e,["instances[0]","personImage","image"],wt(o));const s=l(t,["productImages"]);if(e!==void 0&&s!=null){let r=s;Array.isArray(r)&&(r=r.map(a=>uC(a))),u(e,["instances[0]","productImages"],r)}return n}function hC(t){const e={},n=l(t,["referenceImage"]);n!=null&&u(e,["referenceImage"],wt(n));const i=l(t,["referenceId"]);i!=null&&u(e,["referenceId"],i);const o=l(t,["referenceType"]);o!=null&&u(e,["referenceType"],o);const s=l(t,["maskImageConfig"]);s!=null&&u(e,["maskImageConfig"],lC(s));const r=l(t,["controlImageConfig"]);r!=null&&u(e,["controlImageConfig"],tw(r));const a=l(t,["styleImageConfig"]);a!=null&&u(e,["styleImageConfig"],a);const c=l(t,["subjectImageConfig"]);return c!=null&&u(e,["subjectImageConfig"],c),e}function ym(t){const e={},n=l(t,["safetyAttributes","categories"]);n!=null&&u(e,["categories"],n);const i=l(t,["safetyAttributes","scores"]);i!=null&&u(e,["scores"],i);const o=l(t,["contentType"]);return o!=null&&u(e,["contentType"],o),e}function vm(t){const e={},n=l(t,["safetyAttributes","categories"]);n!=null&&u(e,["categories"],n);const i=l(t,["safetyAttributes","scores"]);i!=null&&u(e,["scores"],i);const o=l(t,["contentType"]);return o!=null&&u(e,["contentType"],o),e}function gC(t){const e={},n=l(t,["category"]);if(n!=null&&u(e,["category"],n),l(t,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const i=l(t,["threshold"]);return i!=null&&u(e,["threshold"],i),e}function yC(t){const e={},n=l(t,["image"]);return n!=null&&u(e,["image"],wt(n)),e}function vC(t,e){const n={},i=l(t,["mode"]);e!==void 0&&i!=null&&u(e,["parameters","mode"],i);const o=l(t,["maxPredictions"]);e!==void 0&&o!=null&&u(e,["parameters","maxPredictions"],o);const s=l(t,["confidenceThreshold"]);e!==void 0&&s!=null&&u(e,["parameters","confidenceThreshold"],s);const r=l(t,["maskDilation"]);e!==void 0&&r!=null&&u(e,["parameters","maskDilation"],r);const a=l(t,["binaryColorThreshold"]);e!==void 0&&a!=null&&u(e,["parameters","binaryColorThreshold"],a);const c=l(t,["labels"]);return e!==void 0&&c!=null&&u(e,["labels"],c),n}function bC(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["source"]);o!=null&&NC(o,n);const s=l(e,["config"]);return s!=null&&vC(s,n),n}function _C(t){const e={},n=l(t,["predictions"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(o=>Hw(o))),u(e,["generatedMasks"],i)}return e}function NC(t,e){const n={},i=l(t,["prompt"]);e!==void 0&&i!=null&&u(e,["instances[0]","prompt"],i);const o=l(t,["image"]);e!==void 0&&o!=null&&u(e,["instances[0]","image"],wt(o));const s=l(t,["scribbleImage"]);return e!==void 0&&s!=null&&u(e,["instances[0]","scribble"],yC(s)),n}function xC(t){const e={},n=l(t,["functionCallingConfig"]);n!=null&&u(e,["functionCallingConfig"],Ew(n));const i=l(t,["retrievalConfig"]);return i!=null&&u(e,["retrievalConfig"],i),e}function SC(t){const e={},n=l(t,["functionDeclarations"]);if(n!=null){let p=n;Array.isArray(p)&&(p=p.map(f=>f)),u(e,["functionDeclarations"],p)}if(l(t,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const i=l(t,["googleSearchRetrieval"]);i!=null&&u(e,["googleSearchRetrieval"],i);const o=l(t,["computerUse"]);o!=null&&u(e,["computerUse"],o);const s=l(t,["fileSearch"]);s!=null&&u(e,["fileSearch"],s);const r=l(t,["codeExecution"]);if(r!=null&&u(e,["codeExecution"],r),l(t,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const a=l(t,["googleMaps"]);a!=null&&u(e,["googleMaps"],Qw(a));const c=l(t,["googleSearch"]);c!=null&&u(e,["googleSearch"],Xw(c));const d=l(t,["urlContext"]);return d!=null&&u(e,["urlContext"],d),e}function bm(t){const e={},n=l(t,["functionDeclarations"]);if(n!=null){let f=n;Array.isArray(f)&&(f=f.map(h=>ww(h))),u(e,["functionDeclarations"],f)}const i=l(t,["retrieval"]);i!=null&&u(e,["retrieval"],i);const o=l(t,["googleSearchRetrieval"]);o!=null&&u(e,["googleSearchRetrieval"],o);const s=l(t,["computerUse"]);if(s!=null&&u(e,["computerUse"],s),l(t,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const r=l(t,["codeExecution"]);r!=null&&u(e,["codeExecution"],r);const a=l(t,["enterpriseWebSearch"]);a!=null&&u(e,["enterpriseWebSearch"],a);const c=l(t,["googleMaps"]);c!=null&&u(e,["googleMaps"],c);const d=l(t,["googleSearch"]);d!=null&&u(e,["googleSearch"],d);const p=l(t,["urlContext"]);return p!=null&&u(e,["urlContext"],p),e}function EC(t){const e={},n=l(t,["baseModel"]);n!=null&&u(e,["baseModel"],n);const i=l(t,["createTime"]);i!=null&&u(e,["createTime"],i);const o=l(t,["updateTime"]);return o!=null&&u(e,["updateTime"],o),e}function wC(t){const e={},n=l(t,["labels","google-vertex-llm-tuning-base-model-id"]);n!=null&&u(e,["baseModel"],n);const i=l(t,["createTime"]);i!=null&&u(e,["createTime"],i);const o=l(t,["updateTime"]);return o!=null&&u(e,["updateTime"],o),e}function CC(t,e){const n={},i=l(t,["displayName"]);e!==void 0&&i!=null&&u(e,["displayName"],i);const o=l(t,["description"]);e!==void 0&&o!=null&&u(e,["description"],o);const s=l(t,["defaultCheckpointId"]);return e!==void 0&&s!=null&&u(e,["defaultCheckpointId"],s),n}function DC(t,e){const n={},i=l(t,["displayName"]);e!==void 0&&i!=null&&u(e,["displayName"],i);const o=l(t,["description"]);e!==void 0&&o!=null&&u(e,["description"],o);const s=l(t,["defaultCheckpointId"]);return e!==void 0&&s!=null&&u(e,["defaultCheckpointId"],s),n}function TC(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","name"],Se(t,i));const o=l(e,["config"]);return o!=null&&CC(o,n),n}function AC(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["config"]);return o!=null&&DC(o,n),n}function kC(t,e){const n={},i=l(t,["outputGcsUri"]);e!==void 0&&i!=null&&u(e,["parameters","storageUri"],i);const o=l(t,["safetyFilterLevel"]);e!==void 0&&o!=null&&u(e,["parameters","safetySetting"],o);const s=l(t,["personGeneration"]);e!==void 0&&s!=null&&u(e,["parameters","personGeneration"],s);const r=l(t,["includeRaiReason"]);e!==void 0&&r!=null&&u(e,["parameters","includeRaiReason"],r);const a=l(t,["outputMimeType"]);e!==void 0&&a!=null&&u(e,["parameters","outputOptions","mimeType"],a);const c=l(t,["outputCompressionQuality"]);e!==void 0&&c!=null&&u(e,["parameters","outputOptions","compressionQuality"],c);const d=l(t,["enhanceInputImage"]);e!==void 0&&d!=null&&u(e,["parameters","upscaleConfig","enhanceInputImage"],d);const p=l(t,["imagePreservationFactor"]);e!==void 0&&p!=null&&u(e,["parameters","upscaleConfig","imagePreservationFactor"],p);const f=l(t,["labels"]);e!==void 0&&f!=null&&u(e,["labels"],f);const h=l(t,["numberOfImages"]);e!==void 0&&h!=null&&u(e,["parameters","sampleCount"],h);const g=l(t,["mode"]);return e!==void 0&&g!=null&&u(e,["parameters","mode"],g),n}function PC(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["_url","model"],Se(t,i));const o=l(e,["image"]);o!=null&&u(n,["instances[0]","image"],wt(o));const s=l(e,["upscaleFactor"]);s!=null&&u(n,["parameters","upscaleConfig","upscaleFactor"],s);const r=l(e,["config"]);return r!=null&&kC(r,n),n}function IC(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["predictions"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(s=>Us(s))),u(e,["generatedImages"],o)}return e}function RC(t){const e={},n=l(t,["uri"]);n!=null&&u(e,["uri"],n);const i=l(t,["encodedVideo"]);i!=null&&u(e,["videoBytes"],Dn(i));const o=l(t,["encoding"]);return o!=null&&u(e,["mimeType"],o),e}function MC(t){const e={},n=l(t,["gcsUri"]);n!=null&&u(e,["uri"],n);const i=l(t,["bytesBase64Encoded"]);i!=null&&u(e,["videoBytes"],Dn(i));const o=l(t,["mimeType"]);return o!=null&&u(e,["mimeType"],o),e}function VC(t){const e={},n=l(t,["image"]);n!=null&&u(e,["_self"],wt(n));const i=l(t,["maskMode"]);return i!=null&&u(e,["maskMode"],i),e}function LC(t){const e={},n=l(t,["image"]);n!=null&&u(e,["image"],$s(n));const i=l(t,["referenceType"]);return i!=null&&u(e,["referenceType"],i),e}function OC(t){const e={},n=l(t,["image"]);n!=null&&u(e,["image"],wt(n));const i=l(t,["referenceType"]);return i!=null&&u(e,["referenceType"],i),e}function _m(t){const e={},n=l(t,["uri"]);n!=null&&u(e,["uri"],n);const i=l(t,["videoBytes"]);i!=null&&u(e,["encodedVideo"],Dn(i));const o=l(t,["mimeType"]);return o!=null&&u(e,["encoding"],o),e}function Nm(t){const e={},n=l(t,["uri"]);n!=null&&u(e,["gcsUri"],n);const i=l(t,["videoBytes"]);i!=null&&u(e,["bytesBase64Encoded"],Dn(i));const o=l(t,["mimeType"]);return o!=null&&u(e,["mimeType"],o),e}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function jC(t,e){const n={},i=l(t,["displayName"]);return e!==void 0&&i!=null&&u(e,["displayName"],i),n}function FC(t){const e={},n=l(t,["config"]);return n!=null&&jC(n,e),e}function qC(t,e){const n={},i=l(t,["force"]);return e!==void 0&&i!=null&&u(e,["_query","force"],i),n}function UC(t){const e={},n=l(t,["name"]);n!=null&&u(e,["_url","name"],n);const i=l(t,["config"]);return i!=null&&qC(i,e),e}function $C(t){const e={},n=l(t,["name"]);return n!=null&&u(e,["_url","name"],n),e}function BC(t,e){const n={},i=l(t,["customMetadata"]);if(e!==void 0&&i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>r)),u(e,["customMetadata"],s)}const o=l(t,["chunkingConfig"]);return e!==void 0&&o!=null&&u(e,["chunkingConfig"],o),n}function GC(t){const e={},n=l(t,["name"]);n!=null&&u(e,["name"],n);const i=l(t,["metadata"]);i!=null&&u(e,["metadata"],i);const o=l(t,["done"]);o!=null&&u(e,["done"],o);const s=l(t,["error"]);s!=null&&u(e,["error"],s);const r=l(t,["response"]);return r!=null&&u(e,["response"],KC(r)),e}function HC(t){const e={},n=l(t,["fileSearchStoreName"]);n!=null&&u(e,["_url","file_search_store_name"],n);const i=l(t,["fileName"]);i!=null&&u(e,["fileName"],i);const o=l(t,["config"]);return o!=null&&BC(o,e),e}function KC(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["parent"]);i!=null&&u(e,["parent"],i);const o=l(t,["documentName"]);return o!=null&&u(e,["documentName"],o),e}function JC(t,e){const n={},i=l(t,["pageSize"]);e!==void 0&&i!=null&&u(e,["_query","pageSize"],i);const o=l(t,["pageToken"]);return e!==void 0&&o!=null&&u(e,["_query","pageToken"],o),n}function WC(t){const e={},n=l(t,["config"]);return n!=null&&JC(n,e),e}function zC(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["nextPageToken"]);i!=null&&u(e,["nextPageToken"],i);const o=l(t,["fileSearchStores"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>r)),u(e,["fileSearchStores"],s)}return e}function xm(t,e){const n={},i=l(t,["mimeType"]);e!==void 0&&i!=null&&u(e,["mimeType"],i);const o=l(t,["displayName"]);e!==void 0&&o!=null&&u(e,["displayName"],o);const s=l(t,["customMetadata"]);if(e!==void 0&&s!=null){let a=s;Array.isArray(a)&&(a=a.map(c=>c)),u(e,["customMetadata"],a)}const r=l(t,["chunkingConfig"]);return e!==void 0&&r!=null&&u(e,["chunkingConfig"],r),n}function YC(t){const e={},n=l(t,["fileSearchStoreName"]);n!=null&&u(e,["_url","file_search_store_name"],n);const i=l(t,["config"]);return i!=null&&xm(i,e),e}function QC(t){const e={},n=l(t,["sdkHttpResponse"]);return n!=null&&u(e,["sdkHttpResponse"],n),e}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */const XC="Content-Type",ZC="X-Server-Timeout",eD="User-Agent",Jr="x-goog-api-client",tD="1.34.0",nD=`google-genai-sdk/${tD}`,iD="v1beta1",oD="v1beta";class sD{constructor(e){var n,i;this.clientOptions=Object.assign(Object.assign({},e),{project:e.project,location:e.location,apiKey:e.apiKey,vertexai:e.vertexai});const o={};this.clientOptions.vertexai?(o.apiVersion=(n=this.clientOptions.apiVersion)!==null&&n!==void 0?n:iD,o.baseUrl=this.baseUrlFromProjectLocation(),this.normalizeAuthParameters()):(o.apiVersion=(i=this.clientOptions.apiVersion)!==null&&i!==void 0?i:oD,o.baseUrl="https://generativelanguage.googleapis.com/"),o.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=o,e.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(o,e.httpOptions))}baseUrlFromProjectLocation(){return this.clientOptions.project&&this.clientOptions.location&&this.clientOptions.location!=="global"?`https://${this.clientOptions.location}-aiplatform.googleapis.com/`:"https://aiplatform.googleapis.com/"}normalizeAuthParameters(){if(this.clientOptions.project&&this.clientOptions.location){this.clientOptions.apiKey=void 0;return}this.clientOptions.project=void 0,this.clientOptions.location=void 0}isVertexAI(){var e;return(e=this.clientOptions.vertexai)!==null&&e!==void 0?e:!1}getProject(){return this.clientOptions.project}getLocation(){return this.clientOptions.location}async getAuthHeaders(){const e=new Headers;return await this.clientOptions.auth.addAuthHeaders(e),e}getApiVersion(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.apiVersion!==void 0)return this.clientOptions.httpOptions.apiVersion;throw new Error("API version is not set.")}getBaseUrl(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.baseUrl!==void 0)return this.clientOptions.httpOptions.baseUrl;throw new Error("Base URL is not set.")}getRequestUrl(){return this.getRequestUrlInternal(this.clientOptions.httpOptions)}getHeaders(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.headers!==void 0)return this.clientOptions.httpOptions.headers;throw new Error("Headers are not set.")}getRequestUrlInternal(e){if(!e||e.baseUrl===void 0||e.apiVersion===void 0)throw new Error("HTTP options are not correctly set.");const i=[e.baseUrl.endsWith("/")?e.baseUrl.slice(0,-1):e.baseUrl];return e.apiVersion&&e.apiVersion!==""&&i.push(e.apiVersion),i.join("/")}getBaseResourcePath(){return`projects/${this.clientOptions.project}/locations/${this.clientOptions.location}`}getApiKey(){return this.clientOptions.apiKey}getWebsocketBaseUrl(){const e=this.getBaseUrl(),n=new URL(e);return n.protocol=n.protocol=="http:"?"ws":"wss",n.toString()}setBaseUrl(e){if(this.clientOptions.httpOptions)this.clientOptions.httpOptions.baseUrl=e;else throw new Error("HTTP options are not correctly set.")}constructUrl(e,n,i){const o=[this.getRequestUrlInternal(n)];return i&&o.push(this.getBaseResourcePath()),e!==""&&o.push(e),new URL(`${o.join("/")}`)}shouldPrependVertexProjectPath(e){return!(this.clientOptions.apiKey||!this.clientOptions.vertexai||e.path.startsWith("projects/")||e.httpMethod==="GET"&&e.path.startsWith("publishers/google/models"))}async request(e){let n=this.clientOptions.httpOptions;e.httpOptions&&(n=this.patchHttpOptions(this.clientOptions.httpOptions,e.httpOptions));const i=this.shouldPrependVertexProjectPath(e),o=this.constructUrl(e.path,n,i);if(e.queryParams)for(const[r,a]of Object.entries(e.queryParams))o.searchParams.append(r,String(a));let s={};if(e.httpMethod==="GET"){if(e.body&&e.body!=="{}")throw new Error("Request body should be empty for GET request, but got non empty request body")}else s.body=e.body;return s=await this.includeExtraHttpOptionsToRequestInit(s,n,o.toString(),e.abortSignal),this.unaryApiCall(o,s,e.httpMethod)}patchHttpOptions(e,n){const i=JSON.parse(JSON.stringify(e));for(const[o,s]of Object.entries(n))typeof s=="object"?i[o]=Object.assign(Object.assign({},i[o]),s):s!==void 0&&(i[o]=s);return i}async requestStream(e){let n=this.clientOptions.httpOptions;e.httpOptions&&(n=this.patchHttpOptions(this.clientOptions.httpOptions,e.httpOptions));const i=this.shouldPrependVertexProjectPath(e),o=this.constructUrl(e.path,n,i);(!o.searchParams.has("alt")||o.searchParams.get("alt")!=="sse")&&o.searchParams.set("alt","sse");let s={};return s.body=e.body,s=await this.includeExtraHttpOptionsToRequestInit(s,n,o.toString(),e.abortSignal),this.streamApiCall(o,s,e.httpMethod)}async includeExtraHttpOptionsToRequestInit(e,n,i,o){if(n&&n.timeout||o){const s=new AbortController,r=s.signal;if(n.timeout&&(n==null?void 0:n.timeout)>0){const a=setTimeout(()=>s.abort(),n.timeout);a&&typeof a.unref=="function"&&a.unref()}o&&o.addEventListener("abort",()=>{s.abort()}),e.signal=r}return n&&n.extraBody!==null&&rD(e,n.extraBody),e.headers=await this.getHeadersInternal(n,i),e}async unaryApiCall(e,n,i){return this.apiCall(e.toString(),Object.assign(Object.assign({},n),{method:i})).then(async o=>(await fu(o),new $r(o))).catch(o=>{throw o instanceof Error?o:new Error(JSON.stringify(o))})}async streamApiCall(e,n,i){return this.apiCall(e.toString(),Object.assign(Object.assign({},n),{method:i})).then(async o=>(await fu(o),this.processStreamResponse(o))).catch(o=>{throw o instanceof Error?o:new Error(JSON.stringify(o))})}processStreamResponse(e){return xt(this,arguments,function*(){var i;const o=(i=e==null?void 0:e.body)===null||i===void 0?void 0:i.getReader(),s=new TextDecoder("utf-8");if(!o)throw new Error("Response body is empty");try{let r="";const a="data:",c=[`

`,"\r\r",`\r
\r
`];for(;;){const{done:d,value:p}=yield pe(o.read());if(d){if(r.trim().length>0)throw new Error("Incomplete JSON segment at the end");break}const f=s.decode(p,{stream:!0});try{const y=JSON.parse(f);if("error"in y){const _=JSON.parse(JSON.stringify(y.error)),v=_.status,x=_.code,E=`got status: ${v}. ${JSON.stringify(y)}`;if(x>=400&&x<600)throw new Fs({message:E,status:x})}}catch(y){if(y.name==="ApiError")throw y}r+=f;let h=-1,g=0;for(;;){h=-1,g=0;for(const v of c){const x=r.indexOf(v);x!==-1&&(h===-1||x<h)&&(h=x,g=v.length)}if(h===-1)break;const y=r.substring(0,h);r=r.substring(h+g);const _=y.trim();if(_.startsWith(a)){const v=_.substring(a.length).trim();try{const x=new Response(v,{headers:e==null?void 0:e.headers,status:e==null?void 0:e.status,statusText:e==null?void 0:e.statusText});yield yield pe(new $r(x))}catch(x){throw new Error(`exception parsing stream chunk ${v}. ${x}`)}}}}}finally{o.releaseLock()}})}async apiCall(e,n){return fetch(e,n).catch(i=>{throw new Error(`exception ${i} sending request`)})}getDefaultHeaders(){const e={},n=nD+" "+this.clientOptions.userAgentExtra;return e[eD]=n,e[Jr]=n,e[XC]="application/json",e}async getHeadersInternal(e,n){const i=new Headers;if(e&&e.headers){for(const[o,s]of Object.entries(e.headers))i.append(o,s);e.timeout&&e.timeout>0&&i.append(ZC,String(Math.ceil(e.timeout/1e3)))}return await this.clientOptions.auth.addAuthHeaders(i,n),i}getFileName(e){var n;let i="";return typeof e=="string"&&(i=e.replace(/[/\\]+$/,""),i=(n=i.split(/[/\\]/).pop())!==null&&n!==void 0?n:""),i}async uploadFile(e,n){var i;const o={};n!=null&&(o.mimeType=n.mimeType,o.name=n.name,o.displayName=n.displayName),o.name&&!o.name.startsWith("files/")&&(o.name=`files/${o.name}`);const s=this.clientOptions.uploader,r=await s.stat(e);o.sizeBytes=String(r.size);const a=(i=n==null?void 0:n.mimeType)!==null&&i!==void 0?i:r.type;if(a===void 0||a==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");o.mimeType=a;const c={file:o},d=this.getFileName(e),p=z("upload/v1beta/files",c._url),f=await this.fetchUploadUrl(p,o.sizeBytes,o.mimeType,d,c,n==null?void 0:n.httpOptions);return s.upload(e,f,this)}async uploadFileToFileSearchStore(e,n,i){var o;const s=this.clientOptions.uploader,r=await s.stat(n),a=String(r.size),c=(o=i==null?void 0:i.mimeType)!==null&&o!==void 0?o:r.type;if(c===void 0||c==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");const d=`upload/v1beta/${e}:uploadToFileSearchStore`,p=this.getFileName(n),f={};i!=null&&xm(i,f);const h=await this.fetchUploadUrl(d,a,c,p,f,i==null?void 0:i.httpOptions);return s.uploadToFileSearchStore(n,h,this)}async downloadFile(e){await this.clientOptions.downloader.download(e,this)}async fetchUploadUrl(e,n,i,o,s,r){var a;let c={};r?c=r:c={apiVersion:"",headers:Object.assign({"Content-Type":"application/json","X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${n}`,"X-Goog-Upload-Header-Content-Type":`${i}`},o?{"X-Goog-Upload-File-Name":o}:{})};const d=await this.request({path:e,body:JSON.stringify(s),httpMethod:"POST",httpOptions:c});if(!d||!(d!=null&&d.headers))throw new Error("Server did not return an HttpResponse or the returned HttpResponse did not have headers.");const p=(a=d==null?void 0:d.headers)===null||a===void 0?void 0:a["x-goog-upload-url"];if(p===void 0)throw new Error("Failed to get upload url. Server did not return the x-google-upload-url in the headers");return p}}async function fu(t){var e;if(t===void 0)throw new Error("response is undefined");if(!t.ok){const n=t.status;let i;!((e=t.headers.get("content-type"))===null||e===void 0)&&e.includes("application/json")?i=await t.json():i={error:{message:await t.text(),code:t.status,status:t.statusText}};const o=JSON.stringify(i);throw n>=400&&n<600?new Fs({message:o,status:n}):new Error(o)}}function rD(t,e){if(!e||Object.keys(e).length===0)return;if(t.body instanceof Blob){console.warn("includeExtraBodyToRequestInit: extraBody provided but current request body is a Blob. extraBody will be ignored as merging is not supported for Blob bodies.");return}let n={};if(typeof t.body=="string"&&t.body.length>0)try{const s=JSON.parse(t.body);if(typeof s=="object"&&s!==null&&!Array.isArray(s))n=s;else{console.warn("includeExtraBodyToRequestInit: Original request body is valid JSON but not a non-array object. Skip applying extraBody to the request body.");return}}catch{console.warn("includeExtraBodyToRequestInit: Original request body is not valid JSON. Skip applying extraBody to the request body.");return}function i(s,r){const a=Object.assign({},s);for(const c in r)if(Object.prototype.hasOwnProperty.call(r,c)){const d=r[c],p=a[c];d&&typeof d=="object"&&!Array.isArray(d)&&p&&typeof p=="object"&&!Array.isArray(p)?a[c]=i(p,d):(p&&d&&typeof p!=typeof d&&console.warn(`includeExtraBodyToRequestInit:deepMerge: Type mismatch for key "${c}". Original type: ${typeof p}, New type: ${typeof d}. Overwriting.`),a[c]=d)}return a}const o=i(n,e);t.body=JSON.stringify(o)}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */const aD="mcp_used/unknown";let lD=!1;function Sm(t){for(const e of t)if(cD(e)||typeof e=="object"&&"inputSchema"in e)return!0;return lD}function Em(t){var e;const n=(e=t[Jr])!==null&&e!==void 0?e:"";t[Jr]=(n+` ${aD}`).trimStart()}function cD(t){return t!==null&&typeof t=="object"&&t instanceof Aa}function uD(t){return xt(this,arguments,function*(n,i=100){let o,s=0;for(;s<i;){const r=yield pe(n.listTools({cursor:o}));for(const a of r.tools)yield yield pe(a),s++;if(!r.nextCursor)break;o=r.nextCursor}})}class Aa{constructor(e=[],n){this.mcpTools=[],this.functionNameToMcpClient={},this.mcpClients=e,this.config=n}static create(e,n){return new Aa(e,n)}async initialize(){var e,n,i,o;if(this.mcpTools.length>0)return;const s={},r=[];for(const p of this.mcpClients)try{for(var a=!0,c=(n=void 0,St(uD(p))),d;d=await c.next(),e=d.done,!e;a=!0){o=d.value,a=!1;const f=o;r.push(f);const h=f.name;if(s[h])throw new Error(`Duplicate function name ${h} found in MCP tools. Please ensure function names are unique.`);s[h]=p}}catch(f){n={error:f}}finally{try{!a&&!e&&(i=c.return)&&await i.call(c)}finally{if(n)throw n.error}}this.mcpTools=r,this.functionNameToMcpClient=s}async tool(){return await this.initialize(),$x(this.mcpTools,this.config)}async callTool(e){await this.initialize();const n=[];for(const i of e)if(i.name in this.functionNameToMcpClient){const o=this.functionNameToMcpClient[i.name];let s;this.config.timeout&&(s={timeout:this.config.timeout});const r=await o.callTool({name:i.name,arguments:i.args},void 0,s);n.push({functionResponse:{name:i.name,response:r.isError?{error:r}:r}})}return n}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */async function dD(t,e,n){const i=new Mx;let o;n.data instanceof Blob?o=JSON.parse(await n.data.text()):o=JSON.parse(n.data),Object.assign(i,o),e(i)}class pD{constructor(e,n,i){this.apiClient=e,this.auth=n,this.webSocketFactory=i}async connect(e){var n,i;if(this.apiClient.isVertexAI())throw new Error("Live music is not supported for Vertex AI.");console.warn("Live music generation is experimental and may change in future versions.");const o=this.apiClient.getWebsocketBaseUrl(),s=this.apiClient.getApiVersion(),r=hD(this.apiClient.getDefaultHeaders()),a=this.apiClient.getApiKey(),c=`${o}/ws/google.ai.generativelanguage.${s}.GenerativeService.BidiGenerateMusic?key=${a}`;let d=()=>{};const p=new Promise(w=>{d=w}),f=e.callbacks,h=function(){d({})},g=this.apiClient,y={onopen:h,onmessage:w=>{dD(g,f.onmessage,w)},onerror:(n=f==null?void 0:f.onerror)!==null&&n!==void 0?n:function(w){},onclose:(i=f==null?void 0:f.onclose)!==null&&i!==void 0?i:function(w){}},_=this.webSocketFactory.create(c,fD(r),y);_.connect(),await p;const E={setup:{model:Se(this.apiClient,e.model)}};return _.send(JSON.stringify(E)),new mD(_,this.apiClient)}}class mD{constructor(e,n){this.conn=e,this.apiClient=n}async setWeightedPrompts(e){if(!e.weightedPrompts||Object.keys(e.weightedPrompts).length===0)throw new Error("Weighted prompts must be set and contain at least one entry.");const n=FE(e);this.conn.send(JSON.stringify({clientContent:n}))}async setMusicGenerationConfig(e){e.musicGenerationConfig||(e.musicGenerationConfig={});const n=jE(e);this.conn.send(JSON.stringify(n))}sendPlaybackControl(e){const n={playbackControl:e};this.conn.send(JSON.stringify(n))}play(){this.sendPlaybackControl(_i.PLAY)}pause(){this.sendPlaybackControl(_i.PAUSE)}stop(){this.sendPlaybackControl(_i.STOP)}resetContext(){this.sendPlaybackControl(_i.RESET_CONTEXT)}close(){this.conn.close()}}function fD(t){const e={};return t.forEach((n,i)=>{e[i]=n}),e}function hD(t){const e=new Headers;for(const[n,i]of Object.entries(t))e.append(n,i);return e}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */const gD="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function yD(t,e,n){const i=new Rx;let o;n.data instanceof Blob?o=await n.data.text():n.data instanceof ArrayBuffer?o=new TextDecoder().decode(n.data):o=n.data;const s=JSON.parse(o);if(t.isVertexAI()){const r=$E(s);Object.assign(i,r)}else Object.assign(i,s);e(i)}class vD{constructor(e,n,i){this.apiClient=e,this.auth=n,this.webSocketFactory=i,this.music=new pD(this.apiClient,this.auth,this.webSocketFactory)}async connect(e){var n,i,o,s,r,a;if(e.config&&e.config.httpOptions)throw new Error("The Live module does not support httpOptions at request-level in LiveConnectConfig yet. Please use the client-level httpOptions configuration instead.");const c=this.apiClient.getWebsocketBaseUrl(),d=this.apiClient.getApiVersion();let p;const f=this.apiClient.getHeaders();e.config&&e.config.tools&&Sm(e.config.tools)&&Em(f);const h=xD(f);if(this.apiClient.isVertexAI())p=`${c}/ws/google.cloud.aiplatform.${d}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(h,p);else{const A=this.apiClient.getApiKey();let R="BidiGenerateContent",q="key";A!=null&&A.startsWith("auth_tokens/")&&(console.warn("Warning: Ephemeral token support is experimental and may change in future versions."),d!=="v1alpha"&&console.warn("Warning: The SDK's ephemeral token support is in v1alpha only. Please use const ai = new GoogleGenAI({apiKey: token.name, httpOptions: { apiVersion: 'v1alpha' }}); before session connection."),R="BidiGenerateContentConstrained",q="access_token"),p=`${c}/ws/google.ai.generativelanguage.${d}.GenerativeService.${R}?${q}=${A}`}let g=()=>{};const y=new Promise(A=>{g=A}),_=e.callbacks,v=function(){var A;(A=_==null?void 0:_.onopen)===null||A===void 0||A.call(_),g({})},x=this.apiClient,E={onopen:v,onmessage:A=>{yD(x,_.onmessage,A)},onerror:(n=_==null?void 0:_.onerror)!==null&&n!==void 0?n:function(A){},onclose:(i=_==null?void 0:_.onclose)!==null&&i!==void 0?i:function(A){}},w=this.webSocketFactory.create(p,ND(h),E);w.connect(),await y;let C=Se(this.apiClient,e.model);if(this.apiClient.isVertexAI()&&C.startsWith("publishers/")){const A=this.apiClient.getProject(),R=this.apiClient.getLocation();C=`projects/${A}/locations/${R}/`+C}let P={};this.apiClient.isVertexAI()&&((o=e.config)===null||o===void 0?void 0:o.responseModalities)===void 0&&(e.config===void 0?e.config={responseModalities:[ss.AUDIO]}:e.config.responseModalities=[ss.AUDIO]),!((s=e.config)===null||s===void 0)&&s.generationConfig&&console.warn("Setting `LiveConnectConfig.generation_config` is deprecated, please set the fields on `LiveConnectConfig` directly. This will become an error in a future version (not before Q3 2025).");const k=(a=(r=e.config)===null||r===void 0?void 0:r.tools)!==null&&a!==void 0?a:[],I=[];for(const A of k)if(this.isCallableTool(A)){const R=A;I.push(await R.tool())}else I.push(A);I.length>0&&(e.config.tools=I);const j={model:C,config:e.config,callbacks:e.callbacks};return this.apiClient.isVertexAI()?P=OE(this.apiClient,j):P=LE(this.apiClient,j),delete P.config,w.send(JSON.stringify(P)),new _D(w,this.apiClient)}isCallableTool(e){return"callTool"in e&&typeof e.callTool=="function"}}const bD={turnComplete:!0};class _D{constructor(e,n){this.conn=e,this.apiClient=n}tLiveClientContent(e,n){if(n.turns!==null&&n.turns!==void 0){let i=[];try{i=pt(n.turns),e.isVertexAI()||(i=i.map(o=>qs(o)))}catch{throw new Error(`Failed to parse client content "turns", type: '${typeof n.turns}'`)}return{clientContent:{turns:i,turnComplete:n.turnComplete}}}return{clientContent:{turnComplete:n.turnComplete}}}tLiveClienttToolResponse(e,n){let i=[];if(n.functionResponses==null)throw new Error("functionResponses is required.");if(Array.isArray(n.functionResponses)?i=n.functionResponses:i=[n.functionResponses],i.length===0)throw new Error("functionResponses is required.");for(const s of i){if(typeof s!="object"||s===null||!("name"in s)||!("response"in s))throw new Error(`Could not parse function response, type '${typeof s}'.`);if(!e.isVertexAI()&&!("id"in s))throw new Error(gD)}return{toolResponse:{functionResponses:i}}}sendClientContent(e){e=Object.assign(Object.assign({},bD),e);const n=this.tLiveClientContent(this.apiClient,e);this.conn.send(JSON.stringify(n))}sendRealtimeInput(e){let n={};this.apiClient.isVertexAI()?n={realtimeInput:UE(e)}:n={realtimeInput:qE(e)},this.conn.send(JSON.stringify(n))}sendToolResponse(e){if(e.functionResponses==null)throw new Error("Tool response parameters are required.");const n=this.tLiveClienttToolResponse(this.apiClient,e);this.conn.send(JSON.stringify(n))}close(){this.conn.close()}}function ND(t){const e={};return t.forEach((n,i)=>{e[i]=n}),e}function xD(t){const e=new Headers;for(const[n,i]of Object.entries(t))e.append(n,i);return e}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */const hu=10;function gu(t){var e,n,i;if(!((e=t==null?void 0:t.automaticFunctionCalling)===null||e===void 0)&&e.disable)return!0;let o=!1;for(const r of(n=t==null?void 0:t.tools)!==null&&n!==void 0?n:[])if(wi(r)){o=!0;break}if(!o)return!0;const s=(i=t==null?void 0:t.automaticFunctionCalling)===null||i===void 0?void 0:i.maximumRemoteCalls;return s&&(s<0||!Number.isInteger(s))||s==0?(console.warn("Invalid maximumRemoteCalls value provided for automatic function calling. Disabled automatic function calling. Please provide a valid integer value greater than 0. maximumRemoteCalls provided:",s),!0):!1}function wi(t){return"callTool"in t&&typeof t.callTool=="function"}function SD(t){var e,n,i;return(i=(n=(e=t.config)===null||e===void 0?void 0:e.tools)===null||n===void 0?void 0:n.some(o=>wi(o)))!==null&&i!==void 0?i:!1}function yu(t){var e;const n=[];return!((e=t==null?void 0:t.config)===null||e===void 0)&&e.tools&&t.config.tools.forEach((i,o)=>{if(wi(i))return;const s=i;s.functionDeclarations&&s.functionDeclarations.length>0&&n.push(o)}),n}function vu(t){var e;return!(!((e=t==null?void 0:t.automaticFunctionCalling)===null||e===void 0)&&e.ignoreCallHistory)}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class ED extends sn{constructor(e){super(),this.apiClient=e,this.generateContent=async n=>{var i,o,s,r,a;const c=await this.processParamsMaybeAddMcpUsage(n);if(this.maybeMoveToResponseJsonSchem(n),!SD(n)||gu(n.config))return await this.generateContentInternal(c);const d=yu(n);if(d.length>0){const _=d.map(v=>`tools[${v}]`).join(", ");throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${_}.`)}let p,f;const h=pt(c.contents),g=(s=(o=(i=c.config)===null||i===void 0?void 0:i.automaticFunctionCalling)===null||o===void 0?void 0:o.maximumRemoteCalls)!==null&&s!==void 0?s:hu;let y=0;for(;y<g&&(p=await this.generateContentInternal(c),!(!p.functionCalls||p.functionCalls.length===0));){const _=p.candidates[0].content,v=[];for(const x of(a=(r=n.config)===null||r===void 0?void 0:r.tools)!==null&&a!==void 0?a:[])if(wi(x)){const w=await x.callTool(p.functionCalls);v.push(...w)}y++,f={role:"user",parts:v},c.contents=pt(c.contents),c.contents.push(_),c.contents.push(f),vu(c.config)&&(h.push(_),h.push(f))}return vu(c.config)&&(p.automaticFunctionCallingHistory=h),p},this.generateContentStream=async n=>{var i,o,s,r,a;if(this.maybeMoveToResponseJsonSchem(n),gu(n.config)){const f=await this.processParamsMaybeAddMcpUsage(n);return await this.generateContentStreamInternal(f)}const c=yu(n);if(c.length>0){const f=c.map(h=>`tools[${h}]`).join(", ");throw new Error(`Incompatible tools found at ${f}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}const d=(s=(o=(i=n==null?void 0:n.config)===null||i===void 0?void 0:i.toolConfig)===null||o===void 0?void 0:o.functionCallingConfig)===null||s===void 0?void 0:s.streamFunctionCallArguments,p=(a=(r=n==null?void 0:n.config)===null||r===void 0?void 0:r.automaticFunctionCalling)===null||a===void 0?void 0:a.disable;if(d&&!p)throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, this feature is not compatible with automatic function calling (AFC). Please set 'config.automaticFunctionCalling.disable' to true to disable AFC or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' to be undefined or set to false to disable streaming function call arguments feature.");return await this.processAfcStream(n)},this.generateImages=async n=>await this.generateImagesInternal(n).then(i=>{var o;let s;const r=[];if(i!=null&&i.generatedImages)for(const c of i.generatedImages)c&&(c!=null&&c.safetyAttributes)&&((o=c==null?void 0:c.safetyAttributes)===null||o===void 0?void 0:o.contentType)==="Positive Prompt"?s=c==null?void 0:c.safetyAttributes:r.push(c);let a;return s?a={generatedImages:r,positivePromptSafetyAttributes:s,sdkHttpResponse:i.sdkHttpResponse}:a={generatedImages:r,sdkHttpResponse:i.sdkHttpResponse},a}),this.list=async n=>{var i;const r={config:Object.assign(Object.assign({},{queryBase:!0}),n==null?void 0:n.config)};if(this.apiClient.isVertexAI()&&!r.config.queryBase){if(!((i=r.config)===null||i===void 0)&&i.filter)throw new Error("Filtering tuned models list for Vertex AI is not currently supported");r.config.filter="labels.tune-type:*"}return new ai(nn.PAGED_ITEM_MODELS,a=>this.listInternal(a),await this.listInternal(r),r)},this.editImage=async n=>{const i={model:n.model,prompt:n.prompt,referenceImages:[],config:n.config};return n.referenceImages&&n.referenceImages&&(i.referenceImages=n.referenceImages.map(o=>o.toReferenceImageAPI())),await this.editImageInternal(i)},this.upscaleImage=async n=>{let i={numberOfImages:1,mode:"upscale"};n.config&&(i=Object.assign(Object.assign({},i),n.config));const o={model:n.model,image:n.image,upscaleFactor:n.upscaleFactor,config:i};return await this.upscaleImageInternal(o)},this.generateVideos=async n=>{var i,o,s,r,a,c;if((n.prompt||n.image||n.video)&&n.source)throw new Error("Source and prompt/image/video are mutually exclusive. Please only use source.");return this.apiClient.isVertexAI()||(!((i=n.video)===null||i===void 0)&&i.uri&&(!((o=n.video)===null||o===void 0)&&o.videoBytes)?n.video={uri:n.video.uri,mimeType:n.video.mimeType}:!((r=(s=n.source)===null||s===void 0?void 0:s.video)===null||r===void 0)&&r.uri&&(!((c=(a=n.source)===null||a===void 0?void 0:a.video)===null||c===void 0)&&c.videoBytes)&&(n.source.video={uri:n.source.video.uri,mimeType:n.source.video.mimeType})),await this.generateVideosInternal(n)}}maybeMoveToResponseJsonSchem(e){e.config&&e.config.responseSchema&&(e.config.responseJsonSchema||Object.keys(e.config.responseSchema).includes("$schema")&&(e.config.responseJsonSchema=e.config.responseSchema,delete e.config.responseSchema))}async processParamsMaybeAddMcpUsage(e){var n,i,o;const s=(n=e.config)===null||n===void 0?void 0:n.tools;if(!s)return e;const r=await Promise.all(s.map(async c=>wi(c)?await c.tool():c)),a={model:e.model,contents:e.contents,config:Object.assign(Object.assign({},e.config),{tools:r})};if(a.config.tools=r,e.config&&e.config.tools&&Sm(e.config.tools)){const c=(o=(i=e.config.httpOptions)===null||i===void 0?void 0:i.headers)!==null&&o!==void 0?o:{};let d=Object.assign({},c);Object.keys(d).length===0&&(d=this.apiClient.getDefaultHeaders()),Em(d),a.config.httpOptions=Object.assign(Object.assign({},e.config.httpOptions),{headers:d})}return a}async initAfcToolsMap(e){var n,i,o;const s=new Map;for(const r of(i=(n=e.config)===null||n===void 0?void 0:n.tools)!==null&&i!==void 0?i:[])if(wi(r)){const a=r,c=await a.tool();for(const d of(o=c.functionDeclarations)!==null&&o!==void 0?o:[]){if(!d.name)throw new Error("Function declaration name is required.");if(s.has(d.name))throw new Error(`Duplicate tool declaration name: ${d.name}`);s.set(d.name,a)}}return s}async processAfcStream(e){var n,i,o;const s=(o=(i=(n=e.config)===null||n===void 0?void 0:n.automaticFunctionCalling)===null||i===void 0?void 0:i.maximumRemoteCalls)!==null&&o!==void 0?o:hu;let r=!1,a=0;const c=await this.initAfcToolsMap(e);return function(d,p,f){return xt(this,arguments,function*(){for(var h,g,y,_,v,x;a<s;){r&&(a++,r=!1);const P=yield pe(d.processParamsMaybeAddMcpUsage(f)),k=yield pe(d.generateContentStreamInternal(P)),I=[],j=[];try{for(var E=!0,w=(g=void 0,St(k)),C;C=yield pe(w.next()),h=C.done,!h;E=!0){_=C.value,E=!1;const A=_;if(yield yield pe(A),A.candidates&&(!((v=A.candidates[0])===null||v===void 0)&&v.content)){j.push(A.candidates[0].content);for(const R of(x=A.candidates[0].content.parts)!==null&&x!==void 0?x:[])if(a<s&&R.functionCall){if(!R.functionCall.name)throw new Error("Function call name was not returned by the model.");if(p.has(R.functionCall.name)){const q=yield pe(p.get(R.functionCall.name).callTool([R.functionCall]));I.push(...q)}else throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${p.keys()}, mising tool: ${R.functionCall.name}`)}}}}catch(A){g={error:A}}finally{try{!E&&!h&&(y=w.return)&&(yield pe(y.call(w)))}finally{if(g)throw g.error}}if(I.length>0){r=!0;const A=new Ji;A.candidates=[{content:{role:"user",parts:I}}],yield yield pe(A);const R=[];R.push(...j),R.push({role:"user",parts:I});const q=pt(f.contents).concat(R);f.contents=q}else break}})}(this,c,e)}async generateContentInternal(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=du(this.apiClient,e);return a=z("{model}:generateContent",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=mu(p),h=new Ji;return Object.assign(h,f),h})}else{const d=uu(this.apiClient,e);return a=z("{model}:generateContent",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=pu(p),h=new Ji;return Object.assign(h,f),h})}}async generateContentStreamInternal(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=du(this.apiClient,e);return a=z("{model}:streamGenerateContent?alt=sse",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.requestStream({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}),r.then(function(f){return xt(this,arguments,function*(){var h,g,y,_;try{for(var v=!0,x=St(f),E;E=yield pe(x.next()),h=E.done,!h;v=!0){_=E.value,v=!1;const w=_,C=mu(yield pe(w.json()));C.sdkHttpResponse={headers:w.headers};const P=new Ji;Object.assign(P,C),yield yield pe(P)}}catch(w){g={error:w}}finally{try{!v&&!h&&(y=x.return)&&(yield pe(y.call(x)))}finally{if(g)throw g.error}}})})}else{const d=uu(this.apiClient,e);return a=z("{model}:streamGenerateContent?alt=sse",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.requestStream({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}),r.then(function(f){return xt(this,arguments,function*(){var h,g,y,_;try{for(var v=!0,x=St(f),E;E=yield pe(x.next()),h=E.done,!h;v=!0){_=E.value,v=!1;const w=_,C=pu(yield pe(w.json()));C.sdkHttpResponse={headers:w.headers};const P=new Ji;Object.assign(P,C),yield yield pe(P)}}catch(w){g={error:w}}finally{try{!v&&!h&&(y=x.return)&&(yield pe(y.call(x)))}finally{if(g)throw g.error}}})})}}async embedContent(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=vw(this.apiClient,e);return a=z("{model}:predict",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=_w(p),h=new Jc;return Object.assign(h,f),h})}else{const d=yw(this.apiClient,e);return a=z("{model}:batchEmbedContents",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=bw(p),h=new Jc;return Object.assign(h,f),h})}}async generateImagesInternal(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=Pw(this.apiClient,e);return a=z("{model}:predict",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=Rw(p),h=new Wc;return Object.assign(h,f),h})}else{const d=kw(this.apiClient,e);return a=z("{model}:predict",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=Iw(p),h=new Wc;return Object.assign(h,f),h})}}async editImageInternal(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI()){const a=mw(this.apiClient,e);return s=z("{model}:predict",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json().then(d=>{const p=d;return p.sdkHttpResponse={headers:c.headers},p})),o.then(c=>{const d=fw(c),p=new xx;return Object.assign(p,d),p})}else throw new Error("This method is only supported by the Vertex AI.")}async upscaleImageInternal(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI()){const a=PC(this.apiClient,e);return s=z("{model}:predict",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json().then(d=>{const p=d;return p.sdkHttpResponse={headers:c.headers},p})),o.then(c=>{const d=IC(c),p=new Sx;return Object.assign(p,d),p})}else throw new Error("This method is only supported by the Vertex AI.")}async recontextImage(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI()){const a=pC(this.apiClient,e);return s=z("{model}:predict",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json()),o.then(c=>{const d=mC(c),p=new Ex;return Object.assign(p,d),p})}else throw new Error("This method is only supported by the Vertex AI.")}async segmentImage(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI()){const a=bC(this.apiClient,e);return s=z("{model}:predict",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json()),o.then(c=>{const d=_C(c),p=new wx;return Object.assign(p,d),p})}else throw new Error("This method is only supported by the Vertex AI.")}async get(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=Yw(this.apiClient,e);return a=z("{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json()),r.then(p=>Kr(p))}else{const d=zw(this.apiClient,e);return a=z("{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),r.then(p=>Hr(p))}}async listInternal(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=sC(this.apiClient,e);return a=z("{models_url}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=aC(p),h=new zc;return Object.assign(h,f),h})}else{const d=oC(this.apiClient,e);return a=z("{models_url}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=rC(p),h=new zc;return Object.assign(h,f),h})}}async update(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=AC(this.apiClient,e);return a=z("{model}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"PATCH",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json()),r.then(p=>Kr(p))}else{const d=TC(this.apiClient,e);return a=z("{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"PATCH",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),r.then(p=>Hr(p))}}async delete(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=cw(this.apiClient,e);return a=z("{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"DELETE",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=dw(p),h=new Yc;return Object.assign(h,f),h})}else{const d=lw(this.apiClient,e);return a=z("{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"DELETE",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=uw(p),h=new Yc;return Object.assign(h,f),h})}}async countTokens(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=sw(this.apiClient,e);return a=z("{model}:countTokens",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=aw(p),h=new Qc;return Object.assign(h,f),h})}else{const d=ow(this.apiClient,e);return a=z("{model}:countTokens",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=rw(p),h=new Qc;return Object.assign(h,f),h})}}async computeTokens(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI()){const a=QE(this.apiClient,e);return s=z("{model}:computeTokens",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json().then(d=>{const p=d;return p.sdkHttpResponse={headers:c.headers},p})),o.then(c=>{const d=XE(c),p=new Cx;return Object.assign(p,d),p})}else throw new Error("This method is only supported by the Vertex AI.")}async generateVideosInternal(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=Fw(this.apiClient,e);return a=z("{model}:predictLongRunning",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json()),r.then(p=>{const f=Ow(p),h=new rs;return Object.assign(h,f),h})}else{const d=jw(this.apiClient,e);return a=z("{model}:predictLongRunning",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),r.then(p=>{const f=Lw(p),h=new rs;return Object.assign(h,f),h})}}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class wD extends sn{constructor(e){super(),this.apiClient=e}async getVideosOperation(e){const n=e.operation,i=e.config;if(n.name===void 0||n.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){const o=n.name.split("/operations/")[0];let s;i&&"httpOptions"in i&&(s=i.httpOptions);const r=await this.fetchPredictVideosOperationInternal({operationName:n.name,resourceName:o,config:{httpOptions:s}});return n._fromAPIResponse({apiResponse:r,_isVertexAI:!0})}else{const o=await this.getVideosOperationInternal({operationName:n.name,config:i});return n._fromAPIResponse({apiResponse:o,_isVertexAI:!1})}}async get(e){const n=e.operation,i=e.config;if(n.name===void 0||n.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){const o=n.name.split("/operations/")[0];let s;i&&"httpOptions"in i&&(s=i.httpOptions);const r=await this.fetchPredictVideosOperationInternal({operationName:n.name,resourceName:o,config:{httpOptions:s}});return n._fromAPIResponse({apiResponse:r,_isVertexAI:!0})}else{const o=await this.getVideosOperationInternal({operationName:n.name,config:i});return n._fromAPIResponse({apiResponse:o,_isVertexAI:!1})}}async getVideosOperationInternal(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=gx(e);return a=z("{operationName}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json()),r}else{const d=hx(e);return a=z("{operationName}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),r}}async fetchPredictVideosOperationInternal(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI()){const a=lx(e);return s=z("{resourceName}:fetchPredictOperation",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json()),o}else throw new Error("This method is only supported by the Vertex AI.")}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function CD(t){const e={},n=l(t,["data"]);if(n!=null&&u(e,["data"],n),l(t,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=l(t,["mimeType"]);return i!=null&&u(e,["mimeType"],i),e}function DD(t){const e={},n=l(t,["parts"]);if(n!=null){let o=n;Array.isArray(o)&&(o=o.map(s=>LD(s))),u(e,["parts"],o)}const i=l(t,["role"]);return i!=null&&u(e,["role"],i),e}function TD(t,e,n){const i={},o=l(e,["expireTime"]);n!==void 0&&o!=null&&u(n,["expireTime"],o);const s=l(e,["newSessionExpireTime"]);n!==void 0&&s!=null&&u(n,["newSessionExpireTime"],s);const r=l(e,["uses"]);n!==void 0&&r!=null&&u(n,["uses"],r);const a=l(e,["liveConnectConstraints"]);n!==void 0&&a!=null&&u(n,["bidiGenerateContentSetup"],VD(t,a));const c=l(e,["lockAdditionalFields"]);return n!==void 0&&c!=null&&u(n,["fieldMask"],c),i}function AD(t,e){const n={},i=l(e,["config"]);return i!=null&&u(n,["config"],TD(t,i,n)),n}function kD(t){const e={};if(l(t,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=l(t,["fileUri"]);n!=null&&u(e,["fileUri"],n);const i=l(t,["mimeType"]);return i!=null&&u(e,["mimeType"],i),e}function PD(t){const e={},n=l(t,["id"]);n!=null&&u(e,["id"],n);const i=l(t,["args"]);i!=null&&u(e,["args"],i);const o=l(t,["name"]);if(o!=null&&u(e,["name"],o),l(t,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(l(t,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}function ID(t){const e={};if(l(t,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const n=l(t,["enableWidget"]);return n!=null&&u(e,["enableWidget"],n),e}function RD(t){const e={};if(l(t,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(l(t,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const n=l(t,["timeRangeFilter"]);return n!=null&&u(e,["timeRangeFilter"],n),e}function MD(t,e){const n={},i=l(t,["generationConfig"]);e!==void 0&&i!=null&&u(e,["setup","generationConfig"],i);const o=l(t,["responseModalities"]);e!==void 0&&o!=null&&u(e,["setup","generationConfig","responseModalities"],o);const s=l(t,["temperature"]);e!==void 0&&s!=null&&u(e,["setup","generationConfig","temperature"],s);const r=l(t,["topP"]);e!==void 0&&r!=null&&u(e,["setup","generationConfig","topP"],r);const a=l(t,["topK"]);e!==void 0&&a!=null&&u(e,["setup","generationConfig","topK"],a);const c=l(t,["maxOutputTokens"]);e!==void 0&&c!=null&&u(e,["setup","generationConfig","maxOutputTokens"],c);const d=l(t,["mediaResolution"]);e!==void 0&&d!=null&&u(e,["setup","generationConfig","mediaResolution"],d);const p=l(t,["seed"]);e!==void 0&&p!=null&&u(e,["setup","generationConfig","seed"],p);const f=l(t,["speechConfig"]);e!==void 0&&f!=null&&u(e,["setup","generationConfig","speechConfig"],Ta(f));const h=l(t,["thinkingConfig"]);e!==void 0&&h!=null&&u(e,["setup","generationConfig","thinkingConfig"],h);const g=l(t,["enableAffectiveDialog"]);e!==void 0&&g!=null&&u(e,["setup","generationConfig","enableAffectiveDialog"],g);const y=l(t,["systemInstruction"]);e!==void 0&&y!=null&&u(e,["setup","systemInstruction"],DD(Je(y)));const _=l(t,["tools"]);if(e!==void 0&&_!=null){let k=Ui(_);Array.isArray(k)&&(k=k.map(I=>jD(qi(I)))),u(e,["setup","tools"],k)}const v=l(t,["sessionResumption"]);e!==void 0&&v!=null&&u(e,["setup","sessionResumption"],OD(v));const x=l(t,["inputAudioTranscription"]);e!==void 0&&x!=null&&u(e,["setup","inputAudioTranscription"],x);const E=l(t,["outputAudioTranscription"]);e!==void 0&&E!=null&&u(e,["setup","outputAudioTranscription"],E);const w=l(t,["realtimeInputConfig"]);e!==void 0&&w!=null&&u(e,["setup","realtimeInputConfig"],w);const C=l(t,["contextWindowCompression"]);e!==void 0&&C!=null&&u(e,["setup","contextWindowCompression"],C);const P=l(t,["proactivity"]);if(e!==void 0&&P!=null&&u(e,["setup","proactivity"],P),l(t,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is not supported in Gemini API.");return n}function VD(t,e){const n={},i=l(e,["model"]);i!=null&&u(n,["setup","model"],Se(t,i));const o=l(e,["config"]);return o!=null&&u(n,["config"],MD(o,n)),n}function LD(t){const e={},n=l(t,["mediaResolution"]);n!=null&&u(e,["mediaResolution"],n);const i=l(t,["codeExecutionResult"]);i!=null&&u(e,["codeExecutionResult"],i);const o=l(t,["executableCode"]);o!=null&&u(e,["executableCode"],o);const s=l(t,["fileData"]);s!=null&&u(e,["fileData"],kD(s));const r=l(t,["functionCall"]);r!=null&&u(e,["functionCall"],PD(r));const a=l(t,["functionResponse"]);a!=null&&u(e,["functionResponse"],a);const c=l(t,["inlineData"]);c!=null&&u(e,["inlineData"],CD(c));const d=l(t,["text"]);d!=null&&u(e,["text"],d);const p=l(t,["thought"]);p!=null&&u(e,["thought"],p);const f=l(t,["thoughtSignature"]);f!=null&&u(e,["thoughtSignature"],f);const h=l(t,["videoMetadata"]);return h!=null&&u(e,["videoMetadata"],h),e}function OD(t){const e={},n=l(t,["handle"]);if(n!=null&&u(e,["handle"],n),l(t,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return e}function jD(t){const e={},n=l(t,["functionDeclarations"]);if(n!=null){let p=n;Array.isArray(p)&&(p=p.map(f=>f)),u(e,["functionDeclarations"],p)}if(l(t,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const i=l(t,["googleSearchRetrieval"]);i!=null&&u(e,["googleSearchRetrieval"],i);const o=l(t,["computerUse"]);o!=null&&u(e,["computerUse"],o);const s=l(t,["fileSearch"]);s!=null&&u(e,["fileSearch"],s);const r=l(t,["codeExecution"]);if(r!=null&&u(e,["codeExecution"],r),l(t,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const a=l(t,["googleMaps"]);a!=null&&u(e,["googleMaps"],ID(a));const c=l(t,["googleSearch"]);c!=null&&u(e,["googleSearch"],RD(c));const d=l(t,["urlContext"]);return d!=null&&u(e,["urlContext"],d),e}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function FD(t){const e=[];for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const i=t[n];if(typeof i=="object"&&i!=null&&Object.keys(i).length>0){const o=Object.keys(i).map(s=>`${n}.${s}`);e.push(...o)}else e.push(n)}return e.join(",")}function qD(t,e){let n=null;const i=t.bidiGenerateContentSetup;if(typeof i=="object"&&i!==null&&"setup"in i){const s=i.setup;typeof s=="object"&&s!==null?(t.bidiGenerateContentSetup=s,n=s):delete t.bidiGenerateContentSetup}else i!==void 0&&delete t.bidiGenerateContentSetup;const o=t.fieldMask;if(n){const s=FD(n);if(Array.isArray(e==null?void 0:e.lockAdditionalFields)&&(e==null?void 0:e.lockAdditionalFields.length)===0)s?t.fieldMask=s:delete t.fieldMask;else if(e!=null&&e.lockAdditionalFields&&e.lockAdditionalFields.length>0&&o!==null&&Array.isArray(o)&&o.length>0){const r=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"];let a=[];o.length>0&&(a=o.map(d=>r.includes(d)?`generationConfig.${d}`:d));const c=[];s&&c.push(s),a.length>0&&c.push(...a),c.length>0?t.fieldMask=c.join(","):delete t.fieldMask}else delete t.fieldMask}else o!==null&&Array.isArray(o)&&o.length>0?t.fieldMask=o.join(","):delete t.fieldMask;return t}class UD extends sn{constructor(e){super(),this.apiClient=e}async create(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");{const a=AD(this.apiClient,e);s=z("auth_tokens",a._url),r=a._query,delete a.config,delete a._url,delete a._query;const c=qD(a,e.config);return o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(d=>d.json()),o.then(d=>d)}}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function $D(t,e){const n={},i=l(t,["force"]);return e!==void 0&&i!=null&&u(e,["_query","force"],i),n}function BD(t){const e={},n=l(t,["name"]);n!=null&&u(e,["_url","name"],n);const i=l(t,["config"]);return i!=null&&$D(i,e),e}function GD(t){const e={},n=l(t,["name"]);return n!=null&&u(e,["_url","name"],n),e}function HD(t,e){const n={},i=l(t,["pageSize"]);e!==void 0&&i!=null&&u(e,["_query","pageSize"],i);const o=l(t,["pageToken"]);return e!==void 0&&o!=null&&u(e,["_query","pageToken"],o),n}function KD(t){const e={},n=l(t,["parent"]);n!=null&&u(e,["_url","parent"],n);const i=l(t,["config"]);return i!=null&&HD(i,e),e}function JD(t){const e={},n=l(t,["sdkHttpResponse"]);n!=null&&u(e,["sdkHttpResponse"],n);const i=l(t,["nextPageToken"]);i!=null&&u(e,["nextPageToken"],i);const o=l(t,["documents"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(r=>r)),u(e,["documents"],s)}return e}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class WD extends sn{constructor(e){super(),this.apiClient=e,this.list=async n=>new ai(nn.PAGED_ITEM_DOCUMENTS,i=>this.listInternal({parent:n.parent,config:i.config}),await this.listInternal(n),n)}async get(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const a=GD(e);return s=z("{name}",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json()),o.then(c=>c)}}async delete(e){var n,i;let o="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const r=BD(e);o=z("{name}",r._url),s=r._query,delete r._url,delete r._query,await this.apiClient.request({path:o,queryParams:s,body:JSON.stringify(r),httpMethod:"DELETE",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal})}}async listInternal(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const a=KD(e);return s=z("{parent}/documents",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json()),o.then(c=>{const d=JD(c),p=new Dx;return Object.assign(p,d),p})}}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class zD extends sn{constructor(e,n=new WD(e)){super(),this.apiClient=e,this.documents=n,this.list=async(i={})=>new ai(nn.PAGED_ITEM_FILE_SEARCH_STORES,o=>this.listInternal(o),await this.listInternal(i),i)}async uploadToFileSearchStore(e){if(this.apiClient.isVertexAI())throw new Error("Vertex AI does not support uploading files to a file search store.");return this.apiClient.uploadFileToFileSearchStore(e.fileSearchStoreName,e.file,e.config)}async create(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const a=FC(e);return s=z("fileSearchStores",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json()),o.then(c=>c)}}async get(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const a=$C(e);return s=z("{name}",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json()),o.then(c=>c)}}async delete(e){var n,i;let o="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const r=UC(e);o=z("{name}",r._url),s=r._query,delete r._url,delete r._query,await this.apiClient.request({path:o,queryParams:s,body:JSON.stringify(r),httpMethod:"DELETE",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal})}}async listInternal(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const a=WC(e);return s=z("fileSearchStores",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json()),o.then(c=>{const d=zC(c),p=new Tx;return Object.assign(p,d),p})}}async uploadToFileSearchStoreInternal(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const a=YC(e);return s=z("upload/v1beta/{file_search_store_name}:uploadToFileSearchStore",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json()),o.then(c=>{const d=QC(c),p=new Ax;return Object.assign(p,d),p})}}async importFile(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const a=HC(e);return s=z("{file_search_store_name}:importFile",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json()),o.then(c=>{const d=GC(c),p=new Sa;return Object.assign(p,d),p})}}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */let wm=function(){const{crypto:t}=globalThis;if(t!=null&&t.randomUUID)return wm=t.randomUUID.bind(t),t.randomUUID();const e=new Uint8Array(1),n=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(+i^n()&15>>+i/4).toString(16))};const YD=()=>wm();/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function Wr(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}const zr=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){const e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class mt extends Error{}class Ye extends mt{constructor(e,n,i,o){super(`${Ye.makeMessage(e,n,i)}`),this.status=e,this.headers=o,this.error=n}static makeMessage(e,n,i){const o=n!=null&&n.message?typeof n.message=="string"?n.message:JSON.stringify(n.message):n?JSON.stringify(n):i;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,n,i,o){if(!e||!o)return new Bs({message:i,cause:zr(n)});const s=n;return e===400?new Dm(e,s,i,o):e===401?new Tm(e,s,i,o):e===403?new Am(e,s,i,o):e===404?new km(e,s,i,o):e===409?new Pm(e,s,i,o):e===422?new Im(e,s,i,o):e===429?new Rm(e,s,i,o):e>=500?new Mm(e,s,i,o):new Ye(e,s,i,o)}}class Yr extends Ye{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}}class Bs extends Ye{constructor({message:e,cause:n}){super(void 0,void 0,e||"Connection error.",void 0),n&&(this.cause=n)}}class Cm extends Bs{constructor({message:e}={}){super({message:e??"Request timed out."})}}class Dm extends Ye{}class Tm extends Ye{}class Am extends Ye{}class km extends Ye{}class Pm extends Ye{}class Im extends Ye{}class Rm extends Ye{}class Mm extends Ye{}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */const QD=/^[a-z][a-z0-9+.-]*:/i,XD=t=>QD.test(t);let Qr=t=>(Qr=Array.isArray,Qr(t));const ZD=Qr;let eT=ZD;const bu=eT;function tT(t){if(!t)return!0;for(const e in t)return!1;return!0}function nT(t,e){return Object.prototype.hasOwnProperty.call(t,e)}const iT=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new mt(`${t} must be an integer`);if(e<0)throw new mt(`${t} must be a positive integer`);return e},oT=t=>{try{return JSON.parse(t)}catch{return}};/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */const sT=t=>new Promise(e=>setTimeout(e,t));/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */const bi="0.0.1";/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function rT(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}const aT=()=>{var t,e,n,i,o;const s=rT();if(s==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":bi,"X-Stainless-OS":Nu(Deno.build.os),"X-Stainless-Arch":_u(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:(e=(t=Deno.version)===null||t===void 0?void 0:t.deno)!==null&&e!==void 0?e:"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":bi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(s==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":bi,"X-Stainless-OS":Nu((n=globalThis.process.platform)!==null&&n!==void 0?n:"unknown"),"X-Stainless-Arch":_u((i=globalThis.process.arch)!==null&&i!==void 0?i:"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":(o=globalThis.process.version)!==null&&o!==void 0?o:"unknown"};const r=lT();return r?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":bi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${r.browser}`,"X-Stainless-Runtime-Version":r.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":bi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function lT(){if(typeof navigator>"u"||!navigator)return null;const t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(const{key:e,pattern:n}of t){const i=n.exec(navigator.userAgent);if(i){const o=i[1]||0,s=i[2]||0,r=i[3]||0;return{browser:e,version:`${o}.${s}.${r}`}}}return null}const _u=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",Nu=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown");let Vo;const cT=()=>Vo??(Vo=aT());/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function uT(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new GeminiNextGenAPIClient({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Vm(...t){const e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function dT(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return Vm({start(){},async pull(n){const{done:i,value:o}=await e.next();i?n.close():n.enqueue(o)},async cancel(){var n;await((n=e.return)===null||n===void 0?void 0:n.call(e))}})}function Lm(t){if(t[Symbol.asyncIterator])return t;const e=t.getReader();return{async next(){try{const n=await e.read();return n!=null&&n.done&&e.releaseLock(),n}catch(n){throw e.releaseLock(),n}},async return(){const n=e.cancel();return e.releaseLock(),await n,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function pT(t){var e,n;if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await((n=(e=t[Symbol.asyncIterator]()).return)===null||n===void 0?void 0:n.call(e));return}const i=t.getReader(),o=i.cancel();i.releaseLock(),await o}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */const mT=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */const Om=()=>{var t;if(typeof File>"u"){const{process:e}=globalThis,n=typeof((t=e==null?void 0:e.versions)===null||t===void 0?void 0:t.node)=="string"&&parseInt(e.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(n?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function sr(t,e,n){return Om(),new File(t,e??"unknown_file",n)}function fT(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}const hT=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function";/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */const jm=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",gT=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&jm(t),yT=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function";async function vT(t,e,n){if(Om(),t=await t,gT(t))return t instanceof File?t:sr([await t.arrayBuffer()],t.name);if(yT(t)){const o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),sr(await Xr(o),e,n)}const i=await Xr(t);if(e||(e=fT(t)),!(n!=null&&n.type)){const o=i.find(s=>typeof s=="object"&&"type"in s&&s.type);typeof o=="string"&&(n=Object.assign(Object.assign({},n),{type:o}))}return sr(i,e,n)}async function Xr(t){var e,n,i,o,s;let r=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)r.push(t);else if(jm(t))r.push(t instanceof Blob?t:await t.arrayBuffer());else if(hT(t))try{for(var a=!0,c=St(t),d;d=await c.next(),e=d.done,!e;a=!0){o=d.value,a=!1;const p=o;r.push(...await Xr(p))}}catch(p){n={error:p}}finally{try{!a&&!e&&(i=c.return)&&await i.call(c)}finally{if(n)throw n.error}}else{const p=(s=t==null?void 0:t.constructor)===null||s===void 0?void 0:s.name;throw new Error(`Unexpected data type: ${typeof t}${p?`; constructor: ${p}`:""}${bT(t)}`)}return r}function bT(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(n=>`"${n}"`).join(", ")}]`}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class Fm{constructor(e){this._client=e}}Fm._key=[];/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function qm(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}const xu=Object.freeze(Object.create(null)),_T=(t=qm)=>function(n,...i){if(n.length===1)return n[0];let o=!1;const s=[],r=n.reduce((p,f,h)=>{var g,y,_;/[?#]/.test(f)&&(o=!0);const v=i[h];let x=(o?encodeURIComponent:t)(""+v);return h!==i.length&&(v==null||typeof v=="object"&&v.toString===((_=Object.getPrototypeOf((y=Object.getPrototypeOf((g=v.hasOwnProperty)!==null&&g!==void 0?g:xu))!==null&&y!==void 0?y:xu))===null||_===void 0?void 0:_.toString))&&(x=v+"",s.push({start:p.length+f.length,length:x.length,error:`Value of type ${Object.prototype.toString.call(v).slice(8,-1)} is not a valid path parameter`})),p+f+(h===i.length?"":x)},""),a=r.split(/[?#]/,1)[0],c=new RegExp("(?<=^|\\/)(?:\\.|%2e){1,2}(?=\\/|$)","gi");let d;for(;(d=c.exec(a))!==null;)s.push({start:d.index,length:d[0].length,error:`Value "${d[0]}" can't be safely passed as a path parameter`});if(s.sort((p,f)=>p.start-f.start),s.length>0){let p=0;const f=s.reduce((h,g)=>{const y=" ".repeat(g.start-p),_="^".repeat(g.length);return p=g.start+g.length,h+y+_},"");throw new mt(`Path parameters result in path with invalid segments:
${s.map(h=>h.error).join(`
`)}
${r}
${f}`)}return r},Lo=_T(qm);/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class Um extends Fm{create(e,n){var i;const{api_version:o=this._client.apiVersion}=e,s=ls(e,["api_version"]);if("model"in s&&"agent_config"in s)throw new mt("Invalid request: specified `model` and `agent_config`. If specifying `model`, use `generation_config`.");if("agent"in s&&"generation_config"in s)throw new mt("Invalid request: specified `agent` and `generation_config`. If specifying `agent`, use `agent_config`.");return this._client.post(Lo`/${o}/interactions`,Object.assign(Object.assign({body:s},n),{stream:(i=e.stream)!==null&&i!==void 0?i:!1}))}delete(e,n={},i){const{api_version:o=this._client.apiVersion}=n??{};return this._client.delete(Lo`/${o}/interactions/${e}`,i)}cancel(e,n={},i){const{api_version:o=this._client.apiVersion}=n??{};return this._client.post(Lo`/${o}/interactions/${e}/cancel`,i)}get(e,n={},i){var o;const s=n??{},{api_version:r=this._client.apiVersion}=s,a=ls(s,["api_version"]);return this._client.get(Lo`/${r}/interactions/${e}`,Object.assign(Object.assign({query:a},i),{stream:(o=n==null?void 0:n.stream)!==null&&o!==void 0?o:!1}))}}Um._key=Object.freeze(["interactions"]);class $m extends Um{}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function NT(t){let e=0;for(const o of t)e+=o.length;const n=new Uint8Array(e);let i=0;for(const o of t)n.set(o,i),i+=o.length;return n}let Oo;function ka(t){let e;return(Oo??(e=new globalThis.TextEncoder,Oo=e.encode.bind(e)))(t)}let jo;function Su(t){let e;return(jo??(e=new globalThis.TextDecoder,jo=e.decode.bind(e)))(t)}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class Gs{constructor(){this.buffer=new Uint8Array,this.carriageReturnIndex=null}decode(e){if(e==null)return[];const n=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?ka(e):e;this.buffer=NT([this.buffer,n]);const i=[];let o;for(;(o=xT(this.buffer,this.carriageReturnIndex))!=null;){if(o.carriage&&this.carriageReturnIndex==null){this.carriageReturnIndex=o.index;continue}if(this.carriageReturnIndex!=null&&(o.index!==this.carriageReturnIndex+1||o.carriage)){i.push(Su(this.buffer.subarray(0,this.carriageReturnIndex-1))),this.buffer=this.buffer.subarray(this.carriageReturnIndex),this.carriageReturnIndex=null;continue}const s=this.carriageReturnIndex!==null?o.preceding-1:o.preceding,r=Su(this.buffer.subarray(0,s));i.push(r),this.buffer=this.buffer.subarray(o.index),this.carriageReturnIndex=null}return i}flush(){return this.buffer.length?this.decode(`
`):[]}}Gs.NEWLINE_CHARS=new Set([`
`,"\r"]);Gs.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function xT(t,e){for(let o=e??0;o<t.length;o++){if(t[o]===10)return{preceding:o,index:o+1,carriage:!1};if(t[o]===13)return{preceding:o,index:o+1,carriage:!0}}return null}function ST(t){for(let i=0;i<t.length-1;i++){if(t[i]===10&&t[i+1]===10||t[i]===13&&t[i+1]===13)return i+2;if(t[i]===13&&t[i+1]===10&&i+3<t.length&&t[i+2]===13&&t[i+3]===10)return i+4}return-1}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */const cs={off:0,error:200,warn:300,info:400,debug:500},Eu=(t,e,n)=>{if(t){if(nT(cs,t))return t;ze(n).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(cs))}`)}};function Zi(){}function Fo(t,e,n){return!e||cs[t]>cs[n]?Zi:e[t].bind(e)}const ET={error:Zi,warn:Zi,info:Zi,debug:Zi};let wu=new WeakMap;function ze(t){var e;const n=t.logger,i=(e=t.logLevel)!==null&&e!==void 0?e:"off";if(!n)return ET;const o=wu.get(n);if(o&&o[0]===i)return o[1];const s={error:Fo("error",n,i),warn:Fo("warn",n,i),info:Fo("info",n,i),debug:Fo("debug",n,i)};return wu.set(n,[i,s]),s}const Ln=t=>(t.options&&(t.options=Object.assign({},t.options),delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,n])=>[e,e.toLowerCase()==="x-goog-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":n]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class Ni{constructor(e,n,i){this.iterator=e,this.controller=n,this.client=i}static fromSSEResponse(e,n,i){let o=!1;const s=i?ze(i):console;function r(){return xt(this,arguments,function*(){var c,d,p,f;if(o)throw new mt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let h=!1;try{try{for(var g=!0,y=St(wT(e,n)),_;_=yield pe(y.next()),c=_.done,!c;g=!0){f=_.value,g=!1;const v=f;if(!h)if(v.data.startsWith("[DONE]")){h=!0;continue}else try{yield yield pe(JSON.parse(v.data))}catch(x){throw s.error("Could not parse message into JSON:",v.data),s.error("From chunk:",v.raw),x}}}catch(v){d={error:v}}finally{try{!g&&!c&&(p=y.return)&&(yield pe(p.call(y)))}finally{if(d)throw d.error}}h=!0}catch(v){if(Wr(v))return yield pe(void 0);throw v}finally{h||n.abort()}})}return new Ni(r,n,i)}static fromReadableStream(e,n,i){let o=!1;function s(){return xt(this,arguments,function*(){var c,d,p,f;const h=new Gs,g=Lm(e);try{for(var y=!0,_=St(g),v;v=yield pe(_.next()),c=v.done,!c;y=!0){f=v.value,y=!1;const x=f;for(const E of h.decode(x))yield yield pe(E)}}catch(x){d={error:x}}finally{try{!y&&!c&&(p=_.return)&&(yield pe(p.call(_)))}finally{if(d)throw d.error}}for(const x of h.flush())yield yield pe(x)})}function r(){return xt(this,arguments,function*(){var c,d,p,f;if(o)throw new mt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let h=!1;try{try{for(var g=!0,y=St(s()),_;_=yield pe(y.next()),c=_.done,!c;g=!0){f=_.value,g=!1;const v=f;h||v&&(yield yield pe(JSON.parse(v)))}}catch(v){d={error:v}}finally{try{!g&&!c&&(p=y.return)&&(yield pe(p.call(y)))}finally{if(d)throw d.error}}h=!0}catch(v){if(Wr(v))return yield pe(void 0);throw v}finally{h||n.abort()}})}return new Ni(r,n,i)}[Symbol.asyncIterator](){return this.iterator()}tee(){const e=[],n=[],i=this.iterator(),o=s=>({next:()=>{if(s.length===0){const r=i.next();e.push(r),n.push(r)}return s.shift()}});return[new Ni(()=>o(e),this.controller,this.client),new Ni(()=>o(n),this.controller,this.client)]}toReadableStream(){const e=this;let n;return Vm({async start(){n=e[Symbol.asyncIterator]()},async pull(i){try{const{value:o,done:s}=await n.next();if(s)return i.close();const r=ka(JSON.stringify(o)+`
`);i.enqueue(r)}catch(o){i.error(o)}},async cancel(){var i;await((i=n.return)===null||i===void 0?void 0:i.call(n))}})}}function wT(t,e){return xt(this,arguments,function*(){var i,o,s,r;if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new mt("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new mt("Attempted to iterate over a response with no body");const a=new DT,c=new Gs,d=Lm(t.body);try{for(var p=!0,f=St(CT(d)),h;h=yield pe(f.next()),i=h.done,!i;p=!0){r=h.value,p=!1;const g=r;for(const y of c.decode(g)){const _=a.decode(y);_&&(yield yield pe(_))}}}catch(g){o={error:g}}finally{try{!p&&!i&&(s=f.return)&&(yield pe(s.call(f)))}finally{if(o)throw o.error}}for(const g of c.flush()){const y=a.decode(g);y&&(yield yield pe(y))}})}function CT(t){return xt(this,arguments,function*(){var n,i,o,s;let r=new Uint8Array;try{for(var a=!0,c=St(t),d;d=yield pe(c.next()),n=d.done,!n;a=!0){s=d.value,a=!1;const p=s;if(p==null)continue;const f=p instanceof ArrayBuffer?new Uint8Array(p):typeof p=="string"?ka(p):p;let h=new Uint8Array(r.length+f.length);h.set(r),h.set(f,r.length),r=h;let g;for(;(g=ST(r))!==-1;)yield yield pe(r.slice(0,g)),r=r.slice(g)}}catch(p){i={error:p}}finally{try{!a&&!n&&(o=c.return)&&(yield pe(o.call(c)))}finally{if(i)throw i.error}}r.length>0&&(yield yield pe(r))})}class DT{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;const s={event:this.event,data:this.data.join(`
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],s}if(this.chunks.push(e),e.startsWith(":"))return null;let[n,i,o]=TT(e,":");return o.startsWith(" ")&&(o=o.substring(1)),n==="event"?this.event=o:n==="data"&&this.data.push(o),null}}function TT(t,e){const n=t.indexOf(e);return n!==-1?[t.substring(0,n),e,t.substring(n+e.length)]:[t,"",""]}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */async function AT(t,e){const{response:n,requestLogID:i,retryOfRequestLogID:o,startTime:s}=e,r=await(async()=>{var a;if(e.options.stream)return ze(t).debug("response",n.status,n.url,n.headers,n.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(n,e.controller,t):Ni.fromSSEResponse(n,e.controller,t);if(n.status===204)return null;if(e.options.__binaryResponse)return n;const c=n.headers.get("content-type"),d=(a=c==null?void 0:c.split(";")[0])===null||a===void 0?void 0:a.trim();return(d==null?void 0:d.includes("application/json"))||(d==null?void 0:d.endsWith("+json"))?await n.json():await n.text()})();return ze(t).debug(`[${i}] response parsed`,Ln({retryOfRequestLogID:o,url:n.url,status:n.status,body:r,durationMs:Date.now()-s})),r}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class Pa extends Promise{constructor(e,n,i=AT){super(o=>{o(null)}),this.responsePromise=n,this.parseResponse=i,this.client=e}_thenUnwrap(e){return new Pa(this.client,this.responsePromise,async(n,i)=>e(await this.parseResponse(n,i),i))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){const[e,n]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:n}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(this.client,e))),this.parsedPromise}then(e,n){return this.parse().then(e,n)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */const Bm=Symbol("brand.privateNullableHeaders");function*kT(t){if(!t)return;if(Bm in t){const{values:i,nulls:o}=t;yield*i.entries();for(const s of o)yield[s,null];return}let e=!1,n;t instanceof Headers?n=t.entries():bu(t)?n=t:(e=!0,n=Object.entries(t??{}));for(let i of n){const o=i[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");const s=bu(i[1])?i[1]:[i[1]];let r=!1;for(const a of s)a!==void 0&&(e&&!r&&(r=!0,yield[o,null]),yield[o,a])}}const Wi=t=>{const e=new Headers,n=new Set;for(const i of t){const o=new Set;for(const[s,r]of kT(i)){const a=s.toLowerCase();o.has(a)||(e.delete(s),o.add(a)),r===null?(e.delete(s),n.add(a)):(e.append(s,r),n.delete(a))}}return{[Bm]:!0,values:e,nulls:n}};/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */const rr=t=>{var e,n,i,o,s,r;if(typeof globalThis.process<"u")return(i=(n=(e=nx)===null||e===void 0?void 0:e[t])===null||n===void 0?void 0:n.trim())!==null&&i!==void 0?i:void 0;if(typeof globalThis.Deno<"u")return(r=(s=(o=globalThis.Deno.env)===null||o===void 0?void 0:o.get)===null||s===void 0?void 0:s.call(o,t))===null||r===void 0?void 0:r.trim()};/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */var Gm;class Hs{constructor(e){var n,i,o,s,r,a,c,{baseURL:d=rr("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:p=(n=rr("GEMINI_API_KEY"))!==null&&n!==void 0?n:null,apiVersion:f="v1beta"}=e,h=ls(e,["baseURL","apiKey","apiVersion"]);const g=Object.assign(Object.assign({apiKey:p,apiVersion:f},h),{baseURL:d||"https://generativelanguage.googleapis.com"});this.baseURL=g.baseURL,this.timeout=(i=g.timeout)!==null&&i!==void 0?i:Hs.DEFAULT_TIMEOUT,this.logger=(o=g.logger)!==null&&o!==void 0?o:console;const y="warn";this.logLevel=y,this.logLevel=(r=(s=Eu(g.logLevel,"ClientOptions.logLevel",this))!==null&&s!==void 0?s:Eu(rr("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&r!==void 0?r:y,this.fetchOptions=g.fetchOptions,this.maxRetries=(a=g.maxRetries)!==null&&a!==void 0?a:2,this.fetch=(c=g.fetch)!==null&&c!==void 0?c:uT(),this.encoder=mT,this._options=g,this.apiKey=p,this.apiVersion=f,this.clientAdapter=g.clientAdapter}withOptions(e){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),e))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:n}){if(!(e.has("authorization")||e.has("x-goog-api-key"))&&!(this.apiKey&&e.get("x-goog-api-key"))&&!n.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(e){const n=Wi([e.headers]);if(!(n.values.has("authorization")||n.values.has("x-goog-api-key"))){if(this.apiKey)return Wi([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return Wi([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(e){return Object.entries(e).filter(([n,i])=>typeof i<"u").map(([n,i])=>{if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")return`${encodeURIComponent(n)}=${encodeURIComponent(i)}`;if(i===null)return`${encodeURIComponent(n)}=`;throw new mt(`Cannot stringify type ${typeof i}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${bi}`}defaultIdempotencyKey(){return`stainless-node-retry-${YD()}`}makeStatusError(e,n,i,o){return Ye.generate(e,n,i,o)}buildURL(e,n,i){const o=!this.baseURLOverridden()&&i||this.baseURL,s=XD(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),r=this.defaultQuery();return tT(r)||(n=Object.assign(Object.assign({},r),n)),typeof n=="object"&&n&&!Array.isArray(n)&&(s.search=this.stringifyQuery(n)),s.toString()}async prepareOptions(e){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!e.path.startsWith(`/${this.apiVersion}/projects/`)){const n=e.path.slice(this.apiVersion.length+1);e.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${n}`}}async prepareRequest(e,{url:n,options:i}){}get(e,n){return this.methodRequest("get",e,n)}post(e,n){return this.methodRequest("post",e,n)}patch(e,n){return this.methodRequest("patch",e,n)}put(e,n){return this.methodRequest("put",e,n)}delete(e,n){return this.methodRequest("delete",e,n)}methodRequest(e,n,i){return this.request(Promise.resolve(i).then(o=>Object.assign({method:e,path:n},o)))}request(e,n=null){return new Pa(this,this.makeRequest(e,n,void 0))}async makeRequest(e,n,i){var o,s,r;const a=await e,c=(o=a.maxRetries)!==null&&o!==void 0?o:this.maxRetries;n==null&&(n=c),await this.prepareOptions(a);const{req:d,url:p,timeout:f}=await this.buildRequest(a,{retryCount:c-n});await this.prepareRequest(d,{url:p,options:a});const h="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),g=i===void 0?"":`, retryOf: ${i}`,y=Date.now();if(ze(this).debug(`[${h}] sending request`,Ln({retryOfRequestLogID:i,method:a.method,url:p,options:a,headers:d.headers})),!((s=a.signal)===null||s===void 0)&&s.aborted)throw new Yr;const _=new AbortController,v=await this.fetchWithTimeout(p,d,f,_).catch(zr),x=Date.now();if(v instanceof globalThis.Error){const w=`retrying, ${n} attempts remaining`;if(!((r=a.signal)===null||r===void 0)&&r.aborted)throw new Yr;const C=Wr(v)||/timed? ?out/i.test(String(v)+("cause"in v?String(v.cause):""));if(n)return ze(this).info(`[${h}] connection ${C?"timed out":"failed"} - ${w}`),ze(this).debug(`[${h}] connection ${C?"timed out":"failed"} (${w})`,Ln({retryOfRequestLogID:i,url:p,durationMs:x-y,message:v.message})),this.retryRequest(a,n,i??h);throw ze(this).info(`[${h}] connection ${C?"timed out":"failed"} - error; no more retries left`),ze(this).debug(`[${h}] connection ${C?"timed out":"failed"} (error; no more retries left)`,Ln({retryOfRequestLogID:i,url:p,durationMs:x-y,message:v.message})),C?new Cm:new Bs({cause:v})}const E=`[${h}${g}] ${d.method} ${p} ${v.ok?"succeeded":"failed"} with status ${v.status} in ${x-y}ms`;if(!v.ok){const w=await this.shouldRetry(v);if(n&&w){const A=`retrying, ${n} attempts remaining`;return await pT(v.body),ze(this).info(`${E} - ${A}`),ze(this).debug(`[${h}] response error (${A})`,Ln({retryOfRequestLogID:i,url:v.url,status:v.status,headers:v.headers,durationMs:x-y})),this.retryRequest(a,n,i??h,v.headers)}const C=w?"error; no more retries left":"error; not retryable";ze(this).info(`${E} - ${C}`);const P=await v.text().catch(A=>zr(A).message),k=oT(P),I=k?void 0:P;throw ze(this).debug(`[${h}] response error (${C})`,Ln({retryOfRequestLogID:i,url:v.url,status:v.status,headers:v.headers,message:I,durationMs:Date.now()-y})),this.makeStatusError(v.status,k,I,v.headers)}return ze(this).info(E),ze(this).debug(`[${h}] response start`,Ln({retryOfRequestLogID:i,url:v.url,status:v.status,headers:v.headers,durationMs:x-y})),{response:v,options:a,controller:_,requestLogID:h,retryOfRequestLogID:i,startTime:y}}async fetchWithTimeout(e,n,i,o){const s=n||{},{signal:r,method:a}=s,c=ls(s,["signal","method"]);r&&r.addEventListener("abort",()=>o.abort());const d=setTimeout(()=>o.abort(),i),p=globalThis.ReadableStream&&c.body instanceof globalThis.ReadableStream||typeof c.body=="object"&&c.body!==null&&Symbol.asyncIterator in c.body,f=Object.assign(Object.assign(Object.assign({signal:o.signal},p?{duplex:"half"}:{}),{method:"GET"}),c);a&&(f.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,f)}finally{clearTimeout(d)}}async shouldRetry(e){const n=e.headers.get("x-should-retry");return n==="true"?!0:n==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,n,i,o){var s;let r;const a=o==null?void 0:o.get("retry-after-ms");if(a){const d=parseFloat(a);Number.isNaN(d)||(r=d)}const c=o==null?void 0:o.get("retry-after");if(c&&!r){const d=parseFloat(c);Number.isNaN(d)?r=Date.parse(c)-Date.now():r=d*1e3}if(!(r&&0<=r&&r<60*1e3)){const d=(s=e.maxRetries)!==null&&s!==void 0?s:this.maxRetries;r=this.calculateDefaultRetryTimeoutMillis(n,d)}return await sT(r),this.makeRequest(e,n-1,i)}calculateDefaultRetryTimeoutMillis(e,n){const s=n-e,r=Math.min(.5*Math.pow(2,s),8),a=1-Math.random()*.25;return r*a*1e3}async buildRequest(e,{retryCount:n=0}={}){var i,o,s;const r=Object.assign({},e),{method:a,path:c,query:d,defaultBaseURL:p}=r,f=this.buildURL(c,d,p);"timeout"in r&&iT("timeout",r.timeout),r.timeout=(i=r.timeout)!==null&&i!==void 0?i:this.timeout;const{bodyHeaders:h,body:g}=this.buildBody({options:r}),y=await this.buildHeaders({options:e,method:a,bodyHeaders:h,retryCount:n});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:a,headers:y},r.signal&&{signal:r.signal}),globalThis.ReadableStream&&g instanceof globalThis.ReadableStream&&{duplex:"half"}),g&&{body:g}),(o=this.fetchOptions)!==null&&o!==void 0?o:{}),(s=r.fetchOptions)!==null&&s!==void 0?s:{}),url:f,timeout:r.timeout}}async buildHeaders({options:e,method:n,bodyHeaders:i,retryCount:o}){let s={};this.idempotencyHeader&&n!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=e.idempotencyKey);const r=await this.authHeaders(e);let a=Wi([s,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o)},e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{}),cT()),this._options.defaultHeaders,i,e.headers,r]);return this.validateHeaders(a),a.values}buildBody({options:{body:e,headers:n}}){if(!e)return{bodyHeaders:void 0,body:void 0};const i=Wi([n]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&i.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:dT(e)}:this.encoder({body:e,headers:i})}}Hs.DEFAULT_TIMEOUT=6e4;class Fe extends Hs{constructor(){super(...arguments),this.interactions=new $m(this)}}Gm=Fe;Fe.GeminiNextGenAPIClient=Gm;Fe.GeminiNextGenAPIClientError=mt;Fe.APIError=Ye;Fe.APIConnectionError=Bs;Fe.APIConnectionTimeoutError=Cm;Fe.APIUserAbortError=Yr;Fe.NotFoundError=km;Fe.ConflictError=Pm;Fe.RateLimitError=Rm;Fe.BadRequestError=Dm;Fe.AuthenticationError=Tm;Fe.InternalServerError=Mm;Fe.PermissionDeniedError=Am;Fe.UnprocessableEntityError=Im;Fe.toFile=vT;Fe.Interactions=$m;/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */function PT(t,e){const n={},i=l(t,["name"]);return i!=null&&u(n,["_url","name"],i),n}function IT(t,e){const n={},i=l(t,["name"]);return i!=null&&u(n,["_url","name"],i),n}function RT(t,e){const n={},i=l(t,["sdkHttpResponse"]);return i!=null&&u(n,["sdkHttpResponse"],i),n}function MT(t,e){const n={},i=l(t,["sdkHttpResponse"]);return i!=null&&u(n,["sdkHttpResponse"],i),n}function VT(t,e,n){const i={};if(l(t,["validationDataset"])!==void 0)throw new Error("validationDataset parameter is not supported in Gemini API.");const o=l(t,["tunedModelDisplayName"]);if(e!==void 0&&o!=null&&u(e,["displayName"],o),l(t,["description"])!==void 0)throw new Error("description parameter is not supported in Gemini API.");const s=l(t,["epochCount"]);e!==void 0&&s!=null&&u(e,["tuningTask","hyperparameters","epochCount"],s);const r=l(t,["learningRateMultiplier"]);if(r!=null&&u(i,["tuningTask","hyperparameters","learningRateMultiplier"],r),l(t,["exportLastCheckpointOnly"])!==void 0)throw new Error("exportLastCheckpointOnly parameter is not supported in Gemini API.");if(l(t,["preTunedModelCheckpointId"])!==void 0)throw new Error("preTunedModelCheckpointId parameter is not supported in Gemini API.");if(l(t,["adapterSize"])!==void 0)throw new Error("adapterSize parameter is not supported in Gemini API.");const a=l(t,["batchSize"]);e!==void 0&&a!=null&&u(e,["tuningTask","hyperparameters","batchSize"],a);const c=l(t,["learningRate"]);if(e!==void 0&&c!=null&&u(e,["tuningTask","hyperparameters","learningRate"],c),l(t,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");if(l(t,["beta"])!==void 0)throw new Error("beta parameter is not supported in Gemini API.");return i}function LT(t,e,n){const i={};let o=l(n,["config","method"]);if(o===void 0&&(o="SUPERVISED_FINE_TUNING"),o==="SUPERVISED_FINE_TUNING"){const g=l(t,["validationDataset"]);e!==void 0&&g!=null&&u(e,["supervisedTuningSpec"],Cu(g))}else if(o==="PREFERENCE_TUNING"){const g=l(t,["validationDataset"]);e!==void 0&&g!=null&&u(e,["preferenceOptimizationSpec"],Cu(g))}const s=l(t,["tunedModelDisplayName"]);e!==void 0&&s!=null&&u(e,["tunedModelDisplayName"],s);const r=l(t,["description"]);e!==void 0&&r!=null&&u(e,["description"],r);let a=l(n,["config","method"]);if(a===void 0&&(a="SUPERVISED_FINE_TUNING"),a==="SUPERVISED_FINE_TUNING"){const g=l(t,["epochCount"]);e!==void 0&&g!=null&&u(e,["supervisedTuningSpec","hyperParameters","epochCount"],g)}else if(a==="PREFERENCE_TUNING"){const g=l(t,["epochCount"]);e!==void 0&&g!=null&&u(e,["preferenceOptimizationSpec","hyperParameters","epochCount"],g)}let c=l(n,["config","method"]);if(c===void 0&&(c="SUPERVISED_FINE_TUNING"),c==="SUPERVISED_FINE_TUNING"){const g=l(t,["learningRateMultiplier"]);e!==void 0&&g!=null&&u(e,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],g)}else if(c==="PREFERENCE_TUNING"){const g=l(t,["learningRateMultiplier"]);e!==void 0&&g!=null&&u(e,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],g)}let d=l(n,["config","method"]);if(d===void 0&&(d="SUPERVISED_FINE_TUNING"),d==="SUPERVISED_FINE_TUNING"){const g=l(t,["exportLastCheckpointOnly"]);e!==void 0&&g!=null&&u(e,["supervisedTuningSpec","exportLastCheckpointOnly"],g)}else if(d==="PREFERENCE_TUNING"){const g=l(t,["exportLastCheckpointOnly"]);e!==void 0&&g!=null&&u(e,["preferenceOptimizationSpec","exportLastCheckpointOnly"],g)}let p=l(n,["config","method"]);if(p===void 0&&(p="SUPERVISED_FINE_TUNING"),p==="SUPERVISED_FINE_TUNING"){const g=l(t,["adapterSize"]);e!==void 0&&g!=null&&u(e,["supervisedTuningSpec","hyperParameters","adapterSize"],g)}else if(p==="PREFERENCE_TUNING"){const g=l(t,["adapterSize"]);e!==void 0&&g!=null&&u(e,["preferenceOptimizationSpec","hyperParameters","adapterSize"],g)}if(l(t,["batchSize"])!==void 0)throw new Error("batchSize parameter is not supported in Vertex AI.");if(l(t,["learningRate"])!==void 0)throw new Error("learningRate parameter is not supported in Vertex AI.");const f=l(t,["labels"]);e!==void 0&&f!=null&&u(e,["labels"],f);const h=l(t,["beta"]);return e!==void 0&&h!=null&&u(e,["preferenceOptimizationSpec","hyperParameters","beta"],h),i}function OT(t,e){const n={},i=l(t,["baseModel"]);i!=null&&u(n,["baseModel"],i);const o=l(t,["preTunedModel"]);o!=null&&u(n,["preTunedModel"],o);const s=l(t,["trainingDataset"]);s!=null&&WT(s);const r=l(t,["config"]);return r!=null&&VT(r,n),n}function jT(t,e){const n={},i=l(t,["baseModel"]);i!=null&&u(n,["baseModel"],i);const o=l(t,["preTunedModel"]);o!=null&&u(n,["preTunedModel"],o);const s=l(t,["trainingDataset"]);s!=null&&zT(s,n,e);const r=l(t,["config"]);return r!=null&&LT(r,n,e),n}function FT(t,e){const n={},i=l(t,["name"]);return i!=null&&u(n,["_url","name"],i),n}function qT(t,e){const n={},i=l(t,["name"]);return i!=null&&u(n,["_url","name"],i),n}function UT(t,e,n){const i={},o=l(t,["pageSize"]);e!==void 0&&o!=null&&u(e,["_query","pageSize"],o);const s=l(t,["pageToken"]);e!==void 0&&s!=null&&u(e,["_query","pageToken"],s);const r=l(t,["filter"]);return e!==void 0&&r!=null&&u(e,["_query","filter"],r),i}function $T(t,e,n){const i={},o=l(t,["pageSize"]);e!==void 0&&o!=null&&u(e,["_query","pageSize"],o);const s=l(t,["pageToken"]);e!==void 0&&s!=null&&u(e,["_query","pageToken"],s);const r=l(t,["filter"]);return e!==void 0&&r!=null&&u(e,["_query","filter"],r),i}function BT(t,e){const n={},i=l(t,["config"]);return i!=null&&UT(i,n),n}function GT(t,e){const n={},i=l(t,["config"]);return i!=null&&$T(i,n),n}function HT(t,e){const n={},i=l(t,["sdkHttpResponse"]);i!=null&&u(n,["sdkHttpResponse"],i);const o=l(t,["nextPageToken"]);o!=null&&u(n,["nextPageToken"],o);const s=l(t,["tunedModels"]);if(s!=null){let r=s;Array.isArray(r)&&(r=r.map(a=>Hm(a))),u(n,["tuningJobs"],r)}return n}function KT(t,e){const n={},i=l(t,["sdkHttpResponse"]);i!=null&&u(n,["sdkHttpResponse"],i);const o=l(t,["nextPageToken"]);o!=null&&u(n,["nextPageToken"],o);const s=l(t,["tuningJobs"]);if(s!=null){let r=s;Array.isArray(r)&&(r=r.map(a=>Zr(a))),u(n,["tuningJobs"],r)}return n}function JT(t,e){const n={},i=l(t,["name"]);i!=null&&u(n,["model"],i);const o=l(t,["name"]);return o!=null&&u(n,["endpoint"],o),n}function WT(t,e){const n={};if(l(t,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(l(t,["vertexDatasetResource"])!==void 0)throw new Error("vertexDatasetResource parameter is not supported in Gemini API.");const i=l(t,["examples"]);if(i!=null){let o=i;Array.isArray(o)&&(o=o.map(s=>s)),u(n,["examples","examples"],o)}return n}function zT(t,e,n){const i={};let o=l(n,["config","method"]);if(o===void 0&&(o="SUPERVISED_FINE_TUNING"),o==="SUPERVISED_FINE_TUNING"){const r=l(t,["gcsUri"]);e!==void 0&&r!=null&&u(e,["supervisedTuningSpec","trainingDatasetUri"],r)}else if(o==="PREFERENCE_TUNING"){const r=l(t,["gcsUri"]);e!==void 0&&r!=null&&u(e,["preferenceOptimizationSpec","trainingDatasetUri"],r)}let s=l(n,["config","method"]);if(s===void 0&&(s="SUPERVISED_FINE_TUNING"),s==="SUPERVISED_FINE_TUNING"){const r=l(t,["vertexDatasetResource"]);e!==void 0&&r!=null&&u(e,["supervisedTuningSpec","trainingDatasetUri"],r)}else if(s==="PREFERENCE_TUNING"){const r=l(t,["vertexDatasetResource"]);e!==void 0&&r!=null&&u(e,["preferenceOptimizationSpec","trainingDatasetUri"],r)}if(l(t,["examples"])!==void 0)throw new Error("examples parameter is not supported in Vertex AI.");return i}function Hm(t,e){const n={},i=l(t,["sdkHttpResponse"]);i!=null&&u(n,["sdkHttpResponse"],i);const o=l(t,["name"]);o!=null&&u(n,["name"],o);const s=l(t,["state"]);s!=null&&u(n,["state"],am(s));const r=l(t,["createTime"]);r!=null&&u(n,["createTime"],r);const a=l(t,["tuningTask","startTime"]);a!=null&&u(n,["startTime"],a);const c=l(t,["tuningTask","completeTime"]);c!=null&&u(n,["endTime"],c);const d=l(t,["updateTime"]);d!=null&&u(n,["updateTime"],d);const p=l(t,["description"]);p!=null&&u(n,["description"],p);const f=l(t,["baseModel"]);f!=null&&u(n,["baseModel"],f);const h=l(t,["_self"]);return h!=null&&u(n,["tunedModel"],JT(h)),n}function Zr(t,e){const n={},i=l(t,["sdkHttpResponse"]);i!=null&&u(n,["sdkHttpResponse"],i);const o=l(t,["name"]);o!=null&&u(n,["name"],o);const s=l(t,["state"]);s!=null&&u(n,["state"],am(s));const r=l(t,["createTime"]);r!=null&&u(n,["createTime"],r);const a=l(t,["startTime"]);a!=null&&u(n,["startTime"],a);const c=l(t,["endTime"]);c!=null&&u(n,["endTime"],c);const d=l(t,["updateTime"]);d!=null&&u(n,["updateTime"],d);const p=l(t,["error"]);p!=null&&u(n,["error"],p);const f=l(t,["description"]);f!=null&&u(n,["description"],f);const h=l(t,["baseModel"]);h!=null&&u(n,["baseModel"],h);const g=l(t,["tunedModel"]);g!=null&&u(n,["tunedModel"],g);const y=l(t,["preTunedModel"]);y!=null&&u(n,["preTunedModel"],y);const _=l(t,["supervisedTuningSpec"]);_!=null&&u(n,["supervisedTuningSpec"],_);const v=l(t,["preferenceOptimizationSpec"]);v!=null&&u(n,["preferenceOptimizationSpec"],v);const x=l(t,["tuningDataStats"]);x!=null&&u(n,["tuningDataStats"],x);const E=l(t,["encryptionSpec"]);E!=null&&u(n,["encryptionSpec"],E);const w=l(t,["partnerModelTuningSpec"]);w!=null&&u(n,["partnerModelTuningSpec"],w);const C=l(t,["customBaseModel"]);C!=null&&u(n,["customBaseModel"],C);const P=l(t,["experiment"]);P!=null&&u(n,["experiment"],P);const k=l(t,["labels"]);k!=null&&u(n,["labels"],k);const I=l(t,["outputUri"]);I!=null&&u(n,["outputUri"],I);const j=l(t,["pipelineJob"]);j!=null&&u(n,["pipelineJob"],j);const A=l(t,["serviceAccount"]);A!=null&&u(n,["serviceAccount"],A);const R=l(t,["tunedModelDisplayName"]);R!=null&&u(n,["tunedModelDisplayName"],R);const q=l(t,["veoTuningSpec"]);return q!=null&&u(n,["veoTuningSpec"],q),n}function YT(t,e){const n={},i=l(t,["sdkHttpResponse"]);i!=null&&u(n,["sdkHttpResponse"],i);const o=l(t,["name"]);o!=null&&u(n,["name"],o);const s=l(t,["metadata"]);s!=null&&u(n,["metadata"],s);const r=l(t,["done"]);r!=null&&u(n,["done"],r);const a=l(t,["error"]);return a!=null&&u(n,["error"],a),n}function Cu(t,e){const n={},i=l(t,["gcsUri"]);i!=null&&u(n,["validationDatasetUri"],i);const o=l(t,["vertexDatasetResource"]);return o!=null&&u(n,["validationDatasetUri"],o),n}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class QT extends sn{constructor(e){super(),this.apiClient=e,this.list=async(n={})=>new ai(nn.PAGED_ITEM_TUNING_JOBS,i=>this.listInternal(i),await this.listInternal(n),n),this.get=async n=>await this.getInternal(n),this.tune=async n=>{var i;if(this.apiClient.isVertexAI())if(n.baseModel.startsWith("projects/")){const o={tunedModelName:n.baseModel};!((i=n.config)===null||i===void 0)&&i.preTunedModelCheckpointId&&(o.checkpointId=n.config.preTunedModelCheckpointId);const s=Object.assign(Object.assign({},n),{preTunedModel:o});return s.baseModel=void 0,await this.tuneInternal(s)}else{const o=Object.assign({},n);return await this.tuneInternal(o)}else{const o=Object.assign({},n),s=await this.tuneMldevInternal(o);let r="";return s.metadata!==void 0&&s.metadata.tunedModel!==void 0?r=s.metadata.tunedModel:s.name!==void 0&&s.name.includes("/operations/")&&(r=s.name.split("/operations/")[0]),{name:r,state:Ur.JOB_STATE_QUEUED}}}}async getInternal(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=qT(e);return a=z("{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>Zr(p))}else{const d=FT(e);return a=z("{name}",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>Hm(p))}}async listInternal(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=GT(e);return a=z("tuningJobs",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=KT(p),h=new Xc;return Object.assign(h,f),h})}else{const d=BT(e);return a=z("tunedModels",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"GET",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=HT(p),h=new Xc;return Object.assign(h,f),h})}}async cancel(e){var n,i,o,s;let r,a="",c={};if(this.apiClient.isVertexAI()){const d=IT(e);return a=z("{name}:cancel",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=MT(p),h=new Zc;return Object.assign(h,f),h})}else{const d=PT(e);return a=z("{name}:cancel",d._url),c=d._query,delete d._url,delete d._query,r=this.apiClient.request({path:a,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(o=e.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(f=>{const h=f;return h.sdkHttpResponse={headers:p.headers},h})),r.then(p=>{const f=RT(p),h=new Zc;return Object.assign(h,f),h})}}async tuneInternal(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI()){const a=jT(e,e);return s=z("tuningJobs",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json().then(d=>{const p=d;return p.sdkHttpResponse={headers:c.headers},p})),o.then(c=>Zr(c))}else throw new Error("This method is only supported by the Vertex AI.")}async tuneMldevInternal(e){var n,i;let o,s="",r={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const a=OT(e);return s=z("tunedModels",a._url),r=a._query,delete a._url,delete a._query,o=this.apiClient.request({path:s,queryParams:r,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(i=e.config)===null||i===void 0?void 0:i.abortSignal}).then(c=>c.json().then(d=>{const p=d;return p.sdkHttpResponse={headers:c.headers},p})),o.then(c=>YT(c))}}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class XT{async download(e,n){throw new Error("Download to file is not supported in the browser, please use a browser compliant download like an <a> tag.")}}const ZT=1024*1024*8,eA=3,tA=1e3,nA=2,us="x-goog-upload-status";async function iA(t,e,n){var i;const o=await Km(t,e,n),s=await(o==null?void 0:o.json());if(((i=o==null?void 0:o.headers)===null||i===void 0?void 0:i[us])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");return s.file}async function oA(t,e,n){var i;const o=await Km(t,e,n),s=await(o==null?void 0:o.json());if(((i=o==null?void 0:o.headers)===null||i===void 0?void 0:i[us])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");const r=tm(s),a=new Ea;return Object.assign(a,r),a}async function Km(t,e,n){var i,o;let s=0,r=0,a=new $r(new Response),c="upload";for(s=t.size;r<s;){const d=Math.min(ZT,s-r),p=t.slice(r,r+d);r+d>=s&&(c+=", finalize");let f=0,h=tA;for(;f<eA&&(a=await n.request({path:"",body:p,httpMethod:"POST",httpOptions:{apiVersion:"",baseUrl:e,headers:{"X-Goog-Upload-Command":c,"X-Goog-Upload-Offset":String(r),"Content-Length":String(d)}}}),!(!((i=a==null?void 0:a.headers)===null||i===void 0)&&i[us]));)f++,await rA(h),h=h*nA;if(r+=d,((o=a==null?void 0:a.headers)===null||o===void 0?void 0:o[us])!=="active")break;if(s<=r)throw new Error("All content has been uploaded, but the upload status is not finalized.")}return a}async function sA(t){return{size:t.size,type:t.type}}function rA(t){return new Promise(e=>setTimeout(e,t))}class aA{async upload(e,n,i){if(typeof e=="string")throw new Error("File path is not supported in browser uploader.");return await iA(e,n,i)}async uploadToFileSearchStore(e,n,i){if(typeof e=="string")throw new Error("File path is not supported in browser uploader.");return await oA(e,n,i)}async stat(e){if(typeof e=="string")throw new Error("File path is not supported in browser uploader.");return await sA(e)}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */class lA{create(e,n,i){return new cA(e,n,i)}}class cA{constructor(e,n,i){this.url=e,this.headers=n,this.callbacks=i}connect(){this.ws=new WebSocket(this.url),this.ws.onopen=this.callbacks.onopen,this.ws.onerror=this.callbacks.onerror,this.ws.onclose=this.callbacks.onclose,this.ws.onmessage=this.callbacks.onmessage}send(e){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.send(e)}close(){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.close()}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */const Du="x-goog-api-key";class uA{constructor(e){this.apiKey=e}async addAuthHeaders(e,n){if(e.get(Du)===null){if(this.apiKey.startsWith("auth_tokens/"))throw new Error("Ephemeral tokens are only supported by the live API.");if(!this.apiKey)throw new Error("API key is missing. Please provide a valid API key.");e.append(Du,this.apiKey)}}}/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */const dA="gl-node/";class pA{get interactions(){if(this._interactions!==void 0)return this._interactions;console.warn("GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.");const e=this.httpOptions;e!=null&&e.extraBody&&console.warn("GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.");const n=new Fe({baseURL:this.apiClient.getBaseUrl(),apiKey:this.apiKey,apiVersion:this.apiClient.getApiVersion(),clientAdapter:this.apiClient,defaultHeaders:this.apiClient.getDefaultHeaders(),timeout:e==null?void 0:e.timeout});return this._interactions=n.interactions,this._interactions}constructor(e){var n;if(e.apiKey==null)throw new Error("An API Key must be set when running in a browser");if(e.project||e.location)throw new Error("Vertex AI project based authentication is not supported on browser runtimes. Please do not provide a project or location.");this.vertexai=(n=e.vertexai)!==null&&n!==void 0?n:!1,this.apiKey=e.apiKey;const i=rx(e.httpOptions,e.vertexai,void 0,void 0);i&&(e.httpOptions?e.httpOptions.baseUrl=i:e.httpOptions={baseUrl:i}),this.apiVersion=e.apiVersion,this.httpOptions=e.httpOptions;const o=new uA(this.apiKey);this.apiClient=new sD({auth:o,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:dA+"web",uploader:new aA,downloader:new XT}),this.models=new ED(this.apiClient),this.live=new vD(this.apiClient,o,new lA),this.batches=new VS(this.apiClient),this.chats=new gE(this.models,this.apiClient),this.caches=new mE(this.apiClient),this.files=new CE(this.apiClient),this.operations=new wD(this.apiClient),this.authTokens=new UD(this.apiClient),this.tunings=new QT(this.apiClient),this.fileSearchStores=new zD(this.apiClient)}}var Tu={};const mA=async t=>({inlineData:{data:await new Promise(n=>{const i=new FileReader;i.onloadend=()=>n(i.result.split(",")[1]),i.readAsDataURL(t)}),mimeType:t.type}}),Jm=({isOpen:t,onClose:e})=>{const{addCheque:n}=si(),{suppliers:i,customers:o}=lp(),{t:s}=ni(),{showToast:r}=$t(),[a,c]=b.useState(null),[d,p]=b.useState(null),[f,h]=b.useState(!1),[g,y]=b.useState(null),[_,v]=b.useState("upload"),[x,E]=b.useState({}),[w,C]=b.useState("receivable"),P=b.useRef(null),[k,I]=b.useState(!1),j=()=>{c(null),p(null),h(!1),y(null),v("upload"),E({}),C("receivable"),I(!1)},A=()=>{j(),e()},R=T=>{var Q;const $=(Q=T.target.files)==null?void 0:Q[0];$&&(c($),p(URL.createObjectURL($)),y(null))},q=T=>{c(T),p(URL.createObjectURL(T)),y(null),I(!1)},G=async()=>{if(!a){y("Select a cheque source.");return}if(!Tu.API_KEY){y("AI scanning unavailable. Key missing.");return}h(!0),y(null);try{const T=new pA({apiKey:Tu.API_KEY||""}),$=await mA(a),Q={type:et.OBJECT,properties:{partyName:{type:et.STRING,description:"The name of the payee or the payer."},chequeNumber:{type:et.STRING,description:"The unique identification number of the cheque."},bankName:{type:et.STRING,description:"The issuing financial institution."},date:{type:et.STRING,description:"The date in YYYY-MM-DD format."},amount:{type:et.NUMBER,description:"The amount on the cheque."}},required:["partyName","chequeNumber","bankName","date","amount"]},X=await T.models.generateContent({model:"gemini-2.5-flash",contents:{parts:[$,{text:"Perform OCR and extract financial data: Payee/Payer, Cheque Number, Bank, Amount, and Date (YYYY-MM-DD)."}]},config:{responseMimeType:"application/json",responseSchema:Q}}),te=JSON.parse(X.text);E({partyName:te.partyName,chequeNumber:te.chequeNumber,bank:te.bankName,amount:te.amount,issueDate:te.date?new Date(te.date+"T00:00:00"):new Date,dueDate:te.date?new Date(te.date+"T00:00:00"):new Date}),v("confirm")}catch(T){console.error("OCR Error:",T),y("Analysis failed. Ensure the document is flat and well-lit.")}finally{h(!1)}},L=()=>{if(!x.amount||!x.chequeNumber||!x.partyId){r("Validate amount, cheque #, and linked account.","warning");return}const $=(w==="receivable"?o:i).find(X=>X.id===x.partyId);if(!$){r("Linked account reference is invalid.","error");return}const Q={type:w,partyId:x.partyId,partyName:$.name,chequeNumber:x.chequeNumber,bank:x.bank||"Manual Bank Entry",amount:x.amount,issueDate:x.issueDate||new Date,dueDate:x.dueDate||new Date,status:"pending",notes:x.notes};n(Q),A()};if(!t)return null;if(k)return m.jsxDEV(gp,{onCapture:q,onClose:()=>I(!1),guideType:"cheque"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:190,columnNumber:16},void 0);const F=w==="receivable"?o:i;return m.jsxDEV(Zp,{isOpen:t,onClose:A,title:s("accounting_modals.scan_cheque.title"),subtitle:"Extract Details",icon:Yn,variant:"primary",maxWidth:"max-w-4xl",children:m.jsxDEV("div",{className:"space-y-8",children:[_==="upload"&&m.jsxDEV("div",{className:"flex flex-col items-center justify-center py-6 sm:py-10 text-center",children:[d?m.jsxDEV("div",{className:"w-full max-w-lg mb-8 animate-scale-in",children:[m.jsxDEV("div",{className:"relative group rounded-[2.5rem] overflow-hidden shadow-2xl border-8 border-white dark:border-gray-800 aspect-[2.4/1]",children:[m.jsxDEV("img",{src:d,alt:"Cheque preview",className:"w-full h-full object-cover transition-transform group-hover:scale-105 duration-500"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:211,columnNumber:37},void 0),m.jsxDEV("div",{className:"absolute inset-0 bg-gradient-to-t from-black/20 to-transparent"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:212,columnNumber:37},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:210,columnNumber:33},void 0),m.jsxDEV("p",{className:"text-[10px] font-black text-gray-400 dark:text-gray-500 mt-4 uppercase tracking-[0.2em] flex items-center justify-center gap-2",children:[m.jsxDEV(Ft,{size:12,className:"text-indigo-500"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:215,columnNumber:37},void 0)," ",a==null?void 0:a.name]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:214,columnNumber:33},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:209,columnNumber:29},void 0):m.jsxDEV("div",{className:"mb-12 animate-fade-in",children:[m.jsxDEV("div",{className:"w-32 h-32 bg-gray-50 dark:bg-gray-900 border border-gray-100 dark:border-gray-800 rounded-[3rem] flex items-center justify-center mx-auto mb-6 shadow-xl shadow-gray-200/20 dark:shadow-none",children:m.jsxDEV(pf,{size:48,className:"text-indigo-500 opacity-40"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:221,columnNumber:37},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:220,columnNumber:33},void 0),m.jsxDEV("h3",{className:"text-2xl font-black text-gray-900 dark:text-white uppercase tracking-tight mb-2",children:"Upload Cheque"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:223,columnNumber:33},void 0),m.jsxDEV("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 max-w-xs mx-auto",children:"Upload an image of the cheque for processing."},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:224,columnNumber:33},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:219,columnNumber:29},void 0),m.jsxDEV("div",{className:"w-full max-w-sm grid grid-cols-1 gap-4",children:[m.jsxDEV(_t,{variant:"secondary",onClick:()=>{var T;return(T=P.current)==null?void 0:T.click()},icon:ed,className:"w-full py-5",children:s("accounting_modals.scan_cheque.actions.library_upload")},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:229,columnNumber:29},void 0),m.jsxDEV(_t,{variant:"primary",onClick:()=>I(!0),icon:Yn,className:"w-full py-5",children:s("accounting_modals.scan_cheque.actions.capture_now")},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:237,columnNumber:29},void 0),m.jsxDEV("input",{type:"file",ref:P,onChange:R,className:"hidden",accept:"image/*"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:245,columnNumber:29},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:228,columnNumber:25},void 0),g&&m.jsxDEV("div",{className:"mt-8 flex items-center gap-3 text-rose-500 bg-rose-50 dark:bg-rose-900/10 px-6 py-3 rounded-2xl border border-rose-100 dark:border-rose-900/30 animate-shake",children:[m.jsxDEV(Fi,{size:18},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:250,columnNumber:33},void 0),m.jsxDEV("span",{className:"text-xs font-black uppercase tracking-widest",children:g},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:251,columnNumber:33},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:249,columnNumber:29},void 0),m.jsxDEV("div",{className:"mt-12 pt-10 border-t border-gray-100 dark:border-gray-800 w-full max-w-sm",children:m.jsxDEV(_t,{variant:"primary",onClick:G,disabled:!a||f,isLoading:f,className:"w-full py-5 text-sm",children:f?s("accounting_modals.scan_cheque.actions.processing"):"Start AI Analysis"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:256,columnNumber:29},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:255,columnNumber:25},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:207,columnNumber:21},void 0),_==="confirm"&&m.jsxDEV("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-10 animate-fade-in",children:[m.jsxDEV("div",{className:"space-y-8",children:[m.jsxDEV("div",{className:"flex items-center gap-4",children:[m.jsxDEV("div",{className:"w-12 h-12 rounded-2xl bg-indigo-50 dark:bg-indigo-900/20 flex items-center justify-center",children:m.jsxDEV(Yo,{size:24,className:"text-indigo-500 animate-spin-once"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:274,columnNumber:37},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:273,columnNumber:33},void 0),m.jsxDEV("div",{children:[m.jsxDEV("h3",{className:"text-xl font-black text-gray-900 dark:text-white uppercase tracking-tight",children:s("accounting_modals.scan_cheque.verify_details")},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:277,columnNumber:37},void 0),m.jsxDEV("p",{className:"text-[10px] text-gray-500 dark:text-gray-400 font-black uppercase tracking-widest mt-0.5",children:s("accounting_modals.scan_cheque.review_extractions")},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:278,columnNumber:37},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:276,columnNumber:33},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:272,columnNumber:29},void 0),m.jsxDEV("div",{className:"space-y-6",children:[m.jsxDEV(Fr,{label:s("accounting_modals.scan_cheque.labels.type"),value:w,onChange:T=>C(T.target.value),children:[m.jsxDEV("option",{value:"receivable",children:s("accounting_modals.scan_cheque.types.receivable")},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:288,columnNumber:37},void 0),m.jsxDEV("option",{value:"payable",children:s("accounting_modals.scan_cheque.types.payable")},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:289,columnNumber:37},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:283,columnNumber:33},void 0),m.jsxDEV(Fr,{label:s("accounting_modals.scan_cheque.labels.link_account"),value:x.partyId||"",onChange:T=>E($=>({...$,partyId:T.target.value})),children:[m.jsxDEV("option",{value:"",children:s("accounting_modals.scan_cheque.labels.choose_entity")},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:297,columnNumber:37},void 0),F.map(T=>m.jsxDEV("option",{value:T.id,children:T.name},T.id,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:298,columnNumber:61},void 0))]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:292,columnNumber:33},void 0),m.jsxDEV("div",{className:"grid grid-cols-2 gap-4",children:[m.jsxDEV(Xt,{label:"Cheque #",value:x.chequeNumber||"",onChange:T=>E($=>({...$,chequeNumber:T.target.value})),className:"font-mono"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:302,columnNumber:37},void 0),m.jsxDEV(Xt,{label:s("accounting_modals.scan_cheque.labels.bank"),value:x.bank||"",onChange:T=>E($=>({...$,bank:T.target.value}))},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:308,columnNumber:37},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:301,columnNumber:33},void 0),m.jsxDEV(Xt,{label:s("accounting_modals.scan_cheque.labels.value"),type:"number",step:"0.01",value:x.amount,onChange:T=>E($=>({...$,amount:parseFloat(T.target.value)})),icon:na,className:"text-xl font-black text-green-600 dark:text-green-400 font-mono"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:315,columnNumber:33},void 0),m.jsxDEV("div",{className:"grid grid-cols-2 gap-4",children:[m.jsxDEV(Xt,{label:s("accounting_modals.scan_cheque.labels.date"),type:"date",value:x.issueDate?new Date(x.issueDate).toISOString().split("T")[0]:"",onChange:T=>E($=>({...$,issueDate:new Date(T.target.value)})),icon:Qn},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:326,columnNumber:37},void 0),m.jsxDEV(Xt,{label:s("accounting_modals.scan_cheque.labels.maturity"),type:"date",value:x.dueDate?new Date(x.dueDate).toISOString().split("T")[0]:"",onChange:T=>E($=>({...$,dueDate:new Date(T.target.value)})),icon:Qn},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:333,columnNumber:37},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:325,columnNumber:33},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:282,columnNumber:29},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:271,columnNumber:25},void 0),m.jsxDEV("div",{className:"space-y-6",children:[m.jsxDEV("h3",{className:"text-[10px] font-black text-gray-400 uppercase tracking-[0.2em]",children:s("accounting_modals.scan_cheque.document_source")},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:345,columnNumber:29},void 0),m.jsxDEV("div",{className:"border-8 border-gray-50 dark:border-gray-800 rounded-[3rem] overflow-hidden shadow-2xl sticky top-0 flex items-center justify-center bg-gray-50 dark:bg-gray-950 aspect-[2/1] lg:aspect-auto ring-1 ring-gray-100 dark:ring-gray-800",children:m.jsxDEV("img",{src:d||"",alt:"Cheque preview",className:"max-w-full max-h-[500px] object-contain transition-transform hover:scale-110 duration-700"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:347,columnNumber:33},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:346,columnNumber:29},void 0),m.jsxDEV("div",{className:"p-4 bg-indigo-50 dark:bg-indigo-900/20 rounded-2xl border border-indigo-100 dark:border-indigo-900/30 flex items-center space-x-3",children:[m.jsxDEV(Yo,{className:"h-4 w-4 text-indigo-500 animate-spin-once"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:350,columnNumber:33},void 0),m.jsxDEV("p",{className:"text-[10px] font-black text-indigo-800 dark:text-indigo-300 uppercase tracking-tight",children:"AI Confidence: High (Metadata Synthesis)"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:351,columnNumber:33},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:349,columnNumber:29},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:344,columnNumber:25},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:270,columnNumber:21},void 0),m.jsxDEV("div",{className:"pt-8 border-t dark:border-gray-800 flex flex-col sm:flex-row justify-end gap-3",children:_==="confirm"?m.jsxDEV(m.Fragment,{children:[m.jsxDEV(_t,{variant:"secondary",onClick:()=>v("upload"),className:"w-full sm:w-auto px-8",children:s("accounting_modals.scan_cheque.actions.recapture")},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:360,columnNumber:29},void 0),m.jsxDEV(_t,{onClick:L,icon:nd,className:"w-full sm:w-[220px]",children:s("accounting_modals.scan_cheque.actions.confirm")},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:367,columnNumber:29},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:359,columnNumber:25},void 0):m.jsxDEV(_t,{variant:"secondary",onClick:A,className:"w-full sm:w-auto px-8",children:s("hr.attendance_kiosk.cancel")},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:376,columnNumber:25},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:357,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:205,columnNumber:13},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/accounting/ScanChequeModal.tsx",lineNumber:196,columnNumber:9},void 0)},KI=Object.freeze(Object.defineProperty({__proto__:null,default:Jm},Symbol.toStringTag,{value:"Module"})),fA=({isOpen:t,onClose:e,onScanInvoice:n,onScanCheque:i,onScanJob:o})=>t?m.jsxDEV("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-end justify-center p-4 z-50 animate-fade-in",onClick:e,children:m.jsxDEV("div",{className:"bg-white dark:bg-gray-800 rounded-2xl w-full max-w-md p-6 shadow-2xl animate-slide-up",onClick:s=>s.stopPropagation(),children:[m.jsxDEV("div",{className:"flex justify-between items-center mb-4",children:[m.jsxDEV("h2",{className:"text-xl font-bold text-gray-900 dark:text-white",children:"Capture Document"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:31,columnNumber:11},void 0),m.jsxDEV("button",{onClick:e,className:"text-gray-400 hover:text-gray-600 p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:m.jsxDEV(en,{className:"h-6 w-6"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:36,columnNumber:13},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:32,columnNumber:11},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:30,columnNumber:9},void 0),m.jsxDEV("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[m.jsxDEV("button",{onClick:o,className:"group flex flex-col items-center justify-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-xl border border-gray-200 dark:border-gray-700 hover:shadow-md hover:border-indigo-300 dark:hover:border-indigo-600 transition-all duration-200",children:[m.jsxDEV(id,{className:"h-8 w-8 text-indigo-500 mb-2 transition-transform group-hover:scale-110"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:44,columnNumber:13},void 0),m.jsxDEV("span",{className:"font-semibold text-sm text-center leading-tight text-gray-800 dark:text-gray-200",children:"Scan Job"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:45,columnNumber:13},void 0),m.jsxDEV("p",{className:"text-[10px] text-gray-500 dark:text-gray-400 mt-1",children:"track progress"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:46,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:40,columnNumber:11},void 0),m.jsxDEV("button",{onClick:n,className:"group flex flex-col items-center justify-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-xl border border-gray-200 dark:border-gray-700 hover:shadow-md hover:border-blue-300 dark:hover:border-blue-600 transition-all duration-200",children:[m.jsxDEV(Ft,{className:"h-8 w-8 text-blue-500 mb-2 transition-transform group-hover:scale-110"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:52,columnNumber:13},void 0),m.jsxDEV("span",{className:"font-semibold text-sm text-center leading-tight text-gray-800 dark:text-gray-200",children:"Scan Bill"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:53,columnNumber:13},void 0),m.jsxDEV("p",{className:"text-[10px] text-gray-500 dark:text-gray-400 mt-1",children:"for expenses"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:54,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:48,columnNumber:11},void 0),m.jsxDEV("button",{onClick:i,className:"group flex flex-col items-center justify-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-xl border border-gray-200 dark:border-gray-700 hover:shadow-md hover:border-purple-300 dark:hover:border-purple-600 transition-all duration-200",children:[m.jsxDEV(Yn,{className:"h-8 w-8 text-purple-500 mb-2 transition-transform group-hover:scale-110"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:60,columnNumber:13},void 0),m.jsxDEV("span",{className:"font-semibold text-sm text-center leading-tight text-gray-800 dark:text-gray-200",children:"Scan Cheque"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:61,columnNumber:13},void 0),m.jsxDEV("p",{className:"text-[10px] text-gray-500 dark:text-gray-400 mt-1",children:"for payments"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:62,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:56,columnNumber:11},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:39,columnNumber:9},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:26,columnNumber:7},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/CaptureOptionsModal.tsx",lineNumber:22,columnNumber:5},void 0):null,Au={admin:[{section:"Main",items:[{name:"Dashboard",href:"/dashboard",icon:Lt},{name:"Orders",href:"/orders",icon:Wt},{name:"Quotations",href:"/quotations",icon:Ft},{name:"Invoices",href:"/invoices",icon:Ot}]},{section:"Operations",items:[{name:"Job Board",href:"/production/board",icon:Uo},{name:"Production",href:"/production-tracking",icon:to},{name:"Inventory",href:"/inventory",icon:Bo},{name:"Materials",href:"/materials",icon:eo},{name:"Scheduling",href:"/machine-scheduling",icon:Qn},{name:"Dispatch",href:"/dispatch",icon:ar},{name:"Quality",href:"/quality-control",icon:$o},{name:"Maintenance",href:"/maintenance",icon:lr},{name:"Layout Planner",href:"/layout-planner",icon:Fa}]},{section:"Finance & HR",items:[{name:"Accounting",href:"/accounting",icon:Ot},{name:"Chart of Accounts",href:"/chart-of-accounts",icon:od},{name:"Purchase Orders",href:"/purchase-orders",icon:cr},{name:"Payroll & HR",href:"/payroll",icon:ur},{name:"Commission",href:"/commission",icon:dr},{name:"Attendance",href:"/attendance",icon:xi},{name:"Partners",href:"/partners",icon:mf},{name:"Job Costing",href:"/job-costing",icon:qa}]},{section:"Analytics",items:[{name:"Analytics",href:"/analytics",icon:Si},{name:"Sales Analysis",href:"/sales-analysis",icon:qa},{name:"Executive BI",href:"/executive-bi",icon:Si}]},{section:"System",items:[{name:"Administration",href:"/admin",icon:uo}]}],manager:[{section:"Main",items:[{name:"Dashboard",href:"/dashboard",icon:Lt},{name:"Orders",href:"/orders",icon:Wt},{name:"Quotations",href:"/quotations",icon:Ft},{name:"Invoices",href:"/invoices",icon:Ot}]},{section:"Operations",items:[{name:"Job Board",href:"/production/board",icon:Uo},{name:"Production",href:"/production-tracking",icon:to},{name:"Inventory",href:"/inventory",icon:Bo},{name:"Materials",href:"/materials",icon:eo},{name:"Scheduling",href:"/machine-scheduling",icon:Qn},{name:"Dispatch",href:"/dispatch",icon:ar},{name:"Quality",href:"/quality-control",icon:$o},{name:"Maintenance",href:"/maintenance",icon:lr}]},{section:"Finance & HR",items:[{name:"Accounting",href:"/accounting",icon:Ot},{name:"Purchase Orders",href:"/purchase-orders",icon:cr},{name:"Payroll & HR",href:"/payroll",icon:ur},{name:"Commission",href:"/commission",icon:dr},{name:"Attendance",href:"/attendance",icon:xi},{name:"Analytics",href:"/analytics",icon:Si}]}],worker:[{section:"Main",items:[{name:"Dashboard",href:"/dashboard",icon:Lt},{name:"Orders",href:"/orders",icon:Wt}]},{section:"Production",items:[{name:"Job Board",href:"/production/board",icon:Uo},{name:"Production",href:"/production-tracking",icon:to},{name:"Quality Control",href:"/quality-control",icon:$o},{name:"Layout Planner",href:"/layout-planner",icon:Fa},{name:"Inventory",href:"/inventory",icon:Bo},{name:"Attendance",href:"/attendance",icon:xi}]}],customer:[{section:"Main",items:[{name:"Dashboard",href:"/dashboard",icon:Lt},{name:"My Orders",href:"/orders",icon:Wt},{name:"New Order",href:"/new-order",icon:Wt},{name:"Request Quote",href:"/request-quote",icon:Ft},{name:"Materials",href:"/materials",icon:eo}]}],supplier:[{section:"Main",items:[{name:"Dashboard",href:"/dashboard",icon:Lt},{name:"Orders",href:"/orders",icon:Wt}]}]},hA=({isOpen:t,onClose:e})=>{var x,E;const{user:n,logout:i}=Ut(),{theme:o}=Et(),{t:s}=ni(),r=ji(),a=o.mode==="dark",[c,d]=b.useState(""),p=ds(),f=w=>p.pathname===w||p.pathname.startsWith(w+"/"),h=Au[n==null?void 0:n.role]||Au.customer,g=h.flatMap(w=>w.items),y=c.trim()?g.filter(w=>w.name.toLowerCase().includes(c.toLowerCase())):null,_=()=>{e(),i(),r("/login")},v=w=>{r(w),setTimeout(()=>{e(),d("")},30)};return t?m.jsxDEV("div",{className:"md:hidden fixed inset-0 z-[300]",children:[m.jsxDEV("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:e},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:196,columnNumber:7},void 0),m.jsxDEV("div",{className:`
          absolute left-0 right-0 bottom-0 rounded-t-3xl flex flex-col
          ${a?"bg-slate-900":"bg-white"}
          animate-sheet-enter
        `,style:{maxHeight:"92vh",paddingBottom:"env(safe-area-inset-bottom)"},children:[m.jsxDEV("div",{className:"flex justify-center pt-3 pb-1 flex-shrink-0",children:m.jsxDEV("div",{className:`w-10 h-1 rounded-full ${a?"bg-slate-700":"bg-slate-200"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:215,columnNumber:11},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:214,columnNumber:9},void 0),m.jsxDEV("div",{className:"flex items-center justify-between px-5 py-3 flex-shrink-0",children:[m.jsxDEV("div",{className:"flex items-center gap-3",children:[m.jsxDEV("div",{className:"w-9 h-9 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-md",children:m.jsxDEV(po,{className:"h-4 w-4 text-white"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:222,columnNumber:15},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:221,columnNumber:13},void 0),m.jsxDEV("div",{children:[m.jsxDEV("p",{className:`text-[15px] font-bold leading-tight ${a?"text-white":"text-slate-900"}`,children:"Pioneer Cetak"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:225,columnNumber:15},void 0),m.jsxDEV("p",{className:`text-[11px] capitalize ${a?"text-slate-500":"text-slate-400"}`,children:[n==null?void 0:n.role," · ",n==null?void 0:n.name]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:228,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:224,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:220,columnNumber:11},void 0),m.jsxDEV("button",{onClick:e,className:`w-9 h-9 rounded-xl flex items-center justify-center active:scale-90 transition-all ${a?"bg-slate-800 text-slate-400":"bg-slate-100 text-slate-500"}`,children:m.jsxDEV(en,{className:"h-4 w-4"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:237,columnNumber:13},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:233,columnNumber:11},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:219,columnNumber:9},void 0),m.jsxDEV("div",{className:"px-5 pb-3 flex-shrink-0",children:m.jsxDEV("div",{className:`flex items-center gap-2 rounded-2xl px-3.5 py-2.5 ${a?"bg-slate-800":"bg-slate-100"}`,children:[m.jsxDEV(sd,{className:`h-4 w-4 flex-shrink-0 ${a?"text-slate-500":"text-slate-400"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:244,columnNumber:13},void 0),m.jsxDEV("input",{type:"search",placeholder:"Search pages…",value:c,onChange:w=>d(w.target.value),className:`flex-1 bg-transparent outline-none text-[14px] font-medium ${a?"text-white placeholder-slate-500":"text-slate-900 placeholder-slate-400"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:245,columnNumber:13},void 0),c&&m.jsxDEV("button",{onClick:()=>d(""),children:m.jsxDEV(en,{className:`h-3.5 w-3.5 ${a?"text-slate-500":"text-slate-400"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:254,columnNumber:17},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:253,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:243,columnNumber:11},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:242,columnNumber:9},void 0),m.jsxDEV("div",{className:"flex-1 overflow-y-auto overscroll-contain px-5 pb-4",children:y?m.jsxDEV("div",{className:"space-y-1",children:y.length===0?m.jsxDEV("p",{className:`text-center py-8 text-sm ${a?"text-slate-500":"text-slate-400"}`,children:"No pages found"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:266,columnNumber:17},void 0):y.map(w=>{const C=w.icon,P=f(w.href);return m.jsxDEV("button",{onClick:()=>v(w.href),className:`flex items-center gap-3 px-4 py-3.5 rounded-2xl transition-all active:scale-[0.98] w-full text-left ${P?"bg-indigo-600 text-white":a?"bg-slate-800 text-slate-300":"bg-slate-50 text-slate-700"}`,children:[m.jsxDEV(C,{className:"h-5 w-5 flex-shrink-0"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:283,columnNumber:23},void 0),m.jsxDEV("span",{className:"text-[14px] font-semibold flex-1",children:w.name},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:284,columnNumber:23},void 0),m.jsxDEV(rd,{className:"h-4 w-4 opacity-40"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:285,columnNumber:23},void 0)]},w.href,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:274,columnNumber:21},void 0)})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:264,columnNumber:13},void 0):m.jsxDEV("div",{className:"space-y-5",children:h.map(w=>m.jsxDEV("div",{children:[m.jsxDEV("p",{className:`text-[10px] font-black uppercase tracking-widest mb-2 px-1 ${a?"text-slate-600":"text-slate-400"}`,children:w.section},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:296,columnNumber:19},void 0),m.jsxDEV("div",{className:"mobile-nav-grid grid grid-cols-3 gap-2",children:w.items.map(C=>{const P=C.icon,k=f(C.href);return m.jsxDEV("button",{onClick:()=>v(C.href),className:`
                            flex flex-col items-center gap-2 p-3 rounded-2xl
                            transition-all active:scale-90 w-full
                            ${k?"bg-indigo-600 shadow-lg shadow-indigo-500/25":a?"bg-slate-800 text-slate-300":"bg-slate-50 text-slate-600"}
                          `,children:[m.jsxDEV("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center ${k?"bg-white/20":a?"bg-slate-700":"bg-white shadow-sm"}`,children:m.jsxDEV(P,{className:`h-5 w-5 ${k?"text-white":a?"text-indigo-400":"text-indigo-600"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:319,columnNumber:29},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:318,columnNumber:27},void 0),m.jsxDEV("span",{className:`text-[11px] font-semibold text-center leading-tight ${k?"text-white":""}`,children:C.name},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:321,columnNumber:27},void 0)]},C.href,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:305,columnNumber:25},void 0)})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:300,columnNumber:19},void 0)]},w.section,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:295,columnNumber:17},void 0))},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:293,columnNumber:13},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:261,columnNumber:9},void 0),m.jsxDEV("div",{className:`flex-shrink-0 px-5 py-3 border-t ${a?"border-slate-800 bg-slate-900/95":"border-slate-100 bg-white/95"}`,children:m.jsxDEV("div",{className:"flex items-center gap-3",children:[m.jsxDEV("div",{className:"w-10 h-10 rounded-2xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center text-white font-bold text-[15px] shadow-md",children:((E=(x=n==null?void 0:n.name)==null?void 0:x.charAt(0))==null?void 0:E.toUpperCase())||"U"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:337,columnNumber:13},void 0),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("p",{className:`text-[14px] font-bold truncate ${a?"text-white":"text-slate-900"}`,children:n==null?void 0:n.name},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:341,columnNumber:15},void 0),m.jsxDEV("p",{className:`text-[12px] truncate ${a?"text-slate-500":"text-slate-400"}`,children:n==null?void 0:n.email},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:342,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:340,columnNumber:13},void 0),m.jsxDEV("button",{onClick:_,className:`flex items-center gap-2 px-3.5 py-2 rounded-2xl text-[13px] font-semibold transition-all active:scale-90 ${a?"bg-red-500/10 text-red-400 border border-red-500/20":"bg-red-50 text-red-500 border border-red-100"}`,children:[m.jsxDEV(no,{className:"h-4 w-4"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:348,columnNumber:15},void 0),"Logout"]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:344,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:336,columnNumber:11},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:335,columnNumber:9},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:202,columnNumber:7},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileNavSheet.tsx",lineNumber:194,columnNumber:5},void 0):null},gA=({isDark:t,onCaptureClick:e})=>{const{t:n}=ni(),i=ji(),[o,s]=b.useState(!1),r=()=>s(!o),a=[{id:"scan-job",icon:id,label:"Scan Job",color:"bg-blue-500",action:()=>{i("/scan"),s(!1)}},{id:"scan-material",icon:ff,label:"Scan Stock",color:"bg-emerald-500",action:()=>{i("/scan?mode=inventory"),s(!1)}},{id:"scan-machine",icon:hf,label:"Scan Machine",color:"bg-purple-500",action:()=>{i("/scan?mode=machine"),s(!1)}},{id:"new-order",icon:gf,label:"New Order",color:"bg-indigo-600",action:()=>{i("/new-order"),s(!1)}},{id:"new-quote",icon:Ot,label:"New Quote",color:"bg-amber-500",action:()=>{i("/request-quote"),s(!1)}}],c=95,d=[180,135,90,45,0];return m.jsxDEV("div",{className:"relative flex items-center justify-center w-[72px] h-full",children:[o&&m.jsxDEV("div",{className:"fixed inset-0 bg-slate-950/40 backdrop-blur-sm z-[40] animate-in fade-in duration-300",onClick:()=>s(!1)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/FabArcMenu.tsx",lineNumber:70,columnNumber:9},void 0),m.jsxDEV("div",{className:`absolute bottom-10 z-[50] pointer-events-none ${o?"visible":"invisible"}`,children:a.map((p,f)=>{const h=d[f]*Math.PI/180,g=Math.cos(h)*c,y=-Math.sin(h)*c;return m.jsxDEV("div",{className:"absolute left-1/2 top-1/2 transition-all duration-500 ease-out flex flex-col items-center gap-1",style:{transform:o?`translate(calc(-50% + ${g}px), calc(-50% + ${y}px)) scale(1)`:"translate(-50%, -50%) scale(0)",opacity:o?1:0,pointerEvents:o?"auto":"none"},children:[m.jsxDEV("button",{onClick:p.action,className:`w-12 h-12 rounded-full flex items-center justify-center text-white shadow-lg ${p.color} active:scale-90 transition-transform border-4 ${t?"border-slate-900":"border-white"}`,children:m.jsxDEV(p.icon,{size:20,strokeWidth:2.5},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/FabArcMenu.tsx",lineNumber:99,columnNumber:17},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/FabArcMenu.tsx",lineNumber:95,columnNumber:15},void 0),m.jsxDEV("span",{className:`text-[10px] whitespace-nowrap font-black uppercase tracking-tighter px-2 py-0.5 rounded-full backdrop-blur-md shadow-sm border ${t?"bg-slate-900/80 text-white border-white/10":"bg-white/80 text-slate-800 border-slate-200"}`,children:p.label},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/FabArcMenu.tsx",lineNumber:101,columnNumber:15},void 0)]},p.id,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/FabArcMenu.tsx",lineNumber:84,columnNumber:13},void 0)})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/FabArcMenu.tsx",lineNumber:77,columnNumber:7},void 0),m.jsxDEV("button",{onClick:r,className:`
          absolute -top-5 z-[60]
          flex items-center justify-center
          w-[58px] h-[58px] rounded-full
          ${o?"bg-slate-800 scale-90":"bg-gradient-to-br from-indigo-500 to-purple-600 shadow-xl shadow-indigo-500/40 translate-y-0"}
          text-white
          transition-all duration-300 active:scale-90
          border-[4px] ${t?"border-slate-900":"border-white"}
        `,"aria-label":"Action Menu",children:m.jsxDEV("div",{className:`transition-transform duration-300 ${o?"rotate-90":"rotate-0"}`,children:o?m.jsxDEV(en,{size:24,strokeWidth:3},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/FabArcMenu.tsx",lineNumber:126,columnNumber:21},void 0):m.jsxDEV(ia,{size:24,strokeWidth:3},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/FabArcMenu.tsx",lineNumber:126,columnNumber:55},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/FabArcMenu.tsx",lineNumber:125,columnNumber:9},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/FabArcMenu.tsx",lineNumber:110,columnNumber:7},void 0),m.jsxDEV("span",{className:`absolute bottom-1 text-[9px] font-black uppercase tracking-widest ${t?"text-indigo-400":"text-indigo-600"}`,children:o?"Close":"Actions"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/FabArcMenu.tsx",lineNumber:131,columnNumber:7},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/FabArcMenu.tsx",lineNumber:67,columnNumber:5},void 0)},yA=(t,e)=>{switch(t){case"admin":case"manager":return{left:[{name:"Home",href:"/dashboard",icon:Lt},{name:"Orders",href:"/orders",icon:Wt}],right:[{name:"Finance",href:"/accounting",icon:Ot},{name:"More",href:"__more__",icon:Ao}],fab:{label:"Capture",icon:Yn,action:"capture"}};case"worker":return{left:[{name:"Home",href:"/dashboard",icon:Lt},{name:"Jobs",href:"/production/board",icon:Uo}],right:[{name:"Track",href:"/production-tracking",icon:to},{name:"More",href:"__more__",icon:Ao}],fab:{label:"Scan",icon:Yn,action:"capture"}};case"customer":return{left:[{name:"Home",href:"/dashboard",icon:Lt},{name:"Orders",href:"/orders",icon:Wt}],right:[{name:"Quotes",href:"/request-quote",icon:Ft},{name:"More",href:"__more__",icon:Ao}],fab:{label:"New Order",icon:ia,action:"navigate",href:"/new-order"}};default:return{left:[{name:"Home",href:"/dashboard",icon:Lt}],right:[{name:"More",href:"__more__",icon:Ao}],fab:null}}},vA=({onCaptureClick:t})=>{const{t:e}=ni(),{user:n}=Ut(),{useArcMenu:i}=fa(),{theme:o}=Et(),s=ji(),r=o.mode==="dark",[a,c]=b.useState(!1),d=yA(n==null?void 0:n.role),{left:p,right:f,fab:h}=d,g=()=>{h&&(h.action==="capture"?t():h.action==="navigate"&&h.href&&s(h.href))},y=({isActive:v})=>`
    flex flex-col items-center justify-center gap-[3px] flex-1 h-full
    transition-all duration-200 active:scale-90 relative
    ${v?r?"text-indigo-400":"text-indigo-600":r?"text-slate-500":"text-slate-400"}
  `,_=({tab:v})=>{const x=v.icon;return v.href==="__more__"?m.jsxDEV("button",{onClick:()=>c(!0),className:`
            flex flex-col items-center justify-center gap-[3px] flex-1 h-full
            transition-all duration-200 active:scale-90
            ${a?r?"text-indigo-400":"text-indigo-600":r?"text-slate-500":"text-slate-400"}
          `,children:[m.jsxDEV("div",{className:`flex items-center justify-center w-10 h-6 rounded-full transition-all ${a?r?"bg-indigo-500/20":"bg-indigo-100":"bg-transparent"}`,children:m.jsxDEV(x,{className:"h-5 w-5",strokeWidth:a?2.5:1.8},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:117,columnNumber:13},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:116,columnNumber:11},void 0),m.jsxDEV("span",{className:`text-[10px] font-semibold leading-none tracking-tight ${a?"opacity-100":"opacity-70"}`,children:v.name},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:119,columnNumber:11},void 0),a&&m.jsxDEV("span",{className:`absolute top-1.5 w-1 h-1 rounded-full ${r?"bg-indigo-400":"bg-indigo-600"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:123,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:106,columnNumber:9},void 0):m.jsxDEV(tf,{to:v.href,className:y,end:v.href==="/dashboard",children:({isActive:E})=>m.jsxDEV(m.Fragment,{children:[m.jsxDEV("div",{className:`flex items-center justify-center w-10 h-6 rounded-full transition-all duration-200 ${E?r?"bg-indigo-500/20":"bg-indigo-100":"bg-transparent"}`,children:m.jsxDEV(x,{className:"h-5 w-5",strokeWidth:E?2.5:1.8},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:134,columnNumber:15},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:133,columnNumber:13},void 0),m.jsxDEV("span",{className:`text-[10px] font-semibold leading-none tracking-tight ${E?"opacity-100":"opacity-70"}`,children:v.name},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:136,columnNumber:13},void 0),E&&m.jsxDEV("span",{className:`absolute top-1.5 w-1 h-1 rounded-full ${r?"bg-indigo-400":"bg-indigo-600"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:140,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:132,columnNumber:11},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:130,columnNumber:7},void 0)};return m.jsxDEV(m.Fragment,{children:[m.jsxDEV("nav",{className:`
          md:hidden fixed bottom-0 left-0 right-0 z-50
          flex items-stretch
          border-t
          ${r?"bg-slate-900/95 border-slate-800":"bg-white/95 border-slate-200/80"}
          backdrop-blur-2xl
        `,style:{height:"calc(56px + env(safe-area-inset-bottom))",paddingBottom:"env(safe-area-inset-bottom)"},"aria-label":"Mobile navigation",children:h?m.jsxDEV(m.Fragment,{children:[m.jsxDEV("div",{className:"flex flex-1 h-full",children:p.map(v=>m.jsxDEV(_,{tab:v},v.href,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:169,columnNumber:32},void 0))},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:168,columnNumber:13},void 0),i?m.jsxDEV(gA,{isDark:r,onCaptureClick:t},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:174,columnNumber:15},void 0):m.jsxDEV("div",{className:"flex items-center justify-center w-[72px] relative flex-shrink-0",children:[m.jsxDEV("button",{onClick:g,className:`
                    absolute -top-5
                    flex items-center justify-center
                    w-[56px] h-[56px] rounded-full
                    bg-gradient-to-br from-indigo-500 to-purple-600
                    text-white shadow-xl shadow-indigo-500/40
                    transition-all duration-200 active:scale-90
                    border-[3px] ${r?"border-slate-900":"border-white"}
                  `,"aria-label":h.label,children:m.jsxDEV(h.icon,{className:"h-5 w-5",strokeWidth:2.2},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:190,columnNumber:19},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:177,columnNumber:17},void 0),m.jsxDEV("span",{className:`absolute bottom-1.5 text-[9px] font-bold tracking-tight ${r?"text-indigo-400":"text-indigo-600"}`,children:h.label},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:192,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:176,columnNumber:15},void 0),m.jsxDEV("div",{className:"flex flex-1 h-full",children:f.map(v=>m.jsxDEV(_,{tab:v},v.href,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:200,columnNumber:33},void 0))},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:199,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:166,columnNumber:11},void 0):m.jsxDEV("div",{className:"flex flex-1 h-full",children:[...p,...f].map(v=>m.jsxDEV(_,{tab:v},v.href,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:205,columnNumber:45},void 0))},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:204,columnNumber:11},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:151,columnNumber:7},void 0),m.jsxDEV(hA,{isOpen:a,onClose:()=>c(!1)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:211,columnNumber:7},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/BottomNavBar.tsx",lineNumber:149,columnNumber:5},void 0)},bA={"/dashboard":"Dashboard","/orders":"Orders","/new-order":"New Order","/request-quote":"Request Quote","/accounting":"Accounting","/analytics":"Analytics","/inventory":"Inventory","/payroll":"Payroll & HR","/commission":"Commission","/quotations":"Quotations","/invoices":"Invoices","/production/board":"Job Board","/production-tracking":"Production","/quality-control":"Quality Control","/attendance":"Attendance","/attendance/reports":"Reports","/partners":"Partners","/purchase-orders":"Purchase Orders","/machine-scheduling":"Scheduling","/maintenance":"Maintenance","/dispatch":"Dispatch","/job-costing":"Job Costing","/executive-bi":"Executive BI","/admin":"Administration","/chart-of-accounts":"Chart of Accounts","/materials":"Materials"},_A=["/dashboard"],NA=({title:t,showBack:e,rightAction:n,transparent:i=!1})=>{var g,y;const o=ji(),s=ds(),{user:r}=Ut(),{theme:a}=Et(),c=a.mode==="dark",d=t||bA[s.pathname]||"Pioneer Cetak",p=_A.includes(s.pathname),f=e??!p,h=((y=(g=r==null?void 0:r.name)==null?void 0:g.charAt(0))==null?void 0:y.toUpperCase())||"U";return m.jsxDEV("div",{className:`
        md:hidden fixed top-0 left-0 right-0 z-50 h-[56px] flex items-center px-4 gap-3
        ${i?"bg-transparent":c?"bg-slate-900/95 border-b border-slate-800":"bg-white/95 border-b border-slate-200/80"}
        backdrop-blur-xl
        ${i?"":"shadow-sm"}
      `,style:{paddingTop:"env(safe-area-inset-top)"},children:[m.jsxDEV("div",{className:"flex items-center flex-shrink-0 w-10",children:f?m.jsxDEV("button",{onClick:()=>o(-1),className:`
              flex items-center justify-center w-10 h-10 rounded-xl -ml-2 transition-all active:scale-90
              ${c?"text-slate-300 active:bg-slate-800":"text-slate-700 active:bg-slate-100"}
            `,"aria-label":"Go back",children:m.jsxDEV(yf,{className:"h-6 w-6"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileAppBar.tsx",lineNumber:90,columnNumber:13},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileAppBar.tsx",lineNumber:82,columnNumber:11},void 0):m.jsxDEV("div",{className:"w-8 h-8 rounded-xl flex items-center justify-center bg-gradient-to-br from-indigo-500 to-purple-600 shadow-md shadow-indigo-500/25",children:m.jsxDEV(po,{className:"h-4 w-4 text-white"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileAppBar.tsx",lineNumber:94,columnNumber:13},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileAppBar.tsx",lineNumber:93,columnNumber:11},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileAppBar.tsx",lineNumber:80,columnNumber:7},void 0),m.jsxDEV("div",{className:"flex-1 flex items-center justify-center",children:m.jsxDEV("h1",{className:`text-[17px] font-bold tracking-tight truncate ${c?"text-white":"text-slate-900"}`,children:d},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileAppBar.tsx",lineNumber:101,columnNumber:9},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileAppBar.tsx",lineNumber:100,columnNumber:7},void 0),m.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:n||m.jsxDEV(m.Fragment,{children:[m.jsxDEV("button",{className:`
                relative flex items-center justify-center w-9 h-9 rounded-xl transition-all active:scale-90
                ${c?"text-slate-400 active:bg-slate-800":"text-slate-500 active:bg-slate-100"}
              `,"aria-label":"Notifications",children:[m.jsxDEV(ad,{className:"h-5 w-5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileAppBar.tsx",lineNumber:120,columnNumber:15},void 0),m.jsxDEV("span",{className:"absolute top-1.5 right-1.5 h-2 w-2 bg-red-500 rounded-full ring-2 ring-white dark:ring-slate-900"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileAppBar.tsx",lineNumber:122,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileAppBar.tsx",lineNumber:113,columnNumber:13},void 0),m.jsxDEV("button",{className:"flex items-center justify-center w-9 h-9 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 shadow-sm active:scale-90 transition-all","aria-label":"Profile",children:m.jsxDEV("span",{className:"text-white text-[13px] font-bold",children:h},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileAppBar.tsx",lineNumber:130,columnNumber:15},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileAppBar.tsx",lineNumber:126,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileAppBar.tsx",lineNumber:112,columnNumber:11},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileAppBar.tsx",lineNumber:110,columnNumber:7},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/MobileAppBar.tsx",lineNumber:66,columnNumber:5},void 0)},we=({children:t})=>{var te;const{t:e,i18n:n}=ni(),{user:i,logout:o}=Ut(),{theme:s,toggleMode:r,getThemeClasses:a,setTheme:c}=Et(),d=ds(),p=ji(),[f,h]=b.useState(!1),[g,y]=b.useState(!1),[_,v]=b.useState(!1),[x,E]=b.useState(!1),[w,C]=b.useState(!1),[P,k]=b.useState(!1),[I,j]=b.useState({Sales:d.pathname.includes("/quotations")||d.pathname.includes("/invoices")||d.pathname.includes("/credit-notes")});b.useEffect(()=>{i!=null&&i.isAttendanceMonitor&&c({...s,color:"blue",gradient:{enabled:!0,startColor:"blue",endColor:"purple",direction:"to-r"}})},[i,c]);const A=()=>{o(),p("/login")},R=()=>{const J=["en","ar","zh"],U=(J.indexOf(n.language)+1)%J.length,H=J[U];n.changeLanguage(H),localStorage.setItem("language",H)},q=n.language==="ar",G=b.useMemo(()=>[{name:"Quotation",href:"/dashboard",icon:Ft,permission:"dashboard:view",description:"Create and manage quotations",roles:["estimator"],section:e("sections.main")},{name:e("navigation.dashboard"),href:"/dashboard",icon:Lt,permission:"dashboard:view",description:e("navigation.descriptions.dashboard"),roles:["admin","manager","worker","customer","supplier"],section:e("sections.main")},{name:e("navigation.orders"),href:"/orders",icon:Wt,permission:"orders:view",description:e("navigation.descriptions.orders"),roles:["admin","manager","worker","customer","supplier","estimator"],section:e("sections.main")},{name:e("navigation.newOrder"),href:"/new-order",icon:ia,permission:"dashboard:view",description:e("navigation.descriptions.newOrder"),roles:["customer"],section:e("sections.main")},{name:e("navigation.requestQuote"),href:"/request-quote",icon:Ft,permission:"dashboard:view",description:e("navigation.descriptions.requestQuote"),roles:["customer"],section:e("sections.main")},{name:e("navigation.invoices"),href:"/orders",icon:Ot,permission:"dashboard:view",description:e("navigation.descriptions.invoices"),roles:["customer"],section:e("sections.main")},{name:e("navigation.support"),href:"/dashboard",icon:vf,permission:"dashboard:view",description:e("navigation.descriptions.support"),roles:["customer"],section:e("sections.main")},{name:"Sales",icon:na,roles:["admin","manager"],section:e("sections.main"),children:[{name:"Quotation",href:"/quotations",icon:Ft,roles:["admin","manager"]},{name:"Invoice",href:"/invoices",icon:Ot,roles:["admin","manager"]},{name:"Credit Note",href:"/accounting",icon:cr,roles:["admin","manager"]},{name:"Reports",href:"/sales-analysis",icon:Si,roles:["admin","manager"]}]},{name:e("navigation.materials"),href:"/materials",icon:eo,permission:"dashboard:view",description:e("navigation.descriptions.materials"),roles:["admin","manager","worker","estimator"],section:e("sections.operations")},{name:e("navigation.jobBoard"),href:"/production/board",icon:eo,permission:"production:view",description:e("navigation.descriptions.jobBoard"),roles:["admin","manager","worker"],section:e("sections.operations")},{name:"Machine Scheduling",href:"/machine-scheduling",icon:Qn,permission:"production:manage_workflow",description:"Schedule Jobs and Maintenance",roles:["admin","manager"],section:e("sections.operations")},{name:e("navigation.productionTracking"),href:"/production-tracking",icon:to,permission:"production:view",description:e("navigation.descriptions.productionTracking"),roles:["admin","manager","worker"],section:e("sections.operations")},{name:e("navigation.layoutPlanner"),href:"/layout-planner",icon:bf,permission:"production:manage_workflow",description:e("navigation.descriptions.layoutPlanner"),roles:["admin","manager","worker","estimator"],section:e("sections.operations")},{name:e("navigation.inventory"),href:"/inventory",icon:Bo,permission:"inventory:view",description:e("navigation.descriptions.inventory"),roles:["admin","manager","worker"],section:e("sections.operations")},{name:"Dispatch & Shipping",href:"/dispatch",icon:ar,permission:"orders:view",description:"Manage Outbound Deliveries and Driver Routes",roles:["admin","manager"],section:e("sections.operations")},{name:"Maintenance",href:"/maintenance",icon:lr,permission:"production:manage_workflow",description:"Manage Machine Maintenance",roles:["admin","manager"],section:e("sections.operations")},{name:e("navigation.qualityControl"),href:"/quality-control",icon:$o,permission:"quality:view",description:e("navigation.descriptions.qualityControl"),roles:["admin","manager","worker"],section:e("sections.operations")},{name:e("navigation.attendance"),href:"/attendance",icon:xi,permission:"hr:view",description:e("navigation.descriptions.attendance"),roles:["admin","manager","worker"],section:e("sections.hrFinance")},{name:e("navigation.accounting"),href:"/accounting",icon:Ot,permission:"accounting:view",description:e("navigation.descriptions.accounting"),roles:["admin","manager"],section:e("sections.hrFinance")},{name:"Chart of Accounts",href:"/chart-of-accounts",icon:od,permission:"accounting:view",description:"Enterprise General Ledger",roles:["admin","manager"],section:e("sections.hrFinance")},{name:e("navigation.payroll"),href:"/payroll",icon:ur,permission:"hr:view",description:e("navigation.descriptions.payroll"),roles:["admin","manager"],section:e("sections.hrFinance")},{name:e("navigation.commission"),href:"/commission",icon:dr,permission:"accounting:view_reports",description:e("navigation.descriptions.commission"),roles:["admin","manager"],section:e("sections.hrFinance")},{name:e("navigation.analytics"),href:"/analytics",icon:Si,permission:"analytics:view",description:e("navigation.descriptions.analytics"),roles:["admin","manager"],section:e("sections.hrFinance")},{name:"Job Costing",href:"/job-costing",icon:Ot,permission:"analytics:view",description:"Advanced Cost Tracking",roles:["admin","manager"],section:e("sections.hrFinance")},{name:"Executive BI",href:"/executive-bi",icon:Si,permission:"reports:view",description:"C-Level Reporting & Business Intelligence",roles:["admin","manager"],section:e("sections.hrFinance")},{name:e("navigation.administration"),href:"/admin",icon:uo,permission:"admin:view",description:e("navigation.descriptions.administration"),roles:["admin","estimator"],section:e("sections.system")}],[e]),L=b.useMemo(()=>G.filter(J=>!(i!=null&&i.role)||!J.roles.includes(i.role)?!1:i.isAttendanceMonitor?J.permission==="hr:view"&&J.name===e("navigation.attendance"):!0).map(J=>J.children?{...J,children:J.children.filter(O=>!O.roles||O.roles.includes(i==null?void 0:i.role))}:J),[G,i==null?void 0:i.role,i==null?void 0:i.isAttendanceMonitor,e]),F=b.useMemo(()=>L.reduce((J,O)=>{const U=O.section||"Main";return J[U]||(J[U]=[]),J[U].push(O),J},{}),[L]),T=s.mode==="dark",[$,Q]=b.useState({top:0,height:0,opacity:0}),X=b.useRef({});return b.useEffect(()=>{const J=L.find(O=>d.pathname===O.href||O.children&&O.children.some(U=>d.pathname===U.href));if(J){const O=X.current[J.name];O&&Q({top:O.offsetTop,height:O.offsetHeight,opacity:1})}else Q(O=>({...O,opacity:0}))},[d.pathname,L]),b.useEffect(()=>{const J=document.querySelector("main");J&&J.scrollTo({top:0,behavior:"instant"})},[d.pathname]),m.jsxDEV("div",{className:`flex h-screen overflow-hidden ${q?"flex-row-reverse":"flex-row"} ${T?"bg-slate-950":"bg-slate-50"}`,children:[m.jsxDEV("div",{className:`
          fixed inset-y-0 ${q?"right-0":"left-0"} z-50 transform transition-all duration-300 ease-in-out lg:translate-x-0 lg:static lg:inset-0 hidden md:flex flex-col border-r
          ${f?"translate-x-0":q?"translate-x-full":"-translate-x-full"}
          ${g&&!f?"w-[72px]":"w-[264px]"}
          ${T?"bg-slate-900 border-slate-800":"bg-white border-slate-200"}
        `,children:[m.jsxDEV("div",{className:`
          flex items-center h-20 px-4 flex-shrink-0 border-b transition-all duration-300
          ${g&&!f?"justify-center":"justify-between"}
          ${T?"border-slate-800":"border-slate-100"}
        `,children:[m.jsxDEV("div",{className:`flex items-center transition-all duration-300 ${g?"space-x-0":"space-x-3"}`,children:[m.jsxDEV("div",{className:"p-2.5 rounded-xl flex-shrink-0 bg-gradient-to-br from-indigo-500 to-purple-600 shadow-lg shadow-indigo-500/20",children:m.jsxDEV(po,{className:"h-6 w-6 text-white"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:183,columnNumber:15},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:182,columnNumber:13},void 0),m.jsxDEV("div",{className:`transition-all duration-300 origin-left flex flex-col ${g&&!f?"w-0 opacity-0 scale-0 hidden":"w-auto opacity-100 scale-100"}`,children:[m.jsxDEV("div",{className:`font-bold text-lg tracking-tight leading-none ${T?"text-white":"text-slate-900"}`,children:e("common.appName")},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:186,columnNumber:15},void 0),m.jsxDEV("div",{className:`text-[10px] font-bold uppercase tracking-wider mt-1 ${T?"text-slate-500":"text-slate-400"}`,children:e("layout.enterprise")},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:187,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:185,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:181,columnNumber:11},void 0),m.jsxDEV("button",{onClick:()=>h(!1),className:`lg:hidden p-2 rounded-xl transition-colors ${T?"text-slate-400 hover:text-white hover:bg-slate-800":"text-slate-400 hover:text-slate-600 hover:bg-slate-100"}`,children:m.jsxDEV(en,{className:"h-5 w-5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:194,columnNumber:13},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:190,columnNumber:11},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:176,columnNumber:9},void 0),m.jsxDEV("div",{className:"hidden lg:flex justify-end px-4 pt-4",children:m.jsxDEV("button",{onClick:()=>y(!g),className:`
              p-2 rounded-xl transition-all duration-200
              ${T?"text-slate-500 hover:text-slate-300 hover:bg-slate-800":"text-slate-400 hover:text-slate-600 hover:bg-slate-100"}
            `,children:g?m.jsxDEV(_f,{size:18},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:209,columnNumber:35},void 0):m.jsxDEV(Nf,{size:18},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:209,columnNumber:65},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:200,columnNumber:11},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:199,columnNumber:9},void 0),m.jsxDEV("nav",{className:"flex-1 overflow-y-auto mt-2 px-3 pb-4 custom-scrollbar relative",children:[m.jsxDEV("div",{className:"absolute left-3 right-3 bg-gradient-to-r from-indigo-600 to-purple-600 shadow-lg shadow-indigo-500/25 rounded-xl transition-all duration-500 ease-out z-0 pointer-events-none",style:{top:$.top,height:$.height,opacity:$.opacity}},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:216,columnNumber:11},void 0),Object.entries(F).map(([J,O])=>m.jsxDEV("div",{className:"mb-4",children:[!g&&Object.keys(F).length>1&&m.jsxDEV("div",{className:`px-4 pt-4 pb-2 text-[10px] font-bold uppercase tracking-widest ${T?"text-slate-500":"text-slate-400"}`,children:J},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:227,columnNumber:17},void 0),g&&Object.keys(F).indexOf(J)>0&&m.jsxDEV("div",{className:`mx-4 my-2 border-t ${T?"border-slate-800":"border-slate-100"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:232,columnNumber:17},void 0),O.map(U=>{const H=U.icon,re=U.children&&U.children.length>0,de=d.pathname===U.href,le=I[U.name];return re&&!g?m.jsxDEV("div",{className:"mb-1",children:[m.jsxDEV("button",{ref:fe=>X.current[U.name]=fe,onClick:()=>j(fe=>({...fe,[U.name]:!fe[U.name]})),className:`
                          w-full group flex items-center px-4 py-3.5 rounded-xl transition-all duration-300 relative overflow-hidden mb-1
                          ${le?T?"bg-slate-800/50 text-white":"bg-indigo-50/50 text-indigo-600":T?"text-slate-400 hover:text-slate-200 hover:bg-slate-800/50":"text-slate-500 hover:text-indigo-600 hover:bg-indigo-50/50"}
                        `,children:[m.jsxDEV(H,{className:`h-[22px] w-[22px] flex-shrink-0 transition-all duration-300 ${!le&&"group-hover:scale-110"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:254,columnNumber:25},void 0),m.jsxDEV("span",{className:`${q?"mr-3 text-right":"ml-3 text-left"} flex-1 text-[14px] font-medium`,children:U.name},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:255,columnNumber:25},void 0),m.jsxDEV(rd,{className:`h-4 w-4 transition-transform duration-300 ${le?"rotate-90":""}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:256,columnNumber:25},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:243,columnNumber:23},void 0),le&&m.jsxDEV("div",{className:`mt-1 space-y-1 ${q?"mr-9 border-r":"ml-9 border-l"} ${T?"border-slate-800":"border-indigo-100"}`,children:U.children.map(fe=>{const De=d.pathname===fe.href,K=fe.icon;return m.jsxDEV(Va,{to:fe.href,className:`
                                  flex items-center py-2.5 px-4 rounded-xl transition-all duration-300
                                  ${De?"text-indigo-600 font-bold":T?"text-slate-500 hover:text-slate-300":"text-slate-400 hover:text-indigo-500"}
                                `,children:[K&&m.jsxDEV(K,{size:16,className:`${q?"ml-2":"mr-2"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:276,columnNumber:47},void 0),m.jsxDEV("span",{className:"text-[13px]",children:fe.name},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:277,columnNumber:33},void 0)]},fe.name,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:265,columnNumber:31},void 0)})},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:260,columnNumber:25},void 0)]},U.name,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:242,columnNumber:21},void 0):m.jsxDEV(Va,{ref:fe=>X.current[U.name]=fe,to:U.href,title:g?U.name:"",className:`
                      group flex items-center rounded-xl transition-all duration-300 relative overflow-hidden z-10
                      ${g&&!f?"px-0 py-3 justify-center mb-2":"px-4 py-3.5 mb-1.5"}
                      ${de?"text-white":T?"text-slate-400 hover:text-slate-200 hover:bg-slate-800/50":"text-slate-500 hover:text-indigo-600 hover:bg-indigo-50/50"}
                    `,onClick:()=>h(!1),children:[m.jsxDEV(H,{className:`
                        h-[22px] w-[22px] flex-shrink-0 transition-all duration-300
                        ${de?"text-white":"text-slate-400"}
                        ${!de&&"group-hover:scale-110"}
                      `},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:305,columnNumber:21},void 0),!g||f?m.jsxDEV("span",{className:`${q?"mr-3":"ml-3"} text-[14px] ${de?"font-semibold":"font-medium"} transition-all duration-300`,children:U.name},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:313,columnNumber:23},void 0):null,de&&(!g||f)&&m.jsxDEV("div",{className:`absolute ${q?"left-3":"right-3"} w-1.5 h-1.5 rounded-full bg-white animate-pulse`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:317,columnNumber:23},void 0)]},U.name,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:288,columnNumber:19},void 0)})]},J,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:225,columnNumber:13},void 0))]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:214,columnNumber:9},void 0),m.jsxDEV("div",{className:`p-4 mx-3 mb-4 rounded-2xl transition-all duration-300 ${T?"bg-slate-800/50":"bg-slate-50"} ${g&&!f?"mx-2 p-2":""}`,children:m.jsxDEV("div",{className:`flex items-center ${g&&!f?"justify-center flex-col gap-3":"space-x-3"}`,children:[m.jsxDEV("div",{className:"h-10 w-10 rounded-xl flex items-center justify-center text-white text-sm font-bold flex-shrink-0 bg-gradient-to-br from-indigo-500 to-purple-600 shadow-md",children:((te=i==null?void 0:i.name)==null?void 0:te.charAt(0))||"U"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:329,columnNumber:13},void 0),(!g||f)&&m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("p",{className:`text-sm font-bold truncate ${T?"text-white":"text-slate-900"}`,children:i==null?void 0:i.name},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:334,columnNumber:17},void 0),m.jsxDEV("p",{className:`text-xs truncate font-medium ${T?"text-slate-400":"text-slate-500"}`,children:i==null?void 0:i.role},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:335,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:333,columnNumber:15},void 0),m.jsxDEV("button",{onClick:A,className:`p-2 rounded-xl transition-colors ${T?"text-slate-400 hover:text-white hover:bg-slate-700":"text-slate-400 hover:text-red-500 hover:bg-red-50"}`,children:m.jsxDEV(no,{size:18},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:342,columnNumber:15},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:338,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:328,columnNumber:11},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:327,columnNumber:9},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:165,columnNumber:7},void 0),m.jsxDEV("div",{className:"flex-1 flex flex-col overflow-hidden relative",children:[m.jsxDEV(NA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:350,columnNumber:9},void 0),m.jsxDEV("header",{className:`
          hidden md:block absolute top-0 left-0 right-0 z-20 h-20 transition-all duration-300
          ${T?"bg-slate-900/80":"bg-white/80"} backdrop-blur-xl border-b ${T?"border-slate-800":"border-slate-200/60"}
        `,children:m.jsxDEV("div",{className:"flex items-center justify-between px-4 sm:px-8 h-full",children:[m.jsxDEV("div",{className:"flex items-center gap-4",children:[m.jsxDEV("button",{onClick:()=>h(!0),className:`lg:hidden p-2.5 rounded-xl transition-colors ${T?"hover:bg-slate-800 text-slate-400":"hover:bg-slate-100 text-slate-500"}`,children:m.jsxDEV(xf,{className:"h-6 w-6"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:363,columnNumber:17},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:359,columnNumber:15},void 0),m.jsxDEV("div",{className:"flex lg:hidden items-center space-x-2",children:[m.jsxDEV("div",{className:"p-1.5 rounded-lg bg-gradient-to-br from-indigo-500 to-purple-600 shadow-sm",children:m.jsxDEV(po,{className:"h-4 w-4 text-white"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:369,columnNumber:19},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:368,columnNumber:17},void 0),m.jsxDEV("span",{className:`font-bold text-sm tracking-tight ${T?"text-white":"text-slate-900"}`,children:e("common.appName")},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:371,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:367,columnNumber:15},void 0),m.jsxDEV("div",{className:"hidden sm:flex relative group",children:[m.jsxDEV(sd,{className:`absolute left-3.5 top-1/2 -translate-y-1/2 h-5 w-5 transition-colors ${T?"text-slate-500 group-focus-within:text-indigo-400":"text-slate-400 group-focus-within:text-indigo-500"}`},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:377,columnNumber:17},void 0),m.jsxDEV("input",{type:"text",placeholder:e("layout.searchPlaceholder"),className:`
                    pl-11 pr-4 py-2.5 w-64 lg:w-96 rounded-xl text-sm font-medium transition-all duration-300 outline-none border
                    ${T?"bg-slate-800/50 border-slate-700 text-white placeholder-slate-500 focus:bg-slate-800 focus:border-indigo-500/50 focus:ring-4 focus:ring-indigo-500/10":"bg-slate-100/50 border-transparent text-slate-900 placeholder-slate-400 focus:bg-white focus:border-indigo-200 focus:ring-4 focus:ring-indigo-500/10 focus:shadow-sm"}
                  `},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:378,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:376,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:358,columnNumber:13},void 0),m.jsxDEV("div",{className:"flex items-center gap-3",children:[m.jsxDEV("button",{onClick:R,className:`flex items-center gap-2 px-3 py-1.5 rounded-xl transition-all font-bold text-xs ${T?"bg-slate-800 text-indigo-400 hover:bg-slate-700":"bg-indigo-50 text-indigo-600 hover:bg-indigo-100"}`,children:m.jsxDEV("span",{children:n.language==="en"?"English":n.language==="ar"?"العربية":"中文"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:397,columnNumber:17},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:393,columnNumber:15},void 0),m.jsxDEV("button",{onClick:()=>v(!0),className:`hidden sm:flex p-2.5 rounded-xl transition-colors ${T?"hover:bg-slate-800 text-slate-400 hover:text-white":"hover:bg-slate-100 text-slate-500 hover:text-indigo-600"}`,children:m.jsxDEV(qo,{className:"h-5 w-5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:404,columnNumber:17},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:400,columnNumber:15},void 0),m.jsxDEV("button",{onClick:r,className:`p-2.5 rounded-xl transition-all duration-300 ${T?"text-indigo-400 bg-slate-800/80 hover:bg-slate-700":"text-amber-500 bg-orange-50 hover:bg-orange-100"}`,children:T?m.jsxDEV(Zu,{className:"h-5 w-5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:411,columnNumber:27},void 0):m.jsxDEV(Xu,{className:"h-5 w-5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:411,columnNumber:58},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:407,columnNumber:15},void 0),m.jsxDEV("button",{className:`relative p-2.5 rounded-xl transition-colors ${T?"hover:bg-slate-800 text-slate-400 hover:text-white":"hover:bg-slate-100 text-slate-500 hover:text-indigo-600"}`,children:[m.jsxDEV(ad,{className:"h-5 w-5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:415,columnNumber:17},void 0),m.jsxDEV("span",{className:"absolute top-2.5 right-2.5 h-2 w-2 bg-red-500 rounded-full ring-2 ring-white dark:ring-slate-900"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:416,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:414,columnNumber:15},void 0),m.jsxDEV("button",{onClick:()=>h(!0),className:"flex lg:hidden p-2.5 rounded-xl transition-all active:scale-90 bg-indigo-500/10 text-indigo-600 border border-indigo-500/20 shadow-sm",children:m.jsxDEV(Sf,{size:20},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:423,columnNumber:17},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:419,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:392,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:357,columnNumber:11},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:353,columnNumber:9},void 0),m.jsxDEV("main",{className:`flex-1 overflow-auto smooth-scroll pt-[64px] md:pt-[80px] pb-[calc(56px+env(safe-area-inset-bottom))] md:pb-0 ${T?"bg-slate-950":"bg-slate-200/80"} relative`,children:[m.jsxDEV("div",{className:"absolute inset-0 pointer-events-none bg-blueprint z-0 opacity-100"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:431,columnNumber:11},void 0),m.jsxDEV("div",{className:"absolute inset-0 pointer-events-none bg-vignette z-0"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:432,columnNumber:11},void 0),m.jsxDEV("div",{className:"relative z-10 p-4 sm:p-6 lg:p-8 max-w-[1920px] mx-auto min-h-full animate-premium-enter",children:t},d.pathname,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:434,columnNumber:11},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:429,columnNumber:9},void 0),m.jsxDEV(vA,{onCaptureClick:()=>k(!0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:440,columnNumber:9},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:348,columnNumber:7},void 0),f&&m.jsxDEV("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-40 lg:hidden",onClick:()=>h(!1)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:446,columnNumber:23},void 0),m.jsxDEV(v_,{isOpen:_,onClose:()=>v(!1)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:447,columnNumber:7},void 0),m.jsxDEV(fA,{isOpen:P,onClose:()=>k(!1),onScanInvoice:()=>{k(!1),E(!0)},onScanCheque:()=>{k(!1),C(!0)},onScanJob:()=>{k(!1),p("/scan")}},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:449,columnNumber:7},void 0),m.jsxDEV(em,{isOpen:x,onClose:()=>E(!1)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:465,columnNumber:7},void 0),m.jsxDEV(Jm,{isOpen:w,onClose:()=>C(!1)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:466,columnNumber:7},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/layout/Layout.tsx",lineNumber:163,columnNumber:5},void 0)},xA=({onSuccess:t,onError:e,mode:n,employeeId:i,challenge:o,allowedCredentials:s=[]})=>{const[r,a]=b.useState(!1),[c,d]=b.useState(!1),[p,f]=b.useState([]);b.useEffect(()=>{h()},[]);const h=async()=>{if(!window.PublicKeyCredential){a(!1);return}if(!window.isSecureContext){a(!1);return}a(!0);const _=[];try{await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()&&_.push("Platform Authenticator (Face ID/Touch ID/Windows Hello)")}catch(v){console.warn("Error checking platform authenticator:",v)}f(_)},g=async()=>{if(!i){e("Employee ID is required for registration");return}d(!0);try{const _={challenge:new TextEncoder().encode(o||`register-${i}-${Date.now()}`),rp:{name:"Pioneer Cetak",id:window.location.hostname},user:{id:new TextEncoder().encode(i),name:i,displayName:i},pubKeyCredParams:[{alg:-7,type:"public-key"},{alg:-257,type:"public-key"}],authenticatorSelection:{authenticatorAttachment:"platform",userVerification:"required",requireResidentKey:!1},timeout:6e4,attestation:"none"},v=await navigator.credentials.create({publicKey:_});if(v){const x=v.response,E={id:v.id,rawId:Array.from(new Uint8Array(v.rawId)),response:{attestationObject:Array.from(new Uint8Array(x.attestationObject)),clientDataJSON:Array.from(new Uint8Array(x.clientDataJSON))},type:v.type};t(E)}}catch(_){console.error("Biometric registration failed:",_);let v="Registration failed.";_.name==="NotAllowedError"?v="Biometric feature is not enabled. Please ensure you are using a secure connection and have allowed biometrics for this site.":_.name==="SecurityError"?v="Permissions Policy error: Biometric registration is not permitted in this frame.":_.message.includes("publickey-credentials-create")?v="Security policy prevents biometric creation in this sandbox environment.":v=_.message||"An unexpected error occurred during biometric setup.",e(v)}finally{d(!1)}},y=async()=>{s.length,d(!0);try{const _={challenge:new TextEncoder().encode(o||`auth-${Date.now()}`),allowCredentials:s,timeout:6e4,userVerification:"required",rpId:window.location.hostname},v=await navigator.credentials.get({publicKey:_});if(v){const x=v.response,E={id:v.id,rawId:Array.from(new Uint8Array(v.rawId)),response:{authenticatorData:Array.from(new Uint8Array(x.authenticatorData)),clientDataJSON:Array.from(new Uint8Array(x.clientDataJSON)),signature:Array.from(new Uint8Array(x.signature)),userHandle:x.userHandle?Array.from(new Uint8Array(x.userHandle)):null},type:v.type};t(E)}}catch(_){console.error("Biometric authentication failed:",_);let v="Authentication failed.";_.name==="NotAllowedError"?v="Access denied or timed out. Please try again.":_.name==="SecurityError"?v="Permissions Policy error: Biometric access is not permitted in this frame.":v=_.message||"An unexpected error occurred during authentication.",e(v)}finally{d(!1)}};return r?m.jsxDEV("div",{className:"text-center p-6",children:[m.jsxDEV("div",{className:"mb-6",children:[m.jsxDEV("div",{className:`w-20 h-20 mx-auto mb-4 rounded-full flex items-center justify-center ${n==="register"?"bg-blue-100 text-blue-600":"bg-green-100 text-green-600"}`,children:n==="register"?m.jsxDEV(uo,{className:"h-10 w-10"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:203,columnNumber:34},void 0):m.jsxDEV(xi,{className:"h-10 w-10"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:203,columnNumber:69},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:202,columnNumber:9},void 0),m.jsxDEV("h3",{className:"text-xl font-bold text-gray-900 dark:text-white mb-2 uppercase tracking-tight",children:n==="register"?"Set Up Biometrics":"Scan to Verify"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:206,columnNumber:9},void 0),m.jsxDEV("p",{className:"text-gray-500 dark:text-gray-400 text-sm mb-6 max-w-xs mx-auto",children:n==="register"?"Connect your device security (Face ID, Fingerprint) to your employee profile.":"Verify your identity using your device sensor to complete this action."},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:210,columnNumber:9},void 0),p.length>0&&m.jsxDEV("div",{className:"inline-flex items-center space-x-2 px-3 py-1 bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 text-xs font-bold rounded-full mb-6",children:[m.jsxDEV("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:219,columnNumber:13},void 0),m.jsxDEV("span",{children:"Sensor Ready"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:220,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:218,columnNumber:11},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:201,columnNumber:7},void 0),m.jsxDEV("button",{onClick:n==="register"?g:y,disabled:c,className:`w-full py-4 px-6 rounded-2xl font-black uppercase tracking-tighter text-white transition-all shadow-lg active:scale-95 ${c?"bg-gray-400 cursor-not-allowed":n==="register"?"bg-blue-600 hover:bg-blue-700":"bg-green-600 hover:bg-green-700"}`,children:c?m.jsxDEV("div",{className:"flex items-center justify-center space-x-2",children:[m.jsxDEV(ta,{className:"animate-spin h-5 w-5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:238,columnNumber:13},void 0),m.jsxDEV("span",{children:"Processing..."},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:239,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:236,columnNumber:11},void 0):m.jsxDEV("div",{className:"flex items-center justify-center space-x-2",children:n==="register"?"Start Scan":"Start Verification"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:242,columnNumber:11},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:225,columnNumber:7},void 0),m.jsxDEV("div",{className:"mt-8 pt-6 border-t border-gray-100 dark:border-gray-700",children:m.jsxDEV("div",{className:"flex items-start space-x-3 text-left",children:[m.jsxDEV(Ef,{className:"h-5 w-5 text-blue-500 flex-shrink-0 mt-0.5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:250,columnNumber:11},void 0),m.jsxDEV("div",{children:[m.jsxDEV("p",{className:"text-xs font-bold text-gray-700 dark:text-gray-300 uppercase tracking-wider",children:"End-to-End Encryption"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:252,columnNumber:13},void 0),m.jsxDEV("p",{className:"text-xs text-gray-500 dark:text-gray-400 leading-relaxed mt-1",children:"Your biometric data never leaves your device. We only store a public cryptographic key for authentication."},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:253,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:251,columnNumber:11},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:249,columnNumber:9},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:248,columnNumber:7},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:200,columnNumber:5},void 0):m.jsxDEV("div",{className:"text-center p-8 bg-red-50 dark:bg-red-900/10 rounded-2xl border border-red-100 dark:border-red-900/30",children:[m.jsxDEV(Fi,{className:"h-16 w-16 text-red-500 mx-auto mb-4"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:190,columnNumber:9},void 0),m.jsxDEV("h3",{className:"text-lg font-bold text-red-800 dark:text-red-400 mb-2",children:"Security Capability Missing"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:191,columnNumber:9},void 0),m.jsxDEV("p",{className:"text-red-700 dark:text-red-300 text-sm",children:"Biometric authentication requires a secure (HTTPS) connection and specific browser capabilities that are currently unavailable in this environment."},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:192,columnNumber:9},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/BiometricAuth.tsx",lineNumber:189,columnNumber:7},void 0)},SA=()=>{const{addAttendanceRecord:t,biometricCredentials:e,employees:n}=jb(),{companyInfo:i}=fa(),{logout:o}=Ut(),s=ji(),{theme:r}=Et(),[a,c]=b.useState(new Date),[d,p]=b.useState(!1),[f,h]=b.useState(null),[g,y]=b.useState("idle"),[_,v]=b.useState(""),[x,E]=b.useState(null),[w,C]=b.useState(!1);b.useEffect(()=>{const F=setInterval(()=>{c(new Date)},1e3);navigator.geolocation&&navigator.geolocation.getCurrentPosition($=>{C(!0),E({latitude:$.coords.latitude,longitude:$.coords.longitude,accuracy:$.coords.accuracy})},()=>C(!1),{enableHighAccuracy:!0,timeout:1e4,maximumAge:3e5});const T=()=>p(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",T),()=>{clearInterval(F),document.removeEventListener("fullscreenchange",T)}},[]);const P=()=>{document.fullscreenElement||document.documentElement.requestFullscreen().catch(F=>{console.error(`Error attempting to enable fullscreen: ${F.message}`)})},k=()=>{document.fullscreenElement&&document.exitFullscreen().catch(F=>{console.error(`Error attempting to exit fullscreen: ${F.message}`)})},I=()=>{window.confirm("Are you sure you want to exit Kiosk Mode?")&&(k(),o(),s("/login",{replace:!0}))},j=F=>{h(F)},A=F=>{const T=e.find(X=>X.credentialId===F.id),$=T?n.find(X=>X.id===T.employeeId):null;if(!$){y("error"),v("Unrecognized biometric key. Please ensure your fingerprint/face is registered by an administrator.");return}const Q={employeeId:$.id,employeeName:$.name,action:f,timestamp:new Date,location:x||void 0,deviceInfo:{userAgent:navigator.userAgent,platform:navigator.platform,timestamp:new Date},credentialId:F.id};t(Q),y("success"),v(`${$.name} has successfully ${f==="clock_in"?"clocked in":"clocked out"}!`),setTimeout(()=>{y("idle"),h(null),v("")},4e3)},R=F=>{y("error"),v(F),setTimeout(()=>{y("idle"),v("")},5e3)},q=F=>F.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}),G=F=>F.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"}),L=e.map(F=>({id:new TextEncoder().encode(F.credentialId),type:"public-key",transports:["internal"]}));return m.jsxDEV("div",{className:`fixed inset-0 z-[100] flex flex-col ${r.mode==="dark"?"bg-gray-900":"bg-gray-50"}`,children:[m.jsxDEV("div",{className:"bg-gradient-to-r from-blue-700 to-indigo-800 text-white p-4 sm:p-6 shadow-lg flex-shrink-0",children:m.jsxDEV("div",{className:"flex justify-between items-center max-w-7xl mx-auto w-full",children:[m.jsxDEV("div",{className:"flex items-center space-x-3",children:[m.jsxDEV("div",{className:"bg-white/20 p-2 rounded-lg",children:m.jsxDEV(po,{className:"h-6 w-6"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:181,columnNumber:15},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:180,columnNumber:13},void 0),m.jsxDEV("div",{className:"hidden xs:block",children:[m.jsxDEV("h1",{className:"text-lg font-bold leading-none",children:i.name},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:184,columnNumber:15},void 0),m.jsxDEV("p",{className:"text-blue-200 text-xs mt-1",children:"Kiosk Mode Active"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:185,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:183,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:179,columnNumber:11},void 0),m.jsxDEV("div",{className:"flex items-center space-x-2",children:[m.jsxDEV("button",{onClick:d?k:P,className:"p-2 bg-white/10 hover:bg-white/20 rounded-lg transition-colors",title:d?"Exit Fullscreen":"Enter Fullscreen",children:d?m.jsxDEV(wf,{className:"h-5 w-5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:195,columnNumber:31},void 0):m.jsxDEV(Cf,{className:"h-5 w-5"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:195,columnNumber:66},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:190,columnNumber:13},void 0),m.jsxDEV("button",{onClick:I,className:"flex items-center space-x-2 px-4 py-2 bg-red-600 hover:bg-red-700 text-white text-sm font-bold rounded-lg shadow-lg transition-all",children:[m.jsxDEV(no,{className:"h-4 w-4"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:201,columnNumber:15},void 0),m.jsxDEV("span",{className:"hidden sm:inline",children:"Exit Kiosk"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:202,columnNumber:15},void 0),m.jsxDEV("span",{className:"sm:hidden",children:"Exit"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:203,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:197,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:189,columnNumber:11},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:178,columnNumber:9},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:177,columnNumber:7},void 0),m.jsxDEV("div",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-8 overflow-y-auto",children:m.jsxDEV("div",{className:"w-full max-w-2xl text-center",children:[m.jsxDEV("div",{className:"mb-12",children:[m.jsxDEV("div",{className:`text-5xl sm:text-8xl font-mono font-bold tracking-tighter ${r.mode==="dark"?"text-white":"text-gray-900"}`,children:q(a)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:214,columnNumber:13},void 0),m.jsxDEV("div",{className:`text-lg sm:text-2xl mt-2 font-medium ${r.mode==="dark"?"text-gray-400":"text-gray-600"}`,children:G(a)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:217,columnNumber:13},void 0),m.jsxDEV("div",{className:"flex items-center justify-center mt-6 space-x-4",children:[m.jsxDEV("div",{className:`flex items-center px-4 py-1.5 rounded-full text-xs font-bold uppercase tracking-wider ${w?"bg-green-100 text-green-700":"bg-red-100 text-red-700"}`,children:[m.jsxDEV(Df,{className:"h-3.5 w-3.5 mr-2"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:223,columnNumber:17},void 0),w?"Location Secured":"GPS Required"]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:222,columnNumber:15},void 0),m.jsxDEV("div",{className:"flex items-center px-4 py-1.5 rounded-full text-xs font-bold uppercase tracking-wider bg-blue-100 text-blue-700",children:[m.jsxDEV(uo,{className:"h-3.5 w-3.5 mr-2"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:227,columnNumber:17},void 0),"FIDO2 Security"]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:226,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:221,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:213,columnNumber:11},void 0),g==="idle"&&!f&&m.jsxDEV("div",{className:"space-y-6 animate-fade-in",children:m.jsxDEV("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 sm:gap-8",children:[m.jsxDEV("button",{onClick:()=>j("clock_in"),className:"group relative p-8 sm:p-14 bg-white dark:bg-gray-800 border-2 border-green-500 rounded-[2rem] shadow-xl hover:shadow-2xl transition-all duration-300 hover:scale-105 active:scale-95 overflow-hidden",children:[m.jsxDEV("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity",children:m.jsxDEV(Ua,{className:"h-24 w-24"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:241,columnNumber:21},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:240,columnNumber:19},void 0),m.jsxDEV("div",{className:"bg-green-600 text-white p-6 rounded-2xl w-24 h-24 mx-auto mb-6 flex items-center justify-center shadow-lg group-hover:rotate-6 transition-transform",children:m.jsxDEV(Ua,{className:"h-12 w-12"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:244,columnNumber:21},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:243,columnNumber:19},void 0),m.jsxDEV("h3",{className:"text-3xl font-black text-gray-900 dark:text-white uppercase tracking-tight",children:"Clock In"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:246,columnNumber:19},void 0),m.jsxDEV("p",{className:"text-gray-500 dark:text-gray-400 mt-2 font-bold uppercase text-xs tracking-widest",children:"Starting Shift"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:247,columnNumber:19},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:236,columnNumber:17},void 0),m.jsxDEV("button",{onClick:()=>j("clock_out"),className:"group relative p-8 sm:p-14 bg-white dark:bg-gray-800 border-2 border-red-500 rounded-[2rem] shadow-xl hover:shadow-2xl transition-all duration-300 hover:scale-105 active:scale-95 overflow-hidden",children:[m.jsxDEV("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity",children:m.jsxDEV(no,{className:"h-24 w-24"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:255,columnNumber:21},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:254,columnNumber:19},void 0),m.jsxDEV("div",{className:"bg-red-600 text-white p-6 rounded-2xl w-24 h-24 mx-auto mb-6 flex items-center justify-center shadow-lg group-hover:-rotate-6 transition-transform",children:m.jsxDEV(no,{className:"h-12 w-12"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:258,columnNumber:21},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:257,columnNumber:19},void 0),m.jsxDEV("h3",{className:"text-3xl font-black text-gray-900 dark:text-white uppercase tracking-tight",children:"Clock Out"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:260,columnNumber:19},void 0),m.jsxDEV("p",{className:"text-gray-500 dark:text-gray-400 mt-2 font-bold uppercase text-xs tracking-widest",children:"Ending Shift"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:261,columnNumber:19},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:250,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:235,columnNumber:15},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:234,columnNumber:13},void 0),f&&g==="idle"&&m.jsxDEV("div",{className:"w-full max-w-md mx-auto animate-scale-in",children:[m.jsxDEV("div",{className:"mb-8",children:[m.jsxDEV("div",{className:"inline-flex p-4 rounded-full bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 mb-4",children:m.jsxDEV(xi,{className:"h-12 w-12 animate-pulse"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:271,columnNumber:19},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:270,columnNumber:17},void 0),m.jsxDEV("h2",{className:`text-4xl font-black ${r.mode==="dark"?"text-white":"text-gray-900"} mb-2 uppercase`,children:"Verify Identity"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:273,columnNumber:17},void 0),m.jsxDEV("p",{className:"text-gray-500 dark:text-gray-400 font-medium",children:["Please scan your biometrics to ",f.replace("_"," ")]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:276,columnNumber:17},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:269,columnNumber:15},void 0),m.jsxDEV("div",{className:"bg-white dark:bg-gray-800 p-2 rounded-[2.5rem] shadow-2xl border border-gray-100 dark:border-gray-700 overflow-hidden",children:m.jsxDEV(xA,{mode:"authenticate",onSuccess:A,onError:R,challenge:`kiosk-${f}-${Date.now()}`,allowedCredentials:L},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:280,columnNumber:17},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:279,columnNumber:15},void 0),m.jsxDEV("button",{onClick:()=>h(null),className:"mt-8 px-8 py-3 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-200 rounded-xl font-black uppercase tracking-widest hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors",children:"Cancel"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:289,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:268,columnNumber:13},void 0),g==="success"&&m.jsxDEV("div",{className:"animate-scale-in",children:[m.jsxDEV("div",{className:"w-40 h-40 bg-green-100 dark:bg-green-900/30 text-green-600 rounded-full flex items-center justify-center mx-auto mb-8 shadow-inner ring-8 ring-green-50 dark:ring-green-900/10",children:m.jsxDEV(ea,{className:"h-24 w-24"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:301,columnNumber:17},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:300,columnNumber:15},void 0),m.jsxDEV("h2",{className:`text-5xl font-black ${r.mode==="dark"?"text-white":"text-gray-900"} mb-4 uppercase tracking-tighter`,children:"Confirmed"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:303,columnNumber:15},void 0),m.jsxDEV("p",{className:`text-2xl font-medium ${r.mode==="dark"?"text-gray-300":"text-gray-600"} max-w-lg mx-auto`,children:_},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:304,columnNumber:15},void 0),m.jsxDEV("div",{className:"mt-8 text-gray-400 font-medium animate-pulse",children:"Returning to start in 4 seconds..."},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:305,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:299,columnNumber:13},void 0),g==="error"&&m.jsxDEV("div",{className:"animate-shake",children:[m.jsxDEV("div",{className:"w-32 h-32 bg-red-100 dark:bg-red-900/30 text-red-600 rounded-full flex items-center justify-center mx-auto mb-8 shadow-inner",children:m.jsxDEV(Fi,{className:"h-20 w-20"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:312,columnNumber:17},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:311,columnNumber:15},void 0),m.jsxDEV("h2",{className:"text-4xl font-black text-red-600 mb-4 uppercase",children:"Auth Failed"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:314,columnNumber:15},void 0),m.jsxDEV("p",{className:"text-xl font-medium text-gray-600 dark:text-gray-400 mb-8 max-w-sm mx-auto",children:_},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:315,columnNumber:15},void 0),m.jsxDEV("button",{onClick:()=>{y("idle"),v("")},className:"bg-blue-600 hover:bg-blue-700 text-white px-10 py-4 rounded-2xl font-black uppercase tracking-tighter transition-transform active:scale-95 shadow-xl",children:"Try Again"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:316,columnNumber:15},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:310,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:211,columnNumber:9},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:210,columnNumber:7},void 0),m.jsxDEV("div",{className:`p-6 border-t ${r.mode==="dark"?"bg-gray-800 border-gray-700":"bg-white border-gray-200"} flex-shrink-0`,children:m.jsxDEV("div",{className:"max-w-7xl mx-auto flex flex-col sm:flex-row justify-between items-center text-xs font-black text-gray-500 dark:text-gray-400 uppercase tracking-widest gap-4",children:[m.jsxDEV("div",{className:"flex items-center space-x-2",children:[m.jsxDEV(uo,{className:"h-4 w-4 text-blue-600"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:331,columnNumber:13},void 0),m.jsxDEV("span",{children:"Encrypted Biometric Terminal"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:332,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:330,columnNumber:11},void 0),m.jsxDEV("div",{className:"flex items-center space-x-6",children:[m.jsxDEV("span",{className:"flex items-center",children:[m.jsxDEV(td,{className:"h-4 w-4 mr-2"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:335,columnNumber:49},void 0),i.name]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:335,columnNumber:13},void 0),m.jsxDEV("span",{className:"flex items-center",children:[m.jsxDEV(Qn,{className:"h-4 w-4 mr-2"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:336,columnNumber:49},void 0),"System Online"]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:336,columnNumber:13},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:334,columnNumber:11},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:329,columnNumber:9},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:328,columnNumber:7},void 0)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/hr/KioskMode.tsx",lineNumber:175,columnNumber:5},void 0)};class EA extends b.Component{constructor(){super(...arguments);Ra(this,"state",{hasError:!1})}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,i){console.error("Uncaught error:",n,i)}render(){return this.state.hasError?m.jsxDEV("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 px-4",children:m.jsxDEV("div",{className:"max-w-md w-full bg-white rounded-lg shadow-lg p-8 text-center",children:[m.jsxDEV("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-100 mb-6",children:m.jsxDEV(Fi,{className:"h-8 w-8 text-red-600"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/ErrorBoundary.tsx",lineNumber:32,columnNumber:29},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/ErrorBoundary.tsx",lineNumber:31,columnNumber:25},this),m.jsxDEV("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Something went wrong"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/ErrorBoundary.tsx",lineNumber:34,columnNumber:25},this),m.jsxDEV("p",{className:"text-gray-600 mb-6",children:"We encountered an unexpected error. The application has been logged for further investigation."},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/ErrorBoundary.tsx",lineNumber:35,columnNumber:25},this),this.state.error&&m.jsxDEV("div",{className:"bg-gray-100 p-3 rounded text-left mb-6 overflow-auto max-h-32 text-xs text-red-800 font-mono",children:this.state.error.toString()},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/ErrorBoundary.tsx",lineNumber:40,columnNumber:29},this),m.jsxDEV("button",{onClick:()=>window.location.reload(),className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",children:[m.jsxDEV(Yo,{className:"mr-2 h-4 w-4"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/ErrorBoundary.tsx",lineNumber:49,columnNumber:29},this),"Reload Application"]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/ErrorBoundary.tsx",lineNumber:45,columnNumber:25},this)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/components/ui/ErrorBoundary.tsx",lineNumber:30,columnNumber:21},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/components/ui/ErrorBoundary.tsx",lineNumber:29,columnNumber:17},this):this.props.children}}const ku=b.lazy(()=>he(()=>import("./Login-BDOaCNiK.js"),__vite__mapDeps([0,1,2,3]))),Pu=b.lazy(()=>he(()=>import("./CustomerDashboard-C1RMRyoa.js"),__vite__mapDeps([4,3,1,5,2,6,7]))),wA=b.lazy(()=>he(()=>import("./SupplierDashboard-CnDs_wwe.js"),__vite__mapDeps([8,3,1,9,5,2,6,10])));b.lazy(()=>he(()=>import("./QuotationDashboard-wiq5sRLQ.js"),__vite__mapDeps([11,5,2,1,6,3])));const CA=b.lazy(()=>he(()=>import("./AdminDashboard-CgKSWZ_u.js"),__vite__mapDeps([12,1,5,2,6,10,3]))),DA=b.lazy(()=>he(()=>import("./Administration-BGpriKLU.js"),__vite__mapDeps([13,3,1,14,2,5]))),TA=b.lazy(()=>he(()=>import("./OrderManagement-BoDgHy0_.js"),__vite__mapDeps([15,3,1,5,2,10]))),Iu=b.lazy(()=>he(()=>import("./ProductionTracking-9vZPqUqC.js"),__vite__mapDeps([16,1,5,2,6,17,3]))),AA=b.lazy(()=>he(()=>import("./QualityControl-ppDYkB1W.js"),__vite__mapDeps([18,3,1,5,2,6,10]))),kA=b.lazy(()=>he(()=>import("./Accounting-BlvRAVtY.js"),__vite__mapDeps([19,3,1,5,2,10]))),PA=b.lazy(()=>he(()=>import("./ChartOfAccounts-Ba4JFHHD.js"),__vite__mapDeps([20,1,5,2,6,10,3]))),IA=b.lazy(()=>he(()=>import("./Analytics-DcYwfgB9.js"),__vite__mapDeps([21,1,5,2,6,3]))),RA=b.lazy(()=>he(()=>import("./NewOrder-Dgm3_ijs.js"),__vite__mapDeps([22,23,1,2,24,3,25,26,10,27]))),MA=b.lazy(()=>he(()=>import("./RequestQuote-tFracgGI.js"),__vite__mapDeps([28,23,1,2,24,3,25,26,10,27]))),Ru=b.lazy(()=>he(()=>import("./BiometricAttendance-Ddq3PwB2.js"),__vite__mapDeps([29,3,1,2,5,6]))),VA=b.lazy(()=>he(()=>import("./AttendanceReports-g_KV1zws.js"),__vite__mapDeps([30,1,5,2,6,7,3]))),LA=b.lazy(()=>he(()=>import("./PayrollHR-BED5ieJF.js"),__vite__mapDeps([31,3,1,9,5,2,6,7,10,32]))),OA=b.lazy(()=>he(()=>import("./Commission-BWUXbwRk.js"),__vite__mapDeps([33,3,1,5,2,6,7,10]))),jA=b.lazy(()=>he(()=>import("./PartnersManagement-BjCKNANv.js"),__vite__mapDeps([34,1,2,5,6,10,7,3]))),FA=b.lazy(()=>he(()=>import("./LayoutPlanner-D6dC07CY.js"),__vite__mapDeps([35,1,5,2,27,10,3]))),qA=b.lazy(()=>he(()=>import("./MaterialsLibrary-B_W3pbim.js"),__vite__mapDeps([36,1,37,2,3,38,39,40,41,5,6,10]))),UA=b.lazy(()=>he(()=>import("./SaasLandingPage-Bv1SXtoX.js"),__vite__mapDeps([42,1,2,3]))),$A=b.lazy(()=>he(()=>import("./SaasFeaturesPage-DqV7lB0Z.js"),__vite__mapDeps([43,1,2,3]))),Mu=b.lazy(()=>he(()=>import("./CompanyLandingPage-BA1jXYwH.js"),__vite__mapDeps([44,1,2,3]))),BA=b.lazy(()=>he(()=>import("./Integrations-Dxhl4vS9.js"),__vite__mapDeps([45,5,2,1,3]))),GA=b.lazy(()=>he(()=>import("./Inventory-CdApuqqG.js"),__vite__mapDeps([46,1,7,2,6,47,5,10,3]))),HA=b.lazy(()=>he(()=>import("./PipelineMonitor-B08p7bC6.js"),__vite__mapDeps([48,1,2,3]))),KA=b.lazy(()=>he(()=>import("./JobStatusBoard-Dae5iV4Z.js"),__vite__mapDeps([49,1,2,5,3]))),Vu=b.lazy(()=>he(()=>import("./QuotesList-BCTAv9hX.js"),__vite__mapDeps([50,1,51,2,3,5,6]))),JA=b.lazy(()=>he(()=>import("./InvoicesList-yaMhsQSq.js"),__vite__mapDeps([52,1,5,2,6,10,3]))),WA=b.lazy(()=>he(()=>import("./MonthlySalesAnalysis-C28WCWaL.js"),__vite__mapDeps([53,1,5,2,6,7,3]))),Lu=b.lazy(()=>he(()=>import("./ScanGateway-BlYzU2U_.js"),__vite__mapDeps([54,1,2,3]))),zA=b.lazy(()=>he(()=>import("./PurchaseOrders-D4QARm_V.js"),__vite__mapDeps([55,1,7,2,6,5,3]))),YA=b.lazy(()=>he(()=>import("./JobCostingReport-_JYIVvaL.js"),__vite__mapDeps([56,1,5,2,6,3]))),QA=b.lazy(()=>he(()=>import("./MachineScheduling-5b2NjZ3D.js"),__vite__mapDeps([57,1,5,2,3]))),XA=b.lazy(()=>he(()=>import("./ExecutiveDashboard-CCj1roxY.js"),__vite__mapDeps([58,1,5,2,3]))),ZA=b.lazy(()=>he(()=>import("./DispatchManager-Df_64ntD.js"),__vite__mapDeps([59,1,2,3]))),ek=b.lazy(()=>he(()=>import("./MachineMaintenance-D_XwKL5c.js"),__vite__mapDeps([60,1,2,3]))),tk=b.lazy(()=>he(()=>import("./DeliveryRoute-B6YyfM-c.js"),__vite__mapDeps([61,1,2,62,3]))),nk=b.lazy(()=>he(()=>import("./FloatingChat-1_ZHGKq6.js"),__vite__mapDeps([63,1,2,3]))),gi=()=>m.jsxDEV("div",{className:"flex items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-900",children:m.jsxDEV("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-blue-600"},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:66,columnNumber:5},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:65,columnNumber:3},void 0);function ik(){const{user:t}=Ut();return t!=null&&t.isAttendanceMonitor?m.jsxDEV(b.Suspense,{fallback:m.jsxDEV(gi,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:76,columnNumber:27},this),children:m.jsxDEV(La,{children:[m.jsxDEV(me,{path:"/login",element:m.jsxDEV(ku,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:78,columnNumber:41},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:78,columnNumber:11},this),m.jsxDEV(me,{path:"/attendance",element:m.jsxDEV(Ru,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:79,columnNumber:46},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:79,columnNumber:11},this),m.jsxDEV(me,{path:"/kiosk",element:m.jsxDEV(SA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:80,columnNumber:41},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:80,columnNumber:11},this),m.jsxDEV(me,{path:"*",element:m.jsxDEV(zo,{to:"/attendance",replace:!0},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:82,columnNumber:36},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:82,columnNumber:11},this)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:77,columnNumber:9},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:76,columnNumber:7},this):m.jsxDEV(b.Suspense,{fallback:m.jsxDEV(gi,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:89,columnNumber:25},this),children:m.jsxDEV(La,{children:[m.jsxDEV(me,{path:"/login",element:m.jsxDEV(ku,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:91,columnNumber:39},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:91,columnNumber:9},this),m.jsxDEV(me,{path:"/scan",element:m.jsxDEV(b.Suspense,{fallback:m.jsxDEV(gi,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:95,columnNumber:33},this),children:m.jsxDEV(Lu,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:96,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:95,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:92,columnNumber:9},this),m.jsxDEV(me,{path:"/scan/:orderId",element:m.jsxDEV(b.Suspense,{fallback:m.jsxDEV(gi,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:103,columnNumber:33},this),children:m.jsxDEV(Lu,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:104,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:103,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:100,columnNumber:9},this),m.jsxDEV(me,{path:"/track/:orderId",element:m.jsxDEV(b.Suspense,{fallback:m.jsxDEV(gi,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:111,columnNumber:33},this),children:m.jsxDEV(Pu,{isTrackingOnly:!0},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:112,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:111,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:108,columnNumber:9},this),m.jsxDEV(me,{path:"/production/order/:orderId",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager","worker"],children:m.jsxDEV(we,{children:m.jsxDEV(Iu,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:121,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:120,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:119,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:116,columnNumber:9},this),m.jsxDEV(me,{path:"/saas",element:m.jsxDEV(UA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:127,columnNumber:38},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:127,columnNumber:9},this),m.jsxDEV(me,{path:"/saas/features",element:m.jsxDEV($A,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:128,columnNumber:47},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:128,columnNumber:9},this),m.jsxDEV(me,{path:"/company",element:m.jsxDEV(Mu,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:129,columnNumber:41},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:129,columnNumber:9},this),m.jsxDEV(me,{path:"/driver/delivery/:orderId",element:m.jsxDEV(b.Suspense,{fallback:m.jsxDEV(gi,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:135,columnNumber:33},this),children:m.jsxDEV(tk,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:136,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:135,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:132,columnNumber:9},this),m.jsxDEV(me,{path:"/",element:t?m.jsxDEV(zo,{to:"/dashboard",replace:!0},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:140,columnNumber:41},this):m.jsxDEV(Mu,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:140,columnNumber:80},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:140,columnNumber:9},this),m.jsxDEV(me,{path:"/dashboard",element:m.jsxDEV(Ee,{children:m.jsxDEV(we,{children:(t==null?void 0:t.role)==="supplier"?m.jsxDEV(wA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:147,columnNumber:46},this):(t==null?void 0:t.role)==="admin"||(t==null?void 0:t.role)==="manager"?m.jsxDEV(CA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:148,columnNumber:72},this):(t==null?void 0:t.role)==="estimator"?m.jsxDEV(Vu,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:149,columnNumber:50},this):m.jsxDEV(Pu,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:150,columnNumber:23},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:146,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:145,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:142,columnNumber:9},this),m.jsxDEV(me,{path:"/admin",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager","estimator"],children:m.jsxDEV(we,{children:m.jsxDEV(DA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:161,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:160,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:159,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:156,columnNumber:9},this),m.jsxDEV(me,{path:"/executive-bi",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager"],children:m.jsxDEV(we,{children:m.jsxDEV(XA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:172,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:171,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:170,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:167,columnNumber:9},this),m.jsxDEV(me,{path:"/dispatch",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager"],children:m.jsxDEV(we,{children:m.jsxDEV(ZA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:183,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:182,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:181,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:178,columnNumber:9},this),m.jsxDEV(me,{path:"/maintenance",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager"],children:m.jsxDEV(we,{children:m.jsxDEV(ek,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:194,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:193,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:192,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:189,columnNumber:9},this),m.jsxDEV(me,{path:"/integrations",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager"],children:m.jsxDEV(we,{children:m.jsxDEV(BA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:205,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:204,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:203,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:200,columnNumber:9},this),m.jsxDEV(me,{path:"/orders",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager","worker","supplier","customer","estimator"],children:m.jsxDEV(we,{children:m.jsxDEV(TA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:216,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:215,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:214,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:211,columnNumber:9},this),m.jsxDEV(me,{path:"/production/board",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager","worker"],children:m.jsxDEV(we,{children:m.jsxDEV(KA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:227,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:226,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:225,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:222,columnNumber:9},this),m.jsxDEV(me,{path:"/pipeline-monitor",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager","worker"],children:m.jsxDEV(HA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:237,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:236,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:233,columnNumber:9},this),m.jsxDEV(me,{path:"/production-tracking",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager","worker"],children:m.jsxDEV(we,{children:m.jsxDEV(Iu,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:247,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:246,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:245,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:242,columnNumber:9},this),m.jsxDEV(me,{path:"/layout-planner",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager","worker","estimator"],children:m.jsxDEV(we,{children:m.jsxDEV(FA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:258,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:257,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:256,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:253,columnNumber:9},this),m.jsxDEV(me,{path:"/inventory",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager","worker"],children:m.jsxDEV(we,{children:m.jsxDEV(GA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:269,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:268,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:267,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:264,columnNumber:9},this),m.jsxDEV(me,{path:"/purchase-orders",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager"],children:m.jsxDEV(we,{children:m.jsxDEV(zA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:280,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:279,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:278,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:275,columnNumber:9},this),m.jsxDEV(me,{path:"/job-costing",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager"],children:m.jsxDEV(we,{children:m.jsxDEV(YA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:291,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:290,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:289,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:286,columnNumber:9},this),m.jsxDEV(me,{path:"/machine-scheduling",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager"],children:m.jsxDEV(we,{children:m.jsxDEV(QA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:302,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:301,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:300,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:297,columnNumber:9},this),m.jsxDEV(me,{path:"/quality-control",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager","worker"],children:m.jsxDEV(we,{children:m.jsxDEV(AA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:313,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:312,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:311,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:308,columnNumber:9},this),m.jsxDEV(me,{path:"/attendance",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager","worker"],children:m.jsxDEV(we,{children:m.jsxDEV(Ru,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:324,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:323,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:322,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:319,columnNumber:9},this),m.jsxDEV(me,{path:"/attendance/reports",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager"],children:m.jsxDEV(we,{children:m.jsxDEV(VA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:335,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:334,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:333,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:330,columnNumber:9},this),m.jsxDEV(me,{path:"/accounting",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager"],children:m.jsxDEV(we,{children:m.jsxDEV(kA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:346,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:345,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:344,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:341,columnNumber:9},this),m.jsxDEV(me,{path:"/chart-of-accounts",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager"],children:m.jsxDEV(we,{children:m.jsxDEV(PA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:357,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:356,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:355,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:352,columnNumber:9},this),m.jsxDEV(me,{path:"/analytics",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager"],children:m.jsxDEV(we,{children:m.jsxDEV(IA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:368,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:367,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:366,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:363,columnNumber:9},this),m.jsxDEV(me,{path:"/new-order",element:m.jsxDEV(Ee,{children:m.jsxDEV(we,{children:m.jsxDEV(RA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:379,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:378,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:377,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:374,columnNumber:9},this),m.jsxDEV(me,{path:"/request-quote",element:m.jsxDEV(Ee,{children:m.jsxDEV(we,{children:m.jsxDEV(MA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:390,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:389,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:388,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:385,columnNumber:9},this),m.jsxDEV(me,{path:"/quotations",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager","estimator"],children:m.jsxDEV(we,{children:m.jsxDEV(Vu,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:401,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:400,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:399,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:396,columnNumber:9},this),m.jsxDEV(me,{path:"/invoices",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager"],children:m.jsxDEV(we,{children:m.jsxDEV(JA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:412,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:411,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:410,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:407,columnNumber:9},this),m.jsxDEV(me,{path:"/sales-analysis",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager"],children:m.jsxDEV(we,{children:m.jsxDEV(WA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:423,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:422,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:421,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:418,columnNumber:9},this),m.jsxDEV(me,{path:"/payroll",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager"],children:m.jsxDEV(we,{children:m.jsxDEV(LA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:434,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:433,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:432,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:429,columnNumber:9},this),m.jsxDEV(me,{path:"/commission",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager"],children:m.jsxDEV(we,{children:m.jsxDEV(OA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:445,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:444,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:443,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:440,columnNumber:9},this),m.jsxDEV(me,{path:"/partners",element:m.jsxDEV(Ee,{allowedRoles:["admin","manager"],children:m.jsxDEV(we,{children:m.jsxDEV(jA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:456,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:455,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:454,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:451,columnNumber:9},this),m.jsxDEV(me,{path:"/materials",element:m.jsxDEV(Ee,{children:m.jsxDEV(we,{children:m.jsxDEV(qA,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:467,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:466,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:465,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:462,columnNumber:9},this)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:90,columnNumber:7},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:89,columnNumber:5},this)}function ok(){const{i18n:t}=ni(),e=t.language==="ar";return b.useEffect(()=>{document.documentElement.dir=e?"rtl":"ltr",document.documentElement.lang=t.language},[e,t.language]),m.jsxDEV("div",{className:`min-h-screen transition-colors duration-300 ${e?"rtl-layout":"ltr-layout"}`,dir:e?"rtl":"ltr",children:[m.jsxDEV(EA,{children:m.jsxDEV(ik,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:490,columnNumber:9},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:489,columnNumber:7},this),m.jsxDEV(b.Suspense,{fallback:null,children:m.jsxDEV(nk,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:493,columnNumber:9},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:492,columnNumber:7},this)]},void 0,!0,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:488,columnNumber:5},this)}function sk(){return m.jsxDEV(y_,{children:m.jsxDEV(Yh,{children:m.jsxDEV(fb,{children:m.jsxDEV(g_,{children:m.jsxDEV(Eb,{children:m.jsxDEV(wb,{children:m.jsxDEV(kb,{children:m.jsxDEV(Fb,{children:m.jsxDEV(Yb,{children:m.jsxDEV(o_,{children:m.jsxDEV(f_,{children:m.jsxDEV(nf,{children:m.jsxDEV(ok,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:513,columnNumber:29},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:512,columnNumber:27},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:511,columnNumber:25},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:510,columnNumber:23},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:509,columnNumber:21},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:508,columnNumber:19},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:507,columnNumber:17},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:506,columnNumber:15},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:505,columnNumber:13},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:504,columnNumber:11},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:503,columnNumber:9},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:502,columnNumber:7},this)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/App.tsx",lineNumber:501,columnNumber:5},this)}const{slice:rk,forEach:ak}=[];function lk(t){return ak.call(rk.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}function ck(t){return typeof t!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(n=>n.test(t))}const Ou=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,uk=function(t,e){const i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},o=encodeURIComponent(e);let s=`${t}=${o}`;if(i.maxAge>0){const r=i.maxAge-0;if(Number.isNaN(r))throw new Error("maxAge should be a Number");s+=`; Max-Age=${Math.floor(r)}`}if(i.domain){if(!Ou.test(i.domain))throw new TypeError("option domain is invalid");s+=`; Domain=${i.domain}`}if(i.path){if(!Ou.test(i.path))throw new TypeError("option path is invalid");s+=`; Path=${i.path}`}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+=`; Expires=${i.expires.toUTCString()}`}if(i.httpOnly&&(s+="; HttpOnly"),i.secure&&(s+="; Secure"),i.sameSite)switch(typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return i.partitioned&&(s+="; Partitioned"),s},ju={create(t,e,n,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+n*60*1e3)),i&&(o.domain=i),document.cookie=uk(t,e,o)},read(t){const e=`${t}=`,n=document.cookie.split(";");for(let i=0;i<n.length;i++){let o=n[i];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(e)===0)return o.substring(e.length,o.length)}return null},remove(t,e){this.create(t,"",-1,e)}};var dk={name:"cookie",lookup(t){let{lookupCookie:e}=t;if(e&&typeof document<"u")return ju.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:n,cookieMinutes:i,cookieDomain:o,cookieOptions:s}=e;n&&typeof document<"u"&&ju.create(n,t,i,o,s)}},pk={name:"querystring",lookup(t){var i;let{lookupQuerystring:e}=t,n;if(typeof window<"u"){let{search:o}=window.location;!window.location.search&&((i=window.location.hash)==null?void 0:i.indexOf("?"))>-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const r=o.substring(1).split("&");for(let a=0;a<r.length;a++){const c=r[a].indexOf("=");c>0&&r[a].substring(0,c)===e&&(n=r[a].substring(c+1))}}return n}},mk={name:"hash",lookup(t){var o;let{lookupHash:e,lookupFromHashIndex:n}=t,i;if(typeof window<"u"){const{hash:s}=window.location;if(s&&s.length>2){const r=s.substring(1);if(e){const a=r.split("&");for(let c=0;c<a.length;c++){const d=a[c].indexOf("=");d>0&&a[c].substring(0,d)===e&&(i=a[c].substring(d+1))}}if(i)return i;if(!i&&n>-1){const a=s.match(/\/([a-zA-Z-]*)/g);return Array.isArray(a)?(o=a[typeof n=="number"?n:0])==null?void 0:o.replace("/",""):void 0}}}return i}};let yi=null;const Fu=()=>{if(yi!==null)return yi;try{if(yi=typeof window<"u"&&window.localStorage!==null,!yi)return!1;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{yi=!1}return yi};var fk={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&Fu())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&Fu()&&window.localStorage.setItem(n,t)}};let vi=null;const qu=()=>{if(vi!==null)return vi;try{if(vi=typeof window<"u"&&window.sessionStorage!==null,!vi)return!1;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{vi=!1}return vi};var hk={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&qu())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&qu()&&window.sessionStorage.setItem(n,t)}},gk={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:n,userLanguage:i,language:o}=navigator;if(n)for(let s=0;s<n.length;s++)e.push(n[s]);i&&e.push(i),o&&e.push(o)}return e.length>0?e:void 0}},yk={name:"htmlTag",lookup(t){let{htmlTag:e}=t,n;const i=e||(typeof document<"u"?document.documentElement:null);return i&&typeof i.getAttribute=="function"&&(n=i.getAttribute("lang")),n}},vk={name:"path",lookup(t){var o;let{lookupFromPathIndex:e}=t;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(o=n[typeof e=="number"?e:0])==null?void 0:o.replace("/",""):void 0}},bk={name:"subdomain",lookup(t){var o,s;let{lookupFromSubdomainIndex:e}=t;const n=typeof e=="number"?e+1:1,i=typeof window<"u"&&((s=(o=window.location)==null?void 0:o.hostname)==null?void 0:s.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(i)return i[n]}};let Wm=!1;try{document.cookie,Wm=!0}catch{}const zm=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];Wm||zm.splice(1,1);const _k=()=>({order:zm,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t});class Ym{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,n)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=lk(n,this.options||{},_k()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(dk),this.addDetector(pk),this.addDetector(fk),this.addDetector(hk),this.addDetector(gk),this.addDetector(yk),this.addDetector(vk),this.addDetector(bk),this.addDetector(mk)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return e.forEach(i=>{if(this.detectors[i]){let o=this.detectors[i].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(n=n.concat(o))}}),n=n.filter(i=>i!=null&&!ck(i)).map(i=>this.options.convertDetectedLanguage(i)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||n.forEach(i=>{this.detectors[i]&&this.detectors[i].cacheUserLanguage(e,this.options)}))}}Ym.type="languageDetector";const Nk={nav:{dashboard:"Dashboard",orders:"Orders Status",new_order:"New Job",materials:"Materials",board:"Job Board",tracking:"Tracking",accounting:"Accounting",analytics:"Analytics",capture:"Capture"},sections:{basic_info:"Basic Information"},labels:{description:"Description",variants:"Variants"},addNew:"Add New",import:"Import",export:"Export",addCustomer:"Add Customer",saveChanges:"Save Changes",disabled:"Disabled",enabled:"Enabled",draft:"Draft",noData:"No data available",loading:"Loading...",not_applicable:"N/A",add:"Add",try_again:"Try Again",step:"Step",of:"of",appName:"Pioneer Cetak",actions:{back:"Back",cancel:"Cancel",close:"Close",delete:"Delete",edit:"Edit"},cancel:"Cancel",generated_on:"Generated on",download_pdf:"Download PDF",months_full:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},change:"Change",close:"Close",collapse:"Collapse",configure:"Configure",delete:"Delete",delete_confirm:"Delete confirm",error:"Error",expand:"Expand",general:"General",hide:"Hide",order:"Order",quotation:"Quotation",reference:"Reference",reset:"Reset",save:"Save",search:"Search",submit:"Submit",success:"Success",summary:"Summary",time:{days:"Days"},units:{sheets:"Sheets"},unknown:"Unknown"},xk={company:{nav:{heritage:"Heritage",capabilities:"Capabilities",inquiry:"Inquiry",clientPortal:"Client Portal",getQuote:"Get a Quote",software:"PrintOS Software"},hero:{badge:"KL's Premium Print Factory",titleMain:"The Art of",titleSub:"Precision Printing.",description:"Since 2009, we have translated digital perfection into physical reality. Uncompromising quality, ISO-certified color, and factory-direct speed.",ctaExplore:"Explore Capabilities",ctaSoftware:"Discover PrintOS Software",slide2:{titleMain:"Industrial",titleSub:"Scalability.",description:"Our Heidelberg Speedmaster fleet delivers uncompromising volume with ISO-certified color precision."},slide3:{titleMain:"The Art of",titleSub:"Luxury Finishing.",description:"From structural packaging to bespoke foil stamping, we craft the tactile details that define your brand."},slide4:{titleMain:"Digital",titleSub:"High Precision.",description:"Our digital production suite offers rapid turnarounds with variable data capabilities for personalized excellence."}},heritage:{badge:"Heritage",title:`We own the machines.
You get the advantage.`,p1:"Unlike print brokers and agencies, we operate our own massive production floor in the heart of Kuala Lumpur. This means complete control over quality and zero middleman markups.",p2:"By investing heavily in the world's most advanced Heidelberg offset presses and precise ICC color-calibration technology, we guarantee that the brand colors you designed are exactly the colors we press into paper.",stat1Val:"ISO 12647",stat1Label:"Certified Colour",stat2Val:"18,000",stat2Label:"Sheets Per Hour",yearsExp:"Years of Excellence"},capabilities:{badge:"Capabilities",title:`Uncompromising Scale.
Meticulous Finish.`,description:"From high-volume commercial runs to bespoke structural packaging, our machinery dictates perfection.",offset:{title:"Offset Printing",desc:"Heidelberg Speedmaster XL. CMYK and Pantone precision engineered for high-yield, cost-effective commercial runs."},digital:{title:"Digital Express",desc:"HP Indigo technology for stunning short-runs, variable data printing, and urgent next-day deliveries without compromise."},packaging:{title:"Structure & Box",desc:"Die-cut folding cartons, rigid luxury boxes, and custom corrugated packaging crafted for retail impact."},finishing:{title:"Premium Finishing",desc:"Spot UV, foil stamping, deep embossing, soft-touch lamination, and perfect binding done entirely in-house."},logistics:{title:"Turnkey Logistics",desc:"Seamless packaging, warehousing, and nationwide dispatch direct from our loading bays to your distribution centers."},cta:{title:"Challenge Us.",desc:"Have a unique spec or impossible deadline? Let's talk."}},contact:{title:`Initiate 
Project.`,description:"Submit your specifications. Our production experts will return a comprehensive quote within 4 business hours.",facility:"Facility",directLine:"Direct Line",hours:"Operating Hours",monWedFri:"Mon-Wed, Fri",thursday:"Thursday",saturday:"Saturday",sunday:"Sunday",closed:"Closed",form:{name:"Name / Company",email:"Email Address",category:"Service Category",categoryOther:"Other",brief:"Project Brief",submit:"Request Quotation"}},footer:{title:"Precision. Built In.",rights:"All rights reserved.",systemBy:"System by PrintOS"},partners:{title:"Strategic Partners"}},saas:{nav:{platform:"Platform",customers:"Customers",agencyDemo:"Agency Demo",signIn:"Sign in",deployNow:"Deploy now"},hero:{badge:"V1.0 Architecture Live",title:`The Operating System 
for Print Production.`,description:"Connect quotes, production boards, accounting ledgers, and inventory into one unified data graph. Goodbye spreadsheets.",ctaBuild:"Start building",ctaDocs:"Read Documentation"},features:{badge:"A perfectly constructed toolkit",title:"A perfectly constructed toolkit.",description:"We ripped out the friction of traditional ERPs. No ancient interfaces. Just lightning-fast workflows built exactly for how a modern prepress and factory floor operates.",stat1Val:"10x",stat1Label:"Faster Quoting",stat2Val:"0",stat2Label:"Missed Deadlines",graph:{title:"Real-time Graph",desc:"Quotes auto-convert into production jobs. Inventory auto-deducts. Everything is synced instantly across the entire platform via WebSockets."},kanban:{title:"Kanban Production",desc:"Drag-and-drop job tickets across your factory floor. Barcode scanning on workstations updates status immediately."},inventory:{title:"Intelligent Inventory",desc:"Track paper weight, grain direction, and ink levels. Configure automatic PO triggers before you run out of stock."},security:{title:"Enterprise Security",desc:"Row-level security, role-based access control, and daily backups. Your client data and pricing matrices are locked down."}},cta:{title:"Stop managing chaos.",description:"Join the new standard of print management. Spin up your workspace in seconds.",deploy:"Deploy PrintOS"},pricing:{title:"Boutique Economics",description:"Transparent, scale-ready pricing for modern factories.",essence:{title:"Essence",price:"$49",period:"per month",feat1:"Up to 5 workstations",feat2:"Basic Inventory",feat3:"Standard Reports",cta:"Get Started"},velocity:{title:"Velocity",price:"$149",period:"per month",feat1:"Unlimited workstations",feat2:"Advanced Production",feat3:"Live Dashboards",cta:"Upgrade to Growth"},enterprise:{title:"Enterprise",price:"Custom",period:"tailored scale",feat1:"Multi-site sync",feat2:"Custom Ledger Integration",feat3:"Dedicated Success Manager",cta:"Talk to Sales"}},features_page:{hero:{badge:"THE NEW STANDARD",title:`Scale Your Printing 
Empire with Precision.`,description:"Stop managing chaos. PrintOS is the vertical operating system designed to handle the multi-layered complexities of offset, digital, and packaging manufacturing at scale."},section1:{title:"Precision Estimation Engine",description:"The world's most advanced estimator for complex printing. It calculates paper weight, ink coverage, machine time, and finishing margins in milliseconds—eliminating human error and spreadsheet fatigue forever.",feat1:"Dynamic HSL Pricing Architecture",feat2:"Layout & Imposition Intelligence",feat3:"Instant, Branded PDF Quotes"},section2:{title:"Live Shop Floor Intelligence",description:"Turn your factory floor into a high-visibility data environment. With real-time Kanban boards and terminal scanning at every workstation, you'll know exactly which job is on which machine at any given second.",feat1:"Live Production Kanban Board",feat2:"QR-Driven Workstation Terminals",feat3:"Real-time Labor & Time Analysis"},section4:{title:"Financial Intelligence & Ledgers",description:"A financial core built specifically for the printing industry. From automated SST-ready invoicing to a fully integrated ledger, we ensure your cash flow is as precise as your printing.",feat1:"Automated SST/VAT Tax Handling",feat2:"Integrated Professional Ledger",feat3:"Payment Tracking & Reminders"},section5:{title:"Human Capital & Attendance",description:"Manage your most valuable asset—your people. Integrated biometric attendance flows directly into automated payroll systems, ensuring your production team is motivated and properly compensated.",feat1:"Biometric Attendance Kiosks",feat2:"Automated Payroll Calculation",feat3:"Staff Commission & Performance Tracking"},section3:{title:"Unified Logistics & Supply",description:"Bridge the gap between raw materials and finished pallets. Our smart inventory system tracks every gram of ink and every sheet of paper, ensuring you never run dry mid-production.",feat1:"Smart Material Threshold Alerts",feat2:"Supplier Fulfillment Gateway",feat3:"Live Logistics & Shipping Tracking"},section6:{title:"Solutions for Every Vertical",description:"PrintOS isn't a one-size-fits-all tool. We've built industry-specific workflows that understand the unique physics and economics of your specific printing sector.",feat1:"Commercial Offset & Web",feat2:"Folding Carton & Packaging",feat3:"Digital & Large Format"},section7:{title:"Enterprise Trust & Security",description:"Your data is your most valuable asset. We protect it with banking-grade encryption and a global infrastructure that ensures 99.9% uptime, even during peak production seasons.",feat1:"AES-256 Data Encryption",feat2:"99.9% SLA Cloud Connectivity",feat3:"Automated Daily Backups"}}}},Sk={passwordPrompt:{title:"Authentication Required",desc:"Please enter your password to continue.",passwordLabel:"Password",confirm:"Confirm",cancel:"Cancel",error:"Invalid password"},accessWorkspace:"Access Workspace",cloudBase:"Cloud Base",copyright:"Copyright",elevateTitle:"Elevate Title",errors:{invalidCredentials:"Invalid Credentials"},forgot:"Forgot",heroDescription:"Hero Description",printingOperations:"Printing Operations",quickAccess:"Quick Access",reliability:"Reliability",roles:{admin:"Admin",adminDesc:"Admin Desc",customer:"Customer",customerDesc:"Customer Desc",kiosk:"Kiosk",kioskDesc:"Kiosk Desc",manager:"Manager",managerDesc:"Manager Desc",supplier:"Supplier",supplierDesc:"Supplier Desc",worker:"Worker",workerDesc:"Worker Desc"},securePassword:"Secure Password",signInSubtitle:"Sign In Subtitle",support:"Support",welcomeBack:"Welcome Back",workEmail:"Work Email"},Ek={dashboard:"Dashboard",orders:"Orders Status",newOrder:"New Order",requestQuote:"Request Quote",invoices:"My Invoices",support:"Help & Support",materials:"Materials Library",jobBoard:"Job Board",productionTracking:"Production Tracking",layoutPlanner:"Layout Planner",inventory:"Inventory",qualityControl:"Quality Control",attendance:"Attendance",accounting:"Accounting",payroll:"Payroll & HR",commission:"Commission",analytics:"Analytics",administration:"Administration",descriptions:{dashboard:"Overview & Quick Actions",orders:"Manage Print Jobs",newOrder:"Place a new order",requestQuote:"Get pricing for your project",invoices:"View and download invoices",support:"Get help",materials:"Browse paper & finishing",jobBoard:"Kanban Job Status",productionTracking:"Real-time Monitoring",layoutPlanner:"Calculate artwork layout",inventory:"Manage stock levels",qualityControl:"Quality Assurance",attendance:"Biometric Attendance",accounting:"Financial Management",payroll:"Employee Management",commission:"Commission Management",analytics:"Business Intelligence",administration:"System Management"}},wk={main:"Main",operations:"Operations",hrFinance:"HR & Finance",system:"System"},Ck={welcome:"Welcome back, {{name}}",overview:"Overview",description:"Here's what's happening in your print shop today.",downloadReport:"Download Report",newCampaign:"New Campaign",portal:"Customer Portal",projectInfo:"Track your orders and manage your print projects.",totalRevenue:"Total Revenue",activeOrders:"Active Orders",pendingQuotes:"Pending Quotes",customers:"Total Customers",fulfillmentRate:"Fulfillment Rate",profitMargin:"Profit Margin",recentOrders:"Recent Orders",viewAll:"View All",status:"Status",date:"Date",orderId:"Order ID",customer:"Customer",product:"Product",total:"Total",revenueTrends:"Revenue Trends",dailyPerformance:"Daily revenue performance",quickActions:"Quick Actions",newOrder:"New Order",addCustomer:"Add Customer",inventory:"Inventory",reports:"Reports",liveActivity:"Live Activity",placedOrder:"{{name}} placed a new order for {{product}}",hoursAgo:"{{count}} hours ago",orderInfo:"Order Info",noRecentOrders:"No recent orders found.",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat",sun:"Sun",jan:"Jan",feb:"Feb",mar:"Mar",apr:"Apr",may:"May",jun:"Jun",spendingTrend:"Spending Trend",orderStatus:"Order Status",completed:"Completed",inProgress:"In Progress",pending:"Pending",confirmed:"Confirmed",quality_check:"Quality Check",delivered:"Delivered",cancelled:"Cancelled",orderManagement:"Order Management",orderManagementDesc:"Track and manage all print orders in one place.",orderDetails:"Order Details",customPrint:"Custom Print",amount:"Amount",totalOrders:"Total Orders",filter:"Filter",searchPlaceholder:"Search by ID, Customer...",viewMode:"View Mode",unknown:"Unknown",actions:"Actions",inProduction:"In Production",vsLastMonth:"vs last month",newToday:"new today",actionNeeded:"action needed",totalCustomers:"Total Customers",thisWeek:"this week",placedNewOrder:"{{customer}} placed a new order for {{product}}",noActivity:"No Activity",order:"Order"},Dk={title:"Financial Management",hub:"Financial Hub",hubDesc:"Oversee all financial operations from a single hub.",loading:"Loading module...",dashboard:"Dashboard",generalLedger:"General Ledger",chartOfAccounts:"Chart of Accounts",bankRecon:"Bank Recon",financialReports:"Financial Reports",salesReports:"Sales Reports",fixedAssets:"Fixed Assets",liabilities:"Liabilities",ar:"A/R",creditNotes:"Credit Notes",ap:"A/P",purchaseOrders:"Purchase Orders",cheques:"Cheques",expenses:"Expenses",inventory:"Inventory",eInvoicing:"E-Invoicing",customers:"Customers",suppliers:"Suppliers",materials:"Materials",commission:"Commission",payrollHr:"Payroll & HR",gl_section:{hero_subtitle:"Accounting Core",hero_title:"General Ledger",hero_desc:"Complete record of all financial transactions and journal entries.",stats:{total_debits:"Total Debits",total_credits:"Total Credits",balance:"Balance",total_entries:"Total Entries"},search_placeholder:"Search entries...",all_accounts:"All Accounts",columns:{date:"Date",reference:"Reference",description:"Description",account:"Account",debit:"Debit",credit:"Credit",actions:"Actions"},export:"Export",new_entry:"New Entry",no_entries:"No entries found"},dashboard_section:{back_to_dashboard:"Back to Dashboard",total_revenue:"Total Revenue",total_expenses:"Total Expenses",net_profit:"Net Profit",outstanding_ar:"Outstanding A/R",vs_last_month:"vs last month",margin:"margin",invoices:"invoices",gl_title:"General Ledger",gl_desc:"View chart of accounts, journal entries, and trial balance.",open_ledger:"Open Ledger",sst_title:"SST Summary",sst_desc:"Sales & Service Tax (6%)",current_sst:"Current Period SST",last_month:"Last Month",ytd:"Year to Date",sst_mgmt:"SST Management",commission_title:"Commission Summary",commission_desc:"Sales and referral commissions",total_commission_mtd:"Total Commissions (MTD)",sales_agents:"Sales Agents",referral_partners:"Referral Partners",manage_commissions:"Manage Commissions",partners_title:"Partners",partners_desc:"Manage partners, capital, and distributions.",go_to_partners:"Go to Partners",materials_assets_title:"Materials & Assets",materials_assets_desc:"Manage paper, finishing options, plates, and blocks.",manage_materials:"Manage Materials",ap_title:"Accounts Payable",ap_desc:"Manage supplier bills, payments, and outstanding balances.",manage_payables:"Manage Payables",po_title:"Purchase Orders",po_desc:"Create and track procurement orders for materials.",manage_pos:"Manage POs",cheques_title:"Cheque Management",cheques_desc:"Track issued/received cheques and banking status.",manage_cheques:"Manage Cheques",expenses_title:"Expenses",expenses_desc:"Record and categorize operational expenses.",manage_expenses:"Manage Expenses",customer_accounts_title:"Customer Accounts",customer_accounts_desc:"Monitor receivables, ageing, and credit limits.",view_customers:"View Customers",financial_perf_title:"Financial Performance",financial_perf_desc:"Monthly revenue, expenses, and profit",revenue:"Revenue",expenses:"Expenses",profit:"Profit",chart_ranges:{last_6_months:"Last 6 Months",last_12_months:"Last 12 Months",ytd:"Year to Date",custom:"Custom Range"},expense_breakdown:"Expense Breakdown",materials_cogs:"Materials (COGS)",material_usage_title:"Material Usage & Waste Reports",material_usage_desc:"Track material consumption and waste metrics",material_usage_cols:{order_no:"Order #",material:"Material",qty:"Quantity Used",cost:"Cost (Est)",delivery:"Delivery Date",staff:"Staff",margin:"Profit Margin"},no_material_data:"No material data available",total_material_cost:"Total Material Cost",calculated_from_orders:"Calculated from orders",avg_profit_margin:"Average Profit Margin",across_all_orders:"Across all orders",avg_waste:"Average Waste",not_tracked:"Not tracked"},reports_section:{hero_subtitle:"Financial Intelligence",hero_title:"Financial Reports",hero_desc:"Comprehensive financial statements and performance analysis.",stats:{total_revenue:"Total Revenue",total_expenses:"Total Expenses",net_profit:"Net Profit",profit_margin:"Profit Margin"},financial_perf_title:"Financial Performance",available_reports:"Available Reports",reports:{income_statement:"Income Statement",income_statement_desc:"Real-time revenue and expenses summary",balance_sheet:"Balance Sheet",balance_sheet_desc:"Assets, liabilities, and equity overview",trial_balance:"Trial Balance",trial_balance_desc:"Debit and Credit balance check",year_end_closing:"Year-End Closing",year_end_closing_desc:"Close current fiscal year and move to Retained Earnings"},report_periods:{fy_2024:"FY 2024",current:"Current",full_ledger:"Full Ledger",action_required:"Action Required"},closing_confirm:"Are you sure you want to close the fiscal year? This will zero out all Income/Expense accounts and transfer profit to Retained Earnings (3100). This action is irreversible."},expenses_section:{hero_subtitle:"Cost Management",hero_title:"Expense Management",hero_desc:"Track business expenses and manage cost categories with AI scanning.",stats:{total_expenses:"Total Expenses",this_month:"This Month",total_records:"Total Records",categories:"Categories",lifetime:"Lifetime",monthly:"Monthly",volume:"Volume",types:"Types"},columns:{date:"Date",category:"Category",description:"Description",provider:"Provider",amount:"Amount",method:"Method",actions:"Actions"},nav:{ledger:"Ledger",categories:"Categories"},search_placeholder:"Search...",ai_scan:"AI Scan",add_expense:"Add Expense",no_expenses:"No expenses found",processing:"Processing...",view_details:"View Details"},customers_section:{hero_subtitle:"CRM",hero_title:"Customer Management",hero_desc:"Manage customer profiles, history, and balances.",stats:{total_customers:"Total Customers",total_revenue:"Total Revenue",total_orders:"Total Orders",outstanding_balance:"Outstanding Balance",active:"Active",lifetime:"Lifetime",volume:"Volume",receivable:"Receivable"},columns:{name:"Name",contact:"Contact",orders:"Orders",total_spent:"Total Spent",balance:"Balance",actions:"Actions"},search_placeholder:"Search customers by name, company, email...",add_customer:"Add Customer",no_customers:"No customers found",view_profile:"View Profile",edit:"Edit",individual:"Individual",delete_confirm:"Customer with ID {{id}} would be deleted. This functionality is for demonstration."},suppliers_section:{hero_subtitle:"Procurement",hero_title:"Supplier Management",hero_desc:"Manage supplier relationships, purchases, and payables.",stats:{total_suppliers:"Total Suppliers",total_payables:"Total Payables",total_purchases:"Total Purchases",active_partners:"Active Partners",active:"Active",outstanding:"Outstanding",lifetime:"Lifetime",operational:"Operational"},columns:{supplier:"Supplier",category:"Category",contact:"Contact",ap_balance:"A/P Balance",purchases:"Purchases",status:"Status",actions:"Actions"},search_placeholder:"Search suppliers by name, category, contact...",add_supplier:"Add Supplier",no_suppliers:"No suppliers found",supplier_portal:"Supplier Portal",pay_supplier:"Pay Supplier",manage_items:"Manage Items",edit:"Edit",active:"Active",inactive:"Inactive",id_label:"ID",no_email:"No email provided",no_phone:"No phone provided",no_address:"No address provided",total_purchases_label:"Total Purchases",balance_label:"Balance",payment_terms_label:"Payment Terms",portal_btn:"Portal",edit_btn:"Edit",pay_btn:"Pay",items_btn:"Items",delete_confirm:"Supplier with ID {{id}} would be deleted. This functionality is for demonstration.",categories:{paper:"Paper",printing_plates:"Printing Plates",finishing:"Finishing",general:"General"}},po_section:{hero_subtitle:"Procurement",hero_title:"Purchase Orders",hero_desc:"Manage supplier orders and track procurement activities.",stats:{total_po_value:"Total PO Value",pending_approval:"Pending Approval",approved:"Approved",received:"Received",active:"Active",orders:"Orders",completed:"Completed"},columns:{po_number:"PO Number",supplier:"Supplier",total:"Total",date:"Date",status:"Status",actions:"Actions"},search_placeholder:"Search by PO # or supplier...",generate_po:"Generate PO",no_pos:"No Purchase Orders Found",due:"Due",ordered:"Ordered",approve:"Approve",reject:"Reject",view:"View",download:"Download",pdf:"PDF",details:"Details",statuses:{draft:"Draft",pending_approval:"Pending Approval",approved:"Approved",sent:"Sent",partially_received:"Partially Received",fully_received:"Fully Received",cancelled:"Cancelled",rejected:"Rejected"},export:{brand:"PIONEER CETAK",title:"PURCHASE ORDER",from:"From",supplier_label:"Supplier",order_date:"Date",exp_delivery:"Exp. Delivery",total_value:"TOTAL ORDER VALUE",notes:"Notes",cols:{item:"Item",desc:"Description",qty:"Qty",price:"Unit Price",total:"Total"}}},cheques_section:{hero_subtitle:"Payment Instruments",hero_title:"Cheque Management",hero_desc:"Track and manage receivable and payable cheques with AI scanning.",stats:{receivable:"Receivable",payable:"Payable",pending:"Pending",cleared:"Cleared",inflow:"Inflow",outflow:"Outflow",processing:"Processing",completed:"Completed"},reminders:{to_deposit:"Cheques to Deposit",to_fund:"Cheques to Fund",records:"Records",clear_7_days:"Clear for next 7 days"},tabs:{receivables:"Receivables",payables:"Payables"},columns:{cheque_number:"Cheque #",party_name:"Party Name",bank:"Bank",amount:"Amount",due_date:"Due Date",status:"Status",actions:"Actions"},search_placeholder:"Search...",ai_scan:"AI Scan",new_cheque:"New Cheque",no_cheques:"No cheques found",settle:"Settle",bounce:"Bounce",logs:"Logs",processing_label:"Processing...",statuses:{pending:"Pending",cleared:"Cleared",bounced:"Bounced"},bounce_prompt:"Please enter a reason for the bounced instrument (e.g. NSF, Account Closed):",no_reason:"No reason provided."},accounts_payable:{hero_subtitle:"Payment Management",hero_title:"Accounts Payable",hero_desc:"Track bills and manage vendor payments efficiently.",stats:{total_payable:"Total Payable",pending:"Pending",overdue:"Overdue",paid:"Paid"},columns:{bill_number:"Bill #",supplier:"Supplier",amount:"Amount",due_date:"Due Date",status:"Status",actions:"Actions"},search_placeholder:"Search bills...",all_statuses:"All Status",no_payables:"No payables found",statuses:{paid:"Paid",pending:"Pending",overdue:"Overdue"}},accounts_receivable:{hero_subtitle:"Cash Flow Management",hero_title:"Accounts Receivable",hero_desc:"Monitor outstanding invoices and track incoming payments.",stats:{total_receivable:"Total Receivable",pending:"Pending",overdue:"Overdue",collected:"Collected"},columns:{invoice_number:"Invoice #",customer:"Customer",amount:"Total Amount",due_date:"Due Date",status:"Status",action:"Action",actions:"Actions"},search_placeholder:"Search invoices...",all_statuses:"All Status",no_receivables:"No receivables found",statuses:{paid:"Paid",pending:"Pending",overdue:"Overdue"}},fixed_assets:{hero_subtitle:"Asset Management",hero_title:"Fixed Assets",hero_desc:"Track and manage company assets, depreciation, and valuations.",stats:{total_asset_value:"Total Asset Value",total_depreciation:"Total Depreciation",total_assets:"Total Assets",avg_asset_value:"Avg Asset Value",items:"Items",per_asset:"Per Asset"},columns:{asset_name:"Asset Name",category:"Category",purchase_date:"Purchase Date",purchase_price:"Purchase Price",current_value:"Current Value",depreciation:"Depreciation",actions:"Actions"},categories:{all:"All Categories",machinery:"Machinery",vehicles:"Vehicles",property:"Property",equipment:"Equipment"},search_placeholder:"Search assets...",add_asset:"Add Asset",no_assets:"No assets found",view:"View",edit:"Edit",delete:"Delete"},liabilities_section:{hero_title:"Liabilities",hero_subtitle:"Financial Monitoring",hero_desc:"Monitor and manage loans, leases, and outstanding obligations.",stats:{total_liabilities:"Total Liabilities",short_term:"Short-Term",long_term:"Long-Term",active_items:"Active Items",current_balance:"Current Balance",payable_soon:"Payable Soon",long_term_debts:"Long-Term Debts",active_loans:"Active Loans"},search_placeholder:"Search liabilities...",add_liability:"Add Liability",no_liabilities:"No liabilities found.",columns:{liability_name:"Liability Name",type:"Type",remaining_balance:"Remaining Balance",issue_date:"Issue Date",status:"Status",actions:"Actions"},types:{all:"All Types","short-term":"Short-Term",long_term:"Long-Term"},statuses:{active:"Active",paid:"Paid",overdue:"Overdue"},view:"View",edit:"Edit",delete:"Delete"},e_invoice_section:{hero_subtitle:"Tax Compliance",hero_title:"E-Invoice",hero_desc:"LHDN e-invoicing compliance and submission tracking.",stats:{validated:"Validated",rejected:"Rejected",submitted:"Submitted",queue:"Queue",compliant:"Compliant",action_req:"Action Req",pending:"Pending",to_send:"To Send"},registry:{title:"Transmission Registry",subtitle:"Real-time status tracking system",search_placeholder:"Filter by invoice ID or client name...",no_transmissions:"No transmissions found matching the current filters"},columns:{registry_id:"Registry ID",entity:"Entity",commitment:"Commitment",protocol_state:"Protocol State",actions:"Actions",portal_status:"Portal status"},statuses:{validated:"Validated",rejected:"Rejected",submitted:"Submitted",draft:"Draft"},inspect:"Inspect"},credit_notes_section:{hero_subtitle:"Customer Refunds",hero_title:"Credit Notes",hero_desc:"Issue and manage customer credit notes and refunds.",stats:{total_value:"Total Credit Value",issued:"Issued",applied:"Applied",draft:"Draft",count:"Count",utilized:"Utilized",pending:"Pending"},columns:{cn_number:"Credit Note #",customer:"Customer",ref_invoice:"Ref Invoice",amount:"Amount",date:"Date",status:"Status",actions:"Actions"},statuses:{draft:"Draft",issued:"Issued",applied:"Applied",voided:"Voided"},search_placeholder:"Search credit notes...",all_statuses:"All Status",issue_cn:"Issue Credit Note",no_cn:"No credit notes found",view:"View",download:"Download",pdf:{title:"CREDIT NOTE",beneficiary:"Beneficiary",date:"Date",ref_invoice:"Ref Invoice",description:"Description",qty:"Qty",unit_price:"Unit Price",total:"Total",total_credit:"TOTAL CREDIT",reason:"Reason"}},bank_reconciliation:{hero_subtitle:"Bank Reconciliation",hero_title:"Reconcile Accounts",hero_desc:"Match bank transactions with your ledger entries automatically.",import_statement:"Import Statement",import_coming_soon:"Import Statement feature is coming soon.",search_placeholder:"Search bank transactions...",all_status:"All Status",no_transactions:"No bank transactions found.",match:"Match",view_details:"View Details",stats:{total_credits:"Total Credits",total_debits:"Total Debits",matched:"Matched",unmatched:"Unmatched",transactions:"Transactions",action_req:"Action Req."},columns:{date:"Date",description:"Description",type:"Type",amount:"Amount",status:"Status",actions:"Actions"},types:{credit:"Credit",debit:"Debit"},statuses:{matched:"Matched",unmatched:"Unmatched"}},sales_reports:{hero_subtitle:"Business Intelligence",hero_title:"Sales Reports",hero_desc:"Analyze sales performance and identify growth opportunities.",stats:{total_revenue:"Total Revenue",total_orders:"Total Orders",active_customers:"Active Customers",avg_order_value:"Avg Order Value"},charts:{sales_trend_title:"Monthly Sales Trend",top_products_title:"Top Products",sales_label:"Sales",orders_label:"Orders"},products:{business_cards:"Business Cards",brochures:"Brochures",flyers:"Flyers",posters:"Posters",other:"Other"},months:{jan:"Jan",feb:"Feb",mar:"Mar",apr:"Apr",may:"May",jun:"Jun",jul:"Jul",aug:"Aug",sep:"Sep",oct:"Oct",nov:"Nov",dec:"Dec"},months_full:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"}},account_types:{asset:"Asset",liability:"Liability",equity:"Equity",revenue:"Revenue",expense:"Expense"},payment_methods:{cash:"Cash",bank_transfer:"Bank Transfer",card:"Card",credit:"Credit",cheque:"Cheque"},supplier_categories:{general:"General",paper:"Paper",printing_plates:"Printing Plates",finishing:"Finishing",printing:"Printing"},action_labels:{edit_expense:"Edit Expense",delete_expense:"Delete Expense"},year_end:{income_statement:"Annual Income Statement",ended_on:"For the Year Ended December 31, {{year}}",revenue:"Revenue",sales_revenue:"Sales Revenue",total_revenue:"Total Revenue",expenses:"Expenses",total_expenses:"Total Expenses",net_income:"Net Income",assets:"ASSETS",current_assets:"Current Assets",cash_equivalents:"Cash and Cash Equivalents",ar:"Accounts Receivable",inventory:"Inventory",total_current_assets:"Total Current Assets",non_current_assets:"Non-Current Assets",ppe:"Property, Plant and Equipment",total_non_current_assets:"Total Non-Current Assets",total_assets:"Total Assets",liabilities:"LIABILITIES",current_liabilities:"Current Liabilities",ap:"Accounts Payable",short_term_loans:"Short-term Loans",total_current_liabilities:"Total Current Liabilities",non_current_liabilities:"Non-Current Liabilities",long_term_loans:"Long-term Loans",total_non_current_liabilities:"Total Non-Current Liabilities",total_liabilities:"Total Liabilities",equity:"EQUITY",owner_equity:"Owner's Equity",retained_earnings:"Retained Earnings",total_equity:"Total Equity",total_liabilities_equity:"Total Liabilities and Equity",as_of:"As of {{date}}",cash_flow:"Statement of Cash Flows",operating_activities:"Cash Flows from Operating Activities",cash_from_customers:"Cash Received from Customers",cash_to_suppliers:"Cash Paid to Suppliers",cash_to_operating:"Cash Paid for Operating Expenses",net_operating:"Net Cash from Operating Activities",investing_activities:"Cash Flows from Investing Activities",purchase_equipment:"Purchase of Equipment",net_investing:"Net Cash used in Investing Activities",financing_activities:"Cash Flows from Financing Activities",proceeds_loans:"Proceeds from Loans",repayment_loans:"Repayment of Loans",net_financing:"Net Cash from Financing Activities",net_increase_cash:"Net Increase in Cash",cash_beginning:"Cash at Beginning of Year",cash_end:"Cash at End of Year",ledger_summary:"General Ledger Summary",description:"Description",debit_rm:"Debit (RM)",credit_rm:"Credit (RM)",tax_summary:"Annual Tax Summary",sst_summary:"SST Summary",total_sales:"Total Sales (Taxable)",total_sst:"Total SST Collected",corporate_tax_summary:"Corporate Tax Summary",taxable_income:"Taxable Income",tax_rate:"Effective Tax Rate",est_tax:"Estimated Tax Payable",payment_schedule:"Payment Schedule",sst_payments:"SST Payments",tax_installments:"Tax Installments (CP204)",compliance_notes:"Tax Compliance Notes",compliance_1:"1. Ensure all SST returns (SST-02) are filed.",compliance_2:"2. Maintain records for at least 7 years.",compliance_3:"3. Verify CPF/SOCSO contributions match records.",valuation_report:"Inventory Valuation Report",paper_inventory:"Paper Inventory",item:"Item",quantity:"Quantity",unit_price:"Unit Price",total_value:"Total Value",material_inventory:"Material Inventory",total_inventory_value:"Total Inventory Value",balance_sheet:"Balance sheet",inventory_summary:"Inventory summary",material_inventory_value:"Material inventory value",paper_inventory_value:"Paper inventory value"}},Tk={common:{cancel:"Cancel",discard:"Discard",save:"Save Changes",error:"An error occurred. Please try again.",close:"Close",save_changes:"Save changes"},credit_note_form:{title_add:"Issue Credit Note",subtitle:"Process rebates or returns for customer invoices",customer:"Select Customer",date:"Note Date",original_invoice:"Reference Invoice",select_invoice:"Select invoice to credit...",items_services:"Credit Items / Services",add_item:"Add Manual Item",reason_notes:"Reason / Internal Notes",reason_placeholder:"Explain why this credit is being issued...",total_credit:"Total Credit Amount",discard:"Discard",commit:"Commit Credit Note",confirm:"Confirm",description:"Description",error_customer:"Error customer",price:"Price",qty:"Qty",select_customer:"Select customer",title_edit:"Title edit"},supplier_portal:{title:"Supplier Collaboration Portal",summary:"Job Summary",work_queue:"Work Queue",history:"History",registry:"Registry",all_jobs:"All Jobs",completed:"Completed Items",open_jobs:"Open Jobs",estimated_delivery:"Est. Delivery",price_agreed:"Agreed Price",unit:"Unit",view_reference:"View Documents",start_job:"Start Job",receive:"Acknowledge Receipt",complete_job:"Mark as Finished",syncing:"Syncing...",no_inventory:"No inventory recorded",inventory_alert:"Stock Alert",queue_size:"Queue size",yield_value:"Yield Value",abort_access:"Abort access",all_synced:"All synced",auth_required:"Auth required",balance:"Balance",close_portal:"Close portal",complete:"Complete",credit:"Credit",critical_tasks:"Critical tasks",date:"Date",debit:"Debit",export:"Export",financial_ledger:"Financial ledger",gateway_login:"Gateway login",inspect_order:"Inspect order",narrative:"Narrative",net_payables:"Net payables",no_history:"No history",no_tasks:"No tasks",node_synced:"Node synced",outstanding:"Outstanding",payments:"Payments",purchases:"Purchases"},journal:{title:"New Journal Entry",subtitle:"Record manual financial transactions across ledgers",effective_date:"Effective Date",general_description:"General Description",narrative_placeholder:"e.g., Monthly office rental payment...",entry_lines:"Entry Lines",add_segment:"Add Segment",account:"Account",description:"Line Description",line_placeholder:"Line details...",debit_rm:"Debit (RM)",credit_rm:"Credit (RM)",actions:"Actions",select_account:"Select Account...",debits:"Total Debits",credits:"Total Credits",balanced:"Ledger Balanced",imbalance:"Out of Balance",commit:"Commit Entry",discard:"Discard Entry",min_lines_error:"A journal entry must have at least two balanced lines."},expense_form:{title_add:"Record Expense",title_edit:"Modify Expense",subtitle:"Track operational costs and overheads",date:"Date",category:"Expense Category",description:"Narrative / Description",amount:"Total Amount (RM)",supplier:"Source Vendor / Supplier",direct_expense:"Direct Expense (No Supplier)",payment_method:"Payment Settlement",ref_number:"Reference / Invoice #",optional:"(Optional)",cheque_details:"Cheque Document Audit",cheque_number:"Cheque Number",bank_name:"Issuing Bank",maturity_date:"Maturity Date",discard:"Discard Entry",save_changes:"Update Record",save_btn:"Record Expense",error_cheque:"Please complete all cheque audit fields."},expense_detail:{title:"Expense Voucher",print_voucher:"Print Voucher",edit_entry:"Edit Entry",delete_entry:"Delete Entry",transaction_value:"Transaction Value",recorded_date:"Recorded Date",classification:"Classification",provider:"Provider",general_disbursement:"General Disbursement",invoice_ref:"Invoice Reference",none:"None",settlement_protocol:"Settlement Protocol",close_registry:"Close Registry"},supplier_categories:{paper:{label:"Paper",desc:"Paper stocks, art card, raw media"},printing:{label:"Printing",desc:"Digital / Offset printing services"},finishing:{label:"Finishing",desc:"Lamination, UV, embossing, die-cut"},printing_plates:{label:"Plates",desc:"CTP / polymer printing plates"},general:{label:"Ink / Consumables",desc:"Inks, toner, adhesives, chemicals"}},supplier_form:{title_add:"Onboard New Supplier",title_edit:"Edit Supplier Profile",subtitle:"Manage procurement relationships and credit terms",info_section:"Identity & Contact",company_name:"Company Name",contact_person:"Contact Person",phone:"Direct Phone",email:"Business Email",address:"Office/Warehouse Address",payment_section:"Financial & Credit",tin:"TIN / Tax Number",category:"Primary Supply Category",credit_term:"Standard Credit Term",portal_section:"Digital Integration",username:"Portal Username/Email",password:"Temporary Password",save_btn:"Save Supplier",delete_confirm:"Permanently remove this supplier? This will not affect historical records.",warning:"Modifying financial terms may affect future automated reconciliations.",errors:{name:"Supplier name is required",contact:"Contact person is required",email:"Invalid email format",username:"Username is required for portal access",password:"Password is required for portal access"}},purchase_order_form:{title_add:"Generate Purchase Order",title_edit:"Modify Purchase Order",subtitle:"Procurement request for raw materials and services",supplier:"Source Supplier",select_supplier:"Choose a supplier...",order_date:"Order Date",expected_delivery:"Expected Delivery",order_items:"Order Items & Bill of Materials",add_item:"Add Item",item_name:"Item Name",item_desc:"Specification",item_qty:"Qty",item_price:"Unit (RM)",notes:"Internal Notes / Remarks",notes_placeholder:"Special instructions for the supplier...",subtotal:"Subtotal",total_order:"Total PO Value",confirm:"Confirm & Generate PO",error_supplier:"Please select a valid supplier."},year_end_close:{title:"Year-End Fiscal Closing",desc:"Consolidate all ledgers and initialize the new fiscal cycle",reports_title:"Select Reports to Generate",fiscal_info_title:"Fiscal Cycle Configuration",current_year:"Closing Period",new_year:"Initialization Period",closing_date:"Ledger Cutoff Date",start_date:"New Cycle Commencement",warning_title:"Irreversible Operation",warning_desc:"Closing the fiscal year will zero out all income and expense accounts. Ensure all audits are complete.",generate_btn:"Execute Closing Ceremony",processing_title:"Archiving Fiscal Year",processing_desc:"Synthesizing millions of data points into audited statements...",gen_reports:"Generating PDF Audit Pack",verify_balances:"Verifying Trial Balance Integrity",closing_ledgers:"Locking Journal Entries",finalizing:"Commencing New Fiscal Cycle",complete_title:"Fiscal Cycle Closed",complete_desc:"FY {{year}} has been successfully archived. Balances moved to Retained Earnings.",generated_reports_label:"Your Audited Report Pack",close_btn:"Return to Dashboard",income_statement:"Income Statement",balance_sheet:"Balance Sheet",cash_flow:"Cash Flow",general_ledger:"General Ledger",tax_summary:"Tax Summary",inventory_valuation:"Inventory Valuation",income_statement_desc:"Summarized revenue and overheads",balance_sheet_desc:"Snaphot of assets and liabilities",cash_flow_desc:"Inflow and outflow audit",general_ledger_desc:"Full transaction record",tax_summary_desc:"SST and corporate tax prep",inventory_valuation_desc:"Stock asset valuation report"},cheque_logs:{title:"Instrument Lifecycle",subtitle:"Audit trail for Cheque #{{id}}",issued:"Issued",mature:"Mature",current_status:"Current Status",no_notes:"No specific narrative recorded.",registry_created:"Registry Created",initial_entry:"Initial entry into system on",close:"Close Audit"},scan_cheque:{title:"AI Cheque Harvesting",actions:{library_upload:"Upload Document",capture_now:"Camera Capture",processing:"AI Synthesizing...",recapture:"Discard & Retry",confirm:"Verify & Register"},verify_details:"Verification Gateway",review_extractions:"Validate AI metadata extraction",labels:{type:"Instrument Nature",link_account:"Ledger Account",choose_entity:"Select Entity...",bank:"Issuing Institution",value:"Instrument Value (RM)",date:"Issue Date",maturity:"Deposit Date"},types:{receivable:"Inbound (Customer)",payable:"Outbound (Supplier)"},document_source:"Original Document Link"},account_detail:{credit:"Credit",date:"Date",debit:"Debit",description:"Description",done_btn:"Done btn",download_csv:"Download csv",ending_position:"Ending position",gl_code:"Gl code",initial_ref:"Initial ref",no_history:"No history",opening_balance:"Opening balance",print_statement:"Print statement",ref:"Ref",running_balance:"Running balance"},account_form:{code:"Code",desc:"Desc",name:"Name",none_root:"None root",parent:"Parent",save_btn:"Save btn",subtitle:"Subtitle",title_add:"Title add",title_edit:"Title edit",type:"Type"},addCustomer:{fields:{address:"Address",company:"Company",email:"Email",name:"Name",phone:"Phone",portalEmail:"Portal Email",portalPassword:"Portal Password",tin:"Tin"},portalAccess:"Portal Access",subtitle:"Subtitle",title:"Title"},asset_form:{amortization:"Amortization",commit:"Commit",cost:"Cost",date:"Date",discard:"Discard",life:"Life",main_specs:"Main specs",method:"Method",name:"Name",none:"None",salvage:"Salvage",straight_line:"Straight line",subtitle:"Subtitle",title_add:"Title add",title_edit:"Title edit"},cheque_form:{audit_notes:"Audit notes",bank:"Bank",beneficiary:"Beneficiary",direction:"Direction",discard:"Discard",error_party:"Error party",face_value:"Face value",issue_date:"Issue date",issuer:"Issuer",maturity_date:"Maturity date",number:"Number",payable:"Payable",receivable:"Receivable",save_btn:"Save btn",select_acc:"Select acc",subtitle:"Subtitle",title_add:"Title add",title_edit:"Title edit"},customer_note:{by_user:"By user",empty_error:"Empty error",for:"For",history:"History",new_note:"New note",no_notes:"No notes",placeholder:"Placeholder",rescheduled_date:"Rescheduled date",save_note:"Save note",status:"Status",status_options:{disputed:"Disputed",overdue:"Overdue",paid_pending_verification:"Paid pending verification",promised_to_pay:"Promised to pay",rescheduled:"Rescheduled"},title:"Title"},editCustomer:{subtitle:"Subtitle",title:"Title"},expense_categories:{add_btn:"Add btn",delete_confirm:"Delete confirm",delete_used_confirm:"Delete used confirm",done_btn:"Done btn",new_placeholder:"New placeholder",title:"Title"},liability:{amortization:"Amortization",apr:"Apr",classification:"Classification",core_info:"Core info",edit:"Edit",interest:"Interest",lender:"Lender",lender_placeholder:"Lender placeholder",long_term:"Long term",months:"Months",name:"Name",name_placeholder:"Name placeholder",principal:"Principal",record:"Record",save_obligation:"Save obligation",short_term:"Short term",subtitle:"Subtitle",term:"Term"},manage_supplier_items:{cost_price:"Cost price",estimated_time:"Estimated time",finishing_options:"Finishing options",in_stock:"In stock",paper_stock:"Paper stock",save_success:"Save success",sell_price:"Sell price",subtitle:"Subtitle",title:"Title"},payment_form:{amount:"Amount",date:"Date",method:"Method",ref_placeholder:"Ref placeholder",reference:"Reference",save_btn:"Save btn",title_edit:"Title edit"},payment_processor:{bank_name:"Bank name",bank_transfer:"Bank transfer",card:"Card",cash:"Cash",cheque:"Cheque",cheque_details:"Cheque details",cheque_details_error:"Cheque details error",cheque_number:"Cheque number",convert_title:"Convert title",custom_amount:"Custom amount",custom_amount_desc:"Custom amount desc",custom_amount_label:"Custom amount label",customer:"Customer",date:"Date",deposit:"Deposit",deposit_desc:"Deposit desc",due_date:"Due date",full_payment:"Full payment",full_payment_desc:"Full payment desc",invoice_paid:"Invoice paid",invoice_paid_desc:"Invoice paid desc",item:"Item",max_payable:"Max payable",no_file:"No file",number:"Number",order_details:"Order details",pay_remaining:"Pay remaining",payment_method:"Payment method",payment_summary:"Payment summary",payment_type:"Payment type",per_unit:"Per unit",pieces:"Pieces",process_title:"Process title",processing:"Processing",select_file:"Select file",select_quantity:"Select quantity",summary_cheque:"Summary cheque",summary_method:"Summary method",summary_proof:"Summary proof",summary_total:"Summary total",summary_type:"Summary type",upload_proof:"Upload proof"},scan_invoice:{ai_confidence:"Ai confidence",capture_now:"Capture now",classification:"Classification",date:"Date",description:"Description",error_extract:"Error extract",error_required:"Error required",invoice_num:"Invoice num",library_upload:"Library upload",matched:"Matched",merchant:"Merchant",no_image:"No image",processing:"Processing",recapture:"Recapture",save:"Save",source:"Source",subtitle:"Subtitle",success:"Success",title:"Title",upload_desc:"Upload desc",upload_title:"Upload title",value:"Value",verify_subtitle:"Verify subtitle",verify_title:"Verify title"}},Ak={title:"Inventory",materialLibrary:"Material Library",stockManagement:"Stock Management",stockManagementDesc:"Centralized stock monitoring and supply chain management.",catalogItems:"Catalog Items",lowStockAlerts:"Low Stock Alerts",stockAssetValue:"Stock Asset Value",stockOverview:"Stock Overview",warehouses:"Warehouses",stockTransfers:"Stock Transfers",history:"History",newTransfer:"New Transfer",recentTransfers:"Recent Transfers",allGood:"All Good",items:"Items",paper:"Paper",sheets:"sheets",itemDetails:"Item Details",inStock:"In Stock",minLevel:"Min Level",status:"Status",actions:"Actions",adjust:"Adjust",paperStock:"Paper Stock",consumable:"Consumables",low:"Low",good:"Good",totalItems:"Total Items",stockValueEst:"Stock Asset Value",searchPlaceholder:"Search inventory...",allStages:"All Stages",clearFilters:"Clear Filters",allTypes:"All Types",addItem:"Add Item",addWarehouse:"Add Warehouse",default:"Default",code:"Code",edit:"Edit",setAsDefault:"Set as Default",dateTime:"Date & Time",type:"Type",material:"Material",quantity:"Quantity",cost:"Cost",location:"Location",user:"User",purchase:"Purchase",usage:"Usage",transfer:"Transfer",noTransactions:"No stock transactions found.",catalog:{title:"Material Library",subtitle:"Catalog",description:"Explore our wide range of substrates, specialized finishing options, and printing machinery.",search:"Search materials...",paper:"Paper",finishing:"Finishing",printing:"Printing",paperTypes:"Paper Types",finishingOptions:"Finishing Options",printingMethods:"Printing Methods",plates:"Plates",blocks:"Blocks"},materials:"Materials",general:"General"},kk={title:"Partners Management",equityDistributions:"Equity & Distributions",equityDistributionsDesc:"Oversee partner equity, contributions, and distributions.",capitalVsDistributions:"Capital vs Distributions",addPartner:"Add Partner",addNew:"Add New",noPartners:"No partners found",noTransactions:"No transactions found",totalCapital:"Total Capital",totalDistributions:"Total Distributions",netPartnerEquity:"Net Partner Equity",invested:"Invested",paidOut:"Paid Out",retained:"Retained",ownership:"Ownership",netEquity:"Net Equity",partner:"Partner",type:"Type",date:"Date",amount:"Amount",notes:"Notes",dashboard:"Dashboard",partners:"Partners",contributions:"Contributions",distributions:"Distributions",types:{founder:"Founder",investor:"Investor",strategic:"Strategic"},editPartner:"Edit Partner",addNewPartner:"Add New Partner",profilePhoto:"Profile Photo",uploadImage:"Upload Image",fullName:"Full Name",emailAddress:"Email Address",phoneNumber:"Phone Number",partnerType:"Partner Type",ownershipPercentage:"Ownership %",joinDate:"Join Date",transferOwnershipFrom:"Transfer Ownership From",totalContribution:"Total Contribution",totalDistribution:"Total Distribution",phone:"Phone",close:"Close",saveChanges:"Save Changes",joined:"Joined",errorNoTransfer:"You must transfer some ownership from existing partners.",errorIncompleteOwnership:"Current total ownership is {{current}}%, not 100%. Cannot add new partner until this is corrected.",errorIncompleteOwnershipShort:"Total ownership ({{current}}%) must be 100%."},Pk={roles:{addRole:"Add New Role",editRole:"Edit Role",roleName:"Role Name",description:"Description",permissions:"Permissions",cancel:"Cancel",saveRole:"Save Role"},settings:{title:"Administration",subtitle:"System Settings",description:"Manage global settings, users, and system configurations.",userManagement:"User Management",userManagementDesc:"Manage staff accounts and access.",rolesPermissions:"Roles & Permissions",rolesPermissionsDesc:"Configure role-based access control.",adminPower:"Admin Power Settings",adminPowerDesc:"System-wide administrative overrides.",companyInformation:"Company Information",companyInformationDesc:"Business details and branding.",themeBranding:"Theme & Branding",themeBrandingDesc:"Customize the look and feel.",financialSettings:"Financial Settings",financialSettingsDesc:"Configure taxes, currencies, and accounting.",aiChatbot:"AI Assistant",aiChatbotDesc:"Configure the intelligent assistant.",productionSettings:"Production Setup",productionSettingsDesc:"Manage machines, materials, and workflow.",hrPayroll:"HR & Payroll",hrPayrollDesc:"Employee records and salary.",documentDesigner:"Document Designer",documentDesignerDesc:"Customize invoice and PO templates.",auditTrail:"Audit Trail",auditTrailDesc:"Track system activity and changes.",integrations:"Integrations",integrationsDesc:"Connect third-party services.",deliveryManagement:"Delivery Management",deliveryManagementDesc:"Configure delivery methods and fleets.",back:"Back to Settings",loading:"Loading module..."}},Ik={machineTracker:{setup:"Machine Setup",startSetup:"Start Setup",endSetup:"End Setup",startRun:"Start Production Run",endRun:"End Production Run",downtime:"Downtime Registry",startDowntime:"Log Downtime",endDowntime:"Resolve Downtime",activeMachines:"Active Machines",assignJob:"Assign Job",cancel:"Cancel",description:"Description",failedToStart:"Failed To Start",failedToStop:"Failed To Stop",idle:"Idle",job:"Job",running:"Running",selectJob:"Select Job",title:"Title",unknownOperator:"Unknown Operator"},layoutPlanner:{artwork:"Artwork",bestFit:"Best",bleedGutter:"Bleed & Gutter ({{unit}})",comparisonTitle:"Paper Size Comparison",custom:"Custom",description:"Calculate optimal artwork imposition layouts with real-time visualization.",dimensions:"{{w}} × {{h}} mm",dropOrClick:"Drop image or click to browse",efficiency:"Efficiency",enterParameters:"Enter artwork and paper dimensions to begin",exportAsPng:"Export PNG",exportLayout:"Export Layout",gridConfig:"Grid",gripArea:"GRIP",height:"Height",landscape:"Landscape",matrixTitle:"Imposition Matrix",noResults:"No valid layout found for these dimensions",orientation:"Orientation",paperStock:"Paper Stock",parentSheet:"Parent Sheet",parentSize:"Parent Size",portrait:"Portrait",pressSheet:"Press Sheet",pressSheetBounds:"Dashed lines show press sheet capacity bounds",readyToCalculate:"Ready to Calculate",resetZoom:"Reset",sheetMargins:"Sheet Margins ({{unit}})",size:"Size",source:"Source",standard:"Standard",subtitle:"Optimised Imposition",title:"Layout Intelligence",totalYield:"Yield",uploadArtwork:"Artwork Preview",ups:"UP",wastePercent:"Waste",width:"Width",zoomIn:"Zoom In",zoomOut:"Zoom Out"},production:{active:"Active",activeProduction:"Active Production",dailyOutput:"Daily Output",description:"Production Status",equipmentUptime:"Equipment Uptime",noActiveOrders:"No Active Orders",onTimeDelivery:"On Time Delivery",qualityScore:"Quality Score",subtitle:"Operations Tracking",systemOperational:"System Operational",systemStatus:"System Status",tasks:"Tasks",teamPerformance:"Team Performance",title:"Production Overview"},qualityControl:{allStatus:"All Status",avgTime:"Avg Time",checksToday:"Checks Today",defectAnalysis:"Defect Analysis",defects:"Defects",description:"Description",detailedDefectAnalysis:"Detailed Defect Analysis",export:"Export",failed:"Failed",inProgress:"In Progress",inspections:"Inspections",inspector:"Inspector",minimumScore:"Minimum Score",newCheck:"New Check",newStandard:"New Standard",noDefectsRecorded:"No Defects Recorded",noInspectionsFound:"No Inspections Found",order:"Order",passRate:"Pass Rate",passed:"Passed",pending:"Pending",qualityScore:"Quality Score",qualityStandards:"Quality Standards",qualityTrends:"Quality Trends",requiresRework:"Requires Rework",score:"Score",searchInspections:"Search Inspections",standards:"Standards",status:"Status",subtitle:"Subtitle",summary:"Summary",title:"Title",tryAdjustingFilters:"Try Adjusting Filters",type:"Type"}},Rk={dashboard:{totalSpent:"Total Spent",recentOrders:"Recent Orders",viewAll:"View All history",orderInfo:"Order info",portal:"Customer Portal",projectInfo:"Track your orders, quotes, and billing.",confirmReorder:"Confirm Reorder"}},Mk={selectCustomer:"Select Customer",chooseClient:"Choose a client for this order",searchPlaceholder:"Search by name, email, phone...",walkInCustomer:"Walk-in / Cash Customer",walkInSubtitle:"Quick select for walk-in clients",selectedCustomer:"Selected Customer",machineRouting:"Machine Routing",routing:"Routing",customerAndCommission:"Customer & Commission",jobDetails:"Job Specifications",paperSelection:"Paper & Stock",printingMethod:"Printing & Ink",finishingOptions:"Finishing",configureFinishing:"Setup",reviewSubmit:"Final Review",customerJob:"Customer & Job",commission:"Commission",commissionPlaceholder:"Sales agent commission...",pricing:{adjustments:"Pricing Adjustments",addAnother:"Add Another",applyDiscount:"Apply Discount",applyExtraCharge:"Apply Extra Charge",discount:"Discount",extraCharge:"Extra Charge",price:"Price",quantity:"Quantity",sst:"Sst",subtotal:"Subtotal",totalAmount:"Total Amount"},specifications:{artworkSize:"Artwork Finished Size",customDimensions:"Custom Dimensions",height:"Height",methodType:"Method Type",paperCost:"Paper Cost",selectSize:"Select Size",selectThickness:"Select Thickness",selectType:"Select Type",sheetSize:"Sheet Size",standardSize:"Standard Size",thickness:"Thickness",width:"Width"},invoice:{quotationTitle:"OFFICIAL QUOTATION",amount:"Amount",currency:"Currency",email:"Email",expeditedSurcharge:"Expedited Surcharge",finishingService:"Finishing Service",issuedOn:"Issued On",netPayable:"Net Payable",notRegistered:"Not Registered",officialInvoice:"Official Invoice",particulars:"Particulars",promotionDisc:"Promotion Disc",recipientBilling:"Recipient Billing",ref:"Ref",status:{draft:"Draft",overdue:"Overdue",paid:"Paid",pending:"Pending"},statusLabel:"Status Label",subtotal:"Subtotal",taxId:"Tax Id",taxLevy:"Tax Levy",tel:"Tel",totalValuation:"Total Valuation",unitRate:"Unit Rate",untitledProject:"Untitled Project",validUntil:"Valid Until",volume:"Volume",watermark:"Watermark"},invoicePreview:{billTo:"Bill To",liveInvoice:"Live Invoice Preview",description:"Description",grandTotal:"Grand Total",included:"Included",issueDate:"Issue Date",title:"Official Document Preview",total:"Total"},wizard:{review:{plates:"Plates Required",customer:"Customer",customerJob:"Customer Job",edit:"Edit",finishing:"Finishing",guestInfo:"Guest Info",headerSub:"Step Summary",headerTitle:"Final Review",jobTitle:"Job Title",machine:"Machine",noFinishing:"No Finishing",noSelected:"No Selected",noteLabel:"Note Label",noteText:"Note Text",paper:"Paper",pricing:"Pricing",printing:"Printing",quantities:"Quantities",size:"Size",thickness:"Thickness",type:"Type",untitled:"Untitled",walkinCustomer:"Walkin Customer"},customer:{addCommission:"Add Commission",addNewCommission:"Add New Commission",change:"Change",commission:"Commission",contactNum:"Contact Num",emailLabel:"Email Label",emailPlaceholder:"Email Placeholder",guestName:"Guest Name",guestNamePlaceholder:"Guest Name Placeholder",hide:"Hide",jobDesc:"Briefly describe the job requirements",jobPlaceholder:"Briefcase, Project X, etc.",jobTitle:"Job Title",optional:"Optional",phonePlaceholder:"Phone Placeholder",registered:"Registered",registeredTip:"Registered Tip",selectCommission:"Select Sales Agent",selectDesc:"Selection a registered client from your database",selectLabel:"Choose Client",subtitle:"Customer & Job Info",tip:"Tip",title:"Project Initiation",walkin:"Walkin",walkinTip:"Walkin Tip"},finishing:{blockHeight:"Block Height",blockRequired:"Block Required",blockWidth:"Block Width",clearAll:"Clear All",configureSubtitle:"Configure Subtitle",configureTitle:"Configure Title",empty:"Empty",emptyPick:"Empty Pick",externalProvider:"External Provider",grid:"Grid",heightCm:"Height Cm",inhouse:"Inhouse",list:"List",new:"New",noMatch:"No Match",noOptions:"No Options",optionsLabel:"Options Label",processTotal:"Process Total",provider:"Provider",quickSelect:"Quick Select",resetAuto:"Reset Auto",reuse:"Reuse",searchPlaceholder:"Search Placeholder",selectedCount:"Selected Count",selectedOptions:"Selected Options",specifyArea:"Specify Area",subtitle:"Add-On Services",tip:"Tip",tipText:"Tip Text",title:"Custom Finishing",totalCost:"Total Cost",totalDesc:"Total Desc",unitPrice:"Unit Price",widthCm:"Width Cm",zoomHint:"Zoom Hint"},method:{addTier:"Add Tier",machineLabel:"Machine Label",pricePerUnit:"Price Per Unit",qtyPieces:"Qty Pieces",qtyTip:"Qty Tip",quantityLabel:"Quantity Label",selectedMachine:"Selected Machine",subtitle:"Process & Machine",tierCount:"Tier Count",tip:"Tip",title:"Production Method"},paper:{height:"Height",selected:"Selected",subtitle:"Stock & Thickness",title:"Paper Selection",typeLabel:"Type Label",width:"Width"}},finishing:{selectSupplier:"Select Supplier",supplier:"Supplier"},orderNotFound:"Order Not Found",back:"Back",backEditing:"Back Editing",bookletPreview:{subtitle:"Subtitle",title:"Title",uploadPdf:"Upload Pdf",uploadValidPdf:"Upload Valid Pdf",viewAgain:"View Again"},clickEnlarge:"Click Enlarge",config:"Config",continue:"Continue",customer:"Customer",customerSelector:{cancel:"Cancel",noResults:"No Results"},draft:"Draft",invoiceEstimate:"Invoice Estimate",job:"Job",livePreview:"Live Preview",newOrder:"New Order",newQuote:"New Quote",noFinishing:"No Finishing",noPaper:"No Paper",optimization:{baseMachineCostLabel:"Base Machine Cost Label",efficiencyTitle:"Efficiency Title",layoutLabel:"Layout Label",manualOverrideDesc:"Manual Override Desc",manualOverrideTitle:"Manual Override Title",noDimensionsDesc:"No Dimensions Desc",noMachinesDesc:"No Machines Desc",noMachinesTitle:"No Machines Title",orientationLabel:"Orientation Label",pressTimeLabel:"Press Time Label",recommendedMinimalCost:"Recommended Minimal Cost",selectedSubtitle:"Selected Subtitle",simulationTitle:"Simulation Title",subtitle:"Subtitle",title:"Title",wasteAreaLabel:"Waste Area Label"},paper:"Paper",pcs:"Pcs",preview:{clickEnlarge:"Click Enlarge",documentInspection:"Document Inspection",highConsistency:"High Consistency",liveMirror:"Live Mirror",precisionDraft:"Precision Draft",printDocument:"Print Document",resetZoom:"Reset Zoom",zoomIn:"Zoom In",zoomOut:"Zoom Out"},printing:"Printing",review:"Review",saveDraft:"Save Draft",saving:"Saving",selectedPaper:"Selected Paper",stepOf:"Step Of",submitOrder:"Submit Order",submitQuote:"Submit Quote",submitting:"Submitting",visualPreview:"Visual Preview",zoomedView:"Zoomed View"},Vk={title:"Advanced Quote",subtitle:"Integrated professional estimation engine.",totalSst:"Total (SST)",saveQuote:"Save Quote",jobDetails:"Job Details",jobPlaceholder:"e.g., Premium Gift Box",targetQuantities:"Target Quantities (Click to remove)",addQty:"Add qty",qtyHint:"Enter price tiers requested by customer",engineOptions:"Print Engine Options",engineOptionsSubtitle:"Adjust plate, press running costs, and markup.",jobComponents:"Job Components (Parts)",addComponent:"Add New Component",emptyTitle:"Build your multi-part order",emptySubtitle:'Click "Add New Component" to configure independent parts.',engine:{pressSetup:"Press Setup (RM)",plateCost:"Per Plate Cost",runningCosts:"Running Costs",pressRun:"Press (per 1k shts)",margin:"Job Profit Margin",targetMargin:"Target Margin (%)",otherCosts:"Other Manual Costs",addLine:"Add Item",description:"Explanation (e.g. Rush Fee)",discounts:"Discounts (RM)",fixedDiscount:"Fixed Discount",tax:"Government Tax (%)",sstRate:"SST Rate (%)"},metrics:{title:"Production Metrics",yield:"Yield",waste:"Waste",netSheets:"Net Sheets",makeReady:"Make-Ready",spoilage:"Spoilage",totalRequired:"Total Required",componentCosts:"Component Costs",plates:"Plates",materials:"Materials",pressRun:"Press Run",finishing:"Finishing",netTotal:"Net Total"}},Lk={title:"Commission Management",compensation:"Sales Compensation",description:"Track and manage sales commissions and payments.",payout:"Commission Payout",beneficiary:"Beneficiary",amount:"Amount",reference:"Reference",order:"Order",created:"Created",cancel:"Cancel",confirmPayment:"Confirm Payment",processed:"processed",paymentNotFound:"Payment not found",totalCommission:"Total Commission",pendingPayout:"Pending Payout",activePartners:"Active Partners",salesMtd:"Sales MTD",monthlyCommission:"Monthly Commission",agentDistribution:"Agent Distribution",topPerformers:"Top Performers",earned:"Earned",pending:"Pending",searchAgents:"Search agents...",allTypes:"All Types",salesAgent:"Sales Agent",referralPartner:"Referral Partner",affiliate:"Affiliate",addAgent:"Add Agent",rate:"Rate",noAgents:"No agents found.",searchPayments:"Search payments...",allStatus:"All Status",paid:"Paid",exportHistory:"Export History",pay:"Pay",noPayments:"No payments found.",period:"Period",currentMonth:"Current Month",previousMonth:"Previous Month",thisYear:"This Year",allAgents:"All Agents",download:"Download",totalPaid:"Total Paid",transactions:"Transactions",commissionByAgent:"Commission by Agent",transactionLedger:"Transaction Ledger",noDataFound:"No data found for this period",summary:"Summary",agents:"Agents",payments:"Payments",reports:"Reports",types:{sales_agent:"Sales Agent",referral_partner:"Referral Partner",affiliate:"Affiliate"}},Ok={title:"Payroll & HR Management",workforceManagement:"Workforce Management",description:"Manage company personnel, payroll disbursements, and attendance tracking.",summary:"Summary",directory:"Directory",payroll:"Payroll",attendance:"Attendance",roles:"Roles",totalHeadcount:"Total Headcount",totalPayroll:"Total Payroll",attendanceRate:"Attendance Rate",activeDepts:"Active Departments",deptDistribution:"Department Distribution",monthlyExpenditure:"Monthly Expenditure",payslip:"Employee Payslip",period:"Pay Period",employee:"Employee",position:"Position",date:"Date",earnings:"Earnings",description_label:"Description",amount_rm:"Amount (RM)",baseSalary:"Base Salary",bonus:"Bonus",gross:"Gross Pay",deductions:"Deductions",statutoryDeductions:"Statutory Deductions",total:"Total",netPay:"Net Pay",unassigned:"Unassigned",deleteConfirm:"Are you sure you want to delete this employee?",searchEmployees:"Search employees...",allDepartments:"All Departments",addEmployee:"Add Employee",role:"Role",department:"Department",email:"Email",actions:"Actions",noEmployees:"No employees found",payrollRegister:"Payroll Register",payrollDesc:"Review and generate employee payslips.",runPayroll:"Run Payroll",generateSlip:"Generate Slip",noPayrollData:"No payroll data available",searchLogs:"Search logs...",viewReports:"View Reports",clockIn:"Clock In",clockOut:"Clock Out",status:"Status",hours:"Hours",hours_label:"hours",noAttendance:"No attendance records found",rolesPermissions:"Roles & Permissions",rolesDesc:"Manage system access levels and permissions.",newRole:"New Role",noRoles:"No roles defined",createFirstRole:"Create First Role",present:"Present",absent:"Absent",late:"Late",ot_pay:"OT Pay",ot_report_btn:"OT Report",failed_payslip:"Failed to generate payslip.",hrs:"hrs",attendance_kiosk:{title:"Attendance Kiosk",subtitle:"Secure biometric authentication",select_action:"Select Action",select_action_desc:"Choose whether you want to clock in or clock out",clock_in:"Clock In",clock_in_desc:"Start your work day",clock_out:"Clock Out",clock_out_desc:"End your work day",security_title:"Secure Biometric Authentication",security_desc:"This system uses your device's built-in biometric authentication (Face ID, Touch ID, or Windows Hello) for secure attendance tracking. Your biometric data never leaves this device.",cancel:"Cancel",clocking_in:"Clocking In",clocking_out:"Clocking Out",no_biometric_title:"No Biometric Data Found",no_biometric_desc:"You need to register your biometric authentication first before you can use the attendance system.",success:"Success",error:"Error",biometric_verify:"Verifying biometric data...",success_msg:"Successfully {{action}} for {{name}}",back:"Back"},biometric_registration:{title:"Biometric Registration",subtitle:"Register an employee's biometric data",select_employee:"Select an employee to register their biometric data:",register_btn:"Starting Enrollment",status_registered:"Registered",status_not_registered:"Not Registered",search_employee:"Search employee...",no_employees:"No employees found.",back:"Back to employee selection",success_title:"Registration Successful!",success_desc:"Biometric data has been registered successfully.",error_title:"Registration Failed",enroll_success:"Biometric data enrolled successfully!",enroll_error:"Failed to enroll biometric data."},"":""},jk={ot_report:{title:"Overtime Payout Report",subtitle:"Audited overtime accruals and cost distribution",employee:"Employee",role:"Role",ot_hrs:"OT Hours",ot_pay:"OT Pay",total:"Total Accrued",total_hrs:"Gross Hours",no_data:"No overtime data for this period",print_pdf:"Export Audit PDF",total_ot_hours:"Total OT Hours",total_ot_payout:"Total OT Payout"},attendance_settings:{discard:"Discard Config",save_protocol:"Apply Protocol",save_success:"Attendance policies updated successfully",kiosk:{backup_pin:"Backup pin",backup_pin_desc:"Backup pin desc",greeting:"Greeting",greeting_default:"Greeting default",refresh_interval:"Refresh interval"},overtime:{multiplier:"Multiplier",standard_daily_hours:"Standard daily hours",title:"Title",working_days:"Working days"},security:{geofencing:"Geofencing",geofencing_desc:"Geofencing desc",ip_placeholder:"Ip placeholder",ip_whitelisting:"Ip whitelisting",ip_whitelisting_desc:"Ip whitelisting desc"},shift:{change_info:"Change info",grace_period:"Grace period",grace_period_desc:"Grace period desc",min:"Min",operating_hours:"Operating hours",punctuality:"Punctuality",shift_end:"Shift end",shift_start:"Shift start"},subtitle:"Subtitle",tabs:{kiosk:"Kiosk",security:"Security",shift:"Shift"},title:"Title"},add_edit_employee:{base_salary:"Base salary",department:"Department",departments:{admin:"Admin",design:"Design",logistics:"Logistics",production:"Production",sales:"Sales"},discard:"Discard",email:"Email",email_placeholder:"Email placeholder",error_save:"Error save",full_name:"Full name",hourly_rate:"Hourly rate",name_placeholder:"Name placeholder",onboard:"Onboard",role:"Role",roles:{admin:"Admin",designer:"Designer",manager:"Manager",sales:"Sales",worker:"Worker"},save_changes:"Save changes",subtitle:"Subtitle",title_add:"Title add",title_edit:"Title edit"},employee_detail:{base_salary:"Base salary",close:"Close",compensation_title:"Compensation title",credentials_title:"Credentials title",cumulative_earnings:"Cumulative earnings",email:"Email",hourly_rate:"Hourly rate",job_yield:"Job yield",join_protocol:"Join protocol",ot_hours:"Ot hours",ot_pay:"Ot pay",ot_this_month:"Ot this month",punctuality:"Punctuality",tenure:"Tenure",unit:"Unit"},payroll_batch:{authorize:"Authorize",cancel:"Cancel",executing:"Executing",fiscal_cycle:"Fiscal cycle",return_hq:"Return hq",schedule:{basic:"Basic",gross:"Gross",name:"Name",net:"Net",ot:"Ot",retained:"Retained",title:"Title"},success_desc:"Success desc",success_title:"Success title",summary:{gross:"Gross",net:"Net",ot_total:"Ot total",retentions:"Retentions"},title:"Title",toast_success:"Toast success",warning_desc:"Warning desc",warning_title:"Warning title"}},Fk={stock_transfer:{subtitle:"Inter-site material movement",actions:{execute:"Execute",processing:"Processing"},labels:{from:"From",material:"Material",notes:"Notes",quantity:"Quantity",to:"To"},messages:{error_material:"Error material",error_transfer:"Error transfer"},placeholders:{notes:"Notes",select_destination:"Select destination",select_material:"Select material",select_source:"Select source"},title:"Title"},add_edit_paper:{sections:{thicknesses_pricing:"Thickness & Pricing Matrix",basic_info:"Basic info",specifications:"Specifications"},actions:{add_size:"Add size",add_thickness:"Add thickness",cancel:"Cancel",save:"Save",upload:"Upload"},labels:{cost_price:"Cost price",description:"Description",height:"Height",name:"Name",photo:"Photo",sell_price:"Sell price",size_preset:"Size preset",supplier:"Supplier",thickness:"Thickness",unit:"Unit",width:"Width"},placeholders:{photo_url:"Photo url",select_supplier:"Select supplier"},sizes:{custom:"Custom",size_n:"Size n"},title_add:"Title add",title_edit:"Title edit"},add_edit_finishing:{placeholders:{name:"e.g., Matt Lamination",photo:"Photo"},actions:{add_tier:"Add tier",cancel:"Cancel",save:"Save",upload:"Upload"},labels:{block_price:"Block price",block_unit:"Block unit",cost:"Cost",cost_unit:"Cost unit",days:"Days",description:"Description",from_qty:"From qty",name:"Name",photo:"Photo",requires_block:"Requires block",sell:"Sell",supplier:"Supplier",to_qty:"To qty"},options:{flat_fee:"Flat fee",in_house:"In house",per_item:"Per item",sqcm:"Sqcm",sqin:"Sqin",sqmm:"Sqmm"},sections:{basic:"Basic",block:"Block",pricing:"Pricing"},title_add:"Title add",title_edit:"Title edit"},add_edit_printing:{sections:{basic:"Basic Configuration",machine_sizes:"Machine sizes",pricing:"Pricing"},placeholders:{name:"e.g., A3 Direct UV",or_more:"Or more"},actions:{upload:"Upload Machine Profile",add_size:"Add size",add_tier:"Add tier",cancel:"Cancel",save:"Save"},labels:{cost_price:"Cost price",from_qty:"From qty",height:"Height",model:"Model",name:"Name",operator:"Operator",photo:"Photo",sell_price:"Sell price",size_name:"Size name",supplier:"Supplier",to_qty:"To qty",type:"Type",unit:"Unit",width:"Width"},options:{cm:"Cm",digital:"Digital",in_house:"In house",inch:"Inch",mm:"Mm",offset:"Offset",select_operator:"Select operator"},title_add:"Title add",title_edit:"Title edit"},material_detail:{stats:{machine:"Machine Compatibility",day:"Day",days:"Days",in_house:"In house",lead_time:"Lead time",provider:"Provider",stock_level:"Stock level",units:"Units"},labels:{cost:"Cost"},no_image:"No image",sections:{pricing:"Pricing",qty_range:"Qty range",sizes:"Sizes",unit_price:"Unit price"},types:{finishing:"Finishing",paper:"Paper",printing:"Printing"}},paper_detail:{labels:{no_supplier:"No preferred supplier recorded",sizes_available:"Dimensions Available",sizes_count:"{{count}} predefined sizes",specification_matrix:"Specification Matrix",variants:"Stock Variants",cost:"Cost",description:"Description",in_stock:"In stock",sell:"Sell"},title:"Title"},finishing_detail:{labels:{cost_price:"Base Cost",cost_unit:"Cost Unit",pricing_tiers:"Volume Pricing Tiers",qty_range:"Qty Range",sell_price:"Sell Price",description:"Description",estimated_days:"Estimated days",in_house:"In house"},title:"Title"},printing_detail:{labels:{cost_price:"Unit Cost",qty_limit:"Max Quantity Limit",sell_price:"Base Sell Price",in_house:"In house",machine_model:"Machine model",operator:"Operator",pricing:"Pricing",type:"Type"},empty_states:{in_house:"In house",no_tiers:"No tiers"},title:"Title"},add_edit_block:{actions:{cancel:"Cancel",save:"Save"},labels:{cost:"Cost",customer:"Customer",finishing_type:"Finishing type",job_id:"Job id",location:"Location",name:"Name",notes:"Notes",purchase_date:"Purchase date",status:"Status",supplier:"Supplier"},placeholders:{customer:"Customer",finishing_type:"Finishing type",job_id:"Job id",location:"Location",name:"Name",notes:"Notes",select_supplier:"Select supplier"},sections:{basic:"Basic",status_location:"Status location"},status_options:{archived:"Archived",available:"Available",damaged:"Damaged",in_use:"In use",lost:"Lost",with_supplier:"With supplier"},title_add:"Title add",title_edit:"Title edit"},add_edit_plate:{actions:{cancel:"Cancel",save:"Save"},labels:{cost:"Cost",customer:"Customer",job_id:"Job id",location:"Location",name:"Name",notes:"Notes",purchase_date:"Purchase date",status:"Status",supplier:"Supplier"},placeholders:{customer:"Customer",job_id:"Job id",location:"Location",name:"Name",notes:"Notes",select_supplier:"Select supplier"},sections:{basic:"Basic",status_location:"Status location"},status_options:{archived:"Archived",available:"Available",damaged:"Damaged",in_use:"In use",lost:"Lost",with_supplier:"With supplier"},title_add:"Title add",title_edit:"Title edit"},add_edit_stock:{actions:{discard:"Discard",save:"Save"},labels:{classification:"Classification",consumable:"Consumable",measurement_unit:"Measurement unit",name:"Name",on_hand:"On hand",paper_stock:"Paper stock",stock_class:"Stock class",supplier:"Supplier",threshold:"Threshold",value_unit:"Value unit"},placeholders:{name:"Name",select_vendor:"Select vendor",unit:"Unit"},sections:{details:"Details",levels:"Levels"},subtitle:"Physical Asset Tracking",title_add:"Onboard New Asset",title_edit:"Modify Asset Record"},add_edit_warehouse:{actions:{cancel:"Cancel",save:"Save"},labels:{code:"Code",contact:"Contact",location:"Location",manager:"Manager",name:"Name",set_default:"Set default"},placeholders:{code:"Code",contact:"Contact",location:"Location",manager:"Manager",name:"Name"},sections:{details:"Details"},title_add:"Register New Warehouse",title_edit:"Configure Facility"},manage_materials:{actions:{cancel:"Cancel",save:"Save"},labels:{cost_price:"Cost price",estimated_time:"Estimated time",in_stock:"In stock",sell_price:"Sell price"},messages:{success:"Success"},sections:{finishing:"Finishing",paper:"Paper"},subtitle:"Inventory Library",title:"Material Management"},reusable_tool_detail:{labels:{by_user:"By user",cost:"Cost",customer:"Customer",history:"History",job_id:"Job id",location:"Location",times_used:"Times used"},status_options:{archived:"Archived",available:"Available",damaged:"Damaged",in_use:"In use",lost:"Lost",unknown:"Unknown",with_supplier:"With supplier"},titles:{block:"Block",plate:"Plate"}}},qk={card:{items_count:"{{count}} items",unpaid:"Deposit Pending"},noJobs:"No Jobs",productionStatus:"Production Pipeline",productionStatusDesc:"Real-time production floor status report.",stages:{artwork:"Artwork",finishing:"Finishing",inspection:"Inspection",outbound:"Outbound",printing:"Printing"},title:"Job Board"},Uk={report:{title:"Attendance Report",summary:"Report Summary",totalRecords:"Total Records",onTimeRate:"On-Time Rate",generated:"Generated on {{date}}",records:"Attendance Records"},actions:{kiosk:"Kiosk",kioskDesc:"Kiosk Desc",kioskMode:"Kiosk Mode",kioskModeDesc:"Kiosk Mode Desc",register:"Register",registerDesc:"Register Desc",reports:"Reports",reportsTitle:"Workforce Analytics",settings:"Settings",settingsDesc:"Configure attendance logic",title:"Module Navigation"},activity:{noScans:"No Scans",recent:"Recent",verified:"Verified"},charts:{absent:"Absent",late:"Late",onTime:"On Time",punctuality:"Punctuality",scans:"Scans",trendAnalysis:"Trend Analysis",weeklyActivity:"Weekly Activity"},exportReport:"Export Report",features:{location:"Location",locationDesc:"Location Desc",multiDevice:"Multi Device",multiDeviceDesc:"Multi Device Desc",privacy:"Privacy",privacyDesc:"Privacy Desc",secure:"Secure",secureDesc:"Secure Desc"},reportsDesc:"Reports Desc",reportsSubtitle:"Reports Subtitle",reportsTitle:"Reports Title",security:{biometricDesc:"Biometric Desc",biometricTitle:"Biometric Title"},stats:{avgHours:"Avg Hours",lateRate:"Late Rate",onTimeRate:"On Time Rate",totalRecords:"Total Records"},system:{activeToday:"Active Today",daily:"Daily",live:"Live",monitoring:"Monitoring",onTimeRate:"On Time Rate",registered:"Registered Staff",status:"System Status",subtitle:"Live Gateway Status",title:"Biometric Terminal"},table:{action:"Action",late:"Late",onTime:"On Time",time:"Time"},tabs:{analytics:"Analytics",detailed:"Detailed",overview:"Overview"}},$k={title:"Analytics Dashboard",subtitle:"Business Intelligence",description:"Comprehensive insights and performance metrics.",stats:{totalRevenue:"Total Revenue",avgOrderValue:"Avg Order Value",completionRate:"Completion Rate",totalOrders:"Total Orders",jobs:"jobs"},charts:{revenueTrends:"Revenue Trends",orderVolume:"Order Volume"}},Bk={title:"Orders Status",subtitle:"Job Pipeline Monitor",description:"Enterprise-wide view of all active production tickets and their real-time statuses.",searchPlaceholder:"Search orders, customers or components...",noJobs:"No jobs found",adjustFilters:"Try adjusting your filters",job:"Job",client:"Client",stage_label:"Stage",payment:"Payment",amount:"Value",actions_label:"Actions",activeJobs:"Active Jobs",totalJobs:"Total Jobs",pipelineOverview:"Pipeline Overview",pcs:"pcs",quantity:"Quantity",clickCard:"Click a card to view details",selectJob:"Select a job",jobInspector:"Job Inspector",dashboard:"Dashboard",productionPipeline:"Production Pipeline",customerContact:"Customer Contact",deliveryDate:"Delivery Date",outsourcedVendors:"Outsourced Vendors",actions:{newJob:"New Job",view:"View",pay:"Pay",process:"Process",call:"Call",whatsapp:"WhatsApp",manageProduction:"Manage Production",processPayment:"Process Payment",viewDocuments:"View Documents"},stages:{artwork:"Artwork / Prep",printing:"In Production",qc:"Quality Control",transit:"In Transit",completed:"Finished"},paymentStatus:{overdue:"Overdue",paid:"Paid",partial:"Partial",pending:"Pending"}},Gk={step_manager:{title:"Process Manager",edit_steps:"Edit Steps",save:"Save Changes",add_step:"Add New Step",step_name:"Step Name",new_step:"New Step",status:{done:"Done",working:"Working",received:"Received",next:"Next",pending:"Pending",received_back:"Received Back"},telemetry:{in:"In",started:"Started",done:"Done"},actions:{receive:"Receive Step",start:"Start Work",finish:"Finish Step",rollback:"Rollback",close:"Close",confirm_start:"Confirm & Start Step",confirm_finish:"Confirm & Finish Step"},alerts:{block_handover:"Handover required: Please hand in the finishing block to start this step.",plate_handover:"Plate Handover: This offset printing job requires plates. Please ensure plates are received."}},tool_action:{confirm_handin:"Confirm Hand-In {{type}}",step_complete:"{{type}} Step Complete",for_step:'For step: "{{name}}"',confirm_handin_desc:"Please confirm you are handing in the following {{type}} from storage for production:",current_location:"Current Location: {{location}}",location_unknown:"Unknown",returned_question:'Has the {{type}} for "{{name}}" been returned to storage?',yes_back:"Yes, it's back",no_supplier:"No, it's with the supplier",where_returned:"Where is the {{type}} being returned to storage?",location_label:"Location / Shelf # *",location_placeholder:"e.g., Shelf C-12",location_error:"Please specify the location/shelf number.",confirm_title:"Please Confirm",supplier_confirm_desc:`The {{type}}'s location will be marked as "With Supplier: {{supplier}}". This should be updated once it's returned.`,types:{block:"Finishing Block",plate:"Printing Plate",finishing:"Finishing",printing:"Printing"}},quality_standard:{title_add:"Add New Quality Standard",title_edit:"Edit Quality Standard",name_label:"Standard Name *",name_placeholder:"e.g., Business Card Standard",category_label:"Category *",category_placeholder:"e.g., Corporate Print",min_score_label:"Minimum Pass Score (%)",criteria_title:"Quality Criteria",add_criterion:"Add Criterion",criterion_name:"Name",criterion_requirement:"Requirement",criterion_tolerance:"Tolerance",criterion_name_placeholder:"e.g. Dimensions",criterion_req_placeholder:"e.g. 3.5x2 inches",criterion_tol_placeholder:"e.g. ±0.1 inch",save_standard:"Save Standard",cancel:"Cancel",validation_error:"Please fill in required fields"},quality_check:{title:"New Quality Inspection",order_label:"Order *",order_placeholder:"Select Order to Inspect",type_label:"Inspection Type",types:{visual:"Visual Inspection",dimensional:"Dimensional Check",color:"Color Accuracy",material:"Material Check",finishing:"Finishing Check"},inspector_label:"Inspector",status_label:"Status",status:{pass:"Pass",rework:"Rework",fail:"Fail"},score_label:"Quality Score (0-100)",defects_label:"Defects Found",add_defect:"Add Defect",no_defects:"No defects recorded. Perfect job!",defect_type_placeholder:"Defect Type",defect_severity:{minor:"Minor",major:"Major",critical:"Critical"},defect_desc_placeholder:"Description",notes_label:"General Notes",notes_placeholder:"Overall inspection comments...",save_inspection:"Save Inspection",saving:"Saving...",validation_error_order:"Please select an order",save_error:"Failed to save inspection"},block_selector:{title:"Select Existing Block",search_placeholder:"Search by block name...",no_blocks:"No available blocks found for this customer and finishing type.",last_used:"Last used: {{date}}",no_blocks_desc:"Please ensure the customer has existing blocks of the required type.",subtitle:"Select a finishing block from the customer's library",select_button:"Select Block"},qc_dashboard:{title:"Quality Control Dashboard",subtitle:"Performance & Accuracy Analytics",metrics:{total:"Total Inspections",passed:"Passed",failed:"Failed",pass_rate:"Pass Rate"},table:{date:"Date",order_ref:"Order Ref",performer:"Inspector",status:"Status",notes:"Notes"},history_title:"Recent Inspection History",no_records:"No quality control records found.",system_performer:"System Audit"},quality_detail:{title:"Inspection Details",order_info:"Order: {{name}}",inspector_label:"Inspector",date_label:"Date",type_label:"Check Type",customer_label:"Customer",defects_title:"Defects Found",no_defects:"No defects recorded. Good job!",notes_title:"Inspector Notes",preview_label_button:"Preview Label",download:"Download",print:"Print",preview_title:"Label Preview",print_now:"Print Now",alert_popups:"Please allow popups to print the label.",label_title:"Quality Check"}},Hk={modules:{dashboard:"Dashboard",orders:"Orders & Quotes",production:"Production",quality_control:"Quality Control",inventory:"Inventory",accounting:"Accounting",hr:"HR & Payroll",analytics:"Analytics",administration:"Administration"},"dashboard:view":"View Dashboard","orders:view":"View All Orders & Quotes","orders:view_own":"View Own Orders & Quotes (Customer)","orders:create":"Create New Orders/Quotes","orders:edit":"Edit Orders/Quotes","orders:delete":"Delete Orders/Quotes","production:view":"View Production Modules","production:update_status":"Update Production Status","production:manage_workflow":"Manage Production Workflow","quality:view":"View Quality Control Module","quality:perform_checks":"Perform Quality Checks","inventory:view":"View Inventory","inventory:edit":"Manage Stock Levels","accounting:view":"View Accounting Modules","accounting:manage_invoices":"Manage Invoices & Payments","accounting:manage_expenses":"Manage Expenses","accounting:view_reports":"View Financial Reports","hr:view":"View HR & Payroll","hr:manage_employees":"Manage Employees","hr:run_payroll":"Run Payroll","analytics:view":"View Analytics Dashboard","admin:view":"View Administration Panel","admin:manage_users":"Manage Users","admin:manage_roles":"Manage Roles & Permissions","admin:manage_system":"Manage System Settings"},Kk={enterprise:"Enterprise Print System",searchPlaceholder:"Search orders, customers or components..."},Jk={addPerson:"Add Commission Agent",fullName:"Name",email:"Email",phone:"Phone",role:"Agent Category",commissionRate:"Rate (%)",commissionAmount:"Commission Amount",commissionType:"Calculation Base",commissionTypes:{fixed:"Fixed Amount",percentage:"Percentage of Sale"},type:"Commission Model",types:{affiliate:"Affiliate Agent",referral_partner:"Referral Partner",sales_agent:"Internal Sales Agent"},savePerson:"Save Agent",errors:{name:"Name required",email:"Email required",emailInvalid:"Invalid email",phone:"Phone required",rateRange:"Rate must be 0-100",amountPositive:"Amount must be positive"},cancel:"Cancel"},Wk={ADD_EDIT_STOCK:{LABEL_UNIT:"Unit of Measurement",UNIT_MEASUREMENT:"Unit of Measurement",LABEL_VALUE_UNIT:"Value / Unit (RM)"}},zk={title:"Quotation Management",subtitle:"Sales / Quotations",description:"Manage, track and convert your customer quotations into orders.",newQuotation:"Create New Quotation",pendingQuotes:"Pending Quotes",acceptedQuotes:"Accepted Quotes",rejectedQuotes:"Rejected Quotes",conversionRate:"Conversion Rate",awaitingAcceptance:"Awaiting Acceptance",convertedToOrders:"Converted to Orders",requiresFollowUp:"Requires Follow-up",lossOpportunity:"Loss Opportunity",winRatio:"Win Ratio",listing:"Quotation Listing",listingDesc:"Historical records of all issued quotes",searchPlaceholder:"Search quotations...",summary:"Status Summary",revenueSuccess:"Revenue Success",totalValueAccepted:"Total value of accepted quotations",verified:"Verified",thisYear:"This Year",noResults:"No results found matching your search",total:"Total",columns:{num:"#",info:"Quotation Info",customer:"Customer",amount:"Total Amount",status:"Status",action:"Action"}},Yk={clickEnlarge:"Click to Enlarge Document"},Qk={title:"Document Preview",subtitle:"Print Preview",desc:"Verify the document before printing or downloading.",labels:{invoice:"Tax Invoice",quotation:"Quotation",jobCard:"Job Ticket",deliveryNote:"Delivery Note"},generating:"Generating PDF...",errorPdf:"Failed to generate PDF",downloadPdf:"Download PDF",print:"Print Now",close:"Close"},Xk="Clock In",Zk="Clock Out",eP="Action",tP="Binary Data",nP="Run",iP="Setup",oP="Submit",sP="x",rP="Downtime",aP="D E L E T E",lP="G E T",cP="P O S T",uP="P U T",dP="T",pP="A",mP="Helvetica",fP="Html2canvas",hP="Jspdf",gP={allStatuses:"All Statuses",autoGenerate:"Auto Generate",createPo:"Create Po",issueDate:"Issue Date"},yP={admin:"Admin",customer:"Customer"},vP={common:Nk,landing:xk,auth:Sk,navigation:Ek,sections:wk,dashboard:Ck,accounting:Dk,accounting_modals:Tk,inventory:Ak,partners:kk,admin:Pk,worker:Ik,customer:Rk,orderForm:Mk,complex_order:Vk,commission:Lk,hr:Ok,hr_modals:jk,inventory_modals:Fk,jobBoard:qk,attendance:Uk,analytics:$k,orders_management:Bk,production_modals:Gk,permissions:Hk,layout:Kk,commissions:Jk,INVENTORY_MODALS:Wk,quotations:zk,preview:Yk,print_preview:Qk,clock_in:Xk,clock_out:Zk,action:eP,blob:tP,run:nP,setup:iP,submit:oP,x:sP,downtime:rP,",":",","":{"":""},"2d":"2d",DELETE:aP,GET:lP,POST:cP,PUT:uP,T:dP,a:pP,"en-MY":"En- M Y",helvetica:mP,html2canvas:fP,jspdf:hP,procurement:gP,roles:yP},bP={noData:"لا توجد بيانات متاحة",loading:"جاري التحميل...",not_applicable:"لا ينطبق",import:"استيراد",export:"تصدير",add:"إضافة",months_full:{january:"يناير",february:"فبراير",march:"مارس",april:"أبريل",may:"مايو",june:"يونيو",july:"يوليو",august:"أغسطس",september:"سبتمبر",october:"أكتوبر",november:"نوفمبر",december:"ديسمبر"}},_P={company:{nav:{heritage:"تراثنا",capabilities:"قدراتنا",inquiry:"استفسار",clientPortal:"بوابة العملاء",getQuote:"اطلب عرض سعر",software:"برنامج PrintOS"},hero:{badge:"مصنع الطباعة المتميز في كوالالمبور",titleMain:"فن",titleSub:"الطباعة الدقيقة.",description:"منذ عام 2009، قمنا بترجمة الكمال الرقمي إلى واقع مادي. جودة لا تضاهى، ألوان معتمدة من ISO، وسرعة مباشرة من المصنع.",ctaExplore:"استكشف القدرات",ctaSoftware:"اكتشف برنامج PrintOS",slide2:{titleMain:"توسع",titleSub:"صناعي.",description:"أسطول هايدلبرغ سبيد ماستر الخاص بنا يوفر أحجام إنتاج لا تضاهى مع دقة ألوان معتمدة من ISO."},slide3:{titleMain:"فن اللمسات",titleSub:"النهائية الفاخرة.",description:"من التغليف الهيكلي إلى ختم الرقائق المخصص، نصنع التفاصيل الملموسة التي تحدد علامتك التجارية."},slide4:{titleMain:"رقمي",titleSub:"دقة عالية.",description:"توفر مجموعة الإنتاج الرقمي لدينا تحولات سريعة مع قدرات بيانات متغيرة للتميز الشخصي."}},heritage:{badge:"تراثنا",title:`نحن نملك الآلات.
أنت تحصل على الميزة.`,p1:"على عكس وسطاء الطباعة والوكالات، نحن ندير صالة إنتاج ضخمة خاصة بنا في قلب كوالالمبور. وهذا يعني تحكماً كاملاً في الجودة وعدم وجود هوامش ربح للوسطاء.",p2:"من خلال الاستثمار بكثافة في أكثر مطابع هايدلبرغ أوفست تقدماً في العالم وتقنية معايرة الألوان ICC الدقيقة، نضمن أن ألوان علامتك التجارية التي صممتها هي بالضبط الألوان التي نطبعها على الورق.",stat1Val:"ISO 12647",stat1Label:"ألوان معتمدة",stat2Val:"18,000",stat2Label:"ورقة في الساعة",yearsExp:"سنوات من التميز"},capabilities:{badge:"القدرات",title:`حجم لا يضاهى.
لمسات نهائية دقيقة.`,description:"من عمليات الطباعة التجارية كبيرة الحجم إلى التعبئة والتغليف الهيكلي المصمم خصيصاً، آلاتنا تملي الكمال.",offset:{title:"طباعة الأوفست",desc:"Heidelberg Speedmaster XL. دقة هندسية في CMYK و Pantone مصممة للإنتاج التجاري عالي الغلة والفعال من حيث التكلفة."},digital:{title:"ديجيتال إكسبريس",desc:"تقنية HP Indigo لعمليات التشغيل القصيرة المذهلة، وطباعة البيانات المتغيرة، والتسليم العاجل في اليوم التالي دون تنازلات."},packaging:{title:"الهيكل والعلب",desc:"كراتين قابلة للطي، علب فاخرة صلبة، وتغليف مموج مخصص مصنوع لتأثير البيع بالتجزئة."},finishing:{title:"لمسات نهائية ممتازة",desc:"Spot UV، ختم الرقائق، النقش العميق، التصفيح ناعم الملمس، والتجليد المثالي يتم بالكامل داخل مصنعنا."},logistics:{title:"خدمات لوجستية متكاملة",desc:"تغليف وتخزين وتوزيع سلس في جميع أنحاء البلاد مباشرة من مناطق التحميل لدينا إلى مراكز التوزيع الخاصة بك."},cta:{title:"تحدانا.",desc:"لديك مواصفات فريدة أو موعد نهائي مستحيل؟ دعنا نتحدث."}},contact:{title:`ابدأ 
المشروع.`,description:"أرسل مواصفاتك. سيعيد خبراء الإنتاج لدينا عرض سعر شامل في غضون 4 ساعات عمل.",facility:"المرفق",directLine:"الخط المباشر",hours:"ساعات العمل",monWedFri:"الإثنين-الأربعاء، الجمعة",thursday:"الخميس",saturday:"السبت",sunday:"الأحد",closed:"مغلق",form:{name:"الاسم / الشركة",email:"البريد الإلكتروني",category:"فئة الخدمة",categoryOther:"أخرى",brief:"موجز المشروع",submit:"اطلب عرض سعر"}},footer:{title:"الدقة. مبنية في الداخل.",rights:"جميع الحقوق محفوظة.",systemBy:"النظام بواسطة PrintOS"}},saas:{nav:{platform:"المنصة",customers:"العملاء",agencyDemo:"عرض الوكالة",signIn:"تسجيل الدخول",deployNow:"ابدأ الآن"},hero:{badge:"V1.0 الهندسة المعمارية مباشرة",title:`نظام التشغيل 
لإنتاج الطباعة.`,description:"اربط عروض الأسعار، لوحات الإنتاج، دفاتر المحاسبة، والمخزون في رسم بياني موحد للبيانات. وداعاً لجداول البيانات.",ctaBuild:"ابدأ البناء",ctaDocs:"اقرأ التوثيق"},features:{badge:"مجموعة أدوات مبنية بإتقان",title:"مجموعة أدوات مبنية بإتقان.",description:"لقد أزلنا تعقيدات أنظمة ERP التقليدية. لا واجهات قديمة. فقط سير عمل فائق السرعة مبني خصيصاً لما تحتاجه مرحلة ما قبل الطباعة وأرضية المصنع الحديثة.",stat1Val:"10x",stat1Label:"تسعير أسرع",stat2Val:"0",stat2Label:"مواعيد فائتة",graph:{title:"رسم بياني مباشر",desc:"تتحول عروض الأسعار تلقائياً إلى مهام إنتاج. يتم خصم المخزون تلقائياً. كل شيء متزامن فوراً عبر المنصة بأكملها عبر WebSockets."},kanban:{title:"إنتاج كانبان",desc:"اسحب وأفلت تذاكر الوظائف عبر أرضية المصنع. نظام مسح الباركود في محطات العمل يحدّث الحالة فوراً."},inventory:{title:"مخزون ذكي",desc:"تتبع وزن الورق، اتجاه الألياف، ومستويات الحبر. قم بتكوين تنبيهات الشراء التلقائية قبل نفاد المخزون."},security:{title:"أمان المؤسسات",desc:"أمان على مستوى السجل، تحكم في الوصول بناءً على الأدوار، ونسخ احتياطي يومي. بيانات عملائك ومصفوفات التسعير الخاصة بك مؤمنة تماماً."}},cta:{title:"توقف عن إدارة الفوضى.",description:"انضم إلى المعيار الجديد لإدارة الطباعة. أنشئ مساحة عملك في ثوانٍ.",deploy:"أطلق PrintOS"},pricing:{title:"اقتصاديات احترافية",description:"أسعار شفافة وجاهزة للتوسع للمطابع الحديثة.",essence:{title:"Essence (الأساسي)",price:"49$",period:"شهرياً",feat1:"حتى 5 محطات عمل",feat2:"مخزون أساسي",feat3:"تقارير قياسية",cta:"ابدأ الآن"},velocity:{title:"Velocity (المتسارع)",price:"149$",period:"شهرياً",feat1:"محطات عمل غير محدودة",feat2:"إنتاج متقدم",feat3:"لوحات معلومات مباشرة",cta:"ترقية للنمو"},enterprise:{title:"Enterprise (المؤسسات)",price:"مخصص",period:"توسع مخصص",feat1:"مزامنة مواقع متعددة",feat2:"تكامل مخصص للدفاتر",feat3:"مدير نجاح مخصص",cta:"تحدث إلى المبيعات"}},features_page:{hero:{badge:"المعيار الجديد",title:`وسع إمبراطورية الطباعة 
الخاصة بك بدقة.`,description:"توقف عن إدارة الفوضى. PrintOS هو نظام التشغيل العمودي المصمم للتعامل مع التعقيدات متعددة الطبقات لتصنيع الأوفست والطباعة الرقمية والتغليف على نطاق واسع."},section1:{title:"محرك تقدير دقيق",description:"أكثر مقدر تقدمًا في العالم للطباعة المعقدة. يحسب وزن الورق وتغطية الحبر ووقت الماكينة وهوامش التشطيب في أجزاء من الثانية - مما يلغي الخطأ البشري وإرهاق جداول البيانات للأبد.",feat1:"هندسة تسعير HSL ديناميكية",feat2:"ذكاء التخطيط والفرض",feat3:"عروض أسعار PDF فورية واحترافية"},section2:{title:"ذكاء أرضية المصنع المباشر",description:"حول أرضية مصنعك إلى بيئة بيانات عالية الوضوح. مع لوحات كانبان في الوقت الفعلي ومسح المحطات في كل نقطة عمل، ستعرف بالضبط أي وظيفة موجودة على أي ماكينة في أي ثانية.",feat1:"لوحة كانبان للإنتاج المباشر",feat2:"محطات عمل مدفوعة بالـ QR",feat3:"تحليل العمالة والوقت الفعلي"},section4:{title:"الذكاء المالي والدفاتر",description:"قلب مالي مبني خصيصًا لصناعة الطباعة. من الفواتير الآلية الجاهزة للضرائب إلى دفتر أستاذ متكامل تمامًا، نضمن أن تدفقك النقدي دقيق تمامًا مثل طباعتك.",feat1:"معالجة ضريبية آلية (SST/VAT)",feat2:"دفتر أستاذ محترف متكامل",feat3:"تتبع المدفوعات والتذكيرات"},section5:{title:"رأس المال البشري والحضور",description:"إدارة أصولك الأكثر قيمة - موظفيك. يتدفق الحضور البيومتري المتكامل مباشرة إلى أنظمة الرواتب المؤتمتة، مما يضمن تحفيز فريق الإنتاج الخاص بك وتعويضه بشكل صحيح.",feat1:"أكشاك الحضور البيومترية",feat2:"حساب الرواتب المؤتمت",feat3:"تتبع عمولات الموظفين والأداء"},section3:{title:"الخدمات اللوجستية والتوريد الموحد",description:"سد الفجوة بين المواد الخام والمنصات النهائية. يتتبع نظام المخزون الذكي لدينا كل جرام من الحبر وكل ورقة، مما يضمن عدم جفافك أبدًا في منتصف الإنتاج.",feat1:"تنبيهات عتبة المواد الذكية",feat2:"بوابة إنجاز الموردين",feat3:"تتبع اللوجستيات والشحن المباشر"},section6:{title:"حلول لكل قطاع عمودي",description:"نظام PrintOS ليس أداة تناسب الجميع. لقد قمنا ببناء سير عمل خاص بالصناعة يفهم الفيزياء والاقتصاديات الفريدة لقطاع الطباعة الخاص بك.",feat1:"أوفست تجاري وويب",feat2:"كرتون قابل للطي وتغليف",feat3:"رقمي وتنسيقات كبيرة"},section7:{title:"ثقة وأمان المؤسسات",description:"بياناتك هي أصولك الأكثر قيمة. نحن نحميها بتشفير من الدرجة المصرفية وبنية تحتية عالمية تضمن وقت تشغيل بنسبة 99.9٪، حتى خلال مواسم الإنتاج القصوى.",feat1:"تشفير بيانات AES-256",feat2:"اتصال سحابي SLA 99.9٪",feat3:"نسخ احتياطي يومي تلقائي"}}}},NP={elevateTitle:"ارتقِ بـ",printingOperations:"عمليات الطباعة الخاصة بك",heroDescription:"أدر مطبعتك بالكامل بنظامنا الاحترافي المدعوم بالذكاء الاصطناعي والمصمم للكفاءة الحديثة.",reliability:"الموثوقية",support:"الدعم",cloudBase:"قاعدة سحابية",welcomeBack:"مرحباً بعودتك",signInSubtitle:"سجل الدخول إلى مساحة العمل الاحترافية الخاصة بك",workEmail:"البريد الإلكتروني للعمل",securePassword:"كلمة مرور آمنة",forgot:"نسيت؟",accessWorkspace:"الدخول إلى مساحة العمل",quickAccess:"دخول سريع للنظام",roles:{admin:"مسؤول",manager:"مدير",worker:"موظف",customer:"عميل",supplier:"مورد",kiosk:"كشك",adminDesc:"وصول كامل",managerDesc:"التحليلات والتقارير",workerDesc:"أرضية الإنتاج",customerDesc:"تتبع الطلبات",supplierDesc:"سلسلة التوريد",kioskDesc:"الحضور"},errors:{invalidCredentials:"بيانات الاعتماد غير صالحة. يرجى المحاولة مرة أخرى."},copyright:"© 2024 بايونير سيتاك. بوابة الوصول الآمن v1.0"},xP={dashboard:"لوحة القيادة",orders:"حالة الطلبات",newOrder:"طلب جديد",requestQuote:"طلب تسعير",invoices:"فواتيري",support:"المساعدة والدعم",materials:"مكتبة المواد",jobBoard:"لوحة المهام",productionTracking:"تتبع الإنتاج",layoutPlanner:"مخطط التخطيط",inventory:"المخزون",qualityControl:"مراقبة الجودة",attendance:"الحضور",accounting:"المحاسبة",payroll:"الكشوف والمرتبات",commission:"العمولة",analytics:"التحليلات",administration:"الإدارة"},SP={main:"الرئيسية",operations:"العمليات",hrFinance:"الموارد البشرية والمالية",system:"النظام"},EP={welcome:"مرحباً بك مجدداً، {{name}}",overview:"نظرة عامة",description:"إليك ما يحدث في متجر الطباعة الخاص بك اليوم.",downloadReport:"تحميل التقرير",newCampaign:"حملة جديدة",portal:"بوابة العملاء",projectInfo:"تتبع طلباتك وإدارة مشاريع الطباعة الخاصة بك.",totalRevenue:"إجمالي الإيرادات",activeOrders:"الطلبات النشطة",pendingQuotes:"العروض المعلقة",customers:"إجمالي العملاء",fulfillmentRate:"معدل الإنجاز",profitMargin:"هامش الربح",recentOrders:"الطلبات الأخيرة",viewAll:"عرض الكل",status:"الحالة",date:"التاريخ",orderId:"رقم الطلب",customer:"العميل",product:"المنتج",total:"الإجمالي",revenueTrends:"اتجاهات الإيرادات",dailyPerformance:"أداء الإيرادات اليومي",quickActions:"إجراءات سريعة",newOrder:"طلب جديد",addCustomer:"إضافة عميل",inventory:"المخزون",reports:"التقارير",liveActivity:"النشاط المباشر",placedOrder:"قام {{name}} بتقديم طلب جديد لـ {{product}}",hoursAgo:"قبل {{count}} ساعة",orderInfo:"معلومات الطلب",noRecentOrders:"لم يتم العثور على طلبات أخيرة.",mon:"إثنين",tue:"ثلاثاء",wed:"أربعاء",thu:"خميس",fri:"جمعة",sat:"سبت",sun:"أحد",jan:"يناير",feb:"فبراير",mar:"مارس",apr:"أبريل",may:"مايو",jun:"يونيو",spendingTrend:"اتجاه الإنفاق",orderStatus:"حالة الطلب",completed:"مكتمل",inProgress:"قيد التنفيذ",pending:"معلق",confirmed:"مؤكد",quality_check:"فحص الجودة",delivered:"تم التسليم",cancelled:"ملغي",orderManagement:"إدارة الطلبات",orderManagementDesc:"تتبع وإدارة جميع طلبات الطباعة في مكان واحد.",orderDetails:"تفاصيل الطلب",customPrint:"طباعة مخصصة",amount:"المبلغ",totalOrders:"إجمالي الطلبات",filter:"تصفية",searchPlaceholder:"البحث حسب الرقم، العميل...",viewMode:"وضع العرض",unknown:"غير معروف",actions:"إجراءات",inProduction:"في الإنتاج",vsLastMonth:"مقابل الشهر الماضي",newToday:"جديد اليوم",actionNeeded:"مطلوب اتخاذ إجراء",totalCustomers:"إجمالي العملاء",thisWeek:"هذا الأسبوع",placedNewOrder:"قام {{customer}} بتقديم طلب جديد لـ {{product}}"},wP={title:"الإدارة المالية",hub:"المركز المالي",hubDesc:"الإشراف على جميع العمليات المالية من مركز واحد.",loading:"جاري تحميل الوحدة...",dashboard:"لوحة القيادة",generalLedger:"دفتر الأستاذ العام",chartOfAccounts:"دليل الحسابات",bankRecon:"تسوية البنك",financialReports:"التقارير المالية",salesReports:"تقارير المبيعات",fixedAssets:"الأصول الثابتة",liabilities:"الالتزامات",ar:"الحسابات المدينة",creditNotes:"إشعارات دائنة",ap:"الحسابات الدائنة",purchaseOrders:"أوامر الشراء",cheques:"الشيكات",expenses:"المصاريف",inventory:"المخزون",eInvoicing:"الفواتير الإلكترونية",customers:"العملاء",suppliers:"الموردين",materials:"المواد",payrollHr:"الرواتب والموارد البشرية",commission:"العمولة",gl_section:{hero_subtitle:"أساسيات المحاسبة",hero_title:"دفتر الأستاذ العام",hero_desc:"سجل كامل لجميع المعاملات المالية وقيود اليومية.",stats:{total_debits:"إجمالي المدين",total_credits:"إجمالي الدائن",balance:"الرصيد",total_entries:"إجمالي القيود"},search_placeholder:"البحث في القيود...",all_accounts:"جميع الحسابات",columns:{date:"التاريخ",reference:"المرجع",description:"الوصف",account:"الحساب",debit:"مدين",credit:"دائن",actions:"الإجراءات"},export:"تصدير",new_entry:"قيد جديد",no_entries:"لم يتم العثور على قيود"},dashboard_section:{back_to_dashboard:"العودة إلى لوحة القيادة",total_revenue:"إجمالي الإيرادات",total_expenses:"إجمالي المصاريف",net_profit:"صافي الربح",outstanding_ar:"الحسابات المدينة القائمة",vs_last_month:"مقارنة بالشهر الماضي",margin:"هامش الربح",invoices:"فواتير",gl_title:"دفتر الأستاذ العام",gl_desc:"عرض دليل الحسابات، قيود اليومية، وميزان المراجعة.",open_ledger:"فتح الدفتر",sst_title:"ملخص ضريبة SST",sst_desc:"ضريبة المبيعات والخدمات (6%)",current_sst:"ضريبة SST للفترة الحالية",last_month:"الشهر الماضي",ytd:"منذ بداية العام",sst_mgmt:"إدارة ضريبة SST",commission_title:"ملخص العمولات",commission_desc:"عمولات المبيعات والإحالات",total_commission_mtd:"إجمالي العمولات (حتى تاريخه)",sales_agents:"وكلاء المبيعات",referral_partners:"شركاء الإحالة",manage_commissions:"إدارة العمولات",partners_title:"الشركاء",partners_desc:"إدارة الشركاء ورأس المال والتوزيعات.",go_to_partners:"الذهاب إلى الشركاء",materials_assets_title:"المواد والأصول",materials_assets_desc:"إدارة الورق، خيارات التشطيب، الألواح، والقوالب.",manage_materials:"إدارة المواد",ap_title:"الحسابات الدائنة",ap_desc:"إدارة فواتير الموردين والمدفوعات والأرصدة المستحقة.",manage_payables:"إدارة الحسابات الدائنة",po_title:"أوامر الشراء",po_desc:"إنشاء وتتبع أوامر الشراء للمواد.",manage_pos:"إدارة أوامر الشراء",cheques_title:"إدارة الشيكات",cheques_desc:"تتبع الشيكات الصادرة/الواردة والوضع البنكي.",manage_cheques:"إدارة الشيكات",expenses_title:"المصاريف",expenses_desc:"تسجيل وتصنيف المصاريف التشغيلية.",manage_expenses:"إدارة المصاريف",customer_accounts_title:"حسابات العملاء",customer_accounts_desc:"مراقبة المستحقات، الأعمار، وحدود الائتمان.",view_customers:"عرض العملاء",financial_perf_title:"الأداء المالي",financial_perf_desc:"الإيرادات الشهرية والمصاريف والأرباح",revenue:"الإيرادات",expenses:"المصاريف",profit:"الأرباح",chart_ranges:{last_6_months:"آخر 6 أشهر",last_12_months:"آخر 12 شهرًا",ytd:"منذ بداية العام",custom:"نطاق مخصص"},expense_breakdown:"توزيع المصاريف",materials_cogs:"المواد (تكلفة البضاعة المباعة)",material_usage_title:"تقارير استهلاك المواد والهدر",material_usage_desc:"تتبع استهلاك المواد ومقاييس الهدر",material_usage_cols:{order_no:"رقم الطلب #",material:"المادة",qty:"الكمية المستخدمة",cost:"التكلفة (تقديرية)",delivery:"تاريخ التسليم",staff:"الموظف",margin:"هامش الربح"},no_material_data:"لا توجد بيانات مواد متاحة",total_material_cost:"إجمالي تكلفة المواد",calculated_from_orders:"محسوبة من الطلبات",avg_profit_margin:"متوسط هامش الربح",across_all_orders:"عبر جميع الطلبات",avg_waste:"متوسط الهدر",not_tracked:"غير متتبع"},reports_section:{hero_subtitle:"الذكاء المالي",hero_title:"التقارير المالية",hero_desc:"بيانات مالية شاملة وتحليل الأداء.",stats:{total_revenue:"إجمالي الإيرادات",total_expenses:"إجمالي المصاريف",net_profit:"صافي الربح",profit_margin:"هامش الربح"},financial_perf_title:"الأداء المالي",available_reports:"التقارير المتوفرة",reports:{income_statement:"بيان الدخل",income_statement_desc:"ملخص الإيرادات والمصاريف في الوقت الفعلي",balance_sheet:"الميزانية العمومية",balance_sheet_desc:"نظرة عامة على الأصول والالتزامات وحقوق الملكية",trial_balance:"ميزان المراجعة",trial_balance_desc:"التحقق من توازن المدين والدائن",year_end_closing:"إقفال نهاية العام",year_end_closing_desc:"إغلاق السنة المالية الحالية وتحويل الأرباح إلى الأرباح المحتجزة"},report_periods:{fy_2024:"السنة المالية 2024",current:"الحالية",full_ledger:"دفتر الأستاذ الكامل",action_required:"إجراء مطلوب"},closing_confirm:"هل أنت متأكد من رغبتك في إغلاق السنة المالية؟ سيؤدي هذا إلى تصفير جميع حسابات الإيرادات/المصاريف ونقل الربح إلى الأرباح المحتجزة (3100). هذا الإجراء غير قابل للتراجع."},expenses_section:{hero_subtitle:"إدارة التكاليف",hero_title:"إدارة المصاريف",hero_desc:"تتبع مصاريف العمل وإدارة فئات التكاليف باستخدام المسح بالذكاء الاصطناعي.",stats:{total_expenses:"إجمالي المصاريف",this_month:"هذا الشهر",total_records:"إجمالي السجلات",categories:"الفئات",lifetime:"مدى الحياة",monthly:"شهري",volume:"الحجم",types:"الأنواع"},columns:{date:"التاريخ",category:"الفئة",description:"الوصف",provider:"المزود",amount:"المبلغ",method:"الطريقة",actions:"الإجراءات"},nav:{ledger:"دفتر الأستاذ",categories:"الفئات"},search_placeholder:"بحث...",ai_scan:"مسح بالذكاء الاصطناعي",add_expense:"إضافة مصروف",no_expenses:"لم يتم العثور على مصاريف",processing:"جاري المعالجة...",view_details:"عرض التفاصيل"},customers_section:{hero_subtitle:"علاقات العملاء",hero_title:"إدارة العملاء",hero_desc:"إدارة ملفات العملاء والتاريخ والأرصدة.",stats:{total_customers:"إجمالي العملاء",total_revenue:"إجمالي الإيرادات",total_orders:"إجمالي الطلبات",outstanding_balance:"الرصيد المستحق",active:"نشط",lifetime:"مدى الحياة",volume:"الحجم",receivable:"المستحقات"},columns:{name:"الاسم",contact:"اتصال",orders:"الطلبات",total_spent:"إجمالي الإنفاق",balance:"الرصيد",actions:"الإجراءات"},search_placeholder:"بحث عن العملاء بالاسم، الشركة، البريد الإلكتروني...",add_customer:"إضافة عميل",no_customers:"لم يتم العثور على عملاء",view_profile:"عرض الملف الشخصي",edit:"تعديل",individual:"فرد",delete_confirm:"سيتم حذف العميل الذي يحمل المعرف {{id}}. هذه الوظيفة لغرض العرض فقط."},suppliers_section:{hero_subtitle:"المشتريات",hero_title:"إدارة الموردين",hero_desc:"إدارة علاقات الموردين والمشتريات والمدفوعات.",stats:{total_suppliers:"إجمالي الموردين",total_payables:"إجمالي المستحقات",total_purchases:"إجمالي المشتريات",active_partners:"الشركاء النشطون",active:"نشط",outstanding:"مستحق",lifetime:"مدى الحياة",operational:"تشغيلي"},columns:{supplier:"المورد",category:"الفئة",contact:"اتصال",ap_balance:"رصيد المستحقات",purchases:"المشتريات",status:"الحالة",actions:"الإجراءات"},search_placeholder:"بحث عن الموردين بالاسم، الفئة، جهة الاتصال...",add_supplier:"إضافة مورد",no_suppliers:"لم يتم العثور على موردين",supplier_portal:"بوابة المورد",pay_supplier:"الدفع للمورد",manage_items:"إدارة الأصناف",edit:"تعديل",active:"نشط",inactive:"غير نشط",id_label:"المعرف",no_email:"لم يتم توفير بريد إلكتروني",no_phone:"لم يتم توفير هاتف",no_address:"لم يتم توفير عنوان",total_purchases_label:"إجمالي المشتريات",balance_label:"الرصيد",payment_terms_label:"شروط الدفع",portal_btn:"البوابة",edit_btn:"تعديل",pay_btn:"دفع",items_btn:"الأصناف",delete_confirm:"سيتم حذف المورد الذي يحمل المعرف {{id}}. هذه الوظيفة لغرض العرض فقط.",categories:{paper:"ورق",printing_plates:"صفائح الطباعة",finishing:"تشطيب",general:"عام"}},po_section:{hero_subtitle:"المشتريات",hero_title:"أوامر الشراء",hero_desc:"إدارة أوامر الموردين وتتبع أنشطة المشتريات.",stats:{total_po_value:"إجمالي قيمة أوامر الشراء",pending_approval:"في انتظار الموافقة",approved:"تمت الموافقة",received:"تم الاستلام",active:"نشط",orders:"أوامر",completed:"مكتمل"},columns:{po_number:"رقم أمر الشراء",supplier:"المورد",total:"الإجمالي",date:"التاريخ",status:"الحالة",actions:"الإجراءات"},search_placeholder:"بحث برقم أمر الشراء أو المورد...",generate_po:"إنشاء أمر شراء",no_pos:"لم يتم العثور على أوامر شراء",due:"تاريخ الاستحقاق",ordered:"تم الطلب",approve:"موافقة",reject:"رفض",view:"عرض",download:"تحميل",pdf:"PDF",details:"التفاصيل",statuses:{draft:"مسودة",pending_approval:"في انتظار الموافقة",approved:"تمت الموافقة",sent:"تم الإرسال",partially_received:"مستلم جزئياً",fully_received:"مستلم كلياً",cancelled:"ملغي",rejected:"مرفوض"},export:{brand:"بايونير سيتك",title:"أمر شراء",from:"من",supplier_label:"المورد",order_date:"التاريخ",exp_delivery:"التسليم المتوقع",total_value:"إجمالي قيمة الطلب",notes:"ملاحظات",cols:{item:"الصنف",desc:"الوصف",qty:"الكمية",price:"سعر الوحدة",total:"الإجمالي"}}},cheques_section:{hero_subtitle:"أدوات الدفع",hero_title:"إدارة الشيكات",hero_desc:"تتبع وإدارة الشيكات المستحقة والمدفوعة مع مسح بالذكاء الاصطناعي.",stats:{receivable:"مستحقات",payable:"مدفوعات",pending:"في انتظار المعالجة",cleared:"تم الصرف",inflow:"تدفق وارد",outflow:"تدفق صادر",processing:"جاري المعالجة",completed:"مكتمل"},reminders:{to_deposit:"شيكات للإيداع",to_fund:"شيكات للتمويل",records:"سجلات",clear_7_days:"سجل خالي للـ 7 أيام القادمة"},tabs:{receivables:"المستحقات",payables:"المدفوعات"},columns:{cheque_number:"رقم الشيك",party_name:"اسم الطرف",bank:"البنك",amount:"المبلغ",due_date:"تاريخ الاستحقاق",status:"الحالة",actions:"الإجراءات"},search_placeholder:"بحث...",ai_scan:"مسح ذكاء اصطناعي",new_cheque:"شيك جديد",no_cheques:"لم يتم العثور على شيكات",settle:"تسوية",bounce:"ارتجاع",logs:"السجلات",processing_label:"جاري المعالجة...",statuses:{pending:"في الانتظار",cleared:"تم الصرف",bounced:"مرتجع"},bounce_prompt:"يرجى إدخال سبب ارتجاع الشيك (مثلاً: عدم كفاية الرصيد، حساب مغلق):",no_reason:"لم يتم تقديم سبب."},accounts_payable:{hero_subtitle:"إدارة المدفوعات",hero_title:"الحسابات الدائنة",hero_desc:"تتبع الفواتير وإدارة مدفوعات الموردين بكفاءة.",stats:{total_payable:"إجمالي المدفوعات",pending:"قيد الانتظار",overdue:"متأخر",paid:"مدفوع"},columns:{bill_number:"رقم الفاتورة",supplier:"المورد",amount:"المبلغ",due_date:"تاريخ الاستحقاق",status:"الحالة",actions:"الإجراءات"},search_placeholder:"بحث عن الفواتير...",all_statuses:"جميع الحالات",no_payables:"لم يتم العثور على مدفوعات",statuses:{paid:"مدفوع",pending:"قيد الانتظار",overdue:"متأخر"}},accounts_receivable:{hero_subtitle:"إدارة التدفق النقدي",hero_title:"الحسابات المدينة",hero_desc:"مراقبة الفواتير المعلقة وتتبع المدفوعات الواردة.",stats:{total_receivable:"إجمالي المستحقات",pending:"قيد الانتظار",overdue:"متأخر",collected:"تم التحصيل"},columns:{invoice_number:"رقم الفاتورة",customer:"العميل",amount:"المبلغ",due_date:"تاريخ الاستحقاق",status:"الحالة",actions:"الإجراءات"},search_placeholder:"بحث عن الفواتير...",all_statuses:"جميع الحالات",no_receivables:"لم يتم العثور على مستحقات",statuses:{paid:"مدفوع",pending:"قيد الانتظار",overdue:"متأخر"}},fixed_assets:{hero_subtitle:"إدارة الأصول",hero_title:"الأصول الثابتة",hero_desc:"تتبع وإدارة أصول الشركة، والاستهلاك، والتقييمات.",stats:{total_asset_value:"إجمالي قيمة الأصول",total_depreciation:"إجمالي الاستهلاك",total_assets:"إجمالي الأصول",avg_asset_value:"متوسط قيمة الأصول",items:"مواد",per_asset:"لكل أصل"},columns:{asset_name:"اسم الأصل",category:"الفئة",purchase_date:"تاريخ الشراء",purchase_price:"سعر الشراء",current_value:"القيمة الحالية",depreciation:"الاستهلاك",actions:"الإجراءات"},categories:{all:"جميع الفئات",machinery:"آلات",vehicles:"مركبات",property:"عقارات",equipment:"معدات"},search_placeholder:"بحث عن الأصول...",add_asset:"إضافة أصل",no_assets:"لم يتم العثور على أصول",view:"عرض",edit:"تعديل",delete:"حذف"},liabilities_section:{hero_subtitle:"المراقبة المالية",hero_title:"الالتزامات",hero_desc:"مراقبة وإدارة القروض وعقود الإيجار والالتزامات المستحقة.",stats:{total_liabilities:"إجمالي الالتزامات",short_term:"قصيرة الأجل",long_term:"طويلة الأجل",active_items:"البنود النشطة",current_balance:"الرصيد الحالي",payable_soon:"مستحق الدفع قريباً",long_term_debts:"ديون طويلة الأجل",active_loans:"قروض نشطة"},columns:{liability_name:"اسم الالتزام",type:"النوع",remaining_balance:"الرصيد المتبقي",issue_date:"تاريخ الإصدار",status:"الحالة",actions:"الإجراءات"},types:{all:"جميع الأنواع","short-term":"قصيرة الأجل","long-term":"طويلة الأجل"},search_placeholder:"بحث عن الالتزامات...",add_liability:"إضافة التزام",no_liabilities:"لم يتم العثور على التزامات",view:"عرض",edit:"تعديل",delete:"حذف",statuses:{active:"نشط",paid:"مدفوع",overdue:"متأخر"}},e_invoice_section:{hero_subtitle:"الامتثال الضريبي",hero_title:"الفاتورة الإلكترونية",hero_desc:"تتبع الامتثال والتقديم للفواتير الإلكترونية (LHDN).",stats:{validated:"تم التحقق",rejected:"مرفوض",submitted:"تم التقديم",queue:"في الانتظار",compliant:"متوافق",action_req:"مطلوب إجراء",pending:"قيد الانتظار",to_send:"للإرسال"},registry:{title:"سجل الإرسال",subtitle:"نظام تتبع الحالة في الوقت الفعلي",search_placeholder:"تصفية حسب معرف الفاتورة أو اسم العميل...",no_transmissions:"لم يتم العثور على عمليات إرسال تطابق الفلاتر الحالية"},columns:{registry_id:"معرف السجل",entity:"الكيان",commitment:"الالتزام",protocol_state:"حالة البروتوكول",actions:"الإجراءات"},statuses:{validated:"تم التحقق",rejected:"مرفوض",submitted:"تم التقديم",draft:"مسودة"},inspect:"فحص"},credit_notes_section:{hero_subtitle:"استرداد مبالغ العملاء",hero_title:"إشعارات الدائن",hero_desc:"إصدار وإدارة إشعارات الدائن والمبالغ المستردة للعملاء.",stats:{total_value:"إجمالي قيمة الائتمان",issued:"تم الإصدار",applied:"تم التطبيق",draft:"مسودة",count:"العدد",utilized:"مستخدم",pending:"قيد الانتظار"},columns:{cn_number:"رقم إشعار الدائن",customer:"العميل",ref_invoice:"الفاتورة المرجعية",amount:"المبلغ",date:"التاريخ",status:"الحالة",actions:"الإجراءات"},statuses:{draft:"مسودة",issued:"تم الإصدار",applied:"تم التطبيق",voided:"ملغي"},search_placeholder:"بحث عن إشعارات الدائن...",all_statuses:"جميع الحالات",issue_cn:"إصدار إشعار دائن",no_cn:"لم يتم العثور على إشعارات دائن",view:"عرض",download:"تنزيل",pdf:{title:"إشعار دائن",beneficiary:"المستفيد",date:"التاريخ",ref_invoice:"الفاتورة المرجعية",description:"الوصف",qty:"الكمية",unit_price:"سعر الوحدة",total:"الإجمالي",total_credit:"إجمالي الائتمان",reason:"السبب"}},bank_reconciliation:{hero_subtitle:"تسوية البنك",hero_title:"تسوية الحسابات",hero_desc:"مطابقة معاملات البنك مع مدخلات دفتر الأستاذ تلقائياً.",import_statement:"استيراد كشف الحساب",stats:{total_credits:"إجمالي الدائن",total_debits:"إجمالي المدين",matched:"مطابق",unmatched:"غير مطابق",transactions:"المعاملات",action_req:"مطلوب إجراء"},columns:{date:"التاريخ",description:"الوصف",type:"النوع",amount:"المبلغ",status:"الحالة",actions:"الإجراءات"},types:{credit:"دائن",debit:"مدين"},statuses:{matched:"مطابق",unmatched:"غير مطابق",pending:"قيد الانتظار"},search_placeholder:"بحث عن المعاملات...",all_status:"جميع الحالات",no_transactions:"لم يتم العثور على معاملات",match:"مطابقة",view_details:"عرض التفاصيل"},sales_reports:{hero_subtitle:"ذكاء الأعمال",hero_title:"تقارير المبيعات",hero_desc:"تحليل أداء المبيعات وتحديد فرص النمو.",stats:{total_revenue:"إجمالي الإيرادات",total_orders:"إجمالي الطلبات",active_customers:"العملاء النشطون",avg_order_value:"متوسط قيمة الطلب"},charts:{sales_trend_title:"اتجاه المبيعات الشهري",top_products_title:"أفضل المنتجات",sales_label:"المبيعات",orders_label:"الطلبات"},products:{business_cards:"بطاقات عمل",brochures:"بروشورات",flyers:"فلايرز",posters:"بوسترات",other:"أخرى"},months:{jan:"يناير",feb:"فبراير",mar:"مارس",apr:"أبريل",may:"مايو",jun:"يونيو",jul:"يوليو",aug:"أغسطس",sep:"سبتمبر",oct:"أكتوبر",nov:"نوفمبر",dec:"ديسمبر"},months_full:{january:"يناير",february:"فبراير",march:"مارس",april:"أبريل",may:"مايو",june:"يونيو",july:"يوليو",august:"أغسطس",september:"سبتمبر",october:"أكتوبر",november:"نوفمبر",december:"ديسمبر"}},account_types:{asset:"أصول",liability:"التزامات",equity:"حقوق الملكية",revenue:"إيرادات",expense:"مصروفات"},payment_methods:{cash:"نقداً",bank_transfer:"تحويل بنكي",card:"بطاقة",credit:"آجل",cheque:"شيك"},supplier_categories:{general:"عام",paper:"ورق",printing_plates:"ألواح طباعة",finishing:"تشطيب",printing:"طباعة"},action_labels:{edit_expense:"تعديل المصروف",delete_expense:"حذف المصروف"},year_end:{income_statement:"بيان الدخل السنوي",ended_on:"للسنة المنتهية في 31 ديسمبر {{year}}",revenue:"الإيرادات",sales_revenue:"إيرادات المبيعات",total_revenue:"إجمالي الإيرادات",expenses:"المصاريف",total_expenses:"إجمالي المصاريف",net_income:"صافي الدخل",assets:"الأصول",current_assets:"الأصول المتداولة",cash_equivalents:"النقد وما يماثله",ar:"الحسابات المدينة",inventory:"المخزون",total_current_assets:"إجمالي الأصول المتداولة",non_current_assets:"الأصول غير المتداولة",ppe:"المتلكات والآلات والمعدات",total_non_current_assets:"إجمالي الأصول غير المتداولة",total_assets:"إجمالي الأصول",liabilities:"الالتزامات",current_liabilities:"الالتزامات المتداولة",ap:"الحسابات الدائنة",short_term_loans:"قروض قصيرة الأجل",total_current_liabilities:"إجمالي الالتزامات المتداولة",non_current_liabilities:"الالتزامات غير المتداولة",long_term_loans:"قروض طويلة الأجل",total_non_current_liabilities:"إجمالي الالتزامات غير المتداولة",total_liabilities:"إجمالي الالتزامات",equity:"حقوق الملكية",owner_equity:"حقوق المالك",retained_earnings:"الأرباح المحتجزة",total_equity:"إجمالي حقوق الملكية",total_liabilities_equity:"إجمالي الالتزامات وحقوق الملكية",as_of:"كما في {{date}}",cash_flow:"قائمة التدفقات النقدية",operating_activities:"التدفقات النقدية من الأنشطة التشغيلية",cash_from_customers:"النقد المستلم من العملاء",cash_to_suppliers:"النقد المدفوع للموردين",cash_to_operating:"النقد المدفوع لمصاريف التشغيل",net_operating:"صافي النقد من الأنشطة التشغيلية",investing_activities:"التدفقات النقدية من الأنشطة الاستثمارية",purchase_equipment:"شراء معدات",net_investing:"صافي النقد المستخدم في الأنشطة الاستثمارية",financing_activities:"التدفقات النقدية من الأنشطة التمويلية",proceeds_loans:"المتحصلات من القروض",repayment_loans:"سداد القروض",net_financing:"صافي النقد من الأنشطة التمويلية",net_increase_cash:"صافي الزيادة في النقد",cash_beginning:"النقد في بداية السنة",cash_end:"النقد في نهاية السنة",ledger_summary:"ملخص دفتر الأستاذ العام",description:"الوصف",debit_rm:"مدين (رينغيت)",credit_rm:"دائن (رينغيت)",tax_summary:"ملخص الضريبة السنوي",sst_summary:"ملخص ضريبة المبيعات والخدمات (SST)",total_sales:"إجمالي المبيعات (الضريبية)",total_sst:"إجمالي ضريبة SST المحصلة",corporate_tax_summary:"ملخص ضريبة الشركات",taxable_income:"الدخل الخاضع للضريبة",tax_rate:"معدل الضريبة الفعلي",est_tax:"الضريبة التقديرية المستحقة",payment_schedule:"جدول السداد",sst_payments:"مدفوعات SST",tax_installments:"أقساط الضريبة (CP204)",compliance_notes:"ملاحظات الامتثال الضريبي",compliance_1:"1. التأكد من تقديم جميع إقرارات SST (SST-02).",compliance_2:"2. الاحتفاظ بالسجلات لمدة 7 سنوات على الأقل.",compliance_3:"3. التحقق من مطابقة مساهمات CPF/SOCSO للسجلات.",valuation_report:"تقرير تقييم المخزون",paper_inventory:"مخزون الورق",item:"البند",quantity:"الكمية",unit_price:"سعر الوحدة",total_value:"إجمالي القيمة",material_inventory:"مخزون المواد",total_inventory_value:"إجمالي قيمة المخزون"}},CP={common:{rm:"رينغيت",cancel:"Cancel",save_changes:"حفظ التغييرات",discard:"تجاهل",close:"إغلاق",save:"Save",delete:"Delete",edit:"Edit"},manage_supplier_items:{title:"إدارة العناصر لـ {{name}}",subtitle:"مورد {{category}}",paper_stock:"مخزون الورق",in_stock:"في المخزن: {{count}}",cost_price:"سعر التكلفة (رينغيت)",sell_price:"سعر البيع (رينغيت) *",finishing_options:"خيارات التشطيب",estimated_time:"الوقت المقدر: {{days}} أيام",save_success:"تم حفظ التغييرات بنجاح!"},payment_processor:{convert_title:"التحويل إلى طلب ودفع",process_title:"معالجة الدفع",order_details:"تفاصيل الطلب",customer:"العميل",item:"العنصر",number:"الرقم",date:"التاريخ",select_quantity:"اختر الكمية",pieces:"قطع",per_unit:"لكل وحدة",payment_type:"نوع الدفع",deposit:"عربون (70%)",deposit_desc:"ادفع 70% الآن، والباقي عند التسليم",pay_remaining:"دفع المتبقي",full_payment:"دفع كامل",full_payment_desc:"ادفع المبلغ بالكامل الآن",custom_amount:"مبلغ مخصص",custom_amount_desc:"حدد مبلغ الدفع",custom_amount_label:"مبلغ الدفع المخصص (رينغيت)",max_payable:"الحد الأقصى للدفع: رينغيت {{amount}}",payment_method:"طريقة الدفع",bank_transfer:"تحويل بنكي",cash:"نقداً",card:"بطاقة ائتمان/خصم",cheque:"شيك",cheque_details:"تفاصيل الشيك",cheque_number:"رقم الشيك",bank_name:"اسم البنك",due_date:"تاريخ الاستحقاق",upload_proof:"تحميل إثبات الدفع",select_file:"اختر ملف",no_file:'لم يتم اختيار ملف. انقر فوق "اختر ملف" لتحميل إيصال أو لقطة شاشة.',payment_summary:"ملخص الدفع",summary_type:"نوع الدفع:",summary_method:"طريقة الدفع:",summary_cheque:"معلومات الشيك:",summary_proof:"إثبات الدفع:",summary_total:"المبلغ المطلوب دفعه:",invoice_paid:"الفاتورة مدفوعة بالكامل",invoice_paid_desc:"تم دفع هذه الفاتورة بالفعل بالكامل. لا يتطلب دفع المزيد.",processing:"جاري المعالجة..."},supplier_portal:{no_tasks:"لا توجد مهام إنتاج معينة.",inspect_order:"فحص الطلب",receive:"استلام",start_job:"بدء العمل",complete:"إكمال",purchases:"المشتريات",payments:"المدفوعات",outstanding:"المستحقات",financial_ledger:"دفتر الأستاذ المالي",export:"تصدير",date:"التاريخ",narrative:"الوصف",debit:"مدين",credit:"دائن",balance:"الرصيد",view_reference:"عرض المرجع رقم",no_history:"لا يوجد سجل حسابات متاح.",queue_size:"حجم الانتظار",net_payables:"صافي المدفوعات",yield_value:"قيمة العائد",critical_tasks:"قائمة المهام الحرجة",all_synced:"تمت مزامنة جميع المهام",protocol_access:"بروتوكول الوصول",auth_required:"المصادقة مطلوبة لـ {{name}}. يرجى مزامنة جلستك عبر بوابة المدخل.",gateway_login:"تسجيل دخول البوابة",abort_access:"إلغاء الوصول",summary:"ملخص",work_queue:"قائمة العمل",registry:"السجل",unit:"وحدة",node_synced:"تمت مزامنة نقطة وصول المزود",close_portal:"إغلاق البوابة"},journal:{title:"دفتر اليومية اليدوي",subtitle:"بروتوكول تسوية دفتر الأستاذ",effective_date:"تاريخ السريان",general_description:"الوصف العام",narrative_placeholder:"وصف لهذا القيد...",entry_lines:"قيود القيد",add_segment:"إضافة جزء",account:"الحساب",description:"الوصف",debit_rm:"مدين (رينغيت)",credit_rm:"دائن (رينغيت)",actions:"إجراءات",select_account:"اختر الحساب",line_placeholder:"تفاصيل القيد...",segment_account:"حساب الجزء",choose_account:"اختر حساباً...",line_description:"وصف القيد",debits:"المدينون",credits:"الدائنون",balanced:"متوازن",imbalance:"غير متوازن",discard:"تجاهل",commit:"تنفيذ",min_lines_error:"يجب أن يحتوي قيد اليومية على سطرين على الأقل."},liability:{edit:"تعديل الالتزام",record:"تسجيل الالتزام",subtitle:"الالتزام المالي",core_info:"المعلومات الأساسية",name:"اسم الالتزام",name_placeholder:"مثل: قرض نمو الشركات الصغيرة والمتوسطة",lender:"المقرض / المؤسسة المالية",lender_placeholder:"مثل: بنك مايبانك بيرهاد",classification:"التصنيف",long_term:"دين طويل الأجل",short_term:"قصير الأجل / جاري",amortization:"معايير الاستهلاك",principal:"المبلغ الأصلي (رينغيت)",interest:"معدل الفائدة (%)",apr:"% سنوياً",term:"مدة السداد (أشهر)",months:"أشهر",save_obligation:"حفظ الالتزام"},expense_categories:{title:"إدارة فئات المصروفات",new_placeholder:"اسم الفئة الجديدة",add_btn:"إضافة",delete_used_confirm:'الفئة "{{category}}" مستخدمة في بعض المصروفات. حذفها سيزيلها من قائمة الفئات المتاحة، لكن المصروفات الحالية ستحتفظ بها. هل تريد الاستمرار؟',delete_confirm:'هل أنت متأكد أنك تريد حذف الفئة "{{category}}"؟',done_btn:"تم",materials:"Materials",rent:"Rent",utilities:"Utilities",salaries:"Salaries",maintenance:"Maintenance",supplier_payment:"Supplier Payment"},customer_note:{title:"تحديث الحالة وإضافة ملاحظة",for:"لـ {{name}}",status:"الحالة",rescheduled_date:"تاريخ الدفع المعاد جدولته",new_note:"ملاحظة جديدة",placeholder:"أضف تفاصيل التواصل، الوعود، إلخ.",history:"سجل الملاحظات",no_notes:"لا توجد ملاحظات بعد.",by_user:"بواسطة {{user}} في {{date}}",save_note:"حفظ الملاحظة",empty_error:"يرجى إدخال ملاحظة.",status_options:{promised_to_pay:"وعد بالدفع",rescheduled:"إعادة جدولة",disputed:"متنازع عليه",paid_pending_verification:"مدفوع - قيد التحقق",overdue:"متأخر (لا يوجد رد)"}},year_end:{income_statement:"بيان الدخل السنوي",ended_on:"للسنة المنتهية في 31 ديسمبر {{year}}",revenue:"الإيرادات",sales_revenue:"إيرادات المبيعات",total_revenue:"إجمالي الإيرادات",expenses:"المصاريف",total_expenses:"إجمالي المصاريف",net_income:"صافي الدخل",assets:"الأصول",current_assets:"الأصول المتداولة",cash_equivalents:"النقد وما يماثله",ar:"الحسابات المدينة",inventory:"المخزون",total_current_assets:"إجمالي الأصول المتداولة",non_current_assets:"الأصول غير المتداولة",ppe:"الممتلكات والمصانع والمعدات",total_non_current_assets:"إجمالي الأصول غير المتداولة",total_assets:"إجمالي الأصول",liabilities:"الالتزامات",current_liabilities:"الالتزامات المتداولة",ap:"الحسابات الدائنة",short_term_loans:"قروض قصيرة الأجل",total_current_liabilities:"إجمالي الالتزامات المتداولة",non_current_liabilities:"الالتزامات غير المتداولة",long_term_loans:"قروض طويلة الأجل",total_non_current_liabilities:"إجمالي الالتزامات غير المتداولة",total_liabilities:"إجمالي الالتزامات",equity:"حقوق الملكية",owner_equity:"حقوق الملكية للمالك",retained_earnings:"الأرباح المحتجزة",total_equity:"إجمالي حقوق الملكية",total_liabilities_equity:"إجمالي الالتزامات وحقوق الملكية",cash_flow:"بيان التدفقات النقدية السنوي",operating_activities:"التدفقات النقدية من الأنشطة التشغيلية",cash_from_customers:"النقد المستلم من العملاء",cash_to_suppliers:"النقد المدفوع للموردين",cash_to_operating:"النقد المدفوع للمصاريف التشغيلية",net_operating:"صافي النقد من الأنشطة التشغيلية",investing_activities:"التدفقات النقدية من الأنشطة الاستثمارية",purchase_equipment:"شراء معدات",net_investing:"صافي النقد المستخدم في الأنشطة الاستثمارية",financing_activities:"التدفقات النقدية من الأنشطة التمويلية",proceeds_loans:"المتحصلات من القروض",repayment_loans:"سداد القروض",net_financing:"صافي النقد من الأنشطة التمويلية",net_increase_cash:"صافي الزيادة في النقد وما يماثله",cash_beginning:"النقد وما يماثله في بداية الفترة",cash_end:"النقد وما يماثله في نهاية الفترة",ledger_summary:"ملخص دفتر الأستاذ العام",tax_summary:"ملخص الضرائب السنوي",sst_summary:"ملخص ضريبة المبيعات والخدمات (SST)",total_sales:"إجمالي المبيعات",total_sst:"إجمالي ضريبة SST المحصلة (6%)",taxable_income:"الدخل الخاضع للضريبة",tax_rate:"معدل ضريبة الشركات",est_tax:"ضريبة الشركات المقدرة",payment_schedule:"جدول سداد الضرائب",sst_payments:"مدفوعات SST (كل شهرين)",tax_installments:"ضريبة الشركات (أقساط)",compliance_notes:"ملاحظات الامتثال الضريبي",compliance_1:"1. يجب تقديم إقرارات SST كل شهرين",compliance_2:"2. يجب تقديم تقدير ضريبة الشركات بحلول الشهر السابع من السنة المالية",compliance_3:"3. يجب تقديم الإقرار الضريبي النهائي للشركة في غضون 7 أشهر بعد نهاية العام",valuation_report:"تقرير تقييم المخزون",paper_inventory:"مخزون الورق",item:"العنصر",description:"الوصف",quantity:"الكمية",unit_price:"سعر الوحدة (رينغيت)",total_value:"إجمالي القيمة (رينغيت)"},year_end_close:{title:"عملية إغلاق نهاية العام",desc:"إنشاء التقارير السنوية وإغلاق السنة المالية",reports_title:"تقارير نهاية العام",reports_desc:"اختر التقارير المراد إنشاؤها لإغلاق نهاية العام",income_statement:"بيان الدخل السنوي",income_statement_desc:"بيان الأرباح والخسائر السنوي",balance_sheet:"الميزانية العمومية السنوية",balance_sheet_desc:"المركز المالي في نهاية العام",cash_flow:"بيان التدفقات النقدية السنوي",cash_flow_desc:"حركة النقدية السنوية",general_ledger:"ملخص الأستاذ العام",general_ledger_desc:"ملخص لجميع الحسابات",tax_summary:"تقرير ملخص الضريبة",tax_summary_desc:"الالتزامات الضريبية السنوية",inventory_valuation:"تقييم المخزون",inventory_valuation_desc:"قيمة المخزون في نهاية العام",required:"مطلوب",fiscal_info_title:"معلومات السنة المالية",current_year:"السنة المالية الحالية",new_year:"السنة المالية الجديدة",closing_date:"تاريخ الإغلاق",start_date:"تاريخ بدء العام الجديد",warning_title:"تحذير هام",warning_desc:"يعد إغلاق نهاية العام عملية محاسبية حرجة لا يمكن التراجع عنها. يرجى التأكد من تسجيل ومراجعة جميع المعاملات للسنة المالية الحالية قبل المتابعة. نوصي بنسخ بياناتك احتياطياً قبل الاستمرار.",processing_title:"جاري معالجة إغلاق نهاية العام",processing_desc:"يرجى الانتظار بينما نقوم بإنشاء التقارير وإغلاق السنة المالية.",gen_reports:"جاري إنشاء التقارير المالية...",verify_balances:"جاري التحقق من أرصدة الحسابات...",closing_ledgers:"جاري إغلاق الدفاتر...",finalizing:"جاري إنهاء عملية نهاية العام...",complete_title:"اكتمل إغلاق نهاية العام",complete_desc:"تم إنشاء جميع التقارير وإغلاق السنة المالية {{year}} بنجاح.",generated_reports_label:"التقارير التي تم إنشاؤها:",generate_btn:"إنشاء التقارير وإغلاق العام",processing_btn:"جاري المعالجة...",close_btn:"إغلاق"},account_detail:{title:"تفاصيل الحساب",gl_code:"رمز الحساب: {{code}}",from:"من",to:"إلى",download_csv:"تحميل CSV",print_statement:"طباعة الكشف",opening_balance:"الرصيد الافتتاحي",initial_ref:"أولي",date:"التاريخ",description:"الوصف",ref:"المرجع",debit:"مدين",credit:"دائن",running_balance:"الرصيد الجاري",no_history:"لم يتم العثور على سجل معاملات لهذه الفترة.",ending_position:"المركز النهائي",done_btn:"تم"},account_form:{title_add:"إضافة حساب جديد",title_edit:"تعديل الحساب",subtitle:"دفتر الأستاذ لخطة الحسابات",code:"رمز الحساب",type:"نوع الحساب",name:"اسم الحساب",parent:"الحساب الأب",none_root:"لا يوجد (حساب رئيسي)",desc:"الوصف",save_btn:"حفظ الحساب"},asset_form:{title_add:"Add Asset",title_edit:"Edit Asset",subtitle:"Record and track business assets and depreciation",main_specs:"المواصفات الرئيسية",name:"Asset Name",date:"تاريخ الاستحواذ",cost:"تكلفة رأس المال (ر.م)",amortization:"الاستهلاك ودورة الحياة",method:"طريقة الاستهلاك",straight_line:"القسط الثابت (معدل سنوي ثابت)",none:"لا يوجد (أصل غير قابل للاستهلاك)",life:"العمر الافتراضي (سنوات)",salvage:"قيمة الخردة (ر.م)",discard:"Discard",commit:"تسجيل الأصل",category:"Asset Category",purchase_price:"Purchase Price",purchase_date:"Purchase Date",salvage_value:"Salvage Value",useful_life:"Useful Life (Years)",serial_number:"Serial Number",notes:"Notes",save:"Save Asset",appName:"Pioneer Cetak"},landing:{company:{nav:{heritage:"تراثنا",capabilities:"قدراتنا",inquiry:"استفسار",clientPortal:"بوابة العملاء",getQuote:"احصل على عرض سعر",software:"برمجيات PrintOS"},hero:{badge:"مصنع الطباعة المتميز في كوالالمبور",titleMain:"فن",titleSub:"الطباعة الدقيقة.",description:"منذ عام 2009، قمنا بترجمة الكمال الرقمي إلى واقع ملموس. جودة لا تضاهى، ألوان معتمدة من ISO، وسرعة المصنع المباشرة.",ctaExplore:"استكشف قدراتنا",ctaSoftware:"اكتشف برمجيات PrintOS"},heritage:{badge:"تراثنا",title:`نحن نمتلك الآلات.
وأنت تحصل على الأفضلية.`,p1:"على عكس وسطاء الطباعة والوكالات، نحن ندير أرضية إنتاج ضخمة خاصة بنا في قلب كوالالمبور. وهذا يعني تحكماً كاملاً في الجودة وعدم وجود رسوم إضافية للوسطاء.",p2:"من خلال الاستثمار بكثافة في أكثر مطابع هايدلبرغ أوفست تقدماً في العالم وتقنية معايرة الألوان ICC الدقيقة، نضمن أن ألوان علامتك التجارية التي صممتها هي بالضبط الألوان التي نطبعها على الورق.",stat1Val:"ISO 12647",stat1Label:"ألوان معتمدة",stat2Val:"18,000",stat2Label:"ورقة في الساعة",yearsExp:"سنوات من التميز"},capabilities:{badge:"قدراتنا",title:`نطاق لا يضاهى.
واحترافية في التفاصيل.`,description:"من الإنتاج التجاري الضخم إلى التغليف الهيكلي المخصص، أجهزتنا تفرض الكمال.",offset:{title:"طباعة أوفست",desc:"هايدلبرغ سبيدماستر XL. دقة CMYK و Pantone مصممة للإنتاج التجاري عالي المردود والفعال من حيث التكلفة."},digital:{title:"الطباعة الرقمية السريعة",desc:"تقنية HP Indigo للطباعة قصيرة المدى المذهلة، وطباعة البيانات المتغيرة، والتسليم السريع في اليوم التالي دون تنازلات."},packaging:{title:"الهياكل والعلب",desc:"كرتون قابل للطي، وعلب فاخرة صلبة، وتغليف مضلع مخصص مصمم للتأثير في تجارة التجزئة."},finishing:{title:"التشطيب المتميز",desc:"طلاء UV موضعي، وختم حراري، ونقش بارز عميق، وتصفيح ناعم الملمس، وتجليد مثالي يتم بالكامل داخلياً."},logistics:{title:"الخدمات اللوجستية المتكاملة",desc:"تغليف وتخزين وتوزيع على مستوى البلاد مباشرة من أحواض التحميل الخاصة بنا إلى مراكز التوزيع الخاصة بك."},cta:{title:"تحدانا.",desc:"هل لديك مواصفات فريدة أو موعد نهائي مستحيل؟ دعنا نتحدث."}},contact:{title:`ابدأ 
مشروعك.`,description:"أرسل مواصفاتك. سيعيد خبراء الإنتاج لدينا عرض سعر شامل في غضون 4 ساعات عمل.",facility:"المرافق",directLine:"الخط المباشر",hours:"ساعات العمل",monWedFri:"الاثنين - الأربعاء، الجمعة",thursday:"الخميس",saturday:"السبت",sunday:"الأحد",closed:"مغلق",form:{name:"الاسم / الشركة",email:"البريد الإلكتروني",category:"فئة الخدمة",categoryOther:"أخرى",brief:"موجز المشروع",submit:"اطلب عرض سعر"}},footer:{title:"دقة. مدمجة.",rights:"جميع الحقوق محفوظة.",systemBy:"النظام بواسطة PrintOS"}},saas:{nav:{platform:"المنصة",customers:"العملاء",agencyDemo:"تجربة الوكالات",signIn:"تسجيل الدخول",deployNow:"ابدأ الآن"},hero:{badge:"V1.0 الهندسة المعمارية قيد التشغيل",title:`نظام التشغيل 
لإنتاج الطباعة.`,description:"اربط عروض الأسعار، ولوحات الإنتاج، ودفاتر الحسابات، والمخزون في رسم بياني موحد للبيانات. وداعاً لجداول البيانات.",ctaBuild:"ابدأ الآن",ctaDocs:"اقرأ الوثائق"},features:{badge:"مجموعة أدوات مبنية بإتقان",title:"مجموعة أدوات مبنية بإتقان.",description:"لقد قمنا بإزالة التعقيدات من أنظمة ERP التقليدية. لا واجهات قديمة. فقط سير عمل سريع كالبرق مصمم خصيصاً لكيفية عمل المطابع الحديثة.",stat1Val:"10x",stat1Label:"تسعير أسرع",stat2Val:"0",stat2Label:"مواعيد فائتة",graph:{title:"رسم بياني في الوقت الفعلي",desc:"تتحول عروض الأسعار تلقائياً إلى وظائف إنتاج. يتم خصم المخزون تلقائياً. يتم مزامنة كل شيء فوراً عبر المنصة بأكملها عبر WebSockets."},kanban:{title:"إنتاج كانبان",desc:"اسحب وأسقط تذاكر العمل عبر أرضية المصنع. يعمل مسح الرموز الشريطية في محطات العمل على تحديث الحالة فوراً."},inventory:{title:"مخزون ذكي",desc:"تتبع وزن الورق واتجاه الألياف ومستويات الحبر. قم بتهيئة أوامر الشراء التلقائية قبل نفاد المخزون."},security:{title:"أمان المؤسسات",desc:"أمان على مستوى الصف، وتحكم في الوصول على أساس الأدوار، ونسخ احتياطي يومي. بيانات عملائك مصفوفات التسعير الخاصة بك مؤمنة بإحكام."}},cta:{title:"توقف عن إدارة الفوضى.",description:"انضم إلى المعيار الجديد لإدارة الطباعة. ابدأ مساحة عملك في ثوانٍ.",deploy:"نشر PrintOS"}}},cheque_form:{title_add:"تسجيل شيك",title_edit:"Edit Cheque",subtitle:"سجل شيكًا واردًا أو صادرًا",direction:"الاتجاه",receivable:"مقبوضات (وارد)",payable:"مدفوعات (صادر)",issuer:"المُصدر / المستفيد",beneficiary:"Beneficiary",select_acc:"اختر حساب...",number:"رقم الشيك",bank:"اسم البنك",face_value:"القيمة الاسمية",issue_date:"تاريخ الإصدار",maturity_date:"Maturity Date",audit_notes:"معلومات مرجعية",save_btn:"حفظ الشيك",discard:"تجاهل",error_party:"Please select a valid party.",audit_notes_placeholder:"Reference info, invoice matches, etc..."},credit_note_form:{title_add:"إصدار إشعار دائن",title_edit:"Edit Credit Note",subtitle:"توفير رصيد ائتماني للعميل",customer:"العميل",select_customer:"Select Customer...",date:"التاريخ",original_invoice:"الفاتورة الأصلية (اختياري)",select_invoice:"حدد فاتورة...",items_services:"العناصر / الخدمات",add_item:"إضافة عنصر",description:"Description",qty:"Qty",price:"Price",reason_notes:"السبب / الملاحظات",reason_placeholder:"مثل البضائع التالفة، الشحن الزائد، إلخ.",total_credit:"إجمالي الائتمان",discard:"تجاهل",confirm:"Confirm & Save",error_customer:"Please select a valid customer.",save_btn:"إصدار الإشعار دائن"},customer_form:{title_add:"إضافة عميل",title_edit:"Edit Customer",subtitle:"إنشاء ملف تعريف عميل جديد",section_info:"المعلومات الأساسية",name:"الشركة / الاسم الكامل",company:"Company",email:"البريد الإلكتروني",phone:"رقم الهاتف",tin:"الرقم الضريبي",address:"عنوان الفواتير",section_portal:"وصول للبوابة",portal_username:"Username / Email",portal_password:"Password",save_btn:"حفظ العميل",delete_confirm:"Are you sure? This action cannot be undone.",errors:{name_req:"Name is required",email_inv:"Invalid email format",portal_email_req:"Portal access requires email",password_req:"Password is required"},type:"Customer Type",credit_limit:"Credit Limit",terms:"Payment Terms",save:"Save",tabs:{basic:"Basic Info",financial:"Financial",shipping:"Shipping",contacts:"Contacts"},cancel:"إلغاء"},expense_form:{title_add:"إضافة مصروف",title_edit:"Edit Expense",subtitle:"تسجيل دفعة جديدة أو فاتورة مستحقة",date:"التاريخ",category:"الفئة",description:"الوصف",amount:"المبلغ",supplier:"المورد (اختياري)",direct_expense:"Direct Expense",payment_method:"طريقة الدفع",ref_number:"الرقم المرجعي",optional:"Optional",cheque_details:"Cheque Details",cheque_number:"Cheque Number",bank_name:"Bank Name",maturity_date:"Maturity Date",discard:"تجاهل",save_btn:"حفظ المصروف",save_changes:"Save Changes",error_cheque:"Please complete all cheque details.",select_category:"Select Category...",provider:"Provider/Vendor",method:"Payment Method",reference:"Reference Number",save:"Save Expense",select_supplier:"حدد مورد..."},payment_form:{title_edit:"Edit Payment",amount:"Amount Paid",date:"Date",method:"Payment Method",reference:"Reference Number",ref_placeholder:"مثلاً: رقم الحوالة البنكية",save_btn:"تحديث الدفعة",title_add:"Add Payment",subtitle:"Record a payment and allocate across supplier bills",supplier:"Supplier",select_supplier:"Select Supplier...",apply_to:"Apply to Outstanding Bills",discard:"Discard",save:"Save Payment"},purchase_order_form:{title_add:"Create Purchase Order",title_edit:"Edit Purchase Order",subtitle:"Generate orders for materials and inventory",supplier:"Supplier",select_supplier:"Select Supplier...",order_date:"Order Date",expected_delivery:"Expected Delivery",order_items:"Order Items",add_item:"Add Item",item_name:"Item Name",item_desc:"Description",item_qty:"Qty",item_price:"Price (RM)",notes:"Notes",notes_placeholder:"Enter additional notes or instructions...",subtotal:"Subtotal",total_order:"Total Order",discard:"Discard",confirm:"Submit Purchase Order",error_supplier:"Please select a valid supplier."},supplier_form:{title_add:"إضافة مورد",title_edit:"Edit Supplier",subtitle:"إدارة ملف المورد",info_section:"Basic Information",company_name:"Company Name",contact_person:"Contact Person",phone:"Phone",email:"Email",address:"Address",payment_section:"Payment & Billing",tin:"الرقم الضريبي",category:"Category",credit_term:"Credit Term",portal_section:"Portal Security",username:"Username",password:"Password",warning:"Warning: Modifying this could affect linked orders.",save_btn:"حفظ المورد",delete_confirm:"Are you sure? This cannot be undone.",errors:{name:"Company name is required",contact:"Contact person is required",email:"Invalid email format",username:"Username is required",password:"Password is required"},name:"Supplier Name",tax_id:"Tax ID",terms:"Payment Terms",save:"Save Supplier",tabs:{basic:"Basic Info",financial:"Financial"},category_prompt:"ماذا يقدم هذا المورد؟",payment_terms:"شروط الدفع",credit_limit:"الحد الائتماني",terms_category:"فئة الشروط",portal_access:"وصول للبوابة"},expense_detail:{title:"تفاصيل القيد",invoice_no:"رقم الفاتورة",print_voucher:"طباعة السند",edit_entry:"تعديل القيد",delete_entry:"حذف القيد",transaction_value:"قيمة المعاملة",recorded_date:"تاريخ التسجيل",classification:"التصنيف",provider:"المزود",invoice_ref:"مرجع الفاتورة",settlement_protocol:"تفاصيل التسوية",close_registry:"إغلاق السجل",general_disbursement:"صرف عام",none:"لا يوجد"},liability_form:{title_add:"Add Liability",title_edit:"Edit Liability",subtitle:"Track bank loans, leases, or other debts",type:"Liability Type",name:"Liability Name",amount:"Principal Amount",interest_rate:"Interest Rate (%)",issue_date:"Issue Date",maturity_date:"Maturity Date",provider:"Institution",notes:"Notes",save:"Save Liability",discard:"Discard"},supplier_categories:{paper:{label:"Paper",desc:"Paper stocks, art card, raw media"},printing:{label:"Printing",desc:"Digital / Offset printing services"},finishing:{label:"Finishing",desc:"Lamination, UV, embossing, die-cut"},printing_plates:{label:"Plates",desc:"CTP / polymer printing plates"},general:{label:"Ink / Consumables",desc:"Inks, toner, adhesives, chemicals"}},scan_invoice:{title:"Scan Invoice",subtitle:"Extract Data",upload_title:"Upload Invoice",upload_desc:"Upload an image of your invoice, bill, or receipt for processing.",library_upload:"Library Upload",capture_now:"Capture Now",processing:"Processing...",error_extract:"Failed to extract data. Please try again or enter manually.",error_required:"Amount and description are required.",success:"Expense added successfully",verify_title:"Verify Details",verify_subtitle:"Review Extractions",merchant:"Supplier / Merchant",matched:"Matched to registered supplier",date:"Date",invoice_num:"Invoice #",value:"Value (RM)",classification:"Classification",description:"Description",recapture:"Re-capture",save:"Save Expense",source:"Document Source",no_image:"No image data",ai_confidence:"AI Confidence: High (Structured Metadata Match)"}},DP={title:"المخزون",materialLibrary:"مكتبة المواد",stockManagement:"إدارة المخزون",stockManagementDesc:"مراقبة مركزية للمخزون وإدارة سلسلة التوريد.",catalogItems:"عناصر الكتالوج",lowStockAlerts:"تنبيهات انخفاض المخزون",stockAssetValue:"قيمة أصول المخزون",stockOverview:"نظرة عامة على المخزون",warehouses:"المستودعات",stockTransfers:"تحويلات المخزون",history:"السجل",newTransfer:"تحويل جديد",recentTransfers:"التحويلات الأخيرة",allGood:"بخير",items:"عناصر",paper:"ورق",sheets:"صفحات",itemDetails:"تفاصيل العنصر",inStock:"في المخزن",minLevel:"المستوى الأدنى",status:"الحالة",actions:"إجراءات",adjust:"ضبط",paperStock:"مخزون الورق",consumable:"مستهلكات",low:"منخفض",good:"جيد",totalItems:"إجمالي العناصر",stockValueEst:"قيمة المخزون (تقديرية)",searchPlaceholder:"البحث في المخزون...",allTypes:"جميع الأنواع",addItem:"إضافة عنصر",addWarehouse:"إضافة مستودع",default:"افتراضي",code:"الكود",edit:"تعديل",setAsDefault:"تعيين كافتراضي",dateTime:"التاريخ والوقت",type:"النوع",material:"المادة",quantity:"الكمية",cost:"التكلفة",location:"الموقع",user:"المستخدم",purchase:"شراء",usage:"استخدام",transfer:"تحويل",noTransactions:"لم يتم العثور على معاملات مخزون.",catalog:{title:"مكتبة المواد",subtitle:"الكتالوج",description:"اكتشف مجموعتنا الواسعة من المواد، وخيارات التشطيب المتخصصة، وآلات الطباعة.",search:"البحث عن المواد...",paper:"ورق",finishing:"تشطيب",printing:"طباعة",paperTypes:"أنواع الورق",finishingOptions:"خيارات التشطيب",printingMethods:"طرق الطباعة",plates:"صفائح",blocks:"بلوكات"},materials:"المواد",general:"عام"},TP={title:"إدارة الشركاء",equityDistributions:"حقوق الملكية والتوزيعات",equityDistributionsDesc:"الإشراف على حقوق ملكية الشركاء والمساهمات والتوزيعات.",capitalVsDistributions:"رأس المال مقابل التوزيعات",addPartner:"إضافة شريك",addNew:"إضافة جديد",noPartners:"لم يتم العثور على شركاء",noTransactions:"لم يتم العثور على معاملات",totalCapital:"إجمالي رأس المال",totalDistributions:"إجمالي التوزيعات",netPartnerEquity:"صافي حقوق الشركاء",invested:"مستثمر",paidOut:"مدفوع",retained:"محتجز",ownership:"الملكية",netEquity:"صافي حقوق الملكية",partner:"الشريك",type:"النوع",date:"التاريخ",amount:"المبلغ",notes:"ملاحظات",dashboard:"لوحة القيادة",partners:"الشركاء",contributions:"المساهمات",distributions:"التوزيعات",types:{founder:"مؤسس",investor:"مستثمر",strategic:"استراتيجي"},editPartner:"تعديل الشريك",addNewPartner:"إضافة شريك جديد",profilePhoto:"صورة الملف الشخصي",uploadImage:"تحميل صورة",fullName:"الاسم الكامل",emailAddress:"البريد الإلكتروني",phoneNumber:"رقم الهاتف",partnerType:"نوع الشريك",ownershipPercentage:"نسبة الملكية",joinDate:"تاريخ الانضمام",transferOwnershipFrom:"نقل الملكية من",totalContribution:"إجمالي المساهمة",totalDistribution:"إجمالي التوزيع",phone:"الهاتف",close:"إغلاق",saveChanges:"حفظ التغييرات",joined:"انضم في",errorNoTransfer:"يجب نقل بعض الملكية من الشركاء الحاليين.",errorIncompleteOwnership:"إجمالي الملكية الحالي هو {{current}}%، وليس 100%. لا يمكن إضافة شريك جديد حتى يتم تصحيح ذلك.",errorIncompleteOwnershipShort:"إجمالي الملكية ({{current}}%) يجب أن يكون 100%."},AP={settings:{title:"الإدارة",subtitle:"إعدادات النظام",description:"إدارة الإعدادات العامة والمستخدمين وتكوينات النظام.",back:"العودة إلى الإعدادات",loading:"جاري تحميل الوحدة...",userManagement:"إدارة المستخدمين",userManagementDesc:"إدارة حسابات الموظفين والوصول.",rolesPermissions:"الأدوار والصلاحيات",rolesPermissionsDesc:"تكوين التحكم في الوصول بناءً على الدور.",adminPower:"إعدادات صلاحيات المسؤول",adminPowerDesc:"تجاوزات إدارية على مستوى النظام.",companyInformation:"معلومات الشركة",companyInformationDesc:"تفاصيل العمل والعلامة التجارية.",themeBranding:"المظهر والعلامة التجارية",themeBrandingDesc:"تخصيص المظهر والشعور.",financialSettings:"الإعدادات المالية",financialSettingsDesc:"تكوين الضرائب والعملات والمحاسبة.",aiChatbot:"المساعد الذكي",aiChatbotDesc:"تكوين المساعد الذكي.",productionSettings:"إعداد الإنتاج",productionSettingsDesc:"إدارة الآلات والمواد وسير العمل.",hrPayroll:"الموارد البشرية والرواتب",hrPayrollDesc:"سجلات الموظفين والرواتب.",documentDesigner:"مصمم المستندات",documentDesignerDesc:"تخصيص قوالب الفواتير وأوامر الشراء.",auditTrail:"سجل التدقيق",auditTrailDesc:"تتبع نشاط النظام والتغييرات.",integrations:"التكاملات",integrationsDesc:"ربط خدمات الطرف الثالث.",deliveryManagement:"إدارة التوصيل",deliveryManagementDesc:"تكوين طرق التوصيل والأساطيل.",notifications:"الإشعارات",notificationsDesc:"تنبيهات البريد الإلكتروني والنظام."}},kP={production:{title:"نظرة عامة على الإنتاج",subtitle:"طابق الإنتاج",description:"مراقبة الإنتاج في الوقت الفعلي ومقاييس الكفاءة.",systemOperational:"النظام يعمل",dailyOutput:"الإنتاج اليومي",onTimeDelivery:"التسليم في الوقت المحدد",qualityScore:"درجة الجودة",equipmentUptime:"وقت تشغيل المعدات",activeProduction:"الإنتاج النشط",active:"نشط",noActiveOrders:"لا توجد أوامر إنتاج نشطة.",systemStatus:"حالة النظام",teamPerformance:"أداء الفريق",tasks:"مهام"},layoutPlanner:{title:"مخطط التخطيط",subtitle:"تخطيط الإنتاج",description:"تحسين استهلاك الورق وحساب تكوينات التخطيط.",exportLayout:"تصدير التخطيط",paperStock:"مخزون الورق",source:"المصدر",standard:"قياسي",custom:"مخصص",size:"الحجم",width:"العرض",height:"الارتفاع",artwork:"العمل الفني",bleedGutter:"النزيف والفجوة ({{unit}})",sheetMargins:"هوامش الصفحة ({{unit}})",readyToCalculate:"جاهز لحساب العائد",enterParameters:"أدخل المعلمات لرؤية التخطيط",efficiency:"الكفاءة",totalYield:"إجمالي العائد",ups:"وحدة",gripArea:"منطقة الإمساك"},qualityControl:{title:"مراقبة الجودة",subtitle:"ضمان الجودة",description:"مراقبة شاملة للجودة وتتبع العيوب.",summary:"ملخص",inspections:"الفحوصات",standards:"المعايير",defects:"العيوب",qualityScore:"درجة الجودة",passRate:"معدل النجاح",checksToday:"فحوصات اليوم",avgTime:"متوسط الوقت",qualityTrends:"اتجاهات الجودة",defectAnalysis:"تحليل العيوب",detailedDefectAnalysis:"تحليل العيوب المفصل",noDefectsRecorded:"لم يتم تسجيل بيانات عيوب بعد",searchInspections:"بحث في الفحوصات...",allStatus:"كل الحالات",pending:"معلق",inProgress:"قيد التنفيذ",passed:"ناجح",failed:"راسب",requiresRework:"إعادة عمل",newCheck:"فحص جديد",export:"تصدير",order:"الطلب",type:"النوع",inspector:"المفتش",status:"الحالة",score:"الدرجة",noInspectionsFound:"لم يتم العثور على فحوصات",tryAdjustingFilters:"حاول تعديل البحث أو الفلاتر",qualityStandards:"معايير الجودة",newStandard:"معيار جديد",minimumScore:"الحد الأدنى للدرجة"},machineTracker:{title:"مركز التحكم في الماكينات",description:"تتبع المعدات في الوقت الفعلي وتخصيص التكاليف",activeMachines:"{{count}} ماكينات نشطة",running:"قيد التشغيل",idle:"خاملة",job:"الوظيفة",operator:"المشغل",unknownOperator:"مشغل غير معروف",stopMachine:"إيقاف الماكينة",assignJob:"تعيين وظيفة",selectJob:"اختر وظيفة...",start:"بدء",cancel:"إلغاء",failedToStart:"فشل بدء الماكينة",failedToStop:"فشل إيقاف الماكينة"}},PP={dashboard:{totalSpent:"إجمالي المصروفات",recentOrders:"الطلبات الأخيرة",viewAll:"عرض كل السجل",orderInfo:"معلومات الطلب",portal:"بوابة العملاء",projectInfo:"تتبع طلباتك وعروض الأسعار والفواتير."}},IP={newOrder:"أمر إنتاج جديد",newQuote:"عرض سعر جديد",stepOf:"الخطوة {{current}} من {{total}}",customerJob:"معلومات العميل والوظيفة",customer:"العميل",paperSelection:"اختيار الورق",paper:"الورق",printingMethod:"طريقة الطباعة",printing:"الطباعة",finishingOptions:"خيارات التشطيب",finishing:"التشطيب",reviewSubmit:"المراجعة والإرسال",review:"المراجعة",livePreview:"معاينة مباشرة",draft:"مسودة",invoiceEstimate:"تقدير الفاتورة",visualPreview:"معاينة بصرية",selectedPaper:"الورق المختار",noPaper:"لم يتم اختيار ورق",noFinishing:"لم يتم اختيار خيارات تشطيب",backEditing:"العودة للتحرير",back:"رجوع",saveDraft:"حفظ كمسودة",submitOrder:"إرسال الطلب",submitQuote:"إرسال عرض السعر",continue:"استمرار",saving:"جاري الحفظ...",submitting:"جاري الإرسال...",clickToEnlarge:"انقر للتكبير"},RP={title:"إدارة العمولات",compensation:"تعويضات المبيعات",description:"تتبع وإدارة عمولات المبيعات والمدفوعات.",summary:"ملخص",agents:"الوكلاء",payments:"المدفوعات",reports:"التقارير",totalCommission:"إجمالي العمولة",pendingPayout:"الدفع المعلق",activePartners:"الشركاء النشطون",salesMtd:"المبيعات لهذا الشهر",monthlyCommission:"العمولة الشهرية",earned:"مكتسب",pending:"معلق",paid:"مدفوع",payout:"صرف مستحقات",beneficiary:"المستفيد",amount:"المبلغ",reference:"المرجع",order:"الطلب",created:"تاريخ الإنشاء",cancel:"إلغاء",confirmPayment:"تأكيد الدفع",processed:"تمت المعالجة",paymentNotFound:"لم يتم العثور على الدفع",searchAgents:"البحث عن الوكلاء...",allTypes:"جميع الأنواع",salesAgent:"وكيل مبيعات",referralPartner:"شريك إحالة",affiliate:"مسوق بالعمولة",addAgent:"إضافة وكيل",noAgents:"لم يتم العثور على وكلاء",searchPayments:"البحث عن المدفوعات...",allStatus:"جميع الحالات",exportHistory:"تصدير السجل",noPayments:"لم يتم العثور على مدفوعات",period:"الفترة",currentMonth:"الشهر الحالي",previousMonth:"الشهر السابق",thisYear:"هذا العام",allAgents:"جميع الوكلاء",download:"تحميل",totalPaid:"إجمالي المدفوع",transactions:"المعاملات",commissionByAgent:"العمولة حسب الوكيل",transactionLedger:"دفتر المعاملات",noDataFound:"لا توجد بيانات لهذه الفترة",agentDistribution:"توزيع الوكلاء",topPerformers:"الأفضل أداءً",types:{sales_agent:"وكيل مبيعات",referral_partner:"شريك",affiliate:"مسوق"},rate:"المعدل",pay:"دفع"},MP={title:"الموارد البشرية",workforceManagement:"إدارة القوى العاملة",description:"قم بإدارة فريقك وتتبع الحضور ومعالجة الرواتب بدقة.",summary:"ملخص",directory:"الدليل",payroll:"الرواتب",attendance:"الحضور",roles:"الأدوار",totalHeadcount:"إجمالي الموظفين",totalPayroll:"إجمالي الرواتب",attendanceRate:"معدل الحضور",activeDepts:"الأقسام النشطة",amount_rm:"المبلغ (رينغيت)",deptDistribution:"توزيع الأقسام",monthlyExpenditure:"المصروفات الشهرية",searchEmployees:"البحث عن الموظفين...",allDepartments:"جميع الأقسام",addEmployee:"إضافة موظف",noEmployees:"لم يتم العثور على موظفين",employee:"الموظف",role:"الدور",department:"القسم",email:"البريد الإلكتروني",actions:"الإجراءات",deleteConfirm:"هل أنت متأكد من حذف هذا الموظف؟",payslip:"قسيمة الراتب",period:"الفترة",date:"التاريخ",position:"المنصب",earnings:"الأرباح",description_label:"الوصف",baseSalary:"الراتب الأساسي",bonus:"المكافأة",gross:"الإجمالي",deductions:"الاستقطاعات",statutoryDeductions:"الاستقطاعات القانونية",total:"المجموع",netPay:"صافي الراتب",generateSlip:"إنشاء قسيمة",payrollRegister:"سجل الرواتب",payrollDesc:"إدارة رواتب الموظفين والمكافآت والقسائم.",runPayroll:"تشغيل دفعة الرواتب",noPayrollData:"لم يتم العثور على بيانات الرواتب",searchLogs:"البحث في السجلات...",viewReports:"عرض التقارير",clockIn:"تسجيل دخول",clockOut:"تسجيل خروج",status:"الحالة",hours:"الساعات",noAttendance:"لم يتم العثور على سجلات حضور",rolesPermissions:"الأدوار والصلاحيات",rolesDesc:"تحديد مستويات الوصول والمسؤوليات.",newRole:"دور جديد",noRoles:"لا توجد أدوار محددة",createFirstRole:"إنشاء أول دور",unassigned:"غير محدد"},VP={add_edit_employee:{title_add:"توطين الموظفين",title_edit:"تعديل الموظف",subtitle:"سجل الموارد البشرية العالمي",full_name:"الاسم الكامل",name_placeholder:"مثال: جون دو",email:"عنوان البريد الإلكتروني",email_placeholder:"john.doe@printing.com",role:"الدور / المنصب",department:"القسم",hourly_rate:"معدل الساعة (رينغيت)",base_salary:"الراتب الأساسي (رينغيت)",discard:"تجاهل",save_changes:"حفظ التغييرات",onboard:"توطين الموظفين",error_save:"فشل في حفظ السجل.",roles:{worker:"موظف إنتاج",manager:"مدير",admin:"مسؤول",sales:"مندوب مبيعات",designer:"مصمم جرافيك"},departments:{production:"طابق الإنتاج",sales:"المبيعات والتسويق",design:"استوديو التصميم",admin:"الإدارة",logistics:"الخدمات اللوجستية والمستودع"}},attendance_settings:{title:"التكوين",subtitle:"منطق الحضور وقواعد الاتصال",tabs:{shift:"قواعد النوبات",security:"الأمان",kiosk:"تكوين الجهاز"},shift:{operating_hours:"ساعات العمل",shift_start:"بداية نوبة النهار",shift_end:"نهاية نوبة النهار",punctuality:"عتبات الانضباط",grace_period:"فترة السماح بالتأخير",grace_period_desc:"الدقائق المسموح بها بعد بدء النوبة قبل احتساب التأخير",min:"دقيقة",change_info:"تغيير ساعات النوبات سيؤثر فقط على سجلات الحضور المستقبلية. ستحتفظ السجلات الحالية لليوم الحالي بحالتها الأصلية."},security:{geofencing:"فرض السياج الجغرافي",geofencing_desc:"تطلب إحداثيات GPS لتسجيل دخول صالح",ip_whitelisting:"القائمة البيضاء لعناوين IP",ip_whitelisting_desc:"السماح فقط بالمسح من شبكات محددة",ip_placeholder:"عناوين IP مفصولة بفاصلة..."},kiosk:{greeting:"تحية العرض",greeting_default:"بوابة حضور بيونير سيتاك",refresh_interval:"فاصل التحديث التلقائي",backup_pin:"رمز النسخ الاحتياطي اليدوي",backup_pin_desc:"في حال فشل القياسات الحيوية"},discard:"تجاهل",save_protocol:"حفظ الإعدادات",save_success:"تم تحديث إعدادات الحضور بنجاح"},employee_detail:{unit:"وحدة",punctuality:"الانضباط",tenure:"مدة الخدمة",job_yield:"إنتاجية العمل",credentials_title:"بيانات اعتماد الموظف",email:"البريد الإلكتروني",join_protocol:"تاريخ الانضمام",compensation_title:"سجل التعويضات",cumulative_earnings:"تراكمي الأرباح",base_salary:"الراتب الأساسي",hourly_rate:"معدل الساعة",close:"إغلاق الملف الشخصي"},payroll_batch:{title:"صرف الدفعة",fiscal_cycle:"الدورة المالية: {{month}} {{year}}",summary:{gross:"الالتزامات الإجمالية",retentions:"الاستقطاعات القانونية",net:"صافي المدفوعات"},schedule:{title:"جدول مدفوعات الموظفين",name:"الاسم",gross:"الإجمالي",retained:"المستقطع",net:"صافي الدفع"},warning_title:"تحذير بالتزام مالي",warning_desc:"سيؤدي تنفيذ هذه الدفعة تلقائياً إلى إنشاء قيود دائنة محاسبية مقابل صندوق النقد الرئيسي. هذا الإجراء مخضع للتدقيق والمساءلة.",cancel:"إلغاء العملية",authorize:"اعتماد وصرف",executing:"جاري التنفيذ...",success_title:"تم الإرسال بنجاح",success_desc:"تم الانتهاء من دفعة الرواتب للفترة الحالية. تم تصفية الأموال ومزامنة الدفاتر المحاسبية.",return_hq:"العودة إلى المقر الرئيسي",toast_success:"تمت معالجة دفعة الرواتب وإنشاء القيود المحاسبية."}},LP={add_edit_paper:{title_add:"إضافة ورق جديد",title_edit:"تعديل الورق",sections:{basic_info:"المعلومات الأساسية",specifications:"مواصفات الورق"},labels:{name:"الاسم *",description:"الوصف *",supplier:"المورد",in_stock:"في المخزن",photo:"الصورة",size_preset:"الحجم المسبق",width:"العرض",height:"الارتفاع",unit:"الوحدة",thickness:"السُمك",cost_price:"سعر التكلفة",sell_price:"سعر البيع"},placeholders:{photo_url:"الصق رابط الصورة أو قم بالرفع",thickness:"مثلاً: 80gsm",select_supplier:"اختر المورد"},actions:{upload:"رفع",add_size:"إضافة حجم",add_thickness:"إضافة سُمك",cancel:"إلغاء",save:"حفظ الورق"},sizes:{custom:"مخصص",size_n:"حجم {{n}}"}},add_edit_stock:{title_add:"مورد جديد",title_edit:"تعديل المخزون",subtitle:"إدارة المخزون",labels:{stock_class:"فئة المخزون",consumable:"مواد استهلاكية",paper_stock:"مخزون الورق",name:"المعرف / الاسم",classification:"التصنيف",supplier:"المورد الرئيسي",on_hand:"متوفر",threshold:"الحد الأدنى",unit:"وحدة القياس",value_unit:"Value / Unit (RM)",measurement_unit:"Unit of Measurement (e.g. liter)"},placeholders:{name:"مثلاً: حبر سيان لإجراءات الطباعة",select_vendor:"اختر المورد...",unit:"مثلاً: لتر / أوراق"},actions:{discard:"تجاهل",save:"حفظ في القبو"}},add_edit_warehouse:{title_add:"إضافة مستودع جديد",title_edit:"تعديل المستودع",labels:{name:"اسم المستودع",code:"الرمز",location:"الموقع / العنوان",manager:"اسم المدير",contact:"رقم الاتصال",set_default:"تعيين كمستودع افتراضي"},sections:{details:"تفاصيل المستودع"},placeholders:{name:"المستودع الرئيسي",code:"WH-001",location:"المنطقة الصناعية - 123",manager:"جون دو",contact:"+60 12-345 6789"},actions:{cancel:"إلغاء",save:"حفظ المستودع"}},add_edit_block:{title_add:"إضافة بلوك تشطيب جديد",title_edit:"تعديل بلوك التشطيب",sections:{basic:"المعلومات الأساسية",status_location:"الحالة والموقع"},labels:{name:"الاسم / المعرف",job_id:"رقم الوظيفة الأصلي",customer:"اسم العميل",finishing_type:"نوع التشطيب",purchase_date:"تاريخ الشراء",cost:"التكلفة (R.M)",supplier:"المورد",status:"الحالة",location:"الموقع",notes:"ملاحظات"},placeholders:{name:"الاسم / المعرف",job_id:"رقم الوظيفة الأصلي",customer:"اسم العميل",finishing_type:"نوع التشطيب (مثل: القطع بالقالب)",select_supplier:"اختر المورد",location:"مثلاً: مخزن القطع بالقالب",notes:"ملاحظات..."},status_options:{available:"متوفر",in_use:"قيد الاستخدام",damaged:"تالف",lost:"مفقود",archived:"مؤرشف",with_supplier:"عند المورد"},actions:{cancel:"إلغاء",save:"حفظ"}},add_edit_plate:{title_add:"إضافة صفيحة طباعة جديدة",title_edit:"تعديل صفيحة الطباعة",sections:{basic:"المعلومات الأساسية",status_location:"الحالة والموقع"},labels:{name:"الاسم / المعرف",job_id:"رقم الوظيفة الأصلي",customer:"اسم العميل",purchase_date:"تاريخ الشراء",cost:"التكلفة (R.M)",supplier:"المورد",status:"الحالة",location:"الموقع",notes:"ملاحظات"},placeholders:{name:"الاسم / المعرف",job_id:"رقم الوظيفة الأصلي",customer:"اسم العميل",select_supplier:"اختر المورد",location:"مثلاً: الرف B-7",notes:"ملاحظات..."},status_options:{available:"متوفر",in_use:"قيد الاستخدام",damaged:"تالف",lost:"مفقود",archived:"مؤرشف",with_supplier:"عند المورد"},actions:{cancel:"إلغاء",save:"حفظ"}},add_edit_finishing:{title_add:"إضافة خيار تشطيب جديد",title_edit:"تعديل خيار التشطيب",sections:{basic:"المعلومات الأساسية",block:"بلوك التشطيب",pricing:"فئات التسعير"},labels:{name:"الاسم *",days:"الأيام المتوقعة *",description:"الوصف",supplier:"المورد",photo:"الصورة",requires_block:"هذا التشطيب يتطلب بلوك/قالب",block_price:"سعر البلوك الجديد (لكل وحدة)",block_unit:"وحدة سعر البلوك",cost_unit:"وحدة التكلفة",from_qty:"من كمية",to_qty:"إلى كمية",cost:"التكلفة (R.M)",sell:"البيع (R.M)"},options:{in_house:"داخلي (في المطبعة)",sqcm:"لكل سم مربع",sqin:"لكل بوصة مربعة",sqmm:"لكل مم مربع",flat_fee:"لكل قطعة (رسم ثابت)",per_item:"لكل قطعة"},placeholders:{photo:"الصق رابط الصورة أو التقط تحميل",from:"من",to:"إلى (اختياري)",cost:"التكلفة",sell:"البيع"},actions:{upload:"تحميل",add_tier:"إضافة فئة سعر",cancel:"إلغاء",save:"حفظ التشطيب"}},add_edit_printing:{title_add:"إضافة خيار طباعة جديد",title_edit:"تعديل خيار الطباعة",sections:{machine_sizes:"مقاسات الماكينة",pricing:"التسعير التدريجي (فئات)"},labels:{name:"الاسم *",type:"النوع *",model:"موديل الماكينة *",supplier:"المورد",operator:"المشغل *",photo:"رابط الصورة",size_name:"الاسم",width:"العرض",height:"الارتفاع",unit:"الوحدة",from_qty:"من كمية",to_qty:"إلى كمية",cost_price:"سعر التكلفة",sell_price:"سعر البيع"},options:{digital:"رقمي (Digital)",offset:"أوفست (Offset)",in_house:"داخلي (في المطبعة)",select_operator:"اختر المشغل",mm:"مم",cm:"سم",inch:"بوصة"},placeholders:{or_more:"أو أكثر"},actions:{add_size:"إضافة مقاس",add_tier:"إضافة فئة سعر",cancel:"إلغاء",save:"حفظ الطباعة"}},manage_materials:{title:"إدارة العناصر لـ {{name}}",subtitle:"مورد {{category}}",sections:{paper:"مخزون الورق",finishing:"خيارات التشطيب"},labels:{in_stock:"في المخزن: {{count}}",estimated_time:"الوقت المتوقع: {{days}} أيام",cost_price:"سعر التكلفة (R.M)",sell_price:"سعر البيع (R.M) *"},actions:{cancel:"إلغاء",save:"حفظ التغييرات"},messages:{success:"تم حفظ التغييرات بنجاح!"}},material_detail:{types:{paper:"ورق",printing:"طباعة",finishing:"تشطيب"},no_image:"لا توجد صورة متاحة",stats:{provider:"المزود",in_house:"داخلي",stock_level:"مستوى المخزون",units:"وحدات",machine_model:"موديل الماكينة",lead_time:"الوقت المتوقع",day:"يوم",days:"أيام"},description_fallback:"لا يوجد وصف تفصيلي متاح لهذا العنصر.",sections:{sizes:"المقاسات والتسعير المتاح",pricing:"هيكلية التسعير",per_unit:"(لكل {{unit}})",qty_range:"نطاق الكمية",unit_price:"سعر الوحدة"},labels:{qty_limit:"{{from}} - {{to}} وحدات",infinity:"∞",cost:"التكلفة: RM{{price}}"},actions:{close:"إغلاق",delete:"حذف",edit:"تعديل المادة"}},paper_detail:{title:"تفاصيل الورق",labels:{description:"الوصف:",supplier:"المورد:",in_stock:"في المخزن:",sizes:"المقاسات والتسعير المتاح:",cost:"التكلفة: RM {{price}}",sell:"البيع: RM {{price}}"},actions:{close:"إغلاق",delete:"حذف",edit:"تعديل"}},finishing_detail:{title:"تفاصيل خيار التشطيب",labels:{description:"الوصف:",supplier:"المورد:",in_house:"داخلي",estimated_days:"الأيام المتوقعة:",pricing:"التسعير (لكل {{unit}}):",qty:"الكمية: {{from}} - {{to}}",cost:"التكلفة: RM {{price}}",sell:"البيع: RM {{price}}"},actions:{close:"إغلاق",delete:"حذف",edit:"تعديل"}},printing_detail:{title:"تفاصيل خيار الطباعة",labels:{machine_model:"موديل الماكينة:",type:"النوع:",supplier:"المورد:",operator:"المشغل:",in_house:"داخلي",pricing:"التسعير:",qty:"الكمية: {{from}} - {{to}}",cost:"التكلفة: RM {{price}} | ",sell:"البيع: RM {{price}}"},empty_states:{in_house:"طباعة داخلية. يتم تحديد السعر لكل وظيفة.",no_tiers:"لم يتم تحديد فئات تسعير."},actions:{close:"إغلاق",delete:"حذف",edit:"تعديل"}},reusable_tool_detail:{titles:{plate:"تفاصيل لوح الطباعة",block:"تفاصيل قالب التشطيب"},status_options:{available:"متاح",in_use:"قيد الاستخدام",damaged:"تالف",lost:"مفقود",archived:"مؤرشف",with_supplier:"عند المورد",unknown:"غير معروف"},labels:{customer:"العميل:",job_id:"رقم الوظيفة الأصلي:",status:"الحالة:",location:"الموقع:",cost:"التكلفة:",times_used:"مرات الاستخدام:",history:"السجل",at:"في",by_user:"بواسطة المستخدم {{id}}"},actions:{close:"إغلاق",delete:"حذف",edit:"تعديل"}},stock_transfer:{title:"تحويل المخزون",labels:{material:"المادة",from:"من (المصدر)",to:"إلى (الوجهة)",quantity:"الكمية المراد تحويلها",notes:"ملاحظات (اختياري)",stock_info:"المخزون: {{qty}} {{unit}}"},placeholders:{select_material:"اختر المادة للتحويل",select_source:"اختر المصدر",select_destination:"اختر الوجهة",notes:"سبب التحويل...",quantity:"0"},actions:{execute:"تنفيذ التحويل",processing:"جاري التنفيذ..."},messages:{error_material:"يجب اختيار المادة",error_transfer:"فشل التحويل. تحقق من وحدة التحكم."}}},OP={title:"لوحة المهام",productionStatus:"حالة الإنتاج",productionStatusDesc:"اسحب وأفلت المهام لتحديث حالة الإنتاج.",stages:{artwork:"العمل الفني / التجهيز",printing:"الطباعة",finishing:"التشطيب",inspection:"الفحص",outbound:"خارجي"},noJobs:"لا توجد مهام"},jP={reportsTitle:"تقارير الحضور",reportsSubtitle:"إدارة القوى العاملة",reportsDesc:"تتبع الحضور في الوقت الفعلي والتحليلات البيومترية.",exportReport:"تصدير التقرير",tabs:{overview:"نظرة عامة",detailed:"سجلات مفصلة",analytics:"تحليلات عميقة"},filters:{today:"اليوم",week:"هذا الأسبوع",month:"هذا الشهر",allStaff:"جميع الموظفين"},stats:{totalRecords:"إجمالي السجلات",onTimeRate:"معدل الانضباط",lateRate:"معدل التأخير",avgHours:"متوسط الساعات"},charts:{weeklyActivity:"نشاط المسح الأسبوعي",punctuality:"توزيع الانضباط",trendAnalysis:"تحليل الاتجاه",scans:"مسحات",onTime:"في الوقت",late:"متأخر",absent:"غائب"},table:{time:"الوقت",action:"الإجراء",onTime:"في الوقت",late:"متأخر",noRecords:"لا توجد سجلات حضور لهذه الفترة."},hr:{ot_pay:"أجر الإضافي",ot_report_btn:"تقرير الإضافي",failed_payslip:"فشل في إنشاء قسيمة الراتب.",hrs:"ساعة",attendance_kiosk:{title:"جهاز الحضور"}},security:{biometricTitle:"اتصال القياسات الحيوية الآمن",biometricDesc:"متصل عبر واجهة برمجة تطبيقات WebAuthn وتشفير من طرف إلى طرف."},system:{title:"نظام الحضور",subtitle:"القياسات الحيوية",status:"النظام متصل",monitoring:"متصل ومراقب",registered:"الموظفين المسجلين",activeToday:"نشط اليوم",onTimeRate:"معدل الالتزام بالمواعيد",daily:"يومي",live:"مباشر"},actions:{title:"إجراءات سريعة",kiosk:"جهاز الحضور",kioskDesc:"تسجيل الحضور بالبصمة",register:"تسجيل موظف",registerDesc:"تسجيل القياسات الحيوية",kioskMode:"وضع الجهاز",kioskModeDesc:"ملء الشاشة للأجهزة اللوحية",reports:"عرض التقارير",reportsDesc:"تحليلات الحضور",settings:"الإعدادات",settingsDesc:"تكوين النظام"},activity:{recent:"عمليات المسح الأخيرة",noScans:"لم يتم تسجيل أي عمليات مسح اليوم",verified:"تم التحقق"},features:{secure:"توثيق آمن",secureDesc:"أمان الاعتماد المدعوم بالأجهزة.",privacy:"حماية الخصوصية",privacyDesc:"معالجة البيانات الحيوية محلياً.",multiDevice:"متعدد الأجهزة",multiDeviceDesc:"متوافق مع الأجهزة اللوحية والجوال.",location:"تم التحقق من الموقع",locationDesc:"عمليات مسح مؤكدة جغرافياً."}},FP={title:"لوحة التحليلات",subtitle:"ذكاء الأعمال",description:"رؤى شاملة ومقاييس الأداء.",stats:{totalRevenue:"إجمالي الإيرادات",avgOrderValue:"متوسط قيمة الطلب",completionRate:"معدل الإنجاز",totalOrders:"إجمالي الطلبات",jobs:"وظائف"},charts:{revenueTrends:"اتجاهات الإيرادات",orderVolume:"حجم الطلبات"}},qP={step_manager:{title:"مدير العمليات",edit_steps:"تعديل الخطوات",save:"حفظ التغييرات",add_step:"إضافة خطوة جديدة",step_name:"اسم الخطوة",new_step:"خطوة جديدة",status:{done:"مكتمل",working:"قيد العمل",received:"مستلم",next:"التالي",pending:"معلق",received_back:"تمت إعادته"},telemetry:{in:"دخل",started:"بدأ",done:"انتهى"},actions:{receive:"استلام الخطوة",start:"بدء العمل",finish:"إنهاء الخطوة",rollback:"تراجع",close:"إغلاق",confirm_start:"تأكيد وبدء الخطوة",confirm_finish:"تأكيد وإنهاء الخطوة"},alerts:{block_handover:"التسليم مطلوب: يرجى تسليم بلوك التشطيب لبدء هذه الخطوة.",plate_handover:"تسليم لوح الطباعة: تتطلب وظيفة طباعة الأوفست هذه ألواحاً. يرجى التأكد من استلام الألواح."}},tool_action:{confirm_handin:"تأكيد تسليم {{type}}",step_complete:"تم اكتمال خطوة {{type}}",for_step:'للخطوة: "{{name}}"',confirm_handin_desc:"يرجى تأكيد تسليم {{type}} التالي من المخزن للإنتاج:",current_location:"الموقع الحالي: {{location}}",location_unknown:"غير معروف",returned_question:'هل تم إعادة {{type}} لـ "{{name}}" إلى المخزن؟',yes_back:"نعم، تم إعادته",no_supplier:"لا، هو عند المورد",where_returned:"أين يتم إعادة {{type}} في المخزن؟",location_label:"الموقع / رقم الرف *",location_placeholder:"مثلاً: الرف C-12",location_error:"يرجى تحديد الموقع/رقم الرف.",confirm_title:"يرجى التأكيد",supplier_confirm_desc:'سيتم تحديد موقع {{type}} على أنه "عند المورد: {{supplier}}". يجب تحديث ذلك بمجرد عودته.',types:{block:"بلوك التشطيب",plate:"لوح الطباعة",finishing:"التشطيب",printing:"الطباعة"}},quality_standard:{title_add:"إضافة معيار جودة جديد",title_edit:"تعديل معيار الجودة",name_label:"اسم المعيار *",name_placeholder:"مثلاً: معيار بطاقات العمل",category_label:"الفئة *",category_placeholder:"مثلاً: مطبوعات الشركات",min_score_label:"الحد الأدنى لدرجة النجاح (%)",criteria_title:"معايير الجودة",add_criterion:"إضافة معيار",criterion_name:"الاسم",criterion_requirement:"المتطلب",criterion_tolerance:"التسامح",criterion_name_placeholder:"مثلاً: الأبعاد",criterion_req_placeholder:"مثلاً: 3.5×2 بوصة",criterion_tol_placeholder:"مثلاً: ±0.1 بوصة",save_standard:"حفظ المعيار",cancel:"إلغاء",validation_error:"يرجى ملء الحقول المطلوبة"},quality_check:{title:"فحص جودة جديد",order_label:"الطلب *",order_placeholder:"اختر الطلب للفحص",type_label:"نوع الفحص",types:{visual:"فحص بصري",dimensional:"فحص الأبعاد",color:"دقة الألوان",material:"فحص المواد",finishing:"فحص التشطيب"},inspector_label:"المفتش",status_label:"الحالة",status:{pass:"ناجح",rework:"إعادة عمل",fail:"راسب"},score_label:"درجة الجودة (0-100)",defects_label:"العيوب المكتشفة",add_defect:"إضافة عيب",no_defects:"لم يتم تسجيل عيوب. عمل ممتاز!",defect_type_placeholder:"نوع العيب",defect_severity:{minor:"بسيط",major:"رئيسي",critical:"حرج"},defect_desc_placeholder:"الوصف",notes_label:"ملاحظات عامة",notes_placeholder:"تعليقات الفحص العامة...",save_inspection:"حفظ الفحص",saving:"جاري الحفظ...",validation_error_order:"يرجى اختيار الطلب",save_error:"فشل في حفظ الفحص"},block_selector:{title:"اختر القالب الحالي",search_placeholder:"بحث باسم القالب...",no_blocks:"لم يتم العثور على قوالب متاحة لهذا العميل ونوع التشطيب.",select_button:"اختر القالب"},quality_detail:{title:"تفاصيل الفحص",order_info:"الطلب: {{name}}",inspector_label:"المفتش",date_label:"التاريخ",type_label:"نوع الفحص",customer_label:"العميل",defects_title:"العيوب المكتشفة",no_defects:"لم يتم تسجيل عيوب. عمل جيد!",notes_title:"ملاحظات المفتش",preview_label_button:"معاينة الملصق",download:"تنزيل",print:"طباعة",preview_title:"معاينة الملصق",print_now:"اطبع الآن",alert_popups:"يرجى السماح بالنوافذ المنبثقة لطباعة الملصق.",label_title:"فحص الجودة"}},UP={ADD_EDIT_STOCK:{LABEL_UNIT:"Unit of Measurement",UNIT_MEASUREMENT:"Unit of Measurement",LABEL_VALUE_UNIT:"Value / Unit (RM)"}},$P={title:"إدارة العروض",subtitle:"المبيعات / عروض الأسعار",description:"إدارة وتتبع وتحويل عروض أسعار العملاء إلى طلبات.",newQuotation:"إنشاء عرض سعر جديد",pendingQuotes:"عروض معلقة",acceptedQuotes:"عروض مقبولة",rejectedQuotes:"عروض مرفوضة",conversionRate:"معدل التحويل",awaitingAcceptance:"في انتظار القبول",convertedToOrders:"تم تحويلها إلى طلبات",requiresFollowUp:"يتطلب المتابعة",lossOpportunity:"فرصة ضائعة",winRatio:"نسبة الفوز",listing:"قائمة العروض",listingDesc:"السجلات التاريخية لجميع عروض الأسعار الصادرة",searchPlaceholder:"البحث في عروض الأسعار...",summary:"ملخص الحالة",revenueSuccess:"نجاح الإيرادات",totalValueAccepted:"إجمالي قيمة العروض المقبولة",verified:"تم التحقق",thisYear:"هذا العام",noResults:"لم يتم العثور على نتائج تطابق بحثك",total:"الإجمالي",columns:{num:"#",info:"معلومات العرض",customer:"العميل",amount:"المبلغ الإجمالي",status:"الحالة",action:"الإجراء"}},BP={title:"إدارة الطلبات",subtitle:"العمليات / الطلبات",description:"مراقبة سير العمل في الإنتاج وإدارة طلبات الطباعة النشطة.",newOrder:"إنشاء طلب جديد",searchPlaceholder:"البحث عن حسب العميل أو الدور...",stages:{artwork:"العمل الفني",printing:"الطباعة",qc:"الجودة / التدقيق",transit:"قيد النقل",completed:"مكتمل"},paymentStatus:{overdue:"متأخر",paid:"مدفوع",partial:"جزئي",pending:"معلق"},quantity:"الكمية",amount:"المبلغ",invoiceRef:"مرجع الفاتورة",deliveryDate:"تاريخ التسليم",daysRemaining:"متبقي {{days}} يوم",pcs:"قطعة",jobInspector:"مفتش العمل",dashboard:"لوحة القيادة",activeJobs:"{{count}} وظيفة نشطة",productionPipeline:"خط الإنتاج",outsourcedVendors:"الموردين الخارجيين",customerContact:"الاتصال بالعميل",pipelineOverview:"نظرة عامة على الخط",totalJobs:"إجمالي الوظائف",selectJob:"اختر وظيفة للفحص",clickCard:"انقر على أي بطاقة طلب لرؤية التفاصيل الكاملة",job:"الوظيفة",client:"العميل",stage_label:"المرحلة",payment:"الدفع",actions_label:"الإجراءات",noJobs:"لم يتم العثور على وظائف",adjustFilters:"حاول تعديل الفلاتر",actions:{view:"عرض",process:"معالجة",pay:"دفع",manageProduction:"إدارة الإنتاج",processPayment:"معالجة الدفع",viewDocuments:"عرض المستندات",newJob:"وظيفة جديدة",call:"اتصال",whatsapp:"واتساب"}},GP={common:bP,landing:_P,auth:NP,navigation:xP,sections:SP,dashboard:EP,accounting:wP,accounting_modals:CP,inventory:DP,partners:TP,admin:AP,worker:kP,customer:PP,orderForm:IP,commission:RP,hr:MP,hr_modals:VP,inventory_modals:LP,jobBoard:OP,attendance:jP,analytics:FP,production_modals:qP,INVENTORY_MODALS:UP,quotations:$P,orders_management:BP},HP={noData:"暂无数据",loading:"加载中...",not_applicable:"不适用",add:"添加",try_again:"重试",step:"步骤",of:"之",appName:"Pioneer Cetak",months_full:{january:"一月",february:"二月",march:"三月",april:"四月",may:"五月",june:"六月",july:"七月",august:"八月",september:"九月",october:"十月",november:"十一月",december:"十二月"}},KP={company:{nav:{heritage:"品牌传承",capabilities:"核心能力",inquiry:"询价",clientPortal:"客户门户",getQuote:"获取报价",software:"PrintOS 软件"},hero:{badge:"吉隆坡顶级印刷工厂",titleMain:"印刷之美",titleSub:"精准至极。",description:"自2009年以来，我们致力于将数字完美转化为物理现实。无可挑剔的质量、ISO认证的色彩以及工厂直供的速度。",ctaExplore:"探索核心能力",ctaSoftware:"发现 PrintOS 软件",slide2:{titleMain:"工业级",titleSub:"规模交付。",description:"我们的海德堡 Speedmaster 机群提供无可挑剔的产能与 ISO 认证的色彩精准度。"},slide3:{titleMain:"奢华",titleSub:"后期工艺。",description:"从结构化包装到定制烫金工艺，我们打造定义您品牌的触感细节。"},slide4:{titleMain:"数码",titleSub:"高精度。",description:"我们的数码生产套件提供快速周转和可变数据功能，实现个性化的卓越品质。"}},heritage:{badge:"品牌传承",title:`我们拥有设备，
您赢得先机。`,p1:"与印刷经纪人和代理机构不同，我们在吉隆坡中心地带拥有自己的大型生产基地。这意味着对质量的完全控制以及零中间加价。",p2:"通过大量投资于全球最先进的海德堡胶印机和精准的 ICC 色彩校准技术，我们保证您设计的品牌色彩就是我们印刷在纸张上的颜色。",stat1Val:"ISO 12647",stat1Label:"色彩认证",stat2Val:"18,000",stat2Label:"时速/张数",yearsExp:"卓越历程"},capabilities:{badge:"核心能力",title:`无懈可击的规模。
层层把关的细节。`,description:"从高通量商业印刷到定制化包装设计，我们的设备定义了完美的标准。",offset:{title:"胶版印刷",desc:"海德堡 Speedmaster XL。精密的 CMYK 和 Pantone 调配，专为高产量、高性价比的商业印刷而设计。"},digital:{title:"数码快印",desc:"HP Indigo 技术可提供惊人的短版印刷、可变数据印刷以及无差错的次日快速交付。"},packaging:{title:"包装结构",desc:"模切折叠纸盒、坚硬的奢侈品包装盒以及专为零售设计的定制瓦楞包装。"},finishing:{title:"高级后期处理",desc:"局部 UV、烫金、深空压凸、触感覆膜以及完美的胶装平装，全部由工厂内部完成。"},logistics:{title:"交钥匙物流",desc:"无缝的包装、仓储和全国配送，直接从我们的装卸码头运往您的分销中心。"},cta:{title:"挑战极限。",desc:"有独特的需求或不可能完成的期限？让我们聊聊。"}},contact:{title:`开启 
项目。`,description:"提交您的规格要求。我们的生产专家将在4个工作小时内提供全面的报价。",facility:"工厂地址",directLine:"直通热线",hours:"营业时间",monWedFri:"周一至周三，周五",thursday:"周四",saturday:"周六",sunday:"周日",closed:"休息",form:{name:"姓名 / 公司",email:"电子邮箱",category:"服务类别",categoryOther:"其他",brief:"项目简介",submit:"立即询价"}},footer:{title:"精准。由心而发。",rights:"版权所有。",systemBy:"系统支持：PrintOS"}},saas:{nav:{platform:"平台",customers:"客户",agencyDemo:"机构演示",signIn:"登录",deployNow:"立即部署"},hero:{badge:"V1.0 架构已上线",title:`专为印刷生产打造的
操作系统。`,description:"将报价、生产看板、会计分类账和库存连接到一个统一的数据图中。告别繁琐的电子表格。",ctaBuild:"开始构建",ctaDocs:"查阅文档"},features:{badge:"精心构建的工具集",title:"精心构建的工具集。",description:"我们消除了传统 ERP 的繁琐感。没有过时的界面。只有专为现代印前和工厂车间运行而设计的快如闪电的工作流程。",stat1Val:"10x",stat1Label:"更快的报价",stat2Val:"0",stat2Label:"截止日期逾期",graph:{title:"实时图表",desc:"报价自动转换为生产任务。库存自动扣减。一切通过 WebSockets 在整个平台即时同步。"},kanban:{title:"看板生产",desc:"在工厂车间拖放工作单。工作站条形码扫描可立即更新状态。"},inventory:{title:"智能库存",desc:"跟踪纸张重量、丝向和墨水液位。在缺货前配置自动采购订单触发器。"},security:{title:"企业级安全",desc:"行级安全、基于角色的访问控制和每日备份。您的客户数据和定价矩阵受到严密保护。"}},cta:{title:"停止混乱的管理。",description:"加入印刷管理的新标准。在几秒钟内启动您的工作空间。",deploy:"部署 PrintOS"},pricing:{title:"精品经济学",description:"专为现代工厂设计的透明且可扩展的价格。",essence:{title:"Essence (精简版)",price:"¥350",period:"每月",feat1:"最多 5 个工作站",feat2:"基础版库存",feat3:"标准版报表",cta:"即刻开始"},velocity:{title:"Velocity (成长版)",price:"¥1050",period:"每月",feat1:"无限工作站",feat2:"高级生产看板",feat3:"实时数据面板",cta:"升级至成长版"},enterprise:{title:"Enterprise (企业版)",price:"定制",period:"量身设计",feat1:"多站点同步",feat2:"定制账单集成",feat3:"专属成功经理",cta:"联系销售"}},features_page:{hero:{badge:"行业新标准",title:`精准掌控，
扩展您的印刷帝国。`,description:"告别混乱管理。PrintOS 是专为处理胶印、数码和包装制造中多层复杂性而设计的垂直操作系统。"},section1:{title:"精准估算引擎",description:"全球最先进的复杂印刷估算器。它能在毫秒内计算纸张重量、油墨覆盖率、机器时间和后期加工边距，永久消除人为错误和电子表格疲劳。",feat1:"动态 HSL 价格架构",feat2:"排版与拼版智能",feat3:"即时生成品牌 PDF 报价"},section2:{title:"实时工厂智能",description:"将您的工厂车间转变为高透明度的数据环境。通过每个工作站的实时看板和终端扫描，您可以随时精确掌握每台机器上的每个作业进度。",feat1:"实时生产看板",feat2:"QR 驱动的工作站终端",feat3:"实时人工与时间分析"},section4:{title:"财务智能与账簿",description:"专为印刷行业构建的财务核心。从自动生成符合 SST 标准的发票到完全集成的账簿，我们确保您的现金流与您的印刷一样精准。",feat1:"自动 SST/VAT 税务处理",feat2:"集成专业账簿",feat3:"付款追踪与提醒"},section5:{title:"人力资本与考勤",description:"管理您最宝贵的资产——员工。集成的生物识别考勤直接接入自动化薪资系统，确保您的生产团队充满动力并获得应有的报酬。",feat1:"生物识别考勤机",feat2:"自动化薪资计算",feat3:"员工佣金与绩效追踪"},section3:{title:"统一物流与供应",description:"弥合原材料与成品之间的差距。我们的智能库存系统追踪每一克油墨和每一张纸，确保您在生产过程中永不中断。",feat1:"智能材料阈值警报",feat2:"供应商履约网关",feat3:"实时物流与货运追踪"},section6:{title:"针对各垂直行业的解决方案",description:"PrintOS 不是一个通用的工具。我们构建了行业特定的工作流程，了解您特定印刷行业的独特物理特性和经济效益。",feat1:"商业胶印与轮转",feat2:"折叠纸盒与包装",feat3:"数码与大宽幅"},section7:{title:"企业级信任与安全",description:"您的数据是您最宝贵的资产。我们通过银行级加密和确保 99.9% 正常运行时间的全球基础设施来保护它，即使在生产高峰期也是如此。",feat1:"AES-256 数据加密",feat2:"99.9% SLA 云连接",feat3:"每日自动备份"}}}},JP={elevateTitle:"提升您的",printingOperations:"印刷业务",heroDescription:"使用我们为现代化效率而设计的专业级人工智能系统，管理您的整个印刷厂。",reliability:"可靠性",support:"客户服务",cloudBase:"云平台",welcomeBack:"欢迎回来",signInSubtitle:"登录您的专业工作空间",workEmail:"工作邮箱",securePassword:"安全密码",forgot:"忘记了？",accessWorkspace:"进入工作空间",quickAccess:"快速系统访问",roles:{admin:"管理员",manager:"经理",worker:"员工",customer:"客户",supplier:"供应商",kiosk:"自助终端",adminDesc:"完全访问权限",managerDesc:"分析与报告",workerDesc:"生产一线",customerDesc:"订单追踪",supplierDesc:"供应链",kioskDesc:"考勤"},errors:{invalidCredentials:"凭据无效。请重试。"},copyright:"© 2024 Pioneer Cetak. Secure Access Portal v1.0"},WP={dashboard:"仪表板",orders:"订单",newOrder:"新建订单",requestQuote:"申请报价",invoices:"我的发票",support:"帮助与支持",materials:"材料库",jobBoard:"工作看板",productionTracking:"生产追踪",layoutPlanner:"排版规划",inventory:"库存",qualityControl:"质量控制",attendance:"考勤管理",accounting:"会计",payroll:"工资单",commission:"提成",analytics:"数据分析",administration:"系统管理",descriptions:{dashboard:"概览与快速操作",orders:"管理印刷作业",newOrder:"下新订单",requestQuote:"获取项目报价",invoices:"查看并下载发票",support:"获取帮助",materials:"浏览纸张与后期加工",jobBoard:"看板作业状态",productionTracking:"实时监控",layoutPlanner:"计算拼版布局",inventory:"管理库存水平",qualityControl:"质量保证",attendance:"生物识别考勤",accounting:"财务管理",payroll:"员工管理",commission:"佣金管理",analytics:"商业智能",administration:"系统管理"}},zP={main:"主菜单",operations:"业务运营",hrFinance:"人事与财务",system:"系统设置"},YP={welcome:"欢迎回来，{{name}}",overview:"纵览",description:"以下是您印刷厂今天的运营情况。",downloadReport:"下载报告",newCampaign:"新建活动",portal:"客户门户",projectInfo:"追踪您的订单并管理您的印刷项目。",totalRevenue:"总收入",activeOrders:"活动订单",pendingQuotes:"待定报价",customers:"客户总数",fulfillmentRate:"交付率",profitMargin:"利润率",recentOrders:"最近订单",viewAll:"查看全部",status:"状态",date:"日期",orderId:"订单编号",customer:"客户",product:"产品",total:"总计",revenueTrends:"收入趋势",dailyPerformance:"每日收入表现",quickActions:"快速操作",newOrder:"新建订单",addCustomer:"添加客户",inventory:"库存管理",reports:"报表",liveActivity:"Live Activity",placedOrder:"{{name}} 下了一个关于 {{product}} 的新订单",hoursAgo:"{{count}} 小时前",orderInfo:"订单详情",noRecentOrders:"未发现最近订单。",mon:"周一",tue:"周二",wed:"周三",thu:"周四",fri:"周五",sat:"周六",sun:"周日",jan:"1月",feb:"2月",mar:"3月",apr:"4月",may:"5月",jun:"6月",spendingTrend:"支出趋势",orderStatus:"订单状态",completed:"已完成",inProgress:"进行中",pending:"待处理",confirmed:"已确认",quality_check:"质检中",delivered:"已送达",cancelled:"已取消",orderManagement:"订单管理",orderManagementDesc:"在一处追踪和管理所有印刷订单。",orderDetails:"订单细节",customPrint:"定制印刷",amount:"金额",totalOrders:"订单总数",filter:"筛选",searchPlaceholder:"搜索订单ID、客户...",viewMode:"视图模式",unknown:"未知",actions:"操作",inProduction:"生产中",vsLastMonth:"环比上月",newToday:"今日新增",actionNeeded:"需处理",totalCustomers:"客户总数",thisWeek:"本周",placedNewOrder:"{{customer}} 下了一个关于 {{product}} 的新订单"},QP={title:"财务管理",hub:"财务中心",hubDesc:"从单一中心监管所有财务运营。",loading:"正在加载模块...",dashboard:"仪表板",generalLedger:"总账",chartOfAccounts:"会计科目表",bankRecon:"银行对账",financialReports:"财务报告",salesReports:"销售报告",fixedAssets:"固定资产",liabilities:"负债",ar:"应收账款",creditNotes:"贷记单",ap:"应付账款",purchaseOrders:"采购订单",cheques:"支票",expenses:"费用",inventory:"库存",eInvoicing:"电子发票",customers:"客户",suppliers:"供应商",materials:"材料",commission:"提成",payrollHr:"工资与人力资源",gl_section:{hero_subtitle:"会计核心",hero_title:"总账",hero_desc:"所有财务交易和日记账分录的完整记录。",stats:{total_debits:"借方总额",total_credits:"贷方总额",balance:"余额",total_entries:"分录总数"},search_placeholder:"搜索分录...",all_accounts:"所有账户",columns:{date:"日期",reference:"参考号",description:"描述",account:"账户",debit:"借方",credit:"贷方",actions:"操作"},export:"导出",new_entry:"新增分录",no_entries:"未发现分录"},dashboard_section:{back_to_dashboard:"返回仪表板",total_revenue:"总收入",total_expenses:"总支出",net_profit:"净利润",outstanding_ar:"未结应收账款",vs_last_month:"环比上月",margin:"毛利",invoices:"发票",gl_title:"总账",gl_desc:"查看会计科目表、日记账分录和试算平衡表。",open_ledger:"打开账本",sst_title:"SST 汇总",sst_desc:"销售与服务税 (6%)",current_sst:"当前期间 SST",last_month:"上月",ytd:"年初至今",sst_mgmt:"SST 管理",commission_title:"提成汇总",commission_desc:"销售和推荐提成",total_commission_mtd:"本月至今提成总额",sales_agents:"销售代理",referral_partners:"推荐伙伴",manage_commissions:"管理提成",partners_title:"合伙人",partners_desc:"管理合伙人、资本和分配。",go_to_partners:"前往合伙人管理",materials_assets_title:"材料与资产",materials_assets_desc:"管理纸张、后期选项、板材和底模。",manage_materials:"管理材料",ap_title:"应付账款",ap_desc:"管理供应商账单、付款和未结余额。",manage_payables:"管理应付",po_title:"采购订单",po_desc:"创建并追踪材料采购订单。",manage_pos:"管理采购订单",cheques_title:"支票管理",cheques_desc:"追踪签发/收到的支票和银行状态。",manage_cheques:"管理支票",expenses_title:"费用支出",expenses_desc:"记录并分类运营费用。",manage_expenses:"管理费用",customer_accounts_title:"客户账户",customer_accounts_desc:"监控应收账款、账龄和信用额度。",view_customers:"查看客户",financial_perf_title:"财务表现",financial_perf_desc:"每月收入、支出和利润",revenue:"收入",expenses:"支出",profit:"利润",chart_ranges:{last_6_months:"最近 6 个月",last_12_months:"最近 12 个月",ytd:"年初至今",custom:"自定义范围"},expense_breakdown:"费用明细",materials_cogs:"材料 (销货成本)",material_usage_title:"材料使用与损耗报告",material_usage_desc:"追踪材料消耗和损耗指标",material_usage_cols:{order_no:"订单号",material:"材料",qty:"使用数量",cost:"成本 (预估)",delivery:"交付日期",staff:"员工",margin:"利润率"},no_material_data:"暂无材料数据",total_material_cost:"总材料成本",calculated_from_orders:"根据订单计算",avg_profit_margin:"平均利润率",across_all_orders:"所有订单平均值",avg_waste:"平均损耗",not_tracked:"未追踪"},reports_section:{hero_subtitle:"财务情报",hero_title:"财务报表",hero_desc:"全面的财务报表和绩效分析。",stats:{total_revenue:"总收入",total_expenses:"总支出",net_profit:"净利润",profit_margin:"利润率"},financial_perf_title:"财务表现",available_reports:"可用报表",reports:{income_statement:"损益表",income_statement_desc:"实时收入和支出摘要",balance_sheet:"资产负债表",balance_sheet_desc:"资产、负债和权益概览",trial_balance:"试算平衡表",trial_balance_desc:"借贷方余额核对",year_end_closing:"年终结账",year_end_closing_desc:"关闭当前财政年度并转入留存收益"},report_periods:{fy_2024:"2024 财年",current:"当前",full_ledger:"完整账本",action_required:"待处理"},closing_confirm:"您确定要关闭该财政年度吗？这将清空所有收入/支出账户，并将利润转入留存收益 (3100)。此操作不可逆。"},expenses_section:{hero_subtitle:"成本管理",hero_title:"费用管理",hero_desc:"追踪业务开支，并通过 AI 扫描管理费用类别。",stats:{total_expenses:"总支出",this_month:"本月",total_records:"总记录数",categories:"类别",lifetime:"终身",monthly:"每月",volume:"交易量",types:"类型"},columns:{date:"日期",category:"类别",description:"描述",provider:"供应商",amount:"金额",method:"方式",actions:"操作"},nav:{ledger:"分类账",categories:"类别"},search_placeholder:"搜索...",ai_scan:"AI 扫描",add_expense:"添加费用",no_expenses:"未发现费用记录",processing:"处理中...",view_details:"查看详情"},customers_section:{hero_subtitle:"CRM",hero_title:"客户管理",hero_desc:"管理客户资料、历史记录和余额。",stats:{total_customers:"客户总数",total_revenue:"总收入",total_orders:"订单总数",outstanding_balance:"未结余额",active:"活跃",lifetime:"终身",volume:"交易量",receivable:"应收"},columns:{name:"姓名",contact:"联系方式",orders:"订单",total_spent:"总消费",balance:"余额",actions:"操作"},search_placeholder:"通过姓名、公司、邮箱搜索客户...",add_customer:"添加客户",no_customers:"未发现客户",view_profile:"查看资料",edit:"编辑",individual:"个人",delete_confirm:"ID 为 {{id}} 的客户将被删除。此功能仅用于演示。"},suppliers_section:{hero_subtitle:"采购",hero_title:"供应商管理",hero_desc:"管理供应商关系、采购记录和应付款项。",stats:{total_suppliers:"供应商总数",total_payables:"应付总额",total_purchases:"采购总额",active_partners:"活跃伙伴",active:"活跃",outstanding:"未结",lifetime:"终身",operational:"运营中"},columns:{supplier:"供应商",category:"类别",contact:"联系方式",ap_balance:"应付余额",purchases:"采购记录",status:"状态",actions:"操作"},search_placeholder:"通过姓名、类别、联系方式搜索供应商...",add_supplier:"添加供应商",no_suppliers:"未发现供应商",supplier_portal:"供应商门户",pay_supplier:"支付供应商",manage_items:"管理项目",edit:"编辑",active:"活跃",inactive:"不活跃",id_label:"ID",no_email:"未提供邮箱",no_phone:"未提供电话",no_address:"未提供地址",total_purchases_label:"采购总额",balance_label:"余额",payment_terms_label:"付款条件",portal_btn:"门户",edit_btn:"编辑",pay_btn:"支付",items_btn:"项目",delete_confirm:"ID 为 {{id}} 的供应商将被删除。此功能仅用于演示。",categories:{paper:"纸张",printing_plates:"印刷版材",finishing:"后期加工",general:"通用"}},po_section:{hero_subtitle:"采购",hero_title:"采购订单",hero_desc:"管理供应商订单并追踪采购活动。",stats:{total_po_value:"采购单总额",pending_approval:"待审批",approved:"已审批",received:"已收到",active:"活跃",orders:"订单量",completed:"已完成"},columns:{po_number:"采购单号",supplier:"供应商",total:"总计",date:"日期",status:"状态",actions:"操作"},search_placeholder:"通过采购单号或供应商搜索...",generate_po:"生成采购单",no_pos:"未发现采购订单",due:"到期",ordered:"已订购",approve:"审批",reject:"拒绝",view:"查看",download:"下载",pdf:"PDF",details:"详情",statuses:{draft:"草案",pending_approval:"待审批",approved:"已审批",sent:"已发送",partially_received:"部分收到",fully_received:"全额收到",cancelled:"已取消",rejected:"已拒绝"},export:{brand:"PIONEER CETAK",title:"采购订单",from:"来自",supplier_label:"供应商",order_date:"日期",exp_delivery:"预估交付",total_value:"订单总价值",notes:"备注",cols:{item:"项目",desc:"描述",qty:"数量",price:"单价",total:"总计"}}},cheques_section:{hero_subtitle:"支付工具",hero_title:"支票管理",hero_desc:"追踪并管理应收和应付支票，支持 AI 扫描。",stats:{receivable:"应收",payable:"应付",pending:"待定",cleared:"已结算",inflow:"流入",outflow:"流出",processing:"处理中",completed:"已完成"},reminders:{to_deposit:"待存入支票",to_fund:"待支付支票",records:"记录",clear_7_days:"未来 7 天结算"},tabs:{receivables:"应收",payables:"应付"},columns:{cheque_number:"支票号",party_name:"相关方姓名",bank:"银行",amount:"金额",due_date:"到期日",status:"状态",actions:"操作"},search_placeholder:"搜索...",ai_scan:"AI 扫描",new_cheque:"新增支票",no_cheques:"未发现支票",settle:"结算",bounce:"退票",logs:"日志",processing_label:"处理中...",statuses:{pending:"待定",cleared:"已结算",bounced:"退票"},bounce_prompt:"请输入该支票退票的原因（例如 NSF，账户已关闭）：",no_reason:"未提供原因。"},accounts_payable:{hero_subtitle:"付款管理",hero_title:"应付账款",hero_desc:"追踪账单并高效管理供应商付款。",stats:{total_payable:"应付总额",pending:"待定",overdue:"逾期",paid:"已付"},columns:{bill_number:"账单号",supplier:"供应商",amount:"金额",due_date:"到期日",status:"状态",actions:"操作"},search_placeholder:"搜索账单...",all_statuses:"所有状态",no_payables:"未发现应付款项",statuses:{paid:"已付",pending:"待定",overdue:"逾期"}},accounts_receivable:{hero_subtitle:"现金流管理",hero_title:"应收账款",hero_desc:"监控未结发票并追踪入账款项。",stats:{total_receivable:"应收总额",pending:"待定",overdue:"逾期",collected:"已收"},columns:{invoice_number:"发票号",customer:"客户",amount:"金额",due_date:"到期日",status:"状态",actions:"操作"},search_placeholder:"搜索发票...",all_statuses:"所有状态",no_receivables:"未发现应收款项",statuses:{paid:"已付",pending:"待定",overdue:"逾期"}},fixed_assets:{hero_subtitle:"资产管理",hero_title:"固定资产",hero_desc:"追踪并管理公司资产、折旧和估值。",stats:{total_asset_value:"资产总值",total_depreciation:"总折旧",total_assets:"资产总数",avg_asset_value:"平均资产价值",items:"项目",per_asset:"每项资产"},columns:{asset_name:"资产名称",category:"类别",purchase_date:"购买日期",purchase_price:"购买价格",current_value:"当前价值",depreciation:"折旧",actions:"操作"},categories:{all:"所有类别",machinery:"机械",vehicles:"车辆",property:"物业",equipment:"设备"},search_placeholder:"搜索资产...",add_asset:"添加资产",no_assets:"未发现资产",view:"查看",edit:"编辑",delete:"删除"},liabilities_section:{hero_title:"负债",hero_subtitle:"财务监控",hero_desc:"监控并管理贷款、租赁和未结义务。",stats:{total_liabilities:"总负债",short_term:"短期",long_term:"长期",active_items:"活跃项",current_balance:"当前余额",payable_soon:"近期需付款",long_term_debts:"长期债务",active_loans:"活跃贷款"},search_placeholder:"搜索负债...",add_liability:"添加负债",no_liabilities:"未找到负债。",columns:{liability_name:"负债名称",type:"类型",remaining_balance:"剩余余额",issue_date:"发放日期",status:"状态",actions:"操作"},types:{all:"所有类型","short-term":"短期",long_term:"长期"},statuses:{active:"活跃",paid:"已付",overdue:"逾期"},view:"查看",edit:"编辑",delete:"删除"},e_invoice_section:{hero_subtitle:"税务合规",hero_title:"电子发票",hero_desc:"LHDN 电子发票合规性及提交追踪。",stats:{validated:"已验证",rejected:"已拒绝",submitted:"已提交",queue:"队列",compliant:"合规",action_req:"需处理",pending:"待定",to_send:"待发送"},registry:{title:"传输注册表",subtitle:"实时状态追踪系统",search_placeholder:"按发票 ID 或客户名称过滤...",no_transmissions:"未发现符合当前过滤条件的传输记录"},columns:{registry_id:"注册 ID",entity:"实体",commitment:"承诺",protocol_state:"协议状态",actions:"操作"},statuses:{validated:"已验证",rejected:"已拒绝",submitted:"已提交",draft:"草案"},inspect:"检查"},credit_notes_section:{hero_subtitle:"客户退款",hero_title:"贷记单",hero_desc:"签发并管理客户贷记单及退款。",stats:{total_value:"总贷记额",issued:"已签发",applied:"已应用",draft:"草案",count:"数量",utilized:"已使用",pending:"待定"},columns:{cn_number:"贷记单号",customer:"客户",ref_invoice:"参考发票",amount:"金额",date:"日期",status:"状态",actions:"操作"},statuses:{draft:"草案",issued:"已签发",applied:"已应用",voided:"已作废"},search_placeholder:"搜索贷记单...",all_statuses:"所有状态",issue_cn:"签发贷记单",no_cn:"未发现贷记单",view:"查看",download:"下载",pdf:{title:"贷记单",beneficiary:"受益人",date:"日期",ref_invoice:"参考发票",description:"描述",qty:"数量",unit_price:"单价",total:"总计",total_credit:"总贷记额",reason:"原因"}},bank_reconciliation:{hero_subtitle:"银行对账",hero_title:"账户对账",hero_desc:"自动核对银行交易与分类账分录。",import_statement:"导入对账单",import_coming_soon:"导入对账单功能即将推出。",search_placeholder:"搜索银行交易...",all_status:"所有状态",no_transactions:"未找到银行交易。",match:"核对",view_details:"查看详情",stats:{total_credits:"总存款",total_debits:"总支出",matched:"已核对",unmatched:"未核对",transactions:"笔交易",action_req:"需处理"},columns:{date:"日期",description:"描述",type:"类型",amount:"金额",status:"状态",actions:"操作"},types:{credit:"存款",debit:"支出"},statuses:{matched:"已核对",unmatched:"未核对"}},sales_reports:{hero_subtitle:"商业智能",hero_title:"销售报表",hero_desc:"分析销售绩效并识别增长机会。",stats:{total_revenue:"总收入",total_orders:"订单总数",active_customers:"活跃客户",avg_order_value:"平均订单价值"},charts:{sales_trend_title:"每月销售趋势",top_products_title:"热门产品",sales_label:"销售额",orders_label:"订单量"},products:{business_cards:"名片",brochures:"手册",flyers:"传单",posters:"海报",other:"其他"},months:{jan:"1月",feb:"2月",mar:"3月",apr:"4月",may:"5月",jun:"6月",jul:"7月",aug:"8月",sep:"9月",oct:"10月",nov:"11月",dec:"12月"},months_full:{january:"一月",february:"二月",march:"三月",april:"四月",may:"五月",june:"六月",july:"七月",august:"八月",september:"九月",october:"十月",november:"十一月",december:"十二月"}},account_types:{asset:"资产",liability:"负债",equity:"权益",revenue:"收入",expense:"费用"},payment_methods:{cash:"现金",bank_transfer:"银行转账",card:"银行卡",credit:"信用",cheque:"支票"},supplier_categories:{general:"通用",paper:"纸张",printing_plates:"印刷版材",finishing:"后期加工",printing:"印刷"},action_labels:{edit_expense:"编辑费用",delete_expense:"删除费用"},year_end:{income_statement:"年度损益表",ended_on:"截至 {{year}} 年 12 月 31 日止年度",revenue:"收入",sales_revenue:"销售收入",total_revenue:"总收入",expenses:"费用",total_expenses:"总费用",net_income:"净收入",assets:"资产",current_assets:"流动资产",cash_equivalents:"现金及现金等价物",ar:"应收账款",inventory:"存货",total_current_assets:"流动资产总额",non_current_assets:"非流动资产",ppe:"物业、厂房及设备",total_non_current_assets:"非流动资产总额",total_assets:"资产总额",liabilities:"负债",current_liabilities:"流动负债",ap:"应付账款",short_term_loans:"短期贷款",total_current_liabilities:"流动负债总额",non_current_liabilities:"非流动负债",long_term_loans:"长期贷款",total_non_current_liabilities:"非流动负债总额",total_liabilities:"负债总额",equity:"权益",owner_equity:"所有者权益",retained_earnings:"留存收益",total_equity:"总权益",total_liabilities_equity:"负债及权益总额",as_of:"截至 {{date}}",cash_flow:"现金流量表",operating_activities:"经营活动产生的现金流量",cash_from_customers:"来自客户的现金",cash_to_suppliers:"支付给供应商的现金",cash_to_operating:"支付经营费用的现金",net_operating:"经营活动产生的现金流量净额",investing_activities:"投资活动产生的现金流量",purchase_equipment:"购买设备",net_investing:"投资活动所用现金净额",financing_activities:"筹资活动产生的现金流量",proceeds_loans:"贷款所得款项",repayment_loans:"偿还贷款",net_financing:"筹资活动产生的现金流量净额",net_increase_cash:"现金净增加额",cash_beginning:"年初现金余额",cash_end:"年终现金余额",ledger_summary:"总账摘要",description:"描述",debit_rm:"借方 (RM)",credit_rm:"贷方 (RM)",tax_summary:"年度税务摘要",sst_summary:"SST 摘要",total_sales:"总销售额 (应税)",total_sst:"SST 总额",corporate_tax_summary:"公司税摘要",taxable_income:"应纳税所得额",tax_rate:"有效税率",est_tax:"预估应交税费",payment_schedule:"付款计划",sst_payments:"SST 付款",tax_installments:"分期缴纳税款 (CP204)",compliance_notes:"税务合规说明",compliance_1:"1. 确保所有 SST 申报表 (SST-02) 已提交。",compliance_2:"2. 记录保存至少 7 年。",compliance_3:"3. 核对 CPF/SOCSO 缴纳情况与记录是否一致。",valuation_report:"存货估值报告",paper_inventory:"纸张存货",item:"项目",quantity:"数量",unit_price:"单价",total_value:"总价值",material_inventory:"材料存货",total_inventory_value:"存货总价值"}},XP={common:{cancel:"取消",close:"关闭",save_changes:"保存更改",discard:"放弃"},journal:{title:"新期初日记账",subtitle:"记录手动交易",effective_date:"生效日期",general_description:"总体说明",narrative_placeholder:"例如，每月折旧调整...",entry_lines:"分录行",add_segment:"添加分录",account:"账户",description:"说明",debit_rm:"借方(RM)",credit_rm:"贷方(RM)",actions:"操作",select_account:"选择账户...",line_placeholder:"行说明...",segment_account:"分录账户",choose_account:"选择账户...",line_description:"行说明",debits:"总借方",credits:"总贷方",balanced:"已平衡",imbalance:"未平衡",commit:"提交分录",min_lines_error:"平衡的分录最少需要2行"},asset_form:{title_edit:"编辑资产",title_add:"添加资产",subtitle:"记录并追踪业务资产和折旧",main_specs:"主要规格",name:"资产名称",date:"购买日期",cost:"购买成本",amortization:"摊销 / 折旧",method:"折旧方法",straight_line:"直线法",none:"无（不折旧）",life:"使用年限（年）",salvage:"残值",discard:"放弃",commit:"提交资产"},liability:{edit:"编辑负债",record:"记录负债",subtitle:"注册新的贷款、租赁或其他义务",core_info:"核心信息",name:"负债名称",name_placeholder:"例如，设备融资...",lender:"贷款人 / 债权人",lender_placeholder:"银行或机构...",classification:"分类",long_term:"长期负债",short_term:"短期负债",amortization:"摊销详情",principal:"本金金额",interest:"年利率（%）",apr:"年化利率%",term:"期限长度",months:"月数",save_obligation:"保存债务"},year_end_close:{title:"年终结账",desc:"完成您的会计年度。此过程将锁定历史期间并结转余额。",reports_title:"所需报告",reports_desc:"将生成并保存结账年度以下报告:",income_statement:"损益表",income_statement_desc:"年度利润和损失摘要。",balance_sheet:"资产负债表",balance_sheet_desc:"期终资产、负债及权益状况。",cash_flow:"现金流量表",cash_flow_desc:"经营、投资和筹资现金流。",general_ledger:"总分类账",general_ledger_desc:"完整交易记录。",tax_summary:"税务摘要",tax_summary_desc:"SST及其他税务义务。",inventory_valuation:"库存估值",inventory_valuation_desc:"年终盘点及估值。",fiscal_info_title:"财务周期信息",current_year:"结账年份",new_year:"新财政年度",closing_date:"结账日期",start_date:"新开始日期",warning_title:"重要通知",warning_desc:"年终结账不可撤销。所有结账日之前的交易将被锁定。请确保所有调整、折旧和应计费用已过账。",processing_title:"正在处理年终结账",processing_desc:"正在结清您的财年，请稍候。请不要关闭此窗口。",gen_reports:"正在生成财务报告...",verify_balances:"正在验证账户余额...",closing_ledgers:"正在结清洗收入和支出分类账...",finalizing:"正在完成新的财政年度...",complete_title:"年终结账完成",complete_desc:"财政年度 {{year}} 已成功结账。所有所需报告已生成并保存。",generated_reports_label:"生成的报告（PDF）",required:"必填",ready_to_close:"准备结账",begin_close:"开始年终结账",done:"完成"},supplier_portal:{date:"日期",balance:"余额",abort_access:"中止访问",all_synced:"全部同步",auth_required:"需要授权",close_portal:"关闭门户",complete:"完成",credit:"贷记",critical_tasks:"关键任务",debit:"借记",export:"导出",financial_ledger:"财务账本",gateway_login:"网关登录",inspect_order:"检查订单",narrative:"说明",net_payables:"净应付款",no_history:"无历史记录",no_tasks:"无任务",node_synced:"节点同步",outstanding:"未结",payments:"付款",purchases:"采购",queue_size:"队列大小",receive:"接收",registry:"注册表",start_job:"开始工作",summary:"摘要",syncing:"同步中",unit:"单位",view_reference:"查看参考",work_queue:"工作队列",yield_value:"产出值"},expense_form:{title_add:"添加费用",title_edit:"编辑支出",subtitle:"记录新付款或未结账单",error_cheque:"支票付款需要支票详情",payment:"付款详情",payment_method:"付款方式",cash:"现金/银行转账",cheque:"支票",date:"日期",amount:"金额",invoice:"发票号码",supplier:"供应商 (可选)",select_supplier:"选择供应商...",cheque_details:"支票详情",cheque_number:"支票号码",bank_name:"银行名称",due_date:"到期日",classification:"分类",category:"类别",description:"描述",description_placeholder:"详情...",save:"保存支出",ref_number:"参考编号",discard:"放弃",save_btn:"保存费用"},income_form:{title_add:"记录收入",title_edit:"编辑收入",subtitle:"记录收到的付款和收入",error_cheque:"需要支票详情",payment:"付款详情",payment_method:"付款方式",cash:"现金/银行转账",cheque:"支票",date:"日期",amount:"金额",reference:"参考号码",customer:"客户（可选）",select_customer:"选择客户...",cheque_details:"支票详情",cheque_number:"支票号码",bank_name:"银行名称",deposit_date:"存款日期",classification:"分类",category:"类别",description:"描述",description_placeholder:"收入来源...",save:"保存收入"},payment_processor:{process_title:"处理付款",processing:"处理中...",payment_summary:"付款摘要",payment_type:"付款类型",select_quantity:"选择数量",select_file:"选择文件",per_unit:"单价",pieces:"件",upload_proof:"上传凭证",summary_cheque:"支票摘要",summary_method:"方式",summary_proof:"凭证",summary_total:"总计",summary_type:"类型"},purchase_order_form:{title_add:"新建采购订单",title_edit:"编辑采购订单",subtitle:"创建给供应商的订单",error_supplier:"请选择供应商",supplier:"供应商",select_supplier:"选择供应商...",expected_delivery:"预计交货",order_date:"订单日期",notes:"备注",notes_placeholder:"补充说明...",order_items:"订单项目",item_name:"项目名称",item_desc:"描述",item_qty:"数量",item_price:"单价",add_item:"添加项目",subtotal:"小计",total_order:"总计",confirm:"确认订单"},scan_cheque:{title:"扫描支票",document_source:"文档来源",review_extractions:"审核提取内容",verify_details:"验证详情",labels:{bank:"银行",choose_entity:"选择实体",date:"日期",link_account:"关联账户",maturity:"到期日",type:"类型",value:"金额"},types:{payable:"应付",receivable:"应收"},actions:{capture_now:"立即拍摄",confirm:"确认",library_upload:"从库上传",processing:"处理中...",recapture:"重新拍摄"}},scan_invoice:{title:"扫描发票",subtitle:"AI 提取",upload_title:"上传发票",upload_desc:"拖放或点击上传",source:"来源",processing:"处理中...",error_extract:"提取失败",error_required:"缺少必填字段",verify_title:"验证发票",verify_subtitle:"检查提取的数据",ai_confidence:"AI 置信度",classification:"分类",merchant:"商户",date:"日期",invoice_num:"发票号码",description:"描述",value:"金额",matched:"已匹配",save:"保存",recapture:"重新拍摄",capture_now:"立即拍摄",library_upload:"从库上传"},supplier_categories:{finishing:{label:"印后加工",desc:"印后服务"},general:{label:"一般",desc:"一般耗材"},paper:{label:"纸张",desc:"纸张库存"},printing:{label:"印刷",desc:"印刷服务"},printing_plates:{label:"印版",desc:"制版"}},supplier_form:{title_add:"添加供应商",title_edit:"编辑供应商",subtitle:"管理供应商配置文件",info_section:"信息",company_name:"公司名称",contact_person:"联系人",email:"电子邮件",phone:"电话",address:"地址",tin:"纳税识别号 (TIN)",payment_section:"付款条件",credit_term:"信用期限（天）",portal_section:"门户访问",username:"用户名",password:"密码",save_btn:"保存供应商",delete_confirm:"您确定要删除此供应商吗？",warning:"警告",errors:{contact:"联系人必填",email:"电子邮件必填",name:"名称必填",password:"密码必填",username:"用户名必填"},category_prompt:"此供应商提供什么？",payment_terms:"付款条件",credit_limit:"信用额度",terms_category:"条款类别",portal_access:"门户访问权限"},credit_note_form:{title_add:"开具信用票据",subtitle:"为客户提供信用余额",customer:"客户",date:"日期",original_invoice:"原发票 (可选)",select_invoice:"选择发票...",items_services:"项目/服务",add_item:"添加项目",reason_notes:"原因 / 备注",reason_placeholder:"例如损坏的货物、多收取的费用等。",total_credit:"总信用额度",discard:"放弃",save_btn:"开具信用票据"},cheque_form:{title_add:"记录支票",subtitle:"记录收到的或开出的支票",direction:"方向",receivable:"应收支票",payable:"应付支票",issuer:"出票人/收款人",select_acc:"选择账户...",number:"支票号码",bank:"银行名称",face_value:"票面价值",issue_date:"开票日期",audit_notes:"参考信息",discard:"放弃",save_btn:"保存支票"},customer_form:{title_add:"添加客户",subtitle:"创建新的客户档案",section_info:"基本信息",name:"公司 / 全名",email:"电子邮件",phone:"电话号码",tin:"纳税识别号 (TIN)",address:"账单地址",section_portal:"门户访问权限",cancel:"取消",save_btn:"保存客户"}},ZP={title:"库存管理",materialLibrary:"物料库",stockManagement:"库存管理",stockManagementDesc:"集中式库存监控及供应链管理。",catalogItems:"目录项目",lowStockAlerts:"低库存预警",stockAssetValue:"库存资产价值",stockOverview:"库存概览",warehouses:"仓库",stockTransfers:"库存转移",history:"历史记录",newTransfer:"新建转移",recentTransfers:"最近转移",allGood:"正常",items:"项目",paper:"纸张",sheets:"张",itemDetails:"项目详情",inStock:"有货",minLevel:"最低水平",status:"状态",actions:"操作",adjust:"调整",paperStock:"纸张库存",consumable:"耗材",low:"低",good:"良",totalItems:"总项目",stockValueEst:"库存资产价值",searchPlaceholder:"搜寻库存...",allStages:"所有阶段",clearFilters:"清除过滤器",allTypes:"所有类型",addItem:"添加项目",addWarehouse:"添加仓库",default:"默认",code:"代码",edit:"编辑",setAsDefault:"设为默认",dateTime:"日期时间",type:"类型",material:"物料",quantity:"数量",cost:"成本",location:"位置",user:"用户",purchase:"采购",usage:"使用",transfer:"转移",noTransactions:"未发现库存交易记录。",catalog:{title:"物料库",subtitle:"目录",description:"探索我们广泛的基材、专业加工选项和印刷设备。",search:"搜索物料...",paper:"纸张",finishing:"加工",printing:"印刷",paperTypes:"纸张类型",finishingOptions:"加工选项",printingMethods:"印刷方式",plates:"印版",blocks:"模具"},materials:"材料",general:"通用库存"},eI={title:"合伙人管理",equityDistributions:"股权及分配",equityDistributionsDesc:"监督合伙人股权、出资和分配。",capitalVsDistributions:"资本 vs 分配",addPartner:"添加合伙人",addNew:"新增",noPartners:"未发现合伙人",noTransactions:"未发现交易",totalCapital:"总资本",totalDistributions:"总分配",netPartnerEquity:"合伙人净资产",invested:"已投入",paidOut:"已支出",retained:"已留存",ownership:"所有权",netEquity:"净资产",partner:"合伙人",type:"类型",date:"日期",amount:"金额",notes:"备注",dashboard:"仪表板",partners:"合伙人",contributions:"出资",distributions:"分配",types:{founder:"创始人",investor:"投资者",strategic:"战略合伙人"},editPartner:"编辑合伙人",addNewPartner:"添加新合伙人",profilePhoto:"资料照片",uploadImage:"上传图片",fullName:"全名",emailAddress:"邮箱地址",phoneNumber:"电话号码",partnerType:"合伙人类型",ownershipPercentage:"所有权 %",joinDate:"加入日期",transferOwnershipFrom:"转移所有权自",totalContribution:"总出资",totalDistribution:"总分配",phone:"电话",close:"关闭",saveChanges:"保存修改",joined:"已加入",errorNoTransfer:"您必须从现有合伙人处转移部分所有权。",errorIncompleteOwnership:"当前总所有权为 {{current}}%，不是 100%。在修正此问题前无法添加新合伙人。",errorIncompleteOwnershipShort:"总所有权 ({{current}}%) 必须为 100%。"},tI={roles:{addRole:"添加新角色",editRole:"编辑角色",roleName:"角色名称",description:"角色描述",permissions:"分配权限",cancel:"取消",saveRole:"保存角色"},settings:{title:"管理",subtitle:"系统设置",description:"管理全局设置、用户和系统配置。",userManagement:"用户管理",userManagementDesc:"管理员工帐户和访问权限。",rolesPermissions:"角色与权限",rolesPermissionsDesc:"配置基于角色的访问控制。",adminPower:"管理员权限设置",adminPowerDesc:"系统范围的管理覆盖。",companyInformation:"公司信息",companyInformationDesc:"业务详细信息和品牌。",themeBranding:"主题和品牌",themeBrandingDesc:"自定义外观和感觉。",financialSettings:"财务设置",financialSettingsDesc:"配置税收、货币和会计。",aiChatbot:"AI 助手",aiChatbotDesc:"配置智能助手。",productionSettings:"生产设置",productionSettingsDesc:"管理机器、材料和工作流程。",hrPayroll:"人力资源与工资单",hrPayrollDesc:"员工记录和工资。",documentDesigner:"文档设计器",documentDesignerDesc:"自定义发票和采购订单模板。",auditTrail:"审计追踪",auditTrailDesc:"跟踪系统活动和更改。",integrations:"集成",integrationsDesc:"连接第三方服务。",deliveryManagement:"交付管理",deliveryManagementDesc:"配置交付方式和车队。",back:"返回设置",loading:"正在加载模块..."}},nI={production:{title:"生产概览",subtitle:"生产车间",description:"实时生产监控和效率指标。",systemOperational:"系统运行中",dailyOutput:"今日产量",onTimeDelivery:"准时交付率",qualityScore:"质量评分",equipmentUptime:"设备运行时间",activeProduction:"活跃生产",active:"活跃",noActiveOrders:"当前无活跃生产订单。",systemStatus:"系统状态",teamPerformance:"团队绩效",tasks:"任务"},layoutPlanner:{title:"排版规划",subtitle:"生产规划",description:"优化纸张利用率并计算排版配置。",exportLayout:"导出排版",paperStock:"纸张库存",source:"来源",standard:"标准",custom:"自定义",size:"尺寸",width:"宽度",height:"高度",artwork:"稿件",bleedGutter:"出血位与出血槽 ({{unit}})",sheetMargins:"印张边距 ({{unit}})",readyToCalculate:"准备计算产出率",enterParameters:"输入参数以查看排版",efficiency:"效率",totalYield:"总产出",ups:"开数 (UPS)",gripArea:"咬口区域"},qualityControl:{title:"质量控制",subtitle:"质量保证",description:"全面的质量监控和缺陷追踪。",summary:"摘要",inspections:"检查记录",standards:"标准",defects:"缺陷",qualityScore:"质量评分",passRate:"合格率",checksToday:"今日检查",avgTime:"平均耗时",qualityTrends:"质量趋势",defectAnalysis:"缺陷分析",detailedDefectAnalysis:"详细缺陷分析",noDefectsRecorded:"尚未记录缺陷数据",searchInspections:"搜索检查记录...",allStatus:"所有状态",pending:"待处理",inProgress:"处理中",passed:"通过",failed:"不通过",requiresRework:"需返工",newCheck:"新检查",export:"导出",order:"订单",type:"类型",inspector:"检查员",status:"状态",score:"评分",noInspectionsFound:"未发现检查记录",tryAdjustingFilters:"请尝试调整搜索或筛选条件",qualityStandards:"质量标准",newStandard:"新标准",minimumScore:"最低评分"},machineTracker:{title:"机器控制中心",description:"实时设备追踪和成本分配",activeMachines:"{{count}} 台活跃机器",running:"运行中",idle:"空闲",job:"工作",operator:"操作员",unknownOperator:"未知操作员",stopMachine:"停止机器",assignJob:"分配工作",selectJob:"选择工作...",start:"开始",cancel:"取消",failedToStart:"启动机器失败",failedToStop:"停止机器失败"}},iI={dashboard:{totalSpent:"总支出",recentOrders:"最近订单",viewAll:"查看所有历史记录",orderInfo:"订单信息",portal:"客户门户",projectInfo:"追踪您的订单、报价和账单。"}},oI={wizard:{method:{title:"印刷方式与数量",subtitle:"选择您的印刷机器并指定数量",machineLabel:"印刷机器 *",quantityLabel:"数量阶梯 *",addTier:"+ 添加阶梯",colors:"颜色",qtyPieces:"数量 (件)",pricePerUnit:"单价 (RM)",tip:"💡 提示：",qtyTip:"添加多个数量阶梯以提供大宗折扣。价格将根据您的纸张和印刷成本自动计算。",selectedMachine:"已选机器",tierCount:"已配置 {{count}} 个数量阶梯",tierCount_plural:"已配置 {{count}} 个数量阶梯"},paper:{title:"选择纸张",subtitle:"为您的印刷作业选择纸张类型、厚度和尺寸",typeLabel:"纸张类型 *",thicknessLabel:"纸张厚度 *",sizeLabel:"纸张尺寸 *",standard:"标准尺寸",custom:"自定义尺寸",width:"宽度",height:"高度",unit:"单位",selected:"已选纸张"},finishing:{clearAll:"全部清除",externalProvider:"外部供应商",inhouse:"内部生产",blockRequired:"需要模具/工具",new:"新建",reuse:"重用",title:"后期加工选项",subtitle:"添加专业的后期加工选项以提升印刷质量（可选）",optionsLabel:"可选后期加工",selectedCount:"（已选 {{count}} 项）",noOptions:"无可用后期加工选项",selectedOptions:"已选后期加工选项",tip:"💡 提示：",tipText:"后期加工选项是可选的，但可以显著提升印刷品的品质和外观。点击任意选项进行选择或取消选择。",list:"列表",grid:"网格",expand:"展开目录",collapse:"收起目录",searchPlaceholder:"搜索加工工艺...",quickSelect:"-- 快速选择工艺 --",zoomHint:"查看大图",noMatch:'没有找到匹配 "{{term}}" 的加工工艺',activeOptions:"已选工艺",provider:"供应商",newBlock:"新建",reuseBlock:"重用",blockWidth:"模具宽度 (cm)",blockHeight:"模具高度 (cm)",specifyArea:"指定加工区域",widthCm:"宽 (cm)",heightCm:"高 (cm)",unitPrice:"单价",processTotal:"工艺总计",resetAuto:"重置为自动计算",empty:"工作流为空",emptyPick:"从上方的库或列表中选择一个工艺",totalCost:"加工总成本",totalDesc:"所有活动工艺的总和"},customer:{title:"此订单是为谁准备的？",subtitle:"选择现有客户或使用散客选项",registered:"注册客户",walkin:"散客/临时客户",change:"更改",selectLabel:"选择客户",selectDesc:"点击从客户列表中选择",guestName:"客全名 *",guestNamePlaceholder:"发票显示的名称",contactNum:"联系电话",optional:"(可选)",phonePlaceholder:"电话号码",emailLabel:"电子邮箱",emailPlaceholder:"电子邮箱地址",jobTitle:"项目标题 *",jobPlaceholder:"例如：名片、宣传册、海报...",jobDesc:"为此印刷作业起一个描述性的名称",commission:"佣金人员",hide:"隐藏",addCommission:"添加佣金",selectCommission:"选择佣金人员...",addNewCommission:"添加新佣金人员",tip:"💡 提示：",walkinTip:"对于不需要在系统中建立永久账户的客户，请使用散客模式。",registeredTip:"注册客户允许您跟踪订单历史并管理信用额度。"},review:{headerTitle:"核对并提交",headerSub:"提交前请核对您的订单详情",customerJob:"客户与项目信息",guestInfo:"访客信息",customer:"客户",walkinCustomer:"散客",noSelected:"未选择",jobTitle:"项目标题",untitled:"未命名项目",paper:"纸张规格",type:"纸张类型",thickness:"厚度",size:"尺寸",printing:"印刷方式",machine:"机器",quantities:"数量",finishing:"后期加工",noFinishing:"未选择后期加工",pricing:"价格详情",subtotal:"小计",discount:"折扣",extraCharge:"额外费用",sst:"消费税",grandTotal:"总计",noteLabel:"💡 提示：",noteText:"请仔细核对所有详情。一旦提交，此订单将加入您的生产队列。您可以返回任何之前的步骤进行更改。",title:"核对订单",subtitle:"请在提交前核对所有详情",noteDesc:"请仔细核对所有详情。一旦提交，此订单将加入您的生产队列。您可以返回任何之前的步骤进行更改。"}},newOrder:"新建印刷订单",newQuote:"新建报价请求",stepOf:"第 {{current}} 步，共 {{total}} 步",customerJob:"客户与项目信息",customer:"客户",paperSelection:"纸张选择",paper:"纸张",printingMethod:"印刷方式与数量",printing:"印刷",finishingOptions:"后期加工",finishing:"后期加工",reviewSubmit:"核对并提交",review:"核对",livePreview:"实时预览",draft:"草稿",back:"返回",saving:"正在保存...",saveDraft:"保存草稿",submitting:"正在提交...",submitOrder:"提交生产订单",submitQuote:"提交正式报价",continue:"继续",invoiceEstimate:"发票估算",backEditing:"返回编辑",visualPreview:"视觉预览",selectedPaper:"已选纸张",noPaper:"未选择纸张",noFinishing:"未选择加工工艺",clickEnlarge:"点击放大",zoomedView:"放大的视图",pcs:"个",customerSelector:{title:"选择客户",subtitle:"活跃客户目录",addNew:"添加新客户",walkIn:{title:"散客 / 一次性",subtitle:"无需注册，快速结账",account:"系统账户"},noResults:"查无结果",adjustParams:"调整您的参数",targetAccount:"目标账户",cancel:"取消"},specifications:{standardSize:"标准尺寸",customDimensions:"自定义尺寸",width:"宽度",height:"高度",thickness:"克重 / 厚度",selectThickness:"选择厚度",sheetSize:"张纸尺寸",selectSize:"选择尺寸",paperCost:"计算纸张成本",methodType:"方法类型",selectType:"选择类型"},pricing:{quantity:"数量",price:"价格",addAnother:"添加另一个数量",applyDiscount:"应用折扣",applyExtraCharge:"应用额外费用",subtotal:"小计",discount:"折扣",extraCharge:"额外费用",sst:"SST",totalAmount:"总金额"},invoicePreview:{title:"发票",issueDate:"签发日期",description:"描述",total:"合计",included:"已包含",grandTotal:"总计"},bookletPreview:{title:"小册子预览",subtitle:"将您的 PDF 可视化为翻页书",viewAgain:"再次查看",uploadPdf:"上传 PDF 书籍",uploadValidPdf:"请上传有效的 PDF 文件。"},invoice:{paymentDue:"付款期限为 30 天",officialInvoice:"正式发票",untitledProject:"无标题打印项目",finishingService:"精密印后处理服务",status:{draft:"临时草案",pending:"等待支付",paid:"已结算并验证",overdue:"已过期 - 逾期"},watermark:"草案副本",recipientBilling:"收件人与账单",notRegistered:"未注册",tel:"电话",email:"电子邮件",issuedOn:"发布日期",validUntil:"有效期至",netPayable:"应付净额",particulars:"项目细则",volume:"数量",unitRate:"单价",amount:"金额",subtotal:"项目小计",promotionDisc:"促销折扣",expeditedSurcharge:"加急附加费",taxLevy:"税款",totalValuation:"总价值",currency:"马来西亚令吉",taxId:"税号",statusLabel:"状态",ref:"编号"},preview:{documentInspection:"文档检查",liveMirror:"实时高分辨率镜像",zoomIn:"放大",zoomOut:"缩小",resetZoom:"重置缩放",printDocument:"打印文档",precisionDraft:"精密 A4 工程草案 • 版本 2.0.4",highConsistency:"高一致性模式",clickEnlarge:"点击放大"},job:"次"},sI={title:"佣金管理",compensation:"销售酬劳",description:"追踪和管理销售佣金及付款。",payout:"佣金支出",beneficiary:"受益人",amount:"金额",reference:"参考",order:"订单",created:"创建日期",cancel:"取消",confirmPayment:"确认付款",processed:"已处理",paymentNotFound:"未找到付款",totalCommission:"总佣金",pendingPayout:"待支佣金",activePartners:"活跃合作伙伴",salesMtd:"本月销售额",monthlyCommission:"本月佣金",agentDistribution:"代理分布",topPerformers:"绩效之星",earned:"已领",pending:"待领",searchAgents:"搜索代理...",allTypes:"所有类型",salesAgent:"销售代理",referralPartner:"推荐伙伴",affiliate:"联属伙伴",addAgent:"添加代理",rate:"费率",noAgents:"未找到代理。",searchPayments:"搜索付款...",allStatus:"所有状态",paid:"已付",exportHistory:"导出历史",pay:"付款",noPayments:"未找到付款记录。",period:"期间",currentMonth:"本月",previousMonth:"上月",thisYear:"今年",allAgents:"所有代理",download:"下载",totalPaid:"已付总计",transactions:"交易记录",commissionByAgent:"代理佣金详情",transactionLedger:"交易分类账",noDataFound:"这段期间内没有数据",summary:"摘要",agents:"代理人",payments:"付款",reports:"报告",types:{sales_agent:"销售代理",referral_partner:"推荐伙伴",affiliate:"联属伙伴"}},rI={title:"工资与人力资源管理",workforceManagement:"员工管理",description:"管理公司人员、工资发放和考勤跟踪。",summary:"概况",directory:"员工名录",payroll:"工资单",attendance:"考勤",roles:"角色",totalHeadcount:"总人数",totalPayroll:"工资总额",attendanceRate:"出勤率",activeDepts:"活跃部门",deptDistribution:"部门分布",monthlyExpenditure:"每月支出",payslip:"员工工资单",period:"发薪期",employee:"员工",position:"职位",date:"日期",earnings:"收入",description_label:"描述",amount_rm:"金额 (RM)",baseSalary:"基本工资",bonus:"奖金",gross:"税前总额",deductions:"扣款",statutoryDeductions:"法定扣款",total:"总计",netPay:"实发工资",unassigned:"未分配",deleteConfirm:"您确定要删除这名员工吗？",searchEmployees:"搜索员工...",allDepartments:"所有部门",addEmployee:"添加员工",role:"角色",department:"部门",email:"邮箱",actions:"操作",noEmployees:"未找到员工",payrollRegister:"工资单寄存器",payrollDesc:"查看并生成员工工资单。",runPayroll:"运行工资单",generateSlip:"生成工资单",noPayrollData:"无工资单数据",searchLogs:"搜索日志...",viewReports:"查看报告",clockIn:"上班打卡",clockOut:"下班打卡",status:"状态",hours:"工时",hours_label:"小时",noAttendance:"未找到考勤记录",rolesPermissions:"角色与权限",rolesDesc:"管理系统访问级别和权限。",newRole:"新角色",noRoles:"未定义角色",createFirstRole:"创建第一个角色",present:"出勤",absent:"缺勤",late:"迟到",ot_hours:"加班工时",ot_pay:"加班费",ot_report_btn:"加班报告",failed_payslip:"生成工资单失败。",hrs:"小时",attendance_kiosk:{title:"考勤自助终端",subtitle:"使用生物识别进行安全打卡",select_action:"选择操作",select_action_desc:"请选择上班或下班打卡",clock_in:"上班打卡",clock_in_desc:"开始您的工作日",clock_out:"下班打卡",clock_out_desc:"结束您的工作日",security_title:"安全生物识别验证",security_desc:"本系统使用您设备内置的生物识别身份验证（Face ID、Touch ID 或 Windows Hello）进行安全的考勤跟踪。您的生物识别数据永远不会离开此设备。",clocking_in:"正在签到",clocking_out:"正在签退",no_biometric_title:"未发现生物识别数据",no_biometric_desc:"您需要先登记您的生物识别身份验证，然后才能使用考勤系统。",success:"打卡成功",error:"打卡失败",biometric_verify:"正在验证生物识别数据...",success_msg:"已成功为 {{name}} 完成 {{action}}",cancel:"取消",back:"返回"},biometric_registration:{title:"生物识别登记",subtitle:"注册员工的生物识别数据",select_employee:"选择一名员工进行生物识别登记：",register_btn:"开始登记过程",status_registered:"已注册",status_not_registered:"未注册",search_employee:"搜索员工...",no_employees:"未找到员工。",back:"返回员工选择",success_title:"登记成功！",success_desc:"生物识别数据已成功登记。",error_title:"登记失败",enroll_success:"生物识别数据登记成功！",enroll_error:"登记过程中发生错误。"}},aI={add_edit_employee:{title_add:"入职人员",title_edit:"编辑人员",subtitle:"全球人力资源分类账",full_name:"全名",name_placeholder:"例如：张三",email:"邮箱地址",email_placeholder:"zhangsan@printing.com",role:"角色 / 职位",department:"部门",hourly_rate:"时薪 (RM)",base_salary:"基本工资 (RM)",discard:"放弃",save_changes:"保存修改",onboard:"办理入职",error_save:"保存记录失败。",roles:{worker:"生产工人",manager:"经理",admin:"管理员",sales:"销售代表",designer:"平面设计师"},departments:{production:"生产部门",sales:"销售与市场",design:"设计工作室",admin:"行政管理",logistics:"物流与仓库"}},attendance_settings:{title:"系统配置",subtitle:"考勤逻辑与连接规则",tabs:{shift:"班次规则",security:"安全设置",kiosk:"自助终端配置"},shift:{operating_hours:"营业时间",shift_start:"白班开始",shift_end:"白班结束",punctuality:"准时阈值",grace_period:"迟到迟到宽限期",grace_period_desc:"在标记为迟到之前允许在班次开始后延迟的分钟数",min:"分钟",change_info:"修改班次时间只会影响未来的考勤记录。当天的现有记录将保留其原始状态。"},security:{geofencing:"地理围栏强制执行",geofencing_desc:"合法的打卡需要 GPS 坐标",ip_whitelisting:"IP 白名单",ip_whitelisting_desc:"仅允许来自特定网络的扫描",ip_placeholder:"以逗号分隔的 IP 地址..."},kiosk:{greeting:"显示欢迎语",greeting_default:"Pioneer Cetak 考勤门户",refresh_interval:"自动刷新间隔",backup_pin:"手动备用 PIN 码",backup_pin_desc:"如果生物识别失败"},discard:"放弃",save_protocol:"保存设置",save_success:"考勤设置更新成功"},employee_detail:{unit:"单位",punctuality:"出勤统计",tenure:"工龄",job_yield:"工作产量",credentials_title:"员工凭据",email:"电子邮件",join_protocol:"加入日期",compensation_title:"薪酬分类账",cumulative_earnings:"累计收入",base_salary:"基本工资",hourly_rate:"时薪",close:"关闭个人资料"},payroll_batch:{title:"批量发放",fiscal_cycle:"财政周期：{{year}} 年 {{month}}",summary:{gross:"应付账款总额",retentions:"法定留存扣款",net:"实发资金总额"},schedule:{title:"人员付款计划",name:"姓名",gross:"总额",retained:"扣除",net:"净发工资"},warning_title:"财务承诺警告",warning_desc:"执行此批处理将自动在主现金登记簿中生成会计贷方分录。此操作将被审计和记录。",cancel:"取消操作",authorize:"授权并分发",executing:"正在执行...",success_title:"传输成功",success_desc:"当前期间的工资批处理已完成。资金已清算且会计分类账已同步。",return_hq:"返回总部",toast_success:"工资批处理已完成，会计分录已创建。"}},lI={add_edit_paper:{title_add:"添加新纸张",title_edit:"编辑纸张",sections:{basic_info:"基本信息",specifications:"纸张规格"},labels:{name:"名称 *",description:"描述 *",supplier:"供应商",in_stock:"当前库存",photo:"照片",size_preset:"预设尺寸",width:"宽度",height:"高度",unit:"单位",thickness:"厚度/克重",cost_price:"成本价",sell_price:"售价"},placeholders:{photo_url:"粘贴图片链接或上传",thickness:"例如：80gsm",select_supplier:"选择供应商"},actions:{upload:"上传",add_size:"添加尺寸",add_thickness:"添加厚度",cancel:"取消",save:"保存纸张"},sizes:{custom:"自定义",size_n:"尺寸 {{n}}"}},add_edit_stock:{title_add:"新资源",title_edit:"调整库存",subtitle:"库存管理",labels:{stock_class:"库存类别",consumable:"耗材",paper_stock:"纸张库存",name:"标识符 / 名称",classification:"分类",supplier:"主要供应商",on_hand:"现有量",threshold:"预警阈值",unit:"计量单位",value_unit:"单价 (RM)",measurement_unit:"数量单位 (例：升)"},placeholders:{name:"例如：青色工艺油墨",select_vendor:"选择供应商...",unit:"例如：升 / 张"},sections:{details:"物品详情",levels:"库存水平"},actions:{discard:"丢弃",save:"提交入库"}},add_edit_warehouse:{title_add:"添加新仓库",title_edit:"编辑仓库",labels:{name:"仓库名称",code:"代码",location:"位置 / 地址",manager:"负责人姓名",contact:"联系电话",set_default:"设为默认仓库"},sections:{details:"仓库详情"},placeholders:{name:"主仓库",code:"WH-001",location:"工业园 123 号",manager:"张三",contact:"+60 12-345 6789"},actions:{cancel:"取消",save:"保存仓库"}},add_edit_block:{title_add:"添加新加工模具",title_edit:"编辑加工模具",sections:{basic:"基本信息",status_location:"状态与位置"},labels:{name:"名称 / 标识符",job_id:"原始工单 ID",customer:"客户名称",finishing_type:"加工类型",purchase_date:"采购日期",cost:"成本 (RM)",supplier:"供应商",status:"状态",location:"存放位置",notes:"备注"},placeholders:{name:"名称 / 标识符",job_id:"原始工单 ID",customer:"客户名称",finishing_type:"加工类型 (例如：模切)",select_supplier:"选择供应商",location:"例如：模切存放区",notes:"备注..."},status_options:{available:"可用",in_use:"使用中",damaged:"损坏",lost:"丢失",archived:"已存档",with_supplier:"在供应商处"},actions:{cancel:"取消",save:"保存"}},add_edit_plate:{title_add:"添加新印版",title_edit:"编辑印版",sections:{basic:"基本信息",status_location:"状态与位置"},labels:{name:"名称 / 标识符",job_id:"原始工单 ID",customer:"客户名称",purchase_date:"采购日期",cost:"成本 (RM)",supplier:"供应商",status:"状态",location:"存放位置",notes:"备注"},placeholders:{name:"名称 / 标识符",job_id:"原始工单 ID",customer:"客户名称",select_supplier:"选择供应商",location:"例如：B-7 架",notes:"备注..."},status_options:{available:"可用",in_use:"使用中",damaged:"损坏",lost:"丢失",archived:"已存档",with_supplier:"在供应商处"},actions:{cancel:"取消",save:"保存"}},add_edit_finishing:{title_add:"添加新加工选项",title_edit:"编辑加工选项",sections:{basic:"基本信息",block:"加工模具",pricing:"定价层级"},labels:{name:"名称 *",days:"预计天数 *",description:"描述",supplier:"供应商",photo:"照片",requires_block:"此加工需要模具/底板",block_price:"新模具价格 (每单位)",block_unit:"模具价格单位",cost_unit:"成本单位",from_qty:"起始数量",to_qty:"截止数量",cost:"成本 (RM)",sell:"售价 (RM)"},options:{in_house:"内部生产",sqcm:"每平方厘米",sqin:"每平方英寸",sqmm:"每平方毫米",flat_fee:"每件 (固定费用)",per_item:"每件"},placeholders:{photo:"粘贴图片链接或上传",from:"从",to:"到 (可选)",cost:"成本",sell:"售价"},actions:{upload:"上传",add_tier:"添加价格层级",cancel:"取消",save:"保存加工选项"}},add_edit_printing:{title_add:"添加新印刷选项",title_edit:"编辑印刷选项",sections:{machine_sizes:"机器尺寸",pricing:"阶梯定价"},labels:{name:"名称 *",type:"类型 *",model:"机器型号 *",supplier:"供应商",operator:"操作员 *",photo:"照片链接",size_name:"名称",width:"宽度",height:"高度",unit:"单位",from_qty:"起始数量",to_qty:"截止数量",cost_price:"成本价",sell_price:"售价"},options:{digital:"数码印刷",offset:"胶印",in_house:"内部印刷",select_operator:"选择操作员",mm:"毫米",cm:"厘米",inch:"英寸"},placeholders:{or_more:"及以上"},actions:{add_size:"添加尺寸",add_tier:"添加价格层级",cancel:"取消",save:"保存印刷选项"}},manage_materials:{title:"管理 {{name}} 的项目",subtitle:"{{category}} 供应商",sections:{paper:"可用纸张",finishing:"加工选项"},labels:{in_stock:"库存：{{count}}",estimated_time:"预计时间：{{days}} 天",cost_price:"成本价 (RM)",sell_price:"售价 (RM) *"},actions:{cancel:"取消",save:"保存修改"},messages:{success:"修改已成功保存！"}},material_detail:{types:{paper:"纸张",printing:"印刷",finishing:"加工"},no_image:"无可用图片",stats:{provider:"供应商",in_house:"内部生产",stock_level:"库存水平",units:"单位",machine_model:"机器型号",lead_time:"交付周期",day:"天",days:"天"},description_fallback:"此目录项目暂无详细描述。",sections:{sizes:"可用尺寸与定价",pricing:"定价结构",per_unit:"(每 {{unit}})",qty_range:"数量范围",unit_price:"单价"},labels:{qty_limit:"{{from}} - {{to}} 单位",infinity:"∞",cost:"成本：RM{{price}}"},actions:{close:"关闭",delete:"删除项目",edit:"编辑物料"}},paper_detail:{title:"纸张详情",labels:{description:"描述：",supplier:"供应商：",in_stock:"现有库存：",sizes:"可用尺寸与定价：",cost:"成本：RM {{price}}",sell:"售价：RM {{price}}"},actions:{close:"关闭",delete:"删除",edit:"编辑"}},finishing_detail:{title:"加工选项详情",labels:{description:"描述：",supplier:"供应商：",in_house:"内部生产",estimated_days:"预计天数：",pricing:"定价 (每 {{unit}})：",qty:"数量：{{from}} - {{to}}",cost:"成本：RM {{price}}",sell:"售价：RM {{price}}"},actions:{close:"关闭",delete:"删除",edit:"编辑"}},printing_detail:{title:"印刷选项详情",labels:{machine_model:"机器型号：",type:"类型：",supplier:"供应商：",operator:"操作员：",in_house:"内部印刷",pricing:"定价：",qty:"数量：{{from}} - {{to}}",cost:"成本：RM {{price}} | ",sell:"售价：RM {{price}}"},empty_states:{in_house:"内部印刷。按工单确定价格。",no_tiers:"未定义价格层级。"},actions:{close:"关闭",delete:"删除",edit:"编辑"}},reusable_tool_detail:{titles:{plate:"印版详情",block:"加工模具详情"},status_options:{available:"可用",in_use:"使用中",damaged:"损坏",lost:"丢失",archived:"已存档",with_supplier:"在供应商处",unknown:"未知"},labels:{customer:"客户：",job_id:"原始工单 ID：",status:"状态：",location:"存放位置：",cost:"成本：",times_used:"使用次数：",history:"历史记录",at:"时间",by_user:"操作员 ID {{id}}"},actions:{close:"关闭",delete:"删除",edit:"编辑"}},stock_transfer:{title:"库存转移",labels:{material:"物料",from:"自 (调出库)",to:"至 (接收库)",quantity:"转移数量",notes:"备注 (可选)",stock_info:"当前库存：{{qty}} {{unit}}"},placeholders:{select_material:"选择要转移的物料",select_source:"选择调出库",select_destination:"选择接收库",notes:"转移原因...",quantity:"0"},actions:{execute:"执行转移",processing:"正在处理..."},messages:{error_material:"必须选择物料",error_transfer:"转移失败。请检查控制台。"}}},cI={title:"工单状态看板",productionStatus:"生产状态",productionStatusDesc:"通过拖放工单来更新它们的生产状态。",stages:{artwork:"稿件 / 印前",printing:"印刷中",finishing:"加工中",inspection:"质量检查",outbound:"准备出库"},noJobs:"当前无工单"},uI={reportsTitle:"考勤报告",reportsSubtitle:"劳动力管理",reportsDesc:"实时考勤追踪和生物识别分析。",exportReport:"导出报告",tabs:{overview:"概览",detailed:"详细记录",analytics:"深度分析"},filters:{today:"今日",week:"本周",month:"本月",allStaff:"全体员工"},stats:{totalRecords:"记录总数",onTimeRate:"准时率",lateRate:"迟到率",avgHours:"平均工时"},charts:{weeklyActivity:"每周扫描活动",punctuality:"准时率分布",trendAnalysis:"趋势分析",scans:"扫描次数",onTime:"准时",late:"迟到",absent:"缺勤"},table:{time:"时间",action:"操作",onTime:"准时",late:"迟到",noRecords:"该期间内未发现考勤记录。"},security:{biometricTitle:"安全生物识别连接",biometricDesc:"通过 WebAuthn API 和端到端加密连接。"},system:{title:"考勤系统",subtitle:"生物识别",status:"系统在线",monitoring:"已连接并持续监控",registered:"已注册员工",activeToday:"今日活跃",onTimeRate:"准时率",daily:"每日",live:"实时"},actions:{title:"快速操作",kiosk:"考勤自助终端",kioskDesc:"使用生物识别进行打卡",register:"注册员工",registerDesc:"生物识别登记",kioskMode:"终端模式",kioskModeDesc:"平板电脑全屏模式",reports:"查看报告",reportsDesc:"考勤数据分析",settings:"系统设置",settingsDesc:"考勤规则配置"},activity:{recent:"近期扫描",noScans:"今日暂无扫描记录",verified:"已验证"},features:{secure:"安全认证",secureDesc:"硬件支持的凭据安全。",privacy:"隐私保护",privacyDesc:"生物识别数据在本地处理。",multiDevice:"多设备支持",multiDeviceDesc:"兼容平板电脑和移动设备。",location:"位置验证",locationDesc:"地理位置确认的扫描。"}},dI={title:"分析仪表板",subtitle:"商业智能",description:"全面的洞察报告和绩效指标。",stats:{totalRevenue:"总收入",avgOrderValue:"平均订单金额",completionRate:"完成率",totalOrders:"订单总数",jobs:"工单"},charts:{revenueTrends:"收入趋势",orderVolume:"订单量"}},pI={step_manager:{title:"流程管理器",edit_steps:"编辑步骤",save:"保存修改",add_step:"添加新步骤",step_name:"步骤名称",new_step:"新步骤",status:{done:"已完成",working:"执行中",received:"已接收",next:"下一步",pending:"待处理",received_back:"已收回"},telemetry:{in:"进入",started:"已开始",done:"已完成"},actions:{receive:"接收步骤",start:"开始工作",finish:"结束步骤",rollback:"回滚",close:"关闭",confirm_start:"确认并开始步骤",confirm_finish:"确认并结束步骤"},alerts:{block_handover:"需要移交：请交回加工模具以开始此步骤。",plate_handover:"印版移交：此胶印任务需要印版。请确保已收到印版。"}},tool_action:{confirm_handin:"确认移交 {{type}}",step_complete:"{{type}} 步骤已完成",for_step:'所属步骤："{{name}}"',confirm_handin_desc:"请确认您正从仓库移交以下 {{type}} 用于生产：",current_location:"当前位置：{{location}}",location_unknown:"未知",returned_question:'"{{name}}" 的 {{type}} 是否已归还仓库？',yes_back:"是的，已归还",no_supplier:"不，在供应商处",where_returned:"{{type}} 归还到仓库的哪个位置？",location_label:"位置 / 货架号 *",location_placeholder:"例如：货架 C-12",location_error:"请指定位置/货架号。",confirm_title:"请确认",supplier_confirm_desc:'{{type}} 的位置将被标记为 "在供应商处：{{supplier}}"。归还后应及时更新。',types:{block:"加工模具",plate:"印版",finishing:"加工",printing:"印刷"}},quality_standard:{title_add:"添加新质量标准",title_edit:"编辑质量标准",name_label:"标准名称 *",name_placeholder:"例如：名片标准",category_label:"分类 *",category_placeholder:"例如：企业印刷",min_score_label:"最低合格分数 (%)",criteria_title:"质量标准细则",add_criterion:"添加指标",criterion_name:"名称",criterion_requirement:"要求",criterion_tolerance:"公差",criterion_name_placeholder:"例如：尺寸",criterion_req_placeholder:"例如：3.5x2 英寸",criterion_tol_placeholder:"例如：±0.1 英寸",save_standard:"保存标准",cancel:"取消",validation_error:"请填写必填字段"},quality_check:{title:"新质量检查",order_label:"工单 *",order_placeholder:"选择要检查的工单",type_label:"检查类型",types:{visual:"外观检查",dimensional:"尺寸检查",color:"色彩准确度",material:"物料检查",finishing:"加工检查"},inspector_label:"检查员",status_label:"状态",status:{pass:"合格",rework:"返工",fail:"不合格"},score_label:"质量评分 (0-100)",defects_label:"发现的缺陷",add_defect:"添加缺陷",no_defects:"未记录缺陷。完美！",defect_type_placeholder:"缺陷类型",defect_severity:{minor:"轻微",major:"主要",critical:"严重"},defect_desc_placeholder:"描述",notes_label:"常规备注",notes_placeholder:"总体检查评论...",save_inspection:"保存检查结果",saving:"正在保存...",validation_error_order:"请选择工单",save_error:"保存检查结果失败"},block_selector:{title:"选择现有模具",search_placeholder:"按模具名称搜索...",no_blocks:"未发现该客户及加工类型的可用模具。",select_button:"选择模具"},quality_detail:{title:"检查详情",order_info:"工单：{{name}}",inspector_label:"检查员",date_label:"日期",type_label:"检查类型",customer_label:"客户",defects_title:"发现的缺陷",no_defects:"未记录缺陷。做得好！",notes_title:"检查员备注",preview_label_button:"预览标签",download:"下载",print:"打印",preview_title:"标签预览",print_now:"立即打印",alert_popups:"请允许弹出窗口以打印标签。",label_title:"质量检查合格证"}},mI={modules:{dashboard:"仪表板",orders:"订单与报价",production:"生产排程",quality_control:"质量管理",inventory:"仓储库存",accounting:"财务会计",hr:"人事与工资",analytics:"数据分析",administration:"系统管理"},"dashboard:view":"查看仪表板","orders:view":"查看所有订单/报价","orders:view_own":"查看个人订单/报价 (客户)","orders:create":"新建订单/报价","orders:edit":"编辑订单/报价","orders:delete":"删除订单/报价","production:view":"查看生产模块","production:update_status":"更新生产状态","production:manage_workflow":"管理生产流程","quality:view":"查看质检模块","quality:perform_checks":"执行质量检查","inventory:view":"查看库存","inventory:edit":"调整库存水平","accounting:view":"查看会计模块","accounting:manage_invoices":"管理发票与付款","accounting:manage_expenses":"管理费用报销","accounting:view_reports":"查看财务报表","hr:view":"查看人事与工资","hr:manage_employees":"管理员工档案","hr:run_payroll":"执行工资核算","analytics:view":"查看分析仪表板","admin:view":"查看系统管理面板","admin:manage_users":"管理系统用户","admin:manage_roles":"管理角色与权限","admin:manage_system":"配置系统设置"},fI={enterprise:"企业级印刷系统",searchPlaceholder:"搜索订单、客户或组件..."},hI={addPerson:"添加佣金人员",fullName:"全名",email:"电子邮箱",phone:"电话号码",role:"角色 / 职位",commissionRate:"提成比例 (%)",cancel:"取消",save:"保存人员"},gI={ADD_EDIT_STOCK:{LABEL_UNIT:"数量单位 (例：升)",UNIT_MEASUREMENT:"数量单位 (例：升)",LABEL_VALUE_UNIT:"单价 (RM)"}},yI={title:"报价管理",subtitle:"销售 / 报价",description:"管理、跟踪并将您的客户报价转换为订单。",newQuotation:"创建新报价",pendingQuotes:"待定报价",acceptedQuotes:"已接受报价",rejectedQuotes:"已拒绝报价",conversionRate:"转换率",awaitingAcceptance:"等待接受",convertedToOrders:"已转换为订单",requiresFollowUp:"需要随访",lossOpportunity:"错失机会",winRatio:"胜率",listing:"报价列表",listingDesc:"所有已发出报价的历史记录",searchPlaceholder:"搜索报价...",summary:"状态摘要",revenueSuccess:"成功收入",totalValueAccepted:"已接受报价的总价值",verified:"已验证",thisYear:"今年",noResults:"未找到匹配您搜索的结果",total:"总计",columns:{num:"#",info:"报价信息",customer:"客户",amount:"总金额",status:"状态",action:"操作"}},vI={title:"订单管理",subtitle:"运营 / 订单",description:"监控生产工作流程并管理活跃的印刷订单。",newOrder:"创建新订单",searchPlaceholder:"按客户或角色搜索...",stages:{artwork:"原稿/设计",printing:"印刷中",qc:"质检/审计",transit:"交付中",completed:"已完成"},paymentStatus:{overdue:"已逾期",paid:"已付清",partial:"部分支付",pending:"待支付"},quantity:"数量",amount:"金额",invoiceRef:"发票参考",deliveryDate:"交付日期",daysRemaining:"剩余 {{days}} 天",pcs:"件",jobInspector:"工作检查员",dashboard:"仪表板",activeJobs:"{{count}} 个活动作业",productionPipeline:"生产流水线",outsourcedVendors:"外包供应商",customerContact:"客户联系",pipelineOverview:"流水线概览",totalJobs:"作业总数",selectJob:"选择要检查的作业",clickCard:"点击任何订单卡以查看完整详情",job:"作业",client:"客户",stage_label:"阶段",payment:"支付",actions_label:"操作",noJobs:"未找到作业",adjustFilters:"请尝试调整过滤器",actions:{view:"查看",process:"处理",pay:"支付",manageProduction:"管理生产",processPayment:"处理支付",viewDocuments:"查看文档",newJob:"新作业",call:"致电",whatsapp:"WhatsApp"}},bI={common:HP,landing:KP,auth:JP,navigation:WP,sections:zP,dashboard:YP,accounting:QP,accounting_modals:XP,inventory:ZP,partners:eI,admin:tI,worker:nI,customer:iI,orderForm:oI,commission:sI,hr:rI,hr_modals:aI,inventory_modals:lI,jobBoard:cI,attendance:uI,analytics:dI,production_modals:pI,permissions:mI,layout:fI,commissions:hI,INVENTORY_MODALS:gI,quotations:yI,orders_management:vI},_I={noData:"Tiada data tersedia",loading:"Memuatkan...",not_applicable:"N/A",add:"Tambah",try_again:"Cuba Lagi",step:"Langkah",of:"daripada",appName:"Pioneer Cetak",pcs:"keping",months_full:{january:"Januari",february:"Februari",march:"Mac",april:"April",may:"Mei",june:"Jun",july:"Julai",august:"Ogos",september:"September",october:"Oktober",november:"November",december:"Disember"},account_types:{asset:"Aset",liability:"Liabiliti",equity:"Ekuiti",revenue:"Hasil",expense:"Perbelanjaan"}},NI={modules:{dashboard:"Papan Pemuka",orders:"Pesanan & Sebut Harga",production:"Pengeluaran",quality_control:"Kawalan Kualiti",inventory:"Inventori",accounting:"Perakaunan",hr:"HR & Payroll",analytics:"Analitik",administration:"Pentadbiran"}},xI={company:{nav:{heritage:"Warisan",capabilities:"Keupayaan",inquiry:"Pertanyaan",clientPortal:"Portal Klien",getQuote:"Dapatkan Sebut Harga",software:"Perisian PrintOS"},hero:{badge:"Kilang Cetak Premium KL",titleMain:"Seni",titleSub:"Percetakan Ketepatan.",description:"Sejak 2009, kami telah menterjemah kesempurnaan digital kepada realiti fizikal. Kualiti tanpa kompromi, warna yang diperakui ISO, dan kelajuan terus dari kilang.",ctaExplore:"Teroka Keupayaan",ctaSoftware:"Temui Perisian PrintOS",slide2:{titleMain:"Skala",titleSub:"Industri.",description:"Armada Heidelberg Speedmaster kami memberikan volum tanpa kompromi dengan ketepatan warna yang diperakui ISO."},slide3:{titleMain:"Seni",titleSub:"Kemasan Mewah.",description:"Daripada pembungkusan struktur kepada pengecapan kerajang khusus, kami menghasilkan butiran sentuhan yang menentukan jenama anda."},slide4:{titleMain:"Digital",titleSub:"Ketepatan Tinggi.",description:"Suite pengeluaran digital kami menawarkan pusing balik pantas dengan keupayaan data berubah-ubah untuk kecemerlangan peribadi."}},heritage:{badge:"Warisan",title:`Kami memiliki mesin.
Anda mendapat kelebihan.`,p1:"Tidak seperti broker dan agensi percetakan, kami mengendalikan lantai pengeluaran besar kami sendiri di tengah-tengah Kuala Lumpur. Ini bermakna kawalan penuh ke atas kualiti dan sifar tokokan orang tengah.",p2:"Dengan melabur banyak dalam mesin cetak offset Heidelberg yang paling maju di dunia dan teknologi penentukuran warna ICC yang tepat, kami menjamin bahawa warna jenama yang anda reka adalah tepat warna yang kami tekan ke dalam kertas.",stat1Val:"ISO 12647",stat1Label:"Warna Diperakuan",stat2Val:"18,000",stat2Label:"Helaian Sejam",yearsExp:"Tahun Kecemerlangan"},capabilities:{badge:"Keupayaan",title:`Skala Tanpa Kompromi.
Kemasan Meticulous.`,description:"Daripada larian komersial volum tinggi kepada pembungkusan struktur khusus, jentera kami menentukan kesempurnaan.",offset:{title:"Percetakan Offset",desc:"Heidelberg Speedmaster XL. Ketepatan CMYK dan Pantone direka untuk larian komersial volum tinggi yang kos efektif."},digital:{title:"Digital Ekspres",desc:"Teknologi HP Indigo untuk larian pendek yang menakjubkan, percetakan data berubah-ubah, dan penghantaran hari berikutnya yang mendesak tanpa kompromi."},packaging:{title:"Struktur & Kotak",desc:"Karton lipat die-cut, kotak mewah tegar, dan pembungkusan beralun khusus yang dibuat untuk impak runcit."},finishing:{title:"Kemasan Premium",desc:"Spot UV, pengecapan kerajang, perembangan dalam, laminasi sentuhan lembut, dan penjilidan sempurna dilakukan sepenuhnya di dalam rumah."},logistics:{title:"Logistik Turnkey",desc:"Pembungkusan, pergudangan, dan penghantaran ke seluruh negara yang lancar terus dari teluk pemuatan kami ke pusat pengedaran anda."},cta:{title:"Cabar Kami.",desc:"Mempunyai spesifikasi unik atau tarikh akhir yang mustahil? Mari berbincang."}},contact:{title:`Mulakan 
Projek.`,description:"Serahkan spesifikasi anda. Pakar pengeluaran kami akan memberikan sebut harga komprehensif dalam masa 4 jam waktu perniagaan.",facility:"Kemudahan",directLine:"Talian Terus",hours:"Waktu Operasi",monWedFri:"Isnin-Rabu, Jumaat",thursday:"Khamis",saturday:"Sabtu",sunday:"Ahad",closed:"Tutup",form:{name:"Nama / Syarikat",email:"Alamat Emel",category:"Kategori Perkhidmatan",categoryOther:"Lain-lain",brief:"Ringkasan Projek",submit:"Dapatkan Sebut Harga"}},footer:{title:"Ketepatan. Terbina Dalam.",rights:"Hak cipta terpelihara.",systemBy:"Sistem oleh PrintOS"}},saas:{nav:{platform:"Platform",customers:"Pelanggan",agencyDemo:"Demo Agensi",signIn:"Log Masuk",deployNow:"Pasang Sekarang"},hero:{badge:"Seni Bina V1.0 Aktif",title:`Sistem Operasi untuk 
Pengeluaran Cetak.`,description:"Hubungkan sebut harga, papan pengeluaran, lejar perakaunan, dan inventori ke dalam satu graf data bersepadu. Selamat tinggal helaian hamparan.",ctaBuild:"Mula Membina",ctaDocs:"Baca Dokumentasi"},features:{badge:"Beg Alatan Sempurna",title:"Alatan yang dibina dengan sempurna.",description:"Kami menghapuskan kerumitan ERP tradisional. Tiada antara muka lama. Hanya aliran kerja pantas kilat yang dibina tepat untuk cara prepress moden dan lantai kilang beroperasi.",stat1Val:"10x",stat1Label:"Sebut Harga Lebih Pantas",stat2Val:"0",stat2Label:"Tarikh Akhir Terlepas",graph:{title:"Graf Masa Nyata",desc:"Sebut harga bertukar secara automatik kepada kerja pengeluaran. Inventori ditolak secara automatik. Semuanya disegerakkan serta-merta melalui WebSockets."},kanban:{title:"Pengeluaran Kanban",desc:"Seret dan letak tiket kerja merentasi lantai kilang anda. Pengimbasan kod bar pada stesen kerja mengemas kini status serta-merta."},inventory:{title:"Inventori Pintar",desc:"Jejaki berat kertas, arah ira, dan tahap dakwat. Konfigurasikan cetusan PO automatik sebelum stok anda habis."},security:{title:"Keselamatan Perusahaan",desc:"Keselamatan peringkat baris, kawalan akses berasaskan peranan, dan sandaran harian. Data pelanggan dan matriks harga anda dikunci rapi."}},cta:{title:"Hentikan kekacauan pengurusan.",description:"Sertai standard baru dalam pengurusan cetakan. Lancarkan ruang kerja anda dalam beberapa saat.",deploy:"Laksanakan PrintOS"},pricing:{title:"Ekonomi Butik",description:"Harga telus dan sedia skala untuk kilang moden.",essence:{title:"Essence",price:"RM210",period:"sebulan",feat1:"Sehingga 5 stesen kerja",feat2:"Inventori Asas",feat3:"Laporan Standard",cta:"Bermula Sekarang"},velocity:{title:"Velocity",price:"RM650",period:"sebulan",feat1:"Stesen kerja tanpa had",feat2:"Pengeluaran Lanjutan",feat3:"Papan Pemuka Langsung",cta:"Tingkat ke Pertumbuhan"},enterprise:{title:"Enterprise",price:"Custom",period:"skala tersuai",feat1:"Sinksroni pelbagai tapak",feat2:"Integrasi Lejar Tersuai",feat3:"Pengurus Kejayaan Dedikasi",cta:"Hubungi Jualan"}},features_page:{hero:{badge:"STANDARD BARU",title:`Luaskan Empayar Cetak 
Anda dengan Ketepatan.`,description:"Hentikan pengurusan kucar-kacir. PrintOS adalah sistem operasi menegak yang direka untuk mengendalikan kerumitan pelbagai tahap pembuatan offset, digital, and pembungkusan secara meluas."},section1:{title:"Enjin Estimasi Ketepatan",description:"Estimator paling canggih di dunia untuk cetakan kompleks. Ia mengira berat kertas, liputan dakwat, masa mesin, dan margin kemasan dalam milisaat—menghapuskan kesilapan manusia dan keletihan hamparan buat selamanya.",feat1:"Arkitektur Harga HSL Dinamik",feat2:"Kecerdasan Susun Atur & Imposisi",feat3:"Sebut Harga PDF Berjenama Segera"},section2:{title:"Kecerdasan Lantai Kilang Langsung",description:"Tukarkan lantai kilang anda menjadi persekitaran data dengan penglihatan tinggi. Dengan papan Kanban masa nyata dan imbasan terminal di setiap stesen kerja, anda akan tahu dengan tepat kerja mana yang berada di mesin mana pada bila-bila masa.",feat1:"Papan Kanban Pengeluaran Langsung",feat2:"Terminal Stesen Kerja Didorong QR",feat3:"Analisis Buruh & Masa Nyata"},section4:{title:"Kecerdasan Kewangan & Lejar",description:"Teras kewangan yang dibina khusus untuk industri cetakan. Dari invois sedia SST automatik ke lejar bersepadu sepenuhnya, kami memastikan aliran tunai anda setepat cetakan anda.",feat1:"Pengurusan Cukai SST/VAT Automatik",feat2:"Lejar Profesional Berintegrasi",feat3:"Penjejakan & Peringatan Pembayaran"},section5:{title:"Modal Insan & Kehadiran",description:"Urus aset paling berharga anda—kakitangan anda. Kehadiran biometrik bersepadu mengalir terus ke sistem penggajian automatik, memastikan pasukan pengeluaran anda bermotivasi dan diberikan pampasan sewajarnya.",feat1:"Kiosk Kehadiran Biometrik",feat2:"Pengiraan Penggajian Automatik",feat3:"Penjejakan Komisen & Prestasi Staf"},section3:{title:"Logistik & Bekalan Bersepadu",description:"Hubungkan jurang antara bahan mentah dan palet siap. Sistem inventori pintar kami menjejaki setiap gram dakwat dan setiap helai kertas, memastikan anda tidak pernah kering di tengah pengeluaran.",feat1:"Amaran Ambang Bahan Pintar",feat2:"Gerbang Pemenuhan Pembekal",feat3:"Penjejakan Logistik & Penghantaran Langsung"},section6:{title:"Penyelesaian untuk Setiap Vertikal",description:"PrintOS bukan alat yang sesuai untuk semua. Kami telah membina aliran kerja khusus industri yang memahami fizik dan ekonomi unik sektor percetakan khusus anda.",feat1:"Offset Komersial & Web",feat2:"Karton Lipat & Pembungkusan",feat3:"Digital & Format Besar"},section7:{title:"Kepercayaan & Keselamatan Korporat",description:"Data anda adalah aset anda yang paling berharga. Kami melindunginya dengan penyulitan gred perbankan dan infrastruktur global yang memastikan masa operasi 99.9%, walaupun semasa musim pengeluaran puncak.",feat1:"Penyulitan Data AES-256",feat2:"Sambungan Awan SLA 99.9%",feat3:"Sandaran Harian Automatik"}}}},SI={title:"Pengurusan Pesanan",subtitle:"Operasi / Pesanan",description:"Pantau aliran kerja pengeluaran dan urus pesanan cetak aktif.",newOrder:"Buat Pesanan Baru",searchPlaceholder:"Cari mengikut pelanggan atau peranan...",stages:{artwork:"Karya Seni",printing:"Percetakan",qc:"QC / Audit",transit:"Dalam Transit",completed:"Selesai"},paymentStatus:{overdue:"Tunggakan",paid:"Dibayar",partial:"Separa",pending:"Belum Selesai"},quantity:"Kuantiti",amount:"Jumlah",invoiceRef:"Ruj Invois",deliveryDate:"Tarikh Penghantaran",daysRemaining:"{{days}} hari lagi",pcs:"keping",jobInspector:"Pemeriksa Kerja",dashboard:"Papan Pemuka",activeJobs:"{{count}} kerja aktif",productionPipeline:"Saluran Paip Pengeluaran",outsourcedVendors:"Vendor Luar",customerContact:"Hubungan Pelanggan",pipelineOverview:"Gambaran Keseluruhan Saluran Paip",totalJobs:"Jumlah Kerja",selectJob:"Pilih kerja untuk diperiksa",clickCard:"Klik mana-mana kad pesanan untuk melihat butiran penuh",job:"Kerja",client:"Pelanggan",stage_label:"Peringkat",payment:"Pembayaran",actions_label:"Tindakan",noJobs:"Tiada kerja ditemui",adjustFilters:"Cuba laras penapis anda",actions:{view:"Lihat",process:"Proses",pay:"Bayar",manageProduction:"Urus Pengeluaran",processPayment:"Proses Pembayaran",viewDocuments:"Lihat Dokumen",newJob:"Kerja Baru",call:"Panggil",whatsapp:"WhatsApp"}},EI={allStages:"Semua Peringkat",clearFilters:"Kosongkan Penapis"},wI={elevateTitle:"Tingkatkan",printingOperations:"Operasi Percetakan",heroDescription:"Urus keseluruhan kedai cetak anda dengan sistem gred profesional kami yang dikuasakan oleh AI, direka untuk kecekapan moden.",reliability:"Kebolehpercayaan",support:"Sokongan",cloudBase:"Asas Awan",welcomeBack:"Selamat Kembali",signInSubtitle:"Log masuk ke ruang kerja profesional anda",workEmail:"Emel Kerja",securePassword:"Kata Laluan Selamat",forgot:"Lupa?",accessWorkspace:"Akses Ruang Kerja",quickAccess:"Akses Pantas Sistem",roles:{admin:"Admin",manager:"Pengurus",worker:"Pekerja",customer:"Pelanggan",supplier:"Pembekal",kiosk:"Kiosk",adminDesc:"Akses penuh",managerDesc:"Analitik & laporan",workerDesc:"Lantai pengeluaran",customerDesc:"Penjejakan pesanan",supplierDesc:"Rantaian bekalan",kioskDesc:"Kehadiran"},errors:{invalidCredentials:"Kredensial tidak sah. Sila cuba lagi."},copyright:"© 2024 Pioneer Cetak. Portal Akses Selamat v1.0"},CI={dashboard:"Papan Pemuka",orders:"Status Pesanan",newOrder:"Pesanan Baru",requestQuote:"Minta Sebut Harga",invoices:"Invois Saya",support:"Bantuan & Sokongan",materials:"Perpustakaan Bahan",jobBoard:"Papan Kerja",productionTracking:"Penjejakan Pengeluaran",layoutPlanner:"Perancang Susun Atur",inventory:"Inventori",qualityControl:"Kawalan Kualiti",attendance:"Kehadiran",accounting:"Perakaunan",payroll:"Penggajian & HR",commission:"Komisen",analytics:"Analitik",administration:"Pentadbiran",descriptions:{dashboard:"Gambaran Keseluruhan & Tindakan Pantas",orders:"Urus Kerja Cetak",newOrder:"Buat pesanan baru",requestQuote:"Dapatkan harga untuk projek anda",invoices:"Lihat dan muat turun invois",support:"Dapatkan bantuan",materials:"Layari kertas & kemasan",jobBoard:"Status Kerja Kanban",productionTracking:"Pemantauan Masa Nyata",layoutPlanner:"Kira susun atur karya seni",inventory:"Urus tahap stok",qualityControl:"Jaminan Kualiti",attendance:"Kehadiran Biometrik",accounting:"Pengurusan Kewangan",payroll:"Pengurusan Pekerja",commission:"Pengurusan Komisen",analytics:"Kecerdasan Perniagaan",administration:"Pengurusan Sistem"}},DI={main:"Utama",operations:"Operasi",hrFinance:"HR & Kewangan",system:"Sistem"},TI={welcome:"Selamat kembali, {{name}}",overview:"Gambaran Keseluruhan",description:"Inilah yang berlaku di kedai cetak anda hari ini.",downloadReport:"Muat Turun Laporan",newCampaign:"Kempen Baru",portal:"Portal Pelanggan",projectInfo:"Jejaki pesanan anda dan urus projek cetakan anda.",totalRevenue:"Jumlah Hasil",activeOrders:"Pesanan Aktif",pendingQuotes:"Sebut Harga Belum Selesai",customers:"Jumlah Pelanggan",fulfillmentRate:"Kadar Pemenuhan",profitMargin:"Margin Keuntungan",recentOrders:"Pesanan Terkini",viewAll:"Lihat Semua",status:"Status",date:"Tarikh",orderId:"ID Pesanan",customer:"Pelanggan",product:"Produk",total:"Jumlah",revenueTrends:"Trend Hasil",dailyPerformance:"Prestasi hasil harian",quickActions:"Tindakan Pantas",newOrder:"Pesanan Baru",addCustomer:"Tambah Pelanggan",inventory:"Inventori",reports:"Laporan",liveActivity:"Aktiviti Langsung",placedOrder:"{{name}} membuat pesanan baru untuk {{product}}",hoursAgo:"{{count}} jam yang lalu",orderInfo:"Maklumat Pesanan",noRecentOrders:"Tiada pesanan terkini ditemui.",mon:"Isn",tue:"Sel",wed:"Rab",thu:"Kha",fri:"Jum",sat:"Sab",sun:"Ahad",jan:"Jan",feb:"Feb",mar:"Mac",apr:"Apr",may:"Mei",jun:"Jun",spendingTrend:"Trend Perbelanjaan",orderStatus:"Status Pesanan",completed:"Selesai",inProgress:"Sedang Berjalan",pending:"Menunggu",confirmed:"Disahkan",quality_check:"Kawalan Kualiti",delivered:"Dihantar",cancelled:"Dibatalkan",orderManagement:"Pengurusan Pesanan",orderManagementDesc:"Jejaki dan urus semua pesanan cetakan di satu tempat.",orderDetails:"Butiran Pesanan",customPrint:"Cetakan Tersuai",amount:"Amaun",totalOrders:"Jumlah Pesanan",filter:"Tapis",searchPlaceholder:"Cari mengikut ID, Pelanggan...",viewMode:"Mod Paparan",unknown:"Tidak diketahui",actions:"Tindakan",inProduction:"Dalam Pengeluaran",vsLastMonth:"berbanding bulan lepas",newToday:"baru hari ini",actionNeeded:"tindakan diperlukan",totalCustomers:"Jumlah Pelanggan",thisWeek:"minggu ini",placedNewOrder:"{{customer}} membuat pesanan baru untuk {{product}}"},AI={title:"Pengurusan Kewangan",hub:"Hab Kewangan",hubDesc:"Pantau semua operasi kewangan dari satu hub.",loading:"Memuatkan modul...",dashboard:"Papan Pemuka",generalLedger:"Lejar Am",chartOfAccounts:"Carta Akaun",bankRecon:"Rekonsiliasi Bank",financialReports:"Laporan Kewangan",salesReports:"Laporan Jualan",fixedAssets:"Aset Tetap",liabilities:"Liabiliti",ar:"A/R",creditNotes:"Nota Kredit",ap:"A/P",purchaseOrders:"Pesanan Pembelian",cheques:"Cek",expenses:"Perbelanjaan",inventory:"Inventori",eInvoicing:"E-Invois",customers:"Pelanggan",suppliers:"Pembekal",materials:"Bahan",commission:"Komisen",payrollHr:"Gaji & HR"},kI={title:"Pengurusan Penggajian & HR",workforceManagement:"Pengurusan Tenaga Kerja",description:"Urus kakitangan syarikat, pengeluaran gaji, dan penjejakan kehadiran.",summary:"Ringkasan",directory:"Direktori",payroll:"Penggajian",attendance:"Kehadiran",roles:"Peranan",totalHeadcount:"Jumlah Kakitangan",totalPayroll:"Jumlah Penggajian",attendanceRate:"Kadar Kehadiran",activeDepts:"Jabatan Aktif",deptDistribution:"Agihan Jabatan",monthlyExpenditure:"Perbelanjaan Bulanan",payslip:"Slip Gaji Pekerja",period:"Tempoh Gaji",employee:"Pekerja",position:"Jawatan",date:"Tarikh",earnings:"Pendapatan",description_label:"Penerangan",amount_rm:"Amaun (RM)",baseSalary:"Gaji Pokok",bonus:"Bonus",gross:"Gaji Kasar",deductions:"Potongan",statutoryDeductions:"Potongan Berkanun",total:"Jumlah",netPay:"Gaji Bersih",unassigned:"Tidak Ditugaskan",deleteConfirm:"Adakah anda pasti mahu memadam pekerja ini?",searchEmployees:"Cari pekerja...",allDepartments:"Semua Jabatan",addEmployee:"Tambah Pekerja",role:"Peranan",department:"Jabatan",email:"Emel",actions:"Tindakan",noEmployees:"Tiada pekerja ditemui",payrollRegister:"Daftar Penggajian",payrollDesc:"Semak dan jana slip gaji pekerja.",runPayroll:"Jalankan Penggajian",generateSlip:"Jana Slip",noPayrollData:"Tiada data penggajian tersedia",searchLogs:"Cari log...",viewReports:"Lihat Laporan",clockIn:"Daftar Masuk",clockOut:"Daftar Keluar",status:"Status",hours:"Jam",hours_label:"jam",noAttendance:"Tiada rekod kehadiran ditemui",rolesPermissions:"Peranan & Keizinan",rolesDesc:"Urus tahap akses sistem dan keizinan.",newRole:"Peranan Baru",noRoles:"Tiada peranan ditakrifkan",createFirstRole:"Cipta Peranan Pertama",present:"Hadir",absent:"Tidak Hadir",late:"Lewat",ot_pay:"Bayaran OT",ot_report_btn:"Laporan OT",failed_payslip:"Gagal menjana slip gaji.",hrs:"jam",attendance_kiosk:{title:"Kiosk Kehadiran",subtitle:"Pengesahan biometrik selamat",select_action:"Pilih Tindakan",select_action_desc:"Pilih sama ada anda mahu daftar masuk atau daftar keluar",clock_in:"Daftar Masuk",clock_in_desc:"Mulakan hari kerja anda",clock_out:"Daftar Keluar",clock_out_desc:"Tamatkan hari kerja anda",security_title:"Pengesahan Biometrik Selamat",security_desc:"Sistem ini menggunakan pengesahan biometrik terbina dalam peranti anda (Face ID, Touch ID, atau Windows Hello) untuk penjejakan kehadiran yang selamat. Data biometrik anda tidak pernah meninggalkan peranti ini.",clocking_in:"Mendaftar Masuk",clocking_out:"Mendaftar Keluar",no_biometric_title:"Tiada Data Biometrik Ditemui",no_biometric_desc:"Anda perlu mendaftarkan pengesahan biometrik anda terlebih dahulu sebelum anda boleh menggunakan sistem kehadiran.",success:"Berjaya",error:"Ralat",biometric_verify:"Mengesahkan data biometrik...",success_msg:"Berjaya {{action}} untuk {{name}}",cancel:"Batal",back:"Kembali"},biometric_registration:{title:"Pendaftaran Biometrik",subtitle:"Daftar data biometrik pekerja",select_employee:"Pilih pekerja untuk mendaftarkan data biometrik mereka:",register_btn:"Mulakan Pendaftaran",status_registered:"Berdaftar",status_not_registered:"Belum Berdaftar",search_employee:"Cari pekerja...",no_employees:"Tiada pekerja ditemui.",back:"Kembali ke pemilihan pekerja",success_title:"Pendaftaran Berjaya!",success_desc:"Data biometrik telah berjaya didaftarkan.",error_title:"Pendaftaran Gagal",enroll_success:"Data biometrik berjaya didaftarkan!",enroll_error:"Gagal mendaftarkan data biometrik."}},PI={add_edit_employee:{title_add:"Pengambilan Kakitangan",title_edit:"Kemas Kini Kakitangan",subtitle:"Lejar Sumber Manusia Global",full_name:"Nama Penuh",name_placeholder:"cth. Ali Bin Abu",email:"Alamat Emel",email_placeholder:"ali@printing.com",role:"Peranan / Jawatan",department:"Jabatan",hourly_rate:"Kadar Sejam (RM)",base_salary:"Gaji Pokok (RM)",discard:"Batal",save_changes:"Simpan Perubahan",onboard:"Daftar Kakitangan",error_save:"Gagal menyimpan rekod.",roles:{worker:"Pekerja Pengeluaran",manager:"Pengurus",admin:"Pentadbir",sales:"Wakil Jualan",designer:"Pereka Grafik"},departments:{production:"Lantai Pengeluaran",sales:"Jualan & Pemasaran",design:"Studio Reka Bentuk",admin:"Pentadbiran",logistics:"Logistik & Gudang"}},attendance_settings:{title:"Konfigurasi Keseluruhan",subtitle:"Logik kehadiran dan peraturan sambungan",tabs:{shift:"Peraturan Syif",security:"Keselamatan",kiosk:"Konfigurasi Kiosk"},shift:{operating_hours:"Waktu Operasi",shift_start:"Mula Syif Siang",shift_end:"Tamat Syif Siang",punctuality:"Ambang Ketepatan Masa",grace_period:"Tempoh Ihsan Lewat",grace_period_desc:"Minit yang dibenarkan selepas mula syif sebelum ditandakan lewat",min:"MIN",change_info:"Menukar waktu syif hanya akan menjejaskan rekod kehadiran masa hadapan. Rekod sedia ada untuk hari ini akan mengekalkan status asal mereka."},security:{geofencing:"Penguatkuasaan Geofencing",geofencing_desc:"Memerlukan koordinat GPS untuk daftar masuk yang sah",ip_whitelisting:"Senarai Putih IP",ip_whitelisting_desc:"Hanya benarkan imbasan daripada rangkaian tertentu",ip_placeholder:"Alamat IP diasingkan koma..."},kiosk:{greeting:"Mesej Aluan",refresh_interval:"Selang Segar Semula Auto",greeting_default:"Selamat Datang ke Pioneer Cetak",backup_pin:"Akses PIN Sandaran",backup_pin_desc:"Benarkan pekerja daftar masuk menggunakan PIN jika pengesahan wajah gagal"},overtime:{title:"Parameter Kerja Lebih Masa",standard_daily_hours:"Waktu Kerja Standard Harian",working_days:"Hari Kerja / Bulan",multiplier:"Pengganda OT"}},employee_detail:{unit:"UNIT",punctuality:"Ketepatan Masa",tenure:"Tempoh Perkhidmatan",job_yield:"Hasil Kerja",credentials_title:"Kredensial Kakitangan",email:"Mel Elektronik",join_protocol:"Tarikh Menyertai",compensation_title:"Lejar Pampasan",cumulative_earnings:"Pendapatan Terkumpul",base_salary:"Gaji Pokok",hourly_rate:"Kadar Sejam",ot_this_month:"Kerja Lebih Masa Bulan Ini",ot_hours:"Jam OT",ot_pay:"Bayaran OT Diperolehi",close:"Tutup Profil"},payroll_batch:{title:"Pengeluaran Berkelompok",fiscal_cycle:"Kitaran Fiskal: {{month}} {{year}}",summary:{gross:"Jumlah Output Kasar",retentions:"Jumlah Potongan",net:"Jumlah Pengeluaran Bersih",ot_total:"Jumlah Bayaran OT"},schedule:{title:"Jadual Pengeluaran Gaji",name:"Penerima",gross:"Kasar",basic:"Gaji Pokok",ot:"Bayaran OT (Jam)",retained:"Dipotong",net:"Gaji Bersih"},warning_title:"Amaran Komitmen Kewangan",warning_desc:"Menjalankan kelompok ini akan secara automatik menjana entri kredit perakaunan terhadap daftar tunai utama. Tindakan ini diaudit dan direkodkan.",cancel:"Batal Operasi",authorize:"Sahkan & Bayar",executing:"Melaksanakan...",success_title:"Penghantaran Berjaya",success_desc:"Kelompok gaji untuk tempoh semasa telah dimuktamadkan. Dana telah dilepaskan dan lejar perakaunan disegerakkan.",return_hq:"Kembali ke HQ",toast_success:"Kelompok gaji diproses dan entri perakaunan dicipta."}},II={common:_I,permissions:NI,landing:xI,orders_management:SI,inventory:EI,auth:wI,navigation:CI,sections:DI,dashboard:TI,accounting:AI,hr:kI,hr_modals:PI};Qe.use(Ym).use(Bh).init({resources:{en:{translation:vP},ar:{translation:GP},zh:{translation:bI},ms:{translation:II}},lng:"en",fallbackLng:"en",load:"languageOnly",ns:["translation"],defaultNS:"translation",interpolation:{escapeValue:!1}});const RI=new Qf;cd(document.getElementById("root")).render(m.jsxDEV(b.StrictMode,{children:m.jsxDEV(eh,{client:RI,children:m.jsxDEV(sk,{},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/main.tsx",lineNumber:13,columnNumber:7},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/main.tsx",lineNumber:12,columnNumber:5},void 0)},void 0,!1,{fileName:"D:/devlop/projects/printing system/src/main.tsx",lineNumber:11,columnNumber:3},void 0));export{xA as B,pA as G,SA as K,Xt as M,HI as S,v_ as T,Ut as a,_t as b,Et as c,pp as d,$t as e,op as f,Zp as g,lp as h,si as i,m as j,UI as k,qI as l,Le as m,fa as n,Ab as o,jb as p,Fr as q,jI as r,tx as s,FI as t,ni as u,KI as v};
