@mypixia/simplex-kiosk 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const g=require("react"),ca=require("qrcode"),da=require("react-barcode"),Di=require("axios");var qe={exports:{}},We={};/**
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const g=require("react"),ha=require("qrcode"),fa=require("react-barcode"),Wi=require("axios");var Ye={exports:{}},Le={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var co;function ha(){if(co)return We;co=1;var s=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function r(n,l,d){var h=null;if(d!==void 0&&(h=""+d),l.key!==void 0&&(h=""+l.key),"key"in l){d={};for(var w in l)w!=="key"&&(d[w]=l[w])}else d=l;return l=d.ref,{$$typeof:s,type:n,key:h,ref:l!==void 0?l:null,props:d}}return We.Fragment=o,We.jsx=r,We.jsxs=r,We}var Be={};/**
9
+ */var fo;function ua(){if(fo)return Le;fo=1;var s=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function r(n,l,d){var h=null;if(d!==void 0&&(h=""+d),l.key!==void 0&&(h=""+l.key),"key"in l){d={};for(var w in l)w!=="key"&&(d[w]=l[w])}else d=l;return l=d.ref,{$$typeof:s,type:n,key:h,ref:l!==void 0?l:null,props:d}}return Le.Fragment=o,Le.jsx=r,Le.jsxs=r,Le}var Re={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,17 +14,17 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var ho;function fa(){return ho||(ho=1,process.env.NODE_ENV!=="production"&&function(){function s(m){if(m==null)return null;if(typeof m=="function")return m.$$typeof===ct?null:m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case _:return"Fragment";case q:return"Profiler";case K:return"StrictMode";case C:return"Suspense";case I:return"SuspenseList";case ot:return"Activity"}if(typeof m=="object")switch(typeof m.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),m.$$typeof){case A:return"Portal";case lt:return(m.displayName||"Context")+".Provider";case D:return(m._context.displayName||"Context")+".Consumer";case V:var R=m.render;return m=m.displayName,m||(m=R.displayName||R.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case $:return R=m.displayName||null,R!==null?R:s(m.type)||"Memo";case v:R=m._payload,m=m._init;try{return s(m(R))}catch{}}return null}function o(m){return""+m}function r(m){try{o(m);var R=!1}catch{R=!0}if(R){R=console;var G=R.error,gt=typeof Symbol=="function"&&Symbol.toStringTag&&m[Symbol.toStringTag]||m.constructor.name||"Object";return G.call(R,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",gt),o(m)}}function n(m){if(m===_)return"<>";if(typeof m=="object"&&m!==null&&m.$$typeof===v)return"<...>";try{var R=s(m);return R?"<"+R+">":"<...>"}catch{return"<...>"}}function l(){var m=ut.A;return m===null?null:m.getOwner()}function d(){return Error("react-stack-top-frame")}function h(m){if(U.call(m,"key")){var R=Object.getOwnPropertyDescriptor(m,"key").get;if(R&&R.isReactWarning)return!1}return m.key!==void 0}function w(m,R){function G(){st||(st=!0,console.error("%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://react.dev/link/special-props)",R))}G.isReactWarning=!0,Object.defineProperty(m,"key",{get:G,configurable:!0})}function k(){var m=s(this.type);return at[m]||(at[m]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),m=this.props.ref,m!==void 0?m:null}function T(m,R,G,gt,wt,kt,Dt,At){return G=kt.ref,m={$$typeof:W,type:m,key:R,props:kt,_owner:wt},(G!==void 0?G:null)!==null?Object.defineProperty(m,"ref",{enumerable:!1,get:k}):Object.defineProperty(m,"ref",{enumerable:!1,value:null}),m._store={},Object.defineProperty(m._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(m,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(m,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Dt}),Object.defineProperty(m,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:At}),Object.freeze&&(Object.freeze(m.props),Object.freeze(m)),m}function N(m,R,G,gt,wt,kt,Dt,At){var B=R.children;if(B!==void 0)if(gt)if(Z(B)){for(gt=0;gt<B.length;gt++)z(B[gt]);Object.freeze&&Object.freeze(B)}else console.error("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 z(B);if(U.call(R,"key")){B=s(m);var Ht=Object.keys(R).filter(function(he){return he!=="key"});gt=0<Ht.length?"{key: someKey, "+Ht.join(": ..., ")+": ...}":"{key: someKey}",bt[B+gt]||(Ht=0<Ht.length?"{"+Ht.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var uo;function ga(){return uo||(uo=1,process.env.NODE_ENV!=="production"&&function(){function s(m){if(m==null)return null;if(typeof m=="function")return m.$$typeof===at?null:m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case $:return"Fragment";case Y:return"Profiler";case Z:return"StrictMode";case F:return"Suspense";case ut:return"SuspenseList";case v:return"Activity"}if(typeof m=="object")switch(typeof m.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),m.$$typeof){case M:return"Portal";case lt:return(m.displayName||"Context")+".Provider";case R:return(m._context.displayName||"Context")+".Consumer";case _:var L=m.render;return m=m.displayName,m||(m=L.displayName||L.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case E:return L=m.displayName||null,L!==null?L:s(m.type)||"Memo";case ot:L=m._payload,m=m._init;try{return s(m(L))}catch{}}return null}function o(m){return""+m}function r(m){try{o(m);var L=!1}catch{L=!0}if(L){L=console;var Q=L.error,ft=typeof Symbol=="function"&&Symbol.toStringTag&&m[Symbol.toStringTag]||m.constructor.name||"Object";return Q.call(L,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",ft),o(m)}}function n(m){if(m===$)return"<>";if(typeof m=="object"&&m!==null&&m.$$typeof===ot)return"<...>";try{var L=s(m);return L?"<"+L+">":"<...>"}catch{return"<...>"}}function l(){var m=ct.A;return m===null?null:m.getOwner()}function d(){return Error("react-stack-top-frame")}function h(m){if(q.call(m,"key")){var L=Object.getOwnPropertyDescriptor(m,"key").get;if(L&&L.isReactWarning)return!1}return m.key!==void 0}function w(m,L){function Q(){J||(J=!0,console.error("%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://react.dev/link/special-props)",L))}Q.isReactWarning=!0,Object.defineProperty(m,"key",{get:Q,configurable:!0})}function k(){var m=s(this.type);return ht[m]||(ht[m]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),m=this.props.ref,m!==void 0?m:null}function z(m,L,Q,ft,zt,kt,Ht,It){return Q=kt.ref,m={$$typeof:D,type:m,key:L,props:kt,_owner:zt},(Q!==void 0?Q:null)!==null?Object.defineProperty(m,"ref",{enumerable:!1,get:k}):Object.defineProperty(m,"ref",{enumerable:!1,value:null}),m._store={},Object.defineProperty(m._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(m,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(m,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Ht}),Object.defineProperty(m,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:It}),Object.freeze&&(Object.freeze(m.props),Object.freeze(m)),m}function N(m,L,Q,ft,zt,kt,Ht,It){var jt=L.children;if(jt!==void 0)if(ft)if(O(jt)){for(ft=0;ft<jt.length;ft++)T(jt[ft]);Object.freeze&&Object.freeze(jt)}else console.error("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 T(jt);if(q.call(L,"key")){jt=s(m);var B=Object.keys(L).filter(function(X){return X!=="key"});ft=0<B.length?"{key: someKey, "+B.join(": ..., ")+": ...}":"{key: someKey}",H[jt+ft]||(B=0<B.length?"{"+B.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,gt,B,Ht,B),bt[B+gt]=!0)}if(B=null,G!==void 0&&(r(G),B=""+G),h(R)&&(r(R.key),B=""+R.key),"key"in R){G={};for(var X in R)X!=="key"&&(G[X]=R[X])}else G=R;return B&&w(G,typeof m=="function"?m.displayName||m.name||"Unknown":m),T(m,B,kt,wt,l(),G,Dt,At)}function z(m){typeof m=="object"&&m!==null&&m.$$typeof===W&&m._store&&(m._store.validated=1)}var S=g,W=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),q=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),lt=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),ot=Symbol.for("react.activity"),ct=Symbol.for("react.client.reference"),ut=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=Object.prototype.hasOwnProperty,Z=Array.isArray,it=console.createTask?console.createTask:function(){return null};S={"react-stack-bottom-frame":function(m){return m()}};var st,at={},F=S["react-stack-bottom-frame"].bind(S,d)(),M=it(n(d)),bt={};Be.Fragment=_,Be.jsx=function(m,R,G,gt,wt){var kt=1e4>ut.recentlyCreatedOwnerStacks++;return N(m,R,G,!1,gt,wt,kt?Error("react-stack-top-frame"):F,kt?it(n(m)):M)},Be.jsxs=function(m,R,G,gt,wt){var kt=1e4>ut.recentlyCreatedOwnerStacks++;return N(m,R,G,!0,gt,wt,kt?Error("react-stack-top-frame"):F,kt?it(n(m)):M)}}()),Be}var fo;function ua(){return fo||(fo=1,process.env.NODE_ENV==="production"?qe.exports=ha():qe.exports=fa()),qe.exports}var e=ua();const tt=({name:s,size:o=24,color:r="#000000",...n})=>{const l={briefcase:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375 7.444 2.25 12 2.25s8.25 1.847 8.25 4.125zM12 12.75c4.556 0 8.25-1.847 8.25-4.125v-2.35c-1.64 1.263-4.54 2.1-8.25 2.1s-6.61-.837-8.25-2.1v2.35c0 2.278 3.694 4.125 8.25 4.125z",money:"M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2zm0 2c-4.418 0-8 3.582-8 8s3.582 8 8 8 8-3.582 8-8-3.582-8-8-8zm1 8V9.5c0-.828.672-1.5 1.5-1.5S16 8.672 16 9.5V10h-1v-.5c0-.276-.224-.5-.5-.5s-.5.224-.5.5V12c0 .828-.672 1.5-1.5 1.5S11 12.828 11 12v-.5h1v.5c0 .276.224.5.5.5s.5-.224.5-.5z",chart:"M3 3v18h18v-2H5V3H3zm4 12V9h2v6H7zm4 0V7h2v8h-2zm4 0v-4h2v4h-2z",target:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm0 10c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z",laptop:"M20 18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2h-4zM4 6h16v10H4V6z",phone:"M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z",wifi:"M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.07 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z",camera:"M9 2l1.17 1H15v1H9.83L8.66 2H9zm-4 7h14l-1 9H6l-1-9zm7 8c1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3 1.34 3 3 3z",email:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z",message:"M20 2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h4v3c0 .6.4 1 1 1h.5c.2 0 .4-.1.6-.2L15.5 18H20c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z",notification:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z",like:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z",share:"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z",user:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z",users:"M16 4c0-1.11.89-2 2-2s2 .89 2 2-.89 2-2 2-2-.89-2-2zM4 4c0-1.11.89-2 2-2s2 .89 2 2-.89 2-2 2-2-.89-2-2zm5 0c0-1.11.89-2 2-2s2 .89 2 2-.89 2-2 2-2-.89-2-2zM12 14v8H4v-8c0-2.66 5.33-4 8-4s8 1.34 8 4v8h-8z",cart:"M7 18c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12L8.1 13h7.45c.75 0 1.41-.41 1.75-1.03L21.7 4H5.21l-.94-2H1zm16 16c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z",bag:"M19 7h-3V6c0-2.76-2.24-5-5-5S6 3.24 6 6v1H3c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2zM8 6c0-1.66 1.34-3 3-3s3 1.34 3 3v1H8V6zm11 15H5V9h2v1c0 .55.45 1 1 1s1-.45 1-1V9h6v1c0 .55.45 1 1 1s1-.45 1-1V9h2v12z",gift:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.68C10.96 2.54 10.05 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h1v6c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2v-6h1c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2z",plane:"M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z",car:"M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.22.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z",location:"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z",home:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z",coffee:"M2 21h18v-2H2v2zM20 8H3v10h17V8zM5 10h12v6H5v-6zM21 5V3h-2v2H3v2h16v-2z",pizza:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z",sun:"M6.76 4.84l-1.8-1.79-1.41 1.41 1.79 1.79 1.42-1.41zM4 10.5H1v2h3v-2zm9-9.95h-2V3.5h2V.55zm7.45 3.91l-1.41-1.41-1.79 1.79 1.41 1.41 1.79-1.79zm-3.21 13.7l1.79 1.8 1.41-1.41-1.8-1.79-1.4 1.4zM20 10.5v2h3v-2h-3zm-8-5c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm-1 16.95h2V19.5h-2v2.95zm-7.45-3.91l1.41 1.41 1.79-1.8-1.41-1.41-1.79 1.8z",cloud:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z",tree:"M16.5 12c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5-1.5-.67-1.5-1.5.67-1.5 1.5-1.5zM9 13c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm3-6c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1z",soccer:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z",basketball:"M17.09 11h4.86c-.16-1.61-.71-3.11-1.54-4.4-1.69.83-2.81 2.54-3.32 4.4zM6.91 11c-.51-1.86-1.63-3.57-3.32-4.4-.83 1.29-1.38 2.79-1.54 4.4h4.86z",music:"M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z",video:"M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z",gamepad:"M15 7.5V2H9v5.5l3 3 3-3zM7.5 9H2v6h5.5l3-3-3-3zM9 16.5V22h6v-5.5l-3-3-3 3zM16.5 9l3 3 3-3H22V2h-5.5z",health:"M9.8 17.3l4.2-4.2L18.2 17c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L15.4 11.4l4.2-4.2c.39-.39.39-1.02 0-1.41-.39-.39-1.02-.39-1.41 0L14 9.8l-4.2-4.2c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41l4.2 4.2-4.2 4.2c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0z",medical:"M19 8h-2v3h-3v2h3v3h2v-3h3v-2h-3V8zM4 6h9v2H4zm0 5h9v2H4zm0 5h6v2H4z",lock:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z",shield:"M12,1L3,5V11C3,16.55 6.84,21.74 12,23C17.16,21.74 21,16.55 21,11V5L12,1M12,7C13.4,7 14.8,8.6 14.8,10V11H15.7V16H8.3V11H9.2V10C9.2,8.6 10.6,7 12,7M12,8.2C11.2,8.2 10.5,8.7 10.5,10V11H13.5V10C13.5,8.7 12.8,8.2 12,8.2Z",wrench:"M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z",gear:"M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z",book:"M18 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM6 4h5v8l-2.5-1.5L6 12V4z",graduation:"M5 13.18v4L12 21l7-3.82v-4L12 17l-7-3.82zM12 3L1 9l11 6 9-4.91V17h2V9L12 3z",arrowUp:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z",arrowDown:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6z",arrowLeft:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6z",arrowRight:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6z",close:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",check:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z",plus:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z",minus:"M19 13H5v-2h14v2z",sparkle:"M19 9l1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25L19 9zm-7.5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12l-5.5-2.5zM19 15l-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25L19 15z",undo:"M12.5 8c-2.65 0-5.05 1.04-6.83 2.73L3 8v8h8l-2.81-2.81C9.62 11.85 10.97 11.2 12.5 11.2c2.96 0 5.48 1.87 6.44 4.5L21 14.9C19.72 11.04 16.42 8 12.5 8z",redo:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-3.92 0-7.22 3.04-8.5 6.9l2.06.77C5.98 13.07 8.47 11.2 11.5 11.2c1.53 0 2.88.65 3.81 1.69L13 15h7V8l-1.6 2.6z",rotateRight:"M15.55 5.55L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45zM19.93 11c-.17-1.39-.72-2.73-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47h2.02zM13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03zm3.89-2.42l1.42 1.41c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.48z",rotateLeft:"M7.11 8.53L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47zM6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47zm1.01 5.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.14-1.71-.48-2.46-1.03L7.1 18.32zM13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93z",text:"M5 4v3h5.5v12h3V7H19V4H5z",move:"M10 9h4V6h3l-5-5-5 5h3v3zm-1 1H6V7l-5 5 5 5v-3h3v-4zm14 2l-5-5v3h-3v4h3v3l5-5zm-9 3h-4v3H8l5 5 5-5h-3v-3z",shapes:"M11 13.5v8h2v-8h8v-2h-8v-8h-2v8h-8v2h8z",upload:"M9 16h6v-6h4l-7-7-7 7h4v6zm-4 2h14v2H5v-2z",cloudUpload:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z",image:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z",sticker:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.5-9c.83 0 1.5-.67 1.5-1.5S17.33 8 16.5 8 15 8.67 15 9.5s.67 1.5 1.5 1.5zm-9 0c.83 0 1.5-.67 1.5-1.5S8.33 8 7.5 8 6 8.67 6 9.5 6.67 11 7.5 11zm4.5 6.5c2.03 0 3.8-1.11 4.75-2.75.19-.33-.05-.75-.44-.75H7.69c-.38 0-.63.42-.44.75.95 1.64 2.72 2.75 4.75 2.75z",qrcode:"M3 11h2v2H3v-2zm8-6h2v4h-2V5zM3 3v6h6V3H3zm4 4H5V5h2v2zm-4 14h6v-6H3v6zm2-4h2v2H5v-2zM15 3v6h6V3h-6zm4 4h-2V5h2v2zm-4 8h2v2h2v2h-2v-2h-2v-2zm-2-2h2v2h-2v-2zm4 0h2v2h-2v-2zm2 4h2v2h-2v-2zm0-4h2v2h-2v-2zM11 13h2v4h-2v-4z",barcode:"M2 4h2v16H2V4zm4 0h1v16H6V4zm3 0h2v16H9V4zm4 0h1v16h-1V4zm3 0h2v16h-2V4zm4 0h2v16h-2V4z",thread:"M19.38 3.9L18.2 2.72a1.5 1.5 0 00-2.12 0l-1.41 1.41L3 15.79V21h5.21l11.66-11.66 1.41-1.41a1.5 1.5 0 000-2.12L19.38 3.9zM7.79 19H5v-2.79l9.95-9.95 2.79 2.79L7.79 19z",duplicate:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z",trash:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z",grid:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z",ruler:"M21 6H3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 10H3V8h2v4h2V8h2v4h2V8h2v4h2V8h2v4h2V8h2v4z",magnet:"M3 7v6c0 5.52 4.48 10 10 10h1V13h-2v8.95C7.83 21.45 5 18.05 5 14V7H3zm18 0h-2v7c0 4.05-2.83 7.45-7 7.95V13h-2v10h1c5.52 0 10-4.48 10-10V7z",rectangle:"M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 12H5V7h14v10z",circle:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z",triangle:"M12 2L1 21h22L12 2zm0 4l7.53 13H4.47L12 6z",star:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z",heart:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z",diamond:"M12 2L2 12l10 10 10-10L12 2zm0 2.83L19.17 12 12 19.17 4.83 12 12 4.83z",hexagon:"M12 2l-8.66 5v10L12 22l8.66-5V7L12 2zm6.66 13.87L12 19.87l-6.66-4V8.13L12 4.13l6.66 4v7.74z",pentagon:"M12 2L2 9l4 12h12l4-12L12 2z",oval:"M12 6c-4.42 0-8 2.69-8 6s3.58 6 8 6 8-2.69 8-6-3.58-6-8-6z",roundedRect:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z",horizontalLine:"M2 12h20",arrowShape:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z",rain:"M6 14c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97C6.22 4.56 8.51 3 11.2 3c2.31 0 4.36 1.25 5.46 3.1C17.43 6.04 18 6.96 18 8c0 1.1-.9 2-2 2H6zm2 6h2v2H8v-2zm4 0h2v2h-2v-2zm-2-3h2v2h-2v-2z",snow:"M22 11h-4.17l3.24-3.24-1.41-1.42L15.83 10H13V7.17l3.24-3.24-1.42-1.41L12 5.83 9.17 2.52 7.76 3.93 11 7.17V10H8.17l-3.24-3.24L3.52 8.17 6.76 11.41H2v2h4.17l-3.24 3.24 1.41 1.42L8.17 14H11v2.83l-3.24 3.24 1.42 1.41L12 18.17l2.83 3.31 1.41-1.41L13 16.83V14h2.83l3.24 3.24 1.42-1.41L17.24 12.59H22v-1z"},d=new Set(["horizontalLine","ruler"]),h=l[s];if(!h)return console.warn(`Icon "${s}" not found`),null;const w=d.has(s);return e.jsx("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:w?"none":r,stroke:w?r:void 0,strokeWidth:w?2:void 0,...n,children:e.jsx("path",{d:h})})},de=[{id:1,text:"DREAM BIG",category:"Motivational",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FF6B35",hasBackground:!0,backgroundColor:"#1A1A1A",textAlign:"center",textTransform:"uppercase"},{id:2,text:"Never Give Up",category:"Motivational",fontSize:28,fontFamily:"Georgia",fontWeight:"bold",fill:"#2E8B57",fontStyle:"italic",textAlign:"center"},{id:3,text:"BE YOURSELF",category:"Motivational",fontSize:24,fontFamily:"Arial",fontWeight:"700",fill:"#FF1493",textTransform:"uppercase",letterSpacing:2},{id:4,text:"Stay Strong",category:"Motivational",fontSize:26,fontFamily:"Verdana",fontWeight:"bold",fill:"#4169E1",hasTextShadow:!0,textShadowX:2,textShadowY:2,textShadowBlur:4,textShadowColor:"#000000"},{id:5,text:"RISE & SHINE",category:"Motivational",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700",hasBackground:!0,backgroundColor:"#8B0000",textAlign:"center"},{id:6,text:"Believe in Magic",category:"Motivational",fontSize:22,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB",textAlign:"center"},{id:7,text:"UNSTOPPABLE",category:"Motivational",fontSize:28,fontFamily:"Arial",fontWeight:"900",fill:"#DC143C",textTransform:"uppercase",letterSpacing:1.5},{id:8,text:"Chase Your Dreams",category:"Motivational",fontSize:24,fontFamily:"Georgia",fill:"#20B2AA",fontWeight:"600"},{id:9,text:"FEARLESS",category:"Motivational",fontSize:36,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",textAlign:"center",hasBackground:!0,backgroundColor:"#000000"},{id:10,text:"Make It Happen",category:"Motivational",fontSize:26,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#32CD32"},{id:11,text:"BORN TO WIN",category:"Motivational",fontSize:24,fontFamily:"Arial",fontWeight:"800",fill:"#FFD700",hasBackground:!0,backgroundColor:"#800080",textAlign:"center"},{id:12,text:"Positive Vibes Only",category:"Motivational",fontSize:20,fontFamily:"Comic Sans MS",fill:"#FF69B4",fontWeight:"600"},{id:13,text:"LIMITLESS",category:"Motivational",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#1E90FF",textTransform:"uppercase",letterSpacing:3},{id:14,text:"Embrace The Journey",category:"Motivational",fontSize:22,fontFamily:"Georgia",fontStyle:"italic",fill:"#8B4513"},{id:15,text:"STRENGTH WITHIN",category:"Motivational",fontSize:26,fontFamily:"Verdana",fontWeight:"bold",fill:"#696969",hasBackground:!0,backgroundColor:"#F0F8FF"},{id:16,text:"Create Your Own Sunshine",category:"Motivational",fontSize:18,fontFamily:"Palatino",fill:"#FF8C00",fontWeight:"600"},{id:17,text:"WARRIOR SPIRIT",category:"Motivational",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#B22222",textAlign:"center"},{id:18,text:"Keep Going",category:"Motivational",fontSize:30,fontFamily:"Arial",fontWeight:"700",fill:"#228B22"},{id:19,text:"FOCUS & WIN",category:"Motivational",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082",hasBackground:!0,backgroundColor:"#FFFF00"},{id:20,text:"Inspire Others",category:"Motivational",fontSize:26,fontFamily:"Georgia",fill:"#CD853F",fontStyle:"italic"},{id:21,text:"GAME CHANGER",category:"Motivational",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#FF1493",textAlign:"center"},{id:22,text:"Live With Purpose",category:"Motivational",fontSize:22,fontFamily:"Palatino",fill:"#2F4F4F",fontWeight:"600"},{id:23,text:"BREAKTHROUGH",category:"Motivational",fontSize:28,fontFamily:"Arial",fontWeight:"900",fill:"#DC143C",letterSpacing:2},{id:24,text:"Shine Bright",category:"Motivational",fontSize:32,fontFamily:"Verdana",fontWeight:"bold",fill:"#FFD700",hasTextShadow:!0,textShadowX:3,textShadowY:3,textShadowBlur:6,textShadowColor:"#000000"},{id:25,text:"NEVER SETTLE",category:"Motivational",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",hasBackground:!0,backgroundColor:"#000080"},{id:26,text:"CEO MINDSET",category:"Business",fontSize:28,fontFamily:"Arial",fontWeight:"bold",fill:"#2F4F4F",textAlign:"center",hasBackground:!0,backgroundColor:"#F5F5F5"},{id:27,text:"Innovation Starts Here",category:"Business",fontSize:20,fontFamily:"Trebuchet MS",fill:"#4169E1",fontWeight:"600"},{id:28,text:"PROFESSIONAL",category:"Business",fontSize:24,fontFamily:"Georgia",fontWeight:"bold",fill:"#000080",letterSpacing:1},{id:29,text:"Excellence Every Day",category:"Business",fontSize:22,fontFamily:"Verdana",fill:"#8B0000",fontWeight:"600"},{id:30,text:"LEADERSHIP",category:"Business",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#B8860B",textAlign:"center"},{id:31,text:"Think Different",category:"Business",fontSize:26,fontFamily:"Palatino",fontStyle:"italic",fill:"#696969"},{id:32,text:"RESULTS DRIVEN",category:"Business",fontSize:24,fontFamily:"Arial",fontWeight:"800",fill:"#DC143C",hasBackground:!0,backgroundColor:"#F0F8FF"},{id:33,text:"Strategic Vision",category:"Business",fontSize:22,fontFamily:"Georgia",fill:"#2E8B57",fontWeight:"700"},{id:34,text:"PRODUCTIVITY",category:"Business",fontSize:28,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082"},{id:35,text:"Success Mindset",category:"Business",fontSize:24,fontFamily:"Verdana",fill:"#FF8C00",fontWeight:"600"},{id:36,text:"EXPERT LEVEL",category:"Business",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#000000",hasBackground:!0,backgroundColor:"#FFD700"},{id:37,text:"Quality First",category:"Business",fontSize:30,fontFamily:"Arial",fontWeight:"700",fill:"#228B22"},{id:38,text:"INTEGRITY",category:"Business",fontSize:32,fontFamily:"Georgia",fontWeight:"bold",fill:"#2F4F4F",textAlign:"center"},{id:39,text:"Growth Focused",category:"Business",fontSize:20,fontFamily:"Palatino",fill:"#20B2AA",fontWeight:"600"},{id:40,text:"COLLABORATION",category:"Business",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#9370DB"},{id:41,text:"Performance Matters",category:"Business",fontSize:22,fontFamily:"Verdana",fill:"#B22222",fontWeight:"700"},{id:42,text:"ACCOUNTABILITY",category:"Business",fontSize:26,fontFamily:"Arial",fontWeight:"800",fill:"#8B4513",letterSpacing:1.5},{id:43,text:"Vision to Reality",category:"Business",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#4169E1"},{id:44,text:"TRANSFORMATION",category:"Business",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",textAlign:"center"},{id:45,text:"Excellence Standard",category:"Business",fontSize:22,fontFamily:"Palatino",fill:"#2E8B57",fontWeight:"600"},{id:46,text:"EFFICIENCY",category:"Business",fontSize:30,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#000080"},{id:47,text:"Forward Thinking",category:"Business",fontSize:24,fontFamily:"Verdana",fill:"#CD853F",fontWeight:"700"},{id:48,text:"ACHIEVEMENT",category:"Business",fontSize:26,fontFamily:"Arial",fontWeight:"bold",fill:"#B8860B",hasBackground:!0,backgroundColor:"#F5F5DC"},{id:49,text:"Strategic Excellence",category:"Business",fontSize:20,fontFamily:"Georgia",fill:"#696969",fontWeight:"600"},{id:50,text:"IMPACT MAKER",category:"Business",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#DC143C",textAlign:"center"},{id:51,text:"COFFEE FIRST",category:"Funny",fontSize:28,fontFamily:"Comic Sans MS",fontWeight:"bold",fill:"#8B4513",hasBackground:!0,backgroundColor:"#F5DEB3"},{id:52,text:"I'm Not Lazy, I'm Energy Efficient",category:"Funny",fontSize:16,fontFamily:"Arial",fill:"#FF69B4",fontWeight:"600"},{id:53,text:"SARCASM LOADING...",category:"Funny",fontSize:24,fontFamily:"Courier New",fontWeight:"bold",fill:"#32CD32",textAlign:"center"},{id:54,text:"Powered By Pizza",category:"Funny",fontSize:26,fontFamily:"Comic Sans MS",fill:"#FF6347",fontWeight:"700"},{id:55,text:"CTRL + ALT + DELETE MONDAY",category:"Funny",fontSize:18,fontFamily:"Courier New",fontWeight:"bold",fill:"#4169E1"},{id:56,text:"Brain 404 Error",category:"Funny",fontSize:22,fontFamily:"Arial",fill:"#FF1493",fontWeight:"600"},{id:57,text:"WEEKEND WARRIOR",category:"Funny",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700",hasBackground:!0,backgroundColor:"#000080"},{id:58,text:"Adulting is Hard",category:"Funny",fontSize:24,fontFamily:"Comic Sans MS",fill:"#9370DB",fontWeight:"600"},{id:59,text:"PROCRASTINATION EXPERT",category:"Funny",fontSize:20,fontFamily:"Arial",fontWeight:"bold",fill:"#FF4500"},{id:60,text:"Netflix & Chill Champion",category:"Funny",fontSize:18,fontFamily:"Trebuchet MS",fill:"#DC143C",fontWeight:"600"},{id:61,text:"CHAOS COORDINATOR",category:"Funny",fontSize:24,fontFamily:"Impact",fontWeight:"bold",fill:"#FF69B4",textAlign:"center"},{id:62,text:"I Speak Fluent Sarcasm",category:"Funny",fontSize:20,fontFamily:"Georgia",fontStyle:"italic",fill:"#2E8B57"},{id:63,text:"SLEEP IS FOR THE WEAK",category:"Funny",fontSize:22,fontFamily:"Arial",fontWeight:"800",fill:"#B22222"},{id:64,text:"Professional Overthinker",category:"Funny",fontSize:20,fontFamily:"Verdana",fill:"#4B0082",fontWeight:"600"},{id:65,text:"WIFI PASSWORD PLEASE",category:"Funny",fontSize:20,fontFamily:"Courier New",fontWeight:"bold",fill:"#32CD32"},{id:66,text:"Certified Couch Potato",category:"Funny",fontSize:22,fontFamily:"Comic Sans MS",fill:"#FF8C00",fontWeight:"700"},{id:67,text:"SOCIAL DISTANCING CHAMPION",category:"Funny",fontSize:16,fontFamily:"Arial",fontWeight:"bold",fill:"#20B2AA"},{id:68,text:"Powered By Caffeine",category:"Funny",fontSize:24,fontFamily:"Impact",fill:"#8B4513",fontWeight:"bold"},{id:69,text:"EMERGENCY CHOCOLATE NEEDED",category:"Funny",fontSize:18,fontFamily:"Comic Sans MS",fontWeight:"bold",fill:"#D2691E"},{id:70,text:"I'm Not Short, I'm Fun Size",category:"Funny",fontSize:20,fontFamily:"Trebuchet MS",fill:"#FF1493",fontWeight:"600"},{id:71,text:"CTRL + Z MY LIFE",category:"Funny",fontSize:26,fontFamily:"Courier New",fontWeight:"bold",fill:"#4169E1"},{id:72,text:"Error 404: Motivation Not Found",category:"Funny",fontSize:16,fontFamily:"Arial",fill:"#FF4500",fontWeight:"600"},{id:73,text:"PROFESSIONAL WEIRDO",category:"Funny",fontSize:24,fontFamily:"Impact",fontWeight:"bold",fill:"#9370DB",textAlign:"center"},{id:74,text:"Snack Attack Mode",category:"Funny",fontSize:26,fontFamily:"Comic Sans MS",fill:"#FF6347",fontWeight:"700"},{id:75,text:"BATTERY LOW, NEED COFFEE",category:"Funny",fontSize:18,fontFamily:"Courier New",fontWeight:"bold",fill:"#8B4513"},{id:76,text:"Love You Forever",category:"Love",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#FF1493",textAlign:"center"},{id:77,text:"SOULMATES",category:"Love",fontSize:32,fontFamily:"Georgia",fontWeight:"bold",fill:"#DC143C",hasBackground:!0,backgroundColor:"#FFE4E1"},{id:78,text:"Better Together",category:"Love",fontSize:26,fontFamily:"Trebuchet MS",fill:"#FF69B4",fontWeight:"600"},{id:79,text:"ENDLESS LOVE",category:"Love",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#B22222",textAlign:"center"},{id:80,text:"You Complete Me",category:"Love",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#8B0000"},{id:81,text:"FOREVER & ALWAYS",category:"Love",fontSize:24,fontFamily:"Arial",fontWeight:"bold",fill:"#FF1493",letterSpacing:1},{id:82,text:"My Heart Belongs To You",category:"Love",fontSize:20,fontFamily:"Palatino",fill:"#DC143C",fontWeight:"600"},{id:83,text:"PURE LOVE",category:"Love",fontSize:34,fontFamily:"Impact",fontWeight:"bold",fill:"#FF69B4",hasTextShadow:!0,textShadowX:2,textShadowY:2,textShadowBlur:4,textShadowColor:"#000000"},{id:84,text:"Together Forever",category:"Love",fontSize:26,fontFamily:"Georgia",fill:"#8B0000",fontWeight:"700",textAlign:"center"},{id:85,text:"MATCH MADE IN HEAVEN",category:"Love",fontSize:20,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#FF1493"},{id:86,text:"Love Story",category:"Love",fontSize:32,fontFamily:"Palatino",fontStyle:"italic",fill:"#B22222"},{id:87,text:"HEARTBEAT",category:"Love",fontSize:28,fontFamily:"Arial",fontWeight:"800",fill:"#DC143C",hasBackground:!0,backgroundColor:"#FFF0F5"},{id:88,text:"You Are My Sunshine",category:"Love",fontSize:22,fontFamily:"Georgia",fill:"#FF8C00",fontWeight:"600"},{id:89,text:"DESTINY",category:"Love",fontSize:36,fontFamily:"Impact",fontWeight:"bold",fill:"#8B0000",textAlign:"center"},{id:90,text:"True Love Waits",category:"Love",fontSize:24,fontFamily:"Palatino",fontStyle:"italic",fill:"#FF1493"},{id:91,text:"BELOVED",category:"Love",fontSize:30,fontFamily:"Georgia",fontWeight:"bold",fill:"#B22222",letterSpacing:2},{id:92,text:"Love Conquers All",category:"Love",fontSize:26,fontFamily:"Trebuchet MS",fill:"#DC143C",fontWeight:"700"},{id:93,text:"PERFECT MATCH",category:"Love",fontSize:24,fontFamily:"Arial",fontWeight:"bold",fill:"#FF69B4",hasBackground:!0,backgroundColor:"#000000"},{id:94,text:"Always & Forever",category:"Love",fontSize:28,fontFamily:"Georgia",fontStyle:"italic",fill:"#8B0000",textAlign:"center"},{id:95,text:"ROMANCE",category:"Love",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FF1493"},{id:96,text:"Love Never Fails",category:"Love",fontSize:24,fontFamily:"Palatino",fill:"#B22222",fontWeight:"600"},{id:97,text:"ETERNAL LOVE",category:"Love",fontSize:28,fontFamily:"Arial",fontWeight:"800",fill:"#DC143C",letterSpacing:1.5},{id:98,text:"Heart & Soul",category:"Love",fontSize:30,fontFamily:"Georgia",fill:"#8B0000",fontWeight:"bold"},{id:99,text:"PASSIONATE",category:"Love",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",textAlign:"center"},{id:100,text:"Love Is Everything",category:"Love",fontSize:24,fontFamily:"Trebuchet MS",fill:"#FF1493",fontWeight:"700"},{id:101,text:"NO PAIN NO GAIN",category:"Sports",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",textAlign:"center",hasBackground:!0,backgroundColor:"#000000"},{id:102,text:"Train Hard",category:"Sports",fontSize:32,fontFamily:"Arial",fontWeight:"900",fill:"#B22222"},{id:103,text:"CHAMPION MINDSET",category:"Sports",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#FFD700",hasBackground:!0,backgroundColor:"#000080"},{id:104,text:"Beast Mode ON",category:"Sports",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#32CD32"},{id:105,text:"STRONGER EVERY DAY",category:"Sports",fontSize:22,fontFamily:"Arial",fontWeight:"800",fill:"#2E8B57",letterSpacing:1},{id:106,text:"Victory Mindset",category:"Sports",fontSize:28,fontFamily:"Georgia",fontWeight:"bold",fill:"#B8860B"},{id:107,text:"GAME TIME",category:"Sports",fontSize:34,fontFamily:"Impact",fontWeight:"bold",fill:"#FF1493",textAlign:"center"},{id:108,text:"Push Your Limits",category:"Sports",fontSize:24,fontFamily:"Trebuchet MS",fill:"#4169E1",fontWeight:"700"},{id:109,text:"ATHLETIC EXCELLENCE",category:"Sports",fontSize:20,fontFamily:"Arial",fontWeight:"bold",fill:"#DC143C"},{id:110,text:"Fitness First",category:"Sports",fontSize:30,fontFamily:"Verdana",fontWeight:"bold",fill:"#228B22"},{id:111,text:"UNSTOPPABLE FORCE",category:"Sports",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",hasTextShadow:!0,textShadowX:3,textShadowY:3,textShadowBlur:6,textShadowColor:"#000000"},{id:112,text:"Sweat Equity",category:"Sports",fontSize:28,fontFamily:"Georgia",fill:"#8B4513",fontWeight:"700"},{id:113,text:"PERFORMANCE ZONE",category:"Sports",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082"},{id:114,text:"Train Like A Champion",category:"Sports",fontSize:20,fontFamily:"Arial",fill:"#B22222",fontWeight:"600"},{id:115,text:"POWER WITHIN",category:"Sports",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FF8C00",textAlign:"center"},{id:116,text:"Maximum Effort",category:"Sports",fontSize:26,fontFamily:"Verdana",fill:"#2E8B57",fontWeight:"800"},{id:117,text:"ELITE ATHLETE",category:"Sports",fontSize:28,fontFamily:"Arial",fontWeight:"900",fill:"#FFD700",hasBackground:!0,backgroundColor:"#8B0000"},{id:118,text:"Rise Above",category:"Sports",fontSize:30,fontFamily:"Georgia",fontWeight:"bold",fill:"#4169E1"},{id:119,text:"COMPETITIVE EDGE",category:"Sports",fontSize:22,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#DC143C"},{id:120,text:"Strength & Honor",category:"Sports",fontSize:26,fontFamily:"Impact",fill:"#2F4F4F",fontWeight:"bold"},{id:121,text:"WINNING ATTITUDE",category:"Sports",fontSize:24,fontFamily:"Arial",fontWeight:"800",fill:"#32CD32",letterSpacing:1.5},{id:122,text:"Never Give Up",category:"Sports",fontSize:32,fontFamily:"Verdana",fontWeight:"bold",fill:"#FF4500"},{id:123,text:"ENDURANCE",category:"Sports",fontSize:36,fontFamily:"Impact",fontWeight:"bold",fill:"#228B22",textAlign:"center"},{id:124,text:"Peak Performance",category:"Sports",fontSize:24,fontFamily:"Georgia",fill:"#B8860B",fontWeight:"700"},{id:125,text:"DEDICATION PAYS OFF",category:"Sports",fontSize:20,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082"},{id:126,text:"STYLE ICON",category:"Lifestyle",fontSize:30,fontFamily:"Palatino",fontWeight:"bold",fill:"#000000",hasBackground:!0,backgroundColor:"#FFD700"},{id:127,text:"Chic & Unique",category:"Lifestyle",fontSize:28,fontFamily:"Georgia",fontStyle:"italic",fill:"#FF1493"},{id:128,text:"TRENDSETTER",category:"Lifestyle",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#9370DB",textAlign:"center"},{id:129,text:"Fashion Forward",category:"Lifestyle",fontSize:24,fontFamily:"Trebuchet MS",fill:"#FF69B4",fontWeight:"600"},{id:130,text:"BOUTIQUE VIBES",category:"Lifestyle",fontSize:22,fontFamily:"Arial",fontWeight:"bold",fill:"#4169E1"},{id:131,text:"Effortlessly Elegant",category:"Lifestyle",fontSize:20,fontFamily:"Georgia",fontStyle:"italic",fill:"#2F4F4F"},{id:132,text:"LUXE LIFESTYLE",category:"Lifestyle",fontSize:28,fontFamily:"Palatino",fontWeight:"bold",fill:"#B8860B",letterSpacing:2},{id:133,text:"Vintage Soul",category:"Lifestyle",fontSize:32,fontFamily:"Georgia",fill:"#8B4513",fontWeight:"700"},{id:134,text:"MODERN CLASSIC",category:"Lifestyle",fontSize:24,fontFamily:"Arial",fontWeight:"800",fill:"#000000"},{id:135,text:"Street Style",category:"Lifestyle",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500"},{id:136,text:"SOPHISTICATED",category:"Lifestyle",fontSize:26,fontFamily:"Palatino",fontWeight:"bold",fill:"#2E8B57",hasBackground:!0,backgroundColor:"#F5F5F5"},{id:137,text:"Boho Chic",category:"Lifestyle",fontSize:28,fontFamily:"Georgia",fontStyle:"italic",fill:"#CD853F"},{id:138,text:"MINIMALIST",category:"Lifestyle",fontSize:32,fontFamily:"Arial",fontWeight:"300",fill:"#696969",letterSpacing:3},{id:139,text:"Glamorous Life",category:"Lifestyle",fontSize:24,fontFamily:"Trebuchet MS",fill:"#FFD700",fontWeight:"700"},{id:140,text:"HAUTE COUTURE",category:"Lifestyle",fontSize:22,fontFamily:"Palatino",fontWeight:"bold",fill:"#4B0082"},{id:141,text:"Urban Explorer",category:"Lifestyle",fontSize:26,fontFamily:"Impact",fill:"#32CD32",fontWeight:"bold"},{id:142,text:"AESTHETIC VIBES",category:"Lifestyle",fontSize:24,fontFamily:"Arial",fontWeight:"600",fill:"#FF69B4"},{id:143,text:"Lifestyle Goals",category:"Lifestyle",fontSize:28,fontFamily:"Georgia",fill:"#20B2AA",fontWeight:"600"},{id:144,text:"PREMIUM QUALITY",category:"Lifestyle",fontSize:20,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#B22222"},{id:145,text:"Designer Dreams",category:"Lifestyle",fontSize:26,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB"},{id:146,text:"CURATED STYLE",category:"Lifestyle",fontSize:24,fontFamily:"Arial",fontWeight:"700",fill:"#2F4F4F",letterSpacing:1},{id:147,text:"Fashion Statement",category:"Lifestyle",fontSize:22,fontFamily:"Georgia",fill:"#FF1493",fontWeight:"600"},{id:148,text:"ARTISAN CRAFTED",category:"Lifestyle",fontSize:20,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#8B4513"},{id:149,text:"Timeless Elegance",category:"Lifestyle",fontSize:24,fontFamily:"Palatino",fontStyle:"italic",fill:"#000080"},{id:150,text:"SIGNATURE STYLE",category:"Lifestyle",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700",textAlign:"center"},{id:151,text:"HAPPY BIRTHDAY",category:"Holidays",fontSize:32,fontFamily:"Comic Sans MS",fontWeight:"bold",fill:"#FF69B4",hasBackground:!0,backgroundColor:"#FFFF00",textAlign:"center"},{id:152,text:"Merry Christmas",category:"Holidays",fontSize:30,fontFamily:"Georgia",fill:"#B22222",fontWeight:"700",hasTextShadow:!0,textShadowX:2,textShadowY:2,textShadowBlur:4,textShadowColor:"#228B22"},{id:153,text:"CELEBRATION TIME",category:"Holidays",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700"},{id:154,text:"Happy New Year",category:"Holidays",fontSize:26,fontFamily:"Trebuchet MS",fill:"#4169E1",fontWeight:"700"},{id:155,text:"THANKFUL HEART",category:"Holidays",fontSize:24,fontFamily:"Georgia",fontWeight:"bold",fill:"#FF8C00",textAlign:"center"},{id:156,text:"Easter Blessings",category:"Holidays",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB"},{id:157,text:"PARTY TIME",category:"Holidays",fontSize:34,fontFamily:"Impact",fontWeight:"bold",fill:"#FF1493",hasBackground:!0,backgroundColor:"#000000"},{id:158,text:"Halloween Spirit",category:"Holidays",fontSize:26,fontFamily:"Arial",fontWeight:"800",fill:"#FF4500"},{id:159,text:"FESTIVE MOOD",category:"Holidays",fontSize:30,fontFamily:"Georgia",fontWeight:"bold",fill:"#32CD32"},{id:160,text:"Valentine's Day",category:"Holidays",fontSize:24,fontFamily:"Palatino",fontStyle:"italic",fill:"#DC143C"},{id:161,text:"ANNIVERSARY JOY",category:"Holidays",fontSize:"22",fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#B8860B"},{id:162,text:"Graduation Day",category:"Holidays",fontSize:28,fontFamily:"Arial",fill:"#000080",fontWeight:"700"},{id:163,text:"SUMMER VIBES",category:"Holidays",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700",textAlign:"center"},{id:164,text:"Winter Wonderland",category:"Holidays",fontSize:20,fontFamily:"Georgia",fill:"#4169E1",fontWeight:"600"},{id:165,text:"MOTHER'S DAY LOVE",category:"Holidays",fontSize:22,fontFamily:"Palatino",fontWeight:"bold",fill:"#FF69B4"},{id:166,text:"Father's Day Hero",category:"Holidays",fontSize:24,fontFamily:"Arial",fill:"#2F4F4F",fontWeight:"700"},{id:167,text:"SPRING AWAKENING",category:"Holidays",fontSize:26,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#32CD32"},{id:168,text:"Holiday Magic",category:"Holidays",fontSize:30,fontFamily:"Georgia",fontStyle:"italic",fill:"#9370DB"},{id:169,text:"FAMILY GATHERING",category:"Holidays",fontSize:20,fontFamily:"Arial",fontWeight:"600",fill:"#8B4513"},{id:170,text:"Wedding Bliss",category:"Holidays",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#FFD700"},{id:171,text:"FIREWORKS NIGHT",category:"Holidays",fontSize:24,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500"},{id:172,text:"Autumn Leaves",category:"Holidays",fontSize:26,fontFamily:"Georgia",fill:"#D2691E",fontWeight:"600"},{id:173,text:"MILESTONE MOMENT",category:"Holidays",fontSize:22,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082"},{id:174,text:"Special Occasion",category:"Holidays",fontSize:24,fontFamily:"Arial",fill:"#B22222",fontWeight:"700"},{id:175,text:"CHEERS TO LIFE",category:"Holidays",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#20B2AA",textAlign:"center"},{id:176,text:'"Life is Beautiful"',category:"Quotes",fontSize:26,fontFamily:"Georgia",fontStyle:"italic",fill:"#2E8B57",textAlign:"center"},{id:177,text:"CARPE DIEM",category:"Quotes",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#B8860B",letterSpacing:2},{id:178,text:'"Choose Happiness"',category:"Quotes",fontSize:24,fontFamily:"Palatino",fontStyle:"italic",fill:"#FF69B4"},{id:179,text:"LIVE LAUGH LOVE",category:"Quotes",fontSize:24,fontFamily:"Arial",fontWeight:"600",fill:"#DC143C",textAlign:"center"},{id:180,text:'"Dream Without Fear"',category:"Quotes",fontSize:22,fontFamily:"Georgia",fontStyle:"italic",fill:"#4169E1"},{id:181,text:"WISDOM WITHIN",category:"Quotes",fontSize:28,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#2F4F4F"},{id:182,text:'"Create Your Story"',category:"Quotes",fontSize:20,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB"},{id:183,text:"INNER PEACE",category:"Quotes",fontSize:30,fontFamily:"Arial",fontWeight:"300",fill:"#20B2AA",letterSpacing:3},{id:184,text:'"Follow Your Heart"',category:"Quotes",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#FF1493"},{id:185,text:"GRATITUDE DAILY",category:"Quotes",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#FF8C00"},{id:186,text:'"Embrace Change"',category:"Quotes",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#32CD32"},{id:187,text:"MINDFUL LIVING",category:"Quotes",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"600",fill:"#4B0082"},{id:188,text:'"Stay Curious"',category:"Quotes",fontSize:30,fontFamily:"Georgia",fontStyle:"italic",fill:"#B22222"},{id:189,text:"PURPOSE DRIVEN",category:"Quotes",fontSize:28,fontFamily:"Arial",fontWeight:"700",fill:"#8B4513"},{id:190,text:'"Find Your Why"',category:"Quotes",fontSize:26,fontFamily:"Palatino",fontStyle:"italic",fill:"#CD853F"},{id:191,text:"AUTHENTIC SELF",category:"Quotes",fontSize:24,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500"},{id:192,text:'"Less is More"',category:"Quotes",fontSize:32,fontFamily:"Arial",fontWeight:"300",fill:"#696969",letterSpacing:2},{id:193,text:"PRESENT MOMENT",category:"Quotes",fontSize:26,fontFamily:"Georgia",fontWeight:"600",fill:"#2E8B57"},{id:194,text:'"Trust The Process"',category:"Quotes",fontSize:22,fontFamily:"Palatino",fontStyle:"italic",fill:"#4169E1"},{id:195,text:"BALANCED LIFE",category:"Quotes",fontSize:28,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#20B2AA"},{id:196,text:'"Spread Kindness"',category:"Quotes",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#FF69B4"},{id:197,text:"GROWTH MINDSET",category:"Quotes",fontSize:26,fontFamily:"Arial",fontWeight:"700",fill:"#32CD32"},{id:198,text:'"Be The Change"',category:"Quotes",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB"},{id:199,text:"INFINITE POSSIBILITIES",category:"Quotes",fontSize:20,fontFamily:"Impact",fontWeight:"bold",fill:"#B8860B"},{id:200,text:'"Leave Your Mark"',category:"Quotes",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#8B0000",textAlign:"center"},{id:201,text:"OPEN",category:"Signage",fontSize:44,fontFamily:"Bebas Neue",fill:"#111827",textAlign:"center",letterSpacing:6},{id:202,text:"EST. 2024",category:"Signage",fontSize:34,fontFamily:"Staatliches",fill:"#374151",textAlign:"center",letterSpacing:3},{id:203,text:"VINTAGE",category:"Signage",fontSize:36,fontFamily:"Alfa Slab One",fill:"#6d4c41",textAlign:"center"},{id:204,text:"MARKET",category:"Signage",fontSize:38,fontFamily:"Anton",fill:"#1f2937",textAlign:"center",letterSpacing:8},{id:205,text:"WELCOME",category:"Signage",fontSize:40,fontFamily:"Bebas Neue",fill:"#0f766e",textAlign:"center",letterSpacing:5},{id:206,text:"OFF DUTY",category:"Streetwear",fontSize:38,fontFamily:"Archivo Black",fill:"#111827",textAlign:"center"},{id:207,text:"STAY HUMBLE",category:"Streetwear",fontSize:30,fontFamily:"Bebas Neue",fill:"#e11d48",textAlign:"center",letterSpacing:4},{id:208,text:"NO RULES",category:"Streetwear",fontSize:34,fontFamily:"Bungee",fill:"#7c3aed",textAlign:"center"},{id:209,text:"HYPE",category:"Streetwear",fontSize:44,fontFamily:"Titan One",fill:"#f59e0b",textAlign:"center"},{id:210,text:"BORN TO STAND OUT",category:"Streetwear",fontSize:24,fontFamily:"Anton",fill:"#111827",textAlign:"center",letterSpacing:2},{id:211,text:"Forever & Always",category:"Wedding",fontSize:38,fontFamily:"Great Vibes",fill:"#9d174d",textAlign:"center"},{id:212,text:"Mr & Mrs",category:"Wedding",fontSize:44,fontFamily:"Great Vibes",fill:"#3f3f46",textAlign:"center"},{id:213,text:"Just Married",category:"Wedding",fontSize:36,fontFamily:"Pacifico",fill:"#be123c",textAlign:"center"},{id:214,text:"Save the Date",category:"Wedding",fontSize:34,fontFamily:"Dancing Script",fontWeight:"700",fill:"#1f2937",textAlign:"center"},{id:215,text:"A",category:"Monogram",fontSize:72,fontFamily:"Playfair Display",fontWeight:"700",fill:"#1f2937",textAlign:"center"},{id:216,text:"M & J",category:"Monogram",fontSize:44,fontFamily:"Great Vibes",fill:"#7c2d12",textAlign:"center"},{id:217,text:"EST. YOU",category:"Monogram",fontSize:30,fontFamily:"Staatliches",fill:"#111827",textAlign:"center",letterSpacing:4},{id:218,text:"RETRO",category:"Retro",fontSize:40,fontFamily:"Bungee Inline",fill:"#0ea5e9",textAlign:"center"},{id:219,text:"Sunset Vibes",category:"Retro",fontSize:36,fontFamily:"Lobster",fill:"#ea580c",textAlign:"center"},{id:220,text:"Good Times",category:"Retro",fontSize:36,fontFamily:"Pacifico",fill:"#b45309",textAlign:"center"},{id:221,text:"CLASSIC",category:"Retro",fontSize:34,fontFamily:"Playfair Display",fontStyle:"italic",fontWeight:"700",fill:"#3f3f46",textAlign:"center",letterSpacing:3},{id:222,text:"ADVENTURE AWAITS",category:"Outdoors",fontSize:24,fontFamily:"Oswald",fontWeight:"700",fill:"#166534",textAlign:"center",letterSpacing:3},{id:223,text:"Wander",category:"Outdoors",fontSize:44,fontFamily:"Sacramento",fill:"#065f46",textAlign:"center"},{id:224,text:"MOUNTAIN TIME",category:"Outdoors",fontSize:28,fontFamily:"Bebas Neue",fill:"#0c4a6e",textAlign:"center",letterSpacing:3},{id:225,text:"Explore More",category:"Outdoors",fontSize:34,fontFamily:"Caveat",fontWeight:"700",fill:"#7c2d12",textAlign:"center"},{id:226,text:"Blessed",category:"Faith",fontSize:44,fontFamily:"Great Vibes",fill:"#6d28d9",textAlign:"center"},{id:227,text:"FAITH",category:"Faith",fontSize:40,fontFamily:"Staatliches",fill:"#1e3a8a",textAlign:"center",letterSpacing:4},{id:228,text:"Grateful",category:"Faith",fontSize:38,fontFamily:"Dancing Script",fontWeight:"700",fill:"#9a3412",textAlign:"center"},{id:229,text:"But First, Coffee",category:"Foodie",fontSize:30,fontFamily:"Pacifico",fill:"#5b3a29",textAlign:"center"},{id:230,text:"Taco Tuesday",category:"Foodie",fontSize:34,fontFamily:"Lobster",fill:"#ca8a04",textAlign:"center"},{id:231,text:"FRESH",category:"Foodie",fontSize:42,fontFamily:"Anton",fill:"#15803d",textAlign:"center",letterSpacing:2},{id:232,text:"Birthday Squad",category:"Kids",fontSize:32,fontFamily:"Caveat",fontWeight:"700",fill:"#db2777",textAlign:"center"},{id:233,text:"Party Time",category:"Kids",fontSize:36,fontFamily:"Pacifico",fill:"#7c3aed",textAlign:"center"},{id:234,text:"Little Legend",category:"Kids",fontSize:34,fontFamily:"Dancing Script",fontWeight:"700",fill:"#2563eb",textAlign:"center"},{id:235,text:"The Family",category:"Family",fontSize:40,fontFamily:"Great Vibes",fill:"#3f3f46",textAlign:"center"},{id:236,text:"Family",category:"Family",fontSize:46,fontFamily:"Sacramento",fill:"#9a3412",textAlign:"center"},{id:237,text:"HOME",category:"Family",fontSize:40,fontFamily:"Alfa Slab One",fill:"#374151",textAlign:"center",letterSpacing:6},{id:238,text:"Gather",category:"Family",fontSize:40,fontFamily:"Playfair Display",fontStyle:"italic",fontWeight:"700",fill:"#1f2937",textAlign:"center"},{id:239,text:"GOOD VIBES",category:"Music",fontSize:34,fontFamily:"Bebas Neue",fill:"#0891b2",textAlign:"center",letterSpacing:4},{id:240,text:"On Repeat",category:"Music",fontSize:36,fontFamily:"Lobster",fill:"#7c3aed",textAlign:"center"},{id:241,text:"GAME OVER",category:"Gaming",fontSize:34,fontFamily:"Bungee",fill:"#dc2626",textAlign:"center"},{id:242,text:"PLAYER ONE",category:"Gaming",fontSize:32,fontFamily:"Squada One",fill:"#16a34a",textAlign:"center",letterSpacing:2},{id:243,text:"CHAMPIONS",category:"Sports",fontSize:30,fontFamily:"Anton",fill:"#b45309",textAlign:"center",letterSpacing:4},{id:244,text:"TEAM SPIRIT",category:"Sports",fontSize:30,fontFamily:"Bebas Neue",fill:"#1d4ed8",textAlign:"center",letterSpacing:3},{id:245,text:"Dream Big",category:"Motivational",fontSize:40,fontFamily:"Pacifico",fill:"#db2777",textAlign:"center"},{id:246,text:"Hustle",category:"Motivational",fontSize:44,fontFamily:"Alfa Slab One",fill:"#111827",textAlign:"center"},{id:247,text:"Good Vibes Only",category:"Motivational",fontSize:34,fontFamily:"Dancing Script",fontWeight:"700",fill:"#0d9488",textAlign:"center"},{id:248,text:"BOLD",category:"Motivational",fontSize:46,fontFamily:"Bungee",fill:"#ea580c",textAlign:"center"},{id:249,text:"Love You More",category:"Love",fontSize:38,fontFamily:"Great Vibes",fill:"#be123c",textAlign:"center"},{id:250,text:"xoxo",category:"Love",fontSize:48,fontFamily:"Sacramento",fill:"#db2777",textAlign:"center"},{id:251,text:"Bonjour",category:"Calligraphy",fontSize:46,fontFamily:"Great Vibes",fill:"#1f2937",textAlign:"center"},{id:252,text:"Forever & Always",category:"Calligraphy",fontSize:40,fontFamily:"Allura",fill:"#be123c",textAlign:"center"},{id:253,text:"Cheers",category:"Calligraphy",fontSize:48,fontFamily:"Parisienne",fill:"#0f766e",textAlign:"center"},{id:254,text:"Sweet Dreams",category:"Calligraphy",fontSize:42,fontFamily:"Tangerine",fontWeight:"700",fill:"#7c3aed",textAlign:"center"},{id:255,text:"Hello Gorgeous",category:"Calligraphy",fontSize:38,fontFamily:"Dancing Script",fontWeight:"700",fill:"#db2777",textAlign:"center"},{id:256,text:"Stay Wild",category:"Calligraphy",fontSize:42,fontFamily:"Sacramento",fill:"#16a34a",textAlign:"center"},{id:257,text:"Adventure Awaits",category:"Calligraphy",fontSize:34,fontFamily:"Satisfy",fill:"#1d4ed8",textAlign:"center"},{id:258,text:"Handcrafted",category:"Calligraphy",fontSize:36,fontFamily:"Kaushan Script",fill:"#b45309",textAlign:"center"},{id:259,text:"Just Married",category:"Calligraphy",fontSize:42,fontFamily:"Great Vibes",fill:"#9d174d",textAlign:"center"},{id:260,text:"Celebrate",category:"Calligraphy",fontSize:40,fontFamily:"Yellowtail",fill:"#c026d3",textAlign:"center"},{id:261,text:"With Love",category:"Calligraphy",fontSize:44,fontFamily:"Cookie",fill:"#e11d48",textAlign:"center"},{id:262,text:"Wanderlust",category:"Calligraphy",fontSize:38,fontFamily:"Marck Script",fill:"#0891b2",textAlign:"center"},{id:263,text:"Grateful",category:"Calligraphy",fontSize:44,fontFamily:"Pacifico",fill:"#ea580c",textAlign:"center"},{id:264,text:"Magnifique",category:"Calligraphy",fontSize:40,fontFamily:"Allura",fill:"#4338ca",textAlign:"center"},{id:265,text:"Bloom",category:"Calligraphy",fontSize:52,fontFamily:"Parisienne",fill:"#db2777",textAlign:"center"},{id:266,text:"Bella Vita",category:"Calligraphy",fontSize:42,fontFamily:"Satisfy",fill:"#0d9488",textAlign:"center"}],Hi=["Arial","Helvetica","Times New Roman","Georgia","Verdana","Courier New","Tahoma","Trebuchet MS","Impact","Comic Sans MS"],ga=new Set(Hi),Ri=[{name:"System",fonts:Hi},{name:"Signage & Display",fonts:["Bebas Neue","Anton","Oswald","Archivo Black","Teko","Fjalla One","Saira Condensed","Squada One","Staatliches","Passion One","Alfa Slab One","Titan One","Bowlby One SC","Bungee","Bungee Inline"]},{name:"Sans Serif",fonts:["Roboto","Open Sans","Montserrat","Lato","Poppins","Inter","Raleway","Work Sans","Nunito","Rubik","Barlow","Kanit","Mukta"]},{name:"Serif",fonts:["Merriweather","Playfair Display","Lora","PT Serif","Cormorant Garamond","Libre Baskerville","EB Garamond","Crimson Text","Bitter"]},{name:"Slab Serif",fonts:["Roboto Slab","Arvo","Zilla Slab","Josefin Slab"]},{name:"Script & Handwriting",fonts:["Dancing Script","Pacifico","Great Vibes","Satisfy","Sacramento","Caveat","Kaushan Script","Lobster","Cookie","Allura","Parisienne","Yellowtail","Tangerine","Marck Script","Shadows Into Light","Permanent Marker","Homemade Apple"]},{name:"Decorative & Stencil",fonts:["Black Ops One","Stardos Stencil","Special Elite","Monoton","Faster One","Press Start 2P","Creepster","Righteous","Audiowide","Orbitron","Russo One","Wallpoet"]},{name:"Monospace",fonts:["Roboto Mono","Source Code Pro","JetBrains Mono","Space Mono","IBM Plex Mono"]}],So=Ri.reduce((s,o)=>s.concat(o.fonts),[]),ma=s=>ga.has(s),pa="https://fonts.googleapis.com/css2",uo=new Set(Hi),ya=s=>`family=${s.trim().replace(/\s+/g,"+")}:wght@400;700`,Je=s=>{if(typeof document>"u")return;const o=(s||[]).filter(n=>n&&!uo.has(n));if(o.length===0)return;const r=10;for(let n=0;n<o.length;n+=r){const l=o.slice(n,n+r),d=document.createElement("link");d.rel="stylesheet",d.href=`${pa}?${l.map(ya).join("&")}&display=swap`,d.setAttribute("data-simplex-font","1"),document.head.appendChild(d),l.forEach(h=>uo.add(h))}},vo=async s=>{if(!(!s||ma(s))&&(Je([s]),!(typeof document>"u"||!document.fonts||!document.fonts.load)))try{await Promise.all([document.fonts.load(`400 24px "${s}"`),document.fonts.load(`700 24px "${s}"`)])}catch{}},$i=async s=>{const o=Array.from(new Set((s||[]).filter(Boolean)));await Promise.all(o.map(vo))},Wi={business:{name:"Business & Office",icons:[{name:"briefcase",symbol:"💼",unicode:"💼"},{name:"chart-up",symbol:"📈",unicode:"📈"},{name:"chart-down",symbol:"📉",unicode:"📉"},{name:"graph",symbol:"📊",unicode:"📊"},{name:"clipboard",symbol:"📋",unicode:"📋"},{name:"calendar",symbol:"📅",unicode:"📅"},{name:"office",symbol:"🏢",unicode:"🏢"},{name:"bank",symbol:"🏦",unicode:"🏦"},{name:"money-bag",symbol:"💰",unicode:"💰"},{name:"credit-card",symbol:"💳",unicode:"💳"}]},technology:{name:"Technology",icons:[{name:"laptop",symbol:"💻",unicode:"💻"},{name:"phone",symbol:"📱",unicode:"📱"},{name:"desktop",symbol:"🖥️",unicode:"🖥️"},{name:"keyboard",symbol:"⌨️",unicode:"⌨️"},{name:"mouse",symbol:"🖱️",unicode:"🖱️"},{name:"printer",symbol:"🖨️",unicode:"🖨️"},{name:"wifi",symbol:"📶",unicode:"📶"},{name:"battery",symbol:"🔋",unicode:"🔋"},{name:"plug",symbol:"🔌",unicode:"🔌"},{name:"gear",symbol:"⚙️",unicode:"⚙️"}]},communication:{name:"Communication",icons:[{name:"email",symbol:"📧",unicode:"📧"},{name:"envelope",symbol:"✉️",unicode:"✉️"},{name:"phone-call",symbol:"📞",unicode:"📞"},{name:"message",symbol:"💬",unicode:"💬"},{name:"announcement",symbol:"📢",unicode:"📢"},{name:"megaphone",symbol:"📣",unicode:"📣"},{name:"satellite",symbol:"📡",unicode:"📡"},{name:"radio",symbol:"📻",unicode:"📻"},{name:"microphone",symbol:"🎤",unicode:"🎤"},{name:"speaker",symbol:"🔊",unicode:"🔊"}]},transport:{name:"Transportation",icons:[{name:"car",symbol:"🚗",unicode:"🚗"},{name:"truck",symbol:"🚛",unicode:"🚛"},{name:"bus",symbol:"🚌",unicode:"🚌"},{name:"airplane",symbol:"✈️",unicode:"✈️"},{name:"train",symbol:"🚆",unicode:"🚆"},{name:"ship",symbol:"🚢",unicode:"🚢"},{name:"bicycle",symbol:"🚴",unicode:"🚴"},{name:"motorcycle",symbol:"🏍️",unicode:"🏍️"},{name:"taxi",symbol:"🚕",unicode:"🚕"},{name:"rocket",symbol:"🚀",unicode:"🚀"}]},nature:{name:"Nature & Environment",icons:[{name:"tree",symbol:"🌳",unicode:"🌳"},{name:"leaf",symbol:"🍃",unicode:"🍃"},{name:"flower",symbol:"🌸",unicode:"🌸"},{name:"sun",symbol:"☀️",unicode:"☀️"},{name:"moon",symbol:"🌙",unicode:"🌙"},{name:"star",symbol:"⭐",unicode:"⭐"},{name:"cloud",symbol:"☁️",unicode:"☁️"},{name:"rainbow",symbol:"🌈",unicode:"🌈"},{name:"mountain",symbol:"⛰️",unicode:"⛰️"},{name:"globe",symbol:"🌍",unicode:"🌍"}]},symbols:{name:"Symbols & Signs",icons:[{name:"check",symbol:"✅",unicode:"✅"},{name:"cross",symbol:"❌",unicode:"❌"},{name:"warning",symbol:"⚠️",unicode:"⚠️"},{name:"info",symbol:"ℹ️",unicode:"ℹ️"},{name:"question",symbol:"❓",unicode:"❓"},{name:"exclamation",symbol:"❗",unicode:"❗"},{name:"lock",symbol:"🔒",unicode:"🔒"},{name:"unlock",symbol:"🔓",unicode:"🔓"},{name:"key",symbol:"🔑",unicode:"🔑"},{name:"shield",symbol:"🛡️",unicode:"🛡️"}]}},wo=()=>Object.values(Wi).flatMap(s=>s.icons.map(o=>({...o,category:s.name}))),xa=s=>wo().filter(r=>r.name.toLowerCase().includes(s.toLowerCase())||r.category.toLowerCase().includes(s.toLowerCase())),ba=({onSelectIcon:s,disabled:o=!1})=>{const[r,n]=g.useState(!1),[l,d]=g.useState(""),[h,w]=g.useState("all"),k=g.useRef(null);g.useEffect(()=>{const S=W=>{k.current&&!k.current.contains(W.target)&&n(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);const T=S=>{s(S),n(!1),d("")},z=(()=>{let S=wo();if(l.trim()&&(S=xa(l)),h!=="all"){const W=Wi[h];W&&(S=S.filter(A=>A.category===W.name))}return S})();return e.jsxs("div",{className:"icon-selector",ref:k,children:[e.jsxs("button",{className:"toolbar-btn compact dropdown-trigger",disabled:o,onClick:()=>n(!r),title:"Add Icon",children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"target",size:18,color:o?"#94a3b8":"#475569"})}),e.jsx("span",{className:"label",children:"Icons"})]}),r&&e.jsxs("div",{className:"icon-dropdown",children:[e.jsxs("div",{className:"icon-dropdown-header",children:[e.jsx("input",{type:"text",placeholder:"Search icons...",value:l,onChange:S=>d(S.target.value),className:"icon-search"}),e.jsxs("select",{value:h,onChange:S=>w(S.target.value),className:"category-select",children:[e.jsx("option",{value:"all",children:"All Categories"}),Object.entries(Wi).map(([S,W])=>e.jsx("option",{value:S,children:W.name},S))]})]}),e.jsx("div",{className:"icon-grid",children:z.length===0?e.jsx("div",{className:"no-icons",children:l?"No icons found":"No icons in this category"}):z.map((S,W)=>e.jsxs("button",{className:"icon-item",onClick:()=>T(S),title:`${S.name} (${S.category})`,children:[e.jsx("span",{className:"icon-symbol",children:S.symbol}),e.jsx("span",{className:"icon-name",children:S.name})]},`${S.name}-${W}`))}),e.jsx("div",{className:"icon-dropdown-footer",children:e.jsxs("span",{className:"icon-count",children:[z.length," icon",z.length!==1?"s":""]})})]})]})},Sa=({isOpen:s,onClose:o,onAddQRCode:r,theme:n})=>{const[l,d]=g.useState(""),[h,w]=g.useState(""),[k,T]=g.useState(200),[N,z]=g.useState("M"),S=()=>{if(!l.trim())return;const _={width:k,errorCorrectionLevel:N,type:"image/png",quality:.92,margin:1,color:{dark:"#000000",light:"#FFFFFF"}};ca.toDataURL(l,_,(K,q)=>{if(K){console.error("QR Code generation error:",K);return}w(q)})},W=()=>{if(!h)return;const _=new Image;_.onload=()=>{r({type:"qrcode",src:h,data:l,width:k,height:k,imageObject:_}),A()},_.src=h},A=()=>{d(""),w(""),o()};return s?e.jsx("div",{className:"qr-modal-overlay",onClick:A,children:e.jsxs("div",{className:"qr-modal-content",onClick:_=>_.stopPropagation(),children:[e.jsxs("div",{className:"qr-modal-header",children:[e.jsx("h3",{children:"Generate QR Code"}),e.jsx("button",{className:"qr-modal-close",onClick:A,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"qr-modal-body",children:[e.jsxs("div",{className:"qr-form-group",children:[e.jsx("label",{htmlFor:"qr-data",children:"Enter Data (URL, Text, etc.)"}),e.jsx("textarea",{id:"qr-data",value:l,onChange:_=>d(_.target.value),placeholder:"https://example.com or any text...",rows:3})]}),e.jsxs("div",{className:"qr-options",children:[e.jsxs("div",{className:"qr-form-group",children:[e.jsx("label",{htmlFor:"qr-size",children:"Size (px)"}),e.jsx("input",{type:"number",id:"qr-size",value:k,onChange:_=>T(Math.max(50,Math.min(500,parseInt(_.target.value)||200))),min:"50",max:"500"})]}),e.jsxs("div",{className:"qr-form-group",children:[e.jsx("label",{htmlFor:"qr-error-level",children:"Error Correction"}),e.jsxs("select",{id:"qr-error-level",value:N,onChange:_=>z(_.target.value),children:[e.jsx("option",{value:"L",children:"Low (7%)"}),e.jsx("option",{value:"M",children:"Medium (15%)"}),e.jsx("option",{value:"Q",children:"Quartile (25%)"}),e.jsx("option",{value:"H",children:"High (30%)"})]})]})]}),e.jsx("div",{className:"qr-actions",children:e.jsx("button",{className:"qr-btn qr-btn-generate",onClick:S,disabled:!l.trim(),children:"Generate QR Code"})}),h&&e.jsxs("div",{className:"qr-preview",children:[e.jsx("h4",{children:"Preview"}),e.jsx("div",{className:"qr-preview-container",children:e.jsx("img",{src:h,alt:"QR Code Preview"})}),e.jsx("button",{className:"qr-btn qr-btn-add",onClick:W,style:{backgroundColor:(n==null?void 0:n.primaryColor)||"#3b82f6",borderColor:(n==null?void 0:n.primaryColor)||"#3b82f6"},children:"Add to Canvas"})]})]})]})}):null},va=({isOpen:s,onClose:o,onAddBarcode:r,theme:n})=>{const[l,d]=g.useState(""),[h,w]=g.useState("CODE128"),[k,T]=g.useState(null),[N,z]=g.useState(2),[S,W]=g.useState(100),[A,_]=g.useState(20),[K,q]=g.useState("center"),[D,lt]=g.useState("bottom"),[V,C]=g.useState(10),I=g.useRef(null),$=[{value:"CODE128",label:"CODE128 (Most Common)"},{value:"EAN13",label:"EAN-13 (European Article Number)"},{value:"EAN8",label:"EAN-8 (Short EAN)"},{value:"UPC",label:"UPC (Universal Product Code)"},{value:"CODE39",label:"CODE39 (Alpha-numeric)"},{value:"ITF14",label:"ITF-14 (Shipping/Logistics)"},{value:"MSI",label:"MSI (Retail)"},{value:"pharmacode",label:"Pharmacode (Pharmaceutical)"},{value:"codabar",label:"Codabar (Libraries/Blood banks)"}],v=()=>{if(l.trim())try{T(e.jsx(da,{value:l,format:h,width:N,height:S,fontSize:A,textAlign:K,textPosition:D,margin:V,background:"#ffffff",lineColor:"#000000"}))}catch(U){console.error("Barcode generation error:",U),alert("Invalid data for selected barcode format. Please check your input.")}},ot=()=>{var U,Z,it,st;if(!(!k||!I.current))try{const at=I.current.querySelector("svg");if(!at){console.error("No SVG element found in barcode");return}const F=document.createElement("canvas"),M=F.getContext("2d"),bt=at.getBoundingClientRect(),m=((Z=(U=at.width)==null?void 0:U.baseVal)==null?void 0:Z.value)||bt.width||200,R=((st=(it=at.height)==null?void 0:it.baseVal)==null?void 0:st.value)||bt.height||100;F.width=m,F.height=R;const G=new XMLSerializer().serializeToString(at),gt=new Blob([G],{type:"image/svg+xml;charset=utf-8"}),wt=URL.createObjectURL(gt),kt=new Image;kt.onload=()=>{M.drawImage(kt,0,0);const Dt=F.toDataURL("image/png"),At=new Image;At.onload=()=>{r({type:"barcode",src:Dt,data:l,format:h,width:m,height:R,imageObject:At}),ct()},At.src=Dt,URL.revokeObjectURL(wt)},kt.src=wt}catch(at){console.error("Error adding barcode to canvas:",at),alert("Failed to add barcode to canvas. Please try again.")}},ct=()=>{d(""),T(null),w("CODE128"),z(2),W(100),_(20),o()},ut=U=>({CODE128:"Supports all ASCII characters. Most versatile format.",EAN13:"Requires exactly 12 digits (13th is checksum). Used for retail products.",EAN8:"Requires exactly 7 digits (8th is checksum). Compact version of EAN-13.",UPC:"Requires exactly 11 digits (12th is checksum). Used in North America.",CODE39:"Supports letters, numbers, and some symbols. Widely used.",ITF14:"Requires exactly 13 digits (14th is checksum). Used for shipping containers.",MSI:"Numeric only. Used in retail inventory.",pharmacode:"Numbers 3-131070. Used in pharmaceutical industry.",codabar:"Supports 0-9, A-D, and symbols. Used in libraries."})[U]||"";return s?e.jsx("div",{className:"barcode-modal-overlay",onClick:ct,children:e.jsxs("div",{className:"barcode-modal-content",onClick:U=>U.stopPropagation(),children:[e.jsxs("div",{className:"barcode-modal-header",children:[e.jsx("h3",{children:"Generate Barcode"}),e.jsx("button",{className:"barcode-modal-close",onClick:ct,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"barcode-modal-body",children:[e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"barcode-data",children:"Enter Data"}),e.jsx("input",{type:"text",id:"barcode-data",value:l,onChange:U=>d(U.target.value),placeholder:"Enter your data..."})]}),e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"barcode-format",children:"Barcode Format"}),e.jsx("select",{id:"barcode-format",value:h,onChange:U=>w(U.target.value),children:$.map(U=>e.jsx("option",{value:U.value,children:U.label},U.value))}),e.jsx("small",{className:"format-description",children:ut(h)})]}),e.jsxs("div",{className:"barcode-options",children:[e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"barcode-width",children:"Bar Width"}),e.jsx("input",{type:"range",id:"barcode-width",min:"1",max:"4",step:"0.5",value:N,onChange:U=>z(parseFloat(U.target.value))}),e.jsxs("span",{className:"range-value",children:[N,"px"]})]}),e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"barcode-height",children:"Height"}),e.jsx("input",{type:"range",id:"barcode-height",min:"50",max:"200",value:S,onChange:U=>W(parseInt(U.target.value))}),e.jsxs("span",{className:"range-value",children:[S,"px"]})]}),e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"barcode-fontsize",children:"Font Size"}),e.jsx("input",{type:"range",id:"barcode-fontsize",min:"10",max:"30",value:A,onChange:U=>_(parseInt(U.target.value))}),e.jsxs("span",{className:"range-value",children:[A,"px"]})]}),e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"text-position",children:"Text Position"}),e.jsxs("select",{id:"text-position",value:D,onChange:U=>lt(U.target.value),children:[e.jsx("option",{value:"bottom",children:"Bottom"}),e.jsx("option",{value:"top",children:"Top"})]})]})]}),e.jsx("div",{className:"barcode-actions",children:e.jsx("button",{className:"barcode-btn barcode-btn-generate",onClick:v,disabled:!l.trim(),children:"Generate Barcode"})}),k&&e.jsxs("div",{className:"barcode-preview",children:[e.jsx("h4",{children:"Preview"}),e.jsx("div",{className:"barcode-preview-container",ref:I,children:k}),e.jsx("button",{className:"barcode-btn barcode-btn-add",onClick:ot,style:{backgroundColor:(n==null?void 0:n.primaryColor)||"#3b82f6",borderColor:(n==null?void 0:n.primaryColor)||"#3b82f6"},children:"Add to Canvas"})]})]})]})}):null},wa=({theme:s})=>e.jsxs("div",{className:"premium-feature-container",style:{padding:"20px",backgroundColor:"#f8f9fa",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.05)",textAlign:"center",maxWidth:"400px",margin:"0 auto"},children:[e.jsx("div",{style:{marginBottom:"16px"},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"#ffc107"},children:[e.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),e.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]})}),e.jsx("h3",{style:{color:"#333",fontSize:"18px",fontWeight:"600",marginBottom:"12px"},children:"Premium Feature Access"}),e.jsx("p",{style:{color:"#555",fontSize:"15px",lineHeight:"1.5",marginBottom:"20px"},children:"Premium stickers feature requires a subscription to access."}),e.jsx("a",{href:"https://mypixia.com/developer",target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:(s==null?void 0:s.primaryColor)||"#4c5bf2",color:"white",padding:"10px 20px",borderRadius:"4px",textDecoration:"none",fontWeight:"500",transition:"background-color 0.2s ease"},children:"Get API Key"})]}),go=()=>e.jsxs("div",{style:{textAlign:"center",padding:"40px"},children:[e.jsx("div",{style:{border:"4px solid #f3f3f3",borderTop:"4px solid #3498db",borderRadius:"50%",width:"40px",height:"40px",animation:"spin 2s linear infinite",margin:"0 auto 20px"}}),e.jsx("p",{children:"Loading..."}),e.jsx("style",{children:`
22
+ <%s key={someKey} {...props} />`,ft,jt,B,jt),H[jt+ft]=!0)}if(jt=null,Q!==void 0&&(r(Q),jt=""+Q),h(L)&&(r(L.key),jt=""+L.key),"key"in L){Q={};for(var oe in L)oe!=="key"&&(Q[oe]=L[oe])}else Q=L;return jt&&w(Q,typeof m=="function"?m.displayName||m.name||"Unknown":m),z(m,jt,kt,zt,l(),Q,Ht,It)}function T(m){typeof m=="object"&&m!==null&&m.$$typeof===D&&m._store&&(m._store.validated=1)}var S=g,D=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),Z=Symbol.for("react.strict_mode"),Y=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),lt=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),ut=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),ot=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),at=Symbol.for("react.client.reference"),ct=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,O=Array.isArray,st=console.createTask?console.createTask:function(){return null};S={"react-stack-bottom-frame":function(m){return m()}};var J,ht={},C=S["react-stack-bottom-frame"].bind(S,d)(),G=st(n(d)),H={};Re.Fragment=$,Re.jsx=function(m,L,Q,ft,zt){var kt=1e4>ct.recentlyCreatedOwnerStacks++;return N(m,L,Q,!1,ft,zt,kt?Error("react-stack-top-frame"):C,kt?st(n(m)):G)},Re.jsxs=function(m,L,Q,ft,zt){var kt=1e4>ct.recentlyCreatedOwnerStacks++;return N(m,L,Q,!0,ft,zt,kt?Error("react-stack-top-frame"):C,kt?st(n(m)):G)}}()),Re}var go;function ma(){return go||(go=1,process.env.NODE_ENV==="production"?Ye.exports=ua():Ye.exports=ga()),Ye.exports}var e=ma();const et=({name:s,size:o=24,color:r="#000000",...n})=>{const l={briefcase:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375 7.444 2.25 12 2.25s8.25 1.847 8.25 4.125zM12 12.75c4.556 0 8.25-1.847 8.25-4.125v-2.35c-1.64 1.263-4.54 2.1-8.25 2.1s-6.61-.837-8.25-2.1v2.35c0 2.278 3.694 4.125 8.25 4.125z",money:"M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2zm0 2c-4.418 0-8 3.582-8 8s3.582 8 8 8 8-3.582 8-8-3.582-8-8-8zm1 8V9.5c0-.828.672-1.5 1.5-1.5S16 8.672 16 9.5V10h-1v-.5c0-.276-.224-.5-.5-.5s-.5.224-.5.5V12c0 .828-.672 1.5-1.5 1.5S11 12.828 11 12v-.5h1v.5c0 .276.224.5.5.5s.5-.224.5-.5z",chart:"M3 3v18h18v-2H5V3H3zm4 12V9h2v6H7zm4 0V7h2v8h-2zm4 0v-4h2v4h-2z",target:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm0 10c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z",laptop:"M20 18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2h-4zM4 6h16v10H4V6z",phone:"M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z",wifi:"M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.07 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z",camera:"M9 2l1.17 1H15v1H9.83L8.66 2H9zm-4 7h14l-1 9H6l-1-9zm7 8c1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3 1.34 3 3 3z",email:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z",message:"M20 2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h4v3c0 .6.4 1 1 1h.5c.2 0 .4-.1.6-.2L15.5 18H20c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z",notification:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z",like:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z",share:"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z",user:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z",users:"M16 4c0-1.11.89-2 2-2s2 .89 2 2-.89 2-2 2-2-.89-2-2zM4 4c0-1.11.89-2 2-2s2 .89 2 2-.89 2-2 2-2-.89-2-2zm5 0c0-1.11.89-2 2-2s2 .89 2 2-.89 2-2 2-2-.89-2-2zM12 14v8H4v-8c0-2.66 5.33-4 8-4s8 1.34 8 4v8h-8z",cart:"M7 18c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12L8.1 13h7.45c.75 0 1.41-.41 1.75-1.03L21.7 4H5.21l-.94-2H1zm16 16c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z",bag:"M19 7h-3V6c0-2.76-2.24-5-5-5S6 3.24 6 6v1H3c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2zM8 6c0-1.66 1.34-3 3-3s3 1.34 3 3v1H8V6zm11 15H5V9h2v1c0 .55.45 1 1 1s1-.45 1-1V9h6v1c0 .55.45 1 1 1s1-.45 1-1V9h2v12z",gift:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.68C10.96 2.54 10.05 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h1v6c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2v-6h1c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2z",plane:"M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z",car:"M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.22.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z",location:"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z",home:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z",coffee:"M2 21h18v-2H2v2zM20 8H3v10h17V8zM5 10h12v6H5v-6zM21 5V3h-2v2H3v2h16v-2z",pizza:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z",sun:"M6.76 4.84l-1.8-1.79-1.41 1.41 1.79 1.79 1.42-1.41zM4 10.5H1v2h3v-2zm9-9.95h-2V3.5h2V.55zm7.45 3.91l-1.41-1.41-1.79 1.79 1.41 1.41 1.79-1.79zm-3.21 13.7l1.79 1.8 1.41-1.41-1.8-1.79-1.4 1.4zM20 10.5v2h3v-2h-3zm-8-5c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm-1 16.95h2V19.5h-2v2.95zm-7.45-3.91l1.41 1.41 1.79-1.8-1.41-1.41-1.79 1.8z",cloud:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z",tree:"M16.5 12c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5-1.5-.67-1.5-1.5.67-1.5 1.5-1.5zM9 13c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm3-6c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1z",soccer:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z",basketball:"M17.09 11h4.86c-.16-1.61-.71-3.11-1.54-4.4-1.69.83-2.81 2.54-3.32 4.4zM6.91 11c-.51-1.86-1.63-3.57-3.32-4.4-.83 1.29-1.38 2.79-1.54 4.4h4.86z",music:"M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z",video:"M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z",gamepad:"M15 7.5V2H9v5.5l3 3 3-3zM7.5 9H2v6h5.5l3-3-3-3zM9 16.5V22h6v-5.5l-3-3-3 3zM16.5 9l3 3 3-3H22V2h-5.5z",health:"M9.8 17.3l4.2-4.2L18.2 17c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L15.4 11.4l4.2-4.2c.39-.39.39-1.02 0-1.41-.39-.39-1.02-.39-1.41 0L14 9.8l-4.2-4.2c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41l4.2 4.2-4.2 4.2c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0z",medical:"M19 8h-2v3h-3v2h3v3h2v-3h3v-2h-3V8zM4 6h9v2H4zm0 5h9v2H4zm0 5h6v2H4z",lock:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z",shield:"M12,1L3,5V11C3,16.55 6.84,21.74 12,23C17.16,21.74 21,16.55 21,11V5L12,1M12,7C13.4,7 14.8,8.6 14.8,10V11H15.7V16H8.3V11H9.2V10C9.2,8.6 10.6,7 12,7M12,8.2C11.2,8.2 10.5,8.7 10.5,10V11H13.5V10C13.5,8.7 12.8,8.2 12,8.2Z",wrench:"M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z",gear:"M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z",book:"M18 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM6 4h5v8l-2.5-1.5L6 12V4z",graduation:"M5 13.18v4L12 21l7-3.82v-4L12 17l-7-3.82zM12 3L1 9l11 6 9-4.91V17h2V9L12 3z",arrowUp:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z",arrowDown:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6z",arrowLeft:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6z",arrowRight:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6z",close:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",check:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z",plus:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z",minus:"M19 13H5v-2h14v2z",sparkle:"M19 9l1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25L19 9zm-7.5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12l-5.5-2.5zM19 15l-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25L19 15z",undo:"M12.5 8c-2.65 0-5.05 1.04-6.83 2.73L3 8v8h8l-2.81-2.81C9.62 11.85 10.97 11.2 12.5 11.2c2.96 0 5.48 1.87 6.44 4.5L21 14.9C19.72 11.04 16.42 8 12.5 8z",redo:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-3.92 0-7.22 3.04-8.5 6.9l2.06.77C5.98 13.07 8.47 11.2 11.5 11.2c1.53 0 2.88.65 3.81 1.69L13 15h7V8l-1.6 2.6z",rotateRight:"M15.55 5.55L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45zM19.93 11c-.17-1.39-.72-2.73-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47h2.02zM13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03zm3.89-2.42l1.42 1.41c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.48z",rotateLeft:"M7.11 8.53L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47zM6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47zm1.01 5.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.14-1.71-.48-2.46-1.03L7.1 18.32zM13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93z",text:"M5 4v3h5.5v12h3V7H19V4H5z",move:"M10 9h4V6h3l-5-5-5 5h3v3zm-1 1H6V7l-5 5 5 5v-3h3v-4zm14 2l-5-5v3h-3v4h3v3l5-5zm-9 3h-4v3H8l5 5 5-5h-3v-3z",shapes:"M11 13.5v8h2v-8h8v-2h-8v-8h-2v8h-8v2h8z",upload:"M9 16h6v-6h4l-7-7-7 7h4v6zm-4 2h14v2H5v-2z",cloudUpload:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z",image:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z",sticker:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.5-9c.83 0 1.5-.67 1.5-1.5S17.33 8 16.5 8 15 8.67 15 9.5s.67 1.5 1.5 1.5zm-9 0c.83 0 1.5-.67 1.5-1.5S8.33 8 7.5 8 6 8.67 6 9.5 6.67 11 7.5 11zm4.5 6.5c2.03 0 3.8-1.11 4.75-2.75.19-.33-.05-.75-.44-.75H7.69c-.38 0-.63.42-.44.75.95 1.64 2.72 2.75 4.75 2.75z",qrcode:"M3 11h2v2H3v-2zm8-6h2v4h-2V5zM3 3v6h6V3H3zm4 4H5V5h2v2zm-4 14h6v-6H3v6zm2-4h2v2H5v-2zM15 3v6h6V3h-6zm4 4h-2V5h2v2zm-4 8h2v2h2v2h-2v-2h-2v-2zm-2-2h2v2h-2v-2zm4 0h2v2h-2v-2zm2 4h2v2h-2v-2zm0-4h2v2h-2v-2zM11 13h2v4h-2v-4z",barcode:"M2 4h2v16H2V4zm4 0h1v16H6V4zm3 0h2v16H9V4zm4 0h1v16h-1V4zm3 0h2v16h-2V4zm4 0h2v16h-2V4z",thread:"M19.38 3.9L18.2 2.72a1.5 1.5 0 00-2.12 0l-1.41 1.41L3 15.79V21h5.21l11.66-11.66 1.41-1.41a1.5 1.5 0 000-2.12L19.38 3.9zM7.79 19H5v-2.79l9.95-9.95 2.79 2.79L7.79 19z",duplicate:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z",trash:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z",grid:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z",ruler:"M21 6H3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 10H3V8h2v4h2V8h2v4h2V8h2v4h2V8h2v4h2V8h2v4z",magnet:"M3 7v6c0 5.52 4.48 10 10 10h1V13h-2v8.95C7.83 21.45 5 18.05 5 14V7H3zm18 0h-2v7c0 4.05-2.83 7.45-7 7.95V13h-2v10h1c5.52 0 10-4.48 10-10V7z",rectangle:"M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 12H5V7h14v10z",circle:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z",triangle:"M12 2L1 21h22L12 2zm0 4l7.53 13H4.47L12 6z",star:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z",heart:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z",diamond:"M12 2L2 12l10 10 10-10L12 2zm0 2.83L19.17 12 12 19.17 4.83 12 12 4.83z",hexagon:"M12 2l-8.66 5v10L12 22l8.66-5V7L12 2zm6.66 13.87L12 19.87l-6.66-4V8.13L12 4.13l6.66 4v7.74z",pentagon:"M12 2L2 9l4 12h12l4-12L12 2z",oval:"M12 6c-4.42 0-8 2.69-8 6s3.58 6 8 6 8-2.69 8-6-3.58-6-8-6z",roundedRect:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z",horizontalLine:"M2 12h20",arrowShape:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z",rain:"M6 14c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97C6.22 4.56 8.51 3 11.2 3c2.31 0 4.36 1.25 5.46 3.1C17.43 6.04 18 6.96 18 8c0 1.1-.9 2-2 2H6zm2 6h2v2H8v-2zm4 0h2v2h-2v-2zm-2-3h2v2h-2v-2z",snow:"M22 11h-4.17l3.24-3.24-1.41-1.42L15.83 10H13V7.17l3.24-3.24-1.42-1.41L12 5.83 9.17 2.52 7.76 3.93 11 7.17V10H8.17l-3.24-3.24L3.52 8.17 6.76 11.41H2v2h4.17l-3.24 3.24 1.41 1.42L8.17 14H11v2.83l-3.24 3.24 1.42 1.41L12 18.17l2.83 3.31 1.41-1.41L13 16.83V14h2.83l3.24 3.24 1.42-1.41L17.24 12.59H22v-1z"},d=new Set(["horizontalLine","ruler"]),h=l[s];if(!h)return console.warn(`Icon "${s}" not found`),null;const w=d.has(s);return e.jsx("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:w?"none":r,stroke:w?r:void 0,strokeWidth:w?2:void 0,...n,children:e.jsx("path",{d:h})})},le=[{id:1,text:"DREAM BIG",category:"Motivational",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FF6B35",hasBackground:!0,backgroundColor:"#1A1A1A",textAlign:"center",textTransform:"uppercase"},{id:2,text:"Never Give Up",category:"Motivational",fontSize:28,fontFamily:"Georgia",fontWeight:"bold",fill:"#2E8B57",fontStyle:"italic",textAlign:"center"},{id:3,text:"BE YOURSELF",category:"Motivational",fontSize:24,fontFamily:"Arial",fontWeight:"700",fill:"#FF1493",textTransform:"uppercase",letterSpacing:2},{id:4,text:"Stay Strong",category:"Motivational",fontSize:26,fontFamily:"Verdana",fontWeight:"bold",fill:"#4169E1",hasTextShadow:!0,textShadowX:2,textShadowY:2,textShadowBlur:4,textShadowColor:"#000000"},{id:5,text:"RISE & SHINE",category:"Motivational",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700",hasBackground:!0,backgroundColor:"#8B0000",textAlign:"center"},{id:6,text:"Believe in Magic",category:"Motivational",fontSize:22,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB",textAlign:"center"},{id:7,text:"UNSTOPPABLE",category:"Motivational",fontSize:28,fontFamily:"Arial",fontWeight:"900",fill:"#DC143C",textTransform:"uppercase",letterSpacing:1.5},{id:8,text:"Chase Your Dreams",category:"Motivational",fontSize:24,fontFamily:"Georgia",fill:"#20B2AA",fontWeight:"600"},{id:9,text:"FEARLESS",category:"Motivational",fontSize:36,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",textAlign:"center",hasBackground:!0,backgroundColor:"#000000"},{id:10,text:"Make It Happen",category:"Motivational",fontSize:26,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#32CD32"},{id:11,text:"BORN TO WIN",category:"Motivational",fontSize:24,fontFamily:"Arial",fontWeight:"800",fill:"#FFD700",hasBackground:!0,backgroundColor:"#800080",textAlign:"center"},{id:12,text:"Positive Vibes Only",category:"Motivational",fontSize:20,fontFamily:"Comic Sans MS",fill:"#FF69B4",fontWeight:"600"},{id:13,text:"LIMITLESS",category:"Motivational",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#1E90FF",textTransform:"uppercase",letterSpacing:3},{id:14,text:"Embrace The Journey",category:"Motivational",fontSize:22,fontFamily:"Georgia",fontStyle:"italic",fill:"#8B4513"},{id:15,text:"STRENGTH WITHIN",category:"Motivational",fontSize:26,fontFamily:"Verdana",fontWeight:"bold",fill:"#696969",hasBackground:!0,backgroundColor:"#F0F8FF"},{id:16,text:"Create Your Own Sunshine",category:"Motivational",fontSize:18,fontFamily:"Palatino",fill:"#FF8C00",fontWeight:"600"},{id:17,text:"WARRIOR SPIRIT",category:"Motivational",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#B22222",textAlign:"center"},{id:18,text:"Keep Going",category:"Motivational",fontSize:30,fontFamily:"Arial",fontWeight:"700",fill:"#228B22"},{id:19,text:"FOCUS & WIN",category:"Motivational",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082",hasBackground:!0,backgroundColor:"#FFFF00"},{id:20,text:"Inspire Others",category:"Motivational",fontSize:26,fontFamily:"Georgia",fill:"#CD853F",fontStyle:"italic"},{id:21,text:"GAME CHANGER",category:"Motivational",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#FF1493",textAlign:"center"},{id:22,text:"Live With Purpose",category:"Motivational",fontSize:22,fontFamily:"Palatino",fill:"#2F4F4F",fontWeight:"600"},{id:23,text:"BREAKTHROUGH",category:"Motivational",fontSize:28,fontFamily:"Arial",fontWeight:"900",fill:"#DC143C",letterSpacing:2},{id:24,text:"Shine Bright",category:"Motivational",fontSize:32,fontFamily:"Verdana",fontWeight:"bold",fill:"#FFD700",hasTextShadow:!0,textShadowX:3,textShadowY:3,textShadowBlur:6,textShadowColor:"#000000"},{id:25,text:"NEVER SETTLE",category:"Motivational",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",hasBackground:!0,backgroundColor:"#000080"},{id:26,text:"CEO MINDSET",category:"Business",fontSize:28,fontFamily:"Arial",fontWeight:"bold",fill:"#2F4F4F",textAlign:"center",hasBackground:!0,backgroundColor:"#F5F5F5"},{id:27,text:"Innovation Starts Here",category:"Business",fontSize:20,fontFamily:"Trebuchet MS",fill:"#4169E1",fontWeight:"600"},{id:28,text:"PROFESSIONAL",category:"Business",fontSize:24,fontFamily:"Georgia",fontWeight:"bold",fill:"#000080",letterSpacing:1},{id:29,text:"Excellence Every Day",category:"Business",fontSize:22,fontFamily:"Verdana",fill:"#8B0000",fontWeight:"600"},{id:30,text:"LEADERSHIP",category:"Business",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#B8860B",textAlign:"center"},{id:31,text:"Think Different",category:"Business",fontSize:26,fontFamily:"Palatino",fontStyle:"italic",fill:"#696969"},{id:32,text:"RESULTS DRIVEN",category:"Business",fontSize:24,fontFamily:"Arial",fontWeight:"800",fill:"#DC143C",hasBackground:!0,backgroundColor:"#F0F8FF"},{id:33,text:"Strategic Vision",category:"Business",fontSize:22,fontFamily:"Georgia",fill:"#2E8B57",fontWeight:"700"},{id:34,text:"PRODUCTIVITY",category:"Business",fontSize:28,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082"},{id:35,text:"Success Mindset",category:"Business",fontSize:24,fontFamily:"Verdana",fill:"#FF8C00",fontWeight:"600"},{id:36,text:"EXPERT LEVEL",category:"Business",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#000000",hasBackground:!0,backgroundColor:"#FFD700"},{id:37,text:"Quality First",category:"Business",fontSize:30,fontFamily:"Arial",fontWeight:"700",fill:"#228B22"},{id:38,text:"INTEGRITY",category:"Business",fontSize:32,fontFamily:"Georgia",fontWeight:"bold",fill:"#2F4F4F",textAlign:"center"},{id:39,text:"Growth Focused",category:"Business",fontSize:20,fontFamily:"Palatino",fill:"#20B2AA",fontWeight:"600"},{id:40,text:"COLLABORATION",category:"Business",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#9370DB"},{id:41,text:"Performance Matters",category:"Business",fontSize:22,fontFamily:"Verdana",fill:"#B22222",fontWeight:"700"},{id:42,text:"ACCOUNTABILITY",category:"Business",fontSize:26,fontFamily:"Arial",fontWeight:"800",fill:"#8B4513",letterSpacing:1.5},{id:43,text:"Vision to Reality",category:"Business",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#4169E1"},{id:44,text:"TRANSFORMATION",category:"Business",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",textAlign:"center"},{id:45,text:"Excellence Standard",category:"Business",fontSize:22,fontFamily:"Palatino",fill:"#2E8B57",fontWeight:"600"},{id:46,text:"EFFICIENCY",category:"Business",fontSize:30,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#000080"},{id:47,text:"Forward Thinking",category:"Business",fontSize:24,fontFamily:"Verdana",fill:"#CD853F",fontWeight:"700"},{id:48,text:"ACHIEVEMENT",category:"Business",fontSize:26,fontFamily:"Arial",fontWeight:"bold",fill:"#B8860B",hasBackground:!0,backgroundColor:"#F5F5DC"},{id:49,text:"Strategic Excellence",category:"Business",fontSize:20,fontFamily:"Georgia",fill:"#696969",fontWeight:"600"},{id:50,text:"IMPACT MAKER",category:"Business",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#DC143C",textAlign:"center"},{id:51,text:"COFFEE FIRST",category:"Funny",fontSize:28,fontFamily:"Comic Sans MS",fontWeight:"bold",fill:"#8B4513",hasBackground:!0,backgroundColor:"#F5DEB3"},{id:52,text:"I'm Not Lazy, I'm Energy Efficient",category:"Funny",fontSize:16,fontFamily:"Arial",fill:"#FF69B4",fontWeight:"600"},{id:53,text:"SARCASM LOADING...",category:"Funny",fontSize:24,fontFamily:"Courier New",fontWeight:"bold",fill:"#32CD32",textAlign:"center"},{id:54,text:"Powered By Pizza",category:"Funny",fontSize:26,fontFamily:"Comic Sans MS",fill:"#FF6347",fontWeight:"700"},{id:55,text:"CTRL + ALT + DELETE MONDAY",category:"Funny",fontSize:18,fontFamily:"Courier New",fontWeight:"bold",fill:"#4169E1"},{id:56,text:"Brain 404 Error",category:"Funny",fontSize:22,fontFamily:"Arial",fill:"#FF1493",fontWeight:"600"},{id:57,text:"WEEKEND WARRIOR",category:"Funny",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700",hasBackground:!0,backgroundColor:"#000080"},{id:58,text:"Adulting is Hard",category:"Funny",fontSize:24,fontFamily:"Comic Sans MS",fill:"#9370DB",fontWeight:"600"},{id:59,text:"PROCRASTINATION EXPERT",category:"Funny",fontSize:20,fontFamily:"Arial",fontWeight:"bold",fill:"#FF4500"},{id:60,text:"Netflix & Chill Champion",category:"Funny",fontSize:18,fontFamily:"Trebuchet MS",fill:"#DC143C",fontWeight:"600"},{id:61,text:"CHAOS COORDINATOR",category:"Funny",fontSize:24,fontFamily:"Impact",fontWeight:"bold",fill:"#FF69B4",textAlign:"center"},{id:62,text:"I Speak Fluent Sarcasm",category:"Funny",fontSize:20,fontFamily:"Georgia",fontStyle:"italic",fill:"#2E8B57"},{id:63,text:"SLEEP IS FOR THE WEAK",category:"Funny",fontSize:22,fontFamily:"Arial",fontWeight:"800",fill:"#B22222"},{id:64,text:"Professional Overthinker",category:"Funny",fontSize:20,fontFamily:"Verdana",fill:"#4B0082",fontWeight:"600"},{id:65,text:"WIFI PASSWORD PLEASE",category:"Funny",fontSize:20,fontFamily:"Courier New",fontWeight:"bold",fill:"#32CD32"},{id:66,text:"Certified Couch Potato",category:"Funny",fontSize:22,fontFamily:"Comic Sans MS",fill:"#FF8C00",fontWeight:"700"},{id:67,text:"SOCIAL DISTANCING CHAMPION",category:"Funny",fontSize:16,fontFamily:"Arial",fontWeight:"bold",fill:"#20B2AA"},{id:68,text:"Powered By Caffeine",category:"Funny",fontSize:24,fontFamily:"Impact",fill:"#8B4513",fontWeight:"bold"},{id:69,text:"EMERGENCY CHOCOLATE NEEDED",category:"Funny",fontSize:18,fontFamily:"Comic Sans MS",fontWeight:"bold",fill:"#D2691E"},{id:70,text:"I'm Not Short, I'm Fun Size",category:"Funny",fontSize:20,fontFamily:"Trebuchet MS",fill:"#FF1493",fontWeight:"600"},{id:71,text:"CTRL + Z MY LIFE",category:"Funny",fontSize:26,fontFamily:"Courier New",fontWeight:"bold",fill:"#4169E1"},{id:72,text:"Error 404: Motivation Not Found",category:"Funny",fontSize:16,fontFamily:"Arial",fill:"#FF4500",fontWeight:"600"},{id:73,text:"PROFESSIONAL WEIRDO",category:"Funny",fontSize:24,fontFamily:"Impact",fontWeight:"bold",fill:"#9370DB",textAlign:"center"},{id:74,text:"Snack Attack Mode",category:"Funny",fontSize:26,fontFamily:"Comic Sans MS",fill:"#FF6347",fontWeight:"700"},{id:75,text:"BATTERY LOW, NEED COFFEE",category:"Funny",fontSize:18,fontFamily:"Courier New",fontWeight:"bold",fill:"#8B4513"},{id:76,text:"Love You Forever",category:"Love",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#FF1493",textAlign:"center"},{id:77,text:"SOULMATES",category:"Love",fontSize:32,fontFamily:"Georgia",fontWeight:"bold",fill:"#DC143C",hasBackground:!0,backgroundColor:"#FFE4E1"},{id:78,text:"Better Together",category:"Love",fontSize:26,fontFamily:"Trebuchet MS",fill:"#FF69B4",fontWeight:"600"},{id:79,text:"ENDLESS LOVE",category:"Love",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#B22222",textAlign:"center"},{id:80,text:"You Complete Me",category:"Love",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#8B0000"},{id:81,text:"FOREVER & ALWAYS",category:"Love",fontSize:24,fontFamily:"Arial",fontWeight:"bold",fill:"#FF1493",letterSpacing:1},{id:82,text:"My Heart Belongs To You",category:"Love",fontSize:20,fontFamily:"Palatino",fill:"#DC143C",fontWeight:"600"},{id:83,text:"PURE LOVE",category:"Love",fontSize:34,fontFamily:"Impact",fontWeight:"bold",fill:"#FF69B4",hasTextShadow:!0,textShadowX:2,textShadowY:2,textShadowBlur:4,textShadowColor:"#000000"},{id:84,text:"Together Forever",category:"Love",fontSize:26,fontFamily:"Georgia",fill:"#8B0000",fontWeight:"700",textAlign:"center"},{id:85,text:"MATCH MADE IN HEAVEN",category:"Love",fontSize:20,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#FF1493"},{id:86,text:"Love Story",category:"Love",fontSize:32,fontFamily:"Palatino",fontStyle:"italic",fill:"#B22222"},{id:87,text:"HEARTBEAT",category:"Love",fontSize:28,fontFamily:"Arial",fontWeight:"800",fill:"#DC143C",hasBackground:!0,backgroundColor:"#FFF0F5"},{id:88,text:"You Are My Sunshine",category:"Love",fontSize:22,fontFamily:"Georgia",fill:"#FF8C00",fontWeight:"600"},{id:89,text:"DESTINY",category:"Love",fontSize:36,fontFamily:"Impact",fontWeight:"bold",fill:"#8B0000",textAlign:"center"},{id:90,text:"True Love Waits",category:"Love",fontSize:24,fontFamily:"Palatino",fontStyle:"italic",fill:"#FF1493"},{id:91,text:"BELOVED",category:"Love",fontSize:30,fontFamily:"Georgia",fontWeight:"bold",fill:"#B22222",letterSpacing:2},{id:92,text:"Love Conquers All",category:"Love",fontSize:26,fontFamily:"Trebuchet MS",fill:"#DC143C",fontWeight:"700"},{id:93,text:"PERFECT MATCH",category:"Love",fontSize:24,fontFamily:"Arial",fontWeight:"bold",fill:"#FF69B4",hasBackground:!0,backgroundColor:"#000000"},{id:94,text:"Always & Forever",category:"Love",fontSize:28,fontFamily:"Georgia",fontStyle:"italic",fill:"#8B0000",textAlign:"center"},{id:95,text:"ROMANCE",category:"Love",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FF1493"},{id:96,text:"Love Never Fails",category:"Love",fontSize:24,fontFamily:"Palatino",fill:"#B22222",fontWeight:"600"},{id:97,text:"ETERNAL LOVE",category:"Love",fontSize:28,fontFamily:"Arial",fontWeight:"800",fill:"#DC143C",letterSpacing:1.5},{id:98,text:"Heart & Soul",category:"Love",fontSize:30,fontFamily:"Georgia",fill:"#8B0000",fontWeight:"bold"},{id:99,text:"PASSIONATE",category:"Love",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",textAlign:"center"},{id:100,text:"Love Is Everything",category:"Love",fontSize:24,fontFamily:"Trebuchet MS",fill:"#FF1493",fontWeight:"700"},{id:101,text:"NO PAIN NO GAIN",category:"Sports",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",textAlign:"center",hasBackground:!0,backgroundColor:"#000000"},{id:102,text:"Train Hard",category:"Sports",fontSize:32,fontFamily:"Arial",fontWeight:"900",fill:"#B22222"},{id:103,text:"CHAMPION MINDSET",category:"Sports",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#FFD700",hasBackground:!0,backgroundColor:"#000080"},{id:104,text:"Beast Mode ON",category:"Sports",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#32CD32"},{id:105,text:"STRONGER EVERY DAY",category:"Sports",fontSize:22,fontFamily:"Arial",fontWeight:"800",fill:"#2E8B57",letterSpacing:1},{id:106,text:"Victory Mindset",category:"Sports",fontSize:28,fontFamily:"Georgia",fontWeight:"bold",fill:"#B8860B"},{id:107,text:"GAME TIME",category:"Sports",fontSize:34,fontFamily:"Impact",fontWeight:"bold",fill:"#FF1493",textAlign:"center"},{id:108,text:"Push Your Limits",category:"Sports",fontSize:24,fontFamily:"Trebuchet MS",fill:"#4169E1",fontWeight:"700"},{id:109,text:"ATHLETIC EXCELLENCE",category:"Sports",fontSize:20,fontFamily:"Arial",fontWeight:"bold",fill:"#DC143C"},{id:110,text:"Fitness First",category:"Sports",fontSize:30,fontFamily:"Verdana",fontWeight:"bold",fill:"#228B22"},{id:111,text:"UNSTOPPABLE FORCE",category:"Sports",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",hasTextShadow:!0,textShadowX:3,textShadowY:3,textShadowBlur:6,textShadowColor:"#000000"},{id:112,text:"Sweat Equity",category:"Sports",fontSize:28,fontFamily:"Georgia",fill:"#8B4513",fontWeight:"700"},{id:113,text:"PERFORMANCE ZONE",category:"Sports",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082"},{id:114,text:"Train Like A Champion",category:"Sports",fontSize:20,fontFamily:"Arial",fill:"#B22222",fontWeight:"600"},{id:115,text:"POWER WITHIN",category:"Sports",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FF8C00",textAlign:"center"},{id:116,text:"Maximum Effort",category:"Sports",fontSize:26,fontFamily:"Verdana",fill:"#2E8B57",fontWeight:"800"},{id:117,text:"ELITE ATHLETE",category:"Sports",fontSize:28,fontFamily:"Arial",fontWeight:"900",fill:"#FFD700",hasBackground:!0,backgroundColor:"#8B0000"},{id:118,text:"Rise Above",category:"Sports",fontSize:30,fontFamily:"Georgia",fontWeight:"bold",fill:"#4169E1"},{id:119,text:"COMPETITIVE EDGE",category:"Sports",fontSize:22,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#DC143C"},{id:120,text:"Strength & Honor",category:"Sports",fontSize:26,fontFamily:"Impact",fill:"#2F4F4F",fontWeight:"bold"},{id:121,text:"WINNING ATTITUDE",category:"Sports",fontSize:24,fontFamily:"Arial",fontWeight:"800",fill:"#32CD32",letterSpacing:1.5},{id:122,text:"Never Give Up",category:"Sports",fontSize:32,fontFamily:"Verdana",fontWeight:"bold",fill:"#FF4500"},{id:123,text:"ENDURANCE",category:"Sports",fontSize:36,fontFamily:"Impact",fontWeight:"bold",fill:"#228B22",textAlign:"center"},{id:124,text:"Peak Performance",category:"Sports",fontSize:24,fontFamily:"Georgia",fill:"#B8860B",fontWeight:"700"},{id:125,text:"DEDICATION PAYS OFF",category:"Sports",fontSize:20,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082"},{id:126,text:"STYLE ICON",category:"Lifestyle",fontSize:30,fontFamily:"Palatino",fontWeight:"bold",fill:"#000000",hasBackground:!0,backgroundColor:"#FFD700"},{id:127,text:"Chic & Unique",category:"Lifestyle",fontSize:28,fontFamily:"Georgia",fontStyle:"italic",fill:"#FF1493"},{id:128,text:"TRENDSETTER",category:"Lifestyle",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#9370DB",textAlign:"center"},{id:129,text:"Fashion Forward",category:"Lifestyle",fontSize:24,fontFamily:"Trebuchet MS",fill:"#FF69B4",fontWeight:"600"},{id:130,text:"BOUTIQUE VIBES",category:"Lifestyle",fontSize:22,fontFamily:"Arial",fontWeight:"bold",fill:"#4169E1"},{id:131,text:"Effortlessly Elegant",category:"Lifestyle",fontSize:20,fontFamily:"Georgia",fontStyle:"italic",fill:"#2F4F4F"},{id:132,text:"LUXE LIFESTYLE",category:"Lifestyle",fontSize:28,fontFamily:"Palatino",fontWeight:"bold",fill:"#B8860B",letterSpacing:2},{id:133,text:"Vintage Soul",category:"Lifestyle",fontSize:32,fontFamily:"Georgia",fill:"#8B4513",fontWeight:"700"},{id:134,text:"MODERN CLASSIC",category:"Lifestyle",fontSize:24,fontFamily:"Arial",fontWeight:"800",fill:"#000000"},{id:135,text:"Street Style",category:"Lifestyle",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500"},{id:136,text:"SOPHISTICATED",category:"Lifestyle",fontSize:26,fontFamily:"Palatino",fontWeight:"bold",fill:"#2E8B57",hasBackground:!0,backgroundColor:"#F5F5F5"},{id:137,text:"Boho Chic",category:"Lifestyle",fontSize:28,fontFamily:"Georgia",fontStyle:"italic",fill:"#CD853F"},{id:138,text:"MINIMALIST",category:"Lifestyle",fontSize:32,fontFamily:"Arial",fontWeight:"300",fill:"#696969",letterSpacing:3},{id:139,text:"Glamorous Life",category:"Lifestyle",fontSize:24,fontFamily:"Trebuchet MS",fill:"#FFD700",fontWeight:"700"},{id:140,text:"HAUTE COUTURE",category:"Lifestyle",fontSize:22,fontFamily:"Palatino",fontWeight:"bold",fill:"#4B0082"},{id:141,text:"Urban Explorer",category:"Lifestyle",fontSize:26,fontFamily:"Impact",fill:"#32CD32",fontWeight:"bold"},{id:142,text:"AESTHETIC VIBES",category:"Lifestyle",fontSize:24,fontFamily:"Arial",fontWeight:"600",fill:"#FF69B4"},{id:143,text:"Lifestyle Goals",category:"Lifestyle",fontSize:28,fontFamily:"Georgia",fill:"#20B2AA",fontWeight:"600"},{id:144,text:"PREMIUM QUALITY",category:"Lifestyle",fontSize:20,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#B22222"},{id:145,text:"Designer Dreams",category:"Lifestyle",fontSize:26,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB"},{id:146,text:"CURATED STYLE",category:"Lifestyle",fontSize:24,fontFamily:"Arial",fontWeight:"700",fill:"#2F4F4F",letterSpacing:1},{id:147,text:"Fashion Statement",category:"Lifestyle",fontSize:22,fontFamily:"Georgia",fill:"#FF1493",fontWeight:"600"},{id:148,text:"ARTISAN CRAFTED",category:"Lifestyle",fontSize:20,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#8B4513"},{id:149,text:"Timeless Elegance",category:"Lifestyle",fontSize:24,fontFamily:"Palatino",fontStyle:"italic",fill:"#000080"},{id:150,text:"SIGNATURE STYLE",category:"Lifestyle",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700",textAlign:"center"},{id:151,text:"HAPPY BIRTHDAY",category:"Holidays",fontSize:32,fontFamily:"Comic Sans MS",fontWeight:"bold",fill:"#FF69B4",hasBackground:!0,backgroundColor:"#FFFF00",textAlign:"center"},{id:152,text:"Merry Christmas",category:"Holidays",fontSize:30,fontFamily:"Georgia",fill:"#B22222",fontWeight:"700",hasTextShadow:!0,textShadowX:2,textShadowY:2,textShadowBlur:4,textShadowColor:"#228B22"},{id:153,text:"CELEBRATION TIME",category:"Holidays",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700"},{id:154,text:"Happy New Year",category:"Holidays",fontSize:26,fontFamily:"Trebuchet MS",fill:"#4169E1",fontWeight:"700"},{id:155,text:"THANKFUL HEART",category:"Holidays",fontSize:24,fontFamily:"Georgia",fontWeight:"bold",fill:"#FF8C00",textAlign:"center"},{id:156,text:"Easter Blessings",category:"Holidays",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB"},{id:157,text:"PARTY TIME",category:"Holidays",fontSize:34,fontFamily:"Impact",fontWeight:"bold",fill:"#FF1493",hasBackground:!0,backgroundColor:"#000000"},{id:158,text:"Halloween Spirit",category:"Holidays",fontSize:26,fontFamily:"Arial",fontWeight:"800",fill:"#FF4500"},{id:159,text:"FESTIVE MOOD",category:"Holidays",fontSize:30,fontFamily:"Georgia",fontWeight:"bold",fill:"#32CD32"},{id:160,text:"Valentine's Day",category:"Holidays",fontSize:24,fontFamily:"Palatino",fontStyle:"italic",fill:"#DC143C"},{id:161,text:"ANNIVERSARY JOY",category:"Holidays",fontSize:"22",fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#B8860B"},{id:162,text:"Graduation Day",category:"Holidays",fontSize:28,fontFamily:"Arial",fill:"#000080",fontWeight:"700"},{id:163,text:"SUMMER VIBES",category:"Holidays",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700",textAlign:"center"},{id:164,text:"Winter Wonderland",category:"Holidays",fontSize:20,fontFamily:"Georgia",fill:"#4169E1",fontWeight:"600"},{id:165,text:"MOTHER'S DAY LOVE",category:"Holidays",fontSize:22,fontFamily:"Palatino",fontWeight:"bold",fill:"#FF69B4"},{id:166,text:"Father's Day Hero",category:"Holidays",fontSize:24,fontFamily:"Arial",fill:"#2F4F4F",fontWeight:"700"},{id:167,text:"SPRING AWAKENING",category:"Holidays",fontSize:26,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#32CD32"},{id:168,text:"Holiday Magic",category:"Holidays",fontSize:30,fontFamily:"Georgia",fontStyle:"italic",fill:"#9370DB"},{id:169,text:"FAMILY GATHERING",category:"Holidays",fontSize:20,fontFamily:"Arial",fontWeight:"600",fill:"#8B4513"},{id:170,text:"Wedding Bliss",category:"Holidays",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#FFD700"},{id:171,text:"FIREWORKS NIGHT",category:"Holidays",fontSize:24,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500"},{id:172,text:"Autumn Leaves",category:"Holidays",fontSize:26,fontFamily:"Georgia",fill:"#D2691E",fontWeight:"600"},{id:173,text:"MILESTONE MOMENT",category:"Holidays",fontSize:22,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082"},{id:174,text:"Special Occasion",category:"Holidays",fontSize:24,fontFamily:"Arial",fill:"#B22222",fontWeight:"700"},{id:175,text:"CHEERS TO LIFE",category:"Holidays",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#20B2AA",textAlign:"center"},{id:176,text:'"Life is Beautiful"',category:"Quotes",fontSize:26,fontFamily:"Georgia",fontStyle:"italic",fill:"#2E8B57",textAlign:"center"},{id:177,text:"CARPE DIEM",category:"Quotes",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#B8860B",letterSpacing:2},{id:178,text:'"Choose Happiness"',category:"Quotes",fontSize:24,fontFamily:"Palatino",fontStyle:"italic",fill:"#FF69B4"},{id:179,text:"LIVE LAUGH LOVE",category:"Quotes",fontSize:24,fontFamily:"Arial",fontWeight:"600",fill:"#DC143C",textAlign:"center"},{id:180,text:'"Dream Without Fear"',category:"Quotes",fontSize:22,fontFamily:"Georgia",fontStyle:"italic",fill:"#4169E1"},{id:181,text:"WISDOM WITHIN",category:"Quotes",fontSize:28,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#2F4F4F"},{id:182,text:'"Create Your Story"',category:"Quotes",fontSize:20,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB"},{id:183,text:"INNER PEACE",category:"Quotes",fontSize:30,fontFamily:"Arial",fontWeight:"300",fill:"#20B2AA",letterSpacing:3},{id:184,text:'"Follow Your Heart"',category:"Quotes",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#FF1493"},{id:185,text:"GRATITUDE DAILY",category:"Quotes",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#FF8C00"},{id:186,text:'"Embrace Change"',category:"Quotes",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#32CD32"},{id:187,text:"MINDFUL LIVING",category:"Quotes",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"600",fill:"#4B0082"},{id:188,text:'"Stay Curious"',category:"Quotes",fontSize:30,fontFamily:"Georgia",fontStyle:"italic",fill:"#B22222"},{id:189,text:"PURPOSE DRIVEN",category:"Quotes",fontSize:28,fontFamily:"Arial",fontWeight:"700",fill:"#8B4513"},{id:190,text:'"Find Your Why"',category:"Quotes",fontSize:26,fontFamily:"Palatino",fontStyle:"italic",fill:"#CD853F"},{id:191,text:"AUTHENTIC SELF",category:"Quotes",fontSize:24,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500"},{id:192,text:'"Less is More"',category:"Quotes",fontSize:32,fontFamily:"Arial",fontWeight:"300",fill:"#696969",letterSpacing:2},{id:193,text:"PRESENT MOMENT",category:"Quotes",fontSize:26,fontFamily:"Georgia",fontWeight:"600",fill:"#2E8B57"},{id:194,text:'"Trust The Process"',category:"Quotes",fontSize:22,fontFamily:"Palatino",fontStyle:"italic",fill:"#4169E1"},{id:195,text:"BALANCED LIFE",category:"Quotes",fontSize:28,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#20B2AA"},{id:196,text:'"Spread Kindness"',category:"Quotes",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#FF69B4"},{id:197,text:"GROWTH MINDSET",category:"Quotes",fontSize:26,fontFamily:"Arial",fontWeight:"700",fill:"#32CD32"},{id:198,text:'"Be The Change"',category:"Quotes",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB"},{id:199,text:"INFINITE POSSIBILITIES",category:"Quotes",fontSize:20,fontFamily:"Impact",fontWeight:"bold",fill:"#B8860B"},{id:200,text:'"Leave Your Mark"',category:"Quotes",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#8B0000",textAlign:"center"},{id:201,text:"OPEN",category:"Signage",fontSize:44,fontFamily:"Bebas Neue",fill:"#111827",textAlign:"center",letterSpacing:6},{id:202,text:"EST. 2024",category:"Signage",fontSize:34,fontFamily:"Staatliches",fill:"#374151",textAlign:"center",letterSpacing:3},{id:203,text:"VINTAGE",category:"Signage",fontSize:36,fontFamily:"Alfa Slab One",fill:"#6d4c41",textAlign:"center"},{id:204,text:"MARKET",category:"Signage",fontSize:38,fontFamily:"Anton",fill:"#1f2937",textAlign:"center",letterSpacing:8},{id:205,text:"WELCOME",category:"Signage",fontSize:40,fontFamily:"Bebas Neue",fill:"#0f766e",textAlign:"center",letterSpacing:5},{id:206,text:"OFF DUTY",category:"Streetwear",fontSize:38,fontFamily:"Archivo Black",fill:"#111827",textAlign:"center"},{id:207,text:"STAY HUMBLE",category:"Streetwear",fontSize:30,fontFamily:"Bebas Neue",fill:"#e11d48",textAlign:"center",letterSpacing:4},{id:208,text:"NO RULES",category:"Streetwear",fontSize:34,fontFamily:"Bungee",fill:"#7c3aed",textAlign:"center"},{id:209,text:"HYPE",category:"Streetwear",fontSize:44,fontFamily:"Titan One",fill:"#f59e0b",textAlign:"center"},{id:210,text:"BORN TO STAND OUT",category:"Streetwear",fontSize:24,fontFamily:"Anton",fill:"#111827",textAlign:"center",letterSpacing:2},{id:211,text:"Forever & Always",category:"Wedding",fontSize:38,fontFamily:"Great Vibes",fill:"#9d174d",textAlign:"center"},{id:212,text:"Mr & Mrs",category:"Wedding",fontSize:44,fontFamily:"Great Vibes",fill:"#3f3f46",textAlign:"center"},{id:213,text:"Just Married",category:"Wedding",fontSize:36,fontFamily:"Pacifico",fill:"#be123c",textAlign:"center"},{id:214,text:"Save the Date",category:"Wedding",fontSize:34,fontFamily:"Dancing Script",fontWeight:"700",fill:"#1f2937",textAlign:"center"},{id:215,text:"A",category:"Monogram",fontSize:72,fontFamily:"Playfair Display",fontWeight:"700",fill:"#1f2937",textAlign:"center"},{id:216,text:"M & J",category:"Monogram",fontSize:44,fontFamily:"Great Vibes",fill:"#7c2d12",textAlign:"center"},{id:217,text:"EST. YOU",category:"Monogram",fontSize:30,fontFamily:"Staatliches",fill:"#111827",textAlign:"center",letterSpacing:4},{id:218,text:"RETRO",category:"Retro",fontSize:40,fontFamily:"Bungee Inline",fill:"#0ea5e9",textAlign:"center"},{id:219,text:"Sunset Vibes",category:"Retro",fontSize:36,fontFamily:"Lobster",fill:"#ea580c",textAlign:"center"},{id:220,text:"Good Times",category:"Retro",fontSize:36,fontFamily:"Pacifico",fill:"#b45309",textAlign:"center"},{id:221,text:"CLASSIC",category:"Retro",fontSize:34,fontFamily:"Playfair Display",fontStyle:"italic",fontWeight:"700",fill:"#3f3f46",textAlign:"center",letterSpacing:3},{id:222,text:"ADVENTURE AWAITS",category:"Outdoors",fontSize:24,fontFamily:"Oswald",fontWeight:"700",fill:"#166534",textAlign:"center",letterSpacing:3},{id:223,text:"Wander",category:"Outdoors",fontSize:44,fontFamily:"Sacramento",fill:"#065f46",textAlign:"center"},{id:224,text:"MOUNTAIN TIME",category:"Outdoors",fontSize:28,fontFamily:"Bebas Neue",fill:"#0c4a6e",textAlign:"center",letterSpacing:3},{id:225,text:"Explore More",category:"Outdoors",fontSize:34,fontFamily:"Caveat",fontWeight:"700",fill:"#7c2d12",textAlign:"center"},{id:226,text:"Blessed",category:"Faith",fontSize:44,fontFamily:"Great Vibes",fill:"#6d28d9",textAlign:"center"},{id:227,text:"FAITH",category:"Faith",fontSize:40,fontFamily:"Staatliches",fill:"#1e3a8a",textAlign:"center",letterSpacing:4},{id:228,text:"Grateful",category:"Faith",fontSize:38,fontFamily:"Dancing Script",fontWeight:"700",fill:"#9a3412",textAlign:"center"},{id:229,text:"But First, Coffee",category:"Foodie",fontSize:30,fontFamily:"Pacifico",fill:"#5b3a29",textAlign:"center"},{id:230,text:"Taco Tuesday",category:"Foodie",fontSize:34,fontFamily:"Lobster",fill:"#ca8a04",textAlign:"center"},{id:231,text:"FRESH",category:"Foodie",fontSize:42,fontFamily:"Anton",fill:"#15803d",textAlign:"center",letterSpacing:2},{id:232,text:"Birthday Squad",category:"Kids",fontSize:32,fontFamily:"Caveat",fontWeight:"700",fill:"#db2777",textAlign:"center"},{id:233,text:"Party Time",category:"Kids",fontSize:36,fontFamily:"Pacifico",fill:"#7c3aed",textAlign:"center"},{id:234,text:"Little Legend",category:"Kids",fontSize:34,fontFamily:"Dancing Script",fontWeight:"700",fill:"#2563eb",textAlign:"center"},{id:235,text:"The Family",category:"Family",fontSize:40,fontFamily:"Great Vibes",fill:"#3f3f46",textAlign:"center"},{id:236,text:"Family",category:"Family",fontSize:46,fontFamily:"Sacramento",fill:"#9a3412",textAlign:"center"},{id:237,text:"HOME",category:"Family",fontSize:40,fontFamily:"Alfa Slab One",fill:"#374151",textAlign:"center",letterSpacing:6},{id:238,text:"Gather",category:"Family",fontSize:40,fontFamily:"Playfair Display",fontStyle:"italic",fontWeight:"700",fill:"#1f2937",textAlign:"center"},{id:239,text:"GOOD VIBES",category:"Music",fontSize:34,fontFamily:"Bebas Neue",fill:"#0891b2",textAlign:"center",letterSpacing:4},{id:240,text:"On Repeat",category:"Music",fontSize:36,fontFamily:"Lobster",fill:"#7c3aed",textAlign:"center"},{id:241,text:"GAME OVER",category:"Gaming",fontSize:34,fontFamily:"Bungee",fill:"#dc2626",textAlign:"center"},{id:242,text:"PLAYER ONE",category:"Gaming",fontSize:32,fontFamily:"Squada One",fill:"#16a34a",textAlign:"center",letterSpacing:2},{id:243,text:"CHAMPIONS",category:"Sports",fontSize:30,fontFamily:"Anton",fill:"#b45309",textAlign:"center",letterSpacing:4},{id:244,text:"TEAM SPIRIT",category:"Sports",fontSize:30,fontFamily:"Bebas Neue",fill:"#1d4ed8",textAlign:"center",letterSpacing:3},{id:245,text:"Dream Big",category:"Motivational",fontSize:40,fontFamily:"Pacifico",fill:"#db2777",textAlign:"center"},{id:246,text:"Hustle",category:"Motivational",fontSize:44,fontFamily:"Alfa Slab One",fill:"#111827",textAlign:"center"},{id:247,text:"Good Vibes Only",category:"Motivational",fontSize:34,fontFamily:"Dancing Script",fontWeight:"700",fill:"#0d9488",textAlign:"center"},{id:248,text:"BOLD",category:"Motivational",fontSize:46,fontFamily:"Bungee",fill:"#ea580c",textAlign:"center"},{id:249,text:"Love You More",category:"Love",fontSize:38,fontFamily:"Great Vibes",fill:"#be123c",textAlign:"center"},{id:250,text:"xoxo",category:"Love",fontSize:48,fontFamily:"Sacramento",fill:"#db2777",textAlign:"center"},{id:251,text:"Bonjour",category:"Calligraphy",fontSize:46,fontFamily:"Great Vibes",fill:"#1f2937",textAlign:"center"},{id:252,text:"Forever & Always",category:"Calligraphy",fontSize:40,fontFamily:"Allura",fill:"#be123c",textAlign:"center"},{id:253,text:"Cheers",category:"Calligraphy",fontSize:48,fontFamily:"Parisienne",fill:"#0f766e",textAlign:"center"},{id:254,text:"Sweet Dreams",category:"Calligraphy",fontSize:42,fontFamily:"Tangerine",fontWeight:"700",fill:"#7c3aed",textAlign:"center"},{id:255,text:"Hello Gorgeous",category:"Calligraphy",fontSize:38,fontFamily:"Dancing Script",fontWeight:"700",fill:"#db2777",textAlign:"center"},{id:256,text:"Stay Wild",category:"Calligraphy",fontSize:42,fontFamily:"Sacramento",fill:"#16a34a",textAlign:"center"},{id:257,text:"Adventure Awaits",category:"Calligraphy",fontSize:34,fontFamily:"Satisfy",fill:"#1d4ed8",textAlign:"center"},{id:258,text:"Handcrafted",category:"Calligraphy",fontSize:36,fontFamily:"Kaushan Script",fill:"#b45309",textAlign:"center"},{id:259,text:"Just Married",category:"Calligraphy",fontSize:42,fontFamily:"Great Vibes",fill:"#9d174d",textAlign:"center"},{id:260,text:"Celebrate",category:"Calligraphy",fontSize:40,fontFamily:"Yellowtail",fill:"#c026d3",textAlign:"center"},{id:261,text:"With Love",category:"Calligraphy",fontSize:44,fontFamily:"Cookie",fill:"#e11d48",textAlign:"center"},{id:262,text:"Wanderlust",category:"Calligraphy",fontSize:38,fontFamily:"Marck Script",fill:"#0891b2",textAlign:"center"},{id:263,text:"Grateful",category:"Calligraphy",fontSize:44,fontFamily:"Pacifico",fill:"#ea580c",textAlign:"center"},{id:264,text:"Magnifique",category:"Calligraphy",fontSize:40,fontFamily:"Allura",fill:"#4338ca",textAlign:"center"},{id:265,text:"Bloom",category:"Calligraphy",fontSize:52,fontFamily:"Parisienne",fill:"#db2777",textAlign:"center"},{id:266,text:"Bella Vita",category:"Calligraphy",fontSize:42,fontFamily:"Satisfy",fill:"#0d9488",textAlign:"center"}],_i=["Arial","Helvetica","Times New Roman","Georgia","Verdana","Courier New","Tahoma","Trebuchet MS","Impact","Comic Sans MS"],pa=new Set(_i),Bi=[{name:"System",fonts:_i},{name:"Signage & Display",fonts:["Bebas Neue","Anton","Oswald","Archivo Black","Teko","Fjalla One","Saira Condensed","Squada One","Staatliches","Passion One","Alfa Slab One","Titan One","Bowlby One SC","Bungee","Bungee Inline"]},{name:"Sans Serif",fonts:["Roboto","Open Sans","Montserrat","Lato","Poppins","Inter","Raleway","Work Sans","Nunito","Rubik","Barlow","Kanit","Mukta"]},{name:"Serif",fonts:["Merriweather","Playfair Display","Lora","PT Serif","Cormorant Garamond","Libre Baskerville","EB Garamond","Crimson Text","Bitter"]},{name:"Slab Serif",fonts:["Roboto Slab","Arvo","Zilla Slab","Josefin Slab"]},{name:"Script & Handwriting",fonts:["Dancing Script","Pacifico","Great Vibes","Satisfy","Sacramento","Caveat","Kaushan Script","Lobster","Cookie","Allura","Parisienne","Yellowtail","Tangerine","Marck Script","Shadows Into Light","Permanent Marker","Homemade Apple"]},{name:"Decorative & Stencil",fonts:["Black Ops One","Stardos Stencil","Special Elite","Monoton","Faster One","Press Start 2P","Creepster","Righteous","Audiowide","Orbitron","Russo One","Wallpoet"]},{name:"Monospace",fonts:["Roboto Mono","Source Code Pro","JetBrains Mono","Space Mono","IBM Plex Mono"]}],wo=Bi.reduce((s,o)=>s.concat(o.fonts),[]),ya=s=>pa.has(s),xa="https://fonts.googleapis.com/css2",mo=new Set(_i),ba=s=>`family=${s.trim().replace(/\s+/g,"+")}:wght@400;700`,Ze=s=>{if(typeof document>"u")return;const o=(s||[]).filter(n=>n&&!mo.has(n));if(o.length===0)return;const r=10;for(let n=0;n<o.length;n+=r){const l=o.slice(n,n+r),d=document.createElement("link");d.rel="stylesheet",d.href=`${xa}?${l.map(ba).join("&")}&display=swap`,d.setAttribute("data-simplex-font","1"),document.head.appendChild(d),l.forEach(h=>mo.add(h))}},ko=async s=>{if(!(!s||ya(s))&&(Ze([s]),!(typeof document>"u"||!document.fonts||!document.fonts.load)))try{await Promise.all([document.fonts.load(`400 24px "${s}"`),document.fonts.load(`700 24px "${s}"`)])}catch{}},Vi=async s=>{const o=Array.from(new Set((s||[]).filter(Boolean)));await Promise.all(o.map(ko))},Pi={business:{name:"Business & Office",icons:[{name:"briefcase",symbol:"💼",unicode:"💼"},{name:"chart-up",symbol:"📈",unicode:"📈"},{name:"chart-down",symbol:"📉",unicode:"📉"},{name:"graph",symbol:"📊",unicode:"📊"},{name:"clipboard",symbol:"📋",unicode:"📋"},{name:"calendar",symbol:"📅",unicode:"📅"},{name:"office",symbol:"🏢",unicode:"🏢"},{name:"bank",symbol:"🏦",unicode:"🏦"},{name:"money-bag",symbol:"💰",unicode:"💰"},{name:"credit-card",symbol:"💳",unicode:"💳"}]},technology:{name:"Technology",icons:[{name:"laptop",symbol:"💻",unicode:"💻"},{name:"phone",symbol:"📱",unicode:"📱"},{name:"desktop",symbol:"🖥️",unicode:"🖥️"},{name:"keyboard",symbol:"⌨️",unicode:"⌨️"},{name:"mouse",symbol:"🖱️",unicode:"🖱️"},{name:"printer",symbol:"🖨️",unicode:"🖨️"},{name:"wifi",symbol:"📶",unicode:"📶"},{name:"battery",symbol:"🔋",unicode:"🔋"},{name:"plug",symbol:"🔌",unicode:"🔌"},{name:"gear",symbol:"⚙️",unicode:"⚙️"}]},communication:{name:"Communication",icons:[{name:"email",symbol:"📧",unicode:"📧"},{name:"envelope",symbol:"✉️",unicode:"✉️"},{name:"phone-call",symbol:"📞",unicode:"📞"},{name:"message",symbol:"💬",unicode:"💬"},{name:"announcement",symbol:"📢",unicode:"📢"},{name:"megaphone",symbol:"📣",unicode:"📣"},{name:"satellite",symbol:"📡",unicode:"📡"},{name:"radio",symbol:"📻",unicode:"📻"},{name:"microphone",symbol:"🎤",unicode:"🎤"},{name:"speaker",symbol:"🔊",unicode:"🔊"}]},transport:{name:"Transportation",icons:[{name:"car",symbol:"🚗",unicode:"🚗"},{name:"truck",symbol:"🚛",unicode:"🚛"},{name:"bus",symbol:"🚌",unicode:"🚌"},{name:"airplane",symbol:"✈️",unicode:"✈️"},{name:"train",symbol:"🚆",unicode:"🚆"},{name:"ship",symbol:"🚢",unicode:"🚢"},{name:"bicycle",symbol:"🚴",unicode:"🚴"},{name:"motorcycle",symbol:"🏍️",unicode:"🏍️"},{name:"taxi",symbol:"🚕",unicode:"🚕"},{name:"rocket",symbol:"🚀",unicode:"🚀"}]},nature:{name:"Nature & Environment",icons:[{name:"tree",symbol:"🌳",unicode:"🌳"},{name:"leaf",symbol:"🍃",unicode:"🍃"},{name:"flower",symbol:"🌸",unicode:"🌸"},{name:"sun",symbol:"☀️",unicode:"☀️"},{name:"moon",symbol:"🌙",unicode:"🌙"},{name:"star",symbol:"⭐",unicode:"⭐"},{name:"cloud",symbol:"☁️",unicode:"☁️"},{name:"rainbow",symbol:"🌈",unicode:"🌈"},{name:"mountain",symbol:"⛰️",unicode:"⛰️"},{name:"globe",symbol:"🌍",unicode:"🌍"}]},symbols:{name:"Symbols & Signs",icons:[{name:"check",symbol:"✅",unicode:"✅"},{name:"cross",symbol:"❌",unicode:"❌"},{name:"warning",symbol:"⚠️",unicode:"⚠️"},{name:"info",symbol:"ℹ️",unicode:"ℹ️"},{name:"question",symbol:"❓",unicode:"❓"},{name:"exclamation",symbol:"❗",unicode:"❗"},{name:"lock",symbol:"🔒",unicode:"🔒"},{name:"unlock",symbol:"🔓",unicode:"🔓"},{name:"key",symbol:"🔑",unicode:"🔑"},{name:"shield",symbol:"🛡️",unicode:"🛡️"}]}},jo=()=>Object.values(Pi).flatMap(s=>s.icons.map(o=>({...o,category:s.name}))),Sa=s=>jo().filter(r=>r.name.toLowerCase().includes(s.toLowerCase())||r.category.toLowerCase().includes(s.toLowerCase())),va=({onSelectIcon:s,disabled:o=!1})=>{const[r,n]=g.useState(!1),[l,d]=g.useState(""),[h,w]=g.useState("all"),k=g.useRef(null);g.useEffect(()=>{const S=D=>{k.current&&!k.current.contains(D.target)&&n(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);const z=S=>{s(S),n(!1),d("")},T=(()=>{let S=jo();if(l.trim()&&(S=Sa(l)),h!=="all"){const D=Pi[h];D&&(S=S.filter(M=>M.category===D.name))}return S})();return e.jsxs("div",{className:"icon-selector",ref:k,children:[e.jsxs("button",{className:"toolbar-btn compact dropdown-trigger",disabled:o,onClick:()=>n(!r),title:"Add Icon",children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"target",size:18,color:o?"#94a3b8":"#475569"})}),e.jsx("span",{className:"label",children:"Icons"})]}),r&&e.jsxs("div",{className:"icon-dropdown",children:[e.jsxs("div",{className:"icon-dropdown-header",children:[e.jsx("input",{type:"text",placeholder:"Search icons...",value:l,onChange:S=>d(S.target.value),className:"icon-search"}),e.jsxs("select",{value:h,onChange:S=>w(S.target.value),className:"category-select",children:[e.jsx("option",{value:"all",children:"All Categories"}),Object.entries(Pi).map(([S,D])=>e.jsx("option",{value:S,children:D.name},S))]})]}),e.jsx("div",{className:"icon-grid",children:T.length===0?e.jsx("div",{className:"no-icons",children:l?"No icons found":"No icons in this category"}):T.map((S,D)=>e.jsxs("button",{className:"icon-item",onClick:()=>z(S),title:`${S.name} (${S.category})`,children:[e.jsx("span",{className:"icon-symbol",children:S.symbol}),e.jsx("span",{className:"icon-name",children:S.name})]},`${S.name}-${D}`))}),e.jsx("div",{className:"icon-dropdown-footer",children:e.jsxs("span",{className:"icon-count",children:[T.length," icon",T.length!==1?"s":""]})})]})]})},wa=({isOpen:s,onClose:o,onAddQRCode:r,theme:n})=>{const[l,d]=g.useState(""),[h,w]=g.useState(""),[k,z]=g.useState(200),[N,T]=g.useState("M"),S=()=>{if(!l.trim())return;const $={width:k,errorCorrectionLevel:N,type:"image/png",quality:.92,margin:1,color:{dark:"#000000",light:"#FFFFFF"}};ha.toDataURL(l,$,(Z,Y)=>{if(Z){console.error("QR Code generation error:",Z);return}w(Y)})},D=()=>{if(!h)return;const $=new Image;$.onload=()=>{r({type:"qrcode",src:h,data:l,width:k,height:k,imageObject:$}),M()},$.src=h},M=()=>{d(""),w(""),o()};return s?e.jsx("div",{className:"qr-modal-overlay",onClick:M,children:e.jsxs("div",{className:"qr-modal-content",onClick:$=>$.stopPropagation(),children:[e.jsxs("div",{className:"qr-modal-header",children:[e.jsx("h3",{children:"Generate QR Code"}),e.jsx("button",{className:"qr-modal-close",onClick:M,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"qr-modal-body",children:[e.jsxs("div",{className:"qr-form-group",children:[e.jsx("label",{htmlFor:"qr-data",children:"Enter Data (URL, Text, etc.)"}),e.jsx("textarea",{id:"qr-data",value:l,onChange:$=>d($.target.value),placeholder:"https://example.com or any text...",rows:3})]}),e.jsxs("div",{className:"qr-options",children:[e.jsxs("div",{className:"qr-form-group",children:[e.jsx("label",{htmlFor:"qr-size",children:"Size (px)"}),e.jsx("input",{type:"number",id:"qr-size",value:k,onChange:$=>z(Math.max(50,Math.min(500,parseInt($.target.value)||200))),min:"50",max:"500"})]}),e.jsxs("div",{className:"qr-form-group",children:[e.jsx("label",{htmlFor:"qr-error-level",children:"Error Correction"}),e.jsxs("select",{id:"qr-error-level",value:N,onChange:$=>T($.target.value),children:[e.jsx("option",{value:"L",children:"Low (7%)"}),e.jsx("option",{value:"M",children:"Medium (15%)"}),e.jsx("option",{value:"Q",children:"Quartile (25%)"}),e.jsx("option",{value:"H",children:"High (30%)"})]})]})]}),e.jsx("div",{className:"qr-actions",children:e.jsx("button",{className:"qr-btn qr-btn-generate",onClick:S,disabled:!l.trim(),children:"Generate QR Code"})}),h&&e.jsxs("div",{className:"qr-preview",children:[e.jsx("h4",{children:"Preview"}),e.jsx("div",{className:"qr-preview-container",children:e.jsx("img",{src:h,alt:"QR Code Preview"})}),e.jsx("button",{className:"qr-btn qr-btn-add",onClick:D,style:{backgroundColor:(n==null?void 0:n.primaryColor)||"#3b82f6",borderColor:(n==null?void 0:n.primaryColor)||"#3b82f6"},children:"Add to Canvas"})]})]})]})}):null},ka=({isOpen:s,onClose:o,onAddBarcode:r,theme:n})=>{const[l,d]=g.useState(""),[h,w]=g.useState("CODE128"),[k,z]=g.useState(null),[N,T]=g.useState(2),[S,D]=g.useState(100),[M,$]=g.useState(20),[Z,Y]=g.useState("center"),[R,lt]=g.useState("bottom"),[_,F]=g.useState(10),ut=g.useRef(null),E=[{value:"CODE128",label:"CODE128 (Most Common)"},{value:"EAN13",label:"EAN-13 (European Article Number)"},{value:"EAN8",label:"EAN-8 (Short EAN)"},{value:"UPC",label:"UPC (Universal Product Code)"},{value:"CODE39",label:"CODE39 (Alpha-numeric)"},{value:"ITF14",label:"ITF-14 (Shipping/Logistics)"},{value:"MSI",label:"MSI (Retail)"},{value:"pharmacode",label:"Pharmacode (Pharmaceutical)"},{value:"codabar",label:"Codabar (Libraries/Blood banks)"}],ot=()=>{if(l.trim())try{z(e.jsx(fa,{value:l,format:h,width:N,height:S,fontSize:M,textAlign:Z,textPosition:R,margin:_,background:"#ffffff",lineColor:"#000000"}))}catch(q){console.error("Barcode generation error:",q),alert("Invalid data for selected barcode format. Please check your input.")}},v=()=>{var q,O,st,J;if(!(!k||!ut.current))try{const ht=ut.current.querySelector("svg");if(!ht){console.error("No SVG element found in barcode");return}const C=document.createElement("canvas"),G=C.getContext("2d"),H=ht.getBoundingClientRect(),m=((O=(q=ht.width)==null?void 0:q.baseVal)==null?void 0:O.value)||H.width||200,L=((J=(st=ht.height)==null?void 0:st.baseVal)==null?void 0:J.value)||H.height||100;C.width=m,C.height=L;const Q=new XMLSerializer().serializeToString(ht),ft=new Blob([Q],{type:"image/svg+xml;charset=utf-8"}),zt=URL.createObjectURL(ft),kt=new Image;kt.onload=()=>{G.drawImage(kt,0,0);const Ht=C.toDataURL("image/png"),It=new Image;It.onload=()=>{r({type:"barcode",src:Ht,data:l,format:h,width:m,height:L,imageObject:It}),at()},It.src=Ht,URL.revokeObjectURL(zt)},kt.src=zt}catch(ht){console.error("Error adding barcode to canvas:",ht),alert("Failed to add barcode to canvas. Please try again.")}},at=()=>{d(""),z(null),w("CODE128"),T(2),D(100),$(20),o()},ct=q=>({CODE128:"Supports all ASCII characters. Most versatile format.",EAN13:"Requires exactly 12 digits (13th is checksum). Used for retail products.",EAN8:"Requires exactly 7 digits (8th is checksum). Compact version of EAN-13.",UPC:"Requires exactly 11 digits (12th is checksum). Used in North America.",CODE39:"Supports letters, numbers, and some symbols. Widely used.",ITF14:"Requires exactly 13 digits (14th is checksum). Used for shipping containers.",MSI:"Numeric only. Used in retail inventory.",pharmacode:"Numbers 3-131070. Used in pharmaceutical industry.",codabar:"Supports 0-9, A-D, and symbols. Used in libraries."})[q]||"";return s?e.jsx("div",{className:"barcode-modal-overlay",onClick:at,children:e.jsxs("div",{className:"barcode-modal-content",onClick:q=>q.stopPropagation(),children:[e.jsxs("div",{className:"barcode-modal-header",children:[e.jsx("h3",{children:"Generate Barcode"}),e.jsx("button",{className:"barcode-modal-close",onClick:at,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"barcode-modal-body",children:[e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"barcode-data",children:"Enter Data"}),e.jsx("input",{type:"text",id:"barcode-data",value:l,onChange:q=>d(q.target.value),placeholder:"Enter your data..."})]}),e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"barcode-format",children:"Barcode Format"}),e.jsx("select",{id:"barcode-format",value:h,onChange:q=>w(q.target.value),children:E.map(q=>e.jsx("option",{value:q.value,children:q.label},q.value))}),e.jsx("small",{className:"format-description",children:ct(h)})]}),e.jsxs("div",{className:"barcode-options",children:[e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"barcode-width",children:"Bar Width"}),e.jsx("input",{type:"range",id:"barcode-width",min:"1",max:"4",step:"0.5",value:N,onChange:q=>T(parseFloat(q.target.value))}),e.jsxs("span",{className:"range-value",children:[N,"px"]})]}),e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"barcode-height",children:"Height"}),e.jsx("input",{type:"range",id:"barcode-height",min:"50",max:"200",value:S,onChange:q=>D(parseInt(q.target.value))}),e.jsxs("span",{className:"range-value",children:[S,"px"]})]}),e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"barcode-fontsize",children:"Font Size"}),e.jsx("input",{type:"range",id:"barcode-fontsize",min:"10",max:"30",value:M,onChange:q=>$(parseInt(q.target.value))}),e.jsxs("span",{className:"range-value",children:[M,"px"]})]}),e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"text-position",children:"Text Position"}),e.jsxs("select",{id:"text-position",value:R,onChange:q=>lt(q.target.value),children:[e.jsx("option",{value:"bottom",children:"Bottom"}),e.jsx("option",{value:"top",children:"Top"})]})]})]}),e.jsx("div",{className:"barcode-actions",children:e.jsx("button",{className:"barcode-btn barcode-btn-generate",onClick:ot,disabled:!l.trim(),children:"Generate Barcode"})}),k&&e.jsxs("div",{className:"barcode-preview",children:[e.jsx("h4",{children:"Preview"}),e.jsx("div",{className:"barcode-preview-container",ref:ut,children:k}),e.jsx("button",{className:"barcode-btn barcode-btn-add",onClick:v,style:{backgroundColor:(n==null?void 0:n.primaryColor)||"#3b82f6",borderColor:(n==null?void 0:n.primaryColor)||"#3b82f6"},children:"Add to Canvas"})]})]})]})}):null},ja=({theme:s})=>e.jsxs("div",{className:"premium-feature-container",style:{padding:"20px",backgroundColor:"#f8f9fa",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.05)",textAlign:"center",maxWidth:"400px",margin:"0 auto"},children:[e.jsx("div",{style:{marginBottom:"16px"},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"#ffc107"},children:[e.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),e.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]})}),e.jsx("h3",{style:{color:"#333",fontSize:"18px",fontWeight:"600",marginBottom:"12px"},children:"Premium Feature Access"}),e.jsx("p",{style:{color:"#555",fontSize:"15px",lineHeight:"1.5",marginBottom:"20px"},children:"Premium stickers feature requires a subscription to access."}),e.jsx("a",{href:"https://mypixia.com/developer",target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:(s==null?void 0:s.primaryColor)||"#4c5bf2",color:"white",padding:"10px 20px",borderRadius:"4px",textDecoration:"none",fontWeight:"500",transition:"background-color 0.2s ease"},children:"Get API Key"})]}),po=()=>e.jsxs("div",{style:{textAlign:"center",padding:"40px"},children:[e.jsx("div",{style:{border:"4px solid #f3f3f3",borderTop:"4px solid #3498db",borderRadius:"50%",width:"40px",height:"40px",animation:"spin 2s linear infinite",margin:"0 auto 20px"}}),e.jsx("p",{children:"Loading..."}),e.jsx("style",{children:`
23
23
  @keyframes spin {
24
24
  0% { transform: rotate(0deg); }
25
25
  100% { transform: rotate(360deg); }
26
26
  }
27
- `})]}),ka=({isOpen:s,onClose:o,onAddSticker:r,theme:n,apiKey:l,apiEndpoint:d})=>{const[h,w]=g.useState([]),[k,T]=g.useState(!1),[N,z]=g.useState(null),[S,W]=g.useState(""),[A,_]=g.useState(""),[K,q]=g.useState({});g.useRef(null);const[D,lt]=g.useState(!1),[V,C]=g.useState(!1),[I,$]=g.useState(!1),v=`${d}/api/v1/designer`;g.useEffect(()=>{s&&l&&ot()},[s,l]);const ot=async()=>{const F=sessionStorage.getItem("apc_x_sub_status");F==="active"?(lt(!0),C(!0),ut()):F==="inactive"?(lt(!1),C(!0)):($(!0),await ct())},ct=async()=>{if(!l){lt(!1),C(!0),$(!1);return}const F=`${v}/get-subscription-status/${l}`;try{(await Di.get(F)).data.object==="active"?(sessionStorage.setItem("apc_x_sub_status","active"),lt(!0),ut()):(sessionStorage.setItem("apc_x_sub_status","inactive"),lt(!1))}catch(M){console.error("Subscription check failed:",M),sessionStorage.setItem("apc_x_sub_status","inactive"),lt(!1)}finally{$(!1),C(!0)}},ut=async()=>{const F=sessionStorage.getItem("apc_stickers");if(F)try{const M=JSON.parse(F);w(M);return}catch{console.warn("Failed to parse cached stickers, fetching fresh data")}T(!0),z(null);try{const M=await Di.get(`${v}/get-stickers`);if(M.data&&M.data.object&&M.data.object.contents){const bt=M.data.object.contents;w(bt),sessionStorage.setItem("apc_stickers",JSON.stringify(bt))}else throw new Error("Invalid response format")}catch(M){console.error("Error fetching stickers:",M),z("Failed to load stickers. Please try again.")}finally{T(!1)}},U=(F,M)=>{r({type:"sticker",src:F,name:M,width:100,height:100}),o()},Z=F=>{q(M=>({...M,[F]:!M[F]}))},it=F=>{const M={};return F.forEach(bt=>{const m=bt.name.split("/");let R=M;m.forEach((G,gt)=>{R[G]||(R[G]=gt===m.length-1?bt:{}),R=R[G]})}),M},st=(F,M="",bt=0)=>e.jsx("div",{className:"sticker-tree-level",style:{paddingLeft:`${bt*15}px`},children:Object.keys(F).map(m=>{const R=`${M}/${m}`,G=K[R];return F[m].type==="image"?!A||m.toLowerCase().includes(A.toLowerCase())?e.jsx("div",{className:"sticker-item",onClick:()=>U(F[m].url,m),children:e.jsx("div",{className:"sticker-preview",children:e.jsx("img",{src:F[m].url,alt:m,loading:"lazy",onError:wt=>{wt.target.style.display="none"}})})},R):null:e.jsxs("div",{className:"sticker-category",children:[e.jsxs("div",{className:"category-header",onClick:()=>Z(R),children:[e.jsx("span",{className:`expand-icon ${G?"expanded":""}`,children:"▶"}),e.jsx("span",{className:"category-name",children:m})]}),G&&st(F[m],R,bt+1)]},R)})}),at=h.filter(F=>!A||F.name.toLowerCase().includes(A.toLowerCase()));return s?e.jsx("div",{className:"sticker-modal-overlay",onClick:o,children:e.jsxs("div",{className:"sticker-modal-content",onClick:F=>F.stopPropagation(),children:[e.jsxs("div",{className:"sticker-modal-header",children:[e.jsx("h3",{children:"Stickers"}),e.jsx("button",{className:"sticker-modal-close",onClick:o,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"sticker-modal-body",children:[I&&e.jsx(go,{}),!D&&!I&&V&&e.jsx(wa,{theme:n}),D&&V&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"sticker-modal-controls",children:e.jsx("div",{className:"search-container",children:e.jsx("input",{type:"text",placeholder:"Search stickers...",value:A,onChange:F=>_(F.target.value),className:"sticker-search"})})}),k&&e.jsx(go,{}),N&&e.jsxs("div",{className:"sticker-error",children:[e.jsx("p",{children:N}),e.jsx("button",{onClick:ut,children:"Retry"})]}),!k&&!N&&h.length>0&&e.jsx("div",{className:"sticker-grid",children:st(it(at))})]})]})]})}):null},ja=`
27
+ `})]}),Ca=({isOpen:s,onClose:o,onAddSticker:r,theme:n,apiKey:l,apiEndpoint:d})=>{const[h,w]=g.useState([]),[k,z]=g.useState(!1),[N,T]=g.useState(null),[S,D]=g.useState(""),[M,$]=g.useState(""),[Z,Y]=g.useState({});g.useRef(null);const[R,lt]=g.useState(!1),[_,F]=g.useState(!1),[ut,E]=g.useState(!1),ot=`${d}/api/v1/designer`;g.useEffect(()=>{s&&l&&v()},[s,l]);const v=async()=>{const C=sessionStorage.getItem("apc_x_sub_status");C==="active"?(lt(!0),F(!0),ct()):C==="inactive"?(lt(!1),F(!0)):(E(!0),await at())},at=async()=>{if(!l){lt(!1),F(!0),E(!1);return}const C=`${ot}/get-subscription-status/${l}`;try{(await Wi.get(C)).data.object==="active"?(sessionStorage.setItem("apc_x_sub_status","active"),lt(!0),ct()):(sessionStorage.setItem("apc_x_sub_status","inactive"),lt(!1))}catch(G){console.error("Subscription check failed:",G),sessionStorage.setItem("apc_x_sub_status","inactive"),lt(!1)}finally{E(!1),F(!0)}},ct=async()=>{const C=sessionStorage.getItem("apc_stickers");if(C)try{const G=JSON.parse(C);w(G);return}catch{console.warn("Failed to parse cached stickers, fetching fresh data")}z(!0),T(null);try{const G=await Wi.get(`${ot}/get-stickers`);if(G.data&&G.data.object&&G.data.object.contents){const H=G.data.object.contents;w(H),sessionStorage.setItem("apc_stickers",JSON.stringify(H))}else throw new Error("Invalid response format")}catch(G){console.error("Error fetching stickers:",G),T("Failed to load stickers. Please try again.")}finally{z(!1)}},q=(C,G)=>{r({type:"sticker",src:C,name:G,width:100,height:100}),o()},O=C=>{Y(G=>({...G,[C]:!G[C]}))},st=C=>{const G={};return C.forEach(H=>{const m=H.name.split("/");let L=G;m.forEach((Q,ft)=>{L[Q]||(L[Q]=ft===m.length-1?H:{}),L=L[Q]})}),G},J=(C,G="",H=0)=>e.jsx("div",{className:"sticker-tree-level",style:{paddingLeft:`${H*15}px`},children:Object.keys(C).map(m=>{const L=`${G}/${m}`,Q=Z[L];return C[m].type==="image"?!M||m.toLowerCase().includes(M.toLowerCase())?e.jsx("div",{className:"sticker-item",onClick:()=>q(C[m].url,m),children:e.jsx("div",{className:"sticker-preview",children:e.jsx("img",{src:C[m].url,alt:m,loading:"lazy",onError:zt=>{zt.target.style.display="none"}})})},L):null:e.jsxs("div",{className:"sticker-category",children:[e.jsxs("div",{className:"category-header",onClick:()=>O(L),children:[e.jsx("span",{className:`expand-icon ${Q?"expanded":""}`,children:"▶"}),e.jsx("span",{className:"category-name",children:m})]}),Q&&J(C[m],L,H+1)]},L)})}),ht=h.filter(C=>!M||C.name.toLowerCase().includes(M.toLowerCase()));return s?e.jsx("div",{className:"sticker-modal-overlay",onClick:o,children:e.jsxs("div",{className:"sticker-modal-content",onClick:C=>C.stopPropagation(),children:[e.jsxs("div",{className:"sticker-modal-header",children:[e.jsx("h3",{children:"Stickers"}),e.jsx("button",{className:"sticker-modal-close",onClick:o,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"sticker-modal-body",children:[ut&&e.jsx(po,{}),!R&&!ut&&_&&e.jsx(ja,{theme:n}),R&&_&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"sticker-modal-controls",children:e.jsx("div",{className:"search-container",children:e.jsx("input",{type:"text",placeholder:"Search stickers...",value:M,onChange:C=>$(C.target.value),className:"sticker-search"})})}),k&&e.jsx(po,{}),N&&e.jsxs("div",{className:"sticker-error",children:[e.jsx("p",{children:N}),e.jsx("button",{onClick:ct,children:"Retry"})]}),!k&&!N&&h.length>0&&e.jsx("div",{className:"sticker-grid",children:J(st(ht))})]})]})]})}):null},Fa=`
28
28
  <defs>
29
29
  <linearGradient id="gloss" x1="0" y1="0" x2="1" y2="0">
30
30
  <stop offset="0" stop-color="#000" stop-opacity="0.28"/>
@@ -49,10 +49,10 @@ React keys must be passed directly to JSX without using spread:
49
49
  <filter id="lift" x="-30%" y="-30%" width="160%" height="160%">
50
50
  <feDropShadow dx="0.5" dy="1.1" stdDeviation="0.9" flood-color="#1a1208" flood-opacity="0.4"/>
51
51
  </filter>
52
- </defs>`,ei='fill="none" stroke="rgba(20,12,6,0.5)" stroke-width="1.3" stroke-dasharray="2.6 2" stroke-linecap="round"',Y=(s,o,r,n,l="satin")=>`<circle cx="${s}" cy="${o}" r="${r}" fill="${n}"/><circle cx="${s}" cy="${o}" r="${r}" fill="url(#${l})"/><circle cx="${s}" cy="${o}" r="${r}" ${ei}/>`,Lt=(s,o,r,n,l,d=0,h="satin")=>{const w=d?` transform="rotate(${d} ${s} ${o})"`:"";return`<ellipse cx="${s}" cy="${o}" rx="${r}" ry="${n}" fill="${l}"${w}/><ellipse cx="${s}" cy="${o}" rx="${r}" ry="${n}" fill="url(#${h})"${w}/><ellipse cx="${s}" cy="${o}" rx="${r}" ry="${n}" ${ei}${w}/>`},et=(s,o,r="satin")=>`<path d="${s}" fill="${o}"/><path d="${s}" fill="url(#${r})"/><path d="${s}" ${ei}/>`,Pt=(s,o,r,n,l,d=2,h="satin")=>`<rect x="${s}" y="${o}" width="${r}" height="${n}" rx="${d}" fill="${l}"/><rect x="${s}" y="${o}" width="${r}" height="${n}" rx="${d}" fill="url(#${h})"/><rect x="${s}" y="${o}" width="${r}" height="${n}" rx="${d}" ${ei}/>`,pt=(s,o,r=3)=>`<path d="${s}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linecap="round"/><path d="${s}" fill="none" stroke="rgba(255,255,255,0.4)" stroke-width="${Math.max(.8,r*.35)}" stroke-linecap="round"/>`;let mo=0;const rt=(s,o,r,n)=>{mo+=1;const l=`<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="0 0 120 120">${ja}<g filter="url(#lift)"><g filter="url(#floss)" stroke-linejoin="round">${n}</g></g></svg>`;return{id:mo,name:s,category:o,description:r,url:`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(l)}`}},zi=(s,o,r,n,l,d,h)=>[...Array(r)].map((w,k)=>{const T=360/r*k,N=T*Math.PI/180;return Lt(s+Math.cos(N)*n,o+Math.sin(N)*n,l,d,h,T)}).join(""),Ti=(s,o,r,n,l,d,h=3)=>[...Array(r)].map((w,k)=>{const T=360/r*k*Math.PI/180;return pt(`M${s+Math.cos(T)*n} ${o+Math.sin(T)*n} L${s+Math.cos(T)*l} ${o+Math.sin(T)*l}`,d,h)}).join(""),Ca=[rt("Rose","Floral","Satin rose",Lt(60,58,26,26,"#e23b6d")+Lt(60,58,17,17,"#f06292",0,"satinV")+Y(60,58,8,"#ad1457")+et("M60 84 q4 16 -6 26","#2e7d32")),rt("Sunflower","Floral","Sunflower",zi(60,58,12,30,9,5,"#f4b400")+Y(60,58,17,"#8d5524","satinV")),rt("Tulip","Floral","Tulip",et("M60 28 q18 6 16 30 q-16 -10 -16 -10 q0 0 -16 10 q-2 -24 16 -30 Z","#e23b6d")+et("M60 48 q8 4 7 20 q-7 -6 -7 -6 q0 0 -7 6 q-1 -16 7 -20 Z","#ad1457")+pt("M60 58 L60 96","#2e7d32",3)+et("M60 78 q14 -6 20 4 q-14 8 -20 -4 Z","#43a047")),rt("Daisy","Floral","Daisy",zi(60,58,10,26,11,5,"#ffffff")+Y(60,58,12,"#ffca28")),rt("Cherry Blossom","Floral","Cherry blossom",zi(60,60,5,18,11,9,"#f8bbd0")+Y(60,60,7,"#fff176")+Ti(60,60,5,6,16,"#fce4ec",1.4)),rt("Lavender","Floral","Lavender sprig",pt("M60 100 C58 70 62 50 60 26","#5e7d3a",3)+[...Array(7)].map((s,o)=>Lt(60+(o%2?6:-6),30+o*9,6,4,"#9575cd",o%2?25:-25)).join("")),rt("Pine Tree","Nature","Evergreen",Pt(56,86,8,16,"#795548")+et("M60 20 L82 56 L38 56 Z","#2e7d32")+et("M60 40 L88 82 L32 82 Z","#388e3c")),rt("Mountain","Nature","Mountain",et("M16 92 L52 36 L72 66 L88 44 L104 92 Z","#6d8299")+et("M52 36 L64 54 L40 54 Z","#ffffff")+Y(92,30,9,"#ffd54f")),rt("Sun","Nature","Sunburst",Ti(60,60,12,26,40,"#f9a825",3)+Y(60,60,22,"#fbc02d")),rt("Leaf Sprig","Nature","Leaf sprig",pt("M60 96 C60 70 60 50 60 28","#2e7d32",3)+et("M60 70 q-22 -6 -26 -22 q24 0 26 22 Z","#43a047")+et("M60 52 q22 -6 26 -22 q-24 0 -26 22 Z","#66bb6a")+et("M60 38 q-18 -6 -22 -20 q20 0 22 20 Z","#43a047")),rt("Cactus","Nature","Potted cactus",et("M52 92 q-2 -34 8 -34 q10 0 8 34 Z","#2e7d32")+et("M52 70 q-16 0 -16 -14 q0 -8 6 -8 q10 0 10 14 Z","#43a047")+et("M68 64 q16 0 16 -14 q0 -8 -6 -8 q-10 0 -10 14 Z","#43a047")+Pt(46,92,28,16,"#c1502e",3)),rt("Mushroom","Nature","Toadstool",et("M30 64 q0 -34 30 -34 q30 0 30 34 Z","#e53935")+Pt(50,64,20,34,"#fff8e1",6)+Y(46,50,4,"#fff")+Y(60,44,5,"#fff")+Y(74,52,4,"#fff")),rt("Acorn","Nature","Acorn",et("M40 56 q20 30 40 0 q-20 8 -40 0 Z","#a1683a")+et("M38 56 q22 -20 44 0 q-22 8 -44 0 Z","#6d4c2f")+pt("M60 30 L60 38","#6d4c2f",3)),rt("Butterfly","Animals","Butterfly",Lt(44,50,16,13,"#7e57c2",-18)+Lt(76,50,16,13,"#7e57c2",18,"satinV")+Lt(46,76,12,10,"#9575cd",-12)+Lt(74,76,12,10,"#9575cd",12,"satinV")+Pt(57,42,6,44,"#4527a0",3)+pt("M60 44 L52 30","#4527a0",2)+pt("M60 44 L68 30","#4527a0",2)),rt("Bee","Animals","Bumblebee",Lt(60,64,22,16,"#fbc02d")+Pt(50,48,8,32,"#3e2723",2)+Pt(64,48,8,32,"#3e2723",2)+Lt(40,54,12,7,"#e3f2fd",-25)+Lt(80,54,12,7,"#e3f2fd",25)),rt("Ladybug","Animals","Ladybug",Y(60,62,24,"#e53935")+pt("M60 38 L60 86","#3e2723",2)+Y(60,40,9,"#3e2723")+Y(50,56,4,"#3e2723")+Y(70,56,4,"#3e2723")+Y(50,72,4,"#3e2723")+Y(70,72,4,"#3e2723")),rt("Cat","Animals","Cat face",Y(60,64,26,"#9e9e9e")+et("M40 46 L36 24 L54 40 Z","#9e9e9e")+et("M80 46 L84 24 L66 40 Z","#9e9e9e")+Y(51,62,3.4,"#212121")+Y(69,62,3.4,"#212121")+et("M56 72 q4 4 8 0","#212121")),rt("Bird","Animals","Little bird",Lt(58,62,22,17,"#42a5f5")+Y(74,50,10,"#42a5f5")+et("M82 50 L96 54 L82 58 Z","#fb8c00")+Y(77,48,2.4,"#212121")+et("M40 64 q-16 4 -18 16 q18 -2 22 -8 Z","#1e88e5")),rt("Fish","Animals","Tropical fish",Lt(56,62,26,16,"#26c6da")+et("M82 62 L100 48 L100 76 Z","#0097a7")+Y(44,58,2.6,"#063")+et("M56 46 q0 -10 -8 -12 q2 8 8 12 Z","#0097a7")),rt("Paw","Animals","Paw print",Lt(60,72,14,11,"#6d4c41")+Y(44,52,6,"#6d4c41")+Y(58,44,6,"#6d4c41")+Y(72,46,6,"#6d4c41")+Y(82,58,5,"#6d4c41")),rt("Diamond","Geometric","Diamond",et("M60 20 L96 60 L60 100 L24 60 Z","#1e88e5")+et("M60 38 L78 60 L60 82 L42 60 Z","#64b5f6","satinV")),rt("Chevron","Geometric","Chevrons",[0,18,36].map((s,o)=>pt(`M24 ${42+s} L60 ${62+s} L96 ${42+s}`,["#1e88e5","#26a69a","#ef6c00"][o],5)).join("")),rt("Mandala","Geometric","Mandala",Y(60,60,30,"#8e24aa")+Y(60,60,20,"#ab47bc","satinV")+[...Array(8)].map((s,o)=>{const r=o*45*Math.PI/180;return Y(60+Math.cos(r)*30,60+Math.sin(r)*30,5,"#f3e5f5")}).join("")+Y(60,60,8,"#f3e5f5")),rt("Heart","Symbols","Heart",et("M60 92 C24 66 30 34 50 34 C58 34 60 42 60 46 C60 42 62 34 70 34 C90 34 96 66 60 92 Z","#e53935")),rt("Star","Symbols","Star",et("M60 22 L71 50 L101 50 L77 68 L86 98 L60 80 L34 98 L43 68 L19 50 L49 50 Z","#fbc02d")),rt("Crown","Symbols","Crown",et("M28 84 L34 46 L48 66 L60 40 L72 66 L86 46 L92 84 Z","#f9a825")+Pt(28,84,64,10,"#f57f17")+Y(34,46,5,"#fdd835")+Y(60,40,5,"#fdd835")+Y(86,46,5,"#fdd835")),rt("Anchor","Symbols","Anchor",Y(60,30,7,"#37474f")+pt("M60 36 L60 92","#455a64",5)+pt("M40 60 L80 60","#455a64",5)+et("M30 76 q6 22 30 22 q24 0 30 -22 q-12 14 -30 14 q-18 0 -30 -14 Z","#37474f")),rt("Lightning","Symbols","Lightning bolt",et("M64 18 L40 64 L56 64 L50 102 L84 50 L66 50 Z","#ffb300")),rt("Music Note","Symbols","Music note",Y(46,84,11,"#5e35b1")+Y(82,76,11,"#5e35b1")+Pt(54,30,6,54,"#5e35b1",3)+Pt(85,22,6,54,"#5e35b1",3)+et("M57 30 L91 22 L91 34 L57 42 Z","#5e35b1")),rt("Peace","Symbols","Peace sign",Y(60,60,30,"#43a047")+pt("M60 30 L60 90","rgba(255,255,255,0.95)",4)+pt("M60 60 L38 82","rgba(255,255,255,0.95)",4)+pt("M60 60 L82 82","rgba(255,255,255,0.95)",4)),rt("Cupcake","Food","Cupcake",et("M38 64 L82 64 L74 98 L46 98 Z","#d7a86e")+et("M34 64 q6 -28 26 -28 q20 0 26 28 Z","#ec407a")+Y(48,50,3,"#fff")+Y(60,44,3,"#fff")+Y(72,50,3,"#fff")+Y(60,34,5,"#e53935")),rt("Cherries","Food","Cherries",Y(46,84,12,"#e53935")+Y(74,84,12,"#c62828")+pt("M46 72 C50 50 60 40 64 30","#2e7d32",2.5)+pt("M74 72 C70 52 66 42 64 30","#2e7d32",2.5)+et("M64 30 q14 -8 22 -2 q-12 8 -22 2 Z","#43a047")),rt("Coffee","Food","Coffee cup",et("M34 50 L84 50 L80 92 L38 92 Z","#6d4c41")+et("M84 56 q16 0 16 14 q0 14 -18 12","#6d4c41")+pt("M48 38 q4 -8 0 -14","#bcaaa4",2.5)+pt("M60 38 q4 -8 0 -14","#bcaaa4",2.5)+pt("M72 38 q4 -8 0 -14","#bcaaa4",2.5)),rt("Soccer Ball","Sports","Soccer ball",Y(60,60,32,"#fafafa")+et("M60 44 L74 54 L69 72 L51 72 L46 54 Z","#212121")+Ti(60,60,5,12,30,"#212121",2)),rt("Basketball","Sports","Basketball",Y(60,60,32,"#ef6c00")+pt("M60 28 L60 92","#3e2723",2.5)+pt("M28 60 L92 60","#3e2723",2.5)+pt("M36 36 Q60 60 36 84","#3e2723",2.5)+pt("M84 36 Q60 60 84 84","#3e2723",2.5)),rt("Snowflake","Holiday","Snowflake",[...Array(6)].map((s,o)=>{const r=o*60*Math.PI/180,n=60+Math.cos(r)*38,l=60+Math.sin(r)*38,d=60+Math.cos(r)*22,h=60+Math.sin(r)*22;return pt(`M60 60 L${n} ${l}`,"#4fc3f7",3)+pt(`M${d} ${h} L${d+Math.cos(r+.5)*10} ${h+Math.sin(r+.5)*10}`,"#4fc3f7",2)+pt(`M${d} ${h} L${d+Math.cos(r-.5)*10} ${h+Math.sin(r-.5)*10}`,"#4fc3f7",2)}).join("")+Y(60,60,5,"#81d4fa")),rt("Gift","Holiday","Gift box",Pt(34,54,52,44,"#e53935",4)+Pt(54,54,12,44,"#fff",2)+Pt(34,50,52,12,"#c62828",3)+et("M60 50 q-18 -22 -2 -22 q8 0 2 22 Z","#fbc02d")+et("M60 50 q18 -22 2 -22 q-8 0 -2 22 Z","#fbc02d")),rt("Holly","Holiday","Holly & berries",et("M40 60 q10 -22 22 -10 q-2 16 -22 10 Z","#2e7d32")+et("M80 60 q-10 -22 -22 -10 q2 16 22 10 Z","#388e3c")+et("M50 78 q10 -16 20 -6 q-4 14 -20 6 Z","#43a047")+Y(56,64,5,"#e53935")+Y(64,64,5,"#c62828")+Y(60,72,5,"#e53935")),rt("Monogram","Text","Initial monogram",Y(60,60,34,"#5e35b1")+Y(60,60,34,"#5e35b1","satinV")+'<text x="60" y="75" text-anchor="middle" font-family="Georgia, serif" font-size="46" font-weight="700" fill="#ede7f6">A</text>')],Fa=({isOpen:s,onClose:o,onAddEmbroidery:r,theme:n,apiKey:l,apiEndpoint:d})=>{const[h,w]=g.useState([]),[k,T]=g.useState(!1),[N,z]=g.useState(null),[S,W]=g.useState(""),[A,_]=g.useState("All"),K=g.useRef(null),q=["All","Floral","Nature","Geometric","Traditional","Sports","Hobbies","Food","Symbols","Holiday","Text"];g.useEffect(()=>{s&&w(Ca)},[s]);const D=V=>{r({type:"embroidery",src:V.url,name:V.name,description:V.description,category:V.category,width:120,height:120}),o()},lt=h.filter(V=>{const C=!S||V.name.toLowerCase().includes(S.toLowerCase())||V.description.toLowerCase().includes(S.toLowerCase()),I=A==="All"||V.category===A;return C&&I});return s?e.jsx("div",{className:"embroidery-modal-overlay",onClick:o,children:e.jsxs("div",{className:"embroidery-modal-content",onClick:V=>V.stopPropagation(),ref:K,children:[e.jsxs("div",{className:"embroidery-modal-header",children:[e.jsx("h3",{children:"Choose an Embroidery Design"}),e.jsx("button",{className:"embroidery-modal-close",onClick:o,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"embroidery-modal-controls",children:[e.jsx("div",{className:"search-container",children:e.jsx("input",{type:"text",placeholder:"Search embroidery designs...",value:S,onChange:V=>W(V.target.value),className:"embroidery-search"})}),e.jsxs("div",{className:"category-filter",children:[e.jsx("label",{children:"Category:"}),e.jsx("select",{value:A,onChange:V=>_(V.target.value),className:"category-select",children:q.map(V=>e.jsx("option",{value:V,children:V},V))})]})]}),e.jsxs("div",{className:"embroidery-modal-body",children:[k&&e.jsxs("div",{className:"embroidery-loading",children:[e.jsx("div",{className:"loading-spinner"}),e.jsx("p",{children:"Loading embroidery designs..."})]}),N&&e.jsx("div",{className:"embroidery-error",children:e.jsx("p",{children:N})}),!k&&!N&&e.jsx("div",{className:"embroidery-grid",children:lt.map(V=>e.jsxs("div",{className:"embroidery-item",onClick:()=>D(V),title:V.description,children:[e.jsx("div",{className:"embroidery-preview",children:e.jsx("img",{src:V.url,alt:V.name,loading:"lazy",onError:C=>{console.error("Failed to load embroidery image:",V.url),C.target.style.display="none"}})}),e.jsxs("div",{className:"embroidery-info",children:[e.jsx("div",{className:"embroidery-name",children:V.name}),e.jsx("div",{className:"embroidery-category",children:V.category})]})]},V.id))}),!k&&!N&&lt.length===0&&e.jsx("div",{className:"no-embroideries",children:e.jsx("p",{children:"No embroidery designs found matching your search."})})]}),e.jsx("div",{className:"embroidery-modal-footer",children:e.jsxs("div",{className:"embroidery-disclaimer",children:[e.jsx("span",{className:"disclaimer-icon",children:"ℹ️"}),e.jsx("span",{children:"Sample embroidery designs for preview. Actual embroidered results may vary based on fabric and thread."})]})})]})}):null},Na=(s,o,r,n)=>`<text x="90" y="${66+1.3}" text-anchor="middle" font-family="${r}" font-weight="700" font-size="${o}" fill="rgba(0,0,0,0.4)">${s}</text><text x="90" y="${66-.8}" text-anchor="middle" font-family="${r}" font-weight="700" font-size="${o}" fill="rgba(255,255,255,0.22)">${s}</text><text x="90" y="66" text-anchor="middle" font-family="${r}" font-weight="700" font-size="${o}" fill="${n}">${s}</text>`,za=(s,o,r,n,l)=>{const d=`<svg xmlns="http://www.w3.org/2000/svg" width="180" height="120" viewBox="0 0 180 120"><defs><linearGradient id="c" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="${l[0]}"/><stop offset="1" stop-color="${l[1]}"/></linearGradient></defs><rect x="6" y="6" width="168" height="108" rx="14" fill="url(#c)"/><rect x="14" y="14" width="152" height="92" rx="9" fill="none" stroke="rgba(0,0,0,0.25)" stroke-width="2"/><rect x="14.5" y="14.5" width="151" height="91" rx="9" fill="none" stroke="rgba(255,255,255,0.25)" stroke-width="1"/>`+Na(s,o,r,n)+"</svg>";return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(d)}`};let po=0;const Ot=(s,o,r,{text:n,font:l,sysFont:d,ink:h,card:w,size:k=40,weight:T=700,style:N="normal",previewSize:z=30})=>(po+=1,{id:po,name:s,category:o,description:r,url:za(n,z,d,h,w),add:{text:n,fontFamily:l,fontSize:k,fontWeight:T,fontStyle:N,fill:h,textAlign:"center",width:300,height:90}}),yo=["#b07e4f","#7d4f28"],Xe=["#f3e6cf","#e3cda6"],Mi=["#dfe4ea","#9aa4b1"],Ai=["#3a4651","#222a31"],Ta=[Ot("Welcome","Signage","Bold welcome sign",{text:"WELCOME",font:"Bebas Neue",sysFont:"Impact, sans-serif",ink:"#3a2a1a",card:Xe,size:46,previewSize:34}),Ot("Open","Signage","Shop open sign",{text:"OPEN",font:"Anton",sysFont:"Impact, sans-serif",ink:"#7a3b12",card:yo,size:54,previewSize:40}),Ot("Café","Signage","Café script sign",{text:"Café",font:"Pacifico",sysFont:'"Brush Script MT", cursive',ink:"#f5f5f5",card:Ai,size:50,previewSize:38}),Ot("Gather","Signage","Gather sign",{text:"gather",font:"Playfair Display",sysFont:"Georgia, serif",ink:"#2e2a26",card:Xe,size:46,style:"italic",previewSize:36}),Ot("Family Name","Home","Family name plaque",{text:"The Smiths",font:"Great Vibes",sysFont:'"Brush Script MT", cursive',ink:"#3a2a1a",card:yo,size:48,previewSize:30}),Ot("Home Sweet Home","Home","Home sweet home",{text:"Home Sweet Home",font:"Dancing Script",sysFont:'"Brush Script MT", cursive',ink:"#3a2a1a",card:Xe,size:40,previewSize:22}),Ot("House Number","Home","House number",{text:"123",font:"Alfa Slab One",sysFont:"Georgia, serif",ink:"#2b3036",card:Mi,size:64,previewSize:48}),Ot("Address","Home","Street address",{text:"21 OAK STREET",font:"Oswald",sysFont:"Arial, sans-serif",ink:"#f5f5f5",card:Ai,size:34,previewSize:18}),Ot("Mr & Mrs","Wedding","Wedding sign",{text:"Mr & Mrs",font:"Great Vibes",sysFont:'"Brush Script MT", cursive',ink:"#3a2a1a",card:Xe,size:52,previewSize:34}),Ot("Joy","Celebrations","Holiday joy",{text:"Joy",font:"Sacramento",sysFont:'"Brush Script MT", cursive',ink:"#f5f5f5",card:Ai,size:60,previewSize:46}),Ot("Established","Celebrations","Established year",{text:"EST. 2024",font:"Staatliches",sysFont:"Impact, sans-serif",ink:"#2b3036",card:Mi,size:44,previewSize:30}),Ot("Office","Business","Office name plate",{text:"OFFICE",font:"Oswald",sysFont:"Arial, sans-serif",ink:"#2b3036",card:Mi,size:40,previewSize:30})],Ma=({isOpen:s,onClose:o,onAddHandcraft:r,theme:n})=>{const[l,d]=g.useState([]),[h,w]=g.useState(""),[k,T]=g.useState("All"),N=g.useRef(null),z=["All","Signage","Business","Home","Wedding","Celebrations"];g.useEffect(()=>{s&&d(Ta)},[s]);const S=A=>{r({...A.add}),o()},W=l.filter(A=>{const _=!h||A.name.toLowerCase().includes(h.toLowerCase())||A.description.toLowerCase().includes(h.toLowerCase()),K=k==="All"||A.category===k;return _&&K});return s?e.jsx("div",{className:"embroidery-modal-overlay",onClick:o,children:e.jsxs("div",{className:"embroidery-modal-content",onClick:A=>A.stopPropagation(),ref:N,children:[e.jsxs("div",{className:"embroidery-modal-header",children:[e.jsx("h3",{children:"Choose a Signage Template"}),e.jsx("button",{className:"embroidery-modal-close",onClick:o,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"embroidery-modal-controls",children:[e.jsx("div",{className:"search-container",children:e.jsx("input",{type:"text",placeholder:"Search signage & handcraft templates...",value:h,onChange:A=>w(A.target.value),className:"embroidery-search"})}),e.jsxs("div",{className:"category-filter",children:[e.jsx("label",{children:"Category:"}),e.jsx("select",{value:k,onChange:A=>T(A.target.value),className:"category-select",children:z.map(A=>e.jsx("option",{value:A,children:A},A))})]})]}),e.jsxs("div",{className:"embroidery-modal-body",children:[e.jsx("div",{className:"embroidery-grid",children:W.map(A=>e.jsxs("div",{className:"embroidery-item",onClick:()=>S(A),title:A.description,children:[e.jsx("div",{className:"embroidery-preview",children:e.jsx("img",{src:A.url,alt:A.name,loading:"lazy"})}),e.jsxs("div",{className:"embroidery-info",children:[e.jsx("div",{className:"embroidery-name",children:A.name}),e.jsx("div",{className:"embroidery-category",children:A.category})]})]},A.id))}),W.length===0&&e.jsx("div",{className:"no-embroideries",children:e.jsx("p",{children:"No templates found matching your search."})})]}),e.jsx("div",{className:"embroidery-modal-footer",children:e.jsxs("div",{className:"embroidery-disclaimer",children:[e.jsx("span",{className:"disclaimer-icon",children:"ℹ️"}),e.jsx("span",{children:"Sample signage templates — add one, then edit the text and resize it. Final engraving/finish may vary by material."})]})})]})}):null},Aa=({isOpen:s,onClose:o,onAddText:r,theme:n})=>{const[l,d]=g.useState(""),[h,w]=g.useState("All");g.useEffect(()=>{if(!s)return;const S=Array.from(new Set(de.map(W=>W.fontFamily).filter(Boolean)));Je(S)},[s]);const k=g.useMemo(()=>{const S=de.reduce((W,A)=>(W[A.category]=(W[A.category]||0)+1,W),{});return[{name:"All",count:de.length},...Object.entries(S).map(([W,A])=>({name:W,count:A}))]},[de]),T=g.useMemo(()=>de.filter(S=>{const W=!l||S.text.toLowerCase().includes(l.toLowerCase())||S.category.toLowerCase().includes(l.toLowerCase()),A=h==="All"||S.category===h;return W&&A}),[de,l,h]),N=S=>{const W={...S};r("text",W),o()},z=()=>{r("text",{text:"Your Text Here",fontSize:24,fontFamily:"Arial",fill:"#000000"}),o()};return s?e.jsx("div",{className:"text-templates-modal-overlay",onClick:o,children:e.jsxs("div",{className:"text-templates-modal",onClick:S=>S.stopPropagation(),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h2",{children:"Text Templates"}),e.jsx("button",{className:"close-btn",onClick:o,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"modal-controls",children:[e.jsx("div",{className:"search-section",children:e.jsx("input",{type:"text",placeholder:"Search templates...",value:l,onChange:S=>d(S.target.value),className:"search-input"})}),e.jsx("div",{className:"category-tabs",children:k.map(S=>e.jsxs("button",{className:`category-tab ${h===S.name?"active":""}`,onClick:()=>w(S.name),children:[S.name,e.jsxs("span",{className:"count",children:["(",S.count,")"]})]},S.name))})]}),e.jsxs("div",{className:"templates-grid",children:[e.jsx("div",{className:"custom-text-option",onClick:z,children:e.jsxs("div",{className:"custom-text-preview",children:[e.jsx("div",{className:"custom-icon",children:"✏️"}),e.jsx("div",{className:"custom-label",children:"Create Custom Text"})]})}),T.map(S=>e.jsxs("div",{className:"template-item",onClick:()=>N(S),children:[e.jsx("div",{className:"template-preview",style:{fontFamily:S.fontFamily,fontSize:`${Math.min(S.fontSize*.6,18)}px`,fontWeight:S.fontWeight,fontStyle:S.fontStyle,color:S.fill,backgroundColor:S.hasBackground?S.backgroundColor:"transparent",textAlign:S.textAlign||"left",textTransform:S.textTransform||"none",letterSpacing:S.letterSpacing?`${S.letterSpacing}px`:"normal",textShadow:S.hasTextShadow?`${S.textShadowX}px ${S.textShadowY}px ${S.textShadowBlur}px ${S.textShadowColor}`:"none"},children:S.text}),e.jsxs("div",{className:"template-info",children:[e.jsx("span",{className:"template-category",children:S.category}),e.jsx("span",{className:"template-font",children:S.fontFamily})]})]},S.id))]}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"results-count",children:[T.length," template",T.length!==1?"s":""," found"]})})]})}):null},Ea=({isOpen:s,onClose:o,onAddImage:r,theme:n,apiKey:l,apiEndpoint:d,aiEndpoint:h,onAIImageGenerate:w,outOfCredits:k=!1,onAddAiCredits:T})=>{const[N,z]=g.useState(""),[S,W]=g.useState(null),[A,_]=g.useState(!1),[K,q]=g.useState(null),[D,lt]=g.useState(null),V=g.useRef(null);if(g.useEffect(()=>{s&&(lt(null),_(!1))},[s]),!s)return null;const C=(n==null?void 0:n.primaryColor)||"#4c5bf2",I=!A&&!k&&(N.trim().length>0||!!S),$=Z=>{var at;const it=(at=Z.target.files)==null?void 0:at[0];if(!it||!it.type.startsWith("image/"))return;const st=new FileReader;st.onload=F=>W({dataUrl:F.target.result,name:it.name}),st.onerror=()=>lt("Could not read that image. Please try another file."),st.readAsDataURL(it),Z.target.value=""},v=()=>W(null),ot=Z=>{const it=Z&&typeof Z=="object"&&"object"in Z?Z.object:Z;return it?typeof it=="string"?it:it.imageUrl||it.url||it.image||(it.imageBase64?`data:image/png;base64,${it.imageBase64}`:null):null},ct=async()=>{var Z,it;lt(null),_(!0),q(null);try{const st={prompt:N.trim(),imageDataUrl:(S==null?void 0:S.dataUrl)||null};let at=null;if(typeof w=="function"){const F=await w(st);at=typeof F=="string"?F:ot(F)}else{const F=h||(d?`${d}/api/v1/designer`:"");if(!F)throw new Error("AI image generation is not configured.");const M=await Di.post(`${F}/generate-image`,{prompt:st.prompt,image:st.imageDataUrl,apiKey:l});at=ot(M.data)}if(!at)throw new Error("No image was returned. Please try a different prompt.");q(at)}catch(st){console.error("AI image generation failed:",st),lt(((it=(Z=st==null?void 0:st.response)==null?void 0:Z.data)==null?void 0:it.message)||(st==null?void 0:st.message)||"Image generation failed. Please try again.")}finally{_(!1)}},ut=()=>{if(!K)return;const Z=new Image;Z.crossOrigin="anonymous",Z.onload=()=>{const st=Z.naturalWidth||512,at=Z.naturalHeight||512,F=Math.min(1,250/Math.max(st,at));r({imageData:Z,src:K,width:Math.round(st*F),height:Math.round(at*F),originalWidth:st,originalHeight:at}),o()},Z.onerror=()=>lt("The generated image could not be loaded onto the canvas."),Z.src=K},U=()=>{q(null),lt(null)};return e.jsx("div",{className:"ai-modal-overlay",onClick:o,children:e.jsxs("div",{className:"ai-modal-content",onClick:Z=>Z.stopPropagation(),children:[e.jsxs("div",{className:"ai-modal-header",children:[e.jsx("h3",{children:"✨ AI Image Generator"}),e.jsx("button",{className:"ai-modal-close",onClick:o,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"ai-modal-body",children:[!K&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"ai-intro",children:["Generate ",e.jsx("strong",{children:"artwork, images, logos, icons, patterns"})," and much more — from a description, your own image, or both."]}),e.jsx("label",{className:"ai-field-label",htmlFor:"ai-prompt",children:"Describe what you want to create"}),e.jsx("textarea",{id:"ai-prompt",className:"ai-prompt",rows:4,placeholder:"e.g. a minimalist mountain logo · a bold retro sunset · a cute cartoon cat mascot · a seamless floral pattern",value:N,onChange:Z=>z(Z.target.value)}),e.jsxs("div",{className:"ai-ref-section",children:[e.jsx("span",{className:"ai-field-label",children:"Reference image (optional)"}),S?e.jsxs("div",{className:"ai-ref-preview",children:[e.jsx("img",{src:S.dataUrl,alt:S.name}),e.jsxs("div",{className:"ai-ref-meta",children:[e.jsx("span",{className:"ai-ref-name",children:S.name}),e.jsx("button",{type:"button",className:"ai-ref-remove",onClick:v,children:"Remove"})]})]}):e.jsx("button",{type:"button",className:"ai-upload-btn",onClick:()=>{var Z;return(Z=V.current)==null?void 0:Z.click()},children:"+ Upload an image to transform"}),e.jsx("input",{ref:V,type:"file",accept:"image/*",style:{display:"none"},onChange:$})]}),e.jsx("p",{className:"ai-hint",children:S?N.trim()?"Your image will be transformed using your description.":"Add a description to guide how your image is transformed.":"Describe an image to create one from scratch, or upload a reference to transform."}),k&&e.jsxs("div",{className:"ai-credits-notice",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap",margin:"4px 0 12px",padding:"10px 12px",borderRadius:8,background:"#fff7ed",border:"1px solid #fed7aa",color:"#9a3412",fontSize:13},children:[e.jsx("span",{children:"You don't have enough AI credits to generate an image."}),T&&e.jsx("button",{type:"button",onClick:()=>T(),style:{flexShrink:0,cursor:"pointer",border:"none",borderRadius:6,padding:"6px 12px",fontWeight:700,fontSize:13,color:"#fff",background:C},children:"Add AI credits"})]}),D&&e.jsx("div",{className:"ai-error",children:D}),e.jsx("button",{type:"button",className:"ai-generate-btn",style:{backgroundColor:C,opacity:I?1:.6},disabled:!I,onClick:ct,children:A?e.jsxs("span",{className:"ai-generating",children:[e.jsx("span",{className:"ai-spinner"})," Generating…"]}):"Generate image"})]}),K&&e.jsxs("div",{className:"ai-result",children:[e.jsx("div",{className:"ai-result-preview",children:e.jsx("img",{src:K,alt:"AI generated result"})}),D&&e.jsx("div",{className:"ai-error",children:D}),e.jsxs("div",{className:"ai-result-actions",children:[e.jsx("button",{type:"button",className:"ai-secondary-btn",onClick:U,children:"Start over"}),e.jsx("button",{type:"button",className:"ai-secondary-btn",onClick:ct,disabled:A,children:A?"Regenerating…":"Regenerate"}),e.jsx("button",{type:"button",className:"ai-generate-btn",style:{backgroundColor:C},onClick:ut,children:"Add to design"})]})]})]})]})})},Ia=[246,245,248,239,247,251],xo=Ia.map(s=>de.find(o=>o.id===s)).filter(Boolean),La=({onAddElement:s,onDeleteElement:o,onDuplicateElement:r,onUndo:n,onRedo:l,onToggleGrid:d,onToggleRulers:h,onToggleSnap:w,onTogglePrintGuides:k,onImageUpload:T,canUndo:N,canRedo:z,showGrid:S,showRulers:W,snapToGrid:A,showPrintGuides:_,selectedElement:K,theme:q,readOnly:D,mode:lt="customize",productionMethods:V,supportsEmbroidery:C,apiKey:I,apiEndpoint:$,aiEnabled:v=!0,aiEndpoint:ot,onAIImageGenerate:ct,aiCreditsRemaining:ut=null,onAddAiCredits:U,isAuthenticated:Z=!0,onRequireAuth:it,onRequestCollaboration:st,onOpenUploads:at})=>{const F=lt==="customize",M=typeof ut=="number"&&ut<=0,m=(V||[]).some(O=>String(O).toUpperCase()==="EMBROIDERY")||C==="Y",R=(V||[]).some(O=>String(O).toUpperCase()==="HANDCRAFTED"),[G,gt]=g.useState(!1),[wt,kt]=g.useState(!1),[Dt,At]=g.useState(!1),[B,Ht]=g.useState(!1),[X,he]=g.useState(!1),[mt,Zt]=g.useState(!1),[$t,fe]=g.useState(!1),[_t,ve]=g.useState(!1),[Ut,ae]=g.useState(!1),[Vt,re]=g.useState(!1),we=g.useRef(null),ke=g.useRef(null);g.useEffect(()=>{const O=Bt=>{we.current&&!we.current.contains(Bt.target)&&ae(!1),ke.current&&!ke.current.contains(Bt.target)&&re(!1)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);const[ue,oi]=g.useState(!1);g.useEffect(()=>{Z&&_t&&(fe(!0),ve(!1))},[Z,_t]);const Mt=O=>{const Bt=O.target.files[0];Bt&&Bt.type.startsWith("image/")&&T(Bt),O.target.value=""},ge=O=>{s("icon",{iconData:O,text:O.symbol,fontSize:48,fontFamily:"Arial",fill:"#000000"})},Q=O=>{s("qrcode",O)},Pe=O=>{s("barcode",O)},Jt=O=>{s("sticker",O)},ai=O=>{s("embroidery",O)},ri=O=>{s("text",O)},je=(O,Bt)=>{s(O,Bt)},Xt=O=>{s("image",O)},me=()=>{ae(!Ut),re(!1)},Wt=()=>{re(!Vt),ae(!1)},Ce=O=>{O==="custom"?s("text"):O==="templates"&&Zt(!0),ae(!1)};g.useEffect(()=>{$i(xo.map(O=>O.fontFamily).filter(Boolean))},[]);const Et=O=>{s("text",{...O}),ae(!1)},Tt=O=>{s(O),re(!1)},ht="#475569",Nt=e.jsxs("div",{className:"toolbar-dropdown",ref:ke,children:[e.jsxs("button",{className:"toolbar-btn compact dropdown-trigger",disabled:D,onClick:Wt,title:"Add a shape — rectangle, circle, star and more",children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"shapes",size:18,color:D?"#94a3b8":ht})}),e.jsx("span",{className:"label",children:"Shapes"})]}),e.jsxs("div",{className:`dropdown-menu ${Vt?"show":""}`,children:[e.jsxs("button",{onClick:()=>Tt("rectangle"),children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"rectangle",size:16,color:ht})})," Rectangle"]}),e.jsxs("button",{onClick:()=>Tt("circle"),children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"circle",size:16,color:ht})})," Circle"]}),e.jsxs("button",{onClick:()=>Tt("triangle"),children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"triangle",size:16,color:ht})})," Triangle"]}),e.jsxs("button",{onClick:()=>Tt("star"),children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"star",size:16,color:ht})})," Star"]}),e.jsxs("button",{onClick:()=>Tt("heart"),children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"heart",size:16,color:ht})})," Heart"]}),e.jsxs("button",{onClick:()=>Tt("arrow"),children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"arrowShape",size:16,color:ht})})," Arrow"]}),e.jsxs("button",{onClick:()=>Tt("diamond"),children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"diamond",size:16,color:ht})})," Diamond"]}),e.jsxs("button",{onClick:()=>Tt("hexagon"),children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"hexagon",size:16,color:ht})})," Hexagon"]}),e.jsxs("button",{onClick:()=>Tt("pentagon"),children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"pentagon",size:16,color:ht})})," Pentagon"]}),e.jsxs("button",{onClick:()=>Tt("oval"),children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"oval",size:16,color:ht})})," Oval"]}),e.jsxs("button",{onClick:()=>Tt("roundedRectangle"),children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"roundedRect",size:16,color:ht})})," Rounded Rectangle"]}),e.jsxs("button",{onClick:()=>Tt("horizontalLine"),children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"horizontalLine",size:16,color:ht})})," Horizontal Line"]})]})]}),Oe=e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>gt(!0),disabled:D,title:"Add QR Code",children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"qrcode",size:18,color:D?"#94a3b8":ht})}),e.jsx("span",{className:"label",children:"QR Code"})]}),e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>kt(!0),disabled:D,title:"Add Barcode",children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"barcode",size:18,color:D?"#94a3b8":ht})}),e.jsx("span",{className:"label",children:"Barcode"})]})]}),pe=e.jsxs("div",{className:"toolbar-view-control",role:"group","aria-label":"View options",children:[e.jsx("span",{className:"toolbar-view-label",children:"View"}),e.jsxs("div",{className:"toolbar-view-segments",children:[e.jsxs("button",{className:`toolbar-btn compact ${S?"active":""}`,onClick:d,"aria-pressed":S,title:"Toggle Grid",children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"grid",size:18,color:S?"#ffffff":ht})}),e.jsx("span",{className:"label",children:"Grid"})]}),e.jsxs("button",{className:`toolbar-btn compact ${W?"active":""}`,onClick:h,"aria-pressed":W,title:"Toggle Rulers",children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"ruler",size:18,color:W?"#ffffff":ht})}),e.jsx("span",{className:"label",children:"Rulers"})]}),e.jsxs("button",{className:`toolbar-btn compact ${A?"active":""}`,onClick:w,"aria-pressed":A,title:"Snap to Grid",children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"magnet",size:18,color:A?"#ffffff":ht})}),e.jsx("span",{className:"label",children:"Snap"})]}),e.jsxs("button",{className:`toolbar-btn compact ${_?"active":""}`,onClick:k,"aria-pressed":_,title:"Toggle print area & safe-zone guides",children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"rectangle",size:18,color:_?"#ffffff":ht})}),e.jsx("span",{className:"label",children:"Print area"})]})]})]});return e.jsxs("div",{className:"toolbar",children:[e.jsxs("div",{className:"toolbar-section",children:[e.jsxs("div",{className:"toolbar-group",children:[e.jsxs("button",{className:"toolbar-btn compact",onClick:n,disabled:!N||D,title:"Undo (Ctrl+Z)",children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"undo",size:18,color:!N||D?"#94a3b8":ht})}),e.jsx("span",{className:"label",children:"Undo"})]}),e.jsxs("button",{className:"toolbar-btn compact",onClick:l,disabled:!z||D,title:"Redo (Ctrl+Y)",children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"redo",size:18,color:!z||D?"#94a3b8":ht})}),e.jsx("span",{className:"label",children:"Redo"})]})]}),e.jsx("div",{className:"toolbar-separator"}),v&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-group",children:e.jsxs("button",{className:"toolbar-btn compact ai-btn",onClick:()=>{if(!Z){ve(!0),it&&it();return}fe(!0)},disabled:D,title:M?"You're out of AI credits — add credits to generate images":"AI: generate artwork, images, logos, icons and much more",style:{color:D?"#94a3b8":"#6d28d9",background:D?void 0:"linear-gradient(135deg, #ede9fe, #f5f3ff)"},children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"sparkle",size:18,color:D?"#94a3b8":"#7c3aed"})}),e.jsx("span",{className:"label",children:"AI Image"})]})}),e.jsx("div",{className:"toolbar-separator"})]}),st&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-group",children:e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>st(),disabled:D,title:"Request collaboration: work on this design together with the seller before you order",children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"share",size:18,color:D?"#94a3b8":"#0f766e"})}),e.jsx("span",{className:"label",children:"Collaborate"})]})}),e.jsx("div",{className:"toolbar-separator"})]}),e.jsxs("div",{className:"toolbar-group",children:[e.jsxs("div",{className:"toolbar-dropdown",ref:we,children:[e.jsxs("button",{className:"toolbar-btn compact dropdown-trigger",disabled:D,title:"Add Text",onClick:me,children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"text",size:18,color:D?"#94a3b8":ht})}),e.jsx("span",{className:"label",children:"Text"})]}),e.jsxs("div",{className:`dropdown-menu text-design-menu ${Ut?"show":""}`,style:{minWidth:240},children:[e.jsxs("button",{onClick:()=>Ce("custom"),children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"text",size:16,color:ht})})," Custom text"]}),e.jsx("div",{style:{padding:"6px 10px 2px",fontSize:11,fontWeight:700,color:"#94a3b8",textTransform:"uppercase",letterSpacing:.5},children:"Design ideas"}),xo.map(O=>e.jsx("button",{onClick:()=>Et(O),title:`Add "${O.text}"`,style:{justifyContent:"flex-start"},children:e.jsx("span",{style:{fontFamily:`'${O.fontFamily}', cursive`,fontWeight:O.fontWeight||"normal",fontStyle:O.fontStyle||"normal",color:O.fill||"#111827",fontSize:18,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textTransform:O.textTransform||"none"},children:O.text})},O.id)),e.jsxs("button",{onClick:()=>Ce("templates"),style:{borderTop:"1px solid #e2e8f0",marginTop:4,color:"#2563eb",fontWeight:600},children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"book",size:16,color:"#2563eb"})})," More designs…"]})]})]}),!F&&Nt,e.jsx("div",{className:"toolbar-separator"}),at?e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>at(),disabled:D,title:"Upload — add a new image from your device or re-use one you've uploaded before",children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"cloudUpload",size:18,color:D?"#94a3b8":ht})}),e.jsx("span",{className:"label",children:"Upload"})]}):e.jsxs("label",{className:"toolbar-btn compact file-upload",title:"Upload your own image",style:{cursor:D?"not-allowed":"pointer"},children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"upload",size:18,color:D?"#94a3b8":ht})}),e.jsx("span",{className:"label",children:"Upload"}),e.jsx("input",{type:"file",accept:"image/*",onChange:Mt,disabled:D})]}),e.jsx("div",{className:"toolbar-separator"}),e.jsx(ba,{onSelectIcon:ge,theme:q,disabled:D}),e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>At(!0),disabled:D,title:"Add Sticker",children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"sticker",size:18,color:D?"#94a3b8":ht})}),e.jsx("span",{className:"label",children:"Stickers"})]}),!F&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-separator"}),Oe]})]}),m&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-separator"}),e.jsx("div",{className:"toolbar-group embroidery-group",children:e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>Ht(!0),disabled:D,title:"Add Embroidery Design",children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"thread",size:18,color:D?"#94a3b8":ht})}),e.jsx("span",{className:"label",children:"Embroidery"})]})})]}),R&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-separator"}),e.jsx("div",{className:"toolbar-group handcraft-group",children:e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>he(!0),disabled:D,title:"Add a signage / handcraft template",children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"briefcase",size:18,color:D?"#94a3b8":ht})}),e.jsx("span",{className:"label",children:"Signage"})]})})]}),!F&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-separator"}),e.jsx("div",{className:"toolbar-group",children:pe})]}),F&&e.jsxs("div",{className:"toolbar-group",style:{marginLeft:"auto"},children:[ue&&e.jsxs(e.Fragment,{children:[Nt,e.jsx("div",{className:"toolbar-separator"}),Oe,e.jsx("div",{className:"toolbar-separator"}),pe,e.jsx("div",{className:"toolbar-separator"})]}),e.jsxs("button",{type:"button",className:`toolbar-btn compact ${ue?"active":""}`,onClick:()=>oi(O=>!O),title:"Advanced tools — shapes, QR code, barcode, grid, rulers, snap & print area",children:[e.jsx("span",{className:"icon",children:e.jsx(tt,{name:"gear",size:18,color:ue?"#ffffff":ht})}),e.jsx("span",{className:"label",children:"Advanced"})]})]})]}),e.jsx(Sa,{isOpen:G,onClose:()=>gt(!1),onAddQRCode:Q,theme:q}),e.jsx(va,{isOpen:wt,onClose:()=>kt(!1),onAddBarcode:Pe,theme:q}),e.jsx(ka,{isOpen:Dt,onClose:()=>At(!1),onAddSticker:Jt,theme:q,apiKey:I,apiEndpoint:$}),e.jsx(Fa,{isOpen:B,onClose:()=>Ht(!1),onAddEmbroidery:ai,theme:q,apiKey:I,apiEndpoint:$}),e.jsx(Ma,{isOpen:X,onClose:()=>he(!1),onAddHandcraft:ri,theme:q}),e.jsx(Aa,{isOpen:mt,onClose:()=>Zt(!1),onAddText:je,theme:q}),v&&e.jsx(Ea,{isOpen:$t,onClose:()=>fe(!1),onAddImage:Xt,theme:q,apiKey:I,apiEndpoint:$,aiEndpoint:ot,onAIImageGenerate:ct,outOfCredits:M,onAddAiCredits:U})]})},Da=({value:s="Arial",onChange:o=()=>{},onFontLoaded:r=()=>{}})=>{const[n,l]=g.useState(!1),[d,h]=g.useState(""),w=g.useRef(null);g.useEffect(()=>{n&&Je(So)},[n]),g.useEffect(()=>{if(!n)return;const N=S=>{w.current&&!w.current.contains(S.target)&&l(!1)},z=S=>{S.key==="Escape"&&l(!1)};return document.addEventListener("mousedown",N),document.addEventListener("keydown",z),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",z)}},[n]);const k=g.useMemo(()=>{const N=d.trim().toLowerCase();return N?Ri.map(z=>({...z,fonts:z.fonts.filter(S=>S.toLowerCase().includes(N))})).filter(z=>z.fonts.length>0):Ri},[d]),T=async N=>{o(N),l(!1),h(""),await vo(N),r()};return e.jsxs("div",{ref:w,style:{position:"relative",width:"100%"},children:[e.jsxs("button",{type:"button",onClick:()=>l(N=>!N),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 10px",border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",cursor:"pointer",fontSize:14},title:"Choose a font",children:[e.jsx("span",{style:{fontFamily:`"${s}"`,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s}),e.jsx("span",{style:{color:"#64748b",fontSize:12},children:"▾"})]}),n&&e.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:1e3,background:"#fff",border:"1px solid #cbd5e1",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.15)",maxHeight:320,display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsx("input",{autoFocus:!0,value:d,onChange:N=>h(N.target.value),placeholder:"Search fonts…",style:{margin:8,padding:"6px 8px",border:"1px solid #e2e8f0",borderRadius:6,fontSize:13,outline:"none"}}),e.jsxs("div",{style:{overflowY:"auto",padding:"0 4px 6px"},children:[k.map(N=>e.jsxs("div",{children:[e.jsx("div",{style:{position:"sticky",top:0,background:"#f8fafc",color:"#64748b",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.04em",padding:"6px 8px"},children:N.name}),N.fonts.map(z=>e.jsx("button",{type:"button",onMouseEnter:()=>Je([z]),onClick:()=>T(z),style:{width:"100%",textAlign:"left",padding:"8px 10px",border:"none",borderRadius:6,cursor:"pointer",fontSize:16,fontFamily:`"${z}"`,background:z===s?"#eff6ff":"transparent",color:z===s?"#1d4ed8":"#0f172a"},children:z},z))]},N.name)),k.length===0&&e.jsxs("div",{style:{padding:12,color:"#94a3b8",fontSize:13},children:["No fonts match “",d,"”."]})]})]})]})},Ze=[{name:"White",hex:"#FFFFFF"},{name:"Ecru",hex:"#F3EAD3"},{name:"Cream",hex:"#F7E9C3"},{name:"Silver",hex:"#C8CDD2"},{name:"Light Grey",hex:"#9AA0A6"},{name:"Steel Grey",hex:"#5F676E"},{name:"Charcoal",hex:"#33373B"},{name:"Black",hex:"#101113"},{name:"Pale Pink",hex:"#F6C5D3"},{name:"Rose",hex:"#E8638C"},{name:"Fuchsia",hex:"#D81B7A"},{name:"Red",hex:"#D11F2D"},{name:"Crimson",hex:"#9E1B2F"},{name:"Burgundy",hex:"#6E1F2C"},{name:"Peach",hex:"#F6A98C"},{name:"Orange",hex:"#F26A21"},{name:"Pumpkin",hex:"#D2541E"},{name:"Gold",hex:"#E8A317"},{name:"Yellow",hex:"#F4C500"},{name:"Lemon",hex:"#F2E54B"},{name:"Lime",hex:"#9BCB3C"},{name:"Kelly Green",hex:"#2E9E45"},{name:"Green",hex:"#1F7A3D"},{name:"Forest",hex:"#14532D"},{name:"Teal",hex:"#0E8C8C"},{name:"Mint",hex:"#9FE0C4"},{name:"Sky Blue",hex:"#5BB6E8"},{name:"Blue",hex:"#1C76C5"},{name:"Royal Blue",hex:"#1E40AF"},{name:"Navy",hex:"#16244C"},{name:"Turquoise",hex:"#22B5C9"},{name:"Lavender",hex:"#B9A6E0"},{name:"Purple",hex:"#7A3CB0"},{name:"Plum",hex:"#5B2A6B"},{name:"Tan",hex:"#C8A06A"},{name:"Brown",hex:"#7A4A26"},{name:"Coffee",hex:"#4A2F1C"},{name:"Gold Metallic",hex:"#C8A53B"},{name:"Silver Metallic",hex:"#B6BCC4"}];function Bi(s){if(!s)return null;let o=String(s).trim().replace("#","");if(o.length===3&&(o=o.split("").map(n=>n+n).join("")),o.length!==6)return null;const r=parseInt(o,16);return Number.isNaN(r)?null:{r:r>>16&255,g:r>>8&255,b:r&255}}function Ra(s,o){const r=(s.r+o.r)/2,n=s.r-o.r,l=s.g-o.g,d=s.b-o.b;return(2+r/256)*n*n+4*l*l+(2+(255-r)/256)*d*d}function Wa(s){const o=Bi(s);if(!o)return Ze[0];let r=Ze[0],n=1/0;for(const l of Ze){const d=Bi(l.hex),h=Ra(o,d);h<n&&(n=h,r=l)}return r}function Ba(s){return Bi(s)?Wa(s).hex:s}const Ei={widthIn:12,dpi:300,safeAreaPct:5},Pa=6e3;function ii(s){const o=s||{};return{widthIn:Number(o.widthIn)>0?Number(o.widthIn):Ei.widthIn,dpi:Number(o.dpi)>0?Number(o.dpi):Ei.dpi,safeAreaPct:Number.isFinite(Number(o.safeAreaPct))?Math.min(40,Math.max(0,Number(o.safeAreaPct))):Ei.safeAreaPct}}function Oa(s,o,r){const{widthIn:n,dpi:l}=ii(r);if(!(s>0))return 1;let h=n*l/s;h=Math.max(1,h);const w=Math.max(s,o||s),k=Pa/w;return Math.min(h,Math.max(1,k))}function Pi(s,o){const{widthIn:r}=ii(o);return s>0?r/s:0}function ko(s,o,r){var w,k,T,N;if(!s||!["image","sticker"].includes(s.type))return null;const l=s.originalWidth||s.naturalWidth||((w=s.imageObject)==null?void 0:w.naturalWidth)||((k=s._imageElement)==null?void 0:k.naturalWidth)||((T=s._stickerElement)==null?void 0:T.naturalWidth)||((N=s.imageData)==null?void 0:N.naturalWidth)||0;if(!(l>0))return null;const d=s.width||0;if(!(d>0))return null;const h=d*Pi(o,r);return h>0?l/h:null}function jo(s,o){const{dpi:r}=ii(o);return s==null?null:s>=r?{level:"good",color:"#16a34a",label:"Print quality: Excellent"}:s>=r/2?{level:"warn",color:"#d97706",label:"Print quality: Acceptable — may look soft"}:{level:"bad",color:"#dc2626",label:"Print quality: Too low — will look blurry"}}const Qe=({checked:s,onChange:o,disabled:r=!1,title:n})=>e.jsxs("label",{className:"switch",title:n,children:[e.jsx("input",{type:"checkbox",checked:s,onChange:o,disabled:r}),e.jsx("span",{className:"switch-track"})]}),Ha=({selectedElement:s,selectedCount:o=0,onUpdate:r,onMoveLayer:n,onAlignSelection:l,onDistributeSelection:d,onDeleteSelection:h,availableFonts:w,theme:k,isEmbroidery:T=!1,onFontLoaded:N=()=>{},canvasWidth:z,canvasHeight:S,printConfig:W,onRemoveBackground:A})=>{const[_,K]=g.useState(!1),[q,D]=g.useState(!1),[lt,V]=g.useState("");if(o>1)return e.jsxs("div",{className:"properties-panel",children:[e.jsx("h3",{children:"Properties"}),e.jsxs("div",{className:"property-group",children:[e.jsxs("h4",{children:[o," elements selected"]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Align"}),e.jsxs("div",{className:"align-buttons",children:[e.jsx("button",{type:"button",title:"Align left",onClick:()=>l==null?void 0:l("left"),children:"⬅"}),e.jsx("button",{type:"button",title:"Center horizontally",onClick:()=>l==null?void 0:l("hcenter"),children:"⬌"}),e.jsx("button",{type:"button",title:"Align right",onClick:()=>l==null?void 0:l("right"),children:"➡"}),e.jsx("button",{type:"button",title:"Align top",onClick:()=>l==null?void 0:l("top"),children:"⬆"}),e.jsx("button",{type:"button",title:"Center vertically",onClick:()=>l==null?void 0:l("vcenter"),children:"⬍"}),e.jsx("button",{type:"button",title:"Align bottom",onClick:()=>l==null?void 0:l("bottom"),children:"⬇"})]})]}),o>2&&e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Distribute"}),e.jsxs("div",{className:"align-buttons",children:[e.jsx("button",{type:"button",title:"Distribute horizontally",onClick:()=>d==null?void 0:d("h"),children:"↔"}),e.jsx("button",{type:"button",title:"Distribute vertically",onClick:()=>d==null?void 0:d("v"),children:"↕"})]})]}),e.jsx("div",{className:"property-row",children:e.jsxs("button",{type:"button",className:"multi-delete-btn",onClick:()=>h==null?void 0:h(),children:["Delete ",o," elements"]})})]})]});if(!s)return e.jsxs("div",{className:"properties-panel",children:[e.jsx("h3",{children:"Properties"}),e.jsx("p",{className:"no-selection",children:"Select an element to edit its properties"})]});const C=(F,M)=>{r(s.id,{[F]:M})},I=()=>{var F,M,bt;return e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Text"}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Content"}),e.jsx("textarea",{value:s.text||"",onChange:m=>C("text",m.target.value),rows:3,placeholder:"Enter your text here..."})]}),e.jsx("div",{className:"subsection-label",children:"Typography"}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Font Family"}),e.jsx(Da,{value:s.fontFamily||"Arial",onChange:m=>C("fontFamily",m),onFontLoaded:N})]}),e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Font Size"}),e.jsx("input",{type:"number",value:s.fontSize||20,onChange:m=>C("fontSize",parseInt(m.target.value)),min:"8",max:"200"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Line Height"}),e.jsx("input",{type:"number",step:"0.1",value:s.lineHeight||1.2,onChange:m=>C("lineHeight",parseFloat(m.target.value)),min:"0.5",max:"3"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Letter Spacing"}),e.jsx("input",{type:"number",step:"0.5",value:s.letterSpacing||0,onChange:m=>C("letterSpacing",parseFloat(m.target.value)||0),min:"-5",max:"50"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Outline Width"}),e.jsx("input",{type:"number",step:"0.5",value:s.strokeWidth||0,onChange:m=>C("strokeWidth",parseFloat(m.target.value)||0),min:"0",max:"20"})]})]}),(s.strokeWidth||0)>0&&e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Outline Color"}),e.jsx("input",{type:"color",value:s.stroke||"#000000",onChange:m=>C("stroke",m.target.value)})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Curve"}),e.jsxs("div",{className:"slider-row",children:[e.jsx("input",{type:"range",min:"-180",max:"180",step:"1",value:s.curve||0,onChange:m=>C("curve",parseInt(m.target.value,10))}),e.jsxs("span",{className:"value-chip",children:[s.curve||0,"°"]}),e.jsx("button",{type:"button",className:"reset-btn",onClick:()=>C("curve",0),disabled:!s.curve,title:"Reset to straight","aria-label":"Reset curve to straight",children:"↺"})]})]}),e.jsx("div",{className:"subsection-label",children:"Style"}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Font Weight"}),e.jsxs("div",{className:"button-group",children:[e.jsx("button",{className:s.fontWeight==="lighter"||s.fontWeight==="300"?"active":"",onClick:()=>C("fontWeight","300"),title:"Light",children:"Light"}),e.jsx("button",{className:!s.fontWeight||s.fontWeight==="normal"||s.fontWeight==="400"?"active":"",onClick:()=>C("fontWeight","normal"),title:"Normal",children:"Normal"}),e.jsx("button",{className:s.fontWeight==="bold"||s.fontWeight==="700"?"active":"",onClick:()=>C("fontWeight","bold"),title:"Bold",children:e.jsx("strong",{children:"Bold"})})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Style"}),e.jsxs("div",{className:"button-group",children:[e.jsx("button",{className:s.fontStyle==="italic"?"active":"",onClick:()=>C("fontStyle",s.fontStyle==="italic"?"normal":"italic"),title:"Italic",children:e.jsx("em",{children:"I"})}),e.jsx("button",{className:(F=s.textDecoration)!=null&&F.includes("underline")?"active":"",onClick:()=>{const m=s.textDecoration||"",R=m.split(" ").filter(G=>G&&G!=="underline");m.includes("underline")||R.push("underline"),C("textDecoration",R.join(" ").trim())},title:"Underline",children:e.jsx("u",{children:"U"})}),e.jsx("button",{className:(M=s.textDecoration)!=null&&M.includes("overline")?"active":"",onClick:()=>{const m=s.textDecoration||"",R=m.split(" ").filter(G=>G&&G!=="overline");m.includes("overline")||R.push("overline"),C("textDecoration",R.join(" ").trim())},title:"Overline",children:e.jsx("span",{style:{textDecoration:"overline"},children:"O"})}),e.jsx("button",{className:(bt=s.textDecoration)!=null&&bt.includes("line-through")?"active":"",onClick:()=>{const m=s.textDecoration||"",R=m.split(" ").filter(G=>G&&G!=="line-through");m.includes("line-through")||R.push("line-through"),C("textDecoration",R.join(" ").trim())},title:"Strikethrough",children:e.jsx("s",{children:"S"})})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Transform"}),e.jsxs("div",{className:"button-group",children:[e.jsx("button",{className:!s.textTransform||s.textTransform==="none"?"active":"",onClick:()=>C("textTransform","none"),title:"Normal",children:"Aa"}),e.jsx("button",{className:s.textTransform==="uppercase"?"active":"",onClick:()=>C("textTransform","uppercase"),title:"Uppercase",children:"AA"}),e.jsx("button",{className:s.textTransform==="lowercase"?"active":"",onClick:()=>C("textTransform","lowercase"),title:"Lowercase",children:"aa"}),e.jsx("button",{className:s.textTransform==="capitalize"?"active":"",onClick:()=>C("textTransform","capitalize"),title:"Capitalize",children:"Aa"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Alignment"}),e.jsxs("div",{className:"button-group",children:[e.jsx("button",{className:!s.textAlign||s.textAlign==="left"?"active":"",onClick:()=>C("textAlign","left"),title:"Left Align",children:"⬅"}),e.jsx("button",{className:s.textAlign==="center"?"active":"",onClick:()=>C("textAlign","center"),title:"Center Align",children:"↔"}),e.jsx("button",{className:s.textAlign==="right"?"active":"",onClick:()=>C("textAlign","right"),title:"Right Align",children:"➡"}),e.jsx("button",{className:s.textAlign==="justify"?"active":"",onClick:()=>C("textAlign","justify"),title:"Justify",children:"≡"})]})]}),e.jsx("div",{className:"subsection-label",children:"Color"}),e.jsx("div",{className:"property-row",children:e.jsxs("div",{className:"color-input-group",children:[e.jsxs("div",{className:"color-input-item",children:[e.jsx("label",{children:T?"Thread Color":"Text Color"}),e.jsx("input",{type:"color",value:s.fill||"#000000",onChange:m=>C("fill",m.target.value)}),T&&e.jsx("div",{title:"Real thread colours",style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:6,maxWidth:200},children:Ze.map(m=>e.jsx("button",{type:"button",title:m.name,onClick:()=>C("fill",m.hex),style:{width:16,height:16,padding:0,borderRadius:"50%",background:m.hex,border:(s.fill||"").toLowerCase()===m.hex.toLowerCase()?"2px solid #2563eb":"1px solid #cbd5e1",cursor:"pointer"}},m.hex))})]}),e.jsxs("div",{className:"color-input-item",children:[e.jsx("label",{children:"Background"}),e.jsxs("div",{className:"color-with-toggle",children:[e.jsx(Qe,{checked:!!s.hasBackground,onChange:m=>C("hasBackground",m.target.checked),title:s.hasBackground?"Hide background":"Show background"}),e.jsx("input",{type:"color",value:s.backgroundColor||"#ffffff",onChange:m=>C("backgroundColor",m.target.value),disabled:!s.hasBackground})]})]})]})}),_&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Letter Spacing"}),e.jsx("input",{type:"number",step:"0.1",value:s.letterSpacing||0,onChange:m=>C("letterSpacing",parseFloat(m.target.value)),min:"-5",max:"10"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Word Spacing"}),e.jsx("input",{type:"number",step:"0.1",value:s.wordSpacing||0,onChange:m=>C("wordSpacing",parseFloat(m.target.value)),min:"-10",max:"20"})]})]}),e.jsx("div",{className:"property-row",children:e.jsxs("div",{className:"text-shadow-controls",children:[e.jsxs("div",{className:"switch-row",children:[e.jsx("span",{className:"switch-label",children:"Text shadow"}),e.jsx(Qe,{checked:!!s.hasTextShadow,onChange:m=>C("hasTextShadow",m.target.checked)})]}),s.hasTextShadow&&e.jsxs("div",{className:"shadow-properties",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"H-Offset"}),e.jsx("input",{type:"number",value:s.textShadowX||2,onChange:m=>C("textShadowX",parseInt(m.target.value)),min:"-20",max:"20"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"V-Offset"}),e.jsx("input",{type:"number",value:s.textShadowY||2,onChange:m=>C("textShadowY",parseInt(m.target.value)),min:"-20",max:"20"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Blur"}),e.jsx("input",{type:"number",value:s.textShadowBlur||4,onChange:m=>C("textShadowBlur",parseInt(m.target.value)),min:"0",max:"20"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Shadow Color"}),e.jsx("input",{type:"color",value:s.textShadowColor||"#000000",onChange:m=>C("textShadowColor",m.target.value)})]})]})]})}),e.jsx("div",{className:"property-row",children:e.jsxs("div",{className:"color-input-group",children:[e.jsxs("div",{className:"color-input-item",children:[e.jsx("label",{children:"Stroke Color"}),e.jsx("input",{type:"color",value:s.stroke||"#000000",onChange:m=>C("stroke",m.target.value)})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Stroke Width"}),e.jsx("input",{type:"number",value:s.strokeWidth||0,onChange:m=>C("strokeWidth",parseInt(m.target.value)),min:"0",max:"20"})]})]})}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Opacity"}),e.jsxs("div",{className:"slider-row",children:[e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:s.opacity||1,onChange:m=>C("opacity",parseFloat(m.target.value))}),e.jsxs("span",{className:"value-chip",children:[Math.round((s.opacity||1)*100),"%"]})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Font Variant"}),e.jsxs("select",{value:s.fontVariant||"normal",onChange:m=>C("fontVariant",m.target.value),children:[e.jsx("option",{value:"normal",children:"Normal"}),e.jsx("option",{value:"small-caps",children:"Small Caps"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Writing Mode"}),e.jsxs("select",{value:s.writingMode||"horizontal-tb",onChange:m=>C("writingMode",m.target.value),children:[e.jsx("option",{value:"horizontal-tb",children:"Horizontal"}),e.jsx("option",{value:"vertical-rl",children:"Vertical Right-to-Left"}),e.jsx("option",{value:"vertical-lr",children:"Vertical Left-to-Right"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Direction"}),e.jsxs("div",{className:"button-group",children:[e.jsx("button",{className:!s.direction||s.direction==="ltr"?"active":"",onClick:()=>C("direction","ltr"),title:"Left to Right",children:"LTR"}),e.jsx("button",{className:s.direction==="rtl"?"active":"",onClick:()=>C("direction","rtl"),title:"Right to Left",children:"RTL"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Background Padding"}),e.jsx("input",{type:"number",value:s.backgroundPadding||5,onChange:m=>C("backgroundPadding",parseInt(m.target.value)),min:"0",max:"50",disabled:!s.hasBackground})]})]})]})},$=()=>e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Shape Properties"}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Fill Color"}),e.jsx("input",{type:"color",value:s.fill||"#000000",onChange:F=>C("fill",F.target.value)})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Stroke Color"}),e.jsx("input",{type:"color",value:s.stroke||"#000000",onChange:F=>C("stroke",F.target.value)})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Stroke Width"}),e.jsx("input",{type:"number",value:s.strokeWidth||2,onChange:F=>C("strokeWidth",parseInt(F.target.value)),min:"0",max:"20"})]}),s.type==="star"&&e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Star Points"}),e.jsx("input",{type:"number",value:s.numPoints||5,onChange:F=>C("numPoints",parseInt(F.target.value)),min:"3",max:"20"})]}),s.type==="roundedRectangle"&&e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Corner Radius"}),e.jsx("input",{type:"number",value:s.cornerRadius||10,onChange:F=>C("cornerRadius",parseInt(F.target.value)),min:"0",max:"50"})]})]}),v=async()=>{if(!(!A||q)){D(!0),V("");try{await A(s)}catch{V("Could not remove the background. Please try again.")}finally{D(!1)}}},ot=["image","sticker","embroidery"],ct=()=>!A||!ot.includes(s.type)?null:e.jsxs("div",{className:"property-group",children:[e.jsx("button",{type:"button",className:"remove-bg-btn",onClick:v,disabled:q,style:{width:"100%",padding:"9px 12px",borderRadius:8,border:"1px solid #cbd5e1",background:q?"#f1f5f9":"#fff",color:"#334155",fontSize:13,fontWeight:600,cursor:q?"wait":"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:8},children:q?"Removing background…":"✂️ Remove background"}),lt&&e.jsx("div",{style:{marginTop:6,fontSize:12,color:"#dc2626"},children:lt})]}),ut=()=>e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Image Properties"}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Opacity"}),e.jsxs("div",{className:"slider-row",children:[e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:s.opacity||1,onChange:F=>C("opacity",parseFloat(F.target.value))}),e.jsxs("span",{className:"value-chip",children:[Math.round((s.opacity||1)*100),"%"]})]})]}),_&&e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Border Radius"}),e.jsx("input",{type:"number",value:s.borderRadius||0,onChange:F=>C("borderRadius",parseInt(F.target.value)),min:"0",max:"50"})]})]}),U=()=>e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Position & Size"}),e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"X"}),e.jsx("input",{type:"number",value:Math.round(s.x)||0,onChange:F=>C("x",parseInt(F.target.value))})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Y"}),e.jsx("input",{type:"number",value:Math.round(s.y)||0,onChange:F=>C("y",parseInt(F.target.value))})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Width"}),e.jsx("input",{type:"number",value:Math.round(s.width)||0,onChange:F=>C("width",parseInt(F.target.value)),min:"1"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Height"}),e.jsx("input",{type:"number",value:Math.round(s.height)||0,onChange:F=>C("height",parseInt(F.target.value)),min:"1"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Rotation"}),e.jsxs("div",{className:"slider-row",children:[e.jsx("input",{type:"range",min:"-180",max:"180",value:s.rotation||0,onChange:F=>C("rotation",parseInt(F.target.value))}),e.jsxs("span",{className:"value-chip",children:[s.rotation||0,"°"]}),e.jsx("button",{type:"button",className:"reset-btn",onClick:()=>C("rotation",0),disabled:!s.rotation,title:"Reset rotation","aria-label":"Reset rotation",children:"↺"})]})]}),z?e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Align"}),e.jsxs("div",{className:"align-buttons",children:[e.jsx("button",{type:"button",title:"Align left",onClick:()=>C("x",0),children:"⬅"}),e.jsx("button",{type:"button",title:"Center horizontally",onClick:()=>C("x",Math.round((z-(s.width||0))/2)),children:"⬌"}),e.jsx("button",{type:"button",title:"Align right",onClick:()=>C("x",Math.round(z-(s.width||0))),children:"➡"}),S?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",title:"Align top",onClick:()=>C("y",0),children:"⬆"}),e.jsx("button",{type:"button",title:"Center vertically",onClick:()=>C("y",Math.round((S-(s.height||0))/2)),children:"⬍"}),e.jsx("button",{type:"button",title:"Align bottom",onClick:()=>C("y",Math.round(S-(s.height||0))),children:"⬇"})]}):null]})]}):null,e.jsxs("div",{className:"property-row lock-toggles",children:[s.type!=="text"&&e.jsxs("div",{className:"switch-row",children:[e.jsx("span",{className:"switch-label",children:"Lock aspect ratio"}),e.jsx(Qe,{checked:!!s.lockAspect,onChange:F=>C("lockAspect",F.target.checked)})]}),e.jsxs("div",{className:"switch-row",children:[e.jsx("span",{className:"switch-label",children:"Lock position"}),e.jsx(Qe,{checked:!!s.locked,onChange:F=>C("locked",F.target.checked)})]})]})]}),Z=()=>e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Line Properties"}),e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Line Width"}),e.jsx("input",{type:"number",value:s.strokeWidth||s.height||2,onChange:F=>{const M=parseInt(F.target.value);C("strokeWidth",M),C("height",M)},min:"1",max:"50"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Length"}),e.jsx("input",{type:"number",value:s.width||200,onChange:F=>C("width",parseInt(F.target.value)),min:"10",max:"1000"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Line Color"}),e.jsxs("div",{className:"color-input-group",children:[e.jsx("input",{type:"color",value:s.stroke||s.fill||"#000000",onChange:F=>{C("stroke",F.target.value),C("fill",F.target.value)}}),e.jsx("input",{type:"text",value:s.stroke||s.fill||"#000000",onChange:F=>{C("stroke",F.target.value),C("fill",F.target.value)},placeholder:"#000000"})]})]})]}),it=()=>e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Layer Controls"}),e.jsxs("div",{className:"button-group vertical",children:[e.jsx("button",{onClick:()=>n(s.id,"top"),children:"Bring to Front"}),e.jsx("button",{onClick:()=>n(s.id,"up"),children:"Bring Forward"}),e.jsx("button",{onClick:()=>n(s.id,"down"),children:"Send Backward"}),e.jsx("button",{onClick:()=>n(s.id,"bottom"),children:"Send to Back"})]})]}),st=["rectangle","circle","triangle","star","arrow","diamond","hexagon","pentagon","heart","oval","roundedRectangle"],at=()=>{const F=ko(s,z,W);if(F==null)return null;const M=jo(F,W);return M?e.jsxs("div",{className:"property-group dpi-meter",style:{borderLeft:`4px solid ${M.color}`,paddingLeft:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:9,height:9,borderRadius:"50%",background:M.color,flex:"0 0 auto"}}),e.jsxs("strong",{style:{color:M.color,fontSize:13},children:[Math.round(F)," DPI"]})]}),e.jsx("div",{style:{fontSize:12,color:"#475569",marginTop:2},children:M.label}),M.level!=="good"&&e.jsx("div",{style:{fontSize:11,color:"#64748b",marginTop:4},children:"Make it smaller on the canvas or upload a higher-resolution image."})]}):null};return e.jsxs("div",{className:"properties-panel",children:[e.jsxs("div",{className:"panel-header",children:[e.jsx("h3",{children:"Properties"}),e.jsx("span",{className:"element-type",children:s.type})]}),e.jsxs("div",{className:"panel-content",children:[at(),ct(),s.type==="text"&&I(),st.includes(s.type)&&$(),s.type==="image"&&ut(),s.type==="horizontalLine"&&Z(),U(),it(),e.jsx("div",{className:"property-group",children:e.jsxs("button",{className:"toggle-advanced",onClick:()=>K(!_),children:[_?"Hide":"Show"," Advanced Options"]})})]})]})},$a=({elements:s,selectedElement:o,onSelectElement:r,onMoveLayer:n,onDeleteElement:l,theme:d})=>{const h=(k,T)=>{switch(k){case"text":return"T";case"rectangle":return"▭";case"circle":return"●";case"triangle":return"▲";case"star":return"★";case"arrow":return"➤";case"diamond":return"◆";case"hexagon":return"⬡";case"pentagon":return"⬟";case"heart":return"♥";case"oval":return"⬭";case"roundedRectangle":return"▢";case"horizontalLine":return"―";case"image":return"🖼";case"qrcode":return"⬚";case"barcode":return"|||";case"sticker":return"🎭";case"embroidery":return"🧵";default:return"?"}},w=k=>{var T,N;if(k.type==="text")return k.isIcon&&k.iconData?`Icon: ${k.iconData.name}`:((T=k.text)==null?void 0:T.substring(0,20))+(((N=k.text)==null?void 0:N.length)>20?"...":"")||"Text";if(k.type==="qrcode")return`QR Code: ${(k.data||"").substring(0,15)+((k.data||"").length>15?"...":"")}`;if(k.type==="barcode"){const z=k.format||"CODE128",S=k.data||"";return`Barcode (${z}): ${S.substring(0,10)+(S.length>10?"...":"")}`}return k.type==="sticker"?`Sticker: ${(k.name||"Untitled").substring(0,15)}`:k.type==="embroidery"?`Embroidery: ${(k.name||"Design").substring(0,15)}`:k.type.charAt(0).toUpperCase()+k.type.slice(1)};return e.jsxs("div",{className:"layers-panel",children:[e.jsxs("div",{className:"panel-header",children:[e.jsx("h3",{children:"Layers"}),e.jsx("span",{className:"layer-count",children:s.length})]}),e.jsx("div",{className:"layers-list",children:s.length===0?e.jsx("div",{className:"no-layers",children:"No elements added yet"}):[...s].reverse().map((k,T)=>e.jsxs("div",{className:`layer-item ${(o==null?void 0:o.id)===k.id?"selected":""}`,onClick:()=>r(k),children:[e.jsxs("div",{className:"layer-info",children:[e.jsx("span",{className:"layer-icon",children:h(k.type)}),e.jsx("span",{className:"layer-name",children:w(k)})]}),e.jsxs("div",{className:"layer-controls",children:[e.jsx("button",{className:"layer-btn",onClick:N=>{N.stopPropagation(),n(k.id,"up")},disabled:T===0,title:"Move Up",children:"↑"}),e.jsx("button",{className:"layer-btn",onClick:N=>{N.stopPropagation(),n(k.id,"down")},disabled:T===s.length-1,title:"Move Down",children:"↓"}),e.jsx("button",{className:"layer-btn delete",onClick:N=>{N.stopPropagation(),l(k.id)},title:"Delete",children:"×"})]})]},k.id))})]})};let Ii=null;function _a(){if(Ii)return Ii;if(typeof document>"u")return null;const s=document.createElement("canvas");s.width=6,s.height=6;const o=s.getContext("2d");return o.strokeStyle="rgba(255,255,255,0.34)",o.lineWidth=1.7,o.lineCap="round",o.beginPath(),o.moveTo(-2,8),o.lineTo(8,-2),o.stroke(),o.strokeStyle="rgba(0,0,0,0.16)",o.lineWidth=1.1,o.beginPath(),o.moveTo(1.5,8),o.lineTo(8,1.5),o.stroke(),Ii=s,s}function Li(s){return s?(s.productionMethods||[]).map(r=>String(r).toUpperCase()).includes("EMBROIDERY")||s.supportsEmbroidery==="Y":!1}function ti(s,o,r,{fontSize:n=20,color:l="#1f6feb"}={}){const d=Ba(l||"#1f6feb"),h=s.globalAlpha===void 0?1:s.globalAlpha,w=(()=>{const k=_a();try{return k?s.createPattern(k,"repeat"):null}catch{return null}})();s.save(),s.shadowColor="rgba(0,0,0,0.40)",s.shadowBlur=Math.max(1,n*.05),s.shadowOffsetX=.4,s.shadowOffsetY=Math.max(.8,n*.06),s.fillStyle=d,s.fillText(o,0,r),s.restore(),s.save(),s.fillStyle=d,s.fillText(o,0,r),w&&(s.globalAlpha=h*.85,s.fillStyle=w,s.fillText(o,0,r),s.globalAlpha=h),s.lineJoin="round",s.lineWidth=Math.max(1,n*.05),s.strokeStyle="rgba(28,16,8,0.55)",s.setLineDash&&s.setLineDash([Math.max(2,n*.13),Math.max(1.5,n*.1)]),s.strokeText(o,0,r),s.setLineDash&&s.setLineDash([]),s.restore()}function Va(s,o,r,n){if(!s||!o)return{dx:0,dy:0,dw:r,dh:n};const l=Math.min(r/s,n/o),d=s*l,h=o*l;return{dx:(r-d)/2,dy:(n-h)/2,dw:d,dh:h}}function Oi(s,o,r,n){const l=o.naturalWidth||o.width,d=o.naturalHeight||o.height,{dx:h,dy:w,dw:k,dh:T}=Va(l,d,r,n);s.drawImage(o,h,w,k,T)}const Ga=["_imageElement","_stickerElement","_imageLoadError"];function bo(s){const o={};for(const[r,n]of Object.entries(s||{}))o[r]={...n,elements:((n==null?void 0:n.elements)||[]).map(l=>{const d={...l};return Ga.forEach(h=>delete d[h]),d})};return o}class Ua{constructor(){this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d")}_prepareCanvas(o,r,n=1){const l=n>0?n:1;this.canvas.width=Math.round(o*l),this.canvas.height=Math.round(r*l),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.setTransform(l,0,0,l,0,0),this.ctx.imageSmoothingEnabled=!0,this.ctx.imageSmoothingQuality="high"}async exportAllSections(o,r,n,l,d="png",h=!0,w=null,k=1){const T={};try{const N=[];for(const z of r){const S=o[z.id||z.sectionName];((S==null?void 0:S.elements)||[]).forEach(W=>{W&&W.type==="text"&&W.fontFamily&&N.push(W.fontFamily)})}await $i(N),typeof document<"u"&&document.fonts&&document.fonts.ready&&await document.fonts.ready}catch{}for(const N of r){const z=N.id||N.sectionName,S=o[z];if(!S||!S.elements||S.elements.length===0){console.log(`Skipping section ${z} - no elements`);continue}if(this._prepareCanvas(n,l,k),h){const A=N.image||N.sectionImage;if(A)try{const _=await this.loadImage(A);Oi(this.ctx,_,n,l)}catch(_){console.warn("Failed to load background image:",_)}}for(const A of S.elements)await this.drawElement(A);const W=this.canvas.toDataURL(`image/${d}`,d==="jpeg"?.9:void 0);T[z]={dataUrl:W,blob:await this.dataUrlToBlob(W)}}return T}async downloadExports(o,r="design"){const n=Object.keys(o);if(n.length===0){alert("No designs to export");return}if(n.length===1){const l=n[0],{blob:d}=o[l],h=URL.createObjectURL(d),w=document.createElement("a");w.href=h,w.download=`${r}-${l}.png`,document.body.appendChild(w),w.click(),document.body.removeChild(w),URL.revokeObjectURL(h)}else for(const l of n){const{blob:d}=o[l],h=URL.createObjectURL(d),w=document.createElement("a");w.href=h,w.download=`${r}-${l}.png`,document.body.appendChild(w),w.click(),document.body.removeChild(w),URL.revokeObjectURL(h),await new Promise(k=>setTimeout(k,100))}}async loadImage(o){return new Promise((r,n)=>{const l=new Image;l.crossOrigin="anonymous",l.onload=()=>r(l),l.onerror=n,l.src=o})}getLuma(o,r,n){return(.2126*o+.7152*r+.0722*n)/255}async processImageColor(o,r){const n=document.createElement("canvas"),l=n.getContext("2d");n.width=o.width,n.height=o.height,l.clearRect(0,0,n.width,n.height),l.drawImage(o,0,0);const d=l.getImageData(0,0,n.width,n.height),h=d.data,w=this.hexToRgb(r);if(!w){console.warn("Invalid target color:",r);return}const{r:k,g:T,b:N}=w;for(let z=0;z<h.length;z+=4){if(h[z+3]===0)continue;const W=this.getLuma(h[z],h[z+1],h[z+2]);h[z]=Math.round(k*W),h[z+1]=Math.round(T*W),h[z+2]=Math.round(N*W)}return l.putImageData(d,0,0),this.processedImage=new Image,new Promise(z=>{this.processedImage.onload=()=>{z()},this.processedImage.onerror=()=>{console.error("Failed to create processed image"),z()},this.processedImage.src=n.toDataURL("image/png")})}async drawElement(o){this.ctx.save();const r=o.x+o.width/2,n=o.y+o.height/2;switch(this.ctx.translate(r,n),o.rotation&&this.ctx.rotate(o.rotation*Math.PI/180),this.ctx.translate(-o.width/2,-o.height/2),o.type){case"text":this.drawText(o);break;case"rectangle":this.drawRectangle(o);break;case"circle":this.drawCircle(o);break;case"triangle":this.drawTriangle(o);break;case"star":this.drawStar(o);break;case"arrow":this.drawArrow(o);break;case"diamond":this.drawDiamond(o);break;case"hexagon":this.drawHexagon(o);break;case"pentagon":this.drawPentagon(o);break;case"heart":this.drawHeart(o);break;case"oval":this.drawOval(o);break;case"roundedRectangle":this.drawRoundedRectangle(o);break;case"qrcode":await this.drawQRCode(o);break;case"barcode":await this.drawBarcode(o);break;case"horizontalLine":this.drawHorizontalLine(o);break;case"sticker":await this.drawSticker(o);break;case"embroidery":await this.drawEmbroidery(o);break;case"image":await this.drawImage(o);break}this.ctx.restore()}drawText(o){let r=o.text||"Text";switch(o.textTransform){case"uppercase":r=r.toUpperCase();break;case"lowercase":r=r.toLowerCase();break;case"capitalize":r=r.replace(/\b\w/g,h=>h.toUpperCase());break}this.ctx.font=`${o.fontStyle||"normal"} ${o.fontWeight||"normal"} ${o.fontSize||20}px ${o.fontFamily||"Arial"}`,this.ctx.letterSpacing=`${o.letterSpacing||0}px`,this.ctx.fillStyle=o.fill||"#000000",this.ctx.textAlign=o.textAlign||"left",this.ctx.textBaseline="top",o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth);const n=r.split(`
53
- `),l=(o.fontSize||20)*(o.lineHeight||1.2),d=this.embroidery&&o.type==="text"&&!o.isIcon;if(o.curve&&Math.abs(o.curve)>=1){const h=Math.max(...n.map(w=>this.ctx.measureText(w).width));this.drawCurvedText(o,n.join(" "),h,d);return}n.forEach((h,w)=>{const k=w*l;d?ti(this.ctx,h,k,{fontSize:o.fontSize||20,color:o.fill||"#000000"}):(o.stroke&&o.strokeWidth>0&&this.ctx.strokeText(h,0,k),this.ctx.fillText(h,0,k))})}drawCurvedText(o,r,n,l=!1){const d=this.ctx,h=Array.from(r);if(h.length===0)return;const w=o.fontSize||20,k=h.map(C=>d.measureText(C).width),T=k.reduce((C,I)=>C+I,0)||1,N=Math.max(1e-4,Math.abs(o.curve)*Math.PI/180),z=T/N,S=o.curve>=0?1:-1,W=(n||T)/2,A=S*z+w/2,_=o.stroke&&o.strokeWidth>0,K=typeof o.textDecoration=="string"?o.textDecoration:"",q={underline:K.includes("underline")||!!o.underline,overline:K.includes("overline")||!!o.overline,strike:K.includes("line-through")||!!o.strikethrough},D=q.underline||q.overline||q.strike,lt=o.decorationColor||o.fill||"#000000",V=Math.max(1,w/20);d.textAlign="center",d.textBaseline="middle",d.save(),d.translate(W,A),d.rotate(-S*N/2);for(let C=0;C<h.length;C++){const I=k[C]/z;if(d.rotate(S*I/2),d.save(),d.translate(0,-S*z),l?ti(d,h[C],0,{fontSize:w,color:o.fill||"#000000"}):(_&&d.strokeText(h[C],0,0),d.fillText(h[C],0,0)),D){const $=k[C];d.strokeStyle=lt,d.lineWidth=V,d.setLineDash&&d.setLineDash([]),q.underline&&(d.beginPath(),d.moveTo(-$/2,w/2+2),d.lineTo($/2,w/2+2),d.stroke()),q.overline&&(d.beginPath(),d.moveTo(-$/2,-(w/2+2)),d.lineTo($/2,-(w/2+2)),d.stroke()),q.strike&&(d.beginPath(),d.moveTo(-$/2,0),d.lineTo($/2,0),d.stroke())}d.restore(),d.rotate(S*I/2)}d.restore()}drawRectangle(o){o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fillRect(0,0,o.width,o.height)),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.strokeRect(0,0,o.width,o.height))}drawCircle(o){const r=Math.min(o.width,o.height)/2,n=o.width/2,l=o.height/2;this.ctx.beginPath(),this.ctx.arc(n,l,r,0,2*Math.PI),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawTriangle(o){const r=o.width/2;this.ctx.beginPath(),this.ctx.moveTo(r,0),this.ctx.lineTo(0,o.height),this.ctx.lineTo(o.width,o.height),this.ctx.closePath(),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawStar(o){const r=o.width/2,n=o.height/2,l=Math.min(o.width,o.height)/2,d=l*.4,h=o.numPoints||5;this.ctx.beginPath();for(let w=0;w<h*2;w++){const k=w%2===0?l:d,T=w*Math.PI/h,N=r+Math.cos(T)*k,z=n+Math.sin(T)*k;w===0?this.ctx.moveTo(N,z):this.ctx.lineTo(N,z)}this.ctx.closePath(),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawArrow(o){const r=o.width,n=o.height,l=r*.3;this.ctx.beginPath(),this.ctx.moveTo(r/2,0),this.ctx.lineTo(r,n*.6),this.ctx.lineTo(r-l,n*.6),this.ctx.lineTo(r-l,n),this.ctx.lineTo(l,n),this.ctx.lineTo(l,n*.6),this.ctx.lineTo(0,n*.6),this.ctx.closePath(),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}async dataUrlToBlob(o){return new Promise(r=>{const n=document.createElement("canvas"),l=n.getContext("2d"),d=new Image;d.onload=()=>{n.width=d.width,n.height=d.height,l.drawImage(d,0,0),n.toBlob(r)},d.src=o})}hexToRgb(o){const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);return r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16)}:null}drawDiamond(o){const r=o.width/2,n=o.height/2;this.ctx.beginPath(),this.ctx.moveTo(r,0),this.ctx.lineTo(o.width,n),this.ctx.lineTo(r,o.height),this.ctx.lineTo(0,n),this.ctx.closePath(),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawHexagon(o){const r=o.width/2,n=o.height/2,l=Math.min(o.width,o.height)/2,d=6;this.ctx.beginPath();for(let h=0;h<d;h++){const w=h*2*Math.PI/d-Math.PI/2,k=r+l*Math.cos(w),T=n+l*Math.sin(w);h===0?this.ctx.moveTo(k,T):this.ctx.lineTo(k,T)}this.ctx.closePath(),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawPentagon(o){const r=o.width/2,n=o.height/2,l=Math.min(o.width,o.height)/2,d=5;this.ctx.beginPath();for(let h=0;h<d;h++){const w=h*2*Math.PI/d-Math.PI/2,k=r+l*Math.cos(w),T=n+l*Math.sin(w);h===0?this.ctx.moveTo(k,T):this.ctx.lineTo(k,T)}this.ctx.closePath(),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawHeart(o){const r=o.width,n=o.height,l=0,d=0;this.ctx.beginPath();const h=n*.3;this.ctx.moveTo(l+r/2,d+h),this.ctx.bezierCurveTo(l+r/2,d,l,d,l,d+h),this.ctx.bezierCurveTo(l,d+(n+h)/2,l+r/2,d+(n+h)/2,l+r/2,d+n),this.ctx.bezierCurveTo(l+r/2,d+(n+h)/2,l+r,d+(n+h)/2,l+r,d+h),this.ctx.bezierCurveTo(l+r,d,l+r/2,d,l+r/2,d+h),this.ctx.closePath(),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawOval(o){const r=o.width/2,n=o.height/2,l=o.width/2,d=o.height/2;this.ctx.beginPath(),this.ctx.ellipse(r,n,l,d,0,0,2*Math.PI),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawRoundedRectangle(o){const r=Math.min(o.width,o.height)*.1;this.drawRoundedRect(0,0,o.width,o.height,r),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawRoundedRect(o,r,n,l,d){this.ctx.beginPath(),this.ctx.moveTo(o+d,r),this.ctx.lineTo(o+n-d,r),this.ctx.quadraticCurveTo(o+n,r,o+n,r+d),this.ctx.lineTo(o+n,r+l-d),this.ctx.quadraticCurveTo(o+n,r+l,o+n-d,r+l),this.ctx.lineTo(o+d,r+l),this.ctx.quadraticCurveTo(o,r+l,o,r+l-d),this.ctx.lineTo(o,r+d),this.ctx.quadraticCurveTo(o,r,o+d,r),this.ctx.closePath()}async drawQRCode(o){if(o.imageObject)this.ctx.drawImage(o.imageObject,0,0,o.width,o.height);else if(o.src)try{const r=await this.loadImage(o.src);this.ctx.drawImage(r,0,0,o.width,o.height)}catch(r){console.warn("Failed to load QR code image for export:",r),this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("QR Error",o.width/2,o.height/2)}else this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("No QR Data",o.width/2,o.height/2)}async drawBarcode(o){if(o.imageObject)this.ctx.drawImage(o.imageObject,0,0,o.width,o.height);else if(o.src)try{const r=await this.loadImage(o.src);this.ctx.drawImage(r,0,0,o.width,o.height)}catch(r){console.warn("Failed to load barcode image for export:",r),this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Barcode Error",o.width/2,o.height/2)}else this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("No Barcode Data",o.width/2,o.height/2)}drawHorizontalLine(o){this.ctx.save(),o.opacity!==void 0&&(this.ctx.globalAlpha=o.opacity),this.ctx.strokeStyle=o.stroke||o.fill||"#000000",this.ctx.lineWidth=o.strokeWidth||o.height||2,this.ctx.lineCap="round",this.ctx.beginPath(),this.ctx.moveTo(0,o.height/2),this.ctx.lineTo(o.width,o.height/2),this.ctx.stroke(),this.ctx.restore()}async drawSticker(o){try{let r=null;if(o.imageObject)r=o.imageObject;else if(o.imageData)r=o.imageData;else if(o.src||o.image){const n=o.src||o.image;r=await this.loadImage(n)}else o.data&&o.data.image&&(r=await this.loadImage(o.data.image));r?(o.opacity!==void 0&&(this.ctx.globalAlpha=o.opacity),this.ctx.drawImage(r,0,0,o.width,o.height)):(this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Sticker",o.width/2,o.height/2))}catch(r){console.warn("Failed to draw sticker:",r),this.ctx.fillStyle="#ffebee",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#f44336",this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#f44336",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Error",o.width/2,o.height/2)}}async drawEmbroidery(o){try{let r=null;if(o.imageObject)r=o.imageObject;else if(o.imageData)r=o.imageData;else if(o.src||o.image){const n=o.src||o.image;r=await this.loadImage(n)}else o.data&&o.data.image&&(r=await this.loadImage(o.data.image));r?(o.opacity!==void 0&&(this.ctx.globalAlpha=o.opacity),this.ctx.drawImage(r,0,0,o.width,o.height)):(this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Embroidery",o.width/2,o.height/2))}catch(r){console.warn("Failed to draw embroidery:",r),this.ctx.fillStyle="#ffebee",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#f44336",this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#f44336",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Error",o.width/2,o.height/2)}}async drawImage(o){try{let r=null;if(o.imageObject&&o.imageObject instanceof HTMLImageElement)r=o.imageObject;else if(o.imageData){if(o.imageData instanceof HTMLImageElement)r=o.imageData;else if(typeof o.imageData=="string")try{r=await this.loadImage(o.imageData)}catch(n){console.warn("Failed to load image from imageData URL:",o.imageData,n),r=await this.loadImageWithFallback(o.imageData)}}else if(o.src)try{r=await this.loadImage(o.src)}catch(n){console.warn("Failed to load image from src:",o.src,n),r=await this.loadImageWithFallback(o.src)}else if(o.image)try{r=await this.loadImage(o.image)}catch(n){console.warn("Failed to load image from image property:",o.image,n),r=await this.loadImageWithFallback(o.image)}r?(o.opacity!==void 0&&(this.ctx.globalAlpha=o.opacity),this.ctx.drawImage(r,0,0,o.width,o.height)):this.drawImagePlaceholder(o)}catch(r){console.error("Failed to draw image element:",r),this.drawImagePlaceholder(o)}}async loadImageWithFallback(o){return new Promise(r=>{const n=new Image;n.onload=()=>r(n),n.onerror=()=>{const l=new Image;l.crossOrigin="anonymous",l.onload=()=>r(l),l.onerror=()=>{console.warn("All image loading attempts failed for:",o),r(null)},l.src=o},n.src=o})}drawImagePlaceholder(o){this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#ccc",this.ctx.lineWidth=2,this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Image",o.width/2,o.height/2-8),this.ctx.fillText("Not Found",o.width/2,o.height/2+8)}async blobToFile(o,r,n="image/png"){return new File([o],r,{type:n,lastModified:Date.now()})}async exportAllSectionsAsJSON(o,r,n,l,d="png",h=null,w=1){var A,_;const k=[],T=[],N=Math.min(w,2),z={};for(const K of r){const q=K.sectionName,D=o[q];if(!D||!D.elements||D.elements.length===0){console.log(`Skipping section ${q} - no elements`);continue}const lt=K.image||K.sectionImage,V={...D,backgroundImage:lt,sectionImage:lt,sectionName:q,selectedColor:D.selectedColor||"#FFFFFF",canvasWidth:n,canvasHeight:l};z[q]=V;const C=await this.exportSectionAsBlob(D,K,n,l,d,!0,h,N);if(C){const $=await this.blobToFile(C,`${q}-full.${d}`,`image/${d}`);k.push({sectionName:q,sectionImage:$})}const I=await this.exportSectionAsBlob(D,K,n,l,d,!1,h,w);if(I){const $=await this.blobToFile(I,`${q}-print.${d}`,`image/${d}`);T.push({sectionName:q,sectionImage:$})}}const S=((A=r[0])==null?void 0:A.image)||((_=r[0])==null?void 0:_.sectionImage),W={sections:bo(z),canvasWidth:n,canvasHeight:l,sectionImage:S,format:d,timestamp:new Date().toISOString(),version:"1.0",...h&&{initData:{sectionImage:h.sectionImage,sections:h.sections?Object.keys(h.sections):[]}},product:{sections:r.map(K=>({sectionName:K.sectionName||K.id,sectionImage:K.image||K.sectionImage,id:K.id||K.sectionName}))}};return{fullDesign:k,printReady:T,designFile:JSON.stringify(W)}}async exportSectionAsBlob(o,r,n,l,d="png",h=!0,w=null,k=1){try{if(this._prepareCanvas(n,l,k),h){const T=r.image||r.sectionImage;if(T)try{const N=await this.loadImage(T);Oi(this.ctx,N,n,l)}catch(N){console.warn("Failed to load background image:",N)}}for(const T of o.elements)await this.drawElement(T);return new Promise(T=>{this.canvas.toBlob(T,`image/${d}`,d==="jpeg"?.9:void 0)})}catch(T){return console.error("Error exporting section as blob:",T),null}}async exportCurrentSectionAsJSON(o,r="png",n=null,l=1){var _,K,q;const d=Math.min(l,2),h=((_=o.activeSection)==null?void 0:_.sectionName)||"main",w=((K=o.activeSection)==null?void 0:K.sectionImage)||((q=o.activeSection)==null?void 0:q.image),k={elements:o.elements,selectedColor:o.selectedColor,canvasWidth:o.canvasWidth,canvasHeight:o.canvasHeight,backgroundImage:w,sectionImage:w,sectionName:h,zoomLevel:o.zoomLevel,showGrid:o.showGrid,snapToGrid:o.snapToGrid},T={id:h,sectionName:h,image:w,sectionImage:w},N=[],z=[],S=await this.exportSectionAsBlob(k,T,o.canvasWidth,o.canvasHeight,r,!0,n,d);if(S){const D=await this.blobToFile(S,`${h}-full.${r}`,`image/${r}`);N.push({sectionName:h,sectionImage:D})}const W=await this.exportSectionAsBlob(k,T,o.canvasWidth,o.canvasHeight,r,!1,n,l);if(W){const D=await this.blobToFile(W,`${h}-print.${r}`,`image/${r}`);z.push({sectionName:h,sectionImage:D})}const A={sections:bo({[h]:k}),canvasWidth:o.canvasWidth,canvasHeight:o.canvasHeight,sectionImage:w,format:r,timestamp:new Date().toISOString(),version:"1.0",...n&&{initData:{sectionImage:n.sectionImage,sections:n.sections?Object.keys(n.sections):[]}},productInfo:{sections:[{sectionName:h,sectionImage:w,id:h}]}};return{fullDesign:N,printReady:z,designFile:JSON.stringify(A)}}}const Ya=["rectangle","circle","triangle","star","heart","diamond","hexagon","pentagon","oval","roundedRectangle"];function qa(s){const o=Array.isArray(s)?s:[],r=[];o.some(l=>l&&l.type==="text"&&!l.isIcon&&(l.fontSize||20)<14)&&r.push("Small text may not stitch cleanly — keep letters bold and reasonably large."),o.some(l=>l&&(l.type==="image"||l.type==="sticker"))&&r.push("Photos & gradients can’t be embroidered — they’ll be simplified to solid thread colours.");const n=new Set;return o.forEach(l=>{l&&(l.type==="text"||Ya.includes(l.type))&&l.fill&&n.add(String(l.fill).toLowerCase())}),n.size>8&&r.push(`Your design uses ${n.size} colours — more thread colours can increase the price.`),r}class Xa{constructor(o="localStorage"){this.storage=o==="sessionStorage"?sessionStorage:localStorage,this.STORAGE_PREFIX="mypixia_canvas_",this.DESIGNS_LIST_KEY="mypixia_saved_designs"}saveDesign(o,r){var n;try{const l=this.generateDesignId(o),d=new Date().toISOString(),h={id:l,name:o,timestamp:d,version:"1.0",canvasData:{elements:r.elements||[],canvasWidth:r.canvasWidth||800,canvasHeight:r.canvasHeight||600,selectedColor:r.selectedColor||"#FF0000",activeSection:r.activeSection||null,product:r.product||null,sectionDesigns:r.sectionDesigns||{},zoomLevel:r.zoomLevel||1,showGrid:r.showGrid||!1,snapToGrid:r.snapToGrid||!0},metadata:{elementCount:((n=r.elements)==null?void 0:n.length)||0,lastModified:d,thumbnail:r.thumbnail||null}};return this.storage.setItem(this.STORAGE_PREFIX+l,JSON.stringify(h)),this.updateDesignsList(l,o,d),{success:!0,designId:l,message:"Design saved successfully"}}catch(l){return console.error("Error saving design:",l),{success:!1,error:l.message}}}loadDesign(o){try{let r=o;if(!o.startsWith("design_")){const h=this.getAllDesigns().find(w=>w.name===o);if(!h)return{success:!1,error:"Design not found"};r=h.id}const n=this.storage.getItem(this.STORAGE_PREFIX+r);return n?{success:!0,data:JSON.parse(n)}:{success:!1,error:"Design not found"}}catch(r){return console.error("Error loading design:",r),{success:!1,error:r.message}}}getAllDesigns(){try{const o=this.storage.getItem(this.DESIGNS_LIST_KEY);return o?JSON.parse(o):[]}catch(o){return console.error("Error getting designs list:",o),[]}}deleteDesign(o){try{this.storage.removeItem(this.STORAGE_PREFIX+o);const n=this.getAllDesigns().filter(l=>l.id!==o);return this.storage.setItem(this.DESIGNS_LIST_KEY,JSON.stringify(n)),{success:!0,message:"Design deleted successfully"}}catch(r){return console.error("Error deleting design:",r),{success:!1,error:r.message}}}exportDesignAsFile(o){try{const r=this.loadDesign(o);if(!r.success)return r;const n=r.data,l=JSON.stringify(n,null,2),d=new Blob([l],{type:"application/json"}),h=URL.createObjectURL(d),w=document.createElement("a");return w.href=h,w.download=`${n.name}_${n.id}.json`,document.body.appendChild(w),w.click(),document.body.removeChild(w),URL.revokeObjectURL(h),{success:!0,message:"Design exported successfully"}}catch(r){return console.error("Error exporting design:",r),{success:!1,error:r.message}}}importDesignFromFile(o){return new Promise(r=>{try{const n=new FileReader;n.onload=l=>{try{const d=JSON.parse(l.target.result);if(!this.validateDesignData(d)){r({success:!1,error:"Invalid design file format"});return}const h=this.generateDesignId(d.name+"_imported");d.id=h,d.name+="_imported",d.timestamp=new Date().toISOString(),d.metadata.lastModified=d.timestamp,this.storage.setItem(this.STORAGE_PREFIX+h,JSON.stringify(d)),this.updateDesignsList(h,d.name,d.timestamp),r({success:!0,data:d,message:"Design imported successfully"})}catch{r({success:!1,error:"Failed to parse design file"})}},n.readAsText(o)}catch(n){r({success:!1,error:n.message})}})}autoSave(o,r){const n=this.STORAGE_PREFIX+"autosave_"+o;try{const l={timestamp:new Date().toISOString(),canvasData:r};return this.storage.setItem(n,JSON.stringify(l)),!0}catch(l){return console.error("Auto-save failed:",l),!1}}loadAutoSave(o){const r=this.STORAGE_PREFIX+"autosave_"+o;try{const n=this.storage.getItem(r);return n?JSON.parse(n):null}catch(n){return console.error("Failed to load auto-save:",n),null}}clearAutoSave(o){const r=this.STORAGE_PREFIX+"autosave_"+o;this.storage.removeItem(r)}getStorageInfo(){const o=this.getAllDesigns();let r=0;return o.forEach(n=>{const l=this.storage.getItem(this.STORAGE_PREFIX+n.id);l&&(r+=new Blob([l]).size)}),{designCount:o.length,totalSize:r,totalSizeFormatted:this.formatBytes(r),storageLimit:this.getStorageLimit()}}clearAllDesigns(){try{return this.getAllDesigns().forEach(r=>{this.storage.removeItem(this.STORAGE_PREFIX+r.id)}),this.storage.removeItem(this.DESIGNS_LIST_KEY),{success:!0,message:"All designs cleared"}}catch(o){return{success:!1,error:o.message}}}generateDesignId(o){const r=Date.now(),n=Math.random().toString(36).substring(2,8);return`design_${r}_${n}`}updateDesignsList(o,r,n){const l=this.getAllDesigns(),d=l.findIndex(w=>w.id===o),h={id:o,name:r,timestamp:n,lastModified:n};d>=0?l[d]=h:l.push(h),l.sort((w,k)=>new Date(k.timestamp)-new Date(w.timestamp)),this.storage.setItem(this.DESIGNS_LIST_KEY,JSON.stringify(l))}validateDesignData(o){return o&&o.id&&o.name&&o.canvasData&&Array.isArray(o.canvasData.elements)}formatBytes(o){if(o===0)return"0 Bytes";const r=1024,n=["Bytes","KB","MB","GB"],l=Math.floor(Math.log(o)/Math.log(r));return parseFloat((o/Math.pow(r,l)).toFixed(2))+" "+n[l]}getStorageLimit(){try{if("storage"in navigator&&"estimate"in navigator.storage)return navigator.storage.estimate().then(o=>o.quota)}catch{console.warn("Unable to estimate storage quota")}return"Unknown"}}const Qa=(s,o)=>{let r;return function(...l){const d=()=>{clearTimeout(r),s(...l)};clearTimeout(r),r=setTimeout(d,o)}},Ke=[{key:"make-it-yours",title:"Make it yours",body:"Add your text, upload a logo, or drag artwork straight onto the product to bring your design to life."},{key:"start-creating",title:"Start creating",body:"Drop in your logo, type a slogan, or add artwork — your custom product takes shape as you go."},{key:"design-in-seconds",title:"Design yours in seconds",body:"Add text or upload an image to get started — no design skills needed."}],Co=g.forwardRef((s,o)=>{var no;const{theme:r={primaryColor:"#6a45d2",secondaryColor:"#f88300",tertiaryColor:"#FFFFFF"},readOnly:n=!1,mode:l="customize",initialColor:d,product:h={name:"Premium Crew Neck T-Shirt",category:"Tshirts",description:"Men's crew neck t-shirts",plainColor:"N",mainImage:"https://static.mypixia.com/dev/products/7/e011a73a-f20a-489b-bea8-91a23da56fc4.png",colorSettings:["#FF0000","#0000FF","#008000","#000000","#FFFFFF","#808080","#FFFF00"],sections:[{sectionName:"Front",sectionImage:"https://static.mypixia.com/prod/products/96ca4acb-c426-4619-a2c4-7acd95b78451.png"},{sectionName:"Sleeve-left",sectionImage:"https://static.mypixia.com/prod/products/27b8c138-af4e-4ea0-833d-88b10fbd3cf7.png"},{sectionName:"Back",sectionImage:"https://static.mypixia.com/prod/products/d4c53776-7b7d-41c5-a6b5-2bf5876cd26e.png"}]},initFile:w,initDesignContent:k,printConfig:T,aiEnabled:N=!0,aiEndpoint:z,onAIImageGenerate:S,aiCreditsRemaining:W=null,onAddAiCredits:A,isAuthenticated:_=!0,onRequireAuth:K,onRequestCollaboration:q,onUploadImage:D,onOpenUploads:lt,onRemoveBackground:V,emptyStateVariant:C=0}=s,[I,$]=g.useState([]),[v,ot]=g.useState(null),[ct,ut]=g.useState([]),[U,Z]=g.useState(!1),[it,st]=g.useState(!1),[at,F]=g.useState(!1),[M,bt]=g.useState({x:0,y:0}),[m,R]=g.useState(null),[G,gt]=g.useState(null),wt=g.useRef(null),kt=g.useRef(null),Dt=g.useRef(null),At=g.useRef(!1),[B,Ht]=g.useState(600),[X,he]=g.useState(600),[mt,Zt]=g.useState(1),[$t,fe]=g.useState(d||((no=h.colorSettings)==null?void 0:no[0])),[_t,ve]=g.useState(!1),[Ut,ae]=g.useState(l!=="customize"),[Vt,re]=g.useState(!0),[we,ke]=g.useState(!1),[ue,oi]=g.useState(l!=="customize"),Mt=ii(T),ge=Oa(B,X,Mt);g.useEffect(()=>{if(!v){ut(i=>i.length?[]:i);return}ut(i=>i.length>1&&i.includes(v.id)?i:[v.id])},[v]);const[Q,Pe]=g.useState(h.sections[0]),[Jt,ai]=g.useState(!1),[ri,je]=g.useState(!1),[Xt,me]=g.useState({}),[Wt,Ce]=g.useState([]),[Et,Tt]=g.useState(-1),[ht]=g.useState(new Xa("localStorage")),Nt=g.useRef(null),Oe=g.useRef(null),pe=g.useRef(null),O=g.useRef(null),Bt=g.useRef({v:[],h:[]}),si=g.useRef([]),ni=g.useRef([]),li=g.useRef(null),Fe=g.useRef(null),Ne=g.useRef(null),_i=g.useRef(null),ze=g.useRef(null),Qt=g.useRef(null),Fo=g.useRef(null),Te=g.useRef(new Ua),No=g.useRef(!1),[Me,Vi]=g.useState(null),yt=g.useCallback(()=>{const i={elements:JSON.parse(JSON.stringify(I)),selectedElement:v?{...v}:null,timestamp:Date.now()},t=Wt.slice(0,Et+1);t.push(i),t.length>50?t.shift():Tt(Et+1),Ce(t)},[I,v,Wt,Et]),Ae=g.useCallback(()=>({elements:I,canvasWidth:B,canvasHeight:X,selectedColor:$t,activeSection:Q,product:h,sectionDesigns:Xt,zoomLevel:mt,showGrid:_t,snapToGrid:Vt,selectedElement:v?{...v}:null,canvasRef:Nt}),[I,B,X,$t,Q,h,Xt,mt,_t,Vt,v]),Gi=i=>{if(i.sections&&typeof i.sections=="object"){const t=Object.keys(i.sections)[0],a=i.sections[t];if(a&&a.elements){$(a.elements||[]),Ht(a.canvasWidth||800),he(a.canvasHeight||600),fe(a.selectedColor||h.colorSettings[0]),Zt(a.zoomLevel||1),ve(a.showGrid||!1),re(a.snapToGrid||!0),ot(null),i.sections&&me(i.sections);const c=h.sections.find(y=>y.sectionName===t);c&&Pe(c),Ce([]),Tt(-1),setTimeout(()=>{yt()},100);return}}};g.useEffect(()=>{const t=setTimeout(async()=>{if(I.length===0&&Wt.length<=1){if(k)try{const a=JSON.parse(k);Vi(a),Gi(a)}catch(a){console.error("Error loading design file:",a),console.warn("Using default text instead")}else if(w)try{const a=await fetch(w);if(a.ok){const c=await a.text();if(c.trim()){const y=JSON.parse(c.trim());Vi(y),Gi(y)}}else console.warn("Failed to load design file, using default text")}catch(a){console.error("Error loading design file:",a),console.warn("Using default text instead")}}},300);return()=>clearTimeout(t)},[w,k,h.colorSettings,h.sections]);const ci=g.useCallback((i="png",t=!0)=>{const a=Ae();return h.sections,Te.current.exportAllSections({[(Q==null?void 0:Q.sectionName)||"main"]:a},[{id:(Q==null?void 0:Q.sectionName)||"main",sectionName:(Q==null?void 0:Q.sectionName)||"main",image:Q==null?void 0:Q.sectionImage,sectionImage:Q==null?void 0:Q.sectionImage}],B,X,i,t,Me,ge)},[Ae,h.sections,Q,B,X,ge]),zo=So,He=20;g.useEffect(()=>{const i=()=>ai(window.innerWidth<768);return i(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),g.useEffect(()=>{const i=document.createElement("canvas");i.width=B,i.height=X,Fo.current=i},[B,X]),g.useEffect(()=>{Wt.length===0&&yt()},[]);const te=(i,t,a,c,y,u)=>{i.beginPath(),i.moveTo(t+u,a),i.lineTo(t+c-u,a),i.quadraticCurveTo(t+c,a,t+c,a+u),i.lineTo(t+c,a+y-u),i.quadraticCurveTo(t+c,a+y,t+c-u,a+y),i.lineTo(t+u,a+y),i.quadraticCurveTo(t,a+y,t,a+y-u),i.lineTo(t,a+u),i.quadraticCurveTo(t,a,t+u,a),i.closePath()},ye=(i,t)=>{if(t.type==="text"&&!t.isIcon){i.save(),i.font=`${t.fontStyle||"normal"} ${t.fontWeight||"normal"} ${t.fontSize||20}px ${t.fontFamily||"Arial"}`;try{i.letterSpacing=`${t.letterSpacing||0}px`}catch{}let J=t.text||"Text";switch(t.textTransform){case"uppercase":J=J.toUpperCase();break;case"lowercase":J=J.toLowerCase();break;case"capitalize":J=J.replace(/\b\w/g,Ft=>Ft.toUpperCase());break}const ft=J.split(`
54
- `),L=Math.max(1,...ft.map(Ft=>i.measureText(Ft||" ").width)),nt=(t.fontSize||20)*(t.lineHeight||1.2),Ct=Math.max(t.fontSize||20,ft.length*nt);i.restore();const xt=t.textAlign||"left",St=xt==="center"?t.x-L/2:xt==="right"?t.x-L:t.x,jt=t.y;return{x:St,y:jt,width:L,height:Ct,cx:St+L/2,cy:jt+Ct/2}}if(!t.isIcon)return{x:t.x,y:t.y,width:t.width,height:t.height,cx:t.x+t.width/2,cy:t.y+t.height/2};i.save(),i.font=`${t.fontStyle||""} ${t.fontWeight||""} ${t.fontSize}px ${t.fontFamily}`,i.textBaseline="alphabetic",i.textAlign="left";const a=i.measureText(t.text),c=a.actualBoundingBoxAscent??t.fontSize*.8,y=a.actualBoundingBoxDescent??t.fontSize*.2,u=a.actualBoundingBoxLeft??0,x=a.actualBoundingBoxRight??a.width,f=u+x,p=c+y,b=t.x,j=t.y,E=b-f/2-u,P=j-p/2-c;return i.restore(),{x:E,y:P,width:f,height:p,cx:b,cy:j}},To=(i,t)=>{if(!t)return;const a=8,c=8,y=4,u=30,x=ye(i,t),f=t.isIcon?Math.max(a,12):a,p={x:-x.width/2-f,y:-x.height/2-f,w:x.width+f*2,h:x.height+f*2};i.save(),i.translate(x.cx,x.cy),t.rotation&&i.rotate(t.rotation*Math.PI/180);const b=i.createLinearGradient(p.x,p.y,p.x+p.w,p.y+p.h);if(b.addColorStop(0,"#6a45d2"),b.addColorStop(.5,"#1d4ed8"),b.addColorStop(1,"#6a45d2"),i.strokeStyle="rgba(106,69,210,.3)",i.lineWidth=3,te(i,p.x-1,p.y-1,p.w+2,p.h+2,y+1),i.stroke(),i.strokeStyle=b,i.lineWidth=2,i.setLineDash([8,4]),te(i,p.x,p.y,p.w,p.h,y),i.stroke(),i.lineDashOffset=-(Date.now()/50)%12,i.strokeStyle="#ffffff",i.lineWidth=1,i.setLineDash([4,8]),te(i,p.x,p.y,p.w,p.h,y),i.stroke(),i.setLineDash([]),i.lineDashOffset=0,t.locked){i.restore();return}[{x:p.x,y:p.y},{x:p.x+p.w,y:p.y},{x:p.x+p.w,y:p.y+p.h},{x:p.x,y:p.y+p.h}].forEach(P=>{i.fillStyle="rgba(0,0,0,.2)",i.fillRect(P.x-c/2+1,P.y-c/2+1,c,c),i.fillStyle="#ffffff",i.fillRect(P.x-c/2,P.y-c/2,c,c),i.strokeStyle="#6a45d2",i.lineWidth=1,i.strokeRect(P.x-c/2,P.y-c/2,c,c)});const j=0,E=p.y-u;i.strokeStyle="#6a45d2",i.lineWidth=1,i.setLineDash([2,2]),i.beginPath(),i.moveTo(j,E+12),i.lineTo(j,p.y),i.stroke(),i.setLineDash([]),i.beginPath(),i.arc(j,E,12,0,2*Math.PI),i.fillStyle="#f59e0b",i.fill(),i.strokeStyle="#ffffff",i.lineWidth=2,i.stroke(),i.strokeStyle="#ffffff",i.lineWidth=2,i.beginPath(),i.arc(j,E,6,-Math.PI/2,Math.PI,!1),i.stroke(),i.beginPath(),i.moveTo(j-6,E),i.lineTo(j-3,E-3),i.lineTo(j-3,E+3),i.closePath(),i.fillStyle="#ffffff",i.fill(),i.restore()},Mo=(i,t)=>{if(!t)return[];const a=ye(i,t),c=t.isIcon?Math.max(8,12):8,y=8,u=30,x=(t.rotation||0)*Math.PI/180,f={x:-a.width/2-c,y:-a.height/2-c,w:a.width+c*2,h:a.height+c*2},p=[{x:f.x,y:f.y,type:"nw-resize"},{x:f.x+f.w,y:f.y,type:"ne-resize"},{x:f.x+f.w,y:f.y+f.h,type:"se-resize"},{x:f.x,y:f.y+f.h,type:"sw-resize"},{x:0,y:f.y-u,type:"rotate"}],b=Math.cos(x),j=Math.sin(x);return p.map(E=>({x:a.cx+(E.x*b-E.y*j),y:a.cy+(E.x*j+E.y*b),type:E.type,size:E.type==="rotate"?24:y}))},Ui=(i,t,a)=>{if(!a)return null;const c=Nt.current;if(!c)return null;const y=c.getContext("2d"),u=Mo(y,a);for(const x of u){const f=i-x.x,p=t-x.y;if(Math.sqrt(f*f+p*p)<=x.size/2)return x.type}return null},Ee=g.useCallback(()=>{if(Et>0){const i=Wt[Et-1];$(i.elements),ot(i.selectedElement),Tt(Et-1)}},[Wt,Et]),xe=g.useCallback(()=>{if(Et<Wt.length-1){const i=Wt[Et+1];$(i.elements),ot(i.selectedElement),Tt(Et+1)}},[Wt,Et]),Kt=i=>Vt?Math.round(i/He)*He:i;g.useEffect(()=>{if(Q!=null&&Q.sectionImage){pe.current=null,O.current=null;const i=Nt.current;if(i&&i.getContext("2d").clearRect(0,0,B,X),w&&!Me)return;const t=new Image;t.crossOrigin="anonymous",t.onload=()=>{pe.current=t,O.current=t,dt()},t.onerror=()=>{console.error("Failed to load background image:",Q.sectionImage),dt()},t.src=Q.sectionImage}else pe.current=null,O.current=null,dt()},[Q,Me]),g.useEffect(()=>{const i=t=>{const a=document.activeElement;if(!(a&&(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.tagName==="SELECT"||a.isContentEditable))){if((t.key==="Delete"||t.key==="Backspace")&&v&&!n){t.preventDefault();const y=v;$(u=>u.filter(x=>x.id!==y.id)),ot(null),yt()}if(t.ctrlKey||t.metaKey)switch(t.key){case"z":t.shiftKey?(t.preventDefault(),xe()):(t.preventDefault(),Ee());break;case"y":t.preventDefault(),xe();break}}};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}},[v,n,Ee,xe,yt]);const Rt=()=>`element_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,Ao=i=>{i.strokeStyle="#e0e0e0",i.lineWidth=1,i.setLineDash([1,1]);for(let t=0;t<=B;t+=He)i.beginPath(),i.moveTo(t,0),i.lineTo(t,X),i.stroke();for(let t=0;t<=X;t+=He)i.beginPath(),i.moveTo(0,t),i.lineTo(B,t),i.stroke();i.setLineDash([])},Eo=(i,t)=>{i.save();const a=t.x+t.width/2,c=t.y+t.height/2;switch(i.translate(a,c),t.rotation&&i.rotate(t.rotation*Math.PI/180),i.translate(-t.width/2,-t.height/2),t.type){case"text":Ro(i,t);break;case"rectangle":Wo(i,t);break;case"circle":Bo(i,t);break;case"triangle":Po(i,t);break;case"star":Oo(i,t);break;case"arrow":Ho(i,t);break;case"diamond":$o(i,t);break;case"hexagon":_o(i,t);break;case"pentagon":Vo(i,t);break;case"heart":Go(i,t);break;case"oval":Uo(i,t);break;case"roundedRectangle":Yo(i,t);break;case"image":Xo(i,t);break;case"qrcode":Lo(i,t);break;case"barcode":Io(i,t);break;case"sticker":Qo(i,t);break;case"horizontalLine":qo(i,t);break;case"embroidery":Ko(i,t);break}i.restore()},Io=(i,t)=>{if(t.imageObject)i.drawImage(t.imageObject,0,0,t.width,t.height);else if(t.src&&!t.imageLoading){t.imageLoading=!0;const a=new Image;a.onload=()=>{$(c=>c.map(y=>y.id===t.id?{...y,imageObject:a,imageLoading:!1}:y))},a.onerror=()=>{$(c=>c.map(y=>y.id===t.id?{...y,imageLoading:!1}:y))},a.src=t.src,i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Your customization",t.width/2,t.height/2)}else t.imageLoading?(i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Your customization",t.width/2,t.height/2)):(i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("No Barcode",t.width/2,t.height/2))},Lo=(i,t)=>{if(t.imageObject)i.drawImage(t.imageObject,0,0,t.width,t.height);else if(t.src&&!t.imageLoading){t.imageLoading=!0;const a=new Image;a.onload=()=>{$(c=>c.map(y=>y.id===t.id?{...y,imageObject:a,imageLoading:!1}:y))},a.onerror=()=>{$(c=>c.map(y=>y.id===t.id?{...y,imageLoading:!1}:y))},a.src=t.src,i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Loading QR...",t.width/2,t.height/2)}else t.imageLoading?(i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Loading QR...",t.width/2,t.height/2)):(i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("No QR Data",t.width/2,t.height/2))},Do=(i,t,a,c,y=!1)=>{const u=Array.from(t);if(u.length===0)return;const x=a.fontSize||20,f=u.map(zt=>i.measureText(zt).width),p=f.reduce((zt,Gt)=>zt+Gt,0)||1,b=Math.max(1e-4,Math.abs(a.curve)*Math.PI/180),j=p/b,E=a.curve>=0?1:-1,P=(c||p)/2,J=E*j+x/2,ft=a.stroke&&a.strokeWidth>0,L=typeof a.textDecoration=="string"?a.textDecoration:"",nt={underline:L.includes("underline")||!!a.underline,overline:L.includes("overline")||!!a.overline,strike:L.includes("line-through")||!!a.strikethrough},Ct=nt.underline||nt.overline||nt.strike,xt=a.decorationColor||a.fill||"#000000",St=Math.max(1,x/20),jt=i.textAlign,Ft=i.textBaseline;i.textAlign="center",i.textBaseline="middle",i.save(),i.translate(P,J),i.rotate(-E*b/2);for(let zt=0;zt<u.length;zt++){const Gt=f[zt]/j;if(i.rotate(E*Gt/2),i.save(),i.translate(0,-E*j),y?ti(i,u[zt],0,{fontSize:x,color:a.fill||"#000000"}):(ft&&i.strokeText(u[zt],0,0),i.fillText(u[zt],0,0)),Ct){const It=f[zt];i.strokeStyle=xt,i.lineWidth=St,i.setLineDash&&i.setLineDash([]),nt.underline&&(i.beginPath(),i.moveTo(-It/2,x/2+2),i.lineTo(It/2,x/2+2),i.stroke()),nt.overline&&(i.beginPath(),i.moveTo(-It/2,-(x/2+2)),i.lineTo(It/2,-(x/2+2)),i.stroke()),nt.strike&&(i.beginPath(),i.moveTo(-It/2,0),i.lineTo(It/2,0),i.stroke())}i.restore(),i.rotate(E*Gt/2)}i.restore(),i.textAlign=jt,i.textBaseline=Ft},Ro=(i,t)=>{i.save();let a=t.text||"Text";if(t.textTransform)switch(t.textTransform){case"uppercase":a=a.toUpperCase();break;case"lowercase":a=a.toLowerCase();break;case"capitalize":a=a.replace(/\b\w/g,p=>p.toUpperCase());break}i.font=`${t.fontStyle||"normal"} ${t.fontWeight||"normal"} ${t.fontSize||20}px ${t.fontFamily||"Arial"}`,i.letterSpacing=`${t.letterSpacing||0}px`,i.fillStyle=t.fill||"#000000",i.textAlign=t.textAlign||"left",i.textBaseline="top",t.opacity!==void 0&&(i.globalAlpha=t.opacity),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth);const c=a.split(`
55
- `),y=(t.fontSize||20)*(t.lineHeight||1.2),u=Math.max(...c.map(p=>i.measureText(p).width)),x=c.length*y;if(t.backgroundColor&&t.backgroundColor!=="transparent"){i.fillStyle=t.backgroundColor;const p=t.backgroundPadding||4;i.fillRect(-p,-p,u+p*2,x+p*2),i.fillStyle=t.fill||"#000000"}(t.hasTextShadow||t.textShadowColor)&&(i.shadowColor=t.textShadowColor||"rgba(0,0,0,0.5)",i.shadowBlur=t.textShadowBlur!=null?t.textShadowBlur:4,i.shadowOffsetX=t.textShadowX!=null?t.textShadowX:2,i.shadowOffsetY=t.textShadowY!=null?t.textShadowY:2);const f=Li(h)&&t.type==="text"&&!t.isIcon;if(t.curve&&Math.abs(t.curve)>=1){Do(i,c.join(" "),t,u,f),i.restore();return}c.forEach((p,b)=>{const j=b*y,E=i.measureText(p).width;f?ti(i,p,j,{fontSize:t.fontSize||20,color:t.fill||"#000000"}):(t.stroke&&t.strokeWidth>0&&i.strokeText(p,0,j),i.fillText(p,0,j));const P=t.fontSize||20,J=t.decorationColor||t.fill||"#000000",ft=Math.max(1,P/20);if(i.strokeStyle=J,i.lineWidth=ft,t.textDecoration==="underline"||t.underline){const L=j+P+2;i.beginPath(),i.moveTo(0,L),i.lineTo(E,L),i.stroke()}if(t.textDecoration==="overline"||t.overline){const L=j-2;i.beginPath(),i.moveTo(0,L),i.lineTo(E,L),i.stroke()}if(t.textDecoration==="line-through"||t.strikethrough){const L=j+P/2;i.beginPath(),i.moveTo(0,L),i.lineTo(E,L),i.stroke()}typeof t.textDecoration=="string"&&t.textDecoration.includes(" ")&&t.textDecoration.split(" ").forEach(nt=>{switch(nt.trim()){case"underline":const Ct=j+P+2;i.beginPath(),i.moveTo(0,Ct),i.lineTo(E,Ct),i.stroke();break;case"overline":const xt=j-2;i.beginPath(),i.moveTo(0,xt),i.lineTo(E,xt),i.stroke();break;case"line-through":const St=j+P/2;i.beginPath(),i.moveTo(0,St),i.lineTo(E,St),i.stroke();break}})}),i.restore()},Wo=(i,t)=>{t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fillRect(0,0,t.width,t.height)),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.strokeRect(0,0,t.width,t.height))},Bo=(i,t)=>{const a=Math.min(t.width,t.height)/2,c=t.width/2,y=t.height/2;i.beginPath(),i.arc(c,y,a,0,2*Math.PI),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Po=(i,t)=>{const a=t.width/2;t.height/2,i.beginPath(),i.moveTo(a,0),i.lineTo(0,t.height),i.lineTo(t.width,t.height),i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Oo=(i,t)=>{const a=t.width/2,c=t.height/2,y=Math.min(t.width,t.height)/2,u=y*.4,x=t.numPoints||5;i.beginPath();for(let f=0;f<x*2;f++){const p=f%2===0?y:u,b=f*Math.PI/x,j=a+Math.cos(b)*p,E=c+Math.sin(b)*p;f===0?i.moveTo(j,E):i.lineTo(j,E)}i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Ho=(i,t)=>{const a=t.width,c=t.height,y=a*.3;i.beginPath(),i.moveTo(a/2,0),i.lineTo(a,c*.6),i.lineTo(a-y,c*.6),i.lineTo(a-y,c),i.lineTo(y,c),i.lineTo(y,c*.6),i.lineTo(0,c*.6),i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},$o=(i,t)=>{const a=t.width/2,c=t.height/2;i.beginPath(),i.moveTo(a,0),i.lineTo(t.width,c),i.lineTo(a,t.height),i.lineTo(0,c),i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},_o=(i,t)=>{const a=t.width/2,c=t.height/2,y=Math.min(t.width,t.height)/2,u=6;i.beginPath();for(let x=0;x<u;x++){const f=x*2*Math.PI/u-Math.PI/2,p=a+y*Math.cos(f),b=c+y*Math.sin(f);x===0?i.moveTo(p,b):i.lineTo(p,b)}i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Vo=(i,t)=>{const a=t.width/2,c=t.height/2,y=Math.min(t.width,t.height)/2,u=5;i.beginPath();for(let x=0;x<u;x++){const f=x*2*Math.PI/u-Math.PI/2,p=a+y*Math.cos(f),b=c+y*Math.sin(f);x===0?i.moveTo(p,b):i.lineTo(p,b)}i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Go=(i,t)=>{const a=t.width,c=t.height,y=0,u=0;i.beginPath();const x=c*.3;i.moveTo(y+a/2,u+x),i.bezierCurveTo(y+a/2,u,y,u,y,u+x),i.bezierCurveTo(y,u+(c+x)/2,y+a/2,u+(c+x)/2,y+a/2,u+c),i.bezierCurveTo(y+a/2,u+(c+x)/2,y+a,u+(c+x)/2,y+a,u+x),i.bezierCurveTo(y+a,u,y+a/2,u,y+a/2,u+x),i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Uo=(i,t)=>{const a=t.width/2,c=t.height/2,y=t.width/2,u=t.height/2;i.beginPath(),i.ellipse(a,c,y,u,0,0,2*Math.PI),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Yo=(i,t)=>{const a=Math.min(t.width,t.height)*.1;te(i,0,0,t.width,t.height,a),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},qo=(i,t)=>{i.save(),t.opacity!==void 0&&(i.globalAlpha=t.opacity),i.strokeStyle=t.stroke||t.fill||"#000000",i.lineWidth=t.strokeWidth||t.height||2,i.lineCap="round",i.beginPath(),i.moveTo(0,t.height/2),i.lineTo(t.width,t.height/2),i.stroke(),i.restore()},Xo=(i,t)=>{const a=t.src||t.imageData;if(a)try{if(a instanceof HTMLImageElement){if(a.complete&&a.naturalWidth>0&&a.naturalHeight>0){i.drawImage(a,0,0,t.width,t.height);return}}else if(typeof a=="string"&&a.length>0){if(t._imageElement instanceof HTMLImageElement||(t._imageElement=new Image,t._imageElement.crossOrigin="anonymous",t._imageElement.onload=()=>{dt()},t._imageElement.onerror=()=>{console.error("Failed to load image:",a),t._imageLoadError=!0,dt()},t._imageElement.src=a),t._imageElement.complete&&t._imageElement.naturalWidth>0&&t._imageElement.naturalHeight>0){i.drawImage(t._imageElement,0,0,t.width,t.height);return}if(t._imageLoadError){i.fillStyle="#ffebee",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#f44336",i.lineWidth=2,i.strokeRect(0,0,t.width,t.height),i.fillStyle="#f44336",i.font="14px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Error loading image",t.width/2,t.height/2);return}}i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.lineWidth=1,i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="14px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Your customization",t.width/2,t.height/2)}catch(c){console.error("Error drawing image:",c),i.fillStyle="#ffebee",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#f44336",i.lineWidth=2,i.strokeRect(0,0,t.width,t.height),i.fillStyle="#f44336",i.font="14px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Error loading image",t.width/2,t.height/2)}else i.fillStyle="#f8f8f8",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ddd",i.lineWidth=1,i.strokeRect(0,0,t.width,t.height),i.fillStyle="#999",i.font="14px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("No Image",t.width/2,t.height/2)},Qo=(i,t)=>{const a=t.src;if(a)try{if(a instanceof HTMLImageElement){if(a.complete&&a.naturalWidth>0&&a.naturalHeight>0){i.drawImage(a,0,0,t.width,t.height);return}}else if(typeof a=="string"&&a.length>0){if(t._stickerElement instanceof HTMLImageElement||(t._stickerElement=new Image,t._stickerElement.crossOrigin="anonymous",t._stickerElement.onload=()=>{dt()},t._stickerElement.onerror=()=>{console.error("Failed to load sticker:",a),t._stickerLoadError=!0,dt()},t._stickerElement.src=a),t._stickerElement.complete&&t._stickerElement.naturalWidth>0&&t._stickerElement.naturalHeight>0){i.drawImage(t._stickerElement,0,0,t.width,t.height);return}if(t._stickerLoadError){$e(i,t,"Failed to load",!0);return}}$e(i,t,"Your customization")}catch(c){console.error("Error drawing sticker:",c),$e(i,t,"Error",!0)}else $e(i,t,"No Sticker")},$e=(i,t,a,c=!1)=>{i.fillStyle=c?"#ffebee":"#f8f9fa",i.fillRect(0,0,t.width,t.height),i.strokeStyle=c?"#f44336":"#dee2e6",i.lineWidth=2,i.strokeRect(0,0,t.width,t.height),i.fillStyle=c?"#f44336":"#6c757d",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText(a,t.width/2,t.height/2)},Ko=(i,t)=>{if(t.imageObject&&t.imageObject.complete&&t.imageObject.naturalHeight!==0)try{i.drawImage(t.imageObject,0,0,t.width,t.height)}catch(a){console.error("Error drawing embroidery image:",a),Ie(i,t,"Error loading image")}else if(t.src&&!t.imageLoading){t.imageLoading=!0;const a=new Image;a.crossOrigin="anonymous",a.onload=()=>{a.complete&&a.naturalHeight!==0?(t.imageObject=a,t.imageLoading=!1,dt()):(t.imageLoading=!1,console.error("Image loaded but is invalid:",t.src))},a.onerror=()=>{t.imageLoading=!1,console.error("Failed to load embroidery image:",t.src),Ie(i,t,"Failed to load")},a.src=t.src,Ie(i,t,"Your customization")}else t.imageLoading?Ie(i,t,"Your customization"):Ie(i,t)},Ie=(i,t,a="Embroidery")=>{i.fillStyle="#f9f9f9",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ddd",i.lineWidth=2,i.strokeRect(0,0,t.width,t.height),i.fillStyle="#999",i.font="24px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("🧵",t.width/2,t.height/2-10),i.fillStyle="#666",i.font="12px Arial",i.fillText(a,t.width/2,t.height/2+15)},di=(i,t,a)=>{if(!a)return!1;const c=a.x+a.width/2,y=a.y+a.height/2,u=i-c,x=t-y,f=-(a.rotation||0)*Math.PI/180,p=Math.cos(f),b=Math.sin(f),j=u*p-x*b,E=u*b+x*p,P=a.width/2,J=a.height/2;return j>=-P&&j<=P&&E>=-J&&E<=J},Yi=g.useCallback(()=>{if(Qt.current){const a=Qt.current;Qt.current=null;const c=Math.min(a.x0,a.x1),y=Math.min(a.y0,a.y1),u=Math.abs(a.x1-a.x0),x=Math.abs(a.y1-a.y0);if(u>3&&x>3){const f=I.filter(b=>{const j=b.width||0,E=b.height||0;return b.x<c+u&&b.x+j>c&&b.y<y+x&&b.y+E>y}),p=f.map(b=>b.id);ut(p),ot(p.length?f[f.length-1]:null)}qt()}(U||it||at)&&yt(),ze.current=null,Bt.current={v:[],h:[]},si.current=[],ni.current=[],li.current=null,Z(!1),st(!1),F(!1),R(null);const i=Dt.current;if(Dt.current=null,i&&!At.current&&!wt.current){const a=I.find(c=>c.id===i);a&&a.type==="text"&&!a.isIcon&&!a.locked&&be(a)}At.current=!1;const t=Nt.current;t&&(t.style.cursor="default")},[U,it,at,yt,I]);g.useEffect(()=>{const i=t=>{if(n)return;const a=document.activeElement;if(a&&(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.tagName==="SELECT"||a.isContentEditable))return;const y=ct.length>1?ct:v?[v.id]:[];if(!wt.current&&v&&v.type==="text"&&!v.isIcon&&ct.length<=1&&!t.ctrlKey&&!t.metaKey&&!t.altKey){if(t.key==="Enter"||t.key==="F2"){t.preventDefault(),be(v);return}if(t.key.length===1){t.preventDefault();const u={...v,text:t.key};se(v.id,{text:t.key}),be(u);return}}if((t.ctrlKey||t.metaKey)&&(t.key==="z"&&!t.shiftKey?(t.preventDefault(),Ee()):(t.key==="z"&&t.shiftKey||t.key==="y")&&(t.preventDefault(),xe())),t.key==="Delete"||t.key==="Backspace"){const u=y.filter(x=>{const f=I.find(p=>p.id===x);return f&&!f.locked});u.length&&($(x=>x.filter(f=>!u.includes(f.id))),ot(null),ut([]),yt(),t.preventDefault())}if((t.ctrlKey||t.metaKey)&&t.key==="d"&&v&&(gi(v.id),t.preventDefault()),t.key==="Escape"&&(v||y.length)&&(ot(null),ut([]),t.preventDefault()),(t.ctrlKey||t.metaKey)&&t.key==="c"&&y.length&&(_i.current=y.map(u=>I.find(x=>x.id===u)).filter(Boolean).map(u=>({...u})),t.preventDefault()),(t.ctrlKey||t.metaKey)&&t.key==="v"){const u=_i.current;if(u&&u.length){const x=u.map(f=>({...f,id:Rt(),x:(f.x||0)+20,y:(f.y||0)+20}));$(f=>[...f,...x]),ut(x.length>1?x.map(f=>f.id):[]),ot(x[x.length-1]),yt(),t.preventDefault()}}if(y.length&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(t.key)){t.preventDefault();const u=t.shiftKey?10:1;let x=0,f=0;switch(t.key){case"ArrowUp":f=-u;break;case"ArrowDown":f=u;break;case"ArrowLeft":x=-u;break;case"ArrowRight":x=u;break}const p=y.filter(b=>{const j=I.find(E=>E.id===b);return j&&!j.locked});if(p.length)if($(b=>b.map(j=>p.includes(j.id)?{...j,x:j.x+x,y:j.y+f}:j)),ot(b=>b&&p.includes(b.id)?{...b,x:b.x+x,y:b.y+f}:b),yt(),p.length===1&&v){const b=v.x+x,j=v.y+f,E=Pi(B,Mt),P=J=>J>=10?Math.round(J).toString():J>=1?J.toFixed(1):J.toFixed(2);Fe.current={cx:b+(v.width||0)/2,y:j+(v.height||0)+8,label:E>0?`x ${P(b*E)}" y ${P(j*E)}"`:`x ${Math.round(b)} y ${Math.round(j)}`},qt(),Ne.current&&clearTimeout(Ne.current),Ne.current=setTimeout(()=>{Fe.current=null,qt()},1e3)}else qt()}};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[v,ct,I,Ee,xe,n,B,Mt]);const hi=(i,t={})=>{const a={id:Rt(),type:i,x:50,y:50,width:100,height:100,fill:"#000000",stroke:"#000000",strokeWidth:0,rotation:0,...t};switch(i){case"text":a.id=Rt(),a.text=t.text||"New Text",a.fontSize=t.fontSize||20,a.fontFamily=t.fontFamily||"Arial",a.fontWeight=t.fontWeight||"normal",a.fontStyle=t.fontStyle||"normal",a.textAlign=t.textAlign||"left",a.width=t.width||150,a.height=t.height||50;break;case"icon":a.id=Rt(),a.text=t.text||"🎯",a.fontSize=t.fontSize||48,a.fontFamily=t.fontFamily||"Arial",a.fontWeight=t.fontWeight||"normal",a.fontStyle=t.fontStyle||"normal",a.textAlign="center",a.width=80,a.height=80,a.iconData=t.iconData||null,a.type="text",a.isIcon=!0;break;case"image":a.id=Rt(),a.imageData=t.imageData||null,a.width=t.width||200,a.height=t.height||200;break;case"qrcode":a.id=Rt(),a.type="qrcode",a.x=(t==null?void 0:t.x)||B/2-((t==null?void 0:t.width)||100)/2,a.y=(t==null?void 0:t.y)||X/2-((t==null?void 0:t.height)||100)/2,a.width=(t==null?void 0:t.width)||100,a.height=(t==null?void 0:t.height)||100,a.src=(t==null?void 0:t.src)||"",a.data=(t==null?void 0:t.data)||"",a.rotation=0,a.opacity=1;break;case"barcode":a.id=Rt(),a.type="barcode",a.x=(t==null?void 0:t.x)||B/2-((t==null?void 0:t.width)||200)/2,a.y=(t==null?void 0:t.y)||X/2-((t==null?void 0:t.height)||100)/2,a.width=(t==null?void 0:t.width)||200,a.height=(t==null?void 0:t.height)||100,a.src=(t==null?void 0:t.src)||"",a.data=(t==null?void 0:t.data)||"",a.format=(t==null?void 0:t.format)||"CODE128",a.rotation=0,a.opacity=1,a.imageObject=(t==null?void 0:t.imageObject)||null;break;case"sticker":a.id=Rt(),a.type="sticker",a.imageData=(t==null?void 0:t.imageData)||null,a.width=t.width||200,a.height=t.height||200;break;case"horizontalLine":a.id=Rt(),a.type="horizontalLine",a.x=B/2-100,a.y=X/2-1,a.width=200,a.height=2,a.fill="#000000",a.stroke="#000000",a.strokeWidth=2,a.rotation=0,a.opacity=1;break;case"embroidery":a.id=Rt(),a.type="embroidery",a.imageData=(t==null?void 0:t.imageData)||null,a.width=t.width||200,a.height=t.height||200;break;case"rectangle":case"circle":case"triangle":case"star":case"arrow":case"diamond":case"hexagon":case"pentagon":case"heart":case"oval":case"roundedRectangle":break;default:console.warn(`Unknown element type: ${i}`);return}t.x==null&&(a.x=Math.max(0,B/2-(a.width||0)/2)),t.y==null&&(a.y=Math.max(0,X/2-(a.height||0)/2)),$(c=>[...c,a]),ot(a),yt(),a.type==="text"&&!a.isIcon&&be(a)},Zo=()=>{hi("text",{text:"Your text",fontSize:32,width:220,height:48,x:B/2-220/2,y:X/2-48/2})},Jo=()=>{const i=document.createElement("input");i.type="file",i.accept="image/*",i.onchange=t=>{const a=t.target.files&&t.target.files[0];a&&a.type.startsWith("image/")&&xi(a)},i.click()},se=(i,t)=>{$(a=>a.map(c=>c.id===i?{...c,...t}:c)),v&&v.id===i&&ot(a=>({...a,...t}))},be=g.useCallback(i=>{n||!i||i.type!=="text"||i.isIcon||(ot(i),ut([i.id]),gt(i.id))},[n]),fi=g.useCallback(()=>{gt(i=>(i!=null&&yt(),null))},[yt]);g.useEffect(()=>{wt.current=G,Le.current&&Le.current()},[G]),g.useEffect(()=>{if(G&&kt.current){const i=kt.current;i.focus();const t=i.value.length;try{i.setSelectionRange(t,t)}catch{}}},[G]);const qi=async i=>{var u,x,f;if(!i||typeof V!="function")return;const t=i.src||i.image||(i.imageData instanceof HTMLImageElement?i.imageData.src:i.imageData)||((u=i._imageElement)==null?void 0:u.src)||((x=i._stickerElement)==null?void 0:x.src)||((f=i._embroideryElement)==null?void 0:f.src);if(!t)throw new Error("No image to process");const a=await V(t),c=typeof a=="string"?a:URL.createObjectURL(a),y=new Image;y.crossOrigin="anonymous",await new Promise((p,b)=>{y.onload=p,y.onerror=()=>b(new Error("Processed image failed to load")),y.src=c}),se(i.id,{src:c,image:c,imageData:c,_imageElement:null,_stickerElement:null,_embroideryElement:null,_imageLoadError:!1,originalWidth:y.naturalWidth,originalHeight:y.naturalHeight,bgRemoved:!0}),yt(),dt()},ui=g.useCallback(()=>{v&&($(i=>i.filter(t=>t.id!==v.id)),ot(null),yt())},[v,yt]),gi=i=>{const t=I.find(a=>a.id===i);if(t){const a={...t,id:Rt(),x:t.x+20,y:t.y+20};$(c=>[...c,a]),ot(a),yt()}},ta=i=>{const t=i||(v==null?void 0:v.id);t&&($(a=>a.map(c=>c.id===t?{...c,locked:!c.locked}:c)),ot(a=>a&&a.id===t?{...a,locked:!a.locked}:a),yt())},Xi=i=>{if(!v||v.locked)return;const t={width:Math.max(10,(v.width||0)*i),height:Math.max(10,(v.height||0)*i)};(v.type==="text"||v.isIcon)&&(t.fontSize=Math.max(6,Math.round((v.fontSize||20)*i))),se(v.id,t),yt()},Qi=i=>{if(!v||v.locked)return;const t=(((v.rotation||0)+i)%360+360)%360;se(v.id,{rotation:t}),yt()},Ki=i=>{const t=I.filter(c=>ct.includes(c.id));if(t.length<2)return;const a={};i(t,a),$(c=>c.map(y=>a[y.id]?{...y,...a[y.id]}:y)),ot(c=>c&&a[c.id]?{...c,...a[c.id]}:c),yt()},ea=i=>Ki((t,a)=>{const c=Math.min(...t.map(b=>b.x)),y=Math.max(...t.map(b=>b.x+(b.width||0))),u=Math.min(...t.map(b=>b.y)),x=Math.max(...t.map(b=>b.y+(b.height||0))),f=(c+y)/2,p=(u+x)/2;t.forEach(b=>{b.locked||(i==="left"?a[b.id]={x:c}:i==="right"?a[b.id]={x:y-(b.width||0)}:i==="hcenter"?a[b.id]={x:f-(b.width||0)/2}:i==="top"?a[b.id]={y:u}:i==="bottom"?a[b.id]={y:x-(b.height||0)}:i==="vcenter"&&(a[b.id]={y:p-(b.height||0)/2}))})}),ia=i=>Ki((t,a)=>{if(t.length<3)return;const c=P=>i==="h"?P.width||0:P.height||0,y=P=>i==="h"?P.x:P.y,u=[...t].sort((P,J)=>y(P)-y(J)),x=u[0],f=u[u.length-1],p=y(f)+c(f)-y(x),b=u.reduce((P,J)=>P+c(J),0),j=(p-b)/(u.length-1);let E=y(x)+c(x)+j;u.forEach((P,J)=>{J===0||J===u.length-1||(P.locked||(a[P.id]=i==="h"?{x:E}:{y:E}),E+=c(P)+j)})}),oa=()=>{ct.length&&($(i=>i.filter(t=>!ct.includes(t.id))),ot(null),ut([]),yt())},Zi=(i,t)=>{const a=I.findIndex(u=>u.id===i);if(a===-1)return;const c=[...I],y=c[a];t==="up"&&a<c.length-1?(c[a]=c[a+1],c[a+1]=y):t==="down"&&a>0?(c[a]=c[a-1],c[a-1]=y):t==="top"?(c.splice(a,1),c.push(y)):t==="bottom"&&(c.splice(a,1),c.unshift(y)),$(c),yt()};g.useCallback(()=>{Q&&me(i=>({...i,[Q.sectionName]:{elements:[...I],selectedColor:$t}}))},[Q,I,$t]);const[,aa]=g.useReducer(i=>i+1,0);setTimeout(()=>{aa()},20);const ra=g.useCallback(()=>{Q&&me(i=>({...i,[Q.sectionName]:{elements:[...I],selectedColor:$t}}))},[Q,I,$t]);g.useImperativeHandle(o,()=>({handleSectionChange:to,flushCurrentSectionDesign:ra,addImageFromUrl:(i,t={})=>{if(!i)return;const a=t.width||220,c=t.height||220;hi("image",{imageData:i,src:i,width:a,height:c,x:Math.max(0,(B-a)/2),y:Math.max(0,(X-c)/2)})},exportPrintReady:async(i="png")=>await ci(i,!1),exportFullDesign:async(i="png")=>await ci(i,!0),exportDesign:ci,getCanvasData:()=>Ae(),exportAllDesignsAsJSON:async(i="png")=>{try{const t=Ae(),a=(Q==null?void 0:Q.sectionName)||"main",c={elements:t.elements,selectedColor:t.selectedColor,canvasWidth:t.canvasWidth,canvasHeight:t.canvasHeight},y={...t.sectionDesigns||{},[a]:c},u=h.sections&&h.sections.length>0?h.sections:[{id:a,sectionName:a,image:Q==null?void 0:Q.sectionImage,sectionImage:Q==null?void 0:Q.sectionImage}];return await Te.current.exportAllSectionsAsJSON(y,u,B,X,i,Me,ge)}catch(t){throw console.error("Export as JSON failed:",t),t}},exportCurrentSectionAsJSON:async(i="png")=>{try{const t=Ae();return await Te.current.exportCurrentSectionAsJSON(t,i,Me,ge)}catch(t){throw console.error("Export current section as JSON failed:",t),t}}}));const Yt=g.useRef(null),mi=g.useRef(!1),dt=g.useCallback(()=>{const i=Nt.current;if(!i||mi.current)return;mi.current=!0;const t=i.getContext("2d");if(t.clearRect(0,0,B,X),O.current&&Oi(t,O.current,B,X),_t&&Ao(t),I.forEach(f=>{f.id!==wt.current&&(t.save(),t.globalAlpha=f.opacity||1,Eo(t,f),t.restore())}),ct.length>1?(t.save(),t.strokeStyle="#6a45d2",t.lineWidth=1.5,t.setLineDash([4,3]),ct.forEach(f=>{const p=I.find(E=>E.id===f);if(!p)return;const b=ye(t,p),j=4;t.save(),t.translate(b.cx,b.cy),p.rotation&&t.rotate(p.rotation*Math.PI/180),t.strokeRect(-b.width/2-j,-b.height/2-j,b.width+j*2,b.height+j*2),t.restore()}),t.restore()):v&&v.id!==wt.current&&To(t,v),Qt.current){const f=Qt.current,p=Math.min(f.x0,f.x1),b=Math.min(f.y0,f.y1),j=Math.abs(f.x1-f.x0),E=Math.abs(f.y1-f.y0);t.save(),t.fillStyle="rgba(106,69,210,0.12)",t.strokeStyle="#6a45d2",t.lineWidth=1,t.setLineDash([4,3]),t.fillRect(p,b,j,E),t.strokeRect(p,b,j,E),t.restore()}const a=Bt.current;a&&(a.v&&a.v.length||a.h&&a.h.length)&&(t.save(),t.strokeStyle="#ec4899",t.lineWidth=1,t.setLineDash([5,4]),(a.v||[]).forEach(f=>{t.beginPath(),t.moveTo(f,0),t.lineTo(f,X),t.stroke()}),(a.h||[]).forEach(f=>{t.beginPath(),t.moveTo(0,f),t.lineTo(B,f),t.stroke()}),t.restore());const c=si.current;c&&c.length&&(t.save(),t.strokeStyle="#ef4444",t.fillStyle="#ef4444",t.lineWidth=1,t.font="11px sans-serif",t.textAlign="center",t.textBaseline="middle",c.forEach(f=>{t.beginPath(),t.moveTo(f.x1,f.y1),t.lineTo(f.x2,f.y2),t.stroke();const p=f.y1===f.y2,b=4;t.beginPath(),p?(t.moveTo(f.x1,f.y1-b),t.lineTo(f.x1,f.y1+b),t.moveTo(f.x2,f.y2-b),t.lineTo(f.x2,f.y2+b)):(t.moveTo(f.x1-b,f.y1),t.lineTo(f.x1+b,f.y1),t.moveTo(f.x2-b,f.y2),t.lineTo(f.x2+b,f.y2)),t.stroke();const j=(f.x1+f.x2)/2,E=(f.y1+f.y2)/2,P=`${f.label}`,ft=t.measureText(P).width+8,L=15;t.fillStyle="#ef4444",te(t,j-ft/2,E-L/2,ft,L,3),t.fill(),t.fillStyle="#ffffff",t.fillText(P,j,E+.5),t.fillStyle="#ef4444"}),t.restore());const y=ni.current;y&&y.length&&(t.save(),t.strokeStyle="#a855f7",t.fillStyle="#a855f7",t.lineWidth=1,t.font="11px sans-serif",t.textAlign="center",t.textBaseline="middle",y.forEach(f=>{t.beginPath(),t.moveTo(f.x1,f.y1),t.lineTo(f.x2,f.y2),t.stroke();const p=f.y1===f.y2,b=4;t.beginPath(),p?(t.moveTo(f.x1,f.y1-b),t.lineTo(f.x1,f.y1+b),t.moveTo(f.x2,f.y2-b),t.lineTo(f.x2,f.y2+b)):(t.moveTo(f.x1-b,f.y1),t.lineTo(f.x1+b,f.y1),t.moveTo(f.x2-b,f.y2),t.lineTo(f.x2+b,f.y2)),t.stroke();const j=(f.x1+f.x2)/2,E=(f.y1+f.y2)/2,P=`${f.label}`,ft=t.measureText(P).width+8,L=15;t.fillStyle="#a855f7",te(t,j-ft/2,E-L/2,ft,L,3),t.fill(),t.fillStyle="#ffffff",t.fillText(P,j,E+.5),t.fillStyle="#a855f7"}),t.restore());const u=li.current;if(u){t.save(),t.font="11px sans-serif",t.textAlign="center",t.textBaseline="middle";const p=t.measureText(u.label).width+10,b=16,j=Math.max(p/2,Math.min(B-p/2,u.cx)),E=Math.min(X-b/2,u.y+b/2);t.fillStyle="#1d4ed8",te(t,j-p/2,E-b/2,p,b,3),t.fill(),t.fillStyle="#ffffff",t.fillText(u.label,j,E+.5),t.restore()}const x=Fe.current;if(x){t.save(),t.font="11px sans-serif",t.textAlign="center",t.textBaseline="middle";const p=t.measureText(x.label).width+10,b=16,j=Math.max(p/2,Math.min(B-p/2,x.cx)),E=Math.min(X-b/2,x.y+b/2);t.fillStyle="#1d4ed8",te(t,j-p/2,E-b/2,p,b,3),t.fill(),t.fillStyle="#ffffff",t.fillText(x.label,j,E+.5),t.restore()}mi.current=!1},[I,v,ct,B,X,_t]),Le=g.useRef(dt);g.useEffect(()=>{Le.current=dt},[dt]);const Ji=g.useRef(!1);g.useEffect(()=>{Ji.current=U||it||at},[U,it,at]);const qt=g.useCallback(()=>{Yt.current&&cancelAnimationFrame(Yt.current),Yt.current=requestAnimationFrame(()=>{Le.current(),Yt.current=null})},[]);g.useEffect(()=>{Te.current&&(Te.current.embroidery=Li(h))},[h]),g.useEffect(()=>{const i=(I||[]).filter(a=>a&&a.type==="text"&&a.fontFamily).map(a=>a.fontFamily);if(i.length===0)return;let t=!1;return $i(i).then(()=>{t||dt()}),()=>{t=!0}},[I,dt]),g.useEffect(()=>{qt()},[I,v,ct,B,X,_t,qt]),g.useEffect(()=>{O.current&&qt()},[O.current,qt]),g.useEffect(()=>()=>{Yt.current&&cancelAnimationFrame(Yt.current)},[]);const pi=g.useCallback(()=>{Le.current(),Ji.current&&(Yt.current=requestAnimationFrame(pi))},[]);g.useEffect(()=>{U||it||at?pi():(Yt.current&&(cancelAnimationFrame(Yt.current),Yt.current=null),qt())},[U,it,at,pi,qt]);const sa=g.useCallback(i=>{if(n)return;const t=Nt.current,a=t.getBoundingClientRect(),c=(i.clientX-a.left)/mt,y=(i.clientY-a.top)/mt;if(i.pointerId!=null&&t.setPointerCapture)try{t.setPointerCapture(i.pointerId)}catch{}if(Fe.current&&(Fe.current=null,Ne.current&&clearTimeout(Ne.current)),At.current=!1,Dt.current=null,bt({x:c,y}),v&&!v.locked&&ct.length<=1){const f=Ui(c,y,v);if(f){if(f==="rotate"){F(!0);const p=v.x+v.width/2,b=v.y+v.height/2,j=Math.atan2(y-b,c-p)*180/Math.PI;bt({x:c,y,initialAngle:j,initialRotation:v.rotation||0})}else st(!0),R(f),bt({x:c,y,initialWidth:v.width,initialHeight:v.height,initialX:v.x,initialY:v.y});return}}let u=null;for(let f=I.length-1;f>=0;f--)if(di(c,y,I[f])){u=I[f];break}const x=ct.length>1?ct:v?[v.id]:[];if(i.shiftKey&&u){const f=x.includes(u.id),p=f?x.filter(j=>j!==u.id):[...x,u.id];ut(p);const b=f?p[p.length-1]:u.id;ot(b&&I.find(j=>j.id===b)||null),dt();return}if(u&&x.length>1&&x.includes(u.id)){const f=I.filter(p=>x.includes(p.id)&&!p.locked);f.length&&(Z(!0),ze.current={startX:c,startY:y,items:f.map(p=>({id:p.id,x:p.x,y:p.y}))},bt({x:c,y}));return}if(u){ze.current=null,ot(u),u.locked||(Z(!0),bt({x:c,y,offsetX:c-u.x,offsetY:y-u.y})),u.type==="text"&&!u.isIcon&&!u.locked&&(Dt.current=u.id),dt();return}ot(null),Qt.current={x0:c,y0:y,x1:c,y1:y},dt()},[n,mt,v,ct,I,dt]),na=g.useCallback(i=>{if(n)return;const a=Nt.current.getBoundingClientRect(),c=(i.clientX-a.left)/mt,y=(i.clientY-a.top)/mt;for(let u=I.length-1;u>=0;u--){const x=I[u];if(x.type==="text"&&!x.isIcon&&di(c,y,x)){be(x);return}}},[n,mt,I,be]),la=g.useCallback(i=>{if(n)return;const t=Nt.current,a=t.getBoundingClientRect(),c=(i.clientX-a.left)/mt,y=(i.clientY-a.top)/mt;if((U||it||at)&&(Math.abs(c-M.x)>2||Math.abs(y-M.y)>2)&&(At.current=!0),Qt.current){Qt.current={...Qt.current,x1:c,y1:y},t.style.cursor="crosshair",dt();return}if(U&&ze.current){const u=ze.current;let x=c-u.startX,f=y-u.startY;const p=L=>{const nt=I.find(Ct=>Ct.id===L);return nt&&nt.width||0},b=L=>{const nt=I.find(Ct=>Ct.id===L);return nt&&nt.height||0},j=Math.min(...u.items.map(L=>L.x)),E=Math.max(...u.items.map(L=>L.x+p(L.id))),P=Math.min(...u.items.map(L=>L.y)),J=Math.max(...u.items.map(L=>L.y+b(L.id)));x=Math.max(-j,Math.min(B-E,x)),f=Math.max(-P,Math.min(X-J,f));const ft={};u.items.forEach(L=>{ft[L.id]={x:L.x+x,y:L.y+f}}),$(L=>L.map(nt=>ft[nt.id]?{...nt,...ft[nt.id]}:nt)),ot(L=>L&&ft[L.id]?{...L,...ft[L.id]}:L),t.style.cursor="grabbing",dt();return}if(v&&!U&&!it&&!at){const u=Ui(c,y,v);u?u==="rotate"?t.style.cursor="grab":t.style.cursor=u:di(c,y,v)?t.style.cursor="move":t.style.cursor="default"}else t.style.cursor=U?"grabbing":"default";if(at&&v){const u=v.x+v.width/2,x=v.y+v.height/2,p=Math.atan2(y-x,c-u)*180/Math.PI-M.initialAngle;let b=M.initialRotation+p;i.shiftKey&&(b=Math.round(b/15)*15),b=(b%360+360)%360,$(j=>j.map(E=>E.id===v.id?{...E,rotation:b}:E)),ot(j=>({...j,rotation:b})),dt();return}if(it&&v&&m){const u=c-M.x,x=y-M.y;let f=M.initialWidth,p=M.initialHeight,b=M.initialX,j=M.initialY;switch(m){case"se-resize":f=Math.max(20,M.initialWidth+u),p=Math.max(20,M.initialHeight+x);break;case"sw-resize":f=Math.max(20,M.initialWidth-u),p=Math.max(20,M.initialHeight+x),b=M.initialX+(M.initialWidth-f);break;case"ne-resize":f=Math.max(20,M.initialWidth+u),p=Math.max(20,M.initialHeight-x),j=M.initialY+(M.initialHeight-p);break;case"nw-resize":f=Math.max(20,M.initialWidth-u),p=Math.max(20,M.initialHeight-x),b=M.initialX+(M.initialWidth-f),j=M.initialY+(M.initialHeight-p);break}if((i.shiftKey||v.lockAspect)&&v.type!=="text"){const L=M.initialWidth/M.initialHeight;m.includes("e"),p=f/L,m.includes("n")&&(j=M.initialY+(M.initialHeight-p))}Vt&&(b=Kt(b),j=Kt(j),f=Kt(f),p=Kt(p));const E={...v,x:b,y:j,width:f,height:p},P=Pi(B,Mt),J=L=>L>=10?Math.round(L).toString():L>=1?L.toFixed(1):L.toFixed(2),ft=P>0?`${J(f*P)}" × ${J(p*P)}"`:`${Math.round(f)} × ${Math.round(p)} px`;li.current={cx:b+f/2,y:j+p+8,label:ft},$(L=>L.map(nt=>nt.id===v.id?E:nt)),ot(E),dt();return}if(U&&v){let u=c-M.offsetX,x=y-M.offsetY;Vt&&(u=Kt(u),x=Kt(x));const f=6/(mt||1),p=v.width,b=v.height,j=I.filter(H=>H.id!==v.id),E=[0,B/2,B],P=[0,X/2,X];j.forEach(H=>{E.push(H.x,H.x+(H.width||0)/2,H.x+(H.width||0)),P.push(H.y,H.y+(H.height||0)/2,H.y+(H.height||0))});const J=(H,ee,_e)=>{const Ve=[0,ee/2,ee];let Se=null;return Ve.forEach(Ge=>{_e.forEach(ie=>{const oe=Math.abs(H+Ge-ie);oe<=f&&(!Se||oe<Se.d)&&(Se={d:oe,snapped:ie-Ge,line:ie})})}),Se},ft={v:[],h:[]},L=J(u,p,E);L&&(u=L.snapped,ft.v.push(L.line));const nt=J(x,b,P);nt&&(x=nt.snapped,ft.h.push(nt.line)),Bt.current=ft,u=Math.max(0,Math.min(B-v.width,u)),x=Math.max(0,Math.min(X-v.height,x));const Ct=()=>{const H=u,ee=u+p,_e=x,Ve=x+b,Se=vt=>Math.min(Ve,vt.y+(vt.height||0))-Math.max(_e,vt.y),Ge=vt=>Math.min(ee,vt.x+(vt.width||0))-Math.max(H,vt.x);let ie=null,oe=null,Ue=null,Ye=null;return j.forEach(vt=>{const Fi=vt.x+(vt.width||0),Ni=vt.y+(vt.height||0);Se(vt)>0&&(Fi<=H&&(!ie||Fi>ie.edge)&&(ie={edge:Fi,el:vt}),vt.x>=ee&&(!oe||vt.x<oe.edge)&&(oe={edge:vt.x,el:vt})),Ge(vt)>0&&(Ni<=_e&&(!Ue||Ni>Ue.edge)&&(Ue={edge:Ni,el:vt}),vt.y>=Ve&&(!Ye||vt.y<Ye.edge)&&(Ye={edge:vt.y,el:vt}))}),{L:ie,R:oe,T:Ue,B:Ye}};let{L:xt,R:St,T:jt,B:Ft}=Ct();if(!L&&xt&&St){const H=(xt.edge+St.edge-p)/2;Math.abs(u-H)<=f&&(u=H)}if(!nt&&jt&&Ft){const H=(jt.edge+Ft.edge-b)/2;Math.abs(x-H)<=f&&(x=H)}u=Math.max(0,Math.min(B-v.width,u)),x=Math.max(0,Math.min(X-v.height,x)),{L:xt,R:St,T:jt,B:Ft}=Ct();const zt=u,Gt=u+p,It=x,ne=x+b,le=H=>(Math.max(It,H.y)+Math.min(ne,H.y+(H.height||0)))/2,ce=H=>(Math.max(zt,H.x)+Math.min(Gt,H.x+(H.width||0)))/2,Si=xt?Math.round(zt-xt.edge):null,vi=St?Math.round(St.edge-Gt):null,wi=jt?Math.round(It-jt.edge):null,ki=Ft?Math.round(Ft.edge-ne):null,ji=xt&&St&&Si===vi,Ci=jt&&Ft&&wi===ki,De=[];if(xt&&!ji){const H=le(xt.el);De.push({x1:xt.edge,y1:H,x2:zt,y2:H,label:Si})}if(St&&!ji){const H=le(St.el);De.push({x1:Gt,y1:H,x2:St.edge,y2:H,label:vi})}if(jt&&!Ci){const H=ce(jt.el);De.push({x1:H,y1:jt.edge,x2:H,y2:It,label:wi})}if(Ft&&!Ci){const H=ce(Ft.el);De.push({x1:H,y1:ne,x2:H,y2:Ft.edge,label:ki})}si.current=De;const Re=[];if(ji){const H=(le(xt.el)+le(St.el))/2;Re.push({x1:xt.edge,y1:H,x2:zt,y2:H,label:Si}),Re.push({x1:Gt,y1:H,x2:St.edge,y2:H,label:vi})}if(Ci){const H=(ce(jt.el)+ce(Ft.el))/2;Re.push({x1:H,y1:jt.edge,x2:H,y2:It,label:wi}),Re.push({x1:H,y1:ne,x2:H,y2:Ft.edge,label:ki})}ni.current=Re;const lo={...v,x:u,y:x};$(H=>H.map(ee=>ee.id===v.id?lo:ee)),ot(lo),dt()}},[n,mt,v,U,it,at,m,M,Vt,B,X,I,dt]),to=g.useCallback(i=>{Q&&me(a=>({...a,[Q.sectionName]:{elements:I.map(c=>c.type==="image"?{...c,imageData:c.imageData,src:c.src}:c),selectedColor:$t}}));const t=Xt[i.sectionName];if(t){const a=t.elements.map(c=>{if(c.type==="image"&&c.src&&!c.imageData){const y=new Image;return y.onload=()=>{$(u=>u.map(x=>x.id===c.id?{...x,imageData:y}:x)),dt()},y.src=c.src,{...c,imageData:y}}return c});$(a),fe(t.selectedColor||$t)}else $([]);Pe(i),ot(null)},[Q,I,$t,Xt,dt]),yi=g.useCallback((i,t)=>{const a={id:Rt(),type:"image",x:Kt(B/2-100),y:Kt(X/2-100),width:Math.min(i.width,200),height:Math.min(i.height,200),rotation:0,imageData:i,src:t,originalWidth:i.width,originalHeight:i.height},c=i.width/i.height;a.width/a.height!==c&&(a.width/c<=200?a.height=a.width/c:a.width=a.height*c),$(y=>[...y,a]),ot(a),yt()},[B,X,Kt,Rt,yt]),xi=g.useCallback(async i=>{if(!i||!i.type.startsWith("image/")){alert("Please select a valid image file.");return}if(typeof D=="function"){const a=URL.createObjectURL(i);try{const c=await D(i),y=typeof c=="string"?c:c&&c.url;if(!y)throw new Error("No URL returned from onUploadImage");const u=new Image;u.crossOrigin="anonymous",await new Promise((x,f)=>{u.onload=x,u.onerror=f,u.src=a}),yi(u,y);return}catch(c){console.error("Upload failed; falling back to inline image",c)}finally{URL.revokeObjectURL(a)}}const t=new FileReader;t.onload=a=>{const c=new Image;c.onload=()=>yi(c,a.target.result),c.onerror=()=>{console.error("Failed to load uploaded image"),alert("Failed to load the uploaded image. Please try again.")},c.src=a.target.result},t.onerror=()=>{console.error("Failed to read file"),alert("Failed to read the file. Please try again.")},t.readAsDataURL(i)},[D,yi]),eo=g.useCallback(Qa(()=>{dt()},16),[dt]);g.useEffect(()=>{No.current||eo()},[I,v,_t,eo]),g.useEffect(()=>{dt()},[dt]);const io=i=>{if(!Ut)return{horizontal:[],vertical:[]};const t=document.querySelector(".ruler-horizontal"),a=document.querySelector(".ruler-vertical");if(!t||!a)return{horizontal:[],vertical:[]};const c=t.getBoundingClientRect(),y=a.getBoundingClientRect(),u=c.width,x=y.height,f=50,p=[],b=[];for(let j=f;j<=u;j+=f)j<=u-20&&p.push({position:j,value:Math.round(j/i)});for(let j=f;j<=x;j+=f)j<=x-15&&b.push({position:j,value:Math.round(j/i)});return{horizontal:p,vertical:b}},[oo,ao]=g.useState({horizontal:[],vertical:[]});g.useEffect(()=>{const i=()=>{setTimeout(()=>{const c=io(mt);ao(c)},50)};i();let t;const a=()=>{clearTimeout(t),t=setTimeout(i,150)};return window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),clearTimeout(t)}},[mt,Ut]),g.useEffect(()=>{if(Ut&&!Jt){const i=setTimeout(()=>{const t=io(mt);ao(t)},100);return()=>clearTimeout(i)}},[Ut,Jt,mt]);const bi=Li(h),ro=bi?qa(I):[],so=e.jsxs(e.Fragment,{children:[e.jsx(Ha,{selectedElement:v,selectedCount:ct.length,onUpdate:se,onMoveLayer:Zi,onAlignSelection:ea,onDistributeSelection:ia,onDeleteSelection:oa,availableFonts:zo,theme:r,isEmbroidery:bi,onFontLoaded:dt,canvasWidth:B,canvasHeight:X,printConfig:Mt,onRemoveBackground:V?qi:null}),l!=="customize"&&e.jsx($a,{elements:I,selectedElement:v,onSelectElement:i=>{ut(i?[i.id]:[]),ot(i)},onMoveLayer:Zi,onDeleteElement:ui,theme:r})]});return e.jsxs("div",{className:"pure-canvas-designer",children:[e.jsx("div",{className:"designer-header",children:e.jsx(La,{onAddElement:hi,onDeleteElement:()=>v&&ui(v.id),onDuplicateElement:()=>v&&gi(v.id),onUndo:Ee,onRedo:xe,onToggleGrid:()=>ve(!_t),onToggleRulers:()=>ae(!Ut),onToggleSnap:()=>re(!Vt),onTogglePrintGuides:()=>oi(i=>!i),onImageUpload:xi,canUndo:Et>0,canRedo:Et<Wt.length-1,showGrid:_t,showRulers:Ut,snapToGrid:Vt,showPrintGuides:ue,selectedElement:v,theme:r,readOnly:n,mode:l,productionMethods:h==null?void 0:h.productionMethods,supportsEmbroidery:h==null?void 0:h.supportsEmbroidery,apiKey:s.apiKey,apiEndpoint:s.apiEndpoint,aiEnabled:N,aiEndpoint:z,onAIImageGenerate:S,aiCreditsRemaining:W,onAddAiCredits:A,isAuthenticated:_,onRequireAuth:K,onRequestCollaboration:q,onOpenUploads:lt})}),bi&&!we&&e.jsxs("div",{role:"note",style:{display:"flex",gap:10,alignItems:"flex-start",margin:"8px 12px",padding:"10px 12px",background:"#fff7ed",border:"1px solid #fed7aa",borderRadius:8,color:"#7c2d12",fontSize:13,lineHeight:1.4},children:[e.jsx("span",{style:{fontSize:16,lineHeight:1},children:"🧵"}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("strong",{children:"Embroidery preview"})," — this is how your design will be stitched. Colours are matched to real thread.",ro.length>0&&e.jsx("ul",{style:{margin:"6px 0 0",paddingLeft:18},children:ro.map((i,t)=>e.jsx("li",{children:i},t))})]}),e.jsx("button",{type:"button",onClick:()=>ke(!0),"aria-label":"Dismiss",style:{background:"none",border:"none",cursor:"pointer",fontSize:18,color:"#9a3412",lineHeight:1},children:"×"})]}),e.jsxs("div",{className:"designer-content",children:[Ut&&!Jt&&e.jsxs("div",{className:"rulers",children:[e.jsx("div",{className:"ruler-horizontal",children:e.jsx("div",{className:"ruler-horizontal-numbers",children:oo.horizontal.map((i,t)=>e.jsx("span",{className:"ruler-number horizontal",style:{left:`${i.position}px`},children:i.value},t))})}),e.jsx("div",{className:"ruler-vertical",children:e.jsx("div",{className:"ruler-vertical-numbers",children:oo.vertical.map((i,t)=>e.jsx("span",{className:"ruler-number vertical",style:{top:`${i.position}px`},children:i.value},t))})})]}),e.jsxs("div",{className:"canvas-container",ref:Oe,onDragOver:i=>{n||i.preventDefault()},onDrop:i=>{var a;if(n)return;i.preventDefault();const t=[...((a=i.dataTransfer)==null?void 0:a.files)||[]].find(c=>c.type.startsWith("image/"));t&&xi(t)},children:[Jt&&e.jsx("button",{type:"button",className:"mobile-panel-toggle","aria-label":"Open tools & properties",title:"Tools & properties",onClick:()=>je(i=>!i),style:{position:"absolute",top:8,right:8,zIndex:40,width:42,height:42,borderRadius:10,border:"1px solid #e2e8f0",background:"#ffffff",boxShadow:"0 2px 10px rgba(0,0,0,0.18)",fontSize:20,lineHeight:1,color:"#334155",cursor:"pointer"},children:"☰"}),!n&&I.length>0&&(()=>{const i=[],t=((Mt==null?void 0:Mt.safeAreaPct)||0)/100;if(t){const c=B*t,y=X*t,u=B*(1-t),x=X*(1-t),f=Nt.current&&Nt.current.getContext("2d"),p=j=>{const E=f?ye(f,j):{x:j.x,y:j.y,width:j.width||0,height:j.height||0,cx:j.x+(j.width||0)/2,cy:j.y+(j.height||0)/2},{x:P,y:J,width:ft,height:L,cx:nt,cy:Ct}=E,xt=(j.rotation||0)*Math.PI/180,St=Math.cos(xt),jt=Math.sin(xt);return[[P,J],[P+ft,J],[P+ft,J+L],[P,J+L]].some(([zt,Gt])=>{const It=zt-nt,ne=Gt-Ct,le=nt+It*St-ne*jt,ce=Ct+It*jt+ne*St;return le<c-.5||ce<y-.5||le>u+.5||ce>x+.5})};I.some(p)&&i.push({key:"safe",text:"Some artwork is outside the safe print area and may be cut off."})}return I.some(c=>{var u;const y=ko(c,B,Mt);return y!=null&&((u=jo(y,Mt))==null?void 0:u.level)==="bad"})&&i.push({key:"dpi",text:"An image is low-resolution and may print blurry — try a larger file or smaller size."}),i.length?e.jsx("div",{style:{position:"absolute",top:8,left:"50%",transform:"translateX(-50%)",zIndex:35,maxWidth:"92%",display:"flex",flexDirection:"column",gap:6},children:i.map(c=>e.jsxs("div",{role:"status",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:8,background:"#fffbeb",border:"1px solid #fcd34d",color:"#92400e",fontSize:12,lineHeight:1.3,boxShadow:"0 2px 10px rgba(0,0,0,0.12)"},children:[e.jsx("span",{"aria-hidden":"true",children:"⚠️"}),c.text]},c.key))}):null})(),e.jsxs("div",{className:"canvas-stage",style:{position:"relative",width:B,height:X,transform:`scale(${mt})`,transformOrigin:"top left"},children:[e.jsx("canvas",{ref:Nt,width:B,height:X,onPointerDown:sa,onPointerMove:la,onPointerUp:Yi,onPointerCancel:Yi,onDoubleClick:na,style:{display:"block",border:"1px solid #e2e8f0",cursor:U?"grabbing":(v==null?void 0:v.type)==="text"&&!v.isIcon&&!G?"text":"default",touchAction:"none"}}),!n&&I.length===0&&(()=>{const i=Ke[(typeof C=="number"?C:Ke.findIndex(a=>a.key===C))%Ke.length]||Ke[0],t={display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",borderRadius:8,cursor:"pointer",fontSize:13,fontWeight:600,lineHeight:1};return e.jsxs("div",{style:{position:"absolute",inset:0,zIndex:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,pointerEvents:"none",textAlign:"center",padding:24,color:"#0f172a"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:"50%",background:"rgba(255,255,255,0.92)",border:"1px dashed #94a3b8"},children:e.jsx(tt,{name:"image",size:26,color:"#475569"})}),e.jsx("div",{style:{fontSize:17,fontWeight:800,color:"#0f172a"},children:i.title}),e.jsx("div",{style:{fontSize:13,fontWeight:600,maxWidth:260,lineHeight:1.45,color:"#334155"},children:i.body}),e.jsxs("div",{style:{display:"flex",gap:8,pointerEvents:"auto",marginTop:2},children:[e.jsxs("button",{type:"button",style:{...t,background:(r==null?void 0:r.primaryColor)||"#0f172a",color:"#ffffff",border:"none"},onClick:Zo,children:[e.jsx(tt,{name:"text",size:16,color:"#ffffff"})," Add text"]}),e.jsxs("button",{type:"button",style:{...t,background:"#ffffff",color:"#0f172a",border:"1px solid #cbd5e1"},onClick:lt?()=>lt():Jo,children:[e.jsx(tt,{name:"upload",size:16,color:"#0f172a"})," Upload image"]})]})]})})(),ue&&e.jsxs("div",{className:"print-guides-overlay","aria-hidden":"true",style:{position:"absolute",top:0,left:0,width:B,height:X,pointerEvents:"none"},children:[e.jsx("div",{style:{position:"absolute",inset:0,border:"1px solid rgba(106, 69, 210, 0.55)"}}),e.jsx("div",{style:{position:"absolute",top:`${Mt.safeAreaPct}%`,left:`${Mt.safeAreaPct}%`,right:`${Mt.safeAreaPct}%`,bottom:`${Mt.safeAreaPct}%`,border:"1px dashed rgba(106, 69, 210, 0.9)"},children:e.jsx("span",{style:{position:"absolute",top:2,left:4,fontSize:10,lineHeight:1.4,color:"rgba(106, 69, 210, 0.9)",background:"rgba(255,255,255,0.6)",padding:"0 3px",borderRadius:2,userSelect:"none"},children:"Safe area"})})]}),v&&!n&&ct.length<=1&&(()=>{const i=Nt.current&&Nt.current.getContext("2d"),t=i?ye(i,v):{cx:v.x+(v.width||0)/2,y:v.y},a=t.cx,c=t.y,y=["image","sticker","embroidery"].includes(v.type),u=!!v.locked,x={width:30,height:30,border:"none",background:"transparent",borderRadius:6,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0},f=p=>{p.preventDefault(),p.stopPropagation();const b=v;if(!b||b.locked)return;const j=b.id,E=p.clientX,P=p.clientY,J=b.x,ft=b.y,L=mt||1,nt=xt=>{const St=J+(xt.clientX-E)/L,jt=ft+(xt.clientY-P)/L;se(j,{x:Math.max(0,Math.min(B-1,St)),y:Math.max(0,Math.min(X-1,jt))})},Ct=()=>{window.removeEventListener("pointermove",nt),window.removeEventListener("pointerup",Ct),yt()};window.addEventListener("pointermove",nt),window.addEventListener("pointerup",Ct)};return e.jsx("div",{style:{position:"absolute",left:a,top:c,pointerEvents:"none",zIndex:30},children:e.jsxs("div",{className:"element-action-toolbar",onMouseDown:p=>p.stopPropagation(),style:{transform:`translate(-50%, calc(-100% - 12px)) scale(${1/(mt||1)})`,transformOrigin:"bottom center",pointerEvents:"auto",display:"flex",alignItems:"center",gap:2,padding:"3px 4px",background:"#ffffff",border:"1px solid #e2e8f0",borderRadius:8,boxShadow:"0 4px 14px rgba(0,0,0,0.18)",whiteSpace:"nowrap"},children:[!u&&e.jsxs(e.Fragment,{children:[e.jsx("button",{style:{...x,cursor:"grab",touchAction:"none"},title:"Drag to move",onPointerDown:f,children:e.jsx(tt,{name:"move",size:18,color:"#334155"})}),e.jsx("span",{style:{width:1,height:20,background:"#e2e8f0",margin:"0 2px"}}),e.jsx("button",{style:x,title:"Shrink",onClick:p=>{p.stopPropagation(),Xi(.9)},children:e.jsx(tt,{name:"minus",size:18,color:"#334155"})}),e.jsx("button",{style:x,title:"Enlarge",onClick:p=>{p.stopPropagation(),Xi(1.1)},children:e.jsx(tt,{name:"plus",size:18,color:"#334155"})}),e.jsx("button",{style:x,title:"Duplicate",onClick:p=>{p.stopPropagation(),gi(v.id)},children:e.jsx(tt,{name:"duplicate",size:18,color:"#334155"})}),e.jsx("button",{style:x,title:"Rotate left 15°",onClick:p=>{p.stopPropagation(),Qi(-15)},children:e.jsx(tt,{name:"rotateLeft",size:18,color:"#334155"})}),e.jsx("button",{style:x,title:"Rotate right 15°",onClick:p=>{p.stopPropagation(),Qi(15)},children:e.jsx(tt,{name:"rotateRight",size:18,color:"#334155"})}),y&&V&&e.jsx("button",{style:x,title:"Remove background",onClick:p=>{p.stopPropagation(),qi(v).catch(()=>{})},children:e.jsx("span",{style:{fontSize:16,lineHeight:1},children:"✂️"})})]}),e.jsx("button",{style:{...x,background:u?"#eef2ff":"transparent"},title:u?"Unlock":"Lock position",onClick:p=>{p.stopPropagation(),ta(v.id)},children:e.jsx(tt,{name:"lock",size:18,color:u?"#4f46e5":"#334155"})}),!u&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{width:1,height:20,background:"#e2e8f0",margin:"0 2px"}}),e.jsx("button",{style:x,title:"Delete",onClick:p=>{p.stopPropagation(),ui()},children:e.jsx(tt,{name:"trash",size:18,color:"#dc2626"})})]})]})})})(),G&&!n&&(()=>{const i=I.find(x=>x.id===G);if(!i)return null;const t=Nt.current&&Nt.current.getContext("2d"),a=t?ye(t,i):{x:i.x,y:i.y,width:i.width||120,height:i.height||i.fontSize||20},c=i.fontSize||20,y=c*(i.lineHeight||1.2),u=(y-c)/2;return e.jsx("textarea",{ref:kt,className:"inline-text-editor",value:i.text||"",wrap:"off",spellCheck:!1,onChange:x=>se(i.id,{text:x.target.value}),onBlur:fi,onKeyDown:x=>{x.stopPropagation(),x.key==="Escape"&&(x.preventDefault(),fi()),x.key==="Enter"&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),fi())},onPointerDown:x=>x.stopPropagation(),style:{position:"absolute",left:a.x,top:a.y-u,width:Math.max((a.width||0)+c,24),height:(a.height||y)+u*2,font:`${i.fontStyle||"normal"} ${i.fontWeight||"normal"} ${c}px ${i.fontFamily||"Arial"}`,lineHeight:`${y}px`,letterSpacing:`${i.letterSpacing||0}px`,color:i.fill||"#000000",caretColor:i.fill||"#6a45d2",textAlign:i.textAlign||"left",textTransform:i.textTransform||"none",background:i.hasBackground?i.backgroundColor||"#ffffff":"transparent",transform:i.rotation?`rotate(${i.rotation}deg)`:void 0,transformOrigin:"center",zIndex:31}})})()]})]}),!Jt&&e.jsx("div",{className:"side-panels",children:so})]}),e.jsxs("div",{className:"designer-footer",children:[e.jsxs("div",{className:"section-thumbnails",children:[e.jsxs("label",{className:"section-thumbnails-label",children:["Available sections for : ",e.jsx("u",{children:h.name})]}),e.jsx("div",{className:"thumbnails-container",children:h.sections.map(i=>{const t=Xt[i.sectionName]&&Xt[i.sectionName].elements&&Xt[i.sectionName].elements.length>0;return e.jsxs("div",{className:`section-thumbnail compact ${Q.sectionName===i.sectionName?"active":""}`,onClick:a=>{a.stopPropagation();const c=h.sections.find(y=>y.sectionName===i.sectionName);to(c)},title:i.sectionName,children:[e.jsxs("div",{className:"thumbnail-image-container compact",children:[e.jsx("img",{src:i.sectionImage,alt:i.sectionName,className:"thumbnail-image compact",onError:a=>{a.target.style.display="none",a.target.nextSibling.style.display="flex"}}),e.jsx("div",{className:"thumbnail-placeholder compact",style:{display:"none"},children:e.jsx("span",{className:"placeholder-icon",children:"📐"})}),t&&e.jsx("div",{className:"content-indicator compact",children:e.jsx("svg",{className:"checkmark compact",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})})]}),e.jsx("span",{className:"thumbnail-label compact",children:i.sectionName})]},i.sectionName)})})]}),e.jsxs("div",{className:"zoom-controls-enhanced compact",children:[e.jsx("label",{className:"zoom-label",children:"Zoom:"}),e.jsxs("div",{className:"zoom-buttons-container compact",children:[e.jsx("button",{className:"zoom-button compact zoom-out",onClick:()=>Zt(Math.max(.25,mt-.25)),disabled:mt<=.25,title:"Zoom Out",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),e.jsxs("div",{className:"zoom-display compact",children:[e.jsxs("span",{className:"zoom-percentage compact",children:[Math.round(mt*100),"%"]}),e.jsx("div",{className:"zoom-slider-container compact",children:e.jsx("input",{type:"range",min:"0.25",max:"4",step:"0.25",value:mt,onChange:i=>Zt(parseFloat(i.target.value)),className:"zoom-slider compact"})})]}),e.jsx("button",{className:"zoom-button compact zoom-in",onClick:()=>Zt(Math.min(4,mt+.25)),disabled:mt>=4,title:"Zoom In",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"}),e.jsx("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),e.jsx("button",{className:"zoom-reset compact",onClick:()=>Zt(1),title:"Reset Zoom (100%)",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M3 3l18 18"}),e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]})})]})]})]}),Jt&&ri&&e.jsx("div",{className:"mobile-panel-modal-overlay",onClick:()=>je(!1),style:{position:"fixed",inset:0,zIndex:1e4,background:"rgba(15,23,42,0.5)",display:"flex",alignItems:"flex-end",justifyContent:"center"},children:e.jsxs("div",{className:"mobile-panel-modal",role:"dialog","aria-modal":"true","aria-label":"Edit design",onClick:i=>i.stopPropagation(),style:{background:"#ffffff",width:"100%",maxWidth:560,maxHeight:"85vh",borderTopLeftRadius:16,borderTopRightRadius:16,display:"flex",flexDirection:"column",boxShadow:"0 -8px 30px rgba(0,0,0,0.25)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #e2e8f0",borderTopLeftRadius:16,borderTopRightRadius:16,flex:"0 0 auto"},children:[e.jsx("span",{style:{fontSize:15,fontWeight:700,color:"#0f172a"},children:"Edit design"}),e.jsx("button",{type:"button","aria-label":"Close",onClick:()=>je(!1),style:{width:32,height:32,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",fontSize:18,lineHeight:1,cursor:"pointer",color:"#334155"},children:"×"})]}),e.jsx("div",{style:{overflowY:"auto",WebkitOverflowScrolling:"touch",padding:12},children:so})]})})]})});Co.displayName="Mypixia";const Ka=g.forwardRef(function({idleTimeoutSeconds:o=120,onIdle:r,...n},l){const d=g.useRef(null),h=g.useRef(null);return g.useEffect(()=>{if(!r)return;const w=Math.max(30,o)*1e3,k=()=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>r(),w)};k();const T=d.current||window,N=["pointerdown","pointermove","touchstart","keydown"];return N.forEach(z=>T.addEventListener(z,k,{passive:!0})),()=>{h.current&&clearTimeout(h.current),N.forEach(z=>T.removeEventListener(z,k))}},[o,r]),e.jsxs("div",{ref:d,className:"mpx-kiosk-root",children:[e.jsx("style",{children:`
52
+ </defs>`,ti='fill="none" stroke="rgba(20,12,6,0.5)" stroke-width="1.3" stroke-dasharray="2.6 2" stroke-linecap="round"',U=(s,o,r,n,l="satin")=>`<circle cx="${s}" cy="${o}" r="${r}" fill="${n}"/><circle cx="${s}" cy="${o}" r="${r}" fill="url(#${l})"/><circle cx="${s}" cy="${o}" r="${r}" ${ti}/>`,Rt=(s,o,r,n,l,d=0,h="satin")=>{const w=d?` transform="rotate(${d} ${s} ${o})"`:"";return`<ellipse cx="${s}" cy="${o}" rx="${r}" ry="${n}" fill="${l}"${w}/><ellipse cx="${s}" cy="${o}" rx="${r}" ry="${n}" fill="url(#${h})"${w}/><ellipse cx="${s}" cy="${o}" rx="${r}" ry="${n}" ${ti}${w}/>`},it=(s,o,r="satin")=>`<path d="${s}" fill="${o}"/><path d="${s}" fill="url(#${r})"/><path d="${s}" ${ti}/>`,$t=(s,o,r,n,l,d=2,h="satin")=>`<rect x="${s}" y="${o}" width="${r}" height="${n}" rx="${d}" fill="${l}"/><rect x="${s}" y="${o}" width="${r}" height="${n}" rx="${d}" fill="url(#${h})"/><rect x="${s}" y="${o}" width="${r}" height="${n}" rx="${d}" ${ti}/>`,xt=(s,o,r=3)=>`<path d="${s}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linecap="round"/><path d="${s}" fill="none" stroke="rgba(255,255,255,0.4)" stroke-width="${Math.max(.8,r*.35)}" stroke-linecap="round"/>`;let yo=0;const rt=(s,o,r,n)=>{yo+=1;const l=`<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="0 0 120 120">${Fa}<g filter="url(#lift)"><g filter="url(#floss)" stroke-linejoin="round">${n}</g></g></svg>`;return{id:yo,name:s,category:o,description:r,url:`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(l)}`}},Mi=(s,o,r,n,l,d,h)=>[...Array(r)].map((w,k)=>{const z=360/r*k,N=z*Math.PI/180;return Rt(s+Math.cos(N)*n,o+Math.sin(N)*n,l,d,h,z)}).join(""),Ai=(s,o,r,n,l,d,h=3)=>[...Array(r)].map((w,k)=>{const z=360/r*k*Math.PI/180;return xt(`M${s+Math.cos(z)*n} ${o+Math.sin(z)*n} L${s+Math.cos(z)*l} ${o+Math.sin(z)*l}`,d,h)}).join(""),Na=[rt("Rose","Floral","Satin rose",Rt(60,58,26,26,"#e23b6d")+Rt(60,58,17,17,"#f06292",0,"satinV")+U(60,58,8,"#ad1457")+it("M60 84 q4 16 -6 26","#2e7d32")),rt("Sunflower","Floral","Sunflower",Mi(60,58,12,30,9,5,"#f4b400")+U(60,58,17,"#8d5524","satinV")),rt("Tulip","Floral","Tulip",it("M60 28 q18 6 16 30 q-16 -10 -16 -10 q0 0 -16 10 q-2 -24 16 -30 Z","#e23b6d")+it("M60 48 q8 4 7 20 q-7 -6 -7 -6 q0 0 -7 6 q-1 -16 7 -20 Z","#ad1457")+xt("M60 58 L60 96","#2e7d32",3)+it("M60 78 q14 -6 20 4 q-14 8 -20 -4 Z","#43a047")),rt("Daisy","Floral","Daisy",Mi(60,58,10,26,11,5,"#ffffff")+U(60,58,12,"#ffca28")),rt("Cherry Blossom","Floral","Cherry blossom",Mi(60,60,5,18,11,9,"#f8bbd0")+U(60,60,7,"#fff176")+Ai(60,60,5,6,16,"#fce4ec",1.4)),rt("Lavender","Floral","Lavender sprig",xt("M60 100 C58 70 62 50 60 26","#5e7d3a",3)+[...Array(7)].map((s,o)=>Rt(60+(o%2?6:-6),30+o*9,6,4,"#9575cd",o%2?25:-25)).join("")),rt("Pine Tree","Nature","Evergreen",$t(56,86,8,16,"#795548")+it("M60 20 L82 56 L38 56 Z","#2e7d32")+it("M60 40 L88 82 L32 82 Z","#388e3c")),rt("Mountain","Nature","Mountain",it("M16 92 L52 36 L72 66 L88 44 L104 92 Z","#6d8299")+it("M52 36 L64 54 L40 54 Z","#ffffff")+U(92,30,9,"#ffd54f")),rt("Sun","Nature","Sunburst",Ai(60,60,12,26,40,"#f9a825",3)+U(60,60,22,"#fbc02d")),rt("Leaf Sprig","Nature","Leaf sprig",xt("M60 96 C60 70 60 50 60 28","#2e7d32",3)+it("M60 70 q-22 -6 -26 -22 q24 0 26 22 Z","#43a047")+it("M60 52 q22 -6 26 -22 q-24 0 -26 22 Z","#66bb6a")+it("M60 38 q-18 -6 -22 -20 q20 0 22 20 Z","#43a047")),rt("Cactus","Nature","Potted cactus",it("M52 92 q-2 -34 8 -34 q10 0 8 34 Z","#2e7d32")+it("M52 70 q-16 0 -16 -14 q0 -8 6 -8 q10 0 10 14 Z","#43a047")+it("M68 64 q16 0 16 -14 q0 -8 -6 -8 q-10 0 -10 14 Z","#43a047")+$t(46,92,28,16,"#c1502e",3)),rt("Mushroom","Nature","Toadstool",it("M30 64 q0 -34 30 -34 q30 0 30 34 Z","#e53935")+$t(50,64,20,34,"#fff8e1",6)+U(46,50,4,"#fff")+U(60,44,5,"#fff")+U(74,52,4,"#fff")),rt("Acorn","Nature","Acorn",it("M40 56 q20 30 40 0 q-20 8 -40 0 Z","#a1683a")+it("M38 56 q22 -20 44 0 q-22 8 -44 0 Z","#6d4c2f")+xt("M60 30 L60 38","#6d4c2f",3)),rt("Butterfly","Animals","Butterfly",Rt(44,50,16,13,"#7e57c2",-18)+Rt(76,50,16,13,"#7e57c2",18,"satinV")+Rt(46,76,12,10,"#9575cd",-12)+Rt(74,76,12,10,"#9575cd",12,"satinV")+$t(57,42,6,44,"#4527a0",3)+xt("M60 44 L52 30","#4527a0",2)+xt("M60 44 L68 30","#4527a0",2)),rt("Bee","Animals","Bumblebee",Rt(60,64,22,16,"#fbc02d")+$t(50,48,8,32,"#3e2723",2)+$t(64,48,8,32,"#3e2723",2)+Rt(40,54,12,7,"#e3f2fd",-25)+Rt(80,54,12,7,"#e3f2fd",25)),rt("Ladybug","Animals","Ladybug",U(60,62,24,"#e53935")+xt("M60 38 L60 86","#3e2723",2)+U(60,40,9,"#3e2723")+U(50,56,4,"#3e2723")+U(70,56,4,"#3e2723")+U(50,72,4,"#3e2723")+U(70,72,4,"#3e2723")),rt("Cat","Animals","Cat face",U(60,64,26,"#9e9e9e")+it("M40 46 L36 24 L54 40 Z","#9e9e9e")+it("M80 46 L84 24 L66 40 Z","#9e9e9e")+U(51,62,3.4,"#212121")+U(69,62,3.4,"#212121")+it("M56 72 q4 4 8 0","#212121")),rt("Bird","Animals","Little bird",Rt(58,62,22,17,"#42a5f5")+U(74,50,10,"#42a5f5")+it("M82 50 L96 54 L82 58 Z","#fb8c00")+U(77,48,2.4,"#212121")+it("M40 64 q-16 4 -18 16 q18 -2 22 -8 Z","#1e88e5")),rt("Fish","Animals","Tropical fish",Rt(56,62,26,16,"#26c6da")+it("M82 62 L100 48 L100 76 Z","#0097a7")+U(44,58,2.6,"#063")+it("M56 46 q0 -10 -8 -12 q2 8 8 12 Z","#0097a7")),rt("Paw","Animals","Paw print",Rt(60,72,14,11,"#6d4c41")+U(44,52,6,"#6d4c41")+U(58,44,6,"#6d4c41")+U(72,46,6,"#6d4c41")+U(82,58,5,"#6d4c41")),rt("Diamond","Geometric","Diamond",it("M60 20 L96 60 L60 100 L24 60 Z","#1e88e5")+it("M60 38 L78 60 L60 82 L42 60 Z","#64b5f6","satinV")),rt("Chevron","Geometric","Chevrons",[0,18,36].map((s,o)=>xt(`M24 ${42+s} L60 ${62+s} L96 ${42+s}`,["#1e88e5","#26a69a","#ef6c00"][o],5)).join("")),rt("Mandala","Geometric","Mandala",U(60,60,30,"#8e24aa")+U(60,60,20,"#ab47bc","satinV")+[...Array(8)].map((s,o)=>{const r=o*45*Math.PI/180;return U(60+Math.cos(r)*30,60+Math.sin(r)*30,5,"#f3e5f5")}).join("")+U(60,60,8,"#f3e5f5")),rt("Heart","Symbols","Heart",it("M60 92 C24 66 30 34 50 34 C58 34 60 42 60 46 C60 42 62 34 70 34 C90 34 96 66 60 92 Z","#e53935")),rt("Star","Symbols","Star",it("M60 22 L71 50 L101 50 L77 68 L86 98 L60 80 L34 98 L43 68 L19 50 L49 50 Z","#fbc02d")),rt("Crown","Symbols","Crown",it("M28 84 L34 46 L48 66 L60 40 L72 66 L86 46 L92 84 Z","#f9a825")+$t(28,84,64,10,"#f57f17")+U(34,46,5,"#fdd835")+U(60,40,5,"#fdd835")+U(86,46,5,"#fdd835")),rt("Anchor","Symbols","Anchor",U(60,30,7,"#37474f")+xt("M60 36 L60 92","#455a64",5)+xt("M40 60 L80 60","#455a64",5)+it("M30 76 q6 22 30 22 q24 0 30 -22 q-12 14 -30 14 q-18 0 -30 -14 Z","#37474f")),rt("Lightning","Symbols","Lightning bolt",it("M64 18 L40 64 L56 64 L50 102 L84 50 L66 50 Z","#ffb300")),rt("Music Note","Symbols","Music note",U(46,84,11,"#5e35b1")+U(82,76,11,"#5e35b1")+$t(54,30,6,54,"#5e35b1",3)+$t(85,22,6,54,"#5e35b1",3)+it("M57 30 L91 22 L91 34 L57 42 Z","#5e35b1")),rt("Peace","Symbols","Peace sign",U(60,60,30,"#43a047")+xt("M60 30 L60 90","rgba(255,255,255,0.95)",4)+xt("M60 60 L38 82","rgba(255,255,255,0.95)",4)+xt("M60 60 L82 82","rgba(255,255,255,0.95)",4)),rt("Cupcake","Food","Cupcake",it("M38 64 L82 64 L74 98 L46 98 Z","#d7a86e")+it("M34 64 q6 -28 26 -28 q20 0 26 28 Z","#ec407a")+U(48,50,3,"#fff")+U(60,44,3,"#fff")+U(72,50,3,"#fff")+U(60,34,5,"#e53935")),rt("Cherries","Food","Cherries",U(46,84,12,"#e53935")+U(74,84,12,"#c62828")+xt("M46 72 C50 50 60 40 64 30","#2e7d32",2.5)+xt("M74 72 C70 52 66 42 64 30","#2e7d32",2.5)+it("M64 30 q14 -8 22 -2 q-12 8 -22 2 Z","#43a047")),rt("Coffee","Food","Coffee cup",it("M34 50 L84 50 L80 92 L38 92 Z","#6d4c41")+it("M84 56 q16 0 16 14 q0 14 -18 12","#6d4c41")+xt("M48 38 q4 -8 0 -14","#bcaaa4",2.5)+xt("M60 38 q4 -8 0 -14","#bcaaa4",2.5)+xt("M72 38 q4 -8 0 -14","#bcaaa4",2.5)),rt("Soccer Ball","Sports","Soccer ball",U(60,60,32,"#fafafa")+it("M60 44 L74 54 L69 72 L51 72 L46 54 Z","#212121")+Ai(60,60,5,12,30,"#212121",2)),rt("Basketball","Sports","Basketball",U(60,60,32,"#ef6c00")+xt("M60 28 L60 92","#3e2723",2.5)+xt("M28 60 L92 60","#3e2723",2.5)+xt("M36 36 Q60 60 36 84","#3e2723",2.5)+xt("M84 36 Q60 60 84 84","#3e2723",2.5)),rt("Snowflake","Holiday","Snowflake",[...Array(6)].map((s,o)=>{const r=o*60*Math.PI/180,n=60+Math.cos(r)*38,l=60+Math.sin(r)*38,d=60+Math.cos(r)*22,h=60+Math.sin(r)*22;return xt(`M60 60 L${n} ${l}`,"#4fc3f7",3)+xt(`M${d} ${h} L${d+Math.cos(r+.5)*10} ${h+Math.sin(r+.5)*10}`,"#4fc3f7",2)+xt(`M${d} ${h} L${d+Math.cos(r-.5)*10} ${h+Math.sin(r-.5)*10}`,"#4fc3f7",2)}).join("")+U(60,60,5,"#81d4fa")),rt("Gift","Holiday","Gift box",$t(34,54,52,44,"#e53935",4)+$t(54,54,12,44,"#fff",2)+$t(34,50,52,12,"#c62828",3)+it("M60 50 q-18 -22 -2 -22 q8 0 2 22 Z","#fbc02d")+it("M60 50 q18 -22 2 -22 q-8 0 -2 22 Z","#fbc02d")),rt("Holly","Holiday","Holly & berries",it("M40 60 q10 -22 22 -10 q-2 16 -22 10 Z","#2e7d32")+it("M80 60 q-10 -22 -22 -10 q2 16 22 10 Z","#388e3c")+it("M50 78 q10 -16 20 -6 q-4 14 -20 6 Z","#43a047")+U(56,64,5,"#e53935")+U(64,64,5,"#c62828")+U(60,72,5,"#e53935")),rt("Monogram","Text","Initial monogram",U(60,60,34,"#5e35b1")+U(60,60,34,"#5e35b1","satinV")+'<text x="60" y="75" text-anchor="middle" font-family="Georgia, serif" font-size="46" font-weight="700" fill="#ede7f6">A</text>')],za=({isOpen:s,onClose:o,onAddEmbroidery:r,theme:n,apiKey:l,apiEndpoint:d})=>{const[h,w]=g.useState([]),[k,z]=g.useState(!1),[N,T]=g.useState(null),[S,D]=g.useState(""),[M,$]=g.useState("All"),Z=g.useRef(null),Y=["All","Floral","Nature","Geometric","Traditional","Sports","Hobbies","Food","Symbols","Holiday","Text"];g.useEffect(()=>{s&&w(Na)},[s]);const R=_=>{r({type:"embroidery",src:_.url,name:_.name,description:_.description,category:_.category,width:120,height:120}),o()},lt=h.filter(_=>{const F=!S||_.name.toLowerCase().includes(S.toLowerCase())||_.description.toLowerCase().includes(S.toLowerCase()),ut=M==="All"||_.category===M;return F&&ut});return s?e.jsx("div",{className:"embroidery-modal-overlay",onClick:o,children:e.jsxs("div",{className:"embroidery-modal-content",onClick:_=>_.stopPropagation(),ref:Z,children:[e.jsxs("div",{className:"embroidery-modal-header",children:[e.jsx("h3",{children:"Choose an Embroidery Design"}),e.jsx("button",{className:"embroidery-modal-close",onClick:o,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"embroidery-modal-controls",children:[e.jsx("div",{className:"search-container",children:e.jsx("input",{type:"text",placeholder:"Search embroidery designs...",value:S,onChange:_=>D(_.target.value),className:"embroidery-search"})}),e.jsxs("div",{className:"category-filter",children:[e.jsx("label",{children:"Category:"}),e.jsx("select",{value:M,onChange:_=>$(_.target.value),className:"category-select",children:Y.map(_=>e.jsx("option",{value:_,children:_},_))})]})]}),e.jsxs("div",{className:"embroidery-modal-body",children:[k&&e.jsxs("div",{className:"embroidery-loading",children:[e.jsx("div",{className:"loading-spinner"}),e.jsx("p",{children:"Loading embroidery designs..."})]}),N&&e.jsx("div",{className:"embroidery-error",children:e.jsx("p",{children:N})}),!k&&!N&&e.jsx("div",{className:"embroidery-grid",children:lt.map(_=>e.jsxs("div",{className:"embroidery-item",onClick:()=>R(_),title:_.description,children:[e.jsx("div",{className:"embroidery-preview",children:e.jsx("img",{src:_.url,alt:_.name,loading:"lazy",onError:F=>{console.error("Failed to load embroidery image:",_.url),F.target.style.display="none"}})}),e.jsxs("div",{className:"embroidery-info",children:[e.jsx("div",{className:"embroidery-name",children:_.name}),e.jsx("div",{className:"embroidery-category",children:_.category})]})]},_.id))}),!k&&!N&&lt.length===0&&e.jsx("div",{className:"no-embroideries",children:e.jsx("p",{children:"No embroidery designs found matching your search."})})]}),e.jsx("div",{className:"embroidery-modal-footer",children:e.jsxs("div",{className:"embroidery-disclaimer",children:[e.jsx("span",{className:"disclaimer-icon",children:"ℹ️"}),e.jsx("span",{children:"Sample embroidery designs for preview. Actual embroidered results may vary based on fabric and thread."})]})})]})}):null},Ta=(s,o,r,n)=>`<text x="90" y="${66+1.3}" text-anchor="middle" font-family="${r}" font-weight="700" font-size="${o}" fill="rgba(0,0,0,0.4)">${s}</text><text x="90" y="${66-.8}" text-anchor="middle" font-family="${r}" font-weight="700" font-size="${o}" fill="rgba(255,255,255,0.22)">${s}</text><text x="90" y="66" text-anchor="middle" font-family="${r}" font-weight="700" font-size="${o}" fill="${n}">${s}</text>`,Ma=(s,o,r,n,l)=>{const d=`<svg xmlns="http://www.w3.org/2000/svg" width="180" height="120" viewBox="0 0 180 120"><defs><linearGradient id="c" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="${l[0]}"/><stop offset="1" stop-color="${l[1]}"/></linearGradient></defs><rect x="6" y="6" width="168" height="108" rx="14" fill="url(#c)"/><rect x="14" y="14" width="152" height="92" rx="9" fill="none" stroke="rgba(0,0,0,0.25)" stroke-width="2"/><rect x="14.5" y="14.5" width="151" height="91" rx="9" fill="none" stroke="rgba(255,255,255,0.25)" stroke-width="1"/>`+Ta(s,o,r,n)+"</svg>";return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(d)}`};let xo=0;const _t=(s,o,r,{text:n,font:l,sysFont:d,ink:h,card:w,size:k=40,weight:z=700,style:N="normal",previewSize:T=30})=>(xo+=1,{id:xo,name:s,category:o,description:r,url:Ma(n,T,d,h,w),add:{text:n,fontFamily:l,fontSize:k,fontWeight:z,fontStyle:N,fill:h,textAlign:"center",width:300,height:90}}),bo=["#b07e4f","#7d4f28"],qe=["#f3e6cf","#e3cda6"],Ei=["#dfe4ea","#9aa4b1"],Ii=["#3a4651","#222a31"],Aa=[_t("Welcome","Signage","Bold welcome sign",{text:"WELCOME",font:"Bebas Neue",sysFont:"Impact, sans-serif",ink:"#3a2a1a",card:qe,size:46,previewSize:34}),_t("Open","Signage","Shop open sign",{text:"OPEN",font:"Anton",sysFont:"Impact, sans-serif",ink:"#7a3b12",card:bo,size:54,previewSize:40}),_t("Café","Signage","Café script sign",{text:"Café",font:"Pacifico",sysFont:'"Brush Script MT", cursive',ink:"#f5f5f5",card:Ii,size:50,previewSize:38}),_t("Gather","Signage","Gather sign",{text:"gather",font:"Playfair Display",sysFont:"Georgia, serif",ink:"#2e2a26",card:qe,size:46,style:"italic",previewSize:36}),_t("Family Name","Home","Family name plaque",{text:"The Smiths",font:"Great Vibes",sysFont:'"Brush Script MT", cursive',ink:"#3a2a1a",card:bo,size:48,previewSize:30}),_t("Home Sweet Home","Home","Home sweet home",{text:"Home Sweet Home",font:"Dancing Script",sysFont:'"Brush Script MT", cursive',ink:"#3a2a1a",card:qe,size:40,previewSize:22}),_t("House Number","Home","House number",{text:"123",font:"Alfa Slab One",sysFont:"Georgia, serif",ink:"#2b3036",card:Ei,size:64,previewSize:48}),_t("Address","Home","Street address",{text:"21 OAK STREET",font:"Oswald",sysFont:"Arial, sans-serif",ink:"#f5f5f5",card:Ii,size:34,previewSize:18}),_t("Mr & Mrs","Wedding","Wedding sign",{text:"Mr & Mrs",font:"Great Vibes",sysFont:'"Brush Script MT", cursive',ink:"#3a2a1a",card:qe,size:52,previewSize:34}),_t("Joy","Celebrations","Holiday joy",{text:"Joy",font:"Sacramento",sysFont:'"Brush Script MT", cursive',ink:"#f5f5f5",card:Ii,size:60,previewSize:46}),_t("Established","Celebrations","Established year",{text:"EST. 2024",font:"Staatliches",sysFont:"Impact, sans-serif",ink:"#2b3036",card:Ei,size:44,previewSize:30}),_t("Office","Business","Office name plate",{text:"OFFICE",font:"Oswald",sysFont:"Arial, sans-serif",ink:"#2b3036",card:Ei,size:40,previewSize:30})],Ea=({isOpen:s,onClose:o,onAddHandcraft:r,theme:n})=>{const[l,d]=g.useState([]),[h,w]=g.useState(""),[k,z]=g.useState("All"),N=g.useRef(null),T=["All","Signage","Business","Home","Wedding","Celebrations"];g.useEffect(()=>{s&&d(Aa)},[s]);const S=M=>{r({...M.add}),o()},D=l.filter(M=>{const $=!h||M.name.toLowerCase().includes(h.toLowerCase())||M.description.toLowerCase().includes(h.toLowerCase()),Z=k==="All"||M.category===k;return $&&Z});return s?e.jsx("div",{className:"embroidery-modal-overlay",onClick:o,children:e.jsxs("div",{className:"embroidery-modal-content",onClick:M=>M.stopPropagation(),ref:N,children:[e.jsxs("div",{className:"embroidery-modal-header",children:[e.jsx("h3",{children:"Choose a Signage Template"}),e.jsx("button",{className:"embroidery-modal-close",onClick:o,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"embroidery-modal-controls",children:[e.jsx("div",{className:"search-container",children:e.jsx("input",{type:"text",placeholder:"Search signage & handcraft templates...",value:h,onChange:M=>w(M.target.value),className:"embroidery-search"})}),e.jsxs("div",{className:"category-filter",children:[e.jsx("label",{children:"Category:"}),e.jsx("select",{value:k,onChange:M=>z(M.target.value),className:"category-select",children:T.map(M=>e.jsx("option",{value:M,children:M},M))})]})]}),e.jsxs("div",{className:"embroidery-modal-body",children:[e.jsx("div",{className:"embroidery-grid",children:D.map(M=>e.jsxs("div",{className:"embroidery-item",onClick:()=>S(M),title:M.description,children:[e.jsx("div",{className:"embroidery-preview",children:e.jsx("img",{src:M.url,alt:M.name,loading:"lazy"})}),e.jsxs("div",{className:"embroidery-info",children:[e.jsx("div",{className:"embroidery-name",children:M.name}),e.jsx("div",{className:"embroidery-category",children:M.category})]})]},M.id))}),D.length===0&&e.jsx("div",{className:"no-embroideries",children:e.jsx("p",{children:"No templates found matching your search."})})]}),e.jsx("div",{className:"embroidery-modal-footer",children:e.jsxs("div",{className:"embroidery-disclaimer",children:[e.jsx("span",{className:"disclaimer-icon",children:"ℹ️"}),e.jsx("span",{children:"Sample signage templates — add one, then edit the text and resize it. Final engraving/finish may vary by material."})]})})]})}):null},Ia=({isOpen:s,onClose:o,onAddText:r,theme:n})=>{const[l,d]=g.useState(""),[h,w]=g.useState("All");g.useEffect(()=>{if(!s)return;const S=Array.from(new Set(le.map(D=>D.fontFamily).filter(Boolean)));Ze(S)},[s]);const k=g.useMemo(()=>{const S=le.reduce((D,M)=>(D[M.category]=(D[M.category]||0)+1,D),{});return[{name:"All",count:le.length},...Object.entries(S).map(([D,M])=>({name:D,count:M}))]},[le]),z=g.useMemo(()=>le.filter(S=>{const D=!l||S.text.toLowerCase().includes(l.toLowerCase())||S.category.toLowerCase().includes(l.toLowerCase()),M=h==="All"||S.category===h;return D&&M}),[le,l,h]),N=S=>{const D={...S};r("text",D),o()},T=()=>{r("text",{text:"Your Text Here",fontSize:24,fontFamily:"Arial",fill:"#000000"}),o()};return s?e.jsx("div",{className:"text-templates-modal-overlay",onClick:o,children:e.jsxs("div",{className:"text-templates-modal",onClick:S=>S.stopPropagation(),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h2",{children:"Text Templates"}),e.jsx("button",{className:"close-btn",onClick:o,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"modal-controls",children:[e.jsx("div",{className:"search-section",children:e.jsx("input",{type:"text",placeholder:"Search templates...",value:l,onChange:S=>d(S.target.value),className:"search-input"})}),e.jsx("div",{className:"category-tabs",children:k.map(S=>e.jsxs("button",{className:`category-tab ${h===S.name?"active":""}`,onClick:()=>w(S.name),children:[S.name,e.jsxs("span",{className:"count",children:["(",S.count,")"]})]},S.name))})]}),e.jsxs("div",{className:"templates-grid",children:[e.jsx("div",{className:"custom-text-option",onClick:T,children:e.jsxs("div",{className:"custom-text-preview",children:[e.jsx("div",{className:"custom-icon",children:"✏️"}),e.jsx("div",{className:"custom-label",children:"Create Custom Text"})]})}),z.map(S=>e.jsxs("div",{className:"template-item",onClick:()=>N(S),children:[e.jsx("div",{className:"template-preview",style:{fontFamily:S.fontFamily,fontSize:`${Math.min(S.fontSize*.6,18)}px`,fontWeight:S.fontWeight,fontStyle:S.fontStyle,color:S.fill,backgroundColor:S.hasBackground?S.backgroundColor:"transparent",textAlign:S.textAlign||"left",textTransform:S.textTransform||"none",letterSpacing:S.letterSpacing?`${S.letterSpacing}px`:"normal",textShadow:S.hasTextShadow?`${S.textShadowX}px ${S.textShadowY}px ${S.textShadowBlur}px ${S.textShadowColor}`:"none"},children:S.text}),e.jsxs("div",{className:"template-info",children:[e.jsx("span",{className:"template-category",children:S.category}),e.jsx("span",{className:"template-font",children:S.fontFamily})]})]},S.id))]}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"results-count",children:[z.length," template",z.length!==1?"s":""," found"]})})]})}):null},La=({isOpen:s,onClose:o,onAddImage:r,theme:n,apiKey:l,apiEndpoint:d,aiEndpoint:h,onAIImageGenerate:w,outOfCredits:k=!1,onAddAiCredits:z})=>{const[N,T]=g.useState(""),[S,D]=g.useState(null),[M,$]=g.useState(!1),[Z,Y]=g.useState(null),[R,lt]=g.useState(null),_=g.useRef(null);if(g.useEffect(()=>{s&&(lt(null),$(!1))},[s]),!s)return null;const F=(n==null?void 0:n.primaryColor)||"#4c5bf2",ut=!M&&!k&&(N.trim().length>0||!!S),E=O=>{var ht;const st=(ht=O.target.files)==null?void 0:ht[0];if(!st||!st.type.startsWith("image/"))return;const J=new FileReader;J.onload=C=>D({dataUrl:C.target.result,name:st.name}),J.onerror=()=>lt("Could not read that image. Please try another file."),J.readAsDataURL(st),O.target.value=""},ot=()=>D(null),v=O=>{const st=O&&typeof O=="object"&&"object"in O?O.object:O;return st?typeof st=="string"?st:st.imageUrl||st.url||st.image||(st.imageBase64?`data:image/png;base64,${st.imageBase64}`:null):null},at=async()=>{var O,st;lt(null),$(!0),Y(null);try{const J={prompt:N.trim(),imageDataUrl:(S==null?void 0:S.dataUrl)||null};let ht=null;if(typeof w=="function"){const C=await w(J);ht=typeof C=="string"?C:v(C)}else{const C=h||(d?`${d}/api/v1/designer`:"");if(!C)throw new Error("AI image generation is not configured.");const G=await Wi.post(`${C}/generate-image`,{prompt:J.prompt,image:J.imageDataUrl,apiKey:l});ht=v(G.data)}if(!ht)throw new Error("No image was returned. Please try a different prompt.");Y(ht)}catch(J){console.error("AI image generation failed:",J),lt(((st=(O=J==null?void 0:J.response)==null?void 0:O.data)==null?void 0:st.message)||(J==null?void 0:J.message)||"Image generation failed. Please try again.")}finally{$(!1)}},ct=()=>{if(!Z)return;const O=new Image;O.crossOrigin="anonymous",O.onload=()=>{const J=O.naturalWidth||512,ht=O.naturalHeight||512,C=Math.min(1,250/Math.max(J,ht));r({imageData:O,src:Z,width:Math.round(J*C),height:Math.round(ht*C),originalWidth:J,originalHeight:ht}),o()},O.onerror=()=>lt("The generated image could not be loaded onto the canvas."),O.src=Z},q=()=>{Y(null),lt(null)};return e.jsx("div",{className:"ai-modal-overlay",onClick:o,children:e.jsxs("div",{className:"ai-modal-content",onClick:O=>O.stopPropagation(),children:[e.jsxs("div",{className:"ai-modal-header",children:[e.jsx("h3",{children:"✨ AI Image Generator"}),e.jsx("button",{className:"ai-modal-close",onClick:o,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"ai-modal-body",children:[!Z&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"ai-intro",children:["Generate ",e.jsx("strong",{children:"artwork, images, logos, icons, patterns"})," and much more — from a description, your own image, or both."]}),e.jsx("label",{className:"ai-field-label",htmlFor:"ai-prompt",children:"Describe what you want to create"}),e.jsx("textarea",{id:"ai-prompt",className:"ai-prompt",rows:4,placeholder:"e.g. a minimalist mountain logo · a bold retro sunset · a cute cartoon cat mascot · a seamless floral pattern",value:N,onChange:O=>T(O.target.value)}),e.jsxs("div",{className:"ai-ref-section",children:[e.jsx("span",{className:"ai-field-label",children:"Reference image (optional)"}),S?e.jsxs("div",{className:"ai-ref-preview",children:[e.jsx("img",{src:S.dataUrl,alt:S.name}),e.jsxs("div",{className:"ai-ref-meta",children:[e.jsx("span",{className:"ai-ref-name",children:S.name}),e.jsx("button",{type:"button",className:"ai-ref-remove",onClick:ot,children:"Remove"})]})]}):e.jsx("button",{type:"button",className:"ai-upload-btn",onClick:()=>{var O;return(O=_.current)==null?void 0:O.click()},children:"+ Upload an image to transform"}),e.jsx("input",{ref:_,type:"file",accept:"image/*",style:{display:"none"},onChange:E})]}),e.jsx("p",{className:"ai-hint",children:S?N.trim()?"Your image will be transformed using your description.":"Add a description to guide how your image is transformed.":"Describe an image to create one from scratch, or upload a reference to transform."}),k&&e.jsxs("div",{className:"ai-credits-notice",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap",margin:"4px 0 12px",padding:"10px 12px",borderRadius:8,background:"#fff7ed",border:"1px solid #fed7aa",color:"#9a3412",fontSize:13},children:[e.jsx("span",{children:"You don't have enough AI credits to generate an image."}),z&&e.jsx("button",{type:"button",onClick:()=>z(),style:{flexShrink:0,cursor:"pointer",border:"none",borderRadius:6,padding:"6px 12px",fontWeight:700,fontSize:13,color:"#fff",background:F},children:"Add AI credits"})]}),R&&e.jsx("div",{className:"ai-error",children:R}),e.jsx("button",{type:"button",className:"ai-generate-btn",style:{backgroundColor:F,opacity:ut?1:.6},disabled:!ut,onClick:at,children:M?e.jsxs("span",{className:"ai-generating",children:[e.jsx("span",{className:"ai-spinner"})," Generating…"]}):"Generate image"})]}),Z&&e.jsxs("div",{className:"ai-result",children:[e.jsx("div",{className:"ai-result-preview",children:e.jsx("img",{src:Z,alt:"AI generated result"})}),R&&e.jsx("div",{className:"ai-error",children:R}),e.jsxs("div",{className:"ai-result-actions",children:[e.jsx("button",{type:"button",className:"ai-secondary-btn",onClick:q,children:"Start over"}),e.jsx("button",{type:"button",className:"ai-secondary-btn",onClick:at,disabled:M,children:M?"Regenerating…":"Regenerate"}),e.jsx("button",{type:"button",className:"ai-generate-btn",style:{backgroundColor:F},onClick:ct,children:"Add to design"})]})]})]})]})})},Ra=[246,245,248,239,247,251],So=Ra.map(s=>le.find(o=>o.id===s)).filter(Boolean),Da=({onAddElement:s,onDeleteElement:o,onDuplicateElement:r,onUndo:n,onRedo:l,onToggleGrid:d,onToggleRulers:h,onToggleSnap:w,onTogglePrintGuides:k,onImageUpload:z,canUndo:N,canRedo:T,showGrid:S,showRulers:D,snapToGrid:M,showPrintGuides:$,selectedElement:Z,theme:Y,readOnly:R,mode:lt="customize",productionMethods:_,supportsEmbroidery:F,apiKey:ut,apiEndpoint:E,aiEnabled:ot=!0,aiEndpoint:v,onAIImageGenerate:at,aiCreditsRemaining:ct=null,onAddAiCredits:q,isAuthenticated:O=!0,onRequireAuth:st,onRequestCollaboration:J,onOpenUploads:ht})=>{const C=lt==="customize",G=typeof ct=="number"&&ct<=0,m=(_||[]).some(V=>String(V).toUpperCase()==="EMBROIDERY")||F==="Y",L=(_||[]).some(V=>String(V).toUpperCase()==="HANDCRAFTED"),[Q,ft]=g.useState(!1),[zt,kt]=g.useState(!1),[Ht,It]=g.useState(!1),[jt,B]=g.useState(!1),[oe,X]=g.useState(!1),[ii,gt]=g.useState(!1),[Zt,Dt]=g.useState(!1),[pe,Vt]=g.useState(!1),[ye,Wt]=g.useState(!1),[De,Bt]=g.useState(!1),ce=g.useRef(null),xe=g.useRef(null);g.useEffect(()=>{const V=Et=>{ce.current&&!ce.current.contains(Et.target)&&Wt(!1),xe.current&&!xe.current.contains(Et.target)&&Bt(!1)};return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[]);const[be,We]=g.useState(!1);g.useEffect(()=>{O&&pe&&(Dt(!0),Vt(!1))},[O,pe]);const oi=V=>{const Et=V.target.files[0];Et&&Et.type.startsWith("image/")&&z(Et),V.target.value=""},At=V=>{s("icon",{iconData:V,text:V.symbol,fontSize:48,fontFamily:"Arial",fill:"#000000"})},de=V=>{s("qrcode",V)},K=V=>{s("barcode",V)},Be=V=>{s("sticker",V)},qt=V=>{s("embroidery",V)},ai=V=>{s("text",V)},ri=(V,Et)=>{s(V,Et)},Se=V=>{s("image",V)},Xt=()=>{Wt(!ye),Bt(!1)},he=()=>{Bt(!De),Wt(!1)},Pt=V=>{V==="custom"?s("text"):V==="templates"&&gt(!0),Wt(!1)};g.useEffect(()=>{Vi(So.map(V=>V.fontFamily).filter(Boolean))},[]);const Pe=V=>{s("text",{...V}),Wt(!1)},yt=V=>{s(V),Bt(!1)},dt="#475569",si=e.jsxs("div",{className:"toolbar-dropdown",ref:xe,children:[e.jsxs("button",{className:"toolbar-btn compact dropdown-trigger",disabled:R,onClick:he,title:"Add a shape — rectangle, circle, star and more",children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"shapes",size:18,color:R?"#94a3b8":dt})}),e.jsx("span",{className:"label",children:"Shapes"})]}),e.jsxs("div",{className:`dropdown-menu ${De?"show":""}`,children:[e.jsxs("button",{onClick:()=>yt("rectangle"),children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"rectangle",size:16,color:dt})})," Rectangle"]}),e.jsxs("button",{onClick:()=>yt("circle"),children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"circle",size:16,color:dt})})," Circle"]}),e.jsxs("button",{onClick:()=>yt("triangle"),children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"triangle",size:16,color:dt})})," Triangle"]}),e.jsxs("button",{onClick:()=>yt("star"),children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"star",size:16,color:dt})})," Star"]}),e.jsxs("button",{onClick:()=>yt("heart"),children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"heart",size:16,color:dt})})," Heart"]}),e.jsxs("button",{onClick:()=>yt("arrow"),children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"arrowShape",size:16,color:dt})})," Arrow"]}),e.jsxs("button",{onClick:()=>yt("diamond"),children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"diamond",size:16,color:dt})})," Diamond"]}),e.jsxs("button",{onClick:()=>yt("hexagon"),children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"hexagon",size:16,color:dt})})," Hexagon"]}),e.jsxs("button",{onClick:()=>yt("pentagon"),children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"pentagon",size:16,color:dt})})," Pentagon"]}),e.jsxs("button",{onClick:()=>yt("oval"),children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"oval",size:16,color:dt})})," Oval"]}),e.jsxs("button",{onClick:()=>yt("roundedRectangle"),children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"roundedRect",size:16,color:dt})})," Rounded Rectangle"]}),e.jsxs("button",{onClick:()=>yt("horizontalLine"),children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"horizontalLine",size:16,color:dt})})," Horizontal Line"]})]})]}),Tt=e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>ft(!0),disabled:R,title:"Add QR Code",children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"qrcode",size:18,color:R?"#94a3b8":dt})}),e.jsx("span",{className:"label",children:"QR Code"})]}),e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>kt(!0),disabled:R,title:"Add Barcode",children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"barcode",size:18,color:R?"#94a3b8":dt})}),e.jsx("span",{className:"label",children:"Barcode"})]})]}),ve=e.jsxs("div",{className:"toolbar-view-control",role:"group","aria-label":"View options",children:[e.jsx("span",{className:"toolbar-view-label",children:"View"}),e.jsxs("div",{className:"toolbar-view-segments",children:[e.jsxs("button",{className:`toolbar-btn compact ${S?"active":""}`,onClick:d,"aria-pressed":S,title:"Toggle Grid",children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"grid",size:18,color:S?"#ffffff":dt})}),e.jsx("span",{className:"label",children:"Grid"})]}),e.jsxs("button",{className:`toolbar-btn compact ${D?"active":""}`,onClick:h,"aria-pressed":D,title:"Toggle Rulers",children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"ruler",size:18,color:D?"#ffffff":dt})}),e.jsx("span",{className:"label",children:"Rulers"})]}),e.jsxs("button",{className:`toolbar-btn compact ${M?"active":""}`,onClick:w,"aria-pressed":M,title:"Snap to Grid",children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"magnet",size:18,color:M?"#ffffff":dt})}),e.jsx("span",{className:"label",children:"Snap"})]}),e.jsxs("button",{className:`toolbar-btn compact ${$?"active":""}`,onClick:k,"aria-pressed":$,title:"Toggle print area & safe-zone guides",children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"rectangle",size:18,color:$?"#ffffff":dt})}),e.jsx("span",{className:"label",children:"Print area"})]})]})]});return e.jsxs("div",{className:"toolbar",children:[e.jsxs("div",{className:"toolbar-section",children:[e.jsxs("div",{className:"toolbar-group",children:[e.jsxs("button",{className:"toolbar-btn compact",onClick:n,disabled:!N||R,title:"Undo (Ctrl+Z)",children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"undo",size:18,color:!N||R?"#94a3b8":dt})}),e.jsx("span",{className:"label",children:"Undo"})]}),e.jsxs("button",{className:"toolbar-btn compact",onClick:l,disabled:!T||R,title:"Redo (Ctrl+Y)",children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"redo",size:18,color:!T||R?"#94a3b8":dt})}),e.jsx("span",{className:"label",children:"Redo"})]})]}),e.jsx("div",{className:"toolbar-separator"}),ot&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-group",children:e.jsxs("button",{className:"toolbar-btn compact ai-btn",onClick:()=>{if(!O){Vt(!0),st&&st();return}Dt(!0)},disabled:R,title:G?"You're out of AI credits — add credits to generate images":"AI: generate artwork, images, logos, icons and much more",style:{color:R?"#94a3b8":"#6d28d9",background:R?void 0:"linear-gradient(135deg, #ede9fe, #f5f3ff)"},children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"sparkle",size:18,color:R?"#94a3b8":"#7c3aed"})}),e.jsx("span",{className:"label",children:"AI Image"})]})}),e.jsx("div",{className:"toolbar-separator"})]}),J&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-group",children:e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>J(),disabled:R,title:"Request collaboration: work on this design together with the seller before you order",children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"share",size:18,color:R?"#94a3b8":"#0f766e"})}),e.jsx("span",{className:"label",children:"Collaborate"})]})}),e.jsx("div",{className:"toolbar-separator"})]}),e.jsxs("div",{className:"toolbar-group",children:[e.jsxs("div",{className:"toolbar-dropdown",ref:ce,children:[e.jsxs("button",{className:"toolbar-btn compact dropdown-trigger",disabled:R,title:"Add Text",onClick:Xt,children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"text",size:18,color:R?"#94a3b8":dt})}),e.jsx("span",{className:"label",children:"Text"})]}),e.jsxs("div",{className:`dropdown-menu text-design-menu ${ye?"show":""}`,style:{minWidth:240},children:[e.jsxs("button",{onClick:()=>Pt("custom"),children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"text",size:16,color:dt})})," Custom text"]}),e.jsx("div",{style:{padding:"6px 10px 2px",fontSize:11,fontWeight:700,color:"#94a3b8",textTransform:"uppercase",letterSpacing:.5},children:"Design ideas"}),So.map(V=>e.jsx("button",{onClick:()=>Pe(V),title:`Add "${V.text}"`,style:{justifyContent:"flex-start"},children:e.jsx("span",{style:{fontFamily:`'${V.fontFamily}', cursive`,fontWeight:V.fontWeight||"normal",fontStyle:V.fontStyle||"normal",color:V.fill||"#111827",fontSize:18,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textTransform:V.textTransform||"none"},children:V.text})},V.id)),e.jsxs("button",{onClick:()=>Pt("templates"),style:{borderTop:"1px solid #e2e8f0",marginTop:4,color:"#2563eb",fontWeight:600},children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"book",size:16,color:"#2563eb"})})," More designs…"]})]})]}),!C&&si,e.jsx("div",{className:"toolbar-separator"}),ht?e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>ht(),disabled:R,title:"Upload — add a new image from your device or re-use one you've uploaded before",children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"cloudUpload",size:18,color:R?"#94a3b8":dt})}),e.jsx("span",{className:"label",children:"Upload"})]}):e.jsxs("label",{className:"toolbar-btn compact file-upload",title:"Upload your own image",style:{cursor:R?"not-allowed":"pointer"},children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"upload",size:18,color:R?"#94a3b8":dt})}),e.jsx("span",{className:"label",children:"Upload"}),e.jsx("input",{type:"file",accept:"image/*",onChange:oi,disabled:R})]}),e.jsx("div",{className:"toolbar-separator"}),e.jsx(va,{onSelectIcon:At,theme:Y,disabled:R}),e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>It(!0),disabled:R,title:"Add Sticker",children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"sticker",size:18,color:R?"#94a3b8":dt})}),e.jsx("span",{className:"label",children:"Stickers"})]}),!C&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-separator"}),Tt]})]}),m&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-separator"}),e.jsx("div",{className:"toolbar-group embroidery-group",children:e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>B(!0),disabled:R,title:"Add Embroidery Design",children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"thread",size:18,color:R?"#94a3b8":dt})}),e.jsx("span",{className:"label",children:"Embroidery"})]})})]}),L&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-separator"}),e.jsx("div",{className:"toolbar-group handcraft-group",children:e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>X(!0),disabled:R,title:"Add a signage / handcraft template",children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"briefcase",size:18,color:R?"#94a3b8":dt})}),e.jsx("span",{className:"label",children:"Signage"})]})})]}),!C&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-separator"}),e.jsx("div",{className:"toolbar-group",children:ve})]}),C&&e.jsxs("div",{className:"toolbar-group",style:{marginLeft:"auto"},children:[be&&e.jsxs(e.Fragment,{children:[si,e.jsx("div",{className:"toolbar-separator"}),Tt,e.jsx("div",{className:"toolbar-separator"}),ve,e.jsx("div",{className:"toolbar-separator"})]}),e.jsxs("button",{type:"button",className:`toolbar-btn compact ${be?"active":""}`,onClick:()=>We(V=>!V),title:"Advanced tools — shapes, QR code, barcode, grid, rulers, snap & print area",children:[e.jsx("span",{className:"icon",children:e.jsx(et,{name:"gear",size:18,color:be?"#ffffff":dt})}),e.jsx("span",{className:"label",children:"Advanced"})]})]})]}),e.jsx(wa,{isOpen:Q,onClose:()=>ft(!1),onAddQRCode:de,theme:Y}),e.jsx(ka,{isOpen:zt,onClose:()=>kt(!1),onAddBarcode:K,theme:Y}),e.jsx(Ca,{isOpen:Ht,onClose:()=>It(!1),onAddSticker:Be,theme:Y,apiKey:ut,apiEndpoint:E}),e.jsx(za,{isOpen:jt,onClose:()=>B(!1),onAddEmbroidery:qt,theme:Y,apiKey:ut,apiEndpoint:E}),e.jsx(Ea,{isOpen:oe,onClose:()=>X(!1),onAddHandcraft:ai,theme:Y}),e.jsx(Ia,{isOpen:ii,onClose:()=>gt(!1),onAddText:ri,theme:Y}),ot&&e.jsx(La,{isOpen:Zt,onClose:()=>Dt(!1),onAddImage:Se,theme:Y,apiKey:ut,apiEndpoint:E,aiEndpoint:v,onAIImageGenerate:at,outOfCredits:G,onAddAiCredits:q})]})},Wa=({value:s="Arial",onChange:o=()=>{},onFontLoaded:r=()=>{}})=>{const[n,l]=g.useState(!1),[d,h]=g.useState(""),w=g.useRef(null);g.useEffect(()=>{n&&Ze(wo)},[n]),g.useEffect(()=>{if(!n)return;const N=S=>{w.current&&!w.current.contains(S.target)&&l(!1)},T=S=>{S.key==="Escape"&&l(!1)};return document.addEventListener("mousedown",N),document.addEventListener("keydown",T),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",T)}},[n]);const k=g.useMemo(()=>{const N=d.trim().toLowerCase();return N?Bi.map(T=>({...T,fonts:T.fonts.filter(S=>S.toLowerCase().includes(N))})).filter(T=>T.fonts.length>0):Bi},[d]),z=async N=>{o(N),l(!1),h(""),await ko(N),r()};return e.jsxs("div",{ref:w,style:{position:"relative",width:"100%"},children:[e.jsxs("button",{type:"button",onClick:()=>l(N=>!N),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 10px",border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",cursor:"pointer",fontSize:14},title:"Choose a font",children:[e.jsx("span",{style:{fontFamily:`"${s}"`,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s}),e.jsx("span",{style:{color:"#64748b",fontSize:12},children:"▾"})]}),n&&e.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:1e3,background:"#fff",border:"1px solid #cbd5e1",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.15)",maxHeight:320,display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsx("input",{autoFocus:!0,value:d,onChange:N=>h(N.target.value),placeholder:"Search fonts…",style:{margin:8,padding:"6px 8px",border:"1px solid #e2e8f0",borderRadius:6,fontSize:13,outline:"none"}}),e.jsxs("div",{style:{overflowY:"auto",padding:"0 4px 6px"},children:[k.map(N=>e.jsxs("div",{children:[e.jsx("div",{style:{position:"sticky",top:0,background:"#f8fafc",color:"#64748b",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.04em",padding:"6px 8px"},children:N.name}),N.fonts.map(T=>e.jsx("button",{type:"button",onMouseEnter:()=>Ze([T]),onClick:()=>z(T),style:{width:"100%",textAlign:"left",padding:"8px 10px",border:"none",borderRadius:6,cursor:"pointer",fontSize:16,fontFamily:`"${T}"`,background:T===s?"#eff6ff":"transparent",color:T===s?"#1d4ed8":"#0f172a"},children:T},T))]},N.name)),k.length===0&&e.jsxs("div",{style:{padding:12,color:"#94a3b8",fontSize:13},children:["No fonts match “",d,"”."]})]})]})]})},Ke=[{name:"White",hex:"#FFFFFF"},{name:"Ecru",hex:"#F3EAD3"},{name:"Cream",hex:"#F7E9C3"},{name:"Silver",hex:"#C8CDD2"},{name:"Light Grey",hex:"#9AA0A6"},{name:"Steel Grey",hex:"#5F676E"},{name:"Charcoal",hex:"#33373B"},{name:"Black",hex:"#101113"},{name:"Pale Pink",hex:"#F6C5D3"},{name:"Rose",hex:"#E8638C"},{name:"Fuchsia",hex:"#D81B7A"},{name:"Red",hex:"#D11F2D"},{name:"Crimson",hex:"#9E1B2F"},{name:"Burgundy",hex:"#6E1F2C"},{name:"Peach",hex:"#F6A98C"},{name:"Orange",hex:"#F26A21"},{name:"Pumpkin",hex:"#D2541E"},{name:"Gold",hex:"#E8A317"},{name:"Yellow",hex:"#F4C500"},{name:"Lemon",hex:"#F2E54B"},{name:"Lime",hex:"#9BCB3C"},{name:"Kelly Green",hex:"#2E9E45"},{name:"Green",hex:"#1F7A3D"},{name:"Forest",hex:"#14532D"},{name:"Teal",hex:"#0E8C8C"},{name:"Mint",hex:"#9FE0C4"},{name:"Sky Blue",hex:"#5BB6E8"},{name:"Blue",hex:"#1C76C5"},{name:"Royal Blue",hex:"#1E40AF"},{name:"Navy",hex:"#16244C"},{name:"Turquoise",hex:"#22B5C9"},{name:"Lavender",hex:"#B9A6E0"},{name:"Purple",hex:"#7A3CB0"},{name:"Plum",hex:"#5B2A6B"},{name:"Tan",hex:"#C8A06A"},{name:"Brown",hex:"#7A4A26"},{name:"Coffee",hex:"#4A2F1C"},{name:"Gold Metallic",hex:"#C8A53B"},{name:"Silver Metallic",hex:"#B6BCC4"}];function Oi(s){if(!s)return null;let o=String(s).trim().replace("#","");if(o.length===3&&(o=o.split("").map(n=>n+n).join("")),o.length!==6)return null;const r=parseInt(o,16);return Number.isNaN(r)?null:{r:r>>16&255,g:r>>8&255,b:r&255}}function Ba(s,o){const r=(s.r+o.r)/2,n=s.r-o.r,l=s.g-o.g,d=s.b-o.b;return(2+r/256)*n*n+4*l*l+(2+(255-r)/256)*d*d}function Pa(s){const o=Oi(s);if(!o)return Ke[0];let r=Ke[0],n=1/0;for(const l of Ke){const d=Oi(l.hex),h=Ba(o,d);h<n&&(n=h,r=l)}return r}function Oa(s){return Oi(s)?Pa(s).hex:s}const Li={widthIn:12,dpi:300,safeAreaPct:5},Ha=6e3;function ei(s){const o=s||{};return{widthIn:Number(o.widthIn)>0?Number(o.widthIn):Li.widthIn,dpi:Number(o.dpi)>0?Number(o.dpi):Li.dpi,safeAreaPct:Number.isFinite(Number(o.safeAreaPct))?Math.min(40,Math.max(0,Number(o.safeAreaPct))):Li.safeAreaPct}}function $a(s,o,r){const{widthIn:n,dpi:l}=ei(r);if(!(s>0))return 1;let h=n*l/s;h=Math.max(1,h);const w=Math.max(s,o||s),k=Ha/w;return Math.min(h,Math.max(1,k))}function Hi(s,o){const{widthIn:r}=ei(o);return s>0?r/s:0}function Co(s,o,r){var w,k,z,N;if(!s||!["image","sticker"].includes(s.type))return null;const l=s.originalWidth||s.naturalWidth||((w=s.imageObject)==null?void 0:w.naturalWidth)||((k=s._imageElement)==null?void 0:k.naturalWidth)||((z=s._stickerElement)==null?void 0:z.naturalWidth)||((N=s.imageData)==null?void 0:N.naturalWidth)||0;if(!(l>0))return null;const d=s.width||0;if(!(d>0))return null;const h=d*Hi(o,r);return h>0?l/h:null}function Fo(s,o){const{dpi:r}=ei(o);return s==null?null:s>=r?{level:"good",color:"#16a34a",label:"Print quality: Excellent"}:s>=r/2?{level:"warn",color:"#d97706",label:"Print quality: Acceptable — may look soft"}:{level:"bad",color:"#dc2626",label:"Print quality: Too low — will look blurry"}}const Xe=({checked:s,onChange:o,disabled:r=!1,title:n})=>e.jsxs("label",{className:"switch",title:n,children:[e.jsx("input",{type:"checkbox",checked:s,onChange:o,disabled:r}),e.jsx("span",{className:"switch-track"})]}),_a=({selectedElement:s,selectedCount:o=0,onUpdate:r,onMoveLayer:n,onAlignSelection:l,onDistributeSelection:d,onDeleteSelection:h,availableFonts:w,theme:k,isEmbroidery:z=!1,onFontLoaded:N=()=>{},canvasWidth:T,canvasHeight:S,printConfig:D,onRemoveBackground:M})=>{const[$,Z]=g.useState(!1),[Y,R]=g.useState(!1),[lt,_]=g.useState("");if(o>1)return e.jsxs("div",{className:"properties-panel",children:[e.jsx("h3",{children:"Properties"}),e.jsxs("div",{className:"property-group",children:[e.jsxs("h4",{children:[o," elements selected"]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Align"}),e.jsxs("div",{className:"align-buttons",children:[e.jsx("button",{type:"button",title:"Align left",onClick:()=>l==null?void 0:l("left"),children:"⬅"}),e.jsx("button",{type:"button",title:"Center horizontally",onClick:()=>l==null?void 0:l("hcenter"),children:"⬌"}),e.jsx("button",{type:"button",title:"Align right",onClick:()=>l==null?void 0:l("right"),children:"➡"}),e.jsx("button",{type:"button",title:"Align top",onClick:()=>l==null?void 0:l("top"),children:"⬆"}),e.jsx("button",{type:"button",title:"Center vertically",onClick:()=>l==null?void 0:l("vcenter"),children:"⬍"}),e.jsx("button",{type:"button",title:"Align bottom",onClick:()=>l==null?void 0:l("bottom"),children:"⬇"})]})]}),o>2&&e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Distribute"}),e.jsxs("div",{className:"align-buttons",children:[e.jsx("button",{type:"button",title:"Distribute horizontally",onClick:()=>d==null?void 0:d("h"),children:"↔"}),e.jsx("button",{type:"button",title:"Distribute vertically",onClick:()=>d==null?void 0:d("v"),children:"↕"})]})]}),e.jsx("div",{className:"property-row",children:e.jsxs("button",{type:"button",className:"multi-delete-btn",onClick:()=>h==null?void 0:h(),children:["Delete ",o," elements"]})})]})]});if(!s)return e.jsxs("div",{className:"properties-panel",children:[e.jsx("h3",{children:"Properties"}),e.jsx("p",{className:"no-selection",children:"Select an element to edit its properties"})]});const F=(C,G)=>{r(s.id,{[C]:G})},ut=()=>{var C,G,H;return e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Text"}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Content"}),e.jsx("textarea",{value:s.text||"",onChange:m=>F("text",m.target.value),rows:3,placeholder:"Enter your text here..."})]}),e.jsx("div",{className:"subsection-label",children:"Typography"}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Font Family"}),e.jsx(Wa,{value:s.fontFamily||"Arial",onChange:m=>F("fontFamily",m),onFontLoaded:N})]}),e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Font Size"}),e.jsx("input",{type:"number",value:s.fontSize||20,onChange:m=>F("fontSize",parseInt(m.target.value)),min:"8",max:"200"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Line Height"}),e.jsx("input",{type:"number",step:"0.1",value:s.lineHeight||1.2,onChange:m=>F("lineHeight",parseFloat(m.target.value)),min:"0.5",max:"3"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Letter Spacing"}),e.jsx("input",{type:"number",step:"0.5",value:s.letterSpacing||0,onChange:m=>F("letterSpacing",parseFloat(m.target.value)||0),min:"-5",max:"50"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Outline Width"}),e.jsx("input",{type:"number",step:"0.5",value:s.strokeWidth||0,onChange:m=>F("strokeWidth",parseFloat(m.target.value)||0),min:"0",max:"20"})]})]}),(s.strokeWidth||0)>0&&e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Outline Color"}),e.jsx("input",{type:"color",value:s.stroke||"#000000",onChange:m=>F("stroke",m.target.value)})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Curve"}),e.jsxs("div",{className:"slider-row",children:[e.jsx("input",{type:"range",min:"-180",max:"180",step:"1",value:s.curve||0,onChange:m=>F("curve",parseInt(m.target.value,10))}),e.jsxs("span",{className:"value-chip",children:[s.curve||0,"°"]}),e.jsx("button",{type:"button",className:"reset-btn",onClick:()=>F("curve",0),disabled:!s.curve,title:"Reset to straight","aria-label":"Reset curve to straight",children:"↺"})]})]}),e.jsx("div",{className:"subsection-label",children:"Style"}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Font Weight"}),e.jsxs("div",{className:"button-group",children:[e.jsx("button",{className:s.fontWeight==="lighter"||s.fontWeight==="300"?"active":"",onClick:()=>F("fontWeight","300"),title:"Light",children:"Light"}),e.jsx("button",{className:!s.fontWeight||s.fontWeight==="normal"||s.fontWeight==="400"?"active":"",onClick:()=>F("fontWeight","normal"),title:"Normal",children:"Normal"}),e.jsx("button",{className:s.fontWeight==="bold"||s.fontWeight==="700"?"active":"",onClick:()=>F("fontWeight","bold"),title:"Bold",children:e.jsx("strong",{children:"Bold"})})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Style"}),e.jsxs("div",{className:"button-group",children:[e.jsx("button",{className:s.fontStyle==="italic"?"active":"",onClick:()=>F("fontStyle",s.fontStyle==="italic"?"normal":"italic"),title:"Italic",children:e.jsx("em",{children:"I"})}),e.jsx("button",{className:(C=s.textDecoration)!=null&&C.includes("underline")?"active":"",onClick:()=>{const m=s.textDecoration||"",L=m.split(" ").filter(Q=>Q&&Q!=="underline");m.includes("underline")||L.push("underline"),F("textDecoration",L.join(" ").trim())},title:"Underline",children:e.jsx("u",{children:"U"})}),e.jsx("button",{className:(G=s.textDecoration)!=null&&G.includes("overline")?"active":"",onClick:()=>{const m=s.textDecoration||"",L=m.split(" ").filter(Q=>Q&&Q!=="overline");m.includes("overline")||L.push("overline"),F("textDecoration",L.join(" ").trim())},title:"Overline",children:e.jsx("span",{style:{textDecoration:"overline"},children:"O"})}),e.jsx("button",{className:(H=s.textDecoration)!=null&&H.includes("line-through")?"active":"",onClick:()=>{const m=s.textDecoration||"",L=m.split(" ").filter(Q=>Q&&Q!=="line-through");m.includes("line-through")||L.push("line-through"),F("textDecoration",L.join(" ").trim())},title:"Strikethrough",children:e.jsx("s",{children:"S"})})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Transform"}),e.jsxs("div",{className:"button-group",children:[e.jsx("button",{className:!s.textTransform||s.textTransform==="none"?"active":"",onClick:()=>F("textTransform","none"),title:"Normal",children:"Aa"}),e.jsx("button",{className:s.textTransform==="uppercase"?"active":"",onClick:()=>F("textTransform","uppercase"),title:"Uppercase",children:"AA"}),e.jsx("button",{className:s.textTransform==="lowercase"?"active":"",onClick:()=>F("textTransform","lowercase"),title:"Lowercase",children:"aa"}),e.jsx("button",{className:s.textTransform==="capitalize"?"active":"",onClick:()=>F("textTransform","capitalize"),title:"Capitalize",children:"Aa"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Alignment"}),e.jsxs("div",{className:"button-group",children:[e.jsx("button",{className:!s.textAlign||s.textAlign==="left"?"active":"",onClick:()=>F("textAlign","left"),title:"Left Align",children:"⬅"}),e.jsx("button",{className:s.textAlign==="center"?"active":"",onClick:()=>F("textAlign","center"),title:"Center Align",children:"↔"}),e.jsx("button",{className:s.textAlign==="right"?"active":"",onClick:()=>F("textAlign","right"),title:"Right Align",children:"➡"}),e.jsx("button",{className:s.textAlign==="justify"?"active":"",onClick:()=>F("textAlign","justify"),title:"Justify",children:"≡"})]})]}),e.jsx("div",{className:"subsection-label",children:"Color"}),e.jsx("div",{className:"property-row",children:e.jsxs("div",{className:"color-input-group",children:[e.jsxs("div",{className:"color-input-item",children:[e.jsx("label",{children:z?"Thread Color":"Text Color"}),e.jsx("input",{type:"color",value:s.fill||"#000000",onChange:m=>F("fill",m.target.value)}),z&&e.jsx("div",{title:"Real thread colours",style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:6,maxWidth:200},children:Ke.map(m=>e.jsx("button",{type:"button",title:m.name,onClick:()=>F("fill",m.hex),style:{width:16,height:16,padding:0,borderRadius:"50%",background:m.hex,border:(s.fill||"").toLowerCase()===m.hex.toLowerCase()?"2px solid #2563eb":"1px solid #cbd5e1",cursor:"pointer"}},m.hex))})]}),e.jsxs("div",{className:"color-input-item",children:[e.jsx("label",{children:"Background"}),e.jsxs("div",{className:"color-with-toggle",children:[e.jsx(Xe,{checked:!!s.hasBackground,onChange:m=>F("hasBackground",m.target.checked),title:s.hasBackground?"Hide background":"Show background"}),e.jsx("input",{type:"color",value:s.backgroundColor||"#ffffff",onChange:m=>F("backgroundColor",m.target.value),disabled:!s.hasBackground})]})]})]})}),$&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Letter Spacing"}),e.jsx("input",{type:"number",step:"0.1",value:s.letterSpacing||0,onChange:m=>F("letterSpacing",parseFloat(m.target.value)),min:"-5",max:"10"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Word Spacing"}),e.jsx("input",{type:"number",step:"0.1",value:s.wordSpacing||0,onChange:m=>F("wordSpacing",parseFloat(m.target.value)),min:"-10",max:"20"})]})]}),e.jsx("div",{className:"property-row",children:e.jsxs("div",{className:"text-shadow-controls",children:[e.jsxs("div",{className:"switch-row",children:[e.jsx("span",{className:"switch-label",children:"Text shadow"}),e.jsx(Xe,{checked:!!s.hasTextShadow,onChange:m=>F("hasTextShadow",m.target.checked)})]}),s.hasTextShadow&&e.jsxs("div",{className:"shadow-properties",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"H-Offset"}),e.jsx("input",{type:"number",value:s.textShadowX||2,onChange:m=>F("textShadowX",parseInt(m.target.value)),min:"-20",max:"20"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"V-Offset"}),e.jsx("input",{type:"number",value:s.textShadowY||2,onChange:m=>F("textShadowY",parseInt(m.target.value)),min:"-20",max:"20"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Blur"}),e.jsx("input",{type:"number",value:s.textShadowBlur||4,onChange:m=>F("textShadowBlur",parseInt(m.target.value)),min:"0",max:"20"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Shadow Color"}),e.jsx("input",{type:"color",value:s.textShadowColor||"#000000",onChange:m=>F("textShadowColor",m.target.value)})]})]})]})}),e.jsx("div",{className:"property-row",children:e.jsxs("div",{className:"color-input-group",children:[e.jsxs("div",{className:"color-input-item",children:[e.jsx("label",{children:"Stroke Color"}),e.jsx("input",{type:"color",value:s.stroke||"#000000",onChange:m=>F("stroke",m.target.value)})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Stroke Width"}),e.jsx("input",{type:"number",value:s.strokeWidth||0,onChange:m=>F("strokeWidth",parseInt(m.target.value)),min:"0",max:"20"})]})]})}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Opacity"}),e.jsxs("div",{className:"slider-row",children:[e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:s.opacity||1,onChange:m=>F("opacity",parseFloat(m.target.value))}),e.jsxs("span",{className:"value-chip",children:[Math.round((s.opacity||1)*100),"%"]})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Font Variant"}),e.jsxs("select",{value:s.fontVariant||"normal",onChange:m=>F("fontVariant",m.target.value),children:[e.jsx("option",{value:"normal",children:"Normal"}),e.jsx("option",{value:"small-caps",children:"Small Caps"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Writing Mode"}),e.jsxs("select",{value:s.writingMode||"horizontal-tb",onChange:m=>F("writingMode",m.target.value),children:[e.jsx("option",{value:"horizontal-tb",children:"Horizontal"}),e.jsx("option",{value:"vertical-rl",children:"Vertical Right-to-Left"}),e.jsx("option",{value:"vertical-lr",children:"Vertical Left-to-Right"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Direction"}),e.jsxs("div",{className:"button-group",children:[e.jsx("button",{className:!s.direction||s.direction==="ltr"?"active":"",onClick:()=>F("direction","ltr"),title:"Left to Right",children:"LTR"}),e.jsx("button",{className:s.direction==="rtl"?"active":"",onClick:()=>F("direction","rtl"),title:"Right to Left",children:"RTL"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Background Padding"}),e.jsx("input",{type:"number",value:s.backgroundPadding||5,onChange:m=>F("backgroundPadding",parseInt(m.target.value)),min:"0",max:"50",disabled:!s.hasBackground})]})]})]})},E=()=>e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Shape Properties"}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Fill Color"}),e.jsx("input",{type:"color",value:s.fill||"#000000",onChange:C=>F("fill",C.target.value)})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Stroke Color"}),e.jsx("input",{type:"color",value:s.stroke||"#000000",onChange:C=>F("stroke",C.target.value)})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Stroke Width"}),e.jsx("input",{type:"number",value:s.strokeWidth||2,onChange:C=>F("strokeWidth",parseInt(C.target.value)),min:"0",max:"20"})]}),s.type==="star"&&e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Star Points"}),e.jsx("input",{type:"number",value:s.numPoints||5,onChange:C=>F("numPoints",parseInt(C.target.value)),min:"3",max:"20"})]}),s.type==="roundedRectangle"&&e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Corner Radius"}),e.jsx("input",{type:"number",value:s.cornerRadius||10,onChange:C=>F("cornerRadius",parseInt(C.target.value)),min:"0",max:"50"})]})]}),ot=async()=>{if(!(!M||Y)){R(!0),_("");try{await M(s)}catch{_("Could not remove the background. Please try again.")}finally{R(!1)}}},v=["image","sticker","embroidery"],at=()=>!M||!v.includes(s.type)?null:e.jsxs("div",{className:"property-group",children:[e.jsx("button",{type:"button",className:"remove-bg-btn",onClick:ot,disabled:Y,style:{width:"100%",padding:"9px 12px",borderRadius:8,border:"1px solid #cbd5e1",background:Y?"#f1f5f9":"#fff",color:"#334155",fontSize:13,fontWeight:600,cursor:Y?"wait":"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:8},children:Y?"Removing background…":"✂️ Remove background"}),lt&&e.jsx("div",{style:{marginTop:6,fontSize:12,color:"#dc2626"},children:lt})]}),ct=()=>e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Image Properties"}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Opacity"}),e.jsxs("div",{className:"slider-row",children:[e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:s.opacity||1,onChange:C=>F("opacity",parseFloat(C.target.value))}),e.jsxs("span",{className:"value-chip",children:[Math.round((s.opacity||1)*100),"%"]})]})]}),$&&e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Border Radius"}),e.jsx("input",{type:"number",value:s.borderRadius||0,onChange:C=>F("borderRadius",parseInt(C.target.value)),min:"0",max:"50"})]})]}),q=()=>e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Position & Size"}),e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"X"}),e.jsx("input",{type:"number",value:Math.round(s.x)||0,onChange:C=>F("x",parseInt(C.target.value))})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Y"}),e.jsx("input",{type:"number",value:Math.round(s.y)||0,onChange:C=>F("y",parseInt(C.target.value))})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Width"}),e.jsx("input",{type:"number",value:Math.round(s.width)||0,onChange:C=>F("width",parseInt(C.target.value)),min:"1"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Height"}),e.jsx("input",{type:"number",value:Math.round(s.height)||0,onChange:C=>F("height",parseInt(C.target.value)),min:"1"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Rotation"}),e.jsxs("div",{className:"slider-row",children:[e.jsx("input",{type:"range",min:"-180",max:"180",value:s.rotation||0,onChange:C=>F("rotation",parseInt(C.target.value))}),e.jsxs("span",{className:"value-chip",children:[s.rotation||0,"°"]}),e.jsx("button",{type:"button",className:"reset-btn",onClick:()=>F("rotation",0),disabled:!s.rotation,title:"Reset rotation","aria-label":"Reset rotation",children:"↺"})]})]}),T?e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Align"}),e.jsxs("div",{className:"align-buttons",children:[e.jsx("button",{type:"button",title:"Align left",onClick:()=>F("x",0),children:"⬅"}),e.jsx("button",{type:"button",title:"Center horizontally",onClick:()=>F("x",Math.round((T-(s.width||0))/2)),children:"⬌"}),e.jsx("button",{type:"button",title:"Align right",onClick:()=>F("x",Math.round(T-(s.width||0))),children:"➡"}),S?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",title:"Align top",onClick:()=>F("y",0),children:"⬆"}),e.jsx("button",{type:"button",title:"Center vertically",onClick:()=>F("y",Math.round((S-(s.height||0))/2)),children:"⬍"}),e.jsx("button",{type:"button",title:"Align bottom",onClick:()=>F("y",Math.round(S-(s.height||0))),children:"⬇"})]}):null]})]}):null,e.jsxs("div",{className:"property-row lock-toggles",children:[s.type!=="text"&&e.jsxs("div",{className:"switch-row",children:[e.jsx("span",{className:"switch-label",children:"Lock aspect ratio"}),e.jsx(Xe,{checked:!!s.lockAspect,onChange:C=>F("lockAspect",C.target.checked)})]}),e.jsxs("div",{className:"switch-row",children:[e.jsx("span",{className:"switch-label",children:"Lock position"}),e.jsx(Xe,{checked:!!s.locked,onChange:C=>F("locked",C.target.checked)})]})]})]}),O=()=>e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Line Properties"}),e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Line Width"}),e.jsx("input",{type:"number",value:s.strokeWidth||s.height||2,onChange:C=>{const G=parseInt(C.target.value);F("strokeWidth",G),F("height",G)},min:"1",max:"50"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Length"}),e.jsx("input",{type:"number",value:s.width||200,onChange:C=>F("width",parseInt(C.target.value)),min:"10",max:"1000"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Line Color"}),e.jsxs("div",{className:"color-input-group",children:[e.jsx("input",{type:"color",value:s.stroke||s.fill||"#000000",onChange:C=>{F("stroke",C.target.value),F("fill",C.target.value)}}),e.jsx("input",{type:"text",value:s.stroke||s.fill||"#000000",onChange:C=>{F("stroke",C.target.value),F("fill",C.target.value)},placeholder:"#000000"})]})]})]}),st=()=>e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Layer Controls"}),e.jsxs("div",{className:"button-group vertical",children:[e.jsx("button",{onClick:()=>n(s.id,"top"),children:"Bring to Front"}),e.jsx("button",{onClick:()=>n(s.id,"up"),children:"Bring Forward"}),e.jsx("button",{onClick:()=>n(s.id,"down"),children:"Send Backward"}),e.jsx("button",{onClick:()=>n(s.id,"bottom"),children:"Send to Back"})]})]}),J=["rectangle","circle","triangle","star","arrow","diamond","hexagon","pentagon","heart","oval","roundedRectangle"],ht=()=>{const C=Co(s,T,D);if(C==null)return null;const G=Fo(C,D);return G?e.jsxs("div",{className:"property-group dpi-meter",style:{borderLeft:`4px solid ${G.color}`,paddingLeft:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:9,height:9,borderRadius:"50%",background:G.color,flex:"0 0 auto"}}),e.jsxs("strong",{style:{color:G.color,fontSize:13},children:[Math.round(C)," DPI"]})]}),e.jsx("div",{style:{fontSize:12,color:"#475569",marginTop:2},children:G.label}),G.level!=="good"&&e.jsx("div",{style:{fontSize:11,color:"#64748b",marginTop:4},children:"Make it smaller on the canvas or upload a higher-resolution image."})]}):null};return e.jsxs("div",{className:"properties-panel",children:[e.jsxs("div",{className:"panel-header",children:[e.jsx("h3",{children:"Properties"}),e.jsx("span",{className:"element-type",children:s.type})]}),e.jsxs("div",{className:"panel-content",children:[ht(),at(),s.type==="text"&&ut(),J.includes(s.type)&&E(),s.type==="image"&&ct(),s.type==="horizontalLine"&&O(),q(),st(),e.jsx("div",{className:"property-group",children:e.jsxs("button",{className:"toggle-advanced",onClick:()=>Z(!$),children:[$?"Hide":"Show"," Advanced Options"]})})]})]})},Va=({elements:s,selectedElement:o,onSelectElement:r,onMoveLayer:n,onDeleteElement:l,theme:d})=>{const h=(k,z)=>{switch(k){case"text":return"T";case"rectangle":return"▭";case"circle":return"●";case"triangle":return"▲";case"star":return"★";case"arrow":return"➤";case"diamond":return"◆";case"hexagon":return"⬡";case"pentagon":return"⬟";case"heart":return"♥";case"oval":return"⬭";case"roundedRectangle":return"▢";case"horizontalLine":return"―";case"image":return"🖼";case"qrcode":return"⬚";case"barcode":return"|||";case"sticker":return"🎭";case"embroidery":return"🧵";default:return"?"}},w=k=>{var z,N;if(k.type==="text")return k.isIcon&&k.iconData?`Icon: ${k.iconData.name}`:((z=k.text)==null?void 0:z.substring(0,20))+(((N=k.text)==null?void 0:N.length)>20?"...":"")||"Text";if(k.type==="qrcode")return`QR Code: ${(k.data||"").substring(0,15)+((k.data||"").length>15?"...":"")}`;if(k.type==="barcode"){const T=k.format||"CODE128",S=k.data||"";return`Barcode (${T}): ${S.substring(0,10)+(S.length>10?"...":"")}`}return k.type==="sticker"?`Sticker: ${(k.name||"Untitled").substring(0,15)}`:k.type==="embroidery"?`Embroidery: ${(k.name||"Design").substring(0,15)}`:k.type.charAt(0).toUpperCase()+k.type.slice(1)};return e.jsxs("div",{className:"layers-panel",children:[e.jsxs("div",{className:"panel-header",children:[e.jsx("h3",{children:"Layers"}),e.jsx("span",{className:"layer-count",children:s.length})]}),e.jsx("div",{className:"layers-list",children:s.length===0?e.jsx("div",{className:"no-layers",children:"No elements added yet"}):[...s].reverse().map((k,z)=>e.jsxs("div",{className:`layer-item ${(o==null?void 0:o.id)===k.id?"selected":""}`,onClick:()=>r(k),children:[e.jsxs("div",{className:"layer-info",children:[e.jsx("span",{className:"layer-icon",children:h(k.type)}),e.jsx("span",{className:"layer-name",children:w(k)})]}),e.jsxs("div",{className:"layer-controls",children:[e.jsx("button",{className:"layer-btn",onClick:N=>{N.stopPropagation(),n(k.id,"up")},disabled:z===0,title:"Move Up",children:"↑"}),e.jsx("button",{className:"layer-btn",onClick:N=>{N.stopPropagation(),n(k.id,"down")},disabled:z===s.length-1,title:"Move Down",children:"↓"}),e.jsx("button",{className:"layer-btn delete",onClick:N=>{N.stopPropagation(),l(k.id)},title:"Delete",children:"×"})]})]},k.id))})]})};let Ri=null;function Ga(){if(Ri)return Ri;if(typeof document>"u")return null;const s=document.createElement("canvas");s.width=6,s.height=6;const o=s.getContext("2d");return o.strokeStyle="rgba(255,255,255,0.34)",o.lineWidth=1.7,o.lineCap="round",o.beginPath(),o.moveTo(-2,8),o.lineTo(8,-2),o.stroke(),o.strokeStyle="rgba(0,0,0,0.16)",o.lineWidth=1.1,o.beginPath(),o.moveTo(1.5,8),o.lineTo(8,1.5),o.stroke(),Ri=s,s}function Di(s){return s?(s.productionMethods||[]).map(r=>String(r).toUpperCase()).includes("EMBROIDERY")||s.supportsEmbroidery==="Y":!1}function Je(s,o,r,{fontSize:n=20,color:l="#1f6feb"}={}){const d=Oa(l||"#1f6feb"),h=s.globalAlpha===void 0?1:s.globalAlpha,w=(()=>{const k=Ga();try{return k?s.createPattern(k,"repeat"):null}catch{return null}})();s.save(),s.shadowColor="rgba(0,0,0,0.40)",s.shadowBlur=Math.max(1,n*.05),s.shadowOffsetX=.4,s.shadowOffsetY=Math.max(.8,n*.06),s.fillStyle=d,s.fillText(o,0,r),s.restore(),s.save(),s.fillStyle=d,s.fillText(o,0,r),w&&(s.globalAlpha=h*.85,s.fillStyle=w,s.fillText(o,0,r),s.globalAlpha=h),s.lineJoin="round",s.lineWidth=Math.max(1,n*.05),s.strokeStyle="rgba(28,16,8,0.55)",s.setLineDash&&s.setLineDash([Math.max(2,n*.13),Math.max(1.5,n*.1)]),s.strokeText(o,0,r),s.setLineDash&&s.setLineDash([]),s.restore()}function Ua(s,o,r,n){if(!s||!o)return{dx:0,dy:0,dw:r,dh:n};const l=Math.min(r/s,n/o),d=s*l,h=o*l;return{dx:(r-d)/2,dy:(n-h)/2,dw:d,dh:h}}function $i(s,o,r,n){const l=o.naturalWidth||o.width,d=o.naturalHeight||o.height,{dx:h,dy:w,dw:k,dh:z}=Ua(l,d,r,n);s.drawImage(o,h,w,k,z)}const Ya=["_imageElement","_stickerElement","_imageLoadError"];function vo(s){const o={};for(const[r,n]of Object.entries(s||{}))o[r]={...n,elements:((n==null?void 0:n.elements)||[]).map(l=>{const d={...l};return Ya.forEach(h=>delete d[h]),d})};return o}class qa{constructor(){this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d")}_prepareCanvas(o,r,n=1){const l=n>0?n:1;this.canvas.width=Math.round(o*l),this.canvas.height=Math.round(r*l),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.setTransform(l,0,0,l,0,0),this.ctx.imageSmoothingEnabled=!0,this.ctx.imageSmoothingQuality="high"}async exportAllSections(o,r,n,l,d="png",h=!0,w=null,k=1){const z={};try{const N=[];for(const T of r){const S=o[T.id||T.sectionName];((S==null?void 0:S.elements)||[]).forEach(D=>{D&&D.type==="text"&&D.fontFamily&&N.push(D.fontFamily)})}await Vi(N),typeof document<"u"&&document.fonts&&document.fonts.ready&&await document.fonts.ready}catch{}for(const N of r){const T=N.id||N.sectionName,S=o[T];if(!S||!S.elements||S.elements.length===0){console.log(`Skipping section ${T} - no elements`);continue}if(this._prepareCanvas(n,l,k),h){const M=N.image||N.sectionImage;if(M)try{const $=await this.loadImage(M);$i(this.ctx,$,n,l)}catch($){console.warn("Failed to load background image:",$)}}for(const M of S.elements)await this.drawElement(M);const D=this.canvas.toDataURL(`image/${d}`,d==="jpeg"?.9:void 0);z[T]={dataUrl:D,blob:await this.dataUrlToBlob(D)}}return z}async downloadExports(o,r="design"){const n=Object.keys(o);if(n.length===0){alert("No designs to export");return}if(n.length===1){const l=n[0],{blob:d}=o[l],h=URL.createObjectURL(d),w=document.createElement("a");w.href=h,w.download=`${r}-${l}.png`,document.body.appendChild(w),w.click(),document.body.removeChild(w),URL.revokeObjectURL(h)}else for(const l of n){const{blob:d}=o[l],h=URL.createObjectURL(d),w=document.createElement("a");w.href=h,w.download=`${r}-${l}.png`,document.body.appendChild(w),w.click(),document.body.removeChild(w),URL.revokeObjectURL(h),await new Promise(k=>setTimeout(k,100))}}async loadImage(o){return new Promise((r,n)=>{const l=new Image;l.crossOrigin="anonymous",l.onload=()=>r(l),l.onerror=n,l.src=o})}getLuma(o,r,n){return(.2126*o+.7152*r+.0722*n)/255}async processImageColor(o,r){const n=document.createElement("canvas"),l=n.getContext("2d");n.width=o.width,n.height=o.height,l.clearRect(0,0,n.width,n.height),l.drawImage(o,0,0);const d=l.getImageData(0,0,n.width,n.height),h=d.data,w=this.hexToRgb(r);if(!w){console.warn("Invalid target color:",r);return}const{r:k,g:z,b:N}=w;for(let T=0;T<h.length;T+=4){if(h[T+3]===0)continue;const D=this.getLuma(h[T],h[T+1],h[T+2]);h[T]=Math.round(k*D),h[T+1]=Math.round(z*D),h[T+2]=Math.round(N*D)}return l.putImageData(d,0,0),this.processedImage=new Image,new Promise(T=>{this.processedImage.onload=()=>{T()},this.processedImage.onerror=()=>{console.error("Failed to create processed image"),T()},this.processedImage.src=n.toDataURL("image/png")})}async drawElement(o){this.ctx.save();const r=o.x+o.width/2,n=o.y+o.height/2;switch(this.ctx.translate(r,n),o.rotation&&this.ctx.rotate(o.rotation*Math.PI/180),this.ctx.translate(-o.width/2,-o.height/2),o.type){case"text":this.drawText(o);break;case"rectangle":this.drawRectangle(o);break;case"circle":this.drawCircle(o);break;case"triangle":this.drawTriangle(o);break;case"star":this.drawStar(o);break;case"arrow":this.drawArrow(o);break;case"diamond":this.drawDiamond(o);break;case"hexagon":this.drawHexagon(o);break;case"pentagon":this.drawPentagon(o);break;case"heart":this.drawHeart(o);break;case"oval":this.drawOval(o);break;case"roundedRectangle":this.drawRoundedRectangle(o);break;case"qrcode":await this.drawQRCode(o);break;case"barcode":await this.drawBarcode(o);break;case"horizontalLine":this.drawHorizontalLine(o);break;case"sticker":await this.drawSticker(o);break;case"embroidery":await this.drawEmbroidery(o);break;case"image":await this.drawImage(o);break}this.ctx.restore()}drawText(o){let r=o.text||"Text";switch(o.textTransform){case"uppercase":r=r.toUpperCase();break;case"lowercase":r=r.toLowerCase();break;case"capitalize":r=r.replace(/\b\w/g,h=>h.toUpperCase());break}this.ctx.font=`${o.fontStyle||"normal"} ${o.fontWeight||"normal"} ${o.fontSize||20}px ${o.fontFamily||"Arial"}`,this.ctx.letterSpacing=`${o.letterSpacing||0}px`,this.ctx.fillStyle=o.fill||"#000000",this.ctx.textAlign=o.textAlign||"left",this.ctx.textBaseline="top",o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth);const n=r.split(`
53
+ `),l=(o.fontSize||20)*(o.lineHeight||1.2),d=this.embroidery&&o.type==="text"&&!o.isIcon;if(o.curve&&Math.abs(o.curve)>=1){const h=Math.max(...n.map(w=>this.ctx.measureText(w).width));this.drawCurvedText(o,n.join(" "),h,d);return}n.forEach((h,w)=>{const k=w*l;d?Je(this.ctx,h,k,{fontSize:o.fontSize||20,color:o.fill||"#000000"}):(o.stroke&&o.strokeWidth>0&&this.ctx.strokeText(h,0,k),this.ctx.fillText(h,0,k))})}drawCurvedText(o,r,n,l=!1){const d=this.ctx,h=Array.from(r);if(h.length===0)return;const w=o.fontSize||20,k=h.map(F=>d.measureText(F).width),z=k.reduce((F,ut)=>F+ut,0)||1,N=Math.max(1e-4,Math.abs(o.curve)*Math.PI/180),T=z/N,S=o.curve>=0?1:-1,D=(n||z)/2,M=S*T+w/2,$=o.stroke&&o.strokeWidth>0,Z=typeof o.textDecoration=="string"?o.textDecoration:"",Y={underline:Z.includes("underline")||!!o.underline,overline:Z.includes("overline")||!!o.overline,strike:Z.includes("line-through")||!!o.strikethrough},R=Y.underline||Y.overline||Y.strike,lt=o.decorationColor||o.fill||"#000000",_=Math.max(1,w/20);d.textAlign="center",d.textBaseline="middle",d.save(),d.translate(D,M),d.rotate(-S*N/2);for(let F=0;F<h.length;F++){const ut=k[F]/T;if(d.rotate(S*ut/2),d.save(),d.translate(0,-S*T),l?Je(d,h[F],0,{fontSize:w,color:o.fill||"#000000"}):($&&d.strokeText(h[F],0,0),d.fillText(h[F],0,0)),R){const E=k[F];d.strokeStyle=lt,d.lineWidth=_,d.setLineDash&&d.setLineDash([]),Y.underline&&(d.beginPath(),d.moveTo(-E/2,w/2+2),d.lineTo(E/2,w/2+2),d.stroke()),Y.overline&&(d.beginPath(),d.moveTo(-E/2,-(w/2+2)),d.lineTo(E/2,-(w/2+2)),d.stroke()),Y.strike&&(d.beginPath(),d.moveTo(-E/2,0),d.lineTo(E/2,0),d.stroke())}d.restore(),d.rotate(S*ut/2)}d.restore()}drawRectangle(o){o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fillRect(0,0,o.width,o.height)),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.strokeRect(0,0,o.width,o.height))}drawCircle(o){const r=Math.min(o.width,o.height)/2,n=o.width/2,l=o.height/2;this.ctx.beginPath(),this.ctx.arc(n,l,r,0,2*Math.PI),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawTriangle(o){const r=o.width/2;this.ctx.beginPath(),this.ctx.moveTo(r,0),this.ctx.lineTo(0,o.height),this.ctx.lineTo(o.width,o.height),this.ctx.closePath(),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawStar(o){const r=o.width/2,n=o.height/2,l=Math.min(o.width,o.height)/2,d=l*.4,h=o.numPoints||5;this.ctx.beginPath();for(let w=0;w<h*2;w++){const k=w%2===0?l:d,z=w*Math.PI/h,N=r+Math.cos(z)*k,T=n+Math.sin(z)*k;w===0?this.ctx.moveTo(N,T):this.ctx.lineTo(N,T)}this.ctx.closePath(),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawArrow(o){const r=o.width,n=o.height,l=r*.3;this.ctx.beginPath(),this.ctx.moveTo(r/2,0),this.ctx.lineTo(r,n*.6),this.ctx.lineTo(r-l,n*.6),this.ctx.lineTo(r-l,n),this.ctx.lineTo(l,n),this.ctx.lineTo(l,n*.6),this.ctx.lineTo(0,n*.6),this.ctx.closePath(),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}async dataUrlToBlob(o){return new Promise(r=>{const n=document.createElement("canvas"),l=n.getContext("2d"),d=new Image;d.onload=()=>{n.width=d.width,n.height=d.height,l.drawImage(d,0,0),n.toBlob(r)},d.src=o})}hexToRgb(o){const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);return r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16)}:null}drawDiamond(o){const r=o.width/2,n=o.height/2;this.ctx.beginPath(),this.ctx.moveTo(r,0),this.ctx.lineTo(o.width,n),this.ctx.lineTo(r,o.height),this.ctx.lineTo(0,n),this.ctx.closePath(),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawHexagon(o){const r=o.width/2,n=o.height/2,l=Math.min(o.width,o.height)/2,d=6;this.ctx.beginPath();for(let h=0;h<d;h++){const w=h*2*Math.PI/d-Math.PI/2,k=r+l*Math.cos(w),z=n+l*Math.sin(w);h===0?this.ctx.moveTo(k,z):this.ctx.lineTo(k,z)}this.ctx.closePath(),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawPentagon(o){const r=o.width/2,n=o.height/2,l=Math.min(o.width,o.height)/2,d=5;this.ctx.beginPath();for(let h=0;h<d;h++){const w=h*2*Math.PI/d-Math.PI/2,k=r+l*Math.cos(w),z=n+l*Math.sin(w);h===0?this.ctx.moveTo(k,z):this.ctx.lineTo(k,z)}this.ctx.closePath(),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawHeart(o){const r=o.width,n=o.height,l=0,d=0;this.ctx.beginPath();const h=n*.3;this.ctx.moveTo(l+r/2,d+h),this.ctx.bezierCurveTo(l+r/2,d,l,d,l,d+h),this.ctx.bezierCurveTo(l,d+(n+h)/2,l+r/2,d+(n+h)/2,l+r/2,d+n),this.ctx.bezierCurveTo(l+r/2,d+(n+h)/2,l+r,d+(n+h)/2,l+r,d+h),this.ctx.bezierCurveTo(l+r,d,l+r/2,d,l+r/2,d+h),this.ctx.closePath(),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawOval(o){const r=o.width/2,n=o.height/2,l=o.width/2,d=o.height/2;this.ctx.beginPath(),this.ctx.ellipse(r,n,l,d,0,0,2*Math.PI),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawRoundedRectangle(o){const r=Math.min(o.width,o.height)*.1;this.drawRoundedRect(0,0,o.width,o.height,r),o.fill&&o.fill!=="transparent"&&(this.ctx.fillStyle=o.fill,this.ctx.fill()),o.stroke&&o.strokeWidth>0&&(this.ctx.strokeStyle=o.stroke,this.ctx.lineWidth=o.strokeWidth,this.ctx.stroke())}drawRoundedRect(o,r,n,l,d){this.ctx.beginPath(),this.ctx.moveTo(o+d,r),this.ctx.lineTo(o+n-d,r),this.ctx.quadraticCurveTo(o+n,r,o+n,r+d),this.ctx.lineTo(o+n,r+l-d),this.ctx.quadraticCurveTo(o+n,r+l,o+n-d,r+l),this.ctx.lineTo(o+d,r+l),this.ctx.quadraticCurveTo(o,r+l,o,r+l-d),this.ctx.lineTo(o,r+d),this.ctx.quadraticCurveTo(o,r,o+d,r),this.ctx.closePath()}async drawQRCode(o){if(o.imageObject)this.ctx.drawImage(o.imageObject,0,0,o.width,o.height);else if(o.src)try{const r=await this.loadImage(o.src);this.ctx.drawImage(r,0,0,o.width,o.height)}catch(r){console.warn("Failed to load QR code image for export:",r),this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("QR Error",o.width/2,o.height/2)}else this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("No QR Data",o.width/2,o.height/2)}async drawBarcode(o){if(o.imageObject)this.ctx.drawImage(o.imageObject,0,0,o.width,o.height);else if(o.src)try{const r=await this.loadImage(o.src);this.ctx.drawImage(r,0,0,o.width,o.height)}catch(r){console.warn("Failed to load barcode image for export:",r),this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Barcode Error",o.width/2,o.height/2)}else this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("No Barcode Data",o.width/2,o.height/2)}drawHorizontalLine(o){this.ctx.save(),o.opacity!==void 0&&(this.ctx.globalAlpha=o.opacity),this.ctx.strokeStyle=o.stroke||o.fill||"#000000",this.ctx.lineWidth=o.strokeWidth||o.height||2,this.ctx.lineCap="round",this.ctx.beginPath(),this.ctx.moveTo(0,o.height/2),this.ctx.lineTo(o.width,o.height/2),this.ctx.stroke(),this.ctx.restore()}async drawSticker(o){try{let r=null;if(o.imageObject)r=o.imageObject;else if(o.imageData)r=o.imageData;else if(o.src||o.image){const n=o.src||o.image;r=await this.loadImage(n)}else o.data&&o.data.image&&(r=await this.loadImage(o.data.image));r?(o.opacity!==void 0&&(this.ctx.globalAlpha=o.opacity),this.ctx.drawImage(r,0,0,o.width,o.height)):(this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Sticker",o.width/2,o.height/2))}catch(r){console.warn("Failed to draw sticker:",r),this.ctx.fillStyle="#ffebee",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#f44336",this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#f44336",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Error",o.width/2,o.height/2)}}async drawEmbroidery(o){try{let r=null;if(o.imageObject)r=o.imageObject;else if(o.imageData)r=o.imageData;else if(o.src||o.image){const n=o.src||o.image;r=await this.loadImage(n)}else o.data&&o.data.image&&(r=await this.loadImage(o.data.image));r?(o.opacity!==void 0&&(this.ctx.globalAlpha=o.opacity),this.ctx.drawImage(r,0,0,o.width,o.height)):(this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Embroidery",o.width/2,o.height/2))}catch(r){console.warn("Failed to draw embroidery:",r),this.ctx.fillStyle="#ffebee",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#f44336",this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#f44336",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Error",o.width/2,o.height/2)}}async drawImage(o){try{let r=null;if(o.imageObject&&o.imageObject instanceof HTMLImageElement)r=o.imageObject;else if(o.imageData){if(o.imageData instanceof HTMLImageElement)r=o.imageData;else if(typeof o.imageData=="string")try{r=await this.loadImage(o.imageData)}catch(n){console.warn("Failed to load image from imageData URL:",o.imageData,n),r=await this.loadImageWithFallback(o.imageData)}}else if(o.src)try{r=await this.loadImage(o.src)}catch(n){console.warn("Failed to load image from src:",o.src,n),r=await this.loadImageWithFallback(o.src)}else if(o.image)try{r=await this.loadImage(o.image)}catch(n){console.warn("Failed to load image from image property:",o.image,n),r=await this.loadImageWithFallback(o.image)}r?(o.opacity!==void 0&&(this.ctx.globalAlpha=o.opacity),this.ctx.drawImage(r,0,0,o.width,o.height)):this.drawImagePlaceholder(o)}catch(r){console.error("Failed to draw image element:",r),this.drawImagePlaceholder(o)}}async loadImageWithFallback(o){return new Promise(r=>{const n=new Image;n.onload=()=>r(n),n.onerror=()=>{const l=new Image;l.crossOrigin="anonymous",l.onload=()=>r(l),l.onerror=()=>{console.warn("All image loading attempts failed for:",o),r(null)},l.src=o},n.src=o})}drawImagePlaceholder(o){this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,o.width,o.height),this.ctx.strokeStyle="#ccc",this.ctx.lineWidth=2,this.ctx.strokeRect(0,0,o.width,o.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Image",o.width/2,o.height/2-8),this.ctx.fillText("Not Found",o.width/2,o.height/2+8)}async blobToFile(o,r,n="image/png"){return new File([o],r,{type:n,lastModified:Date.now()})}async exportAllSectionsAsJSON(o,r,n,l,d="png",h=null,w=1){var M,$;const k=[],z=[],N=Math.min(w,2),T={};for(const Z of r){const Y=Z.sectionName,R=o[Y];if(!R||!R.elements||R.elements.length===0){console.log(`Skipping section ${Y} - no elements`);continue}const lt=Z.image||Z.sectionImage,_={...R,backgroundImage:lt,sectionImage:lt,sectionName:Y,selectedColor:R.selectedColor||"#FFFFFF",canvasWidth:n,canvasHeight:l};T[Y]=_;const F=await this.exportSectionAsBlob(R,Z,n,l,d,!0,h,N);if(F){const E=await this.blobToFile(F,`${Y}-full.${d}`,`image/${d}`);k.push({sectionName:Y,sectionImage:E})}const ut=await this.exportSectionAsBlob(R,Z,n,l,d,!1,h,w);if(ut){const E=await this.blobToFile(ut,`${Y}-print.${d}`,`image/${d}`);z.push({sectionName:Y,sectionImage:E})}}const S=((M=r[0])==null?void 0:M.image)||(($=r[0])==null?void 0:$.sectionImage),D={sections:vo(T),canvasWidth:n,canvasHeight:l,sectionImage:S,format:d,timestamp:new Date().toISOString(),version:"1.0",...h&&{initData:{sectionImage:h.sectionImage,sections:h.sections?Object.keys(h.sections):[]}},product:{sections:r.map(Z=>({sectionName:Z.sectionName||Z.id,sectionImage:Z.image||Z.sectionImage,id:Z.id||Z.sectionName}))}};return{fullDesign:k,printReady:z,designFile:JSON.stringify(D)}}async exportSectionAsBlob(o,r,n,l,d="png",h=!0,w=null,k=1){try{if(this._prepareCanvas(n,l,k),h){const z=r.image||r.sectionImage;if(z)try{const N=await this.loadImage(z);$i(this.ctx,N,n,l)}catch(N){console.warn("Failed to load background image:",N)}}for(const z of o.elements)await this.drawElement(z);return new Promise(z=>{this.canvas.toBlob(z,`image/${d}`,d==="jpeg"?.9:void 0)})}catch(z){return console.error("Error exporting section as blob:",z),null}}async exportCurrentSectionAsJSON(o,r="png",n=null,l=1){var $,Z,Y;const d=Math.min(l,2),h=(($=o.activeSection)==null?void 0:$.sectionName)||"main",w=((Z=o.activeSection)==null?void 0:Z.sectionImage)||((Y=o.activeSection)==null?void 0:Y.image),k={elements:o.elements,selectedColor:o.selectedColor,canvasWidth:o.canvasWidth,canvasHeight:o.canvasHeight,backgroundImage:w,sectionImage:w,sectionName:h,zoomLevel:o.zoomLevel,showGrid:o.showGrid,snapToGrid:o.snapToGrid},z={id:h,sectionName:h,image:w,sectionImage:w},N=[],T=[],S=await this.exportSectionAsBlob(k,z,o.canvasWidth,o.canvasHeight,r,!0,n,d);if(S){const R=await this.blobToFile(S,`${h}-full.${r}`,`image/${r}`);N.push({sectionName:h,sectionImage:R})}const D=await this.exportSectionAsBlob(k,z,o.canvasWidth,o.canvasHeight,r,!1,n,l);if(D){const R=await this.blobToFile(D,`${h}-print.${r}`,`image/${r}`);T.push({sectionName:h,sectionImage:R})}const M={sections:vo({[h]:k}),canvasWidth:o.canvasWidth,canvasHeight:o.canvasHeight,sectionImage:w,format:r,timestamp:new Date().toISOString(),version:"1.0",...n&&{initData:{sectionImage:n.sectionImage,sections:n.sections?Object.keys(n.sections):[]}},productInfo:{sections:[{sectionName:h,sectionImage:w,id:h}]}};return{fullDesign:N,printReady:T,designFile:JSON.stringify(M)}}}const Xa=["rectangle","circle","triangle","star","heart","diamond","hexagon","pentagon","oval","roundedRectangle"];function Qa(s){const o=Array.isArray(s)?s:[],r=[];o.some(l=>l&&l.type==="text"&&!l.isIcon&&(l.fontSize||20)<14)&&r.push("Small text may not stitch cleanly — keep letters bold and reasonably large."),o.some(l=>l&&(l.type==="image"||l.type==="sticker"))&&r.push("Photos & gradients can’t be embroidered — they’ll be simplified to solid thread colours.");const n=new Set;return o.forEach(l=>{l&&(l.type==="text"||Xa.includes(l.type))&&l.fill&&n.add(String(l.fill).toLowerCase())}),n.size>8&&r.push(`Your design uses ${n.size} colours — more thread colours can increase the price.`),r}class Ka{constructor(o="localStorage"){this.storage=o==="sessionStorage"?sessionStorage:localStorage,this.STORAGE_PREFIX="mypixia_canvas_",this.DESIGNS_LIST_KEY="mypixia_saved_designs"}saveDesign(o,r){var n;try{const l=this.generateDesignId(o),d=new Date().toISOString(),h={id:l,name:o,timestamp:d,version:"1.0",canvasData:{elements:r.elements||[],canvasWidth:r.canvasWidth||800,canvasHeight:r.canvasHeight||600,selectedColor:r.selectedColor||"#FF0000",activeSection:r.activeSection||null,product:r.product||null,sectionDesigns:r.sectionDesigns||{},zoomLevel:r.zoomLevel||1,showGrid:r.showGrid||!1,snapToGrid:r.snapToGrid||!0},metadata:{elementCount:((n=r.elements)==null?void 0:n.length)||0,lastModified:d,thumbnail:r.thumbnail||null}};return this.storage.setItem(this.STORAGE_PREFIX+l,JSON.stringify(h)),this.updateDesignsList(l,o,d),{success:!0,designId:l,message:"Design saved successfully"}}catch(l){return console.error("Error saving design:",l),{success:!1,error:l.message}}}loadDesign(o){try{let r=o;if(!o.startsWith("design_")){const h=this.getAllDesigns().find(w=>w.name===o);if(!h)return{success:!1,error:"Design not found"};r=h.id}const n=this.storage.getItem(this.STORAGE_PREFIX+r);return n?{success:!0,data:JSON.parse(n)}:{success:!1,error:"Design not found"}}catch(r){return console.error("Error loading design:",r),{success:!1,error:r.message}}}getAllDesigns(){try{const o=this.storage.getItem(this.DESIGNS_LIST_KEY);return o?JSON.parse(o):[]}catch(o){return console.error("Error getting designs list:",o),[]}}deleteDesign(o){try{this.storage.removeItem(this.STORAGE_PREFIX+o);const n=this.getAllDesigns().filter(l=>l.id!==o);return this.storage.setItem(this.DESIGNS_LIST_KEY,JSON.stringify(n)),{success:!0,message:"Design deleted successfully"}}catch(r){return console.error("Error deleting design:",r),{success:!1,error:r.message}}}exportDesignAsFile(o){try{const r=this.loadDesign(o);if(!r.success)return r;const n=r.data,l=JSON.stringify(n,null,2),d=new Blob([l],{type:"application/json"}),h=URL.createObjectURL(d),w=document.createElement("a");return w.href=h,w.download=`${n.name}_${n.id}.json`,document.body.appendChild(w),w.click(),document.body.removeChild(w),URL.revokeObjectURL(h),{success:!0,message:"Design exported successfully"}}catch(r){return console.error("Error exporting design:",r),{success:!1,error:r.message}}}importDesignFromFile(o){return new Promise(r=>{try{const n=new FileReader;n.onload=l=>{try{const d=JSON.parse(l.target.result);if(!this.validateDesignData(d)){r({success:!1,error:"Invalid design file format"});return}const h=this.generateDesignId(d.name+"_imported");d.id=h,d.name+="_imported",d.timestamp=new Date().toISOString(),d.metadata.lastModified=d.timestamp,this.storage.setItem(this.STORAGE_PREFIX+h,JSON.stringify(d)),this.updateDesignsList(h,d.name,d.timestamp),r({success:!0,data:d,message:"Design imported successfully"})}catch{r({success:!1,error:"Failed to parse design file"})}},n.readAsText(o)}catch(n){r({success:!1,error:n.message})}})}autoSave(o,r){const n=this.STORAGE_PREFIX+"autosave_"+o;try{const l={timestamp:new Date().toISOString(),canvasData:r};return this.storage.setItem(n,JSON.stringify(l)),!0}catch(l){return console.error("Auto-save failed:",l),!1}}loadAutoSave(o){const r=this.STORAGE_PREFIX+"autosave_"+o;try{const n=this.storage.getItem(r);return n?JSON.parse(n):null}catch(n){return console.error("Failed to load auto-save:",n),null}}clearAutoSave(o){const r=this.STORAGE_PREFIX+"autosave_"+o;this.storage.removeItem(r)}getStorageInfo(){const o=this.getAllDesigns();let r=0;return o.forEach(n=>{const l=this.storage.getItem(this.STORAGE_PREFIX+n.id);l&&(r+=new Blob([l]).size)}),{designCount:o.length,totalSize:r,totalSizeFormatted:this.formatBytes(r),storageLimit:this.getStorageLimit()}}clearAllDesigns(){try{return this.getAllDesigns().forEach(r=>{this.storage.removeItem(this.STORAGE_PREFIX+r.id)}),this.storage.removeItem(this.DESIGNS_LIST_KEY),{success:!0,message:"All designs cleared"}}catch(o){return{success:!1,error:o.message}}}generateDesignId(o){const r=Date.now(),n=Math.random().toString(36).substring(2,8);return`design_${r}_${n}`}updateDesignsList(o,r,n){const l=this.getAllDesigns(),d=l.findIndex(w=>w.id===o),h={id:o,name:r,timestamp:n,lastModified:n};d>=0?l[d]=h:l.push(h),l.sort((w,k)=>new Date(k.timestamp)-new Date(w.timestamp)),this.storage.setItem(this.DESIGNS_LIST_KEY,JSON.stringify(l))}validateDesignData(o){return o&&o.id&&o.name&&o.canvasData&&Array.isArray(o.canvasData.elements)}formatBytes(o){if(o===0)return"0 Bytes";const r=1024,n=["Bytes","KB","MB","GB"],l=Math.floor(Math.log(o)/Math.log(r));return parseFloat((o/Math.pow(r,l)).toFixed(2))+" "+n[l]}getStorageLimit(){try{if("storage"in navigator&&"estimate"in navigator.storage)return navigator.storage.estimate().then(o=>o.quota)}catch{console.warn("Unable to estimate storage quota")}return"Unknown"}}const Za=(s,o)=>{let r;return function(...l){const d=()=>{clearTimeout(r),s(...l)};clearTimeout(r),r=setTimeout(d,o)}},Qe=[{key:"make-it-yours",title:"Make it yours",body:"Add your text, upload a logo, or drag artwork straight onto the product to bring your design to life."},{key:"start-creating",title:"Start creating",body:"Drop in your logo, type a slogan, or add artwork — your custom product takes shape as you go."},{key:"design-in-seconds",title:"Design yours in seconds",body:"Add text or upload an image to get started — no design skills needed."}],No=g.forwardRef((s,o)=>{var co;const{theme:r={primaryColor:"#6a45d2",secondaryColor:"#f88300",tertiaryColor:"#FFFFFF"},readOnly:n=!1,mode:l="customize",initialColor:d,product:h={name:"Premium Crew Neck T-Shirt",category:"Tshirts",description:"Men's crew neck t-shirts",plainColor:"N",mainImage:"https://static.mypixia.com/dev/products/7/e011a73a-f20a-489b-bea8-91a23da56fc4.png",colorSettings:["#FF0000","#0000FF","#008000","#000000","#FFFFFF","#808080","#FFFF00"],sections:[{sectionName:"Front",sectionImage:"https://static.mypixia.com/prod/products/96ca4acb-c426-4619-a2c4-7acd95b78451.png"},{sectionName:"Sleeve-left",sectionImage:"https://static.mypixia.com/prod/products/27b8c138-af4e-4ea0-833d-88b10fbd3cf7.png"},{sectionName:"Back",sectionImage:"https://static.mypixia.com/prod/products/d4c53776-7b7d-41c5-a6b5-2bf5876cd26e.png"}]},initFile:w,initDesignContent:k,printConfig:z,aiEnabled:N=!0,aiEndpoint:T,onAIImageGenerate:S,aiCreditsRemaining:D=null,onAddAiCredits:M,isAuthenticated:$=!0,onRequireAuth:Z,onRequestCollaboration:Y,onUploadImage:R,onOpenUploads:lt,onRemoveBackground:_,emptyStateVariant:F=0,fitToContainer:ut=!1}=s,[E,ot]=g.useState([]),[v,at]=g.useState(null),[ct,q]=g.useState([]),[O,st]=g.useState(!1),[J,ht]=g.useState(!1),[C,G]=g.useState(!1),[H,m]=g.useState({x:0,y:0}),[L,Q]=g.useState(null),[ft,zt]=g.useState(null),kt=g.useRef(null),Ht=g.useRef(null),It=g.useRef(null),jt=g.useRef(!1),[B,oe]=g.useState(600),[X,ii]=g.useState(600),[gt,Zt]=g.useState(1),[Dt,pe]=g.useState(d||((co=h.colorSettings)==null?void 0:co[0])),[Vt,ye]=g.useState(!1),[Wt,De]=g.useState(l!=="customize"),[Bt,ce]=g.useState(!0),[xe,be]=g.useState(!1),[We,oi]=g.useState(l!=="customize"),At=ei(z),de=$a(B,X,At);g.useEffect(()=>{if(!v){q(i=>i.length?[]:i);return}q(i=>i.length>1&&i.includes(v.id)?i:[v.id])},[v]);const[K,Be]=g.useState(h.sections[0]),[qt,ai]=g.useState(!1),[ri,Se]=g.useState(!1),[Xt,he]=g.useState({}),[Pt,Pe]=g.useState([]),[yt,dt]=g.useState(-1),[si]=g.useState(new Ka("localStorage")),Tt=g.useRef(null),ve=g.useRef(null),V=g.useRef(null),Et=g.useRef(null),ni=g.useRef({v:[],h:[]}),li=g.useRef([]),ci=g.useRef([]),di=g.useRef(null),we=g.useRef(null),ke=g.useRef(null),Gi=g.useRef(null),je=g.useRef(null),Qt=g.useRef(null),zo=g.useRef(null),Ce=g.useRef(new qa),To=g.useRef(!1),[Fe,Ui]=g.useState(null),bt=g.useCallback(()=>{const i={elements:JSON.parse(JSON.stringify(E)),selectedElement:v?{...v}:null,timestamp:Date.now()},t=Pt.slice(0,yt+1);t.push(i),t.length>50?t.shift():dt(yt+1),Pe(t)},[E,v,Pt,yt]),Ne=g.useCallback(()=>({elements:E,canvasWidth:B,canvasHeight:X,selectedColor:Dt,activeSection:K,product:h,sectionDesigns:Xt,zoomLevel:gt,showGrid:Vt,snapToGrid:Bt,selectedElement:v?{...v}:null,canvasRef:Tt}),[E,B,X,Dt,K,h,Xt,gt,Vt,Bt,v]),Yi=i=>{if(i.sections&&typeof i.sections=="object"){const t=Object.keys(i.sections)[0],a=i.sections[t];if(a&&a.elements){ot(a.elements||[]),oe(a.canvasWidth||800),ii(a.canvasHeight||600),pe(a.selectedColor||h.colorSettings[0]),ut||Zt(a.zoomLevel||1),ye(a.showGrid||!1),ce(a.snapToGrid||!0),at(null),i.sections&&he(i.sections);const c=h.sections.find(y=>y.sectionName===t);c&&Be(c),Pe([]),dt(-1),setTimeout(()=>{bt()},100);return}}};g.useEffect(()=>{const t=setTimeout(async()=>{if(E.length===0&&Pt.length<=1){if(k)try{const a=JSON.parse(k);Ui(a),Yi(a)}catch(a){console.error("Error loading design file:",a),console.warn("Using default text instead")}else if(w)try{const a=await fetch(w);if(a.ok){const c=await a.text();if(c.trim()){const y=JSON.parse(c.trim());Ui(y),Yi(y)}}else console.warn("Failed to load design file, using default text")}catch(a){console.error("Error loading design file:",a),console.warn("Using default text instead")}}},300);return()=>clearTimeout(t)},[w,k,h.colorSettings,h.sections]);const hi=g.useCallback((i="png",t=!0)=>{const a=Ne();return h.sections,Ce.current.exportAllSections({[(K==null?void 0:K.sectionName)||"main"]:a},[{id:(K==null?void 0:K.sectionName)||"main",sectionName:(K==null?void 0:K.sectionName)||"main",image:K==null?void 0:K.sectionImage,sectionImage:K==null?void 0:K.sectionImage}],B,X,i,t,Fe,de)},[Ne,h.sections,K,B,X,de]),Mo=wo,Oe=20;g.useEffect(()=>{const i=()=>ai(window.innerWidth<768);return i(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]);const ze=Math.max(1,Math.min(qt?2:3,gt*(window.devicePixelRatio||1)));g.useEffect(()=>{if(!ut)return;const i=ve.current;if(!i||typeof ResizeObserver>"u")return;const t=24,a=()=>{const y=i.clientWidth-t*2,u=i.clientHeight-t*2;if(y<=0||u<=0)return;const x=Math.min(y/B,u/X);Zt(Math.max(.25,Math.min(4,Math.floor(x*20)/20)))};a();const c=new ResizeObserver(a);return c.observe(i),()=>c.disconnect()},[ut,B,X]),g.useEffect(()=>{const i=document.createElement("canvas");i.width=B,i.height=X,zo.current=i},[B,X]),g.useEffect(()=>{Pt.length===0&&bt()},[]);const Jt=(i,t,a,c,y,u)=>{i.beginPath(),i.moveTo(t+u,a),i.lineTo(t+c-u,a),i.quadraticCurveTo(t+c,a,t+c,a+u),i.lineTo(t+c,a+y-u),i.quadraticCurveTo(t+c,a+y,t+c-u,a+y),i.lineTo(t+u,a+y),i.quadraticCurveTo(t,a+y,t,a+y-u),i.lineTo(t,a+u),i.quadraticCurveTo(t,a,t+u,a),i.closePath()},fe=(i,t)=>{if(t.type==="text"&&!t.isIcon){i.save(),i.font=`${t.fontStyle||"normal"} ${t.fontWeight||"normal"} ${t.fontSize||20}px ${t.fontFamily||"Arial"}`;try{i.letterSpacing=`${t.letterSpacing||0}px`}catch{}let tt=t.text||"Text";switch(t.textTransform){case"uppercase":tt=tt.toUpperCase();break;case"lowercase":tt=tt.toLowerCase();break;case"capitalize":tt=tt.replace(/\b\w/g,Nt=>Nt.toUpperCase());break}const pt=tt.split(`
54
+ `),I=Math.max(1,...pt.map(Nt=>i.measureText(Nt||" ").width)),nt=(t.fontSize||20)*(t.lineHeight||1.2),Ft=Math.max(t.fontSize||20,pt.length*nt);i.restore();const St=t.textAlign||"left",vt=St==="center"?t.x-I/2:St==="right"?t.x-I:t.x,Ct=t.y;return{x:vt,y:Ct,width:I,height:Ft,cx:vt+I/2,cy:Ct+Ft/2}}if(!t.isIcon)return{x:t.x,y:t.y,width:t.width,height:t.height,cx:t.x+t.width/2,cy:t.y+t.height/2};i.save(),i.font=`${t.fontStyle||""} ${t.fontWeight||""} ${t.fontSize}px ${t.fontFamily}`,i.textBaseline="alphabetic",i.textAlign="left";const a=i.measureText(t.text),c=a.actualBoundingBoxAscent??t.fontSize*.8,y=a.actualBoundingBoxDescent??t.fontSize*.2,u=a.actualBoundingBoxLeft??0,x=a.actualBoundingBoxRight??a.width,f=u+x,p=c+y,b=t.x,j=t.y,A=b-f/2-u,W=j-p/2-c;return i.restore(),{x:A,y:W,width:f,height:p,cx:b,cy:j}},Ao=(i,t)=>{if(!t)return;const a=8,c=8,y=4,u=30,x=fe(i,t),f=t.isIcon?Math.max(a,12):a,p={x:-x.width/2-f,y:-x.height/2-f,w:x.width+f*2,h:x.height+f*2};i.save(),i.translate(x.cx,x.cy),t.rotation&&i.rotate(t.rotation*Math.PI/180);const b=i.createLinearGradient(p.x,p.y,p.x+p.w,p.y+p.h);if(b.addColorStop(0,"#6a45d2"),b.addColorStop(.5,"#1d4ed8"),b.addColorStop(1,"#6a45d2"),i.strokeStyle="rgba(106,69,210,.3)",i.lineWidth=3,Jt(i,p.x-1,p.y-1,p.w+2,p.h+2,y+1),i.stroke(),i.strokeStyle=b,i.lineWidth=2,i.setLineDash([8,4]),Jt(i,p.x,p.y,p.w,p.h,y),i.stroke(),i.lineDashOffset=-(Date.now()/50)%12,i.strokeStyle="#ffffff",i.lineWidth=1,i.setLineDash([4,8]),Jt(i,p.x,p.y,p.w,p.h,y),i.stroke(),i.setLineDash([]),i.lineDashOffset=0,t.locked){i.restore();return}[{x:p.x,y:p.y},{x:p.x+p.w,y:p.y},{x:p.x+p.w,y:p.y+p.h},{x:p.x,y:p.y+p.h}].forEach(W=>{i.fillStyle="rgba(0,0,0,.2)",i.fillRect(W.x-c/2+1,W.y-c/2+1,c,c),i.fillStyle="#ffffff",i.fillRect(W.x-c/2,W.y-c/2,c,c),i.strokeStyle="#6a45d2",i.lineWidth=1,i.strokeRect(W.x-c/2,W.y-c/2,c,c)});const j=0,A=p.y-u;i.strokeStyle="#6a45d2",i.lineWidth=1,i.setLineDash([2,2]),i.beginPath(),i.moveTo(j,A+12),i.lineTo(j,p.y),i.stroke(),i.setLineDash([]),i.beginPath(),i.arc(j,A,12,0,2*Math.PI),i.fillStyle="#f59e0b",i.fill(),i.strokeStyle="#ffffff",i.lineWidth=2,i.stroke(),i.strokeStyle="#ffffff",i.lineWidth=2,i.beginPath(),i.arc(j,A,6,-Math.PI/2,Math.PI,!1),i.stroke(),i.beginPath(),i.moveTo(j-6,A),i.lineTo(j-3,A-3),i.lineTo(j-3,A+3),i.closePath(),i.fillStyle="#ffffff",i.fill(),i.restore()},Eo=(i,t)=>{if(!t)return[];const a=fe(i,t),c=t.isIcon?Math.max(8,12):8,y=8,u=30,x=(t.rotation||0)*Math.PI/180,f={x:-a.width/2-c,y:-a.height/2-c,w:a.width+c*2,h:a.height+c*2},p=[{x:f.x,y:f.y,type:"nw-resize"},{x:f.x+f.w,y:f.y,type:"ne-resize"},{x:f.x+f.w,y:f.y+f.h,type:"se-resize"},{x:f.x,y:f.y+f.h,type:"sw-resize"},{x:0,y:f.y-u,type:"rotate"}],b=Math.cos(x),j=Math.sin(x);return p.map(A=>({x:a.cx+(A.x*b-A.y*j),y:a.cy+(A.x*j+A.y*b),type:A.type,size:A.type==="rotate"?24:y}))},qi=(i,t,a)=>{if(!a)return null;const c=Tt.current;if(!c)return null;const y=c.getContext("2d"),u=Eo(y,a);for(const x of u){const f=i-x.x,p=t-x.y;if(Math.sqrt(f*f+p*p)<=x.size/2)return x.type}return null},Te=g.useCallback(()=>{if(yt>0){const i=Pt[yt-1];ot(i.elements),at(i.selectedElement),dt(yt-1)}},[Pt,yt]),ue=g.useCallback(()=>{if(yt<Pt.length-1){const i=Pt[yt+1];ot(i.elements),at(i.selectedElement),dt(yt+1)}},[Pt,yt]),Kt=i=>Bt?Math.round(i/Oe)*Oe:i;g.useEffect(()=>{if(K!=null&&K.sectionImage){V.current=null,Et.current=null;const i=Tt.current;if(i){const a=i.getContext("2d");a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,i.width,i.height),a.restore()}if(w&&!Fe)return;const t=new Image;t.crossOrigin="anonymous",t.onload=()=>{V.current=t,Et.current=t,mt()},t.onerror=()=>{console.error("Failed to load background image:",K.sectionImage),mt()},t.src=K.sectionImage}else V.current=null,Et.current=null,mt()},[K,Fe]),g.useEffect(()=>{const i=t=>{const a=document.activeElement;if(!(a&&(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.tagName==="SELECT"||a.isContentEditable))){if((t.key==="Delete"||t.key==="Backspace")&&v&&!n){t.preventDefault();const y=v;ot(u=>u.filter(x=>x.id!==y.id)),at(null),bt()}if(t.ctrlKey||t.metaKey)switch(t.key){case"z":t.shiftKey?(t.preventDefault(),ue()):(t.preventDefault(),Te());break;case"y":t.preventDefault(),ue();break}}};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}},[v,n,Te,ue,bt]);const Ot=()=>`element_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,Io=i=>{i.strokeStyle="#e0e0e0",i.lineWidth=1,i.setLineDash([1,1]);for(let t=0;t<=B;t+=Oe)i.beginPath(),i.moveTo(t,0),i.lineTo(t,X),i.stroke();for(let t=0;t<=X;t+=Oe)i.beginPath(),i.moveTo(0,t),i.lineTo(B,t),i.stroke();i.setLineDash([])},Lo=(i,t)=>{i.save();const a=t.x+t.width/2,c=t.y+t.height/2;switch(i.translate(a,c),t.rotation&&i.rotate(t.rotation*Math.PI/180),i.translate(-t.width/2,-t.height/2),t.type){case"text":Bo(i,t);break;case"rectangle":Po(i,t);break;case"circle":Oo(i,t);break;case"triangle":Ho(i,t);break;case"star":$o(i,t);break;case"arrow":_o(i,t);break;case"diamond":Vo(i,t);break;case"hexagon":Go(i,t);break;case"pentagon":Uo(i,t);break;case"heart":Yo(i,t);break;case"oval":qo(i,t);break;case"roundedRectangle":Xo(i,t);break;case"image":Ko(i,t);break;case"qrcode":Do(i,t);break;case"barcode":Ro(i,t);break;case"sticker":Zo(i,t);break;case"horizontalLine":Qo(i,t);break;case"embroidery":Jo(i,t);break}i.restore()},Ro=(i,t)=>{if(t.imageObject)i.drawImage(t.imageObject,0,0,t.width,t.height);else if(t.src&&!t.imageLoading){t.imageLoading=!0;const a=new Image;a.onload=()=>{ot(c=>c.map(y=>y.id===t.id?{...y,imageObject:a,imageLoading:!1}:y))},a.onerror=()=>{ot(c=>c.map(y=>y.id===t.id?{...y,imageLoading:!1}:y))},a.src=t.src,i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Your customization",t.width/2,t.height/2)}else t.imageLoading?(i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Your customization",t.width/2,t.height/2)):(i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("No Barcode",t.width/2,t.height/2))},Do=(i,t)=>{if(t.imageObject)i.drawImage(t.imageObject,0,0,t.width,t.height);else if(t.src&&!t.imageLoading){t.imageLoading=!0;const a=new Image;a.onload=()=>{ot(c=>c.map(y=>y.id===t.id?{...y,imageObject:a,imageLoading:!1}:y))},a.onerror=()=>{ot(c=>c.map(y=>y.id===t.id?{...y,imageLoading:!1}:y))},a.src=t.src,i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Loading QR...",t.width/2,t.height/2)}else t.imageLoading?(i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Loading QR...",t.width/2,t.height/2)):(i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("No QR Data",t.width/2,t.height/2))},Wo=(i,t,a,c,y=!1)=>{const u=Array.from(t);if(u.length===0)return;const x=a.fontSize||20,f=u.map(Mt=>i.measureText(Mt).width),p=f.reduce((Mt,Gt)=>Mt+Gt,0)||1,b=Math.max(1e-4,Math.abs(a.curve)*Math.PI/180),j=p/b,A=a.curve>=0?1:-1,W=(c||p)/2,tt=A*j+x/2,pt=a.stroke&&a.strokeWidth>0,I=typeof a.textDecoration=="string"?a.textDecoration:"",nt={underline:I.includes("underline")||!!a.underline,overline:I.includes("overline")||!!a.overline,strike:I.includes("line-through")||!!a.strikethrough},Ft=nt.underline||nt.overline||nt.strike,St=a.decorationColor||a.fill||"#000000",vt=Math.max(1,x/20),Ct=i.textAlign,Nt=i.textBaseline;i.textAlign="center",i.textBaseline="middle",i.save(),i.translate(W,tt),i.rotate(-A*b/2);for(let Mt=0;Mt<u.length;Mt++){const Gt=f[Mt]/j;if(i.rotate(A*Gt/2),i.save(),i.translate(0,-A*j),y?Je(i,u[Mt],0,{fontSize:x,color:a.fill||"#000000"}):(pt&&i.strokeText(u[Mt],0,0),i.fillText(u[Mt],0,0)),Ft){const Lt=f[Mt];i.strokeStyle=St,i.lineWidth=vt,i.setLineDash&&i.setLineDash([]),nt.underline&&(i.beginPath(),i.moveTo(-Lt/2,x/2+2),i.lineTo(Lt/2,x/2+2),i.stroke()),nt.overline&&(i.beginPath(),i.moveTo(-Lt/2,-(x/2+2)),i.lineTo(Lt/2,-(x/2+2)),i.stroke()),nt.strike&&(i.beginPath(),i.moveTo(-Lt/2,0),i.lineTo(Lt/2,0),i.stroke())}i.restore(),i.rotate(A*Gt/2)}i.restore(),i.textAlign=Ct,i.textBaseline=Nt},Bo=(i,t)=>{i.save();let a=t.text||"Text";if(t.textTransform)switch(t.textTransform){case"uppercase":a=a.toUpperCase();break;case"lowercase":a=a.toLowerCase();break;case"capitalize":a=a.replace(/\b\w/g,p=>p.toUpperCase());break}i.font=`${t.fontStyle||"normal"} ${t.fontWeight||"normal"} ${t.fontSize||20}px ${t.fontFamily||"Arial"}`,i.letterSpacing=`${t.letterSpacing||0}px`,i.fillStyle=t.fill||"#000000",i.textAlign=t.textAlign||"left",i.textBaseline="top",t.opacity!==void 0&&(i.globalAlpha=t.opacity),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth);const c=a.split(`
55
+ `),y=(t.fontSize||20)*(t.lineHeight||1.2),u=Math.max(...c.map(p=>i.measureText(p).width)),x=c.length*y;if(t.backgroundColor&&t.backgroundColor!=="transparent"){i.fillStyle=t.backgroundColor;const p=t.backgroundPadding||4;i.fillRect(-p,-p,u+p*2,x+p*2),i.fillStyle=t.fill||"#000000"}(t.hasTextShadow||t.textShadowColor)&&(i.shadowColor=t.textShadowColor||"rgba(0,0,0,0.5)",i.shadowBlur=t.textShadowBlur!=null?t.textShadowBlur:4,i.shadowOffsetX=t.textShadowX!=null?t.textShadowX:2,i.shadowOffsetY=t.textShadowY!=null?t.textShadowY:2);const f=Di(h)&&t.type==="text"&&!t.isIcon;if(t.curve&&Math.abs(t.curve)>=1){Wo(i,c.join(" "),t,u,f),i.restore();return}c.forEach((p,b)=>{const j=b*y,A=i.measureText(p).width;f?Je(i,p,j,{fontSize:t.fontSize||20,color:t.fill||"#000000"}):(t.stroke&&t.strokeWidth>0&&i.strokeText(p,0,j),i.fillText(p,0,j));const W=t.fontSize||20,tt=t.decorationColor||t.fill||"#000000",pt=Math.max(1,W/20);if(i.strokeStyle=tt,i.lineWidth=pt,t.textDecoration==="underline"||t.underline){const I=j+W+2;i.beginPath(),i.moveTo(0,I),i.lineTo(A,I),i.stroke()}if(t.textDecoration==="overline"||t.overline){const I=j-2;i.beginPath(),i.moveTo(0,I),i.lineTo(A,I),i.stroke()}if(t.textDecoration==="line-through"||t.strikethrough){const I=j+W/2;i.beginPath(),i.moveTo(0,I),i.lineTo(A,I),i.stroke()}typeof t.textDecoration=="string"&&t.textDecoration.includes(" ")&&t.textDecoration.split(" ").forEach(nt=>{switch(nt.trim()){case"underline":const Ft=j+W+2;i.beginPath(),i.moveTo(0,Ft),i.lineTo(A,Ft),i.stroke();break;case"overline":const St=j-2;i.beginPath(),i.moveTo(0,St),i.lineTo(A,St),i.stroke();break;case"line-through":const vt=j+W/2;i.beginPath(),i.moveTo(0,vt),i.lineTo(A,vt),i.stroke();break}})}),i.restore()},Po=(i,t)=>{t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fillRect(0,0,t.width,t.height)),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.strokeRect(0,0,t.width,t.height))},Oo=(i,t)=>{const a=Math.min(t.width,t.height)/2,c=t.width/2,y=t.height/2;i.beginPath(),i.arc(c,y,a,0,2*Math.PI),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Ho=(i,t)=>{const a=t.width/2;t.height/2,i.beginPath(),i.moveTo(a,0),i.lineTo(0,t.height),i.lineTo(t.width,t.height),i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},$o=(i,t)=>{const a=t.width/2,c=t.height/2,y=Math.min(t.width,t.height)/2,u=y*.4,x=t.numPoints||5;i.beginPath();for(let f=0;f<x*2;f++){const p=f%2===0?y:u,b=f*Math.PI/x,j=a+Math.cos(b)*p,A=c+Math.sin(b)*p;f===0?i.moveTo(j,A):i.lineTo(j,A)}i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},_o=(i,t)=>{const a=t.width,c=t.height,y=a*.3;i.beginPath(),i.moveTo(a/2,0),i.lineTo(a,c*.6),i.lineTo(a-y,c*.6),i.lineTo(a-y,c),i.lineTo(y,c),i.lineTo(y,c*.6),i.lineTo(0,c*.6),i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Vo=(i,t)=>{const a=t.width/2,c=t.height/2;i.beginPath(),i.moveTo(a,0),i.lineTo(t.width,c),i.lineTo(a,t.height),i.lineTo(0,c),i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Go=(i,t)=>{const a=t.width/2,c=t.height/2,y=Math.min(t.width,t.height)/2,u=6;i.beginPath();for(let x=0;x<u;x++){const f=x*2*Math.PI/u-Math.PI/2,p=a+y*Math.cos(f),b=c+y*Math.sin(f);x===0?i.moveTo(p,b):i.lineTo(p,b)}i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Uo=(i,t)=>{const a=t.width/2,c=t.height/2,y=Math.min(t.width,t.height)/2,u=5;i.beginPath();for(let x=0;x<u;x++){const f=x*2*Math.PI/u-Math.PI/2,p=a+y*Math.cos(f),b=c+y*Math.sin(f);x===0?i.moveTo(p,b):i.lineTo(p,b)}i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Yo=(i,t)=>{const a=t.width,c=t.height,y=0,u=0;i.beginPath();const x=c*.3;i.moveTo(y+a/2,u+x),i.bezierCurveTo(y+a/2,u,y,u,y,u+x),i.bezierCurveTo(y,u+(c+x)/2,y+a/2,u+(c+x)/2,y+a/2,u+c),i.bezierCurveTo(y+a/2,u+(c+x)/2,y+a,u+(c+x)/2,y+a,u+x),i.bezierCurveTo(y+a,u,y+a/2,u,y+a/2,u+x),i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},qo=(i,t)=>{const a=t.width/2,c=t.height/2,y=t.width/2,u=t.height/2;i.beginPath(),i.ellipse(a,c,y,u,0,0,2*Math.PI),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Xo=(i,t)=>{const a=Math.min(t.width,t.height)*.1;Jt(i,0,0,t.width,t.height,a),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Qo=(i,t)=>{i.save(),t.opacity!==void 0&&(i.globalAlpha=t.opacity),i.strokeStyle=t.stroke||t.fill||"#000000",i.lineWidth=t.strokeWidth||t.height||2,i.lineCap="round",i.beginPath(),i.moveTo(0,t.height/2),i.lineTo(t.width,t.height/2),i.stroke(),i.restore()},Ko=(i,t)=>{const a=t.src||t.imageData;if(a)try{if(a instanceof HTMLImageElement){if(a.complete&&a.naturalWidth>0&&a.naturalHeight>0){i.drawImage(a,0,0,t.width,t.height);return}}else if(typeof a=="string"&&a.length>0){if(t._imageElement instanceof HTMLImageElement||(t._imageElement=new Image,t._imageElement.crossOrigin="anonymous",t._imageElement.onload=()=>{mt()},t._imageElement.onerror=()=>{console.error("Failed to load image:",a),t._imageLoadError=!0,mt()},t._imageElement.src=a),t._imageElement.complete&&t._imageElement.naturalWidth>0&&t._imageElement.naturalHeight>0){i.drawImage(t._imageElement,0,0,t.width,t.height);return}if(t._imageLoadError){i.fillStyle="#ffebee",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#f44336",i.lineWidth=2,i.strokeRect(0,0,t.width,t.height),i.fillStyle="#f44336",i.font="14px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Error loading image",t.width/2,t.height/2);return}}i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.lineWidth=1,i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="14px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Your customization",t.width/2,t.height/2)}catch(c){console.error("Error drawing image:",c),i.fillStyle="#ffebee",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#f44336",i.lineWidth=2,i.strokeRect(0,0,t.width,t.height),i.fillStyle="#f44336",i.font="14px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Error loading image",t.width/2,t.height/2)}else i.fillStyle="#f8f8f8",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ddd",i.lineWidth=1,i.strokeRect(0,0,t.width,t.height),i.fillStyle="#999",i.font="14px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("No Image",t.width/2,t.height/2)},Zo=(i,t)=>{const a=t.src;if(a)try{if(a instanceof HTMLImageElement){if(a.complete&&a.naturalWidth>0&&a.naturalHeight>0){i.drawImage(a,0,0,t.width,t.height);return}}else if(typeof a=="string"&&a.length>0){if(t._stickerElement instanceof HTMLImageElement||(t._stickerElement=new Image,t._stickerElement.crossOrigin="anonymous",t._stickerElement.onload=()=>{mt()},t._stickerElement.onerror=()=>{console.error("Failed to load sticker:",a),t._stickerLoadError=!0,mt()},t._stickerElement.src=a),t._stickerElement.complete&&t._stickerElement.naturalWidth>0&&t._stickerElement.naturalHeight>0){i.drawImage(t._stickerElement,0,0,t.width,t.height);return}if(t._stickerLoadError){He(i,t,"Failed to load",!0);return}}He(i,t,"Your customization")}catch(c){console.error("Error drawing sticker:",c),He(i,t,"Error",!0)}else He(i,t,"No Sticker")},He=(i,t,a,c=!1)=>{i.fillStyle=c?"#ffebee":"#f8f9fa",i.fillRect(0,0,t.width,t.height),i.strokeStyle=c?"#f44336":"#dee2e6",i.lineWidth=2,i.strokeRect(0,0,t.width,t.height),i.fillStyle=c?"#f44336":"#6c757d",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText(a,t.width/2,t.height/2)},Jo=(i,t)=>{if(t.imageObject&&t.imageObject.complete&&t.imageObject.naturalHeight!==0)try{i.drawImage(t.imageObject,0,0,t.width,t.height)}catch(a){console.error("Error drawing embroidery image:",a),Me(i,t,"Error loading image")}else if(t.src&&!t.imageLoading){t.imageLoading=!0;const a=new Image;a.crossOrigin="anonymous",a.onload=()=>{a.complete&&a.naturalHeight!==0?(t.imageObject=a,t.imageLoading=!1,mt()):(t.imageLoading=!1,console.error("Image loaded but is invalid:",t.src))},a.onerror=()=>{t.imageLoading=!1,console.error("Failed to load embroidery image:",t.src),Me(i,t,"Failed to load")},a.src=t.src,Me(i,t,"Your customization")}else t.imageLoading?Me(i,t,"Your customization"):Me(i,t)},Me=(i,t,a="Embroidery")=>{i.fillStyle="#f9f9f9",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ddd",i.lineWidth=2,i.strokeRect(0,0,t.width,t.height),i.fillStyle="#999",i.font="24px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("🧵",t.width/2,t.height/2-10),i.fillStyle="#666",i.font="12px Arial",i.fillText(a,t.width/2,t.height/2+15)},fi=(i,t,a)=>{if(!a)return!1;const c=a.x+a.width/2,y=a.y+a.height/2,u=i-c,x=t-y,f=-(a.rotation||0)*Math.PI/180,p=Math.cos(f),b=Math.sin(f),j=u*p-x*b,A=u*b+x*p,W=a.width/2,tt=a.height/2;return j>=-W&&j<=W&&A>=-tt&&A<=tt},Xi=g.useCallback(()=>{if(Qt.current){const a=Qt.current;Qt.current=null;const c=Math.min(a.x0,a.x1),y=Math.min(a.y0,a.y1),u=Math.abs(a.x1-a.x0),x=Math.abs(a.y1-a.y0);if(u>3&&x>3){const f=E.filter(b=>{const j=b.width||0,A=b.height||0;return b.x<c+u&&b.x+j>c&&b.y<y+x&&b.y+A>y}),p=f.map(b=>b.id);q(p),at(p.length?f[f.length-1]:null)}Yt()}(O||J||C)&&bt(),je.current=null,ni.current={v:[],h:[]},li.current=[],ci.current=[],di.current=null,st(!1),ht(!1),G(!1),Q(null);const i=It.current;if(It.current=null,i&&!jt.current&&!kt.current){const a=E.find(c=>c.id===i);a&&a.type==="text"&&!a.isIcon&&!a.locked&&ge(a)}jt.current=!1;const t=Tt.current;t&&(t.style.cursor="default")},[O,J,C,bt,E]);g.useEffect(()=>{const i=t=>{if(n)return;const a=document.activeElement;if(a&&(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.tagName==="SELECT"||a.isContentEditable))return;const y=ct.length>1?ct:v?[v.id]:[];if(!kt.current&&v&&v.type==="text"&&!v.isIcon&&ct.length<=1&&!t.ctrlKey&&!t.metaKey&&!t.altKey){if(t.key==="Enter"||t.key==="F2"){t.preventDefault(),ge(v);return}if(t.key.length===1){t.preventDefault();const u={...v,text:t.key};ae(v.id,{text:t.key}),ge(u);return}}if((t.ctrlKey||t.metaKey)&&(t.key==="z"&&!t.shiftKey?(t.preventDefault(),Te()):(t.key==="z"&&t.shiftKey||t.key==="y")&&(t.preventDefault(),ue())),t.key==="Delete"||t.key==="Backspace"){const u=y.filter(x=>{const f=E.find(p=>p.id===x);return f&&!f.locked});u.length&&(ot(x=>x.filter(f=>!u.includes(f.id))),at(null),q([]),bt(),t.preventDefault())}if((t.ctrlKey||t.metaKey)&&t.key==="d"&&v&&(pi(v.id),t.preventDefault()),t.key==="Escape"&&(v||y.length)&&(at(null),q([]),t.preventDefault()),(t.ctrlKey||t.metaKey)&&t.key==="c"&&y.length&&(Gi.current=y.map(u=>E.find(x=>x.id===u)).filter(Boolean).map(u=>({...u})),t.preventDefault()),(t.ctrlKey||t.metaKey)&&t.key==="v"){const u=Gi.current;if(u&&u.length){const x=u.map(f=>({...f,id:Ot(),x:(f.x||0)+20,y:(f.y||0)+20}));ot(f=>[...f,...x]),q(x.length>1?x.map(f=>f.id):[]),at(x[x.length-1]),bt(),t.preventDefault()}}if(y.length&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(t.key)){t.preventDefault();const u=t.shiftKey?10:1;let x=0,f=0;switch(t.key){case"ArrowUp":f=-u;break;case"ArrowDown":f=u;break;case"ArrowLeft":x=-u;break;case"ArrowRight":x=u;break}const p=y.filter(b=>{const j=E.find(A=>A.id===b);return j&&!j.locked});if(p.length)if(ot(b=>b.map(j=>p.includes(j.id)?{...j,x:j.x+x,y:j.y+f}:j)),at(b=>b&&p.includes(b.id)?{...b,x:b.x+x,y:b.y+f}:b),bt(),p.length===1&&v){const b=v.x+x,j=v.y+f,A=Hi(B,At),W=tt=>tt>=10?Math.round(tt).toString():tt>=1?tt.toFixed(1):tt.toFixed(2);we.current={cx:b+(v.width||0)/2,y:j+(v.height||0)+8,label:A>0?`x ${W(b*A)}" y ${W(j*A)}"`:`x ${Math.round(b)} y ${Math.round(j)}`},Yt(),ke.current&&clearTimeout(ke.current),ke.current=setTimeout(()=>{we.current=null,Yt()},1e3)}else Yt()}};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[v,ct,E,Te,ue,n,B,At]);const ui=(i,t={})=>{const a={id:Ot(),type:i,x:50,y:50,width:100,height:100,fill:"#000000",stroke:"#000000",strokeWidth:0,rotation:0,...t};switch(i){case"text":a.id=Ot(),a.text=t.text||"New Text",a.fontSize=t.fontSize||20,a.fontFamily=t.fontFamily||"Arial",a.fontWeight=t.fontWeight||"normal",a.fontStyle=t.fontStyle||"normal",a.textAlign=t.textAlign||"left",a.width=t.width||150,a.height=t.height||50;break;case"icon":a.id=Ot(),a.text=t.text||"🎯",a.fontSize=t.fontSize||48,a.fontFamily=t.fontFamily||"Arial",a.fontWeight=t.fontWeight||"normal",a.fontStyle=t.fontStyle||"normal",a.textAlign="center",a.width=80,a.height=80,a.iconData=t.iconData||null,a.type="text",a.isIcon=!0;break;case"image":a.id=Ot(),a.imageData=t.imageData||null,a.width=t.width||200,a.height=t.height||200;break;case"qrcode":a.id=Ot(),a.type="qrcode",a.x=(t==null?void 0:t.x)||B/2-((t==null?void 0:t.width)||100)/2,a.y=(t==null?void 0:t.y)||X/2-((t==null?void 0:t.height)||100)/2,a.width=(t==null?void 0:t.width)||100,a.height=(t==null?void 0:t.height)||100,a.src=(t==null?void 0:t.src)||"",a.data=(t==null?void 0:t.data)||"",a.rotation=0,a.opacity=1;break;case"barcode":a.id=Ot(),a.type="barcode",a.x=(t==null?void 0:t.x)||B/2-((t==null?void 0:t.width)||200)/2,a.y=(t==null?void 0:t.y)||X/2-((t==null?void 0:t.height)||100)/2,a.width=(t==null?void 0:t.width)||200,a.height=(t==null?void 0:t.height)||100,a.src=(t==null?void 0:t.src)||"",a.data=(t==null?void 0:t.data)||"",a.format=(t==null?void 0:t.format)||"CODE128",a.rotation=0,a.opacity=1,a.imageObject=(t==null?void 0:t.imageObject)||null;break;case"sticker":a.id=Ot(),a.type="sticker",a.imageData=(t==null?void 0:t.imageData)||null,a.width=t.width||200,a.height=t.height||200;break;case"horizontalLine":a.id=Ot(),a.type="horizontalLine",a.x=B/2-100,a.y=X/2-1,a.width=200,a.height=2,a.fill="#000000",a.stroke="#000000",a.strokeWidth=2,a.rotation=0,a.opacity=1;break;case"embroidery":a.id=Ot(),a.type="embroidery",a.imageData=(t==null?void 0:t.imageData)||null,a.width=t.width||200,a.height=t.height||200;break;case"rectangle":case"circle":case"triangle":case"star":case"arrow":case"diamond":case"hexagon":case"pentagon":case"heart":case"oval":case"roundedRectangle":break;default:console.warn(`Unknown element type: ${i}`);return}t.x==null&&(a.x=Math.max(0,B/2-(a.width||0)/2)),t.y==null&&(a.y=Math.max(0,X/2-(a.height||0)/2)),ot(c=>[...c,a]),at(a),bt(),a.type==="text"&&!a.isIcon&&ge(a)},ta=()=>{ui("text",{text:"Your text",fontSize:32,width:220,height:48,x:B/2-220/2,y:X/2-48/2})},ea=()=>{const i=document.createElement("input");i.type="file",i.accept="image/*",i.onchange=t=>{const a=t.target.files&&t.target.files[0];a&&a.type.startsWith("image/")&&Si(a)},i.click()},ae=(i,t)=>{ot(a=>a.map(c=>c.id===i?{...c,...t}:c)),v&&v.id===i&&at(a=>({...a,...t}))},ge=g.useCallback(i=>{n||!i||i.type!=="text"||i.isIcon||(at(i),q([i.id]),zt(i.id))},[n]),gi=g.useCallback(()=>{zt(i=>(i!=null&&bt(),null))},[bt]);g.useEffect(()=>{kt.current=ft,Ae.current&&Ae.current()},[ft]),g.useEffect(()=>{if(ft&&Ht.current){const i=Ht.current;i.focus();const t=i.value.length;try{i.setSelectionRange(t,t)}catch{}}},[ft]);const Qi=async i=>{var u,x,f;if(!i||typeof _!="function")return;const t=i.src||i.image||(i.imageData instanceof HTMLImageElement?i.imageData.src:i.imageData)||((u=i._imageElement)==null?void 0:u.src)||((x=i._stickerElement)==null?void 0:x.src)||((f=i._embroideryElement)==null?void 0:f.src);if(!t)throw new Error("No image to process");const a=await _(t),c=typeof a=="string"?a:URL.createObjectURL(a),y=new Image;y.crossOrigin="anonymous",await new Promise((p,b)=>{y.onload=p,y.onerror=()=>b(new Error("Processed image failed to load")),y.src=c}),ae(i.id,{src:c,image:c,imageData:c,_imageElement:null,_stickerElement:null,_embroideryElement:null,_imageLoadError:!1,originalWidth:y.naturalWidth,originalHeight:y.naturalHeight,bgRemoved:!0}),bt(),mt()},mi=g.useCallback(()=>{v&&(ot(i=>i.filter(t=>t.id!==v.id)),at(null),bt())},[v,bt]),pi=i=>{const t=E.find(a=>a.id===i);if(t){const a={...t,id:Ot(),x:t.x+20,y:t.y+20};ot(c=>[...c,a]),at(a),bt()}},ia=i=>{const t=i||(v==null?void 0:v.id);t&&(ot(a=>a.map(c=>c.id===t?{...c,locked:!c.locked}:c)),at(a=>a&&a.id===t?{...a,locked:!a.locked}:a),bt())},Ki=i=>{if(!v||v.locked)return;const t={width:Math.max(10,(v.width||0)*i),height:Math.max(10,(v.height||0)*i)};(v.type==="text"||v.isIcon)&&(t.fontSize=Math.max(6,Math.round((v.fontSize||20)*i))),ae(v.id,t),bt()},Zi=i=>{if(!v||v.locked)return;const t=(((v.rotation||0)+i)%360+360)%360;ae(v.id,{rotation:t}),bt()},Ji=i=>{const t=E.filter(c=>ct.includes(c.id));if(t.length<2)return;const a={};i(t,a),ot(c=>c.map(y=>a[y.id]?{...y,...a[y.id]}:y)),at(c=>c&&a[c.id]?{...c,...a[c.id]}:c),bt()},oa=i=>Ji((t,a)=>{const c=Math.min(...t.map(b=>b.x)),y=Math.max(...t.map(b=>b.x+(b.width||0))),u=Math.min(...t.map(b=>b.y)),x=Math.max(...t.map(b=>b.y+(b.height||0))),f=(c+y)/2,p=(u+x)/2;t.forEach(b=>{b.locked||(i==="left"?a[b.id]={x:c}:i==="right"?a[b.id]={x:y-(b.width||0)}:i==="hcenter"?a[b.id]={x:f-(b.width||0)/2}:i==="top"?a[b.id]={y:u}:i==="bottom"?a[b.id]={y:x-(b.height||0)}:i==="vcenter"&&(a[b.id]={y:p-(b.height||0)/2}))})}),aa=i=>Ji((t,a)=>{if(t.length<3)return;const c=W=>i==="h"?W.width||0:W.height||0,y=W=>i==="h"?W.x:W.y,u=[...t].sort((W,tt)=>y(W)-y(tt)),x=u[0],f=u[u.length-1],p=y(f)+c(f)-y(x),b=u.reduce((W,tt)=>W+c(tt),0),j=(p-b)/(u.length-1);let A=y(x)+c(x)+j;u.forEach((W,tt)=>{tt===0||tt===u.length-1||(W.locked||(a[W.id]=i==="h"?{x:A}:{y:A}),A+=c(W)+j)})}),ra=()=>{ct.length&&(ot(i=>i.filter(t=>!ct.includes(t.id))),at(null),q([]),bt())},to=(i,t)=>{const a=E.findIndex(u=>u.id===i);if(a===-1)return;const c=[...E],y=c[a];t==="up"&&a<c.length-1?(c[a]=c[a+1],c[a+1]=y):t==="down"&&a>0?(c[a]=c[a-1],c[a-1]=y):t==="top"?(c.splice(a,1),c.push(y)):t==="bottom"&&(c.splice(a,1),c.unshift(y)),ot(c),bt()};g.useCallback(()=>{K&&he(i=>({...i,[K.sectionName]:{elements:[...E],selectedColor:Dt}}))},[K,E,Dt]);const[,sa]=g.useReducer(i=>i+1,0);setTimeout(()=>{sa()},20);const na=g.useCallback(()=>{K&&he(i=>({...i,[K.sectionName]:{elements:[...E],selectedColor:Dt}}))},[K,E,Dt]);g.useImperativeHandle(o,()=>({handleSectionChange:io,flushCurrentSectionDesign:na,addImageFromUrl:(i,t={})=>{if(!i)return;const a=t.width||220,c=t.height||220;ui("image",{imageData:i,src:i,width:a,height:c,x:Math.max(0,(B-a)/2),y:Math.max(0,(X-c)/2)})},exportPrintReady:async(i="png")=>await hi(i,!1),exportFullDesign:async(i="png")=>await hi(i,!0),exportDesign:hi,getCanvasData:()=>Ne(),exportAllDesignsAsJSON:async(i="png")=>{try{const t=Ne(),a=(K==null?void 0:K.sectionName)||"main",c={elements:t.elements,selectedColor:t.selectedColor,canvasWidth:t.canvasWidth,canvasHeight:t.canvasHeight},y={...t.sectionDesigns||{},[a]:c},u=h.sections&&h.sections.length>0?h.sections:[{id:a,sectionName:a,image:K==null?void 0:K.sectionImage,sectionImage:K==null?void 0:K.sectionImage}];return await Ce.current.exportAllSectionsAsJSON(y,u,B,X,i,Fe,de)}catch(t){throw console.error("Export as JSON failed:",t),t}},exportCurrentSectionAsJSON:async(i="png")=>{try{const t=Ne();return await Ce.current.exportCurrentSectionAsJSON(t,i,Fe,de)}catch(t){throw console.error("Export current section as JSON failed:",t),t}}}));const Ut=g.useRef(null),yi=g.useRef(!1),mt=g.useCallback(()=>{const i=Tt.current;if(!i||yi.current)return;yi.current=!0;const t=i.getContext("2d");if(t.setTransform(ze,0,0,ze,0,0),t.clearRect(0,0,B,X),Et.current&&$i(t,Et.current,B,X),Vt&&Io(t),E.forEach(f=>{f.id!==kt.current&&(t.save(),t.globalAlpha=f.opacity||1,Lo(t,f),t.restore())}),ct.length>1?(t.save(),t.strokeStyle="#6a45d2",t.lineWidth=1.5,t.setLineDash([4,3]),ct.forEach(f=>{const p=E.find(A=>A.id===f);if(!p)return;const b=fe(t,p),j=4;t.save(),t.translate(b.cx,b.cy),p.rotation&&t.rotate(p.rotation*Math.PI/180),t.strokeRect(-b.width/2-j,-b.height/2-j,b.width+j*2,b.height+j*2),t.restore()}),t.restore()):v&&v.id!==kt.current&&Ao(t,v),Qt.current){const f=Qt.current,p=Math.min(f.x0,f.x1),b=Math.min(f.y0,f.y1),j=Math.abs(f.x1-f.x0),A=Math.abs(f.y1-f.y0);t.save(),t.fillStyle="rgba(106,69,210,0.12)",t.strokeStyle="#6a45d2",t.lineWidth=1,t.setLineDash([4,3]),t.fillRect(p,b,j,A),t.strokeRect(p,b,j,A),t.restore()}const a=ni.current;a&&(a.v&&a.v.length||a.h&&a.h.length)&&(t.save(),t.strokeStyle="#ec4899",t.lineWidth=1,t.setLineDash([5,4]),(a.v||[]).forEach(f=>{t.beginPath(),t.moveTo(f,0),t.lineTo(f,X),t.stroke()}),(a.h||[]).forEach(f=>{t.beginPath(),t.moveTo(0,f),t.lineTo(B,f),t.stroke()}),t.restore());const c=li.current;c&&c.length&&(t.save(),t.strokeStyle="#ef4444",t.fillStyle="#ef4444",t.lineWidth=1,t.font="11px sans-serif",t.textAlign="center",t.textBaseline="middle",c.forEach(f=>{t.beginPath(),t.moveTo(f.x1,f.y1),t.lineTo(f.x2,f.y2),t.stroke();const p=f.y1===f.y2,b=4;t.beginPath(),p?(t.moveTo(f.x1,f.y1-b),t.lineTo(f.x1,f.y1+b),t.moveTo(f.x2,f.y2-b),t.lineTo(f.x2,f.y2+b)):(t.moveTo(f.x1-b,f.y1),t.lineTo(f.x1+b,f.y1),t.moveTo(f.x2-b,f.y2),t.lineTo(f.x2+b,f.y2)),t.stroke();const j=(f.x1+f.x2)/2,A=(f.y1+f.y2)/2,W=`${f.label}`,pt=t.measureText(W).width+8,I=15;t.fillStyle="#ef4444",Jt(t,j-pt/2,A-I/2,pt,I,3),t.fill(),t.fillStyle="#ffffff",t.fillText(W,j,A+.5),t.fillStyle="#ef4444"}),t.restore());const y=ci.current;y&&y.length&&(t.save(),t.strokeStyle="#a855f7",t.fillStyle="#a855f7",t.lineWidth=1,t.font="11px sans-serif",t.textAlign="center",t.textBaseline="middle",y.forEach(f=>{t.beginPath(),t.moveTo(f.x1,f.y1),t.lineTo(f.x2,f.y2),t.stroke();const p=f.y1===f.y2,b=4;t.beginPath(),p?(t.moveTo(f.x1,f.y1-b),t.lineTo(f.x1,f.y1+b),t.moveTo(f.x2,f.y2-b),t.lineTo(f.x2,f.y2+b)):(t.moveTo(f.x1-b,f.y1),t.lineTo(f.x1+b,f.y1),t.moveTo(f.x2-b,f.y2),t.lineTo(f.x2+b,f.y2)),t.stroke();const j=(f.x1+f.x2)/2,A=(f.y1+f.y2)/2,W=`${f.label}`,pt=t.measureText(W).width+8,I=15;t.fillStyle="#a855f7",Jt(t,j-pt/2,A-I/2,pt,I,3),t.fill(),t.fillStyle="#ffffff",t.fillText(W,j,A+.5),t.fillStyle="#a855f7"}),t.restore());const u=di.current;if(u){t.save(),t.font="11px sans-serif",t.textAlign="center",t.textBaseline="middle";const p=t.measureText(u.label).width+10,b=16,j=Math.max(p/2,Math.min(B-p/2,u.cx)),A=Math.min(X-b/2,u.y+b/2);t.fillStyle="#1d4ed8",Jt(t,j-p/2,A-b/2,p,b,3),t.fill(),t.fillStyle="#ffffff",t.fillText(u.label,j,A+.5),t.restore()}const x=we.current;if(x){t.save(),t.font="11px sans-serif",t.textAlign="center",t.textBaseline="middle";const p=t.measureText(x.label).width+10,b=16,j=Math.max(p/2,Math.min(B-p/2,x.cx)),A=Math.min(X-b/2,x.y+b/2);t.fillStyle="#1d4ed8",Jt(t,j-p/2,A-b/2,p,b,3),t.fill(),t.fillStyle="#ffffff",t.fillText(x.label,j,A+.5),t.restore()}yi.current=!1},[E,v,ct,B,X,Vt,ze]),Ae=g.useRef(mt);g.useEffect(()=>{Ae.current=mt},[mt]);const eo=g.useRef(!1);g.useEffect(()=>{eo.current=O||J||C},[O,J,C]);const Yt=g.useCallback(()=>{Ut.current&&cancelAnimationFrame(Ut.current),Ut.current=requestAnimationFrame(()=>{Ae.current(),Ut.current=null})},[]);g.useEffect(()=>{Ce.current&&(Ce.current.embroidery=Di(h))},[h]),g.useEffect(()=>{const i=(E||[]).filter(a=>a&&a.type==="text"&&a.fontFamily).map(a=>a.fontFamily);if(i.length===0)return;let t=!1;return Vi(i).then(()=>{t||mt()}),()=>{t=!0}},[E,mt]),g.useEffect(()=>{Yt()},[E,v,ct,B,X,Vt,Yt]),g.useEffect(()=>{Et.current&&Yt()},[Et.current,Yt]),g.useEffect(()=>()=>{Ut.current&&cancelAnimationFrame(Ut.current)},[]);const xi=g.useCallback(()=>{Ae.current(),eo.current&&(Ut.current=requestAnimationFrame(xi))},[]);g.useEffect(()=>{O||J||C?xi():(Ut.current&&(cancelAnimationFrame(Ut.current),Ut.current=null),Yt())},[O,J,C,xi,Yt]);const la=g.useCallback(i=>{if(n)return;const t=Tt.current,a=t.getBoundingClientRect(),c=(i.clientX-a.left)/gt,y=(i.clientY-a.top)/gt;if(i.pointerId!=null&&t.setPointerCapture)try{t.setPointerCapture(i.pointerId)}catch{}if(we.current&&(we.current=null,ke.current&&clearTimeout(ke.current)),jt.current=!1,It.current=null,m({x:c,y}),v&&!v.locked&&ct.length<=1){const f=qi(c,y,v);if(f){if(f==="rotate"){G(!0);const p=v.x+v.width/2,b=v.y+v.height/2,j=Math.atan2(y-b,c-p)*180/Math.PI;m({x:c,y,initialAngle:j,initialRotation:v.rotation||0})}else ht(!0),Q(f),m({x:c,y,initialWidth:v.width,initialHeight:v.height,initialX:v.x,initialY:v.y});return}}let u=null;for(let f=E.length-1;f>=0;f--)if(fi(c,y,E[f])){u=E[f];break}const x=ct.length>1?ct:v?[v.id]:[];if(i.shiftKey&&u){const f=x.includes(u.id),p=f?x.filter(j=>j!==u.id):[...x,u.id];q(p);const b=f?p[p.length-1]:u.id;at(b&&E.find(j=>j.id===b)||null),mt();return}if(u&&x.length>1&&x.includes(u.id)){const f=E.filter(p=>x.includes(p.id)&&!p.locked);f.length&&(st(!0),je.current={startX:c,startY:y,items:f.map(p=>({id:p.id,x:p.x,y:p.y}))},m({x:c,y}));return}if(u){je.current=null,at(u),u.locked||(st(!0),m({x:c,y,offsetX:c-u.x,offsetY:y-u.y})),u.type==="text"&&!u.isIcon&&!u.locked&&(It.current=u.id),mt();return}at(null),Qt.current={x0:c,y0:y,x1:c,y1:y},mt()},[n,gt,v,ct,E,mt]),ca=g.useCallback(i=>{if(n)return;const a=Tt.current.getBoundingClientRect(),c=(i.clientX-a.left)/gt,y=(i.clientY-a.top)/gt;for(let u=E.length-1;u>=0;u--){const x=E[u];if(x.type==="text"&&!x.isIcon&&fi(c,y,x)){ge(x);return}}},[n,gt,E,ge]),da=g.useCallback(i=>{if(n)return;const t=Tt.current,a=t.getBoundingClientRect(),c=(i.clientX-a.left)/gt,y=(i.clientY-a.top)/gt;if((O||J||C)&&(Math.abs(c-H.x)>2||Math.abs(y-H.y)>2)&&(jt.current=!0),Qt.current){Qt.current={...Qt.current,x1:c,y1:y},t.style.cursor="crosshair",mt();return}if(O&&je.current){const u=je.current;let x=c-u.startX,f=y-u.startY;const p=I=>{const nt=E.find(Ft=>Ft.id===I);return nt&&nt.width||0},b=I=>{const nt=E.find(Ft=>Ft.id===I);return nt&&nt.height||0},j=Math.min(...u.items.map(I=>I.x)),A=Math.max(...u.items.map(I=>I.x+p(I.id))),W=Math.min(...u.items.map(I=>I.y)),tt=Math.max(...u.items.map(I=>I.y+b(I.id)));x=Math.max(-j,Math.min(B-A,x)),f=Math.max(-W,Math.min(X-tt,f));const pt={};u.items.forEach(I=>{pt[I.id]={x:I.x+x,y:I.y+f}}),ot(I=>I.map(nt=>pt[nt.id]?{...nt,...pt[nt.id]}:nt)),at(I=>I&&pt[I.id]?{...I,...pt[I.id]}:I),t.style.cursor="grabbing",mt();return}if(v&&!O&&!J&&!C){const u=qi(c,y,v);u?u==="rotate"?t.style.cursor="grab":t.style.cursor=u:fi(c,y,v)?t.style.cursor="move":t.style.cursor="default"}else t.style.cursor=O?"grabbing":"default";if(C&&v){const u=v.x+v.width/2,x=v.y+v.height/2,p=Math.atan2(y-x,c-u)*180/Math.PI-H.initialAngle;let b=H.initialRotation+p;i.shiftKey&&(b=Math.round(b/15)*15),b=(b%360+360)%360,ot(j=>j.map(A=>A.id===v.id?{...A,rotation:b}:A)),at(j=>({...j,rotation:b})),mt();return}if(J&&v&&L){const u=c-H.x,x=y-H.y;let f=H.initialWidth,p=H.initialHeight,b=H.initialX,j=H.initialY;switch(L){case"se-resize":f=Math.max(20,H.initialWidth+u),p=Math.max(20,H.initialHeight+x);break;case"sw-resize":f=Math.max(20,H.initialWidth-u),p=Math.max(20,H.initialHeight+x),b=H.initialX+(H.initialWidth-f);break;case"ne-resize":f=Math.max(20,H.initialWidth+u),p=Math.max(20,H.initialHeight-x),j=H.initialY+(H.initialHeight-p);break;case"nw-resize":f=Math.max(20,H.initialWidth-u),p=Math.max(20,H.initialHeight-x),b=H.initialX+(H.initialWidth-f),j=H.initialY+(H.initialHeight-p);break}if((i.shiftKey||v.lockAspect)&&v.type!=="text"){const I=H.initialWidth/H.initialHeight;L.includes("e"),p=f/I,L.includes("n")&&(j=H.initialY+(H.initialHeight-p))}Bt&&(b=Kt(b),j=Kt(j),f=Kt(f),p=Kt(p));const A={...v,x:b,y:j,width:f,height:p},W=Hi(B,At),tt=I=>I>=10?Math.round(I).toString():I>=1?I.toFixed(1):I.toFixed(2),pt=W>0?`${tt(f*W)}" × ${tt(p*W)}"`:`${Math.round(f)} × ${Math.round(p)} px`;di.current={cx:b+f/2,y:j+p+8,label:pt},ot(I=>I.map(nt=>nt.id===v.id?A:nt)),at(A),mt();return}if(O&&v){let u=c-H.offsetX,x=y-H.offsetY;Bt&&(u=Kt(u),x=Kt(x));const f=6/(gt||1),p=v.width,b=v.height,j=E.filter(P=>P.id!==v.id),A=[0,B/2,B],W=[0,X/2,X];j.forEach(P=>{A.push(P.x,P.x+(P.width||0)/2,P.x+(P.width||0)),W.push(P.y,P.y+(P.height||0)/2,P.y+(P.height||0))});const tt=(P,te,$e)=>{const _e=[0,te/2,te];let me=null;return _e.forEach(Ve=>{$e.forEach(ee=>{const ie=Math.abs(P+Ve-ee);ie<=f&&(!me||ie<me.d)&&(me={d:ie,snapped:ee-Ve,line:ee})})}),me},pt={v:[],h:[]},I=tt(u,p,A);I&&(u=I.snapped,pt.v.push(I.line));const nt=tt(x,b,W);nt&&(x=nt.snapped,pt.h.push(nt.line)),ni.current=pt,u=Math.max(0,Math.min(B-v.width,u)),x=Math.max(0,Math.min(X-v.height,x));const Ft=()=>{const P=u,te=u+p,$e=x,_e=x+b,me=wt=>Math.min(_e,wt.y+(wt.height||0))-Math.max($e,wt.y),Ve=wt=>Math.min(te,wt.x+(wt.width||0))-Math.max(P,wt.x);let ee=null,ie=null,Ge=null,Ue=null;return j.forEach(wt=>{const zi=wt.x+(wt.width||0),Ti=wt.y+(wt.height||0);me(wt)>0&&(zi<=P&&(!ee||zi>ee.edge)&&(ee={edge:zi,el:wt}),wt.x>=te&&(!ie||wt.x<ie.edge)&&(ie={edge:wt.x,el:wt})),Ve(wt)>0&&(Ti<=$e&&(!Ge||Ti>Ge.edge)&&(Ge={edge:Ti,el:wt}),wt.y>=_e&&(!Ue||wt.y<Ue.edge)&&(Ue={edge:wt.y,el:wt}))}),{L:ee,R:ie,T:Ge,B:Ue}};let{L:St,R:vt,T:Ct,B:Nt}=Ft();if(!I&&St&&vt){const P=(St.edge+vt.edge-p)/2;Math.abs(u-P)<=f&&(u=P)}if(!nt&&Ct&&Nt){const P=(Ct.edge+Nt.edge-b)/2;Math.abs(x-P)<=f&&(x=P)}u=Math.max(0,Math.min(B-v.width,u)),x=Math.max(0,Math.min(X-v.height,x)),{L:St,R:vt,T:Ct,B:Nt}=Ft();const Mt=u,Gt=u+p,Lt=x,re=x+b,se=P=>(Math.max(Lt,P.y)+Math.min(re,P.y+(P.height||0)))/2,ne=P=>(Math.max(Mt,P.x)+Math.min(Gt,P.x+(P.width||0)))/2,wi=St?Math.round(Mt-St.edge):null,ki=vt?Math.round(vt.edge-Gt):null,ji=Ct?Math.round(Lt-Ct.edge):null,Ci=Nt?Math.round(Nt.edge-re):null,Fi=St&&vt&&wi===ki,Ni=Ct&&Nt&&ji===Ci,Ee=[];if(St&&!Fi){const P=se(St.el);Ee.push({x1:St.edge,y1:P,x2:Mt,y2:P,label:wi})}if(vt&&!Fi){const P=se(vt.el);Ee.push({x1:Gt,y1:P,x2:vt.edge,y2:P,label:ki})}if(Ct&&!Ni){const P=ne(Ct.el);Ee.push({x1:P,y1:Ct.edge,x2:P,y2:Lt,label:ji})}if(Nt&&!Ni){const P=ne(Nt.el);Ee.push({x1:P,y1:re,x2:P,y2:Nt.edge,label:Ci})}li.current=Ee;const Ie=[];if(Fi){const P=(se(St.el)+se(vt.el))/2;Ie.push({x1:St.edge,y1:P,x2:Mt,y2:P,label:wi}),Ie.push({x1:Gt,y1:P,x2:vt.edge,y2:P,label:ki})}if(Ni){const P=(ne(Ct.el)+ne(Nt.el))/2;Ie.push({x1:P,y1:Ct.edge,x2:P,y2:Lt,label:ji}),Ie.push({x1:P,y1:re,x2:P,y2:Nt.edge,label:Ci})}ci.current=Ie;const ho={...v,x:u,y:x};ot(P=>P.map(te=>te.id===v.id?ho:te)),at(ho),mt()}},[n,gt,v,O,J,C,L,H,Bt,B,X,E,mt]),io=g.useCallback(i=>{K&&he(a=>({...a,[K.sectionName]:{elements:E.map(c=>c.type==="image"?{...c,imageData:c.imageData,src:c.src}:c),selectedColor:Dt}}));const t=Xt[i.sectionName];if(t){const a=t.elements.map(c=>{if(c.type==="image"&&c.src&&!c.imageData){const y=new Image;return y.onload=()=>{ot(u=>u.map(x=>x.id===c.id?{...x,imageData:y}:x)),mt()},y.src=c.src,{...c,imageData:y}}return c});ot(a),pe(t.selectedColor||Dt)}else ot([]);Be(i),at(null)},[K,E,Dt,Xt,mt]),bi=g.useCallback((i,t)=>{const a={id:Ot(),type:"image",x:Kt(B/2-100),y:Kt(X/2-100),width:Math.min(i.width,200),height:Math.min(i.height,200),rotation:0,imageData:i,src:t,originalWidth:i.width,originalHeight:i.height},c=i.width/i.height;a.width/a.height!==c&&(a.width/c<=200?a.height=a.width/c:a.width=a.height*c),ot(y=>[...y,a]),at(a),bt()},[B,X,Kt,Ot,bt]),Si=g.useCallback(async i=>{if(!i||!i.type.startsWith("image/")){alert("Please select a valid image file.");return}if(typeof R=="function"){const a=URL.createObjectURL(i);try{const c=await R(i),y=typeof c=="string"?c:c&&c.url;if(!y)throw new Error("No URL returned from onUploadImage");const u=new Image;u.crossOrigin="anonymous",await new Promise((x,f)=>{u.onload=x,u.onerror=f,u.src=a}),bi(u,y);return}catch(c){console.error("Upload failed; falling back to inline image",c)}finally{URL.revokeObjectURL(a)}}const t=new FileReader;t.onload=a=>{const c=new Image;c.onload=()=>bi(c,a.target.result),c.onerror=()=>{console.error("Failed to load uploaded image"),alert("Failed to load the uploaded image. Please try again.")},c.src=a.target.result},t.onerror=()=>{console.error("Failed to read file"),alert("Failed to read the file. Please try again.")},t.readAsDataURL(i)},[R,bi]),oo=g.useCallback(Za(()=>{mt()},16),[mt]);g.useEffect(()=>{To.current||oo()},[E,v,Vt,oo]),g.useEffect(()=>{mt()},[mt]);const ao=i=>{if(!Wt)return{horizontal:[],vertical:[]};const t=document.querySelector(".ruler-horizontal"),a=document.querySelector(".ruler-vertical");if(!t||!a)return{horizontal:[],vertical:[]};const c=t.getBoundingClientRect(),y=a.getBoundingClientRect(),u=c.width,x=y.height,f=50,p=[],b=[];for(let j=f;j<=u;j+=f)j<=u-20&&p.push({position:j,value:Math.round(j/i)});for(let j=f;j<=x;j+=f)j<=x-15&&b.push({position:j,value:Math.round(j/i)});return{horizontal:p,vertical:b}},[ro,so]=g.useState({horizontal:[],vertical:[]});g.useEffect(()=>{const i=()=>{setTimeout(()=>{const c=ao(gt);so(c)},50)};i();let t;const a=()=>{clearTimeout(t),t=setTimeout(i,150)};return window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),clearTimeout(t)}},[gt,Wt]),g.useEffect(()=>{if(Wt&&!qt){const i=setTimeout(()=>{const t=ao(gt);so(t)},100);return()=>clearTimeout(i)}},[Wt,qt,gt]);const vi=Di(h),no=vi?Qa(E):[],lo=e.jsxs(e.Fragment,{children:[e.jsx(_a,{selectedElement:v,selectedCount:ct.length,onUpdate:ae,onMoveLayer:to,onAlignSelection:oa,onDistributeSelection:aa,onDeleteSelection:ra,availableFonts:Mo,theme:r,isEmbroidery:vi,onFontLoaded:mt,canvasWidth:B,canvasHeight:X,printConfig:At,onRemoveBackground:_?Qi:null}),l!=="customize"&&e.jsx(Va,{elements:E,selectedElement:v,onSelectElement:i=>{q(i?[i.id]:[]),at(i)},onMoveLayer:to,onDeleteElement:mi,theme:r})]});return e.jsxs("div",{className:"pure-canvas-designer",children:[e.jsx("div",{className:"designer-header",children:e.jsx(Da,{onAddElement:ui,onDeleteElement:()=>v&&mi(v.id),onDuplicateElement:()=>v&&pi(v.id),onUndo:Te,onRedo:ue,onToggleGrid:()=>ye(!Vt),onToggleRulers:()=>De(!Wt),onToggleSnap:()=>ce(!Bt),onTogglePrintGuides:()=>oi(i=>!i),onImageUpload:Si,canUndo:yt>0,canRedo:yt<Pt.length-1,showGrid:Vt,showRulers:Wt,snapToGrid:Bt,showPrintGuides:We,selectedElement:v,theme:r,readOnly:n,mode:l,productionMethods:h==null?void 0:h.productionMethods,supportsEmbroidery:h==null?void 0:h.supportsEmbroidery,apiKey:s.apiKey,apiEndpoint:s.apiEndpoint,aiEnabled:N,aiEndpoint:T,onAIImageGenerate:S,aiCreditsRemaining:D,onAddAiCredits:M,isAuthenticated:$,onRequireAuth:Z,onRequestCollaboration:Y,onOpenUploads:lt})}),vi&&!xe&&e.jsxs("div",{role:"note",style:{display:"flex",gap:10,alignItems:"flex-start",margin:"8px 12px",padding:"10px 12px",background:"#fff7ed",border:"1px solid #fed7aa",borderRadius:8,color:"#7c2d12",fontSize:13,lineHeight:1.4},children:[e.jsx("span",{style:{fontSize:16,lineHeight:1},children:"🧵"}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("strong",{children:"Embroidery preview"})," — this is how your design will be stitched. Colours are matched to real thread.",no.length>0&&e.jsx("ul",{style:{margin:"6px 0 0",paddingLeft:18},children:no.map((i,t)=>e.jsx("li",{children:i},t))})]}),e.jsx("button",{type:"button",onClick:()=>be(!0),"aria-label":"Dismiss",style:{background:"none",border:"none",cursor:"pointer",fontSize:18,color:"#9a3412",lineHeight:1},children:"×"})]}),e.jsxs("div",{className:"designer-content",children:[Wt&&!qt&&e.jsxs("div",{className:"rulers",children:[e.jsx("div",{className:"ruler-horizontal",children:e.jsx("div",{className:"ruler-horizontal-numbers",children:ro.horizontal.map((i,t)=>e.jsx("span",{className:"ruler-number horizontal",style:{left:`${i.position}px`},children:i.value},t))})}),e.jsx("div",{className:"ruler-vertical",children:e.jsx("div",{className:"ruler-vertical-numbers",children:ro.vertical.map((i,t)=>e.jsx("span",{className:"ruler-number vertical",style:{top:`${i.position}px`},children:i.value},t))})})]}),e.jsxs("div",{className:"canvas-container",ref:ve,onDragOver:i=>{n||i.preventDefault()},onDrop:i=>{var a;if(n)return;i.preventDefault();const t=[...((a=i.dataTransfer)==null?void 0:a.files)||[]].find(c=>c.type.startsWith("image/"));t&&Si(t)},children:[qt&&e.jsx("button",{type:"button",className:"mobile-panel-toggle","aria-label":"Open tools & properties",title:"Tools & properties",onClick:()=>Se(i=>!i),style:{position:"absolute",top:8,right:8,zIndex:40,width:42,height:42,borderRadius:10,border:"1px solid #e2e8f0",background:"#ffffff",boxShadow:"0 2px 10px rgba(0,0,0,0.18)",fontSize:20,lineHeight:1,color:"#334155",cursor:"pointer"},children:"☰"}),!n&&E.length>0&&(()=>{const i=[],t=((At==null?void 0:At.safeAreaPct)||0)/100;if(t){const c=B*t,y=X*t,u=B*(1-t),x=X*(1-t),f=Tt.current&&Tt.current.getContext("2d"),p=j=>{const A=f?fe(f,j):{x:j.x,y:j.y,width:j.width||0,height:j.height||0,cx:j.x+(j.width||0)/2,cy:j.y+(j.height||0)/2},{x:W,y:tt,width:pt,height:I,cx:nt,cy:Ft}=A,St=(j.rotation||0)*Math.PI/180,vt=Math.cos(St),Ct=Math.sin(St);return[[W,tt],[W+pt,tt],[W+pt,tt+I],[W,tt+I]].some(([Mt,Gt])=>{const Lt=Mt-nt,re=Gt-Ft,se=nt+Lt*vt-re*Ct,ne=Ft+Lt*Ct+re*vt;return se<c-.5||ne<y-.5||se>u+.5||ne>x+.5})};E.some(p)&&i.push({key:"safe",text:"Some artwork is outside the safe print area and may be cut off."})}return E.some(c=>{var u;const y=Co(c,B,At);return y!=null&&((u=Fo(y,At))==null?void 0:u.level)==="bad"})&&i.push({key:"dpi",text:"An image is low-resolution and may print blurry — try a larger file or smaller size."}),i.length?e.jsx("div",{style:{position:"absolute",top:8,left:"50%",transform:"translateX(-50%)",zIndex:35,maxWidth:"92%",display:"flex",flexDirection:"column",gap:6},children:i.map(c=>e.jsxs("div",{role:"status",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:8,background:"#fffbeb",border:"1px solid #fcd34d",color:"#92400e",fontSize:12,lineHeight:1.3,boxShadow:"0 2px 10px rgba(0,0,0,0.12)"},children:[e.jsx("span",{"aria-hidden":"true",children:"⚠️"}),c.text]},c.key))}):null})(),e.jsx("div",{style:{width:B*gt,height:X*gt,flex:"none"},children:e.jsxs("div",{className:"canvas-stage",style:{position:"relative",width:B,height:X,transform:`scale(${gt})`,transformOrigin:"top left"},children:[e.jsx("canvas",{ref:Tt,width:Math.round(B*ze),height:Math.round(X*ze),onPointerDown:la,onPointerMove:da,onPointerUp:Xi,onPointerCancel:Xi,onDoubleClick:ca,style:{display:"block",width:B,height:X,border:"1px solid #e2e8f0",cursor:O?"grabbing":(v==null?void 0:v.type)==="text"&&!v.isIcon&&!ft?"text":"default",touchAction:"none"}}),!n&&E.length===0&&(()=>{const i=Qe[(typeof F=="number"?F:Qe.findIndex(a=>a.key===F))%Qe.length]||Qe[0],t={display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",borderRadius:8,cursor:"pointer",fontSize:13,fontWeight:600,lineHeight:1};return e.jsxs("div",{style:{position:"absolute",inset:0,zIndex:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,pointerEvents:"none",textAlign:"center",padding:24,color:"#0f172a"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:"50%",background:"rgba(255,255,255,0.92)",border:"1px dashed #94a3b8"},children:e.jsx(et,{name:"image",size:26,color:"#475569"})}),e.jsx("div",{style:{fontSize:17,fontWeight:800,color:"#0f172a"},children:i.title}),e.jsx("div",{style:{fontSize:13,fontWeight:600,maxWidth:260,lineHeight:1.45,color:"#334155"},children:i.body}),e.jsxs("div",{style:{display:"flex",gap:8,pointerEvents:"auto",marginTop:2},children:[e.jsxs("button",{type:"button",style:{...t,background:(r==null?void 0:r.primaryColor)||"#0f172a",color:"#ffffff",border:"none"},onClick:ta,children:[e.jsx(et,{name:"text",size:16,color:"#ffffff"})," Add text"]}),e.jsxs("button",{type:"button",style:{...t,background:"#ffffff",color:"#0f172a",border:"1px solid #cbd5e1"},onClick:lt?()=>lt():ea,children:[e.jsx(et,{name:"upload",size:16,color:"#0f172a"})," Upload image"]})]})]})})(),We&&e.jsxs("div",{className:"print-guides-overlay","aria-hidden":"true",style:{position:"absolute",top:0,left:0,width:B,height:X,pointerEvents:"none"},children:[e.jsx("div",{style:{position:"absolute",inset:0,border:"1px solid rgba(106, 69, 210, 0.55)"}}),e.jsx("div",{style:{position:"absolute",top:`${At.safeAreaPct}%`,left:`${At.safeAreaPct}%`,right:`${At.safeAreaPct}%`,bottom:`${At.safeAreaPct}%`,border:"1px dashed rgba(106, 69, 210, 0.9)"},children:e.jsx("span",{style:{position:"absolute",top:2,left:4,fontSize:10,lineHeight:1.4,color:"rgba(106, 69, 210, 0.9)",background:"rgba(255,255,255,0.6)",padding:"0 3px",borderRadius:2,userSelect:"none"},children:"Safe area"})})]}),v&&!n&&ct.length<=1&&(()=>{const i=Tt.current&&Tt.current.getContext("2d"),t=i?fe(i,v):{cx:v.x+(v.width||0)/2,y:v.y},a=t.cx,c=t.y,y=["image","sticker","embroidery"].includes(v.type),u=!!v.locked,x={width:30,height:30,border:"none",background:"transparent",borderRadius:6,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0},f=p=>{p.preventDefault(),p.stopPropagation();const b=v;if(!b||b.locked)return;const j=b.id,A=p.clientX,W=p.clientY,tt=b.x,pt=b.y,I=gt||1,nt=St=>{const vt=tt+(St.clientX-A)/I,Ct=pt+(St.clientY-W)/I;ae(j,{x:Math.max(0,Math.min(B-1,vt)),y:Math.max(0,Math.min(X-1,Ct))})},Ft=()=>{window.removeEventListener("pointermove",nt),window.removeEventListener("pointerup",Ft),bt()};window.addEventListener("pointermove",nt),window.addEventListener("pointerup",Ft)};return e.jsx("div",{style:{position:"absolute",left:a,top:c,pointerEvents:"none",zIndex:30},children:e.jsxs("div",{className:"element-action-toolbar",onMouseDown:p=>p.stopPropagation(),style:{transform:`translate(-50%, calc(-100% - 12px)) scale(${1/(gt||1)})`,transformOrigin:"bottom center",pointerEvents:"auto",display:"flex",alignItems:"center",gap:2,padding:"3px 4px",background:"#ffffff",border:"1px solid #e2e8f0",borderRadius:8,boxShadow:"0 4px 14px rgba(0,0,0,0.18)",whiteSpace:"nowrap"},children:[!u&&e.jsxs(e.Fragment,{children:[e.jsx("button",{style:{...x,cursor:"grab",touchAction:"none"},title:"Drag to move",onPointerDown:f,children:e.jsx(et,{name:"move",size:18,color:"#334155"})}),e.jsx("span",{style:{width:1,height:20,background:"#e2e8f0",margin:"0 2px"}}),e.jsx("button",{style:x,title:"Shrink",onClick:p=>{p.stopPropagation(),Ki(.9)},children:e.jsx(et,{name:"minus",size:18,color:"#334155"})}),e.jsx("button",{style:x,title:"Enlarge",onClick:p=>{p.stopPropagation(),Ki(1.1)},children:e.jsx(et,{name:"plus",size:18,color:"#334155"})}),e.jsx("button",{style:x,title:"Duplicate",onClick:p=>{p.stopPropagation(),pi(v.id)},children:e.jsx(et,{name:"duplicate",size:18,color:"#334155"})}),e.jsx("button",{style:x,title:"Rotate left 15°",onClick:p=>{p.stopPropagation(),Zi(-15)},children:e.jsx(et,{name:"rotateLeft",size:18,color:"#334155"})}),e.jsx("button",{style:x,title:"Rotate right 15°",onClick:p=>{p.stopPropagation(),Zi(15)},children:e.jsx(et,{name:"rotateRight",size:18,color:"#334155"})}),y&&_&&e.jsx("button",{style:x,title:"Remove background",onClick:p=>{p.stopPropagation(),Qi(v).catch(()=>{})},children:e.jsx("span",{style:{fontSize:16,lineHeight:1},children:"✂️"})})]}),e.jsx("button",{style:{...x,background:u?"#eef2ff":"transparent"},title:u?"Unlock":"Lock position",onClick:p=>{p.stopPropagation(),ia(v.id)},children:e.jsx(et,{name:"lock",size:18,color:u?"#4f46e5":"#334155"})}),!u&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{width:1,height:20,background:"#e2e8f0",margin:"0 2px"}}),e.jsx("button",{style:x,title:"Delete",onClick:p=>{p.stopPropagation(),mi()},children:e.jsx(et,{name:"trash",size:18,color:"#dc2626"})})]})]})})})(),ft&&!n&&(()=>{const i=E.find(x=>x.id===ft);if(!i)return null;const t=Tt.current&&Tt.current.getContext("2d"),a=t?fe(t,i):{x:i.x,y:i.y,width:i.width||120,height:i.height||i.fontSize||20},c=i.fontSize||20,y=c*(i.lineHeight||1.2),u=(y-c)/2;return e.jsx("textarea",{ref:Ht,className:"inline-text-editor",value:i.text||"",wrap:"off",spellCheck:!1,onChange:x=>ae(i.id,{text:x.target.value}),onBlur:gi,onKeyDown:x=>{x.stopPropagation(),x.key==="Escape"&&(x.preventDefault(),gi()),x.key==="Enter"&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),gi())},onPointerDown:x=>x.stopPropagation(),style:{position:"absolute",left:a.x,top:a.y-u,width:Math.max((a.width||0)+c,24),height:(a.height||y)+u*2,font:`${i.fontStyle||"normal"} ${i.fontWeight||"normal"} ${c}px ${i.fontFamily||"Arial"}`,lineHeight:`${y}px`,letterSpacing:`${i.letterSpacing||0}px`,color:i.fill||"#000000",caretColor:i.fill||"#6a45d2",textAlign:i.textAlign||"left",textTransform:i.textTransform||"none",background:i.hasBackground?i.backgroundColor||"#ffffff":"transparent",transform:i.rotation?`rotate(${i.rotation}deg)`:void 0,transformOrigin:"center",zIndex:31}})})()]})})]}),!qt&&e.jsx("div",{className:"side-panels",children:lo})]}),e.jsxs("div",{className:"designer-footer",children:[e.jsxs("div",{className:"section-thumbnails",children:[e.jsxs("label",{className:"section-thumbnails-label",children:["Available sections for : ",e.jsx("u",{children:h.name})]}),e.jsx("div",{className:"thumbnails-container",children:h.sections.map(i=>{const t=Xt[i.sectionName]&&Xt[i.sectionName].elements&&Xt[i.sectionName].elements.length>0;return e.jsxs("div",{className:`section-thumbnail compact ${K.sectionName===i.sectionName?"active":""}`,onClick:a=>{a.stopPropagation();const c=h.sections.find(y=>y.sectionName===i.sectionName);io(c)},title:i.sectionName,children:[e.jsxs("div",{className:"thumbnail-image-container compact",children:[e.jsx("img",{src:i.sectionImage,alt:i.sectionName,className:"thumbnail-image compact",onError:a=>{a.target.style.display="none",a.target.nextSibling.style.display="flex"}}),e.jsx("div",{className:"thumbnail-placeholder compact",style:{display:"none"},children:e.jsx("span",{className:"placeholder-icon",children:"📐"})}),t&&e.jsx("div",{className:"content-indicator compact",children:e.jsx("svg",{className:"checkmark compact",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})})]}),e.jsx("span",{className:"thumbnail-label compact",children:i.sectionName})]},i.sectionName)})})]}),e.jsxs("div",{className:"zoom-controls-enhanced compact",children:[e.jsx("label",{className:"zoom-label",children:"Zoom:"}),e.jsxs("div",{className:"zoom-buttons-container compact",children:[e.jsx("button",{className:"zoom-button compact zoom-out",onClick:()=>Zt(Math.max(.25,gt-.25)),disabled:gt<=.25,title:"Zoom Out",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),e.jsxs("div",{className:"zoom-display compact",children:[e.jsxs("span",{className:"zoom-percentage compact",children:[Math.round(gt*100),"%"]}),e.jsx("div",{className:"zoom-slider-container compact",children:e.jsx("input",{type:"range",min:"0.25",max:"4",step:"0.25",value:gt,onChange:i=>Zt(parseFloat(i.target.value)),className:"zoom-slider compact"})})]}),e.jsx("button",{className:"zoom-button compact zoom-in",onClick:()=>Zt(Math.min(4,gt+.25)),disabled:gt>=4,title:"Zoom In",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"}),e.jsx("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),e.jsx("button",{className:"zoom-reset compact",onClick:()=>Zt(1),title:"Reset Zoom (100%)",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M3 3l18 18"}),e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]})})]})]})]}),qt&&ri&&e.jsx("div",{className:"mobile-panel-modal-overlay",onClick:()=>Se(!1),style:{position:"fixed",inset:0,zIndex:1e4,background:"rgba(15,23,42,0.5)",display:"flex",alignItems:"flex-end",justifyContent:"center"},children:e.jsxs("div",{className:"mobile-panel-modal",role:"dialog","aria-modal":"true","aria-label":"Edit design",onClick:i=>i.stopPropagation(),style:{background:"#ffffff",width:"100%",maxWidth:560,maxHeight:"85vh",borderTopLeftRadius:16,borderTopRightRadius:16,display:"flex",flexDirection:"column",boxShadow:"0 -8px 30px rgba(0,0,0,0.25)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #e2e8f0",borderTopLeftRadius:16,borderTopRightRadius:16,flex:"0 0 auto"},children:[e.jsx("span",{style:{fontSize:15,fontWeight:700,color:"#0f172a"},children:"Edit design"}),e.jsx("button",{type:"button","aria-label":"Close",onClick:()=>Se(!1),style:{width:32,height:32,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",fontSize:18,lineHeight:1,cursor:"pointer",color:"#334155"},children:"×"})]}),e.jsx("div",{style:{overflowY:"auto",WebkitOverflowScrolling:"touch",padding:12},children:lo})]})})]})});No.displayName="Mypixia";const Ja=g.forwardRef(function({idleTimeoutSeconds:o=120,onIdle:r,fitToContainer:n=!0,...l},d){const h=g.useRef(null),w=g.useRef(null);return g.useEffect(()=>{if(!r)return;const k=Math.max(30,o)*1e3,z=()=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>r(),k)};z();const N=h.current||window,T=["pointerdown","pointermove","touchstart","keydown"];return T.forEach(S=>N.addEventListener(S,z,{passive:!0})),()=>{w.current&&clearTimeout(w.current),T.forEach(S=>N.removeEventListener(S,z))}},[o,r]),e.jsxs("div",{ref:h,className:"mpx-kiosk-root",children:[e.jsx("style",{children:`
56
56
  .mpx-kiosk-root {
57
57
  /* Kiosk surfaces are touch-only: no text selection, no
58
58
  stray callouts, no browser pinch zoom fighting the canvas. */
@@ -71,4 +71,4 @@ React keys must be passed directly to JSX without using spread:
71
71
  min-height: 44px;
72
72
  font-size: 16px; /* prevents mobile zoom-on-focus */
73
73
  }
74
- `}),e.jsx(Co,{...n,ref:l,mode:"customize",readOnly:!1})]})});async function Za(s=document.documentElement){if(document.fullscreenElement)return!0;try{return await s.requestFullscreen({navigationUI:"hide"}),!0}catch{return!1}}exports.default=Ka;exports.enterKioskFullscreen=Za;
74
+ `}),e.jsx(No,{...l,ref:d,mode:"customize",readOnly:!1,fitToContainer:n})]})});async function tr(s=document.documentElement){if(document.fullscreenElement)return!0;try{return await s.requestFullscreen({navigationUI:"hide"}),!0}catch{return!1}}exports.default=Ja;exports.enterKioskFullscreen=tr;