entropretty-editor
Version:
Web Editor for Entropretty Scripts
67 lines • 62.5 kB
JavaScript
(function(X,M){typeof exports=="object"&&typeof module<"u"?M(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],M):(X=typeof globalThis<"u"?globalThis:X||self,M(X.Editor={},X.React))})(this,function(X,M){"use strict";function st(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const F=st(M);function at(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Se={exports:{}},pe={};/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var sr;function it(){if(sr)return pe;sr=1;var e=M,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function l(i,u,c){var f,h={},g=null,v=null;c!==void 0&&(g=""+c),u.key!==void 0&&(g=""+u.key),u.ref!==void 0&&(v=u.ref);for(f in u)o.call(u,f)&&!a.hasOwnProperty(f)&&(h[f]=u[f]);if(i&&i.defaultProps)for(f in u=i.defaultProps,u)h[f]===void 0&&(h[f]=u[f]);return{$$typeof:t,type:i,key:g,ref:v,props:h,_owner:s.current}}return pe.Fragment=r,pe.jsx=l,pe.jsxs=l,pe}var me={};/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var ar;function lt(){return ar||(ar=1,process.env.NODE_ENV!=="production"&&function(){var e=M,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),i=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen"),w=Symbol.iterator,p="@@iterator";function m(n){if(n===null||typeof n!="object")return null;var d=w&&n[w]||n[p];return typeof d=="function"?d:null}var x=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(n){{for(var d=arguments.length,y=new Array(d>1?d-1:0),S=1;S<d;S++)y[S-1]=arguments[S];R("error",n,y)}}function R(n,d,y){{var S=x.ReactDebugCurrentFrame,k=S.getStackAddendum();k!==""&&(d+="%s",y=y.concat([k]));var P=y.map(function(O){return String(O)});P.unshift("Warning: "+d),Function.prototype.apply.call(console[n],console,P)}}var D=!1,V=!1,I=!1,N=!1,Y=!1,ce;ce=Symbol.for("react.module.reference");function ve(n){return!!(typeof n=="string"||typeof n=="function"||n===o||n===a||Y||n===s||n===c||n===f||N||n===v||D||V||I||typeof n=="object"&&n!==null&&(n.$$typeof===g||n.$$typeof===h||n.$$typeof===l||n.$$typeof===i||n.$$typeof===u||n.$$typeof===ce||n.getModuleId!==void 0))}function ye(n,d,y){var S=n.displayName;if(S)return S;var k=d.displayName||d.name||"";return k!==""?y+"("+k+")":y}function j(n){return n.displayName||"Context"}function H(n){if(n==null)return null;if(typeof n.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case o:return"Fragment";case r:return"Portal";case a:return"Profiler";case s:return"StrictMode";case c:return"Suspense";case f:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case i:var d=n;return j(d)+".Consumer";case l:var y=n;return j(y._context)+".Provider";case u:return ye(n,n.render,"ForwardRef");case h:var S=n.displayName||null;return S!==null?S:H(n.type)||"Memo";case g:{var k=n,P=k._payload,O=k._init;try{return H(O(P))}catch{return null}}}return null}var B=Object.assign,ee=0,ne,we,ue,re,xe,$,Gr;function Br(){}Br.__reactDisabledLog=!0;function Ln(){{if(ee===0){ne=console.log,we=console.info,ue=console.warn,re=console.error,xe=console.group,$=console.groupCollapsed,Gr=console.groupEnd;var n={configurable:!0,enumerable:!0,value:Br,writable:!0};Object.defineProperties(console,{info:n,log:n,warn:n,error:n,group:n,groupCollapsed:n,groupEnd:n})}ee++}}function Nn(){{if(ee--,ee===0){var n={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:B({},n,{value:ne}),info:B({},n,{value:we}),warn:B({},n,{value:ue}),error:B({},n,{value:re}),group:B({},n,{value:xe}),groupCollapsed:B({},n,{value:$}),groupEnd:B({},n,{value:Gr})})}ee<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Xe=x.ReactCurrentDispatcher,Ze;function Ae(n,d,y){{if(Ze===void 0)try{throw Error()}catch(k){var S=k.stack.trim().match(/\n( *(at )?)/);Ze=S&&S[1]||""}return`
`+Ze+n}}var Qe=!1,Ie;{var Fn=typeof WeakMap=="function"?WeakMap:Map;Ie=new Fn}function $r(n,d){if(!n||Qe)return"";{var y=Ie.get(n);if(y!==void 0)return y}var S;Qe=!0;var k=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var P;P=Xe.current,Xe.current=null,Ln();try{if(d){var O=function(){throw Error()};if(Object.defineProperty(O.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(O,[])}catch(G){S=G}Reflect.construct(n,[],O)}else{try{O.call()}catch(G){S=G}n.call(O.prototype)}}else{try{throw Error()}catch(G){S=G}n()}}catch(G){if(G&&S&&typeof G.stack=="string"){for(var C=G.stack.split(`
`),W=S.stack.split(`
`),z=C.length-1,L=W.length-1;z>=1&&L>=0&&C[z]!==W[L];)L--;for(;z>=1&&L>=0;z--,L--)if(C[z]!==W[L]){if(z!==1||L!==1)do if(z--,L--,L<0||C[z]!==W[L]){var U=`
`+C[z].replace(" at new "," at ");return n.displayName&&U.includes("<anonymous>")&&(U=U.replace("<anonymous>",n.displayName)),typeof n=="function"&&Ie.set(n,U),U}while(z>=1&&L>=0);break}}}finally{Qe=!1,Xe.current=P,Nn(),Error.prepareStackTrace=k}var fe=n?n.displayName||n.name:"",oe=fe?Ae(fe):"";return typeof n=="function"&&Ie.set(n,oe),oe}function Wn(n,d,y){return $r(n,!1)}function Vn(n){var d=n.prototype;return!!(d&&d.isReactComponent)}function Me(n,d,y){if(n==null)return"";if(typeof n=="function")return $r(n,Vn(n));if(typeof n=="string")return Ae(n);switch(n){case c:return Ae("Suspense");case f:return Ae("SuspenseList")}if(typeof n=="object")switch(n.$$typeof){case u:return Wn(n.render);case h:return Me(n.type,d,y);case g:{var S=n,k=S._payload,P=S._init;try{return Me(P(k),d,y)}catch{}}}return""}var Ee=Object.prototype.hasOwnProperty,Ur={},Hr=x.ReactDebugCurrentFrame;function De(n){if(n){var d=n._owner,y=Me(n.type,n._source,d?d.type:null);Hr.setExtraStackFrame(y)}else Hr.setExtraStackFrame(null)}function Gn(n,d,y,S,k){{var P=Function.call.bind(Ee);for(var O in n)if(P(n,O)){var C=void 0;try{if(typeof n[O]!="function"){var W=Error((S||"React class")+": "+y+" type `"+O+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof n[O]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw W.name="Invariant Violation",W}C=n[O](d,O,S,y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(z){C=z}C&&!(C instanceof Error)&&(De(k),b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",S||"React class",y,O,typeof C),De(null)),C instanceof Error&&!(C.message in Ur)&&(Ur[C.message]=!0,De(k),b("Failed %s type: %s",y,C.message),De(null))}}}var Bn=Array.isArray;function er(n){return Bn(n)}function $n(n){{var d=typeof Symbol=="function"&&Symbol.toStringTag,y=d&&n[Symbol.toStringTag]||n.constructor.name||"Object";return y}}function Un(n){try{return Yr(n),!1}catch{return!0}}function Yr(n){return""+n}function Kr(n){if(Un(n))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",$n(n)),Yr(n)}var qr=x.ReactCurrentOwner,Hn={key:!0,ref:!0,__self:!0,__source:!0},Jr,Xr;function Yn(n){if(Ee.call(n,"ref")){var d=Object.getOwnPropertyDescriptor(n,"ref").get;if(d&&d.isReactWarning)return!1}return n.ref!==void 0}function Kn(n){if(Ee.call(n,"key")){var d=Object.getOwnPropertyDescriptor(n,"key").get;if(d&&d.isReactWarning)return!1}return n.key!==void 0}function qn(n,d){typeof n.ref=="string"&&qr.current}function Jn(n,d){{var y=function(){Jr||(Jr=!0,b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",d))};y.isReactWarning=!0,Object.defineProperty(n,"key",{get:y,configurable:!0})}}function Xn(n,d){{var y=function(){Xr||(Xr=!0,b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",d))};y.isReactWarning=!0,Object.defineProperty(n,"ref",{get:y,configurable:!0})}}var Zn=function(n,d,y,S,k,P,O){var C={$$typeof:t,type:n,key:d,ref:y,props:O,_owner:P};return C._store={},Object.defineProperty(C._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(C,"_self",{configurable:!1,enumerable:!1,writable:!1,value:S}),Object.defineProperty(C,"_source",{configurable:!1,enumerable:!1,writable:!1,value:k}),Object.freeze&&(Object.freeze(C.props),Object.freeze(C)),C};function Qn(n,d,y,S,k){{var P,O={},C=null,W=null;y!==void 0&&(Kr(y),C=""+y),Kn(d)&&(Kr(d.key),C=""+d.key),Yn(d)&&(W=d.ref,qn(d,k));for(P in d)Ee.call(d,P)&&!Hn.hasOwnProperty(P)&&(O[P]=d[P]);if(n&&n.defaultProps){var z=n.defaultProps;for(P in z)O[P]===void 0&&(O[P]=z[P])}if(C||W){var L=typeof n=="function"?n.displayName||n.name||"Unknown":n;C&&Jn(O,L),W&&Xn(O,L)}return Zn(n,C,W,k,S,qr.current,O)}}var rr=x.ReactCurrentOwner,Zr=x.ReactDebugCurrentFrame;function de(n){if(n){var d=n._owner,y=Me(n.type,n._source,d?d.type:null);Zr.setExtraStackFrame(y)}else Zr.setExtraStackFrame(null)}var tr;tr=!1;function nr(n){return typeof n=="object"&&n!==null&&n.$$typeof===t}function Qr(){{if(rr.current){var n=H(rr.current.type);if(n)return`
Check the render method of \``+n+"`."}return""}}function eo(n){return""}var et={};function ro(n){{var d=Qr();if(!d){var y=typeof n=="string"?n:n.displayName||n.name;y&&(d=`
Check the top-level render call using <`+y+">.")}return d}}function rt(n,d){{if(!n._store||n._store.validated||n.key!=null)return;n._store.validated=!0;var y=ro(d);if(et[y])return;et[y]=!0;var S="";n&&n._owner&&n._owner!==rr.current&&(S=" It was passed a child from "+H(n._owner.type)+"."),de(n),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',y,S),de(null)}}function tt(n,d){{if(typeof n!="object")return;if(er(n))for(var y=0;y<n.length;y++){var S=n[y];nr(S)&&rt(S,d)}else if(nr(n))n._store&&(n._store.validated=!0);else if(n){var k=m(n);if(typeof k=="function"&&k!==n.entries)for(var P=k.call(n),O;!(O=P.next()).done;)nr(O.value)&&rt(O.value,d)}}}function to(n){{var d=n.type;if(d==null||typeof d=="string")return;var y;if(typeof d=="function")y=d.propTypes;else if(typeof d=="object"&&(d.$$typeof===u||d.$$typeof===h))y=d.propTypes;else return;if(y){var S=H(d);Gn(y,n.props,"prop",S,n)}else if(d.PropTypes!==void 0&&!tr){tr=!0;var k=H(d);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",k||"Unknown")}typeof d.getDefaultProps=="function"&&!d.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function no(n){{for(var d=Object.keys(n.props),y=0;y<d.length;y++){var S=d[y];if(S!=="children"&&S!=="key"){de(n),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",S),de(null);break}}n.ref!==null&&(de(n),b("Invalid attribute `ref` supplied to `React.Fragment`."),de(null))}}var nt={};function ot(n,d,y,S,k,P){{var O=ve(n);if(!O){var C="";(n===void 0||typeof n=="object"&&n!==null&&Object.keys(n).length===0)&&(C+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var W=eo();W?C+=W:C+=Qr();var z;n===null?z="null":er(n)?z="array":n!==void 0&&n.$$typeof===t?(z="<"+(H(n.type)||"Unknown")+" />",C=" Did you accidentally export a JSX literal instead of a component?"):z=typeof n,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",z,C)}var L=Qn(n,d,y,k,P);if(L==null)return L;if(O){var U=d.children;if(U!==void 0)if(S)if(er(U)){for(var fe=0;fe<U.length;fe++)tt(U[fe],n);Object.freeze&&Object.freeze(U)}else b("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 tt(U,n)}if(Ee.call(d,"key")){var oe=H(n),G=Object.keys(d).filter(function(co){return co!=="key"}),or=G.length>0?"{key: someKey, "+G.join(": ..., ")+": ...}":"{key: someKey}";if(!nt[oe+or]){var lo=G.length>0?"{"+G.join(": ..., ")+": ...}":"{}";b(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,or,oe,lo,oe),nt[oe+or]=!0}}return n===o?no(L):to(L),L}}function oo(n,d,y){return ot(n,d,y,!0)}function so(n,d,y){return ot(n,d,y,!1)}var ao=so,io=oo;me.Fragment=o,me.jsx=ao,me.jsxs=io}()),me}var ir;function ct(){return ir||(ir=1,process.env.NODE_ENV==="production"?Se.exports=it():Se.exports=lt()),Se.exports}var E=ct();function lr(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ut(...e){return t=>{let r=!1;const o=e.map(s=>{const a=lr(s,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let s=0;s<o.length;s++){const a=o[s];typeof a=="function"?a():lr(e[s],null)}}}}var cr=F.forwardRef((e,t)=>{const{children:r,...o}=e,s=F.Children.toArray(r),a=s.find(ft);if(a){const l=a.props.children,i=s.map(u=>u===a?F.Children.count(l)>1?F.Children.only(null):F.isValidElement(l)?l.props.children:null:u);return E.jsx(ze,{...o,ref:t,children:F.isValidElement(l)?F.cloneElement(l,void 0,i):null})}return E.jsx(ze,{...o,ref:t,children:r})});cr.displayName="Slot";var ze=F.forwardRef((e,t)=>{const{children:r,...o}=e;if(F.isValidElement(r)){const s=mt(r),a=pt(o,r.props);return r.type!==F.Fragment&&(a.ref=t?ut(t,s):s),F.cloneElement(r,a)}return F.Children.count(r)>1?F.Children.only(null):null});ze.displayName="SlotClone";var dt=({children:e})=>E.jsx(E.Fragment,{children:e});function ft(e){return F.isValidElement(e)&&e.type===dt}function pt(e,t){const r={...t};for(const o in t){const s=e[o],a=t[o];/^on[A-Z]/.test(o)?s&&a?r[o]=(...i)=>{a(...i),s(...i)}:s&&(r[o]=s):o==="style"?r[o]={...s,...a}:o==="className"&&(r[o]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function mt(e){var o,s;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function ur(e){var t,r,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=ur(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function dr(){for(var e,t,r=0,o="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=ur(e))&&(o&&(o+=" "),o+=t);return o}const fr=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,pr=dr,gt=(e,t)=>r=>{var o;if((t==null?void 0:t.variants)==null)return pr(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:a}=t,l=Object.keys(s).map(c=>{const f=r==null?void 0:r[c],h=a==null?void 0:a[c];if(f===null)return null;const g=fr(f)||fr(h);return s[c][g]}),i=r&&Object.entries(r).reduce((c,f)=>{let[h,g]=f;return g===void 0||(c[h]=g),c},{}),u=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((c,f)=>{let{class:h,className:g,...v}=f;return Object.entries(v).every(w=>{let[p,m]=w;return Array.isArray(m)?m.includes({...a,...i}[p]):{...a,...i}[p]===m})?[...c,h,g]:c},[]);return pr(e,l,u,r==null?void 0:r.class,r==null?void 0:r.className)},Le="-",ht=e=>{const t=vt(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:l=>{const i=l.split(Le);return i[0]===""&&i.length!==1&&i.shift(),mr(i,t)||bt(l)},getConflictingClassGroupIds:(l,i)=>{const u=r[l]||[];return i&&o[l]?[...u,...o[l]]:u}}},mr=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const r=e[0],o=t.nextPart.get(r),s=o?mr(e.slice(1),o):void 0;if(s)return s;if(t.validators.length===0)return;const a=e.join(Le);return(l=t.validators.find(({validator:i})=>i(a)))==null?void 0:l.classGroupId},gr=/^\[(.+)\]$/,bt=e=>{if(gr.test(e)){const t=gr.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},vt=e=>{const{theme:t,prefix:r}=e,o={nextPart:new Map,validators:[]};return wt(Object.entries(e.classGroups),r).forEach(([a,l])=>{Ne(l,o,a,t)}),o},Ne=(e,t,r,o)=>{e.forEach(s=>{if(typeof s=="string"){const a=s===""?t:hr(t,s);a.classGroupId=r;return}if(typeof s=="function"){if(yt(s)){Ne(s(o),t,r,o);return}t.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([a,l])=>{Ne(l,hr(t,a),r,o)})})},hr=(e,t)=>{let r=e;return t.split(Le).forEach(o=>{r.nextPart.has(o)||r.nextPart.set(o,{nextPart:new Map,validators:[]}),r=r.nextPart.get(o)}),r},yt=e=>e.isThemeGetter,wt=(e,t)=>t?e.map(([r,o])=>{const s=o.map(a=>typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([l,i])=>[t+l,i])):a);return[r,s]}):e,xt=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,o=new Map;const s=(a,l)=>{r.set(a,l),t++,t>e&&(t=0,o=r,r=new Map)};return{get(a){let l=r.get(a);if(l!==void 0)return l;if((l=o.get(a))!==void 0)return s(a,l),l},set(a,l){r.has(a)?r.set(a,l):s(a,l)}}},br="!",Et=e=>{const{separator:t,experimentalParseClassName:r}=e,o=t.length===1,s=t[0],a=t.length,l=i=>{const u=[];let c=0,f=0,h;for(let m=0;m<i.length;m++){let x=i[m];if(c===0){if(x===s&&(o||i.slice(m,m+a)===t)){u.push(i.slice(f,m)),f=m+a;continue}if(x==="/"){h=m;continue}}x==="["?c++:x==="]"&&c--}const g=u.length===0?i:i.substring(f),v=g.startsWith(br),w=v?g.substring(1):g,p=h&&h>f?h-f:void 0;return{modifiers:u,hasImportantModifier:v,baseClassName:w,maybePostfixModifierPosition:p}};return r?i=>r({className:i,parseClassName:l}):l},St=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(o=>{o[0]==="["?(t.push(...r.sort(),o),r=[]):r.push(o)}),t.push(...r.sort()),t},_t=e=>({cache:xt(e.cacheSize),parseClassName:Et(e),...ht(e)}),Ct=/\s+/,Ot=(e,t)=>{const{parseClassName:r,getClassGroupId:o,getConflictingClassGroupIds:s}=t,a=[],l=e.trim().split(Ct);let i="";for(let u=l.length-1;u>=0;u-=1){const c=l[u],{modifiers:f,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:v}=r(c);let w=!!v,p=o(w?g.substring(0,v):g);if(!p){if(!w){i=c+(i.length>0?" "+i:i);continue}if(p=o(g),!p){i=c+(i.length>0?" "+i:i);continue}w=!1}const m=St(f).join(":"),x=h?m+br:m,b=x+p;if(a.includes(b))continue;a.push(b);const R=s(p,w);for(let D=0;D<R.length;++D){const V=R[D];a.push(x+V)}i=c+(i.length>0?" "+i:i)}return i};function Rt(){let e=0,t,r,o="";for(;e<arguments.length;)(t=arguments[e++])&&(r=vr(t))&&(o&&(o+=" "),o+=r);return o}const vr=e=>{if(typeof e=="string")return e;let t,r="";for(let o=0;o<e.length;o++)e[o]&&(t=vr(e[o]))&&(r&&(r+=" "),r+=t);return r};function kt(e,...t){let r,o,s,a=l;function l(u){const c=t.reduce((f,h)=>h(f),e());return r=_t(c),o=r.cache.get,s=r.cache.set,a=i,i(u)}function i(u){const c=o(u);if(c)return c;const f=Ot(u,r);return s(u,f),f}return function(){return a(Rt.apply(null,arguments))}}const A=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},yr=/^\[(?:([a-z-]+):)?(.+)\]$/i,jt=/^\d+\/\d+$/,Pt=new Set(["px","full","screen"]),Tt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,At=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,It=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Mt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Dt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,K=e=>se(e)||Pt.has(e)||jt.test(e),Z=e=>ae(e,"length",Bt),se=e=>!!e&&!Number.isNaN(Number(e)),Fe=e=>ae(e,"number",se),ge=e=>!!e&&Number.isInteger(Number(e)),zt=e=>e.endsWith("%")&&se(e.slice(0,-1)),_=e=>yr.test(e),Q=e=>Tt.test(e),Lt=new Set(["length","size","percentage"]),Nt=e=>ae(e,Lt,wr),Ft=e=>ae(e,"position",wr),Wt=new Set(["image","url"]),Vt=e=>ae(e,Wt,Ut),Gt=e=>ae(e,"",$t),he=()=>!0,ae=(e,t,r)=>{const o=yr.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):r(o[2]):!1},Bt=e=>At.test(e)&&!It.test(e),wr=()=>!1,$t=e=>Mt.test(e),Ut=e=>Dt.test(e),Ht=kt(()=>{const e=A("colors"),t=A("spacing"),r=A("blur"),o=A("brightness"),s=A("borderColor"),a=A("borderRadius"),l=A("borderSpacing"),i=A("borderWidth"),u=A("contrast"),c=A("grayscale"),f=A("hueRotate"),h=A("invert"),g=A("gap"),v=A("gradientColorStops"),w=A("gradientColorStopPositions"),p=A("inset"),m=A("margin"),x=A("opacity"),b=A("padding"),R=A("saturate"),D=A("scale"),V=A("sepia"),I=A("skew"),N=A("space"),Y=A("translate"),ce=()=>["auto","contain","none"],ve=()=>["auto","hidden","clip","visible","scroll"],ye=()=>["auto",_,t],j=()=>[_,t],H=()=>["",K,Z],B=()=>["auto",se,_],ee=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ne=()=>["solid","dashed","dotted","double","none"],we=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>["start","end","center","between","around","evenly","stretch"],re=()=>["","0",_],xe=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>[se,_];return{cacheSize:500,separator:":",theme:{colors:[he],spacing:[K,Z],blur:["none","",Q,_],brightness:$(),borderColor:[e],borderRadius:["none","","full",Q,_],borderSpacing:j(),borderWidth:H(),contrast:$(),grayscale:re(),hueRotate:$(),invert:re(),gap:j(),gradientColorStops:[e],gradientColorStopPositions:[zt,Z],inset:ye(),margin:ye(),opacity:$(),padding:j(),saturate:$(),scale:$(),sepia:re(),skew:$(),space:j(),translate:j()},classGroups:{aspect:[{aspect:["auto","square","video",_]}],container:["container"],columns:[{columns:[Q]}],"break-after":[{"break-after":xe()}],"break-before":[{"break-before":xe()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...ee(),_]}],overflow:[{overflow:ve()}],"overflow-x":[{"overflow-x":ve()}],"overflow-y":[{"overflow-y":ve()}],overscroll:[{overscroll:ce()}],"overscroll-x":[{"overscroll-x":ce()}],"overscroll-y":[{"overscroll-y":ce()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ge,_]}],basis:[{basis:ye()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",_]}],grow:[{grow:re()}],shrink:[{shrink:re()}],order:[{order:["first","last","none",ge,_]}],"grid-cols":[{"grid-cols":[he]}],"col-start-end":[{col:["auto",{span:["full",ge,_]},_]}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":[he]}],"row-start-end":[{row:["auto",{span:[ge,_]},_]}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",_]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",_]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...ue()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ue(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ue(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[m]}],mx:[{mx:[m]}],my:[{my:[m]}],ms:[{ms:[m]}],me:[{me:[m]}],mt:[{mt:[m]}],mr:[{mr:[m]}],mb:[{mb:[m]}],ml:[{ml:[m]}],"space-x":[{"space-x":[N]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[N]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",_,t]}],"min-w":[{"min-w":[_,t,"min","max","fit"]}],"max-w":[{"max-w":[_,t,"none","full","min","max","fit","prose",{screen:[Q]},Q]}],h:[{h:[_,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[_,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[_,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[_,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Q,Z]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Fe]}],"font-family":[{font:[he]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",_]}],"line-clamp":[{"line-clamp":["none",se,Fe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",K,_]}],"list-image":[{"list-image":["none",_]}],"list-style-type":[{list:["none","disc","decimal",_]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ne(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",K,Z]}],"underline-offset":[{"underline-offset":["auto",K,_]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",_]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",_]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ee(),Ft]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Nt]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Vt]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-b":[{"border-b":[i]}],"border-w-l":[{"border-l":[i]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[...ne(),"hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:ne()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...ne()]}],"outline-offset":[{"outline-offset":[K,_]}],"outline-w":[{outline:[K,Z]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[K,Z]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Q,Gt]}],"shadow-color":[{shadow:[he]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...we(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":we()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[o]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Q,_]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[h]}],saturate:[{saturate:[R]}],sepia:[{sepia:[V]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[R]}],"backdrop-sepia":[{"backdrop-sepia":[V]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",_]}],duration:[{duration:$()}],ease:[{ease:["linear","in","out","in-out",_]}],delay:[{delay:$()}],animate:[{animate:["none","spin","ping","pulse","bounce",_]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[D]}],"scale-x":[{"scale-x":[D]}],"scale-y":[{"scale-y":[D]}],rotate:[{rotate:[ge,_]}],"translate-x":[{"translate-x":[Y]}],"translate-y":[{"translate-y":[Y]}],"skew-x":[{"skew-x":[I]}],"skew-y":[{"skew-y":[I]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",_]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",_]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",_]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[K,Z,Fe]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function q(...e){return Ht(dr(e))}const Yt=gt("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),J=F.forwardRef(({className:e,variant:t,size:r,asChild:o=!1,...s},a)=>{const l=o?cr:"button";return E.jsx(l,{className:q(Yt({variant:t,size:r,className:e})),ref:a,...s})});J.displayName="Button";/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/const xr=Symbol("Comlink.proxy"),Kt=Symbol("Comlink.endpoint"),qt=Symbol("Comlink.releaseProxy"),We=Symbol("Comlink.finalizer"),_e=Symbol("Comlink.thrown"),Er=e=>typeof e=="object"&&e!==null||typeof e=="function",Jt={canHandle:e=>Er(e)&&e[xr],serialize(e){const{port1:t,port2:r}=new MessageChannel;return _r(e,t),[r,[r]]},deserialize(e){return e.start(),Or(e)}},Xt={canHandle:e=>Er(e)&&_e in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},Sr=new Map([["proxy",Jt],["throw",Xt]]);function Zt(e,t){for(const r of e)if(t===r||r==="*"||r instanceof RegExp&&r.test(t))return!0;return!1}function _r(e,t=globalThis,r=["*"]){t.addEventListener("message",function o(s){if(!s||!s.data)return;if(!Zt(r,s.origin)){console.warn(`Invalid origin '${s.origin}' for comlink proxy`);return}const{id:a,type:l,path:i}=Object.assign({path:[]},s.data),u=(s.data.argumentList||[]).map(te);let c;try{const f=i.slice(0,-1).reduce((g,v)=>g[v],e),h=i.reduce((g,v)=>g[v],e);switch(l){case"GET":c=h;break;case"SET":f[i.slice(-1)[0]]=te(s.data.value),c=!0;break;case"APPLY":c=h.apply(f,u);break;case"CONSTRUCT":{const g=new h(...u);c=nn(g)}break;case"ENDPOINT":{const{port1:g,port2:v}=new MessageChannel;_r(e,v),c=Pr(g,[g])}break;case"RELEASE":c=void 0;break;default:return}}catch(f){c={value:f,[_e]:0}}Promise.resolve(c).catch(f=>({value:f,[_e]:0})).then(f=>{const[h,g]=ke(f);t.postMessage(Object.assign(Object.assign({},h),{id:a}),g),l==="RELEASE"&&(t.removeEventListener("message",o),Cr(t),We in e&&typeof e[We]=="function"&&e[We]())}).catch(f=>{const[h,g]=ke({value:new TypeError("Unserializable return value"),[_e]:0});t.postMessage(Object.assign(Object.assign({},h),{id:a}),g)})}),t.start&&t.start()}function Qt(e){return e.constructor.name==="MessagePort"}function Cr(e){Qt(e)&&e.close()}function Or(e,t){const r=new Map;return e.addEventListener("message",function(s){const{data:a}=s;if(!a||!a.id)return;const l=r.get(a.id);if(l)try{l(a)}finally{r.delete(a.id)}}),Ve(e,r,[],t)}function Ce(e){if(e)throw new Error("Proxy has been released and is not useable")}function Rr(e){return ie(e,new Map,{type:"RELEASE"}).then(()=>{Cr(e)})}const Oe=new WeakMap,Re="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(Oe.get(e)||0)-1;Oe.set(e,t),t===0&&Rr(e)});function en(e,t){const r=(Oe.get(t)||0)+1;Oe.set(t,r),Re&&Re.register(e,t,e)}function rn(e){Re&&Re.unregister(e)}function Ve(e,t,r=[],o=function(){}){let s=!1;const a=new Proxy(o,{get(l,i){if(Ce(s),i===qt)return()=>{rn(a),Rr(e),t.clear(),s=!0};if(i==="then"){if(r.length===0)return{then:()=>a};const u=ie(e,t,{type:"GET",path:r.map(c=>c.toString())}).then(te);return u.then.bind(u)}return Ve(e,t,[...r,i])},set(l,i,u){Ce(s);const[c,f]=ke(u);return ie(e,t,{type:"SET",path:[...r,i].map(h=>h.toString()),value:c},f).then(te)},apply(l,i,u){Ce(s);const c=r[r.length-1];if(c===Kt)return ie(e,t,{type:"ENDPOINT"}).then(te);if(c==="bind")return Ve(e,t,r.slice(0,-1));const[f,h]=kr(u);return ie(e,t,{type:"APPLY",path:r.map(g=>g.toString()),argumentList:f},h).then(te)},construct(l,i){Ce(s);const[u,c]=kr(i);return ie(e,t,{type:"CONSTRUCT",path:r.map(f=>f.toString()),argumentList:u},c).then(te)}});return en(a,e),a}function tn(e){return Array.prototype.concat.apply([],e)}function kr(e){const t=e.map(ke);return[t.map(r=>r[0]),tn(t.map(r=>r[1]))]}const jr=new WeakMap;function Pr(e,t){return jr.set(e,t),e}function nn(e){return Object.assign(e,{[xr]:!0})}function ke(e){for(const[t,r]of Sr)if(r.canHandle(e)){const[o,s]=r.serialize(e);return[{type:"HANDLER",name:t,value:o},s]}return[{type:"RAW",value:e},jr.get(e)||[]]}function te(e){switch(e.type){case"HANDLER":return Sr.get(e.name).deserialize(e.value);case"RAW":return e.value}}function ie(e,t,r,o){return new Promise(s=>{const a=on();t.set(a,s),e.start&&e.start(),e.postMessage(Object.assign({id:a},r),o)})}function on(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var Ge=cn(1,2,3,4);function sn(e){return{Procedural:Be(4,Ge),ProceduralPersonal:Uint8Array.from([0,0,0,0,0,0,0,...Be(1,Ge)]),ProceduralAccount:Be(32,Ge)}[e]}function je(e){return Array.from(e).join(",")}function le(e,t=16){const r=sn(e);return ln(r,{size:t})}function an(e,t={minBits:1,maxBits:3}){if(t.minBits>t.maxBits)throw new Error("minBits must be less than maxBits");if(t.minBits<1)throw new Error("minBits must be greater than 0");if(t.maxBits<1)throw new Error("maxBits must be greater than 0");const r=Array.from(e);if(e.length===8){const a=r.slice(-4);Tr(Math.max(Math.floor(Math.random()*t.maxBits),t.minBits))(a),r.splice(-4,4,...a)}else Tr(Math.floor(Math.random()*3)+1)(r);return r}function ln(e,t){const r=new Map;for(r.set(je(e),Array.from(e));r.size<t.size;){const o=an(e),s=je(o);r.has(s)||r.set(s,o)}return[...r.values()]}function Be(e,t){const r=new Uint8Array(e);for(let o=0;o<e;o++)r[o]=Math.floor(t()*255);return r}function cn(e,t,r,o){return function(){e|=0,t|=0,r|=0,o|=0;const s=(e+t|0)+o|0;return o=o+1|0,e=t^t>>>9,t=r+(r<<3)|0,r=r<<21|r>>>11,r=r+s|0,(s>>>0)/4294967296}}function Tr(e){return t=>{for(let r=0;r<e;++r){const o=2**Math.floor(Math.random()*8),s=Math.floor(Math.random()*4);t[s]^=o}}}const un={},Ar=e=>{let t;const r=new Set,o=(f,h)=>{const g=typeof f=="function"?f(t):f;if(!Object.is(g,t)){const v=t;t=h??(typeof g!="object"||g===null)?g:Object.assign({},t,g),r.forEach(w=>w(t,v))}},s=()=>t,u={setState:o,getState:s,getInitialState:()=>c,subscribe:f=>(r.add(f),()=>r.delete(f)),destroy:()=>{(un?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},c=t=e(o,s,u);return u},dn=e=>e?Ar(e):Ar;var Pe={exports:{}},$e={},Te={exports:{}},Ue={};/**
* @license React
* use-sync-external-store-shim.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Ir;function fn(){if(Ir)return Ue;Ir=1;var e=M;function t(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var r=typeof Object.is=="function"?Object.is:t,o=e.useState,s=e.useEffect,a=e.useLayoutEffect,l=e.useDebugValue;function i(h,g){var v=g(),w=o({inst:{value:v,getSnapshot:g}}),p=w[0].inst,m=w[1];return a(function(){p.value=v,p.getSnapshot=g,u(p)&&m({inst:p})},[h,v,g]),s(function(){return u(p)&&m({inst:p}),h(function(){u(p)&&m({inst:p})})},[h]),l(v),v}function u(h){var g=h.getSnapshot;h=h.value;try{var v=g();return!r(h,v)}catch{return!0}}function c(h,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:i;return Ue.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Ue}var He={};/**
* @license React
* use-sync-external-store-shim.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Mr;function pn(){return Mr||(Mr=1,process.env.NODE_ENV!=="production"&&function(){function e(v,w){return v===w&&(v!==0||1/v===1/w)||v!==v&&w!==w}function t(v,w){f||s.startTransition===void 0||(f=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var p=w();if(!h){var m=w();a(p,m)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),h=!0)}m=l({inst:{value:p,getSnapshot:w}});var x=m[0].inst,b=m[1];return u(function(){x.value=p,x.getSnapshot=w,r(x)&&b({inst:x})},[v,p,w]),i(function(){return r(x)&&b({inst:x}),v(function(){r(x)&&b({inst:x})})},[v]),c(p),p}function r(v){var w=v.getSnapshot;v=v.value;try{var p=w();return!a(v,p)}catch{return!0}}function o(v,w){return w()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=M,a=typeof Object.is=="function"?Object.is:e,l=s.useState,i=s.useEffect,u=s.useLayoutEffect,c=s.useDebugValue,f=!1,h=!1,g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?o:t;He.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:g,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),He}var Dr;function zr(){return Dr||(Dr=1,process.env.NODE_ENV==="production"?Te.exports=fn():Te.exports=pn()),Te.exports}/**
* @license React
* use-sync-external-store-shim/with-selector.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Lr;function mn(){if(Lr)return $e;Lr=1;var e=M,t=zr();function r(c,f){return c===f&&(c!==0||1/c===1/f)||c!==c&&f!==f}var o=typeof Object.is=="function"?Object.is:r,s=t.useSyncExternalStore,a=e.useRef,l=e.useEffect,i=e.useMemo,u=e.useDebugValue;return $e.useSyncExternalStoreWithSelector=function(c,f,h,g,v){var w=a(null);if(w.current===null){var p={hasValue:!1,value:null};w.current=p}else p=w.current;w=i(function(){function x(I){if(!b){if(b=!0,R=I,I=g(I),v!==void 0&&p.hasValue){var N=p.value;if(v(N,I))return D=N}return D=I}if(N=D,o(R,I))return N;var Y=g(I);return v!==void 0&&v(N,Y)?(R=I,N):(R=I,D=Y)}var b=!1,R,D,V=h===void 0?null:h;return[function(){return x(f())},V===null?void 0:function(){return x(V())}]},[f,h,g,v]);var m=s(c,w[0],w[1]);return l(function(){p.hasValue=!0,p.value=m},[m]),u(m),m},$e}var Ye={};/**
* @license React
* use-sync-external-store-shim/with-selector.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Nr;function gn(){return Nr||(Nr=1,process.env.NODE_ENV!=="production"&&function(){function e(c,f){return c===f&&(c!==0||1/c===1/f)||c!==c&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=M,r=zr(),o=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,a=t.useRef,l=t.useEffect,i=t.useMemo,u=t.useDebugValue;Ye.useSyncExternalStoreWithSelector=function(c,f,h,g,v){var w=a(null);if(w.current===null){var p={hasValue:!1,value:null};w.current=p}else p=w.current;w=i(function(){function x(I){if(!b){if(b=!0,R=I,I=g(I),v!==void 0&&p.hasValue){var N=p.value;if(v(N,I))return D=N}return D=I}if(N=D,o(R,I))return N;var Y=g(I);return v!==void 0&&v(N,Y)?(R=I,N):(R=I,D=Y)}var b=!1,R,D,V=h===void 0?null:h;return[function(){return x(f())},V===null?void 0:function(){return x(V())}]},[f,h,g,v]);var m=s(c,w[0],w[1]);return l(function(){p.hasValue=!0,p.value=m},[m]),u(m),m},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Ye}var Fr;function hn(){return Fr||(Fr=1,process.env.NODE_ENV==="production"?Pe.exports=mn():Pe.exports=gn()),Pe.exports}var bn=hn();const vn=at(bn),Wr={},{useDebugValue:yn}=M,{useSyncExternalStoreWithSelector:wn}=vn;let Vr=!1;const xn=e=>e;function En(e,t=xn,r){(Wr?"production":void 0)!=="production"&&r&&!Vr&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Vr=!0);const o=wn(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return yn(o),o}const Sn=e=>{(Wr?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?dn(e):e,r=(o,s)=>En(t,o,s);return Object.assign(r,t),r},_n=e=>Sn,Cn={};function On(e,t){let r;try{r=e()}catch{return}return{getItem:s=>{var a;const l=u=>u===null?null:JSON.parse(u,void 0),i=(a=r.getItem(s))!=null?a:null;return i instanceof Promise?i.then(l):l(i)},setItem:(s,a)=>r.setItem(s,JSON.stringify(a,void 0)),removeItem:s=>r.removeItem(s)}}const be=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(o){return be(o)(r)},catch(o){return this}}}catch(r){return{then(o){return this},catch(o){return be(o)(r)}}}},Rn=(e,t)=>(r,o,s)=>{let a={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:m=>m,version:0,merge:(m,x)=>({...x,...m}),...t},l=!1;const i=new Set,u=new Set;let c;try{c=a.getStorage()}catch{}if(!c)return e((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),r(...m)},o,s);const f=be(a.serialize),h=()=>{const m=a.partialize({...o()});let x;const b=f({state:m,version:a.version}).then(R=>c.setItem(a.name,R)).catch(R=>{x=R});if(x)throw x;return b},g=s.setState;s.setState=(m,x)=>{g(m,x),h()};const v=e((...m)=>{r(...m),h()},o,s);let w;const p=()=>{var m;if(!c)return;l=!1,i.forEach(b=>b(o()));const x=((m=a.onRehydrateStorage)==null?void 0:m.call(a,o()))||void 0;return be(c.getItem.bind(c))(a.name).then(b=>{if(b)return a.deserialize(b)}).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==a.version){if(a.migrate)return a.migrate(b.state,b.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return b.state}).then(b=>{var R;return w=a.merge(b,(R=o())!=null?R:v),r(w,!0),h()}).then(()=>{x==null||x(w,void 0),l=!0,u.forEach(b=>b(w))}).catch(b=>{x==null||x(void 0,b)})};return s.persist={setOptions:m=>{a={...a,...m},m.getStorage&&(c=m.getStorage())},clearStorage:()=>{c==null||c.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>p(),hasHydrated:()=>l,onHydrate:m=>(i.add(m),()=>{i.delete(m)}),onFinishHydration:m=>(u.add(m),()=>{u.delete(m)})},p(),w||v},kn=(e,t)=>(r,o,s)=>{let a={storage:On(()=>localStorage),partialize:p=>p,version:0,merge:(p,m)=>({...m,...p}),...t},l=!1;const i=new Set,u=new Set;let c=a.storage;if(!c)return e((...p)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),r(...p)},o,s);const f=()=>{const p=a.partialize({...o()});return c.setItem(a.name,{state:p,version:a.version})},h=s.setState;s.setState=(p,m)=>{h(p,m),f()};const g=e((...p)=>{r(...p),f()},o,s);s.getInitialState=()=>g;let v;const w=()=>{var p,m;if(!c)return;l=!1,i.forEach(b=>{var R;return b((R=o())!=null?R:g)});const x=((m=a.onRehydrateStorage)==null?void 0:m.call(a,(p=o())!=null?p:g))||void 0;return be(c.getItem.bind(c))(a.name).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==a.version){if(a.migrate)return[!0,a.migrate(b.state,b.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,b.state];return[!1,void 0]}).then(b=>{var R;const[D,V]=b;if(v=a.merge(V,(R=o())!=null?R:g),r(v,!0),D)return f()}).then(()=>{x==null||x(v,void 0),v=o(),l=!0,u.forEach(b=>b(v))}).catch(b=>{x==null||x(void 0,b)})};return s.persist={setOptions:p=>{a={...a,...p},p.storage&&(c=p.storage)},clearStorage:()=>{c==null||c.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>w(),hasHydrated:()=>l,onHydrate:p=>(i.add(p),()=>{i.delete(p)}),onFinishHydration:p=>(u.add(p),()=>{u.delete(p)})},a.skipHydration||w(),v||g},jn=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((Cn?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Rn(e,t)):kn(e,t),Ke=["horizontal","vertical","grid","single","families"],T=_n()(jn((e,t)=>{const r=Array(8).fill(1),o={Procedural:r.map(()=>le("Procedural")),ProceduralPersonal:r.map(()=>le("ProceduralPersonal")),ProceduralAccount:r.map(()=>le("ProceduralAccount"))};return{worker:null,schema:null,schemas:[],showControls:!0,seeds:o,showDetails:!1,focus:[0,0],familyIndex:0,focusIndex:0,toggleDetails(){e({showDetails:!t().showDetails})},setFocus(s,a){e({familyIndex:s,focusIndex:a})},refreshSeeds(){e({seeds:{Procedural:r.map(()=>le("Procedural")),ProceduralPersonal:r.map(()=>le("ProceduralPersonal")),ProceduralAccount:r.map(()=>le("ProceduralAccount"))}})},toggleControls(){e({showControls:!t().showControls})},async init(s){const a=Or(s),l=await a.init();if(l.length===0)throw new Error("No schemas found");const i=t().schema;i&&l.find(u=>u.name===i.name)?e({schema:i}):e({schema:l[0]}),e({worker:a,schemas:l})},setSchema(s){const a=t().schemas.find(l=>l.name===s);e({schema:a})},mode:"horizontal",cycleMode(){const s=t().mode,l=(Ke.indexOf(s)+1)%Ke.length;e({mode:Ke[l]})}}},{name:"entropretty-editor-state",partialize:e=>({mode:e.mode,showControls:e.showControls,schema:e.schema,showDetails:e.showDetails,focusIndex:e.focusIndex,familyIndex:e.familyIndex})})),Pn=()=>{const e=T(u=>u.cycleMode),t=T(u=>u.mode),r=T(u=>u.schema),o=T(u=>u.showControls),s=T(u=>u.toggleControls),a=T(u=>u.refreshSeeds),l=T(u=>u.toggleDetails),i=M.useCallback(()=>{const u=document.getElementById("focus-canvas");if(!u)return;const c=document.createElement("a");c.href=u.toDataURL("image/png"),c.download=((r==null?void 0:r.name)||"entropretty")+".png",c.click()},[r==null?void 0:r.name]);return M.useEffect(()=>{const u=c=>{c.key==="q"&&e(),c.key==="w"&&s(),c.key==="r"&&location.reload(),c.key==="d"&&l()};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},[e,s,l]),r?E.jsxs(E.Fragment,{children:[E.jsxs("nav",{className:q("bg-background/95 supports-[backdrop-filter]:bg-background/30 fixed bottom-4 left-4 flex flex-row items-center justify-center overflow-hidden rounded-md border text-sm backdrop-blur transition-all duration-300 ease-in-out",{hidden:!o}),children:[E.jsx("div",{className:q("flex h-10 w-fit flex-row items-center justify-center rounded-r-md px-4",{"bg-yellow-400":r.kind==="Procedural","bg-blue-400":r.kind==="ProceduralAccount","bg-red-400":r.kind==="ProceduralPersonal"}),children:r==null?void 0:r.kind}),E.jsxs("div",{className:"flex flex-row px-[2px]",children:[E.jsx(J,{variant:"ghost",className:"w-36",onClick:e,children:`(q) ${t}`}),E.jsx(J,{variant:"ghost",onClick:s,children:"(w) hide"}),E.jsx(J,{variant:"ghost",children:"(r) reload"}),E.jsx(J,{variant:"ghost",onMouseDown:l,children:"(d) details"}),E.jsx(J,{variant:"ghost",onMouseDown:a,children:"new seeds"}),E.jsx(J,{disabled:["families","grid"].includes(t),variant:"ghost",onMouseDown:i,children:"download"})]})]}),!o&&E.jsx(J,{variant:"ghost",onMouseDown:s,className:"text-muted-foreground fixed bottom-4 left-4 h-10 text-sm",children:"show"})]}):null},qe=({seed:e,schema:t,size:r,scale:o=2,id:s})=>{const[a,l]=M.useState(!1),i=M.useRef(null),u=T(f=>f.worker),c=M.useMemo(()=>r*o,[r,o]);return M.useEffect(()=>{i.current!==null&&u.drawTransfer(t,e,c).then(f=>{const h=i.current.getContext("2d");h.clearRect(0,0,c,c),h.drawImage(f,0,0,c,c),l(!0)})},[e,t,r,u,c]),E.jsx("canvas",{id:s,className:q("cursor-pointer",{hidden:!a}),ref:i,width:c,height:c,style:{width:r,height:r}})},Je=({familyIndex:e,seedIndex:t,seed:r})=>{const[o,s]=T(c=>[c.familyIndex,c.focusIndex]),a=T(c=>c.schema),l=T(c=>c.setFocus),i=T(c=>c.showDetails),u=M.useCallback(()=>{l(e,t)},[e,t,l]);return E.jsxs(E.Fragment,{children:[i&&E.jsxs("div",{className:"bg-background/50 absolute bottom-0 left-0 flex h-full w-full whitespace-normal border text-[9px]",children:["[",r.join(", "),"]"]}),i&&E.jsx("div",{className:"absolute left-0 top-0 flex h-full w-full items-center justify-center",children:"×"}),E.jsx("div",{title:r.join(","),className:q("absolute bottom-0 h-full w-full cursor-pointer border-b-4",{"opacity-0":e!==o||t!==s,"border-b-yellow-400":(a==null?void 0:a.kind)==="Procedural","border-b-blue-400":(a==null?void 0:a.kind)==="ProceduralAccount","border-b-red-400":(a==null?void 0:a.kind)==="ProceduralPersonal"}),onClick:u})]})},Tn=({familyIndex:e})=>{const[t]=T(o=>[o.familyIndex]),r=T(o=>o.schema);return E.jsx(E.Fragment,{children:E.jsx("div",{className:q("pointer-events-none absolute h-full w-full rounded-md border",{"opacity-0":e!==t,"border-yellow-400":(r==null?void 0:r.kind)==="Procedural","border-blue-400":(r==null?void 0:r.kind)==="ProceduralAccount","border-red-400":(r==null?void 0:r.kind)==="ProceduralPersonal"})})})};function An({schema:e}){const t=T(l=>l.seeds[e.kind]),[r]=T(l=>[l.familyIndex]),o=T(l=>l.mode),[s,a]=M.useMemo(()=>{const l=window.innerWidth||1e3,i=window.innerHeight||1e3,u={horizontal:l/2,vertical:i/2,grid:0,single:i<l?i:l,families:0}[o],c={horizontal:l/8,vertical:i/8,grid:i<l?i/4:l/4,single:0,families:l/16}[o];return[u,c]},[o]);return E.jsxs("div",{className:"flex flex-col",children:[t&&o==="families"&&t.map((l,i)=>E.jsx("div",{children:E.jsxs("div",{className:"grid-cols-16 relative grid",children:[l.map((u,c)=>E.jsxs("div",{className:"relative overflow-hidden",children:[E.jsx(qe,{schema:e.name,seed:u,size:a}),E.jsx(Je,{familyIndex:i,seedIndex:c,seed:u})]},je(u))),E.jsx(Tn,{familyIndex:i})]})},l.toString())),t&&o!=="families"&&E.jsxs("div",{className:q("flex items-start justify-start",{"flex-row":o==="horizontal","flex-col":o==="vertical"}),children:[E.jsx(In,{schema:e,size:s}),o!=="single"&&E.jsx("div",{className:"grid grid-cols-4",children:t[r].map((l,i)=>E.jsxs("div",{className:"relative",children:[E.jsx(qe,{schema:e.name,seed:l,size:a}),E.jsx(Je,{familyIndex:r,seedIndex:i,seed:l})]},je(l)))})]})]})}function In({schema:e,size:t}){const r=T(a=>a.seeds[e.kind]),[o,s]=T(a=>[a.familyIndex,a.focusIndex]);return E.jsxs("div",{className:"relative overflow-hidden",children:[E.jsx(qe,{id:"focus-canvas",schema:e.name,seed:r[o][s],size:t}),E.jsx(Je,{familyIndex:o,seedIndex:s,seed:r[o][s]})]})}const Mn=()=>{const e=T(s=>s.schemas),t=T(s=>s.schema),r=T(s=>s.setSchema),o=T(s=>s.showControls);return E.jsx("aside",{className:q("bg-background/95 supports-[backdrop-filter]:bg-background/30 fixed left-4 top-4 flex h-10 flex-row items-center justify-center rounded-md border backdrop-blur transition-all duration-300 ease-in-out",{hidden:!o||e.length<=1}),children:e.map(s=>E.jsx(J,{className:q({underline:(t==null?void 0:t.name)===s.name}),variant:(t==null?void 0:t.name)===s.name?"link":"ghost",onClick:()=>r(s.name),children:`${s.name}`},s.name))})},Dn=({worker:e})=>{const t=T(s=>s.init),r=T(s=>s.worker),o=T(s=>s.schema);return M.useEffect(()=>{t(e)},[t,e]),r?E.jsxs("main",{className:"flex h-screen w-screen flex-col items-center justify-center",children:[o&&E.jsx(An,{schema:o}),E.jsx(Pn,{}),E.jsx(Mn,{})]}):(console.info("Worker not set"),E.jsx("div",{children:"Loading..."}))},zn=e=>{const t=new Map;let r=!1;return{init:async()=>{const o=[];return await Promise.all(Object.values(e).map(async s=>{try{const l=(await s()).schema;t.set(l.name,l);const{draw:i,...u}=l;u.kind===void 0&&(console.warn(`Schema kind for '${u.name}' not defined, defaulting to 'Procedural'`),u.kind="Procedural"),o.push(u)}catch(a){console.log({e:a})}})),r=!0,Array.from(o).sort((s,a)=>s.name.localeCompare(a.name))},isInitialized:()=>r,hasSchema:o=>t.has(o),drawTransfer:async(o,s,a)=>{const l=new OffscreenCanvas(a,a),i=l.getContext("2d");if(!i)throw"Unable to get Context from OffscreenCanvas in Worker";const u=t.get(o);if(u===void 0)throw"Schema not loaded, try adding it before drawing";i.clearRect(0,0,l.width,l.height),i.scale(l.width/100,l.width/100),i.lineWidth=1,i.lineCap="butt",i.lineJoin="miter",i.strokeStyle="black",i.fillStyle="black",i.textAlign="center",i.textBaseline="bottom";try{u.draw(i,s)}catch(f){console.error("Error drawing",o),console.info(f)}const c=l.transferToImageBitmap();return Pr(c,[c])}}};X.EntroprettyEditor=Dn,X.createWorker=zn,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})});